64228 lines
2.2 MiB
Plaintext
64228 lines
2.2 MiB
Plaintext
var $wnd = $wnd || window.parent;
|
|
var __gwtModuleFunction = $wnd.circuitjs1;
|
|
var $sendStats = __gwtModuleFunction.__sendStats;
|
|
$sendStats('moduleStartup', 'moduleEvalStart');
|
|
var $gwt_version = "2.8.2";
|
|
var $strongName = 'D4B0A4D2B21470577B4DC7B4A8A76F45';
|
|
var $gwt = {};
|
|
var $doc = $wnd.document;
|
|
var $moduleName, $moduleBase;
|
|
function __gwtStartLoadingFragment(frag) {
|
|
var fragFile = 'deferredjs/' + $strongName + '/' + frag + '.cache.js';
|
|
return __gwtModuleFunction.__startLoadingFragment(fragFile);
|
|
}
|
|
function __gwtInstallCode(code) {return __gwtModuleFunction.__installRunAsyncCode(code);}
|
|
function __gwt_isKnownPropertyValue(propName, propValue) {
|
|
return __gwtModuleFunction.__gwt_isKnownPropertyValue(propName, propValue);
|
|
}
|
|
function __gwt_getMetaProperty(name) {
|
|
return __gwtModuleFunction.__gwt_getMetaProperty(name);
|
|
}
|
|
var $stats = $wnd.__gwtStatsEvent ? function(a) {
|
|
return $wnd.__gwtStatsEvent && $wnd.__gwtStatsEvent(a);
|
|
} : null;
|
|
var $sessionId = $wnd.__gwtStatsSessionId ? $wnd.__gwtStatsSessionId : null;
|
|
var $intern_0 = 2147483647, $intern_1 = 3.141592653589793, $intern_2 = 6.283185307179586, $intern_3 = {3:1, 4:1, 6:1}, $intern_4 = {28:1, 25:1, 27:1, 23:1, 29:1, 22:1, 24:1}, $intern_5 = {71:1, 119:1, 94:1, 122:1, 85:1, 98:1, 121:1, 69:1, 70:1, 72:1, 73:1, 75:1, 74:1, 76:1, 77:1, 78:1, 120:1, 96:1, 97:1, 95:1, 124:1, 125:1, 123:1, 86:1, 90:1, 88:1, 89:1, 87:1, 91:1, 102:1, 101:1, 100:1, 99:1, 28:1, 25:1, 27:1, 82:1, 116:1, 105:1, 115:1, 23:1, 29:1, 92:1, 117:1, 118:1, 93:1, 22:1, 24:1}, $intern_6 = {3:1, 42:1}, $intern_7 = {3:1, 13:1, 42:1}, $intern_8 = 65535, $intern_9 = {150:1, 30:1, 3:1, 16:1, 15:1}, $intern_10 = {46:1, 30:1, 3:1, 16:1, 15:1}, $intern_11 = {45:1, 30:1, 3:1, 16:1, 15:1}, $intern_12 = {161:1, 30:1, 3:1, 16:1, 15:1}, $intern_13 = {30:1, 162:1, 3:1, 16:1, 15:1}, $intern_14 = {30:1, 163:1, 3:1, 16:1, 15:1}, $intern_15 = {30:1, 164:1, 3:1, 16:1, 15:1}, $intern_16 = {103:1, 3:1, 16:1, 15:1}, $intern_17 = {30:1, 218:1, 3:1, 16:1, 15:1}, $intern_18 = {30:1, 151:1, 3:1, 16:1, 15:1}, $intern_19 = {217:1, 3:1, 13:1, 42:1}, $intern_20 = {156:1, 3:1, 13:1, 42:1}, $intern_21 = {3:1, 4:1}, $intern_22 = 1000, $intern_23 = {3:1, 4:1, 6:1, 41:1}, $intern_24 = 1024, $intern_25 = {17:1, 3:1, 4:1}, $intern_26 = Infinity, $intern_27 = 4194303, $intern_28 = 1048575, $intern_29 = 524288, $intern_30 = 4194304, $intern_31 = 17592186044416, $intern_32 = 1000000000, $intern_33 = -17592186044416, $intern_34 = 0.01, $intern_35 = {458:1, 3:1}, $intern_36 = 0.02, $intern_37 = {956:1, 11:1}, $intern_38 = {957:1, 11:1}, $intern_39 = {958:1, 11:1}, $intern_40 = {11:1, 954:1}, $intern_41 = {250:1, 11:1}, $intern_42 = 4096, $intern_43 = 2048, $intern_44 = 16384, $intern_45 = 65536, $intern_46 = 131072, $intern_47 = 262144, $intern_48 = 1048576, $intern_49 = 2097152, $intern_50 = 8388608, $intern_51 = 16777216, $intern_52 = 33554432, $intern_53 = 67108864, $intern_54 = {28:1, 25:1, 27:1, 23:1, 44:1, 29:1, 22:1, 24:1, 36:1}, $intern_55 = {172:1, 71:1, 119:1, 94:1, 122:1, 85:1, 98:1, 121:1, 69:1, 70:1, 72:1, 73:1, 75:1, 74:1, 76:1, 77:1, 78:1, 120:1, 96:1, 97:1, 95:1, 124:1, 125:1, 123:1, 86:1, 90:1, 88:1, 89:1, 87:1, 91:1, 102:1, 101:1, 100:1, 99:1, 28:1, 210:1, 25:1, 134:1, 60:1, 27:1, 230:1, 190:1, 166:1, 82:1, 116:1, 248:1, 206:1, 105:1, 115:1, 59:1, 146:1, 50:1, 229:1, 23:1, 196:1, 29:1, 92:1, 117:1, 118:1, 93:1, 22:1, 24:1}, $intern_56 = {37:1, 11:1}, $intern_57 = {28:1, 64:1, 25:1, 27:1, 67:1, 23:1, 44:1, 29:1, 48:1, 22:1, 24:1, 36:1}, $intern_58 = {28:1, 64:1, 25:1, 60:1, 27:1, 67:1, 59:1, 50:1, 23:1, 44:1, 29:1, 48:1, 22:1, 24:1, 36:1, 107:1}, $intern_59 = {172:1, 71:1, 94:1, 85:1, 98:1, 69:1, 70:1, 72:1, 73:1, 75:1, 74:1, 76:1, 77:1, 78:1, 96:1, 97:1, 95:1, 86:1, 90:1, 88:1, 89:1, 87:1, 91:1, 102:1, 101:1, 100:1, 99:1, 28:1, 25:1, 207:1, 134:1, 27:1, 315:1, 206:1, 227:1, 50:1, 23:1, 196:1, 29:1, 33:1, 176:1, 92:1, 93:1, 22:1, 24:1}, $intern_60 = {172:1, 71:1, 94:1, 85:1, 98:1, 69:1, 70:1, 72:1, 73:1, 75:1, 74:1, 76:1, 77:1, 78:1, 96:1, 97:1, 95:1, 86:1, 90:1, 88:1, 89:1, 87:1, 91:1, 102:1, 101:1, 100:1, 99:1, 28:1, 25:1, 207:1, 134:1, 60:1, 27:1, 315:1, 248:1, 206:1, 59:1, 227:1, 50:1, 23:1, 196:1, 29:1, 33:1, 176:1, 92:1, 93:1, 22:1, 24:1}, $intern_61 = {28:1, 25:1, 27:1, 23:1, 44:1, 29:1, 209:1, 22:1, 24:1, 36:1}, $intern_62 = {71:1, 69:1, 70:1, 72:1, 73:1, 75:1, 74:1, 76:1, 77:1, 78:1, 28:1, 25:1, 27:1, 23:1, 44:1, 29:1, 22:1, 24:1, 36:1}, $intern_63 = {28:1, 25:1, 27:1, 227:1, 23:1, 44:1, 29:1, 22:1, 24:1, 36:1}, $intern_64 = {71:1, 119:1, 94:1, 122:1, 85:1, 98:1, 121:1, 69:1, 70:1, 72:1, 73:1, 75:1, 74:1, 76:1, 77:1, 78:1, 120:1, 96:1, 97:1, 95:1, 124:1, 125:1, 123:1, 86:1, 90:1, 88:1, 89:1, 87:1, 91:1, 102:1, 101:1, 100:1, 99:1, 28:1, 25:1, 134:1, 27:1, 82:1, 116:1, 105:1, 115:1, 146:1, 23:1, 29:1, 92:1, 117:1, 118:1, 93:1, 22:1, 24:1}, $intern_65 = {959:1, 11:1}, $intern_66 = {28:1, 64:1, 25:1, 27:1, 67:1, 23:1, 29:1, 58:1, 999:1, 22:1, 24:1, 107:1}, $intern_67 = {60:1, 105:1, 59:1, 50:1, 23:1, 40:1, 22:1}, $intern_68 = {139:1, 11:1}, $intern_69 = {28:1, 25:1, 27:1, 23:1, 44:1, 29:1, 289:1, 22:1, 24:1, 36:1}, $intern_70 = {172:1, 71:1, 119:1, 94:1, 122:1, 85:1, 98:1, 121:1, 69:1, 70:1, 72:1, 73:1, 75:1, 74:1, 76:1, 77:1, 78:1, 120:1, 96:1, 97:1, 95:1, 124:1, 125:1, 123:1, 86:1, 90:1, 88:1, 89:1, 87:1, 91:1, 102:1, 101:1, 100:1, 99:1, 28:1, 210:1, 25:1, 207:1, 134:1, 27:1, 230:1, 82:1, 116:1, 105:1, 115:1, 146:1, 50:1, 229:1, 23:1, 29:1, 92:1, 117:1, 118:1, 93:1, 22:1, 24:1}, $intern_71 = {155:1, 11:1}, $intern_72 = {168:1, 3:1, 16:1, 15:1}, $intern_73 = {36:1}, $intern_74 = {128:1}, $intern_75 = {1003:1, 128:1}, $intern_76 = {12:1, 3:1, 4:1}, $intern_77 = 0.48, $intern_78 = {80:1, 3:1, 4:1, 6:1}, $intern_79 = 1.0E-14, $intern_80 = 1.0E-9, $intern_81 = 1000000000000, $intern_82 = 1.0E-6, $intern_83 = 0.001, $intern_84 = 1000000, $intern_85 = {8:1, 10:1}, $intern_86 = 0.6366197723675814, $intern_87 = 1.0E-4, $intern_88 = 10000, $intern_89 = 1.5707963267948966, $intern_90 = 0.15915494309189535, $intern_91 = {8:1, 10:1, 56:1}, $intern_92 = {8:1, 10:1, 47:1, 56:1}, $intern_93 = 1.7976931348623157E308, $intern_94 = 10000000000, $intern_95 = {26:1, 3:1, 4:1}, $intern_96 = -1.5707963267948966, $intern_97 = 100000000, $intern_98 = 4294901760, $intern_99 = {8:1, 10:1, 133:1}, $intern_100 = {8:1, 10:1, 61:1}, $intern_101 = -1.0E-6, $intern_102 = 1.0E-12, $intern_103 = {143:1, 8:1, 10:1}, $intern_104 = -30000, $intern_105 = {8:1, 202:1, 10:1}, $intern_106 = 1.0471975511965976, $intern_107 = 2.0943951023931953, $intern_108 = 38.662284941040014, $intern_109 = 0.025865, $intern_110 = {8:1, 154:1, 10:1}, $intern_111 = 1.7143528192808883E-7, $intern_112 = 1.0E-8, $intern_113 = -2147483648, $intern_114 = 1.0E-15, $intern_115 = {208:1, 11:1}, $intern_116 = {173:1, 11:1}, $intern_117 = {155:1, 71:1, 119:1, 94:1, 122:1, 85:1, 98:1, 121:1, 69:1, 70:1, 72:1, 73:1, 75:1, 74:1, 76:1, 77:1, 78:1, 120:1, 96:1, 97:1, 95:1, 124:1, 125:1, 123:1, 86:1, 90:1, 88:1, 89:1, 87:1, 91:1, 102:1, 101:1, 100:1, 99:1, 28:1, 11:1, 25:1, 27:1, 82:1, 116:1, 105:1, 115:1, 146:1, 23:1, 29:1, 92:1, 117:1, 118:1, 93:1, 22:1, 24:1}, $intern_118 = 0.3333, $intern_119 = 0.6666, $intern_120 = 100000, $intern_121 = {131:1, 11:1, 8:1, 10:1, 129:1}, $intern_122 = 0.16666666666666666, $intern_123 = {131:1, 11:1, 8:1, 10:1, 185:1, 129:1}, $intern_124 = 0.0099, $intern_125 = {131:1, 11:1, 8:1, 10:1}, $intern_126 = {131:1, 11:1, 8:1, 10:1, 153:1}, $intern_127 = 0.8297872340425532, $intern_128 = 0.0231, $intern_129 = 0.005, $intern_130 = 0.0625, $intern_131 = 0.499, $intern_132 = {208:1, 173:1, 131:1, 28:1, 64:1, 11:1, 25:1, 27:1, 67:1, 23:1, 44:1, 29:1, 48:1, 22:1, 24:1, 36:1}, $intern_133 = {228:1, 11:1}, $intern_134 = 3.7E-4, $intern_135 = 0.0047, $intern_136 = -20.192307692307693, $intern_137 = 4294967295, $intern_138 = {8:1, 10:1, 195:1}, $intern_139 = {16:1, 212:1}, $intern_140 = {36:1, 149:1, 171:1}, $intern_141 = {36:1, 149:1, 171:1, 313:1}, $intern_142 = {247:1}, $intern_143 = 15525485, $intern_144 = 5.9604644775390625E-8;
|
|
var _, prototypesByTypeId_0, initFnList_0, permutationId = -1;
|
|
function setGwtProperty(propertyName, propertyValue){
|
|
typeof window === 'object' && typeof window['$gwt'] === 'object' && (window['$gwt'][propertyName] = propertyValue);
|
|
}
|
|
|
|
function gwtOnLoad_0(errFn, modName, modBase, softPermutationId){
|
|
ensureModuleInit();
|
|
var initFnList = initFnList_0;
|
|
$moduleName = modName;
|
|
$moduleBase = modBase;
|
|
permutationId = softPermutationId;
|
|
function initializeModules(){
|
|
for (var i = 0; i < initFnList.length; i++) {
|
|
initFnList[i]();
|
|
}
|
|
}
|
|
|
|
if (errFn) {
|
|
try {
|
|
$entry(initializeModules)();
|
|
}
|
|
catch (e) {
|
|
errFn(modName, e);
|
|
}
|
|
}
|
|
else {
|
|
$entry(initializeModules)();
|
|
}
|
|
}
|
|
|
|
function ensureModuleInit(){
|
|
initFnList_0 == null && (initFnList_0 = []);
|
|
}
|
|
|
|
function addInitFunctions(){
|
|
ensureModuleInit();
|
|
var initFnList = initFnList_0;
|
|
for (var i = 0; i < arguments.length; i++) {
|
|
initFnList.push(arguments[i]);
|
|
}
|
|
}
|
|
|
|
function typeMarkerFn(){
|
|
}
|
|
|
|
function toString_9(object){
|
|
var number;
|
|
if (Array.isArray(object) && object.typeMarker === typeMarkerFn) {
|
|
return $getName(getClass__Ljava_lang_Class___devirtual$(object)) + '@' + (number = hashCode__I__devirtual$(object) >>> 0 , number.toString(16));
|
|
}
|
|
return object.toString();
|
|
}
|
|
|
|
function portableObjCreate(obj){
|
|
function F(){
|
|
}
|
|
|
|
;
|
|
F.prototype = obj || {};
|
|
return new F;
|
|
}
|
|
|
|
function emptyMethod(){
|
|
}
|
|
|
|
function defineClass(typeId, superTypeIdOrPrototype, castableTypeMap){
|
|
var prototypesByTypeId = prototypesByTypeId_0, superPrototype;
|
|
var prototype_0 = prototypesByTypeId[typeId];
|
|
var clazz = prototype_0 instanceof Array?prototype_0[0]:null;
|
|
if (prototype_0 && !clazz) {
|
|
_ = prototype_0;
|
|
}
|
|
else {
|
|
_ = (superPrototype = superTypeIdOrPrototype && superTypeIdOrPrototype.prototype , !superPrototype && (superPrototype = prototypesByTypeId_0[superTypeIdOrPrototype]) , portableObjCreate(superPrototype));
|
|
_.castableTypeMap = castableTypeMap;
|
|
!superTypeIdOrPrototype && (_.typeMarker = typeMarkerFn);
|
|
prototypesByTypeId[typeId] = _;
|
|
}
|
|
for (var i = 3; i < arguments.length; ++i) {
|
|
arguments[i].prototype = _;
|
|
}
|
|
clazz && (_.___clazz = clazz);
|
|
}
|
|
|
|
function bootstrap(){
|
|
prototypesByTypeId_0 = {};
|
|
!Array.isArray && (Array.isArray = function(vArg){
|
|
return Object.prototype.toString.call(vArg) === '[object Array]';
|
|
}
|
|
);
|
|
function now_0(){
|
|
return (new Date).getTime();
|
|
}
|
|
|
|
!Date.now && (Date.now = now_0);
|
|
}
|
|
|
|
bootstrap();
|
|
function Object_0(){
|
|
}
|
|
|
|
function equals_Ljava_lang_Object__Z__devirtual$(this$static, other){
|
|
return instanceOfString(this$static)?$equals_1(this$static, other):instanceOfDouble(this$static)?(checkCriticalNotNull(this$static) , this$static === other):instanceOfBoolean(this$static)?(checkCriticalNotNull(this$static) , this$static === other):hasJavaObjectVirtualDispatch(this$static)?this$static.equals_0(other):isJavaArray(this$static)?this$static === other:!!this$static && !!this$static.equals?this$static.equals(other):maskUndefined(this$static) === maskUndefined(other);
|
|
}
|
|
|
|
function getClass__Ljava_lang_Class___devirtual$(this$static){
|
|
return instanceOfString(this$static)?Ljava_lang_String_2_classLit:instanceOfDouble(this$static)?Ljava_lang_Double_2_classLit:instanceOfBoolean(this$static)?Ljava_lang_Boolean_2_classLit:hasJavaObjectVirtualDispatch(this$static)?this$static.___clazz:isJavaArray(this$static)?this$static.___clazz:this$static.___clazz || Array.isArray(this$static) && getClassLiteralForArray(Lcom_google_gwt_core_client_JavaScriptObject_2_classLit, 1) || Lcom_google_gwt_core_client_JavaScriptObject_2_classLit;
|
|
}
|
|
|
|
function hashCode__I__devirtual$(this$static){
|
|
return instanceOfString(this$static)?getHashCode_0(this$static):instanceOfDouble(this$static)?round_int((checkCriticalNotNull(this$static) , this$static)):instanceOfBoolean(this$static)?(checkCriticalNotNull(this$static) , this$static)?1231:1237:hasJavaObjectVirtualDispatch(this$static)?this$static.hashCode_0():isJavaArray(this$static)?getHashCode(this$static):$hashCode(this$static);
|
|
}
|
|
|
|
defineClass(1, null, {}, Object_0);
|
|
_.equals_0 = function equals(other){
|
|
return this === other;
|
|
}
|
|
;
|
|
_.getClass_0 = function getClass_0(){
|
|
return this.___clazz;
|
|
}
|
|
;
|
|
_.hashCode_0 = function hashCode_0(){
|
|
return getHashCode(this);
|
|
}
|
|
;
|
|
_.toString_0 = function toString_0(){
|
|
var number;
|
|
return $getName(getClass__Ljava_lang_Class___devirtual$(this)) + '@' + (number = hashCode__I__devirtual$(this) >>> 0 , number.toString(16));
|
|
}
|
|
;
|
|
_.equals = function(other){
|
|
return this.equals_0(other);
|
|
}
|
|
;
|
|
_.hashCode = function(){
|
|
return this.hashCode_0();
|
|
}
|
|
;
|
|
_.toString = function(){
|
|
return this.toString_0();
|
|
}
|
|
;
|
|
function canCast(src_0, dstId){
|
|
if (instanceOfString(src_0)) {
|
|
return !!stringCastMap[dstId];
|
|
}
|
|
else if (src_0.castableTypeMap) {
|
|
return !!src_0.castableTypeMap[dstId];
|
|
}
|
|
else if (instanceOfDouble(src_0)) {
|
|
return !!doubleCastMap[dstId];
|
|
}
|
|
else if (instanceOfBoolean(src_0)) {
|
|
return !!booleanCastMap[dstId];
|
|
}
|
|
return false;
|
|
}
|
|
|
|
function charToString(x_0){
|
|
return String.fromCharCode(x_0);
|
|
}
|
|
|
|
function hasJavaObjectVirtualDispatch(src_0){
|
|
return !Array.isArray(src_0) && src_0.typeMarker === typeMarkerFn;
|
|
}
|
|
|
|
function instanceOf(src_0, dstId){
|
|
return src_0 != null && canCast(src_0, dstId);
|
|
}
|
|
|
|
function instanceOfBoolean(src_0){
|
|
return typeof src_0 === 'boolean';
|
|
}
|
|
|
|
function instanceOfDouble(src_0){
|
|
return typeof src_0 === 'number';
|
|
}
|
|
|
|
function instanceOfJso(src_0){
|
|
return src_0 != null && (typeof src_0 === 'object' || typeof src_0 === 'function') && !(src_0.typeMarker === typeMarkerFn);
|
|
}
|
|
|
|
function instanceOfString(src_0){
|
|
return typeof src_0 === 'string';
|
|
}
|
|
|
|
function maskUndefined(src_0){
|
|
return src_0 == null?null:src_0;
|
|
}
|
|
|
|
function round_int(x_0){
|
|
return Math.max(Math.min(x_0, $intern_0), -2147483648) | 0;
|
|
}
|
|
|
|
var booleanCastMap, doubleCastMap, stringCastMap;
|
|
function $ensureNamesAreInitialized(this$static){
|
|
if (this$static.typeName != null) {
|
|
return;
|
|
}
|
|
initializeNames(this$static);
|
|
}
|
|
|
|
function $getName(this$static){
|
|
$ensureNamesAreInitialized(this$static);
|
|
return this$static.typeName;
|
|
}
|
|
|
|
function $getSimpleName(this$static){
|
|
$ensureNamesAreInitialized(this$static);
|
|
return this$static.simpleName;
|
|
}
|
|
|
|
function Class(){
|
|
++nextSequentialId;
|
|
this.typeName = null;
|
|
this.simpleName = null;
|
|
this.packageName = null;
|
|
this.compoundName = null;
|
|
this.canonicalName = null;
|
|
this.typeId = null;
|
|
this.arrayLiterals = null;
|
|
}
|
|
|
|
function createClassObject(packageName, compoundClassName){
|
|
var clazz;
|
|
clazz = new Class;
|
|
clazz.packageName = packageName;
|
|
clazz.compoundName = compoundClassName;
|
|
return clazz;
|
|
}
|
|
|
|
function createForClass(packageName, compoundClassName, typeId){
|
|
var clazz;
|
|
clazz = createClassObject(packageName, compoundClassName);
|
|
maybeSetClassLiteral(typeId, clazz);
|
|
return clazz;
|
|
}
|
|
|
|
function createForEnum(packageName, compoundClassName, typeId, enumConstantsFunc){
|
|
var clazz;
|
|
clazz = createClassObject(packageName, compoundClassName);
|
|
maybeSetClassLiteral(typeId, clazz);
|
|
clazz.modifiers = enumConstantsFunc?8:0;
|
|
return clazz;
|
|
}
|
|
|
|
function createForPrimitive(className, primitiveTypeId){
|
|
var clazz;
|
|
clazz = createClassObject('', className);
|
|
clazz.typeId = primitiveTypeId;
|
|
clazz.modifiers = 1;
|
|
return clazz;
|
|
}
|
|
|
|
function getClassLiteralForArray_0(leafClass, dimensions){
|
|
var arrayLiterals = leafClass.arrayLiterals = leafClass.arrayLiterals || [];
|
|
return arrayLiterals[dimensions] || (arrayLiterals[dimensions] = leafClass.createClassLiteralForArray(dimensions));
|
|
}
|
|
|
|
function getPrototypeForClass(clazz){
|
|
if (clazz.isPrimitive()) {
|
|
return null;
|
|
}
|
|
var typeId = clazz.typeId;
|
|
return prototypesByTypeId_0[typeId];
|
|
}
|
|
|
|
function initializeNames(clazz){
|
|
if (clazz.isArray_0()) {
|
|
var componentType = clazz.componentType;
|
|
componentType.isPrimitive()?(clazz.typeName = '[' + componentType.typeId):!componentType.isArray_0()?(clazz.typeName = '[L' + componentType.getName_0() + ';'):(clazz.typeName = '[' + componentType.getName_0());
|
|
clazz.canonicalName = componentType.getCanonicalName() + '[]';
|
|
clazz.simpleName = componentType.getSimpleName() + '[]';
|
|
return;
|
|
}
|
|
var packageName = clazz.packageName;
|
|
var compoundName = clazz.compoundName;
|
|
compoundName = compoundName.split('/');
|
|
clazz.typeName = join_0('.', [packageName, join_0('$', compoundName)]);
|
|
clazz.canonicalName = join_0('.', [packageName, join_0('.', compoundName)]);
|
|
clazz.simpleName = compoundName[compoundName.length - 1];
|
|
}
|
|
|
|
function join_0(separator, strings){
|
|
var i = 0;
|
|
while (!strings[i] || strings[i] == '') {
|
|
i++;
|
|
}
|
|
var result = strings[i++];
|
|
for (; i < strings.length; i++) {
|
|
if (!strings[i] || strings[i] == '') {
|
|
continue;
|
|
}
|
|
result += separator + strings[i];
|
|
}
|
|
return result;
|
|
}
|
|
|
|
function maybeSetClassLiteral(typeId, clazz){
|
|
var proto;
|
|
if (!typeId) {
|
|
return;
|
|
}
|
|
clazz.typeId = typeId;
|
|
var prototype_0 = getPrototypeForClass(clazz);
|
|
if (!prototype_0) {
|
|
prototypesByTypeId_0[typeId] = [clazz];
|
|
return;
|
|
}
|
|
prototype_0.___clazz = clazz;
|
|
}
|
|
|
|
defineClass(318, 1, {}, Class);
|
|
_.createClassLiteralForArray = function createClassLiteralForArray(dimensions){
|
|
var clazz;
|
|
clazz = new Class;
|
|
clazz.modifiers = 4;
|
|
dimensions > 1?(clazz.componentType = getClassLiteralForArray_0(this, dimensions - 1)):(clazz.componentType = this);
|
|
return clazz;
|
|
}
|
|
;
|
|
_.getCanonicalName = function getCanonicalName(){
|
|
$ensureNamesAreInitialized(this);
|
|
return this.canonicalName;
|
|
}
|
|
;
|
|
_.getName_0 = function getName_0(){
|
|
return $getName(this);
|
|
}
|
|
;
|
|
_.getSimpleName = function getSimpleName(){
|
|
return $getSimpleName(this);
|
|
}
|
|
;
|
|
_.isArray_0 = function isArray(){
|
|
return (this.modifiers & 4) != 0;
|
|
}
|
|
;
|
|
_.isPrimitive = function isPrimitive(){
|
|
return (this.modifiers & 1) != 0;
|
|
}
|
|
;
|
|
_.toString_0 = function toString_25(){
|
|
return ((this.modifiers & 2) != 0?'interface ':(this.modifiers & 1) != 0?'':'class ') + ($ensureNamesAreInitialized(this) , this.typeName);
|
|
}
|
|
;
|
|
_.modifiers = 0;
|
|
var nextSequentialId = 1;
|
|
var Ljava_lang_Object_2_classLit = createForClass('java.lang', 'Object', 1);
|
|
var Ljava_lang_Class_2_classLit = createForClass('java.lang', 'Class', 318);
|
|
function $cancel(this$static){
|
|
if (!this$static.isRunning_0) {
|
|
return;
|
|
}
|
|
this$static.wasStarted = this$static.isStarted;
|
|
this$static.element = null;
|
|
this$static.isRunning_0 = false;
|
|
this$static.isStarted = false;
|
|
if (this$static.requestHandle) {
|
|
this$static.requestHandle.cancel();
|
|
this$static.requestHandle = null;
|
|
}
|
|
this$static.onCancel();
|
|
}
|
|
|
|
function $run(this$static, duration, startTime, element){
|
|
$cancel(this$static);
|
|
this$static.isRunning_0 = true;
|
|
this$static.isStarted = false;
|
|
this$static.duration = duration;
|
|
this$static.startTime = startTime;
|
|
this$static.element = element;
|
|
++this$static.runId;
|
|
$execute(this$static.callback, now_1());
|
|
}
|
|
|
|
function $run_0(this$static, duration, element){
|
|
$run(this$static, duration, now_1(), element);
|
|
}
|
|
|
|
function $update(this$static, curTime){
|
|
var curRunId, finished, progress;
|
|
curRunId = this$static.runId;
|
|
finished = curTime >= this$static.startTime + this$static.duration;
|
|
if (this$static.isStarted && !finished) {
|
|
progress = (curTime - this$static.startTime) / this$static.duration;
|
|
this$static.onUpdate((1 + $wnd.Math.cos($intern_1 + progress * $intern_1)) / 2);
|
|
return this$static.isRunning_0 && this$static.runId == curRunId;
|
|
}
|
|
if (!this$static.isStarted && curTime >= this$static.startTime) {
|
|
this$static.isStarted = true;
|
|
this$static.onStart();
|
|
if (!(this$static.isRunning_0 && this$static.runId == curRunId)) {
|
|
return false;
|
|
}
|
|
}
|
|
if (finished) {
|
|
this$static.isRunning_0 = false;
|
|
this$static.isStarted = false;
|
|
this$static.onComplete();
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
function Animation(){
|
|
Animation_0.call(this, (!instance && (instance = !!$wnd.requestAnimationFrame && !!$wnd.cancelAnimationFrame?new AnimationSchedulerImplStandard:new AnimationSchedulerImplTimer) , instance));
|
|
}
|
|
|
|
function Animation_0(scheduler){
|
|
this.callback = new Animation$1(this);
|
|
this.scheduler = scheduler;
|
|
}
|
|
|
|
defineClass(287, 1, {});
|
|
_.onCancel = function onCancel(){
|
|
this.wasStarted && this.onComplete();
|
|
}
|
|
;
|
|
_.onComplete = function onComplete(){
|
|
this.onUpdate((1 + $wnd.Math.cos($intern_2)) / 2);
|
|
}
|
|
;
|
|
_.onStart = function onStart(){
|
|
this.onUpdate((1 + $wnd.Math.cos($intern_1)) / 2);
|
|
}
|
|
;
|
|
_.duration = -1;
|
|
_.isRunning_0 = false;
|
|
_.isStarted = false;
|
|
_.runId = -1;
|
|
_.startTime = -1;
|
|
_.wasStarted = false;
|
|
var Lcom_google_gwt_animation_client_Animation_2_classLit = createForClass('com.google.gwt.animation.client', 'Animation', 287);
|
|
function $execute(this$static, timestamp){
|
|
$update(this$static.this$01, timestamp)?(this$static.this$01.requestHandle = this$static.this$01.scheduler.requestAnimationFrame_0(this$static.this$01.callback, this$static.this$01.element)):(this$static.this$01.requestHandle = null);
|
|
}
|
|
|
|
function Animation$1(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(524, 1, {}, Animation$1);
|
|
_.execute = function execute(timestamp){
|
|
$execute(this, timestamp);
|
|
}
|
|
;
|
|
var Lcom_google_gwt_animation_client_Animation$1_2_classLit = createForClass('com.google.gwt.animation.client', 'Animation/1', 524);
|
|
defineClass(997, 1, {});
|
|
var instance;
|
|
var Lcom_google_gwt_animation_client_AnimationScheduler_2_classLit = createForClass('com.google.gwt.animation.client', 'AnimationScheduler', 997);
|
|
defineClass(311, 1, {311:1});
|
|
var Lcom_google_gwt_animation_client_AnimationScheduler$AnimationHandle_2_classLit = createForClass('com.google.gwt.animation.client', 'AnimationScheduler/AnimationHandle', 311);
|
|
function AnimationSchedulerImplStandard(){
|
|
}
|
|
|
|
function cancelImpl(holder){
|
|
$wnd.cancelAnimationFrame(holder.id);
|
|
}
|
|
|
|
function requestImpl(cb, element){
|
|
var callback = $entry(function(){
|
|
var time = now_1();
|
|
cb.execute(time);
|
|
}
|
|
);
|
|
var handle = $wnd.requestAnimationFrame(callback, element);
|
|
return {id:handle};
|
|
}
|
|
|
|
defineClass(940, 997, {}, AnimationSchedulerImplStandard);
|
|
_.requestAnimationFrame_0 = function requestAnimationFrame_0(callback, element){
|
|
var handle;
|
|
handle = requestImpl(callback, element);
|
|
return new AnimationSchedulerImplStandard$1(handle);
|
|
}
|
|
;
|
|
var Lcom_google_gwt_animation_client_AnimationSchedulerImplStandard_2_classLit = createForClass('com.google.gwt.animation.client', 'AnimationSchedulerImplStandard', 940);
|
|
function AnimationSchedulerImplStandard$1(val$handle){
|
|
this.val$handle2 = val$handle;
|
|
}
|
|
|
|
defineClass(941, 311, {311:1}, AnimationSchedulerImplStandard$1);
|
|
_.cancel = function cancel(){
|
|
cancelImpl(this.val$handle2);
|
|
}
|
|
;
|
|
var Lcom_google_gwt_animation_client_AnimationSchedulerImplStandard$1_2_classLit = createForClass('com.google.gwt.animation.client', 'AnimationSchedulerImplStandard/1', 941);
|
|
function $cancelAnimationFrame(this$static, requestId){
|
|
$remove_13(this$static.animationRequests, requestId);
|
|
this$static.animationRequests.array.length == 0 && $cancel_0(this$static.timer);
|
|
}
|
|
|
|
function $updateAnimations(this$static){
|
|
var curAnimations, duration, requestId, requestId$index, requestId$max;
|
|
curAnimations = initUnidimensionalArray(Lcom_google_gwt_animation_client_AnimationSchedulerImplTimer$AnimationHandleImpl_2_classLit, {1017:1, 3:1, 4:1, 6:1}, 312, this$static.animationRequests.array.length, 0, 1);
|
|
curAnimations = $toArray_0(this$static.animationRequests, curAnimations);
|
|
duration = new Duration;
|
|
for (requestId$index = 0 , requestId$max = curAnimations.length; requestId$index < requestId$max; ++requestId$index) {
|
|
requestId = curAnimations[requestId$index];
|
|
$remove_13(this$static.animationRequests, requestId);
|
|
$execute(requestId.callback, duration.start_0);
|
|
}
|
|
this$static.animationRequests.array.length > 0 && $schedule(this$static.timer, $wnd.Math.max(5, 16 - (now_1() - duration.start_0)));
|
|
}
|
|
|
|
function AnimationSchedulerImplTimer(){
|
|
this.animationRequests = new ArrayList;
|
|
this.timer = new AnimationSchedulerImplTimer$1(this);
|
|
}
|
|
|
|
defineClass(942, 997, {}, AnimationSchedulerImplTimer);
|
|
_.requestAnimationFrame_0 = function requestAnimationFrame_1(callback, element){
|
|
var requestId;
|
|
requestId = new AnimationSchedulerImplTimer$AnimationHandleImpl(this, callback);
|
|
$add_8(this.animationRequests, requestId);
|
|
this.animationRequests.array.length == 1 && $schedule(this.timer, 16);
|
|
return requestId;
|
|
}
|
|
;
|
|
var Lcom_google_gwt_animation_client_AnimationSchedulerImplTimer_2_classLit = createForClass('com.google.gwt.animation.client', 'AnimationSchedulerImplTimer', 942);
|
|
function $cancel_0(this$static){
|
|
if (!this$static.timerId) {
|
|
return;
|
|
}
|
|
++this$static.cancelCounter;
|
|
this$static.isRepeating?clearInterval_0(this$static.timerId.value_0):clearTimeout_0(this$static.timerId.value_0);
|
|
this$static.timerId = null;
|
|
}
|
|
|
|
function $schedule(this$static, delayMillis){
|
|
if (delayMillis < 0) {
|
|
throw toJs(new IllegalArgumentException_0('must be non-negative'));
|
|
}
|
|
!!this$static.timerId && $cancel_0(this$static);
|
|
this$static.isRepeating = false;
|
|
this$static.timerId = valueOf_0(setTimeout_0(createCallback(this$static, this$static.cancelCounter), delayMillis));
|
|
}
|
|
|
|
function $scheduleRepeating(this$static, periodMillis){
|
|
if (periodMillis <= 0) {
|
|
throw toJs(new IllegalArgumentException_0('must be positive'));
|
|
}
|
|
!!this$static.timerId && $cancel_0(this$static);
|
|
this$static.isRepeating = true;
|
|
this$static.timerId = valueOf_0(setInterval_0(createCallback(this$static, this$static.cancelCounter), periodMillis));
|
|
}
|
|
|
|
function Timer(){
|
|
}
|
|
|
|
function clearInterval_0(timerId){
|
|
$wnd.clearInterval(timerId);
|
|
}
|
|
|
|
function clearTimeout_0(timerId){
|
|
$wnd.clearTimeout(timerId);
|
|
}
|
|
|
|
function createCallback(timer, cancelCounter){
|
|
return $entry(function(){
|
|
timer.fire(cancelCounter);
|
|
}
|
|
);
|
|
}
|
|
|
|
function setInterval_0(func, time){
|
|
return $wnd.setInterval(func, time);
|
|
}
|
|
|
|
function setTimeout_0(func, time){
|
|
return $wnd.setTimeout(func, time);
|
|
}
|
|
|
|
defineClass(213, 1, {});
|
|
_.fire = function fire(scheduleCancelCounter){
|
|
if (scheduleCancelCounter != this.cancelCounter) {
|
|
return;
|
|
}
|
|
this.isRepeating || (this.timerId = null);
|
|
this.run();
|
|
}
|
|
;
|
|
_.cancelCounter = 0;
|
|
_.isRepeating = false;
|
|
_.timerId = null;
|
|
var Lcom_google_gwt_user_client_Timer_2_classLit = createForClass('com.google.gwt.user.client', 'Timer', 213);
|
|
function AnimationSchedulerImplTimer$1(this$0){
|
|
this.this$01 = this$0;
|
|
Timer.call(this);
|
|
}
|
|
|
|
defineClass(943, 213, {}, AnimationSchedulerImplTimer$1);
|
|
_.run = function run_0(){
|
|
$updateAnimations(this.this$01);
|
|
}
|
|
;
|
|
var Lcom_google_gwt_animation_client_AnimationSchedulerImplTimer$1_2_classLit = createForClass('com.google.gwt.animation.client', 'AnimationSchedulerImplTimer/1', 943);
|
|
function AnimationSchedulerImplTimer$AnimationHandleImpl(this$0, callback){
|
|
this.this$01 = this$0;
|
|
this.callback = callback;
|
|
}
|
|
|
|
defineClass(312, 311, {311:1, 312:1}, AnimationSchedulerImplTimer$AnimationHandleImpl);
|
|
_.cancel = function cancel_0(){
|
|
$cancelAnimationFrame(this.this$01, this);
|
|
}
|
|
;
|
|
var Lcom_google_gwt_animation_client_AnimationSchedulerImplTimer$AnimationHandleImpl_2_classLit = createForClass('com.google.gwt.animation.client', 'AnimationSchedulerImplTimer/AnimationHandleImpl', 312);
|
|
function $set(this$static, element){
|
|
$setAttribute(element, 'role', this$static.roleName);
|
|
}
|
|
|
|
function $setAriaHaspopupProperty(element, value_0){
|
|
$set_0(($clinit_Property() , HASPOPUP), element, stampJavaTypeInfo(getClassLiteralForArray(Ljava_lang_Boolean_2_classLit, 1), $intern_3, 281, 8, [($clinit_Boolean() , value_0?true:false)]));
|
|
}
|
|
|
|
function RoleImpl(roleName){
|
|
this.roleName = roleName;
|
|
}
|
|
|
|
defineClass(35, 1, {});
|
|
var Lcom_google_gwt_aria_client_RoleImpl_2_classLit = createForClass('com.google.gwt.aria.client', 'RoleImpl', 35);
|
|
function AlertRoleImpl(){
|
|
RoleImpl.call(this, 'alert');
|
|
}
|
|
|
|
defineClass(834, 35, {}, AlertRoleImpl);
|
|
var Lcom_google_gwt_aria_client_AlertRoleImpl_2_classLit = createForClass('com.google.gwt.aria.client', 'AlertRoleImpl', 834);
|
|
function AlertdialogRoleImpl(){
|
|
RoleImpl.call(this, 'alertdialog');
|
|
}
|
|
|
|
defineClass(833, 35, {}, AlertdialogRoleImpl);
|
|
var Lcom_google_gwt_aria_client_AlertdialogRoleImpl_2_classLit = createForClass('com.google.gwt.aria.client', 'AlertdialogRoleImpl', 833);
|
|
function ApplicationRoleImpl(){
|
|
RoleImpl.call(this, 'application');
|
|
}
|
|
|
|
defineClass(835, 35, {}, ApplicationRoleImpl);
|
|
var Lcom_google_gwt_aria_client_ApplicationRoleImpl_2_classLit = createForClass('com.google.gwt.aria.client', 'ApplicationRoleImpl', 835);
|
|
function $getAriaValue(this$static, value_0){
|
|
var buf, item_0, item$index, item$max;
|
|
buf = new StringBuilder;
|
|
for (item$index = 0 , item$max = value_0.length; item$index < item$max; ++item$index) {
|
|
item_0 = value_0[item$index];
|
|
$append_4($append_4(buf, this$static.getSingleValue(item_0)), ' ');
|
|
}
|
|
return $trim(buf.string);
|
|
}
|
|
|
|
function $set_0(this$static, element, values){
|
|
$setAttribute(element, this$static.name_0, $getAriaValue(this$static, values));
|
|
}
|
|
|
|
function Attribute(name_0){
|
|
this.name_0 = name_0;
|
|
}
|
|
|
|
defineClass(450, 1, {});
|
|
var Lcom_google_gwt_aria_client_Attribute_2_classLit = createForClass('com.google.gwt.aria.client', 'Attribute', 450);
|
|
function AriaValueAttribute(name_0){
|
|
Attribute.call(this, name_0);
|
|
}
|
|
|
|
defineClass(111, 450, {}, AriaValueAttribute);
|
|
_.getSingleValue = function getSingleValue(value_0){
|
|
return value_0.id_0;
|
|
}
|
|
;
|
|
var Lcom_google_gwt_aria_client_AriaValueAttribute_2_classLit = createForClass('com.google.gwt.aria.client', 'AriaValueAttribute', 111);
|
|
function ArticleRoleImpl(){
|
|
RoleImpl.call(this, 'article');
|
|
}
|
|
|
|
defineClass(836, 35, {}, ArticleRoleImpl);
|
|
var Lcom_google_gwt_aria_client_ArticleRoleImpl_2_classLit = createForClass('com.google.gwt.aria.client', 'ArticleRoleImpl', 836);
|
|
function BannerRoleImpl(){
|
|
RoleImpl.call(this, 'banner');
|
|
}
|
|
|
|
defineClass(837, 35, {}, BannerRoleImpl);
|
|
var Lcom_google_gwt_aria_client_BannerRoleImpl_2_classLit = createForClass('com.google.gwt.aria.client', 'BannerRoleImpl', 837);
|
|
function ButtonRoleImpl(){
|
|
RoleImpl.call(this, 'button');
|
|
}
|
|
|
|
defineClass(838, 35, {}, ButtonRoleImpl);
|
|
var Lcom_google_gwt_aria_client_ButtonRoleImpl_2_classLit = createForClass('com.google.gwt.aria.client', 'ButtonRoleImpl', 838);
|
|
function CheckboxRoleImpl(){
|
|
RoleImpl.call(this, 'checkbox');
|
|
}
|
|
|
|
defineClass(839, 35, {}, CheckboxRoleImpl);
|
|
var Lcom_google_gwt_aria_client_CheckboxRoleImpl_2_classLit = createForClass('com.google.gwt.aria.client', 'CheckboxRoleImpl', 839);
|
|
function ColumnheaderRoleImpl(){
|
|
RoleImpl.call(this, 'columnheader');
|
|
}
|
|
|
|
defineClass(840, 35, {}, ColumnheaderRoleImpl);
|
|
var Lcom_google_gwt_aria_client_ColumnheaderRoleImpl_2_classLit = createForClass('com.google.gwt.aria.client', 'ColumnheaderRoleImpl', 840);
|
|
function ComboboxRoleImpl(){
|
|
RoleImpl.call(this, 'combobox');
|
|
}
|
|
|
|
defineClass(841, 35, {}, ComboboxRoleImpl);
|
|
var Lcom_google_gwt_aria_client_ComboboxRoleImpl_2_classLit = createForClass('com.google.gwt.aria.client', 'ComboboxRoleImpl', 841);
|
|
function ComplementaryRoleImpl(){
|
|
RoleImpl.call(this, 'complementary');
|
|
}
|
|
|
|
defineClass(842, 35, {}, ComplementaryRoleImpl);
|
|
var Lcom_google_gwt_aria_client_ComplementaryRoleImpl_2_classLit = createForClass('com.google.gwt.aria.client', 'ComplementaryRoleImpl', 842);
|
|
function ContentinfoRoleImpl(){
|
|
RoleImpl.call(this, 'contentinfo');
|
|
}
|
|
|
|
defineClass(843, 35, {}, ContentinfoRoleImpl);
|
|
var Lcom_google_gwt_aria_client_ContentinfoRoleImpl_2_classLit = createForClass('com.google.gwt.aria.client', 'ContentinfoRoleImpl', 843);
|
|
function DefinitionRoleImpl(){
|
|
RoleImpl.call(this, 'definition');
|
|
}
|
|
|
|
defineClass(844, 35, {}, DefinitionRoleImpl);
|
|
var Lcom_google_gwt_aria_client_DefinitionRoleImpl_2_classLit = createForClass('com.google.gwt.aria.client', 'DefinitionRoleImpl', 844);
|
|
function DialogRoleImpl(){
|
|
RoleImpl.call(this, 'dialog');
|
|
}
|
|
|
|
defineClass(845, 35, {}, DialogRoleImpl);
|
|
var Lcom_google_gwt_aria_client_DialogRoleImpl_2_classLit = createForClass('com.google.gwt.aria.client', 'DialogRoleImpl', 845);
|
|
function DirectoryRoleImpl(){
|
|
RoleImpl.call(this, 'directory');
|
|
}
|
|
|
|
defineClass(846, 35, {}, DirectoryRoleImpl);
|
|
var Lcom_google_gwt_aria_client_DirectoryRoleImpl_2_classLit = createForClass('com.google.gwt.aria.client', 'DirectoryRoleImpl', 846);
|
|
function DocumentRoleImpl(){
|
|
RoleImpl.call(this, 'document');
|
|
}
|
|
|
|
defineClass(847, 35, {}, DocumentRoleImpl);
|
|
var Lcom_google_gwt_aria_client_DocumentRoleImpl_2_classLit = createForClass('com.google.gwt.aria.client', 'DocumentRoleImpl', 847);
|
|
function FormRoleImpl(){
|
|
RoleImpl.call(this, 'form');
|
|
}
|
|
|
|
defineClass(848, 35, {}, FormRoleImpl);
|
|
var Lcom_google_gwt_aria_client_FormRoleImpl_2_classLit = createForClass('com.google.gwt.aria.client', 'FormRoleImpl', 848);
|
|
function GridRoleImpl(){
|
|
RoleImpl.call(this, 'grid');
|
|
}
|
|
|
|
defineClass(850, 35, {}, GridRoleImpl);
|
|
var Lcom_google_gwt_aria_client_GridRoleImpl_2_classLit = createForClass('com.google.gwt.aria.client', 'GridRoleImpl', 850);
|
|
function GridcellRoleImpl(){
|
|
RoleImpl.call(this, 'gridcell');
|
|
}
|
|
|
|
defineClass(849, 35, {}, GridcellRoleImpl);
|
|
var Lcom_google_gwt_aria_client_GridcellRoleImpl_2_classLit = createForClass('com.google.gwt.aria.client', 'GridcellRoleImpl', 849);
|
|
function GroupRoleImpl(){
|
|
RoleImpl.call(this, 'group');
|
|
}
|
|
|
|
defineClass(851, 35, {}, GroupRoleImpl);
|
|
var Lcom_google_gwt_aria_client_GroupRoleImpl_2_classLit = createForClass('com.google.gwt.aria.client', 'GroupRoleImpl', 851);
|
|
function HeadingRoleImpl(){
|
|
RoleImpl.call(this, 'heading');
|
|
}
|
|
|
|
defineClass(852, 35, {}, HeadingRoleImpl);
|
|
var Lcom_google_gwt_aria_client_HeadingRoleImpl_2_classLit = createForClass('com.google.gwt.aria.client', 'HeadingRoleImpl', 852);
|
|
function $init(this$static, elementId){
|
|
this$static.id_0 = elementId;
|
|
}
|
|
|
|
function Id(element){
|
|
$init(this, element.id);
|
|
}
|
|
|
|
defineClass(302, 1, {1018:1, 302:1}, Id);
|
|
var Lcom_google_gwt_aria_client_Id_2_classLit = createForClass('com.google.gwt.aria.client', 'Id', 302);
|
|
function ImgRoleImpl(){
|
|
RoleImpl.call(this, 'img');
|
|
}
|
|
|
|
defineClass(853, 35, {}, ImgRoleImpl);
|
|
var Lcom_google_gwt_aria_client_ImgRoleImpl_2_classLit = createForClass('com.google.gwt.aria.client', 'ImgRoleImpl', 853);
|
|
function LinkRoleImpl(){
|
|
RoleImpl.call(this, 'link');
|
|
}
|
|
|
|
defineClass(854, 35, {}, LinkRoleImpl);
|
|
var Lcom_google_gwt_aria_client_LinkRoleImpl_2_classLit = createForClass('com.google.gwt.aria.client', 'LinkRoleImpl', 854);
|
|
function ListRoleImpl(){
|
|
RoleImpl.call(this, 'list');
|
|
}
|
|
|
|
defineClass(857, 35, {}, ListRoleImpl);
|
|
var Lcom_google_gwt_aria_client_ListRoleImpl_2_classLit = createForClass('com.google.gwt.aria.client', 'ListRoleImpl', 857);
|
|
function ListboxRoleImpl(){
|
|
RoleImpl.call(this, 'listbox');
|
|
}
|
|
|
|
defineClass(855, 35, {}, ListboxRoleImpl);
|
|
var Lcom_google_gwt_aria_client_ListboxRoleImpl_2_classLit = createForClass('com.google.gwt.aria.client', 'ListboxRoleImpl', 855);
|
|
function ListitemRoleImpl(){
|
|
RoleImpl.call(this, 'listitem');
|
|
}
|
|
|
|
defineClass(856, 35, {}, ListitemRoleImpl);
|
|
var Lcom_google_gwt_aria_client_ListitemRoleImpl_2_classLit = createForClass('com.google.gwt.aria.client', 'ListitemRoleImpl', 856);
|
|
function LogRoleImpl(){
|
|
RoleImpl.call(this, 'log');
|
|
}
|
|
|
|
defineClass(858, 35, {}, LogRoleImpl);
|
|
var Lcom_google_gwt_aria_client_LogRoleImpl_2_classLit = createForClass('com.google.gwt.aria.client', 'LogRoleImpl', 858);
|
|
function MainRoleImpl(){
|
|
RoleImpl.call(this, 'main');
|
|
}
|
|
|
|
defineClass(859, 35, {}, MainRoleImpl);
|
|
var Lcom_google_gwt_aria_client_MainRoleImpl_2_classLit = createForClass('com.google.gwt.aria.client', 'MainRoleImpl', 859);
|
|
function MarqueeRoleImpl(){
|
|
RoleImpl.call(this, 'marquee');
|
|
}
|
|
|
|
defineClass(860, 35, {}, MarqueeRoleImpl);
|
|
var Lcom_google_gwt_aria_client_MarqueeRoleImpl_2_classLit = createForClass('com.google.gwt.aria.client', 'MarqueeRoleImpl', 860);
|
|
function MathRoleImpl(){
|
|
RoleImpl.call(this, 'math');
|
|
}
|
|
|
|
defineClass(861, 35, {}, MathRoleImpl);
|
|
var Lcom_google_gwt_aria_client_MathRoleImpl_2_classLit = createForClass('com.google.gwt.aria.client', 'MathRoleImpl', 861);
|
|
function MenuRoleImpl(){
|
|
RoleImpl.call(this, 'menu');
|
|
}
|
|
|
|
defineClass(866, 35, {}, MenuRoleImpl);
|
|
var Lcom_google_gwt_aria_client_MenuRoleImpl_2_classLit = createForClass('com.google.gwt.aria.client', 'MenuRoleImpl', 866);
|
|
function $setAriaActivedescendantProperty(element, value_0){
|
|
$set_0(($clinit_Property() , ACTIVEDESCENDANT), element, stampJavaTypeInfo(getClassLiteralForArray(Lcom_google_gwt_aria_client_Id_2_classLit, 1), $intern_3, 302, 0, [value_0]));
|
|
}
|
|
|
|
function MenubarRoleImpl(){
|
|
RoleImpl.call(this, 'menubar');
|
|
}
|
|
|
|
defineClass(862, 35, {}, MenubarRoleImpl);
|
|
var Lcom_google_gwt_aria_client_MenubarRoleImpl_2_classLit = createForClass('com.google.gwt.aria.client', 'MenubarRoleImpl', 862);
|
|
function MenuitemRoleImpl(){
|
|
RoleImpl.call(this, 'menuitem');
|
|
}
|
|
|
|
defineClass(865, 35, {}, MenuitemRoleImpl);
|
|
var Lcom_google_gwt_aria_client_MenuitemRoleImpl_2_classLit = createForClass('com.google.gwt.aria.client', 'MenuitemRoleImpl', 865);
|
|
function MenuitemcheckboxRoleImpl(){
|
|
RoleImpl.call(this, 'menuitemcheckbox');
|
|
}
|
|
|
|
defineClass(863, 35, {}, MenuitemcheckboxRoleImpl);
|
|
var Lcom_google_gwt_aria_client_MenuitemcheckboxRoleImpl_2_classLit = createForClass('com.google.gwt.aria.client', 'MenuitemcheckboxRoleImpl', 863);
|
|
function MenuitemradioRoleImpl(){
|
|
RoleImpl.call(this, 'menuitemradio');
|
|
}
|
|
|
|
defineClass(864, 35, {}, MenuitemradioRoleImpl);
|
|
var Lcom_google_gwt_aria_client_MenuitemradioRoleImpl_2_classLit = createForClass('com.google.gwt.aria.client', 'MenuitemradioRoleImpl', 864);
|
|
function NavigationRoleImpl(){
|
|
RoleImpl.call(this, 'navigation');
|
|
}
|
|
|
|
defineClass(867, 35, {}, NavigationRoleImpl);
|
|
var Lcom_google_gwt_aria_client_NavigationRoleImpl_2_classLit = createForClass('com.google.gwt.aria.client', 'NavigationRoleImpl', 867);
|
|
function NoteRoleImpl(){
|
|
RoleImpl.call(this, 'note');
|
|
}
|
|
|
|
defineClass(868, 35, {}, NoteRoleImpl);
|
|
var Lcom_google_gwt_aria_client_NoteRoleImpl_2_classLit = createForClass('com.google.gwt.aria.client', 'NoteRoleImpl', 868);
|
|
function OptionRoleImpl(){
|
|
RoleImpl.call(this, 'option');
|
|
}
|
|
|
|
defineClass(869, 35, {}, OptionRoleImpl);
|
|
var Lcom_google_gwt_aria_client_OptionRoleImpl_2_classLit = createForClass('com.google.gwt.aria.client', 'OptionRoleImpl', 869);
|
|
function PresentationRoleImpl(){
|
|
RoleImpl.call(this, 'presentation');
|
|
}
|
|
|
|
defineClass(870, 35, {}, PresentationRoleImpl);
|
|
var Lcom_google_gwt_aria_client_PresentationRoleImpl_2_classLit = createForClass('com.google.gwt.aria.client', 'PresentationRoleImpl', 870);
|
|
function PrimitiveValueAttribute(name_0){
|
|
Attribute.call(this, name_0);
|
|
}
|
|
|
|
defineClass(114, 450, {}, PrimitiveValueAttribute);
|
|
_.getSingleValue = function getSingleValue_0(value_0){
|
|
return value_0 == null?'null':toString_9(value_0);
|
|
}
|
|
;
|
|
var Lcom_google_gwt_aria_client_PrimitiveValueAttribute_2_classLit = createForClass('com.google.gwt.aria.client', 'PrimitiveValueAttribute', 114);
|
|
function ProgressbarRoleImpl(){
|
|
RoleImpl.call(this, 'progressbar');
|
|
}
|
|
|
|
defineClass(871, 35, {}, ProgressbarRoleImpl);
|
|
var Lcom_google_gwt_aria_client_ProgressbarRoleImpl_2_classLit = createForClass('com.google.gwt.aria.client', 'ProgressbarRoleImpl', 871);
|
|
function $clinit_Property(){
|
|
$clinit_Property = emptyMethod;
|
|
ACTIVEDESCENDANT = new AriaValueAttribute('aria-activedescendant');
|
|
new PrimitiveValueAttribute('aria-atomic');
|
|
new AriaValueAttribute('aria-autocomplete');
|
|
new AriaValueAttribute('aria-controls');
|
|
new AriaValueAttribute('aria-describedby');
|
|
new AriaValueAttribute('aria-dropeffect');
|
|
new AriaValueAttribute('aria-flowto');
|
|
HASPOPUP = new PrimitiveValueAttribute('aria-haspopup');
|
|
new PrimitiveValueAttribute('aria-label');
|
|
new AriaValueAttribute('aria-labelledby');
|
|
new PrimitiveValueAttribute('aria-level');
|
|
new AriaValueAttribute('aria-live');
|
|
new PrimitiveValueAttribute('aria-multiline');
|
|
new PrimitiveValueAttribute('aria-multiselectable');
|
|
new AriaValueAttribute('aria-orientation');
|
|
new AriaValueAttribute('aria-owns');
|
|
new PrimitiveValueAttribute('aria-posinset');
|
|
new PrimitiveValueAttribute('aria-readonly');
|
|
new AriaValueAttribute('aria-relevant');
|
|
new PrimitiveValueAttribute('aria-required');
|
|
new PrimitiveValueAttribute('aria-setsize');
|
|
new AriaValueAttribute('aria-sort');
|
|
new PrimitiveValueAttribute('aria-valuemax');
|
|
new PrimitiveValueAttribute('aria-valuemin');
|
|
new PrimitiveValueAttribute('aria-valuenow');
|
|
new PrimitiveValueAttribute('aria-valuetext');
|
|
}
|
|
|
|
var ACTIVEDESCENDANT, HASPOPUP;
|
|
function RadioRoleImpl(){
|
|
RoleImpl.call(this, 'radio');
|
|
}
|
|
|
|
defineClass(873, 35, {}, RadioRoleImpl);
|
|
var Lcom_google_gwt_aria_client_RadioRoleImpl_2_classLit = createForClass('com.google.gwt.aria.client', 'RadioRoleImpl', 873);
|
|
function RadiogroupRoleImpl(){
|
|
RoleImpl.call(this, 'radiogroup');
|
|
}
|
|
|
|
defineClass(872, 35, {}, RadiogroupRoleImpl);
|
|
var Lcom_google_gwt_aria_client_RadiogroupRoleImpl_2_classLit = createForClass('com.google.gwt.aria.client', 'RadiogroupRoleImpl', 872);
|
|
function RegionRoleImpl(){
|
|
RoleImpl.call(this, 'region');
|
|
}
|
|
|
|
defineClass(874, 35, {}, RegionRoleImpl);
|
|
var Lcom_google_gwt_aria_client_RegionRoleImpl_2_classLit = createForClass('com.google.gwt.aria.client', 'RegionRoleImpl', 874);
|
|
function $clinit_Roles(){
|
|
$clinit_Roles = emptyMethod;
|
|
ALERTDIALOG = new AlertdialogRoleImpl;
|
|
ALERT = new AlertRoleImpl;
|
|
APPLICATION = new ApplicationRoleImpl;
|
|
ARTICLE = new ArticleRoleImpl;
|
|
BANNER = new BannerRoleImpl;
|
|
BUTTON = new ButtonRoleImpl;
|
|
CHECKBOX = new CheckboxRoleImpl;
|
|
COLUMNHEADER = new ColumnheaderRoleImpl;
|
|
COMBOBOX = new ComboboxRoleImpl;
|
|
COMPLEMENTARY = new ComplementaryRoleImpl;
|
|
CONTENTINFO = new ContentinfoRoleImpl;
|
|
DEFINITION = new DefinitionRoleImpl;
|
|
DIALOG = new DialogRoleImpl;
|
|
DIRECTORY = new DirectoryRoleImpl;
|
|
DOCUMENT = new DocumentRoleImpl;
|
|
FORM = new FormRoleImpl;
|
|
GRIDCELL = new GridcellRoleImpl;
|
|
GRID = new GridRoleImpl;
|
|
GROUP = new GroupRoleImpl;
|
|
HEADING = new HeadingRoleImpl;
|
|
IMG = new ImgRoleImpl;
|
|
LINK = new LinkRoleImpl;
|
|
LISTBOX = new ListboxRoleImpl;
|
|
LISTITEM = new ListitemRoleImpl;
|
|
LIST = new ListRoleImpl;
|
|
LOG = new LogRoleImpl;
|
|
MAIN = new MainRoleImpl;
|
|
MARQUEE = new MarqueeRoleImpl;
|
|
MATH = new MathRoleImpl;
|
|
MENUBAR = new MenubarRoleImpl;
|
|
MENUITEMCHECKBOX = new MenuitemcheckboxRoleImpl;
|
|
MENUITEMRADIO = new MenuitemradioRoleImpl;
|
|
MENUITEM = new MenuitemRoleImpl;
|
|
MENU = new MenuRoleImpl;
|
|
NAVIGATION = new NavigationRoleImpl;
|
|
NOTE = new NoteRoleImpl;
|
|
OPTION = new OptionRoleImpl;
|
|
PRESENTATION = new PresentationRoleImpl;
|
|
PROGRESSBAR = new ProgressbarRoleImpl;
|
|
RADIOGROUP = new RadiogroupRoleImpl;
|
|
RADIO = new RadioRoleImpl;
|
|
REGION = new RegionRoleImpl;
|
|
ROWGROUP = new RowgroupRoleImpl;
|
|
ROWHEADER = new RowheaderRoleImpl;
|
|
ROW = new RowRoleImpl;
|
|
SCROLLBAR = new ScrollbarRoleImpl;
|
|
SEARCH = new SearchRoleImpl;
|
|
SEPARATOR = new SeparatorRoleImpl;
|
|
SLIDER = new SliderRoleImpl;
|
|
SPINBUTTON = new SpinbuttonRoleImpl;
|
|
STATUS = new StatusRoleImpl;
|
|
TABLIST = new TablistRoleImpl;
|
|
TABPANEL = new TabpanelRoleImpl;
|
|
TAB = new TabRoleImpl;
|
|
TEXTBOX = new TextboxRoleImpl;
|
|
TIMER = new TimerRoleImpl;
|
|
TOOLBAR = new ToolbarRoleImpl;
|
|
TOOLTIP = new TooltipRoleImpl;
|
|
TREEGRID = new TreegridRoleImpl;
|
|
TREEITEM = new TreeitemRoleImpl;
|
|
TREE = new TreeRoleImpl;
|
|
ROLES_MAP = new HashMap;
|
|
$putStringValue(ROLES_MAP, 'region', REGION);
|
|
$putStringValue(ROLES_MAP, 'alert', ALERT);
|
|
$putStringValue(ROLES_MAP, 'dialog', DIALOG);
|
|
$putStringValue(ROLES_MAP, 'alertdialog', ALERTDIALOG);
|
|
$putStringValue(ROLES_MAP, 'application', APPLICATION);
|
|
$putStringValue(ROLES_MAP, 'document', DOCUMENT);
|
|
$putStringValue(ROLES_MAP, 'article', ARTICLE);
|
|
$putStringValue(ROLES_MAP, 'banner', BANNER);
|
|
$putStringValue(ROLES_MAP, 'button', BUTTON);
|
|
$putStringValue(ROLES_MAP, 'checkbox', CHECKBOX);
|
|
$putStringValue(ROLES_MAP, 'gridcell', GRIDCELL);
|
|
$putStringValue(ROLES_MAP, 'columnheader', COLUMNHEADER);
|
|
$putStringValue(ROLES_MAP, 'group', GROUP);
|
|
$putStringValue(ROLES_MAP, 'combobox', COMBOBOX);
|
|
$putStringValue(ROLES_MAP, 'complementary', COMPLEMENTARY);
|
|
$putStringValue(ROLES_MAP, 'contentinfo', CONTENTINFO);
|
|
$putStringValue(ROLES_MAP, 'definition', DEFINITION);
|
|
$putStringValue(ROLES_MAP, 'list', LIST);
|
|
$putStringValue(ROLES_MAP, 'directory', DIRECTORY);
|
|
$putStringValue(ROLES_MAP, 'form', FORM);
|
|
$putStringValue(ROLES_MAP, 'grid', GRID);
|
|
$putStringValue(ROLES_MAP, 'heading', HEADING);
|
|
$putStringValue(ROLES_MAP, 'img', IMG);
|
|
$putStringValue(ROLES_MAP, 'link', LINK);
|
|
$putStringValue(ROLES_MAP, 'listbox', LISTBOX);
|
|
$putStringValue(ROLES_MAP, 'listitem', LISTITEM);
|
|
$putStringValue(ROLES_MAP, 'log', LOG);
|
|
$putStringValue(ROLES_MAP, 'main', MAIN);
|
|
$putStringValue(ROLES_MAP, 'marquee', MARQUEE);
|
|
$putStringValue(ROLES_MAP, 'math', MATH);
|
|
$putStringValue(ROLES_MAP, 'menu', MENU);
|
|
$putStringValue(ROLES_MAP, 'menubar', MENUBAR);
|
|
$putStringValue(ROLES_MAP, 'menuitem', MENUITEM);
|
|
$putStringValue(ROLES_MAP, 'menuitemcheckbox', MENUITEMCHECKBOX);
|
|
$putStringValue(ROLES_MAP, 'option', OPTION);
|
|
$putStringValue(ROLES_MAP, 'radio', RADIO);
|
|
$putStringValue(ROLES_MAP, 'menuitemradio', MENUITEMRADIO);
|
|
$putStringValue(ROLES_MAP, 'navigation', NAVIGATION);
|
|
$putStringValue(ROLES_MAP, 'note', NOTE);
|
|
$putStringValue(ROLES_MAP, 'presentation', PRESENTATION);
|
|
$putStringValue(ROLES_MAP, 'progressbar', PROGRESSBAR);
|
|
$putStringValue(ROLES_MAP, 'radiogroup', RADIOGROUP);
|
|
$putStringValue(ROLES_MAP, 'row', ROW);
|
|
$putStringValue(ROLES_MAP, 'rowgroup', ROWGROUP);
|
|
$putStringValue(ROLES_MAP, 'rowheader', ROWHEADER);
|
|
$putStringValue(ROLES_MAP, 'search', SEARCH);
|
|
$putStringValue(ROLES_MAP, 'separator', SEPARATOR);
|
|
$putStringValue(ROLES_MAP, 'scrollbar', SCROLLBAR);
|
|
$putStringValue(ROLES_MAP, 'slider', SLIDER);
|
|
$putStringValue(ROLES_MAP, 'spinbutton', SPINBUTTON);
|
|
$putStringValue(ROLES_MAP, 'status', STATUS);
|
|
$putStringValue(ROLES_MAP, 'tab', TAB);
|
|
$putStringValue(ROLES_MAP, 'tablist', TABLIST);
|
|
$putStringValue(ROLES_MAP, 'tabpanel', TABPANEL);
|
|
$putStringValue(ROLES_MAP, 'textbox', TEXTBOX);
|
|
$putStringValue(ROLES_MAP, 'timer', TIMER);
|
|
$putStringValue(ROLES_MAP, 'toolbar', TOOLBAR);
|
|
$putStringValue(ROLES_MAP, 'tooltip', TOOLTIP);
|
|
$putStringValue(ROLES_MAP, 'tree', TREE);
|
|
$putStringValue(ROLES_MAP, 'treegrid', TREEGRID);
|
|
$putStringValue(ROLES_MAP, 'treeitem', TREEITEM);
|
|
}
|
|
|
|
var ALERT, ALERTDIALOG, APPLICATION, ARTICLE, BANNER, BUTTON, CHECKBOX, COLUMNHEADER, COMBOBOX, COMPLEMENTARY, CONTENTINFO, DEFINITION, DIALOG, DIRECTORY, DOCUMENT, FORM, GRID, GRIDCELL, GROUP, HEADING, IMG, LINK, LIST, LISTBOX, LISTITEM, LOG, MAIN, MARQUEE, MATH, MENU, MENUBAR, MENUITEM, MENUITEMCHECKBOX, MENUITEMRADIO, NAVIGATION, NOTE, OPTION, PRESENTATION, PROGRESSBAR, RADIO, RADIOGROUP, REGION, ROLES_MAP, ROW, ROWGROUP, ROWHEADER, SCROLLBAR, SEARCH, SEPARATOR, SLIDER, SPINBUTTON, STATUS, TAB, TABLIST, TABPANEL, TEXTBOX, TIMER, TOOLBAR, TOOLTIP, TREE, TREEGRID, TREEITEM;
|
|
function RowRoleImpl(){
|
|
RoleImpl.call(this, 'row');
|
|
}
|
|
|
|
defineClass(877, 35, {}, RowRoleImpl);
|
|
var Lcom_google_gwt_aria_client_RowRoleImpl_2_classLit = createForClass('com.google.gwt.aria.client', 'RowRoleImpl', 877);
|
|
function RowgroupRoleImpl(){
|
|
RoleImpl.call(this, 'rowgroup');
|
|
}
|
|
|
|
defineClass(875, 35, {}, RowgroupRoleImpl);
|
|
var Lcom_google_gwt_aria_client_RowgroupRoleImpl_2_classLit = createForClass('com.google.gwt.aria.client', 'RowgroupRoleImpl', 875);
|
|
function RowheaderRoleImpl(){
|
|
RoleImpl.call(this, 'rowheader');
|
|
}
|
|
|
|
defineClass(876, 35, {}, RowheaderRoleImpl);
|
|
var Lcom_google_gwt_aria_client_RowheaderRoleImpl_2_classLit = createForClass('com.google.gwt.aria.client', 'RowheaderRoleImpl', 876);
|
|
function ScrollbarRoleImpl(){
|
|
RoleImpl.call(this, 'scrollbar');
|
|
}
|
|
|
|
defineClass(878, 35, {}, ScrollbarRoleImpl);
|
|
var Lcom_google_gwt_aria_client_ScrollbarRoleImpl_2_classLit = createForClass('com.google.gwt.aria.client', 'ScrollbarRoleImpl', 878);
|
|
function SearchRoleImpl(){
|
|
RoleImpl.call(this, 'search');
|
|
}
|
|
|
|
defineClass(879, 35, {}, SearchRoleImpl);
|
|
var Lcom_google_gwt_aria_client_SearchRoleImpl_2_classLit = createForClass('com.google.gwt.aria.client', 'SearchRoleImpl', 879);
|
|
function SeparatorRoleImpl(){
|
|
RoleImpl.call(this, 'separator');
|
|
}
|
|
|
|
defineClass(880, 35, {}, SeparatorRoleImpl);
|
|
var Lcom_google_gwt_aria_client_SeparatorRoleImpl_2_classLit = createForClass('com.google.gwt.aria.client', 'SeparatorRoleImpl', 880);
|
|
function SliderRoleImpl(){
|
|
RoleImpl.call(this, 'slider');
|
|
}
|
|
|
|
defineClass(881, 35, {}, SliderRoleImpl);
|
|
var Lcom_google_gwt_aria_client_SliderRoleImpl_2_classLit = createForClass('com.google.gwt.aria.client', 'SliderRoleImpl', 881);
|
|
function SpinbuttonRoleImpl(){
|
|
RoleImpl.call(this, 'spinbutton');
|
|
}
|
|
|
|
defineClass(882, 35, {}, SpinbuttonRoleImpl);
|
|
var Lcom_google_gwt_aria_client_SpinbuttonRoleImpl_2_classLit = createForClass('com.google.gwt.aria.client', 'SpinbuttonRoleImpl', 882);
|
|
function $clinit_State(){
|
|
$clinit_State = emptyMethod;
|
|
new PrimitiveValueAttribute('aria-busy');
|
|
new AriaValueAttribute('aria-checked');
|
|
new PrimitiveValueAttribute('aria-disabled');
|
|
new AriaValueAttribute('aria-expanded');
|
|
new AriaValueAttribute('aria-grabbed');
|
|
HIDDEN = new PrimitiveValueAttribute('aria-hidden');
|
|
new AriaValueAttribute('aria-invalid');
|
|
new AriaValueAttribute('aria-pressed');
|
|
new AriaValueAttribute('aria-selected');
|
|
}
|
|
|
|
var HIDDEN;
|
|
function StatusRoleImpl(){
|
|
RoleImpl.call(this, 'status');
|
|
}
|
|
|
|
defineClass(883, 35, {}, StatusRoleImpl);
|
|
var Lcom_google_gwt_aria_client_StatusRoleImpl_2_classLit = createForClass('com.google.gwt.aria.client', 'StatusRoleImpl', 883);
|
|
function TabRoleImpl(){
|
|
RoleImpl.call(this, 'tab');
|
|
}
|
|
|
|
defineClass(886, 35, {}, TabRoleImpl);
|
|
var Lcom_google_gwt_aria_client_TabRoleImpl_2_classLit = createForClass('com.google.gwt.aria.client', 'TabRoleImpl', 886);
|
|
function TablistRoleImpl(){
|
|
RoleImpl.call(this, 'tablist');
|
|
}
|
|
|
|
defineClass(884, 35, {}, TablistRoleImpl);
|
|
var Lcom_google_gwt_aria_client_TablistRoleImpl_2_classLit = createForClass('com.google.gwt.aria.client', 'TablistRoleImpl', 884);
|
|
function TabpanelRoleImpl(){
|
|
RoleImpl.call(this, 'tabpanel');
|
|
}
|
|
|
|
defineClass(885, 35, {}, TabpanelRoleImpl);
|
|
var Lcom_google_gwt_aria_client_TabpanelRoleImpl_2_classLit = createForClass('com.google.gwt.aria.client', 'TabpanelRoleImpl', 885);
|
|
function TextboxRoleImpl(){
|
|
RoleImpl.call(this, 'textbox');
|
|
}
|
|
|
|
defineClass(887, 35, {}, TextboxRoleImpl);
|
|
var Lcom_google_gwt_aria_client_TextboxRoleImpl_2_classLit = createForClass('com.google.gwt.aria.client', 'TextboxRoleImpl', 887);
|
|
function TimerRoleImpl(){
|
|
RoleImpl.call(this, 'timer');
|
|
}
|
|
|
|
defineClass(888, 35, {}, TimerRoleImpl);
|
|
var Lcom_google_gwt_aria_client_TimerRoleImpl_2_classLit = createForClass('com.google.gwt.aria.client', 'TimerRoleImpl', 888);
|
|
function ToolbarRoleImpl(){
|
|
RoleImpl.call(this, 'toolbar');
|
|
}
|
|
|
|
defineClass(889, 35, {}, ToolbarRoleImpl);
|
|
var Lcom_google_gwt_aria_client_ToolbarRoleImpl_2_classLit = createForClass('com.google.gwt.aria.client', 'ToolbarRoleImpl', 889);
|
|
function TooltipRoleImpl(){
|
|
RoleImpl.call(this, 'tooltip');
|
|
}
|
|
|
|
defineClass(890, 35, {}, TooltipRoleImpl);
|
|
var Lcom_google_gwt_aria_client_TooltipRoleImpl_2_classLit = createForClass('com.google.gwt.aria.client', 'TooltipRoleImpl', 890);
|
|
function TreeRoleImpl(){
|
|
RoleImpl.call(this, 'tree');
|
|
}
|
|
|
|
defineClass(893, 35, {}, TreeRoleImpl);
|
|
var Lcom_google_gwt_aria_client_TreeRoleImpl_2_classLit = createForClass('com.google.gwt.aria.client', 'TreeRoleImpl', 893);
|
|
function TreegridRoleImpl(){
|
|
RoleImpl.call(this, 'treegrid');
|
|
}
|
|
|
|
defineClass(891, 35, {}, TreegridRoleImpl);
|
|
var Lcom_google_gwt_aria_client_TreegridRoleImpl_2_classLit = createForClass('com.google.gwt.aria.client', 'TreegridRoleImpl', 891);
|
|
function TreeitemRoleImpl(){
|
|
RoleImpl.call(this, 'treeitem');
|
|
}
|
|
|
|
defineClass(892, 35, {}, TreeitemRoleImpl);
|
|
var Lcom_google_gwt_aria_client_TreeitemRoleImpl_2_classLit = createForClass('com.google.gwt.aria.client', 'TreeitemRoleImpl', 892);
|
|
function $addStyleDependentName(this$static, styleSuffix){
|
|
$setStyleName_0(this$static, getStylePrimaryName(($clinit_DOM() , this$static.element)) + '-' + styleSuffix, true);
|
|
}
|
|
|
|
function $addStyleName(this$static, style){
|
|
setStyleName(this$static.getStyleElement(), style, true);
|
|
}
|
|
|
|
function $getAbsoluteLeft(this$static){
|
|
return $getAbsoluteLeft_0(($clinit_DOM() , this$static.element));
|
|
}
|
|
|
|
function $getAbsoluteTop(this$static){
|
|
return $getBoundingClientRectTop(($clinit_DOM() , this$static.element)) + $wnd.pageYOffset | 0;
|
|
}
|
|
|
|
function $getElement(this$static){
|
|
return $clinit_DOM() , this$static.element;
|
|
}
|
|
|
|
function $getOffsetHeight(this$static){
|
|
return $getPropertyInt(($clinit_DOM() , this$static.element), 'offsetHeight');
|
|
}
|
|
|
|
function $getOffsetWidth(this$static){
|
|
return $getPropertyInt(($clinit_DOM() , this$static.element), 'offsetWidth');
|
|
}
|
|
|
|
function $removeStyleDependentName(this$static){
|
|
$setStyleName_0(this$static, getStylePrimaryName(($clinit_DOM() , this$static.element)) + '-' + 'current', false);
|
|
}
|
|
|
|
function $removeStyleName(this$static, style){
|
|
setStyleName(($clinit_DOM() , this$static.element), style, false);
|
|
}
|
|
|
|
function $resolvePotentialElement(){
|
|
throw toJs(new UnsupportedOperationException);
|
|
}
|
|
|
|
function $setElement(this$static, elem){
|
|
$setElement_0(this$static, ($clinit_DOM() , elem));
|
|
}
|
|
|
|
function $setElement_0(this$static, elem){
|
|
this$static.element = elem;
|
|
}
|
|
|
|
function $setHeight(this$static, height){
|
|
($clinit_DOM() , this$static.element).style['height'] = height;
|
|
}
|
|
|
|
function $setStyleName(this$static, style){
|
|
$setClassName(this$static.getStyleElement(), style);
|
|
}
|
|
|
|
function $setStyleName_0(this$static, style, add_0){
|
|
setStyleName(this$static.getStyleElement(), style, add_0);
|
|
}
|
|
|
|
function $setStylePrimaryName(this$static, style){
|
|
setStylePrimaryName(($clinit_DOM() , this$static.element), style);
|
|
}
|
|
|
|
function $setTitle(this$static, title_0){
|
|
title_0 == null || title_0.length == 0?(($clinit_DOM() , this$static.element).removeAttribute('title') , undefined):$setAttribute(($clinit_DOM() , this$static.element), 'title', title_0);
|
|
}
|
|
|
|
function $setVisible(this$static, visible){
|
|
setVisible(($clinit_DOM() , this$static.element), visible);
|
|
}
|
|
|
|
function $setWidth(this$static, width_0){
|
|
($clinit_DOM() , this$static.element).style['width'] = width_0;
|
|
}
|
|
|
|
function $sinkBitlessEvent(this$static, eventTypeName){
|
|
$clinit_DOM();
|
|
$sinkBitlessEvent_0(this$static.element, eventTypeName);
|
|
}
|
|
|
|
function getStylePrimaryName(elem){
|
|
var fullClassName, spaceIdx;
|
|
fullClassName = elem.className || '';
|
|
spaceIdx = $indexOf_1(fullClassName, fromCodePoint(32));
|
|
if (spaceIdx >= 0) {
|
|
return fullClassName.substr(0, spaceIdx);
|
|
}
|
|
return fullClassName;
|
|
}
|
|
|
|
function setStyleName(elem, style, add_0){
|
|
if (!elem) {
|
|
throw toJs(new RuntimeException_0('Null widget handle. If you are creating a composite, ensure that initWidget() has been called.'));
|
|
}
|
|
style = $trim(style);
|
|
if (style.length == 0) {
|
|
throw toJs(new IllegalArgumentException_0('Style names cannot be empty'));
|
|
}
|
|
add_0?$addClassName(elem, style):$removeClassName(elem, style);
|
|
}
|
|
|
|
function setStylePrimaryName(elem, style){
|
|
if (!elem) {
|
|
throw toJs(new RuntimeException_0('Null widget handle. If you are creating a composite, ensure that initWidget() has been called.'));
|
|
}
|
|
style = $trim(style);
|
|
if (style.length == 0) {
|
|
throw toJs(new IllegalArgumentException_0('Style names cannot be empty'));
|
|
}
|
|
updatePrimaryAndDependentStyleNames(elem, style);
|
|
}
|
|
|
|
function setVisible(elem, visible){
|
|
elem.style.display = visible?'':'none';
|
|
visible?elem.removeAttribute('aria-hidden'):elem.setAttribute('aria-hidden', 'true');
|
|
}
|
|
|
|
function updatePrimaryAndDependentStyleNames(elem, newPrimaryStyle){
|
|
var classes = (elem.className || '').split(/\s+/);
|
|
if (!classes) {
|
|
return;
|
|
}
|
|
var oldPrimaryStyle = classes[0];
|
|
var oldPrimaryStyleLen = oldPrimaryStyle.length;
|
|
classes[0] = newPrimaryStyle;
|
|
for (var i = 1, n = classes.length; i < n; i++) {
|
|
var name_0 = classes[i];
|
|
name_0.length > oldPrimaryStyleLen && name_0.charAt(oldPrimaryStyleLen) == '-' && name_0.indexOf(oldPrimaryStyle) == 0 && (classes[i] = newPrimaryStyle + name_0.substring(oldPrimaryStyleLen));
|
|
}
|
|
elem.className = classes.join(' ');
|
|
}
|
|
|
|
defineClass(22, 1, {23:1, 22:1});
|
|
_.getOffsetHeight = function getOffsetHeight(){
|
|
return $getOffsetHeight(this);
|
|
}
|
|
;
|
|
_.getStyleElement = function getStyleElement(){
|
|
return $clinit_DOM() , this.element;
|
|
}
|
|
;
|
|
_.resolvePotentialElement = function resolvePotentialElement(){
|
|
return $resolvePotentialElement();
|
|
}
|
|
;
|
|
_.setHeight_0 = function setHeight(height){
|
|
$setHeight(this, height);
|
|
}
|
|
;
|
|
_.setWidth_0 = function setWidth(width_0){
|
|
$setWidth(this, width_0);
|
|
}
|
|
;
|
|
_.toString_0 = function toString_1(){
|
|
if (!this.element) {
|
|
return '(null handle)';
|
|
}
|
|
return ($clinit_DOM() , this.element).outerHTML;
|
|
}
|
|
;
|
|
var Lcom_google_gwt_user_client_ui_UIObject_2_classLit = createForClass('com.google.gwt.user.client.ui', 'UIObject', 22);
|
|
function $addDomHandler(this$static, handler, type_0){
|
|
var typeInt;
|
|
typeInt = getTypeInt(type_0.name_0);
|
|
typeInt == -1?$sinkBitlessEvent(this$static, type_0.name_0):this$static.sinkEvents(typeInt);
|
|
return $addHandler_0(!this$static.handlerManager?(this$static.handlerManager = new HandlerManager(this$static)):this$static.handlerManager, type_0, handler);
|
|
}
|
|
|
|
function $addHandler(this$static, handler, type_0){
|
|
return $addHandler_0(!this$static.handlerManager?(this$static.handlerManager = new HandlerManager(this$static)):this$static.handlerManager, type_0, handler);
|
|
}
|
|
|
|
function $fireEvent(this$static, event_0){
|
|
!!this$static.handlerManager && $fireEvent_0(this$static.handlerManager, event_0);
|
|
}
|
|
|
|
function $onAttach(this$static){
|
|
var bitsToAdd;
|
|
if (this$static.isAttached()) {
|
|
throw toJs(new IllegalStateException_0("Should only call onAttach when the widget is detached from the browser's document"));
|
|
}
|
|
this$static.attached = true;
|
|
$clinit_DOM();
|
|
setEventListener(this$static.element, this$static);
|
|
bitsToAdd = this$static.eventsToSink;
|
|
this$static.eventsToSink = -1;
|
|
bitsToAdd > 0 && this$static.sinkEvents(bitsToAdd);
|
|
this$static.doAttachChildren();
|
|
this$static.onLoad();
|
|
fire_0(this$static, true);
|
|
}
|
|
|
|
function $onBrowserEvent(this$static, event_0){
|
|
var related;
|
|
switch ($clinit_DOM() , $eventGetTypeInt(event_0.type)) {
|
|
case 16:
|
|
case 32:
|
|
related = event_0.relatedTarget;
|
|
if (!!related && isOrHasChildImpl(this$static.element, related)) {
|
|
return;
|
|
}
|
|
|
|
}
|
|
fireNativeEvent(event_0, this$static, this$static.element);
|
|
}
|
|
|
|
function $onDetach(this$static){
|
|
if (!this$static.isAttached()) {
|
|
throw toJs(new IllegalStateException_0("Should only call onDetach when the widget is attached to the browser's document"));
|
|
}
|
|
try {
|
|
this$static.onUnload();
|
|
fire_0(this$static, false);
|
|
}
|
|
finally {
|
|
try {
|
|
this$static.doDetachChildren();
|
|
}
|
|
finally {
|
|
$clinit_DOM();
|
|
this$static.element.__listener = null;
|
|
this$static.attached = false;
|
|
}
|
|
}
|
|
}
|
|
|
|
function $removeFromParent(this$static){
|
|
if (!this$static.parent_0) {
|
|
$clinit_RootPanel();
|
|
$contains_3(widgetsToDetach, this$static) && detachNow(this$static);
|
|
}
|
|
else if (instanceOf(this$static.parent_0, 44)) {
|
|
this$static.parent_0.remove_0(this$static);
|
|
}
|
|
else if (this$static.parent_0) {
|
|
throw toJs(new IllegalStateException_0("This widget's parent does not implement HasWidgets"));
|
|
}
|
|
}
|
|
|
|
function $setParent(this$static, parent_0){
|
|
var oldParent;
|
|
oldParent = this$static.parent_0;
|
|
if (!parent_0) {
|
|
try {
|
|
!!oldParent && oldParent.isAttached() && this$static.onDetach();
|
|
}
|
|
finally {
|
|
this$static.parent_0 = null;
|
|
}
|
|
}
|
|
else {
|
|
if (oldParent) {
|
|
throw toJs(new IllegalStateException_0('Cannot set a new parent without first clearing the old parent'));
|
|
}
|
|
this$static.parent_0 = parent_0;
|
|
parent_0.isAttached() && this$static.onAttach();
|
|
}
|
|
}
|
|
|
|
function $sinkEvents(this$static, eventBitsToAdd){
|
|
this$static.eventsToSink == -1?sinkEvents_0(($clinit_DOM() , this$static.element), eventBitsToAdd | (this$static.element.__eventBits || 0)):(this$static.eventsToSink |= eventBitsToAdd);
|
|
}
|
|
|
|
defineClass(24, 22, $intern_4);
|
|
_.doAttachChildren = function doAttachChildren(){
|
|
}
|
|
;
|
|
_.doDetachChildren = function doDetachChildren(){
|
|
}
|
|
;
|
|
_.fireEvent = function fireEvent(event_0){
|
|
$fireEvent(this, event_0);
|
|
}
|
|
;
|
|
_.isAttached = function isAttached(){
|
|
return this.attached;
|
|
}
|
|
;
|
|
_.onAttach = function onAttach(){
|
|
$onAttach(this);
|
|
}
|
|
;
|
|
_.onBrowserEvent = function onBrowserEvent(event_0){
|
|
$onBrowserEvent(this, event_0);
|
|
}
|
|
;
|
|
_.onDetach = function onDetach(){
|
|
$onDetach(this);
|
|
}
|
|
;
|
|
_.onLoad = function onLoad(){
|
|
}
|
|
;
|
|
_.onUnload = function onUnload(){
|
|
}
|
|
;
|
|
_.sinkEvents = function sinkEvents(eventBitsToAdd){
|
|
$sinkEvents(this, eventBitsToAdd);
|
|
}
|
|
;
|
|
_.attached = false;
|
|
_.eventsToSink = 0;
|
|
var Lcom_google_gwt_user_client_ui_Widget_2_classLit = createForClass('com.google.gwt.user.client.ui', 'Widget', 24);
|
|
function $setEnabled(this$static, enabled){
|
|
($clinit_DOM() , this$static.element)['disabled'] = !enabled;
|
|
}
|
|
|
|
function $setFocus(this$static){
|
|
($clinit_DOM() , this$static.element).focus();
|
|
}
|
|
|
|
function FocusWidget(elem){
|
|
$setElement_0(this, ($clinit_DOM() , elem));
|
|
}
|
|
|
|
defineClass(82, 24, $intern_5);
|
|
_.getTabIndex = function getTabIndex(){
|
|
return $getTabIndex(($clinit_DOM() , this.element));
|
|
}
|
|
;
|
|
_.onAttach = function onAttach_0(){
|
|
var tabIndex;
|
|
$onAttach(this);
|
|
tabIndex = this.getTabIndex();
|
|
-1 == tabIndex && this.setTabIndex(0);
|
|
}
|
|
;
|
|
_.setTabIndex = function setTabIndex(index_0){
|
|
$setTabIndex(($clinit_DOM() , this.element), index_0);
|
|
}
|
|
;
|
|
var Lcom_google_gwt_user_client_ui_FocusWidget_2_classLit = createForClass('com.google.gwt.user.client.ui', 'FocusWidget', 82);
|
|
function $getContext2d(this$static){
|
|
return ($clinit_DOM() , this$static.element).getContext('2d');
|
|
}
|
|
|
|
function $getCoordinateSpaceWidth(this$static){
|
|
return ($clinit_DOM() , this$static.element).width;
|
|
}
|
|
|
|
function $setCoordinateSpaceHeight(this$static, height){
|
|
$setHeight_0(($clinit_DOM() , this$static.element), height);
|
|
}
|
|
|
|
function $setCoordinateSpaceWidth(this$static, width_0){
|
|
$setWidth_0(($clinit_DOM() , this$static.element), width_0);
|
|
}
|
|
|
|
function $toDataUrl(this$static){
|
|
return ($clinit_DOM() , this$static.element).toDataURL();
|
|
}
|
|
|
|
function Canvas_0(element){
|
|
$setElement_0(this, ($clinit_DOM() , element));
|
|
}
|
|
|
|
function createIfSupported(){
|
|
var element;
|
|
!detector && (detector = new Canvas$CanvasElementSupportDetectedMaybe);
|
|
element = $doc.createElement('canvas');
|
|
if (!element.getContext) {
|
|
return null;
|
|
}
|
|
return new Canvas_0(element);
|
|
}
|
|
|
|
defineClass(668, 82, $intern_5, Canvas_0);
|
|
var detector;
|
|
var Lcom_google_gwt_canvas_client_Canvas_2_classLit = createForClass('com.google.gwt.canvas.client', 'Canvas', 668);
|
|
defineClass(982, 1, {});
|
|
var Lcom_google_gwt_canvas_client_Canvas$CanvasElementSupportDetector_2_classLit = createForClass('com.google.gwt.canvas.client', 'Canvas/CanvasElementSupportDetector', 982);
|
|
function Canvas$CanvasElementSupportDetectedMaybe(){
|
|
}
|
|
|
|
defineClass(669, 982, {}, Canvas$CanvasElementSupportDetectedMaybe);
|
|
var Lcom_google_gwt_canvas_client_Canvas$CanvasElementSupportDetectedMaybe_2_classLit = createForClass('com.google.gwt.canvas.client', 'Canvas/CanvasElementSupportDetectedMaybe', 669);
|
|
function $hashCode(this$static){
|
|
return !!this$static && !!this$static.hashCode?this$static.hashCode():getHashCode(this$static);
|
|
}
|
|
|
|
var Lcom_google_gwt_core_client_JavaScriptObject_2_classLit = createForClass('com.google.gwt.core.client', 'JavaScriptObject$', 0);
|
|
function $addColorStop(this$static, offset, color_0){
|
|
this$static.addColorStop(offset, color_0);
|
|
}
|
|
|
|
function $arc(this$static, x_0, y_0, radius, startAngle, endAngle){
|
|
this$static.arc(x_0, y_0, radius, startAngle, endAngle, false);
|
|
}
|
|
|
|
function $arc_0(this$static, x_0, y_0, radius, startAngle, endAngle, anticlockwise){
|
|
this$static.arc(x_0, y_0, radius, startAngle, endAngle, anticlockwise);
|
|
}
|
|
|
|
function $bezierCurveTo(this$static, cp1x, cp1y, cp2x, cp2y, x_0, y_0){
|
|
this$static.bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x_0, y_0);
|
|
}
|
|
|
|
function $createLinearGradient(this$static, x0, y0, x1, y1){
|
|
return this$static.createLinearGradient(x0, y0, x1, y1);
|
|
}
|
|
|
|
function $drawImage(this$static, image, dx, dy){
|
|
this$static.drawImage(image, dx, dy);
|
|
}
|
|
|
|
function $fillRect(this$static, x_0, y_0, w, h){
|
|
this$static.fillRect(x_0, y_0, w, h);
|
|
}
|
|
|
|
function $fillText(this$static, text_0, x_0, y_0){
|
|
this$static.fillText && this$static.fillText(text_0, x_0, y_0);
|
|
}
|
|
|
|
function $lineTo(this$static, x_0, y_0){
|
|
this$static.lineTo(x_0, y_0);
|
|
}
|
|
|
|
function $measureText(this$static, text_0){
|
|
return this$static.measureText(text_0);
|
|
}
|
|
|
|
function $moveTo(this$static, x_0, y_0){
|
|
this$static.moveTo(x_0, y_0);
|
|
}
|
|
|
|
function $rect(this$static, x_0, y_0, w, h){
|
|
this$static.rect(x_0, y_0, w, h);
|
|
}
|
|
|
|
function $scale(this$static, x_0, y_0){
|
|
this$static.scale(x_0, y_0);
|
|
}
|
|
|
|
function $setFillStyleWeb(this$static, fillStyle){
|
|
this$static.fillStyle = fillStyle;
|
|
}
|
|
|
|
function $setFont(this$static, f){
|
|
this$static.font = f;
|
|
}
|
|
|
|
function $setGlobalAlpha(this$static, alpha_0){
|
|
this$static.globalAlpha = alpha_0;
|
|
}
|
|
|
|
function $setLineCap(this$static, lineCap){
|
|
this$static.lineCap = lineCap;
|
|
}
|
|
|
|
function $setLineWidth(this$static, lineWidth){
|
|
this$static.lineWidth = lineWidth;
|
|
}
|
|
|
|
function $setStrokeStyleWeb(this$static, strokeStyle){
|
|
this$static.strokeStyle = strokeStyle;
|
|
}
|
|
|
|
function $setTransform(this$static, m11, m12, m21, m22, dx, dy){
|
|
this$static.setTransform(m11, m12, m21, m22, dx, dy);
|
|
}
|
|
|
|
function $strokeRect(this$static, x_0, y_0, w, h){
|
|
this$static.strokeRect(x_0, y_0, w, h);
|
|
}
|
|
|
|
function $transform(this$static, m11, m12, m21, m22, dx, dy){
|
|
this$static.transform(m11, m12, m21, m22, dx, dy);
|
|
}
|
|
|
|
function $translate(this$static, x_0, y_0){
|
|
this$static.translate(x_0, y_0);
|
|
}
|
|
|
|
function Enum(name_0, ordinal){
|
|
this.name_0 = name_0;
|
|
this.ordinal = ordinal;
|
|
}
|
|
|
|
defineClass(15, 1, {3:1, 16:1, 15:1});
|
|
_.compareTo = function compareTo(other){
|
|
return this.ordinal - other.ordinal;
|
|
}
|
|
;
|
|
_.equals_0 = function equals_0(other){
|
|
return this === other;
|
|
}
|
|
;
|
|
_.hashCode_0 = function hashCode_1(){
|
|
return getHashCode(this);
|
|
}
|
|
;
|
|
_.toString_0 = function toString_2(){
|
|
return this.name_0 != null?this.name_0:'' + this.ordinal;
|
|
}
|
|
;
|
|
_.ordinal = 0;
|
|
var Ljava_lang_Enum_2_classLit = createForClass('java.lang', 'Enum', 15);
|
|
function $clinit_Context2d$LineCap(){
|
|
$clinit_Context2d$LineCap = emptyMethod;
|
|
BUTT = new Context2d$LineCap('BUTT', 0, 'butt');
|
|
ROUND = new Context2d$LineCap('ROUND', 1, 'round');
|
|
SQUARE = new Context2d$LineCap('SQUARE', 2, 'square');
|
|
}
|
|
|
|
function Context2d$LineCap(enum$name, enum$ordinal, value_0){
|
|
Enum.call(this, enum$name, enum$ordinal);
|
|
this.value_0 = value_0;
|
|
}
|
|
|
|
function values_0(){
|
|
$clinit_Context2d$LineCap();
|
|
return stampJavaTypeInfo(getClassLiteralForArray(Lcom_google_gwt_canvas_dom_client_Context2d$LineCap_2_classLit, 1), $intern_3, 239, 0, [BUTT, ROUND, SQUARE]);
|
|
}
|
|
|
|
defineClass(239, 15, {239:1, 3:1, 16:1, 15:1}, Context2d$LineCap);
|
|
var BUTT, ROUND, SQUARE;
|
|
var Lcom_google_gwt_canvas_dom_client_Context2d$LineCap_2_classLit = createForEnum('com.google.gwt.canvas.dom.client', 'Context2d/LineCap', 239, values_0);
|
|
function $$init(this$static){
|
|
this$static.stackTrace = initUnidimensionalArray(Ljava_lang_StackTraceElement_2_classLit, $intern_3, 187, 0, 0, 1);
|
|
}
|
|
|
|
function $addSuppressed(this$static, exception){
|
|
checkCriticalNotNull_0(exception, 'Cannot suppress a null exception.');
|
|
checkCriticalArgument_0(exception != this$static, 'Exception can not suppress itself.');
|
|
if (this$static.disableSuppression) {
|
|
return;
|
|
}
|
|
this$static.suppressedExceptions == null?(this$static.suppressedExceptions = stampJavaTypeInfo(getClassLiteralForArray(Ljava_lang_Throwable_2_classLit, 1), $intern_3, 42, 0, [exception])):(this$static.suppressedExceptions[this$static.suppressedExceptions.length] = exception);
|
|
}
|
|
|
|
function $fillInStackTrace(this$static){
|
|
if (this$static.writetableStackTrace) {
|
|
this$static.backingJsObject !== '__noinit__' && this$static.initializeBackingError();
|
|
this$static.stackTrace = null;
|
|
}
|
|
return this$static;
|
|
}
|
|
|
|
function $initCause(this$static, cause){
|
|
checkCriticalState_0(!this$static.cause, "Can't overwrite cause");
|
|
checkCriticalArgument_0(cause != this$static, 'Self-causation not permitted');
|
|
this$static.cause = cause;
|
|
return this$static;
|
|
}
|
|
|
|
function $printStackTraceImpl(this$static, out, ident){
|
|
var t, t$array, t$index, t$max, theCause;
|
|
$printStackTraceItems(this$static);
|
|
for (t$array = (this$static.suppressedExceptions == null && (this$static.suppressedExceptions = initUnidimensionalArray(Ljava_lang_Throwable_2_classLit, $intern_3, 42, 0, 0, 1)) , this$static.suppressedExceptions) , t$index = 0 , t$max = t$array.length; t$index < t$max; ++t$index) {
|
|
t = t$array[t$index];
|
|
$printStackTraceImpl(t, out, '\t' + ident);
|
|
}
|
|
theCause = this$static.cause;
|
|
!!theCause && $printStackTraceImpl(theCause, out, ident);
|
|
}
|
|
|
|
function $printStackTraceItems(this$static){
|
|
var element$array, element$index, element$max, stackTrace;
|
|
for (element$array = (this$static.stackTrace == null && (this$static.stackTrace = ($clinit_StackTraceCreator() , stackTrace = collector.getStackTrace(this$static) , dropInternalFrames(stackTrace))) , this$static.stackTrace) , element$index = 0 , element$max = element$array.length; element$index < element$max; ++element$index)
|
|
;
|
|
}
|
|
|
|
function $setBackingJsObject(this$static, backingJsObject){
|
|
this$static.backingJsObject = backingJsObject;
|
|
backingJsObject != null && setPropertySafe(backingJsObject, '__java$exception', this$static);
|
|
}
|
|
|
|
function $toString(this$static, message){
|
|
var className;
|
|
className = $getName(this$static.___clazz);
|
|
return message == null?className:className + ': ' + message;
|
|
}
|
|
|
|
function Throwable(message, cause){
|
|
$$init(this);
|
|
this.cause = cause;
|
|
this.detailMessage = message;
|
|
$fillInStackTrace(this);
|
|
this.initializeBackingError();
|
|
}
|
|
|
|
function fixIE(e){
|
|
if (!('stack' in e)) {
|
|
try {
|
|
throw e;
|
|
}
|
|
catch (ignored) {
|
|
}
|
|
}
|
|
return e;
|
|
}
|
|
|
|
defineClass(42, 1, $intern_6);
|
|
_.createError = function createError(msg){
|
|
return new Error(msg);
|
|
}
|
|
;
|
|
_.getMessage = function getMessage(){
|
|
return this.detailMessage;
|
|
}
|
|
;
|
|
_.initializeBackingError = function initializeBackingError(){
|
|
var className, errorMessage, message;
|
|
message = this.detailMessage == null?null:this.detailMessage.replace(new RegExp('\n', 'g'), ' ');
|
|
errorMessage = (className = $getName(this.___clazz) , message == null?className:className + ': ' + message);
|
|
$setBackingJsObject(this, fixIE(this.createError(errorMessage)));
|
|
captureStackTrace(this);
|
|
}
|
|
;
|
|
_.toString_0 = function toString_3(){
|
|
return $toString(this, this.getMessage());
|
|
}
|
|
;
|
|
_.backingJsObject = '__noinit__';
|
|
_.disableSuppression = false;
|
|
_.writetableStackTrace = true;
|
|
var Ljava_lang_Throwable_2_classLit = createForClass('java.lang', 'Throwable', 42);
|
|
function Exception(message){
|
|
$$init(this);
|
|
this.detailMessage = message;
|
|
$fillInStackTrace(this);
|
|
this.initializeBackingError();
|
|
}
|
|
|
|
defineClass(13, 42, $intern_7);
|
|
var Ljava_lang_Exception_2_classLit = createForClass('java.lang', 'Exception', 13);
|
|
function RuntimeException(){
|
|
$$init(this);
|
|
$fillInStackTrace(this);
|
|
this.initializeBackingError();
|
|
}
|
|
|
|
function RuntimeException_0(message){
|
|
Exception.call(this, message);
|
|
}
|
|
|
|
function RuntimeException_1(message, cause){
|
|
Throwable.call(this, message, cause);
|
|
}
|
|
|
|
defineClass(83, 13, $intern_7, RuntimeException_0);
|
|
var Ljava_lang_RuntimeException_2_classLit = createForClass('java.lang', 'RuntimeException', 83);
|
|
function CodeDownloadException(message){
|
|
RuntimeException_0.call(this, message);
|
|
}
|
|
|
|
defineClass(992, 83, $intern_7, CodeDownloadException);
|
|
var Lcom_google_gwt_core_client_CodeDownloadException_2_classLit = createForClass('com.google.gwt.core.client', 'CodeDownloadException', 992);
|
|
function $elapsedMillis(this$static){
|
|
return now_1() - this$static.start_0;
|
|
}
|
|
|
|
function Duration(){
|
|
this.start_0 = now_1();
|
|
}
|
|
|
|
defineClass(284, 1, {}, Duration);
|
|
_.start_0 = 0;
|
|
var Lcom_google_gwt_core_client_Duration_2_classLit = createForClass('com.google.gwt.core.client', 'Duration', 284);
|
|
defineClass(282, 83, $intern_7);
|
|
var Ljava_lang_JsException_2_classLit = createForClass('java.lang', 'JsException', 282);
|
|
defineClass(467, 282, $intern_7);
|
|
var Lcom_google_gwt_core_client_impl_JavaScriptExceptionBase_2_classLit = createForClass('com.google.gwt.core.client.impl', 'JavaScriptExceptionBase', 467);
|
|
function $clinit_JavaScriptException(){
|
|
$clinit_JavaScriptException = emptyMethod;
|
|
NOT_SET = new Object_0;
|
|
}
|
|
|
|
function $ensureInit(this$static){
|
|
var exception;
|
|
if (this$static.message_0 == null) {
|
|
exception = maskUndefined(this$static.e) === maskUndefined(NOT_SET)?null:this$static.e;
|
|
this$static.name_0 = exception == null?'null':instanceOfJso(exception)?exception == null?null:exception.name:instanceOfString(exception)?'String':$getName(getClass__Ljava_lang_Class___devirtual$(exception));
|
|
this$static.description = this$static.description + ': ' + (instanceOfJso(exception)?exception == null?null:exception.message:exception + '');
|
|
this$static.message_0 = '(' + this$static.name_0 + ') ' + this$static.description;
|
|
}
|
|
}
|
|
|
|
function JavaScriptException(e){
|
|
$clinit_JavaScriptException();
|
|
$$init(this);
|
|
$fillInStackTrace(this);
|
|
this.backingJsObject = e;
|
|
e != null && setPropertySafe(e, '__java$exception', this);
|
|
this.detailMessage = e == null?'null':toString_9(e);
|
|
this.description = '';
|
|
this.e = e;
|
|
this.description = '';
|
|
}
|
|
|
|
defineClass(135, 467, {135:1, 3:1, 13:1, 42:1}, JavaScriptException);
|
|
_.getMessage = function getMessage_0(){
|
|
return $ensureInit(this) , this.message_0;
|
|
}
|
|
;
|
|
_.getThrown = function getThrown(){
|
|
return maskUndefined(this.e) === maskUndefined(NOT_SET)?null:this.e;
|
|
}
|
|
;
|
|
var NOT_SET;
|
|
var Lcom_google_gwt_core_client_JavaScriptException_2_classLit = createForClass('com.google.gwt.core.client', 'JavaScriptException', 135);
|
|
function now_1(){
|
|
if (Date.now) {
|
|
return Date.now();
|
|
}
|
|
return (new Date).getTime();
|
|
}
|
|
|
|
defineClass(960, 1, {});
|
|
var Lcom_google_gwt_core_client_Scheduler_2_classLit = createForClass('com.google.gwt.core.client', 'Scheduler', 960);
|
|
function $clinit_ScriptInjector(){
|
|
$clinit_ScriptInjector = emptyMethod;
|
|
}
|
|
|
|
function attachListeners(scriptElement, callback, removeTag){
|
|
$clinit_ScriptInjector();
|
|
function clearCallbacks(){
|
|
scriptElement.onerror = scriptElement.onreadystatechange = scriptElement.onload = null;
|
|
removeTag && nativeRemove(scriptElement);
|
|
}
|
|
|
|
scriptElement.onload = $entry(function(){
|
|
clearCallbacks();
|
|
callback && callback.onSuccess(null);
|
|
}
|
|
);
|
|
scriptElement.onerror = $entry(function(){
|
|
clearCallbacks();
|
|
if (callback) {
|
|
var ex = new CodeDownloadException('onerror() called.');
|
|
callback.onFailure(ex);
|
|
}
|
|
}
|
|
);
|
|
scriptElement.onreadystatechange = $entry(function(){
|
|
/loaded|complete/.test(scriptElement.readyState) && scriptElement.onload();
|
|
}
|
|
);
|
|
}
|
|
|
|
function nativeRemove(scriptElement){
|
|
scriptElement.parentNode.removeChild(scriptElement);
|
|
}
|
|
|
|
function nativeSetSrc(element, url_0){
|
|
$clinit_ScriptInjector();
|
|
element.src = url_0;
|
|
}
|
|
|
|
function $inject(this$static){
|
|
var doc, scriptElement, wnd;
|
|
wnd = ($clinit_ScriptInjector() , window);
|
|
doc = wnd.document;
|
|
scriptElement = doc.createElement('script');
|
|
!!this$static.callback && attachListeners(scriptElement, this$static.callback, false);
|
|
nativeSetSrc(scriptElement, this$static.scriptUrl);
|
|
(doc.head || doc.getElementsByTagName('head')[0]).appendChild(scriptElement);
|
|
return scriptElement;
|
|
}
|
|
|
|
function $setCallback(this$static, callback){
|
|
this$static.callback = callback;
|
|
return this$static;
|
|
}
|
|
|
|
function ScriptInjector$FromUrl(){
|
|
this.scriptUrl = 'canvas2svg.js';
|
|
}
|
|
|
|
defineClass(794, 1, {}, ScriptInjector$FromUrl);
|
|
var Lcom_google_gwt_core_client_ScriptInjector$FromUrl_2_classLit = createForClass('com.google.gwt.core.client', 'ScriptInjector/FromUrl', 794);
|
|
function $clinit_Impl(){
|
|
$clinit_Impl = emptyMethod;
|
|
!!($clinit_StackTraceCreator() , collector);
|
|
}
|
|
|
|
function apply_0(jsFunction, thisObj, args){
|
|
return jsFunction.apply(thisObj, args);
|
|
var __0;
|
|
}
|
|
|
|
function enter(){
|
|
var now_0;
|
|
if (entryDepth != 0) {
|
|
now_0 = now_1();
|
|
if (now_0 - watchdogEntryDepthLastScheduled > 2000) {
|
|
watchdogEntryDepthLastScheduled = now_0;
|
|
watchdogEntryDepthTimerId = $wnd.setTimeout(watchdogEntryDepthRun, 10);
|
|
}
|
|
}
|
|
if (entryDepth++ == 0) {
|
|
$flushEntryCommands(($clinit_SchedulerImpl() , INSTANCE));
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
function entry_0(jsFunction){
|
|
$clinit_Impl();
|
|
return function(){
|
|
return entry0_0(jsFunction, this, arguments);
|
|
var __0;
|
|
}
|
|
;
|
|
}
|
|
|
|
function entry0_0(jsFunction, thisObj, args){
|
|
var initialEntry;
|
|
initialEntry = enter();
|
|
try {
|
|
return apply_0(jsFunction, thisObj, args);
|
|
}
|
|
finally {
|
|
exit(initialEntry);
|
|
}
|
|
}
|
|
|
|
function exit(initialEntry){
|
|
initialEntry && $flushFinallyCommands(($clinit_SchedulerImpl() , INSTANCE));
|
|
--entryDepth;
|
|
if (initialEntry) {
|
|
if (watchdogEntryDepthTimerId != -1) {
|
|
watchdogEntryDepthCancel(watchdogEntryDepthTimerId);
|
|
watchdogEntryDepthTimerId = -1;
|
|
}
|
|
}
|
|
}
|
|
|
|
function getModuleBaseURL(){
|
|
$clinit_Impl();
|
|
var key = '__gwtDevModeHook:' + $moduleName + ':moduleBase';
|
|
var global = $wnd || self;
|
|
return global[key] || $moduleBase;
|
|
}
|
|
|
|
function reportToBrowser(e){
|
|
$clinit_Impl();
|
|
$wnd.setTimeout(function(){
|
|
throw e;
|
|
}
|
|
, 0);
|
|
}
|
|
|
|
function watchdogEntryDepthCancel(timerId){
|
|
$wnd.clearTimeout(timerId);
|
|
}
|
|
|
|
function watchdogEntryDepthRun(){
|
|
entryDepth != 0 && (entryDepth = 0);
|
|
watchdogEntryDepthTimerId = -1;
|
|
}
|
|
|
|
var entryDepth = 0, watchdogEntryDepthLastScheduled = 0, watchdogEntryDepthTimerId = -1;
|
|
function $clinit_SchedulerImpl(){
|
|
$clinit_SchedulerImpl = emptyMethod;
|
|
INSTANCE = new SchedulerImpl;
|
|
}
|
|
|
|
function $flushEntryCommands(this$static){
|
|
var oldQueue, rescheduled;
|
|
if (this$static.entryCommands) {
|
|
rescheduled = null;
|
|
do {
|
|
oldQueue = this$static.entryCommands;
|
|
this$static.entryCommands = null;
|
|
rescheduled = runScheduledTasks(oldQueue, rescheduled);
|
|
}
|
|
while (this$static.entryCommands);
|
|
this$static.entryCommands = rescheduled;
|
|
}
|
|
}
|
|
|
|
function $flushFinallyCommands(this$static){
|
|
var oldQueue, rescheduled;
|
|
if (this$static.finallyCommands) {
|
|
rescheduled = null;
|
|
do {
|
|
oldQueue = this$static.finallyCommands;
|
|
this$static.finallyCommands = null;
|
|
rescheduled = runScheduledTasks(oldQueue, rescheduled);
|
|
}
|
|
while (this$static.finallyCommands);
|
|
this$static.finallyCommands = rescheduled;
|
|
}
|
|
}
|
|
|
|
function $flushPostEventPumpCommands(this$static){
|
|
var oldDeferred;
|
|
if (this$static.deferredCommands) {
|
|
oldDeferred = this$static.deferredCommands;
|
|
this$static.deferredCommands = null;
|
|
!this$static.incrementalCommands && (this$static.incrementalCommands = []);
|
|
runScheduledTasks(oldDeferred, this$static.incrementalCommands);
|
|
}
|
|
!!this$static.incrementalCommands && (this$static.incrementalCommands = $runRepeatingTasks(this$static.incrementalCommands));
|
|
}
|
|
|
|
function $isWorkQueued(this$static){
|
|
return !!this$static.deferredCommands || !!this$static.incrementalCommands;
|
|
}
|
|
|
|
function $maybeSchedulePostEventPumpCommands(this$static){
|
|
if (!this$static.shouldBeRunning) {
|
|
this$static.shouldBeRunning = true;
|
|
!this$static.flusher && (this$static.flusher = new SchedulerImpl$Flusher(this$static));
|
|
scheduleFixedDelayImpl(this$static.flusher, 1);
|
|
!this$static.rescue && (this$static.rescue = new SchedulerImpl$Rescuer(this$static));
|
|
scheduleFixedDelayImpl(this$static.rescue, 50);
|
|
}
|
|
}
|
|
|
|
function $runRepeatingTasks(tasks){
|
|
var canceledSomeTasks, duration, executedSomeTask, i, length_0, newTasks, t;
|
|
length_0 = tasks.length;
|
|
if (length_0 == 0) {
|
|
return null;
|
|
}
|
|
canceledSomeTasks = false;
|
|
duration = new Duration;
|
|
while (now_1() - duration.start_0 < 16) {
|
|
executedSomeTask = false;
|
|
for (i = 0; i < length_0; i++) {
|
|
t = tasks[i];
|
|
if (!t) {
|
|
continue;
|
|
}
|
|
executedSomeTask = true;
|
|
if (!t[0].execute_0()) {
|
|
tasks[i] = null;
|
|
canceledSomeTasks = true;
|
|
}
|
|
}
|
|
if (!executedSomeTask) {
|
|
break;
|
|
}
|
|
}
|
|
if (canceledSomeTasks) {
|
|
newTasks = [];
|
|
for (i = 0; i < length_0; i++) {
|
|
!!tasks[i] && (newTasks[newTasks.length] = tasks[i] , undefined);
|
|
}
|
|
return newTasks.length == 0?null:newTasks;
|
|
}
|
|
else {
|
|
return tasks;
|
|
}
|
|
}
|
|
|
|
function $scheduleDeferred(this$static, cmd){
|
|
this$static.deferredCommands = push_0(this$static.deferredCommands, [cmd, false]);
|
|
$maybeSchedulePostEventPumpCommands(this$static);
|
|
}
|
|
|
|
function $scheduleFinally(this$static, cmd){
|
|
this$static.finallyCommands = push_0(this$static.finallyCommands, [cmd, false]);
|
|
}
|
|
|
|
function SchedulerImpl(){
|
|
}
|
|
|
|
function execute_0(cmd){
|
|
return cmd.execute_0();
|
|
}
|
|
|
|
function push_0(queue, task){
|
|
!queue && (queue = []);
|
|
queue[queue.length] = task;
|
|
return queue;
|
|
}
|
|
|
|
function runScheduledTasks(tasks, rescheduled){
|
|
var e, i, j, t;
|
|
for (i = 0 , j = tasks.length; i < j; i++) {
|
|
t = tasks[i];
|
|
try {
|
|
t[1]?t[0].execute_0() && (rescheduled = push_0(rescheduled, t)):t[0].execute_1();
|
|
}
|
|
catch ($e0) {
|
|
$e0 = toJava($e0);
|
|
if (instanceOf($e0, 42)) {
|
|
e = $e0;
|
|
$clinit_Impl();
|
|
reportToBrowser(instanceOf(e, 135)?e.getThrown():e);
|
|
}
|
|
else
|
|
throw toJs($e0);
|
|
}
|
|
}
|
|
return rescheduled;
|
|
}
|
|
|
|
function scheduleFixedDelayImpl(cmd, delayMs){
|
|
$clinit_SchedulerImpl();
|
|
function callback(){
|
|
var ret = $entry(execute_0)(cmd);
|
|
ret && $wnd.setTimeout(callback, delayMs);
|
|
}
|
|
|
|
$wnd.setTimeout(callback, delayMs);
|
|
}
|
|
|
|
defineClass(479, 960, {}, SchedulerImpl);
|
|
_.flushRunning = false;
|
|
_.shouldBeRunning = false;
|
|
var INSTANCE;
|
|
var Lcom_google_gwt_core_client_impl_SchedulerImpl_2_classLit = createForClass('com.google.gwt.core.client.impl', 'SchedulerImpl', 479);
|
|
function SchedulerImpl$Flusher(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(480, 1, {}, SchedulerImpl$Flusher);
|
|
_.execute_0 = function execute_1(){
|
|
this.this$01.flushRunning = true;
|
|
$flushPostEventPumpCommands(this.this$01);
|
|
this.this$01.flushRunning = false;
|
|
return this.this$01.shouldBeRunning = $isWorkQueued(this.this$01);
|
|
}
|
|
;
|
|
var Lcom_google_gwt_core_client_impl_SchedulerImpl$Flusher_2_classLit = createForClass('com.google.gwt.core.client.impl', 'SchedulerImpl/Flusher', 480);
|
|
function SchedulerImpl$Rescuer(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(481, 1, {}, SchedulerImpl$Rescuer);
|
|
_.execute_0 = function execute_2(){
|
|
this.this$01.flushRunning && scheduleFixedDelayImpl(this.this$01.flusher, 1);
|
|
return this.this$01.shouldBeRunning;
|
|
}
|
|
;
|
|
var Lcom_google_gwt_core_client_impl_SchedulerImpl$Rescuer_2_classLit = createForClass('com.google.gwt.core.client.impl', 'SchedulerImpl/Rescuer', 481);
|
|
function $clinit_StackTraceCreator(){
|
|
$clinit_StackTraceCreator = emptyMethod;
|
|
var c, enforceLegacy;
|
|
enforceLegacy = !supportsErrorStack();
|
|
c = new StackTraceCreator$CollectorModernNoSourceMap;
|
|
collector = enforceLegacy?new StackTraceCreator$CollectorLegacy:c;
|
|
}
|
|
|
|
function captureStackTrace(error){
|
|
$clinit_StackTraceCreator();
|
|
collector.collect(error);
|
|
}
|
|
|
|
function dropInternalFrames(stackTrace){
|
|
var dropFrameUntilFnName, dropFrameUntilFnName2, i, numberOfFramesToSearch;
|
|
dropFrameUntilFnName = 'captureStackTrace';
|
|
dropFrameUntilFnName2 = 'initializeBackingError';
|
|
numberOfFramesToSearch = $wnd.Math.min(stackTrace.length, 5);
|
|
for (i = numberOfFramesToSearch - 1; i >= 0; i--) {
|
|
if ($equals_1(stackTrace[i].methodName, dropFrameUntilFnName) || $equals_1(stackTrace[i].methodName, dropFrameUntilFnName2)) {
|
|
stackTrace.length >= i + 1 && stackTrace.splice(0, i + 1);
|
|
break;
|
|
}
|
|
}
|
|
return stackTrace;
|
|
}
|
|
|
|
function extractFunctionName(fnName){
|
|
var fnRE = /function(?:\s+([\w$]+))?\s*\(/;
|
|
var match_0 = fnRE.exec(fnName);
|
|
return match_0 && match_0[1] || 'anonymous';
|
|
}
|
|
|
|
function parseInt_0(number){
|
|
$clinit_StackTraceCreator();
|
|
return parseInt(number) || -1;
|
|
}
|
|
|
|
function supportsErrorStack(){
|
|
if (Error.stackTraceLimit > 0) {
|
|
$wnd.Error.stackTraceLimit = Error.stackTraceLimit = 64;
|
|
return true;
|
|
}
|
|
return 'stack' in new Error;
|
|
}
|
|
|
|
var collector;
|
|
defineClass(970, 1, {});
|
|
var Lcom_google_gwt_core_client_impl_StackTraceCreator$Collector_2_classLit = createForClass('com.google.gwt.core.client.impl', 'StackTraceCreator/Collector', 970);
|
|
function StackTraceCreator$CollectorLegacy(){
|
|
}
|
|
|
|
defineClass(468, 970, {}, StackTraceCreator$CollectorLegacy);
|
|
_.collect = function collect(error){
|
|
var seen = {}, name_1;
|
|
var fnStack = [];
|
|
error['fnStack'] = fnStack;
|
|
var callee = arguments.callee.caller;
|
|
while (callee) {
|
|
var name_0 = ($clinit_StackTraceCreator() , callee.name || (callee.name = extractFunctionName(callee.toString())));
|
|
fnStack.push(name_0);
|
|
var keyName = ':' + name_0;
|
|
var withThisName = seen[keyName];
|
|
if (withThisName) {
|
|
var i, j;
|
|
for (i = 0 , j = withThisName.length; i < j; i++) {
|
|
if (withThisName[i] === callee) {
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
(withThisName || (seen[keyName] = [])).push(callee);
|
|
callee = callee.caller;
|
|
}
|
|
}
|
|
;
|
|
_.getStackTrace = function getStackTrace(t){
|
|
var i, length_0, stack_0, stackTrace;
|
|
stack_0 = ($clinit_StackTraceCreator() , t && t['fnStack']?t['fnStack']:[]);
|
|
length_0 = stack_0.length;
|
|
stackTrace = initUnidimensionalArray(Ljava_lang_StackTraceElement_2_classLit, $intern_3, 187, length_0, 0, 1);
|
|
for (i = 0; i < length_0; i++) {
|
|
stackTrace[i] = new StackTraceElement(stack_0[i], null, -1);
|
|
}
|
|
return stackTrace;
|
|
}
|
|
;
|
|
var Lcom_google_gwt_core_client_impl_StackTraceCreator$CollectorLegacy_2_classLit = createForClass('com.google.gwt.core.client.impl', 'StackTraceCreator/CollectorLegacy', 468);
|
|
function $parse(this$static, stString){
|
|
var closeParen, col, endFileUrlIndex, fileName, index_0, lastColonIndex, line, location_0, toReturn;
|
|
if (stString.length == 0) {
|
|
return this$static.createSte('Unknown', 'anonymous', -1, -1);
|
|
}
|
|
toReturn = $trim(stString);
|
|
$equals_1(toReturn.substr(0, 3), 'at ') && (toReturn = toReturn.substr(3));
|
|
toReturn = toReturn.replace(/\[.*?\]/g, '');
|
|
index_0 = toReturn.indexOf('(');
|
|
if (index_0 == -1) {
|
|
index_0 = toReturn.indexOf('@');
|
|
if (index_0 == -1) {
|
|
location_0 = toReturn;
|
|
toReturn = '';
|
|
}
|
|
else {
|
|
location_0 = $trim(toReturn.substr(index_0 + 1));
|
|
toReturn = $trim(toReturn.substr(0, index_0));
|
|
}
|
|
}
|
|
else {
|
|
closeParen = toReturn.indexOf(')', index_0);
|
|
location_0 = toReturn.substr(index_0 + 1, closeParen - (index_0 + 1));
|
|
toReturn = $trim(toReturn.substr(0, index_0));
|
|
}
|
|
index_0 = $indexOf_1(toReturn, fromCodePoint(46));
|
|
index_0 != -1 && (toReturn = toReturn.substr(index_0 + 1));
|
|
(toReturn.length == 0 || $equals_1(toReturn, 'Anonymous function')) && (toReturn = 'anonymous');
|
|
lastColonIndex = $lastIndexOf(location_0, fromCodePoint(58));
|
|
endFileUrlIndex = $lastIndexOf_0(location_0, fromCodePoint(58), lastColonIndex - 1);
|
|
line = -1;
|
|
col = -1;
|
|
fileName = 'Unknown';
|
|
if (lastColonIndex != -1 && endFileUrlIndex != -1) {
|
|
fileName = location_0.substr(0, endFileUrlIndex);
|
|
line = parseInt_0(location_0.substr(endFileUrlIndex + 1, lastColonIndex - (endFileUrlIndex + 1)));
|
|
col = parseInt_0(location_0.substr(lastColonIndex + 1));
|
|
}
|
|
return this$static.createSte(fileName, toReturn, line, col);
|
|
}
|
|
|
|
defineClass(971, 970, {});
|
|
_.collect = function collect_0(error){
|
|
}
|
|
;
|
|
_.createSte = function createSte(fileName, method, line, col){
|
|
return new StackTraceElement(method, fileName + '@' + col, line < 0?-1:line);
|
|
}
|
|
;
|
|
_.getStackTrace = function getStackTrace_0(t){
|
|
var addIndex, i, length_0, stack_0, stackTrace, ste, e;
|
|
stack_0 = ($clinit_StackTraceCreator() , e = t.backingJsObject , e && e.stack?e.stack.split('\n'):[]);
|
|
stackTrace = initUnidimensionalArray(Ljava_lang_StackTraceElement_2_classLit, $intern_3, 187, 0, 0, 1);
|
|
addIndex = 0;
|
|
length_0 = stack_0.length;
|
|
if (length_0 == 0) {
|
|
return stackTrace;
|
|
}
|
|
ste = $parse(this, stack_0[0]);
|
|
$equals_1(ste.methodName, 'anonymous') || (stackTrace[addIndex++] = ste);
|
|
for (i = 1; i < length_0; i++) {
|
|
stackTrace[addIndex++] = $parse(this, stack_0[i]);
|
|
}
|
|
return stackTrace;
|
|
}
|
|
;
|
|
var Lcom_google_gwt_core_client_impl_StackTraceCreator$CollectorModern_2_classLit = createForClass('com.google.gwt.core.client.impl', 'StackTraceCreator/CollectorModern', 971);
|
|
function StackTraceCreator$CollectorModernNoSourceMap(){
|
|
}
|
|
|
|
defineClass(469, 971, {}, StackTraceCreator$CollectorModernNoSourceMap);
|
|
_.createSte = function createSte_0(fileName, method, line, col){
|
|
return new StackTraceElement(method, fileName, -1);
|
|
}
|
|
;
|
|
var Lcom_google_gwt_core_client_impl_StackTraceCreator$CollectorModernNoSourceMap_2_classLit = createForClass('com.google.gwt.core.client.impl', 'StackTraceCreator/CollectorModernNoSourceMap', 469);
|
|
function $appendChild(this$static, newChild){
|
|
return this$static.appendChild(newChild);
|
|
}
|
|
|
|
function $insertBefore(this$static, newChild, refChild){
|
|
return this$static.insertBefore(newChild, refChild);
|
|
}
|
|
|
|
function $insertFirst(this$static, child){
|
|
return $insertBefore(this$static, child, this$static.firstChild);
|
|
}
|
|
|
|
function $removeChild(this$static, oldChild){
|
|
return this$static.removeChild(oldChild);
|
|
}
|
|
|
|
function is(o){
|
|
try {
|
|
return !!o && !!o.nodeType;
|
|
}
|
|
catch (e) {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
function $addClassName(this$static, className){
|
|
var idx, oldClassName;
|
|
className = trimClassName(className);
|
|
oldClassName = this$static.className || '';
|
|
idx = indexOfName(oldClassName, className);
|
|
if (idx == -1) {
|
|
oldClassName.length > 0?(this$static.className = oldClassName + ' ' + className || '' , undefined):(this$static.className = className || '' , undefined);
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
function $getPropertyInt(this$static, name_0){
|
|
return parseInt(this$static[name_0]) | 0;
|
|
}
|
|
|
|
function $getPropertyString(this$static, name_0){
|
|
return this$static[name_0] == null?null:String(this$static[name_0]);
|
|
}
|
|
|
|
function $removeClassName(this$static, className){
|
|
var begin, end, idx, newClassName, oldStyle;
|
|
className = trimClassName(className);
|
|
oldStyle = this$static.className || '';
|
|
idx = indexOfName(oldStyle, className);
|
|
if (idx != -1) {
|
|
begin = $trim(oldStyle.substr(0, idx));
|
|
end = $trim($substring(oldStyle, idx + className.length));
|
|
begin.length == 0?(newClassName = end):end.length == 0?(newClassName = begin):(newClassName = begin + ' ' + end);
|
|
this$static.className = newClassName || '';
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
function $setAttribute(this$static, name_0, value_0){
|
|
this$static.setAttribute(name_0, value_0);
|
|
}
|
|
|
|
function $setClassName(this$static, className){
|
|
this$static.className = className || '';
|
|
}
|
|
|
|
function $setInnerHTML(this$static, html){
|
|
this$static.innerHTML = html || '';
|
|
}
|
|
|
|
function $setScrollTop(this$static, scrollTop){
|
|
this$static.scrollTop = scrollTop;
|
|
}
|
|
|
|
function $setTabIndex(this$static, tabIndex){
|
|
this$static.tabIndex = tabIndex;
|
|
}
|
|
|
|
function indexOfName(nameList, name_0){
|
|
var idx, last, lastPos;
|
|
idx = nameList.indexOf(name_0);
|
|
while (idx != -1) {
|
|
if (idx == 0 || (checkCriticalStringElementIndex(idx - 1, nameList.length) , nameList.charCodeAt(idx - 1) == 32)) {
|
|
last = idx + name_0.length;
|
|
lastPos = nameList.length;
|
|
if (last == lastPos || last < lastPos && (checkCriticalStringElementIndex(last, nameList.length) , nameList.charCodeAt(last) == 32)) {
|
|
break;
|
|
}
|
|
}
|
|
idx = nameList.indexOf(name_0, idx + 1);
|
|
}
|
|
return idx;
|
|
}
|
|
|
|
function is_0(o){
|
|
if (is(o)) {
|
|
return !!o && o.nodeType == 1;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
function trimClassName(className){
|
|
className = $trim(className);
|
|
return className;
|
|
}
|
|
|
|
function $setHref(this$static, href_0){
|
|
this$static.href = href_0;
|
|
}
|
|
|
|
function $setHeight_0(this$static, height){
|
|
this$static.height = height;
|
|
}
|
|
|
|
function $setWidth_0(this$static, width_0){
|
|
this$static.width = width_0;
|
|
}
|
|
|
|
function $createCheckInputElement(doc){
|
|
var e = doc.createElement('INPUT');
|
|
e.type = 'checkbox';
|
|
e.value = 'on';
|
|
return e;
|
|
}
|
|
|
|
function $createInputElement(doc, type_0){
|
|
var e = doc.createElement('INPUT');
|
|
e.type = type_0;
|
|
return e;
|
|
}
|
|
|
|
function $getFirstChildElement(elem){
|
|
var child = elem.firstChild;
|
|
while (child && child.nodeType != 1)
|
|
child = child.nextSibling;
|
|
return child;
|
|
}
|
|
|
|
function $getParentElement(node){
|
|
var parent_0 = node.parentNode;
|
|
(!parent_0 || parent_0.nodeType != 1) && (parent_0 = null);
|
|
return parent_0;
|
|
}
|
|
|
|
function $createInputRadioElement(doc, name_0){
|
|
var elem = doc.createElement('INPUT');
|
|
elem.type = 'radio';
|
|
elem.name = name_0;
|
|
elem.value = 'on';
|
|
return elem;
|
|
}
|
|
|
|
function $eventGetButton(evt){
|
|
var button = evt.button;
|
|
if (button == 1) {
|
|
return 4;
|
|
}
|
|
else if (button == 2) {
|
|
return 2;
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
function $setInnerText(elem, text_0){
|
|
elem.textContent = text_0 || '';
|
|
}
|
|
|
|
function $createScriptElement(doc, source){
|
|
var elem;
|
|
elem = doc.createElement('script');
|
|
elem.textContent = source || '';
|
|
return elem;
|
|
}
|
|
|
|
function $eventGetMouseWheelVelocityY(evt){
|
|
return Math.round(-evt.wheelDelta / 40) || 0;
|
|
}
|
|
|
|
function $isRTL(elem){
|
|
return elem.ownerDocument.defaultView.getComputedStyle(elem, '').direction == 'rtl';
|
|
}
|
|
|
|
function $getAbsoluteLeft_0(elem){
|
|
var left;
|
|
left = $getBoundingClientRectLeft(elem) + $wnd.pageXOffset;
|
|
$isRTL(elem) && (left += $getParentOffsetDelta(elem));
|
|
return left | 0;
|
|
}
|
|
|
|
function $getBoundingClientRectLeft(elem){
|
|
try {
|
|
return elem.getBoundingClientRect().left;
|
|
}
|
|
catch (e) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
function $getBoundingClientRectTop(elem){
|
|
try {
|
|
return elem.getBoundingClientRect().top;
|
|
}
|
|
catch (e) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
function $getParentOffsetDelta(elem){
|
|
var offsetParent = elem.offsetParent;
|
|
if (offsetParent) {
|
|
return offsetParent.offsetWidth - offsetParent.clientWidth;
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
function $getScrollLeft(elem){
|
|
var left;
|
|
left = (elem.scrollLeft || 0) | 0;
|
|
$isRTL(elem) && (left = -left);
|
|
return left;
|
|
}
|
|
|
|
function $getTabIndex(elem){
|
|
return elem.tabIndex < $intern_8?elem.tabIndex:-(elem.tabIndex % $intern_8) - 1;
|
|
}
|
|
|
|
function $selectRemoveOption(select, index_0){
|
|
try {
|
|
select.remove(index_0);
|
|
}
|
|
catch (e) {
|
|
select.removeChild(select.childNodes[index_0]);
|
|
}
|
|
}
|
|
|
|
function $setScrollLeft(elem, left){
|
|
$isRTL(elem) && (left = -left);
|
|
elem.scrollLeft = left;
|
|
}
|
|
|
|
function isOrHasChildImpl(parent_0, child){
|
|
if (parent_0.nodeType != 1 && parent_0.nodeType != 9) {
|
|
return parent_0 == child;
|
|
}
|
|
if (child.nodeType != 1) {
|
|
child = child.parentNode;
|
|
if (!child) {
|
|
return false;
|
|
}
|
|
}
|
|
if (parent_0.nodeType == 9) {
|
|
return parent_0 === child || parent_0.body && parent_0.body.contains(child);
|
|
}
|
|
else {
|
|
return parent_0 === child || parent_0.contains(child);
|
|
}
|
|
}
|
|
|
|
function $createUniqueId(this$static){
|
|
!this$static.gwt_uid && (this$static.gwt_uid = 1);
|
|
return 'gwt-uid-' + this$static.gwt_uid++;
|
|
}
|
|
|
|
function $getClientHeight(this$static){
|
|
return ($equals_1(this$static.compatMode, 'CSS1Compat')?this$static.documentElement:this$static.body).clientHeight | 0;
|
|
}
|
|
|
|
function $getClientWidth(this$static){
|
|
return ($equals_1(this$static.compatMode, 'CSS1Compat')?this$static.documentElement:this$static.body).clientWidth | 0;
|
|
}
|
|
|
|
function $getScrollHeight(this$static){
|
|
return (($equals_1(this$static.compatMode, 'CSS1Compat')?this$static.documentElement:this$static.body).scrollHeight || 0) | 0;
|
|
}
|
|
|
|
function $getScrollWidth(this$static){
|
|
return (($equals_1(this$static.compatMode, 'CSS1Compat')?this$static.documentElement:this$static.body).scrollWidth || 0) | 0;
|
|
}
|
|
|
|
function $setTitle_0(this$static, title_0){
|
|
this$static.title = title_0;
|
|
}
|
|
|
|
function $setChecked(this$static, checked){
|
|
this$static.checked = checked;
|
|
}
|
|
|
|
function $setDefaultChecked(this$static, defaultChecked){
|
|
this$static.defaultChecked = defaultChecked;
|
|
}
|
|
|
|
function $setDisabled(this$static, disabled){
|
|
this$static.disabled = disabled;
|
|
}
|
|
|
|
function $setName(this$static, name_0){
|
|
this$static.name = name_0;
|
|
}
|
|
|
|
function $setHtmlFor(this$static, htmlFor){
|
|
this$static.htmlFor = htmlFor;
|
|
}
|
|
|
|
function $setSelectedIndex(this$static, index_0){
|
|
this$static.selectedIndex = index_0;
|
|
}
|
|
|
|
function $setSize(this$static, size_0){
|
|
this$static.size = size_0;
|
|
}
|
|
|
|
function $clinit_Style$BorderStyle(){
|
|
$clinit_Style$BorderStyle = emptyMethod;
|
|
NONE = new Style$BorderStyle$1;
|
|
DOTTED = new Style$BorderStyle$2;
|
|
DASHED = new Style$BorderStyle$3;
|
|
HIDDEN_0 = new Style$BorderStyle$4;
|
|
SOLID = new Style$BorderStyle$5;
|
|
}
|
|
|
|
function Style$BorderStyle(enum$name, enum$ordinal){
|
|
Enum.call(this, enum$name, enum$ordinal);
|
|
}
|
|
|
|
function values_1(){
|
|
$clinit_Style$BorderStyle();
|
|
return stampJavaTypeInfo(getClassLiteralForArray(Lcom_google_gwt_dom_client_Style$BorderStyle_2_classLit, 1), $intern_3, 150, 0, [NONE, DOTTED, DASHED, HIDDEN_0, SOLID]);
|
|
}
|
|
|
|
defineClass(150, 15, $intern_9);
|
|
var DASHED, DOTTED, HIDDEN_0, NONE, SOLID;
|
|
var Lcom_google_gwt_dom_client_Style$BorderStyle_2_classLit = createForEnum('com.google.gwt.dom.client', 'Style/BorderStyle', 150, values_1);
|
|
function Style$BorderStyle$1(){
|
|
Style$BorderStyle.call(this, 'NONE', 0);
|
|
}
|
|
|
|
defineClass(584, 150, $intern_9, Style$BorderStyle$1);
|
|
var Lcom_google_gwt_dom_client_Style$BorderStyle$1_2_classLit = createForEnum('com.google.gwt.dom.client', 'Style/BorderStyle/1', 584, null);
|
|
function Style$BorderStyle$2(){
|
|
Style$BorderStyle.call(this, 'DOTTED', 1);
|
|
}
|
|
|
|
defineClass(585, 150, $intern_9, Style$BorderStyle$2);
|
|
var Lcom_google_gwt_dom_client_Style$BorderStyle$2_2_classLit = createForEnum('com.google.gwt.dom.client', 'Style/BorderStyle/2', 585, null);
|
|
function Style$BorderStyle$3(){
|
|
Style$BorderStyle.call(this, 'DASHED', 2);
|
|
}
|
|
|
|
defineClass(586, 150, $intern_9, Style$BorderStyle$3);
|
|
var Lcom_google_gwt_dom_client_Style$BorderStyle$3_2_classLit = createForEnum('com.google.gwt.dom.client', 'Style/BorderStyle/3', 586, null);
|
|
function Style$BorderStyle$4(){
|
|
Style$BorderStyle.call(this, 'HIDDEN', 3);
|
|
}
|
|
|
|
defineClass(587, 150, $intern_9, Style$BorderStyle$4);
|
|
var Lcom_google_gwt_dom_client_Style$BorderStyle$4_2_classLit = createForEnum('com.google.gwt.dom.client', 'Style/BorderStyle/4', 587, null);
|
|
function Style$BorderStyle$5(){
|
|
Style$BorderStyle.call(this, 'SOLID', 4);
|
|
}
|
|
|
|
defineClass(588, 150, $intern_9, Style$BorderStyle$5);
|
|
var Lcom_google_gwt_dom_client_Style$BorderStyle$5_2_classLit = createForEnum('com.google.gwt.dom.client', 'Style/BorderStyle/5', 588, null);
|
|
function $clinit_Style$Cursor(){
|
|
$clinit_Style$Cursor = emptyMethod;
|
|
DEFAULT = new Style$Cursor$1;
|
|
AUTO = new Style$Cursor$2;
|
|
CROSSHAIR = new Style$Cursor$3;
|
|
POINTER = new Style$Cursor$4;
|
|
MOVE = new Style$Cursor$5;
|
|
E_RESIZE = new Style$Cursor$6;
|
|
NE_RESIZE = new Style$Cursor$7;
|
|
NW_RESIZE = new Style$Cursor$8;
|
|
N_RESIZE = new Style$Cursor$9;
|
|
SE_RESIZE = new Style$Cursor$10;
|
|
SW_RESIZE = new Style$Cursor$11;
|
|
S_RESIZE = new Style$Cursor$12;
|
|
W_RESIZE = new Style$Cursor$13;
|
|
TEXT = new Style$Cursor$14;
|
|
WAIT = new Style$Cursor$15;
|
|
HELP = new Style$Cursor$16;
|
|
COL_RESIZE = new Style$Cursor$17;
|
|
ROW_RESIZE = new Style$Cursor$18;
|
|
}
|
|
|
|
function Style$Cursor(enum$name, enum$ordinal){
|
|
Enum.call(this, enum$name, enum$ordinal);
|
|
}
|
|
|
|
function values_2(){
|
|
$clinit_Style$Cursor();
|
|
return stampJavaTypeInfo(getClassLiteralForArray(Lcom_google_gwt_dom_client_Style$Cursor_2_classLit, 1), $intern_3, 46, 0, [DEFAULT, AUTO, CROSSHAIR, POINTER, MOVE, E_RESIZE, NE_RESIZE, NW_RESIZE, N_RESIZE, SE_RESIZE, SW_RESIZE, S_RESIZE, W_RESIZE, TEXT, WAIT, HELP, COL_RESIZE, ROW_RESIZE]);
|
|
}
|
|
|
|
defineClass(46, 15, $intern_10);
|
|
var AUTO, COL_RESIZE, CROSSHAIR, DEFAULT, E_RESIZE, HELP, MOVE, NE_RESIZE, NW_RESIZE, N_RESIZE, POINTER, ROW_RESIZE, SE_RESIZE, SW_RESIZE, S_RESIZE, TEXT, WAIT, W_RESIZE;
|
|
var Lcom_google_gwt_dom_client_Style$Cursor_2_classLit = createForEnum('com.google.gwt.dom.client', 'Style/Cursor', 46, values_2);
|
|
function Style$Cursor$1(){
|
|
Style$Cursor.call(this, 'DEFAULT', 0);
|
|
}
|
|
|
|
defineClass(589, 46, $intern_10, Style$Cursor$1);
|
|
var Lcom_google_gwt_dom_client_Style$Cursor$1_2_classLit = createForEnum('com.google.gwt.dom.client', 'Style/Cursor/1', 589, null);
|
|
function Style$Cursor$10(){
|
|
Style$Cursor.call(this, 'SE_RESIZE', 9);
|
|
}
|
|
|
|
defineClass(598, 46, $intern_10, Style$Cursor$10);
|
|
var Lcom_google_gwt_dom_client_Style$Cursor$10_2_classLit = createForEnum('com.google.gwt.dom.client', 'Style/Cursor/10', 598, null);
|
|
function Style$Cursor$11(){
|
|
Style$Cursor.call(this, 'SW_RESIZE', 10);
|
|
}
|
|
|
|
defineClass(599, 46, $intern_10, Style$Cursor$11);
|
|
var Lcom_google_gwt_dom_client_Style$Cursor$11_2_classLit = createForEnum('com.google.gwt.dom.client', 'Style/Cursor/11', 599, null);
|
|
function Style$Cursor$12(){
|
|
Style$Cursor.call(this, 'S_RESIZE', 11);
|
|
}
|
|
|
|
defineClass(600, 46, $intern_10, Style$Cursor$12);
|
|
var Lcom_google_gwt_dom_client_Style$Cursor$12_2_classLit = createForEnum('com.google.gwt.dom.client', 'Style/Cursor/12', 600, null);
|
|
function Style$Cursor$13(){
|
|
Style$Cursor.call(this, 'W_RESIZE', 12);
|
|
}
|
|
|
|
defineClass(601, 46, $intern_10, Style$Cursor$13);
|
|
var Lcom_google_gwt_dom_client_Style$Cursor$13_2_classLit = createForEnum('com.google.gwt.dom.client', 'Style/Cursor/13', 601, null);
|
|
function Style$Cursor$14(){
|
|
Style$Cursor.call(this, 'TEXT', 13);
|
|
}
|
|
|
|
defineClass(602, 46, $intern_10, Style$Cursor$14);
|
|
var Lcom_google_gwt_dom_client_Style$Cursor$14_2_classLit = createForEnum('com.google.gwt.dom.client', 'Style/Cursor/14', 602, null);
|
|
function Style$Cursor$15(){
|
|
Style$Cursor.call(this, 'WAIT', 14);
|
|
}
|
|
|
|
defineClass(603, 46, $intern_10, Style$Cursor$15);
|
|
var Lcom_google_gwt_dom_client_Style$Cursor$15_2_classLit = createForEnum('com.google.gwt.dom.client', 'Style/Cursor/15', 603, null);
|
|
function Style$Cursor$16(){
|
|
Style$Cursor.call(this, 'HELP', 15);
|
|
}
|
|
|
|
defineClass(604, 46, $intern_10, Style$Cursor$16);
|
|
var Lcom_google_gwt_dom_client_Style$Cursor$16_2_classLit = createForEnum('com.google.gwt.dom.client', 'Style/Cursor/16', 604, null);
|
|
function Style$Cursor$17(){
|
|
Style$Cursor.call(this, 'COL_RESIZE', 16);
|
|
}
|
|
|
|
defineClass(605, 46, $intern_10, Style$Cursor$17);
|
|
var Lcom_google_gwt_dom_client_Style$Cursor$17_2_classLit = createForEnum('com.google.gwt.dom.client', 'Style/Cursor/17', 605, null);
|
|
function Style$Cursor$18(){
|
|
Style$Cursor.call(this, 'ROW_RESIZE', 17);
|
|
}
|
|
|
|
defineClass(606, 46, $intern_10, Style$Cursor$18);
|
|
var Lcom_google_gwt_dom_client_Style$Cursor$18_2_classLit = createForEnum('com.google.gwt.dom.client', 'Style/Cursor/18', 606, null);
|
|
function Style$Cursor$2(){
|
|
Style$Cursor.call(this, 'AUTO', 1);
|
|
}
|
|
|
|
defineClass(590, 46, $intern_10, Style$Cursor$2);
|
|
var Lcom_google_gwt_dom_client_Style$Cursor$2_2_classLit = createForEnum('com.google.gwt.dom.client', 'Style/Cursor/2', 590, null);
|
|
function Style$Cursor$3(){
|
|
Style$Cursor.call(this, 'CROSSHAIR', 2);
|
|
}
|
|
|
|
defineClass(591, 46, $intern_10, Style$Cursor$3);
|
|
var Lcom_google_gwt_dom_client_Style$Cursor$3_2_classLit = createForEnum('com.google.gwt.dom.client', 'Style/Cursor/3', 591, null);
|
|
function Style$Cursor$4(){
|
|
Style$Cursor.call(this, 'POINTER', 3);
|
|
}
|
|
|
|
defineClass(592, 46, $intern_10, Style$Cursor$4);
|
|
var Lcom_google_gwt_dom_client_Style$Cursor$4_2_classLit = createForEnum('com.google.gwt.dom.client', 'Style/Cursor/4', 592, null);
|
|
function Style$Cursor$5(){
|
|
Style$Cursor.call(this, 'MOVE', 4);
|
|
}
|
|
|
|
defineClass(593, 46, $intern_10, Style$Cursor$5);
|
|
var Lcom_google_gwt_dom_client_Style$Cursor$5_2_classLit = createForEnum('com.google.gwt.dom.client', 'Style/Cursor/5', 593, null);
|
|
function Style$Cursor$6(){
|
|
Style$Cursor.call(this, 'E_RESIZE', 5);
|
|
}
|
|
|
|
defineClass(594, 46, $intern_10, Style$Cursor$6);
|
|
var Lcom_google_gwt_dom_client_Style$Cursor$6_2_classLit = createForEnum('com.google.gwt.dom.client', 'Style/Cursor/6', 594, null);
|
|
function Style$Cursor$7(){
|
|
Style$Cursor.call(this, 'NE_RESIZE', 6);
|
|
}
|
|
|
|
defineClass(595, 46, $intern_10, Style$Cursor$7);
|
|
var Lcom_google_gwt_dom_client_Style$Cursor$7_2_classLit = createForEnum('com.google.gwt.dom.client', 'Style/Cursor/7', 595, null);
|
|
function Style$Cursor$8(){
|
|
Style$Cursor.call(this, 'NW_RESIZE', 7);
|
|
}
|
|
|
|
defineClass(596, 46, $intern_10, Style$Cursor$8);
|
|
var Lcom_google_gwt_dom_client_Style$Cursor$8_2_classLit = createForEnum('com.google.gwt.dom.client', 'Style/Cursor/8', 596, null);
|
|
function Style$Cursor$9(){
|
|
Style$Cursor.call(this, 'N_RESIZE', 8);
|
|
}
|
|
|
|
defineClass(597, 46, $intern_10, Style$Cursor$9);
|
|
var Lcom_google_gwt_dom_client_Style$Cursor$9_2_classLit = createForEnum('com.google.gwt.dom.client', 'Style/Cursor/9', 597, null);
|
|
function $clinit_Style$Display(){
|
|
$clinit_Style$Display = emptyMethod;
|
|
NONE_0 = new Style$Display$1;
|
|
BLOCK = new Style$Display$2;
|
|
INLINE = new Style$Display$3;
|
|
INLINE_BLOCK = new Style$Display$4;
|
|
INLINE_TABLE = new Style$Display$5;
|
|
LIST_ITEM = new Style$Display$6;
|
|
RUN_IN = new Style$Display$7;
|
|
TABLE = new Style$Display$8;
|
|
TABLE_CAPTION = new Style$Display$9;
|
|
TABLE_COLUMN_GROUP = new Style$Display$10;
|
|
TABLE_HEADER_GROUP = new Style$Display$11;
|
|
TABLE_FOOTER_GROUP = new Style$Display$12;
|
|
TABLE_ROW_GROUP = new Style$Display$13;
|
|
TABLE_CELL = new Style$Display$14;
|
|
TABLE_COLUMN = new Style$Display$15;
|
|
TABLE_ROW = new Style$Display$16;
|
|
INITIAL = new Style$Display$17;
|
|
FLEX = new Style$Display$18;
|
|
INLINE_FLEX = new Style$Display$19;
|
|
}
|
|
|
|
function Style$Display(enum$name, enum$ordinal){
|
|
Enum.call(this, enum$name, enum$ordinal);
|
|
}
|
|
|
|
function values_3(){
|
|
$clinit_Style$Display();
|
|
return stampJavaTypeInfo(getClassLiteralForArray(Lcom_google_gwt_dom_client_Style$Display_2_classLit, 1), $intern_3, 45, 0, [NONE_0, BLOCK, INLINE, INLINE_BLOCK, INLINE_TABLE, LIST_ITEM, RUN_IN, TABLE, TABLE_CAPTION, TABLE_COLUMN_GROUP, TABLE_HEADER_GROUP, TABLE_FOOTER_GROUP, TABLE_ROW_GROUP, TABLE_CELL, TABLE_COLUMN, TABLE_ROW, INITIAL, FLEX, INLINE_FLEX]);
|
|
}
|
|
|
|
defineClass(45, 15, $intern_11);
|
|
var BLOCK, FLEX, INITIAL, INLINE, INLINE_BLOCK, INLINE_FLEX, INLINE_TABLE, LIST_ITEM, NONE_0, RUN_IN, TABLE, TABLE_CAPTION, TABLE_CELL, TABLE_COLUMN, TABLE_COLUMN_GROUP, TABLE_FOOTER_GROUP, TABLE_HEADER_GROUP, TABLE_ROW, TABLE_ROW_GROUP;
|
|
var Lcom_google_gwt_dom_client_Style$Display_2_classLit = createForEnum('com.google.gwt.dom.client', 'Style/Display', 45, values_3);
|
|
function Style$Display$1(){
|
|
Style$Display.call(this, 'NONE', 0);
|
|
}
|
|
|
|
defineClass(607, 45, $intern_11, Style$Display$1);
|
|
_.getCssName = function getCssName(){
|
|
return 'none';
|
|
}
|
|
;
|
|
var Lcom_google_gwt_dom_client_Style$Display$1_2_classLit = createForEnum('com.google.gwt.dom.client', 'Style/Display/1', 607, null);
|
|
function Style$Display$10(){
|
|
Style$Display.call(this, 'TABLE_COLUMN_GROUP', 9);
|
|
}
|
|
|
|
defineClass(616, 45, $intern_11, Style$Display$10);
|
|
_.getCssName = function getCssName_0(){
|
|
return 'table-column-group';
|
|
}
|
|
;
|
|
var Lcom_google_gwt_dom_client_Style$Display$10_2_classLit = createForEnum('com.google.gwt.dom.client', 'Style/Display/10', 616, null);
|
|
function Style$Display$11(){
|
|
Style$Display.call(this, 'TABLE_HEADER_GROUP', 10);
|
|
}
|
|
|
|
defineClass(617, 45, $intern_11, Style$Display$11);
|
|
_.getCssName = function getCssName_1(){
|
|
return 'table-header-group';
|
|
}
|
|
;
|
|
var Lcom_google_gwt_dom_client_Style$Display$11_2_classLit = createForEnum('com.google.gwt.dom.client', 'Style/Display/11', 617, null);
|
|
function Style$Display$12(){
|
|
Style$Display.call(this, 'TABLE_FOOTER_GROUP', 11);
|
|
}
|
|
|
|
defineClass(618, 45, $intern_11, Style$Display$12);
|
|
_.getCssName = function getCssName_2(){
|
|
return 'table-footer-group';
|
|
}
|
|
;
|
|
var Lcom_google_gwt_dom_client_Style$Display$12_2_classLit = createForEnum('com.google.gwt.dom.client', 'Style/Display/12', 618, null);
|
|
function Style$Display$13(){
|
|
Style$Display.call(this, 'TABLE_ROW_GROUP', 12);
|
|
}
|
|
|
|
defineClass(619, 45, $intern_11, Style$Display$13);
|
|
_.getCssName = function getCssName_3(){
|
|
return 'table-row-group';
|
|
}
|
|
;
|
|
var Lcom_google_gwt_dom_client_Style$Display$13_2_classLit = createForEnum('com.google.gwt.dom.client', 'Style/Display/13', 619, null);
|
|
function Style$Display$14(){
|
|
Style$Display.call(this, 'TABLE_CELL', 13);
|
|
}
|
|
|
|
defineClass(620, 45, $intern_11, Style$Display$14);
|
|
_.getCssName = function getCssName_4(){
|
|
return 'table-cell';
|
|
}
|
|
;
|
|
var Lcom_google_gwt_dom_client_Style$Display$14_2_classLit = createForEnum('com.google.gwt.dom.client', 'Style/Display/14', 620, null);
|
|
function Style$Display$15(){
|
|
Style$Display.call(this, 'TABLE_COLUMN', 14);
|
|
}
|
|
|
|
defineClass(621, 45, $intern_11, Style$Display$15);
|
|
_.getCssName = function getCssName_5(){
|
|
return 'table-column';
|
|
}
|
|
;
|
|
var Lcom_google_gwt_dom_client_Style$Display$15_2_classLit = createForEnum('com.google.gwt.dom.client', 'Style/Display/15', 621, null);
|
|
function Style$Display$16(){
|
|
Style$Display.call(this, 'TABLE_ROW', 15);
|
|
}
|
|
|
|
defineClass(622, 45, $intern_11, Style$Display$16);
|
|
_.getCssName = function getCssName_6(){
|
|
return 'table-row';
|
|
}
|
|
;
|
|
var Lcom_google_gwt_dom_client_Style$Display$16_2_classLit = createForEnum('com.google.gwt.dom.client', 'Style/Display/16', 622, null);
|
|
function Style$Display$17(){
|
|
Style$Display.call(this, 'INITIAL', 16);
|
|
}
|
|
|
|
defineClass(623, 45, $intern_11, Style$Display$17);
|
|
_.getCssName = function getCssName_7(){
|
|
return 'initial';
|
|
}
|
|
;
|
|
var Lcom_google_gwt_dom_client_Style$Display$17_2_classLit = createForEnum('com.google.gwt.dom.client', 'Style/Display/17', 623, null);
|
|
function Style$Display$18(){
|
|
Style$Display.call(this, 'FLEX', 17);
|
|
}
|
|
|
|
defineClass(624, 45, $intern_11, Style$Display$18);
|
|
_.getCssName = function getCssName_8(){
|
|
return 'flex';
|
|
}
|
|
;
|
|
var Lcom_google_gwt_dom_client_Style$Display$18_2_classLit = createForEnum('com.google.gwt.dom.client', 'Style/Display/18', 624, null);
|
|
function Style$Display$19(){
|
|
Style$Display.call(this, 'INLINE_FLEX', 18);
|
|
}
|
|
|
|
defineClass(625, 45, $intern_11, Style$Display$19);
|
|
_.getCssName = function getCssName_9(){
|
|
return 'inline-flex';
|
|
}
|
|
;
|
|
var Lcom_google_gwt_dom_client_Style$Display$19_2_classLit = createForEnum('com.google.gwt.dom.client', 'Style/Display/19', 625, null);
|
|
function Style$Display$2(){
|
|
Style$Display.call(this, 'BLOCK', 1);
|
|
}
|
|
|
|
defineClass(608, 45, $intern_11, Style$Display$2);
|
|
_.getCssName = function getCssName_10(){
|
|
return 'block';
|
|
}
|
|
;
|
|
var Lcom_google_gwt_dom_client_Style$Display$2_2_classLit = createForEnum('com.google.gwt.dom.client', 'Style/Display/2', 608, null);
|
|
function Style$Display$3(){
|
|
Style$Display.call(this, 'INLINE', 2);
|
|
}
|
|
|
|
defineClass(609, 45, $intern_11, Style$Display$3);
|
|
_.getCssName = function getCssName_11(){
|
|
return 'inline';
|
|
}
|
|
;
|
|
var Lcom_google_gwt_dom_client_Style$Display$3_2_classLit = createForEnum('com.google.gwt.dom.client', 'Style/Display/3', 609, null);
|
|
function Style$Display$4(){
|
|
Style$Display.call(this, 'INLINE_BLOCK', 3);
|
|
}
|
|
|
|
defineClass(610, 45, $intern_11, Style$Display$4);
|
|
_.getCssName = function getCssName_12(){
|
|
return 'inline-block';
|
|
}
|
|
;
|
|
var Lcom_google_gwt_dom_client_Style$Display$4_2_classLit = createForEnum('com.google.gwt.dom.client', 'Style/Display/4', 610, null);
|
|
function Style$Display$5(){
|
|
Style$Display.call(this, 'INLINE_TABLE', 4);
|
|
}
|
|
|
|
defineClass(611, 45, $intern_11, Style$Display$5);
|
|
_.getCssName = function getCssName_13(){
|
|
return 'inline-table';
|
|
}
|
|
;
|
|
var Lcom_google_gwt_dom_client_Style$Display$5_2_classLit = createForEnum('com.google.gwt.dom.client', 'Style/Display/5', 611, null);
|
|
function Style$Display$6(){
|
|
Style$Display.call(this, 'LIST_ITEM', 5);
|
|
}
|
|
|
|
defineClass(612, 45, $intern_11, Style$Display$6);
|
|
_.getCssName = function getCssName_14(){
|
|
return 'list-item';
|
|
}
|
|
;
|
|
var Lcom_google_gwt_dom_client_Style$Display$6_2_classLit = createForEnum('com.google.gwt.dom.client', 'Style/Display/6', 612, null);
|
|
function Style$Display$7(){
|
|
Style$Display.call(this, 'RUN_IN', 6);
|
|
}
|
|
|
|
defineClass(613, 45, $intern_11, Style$Display$7);
|
|
_.getCssName = function getCssName_15(){
|
|
return 'run-in';
|
|
}
|
|
;
|
|
var Lcom_google_gwt_dom_client_Style$Display$7_2_classLit = createForEnum('com.google.gwt.dom.client', 'Style/Display/7', 613, null);
|
|
function Style$Display$8(){
|
|
Style$Display.call(this, 'TABLE', 7);
|
|
}
|
|
|
|
defineClass(614, 45, $intern_11, Style$Display$8);
|
|
_.getCssName = function getCssName_16(){
|
|
return 'table';
|
|
}
|
|
;
|
|
var Lcom_google_gwt_dom_client_Style$Display$8_2_classLit = createForEnum('com.google.gwt.dom.client', 'Style/Display/8', 614, null);
|
|
function Style$Display$9(){
|
|
Style$Display.call(this, 'TABLE_CAPTION', 8);
|
|
}
|
|
|
|
defineClass(615, 45, $intern_11, Style$Display$9);
|
|
_.getCssName = function getCssName_17(){
|
|
return 'table-caption';
|
|
}
|
|
;
|
|
var Lcom_google_gwt_dom_client_Style$Display$9_2_classLit = createForEnum('com.google.gwt.dom.client', 'Style/Display/9', 615, null);
|
|
function $clinit_Style$FontWeight(){
|
|
$clinit_Style$FontWeight = emptyMethod;
|
|
NORMAL = new Style$FontWeight$1;
|
|
BOLD = new Style$FontWeight$2;
|
|
BOLDER = new Style$FontWeight$3;
|
|
LIGHTER = new Style$FontWeight$4;
|
|
}
|
|
|
|
function Style$FontWeight(enum$name, enum$ordinal){
|
|
Enum.call(this, enum$name, enum$ordinal);
|
|
}
|
|
|
|
function values_4(){
|
|
$clinit_Style$FontWeight();
|
|
return stampJavaTypeInfo(getClassLiteralForArray(Lcom_google_gwt_dom_client_Style$FontWeight_2_classLit, 1), $intern_3, 161, 0, [NORMAL, BOLD, BOLDER, LIGHTER]);
|
|
}
|
|
|
|
defineClass(161, 15, $intern_12);
|
|
var BOLD, BOLDER, LIGHTER, NORMAL;
|
|
var Lcom_google_gwt_dom_client_Style$FontWeight_2_classLit = createForEnum('com.google.gwt.dom.client', 'Style/FontWeight', 161, values_4);
|
|
function Style$FontWeight$1(){
|
|
Style$FontWeight.call(this, 'NORMAL', 0);
|
|
}
|
|
|
|
defineClass(626, 161, $intern_12, Style$FontWeight$1);
|
|
var Lcom_google_gwt_dom_client_Style$FontWeight$1_2_classLit = createForEnum('com.google.gwt.dom.client', 'Style/FontWeight/1', 626, null);
|
|
function Style$FontWeight$2(){
|
|
Style$FontWeight.call(this, 'BOLD', 1);
|
|
}
|
|
|
|
defineClass(627, 161, $intern_12, Style$FontWeight$2);
|
|
var Lcom_google_gwt_dom_client_Style$FontWeight$2_2_classLit = createForEnum('com.google.gwt.dom.client', 'Style/FontWeight/2', 627, null);
|
|
function Style$FontWeight$3(){
|
|
Style$FontWeight.call(this, 'BOLDER', 2);
|
|
}
|
|
|
|
defineClass(628, 161, $intern_12, Style$FontWeight$3);
|
|
var Lcom_google_gwt_dom_client_Style$FontWeight$3_2_classLit = createForEnum('com.google.gwt.dom.client', 'Style/FontWeight/3', 628, null);
|
|
function Style$FontWeight$4(){
|
|
Style$FontWeight.call(this, 'LIGHTER', 3);
|
|
}
|
|
|
|
defineClass(629, 161, $intern_12, Style$FontWeight$4);
|
|
var Lcom_google_gwt_dom_client_Style$FontWeight$4_2_classLit = createForEnum('com.google.gwt.dom.client', 'Style/FontWeight/4', 629, null);
|
|
function $clinit_Style$Overflow(){
|
|
$clinit_Style$Overflow = emptyMethod;
|
|
VISIBLE = new Style$Overflow$1;
|
|
HIDDEN_1 = new Style$Overflow$2;
|
|
SCROLL = new Style$Overflow$3;
|
|
AUTO_0 = new Style$Overflow$4;
|
|
}
|
|
|
|
function Style$Overflow(enum$name, enum$ordinal){
|
|
Enum.call(this, enum$name, enum$ordinal);
|
|
}
|
|
|
|
function values_5(){
|
|
$clinit_Style$Overflow();
|
|
return stampJavaTypeInfo(getClassLiteralForArray(Lcom_google_gwt_dom_client_Style$Overflow_2_classLit, 1), $intern_3, 162, 0, [VISIBLE, HIDDEN_1, SCROLL, AUTO_0]);
|
|
}
|
|
|
|
defineClass(162, 15, $intern_13);
|
|
var AUTO_0, HIDDEN_1, SCROLL, VISIBLE;
|
|
var Lcom_google_gwt_dom_client_Style$Overflow_2_classLit = createForEnum('com.google.gwt.dom.client', 'Style/Overflow', 162, values_5);
|
|
function Style$Overflow$1(){
|
|
Style$Overflow.call(this, 'VISIBLE', 0);
|
|
}
|
|
|
|
defineClass(630, 162, $intern_13, Style$Overflow$1);
|
|
var Lcom_google_gwt_dom_client_Style$Overflow$1_2_classLit = createForEnum('com.google.gwt.dom.client', 'Style/Overflow/1', 630, null);
|
|
function Style$Overflow$2(){
|
|
Style$Overflow.call(this, 'HIDDEN', 1);
|
|
}
|
|
|
|
defineClass(631, 162, $intern_13, Style$Overflow$2);
|
|
var Lcom_google_gwt_dom_client_Style$Overflow$2_2_classLit = createForEnum('com.google.gwt.dom.client', 'Style/Overflow/2', 631, null);
|
|
function Style$Overflow$3(){
|
|
Style$Overflow.call(this, 'SCROLL', 2);
|
|
}
|
|
|
|
defineClass(632, 162, $intern_13, Style$Overflow$3);
|
|
var Lcom_google_gwt_dom_client_Style$Overflow$3_2_classLit = createForEnum('com.google.gwt.dom.client', 'Style/Overflow/3', 632, null);
|
|
function Style$Overflow$4(){
|
|
Style$Overflow.call(this, 'AUTO', 3);
|
|
}
|
|
|
|
defineClass(633, 162, $intern_13, Style$Overflow$4);
|
|
var Lcom_google_gwt_dom_client_Style$Overflow$4_2_classLit = createForEnum('com.google.gwt.dom.client', 'Style/Overflow/4', 633, null);
|
|
function $clinit_Style$Position(){
|
|
$clinit_Style$Position = emptyMethod;
|
|
STATIC = new Style$Position$1;
|
|
RELATIVE = new Style$Position$2;
|
|
ABSOLUTE = new Style$Position$3;
|
|
FIXED = new Style$Position$4;
|
|
}
|
|
|
|
function Style$Position(enum$name, enum$ordinal){
|
|
Enum.call(this, enum$name, enum$ordinal);
|
|
}
|
|
|
|
function values_6(){
|
|
$clinit_Style$Position();
|
|
return stampJavaTypeInfo(getClassLiteralForArray(Lcom_google_gwt_dom_client_Style$Position_2_classLit, 1), $intern_3, 163, 0, [STATIC, RELATIVE, ABSOLUTE, FIXED]);
|
|
}
|
|
|
|
defineClass(163, 15, $intern_14);
|
|
var ABSOLUTE, FIXED, RELATIVE, STATIC;
|
|
var Lcom_google_gwt_dom_client_Style$Position_2_classLit = createForEnum('com.google.gwt.dom.client', 'Style/Position', 163, values_6);
|
|
function Style$Position$1(){
|
|
Style$Position.call(this, 'STATIC', 0);
|
|
}
|
|
|
|
defineClass(634, 163, $intern_14, Style$Position$1);
|
|
var Lcom_google_gwt_dom_client_Style$Position$1_2_classLit = createForEnum('com.google.gwt.dom.client', 'Style/Position/1', 634, null);
|
|
function Style$Position$2(){
|
|
Style$Position.call(this, 'RELATIVE', 1);
|
|
}
|
|
|
|
defineClass(635, 163, $intern_14, Style$Position$2);
|
|
var Lcom_google_gwt_dom_client_Style$Position$2_2_classLit = createForEnum('com.google.gwt.dom.client', 'Style/Position/2', 635, null);
|
|
function Style$Position$3(){
|
|
Style$Position.call(this, 'ABSOLUTE', 2);
|
|
}
|
|
|
|
defineClass(636, 163, $intern_14, Style$Position$3);
|
|
var Lcom_google_gwt_dom_client_Style$Position$3_2_classLit = createForEnum('com.google.gwt.dom.client', 'Style/Position/3', 636, null);
|
|
function Style$Position$4(){
|
|
Style$Position.call(this, 'FIXED', 3);
|
|
}
|
|
|
|
defineClass(637, 163, $intern_14, Style$Position$4);
|
|
var Lcom_google_gwt_dom_client_Style$Position$4_2_classLit = createForEnum('com.google.gwt.dom.client', 'Style/Position/4', 637, null);
|
|
function $clinit_Style$TextAlign(){
|
|
$clinit_Style$TextAlign = emptyMethod;
|
|
CENTER = new Style$TextAlign$1;
|
|
JUSTIFY = new Style$TextAlign$2;
|
|
LEFT = new Style$TextAlign$3;
|
|
RIGHT = new Style$TextAlign$4;
|
|
}
|
|
|
|
function Style$TextAlign(enum$name, enum$ordinal){
|
|
Enum.call(this, enum$name, enum$ordinal);
|
|
}
|
|
|
|
function values_7(){
|
|
$clinit_Style$TextAlign();
|
|
return stampJavaTypeInfo(getClassLiteralForArray(Lcom_google_gwt_dom_client_Style$TextAlign_2_classLit, 1), $intern_3, 164, 0, [CENTER, JUSTIFY, LEFT, RIGHT]);
|
|
}
|
|
|
|
defineClass(164, 15, $intern_15);
|
|
var CENTER, JUSTIFY, LEFT, RIGHT;
|
|
var Lcom_google_gwt_dom_client_Style$TextAlign_2_classLit = createForEnum('com.google.gwt.dom.client', 'Style/TextAlign', 164, values_7);
|
|
function Style$TextAlign$1(){
|
|
Style$TextAlign.call(this, 'CENTER', 0);
|
|
}
|
|
|
|
defineClass(638, 164, $intern_15, Style$TextAlign$1);
|
|
var Lcom_google_gwt_dom_client_Style$TextAlign$1_2_classLit = createForEnum('com.google.gwt.dom.client', 'Style/TextAlign/1', 638, null);
|
|
function Style$TextAlign$2(){
|
|
Style$TextAlign.call(this, 'JUSTIFY', 1);
|
|
}
|
|
|
|
defineClass(639, 164, $intern_15, Style$TextAlign$2);
|
|
var Lcom_google_gwt_dom_client_Style$TextAlign$2_2_classLit = createForEnum('com.google.gwt.dom.client', 'Style/TextAlign/2', 639, null);
|
|
function Style$TextAlign$3(){
|
|
Style$TextAlign.call(this, 'LEFT', 2);
|
|
}
|
|
|
|
defineClass(640, 164, $intern_15, Style$TextAlign$3);
|
|
var Lcom_google_gwt_dom_client_Style$TextAlign$3_2_classLit = createForEnum('com.google.gwt.dom.client', 'Style/TextAlign/3', 640, null);
|
|
function Style$TextAlign$4(){
|
|
Style$TextAlign.call(this, 'RIGHT', 3);
|
|
}
|
|
|
|
defineClass(641, 164, $intern_15, Style$TextAlign$4);
|
|
var Lcom_google_gwt_dom_client_Style$TextAlign$4_2_classLit = createForEnum('com.google.gwt.dom.client', 'Style/TextAlign/4', 641, null);
|
|
function $clinit_Style$Unit(){
|
|
$clinit_Style$Unit = emptyMethod;
|
|
PX = new Style$Unit$1;
|
|
PCT = new Style$Unit$2;
|
|
EM = new Style$Unit$3;
|
|
EX = new Style$Unit$4;
|
|
PT = new Style$Unit$5;
|
|
PC = new Style$Unit$6;
|
|
IN = new Style$Unit$7;
|
|
CM = new Style$Unit$8;
|
|
MM = new Style$Unit$9;
|
|
}
|
|
|
|
function Style$Unit(enum$name, enum$ordinal){
|
|
Enum.call(this, enum$name, enum$ordinal);
|
|
}
|
|
|
|
function values_8(){
|
|
$clinit_Style$Unit();
|
|
return stampJavaTypeInfo(getClassLiteralForArray(Lcom_google_gwt_dom_client_Style$Unit_2_classLit, 1), $intern_3, 103, 0, [PX, PCT, EM, EX, PT, PC, IN, CM, MM]);
|
|
}
|
|
|
|
defineClass(103, 15, $intern_16);
|
|
var CM, EM, EX, IN, MM, PC, PCT, PT, PX;
|
|
var Lcom_google_gwt_dom_client_Style$Unit_2_classLit = createForEnum('com.google.gwt.dom.client', 'Style/Unit', 103, values_8);
|
|
function Style$Unit$1(){
|
|
Style$Unit.call(this, 'PX', 0);
|
|
}
|
|
|
|
defineClass(575, 103, $intern_16, Style$Unit$1);
|
|
_.getType_0 = function getType(){
|
|
return 'px';
|
|
}
|
|
;
|
|
var Lcom_google_gwt_dom_client_Style$Unit$1_2_classLit = createForEnum('com.google.gwt.dom.client', 'Style/Unit/1', 575, null);
|
|
function Style$Unit$2(){
|
|
Style$Unit.call(this, 'PCT', 1);
|
|
}
|
|
|
|
defineClass(576, 103, $intern_16, Style$Unit$2);
|
|
_.getType_0 = function getType_0(){
|
|
return '%';
|
|
}
|
|
;
|
|
var Lcom_google_gwt_dom_client_Style$Unit$2_2_classLit = createForEnum('com.google.gwt.dom.client', 'Style/Unit/2', 576, null);
|
|
function Style$Unit$3(){
|
|
Style$Unit.call(this, 'EM', 2);
|
|
}
|
|
|
|
defineClass(577, 103, $intern_16, Style$Unit$3);
|
|
_.getType_0 = function getType_1(){
|
|
return 'em';
|
|
}
|
|
;
|
|
var Lcom_google_gwt_dom_client_Style$Unit$3_2_classLit = createForEnum('com.google.gwt.dom.client', 'Style/Unit/3', 577, null);
|
|
function Style$Unit$4(){
|
|
Style$Unit.call(this, 'EX', 3);
|
|
}
|
|
|
|
defineClass(578, 103, $intern_16, Style$Unit$4);
|
|
_.getType_0 = function getType_2(){
|
|
return 'ex';
|
|
}
|
|
;
|
|
var Lcom_google_gwt_dom_client_Style$Unit$4_2_classLit = createForEnum('com.google.gwt.dom.client', 'Style/Unit/4', 578, null);
|
|
function Style$Unit$5(){
|
|
Style$Unit.call(this, 'PT', 4);
|
|
}
|
|
|
|
defineClass(579, 103, $intern_16, Style$Unit$5);
|
|
_.getType_0 = function getType_3(){
|
|
return 'pt';
|
|
}
|
|
;
|
|
var Lcom_google_gwt_dom_client_Style$Unit$5_2_classLit = createForEnum('com.google.gwt.dom.client', 'Style/Unit/5', 579, null);
|
|
function Style$Unit$6(){
|
|
Style$Unit.call(this, 'PC', 5);
|
|
}
|
|
|
|
defineClass(580, 103, $intern_16, Style$Unit$6);
|
|
_.getType_0 = function getType_4(){
|
|
return 'pc';
|
|
}
|
|
;
|
|
var Lcom_google_gwt_dom_client_Style$Unit$6_2_classLit = createForEnum('com.google.gwt.dom.client', 'Style/Unit/6', 580, null);
|
|
function Style$Unit$7(){
|
|
Style$Unit.call(this, 'IN', 6);
|
|
}
|
|
|
|
defineClass(581, 103, $intern_16, Style$Unit$7);
|
|
_.getType_0 = function getType_5(){
|
|
return 'in';
|
|
}
|
|
;
|
|
var Lcom_google_gwt_dom_client_Style$Unit$7_2_classLit = createForEnum('com.google.gwt.dom.client', 'Style/Unit/7', 581, null);
|
|
function Style$Unit$8(){
|
|
Style$Unit.call(this, 'CM', 7);
|
|
}
|
|
|
|
defineClass(582, 103, $intern_16, Style$Unit$8);
|
|
_.getType_0 = function getType_6(){
|
|
return 'cm';
|
|
}
|
|
;
|
|
var Lcom_google_gwt_dom_client_Style$Unit$8_2_classLit = createForEnum('com.google.gwt.dom.client', 'Style/Unit/8', 582, null);
|
|
function Style$Unit$9(){
|
|
Style$Unit.call(this, 'MM', 8);
|
|
}
|
|
|
|
defineClass(583, 103, $intern_16, Style$Unit$9);
|
|
_.getType_0 = function getType_7(){
|
|
return 'mm';
|
|
}
|
|
;
|
|
var Lcom_google_gwt_dom_client_Style$Unit$9_2_classLit = createForEnum('com.google.gwt.dom.client', 'Style/Unit/9', 583, null);
|
|
function $clinit_Style$Visibility(){
|
|
$clinit_Style$Visibility = emptyMethod;
|
|
VISIBLE_0 = new Style$Visibility$1;
|
|
HIDDEN_2 = new Style$Visibility$2;
|
|
}
|
|
|
|
function Style$Visibility(enum$name, enum$ordinal){
|
|
Enum.call(this, enum$name, enum$ordinal);
|
|
}
|
|
|
|
function values_9(){
|
|
$clinit_Style$Visibility();
|
|
return stampJavaTypeInfo(getClassLiteralForArray(Lcom_google_gwt_dom_client_Style$Visibility_2_classLit, 1), $intern_3, 218, 0, [VISIBLE_0, HIDDEN_2]);
|
|
}
|
|
|
|
defineClass(218, 15, $intern_17);
|
|
var HIDDEN_2, VISIBLE_0;
|
|
var Lcom_google_gwt_dom_client_Style$Visibility_2_classLit = createForEnum('com.google.gwt.dom.client', 'Style/Visibility', 218, values_9);
|
|
function Style$Visibility$1(){
|
|
Style$Visibility.call(this, 'VISIBLE', 0);
|
|
}
|
|
|
|
defineClass(642, 218, $intern_17, Style$Visibility$1);
|
|
var Lcom_google_gwt_dom_client_Style$Visibility$1_2_classLit = createForEnum('com.google.gwt.dom.client', 'Style/Visibility/1', 642, null);
|
|
function Style$Visibility$2(){
|
|
Style$Visibility.call(this, 'HIDDEN', 1);
|
|
}
|
|
|
|
defineClass(643, 218, $intern_17, Style$Visibility$2);
|
|
var Lcom_google_gwt_dom_client_Style$Visibility$2_2_classLit = createForEnum('com.google.gwt.dom.client', 'Style/Visibility/2', 643, null);
|
|
function $clinit_Style$WhiteSpace(){
|
|
$clinit_Style$WhiteSpace = emptyMethod;
|
|
NORMAL_0 = new Style$WhiteSpace$1;
|
|
NOWRAP = new Style$WhiteSpace$2;
|
|
PRE = new Style$WhiteSpace$3;
|
|
PRE_LINE = new Style$WhiteSpace$4;
|
|
PRE_WRAP = new Style$WhiteSpace$5;
|
|
}
|
|
|
|
function Style$WhiteSpace(enum$name, enum$ordinal){
|
|
Enum.call(this, enum$name, enum$ordinal);
|
|
}
|
|
|
|
function values_10(){
|
|
$clinit_Style$WhiteSpace();
|
|
return stampJavaTypeInfo(getClassLiteralForArray(Lcom_google_gwt_dom_client_Style$WhiteSpace_2_classLit, 1), $intern_3, 151, 0, [NORMAL_0, NOWRAP, PRE, PRE_LINE, PRE_WRAP]);
|
|
}
|
|
|
|
defineClass(151, 15, $intern_18);
|
|
var NORMAL_0, NOWRAP, PRE, PRE_LINE, PRE_WRAP;
|
|
var Lcom_google_gwt_dom_client_Style$WhiteSpace_2_classLit = createForEnum('com.google.gwt.dom.client', 'Style/WhiteSpace', 151, values_10);
|
|
function Style$WhiteSpace$1(){
|
|
Style$WhiteSpace.call(this, 'NORMAL', 0);
|
|
}
|
|
|
|
defineClass(644, 151, $intern_18, Style$WhiteSpace$1);
|
|
var Lcom_google_gwt_dom_client_Style$WhiteSpace$1_2_classLit = createForEnum('com.google.gwt.dom.client', 'Style/WhiteSpace/1', 644, null);
|
|
function Style$WhiteSpace$2(){
|
|
Style$WhiteSpace.call(this, 'NOWRAP', 1);
|
|
}
|
|
|
|
defineClass(645, 151, $intern_18, Style$WhiteSpace$2);
|
|
var Lcom_google_gwt_dom_client_Style$WhiteSpace$2_2_classLit = createForEnum('com.google.gwt.dom.client', 'Style/WhiteSpace/2', 645, null);
|
|
function Style$WhiteSpace$3(){
|
|
Style$WhiteSpace.call(this, 'PRE', 2);
|
|
}
|
|
|
|
defineClass(646, 151, $intern_18, Style$WhiteSpace$3);
|
|
var Lcom_google_gwt_dom_client_Style$WhiteSpace$3_2_classLit = createForEnum('com.google.gwt.dom.client', 'Style/WhiteSpace/3', 646, null);
|
|
function Style$WhiteSpace$4(){
|
|
Style$WhiteSpace.call(this, 'PRE_LINE', 3);
|
|
}
|
|
|
|
defineClass(647, 151, $intern_18, Style$WhiteSpace$4);
|
|
var Lcom_google_gwt_dom_client_Style$WhiteSpace$4_2_classLit = createForEnum('com.google.gwt.dom.client', 'Style/WhiteSpace/4', 647, null);
|
|
function Style$WhiteSpace$5(){
|
|
Style$WhiteSpace.call(this, 'PRE_WRAP', 4);
|
|
}
|
|
|
|
defineClass(648, 151, $intern_18, Style$WhiteSpace$5);
|
|
var Lcom_google_gwt_dom_client_Style$WhiteSpace$5_2_classLit = createForEnum('com.google.gwt.dom.client', 'Style/WhiteSpace/5', 648, null);
|
|
function $setRows(this$static, rows_0){
|
|
this$static.rows = rows_0;
|
|
}
|
|
|
|
function $getRelativeX(this$static, target){
|
|
return ((this$static.clientX || 0) | 0) - $getAbsoluteLeft_0(target) + $getScrollLeft(target) + ($wnd.pageXOffset | 0);
|
|
}
|
|
|
|
defineClass(977, 1, {});
|
|
_.toString_0 = function toString_4(){
|
|
return 'An event type';
|
|
}
|
|
;
|
|
var Lcom_google_web_bindery_event_shared_Event_2_classLit = createForClass('com.google.web.bindery.event.shared', 'Event', 977);
|
|
function $overrideSource(this$static, source){
|
|
this$static.source = source;
|
|
}
|
|
|
|
defineClass(978, 977, {});
|
|
_.revive = function revive(){
|
|
this.dead = false;
|
|
this.source = null;
|
|
}
|
|
;
|
|
_.dead = false;
|
|
var Lcom_google_gwt_event_shared_GwtEvent_2_classLit = createForClass('com.google.gwt.event.shared', 'GwtEvent', 978);
|
|
function $setNativeEvent(this$static, nativeEvent){
|
|
this$static.nativeEvent = nativeEvent;
|
|
}
|
|
|
|
function $setRelativeElement(this$static, relativeElem){
|
|
this$static.relativeElem = relativeElem;
|
|
}
|
|
|
|
function fireNativeEvent(nativeEvent, handlerSource, relativeElem){
|
|
var currentNative, currentRelativeElem, type_0, type$iterator, types;
|
|
if (registered) {
|
|
types = $unsafeGet(registered, nativeEvent.type);
|
|
if (types) {
|
|
for (type$iterator = types.iterator(); type$iterator.hasNext_0();) {
|
|
type_0 = type$iterator.next_1();
|
|
currentNative = type_0.flyweight.nativeEvent;
|
|
currentRelativeElem = type_0.flyweight.relativeElem;
|
|
$setNativeEvent(type_0.flyweight, nativeEvent);
|
|
$setRelativeElement(type_0.flyweight, relativeElem);
|
|
$fireEvent(handlerSource, type_0.flyweight);
|
|
$setNativeEvent(type_0.flyweight, currentNative);
|
|
$setRelativeElement(type_0.flyweight, currentRelativeElem);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
defineClass(984, 978, {});
|
|
_.getAssociatedType = function getAssociatedType(){
|
|
return this.getAssociatedType_0();
|
|
}
|
|
;
|
|
var registered;
|
|
var Lcom_google_gwt_event_dom_client_DomEvent_2_classLit = createForClass('com.google.gwt.event.dom.client', 'DomEvent', 984);
|
|
function $clinit_BlurEvent(){
|
|
$clinit_BlurEvent = emptyMethod;
|
|
TYPE = new DomEvent$Type('blur', new BlurEvent);
|
|
}
|
|
|
|
function BlurEvent(){
|
|
}
|
|
|
|
defineClass(832, 984, {}, BlurEvent);
|
|
_.dispatch = function dispatch(handler){
|
|
!handler.this$01.shownChildMenu && $selectItem(handler.this$01, null);
|
|
}
|
|
;
|
|
_.getAssociatedType_0 = function getAssociatedType_0(){
|
|
return TYPE;
|
|
}
|
|
;
|
|
var TYPE;
|
|
var Lcom_google_gwt_event_dom_client_BlurEvent_2_classLit = createForClass('com.google.gwt.event.dom.client', 'BlurEvent', 832);
|
|
function $clinit_ChangeEvent(){
|
|
$clinit_ChangeEvent = emptyMethod;
|
|
TYPE_0 = new DomEvent$Type('change', new ChangeEvent);
|
|
}
|
|
|
|
function ChangeEvent(){
|
|
}
|
|
|
|
defineClass(801, 984, {}, ChangeEvent);
|
|
_.dispatch = function dispatch_0(handler){
|
|
handler.onChange(this);
|
|
}
|
|
;
|
|
_.getAssociatedType_0 = function getAssociatedType_1(){
|
|
return TYPE_0;
|
|
}
|
|
;
|
|
var TYPE_0;
|
|
var Lcom_google_gwt_event_dom_client_ChangeEvent_2_classLit = createForClass('com.google.gwt.event.dom.client', 'ChangeEvent', 801);
|
|
defineClass(985, 984, {});
|
|
var Lcom_google_gwt_event_dom_client_HumanInputEvent_2_classLit = createForClass('com.google.gwt.event.dom.client', 'HumanInputEvent', 985);
|
|
function $getX(this$static){
|
|
var e, relativeElem;
|
|
relativeElem = this$static.relativeElem;
|
|
if (relativeElem) {
|
|
return e = this$static.nativeEvent , ((e.clientX || 0) | 0) - $getAbsoluteLeft_0(relativeElem) + $getScrollLeft(relativeElem) + ($wnd.pageXOffset | 0);
|
|
}
|
|
return (this$static.nativeEvent.clientX || 0) | 0;
|
|
}
|
|
|
|
function $getY(this$static){
|
|
var e, relativeElem;
|
|
relativeElem = this$static.relativeElem;
|
|
if (relativeElem) {
|
|
return e = this$static.nativeEvent , ((e.clientY || 0) | 0) - ($getBoundingClientRectTop(relativeElem) + $wnd.pageYOffset | 0) + ((relativeElem.scrollTop || 0) | 0) + ($wnd.pageYOffset | 0);
|
|
}
|
|
return (this$static.nativeEvent.clientY || 0) | 0;
|
|
}
|
|
|
|
defineClass(986, 985, {});
|
|
var Lcom_google_gwt_event_dom_client_MouseEvent_2_classLit = createForClass('com.google.gwt.event.dom.client', 'MouseEvent', 986);
|
|
function $clinit_ClickEvent(){
|
|
$clinit_ClickEvent = emptyMethod;
|
|
TYPE_1 = new DomEvent$Type('click', new ClickEvent);
|
|
}
|
|
|
|
function ClickEvent(){
|
|
}
|
|
|
|
defineClass(680, 986, {}, ClickEvent);
|
|
_.dispatch = function dispatch_1(handler){
|
|
handler.onClick(this);
|
|
}
|
|
;
|
|
_.getAssociatedType_0 = function getAssociatedType_2(){
|
|
return TYPE_1;
|
|
}
|
|
;
|
|
var TYPE_1;
|
|
var Lcom_google_gwt_event_dom_client_ClickEvent_2_classLit = createForClass('com.google.gwt.event.dom.client', 'ClickEvent', 680);
|
|
function $clinit_ContextMenuEvent(){
|
|
$clinit_ContextMenuEvent = emptyMethod;
|
|
TYPE_2 = new DomEvent$Type('contextmenu', new ContextMenuEvent);
|
|
}
|
|
|
|
function ContextMenuEvent(){
|
|
}
|
|
|
|
defineClass(708, 984, {}, ContextMenuEvent);
|
|
_.dispatch = function dispatch_2(handler){
|
|
$onContextMenu(handler, this);
|
|
}
|
|
;
|
|
_.getAssociatedType_0 = function getAssociatedType_3(){
|
|
return TYPE_2;
|
|
}
|
|
;
|
|
var TYPE_2;
|
|
var Lcom_google_gwt_event_dom_client_ContextMenuEvent_2_classLit = createForClass('com.google.gwt.event.dom.client', 'ContextMenuEvent', 708);
|
|
defineClass(484, 1, {});
|
|
_.hashCode_0 = function hashCode_2(){
|
|
return this.index_0;
|
|
}
|
|
;
|
|
_.toString_0 = function toString_5(){
|
|
return 'Event type';
|
|
}
|
|
;
|
|
_.index_0 = 0;
|
|
var nextHashCode = 0;
|
|
var Lcom_google_web_bindery_event_shared_Event$Type_2_classLit = createForClass('com.google.web.bindery.event.shared', 'Event/Type', 484);
|
|
function GwtEvent$Type(){
|
|
this.index_0 = ++nextHashCode;
|
|
}
|
|
|
|
defineClass(158, 484, {}, GwtEvent$Type);
|
|
var Lcom_google_gwt_event_shared_GwtEvent$Type_2_classLit = createForClass('com.google.gwt.event.shared', 'GwtEvent/Type', 158);
|
|
function DomEvent$Type(eventName, flyweight){
|
|
var types;
|
|
GwtEvent$Type.call(this);
|
|
this.flyweight = flyweight;
|
|
!registered && (registered = new PrivateMap);
|
|
types = $unsafeGet(registered, eventName);
|
|
if (!types) {
|
|
types = new ArrayList;
|
|
$unsafePut(registered, eventName, types);
|
|
}
|
|
types.add_1(this);
|
|
this.name_0 = eventName;
|
|
}
|
|
|
|
defineClass(104, 158, {104:1}, DomEvent$Type);
|
|
var Lcom_google_gwt_event_dom_client_DomEvent$Type_2_classLit = createForClass('com.google.gwt.event.dom.client', 'DomEvent/Type', 104);
|
|
function $clinit_DoubleClickEvent(){
|
|
$clinit_DoubleClickEvent = emptyMethod;
|
|
TYPE_3 = new DomEvent$Type('dblclick', new DoubleClickEvent);
|
|
}
|
|
|
|
function DoubleClickEvent(){
|
|
}
|
|
|
|
defineClass(811, 986, {}, DoubleClickEvent);
|
|
_.dispatch = function dispatch_3(handler){
|
|
handler.onDoubleClick(this);
|
|
}
|
|
;
|
|
_.getAssociatedType_0 = function getAssociatedType_4(){
|
|
return TYPE_3;
|
|
}
|
|
;
|
|
var TYPE_3;
|
|
var Lcom_google_gwt_event_dom_client_DoubleClickEvent_2_classLit = createForClass('com.google.gwt.event.dom.client', 'DoubleClickEvent', 811);
|
|
defineClass(988, 984, {});
|
|
var Lcom_google_gwt_event_dom_client_KeyEvent_2_classLit = createForClass('com.google.gwt.event.dom.client', 'KeyEvent', 988);
|
|
defineClass(989, 988, {});
|
|
var Lcom_google_gwt_event_dom_client_KeyCodeEvent_2_classLit = createForClass('com.google.gwt.event.dom.client', 'KeyCodeEvent', 989);
|
|
function maybeSwapArrowKeysForRtl(code_0, isRtl){
|
|
isRtl && (code_0 == 39?(code_0 = 37):code_0 == 37 && (code_0 = 39));
|
|
return code_0;
|
|
}
|
|
|
|
function $clinit_KeyDownEvent(){
|
|
$clinit_KeyDownEvent = emptyMethod;
|
|
TYPE_4 = new DomEvent$Type('keydown', new KeyDownEvent);
|
|
}
|
|
|
|
function KeyDownEvent(){
|
|
}
|
|
|
|
defineClass(817, 989, {}, KeyDownEvent);
|
|
_.dispatch = function dispatch_4(handler){
|
|
$onKeyDown(handler, this);
|
|
}
|
|
;
|
|
_.getAssociatedType_0 = function getAssociatedType_5(){
|
|
return TYPE_4;
|
|
}
|
|
;
|
|
var TYPE_4;
|
|
var Lcom_google_gwt_event_dom_client_KeyDownEvent_2_classLit = createForClass('com.google.gwt.event.dom.client', 'KeyDownEvent', 817);
|
|
function $clinit_KeyPressEvent(){
|
|
$clinit_KeyPressEvent = emptyMethod;
|
|
TYPE_5 = new DomEvent$Type('keypress', new KeyPressEvent);
|
|
}
|
|
|
|
function KeyPressEvent(){
|
|
}
|
|
|
|
defineClass(818, 988, {}, KeyPressEvent);
|
|
_.dispatch = function dispatch_5(handler){
|
|
var cc;
|
|
!!this.nativeEvent && (this.nativeEvent.preventDefault() , undefined);
|
|
cc = (this.nativeEvent.charCode || 0) & $intern_8;
|
|
cc >= 32 && cc < 127 && $setRowShortcut(handler.this$01, handler.val$row2, handler.val$text3, String.fromCharCode(cc));
|
|
}
|
|
;
|
|
_.getAssociatedType_0 = function getAssociatedType_6(){
|
|
return TYPE_5;
|
|
}
|
|
;
|
|
var TYPE_5;
|
|
var Lcom_google_gwt_event_dom_client_KeyPressEvent_2_classLit = createForClass('com.google.gwt.event.dom.client', 'KeyPressEvent', 818);
|
|
function $clinit_KeyUpEvent(){
|
|
$clinit_KeyUpEvent = emptyMethod;
|
|
TYPE_6 = new DomEvent$Type('keyup', new KeyUpEvent);
|
|
}
|
|
|
|
function KeyUpEvent(){
|
|
}
|
|
|
|
defineClass(821, 989, {}, KeyUpEvent);
|
|
_.dispatch = function dispatch_6(handler){
|
|
handler.onKeyUp(this);
|
|
}
|
|
;
|
|
_.getAssociatedType_0 = function getAssociatedType_7(){
|
|
return TYPE_6;
|
|
}
|
|
;
|
|
var TYPE_6;
|
|
var Lcom_google_gwt_event_dom_client_KeyUpEvent_2_classLit = createForClass('com.google.gwt.event.dom.client', 'KeyUpEvent', 821);
|
|
function $clinit_MouseDownEvent(){
|
|
$clinit_MouseDownEvent = emptyMethod;
|
|
TYPE_7 = new DomEvent$Type('mousedown', new MouseDownEvent);
|
|
}
|
|
|
|
function MouseDownEvent(){
|
|
}
|
|
|
|
defineClass(802, 986, {}, MouseDownEvent);
|
|
_.dispatch = function dispatch_7(handler){
|
|
handler.onMouseDown(this);
|
|
}
|
|
;
|
|
_.getAssociatedType_0 = function getAssociatedType_8(){
|
|
return TYPE_7;
|
|
}
|
|
;
|
|
var TYPE_7;
|
|
var Lcom_google_gwt_event_dom_client_MouseDownEvent_2_classLit = createForClass('com.google.gwt.event.dom.client', 'MouseDownEvent', 802);
|
|
function $clinit_MouseMoveEvent(){
|
|
$clinit_MouseMoveEvent = emptyMethod;
|
|
TYPE_8 = new DomEvent$Type('mousemove', new MouseMoveEvent);
|
|
}
|
|
|
|
function MouseMoveEvent(){
|
|
}
|
|
|
|
defineClass(804, 986, {}, MouseMoveEvent);
|
|
_.dispatch = function dispatch_8(handler){
|
|
handler.onMouseMove(this);
|
|
}
|
|
;
|
|
_.getAssociatedType_0 = function getAssociatedType_9(){
|
|
return TYPE_8;
|
|
}
|
|
;
|
|
var TYPE_8;
|
|
var Lcom_google_gwt_event_dom_client_MouseMoveEvent_2_classLit = createForClass('com.google.gwt.event.dom.client', 'MouseMoveEvent', 804);
|
|
function $clinit_MouseOutEvent(){
|
|
$clinit_MouseOutEvent = emptyMethod;
|
|
TYPE_9 = new DomEvent$Type('mouseout', new MouseOutEvent);
|
|
}
|
|
|
|
function MouseOutEvent(){
|
|
}
|
|
|
|
defineClass(799, 986, {}, MouseOutEvent);
|
|
_.dispatch = function dispatch_9(handler){
|
|
handler.onMouseOut(this);
|
|
}
|
|
;
|
|
_.getAssociatedType_0 = function getAssociatedType_10(){
|
|
return TYPE_9;
|
|
}
|
|
;
|
|
var TYPE_9;
|
|
var Lcom_google_gwt_event_dom_client_MouseOutEvent_2_classLit = createForClass('com.google.gwt.event.dom.client', 'MouseOutEvent', 799);
|
|
function $clinit_MouseOverEvent(){
|
|
$clinit_MouseOverEvent = emptyMethod;
|
|
TYPE_10 = new DomEvent$Type('mouseover', new MouseOverEvent);
|
|
}
|
|
|
|
function MouseOverEvent(){
|
|
}
|
|
|
|
defineClass(798, 986, {}, MouseOverEvent);
|
|
_.dispatch = function dispatch_10(handler){
|
|
handler.onMouseOver(this);
|
|
}
|
|
;
|
|
_.getAssociatedType_0 = function getAssociatedType_11(){
|
|
return TYPE_10;
|
|
}
|
|
;
|
|
var TYPE_10;
|
|
var Lcom_google_gwt_event_dom_client_MouseOverEvent_2_classLit = createForClass('com.google.gwt.event.dom.client', 'MouseOverEvent', 798);
|
|
function $clinit_MouseUpEvent(){
|
|
$clinit_MouseUpEvent = emptyMethod;
|
|
TYPE_11 = new DomEvent$Type('mouseup', new MouseUpEvent);
|
|
}
|
|
|
|
function MouseUpEvent(){
|
|
}
|
|
|
|
defineClass(803, 986, {}, MouseUpEvent);
|
|
_.dispatch = function dispatch_11(handler){
|
|
handler.onMouseUp(this);
|
|
}
|
|
;
|
|
_.getAssociatedType_0 = function getAssociatedType_12(){
|
|
return TYPE_11;
|
|
}
|
|
;
|
|
var TYPE_11;
|
|
var Lcom_google_gwt_event_dom_client_MouseUpEvent_2_classLit = createForClass('com.google.gwt.event.dom.client', 'MouseUpEvent', 803);
|
|
function $clinit_MouseWheelEvent(){
|
|
$clinit_MouseWheelEvent = emptyMethod;
|
|
TYPE_12 = new DomEvent$Type('mousewheel', new MouseWheelEvent_0);
|
|
new DomEvent$Type('DOMMouseScroll', new MouseWheelEvent_0);
|
|
}
|
|
|
|
function MouseWheelEvent_0(){
|
|
}
|
|
|
|
defineClass(351, 986, {}, MouseWheelEvent_0);
|
|
_.dispatch = function dispatch_12(handler){
|
|
handler.onMouseWheel(this);
|
|
}
|
|
;
|
|
_.getAssociatedType_0 = function getAssociatedType_13(){
|
|
return TYPE_12;
|
|
}
|
|
;
|
|
var TYPE_12;
|
|
var Lcom_google_gwt_event_dom_client_MouseWheelEvent_2_classLit = createForClass('com.google.gwt.event.dom.client', 'MouseWheelEvent', 351);
|
|
function $unsafeGet(this$static, key){
|
|
return this$static.map_0[key];
|
|
}
|
|
|
|
function $unsafePut(this$static, key, value_0){
|
|
this$static.map_0[key] = value_0;
|
|
}
|
|
|
|
function PrivateMap(){
|
|
this.map_0 = {};
|
|
}
|
|
|
|
defineClass(812, 1, {}, PrivateMap);
|
|
var Lcom_google_gwt_event_dom_client_PrivateMap_2_classLit = createForClass('com.google.gwt.event.dom.client', 'PrivateMap', 812);
|
|
defineClass(987, 985, {});
|
|
var impl;
|
|
var Lcom_google_gwt_event_dom_client_TouchEvent_2_classLit = createForClass('com.google.gwt.event.dom.client', 'TouchEvent', 987);
|
|
function $clinit_TouchCancelEvent(){
|
|
$clinit_TouchCancelEvent = emptyMethod;
|
|
TYPE_13 = new DomEvent$Type('touchcancel', new TouchCancelEvent);
|
|
}
|
|
|
|
function TouchCancelEvent(){
|
|
}
|
|
|
|
defineClass(810, 987, {}, TouchCancelEvent);
|
|
_.dispatch = function dispatch_13(handler){
|
|
handler.onTouchCancel(this);
|
|
}
|
|
;
|
|
_.getAssociatedType_0 = function getAssociatedType_14(){
|
|
return TYPE_13;
|
|
}
|
|
;
|
|
var TYPE_13;
|
|
var Lcom_google_gwt_event_dom_client_TouchCancelEvent_2_classLit = createForClass('com.google.gwt.event.dom.client', 'TouchCancelEvent', 810);
|
|
function $clinit_TouchEndEvent(){
|
|
$clinit_TouchEndEvent = emptyMethod;
|
|
TYPE_14 = new DomEvent$Type('touchend', new TouchEndEvent);
|
|
}
|
|
|
|
function TouchEndEvent(){
|
|
}
|
|
|
|
defineClass(809, 987, {}, TouchEndEvent);
|
|
_.dispatch = function dispatch_14(handler){
|
|
handler.onTouchEnd(this);
|
|
}
|
|
;
|
|
_.getAssociatedType_0 = function getAssociatedType_15(){
|
|
return TYPE_14;
|
|
}
|
|
;
|
|
var TYPE_14;
|
|
var Lcom_google_gwt_event_dom_client_TouchEndEvent_2_classLit = createForClass('com.google.gwt.event.dom.client', 'TouchEndEvent', 809);
|
|
defineClass(806, 1, {});
|
|
var Lcom_google_gwt_event_dom_client_TouchEvent$TouchSupportDetector_2_classLit = createForClass('com.google.gwt.event.dom.client', 'TouchEvent/TouchSupportDetector', 806);
|
|
function TouchEvent$TouchSupportDetectorNo(){
|
|
}
|
|
|
|
defineClass(807, 806, {}, TouchEvent$TouchSupportDetectorNo);
|
|
var Lcom_google_gwt_event_dom_client_TouchEvent$TouchSupportDetectorNo_2_classLit = createForClass('com.google.gwt.event.dom.client', 'TouchEvent/TouchSupportDetectorNo', 807);
|
|
function $clinit_TouchMoveEvent(){
|
|
$clinit_TouchMoveEvent = emptyMethod;
|
|
TYPE_15 = new DomEvent$Type('touchmove', new TouchMoveEvent);
|
|
}
|
|
|
|
function TouchMoveEvent(){
|
|
}
|
|
|
|
defineClass(808, 987, {}, TouchMoveEvent);
|
|
_.dispatch = function dispatch_15(handler){
|
|
handler.onTouchMove(this);
|
|
}
|
|
;
|
|
_.getAssociatedType_0 = function getAssociatedType_16(){
|
|
return TYPE_15;
|
|
}
|
|
;
|
|
var TYPE_15;
|
|
var Lcom_google_gwt_event_dom_client_TouchMoveEvent_2_classLit = createForClass('com.google.gwt.event.dom.client', 'TouchMoveEvent', 808);
|
|
function $clinit_TouchStartEvent(){
|
|
$clinit_TouchStartEvent = emptyMethod;
|
|
TYPE_16 = new DomEvent$Type('touchstart', new TouchStartEvent);
|
|
}
|
|
|
|
function TouchStartEvent(){
|
|
}
|
|
|
|
defineClass(805, 987, {}, TouchStartEvent);
|
|
_.dispatch = function dispatch_16(handler){
|
|
handler.onTouchStart(this);
|
|
}
|
|
;
|
|
_.getAssociatedType_0 = function getAssociatedType_17(){
|
|
return TYPE_16;
|
|
}
|
|
;
|
|
var TYPE_16;
|
|
var Lcom_google_gwt_event_dom_client_TouchStartEvent_2_classLit = createForClass('com.google.gwt.event.dom.client', 'TouchStartEvent', 805);
|
|
function AttachEvent(attached){
|
|
this.attached = attached;
|
|
}
|
|
|
|
function fire_0(source, attached){
|
|
var event_0;
|
|
if (TYPE_17) {
|
|
event_0 = new AttachEvent(attached);
|
|
!!source.handlerManager && $fireEvent_0(source.handlerManager, event_0);
|
|
}
|
|
}
|
|
|
|
defineClass(895, 978, {}, AttachEvent);
|
|
_.dispatch = function dispatch_17(handler){
|
|
this.attached?$setupBustClickHandler(handler.this$01):$removeBustClickHandler(handler.this$01);
|
|
}
|
|
;
|
|
_.getAssociatedType = function getAssociatedType_18(){
|
|
return TYPE_17;
|
|
}
|
|
;
|
|
_.attached = false;
|
|
var TYPE_17;
|
|
var Lcom_google_gwt_event_logical_shared_AttachEvent_2_classLit = createForClass('com.google.gwt.event.logical.shared', 'AttachEvent', 895);
|
|
function CloseEvent_0(autoClosed){
|
|
this.autoClosed = autoClosed;
|
|
}
|
|
|
|
function fire_1(source, autoClosed){
|
|
var event_0;
|
|
if (TYPE_18) {
|
|
event_0 = new CloseEvent_0(autoClosed);
|
|
source.fireEvent(event_0);
|
|
}
|
|
}
|
|
|
|
defineClass(816, 978, {}, CloseEvent_0);
|
|
_.dispatch = function dispatch_18(handler){
|
|
handler.onClose(this);
|
|
}
|
|
;
|
|
_.getAssociatedType = function getAssociatedType_19(){
|
|
return TYPE_18;
|
|
}
|
|
;
|
|
_.autoClosed = false;
|
|
var TYPE_18;
|
|
var Lcom_google_gwt_event_logical_shared_CloseEvent_2_classLit = createForClass('com.google.gwt.event.logical.shared', 'CloseEvent', 816);
|
|
function ResizeEvent(width_0){
|
|
this.width_0 = width_0;
|
|
}
|
|
|
|
function fire_2(source, width_0){
|
|
var event_0;
|
|
if (TYPE_19) {
|
|
event_0 = new ResizeEvent(width_0);
|
|
$fireEvent_0(source, event_0);
|
|
}
|
|
}
|
|
|
|
defineClass(566, 978, {}, ResizeEvent);
|
|
_.dispatch = function dispatch_19(handler){
|
|
handler.onResize(this);
|
|
}
|
|
;
|
|
_.getAssociatedType = function getAssociatedType_20(){
|
|
return TYPE_19;
|
|
}
|
|
;
|
|
_.width_0 = 0;
|
|
var TYPE_19;
|
|
var Lcom_google_gwt_event_logical_shared_ResizeEvent_2_classLit = createForClass('com.google.gwt.event.logical.shared', 'ResizeEvent', 566);
|
|
function ValueChangeEvent(value_0){
|
|
this.value_0 = value_0;
|
|
}
|
|
|
|
function fire_3(source, value_0){
|
|
var event_0;
|
|
if (TYPE_20) {
|
|
event_0 = new ValueChangeEvent(value_0);
|
|
source.fireEvent(event_0);
|
|
}
|
|
}
|
|
|
|
function fireIfNotEqual(source, oldValue, newValue){
|
|
var event_0;
|
|
if (!!TYPE_20 && oldValue != newValue && (oldValue == null || (checkCriticalNotNull(oldValue) , oldValue != newValue))) {
|
|
event_0 = new ValueChangeEvent(newValue);
|
|
!!source.handlerManager && $fireEvent_0(source.handlerManager, event_0);
|
|
}
|
|
}
|
|
|
|
defineClass(360, 978, {}, ValueChangeEvent);
|
|
_.dispatch = function dispatch_20(handler){
|
|
handler.onValueChange(this);
|
|
}
|
|
;
|
|
_.getAssociatedType = function getAssociatedType_21(){
|
|
return TYPE_20;
|
|
}
|
|
;
|
|
var TYPE_20;
|
|
var Lcom_google_gwt_event_logical_shared_ValueChangeEvent_2_classLit = createForClass('com.google.gwt.event.logical.shared', 'ValueChangeEvent', 360);
|
|
function $addHandler_0(this$static, type_0, handler){
|
|
return new LegacyHandlerWrapper($doAdd(this$static.eventBus, type_0, handler));
|
|
}
|
|
|
|
function $fireEvent_0(this$static, event_0){
|
|
var e, oldSource;
|
|
!event_0.dead || event_0.revive();
|
|
oldSource = event_0.source;
|
|
$overrideSource(event_0, this$static.source);
|
|
try {
|
|
$doFire(this$static.eventBus, event_0);
|
|
}
|
|
catch ($e0) {
|
|
$e0 = toJava($e0);
|
|
if (instanceOf($e0, 217)) {
|
|
e = $e0;
|
|
throw toJs(new UmbrellaException_0(e.causes));
|
|
}
|
|
else
|
|
throw toJs($e0);
|
|
}
|
|
finally {
|
|
oldSource == null?(event_0.dead = true , event_0.source = null):(event_0.source = oldSource);
|
|
}
|
|
}
|
|
|
|
function $isEventHandled(this$static, e){
|
|
return $isEventHandled_0(this$static.eventBus, e);
|
|
}
|
|
|
|
function HandlerManager(source){
|
|
HandlerManager_0.call(this, source, false);
|
|
}
|
|
|
|
function HandlerManager_0(source, fireInReverseOrder){
|
|
this.eventBus = new HandlerManager$Bus(fireInReverseOrder);
|
|
this.source = source;
|
|
}
|
|
|
|
defineClass(214, 1, {25:1}, HandlerManager, HandlerManager_0);
|
|
_.fireEvent = function fireEvent_0(event_0){
|
|
$fireEvent_0(this, event_0);
|
|
}
|
|
;
|
|
var Lcom_google_gwt_event_shared_HandlerManager_2_classLit = createForClass('com.google.gwt.event.shared', 'HandlerManager', 214);
|
|
defineClass(979, 1, {});
|
|
var Lcom_google_web_bindery_event_shared_EventBus_2_classLit = createForClass('com.google.web.bindery.event.shared', 'EventBus', 979);
|
|
function $defer(this$static, command){
|
|
!this$static.deferredDeltas && (this$static.deferredDeltas = new ArrayList);
|
|
$add_8(this$static.deferredDeltas, command);
|
|
}
|
|
|
|
function $doAdd(this$static, type_0, handler){
|
|
var l_0;
|
|
if (!type_0) {
|
|
throw toJs(new NullPointerException_0('Cannot add a handler with a null type'));
|
|
}
|
|
if (!handler) {
|
|
throw toJs(new NullPointerException_0('Cannot add a null handler'));
|
|
}
|
|
this$static.firingDepth > 0?$defer(this$static, new SimpleEventBus$2(this$static, type_0, handler)):(l_0 = $ensureHandlerList(this$static, type_0, null) , l_0.add_1(handler));
|
|
return new SimpleEventBus$1(this$static, type_0, handler);
|
|
}
|
|
|
|
function $doAddNow(this$static, type_0, source, handler){
|
|
var l_0;
|
|
l_0 = $ensureHandlerList(this$static, type_0, source);
|
|
l_0.add_1(handler);
|
|
}
|
|
|
|
function $doFire(this$static, event_0){
|
|
var causes, directHandlers, e, handler, handlers, it;
|
|
if (!event_0) {
|
|
throw toJs(new NullPointerException_0('Cannot fire null event'));
|
|
}
|
|
try {
|
|
++this$static.firingDepth;
|
|
handlers = (directHandlers = $getHandlerList(this$static, event_0.getAssociatedType(), null) , directHandlers);
|
|
causes = null;
|
|
it = this$static.isReverseOrder?handlers.listIterator_0(handlers.size_1()):handlers.listIterator();
|
|
while (this$static.isReverseOrder?it.hasPrevious():it.hasNext_0()) {
|
|
handler = this$static.isReverseOrder?it.previous():it.next_1();
|
|
try {
|
|
event_0.dispatch(handler);
|
|
}
|
|
catch ($e0) {
|
|
$e0 = toJava($e0);
|
|
if (instanceOf($e0, 42)) {
|
|
e = $e0;
|
|
!causes && (causes = new HashSet);
|
|
$put_0(causes.map_0, e, causes);
|
|
}
|
|
else
|
|
throw toJs($e0);
|
|
}
|
|
}
|
|
if (causes) {
|
|
throw toJs(new UmbrellaException(causes));
|
|
}
|
|
}
|
|
finally {
|
|
--this$static.firingDepth;
|
|
this$static.firingDepth == 0 && $handleQueuedAddsAndRemoves(this$static);
|
|
}
|
|
}
|
|
|
|
function $doRemoveNow(this$static, type_0, source, handler){
|
|
var l_0, removed, sourceMap;
|
|
l_0 = $getHandlerList(this$static, type_0, source);
|
|
removed = l_0.remove_2(handler);
|
|
removed && l_0.isEmpty() && (sourceMap = $get_1(this$static.map_0, type_0) , $remove_16(sourceMap.hashCodeMap, source) , sourceMap.hashCodeMap.size_0 + sourceMap.stringMap.size_0 == 0 && $remove_7(this$static.map_0, type_0) , undefined);
|
|
}
|
|
|
|
function $ensureHandlerList(this$static, type_0, source){
|
|
var handlers, sourceMap;
|
|
sourceMap = $get_1(this$static.map_0, type_0);
|
|
if (!sourceMap) {
|
|
sourceMap = new HashMap;
|
|
$put_0(this$static.map_0, type_0, sourceMap);
|
|
}
|
|
handlers = getEntryValueOrNull($getEntry(sourceMap.hashCodeMap, source));
|
|
if (!handlers) {
|
|
handlers = new ArrayList;
|
|
$put_1(sourceMap.hashCodeMap, source, handlers);
|
|
}
|
|
return handlers;
|
|
}
|
|
|
|
function $getHandlerList(this$static, type_0, source){
|
|
var handlers, sourceMap;
|
|
sourceMap = $get_1(this$static.map_0, type_0);
|
|
if (!sourceMap) {
|
|
return $clinit_Collections() , $clinit_Collections() , EMPTY_LIST;
|
|
}
|
|
handlers = getEntryValueOrNull($getEntry(sourceMap.hashCodeMap, source));
|
|
if (!handlers) {
|
|
return $clinit_Collections() , $clinit_Collections() , EMPTY_LIST;
|
|
}
|
|
return handlers;
|
|
}
|
|
|
|
function $handleQueuedAddsAndRemoves(this$static){
|
|
var c, c$iterator;
|
|
if (this$static.deferredDeltas) {
|
|
try {
|
|
for (c$iterator = new ArrayList$1(this$static.deferredDeltas); c$iterator.i < c$iterator.this$01.array.length;) {
|
|
c = $next_4(c$iterator);
|
|
c.execute_1();
|
|
}
|
|
}
|
|
finally {
|
|
this$static.deferredDeltas = null;
|
|
}
|
|
}
|
|
}
|
|
|
|
function $isEventHandled_0(this$static, eventKey){
|
|
return $containsKey(this$static.map_0, eventKey);
|
|
}
|
|
|
|
defineClass(486, 979, {});
|
|
_.firingDepth = 0;
|
|
_.isReverseOrder = false;
|
|
var Lcom_google_web_bindery_event_shared_SimpleEventBus_2_classLit = createForClass('com.google.web.bindery.event.shared', 'SimpleEventBus', 486);
|
|
function $doRemove(this$static, type_0, source, handler){
|
|
this$static.firingDepth > 0?$defer(this$static, new SimpleEventBus$3(this$static, type_0, source, handler)):$doRemoveNow(this$static, type_0, source, handler);
|
|
}
|
|
|
|
function HandlerManager$Bus(fireInReverseOrder){
|
|
this.map_0 = new HashMap;
|
|
this.isReverseOrder = fireInReverseOrder;
|
|
}
|
|
|
|
defineClass(487, 486, {}, HandlerManager$Bus);
|
|
var Lcom_google_gwt_event_shared_HandlerManager$Bus_2_classLit = createForClass('com.google.gwt.event.shared', 'HandlerManager/Bus', 487);
|
|
function LegacyHandlerWrapper(real){
|
|
this.real = real;
|
|
}
|
|
|
|
defineClass(793, 1, {1006:1}, LegacyHandlerWrapper);
|
|
var Lcom_google_gwt_event_shared_LegacyHandlerWrapper_2_classLit = createForClass('com.google.gwt.event.shared', 'LegacyHandlerWrapper', 793);
|
|
function UmbrellaException(causes){
|
|
var cause, cause$iterator, i;
|
|
RuntimeException_1.call(this, makeMessage(causes), causes.isEmpty()?null:causes.iterator().next_1());
|
|
this.causes = causes;
|
|
i = 0;
|
|
for (cause$iterator = causes.iterator(); cause$iterator.hasNext_0();) {
|
|
cause = cause$iterator.next_1();
|
|
if (i++ == 0) {
|
|
continue;
|
|
}
|
|
$addSuppressed(this, cause);
|
|
}
|
|
}
|
|
|
|
function makeMessage(causes){
|
|
var b, count, first, t, t$iterator;
|
|
count = causes.size_1();
|
|
if (count == 0) {
|
|
return null;
|
|
}
|
|
b = new StringBuilder_1(count == 1?'Exception caught: ':count + ' exceptions caught: ');
|
|
first = true;
|
|
for (t$iterator = causes.iterator(); t$iterator.hasNext_0();) {
|
|
t = t$iterator.next_1();
|
|
first?(first = false):(b.string += '; ' , b);
|
|
$append_4(b, t.getMessage());
|
|
}
|
|
return b.string;
|
|
}
|
|
|
|
defineClass(217, 83, $intern_19, UmbrellaException);
|
|
var Lcom_google_web_bindery_event_shared_UmbrellaException_2_classLit = createForClass('com.google.web.bindery.event.shared', 'UmbrellaException', 217);
|
|
function UmbrellaException_0(causes){
|
|
UmbrellaException.call(this, causes);
|
|
}
|
|
|
|
defineClass(333, 217, $intern_19, UmbrellaException_0);
|
|
var Lcom_google_gwt_event_shared_UmbrellaException_2_classLit = createForClass('com.google.gwt.event.shared', 'UmbrellaException', 333);
|
|
function $cancel_1(this$static){
|
|
var xhr;
|
|
if (!this$static.xmlHttpRequest) {
|
|
return;
|
|
}
|
|
$cancel_0(this$static.timer);
|
|
xhr = this$static.xmlHttpRequest;
|
|
this$static.xmlHttpRequest = null;
|
|
$clearOnReadyStateChange(xhr);
|
|
xhr.abort();
|
|
}
|
|
|
|
function $fireOnResponseReceived(this$static, callback){
|
|
var response, xhr;
|
|
if (!this$static.xmlHttpRequest) {
|
|
return;
|
|
}
|
|
$cancel_0(this$static.timer);
|
|
xhr = this$static.xmlHttpRequest;
|
|
this$static.xmlHttpRequest = null;
|
|
response = new ResponseImpl(xhr);
|
|
callback.onResponseReceived(this$static, response);
|
|
}
|
|
|
|
function $fireOnTimeout(this$static){
|
|
if (!this$static.xmlHttpRequest) {
|
|
return;
|
|
}
|
|
$cancel_1(this$static);
|
|
this$static.callback.onError(this$static, new RequestTimeoutException(this$static.timeoutMillis));
|
|
}
|
|
|
|
function Request_0(xmlHttpRequest, timeoutMillis, callback){
|
|
this.timer = new Request$1(this);
|
|
if (!xmlHttpRequest) {
|
|
throw toJs(new NullPointerException);
|
|
}
|
|
if (timeoutMillis < 0) {
|
|
throw toJs(new IllegalArgumentException);
|
|
}
|
|
this.callback = callback;
|
|
this.timeoutMillis = timeoutMillis;
|
|
this.xmlHttpRequest = xmlHttpRequest;
|
|
timeoutMillis > 0 && $schedule(this.timer, timeoutMillis);
|
|
}
|
|
|
|
defineClass(476, 1, {}, Request_0);
|
|
_.timeoutMillis = 0;
|
|
var Lcom_google_gwt_http_client_Request_2_classLit = createForClass('com.google.gwt.http.client', 'Request', 476);
|
|
function Request$1(this$0){
|
|
this.this$01 = this$0;
|
|
Timer.call(this);
|
|
}
|
|
|
|
defineClass(478, 213, {}, Request$1);
|
|
_.run = function run_1(){
|
|
$fireOnTimeout(this.this$01);
|
|
}
|
|
;
|
|
var Lcom_google_gwt_http_client_Request$1_2_classLit = createForClass('com.google.gwt.http.client', 'Request/1', 478);
|
|
function $clinit_RequestBuilder(){
|
|
$clinit_RequestBuilder = emptyMethod;
|
|
new RequestBuilder$Method('DELETE');
|
|
GET = new RequestBuilder$Method('GET');
|
|
new RequestBuilder$Method('HEAD');
|
|
new RequestBuilder$Method('POST');
|
|
new RequestBuilder$Method('PUT');
|
|
}
|
|
|
|
function $doSend(this$static, callback){
|
|
var e, request, requestPermissionException, xmlHttpRequest;
|
|
xmlHttpRequest = new $wnd.XMLHttpRequest;
|
|
try {
|
|
$open(xmlHttpRequest, this$static.httpMethod, this$static.url_0);
|
|
}
|
|
catch ($e0) {
|
|
$e0 = toJava($e0);
|
|
if (instanceOf($e0, 135)) {
|
|
e = $e0;
|
|
requestPermissionException = new RequestPermissionException(this$static.url_0);
|
|
$initCause(requestPermissionException, new RequestException(e.getMessage()));
|
|
throw toJs(requestPermissionException);
|
|
}
|
|
else
|
|
throw toJs($e0);
|
|
}
|
|
xmlHttpRequest.setRequestHeader('Content-Type', 'text/plain; charset=utf-8');
|
|
this$static.includeCredentials && (xmlHttpRequest.withCredentials = true , undefined);
|
|
request = new Request_0(xmlHttpRequest, this$static.timeoutMillis, callback);
|
|
$setOnReadyStateChange(xmlHttpRequest, new RequestBuilder$1(request, callback));
|
|
try {
|
|
xmlHttpRequest.send(null);
|
|
}
|
|
catch ($e1) {
|
|
$e1 = toJava($e1);
|
|
if (instanceOf($e1, 135)) {
|
|
e = $e1;
|
|
throw toJs(new RequestException(e.getMessage()));
|
|
}
|
|
else
|
|
throw toJs($e1);
|
|
}
|
|
return request;
|
|
}
|
|
|
|
function $sendRequest(this$static, callback){
|
|
throwIfNull('callback', callback);
|
|
return $doSend(this$static, callback);
|
|
}
|
|
|
|
function RequestBuilder(httpMethod, url_0){
|
|
$clinit_RequestBuilder();
|
|
RequestBuilder_0.call(this, !httpMethod?null:httpMethod.name_0, url_0);
|
|
}
|
|
|
|
function RequestBuilder_0(httpMethod, url_0){
|
|
throwIfEmptyOrNull('httpMethod', httpMethod);
|
|
throwIfEmptyOrNull('url', url_0);
|
|
this.httpMethod = httpMethod;
|
|
this.url_0 = url_0;
|
|
}
|
|
|
|
defineClass(231, 1, {}, RequestBuilder);
|
|
_.includeCredentials = false;
|
|
_.timeoutMillis = 0;
|
|
var GET;
|
|
var Lcom_google_gwt_http_client_RequestBuilder_2_classLit = createForClass('com.google.gwt.http.client', 'RequestBuilder', 231);
|
|
function RequestBuilder$1(val$request, val$callback){
|
|
this.val$request2 = val$request;
|
|
this.val$callback3 = val$callback;
|
|
}
|
|
|
|
defineClass(475, 1, {}, RequestBuilder$1);
|
|
_.onReadyStateChange = function onReadyStateChange(xhr){
|
|
if (xhr.readyState == 4) {
|
|
$clearOnReadyStateChange(xhr);
|
|
$fireOnResponseReceived(this.val$request2, this.val$callback3);
|
|
}
|
|
}
|
|
;
|
|
var Lcom_google_gwt_http_client_RequestBuilder$1_2_classLit = createForClass('com.google.gwt.http.client', 'RequestBuilder/1', 475);
|
|
function RequestBuilder$Method(name_0){
|
|
this.name_0 = name_0;
|
|
}
|
|
|
|
defineClass(234, 1, {}, RequestBuilder$Method);
|
|
_.toString_0 = function toString_6(){
|
|
return this.name_0;
|
|
}
|
|
;
|
|
var Lcom_google_gwt_http_client_RequestBuilder$Method_2_classLit = createForClass('com.google.gwt.http.client', 'RequestBuilder/Method', 234);
|
|
function RequestException(message){
|
|
Exception.call(this, message);
|
|
}
|
|
|
|
defineClass(156, 13, $intern_20, RequestException);
|
|
var Lcom_google_gwt_http_client_RequestException_2_classLit = createForClass('com.google.gwt.http.client', 'RequestException', 156);
|
|
function RequestPermissionException(url_0){
|
|
RequestException.call(this, 'The URL ' + url_0 + ' is invalid or violates the same-origin security restriction');
|
|
}
|
|
|
|
defineClass(567, 156, $intern_20, RequestPermissionException);
|
|
var Lcom_google_gwt_http_client_RequestPermissionException_2_classLit = createForClass('com.google.gwt.http.client', 'RequestPermissionException', 567);
|
|
function RequestTimeoutException(timeoutMillis){
|
|
RequestException.call(this, 'A request timeout has expired after ' + timeoutMillis + ' ms');
|
|
}
|
|
|
|
defineClass(936, 156, $intern_20, RequestTimeoutException);
|
|
var Lcom_google_gwt_http_client_RequestTimeoutException_2_classLit = createForClass('com.google.gwt.http.client', 'RequestTimeoutException', 936);
|
|
defineClass(976, 1, {});
|
|
var Lcom_google_gwt_http_client_Response_2_classLit = createForClass('com.google.gwt.http.client', 'Response', 976);
|
|
function ResponseImpl(xmlHttpRequest){
|
|
this.xmlHttpRequest = xmlHttpRequest;
|
|
}
|
|
|
|
defineClass(477, 976, {}, ResponseImpl);
|
|
var Lcom_google_gwt_http_client_ResponseImpl_2_classLit = createForClass('com.google.gwt.http.client', 'ResponseImpl', 477);
|
|
function throwIfEmptyOrNull(name_0, value_0){
|
|
throwIfNull(name_0, value_0);
|
|
if (0 == $trim(value_0).length) {
|
|
throw toJs(new IllegalArgumentException_0(name_0 + ' cannot be empty'));
|
|
}
|
|
}
|
|
|
|
function throwIfNull(name_0, value_0){
|
|
if (null == value_0) {
|
|
throw toJs(new NullPointerException_0(name_0 + ' cannot be null'));
|
|
}
|
|
}
|
|
|
|
function decodeQueryStringImpl(encodedURLComponent){
|
|
var regexp = /\+/g;
|
|
return decodeURIComponent(encodedURLComponent.replace(regexp, '%20'));
|
|
}
|
|
|
|
function getDirectionOnElement(elem){
|
|
var dirPropertyValue;
|
|
dirPropertyValue = $getPropertyString(elem, 'dir');
|
|
if ($equalsIgnoreCase('rtl', dirPropertyValue)) {
|
|
return $clinit_HasDirection$Direction() , RTL;
|
|
}
|
|
else if ($equalsIgnoreCase('ltr', dirPropertyValue)) {
|
|
return $clinit_HasDirection$Direction() , LTR;
|
|
}
|
|
return $clinit_HasDirection$Direction() , DEFAULT_0;
|
|
}
|
|
|
|
function setDirectionOnElement(elem, direction){
|
|
switch (direction.ordinal) {
|
|
case 0:
|
|
{
|
|
elem['dir'] = 'rtl';
|
|
break;
|
|
}
|
|
|
|
case 1:
|
|
{
|
|
elem['dir'] = 'ltr';
|
|
break;
|
|
}
|
|
|
|
case 2:
|
|
{
|
|
getDirectionOnElement(elem) != ($clinit_HasDirection$Direction() , DEFAULT_0) && (elem['dir'] = '' , undefined);
|
|
break;
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
function $getDefaultNative(){
|
|
return ['USD', 'US$', 2, 'US$', '$'];
|
|
}
|
|
|
|
function $clinit_DateTimeFormat(){
|
|
$clinit_DateTimeFormat = emptyMethod;
|
|
new HashMap;
|
|
}
|
|
|
|
function $addPart(this$static, buf, count){
|
|
var oldLength;
|
|
if (buf.string.length > 0) {
|
|
$add_8(this$static.patternParts, new DateTimeFormat$PatternPart(buf.string, count));
|
|
oldLength = buf.string.length;
|
|
0 < oldLength?(buf.string = buf.string.substr(0, 0)):0 > oldLength && (buf.string += valueOf_2(initUnidimensionalArray(C_classLit, $intern_21, 7, -oldLength, 15, 1)));
|
|
}
|
|
}
|
|
|
|
function $format(this$static, date, timeZone){
|
|
var ch_0, diff, i, j, keepDate, keepTime, n, toAppendTo, trailQuote;
|
|
!timeZone && (timeZone = createTimeZone(date.jsdate.getTimezoneOffset()));
|
|
diff = (date.jsdate.getTimezoneOffset() - timeZone.standardOffset) * 60000;
|
|
keepDate = new Date_1(add_2(fromDouble_0(date.jsdate.getTime()), diff));
|
|
keepTime = keepDate;
|
|
if (keepDate.jsdate.getTimezoneOffset() != date.jsdate.getTimezoneOffset()) {
|
|
diff > 0?(diff -= 86400000):(diff += 86400000);
|
|
keepTime = new Date_1(add_2(fromDouble_0(date.jsdate.getTime()), diff));
|
|
}
|
|
toAppendTo = new StringBuilder_0;
|
|
n = this$static.pattern.length;
|
|
for (i = 0; i < n;) {
|
|
ch_0 = $charAt_0(this$static.pattern, i);
|
|
if (ch_0 >= 97 && ch_0 <= 122 || ch_0 >= 65 && ch_0 <= 90) {
|
|
for (j = i + 1; j < n && $charAt_0(this$static.pattern, j) == ch_0; ++j)
|
|
;
|
|
$subFormat(toAppendTo, ch_0, j - i, keepDate, keepTime, timeZone);
|
|
i = j;
|
|
}
|
|
else if (ch_0 == 39) {
|
|
++i;
|
|
if (i < n && $charAt_0(this$static.pattern, i) == 39) {
|
|
toAppendTo.string += "'";
|
|
++i;
|
|
continue;
|
|
}
|
|
trailQuote = false;
|
|
while (!trailQuote) {
|
|
j = i;
|
|
while (j < n && $charAt_0(this$static.pattern, j) != 39) {
|
|
++j;
|
|
}
|
|
if (j >= n) {
|
|
throw toJs(new IllegalArgumentException_0("Missing trailing '"));
|
|
}
|
|
j + 1 < n && $charAt_0(this$static.pattern, j + 1) == 39?++j:(trailQuote = true);
|
|
$append_4(toAppendTo, $substring_0(this$static.pattern, i, j));
|
|
i = j + 1;
|
|
}
|
|
}
|
|
else {
|
|
toAppendTo.string += String.fromCharCode(ch_0);
|
|
++i;
|
|
}
|
|
}
|
|
return toAppendTo.string;
|
|
}
|
|
|
|
function $formatFractionalSeconds(buf, count, date){
|
|
var time, value_0;
|
|
time = fromDouble_0(date.jsdate.getTime());
|
|
if (compare_0(time, 0) < 0) {
|
|
value_0 = $intern_22 - toInt_0(mod(neg_1(time), $intern_22));
|
|
value_0 == $intern_22 && (value_0 = 0);
|
|
}
|
|
else {
|
|
value_0 = toInt_0(mod(time, $intern_22));
|
|
}
|
|
if (count == 1) {
|
|
value_0 = $wnd.Math.min((value_0 + 50) / 100 | 0, 9);
|
|
$append_0(buf, 48 + value_0 & $intern_8);
|
|
}
|
|
else if (count == 2) {
|
|
value_0 = $wnd.Math.min((value_0 + 5) / 10 | 0, 99);
|
|
$zeroPaddingNumber(buf, value_0, 2);
|
|
}
|
|
else {
|
|
$zeroPaddingNumber(buf, value_0, 3);
|
|
count > 3 && $zeroPaddingNumber(buf, 0, count - 3);
|
|
}
|
|
}
|
|
|
|
function $formatMonth(buf, count, date){
|
|
var value_0;
|
|
value_0 = date.jsdate.getMonth();
|
|
switch (count) {
|
|
case 5:
|
|
$append_4(buf, stampJavaTypeInfo(getClassLiteralForArray(Ljava_lang_String_2_classLit, 1), $intern_23, 2, 6, ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D'])[value_0]);
|
|
break;
|
|
case 4:
|
|
$append_4(buf, stampJavaTypeInfo(getClassLiteralForArray(Ljava_lang_String_2_classLit, 1), $intern_23, 2, 6, ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'])[value_0]);
|
|
break;
|
|
case 3:
|
|
$append_4(buf, stampJavaTypeInfo(getClassLiteralForArray(Ljava_lang_String_2_classLit, 1), $intern_23, 2, 6, ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'])[value_0]);
|
|
break;
|
|
default:$zeroPaddingNumber(buf, value_0 + 1, count);
|
|
}
|
|
}
|
|
|
|
function $formatYear(buf, count, date){
|
|
var value_0;
|
|
value_0 = date.jsdate.getFullYear() - 1900 + 1900;
|
|
value_0 < 0 && (value_0 = -value_0);
|
|
switch (count) {
|
|
case 1:
|
|
buf.string += value_0;
|
|
break;
|
|
case 2:
|
|
$zeroPaddingNumber(buf, value_0 % 100, 2);
|
|
break;
|
|
default:$zeroPaddingNumber(buf, value_0, count);
|
|
}
|
|
}
|
|
|
|
function $getNextCharCountInPattern(pattern, start_0){
|
|
var ch_0, next;
|
|
ch_0 = (checkCriticalStringElementIndex(start_0, pattern.length) , pattern.charCodeAt(start_0));
|
|
next = start_0 + 1;
|
|
while (next < pattern.length && (checkCriticalStringElementIndex(next, pattern.length) , pattern.charCodeAt(next) == ch_0)) {
|
|
++next;
|
|
}
|
|
return next - start_0;
|
|
}
|
|
|
|
function $identifyAbutStart(this$static){
|
|
var abut, i, len;
|
|
abut = false;
|
|
len = this$static.patternParts.array.length;
|
|
for (i = 0; i < len; i++) {
|
|
if ($isNumeric($get_2(this$static.patternParts, i))) {
|
|
if (!abut && i + 1 < len && $isNumeric($get_2(this$static.patternParts, i + 1))) {
|
|
abut = true;
|
|
$get_2(this$static.patternParts, i).abutStart = true;
|
|
}
|
|
}
|
|
else {
|
|
abut = false;
|
|
}
|
|
}
|
|
}
|
|
|
|
function $isNumeric(part){
|
|
var i;
|
|
if (part.count <= 0) {
|
|
return false;
|
|
}
|
|
i = $indexOf_1('MLydhHmsSDkK', fromCodePoint($charAt_0(part.text_0, 0)));
|
|
return i > 1 || i >= 0 && part.count < 3;
|
|
}
|
|
|
|
function $parsePattern(this$static, pattern){
|
|
var buf, ch_0, count, i, inQuote;
|
|
buf = new StringBuilder_0;
|
|
inQuote = false;
|
|
for (i = 0; i < pattern.length; i++) {
|
|
ch_0 = (checkCriticalStringElementIndex(i, pattern.length) , pattern.charCodeAt(i));
|
|
if (ch_0 == 32) {
|
|
$addPart(this$static, buf, 0);
|
|
buf.string += ' ';
|
|
$addPart(this$static, buf, 0);
|
|
while (i + 1 < pattern.length && (checkCriticalStringElementIndex(i + 1, pattern.length) , pattern.charCodeAt(i + 1) == 32)) {
|
|
++i;
|
|
}
|
|
continue;
|
|
}
|
|
if (inQuote) {
|
|
if (ch_0 == 39) {
|
|
if (i + 1 < pattern.length && (checkCriticalStringElementIndex(i + 1, pattern.length) , pattern.charCodeAt(i + 1) == 39)) {
|
|
buf.string += "'";
|
|
++i;
|
|
}
|
|
else {
|
|
inQuote = false;
|
|
}
|
|
}
|
|
else {
|
|
buf.string += String.fromCharCode(ch_0);
|
|
}
|
|
continue;
|
|
}
|
|
if ($indexOf_1('GyMLdkHmsSEcDahKzZv', fromCodePoint(ch_0)) > 0) {
|
|
$addPart(this$static, buf, 0);
|
|
buf.string += String.fromCharCode(ch_0);
|
|
count = $getNextCharCountInPattern(pattern, i);
|
|
$addPart(this$static, buf, count);
|
|
i += count - 1;
|
|
continue;
|
|
}
|
|
if (ch_0 == 39) {
|
|
if (i + 1 < pattern.length && (checkCriticalStringElementIndex(i + 1, pattern.length) , pattern.charCodeAt(i + 1) == 39)) {
|
|
buf.string += "'";
|
|
++i;
|
|
}
|
|
else {
|
|
inQuote = true;
|
|
}
|
|
}
|
|
else {
|
|
buf.string += String.fromCharCode(ch_0);
|
|
}
|
|
}
|
|
$addPart(this$static, buf, 0);
|
|
$identifyAbutStart(this$static);
|
|
}
|
|
|
|
function $subFormat(buf, ch_0, count, adjustedDate, adjustedTime, timezone){
|
|
var value_0, value0, value1, value10, value2, value3, value4, value5, value6, value7, value8, value9;
|
|
switch (ch_0) {
|
|
case 71:
|
|
value0 = adjustedDate.jsdate.getFullYear() - 1900 >= -1900?1:0;
|
|
count >= 4?$append_4(buf, stampJavaTypeInfo(getClassLiteralForArray(Ljava_lang_String_2_classLit, 1), $intern_23, 2, 6, ['Before Christ', 'Anno Domini'])[value0]):$append_4(buf, stampJavaTypeInfo(getClassLiteralForArray(Ljava_lang_String_2_classLit, 1), $intern_23, 2, 6, ['BC', 'AD'])[value0]);
|
|
break;
|
|
case 121:
|
|
$formatYear(buf, count, adjustedDate);
|
|
break;
|
|
case 77:
|
|
$formatMonth(buf, count, adjustedDate);
|
|
break;
|
|
case 107:
|
|
value1 = adjustedTime.jsdate.getHours();
|
|
value1 == 0?$zeroPaddingNumber(buf, 24, count):$zeroPaddingNumber(buf, value1, count);
|
|
break;
|
|
case 83:
|
|
$formatFractionalSeconds(buf, count, adjustedTime);
|
|
break;
|
|
case 69:
|
|
value2 = adjustedDate.jsdate.getDay();
|
|
count == 5?$append_4(buf, stampJavaTypeInfo(getClassLiteralForArray(Ljava_lang_String_2_classLit, 1), $intern_23, 2, 6, ['S', 'M', 'T', 'W', 'T', 'F', 'S'])[value2]):count == 4?$append_4(buf, stampJavaTypeInfo(getClassLiteralForArray(Ljava_lang_String_2_classLit, 1), $intern_23, 2, 6, ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'])[value2]):$append_4(buf, stampJavaTypeInfo(getClassLiteralForArray(Ljava_lang_String_2_classLit, 1), $intern_23, 2, 6, ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'])[value2]);
|
|
break;
|
|
case 97:
|
|
adjustedTime.jsdate.getHours() >= 12 && adjustedTime.jsdate.getHours() < 24?$append_4(buf, stampJavaTypeInfo(getClassLiteralForArray(Ljava_lang_String_2_classLit, 1), $intern_23, 2, 6, ['AM', 'PM'])[1]):$append_4(buf, stampJavaTypeInfo(getClassLiteralForArray(Ljava_lang_String_2_classLit, 1), $intern_23, 2, 6, ['AM', 'PM'])[0]);
|
|
break;
|
|
case 104:
|
|
value3 = adjustedTime.jsdate.getHours() % 12;
|
|
value3 == 0?$zeroPaddingNumber(buf, 12, count):$zeroPaddingNumber(buf, value3, count);
|
|
break;
|
|
case 75:
|
|
value4 = adjustedTime.jsdate.getHours() % 12;
|
|
$zeroPaddingNumber(buf, value4, count);
|
|
break;
|
|
case 72:
|
|
value5 = adjustedTime.jsdate.getHours();
|
|
$zeroPaddingNumber(buf, value5, count);
|
|
break;
|
|
case 99:
|
|
value6 = adjustedDate.jsdate.getDay();
|
|
count == 5?$append_4(buf, stampJavaTypeInfo(getClassLiteralForArray(Ljava_lang_String_2_classLit, 1), $intern_23, 2, 6, ['S', 'M', 'T', 'W', 'T', 'F', 'S'])[value6]):count == 4?$append_4(buf, stampJavaTypeInfo(getClassLiteralForArray(Ljava_lang_String_2_classLit, 1), $intern_23, 2, 6, ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'])[value6]):count == 3?$append_4(buf, stampJavaTypeInfo(getClassLiteralForArray(Ljava_lang_String_2_classLit, 1), $intern_23, 2, 6, ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'])[value6]):$zeroPaddingNumber(buf, value6, 1);
|
|
break;
|
|
case 76:
|
|
value7 = adjustedDate.jsdate.getMonth();
|
|
count == 5?$append_4(buf, stampJavaTypeInfo(getClassLiteralForArray(Ljava_lang_String_2_classLit, 1), $intern_23, 2, 6, ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D'])[value7]):count == 4?$append_4(buf, stampJavaTypeInfo(getClassLiteralForArray(Ljava_lang_String_2_classLit, 1), $intern_23, 2, 6, ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'])[value7]):count == 3?$append_4(buf, stampJavaTypeInfo(getClassLiteralForArray(Ljava_lang_String_2_classLit, 1), $intern_23, 2, 6, ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'])[value7]):$zeroPaddingNumber(buf, value7 + 1, count);
|
|
break;
|
|
case 81:
|
|
value8 = adjustedDate.jsdate.getMonth() / 3 | 0;
|
|
count < 4?$append_4(buf, stampJavaTypeInfo(getClassLiteralForArray(Ljava_lang_String_2_classLit, 1), $intern_23, 2, 6, ['Q1', 'Q2', 'Q3', 'Q4'])[value8]):$append_4(buf, stampJavaTypeInfo(getClassLiteralForArray(Ljava_lang_String_2_classLit, 1), $intern_23, 2, 6, ['1st quarter', '2nd quarter', '3rd quarter', '4th quarter'])[value8]);
|
|
break;
|
|
case 100:
|
|
value9 = adjustedDate.jsdate.getDate();
|
|
$zeroPaddingNumber(buf, value9, count);
|
|
break;
|
|
case 109:
|
|
value10 = adjustedTime.jsdate.getMinutes();
|
|
$zeroPaddingNumber(buf, value10, count);
|
|
break;
|
|
case 115:
|
|
value_0 = adjustedTime.jsdate.getSeconds();
|
|
$zeroPaddingNumber(buf, value_0, count);
|
|
break;
|
|
case 122:
|
|
count < 4?$append_4(buf, timezone.tzNames[0]):$append_4(buf, timezone.tzNames[1]);
|
|
break;
|
|
case 118:
|
|
$append_4(buf, timezone.timezoneID);
|
|
break;
|
|
case 90:
|
|
count < 3?$append_4(buf, $getRFCTimeZoneString(timezone)):count == 3?$append_4(buf, $getISOTimeZoneString(timezone)):$append_4(buf, composeGMTString(timezone.standardOffset));
|
|
break;
|
|
default:return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
function $zeroPaddingNumber(buf, value_0, minWidth){
|
|
var b, i;
|
|
b = 10;
|
|
for (i = 0; i < minWidth - 1; i++) {
|
|
value_0 < b && (buf.string += '0' , buf);
|
|
b *= 10;
|
|
}
|
|
buf.string += value_0;
|
|
}
|
|
|
|
defineClass(815, 1, {});
|
|
var Lcom_google_gwt_i18n_shared_DateTimeFormat_2_classLit = createForClass('com.google.gwt.i18n.shared', 'DateTimeFormat', 815);
|
|
function $clinit_DateTimeFormat_0(){
|
|
$clinit_DateTimeFormat_0 = emptyMethod;
|
|
$clinit_DateTimeFormat();
|
|
cache = new HashMap;
|
|
}
|
|
|
|
function DateTimeFormat(pattern){
|
|
$clinit_DateTimeFormat();
|
|
this.patternParts = new ArrayList;
|
|
this.pattern = pattern;
|
|
$parsePattern(this, pattern);
|
|
}
|
|
|
|
function getFormat(pattern, dtfi){
|
|
$clinit_DateTimeFormat_0();
|
|
var defaultDtfi, dtf;
|
|
defaultDtfi = $getDateTimeFormatInfo(($clinit_LocaleInfo() , $clinit_LocaleInfo() , instance_0));
|
|
dtf = null;
|
|
dtfi == defaultDtfi && (dtf = $getStringValue(cache, pattern));
|
|
if (!dtf) {
|
|
dtf = new DateTimeFormat(pattern);
|
|
dtfi == defaultDtfi && $putStringValue(cache, pattern, dtf);
|
|
}
|
|
return dtf;
|
|
}
|
|
|
|
defineClass(353, 815, {353:1}, DateTimeFormat);
|
|
var cache;
|
|
var Lcom_google_gwt_i18n_client_DateTimeFormat_2_classLit = createForClass('com.google.gwt.i18n.client', 'DateTimeFormat', 353);
|
|
defineClass(994, 1, {});
|
|
var Lcom_google_gwt_i18n_shared_DefaultDateTimeFormatInfo_2_classLit = createForClass('com.google.gwt.i18n.shared', 'DefaultDateTimeFormatInfo', 994);
|
|
defineClass(995, 994, {});
|
|
var Lcom_google_gwt_i18n_client_DefaultDateTimeFormatInfo_2_classLit = createForClass('com.google.gwt.i18n.client', 'DefaultDateTimeFormatInfo', 995);
|
|
function $clinit_HasDirection$Direction(){
|
|
$clinit_HasDirection$Direction = emptyMethod;
|
|
RTL = new HasDirection$Direction('RTL', 0);
|
|
LTR = new HasDirection$Direction('LTR', 1);
|
|
DEFAULT_0 = new HasDirection$Direction('DEFAULT', 2);
|
|
}
|
|
|
|
function HasDirection$Direction(enum$name, enum$ordinal){
|
|
Enum.call(this, enum$name, enum$ordinal);
|
|
}
|
|
|
|
function values_11(){
|
|
$clinit_HasDirection$Direction();
|
|
return stampJavaTypeInfo(getClassLiteralForArray(Lcom_google_gwt_i18n_client_HasDirection$Direction_2_classLit, 1), $intern_3, 237, 0, [RTL, LTR, DEFAULT_0]);
|
|
}
|
|
|
|
defineClass(237, 15, {237:1, 3:1, 16:1, 15:1}, HasDirection$Direction);
|
|
var DEFAULT_0, LTR, RTL;
|
|
var Lcom_google_gwt_i18n_client_HasDirection$Direction_2_classLit = createForEnum('com.google.gwt.i18n.client', 'HasDirection/Direction', 237, values_11);
|
|
function $clinit_LocaleInfo(){
|
|
$clinit_LocaleInfo = emptyMethod;
|
|
instance_0 = new LocaleInfo;
|
|
}
|
|
|
|
function $getDateTimeFormatInfo(this$static){
|
|
!this$static.dateTimeFormatInfo && (this$static.dateTimeFormatInfo = new DateTimeFormatInfoImpl);
|
|
return this$static.dateTimeFormatInfo;
|
|
}
|
|
|
|
function $getNumberConstants(this$static){
|
|
!this$static.numberConstants && (this$static.numberConstants = new NumberConstantsImpl_);
|
|
return this$static.numberConstants;
|
|
}
|
|
|
|
function LocaleInfo(){
|
|
}
|
|
|
|
defineClass(795, 1, {}, LocaleInfo);
|
|
var instance_0;
|
|
var Lcom_google_gwt_i18n_client_LocaleInfo_2_classLit = createForClass('com.google.gwt.i18n.client', 'LocaleInfo', 795);
|
|
function $clinit_NumberFormat(){
|
|
$clinit_NumberFormat = emptyMethod;
|
|
$getNumberConstants(($clinit_LocaleInfo() , $clinit_LocaleInfo() , instance_0));
|
|
}
|
|
|
|
function $addExponent(this$static, digits){
|
|
var exponentDigits, i;
|
|
digits.string += 'E';
|
|
if (this$static.exponent < 0) {
|
|
this$static.exponent = -this$static.exponent;
|
|
digits.string += '-';
|
|
}
|
|
exponentDigits = '' + this$static.exponent;
|
|
for (i = exponentDigits.length; i < this$static.minExponentDigits; ++i) {
|
|
digits.string += '0';
|
|
}
|
|
digits.string += exponentDigits;
|
|
}
|
|
|
|
function $addZeroAndDecimal(this$static, digits, decimalSeparator){
|
|
if (this$static.digitsLength == 0) {
|
|
digits.string = digits.string.substr(0, 0) + '0' + digits.string.substr(0);
|
|
++this$static.decimalPosition;
|
|
++this$static.digitsLength;
|
|
}
|
|
if (this$static.decimalPosition < this$static.digitsLength || this$static.decimalSeparatorAlwaysShown) {
|
|
$insert_4(digits, this$static.decimalPosition, String.fromCharCode(decimalSeparator));
|
|
++this$static.digitsLength;
|
|
}
|
|
}
|
|
|
|
function $adjustFractionDigits(this$static, digits){
|
|
var requiredDigits, toRemove;
|
|
requiredDigits = this$static.decimalPosition + this$static.minimumFractionDigits;
|
|
if (this$static.digitsLength < requiredDigits) {
|
|
while (this$static.digitsLength < requiredDigits) {
|
|
digits.string += '0';
|
|
++this$static.digitsLength;
|
|
}
|
|
}
|
|
else {
|
|
toRemove = this$static.decimalPosition + this$static.maximumFractionDigits;
|
|
toRemove > this$static.digitsLength && (toRemove = this$static.digitsLength);
|
|
while (toRemove > requiredDigits && $charAt_0(digits.string, toRemove - 1) == 48) {
|
|
--toRemove;
|
|
}
|
|
if (toRemove < this$static.digitsLength) {
|
|
$delete(digits, toRemove, this$static.digitsLength);
|
|
this$static.digitsLength = toRemove;
|
|
}
|
|
}
|
|
}
|
|
|
|
function $computeExponent(this$static, digits){
|
|
var remainder, strip;
|
|
strip = 0;
|
|
while (strip < this$static.digitsLength - 1 && $charAt_0(digits.string, strip) == 48) {
|
|
++strip;
|
|
}
|
|
if (strip > 0) {
|
|
digits.string = digits.string.substr(0, 0) + '' + $substring(digits.string, strip);
|
|
this$static.digitsLength -= strip;
|
|
this$static.exponent -= strip;
|
|
}
|
|
if (this$static.maximumIntegerDigits > this$static.minimumIntegerDigits && this$static.maximumIntegerDigits > 0) {
|
|
this$static.exponent += this$static.decimalPosition - 1;
|
|
remainder = this$static.exponent % this$static.maximumIntegerDigits;
|
|
remainder < 0 && (remainder += this$static.maximumIntegerDigits);
|
|
this$static.decimalPosition = remainder + 1;
|
|
this$static.exponent -= remainder;
|
|
}
|
|
else {
|
|
this$static.exponent += this$static.decimalPosition - this$static.minimumIntegerDigits;
|
|
this$static.decimalPosition = this$static.minimumIntegerDigits;
|
|
}
|
|
if (this$static.digitsLength == 1 && $charAt_0(digits.string, 0) == 48) {
|
|
this$static.exponent = 0;
|
|
this$static.decimalPosition = this$static.minimumIntegerDigits;
|
|
}
|
|
}
|
|
|
|
function $format_0(this$static, number){
|
|
var buf, isNegative, preRound, scale;
|
|
if (isNaN(number)) {
|
|
return 'NaN';
|
|
}
|
|
isNegative = number < 0 || number == 0 && 1 / number < 0;
|
|
isNegative && (number = -number);
|
|
buf = new StringBuilder;
|
|
if (!isNaN(number) && !isFinite(number)) {
|
|
$append_4(buf, isNegative?this$static.negativePrefix:this$static.positivePrefix);
|
|
buf.string += '\u221E';
|
|
$append_4(buf, isNegative?this$static.negativeSuffix:this$static.positiveSuffix);
|
|
return buf.string;
|
|
}
|
|
number *= this$static.multiplier;
|
|
scale = toScaledString(buf, number);
|
|
preRound = buf.string.length + scale + this$static.maximumFractionDigits + 3;
|
|
if (preRound > 0 && preRound < buf.string.length && $charAt_0(buf.string, preRound) == 57) {
|
|
$propagateCarry(this$static, buf, preRound - 1);
|
|
scale += buf.string.length - preRound;
|
|
$delete(buf, preRound, buf.string.length);
|
|
}
|
|
$format_1(this$static, isNegative, buf, scale);
|
|
return buf.string;
|
|
}
|
|
|
|
function $format_1(this$static, isNegative, digits, scale){
|
|
var currentGroupingSize, decimalSeparator, groupingSeparator, useExponent, zeroChar;
|
|
if (this$static.isCurrencyFormat) {
|
|
decimalSeparator = (checkCriticalStringElementIndex(0, '.'.length) , '.'.charCodeAt(0));
|
|
groupingSeparator = (checkCriticalStringElementIndex(0, ','.length) , ','.charCodeAt(0));
|
|
}
|
|
else {
|
|
decimalSeparator = (checkCriticalStringElementIndex(0, '.'.length) , '.'.charCodeAt(0));
|
|
groupingSeparator = (checkCriticalStringElementIndex(0, ','.length) , ','.charCodeAt(0));
|
|
}
|
|
this$static.exponent = 0;
|
|
this$static.digitsLength = digits.string.length;
|
|
this$static.decimalPosition = this$static.digitsLength + scale;
|
|
useExponent = this$static.useExponentialNotation;
|
|
currentGroupingSize = this$static.groupingSize;
|
|
this$static.decimalPosition > $intern_24 && (useExponent = true);
|
|
useExponent && $computeExponent(this$static, digits);
|
|
$processLeadingZeros(this$static, digits);
|
|
$roundValue(this$static, digits);
|
|
$insertGroupingSeparators(this$static, digits, groupingSeparator, currentGroupingSize);
|
|
$adjustFractionDigits(this$static, digits);
|
|
$addZeroAndDecimal(this$static, digits, decimalSeparator);
|
|
useExponent && $addExponent(this$static, digits);
|
|
zeroChar = (checkCriticalStringElementIndex(0, '0'.length) , '0'.charCodeAt(0));
|
|
zeroChar != 48 && $localizeDigits(digits, zeroChar);
|
|
$insert_4(digits, 0, isNegative?this$static.negativePrefix:this$static.positivePrefix);
|
|
$append_4(digits, isNegative?this$static.negativeSuffix:this$static.positiveSuffix);
|
|
}
|
|
|
|
function $getDigit(ch_0){
|
|
var zeroChar;
|
|
if (48 <= ch_0 && ch_0 <= 57) {
|
|
return ch_0 - 48;
|
|
}
|
|
else {
|
|
zeroChar = (checkCriticalStringElementIndex(0, '0'.length) , '0'.charCodeAt(0));
|
|
return zeroChar <= ch_0 && ch_0 <= zeroChar + 9?ch_0 - zeroChar:-1;
|
|
}
|
|
}
|
|
|
|
function $insertGroupingSeparators(this$static, digits, groupingSeparator, g){
|
|
var i;
|
|
if (g > 0) {
|
|
for (i = g; i < this$static.decimalPosition; i += g + 1) {
|
|
$insert_4(digits, this$static.decimalPosition - i, String.fromCharCode(groupingSeparator));
|
|
++this$static.decimalPosition;
|
|
++this$static.digitsLength;
|
|
}
|
|
}
|
|
}
|
|
|
|
function $localizeDigits(digits, zero){
|
|
var ch_0, i, n;
|
|
n = digits.string.length;
|
|
for (i = 0; i < n; ++i) {
|
|
ch_0 = $charAt_0(digits.string, i);
|
|
ch_0 >= 48 && ch_0 <= 57 && $setCharAt(digits, i, ch_0 - 48 + zero & $intern_8);
|
|
}
|
|
}
|
|
|
|
function $parse_0(this$static, text_0){
|
|
var pos, result;
|
|
pos = stampJavaTypeInfo(getClassLiteralForArray(I_classLit, 1), $intern_25, 7, 15, [0]);
|
|
result = $parse_1(this$static, text_0, pos);
|
|
if (pos[0] == 0 || pos[0] != text_0.length) {
|
|
throw toJs(new NumberFormatException(text_0));
|
|
}
|
|
return result;
|
|
}
|
|
|
|
function $parse_1(this$static, text_0, inOutPos){
|
|
var gotNegative, gotNegativePrefix, gotNegativeSuffix, gotPositive, gotPositivePrefix, gotPositiveSuffix, ret, tempPos, valueOnly;
|
|
gotPositivePrefix = $startsWith_0(text_0, this$static.positivePrefix, inOutPos[0]);
|
|
gotNegativePrefix = $startsWith_0(text_0, this$static.negativePrefix, inOutPos[0]);
|
|
gotPositiveSuffix = $endsWith(text_0, this$static.positiveSuffix);
|
|
gotNegativeSuffix = $endsWith(text_0, this$static.negativeSuffix);
|
|
gotPositive = gotPositivePrefix && gotPositiveSuffix;
|
|
gotNegative = gotNegativePrefix && gotNegativeSuffix;
|
|
if (gotPositive && gotNegative) {
|
|
this$static.positivePrefix.length > this$static.negativePrefix.length?(gotNegative = false):this$static.positivePrefix.length < this$static.negativePrefix.length?(gotPositive = false):this$static.positiveSuffix.length > this$static.negativeSuffix.length?(gotNegative = false):this$static.positiveSuffix.length < this$static.negativeSuffix.length?(gotPositive = false):(gotNegative = false);
|
|
}
|
|
else if (!gotPositive && !gotNegative) {
|
|
throw toJs(new NumberFormatException(text_0 + ' does not have either positive or negative affixes'));
|
|
}
|
|
if (gotPositive) {
|
|
inOutPos[0] += this$static.positivePrefix.length;
|
|
valueOnly = $substring_0(text_0, inOutPos[0], text_0.length - this$static.positiveSuffix.length);
|
|
}
|
|
else {
|
|
inOutPos[0] += this$static.negativePrefix.length;
|
|
valueOnly = $substring_0(text_0, inOutPos[0], text_0.length - this$static.negativeSuffix.length);
|
|
}
|
|
if ($equals_1(valueOnly, '\u221E')) {
|
|
inOutPos[0] += '\u221E'.length;
|
|
ret = $intern_26;
|
|
}
|
|
else if ($equals_1(valueOnly, 'NaN')) {
|
|
inOutPos[0] += 'NaN'.length;
|
|
ret = NaN;
|
|
}
|
|
else {
|
|
tempPos = stampJavaTypeInfo(getClassLiteralForArray(I_classLit, 1), $intern_25, 7, 15, [0]);
|
|
ret = $parseNumber(this$static, valueOnly, tempPos);
|
|
inOutPos[0] += tempPos[0];
|
|
}
|
|
gotPositive?(inOutPos[0] += this$static.positiveSuffix.length):gotNegative && (inOutPos[0] += this$static.negativeSuffix.length);
|
|
gotNegative && (ret = -ret);
|
|
return ret;
|
|
}
|
|
|
|
function $parseAffix(this$static, pattern, start_0, affix, inNegativePattern){
|
|
var ch_0, inQuote, len, pos;
|
|
$delete(affix, 0, affix.string.length);
|
|
inQuote = false;
|
|
len = pattern.length;
|
|
for (pos = start_0; pos < len; ++pos) {
|
|
ch_0 = (checkCriticalStringElementIndex(pos, pattern.length) , pattern.charCodeAt(pos));
|
|
if (ch_0 == 39) {
|
|
if (pos + 1 < len && (checkCriticalStringElementIndex(pos + 1, pattern.length) , pattern.charCodeAt(pos + 1) == 39)) {
|
|
++pos;
|
|
affix.string += "'";
|
|
}
|
|
else {
|
|
inQuote = !inQuote;
|
|
}
|
|
continue;
|
|
}
|
|
if (inQuote) {
|
|
affix.string += String.fromCharCode(ch_0);
|
|
}
|
|
else {
|
|
switch (ch_0) {
|
|
case 35:
|
|
case 48:
|
|
case 44:
|
|
case 46:
|
|
case 59:
|
|
return pos - start_0;
|
|
case 164:
|
|
this$static.isCurrencyFormat = true;
|
|
if (pos + 1 < len && (checkCriticalStringElementIndex(pos + 1, pattern.length) , pattern.charCodeAt(pos + 1) == 164)) {
|
|
++pos;
|
|
if (pos < len - 2 && (checkCriticalStringElementIndex(pos + 1, pattern.length) , pattern.charCodeAt(pos + 1) == 164) && (checkCriticalStringElementIndex(pos + 2, pattern.length) , pattern.charCodeAt(pos + 2) == 164)) {
|
|
pos += 2;
|
|
$append_4(affix, $getSimpleCurrencySymbol(this$static.currencyData));
|
|
}
|
|
else {
|
|
$append_4(affix, this$static.currencyData[0]);
|
|
}
|
|
}
|
|
else {
|
|
$append_4(affix, this$static.currencyData[1]);
|
|
}
|
|
|
|
break;
|
|
case 37:
|
|
if (!inNegativePattern) {
|
|
if (this$static.multiplier != 1) {
|
|
throw toJs(new IllegalArgumentException_0('Too many percent/per mille characters in pattern "' + pattern + '"'));
|
|
}
|
|
this$static.multiplier = 100;
|
|
}
|
|
|
|
affix.string += '%';
|
|
break;
|
|
case 8240:
|
|
if (!inNegativePattern) {
|
|
if (this$static.multiplier != 1) {
|
|
throw toJs(new IllegalArgumentException_0('Too many percent/per mille characters in pattern "' + pattern + '"'));
|
|
}
|
|
this$static.multiplier = $intern_22;
|
|
}
|
|
|
|
affix.string += '\u2030';
|
|
break;
|
|
case 45:
|
|
affix.string += '-';
|
|
break;
|
|
default:affix.string += String.fromCharCode(ch_0);
|
|
}
|
|
}
|
|
}
|
|
return len - start_0;
|
|
}
|
|
|
|
function $parseNumber(this$static, text_0, pos){
|
|
var ch_0, decimal, digit, grouping, normalizedText, ret, sawDecimal, sawDigit, sawExponent, scale;
|
|
sawDecimal = false;
|
|
sawExponent = false;
|
|
sawDigit = false;
|
|
scale = 1;
|
|
decimal = this$static.isCurrencyFormat?'.':'.';
|
|
grouping = this$static.isCurrencyFormat?',':',';
|
|
normalizedText = new StringBuilder;
|
|
for (; pos[0] < text_0.length; ++pos[0]) {
|
|
ch_0 = $charAt_0(text_0, pos[0]);
|
|
digit = $getDigit(ch_0);
|
|
if (digit >= 0 && digit <= 9) {
|
|
$append_0(normalizedText, digit + 48 & $intern_8);
|
|
sawDigit = true;
|
|
}
|
|
else if (ch_0 == (checkCriticalStringElementIndex(0, decimal.length) , decimal.charCodeAt(0))) {
|
|
if (sawDecimal || sawExponent) {
|
|
break;
|
|
}
|
|
normalizedText.string += '.';
|
|
sawDecimal = true;
|
|
}
|
|
else if (ch_0 == (checkCriticalStringElementIndex(0, grouping.length) , grouping.charCodeAt(0))) {
|
|
if (sawDecimal || sawExponent) {
|
|
break;
|
|
}
|
|
continue;
|
|
}
|
|
else if (ch_0 == (checkCriticalStringElementIndex(0, 'E'.length) , 'E'.charCodeAt(0))) {
|
|
if (sawExponent) {
|
|
break;
|
|
}
|
|
normalizedText.string += 'E';
|
|
sawExponent = true;
|
|
}
|
|
else if (ch_0 == 43 || ch_0 == 45) {
|
|
normalizedText.string += String.fromCharCode(ch_0);
|
|
}
|
|
else if (ch_0 == (checkCriticalStringElementIndex(0, '%'.length) , '%'.charCodeAt(0))) {
|
|
if (scale != 1) {
|
|
break;
|
|
}
|
|
scale = 100;
|
|
if (sawDigit) {
|
|
++pos[0];
|
|
break;
|
|
}
|
|
}
|
|
else if (ch_0 == (checkCriticalStringElementIndex(0, '\u2030'.length) , '\u2030'.charCodeAt(0))) {
|
|
if (scale != 1) {
|
|
break;
|
|
}
|
|
scale = $intern_22;
|
|
if (sawDigit) {
|
|
++pos[0];
|
|
break;
|
|
}
|
|
}
|
|
else {
|
|
break;
|
|
}
|
|
}
|
|
try {
|
|
ret = __parseAndValidateDouble(normalizedText.string);
|
|
}
|
|
catch ($e0) {
|
|
$e0 = toJava($e0);
|
|
if (instanceOf($e0, 147)) {
|
|
throw toJs(new NumberFormatException(text_0));
|
|
}
|
|
else
|
|
throw toJs($e0);
|
|
}
|
|
ret = ret / scale;
|
|
return ret;
|
|
}
|
|
|
|
function $parsePattern_0(this$static, pattern){
|
|
var affix, pos;
|
|
pos = 0;
|
|
affix = new StringBuilder;
|
|
pos += $parseAffix(this$static, pattern, 0, affix, false);
|
|
this$static.positivePrefix = affix.string;
|
|
pos += $parseTrunk(this$static, pattern, pos, false);
|
|
pos += $parseAffix(this$static, pattern, pos, affix, false);
|
|
this$static.positiveSuffix = affix.string;
|
|
if (pos < pattern.length && (checkCriticalStringElementIndex(pos, pattern.length) , pattern.charCodeAt(pos) == 59)) {
|
|
++pos;
|
|
pos += $parseAffix(this$static, pattern, pos, affix, true);
|
|
this$static.negativePrefix = affix.string;
|
|
pos += $parseTrunk(this$static, pattern, pos, true);
|
|
pos += $parseAffix(this$static, pattern, pos, affix, true);
|
|
this$static.negativeSuffix = affix.string;
|
|
}
|
|
else {
|
|
this$static.negativePrefix = '-' + this$static.positivePrefix;
|
|
this$static.negativeSuffix = this$static.positiveSuffix;
|
|
}
|
|
}
|
|
|
|
function $parseTrunk(this$static, pattern, start_0, ignorePattern){
|
|
var ch_0, decimalPos, digitLeftCount, digitRightCount, effectiveDecimalPos, groupingCount, len, loop, n, pos, totalDigits, zeroDigitCount;
|
|
decimalPos = -1;
|
|
digitLeftCount = 0;
|
|
zeroDigitCount = 0;
|
|
digitRightCount = 0;
|
|
groupingCount = -1;
|
|
len = pattern.length;
|
|
pos = start_0;
|
|
loop = true;
|
|
for (; pos < len && loop; ++pos) {
|
|
ch_0 = (checkCriticalStringElementIndex(pos, pattern.length) , pattern.charCodeAt(pos));
|
|
switch (ch_0) {
|
|
case 35:
|
|
zeroDigitCount > 0?++digitRightCount:++digitLeftCount;
|
|
groupingCount >= 0 && decimalPos < 0 && ++groupingCount;
|
|
break;
|
|
case 48:
|
|
if (digitRightCount > 0) {
|
|
throw toJs(new IllegalArgumentException_0("Unexpected '0' in pattern \"" + pattern + '"'));
|
|
}
|
|
|
|
++zeroDigitCount;
|
|
groupingCount >= 0 && decimalPos < 0 && ++groupingCount;
|
|
break;
|
|
case 44:
|
|
groupingCount = 0;
|
|
break;
|
|
case 46:
|
|
if (decimalPos >= 0) {
|
|
throw toJs(new IllegalArgumentException_0('Multiple decimal separators in pattern "' + pattern + '"'));
|
|
}
|
|
|
|
decimalPos = digitLeftCount + zeroDigitCount + digitRightCount;
|
|
break;
|
|
case 69:
|
|
if (!ignorePattern) {
|
|
if (this$static.useExponentialNotation) {
|
|
throw toJs(new IllegalArgumentException_0('Multiple exponential symbols in pattern "' + pattern + '"'));
|
|
}
|
|
this$static.useExponentialNotation = true;
|
|
this$static.minExponentDigits = 0;
|
|
}
|
|
|
|
while (pos + 1 < len && (checkCriticalStringElementIndex(pos + 1, pattern.length) , pattern.charCodeAt(pos + 1) == 48)) {
|
|
++pos;
|
|
ignorePattern || ++this$static.minExponentDigits;
|
|
}
|
|
|
|
if (!ignorePattern && digitLeftCount + zeroDigitCount < 1 || this$static.minExponentDigits < 1) {
|
|
throw toJs(new IllegalArgumentException_0('Malformed exponential pattern "' + pattern + '"'));
|
|
}
|
|
|
|
loop = false;
|
|
break;
|
|
default:--pos;
|
|
loop = false;
|
|
}
|
|
}
|
|
if (zeroDigitCount == 0 && digitLeftCount > 0 && decimalPos >= 0) {
|
|
n = decimalPos;
|
|
decimalPos == 0 && ++n;
|
|
digitRightCount = digitLeftCount - n;
|
|
digitLeftCount = n - 1;
|
|
zeroDigitCount = 1;
|
|
}
|
|
if (decimalPos < 0 && digitRightCount > 0 || decimalPos >= 0 && (decimalPos < digitLeftCount || decimalPos > digitLeftCount + zeroDigitCount) || groupingCount == 0) {
|
|
throw toJs(new IllegalArgumentException_0('Malformed pattern "' + pattern + '"'));
|
|
}
|
|
if (ignorePattern) {
|
|
return pos - start_0;
|
|
}
|
|
totalDigits = digitLeftCount + zeroDigitCount + digitRightCount;
|
|
this$static.maximumFractionDigits = decimalPos >= 0?totalDigits - decimalPos:0;
|
|
if (decimalPos >= 0) {
|
|
this$static.minimumFractionDigits = digitLeftCount + zeroDigitCount - decimalPos;
|
|
this$static.minimumFractionDigits < 0 && (this$static.minimumFractionDigits = 0);
|
|
}
|
|
effectiveDecimalPos = decimalPos >= 0?decimalPos:totalDigits;
|
|
this$static.minimumIntegerDigits = effectiveDecimalPos - digitLeftCount;
|
|
if (this$static.useExponentialNotation) {
|
|
this$static.maximumIntegerDigits = digitLeftCount + this$static.minimumIntegerDigits;
|
|
this$static.maximumFractionDigits == 0 && this$static.minimumIntegerDigits == 0 && (this$static.minimumIntegerDigits = 1);
|
|
}
|
|
this$static.groupingSize = groupingCount > 0?groupingCount:0;
|
|
this$static.decimalSeparatorAlwaysShown = decimalPos == 0 || decimalPos == totalDigits;
|
|
return pos - start_0;
|
|
}
|
|
|
|
function $processLeadingZeros(this$static, digits){
|
|
var i, prefix, strip;
|
|
if (this$static.decimalPosition > this$static.digitsLength) {
|
|
while (this$static.digitsLength < this$static.decimalPosition) {
|
|
digits.string += '0';
|
|
++this$static.digitsLength;
|
|
}
|
|
}
|
|
if (!this$static.useExponentialNotation) {
|
|
if (this$static.decimalPosition < this$static.minimumIntegerDigits) {
|
|
prefix = new StringBuilder;
|
|
while (this$static.decimalPosition < this$static.minimumIntegerDigits) {
|
|
prefix.string += '0';
|
|
++this$static.decimalPosition;
|
|
++this$static.digitsLength;
|
|
}
|
|
$insert_4(digits, 0, prefix.string);
|
|
}
|
|
else if (this$static.decimalPosition > this$static.minimumIntegerDigits) {
|
|
strip = this$static.decimalPosition - this$static.minimumIntegerDigits;
|
|
for (i = 0; i < strip; ++i) {
|
|
if ($charAt_0(digits.string, i) != 48) {
|
|
strip = i;
|
|
break;
|
|
}
|
|
}
|
|
if (strip > 0) {
|
|
digits.string = digits.string.substr(0, 0) + '' + $substring(digits.string, strip);
|
|
this$static.digitsLength -= strip;
|
|
this$static.decimalPosition -= strip;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
function $propagateCarry(this$static, digits, i){
|
|
var carry, digit;
|
|
carry = true;
|
|
while (carry && i >= 0) {
|
|
digit = $charAt_0(digits.string, i);
|
|
if (digit == 57) {
|
|
$setCharAt(digits, i--, 48);
|
|
}
|
|
else {
|
|
$setCharAt(digits, i, digit + 1 & $intern_8);
|
|
carry = false;
|
|
}
|
|
}
|
|
if (carry) {
|
|
digits.string = digits.string.substr(0, 0) + '1' + digits.string.substr(0);
|
|
++this$static.decimalPosition;
|
|
++this$static.digitsLength;
|
|
}
|
|
}
|
|
|
|
function $roundValue(this$static, digits){
|
|
var i;
|
|
if (this$static.digitsLength > this$static.decimalPosition + this$static.maximumFractionDigits && $charAt(digits, this$static.decimalPosition + this$static.maximumFractionDigits) >= 53) {
|
|
i = this$static.decimalPosition + this$static.maximumFractionDigits - 1;
|
|
$propagateCarry(this$static, digits, i);
|
|
}
|
|
}
|
|
|
|
function NumberFormat(pattern, cdata, userSuppliedPattern){
|
|
if (!cdata) {
|
|
throw toJs(new IllegalArgumentException_0('Unknown currency code'));
|
|
}
|
|
this.pattern = pattern;
|
|
this.currencyData = cdata;
|
|
$parsePattern_0(this, this.pattern);
|
|
if (!userSuppliedPattern && this.isCurrencyFormat) {
|
|
this.minimumFractionDigits = this.currencyData[2] & 7;
|
|
this.maximumFractionDigits = this.minimumFractionDigits;
|
|
}
|
|
}
|
|
|
|
function NumberFormat_0(pattern, cdata){
|
|
$clinit_NumberFormat();
|
|
NumberFormat.call(this, pattern, cdata, true);
|
|
}
|
|
|
|
function toScaledString(buf, val){
|
|
var dot, expDigits, expIdx, scale, startLen;
|
|
startLen = buf.string.length;
|
|
$append_4(buf, val.toPrecision(20));
|
|
scale = 0;
|
|
expIdx = $indexOf_2(buf.string, 'e', startLen);
|
|
expIdx < 0 && (expIdx = $indexOf_2(buf.string, 'E', startLen));
|
|
if (expIdx >= 0) {
|
|
expDigits = expIdx + 1;
|
|
expDigits < buf.string.length && $charAt_0(buf.string, expDigits) == 43 && ++expDigits;
|
|
expDigits < buf.string.length && (scale = __parseAndValidateInt($substring(buf.string, expDigits), 10));
|
|
$delete(buf, expIdx, buf.string.length);
|
|
}
|
|
dot = $indexOf_2(buf.string, '.', startLen);
|
|
if (dot >= 0) {
|
|
buf.string = $substring_0(buf.string, 0, dot) + '' + $substring(buf.string, dot + 1);
|
|
scale -= buf.string.length - dot;
|
|
}
|
|
return scale;
|
|
}
|
|
|
|
defineClass(191, 1, {}, NumberFormat_0);
|
|
_.decimalPosition = 0;
|
|
_.decimalSeparatorAlwaysShown = false;
|
|
_.digitsLength = 0;
|
|
_.exponent = 0;
|
|
_.groupingSize = 3;
|
|
_.isCurrencyFormat = false;
|
|
_.maximumFractionDigits = 3;
|
|
_.maximumIntegerDigits = 40;
|
|
_.minExponentDigits = 0;
|
|
_.minimumFractionDigits = 0;
|
|
_.minimumIntegerDigits = 1;
|
|
_.multiplier = 1;
|
|
_.negativePrefix = '-';
|
|
_.negativeSuffix = '';
|
|
_.positivePrefix = '';
|
|
_.positiveSuffix = '';
|
|
_.useExponentialNotation = false;
|
|
var Lcom_google_gwt_i18n_client_NumberFormat_2_classLit = createForClass('com.google.gwt.i18n.client', 'NumberFormat', 191);
|
|
function $getISOTimeZoneString(this$static){
|
|
var data_0, offset;
|
|
offset = -this$static.standardOffset;
|
|
data_0 = stampJavaTypeInfo(getClassLiteralForArray(C_classLit, 1), $intern_21, 7, 15, [43, 48, 48, 58, 48, 48]);
|
|
if (offset < 0) {
|
|
data_0[0] = 45;
|
|
offset = -offset;
|
|
}
|
|
data_0[1] = data_0[1] + ((offset / 60 | 0) / 10 | 0) & $intern_8;
|
|
data_0[2] = data_0[2] + (offset / 60 | 0) % 10 & $intern_8;
|
|
data_0[4] = data_0[4] + (offset % 60 / 10 | 0) & $intern_8;
|
|
data_0[5] = data_0[5] + offset % 10 & $intern_8;
|
|
return valueOf_3(data_0, data_0.length);
|
|
}
|
|
|
|
function $getRFCTimeZoneString(this$static){
|
|
var data_0, offset;
|
|
offset = -this$static.standardOffset;
|
|
data_0 = stampJavaTypeInfo(getClassLiteralForArray(C_classLit, 1), $intern_21, 7, 15, [43, 48, 48, 48, 48]);
|
|
if (offset < 0) {
|
|
data_0[0] = 45;
|
|
offset = -offset;
|
|
}
|
|
data_0[1] = data_0[1] + ((offset / 60 | 0) / 10 | 0) & $intern_8;
|
|
data_0[2] = data_0[2] + (offset / 60 | 0) % 10 & $intern_8;
|
|
data_0[3] = data_0[3] + (offset % 60 / 10 | 0) & $intern_8;
|
|
data_0[4] = data_0[4] + offset % 10 & $intern_8;
|
|
return valueOf_3(data_0, data_0.length);
|
|
}
|
|
|
|
function TimeZone(){
|
|
}
|
|
|
|
function composeGMTString(offset){
|
|
var data_0;
|
|
data_0 = stampJavaTypeInfo(getClassLiteralForArray(C_classLit, 1), $intern_21, 7, 15, [71, 77, 84, 45, 48, 48, 58, 48, 48]);
|
|
if (offset <= 0) {
|
|
data_0[3] = 43;
|
|
offset = -offset;
|
|
}
|
|
data_0[4] = data_0[4] + ((offset / 60 | 0) / 10 | 0) & $intern_8;
|
|
data_0[5] = data_0[5] + (offset / 60 | 0) % 10 & $intern_8;
|
|
data_0[7] = data_0[7] + (offset % 60 / 10 | 0) & $intern_8;
|
|
data_0[8] = data_0[8] + offset % 10 & $intern_8;
|
|
return valueOf_3(data_0, data_0.length);
|
|
}
|
|
|
|
function composePOSIXTimeZoneID(offset){
|
|
var str;
|
|
if (offset == 0) {
|
|
return 'Etc/GMT';
|
|
}
|
|
if (offset < 0) {
|
|
offset = -offset;
|
|
str = 'Etc/GMT-';
|
|
}
|
|
else {
|
|
str = 'Etc/GMT+';
|
|
}
|
|
return str + offsetDisplay(offset);
|
|
}
|
|
|
|
function composeUTCString(offset){
|
|
var str;
|
|
if (offset == 0) {
|
|
return 'UTC';
|
|
}
|
|
if (offset < 0) {
|
|
offset = -offset;
|
|
str = 'UTC+';
|
|
}
|
|
else {
|
|
str = 'UTC-';
|
|
}
|
|
return str + offsetDisplay(offset);
|
|
}
|
|
|
|
function createTimeZone(timeZoneOffsetInMinutes){
|
|
var tz;
|
|
tz = new TimeZone;
|
|
tz.standardOffset = timeZoneOffsetInMinutes;
|
|
tz.timezoneID = composePOSIXTimeZoneID(timeZoneOffsetInMinutes);
|
|
tz.tzNames = initUnidimensionalArray(Ljava_lang_String_2_classLit, $intern_23, 2, 2, 6, 1);
|
|
tz.tzNames[0] = composeUTCString(timeZoneOffsetInMinutes);
|
|
tz.tzNames[1] = composeUTCString(timeZoneOffsetInMinutes);
|
|
return tz;
|
|
}
|
|
|
|
function offsetDisplay(offset){
|
|
var hour, mins;
|
|
hour = offset / 60 | 0;
|
|
mins = offset % 60;
|
|
if (mins == 0) {
|
|
return '' + hour;
|
|
}
|
|
return '' + hour + ':' + ('' + mins);
|
|
}
|
|
|
|
defineClass(934, 1, {}, TimeZone);
|
|
_.standardOffset = 0;
|
|
var Lcom_google_gwt_i18n_client_TimeZone_2_classLit = createForClass('com.google.gwt.i18n.client', 'TimeZone', 934);
|
|
function NumberConstantsImpl_(){
|
|
}
|
|
|
|
defineClass(918, 1, {}, NumberConstantsImpl_);
|
|
var Lcom_google_gwt_i18n_client_constants_NumberConstantsImpl_1_2_classLit = createForClass('com.google.gwt.i18n.client.constants', 'NumberConstantsImpl_', 918);
|
|
function $getSimpleCurrencySymbol(this$static){
|
|
return this$static[4] || this$static[1];
|
|
}
|
|
|
|
function DateTimeFormatInfoImpl(){
|
|
}
|
|
|
|
defineClass(933, 995, {}, DateTimeFormatInfoImpl);
|
|
var Lcom_google_gwt_i18n_client_impl_cldr_DateTimeFormatInfoImpl_2_classLit = createForClass('com.google.gwt.i18n.client.impl.cldr', 'DateTimeFormatInfoImpl', 933);
|
|
function DateTimeFormat$PatternPart(txt, cnt){
|
|
this.text_0 = txt;
|
|
this.count = cnt;
|
|
this.abutStart = false;
|
|
}
|
|
|
|
defineClass(354, 1, {354:1}, DateTimeFormat$PatternPart);
|
|
_.abutStart = false;
|
|
_.count = 0;
|
|
var Lcom_google_gwt_i18n_shared_DateTimeFormat$PatternPart_2_classLit = createForClass('com.google.gwt.i18n.shared', 'DateTimeFormat/PatternPart', 354);
|
|
function getClassLiteralForArray(clazz, dimensions){
|
|
return getClassLiteralForArray_0(clazz, dimensions);
|
|
}
|
|
|
|
function getElementTypeCategory(array){
|
|
return array.__elementTypeCategory$ == null?10:array.__elementTypeCategory$;
|
|
}
|
|
|
|
function initMultidimensionalArray(leafClassLiteral, castableTypeMapExprs, elementTypeIds, leafElementTypeCategory, dimExprs, count){
|
|
return initMultidimensionalArray_0(leafClassLiteral, castableTypeMapExprs, elementTypeIds, leafElementTypeCategory, dimExprs, 0, count);
|
|
}
|
|
|
|
function initMultidimensionalArray_0(leafClassLiteral, castableTypeMapExprs, elementTypeIds, leafElementTypeCategory, dimExprs, index_0, count){
|
|
var elementTypeCategory, i, isLastDimension, length_0, result;
|
|
length_0 = dimExprs[index_0];
|
|
isLastDimension = index_0 == count - 1;
|
|
elementTypeCategory = isLastDimension?leafElementTypeCategory:0;
|
|
result = initializeArrayElementsWithDefaults(elementTypeCategory, length_0);
|
|
leafElementTypeCategory != 10 && stampJavaTypeInfo(getClassLiteralForArray(leafClassLiteral, count - index_0), castableTypeMapExprs[index_0], elementTypeIds[index_0], elementTypeCategory, result);
|
|
if (!isLastDimension) {
|
|
++index_0;
|
|
for (i = 0; i < length_0; ++i) {
|
|
result[i] = initMultidimensionalArray_0(leafClassLiteral, castableTypeMapExprs, elementTypeIds, leafElementTypeCategory, dimExprs, index_0, count);
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
|
|
function initUnidimensionalArray(leafClassLiteral, castableTypeMap, elementTypeId, length_0, elementTypeCategory, dimensions){
|
|
var result;
|
|
result = initializeArrayElementsWithDefaults(elementTypeCategory, length_0);
|
|
elementTypeCategory != 10 && stampJavaTypeInfo(getClassLiteralForArray(leafClassLiteral, dimensions), castableTypeMap, elementTypeId, elementTypeCategory, result);
|
|
return result;
|
|
}
|
|
|
|
function initializeArrayElementsWithDefaults(elementTypeCategory, length_0){
|
|
var array = new Array(length_0);
|
|
var initValue;
|
|
switch (elementTypeCategory) {
|
|
case 14:
|
|
case 15:
|
|
initValue = 0;
|
|
break;
|
|
case 16:
|
|
initValue = false;
|
|
break;
|
|
default:return array;
|
|
}
|
|
for (var i = 0; i < length_0; ++i) {
|
|
array[i] = initValue;
|
|
}
|
|
return array;
|
|
}
|
|
|
|
function isJavaArray(src_0){
|
|
return Array.isArray(src_0) && src_0.typeMarker === typeMarkerFn;
|
|
}
|
|
|
|
function stampJavaTypeInfo(arrayClass, castableTypeMap, elementTypeId, elementTypeCategory, array){
|
|
array.___clazz = arrayClass;
|
|
array.castableTypeMap = castableTypeMap;
|
|
array.typeMarker = typeMarkerFn;
|
|
array.__elementTypeId$ = elementTypeId;
|
|
array.__elementTypeCategory$ = elementTypeCategory;
|
|
return array;
|
|
}
|
|
|
|
function stampJavaTypeInfo_0(array, referenceType){
|
|
getElementTypeCategory(referenceType) != 10 && stampJavaTypeInfo(getClass__Ljava_lang_Class___devirtual$(referenceType), referenceType.castableTypeMap, referenceType.__elementTypeId$, getElementTypeCategory(referenceType), array);
|
|
return array;
|
|
}
|
|
|
|
function create(value_0){
|
|
var a0, a1, a2;
|
|
a0 = value_0 & $intern_27;
|
|
a1 = value_0 >> 22 & $intern_27;
|
|
a2 = value_0 < 0?$intern_28:0;
|
|
return create0(a0, a1, a2);
|
|
}
|
|
|
|
function create_0(a){
|
|
return create0(a.l, a.m, a.h);
|
|
}
|
|
|
|
function create0(l_0, m, h){
|
|
return {l:l_0, m:m, h:h};
|
|
}
|
|
|
|
function divMod(a, b, computeRemainder){
|
|
var aIsCopy, aIsMinValue, aIsNegative, bpower, c, negative;
|
|
if (b.l == 0 && b.m == 0 && b.h == 0) {
|
|
throw toJs(new ArithmeticException);
|
|
}
|
|
if (a.l == 0 && a.m == 0 && a.h == 0) {
|
|
computeRemainder && (remainder_0 = create0(0, 0, 0));
|
|
return create0(0, 0, 0);
|
|
}
|
|
if (b.h == $intern_29 && b.m == 0 && b.l == 0) {
|
|
return divModByMinValue(a, computeRemainder);
|
|
}
|
|
negative = false;
|
|
if (b.h >> 19 != 0) {
|
|
b = neg_0(b);
|
|
negative = true;
|
|
}
|
|
bpower = powerOfTwo(b);
|
|
aIsNegative = false;
|
|
aIsMinValue = false;
|
|
aIsCopy = false;
|
|
if (a.h == $intern_29 && a.m == 0 && a.l == 0) {
|
|
aIsMinValue = true;
|
|
aIsNegative = true;
|
|
if (bpower == -1) {
|
|
a = create_0(($clinit_BigLongLib$Const() , MAX_VALUE));
|
|
aIsCopy = true;
|
|
negative = !negative;
|
|
}
|
|
else {
|
|
c = shr(a, bpower);
|
|
negative && negate(c);
|
|
computeRemainder && (remainder_0 = create0(0, 0, 0));
|
|
return c;
|
|
}
|
|
}
|
|
else if (a.h >> 19 != 0) {
|
|
aIsNegative = true;
|
|
a = neg_0(a);
|
|
aIsCopy = true;
|
|
negative = !negative;
|
|
}
|
|
if (bpower != -1) {
|
|
return divModByShift(a, bpower, negative, aIsNegative, computeRemainder);
|
|
}
|
|
if (compare(a, b) < 0) {
|
|
computeRemainder && (aIsNegative?(remainder_0 = neg_0(a)):(remainder_0 = create0(a.l, a.m, a.h)));
|
|
return create0(0, 0, 0);
|
|
}
|
|
return divModHelper(aIsCopy?a:create0(a.l, a.m, a.h), b, negative, aIsNegative, aIsMinValue, computeRemainder);
|
|
}
|
|
|
|
function divModByMinValue(a, computeRemainder){
|
|
if (a.h == $intern_29 && a.m == 0 && a.l == 0) {
|
|
computeRemainder && (remainder_0 = create0(0, 0, 0));
|
|
return create_0(($clinit_BigLongLib$Const() , ONE));
|
|
}
|
|
computeRemainder && (remainder_0 = create0(a.l, a.m, a.h));
|
|
return create0(0, 0, 0);
|
|
}
|
|
|
|
function divModByShift(a, bpower, negative, aIsNegative, computeRemainder){
|
|
var c;
|
|
c = shr(a, bpower);
|
|
negative && negate(c);
|
|
if (computeRemainder) {
|
|
a = maskRight(a, bpower);
|
|
aIsNegative?(remainder_0 = neg_0(a)):(remainder_0 = create0(a.l, a.m, a.h));
|
|
}
|
|
return c;
|
|
}
|
|
|
|
function divModHelper(a, b, negative, aIsNegative, aIsMinValue, computeRemainder){
|
|
var bshift, gte, quotient, shift_0, a1, a2, a0;
|
|
shift_0 = numberOfLeadingZeros(b) - numberOfLeadingZeros(a);
|
|
bshift = shl(b, shift_0);
|
|
quotient = create0(0, 0, 0);
|
|
while (shift_0 >= 0) {
|
|
gte = trialSubtract(a, bshift);
|
|
if (gte) {
|
|
shift_0 < 22?(quotient.l |= 1 << shift_0 , undefined):shift_0 < 44?(quotient.m |= 1 << shift_0 - 22 , undefined):(quotient.h |= 1 << shift_0 - 44 , undefined);
|
|
if (a.l == 0 && a.m == 0 && a.h == 0) {
|
|
break;
|
|
}
|
|
}
|
|
a1 = bshift.m;
|
|
a2 = bshift.h;
|
|
a0 = bshift.l;
|
|
bshift.h = a2 >>> 1;
|
|
bshift.m = a1 >>> 1 | (a2 & 1) << 21;
|
|
bshift.l = a0 >>> 1 | (a1 & 1) << 21;
|
|
--shift_0;
|
|
}
|
|
negative && negate(quotient);
|
|
if (computeRemainder) {
|
|
if (aIsNegative) {
|
|
remainder_0 = neg_0(a);
|
|
aIsMinValue && (remainder_0 = sub_0(remainder_0, ($clinit_BigLongLib$Const() , ONE)));
|
|
}
|
|
else {
|
|
remainder_0 = create0(a.l, a.m, a.h);
|
|
}
|
|
}
|
|
return quotient;
|
|
}
|
|
|
|
function maskRight(a, bits){
|
|
var b0, b1, b2;
|
|
if (bits <= 22) {
|
|
b0 = a.l & (1 << bits) - 1;
|
|
b1 = b2 = 0;
|
|
}
|
|
else if (bits <= 44) {
|
|
b0 = a.l;
|
|
b1 = a.m & (1 << bits - 22) - 1;
|
|
b2 = 0;
|
|
}
|
|
else {
|
|
b0 = a.l;
|
|
b1 = a.m;
|
|
b2 = a.h & (1 << bits - 44) - 1;
|
|
}
|
|
return create0(b0, b1, b2);
|
|
}
|
|
|
|
function negate(a){
|
|
var neg0, neg1, neg2;
|
|
neg0 = ~a.l + 1 & $intern_27;
|
|
neg1 = ~a.m + (neg0 == 0?1:0) & $intern_27;
|
|
neg2 = ~a.h + (neg0 == 0 && neg1 == 0?1:0) & $intern_28;
|
|
a.l = neg0;
|
|
a.m = neg1;
|
|
a.h = neg2;
|
|
}
|
|
|
|
function numberOfLeadingZeros(a){
|
|
var b1, b2;
|
|
b2 = numberOfLeadingZeros_0(a.h);
|
|
if (b2 == 32) {
|
|
b1 = numberOfLeadingZeros_0(a.m);
|
|
return b1 == 32?numberOfLeadingZeros_0(a.l) + 32:b1 + 20 - 10;
|
|
}
|
|
else {
|
|
return b2 - 12;
|
|
}
|
|
}
|
|
|
|
function powerOfTwo(a){
|
|
var h, l_0, m;
|
|
l_0 = a.l;
|
|
if ((l_0 & l_0 - 1) != 0) {
|
|
return -1;
|
|
}
|
|
m = a.m;
|
|
if ((m & m - 1) != 0) {
|
|
return -1;
|
|
}
|
|
h = a.h;
|
|
if ((h & h - 1) != 0) {
|
|
return -1;
|
|
}
|
|
if (h == 0 && m == 0 && l_0 == 0) {
|
|
return -1;
|
|
}
|
|
if (h == 0 && m == 0 && l_0 != 0) {
|
|
return numberOfTrailingZeros(l_0);
|
|
}
|
|
if (h == 0 && m != 0 && l_0 == 0) {
|
|
return numberOfTrailingZeros(m) + 22;
|
|
}
|
|
if (h != 0 && m == 0 && l_0 == 0) {
|
|
return numberOfTrailingZeros(h) + 44;
|
|
}
|
|
return -1;
|
|
}
|
|
|
|
function toDoubleHelper(a){
|
|
return a.l + a.m * $intern_30 + a.h * $intern_31;
|
|
}
|
|
|
|
function trialSubtract(a, b){
|
|
var sum0, sum1, sum2;
|
|
sum2 = a.h - b.h;
|
|
if (sum2 < 0) {
|
|
return false;
|
|
}
|
|
sum0 = a.l - b.l;
|
|
sum1 = a.m - b.m + (sum0 >> 22);
|
|
sum2 += sum1 >> 22;
|
|
if (sum2 < 0) {
|
|
return false;
|
|
}
|
|
a.l = sum0 & $intern_27;
|
|
a.m = sum1 & $intern_27;
|
|
a.h = sum2 & $intern_28;
|
|
return true;
|
|
}
|
|
|
|
var remainder_0;
|
|
function add_1(a, b){
|
|
var sum0, sum1, sum2;
|
|
sum0 = a.l + b.l;
|
|
sum1 = a.m + b.m + (sum0 >> 22);
|
|
sum2 = a.h + b.h + (sum1 >> 22);
|
|
return create0(sum0 & $intern_27, sum1 & $intern_27, sum2 & $intern_28);
|
|
}
|
|
|
|
function and(a, b){
|
|
return create0(a.l & b.l, a.m & b.m, a.h & b.h);
|
|
}
|
|
|
|
function compare(a, b){
|
|
var a0, a1, a2, b0, b1, b2, signA, signB;
|
|
signA = a.h >> 19;
|
|
signB = b.h >> 19;
|
|
if (signA != signB) {
|
|
return signB - signA;
|
|
}
|
|
a2 = a.h;
|
|
b2 = b.h;
|
|
if (a2 != b2) {
|
|
return a2 - b2;
|
|
}
|
|
a1 = a.m;
|
|
b1 = b.m;
|
|
if (a1 != b1) {
|
|
return a1 - b1;
|
|
}
|
|
a0 = a.l;
|
|
b0 = b.l;
|
|
return a0 - b0;
|
|
}
|
|
|
|
function fromDouble(value_0){
|
|
var a0, a1, a2, negative, result;
|
|
if (isNaN(value_0)) {
|
|
return $clinit_BigLongLib$Const() , ZERO;
|
|
}
|
|
if (value_0 < -9223372036854775808) {
|
|
return $clinit_BigLongLib$Const() , MIN_VALUE;
|
|
}
|
|
if (value_0 >= 9223372036854775807) {
|
|
return $clinit_BigLongLib$Const() , MAX_VALUE;
|
|
}
|
|
negative = false;
|
|
if (value_0 < 0) {
|
|
negative = true;
|
|
value_0 = -value_0;
|
|
}
|
|
a2 = 0;
|
|
if (value_0 >= $intern_31) {
|
|
a2 = round_int(value_0 / $intern_31);
|
|
value_0 -= a2 * $intern_31;
|
|
}
|
|
a1 = 0;
|
|
if (value_0 >= $intern_30) {
|
|
a1 = round_int(value_0 / $intern_30);
|
|
value_0 -= a1 * $intern_30;
|
|
}
|
|
a0 = round_int(value_0);
|
|
result = create0(a0, a1, a2);
|
|
negative && negate(result);
|
|
return result;
|
|
}
|
|
|
|
function mul(a, b){
|
|
var a0, a1, a2, a3, a4, b0, b1, b2, b3, b4, c0, c00, c01, c1, c10, c11, c12, c13, c2, c22, c23, c24, p0, p1, p2, p3, p4;
|
|
a0 = a.l & 8191;
|
|
a1 = a.l >> 13 | (a.m & 15) << 9;
|
|
a2 = a.m >> 4 & 8191;
|
|
a3 = a.m >> 17 | (a.h & 255) << 5;
|
|
a4 = (a.h & 1048320) >> 8;
|
|
b0 = b.l & 8191;
|
|
b1 = b.l >> 13 | (b.m & 15) << 9;
|
|
b2 = b.m >> 4 & 8191;
|
|
b3 = b.m >> 17 | (b.h & 255) << 5;
|
|
b4 = (b.h & 1048320) >> 8;
|
|
p0 = a0 * b0;
|
|
p1 = a1 * b0;
|
|
p2 = a2 * b0;
|
|
p3 = a3 * b0;
|
|
p4 = a4 * b0;
|
|
if (b1 != 0) {
|
|
p1 += a0 * b1;
|
|
p2 += a1 * b1;
|
|
p3 += a2 * b1;
|
|
p4 += a3 * b1;
|
|
}
|
|
if (b2 != 0) {
|
|
p2 += a0 * b2;
|
|
p3 += a1 * b2;
|
|
p4 += a2 * b2;
|
|
}
|
|
if (b3 != 0) {
|
|
p3 += a0 * b3;
|
|
p4 += a1 * b3;
|
|
}
|
|
b4 != 0 && (p4 += a0 * b4);
|
|
c00 = p0 & $intern_27;
|
|
c01 = (p1 & 511) << 13;
|
|
c0 = c00 + c01;
|
|
c10 = p0 >> 22;
|
|
c11 = p1 >> 9;
|
|
c12 = (p2 & 262143) << 4;
|
|
c13 = (p3 & 31) << 17;
|
|
c1 = c10 + c11 + c12 + c13;
|
|
c22 = p2 >> 18;
|
|
c23 = p3 >> 5;
|
|
c24 = (p4 & 4095) << 8;
|
|
c2 = c22 + c23 + c24;
|
|
c1 += c0 >> 22;
|
|
c0 &= $intern_27;
|
|
c2 += c1 >> 22;
|
|
c1 &= $intern_27;
|
|
c2 &= $intern_28;
|
|
return create0(c0, c1, c2);
|
|
}
|
|
|
|
function neg_0(a){
|
|
var neg0, neg1, neg2;
|
|
neg0 = ~a.l + 1 & $intern_27;
|
|
neg1 = ~a.m + (neg0 == 0?1:0) & $intern_27;
|
|
neg2 = ~a.h + (neg0 == 0 && neg1 == 0?1:0) & $intern_28;
|
|
return create0(neg0, neg1, neg2);
|
|
}
|
|
|
|
function or(a, b){
|
|
return create0(a.l | b.l, a.m | b.m, a.h | b.h);
|
|
}
|
|
|
|
function shl(a, n){
|
|
var res0, res1, res2;
|
|
n &= 63;
|
|
if (n < 22) {
|
|
res0 = a.l << n;
|
|
res1 = a.m << n | a.l >> 22 - n;
|
|
res2 = a.h << n | a.m >> 22 - n;
|
|
}
|
|
else if (n < 44) {
|
|
res0 = 0;
|
|
res1 = a.l << n - 22;
|
|
res2 = a.m << n - 22 | a.l >> 44 - n;
|
|
}
|
|
else {
|
|
res0 = 0;
|
|
res1 = 0;
|
|
res2 = a.l << n - 44;
|
|
}
|
|
return create0(res0 & $intern_27, res1 & $intern_27, res2 & $intern_28);
|
|
}
|
|
|
|
function shr(a, n){
|
|
var a2, negative, res0, res1, res2;
|
|
n &= 63;
|
|
a2 = a.h;
|
|
negative = (a2 & $intern_29) != 0;
|
|
negative && (a2 |= -1048576);
|
|
if (n < 22) {
|
|
res2 = a2 >> n;
|
|
res1 = a.m >> n | a2 << 22 - n;
|
|
res0 = a.l >> n | a.m << 22 - n;
|
|
}
|
|
else if (n < 44) {
|
|
res2 = negative?$intern_28:0;
|
|
res1 = a2 >> n - 22;
|
|
res0 = a.m >> n - 22 | a2 << 44 - n;
|
|
}
|
|
else {
|
|
res2 = negative?$intern_28:0;
|
|
res1 = negative?$intern_27:0;
|
|
res0 = a2 >> n - 44;
|
|
}
|
|
return create0(res0 & $intern_27, res1 & $intern_27, res2 & $intern_28);
|
|
}
|
|
|
|
function shru(a, n){
|
|
var a2, res0, res1, res2;
|
|
n &= 63;
|
|
a2 = a.h & $intern_28;
|
|
if (n < 22) {
|
|
res2 = a2 >>> n;
|
|
res1 = a.m >> n | a2 << 22 - n;
|
|
res0 = a.l >> n | a.m << 22 - n;
|
|
}
|
|
else if (n < 44) {
|
|
res2 = 0;
|
|
res1 = a2 >>> n - 22;
|
|
res0 = a.m >> n - 22 | a.h << 44 - n;
|
|
}
|
|
else {
|
|
res2 = 0;
|
|
res1 = 0;
|
|
res0 = a2 >>> n - 44;
|
|
}
|
|
return create0(res0 & $intern_27, res1 & $intern_27, res2 & $intern_28);
|
|
}
|
|
|
|
function sub_0(a, b){
|
|
var sum0, sum1, sum2;
|
|
sum0 = a.l - b.l;
|
|
sum1 = a.m - b.m + (sum0 >> 22);
|
|
sum2 = a.h - b.h + (sum1 >> 22);
|
|
return create0(sum0 & $intern_27, sum1 & $intern_27, sum2 & $intern_28);
|
|
}
|
|
|
|
function toDouble(a){
|
|
if (compare(a, ($clinit_BigLongLib$Const() , ZERO)) < 0) {
|
|
return -toDoubleHelper(neg_0(a));
|
|
}
|
|
return a.l + a.m * $intern_30 + a.h * $intern_31;
|
|
}
|
|
|
|
function toInt(a){
|
|
return a.l | a.m << 22;
|
|
}
|
|
|
|
function toString_7(a){
|
|
var digits, rem, res, tenPowerLong, zeroesNeeded;
|
|
if (a.l == 0 && a.m == 0 && a.h == 0) {
|
|
return '0';
|
|
}
|
|
if (a.h == $intern_29 && a.m == 0 && a.l == 0) {
|
|
return '-9223372036854775808';
|
|
}
|
|
if (a.h >> 19 != 0) {
|
|
return '-' + toString_7(neg_0(a));
|
|
}
|
|
rem = a;
|
|
res = '';
|
|
while (!(rem.l == 0 && rem.m == 0 && rem.h == 0)) {
|
|
tenPowerLong = create($intern_32);
|
|
rem = divMod(rem, tenPowerLong, true);
|
|
digits = '' + toInt(remainder_0);
|
|
if (!(rem.l == 0 && rem.m == 0 && rem.h == 0)) {
|
|
zeroesNeeded = 9 - digits.length;
|
|
for (; zeroesNeeded > 0; zeroesNeeded--) {
|
|
digits = '0' + digits;
|
|
}
|
|
}
|
|
res = digits + res;
|
|
}
|
|
return res;
|
|
}
|
|
|
|
function xor(a, b){
|
|
return create0(a.l ^ b.l, a.m ^ b.m, a.h ^ b.h);
|
|
}
|
|
|
|
function $clinit_BigLongLib$Const(){
|
|
$clinit_BigLongLib$Const = emptyMethod;
|
|
MAX_VALUE = create0($intern_27, $intern_27, 524287);
|
|
MIN_VALUE = create0(0, 0, $intern_29);
|
|
ONE = create(1);
|
|
create(2);
|
|
ZERO = create(0);
|
|
}
|
|
|
|
var MAX_VALUE, MIN_VALUE, ONE, ZERO;
|
|
function toJava(e){
|
|
var javaException;
|
|
if (instanceOf(e, 42)) {
|
|
return e;
|
|
}
|
|
javaException = e && e['__java$exception'];
|
|
if (!javaException) {
|
|
javaException = new JavaScriptException(e);
|
|
captureStackTrace(javaException);
|
|
}
|
|
return javaException;
|
|
}
|
|
|
|
function toJs(t){
|
|
return t.backingJsObject;
|
|
}
|
|
|
|
function add_2(a, b){
|
|
var result;
|
|
if (isSmallLong0(a) && isSmallLong0(b)) {
|
|
result = a + b;
|
|
if ($intern_33 < result && result < $intern_31) {
|
|
return result;
|
|
}
|
|
}
|
|
return createLongEmul(add_1(isSmallLong0(a)?toBigLong(a):a, isSmallLong0(b)?toBigLong(b):b));
|
|
}
|
|
|
|
function compare_0(a, b){
|
|
var result;
|
|
if (isSmallLong0(a) && isSmallLong0(b)) {
|
|
result = a - b;
|
|
if (!isNaN(result)) {
|
|
return result;
|
|
}
|
|
}
|
|
return compare(isSmallLong0(a)?toBigLong(a):a, isSmallLong0(b)?toBigLong(b):b);
|
|
}
|
|
|
|
function createLongEmul(big_0){
|
|
var a2;
|
|
a2 = big_0.h;
|
|
if (a2 == 0) {
|
|
return big_0.l + big_0.m * $intern_30;
|
|
}
|
|
if (a2 == $intern_28) {
|
|
return big_0.l + big_0.m * $intern_30 - $intern_31;
|
|
}
|
|
return big_0;
|
|
}
|
|
|
|
function eq_0(a, b){
|
|
return compare_0(a, b) == 0;
|
|
}
|
|
|
|
function fromDouble_0(value_0){
|
|
if ($intern_33 < value_0 && value_0 < $intern_31) {
|
|
return value_0 < 0?$wnd.Math.ceil(value_0):$wnd.Math.floor(value_0);
|
|
}
|
|
return createLongEmul(fromDouble(value_0));
|
|
}
|
|
|
|
function gt(a, b){
|
|
return compare_0(a, b) > 0;
|
|
}
|
|
|
|
function gte_0(a, b){
|
|
return compare_0(a, b) >= 0;
|
|
}
|
|
|
|
function isSmallLong0(value_0){
|
|
return typeof value_0 === 'number';
|
|
}
|
|
|
|
function lt(a, b){
|
|
return compare_0(a, b) < 0;
|
|
}
|
|
|
|
function mod(a, b){
|
|
var result;
|
|
if (isSmallLong0(a) && isSmallLong0(b)) {
|
|
result = a % b;
|
|
if ($intern_33 < result && result < $intern_31) {
|
|
return result;
|
|
}
|
|
}
|
|
return createLongEmul((divMod(isSmallLong0(a)?toBigLong(a):a, isSmallLong0(b)?toBigLong(b):b, true) , remainder_0));
|
|
}
|
|
|
|
function mul_0(a, b){
|
|
var result;
|
|
if (isSmallLong0(a) && isSmallLong0(b)) {
|
|
result = a * b;
|
|
if ($intern_33 < result && result < $intern_31) {
|
|
return result;
|
|
}
|
|
}
|
|
return createLongEmul(mul(isSmallLong0(a)?toBigLong(a):a, isSmallLong0(b)?toBigLong(b):b));
|
|
}
|
|
|
|
function neg_1(a){
|
|
var result;
|
|
if (isSmallLong0(a)) {
|
|
result = 0 - a;
|
|
if (!isNaN(result)) {
|
|
return result;
|
|
}
|
|
}
|
|
return createLongEmul(neg_0(a));
|
|
}
|
|
|
|
function neq(a, b){
|
|
return compare_0(a, b) != 0;
|
|
}
|
|
|
|
function or_0(a, b){
|
|
return createLongEmul(or(isSmallLong0(a)?toBigLong(a):a, isSmallLong0(b)?toBigLong(b):b));
|
|
}
|
|
|
|
function shr_0(a, n){
|
|
return createLongEmul(shr(isSmallLong0(a)?toBigLong(a):a, n));
|
|
}
|
|
|
|
function sub_1(a, b){
|
|
var result;
|
|
if (isSmallLong0(a) && isSmallLong0(b)) {
|
|
result = a - b;
|
|
if ($intern_33 < result && result < $intern_31) {
|
|
return result;
|
|
}
|
|
}
|
|
return createLongEmul(sub_0(isSmallLong0(a)?toBigLong(a):a, isSmallLong0(b)?toBigLong(b):b));
|
|
}
|
|
|
|
function toBigLong(longValue){
|
|
var a0, a1, a3, value_0;
|
|
value_0 = longValue;
|
|
a3 = 0;
|
|
if (value_0 < 0) {
|
|
value_0 += $intern_31;
|
|
a3 = $intern_28;
|
|
}
|
|
a1 = round_int(value_0 / $intern_30);
|
|
a0 = round_int(value_0 - a1 * $intern_30);
|
|
return create0(a0, a1, a3);
|
|
}
|
|
|
|
function toDouble_0(a){
|
|
var d;
|
|
if (isSmallLong0(a)) {
|
|
d = a;
|
|
return d == -0.?0:d;
|
|
}
|
|
return toDouble(a);
|
|
}
|
|
|
|
function toInt_0(a){
|
|
if (isSmallLong0(a)) {
|
|
return a | 0;
|
|
}
|
|
return toInt(a);
|
|
}
|
|
|
|
function toString_8(a){
|
|
if (isSmallLong0(a)) {
|
|
return '' + a;
|
|
}
|
|
return toString_7(a);
|
|
}
|
|
|
|
function xor_0(a, b){
|
|
return createLongEmul(xor(isSmallLong0(a)?toBigLong(a):a, isSmallLong0(b)?toBigLong(b):b));
|
|
}
|
|
|
|
function init(){
|
|
$wnd.setTimeout($entry(assertCompileTimeUserAgent));
|
|
$onModuleLoad();
|
|
$loadLocale();
|
|
}
|
|
|
|
function $adjustHorizontalConstraints(this$static, parentWidth, l_0){
|
|
var leftPx, rightPx, widthPx;
|
|
leftPx = l_0.left_0 * $getUnitSize(this$static, l_0.leftUnit, false);
|
|
rightPx = l_0.right * $getUnitSize(this$static, l_0.rightUnit, false);
|
|
widthPx = l_0.width_0 * $getUnitSize(this$static, l_0.widthUnit, false);
|
|
if (l_0.setLeft && !l_0.setTargetLeft) {
|
|
l_0.setLeft = false;
|
|
if (l_0.setWidth) {
|
|
l_0.setTargetRight = true;
|
|
l_0.sourceRight = (parentWidth - (leftPx + widthPx)) / $getUnitSize(this$static, l_0.targetRightUnit, false);
|
|
}
|
|
else {
|
|
l_0.setTargetWidth = true;
|
|
l_0.sourceWidth = (parentWidth - (leftPx + rightPx)) / $getUnitSize(this$static, l_0.targetWidthUnit, false);
|
|
}
|
|
}
|
|
else if (l_0.setWidth && !l_0.setTargetWidth) {
|
|
l_0.setWidth = false;
|
|
if (l_0.setLeft) {
|
|
l_0.setTargetRight = true;
|
|
l_0.sourceRight = (parentWidth - (leftPx + widthPx)) / $getUnitSize(this$static, l_0.targetRightUnit, false);
|
|
}
|
|
else {
|
|
l_0.setTargetLeft = true;
|
|
l_0.sourceLeft = (parentWidth - (rightPx + widthPx)) / $getUnitSize(this$static, l_0.targetLeftUnit, false);
|
|
}
|
|
}
|
|
else if (l_0.setRight && !l_0.setTargetRight) {
|
|
l_0.setRight = false;
|
|
if (l_0.setWidth) {
|
|
l_0.setTargetLeft = true;
|
|
l_0.sourceLeft = (parentWidth - (rightPx + widthPx)) / $getUnitSize(this$static, l_0.targetLeftUnit, false);
|
|
}
|
|
else {
|
|
l_0.setTargetWidth = true;
|
|
l_0.sourceWidth = (parentWidth - (leftPx + rightPx)) / $getUnitSize(this$static, l_0.targetWidthUnit, false);
|
|
}
|
|
}
|
|
l_0.setLeft = l_0.setTargetLeft;
|
|
l_0.setRight = l_0.setTargetRight;
|
|
l_0.setWidth = l_0.setTargetWidth;
|
|
l_0.leftUnit = l_0.targetLeftUnit;
|
|
l_0.rightUnit = l_0.targetRightUnit;
|
|
l_0.widthUnit = l_0.targetWidthUnit;
|
|
}
|
|
|
|
function $adjustVerticalConstraints(this$static, parentHeight, l_0){
|
|
var bottomPx, heightPx, topPx;
|
|
topPx = l_0.top_0 * $getUnitSize(this$static, l_0.topUnit, true);
|
|
bottomPx = l_0.bottom_0 * $getUnitSize(this$static, l_0.bottomUnit, true);
|
|
heightPx = l_0.height_0 * $getUnitSize(this$static, l_0.heightUnit, true);
|
|
if (l_0.setTop && !l_0.setTargetTop) {
|
|
l_0.setTop = false;
|
|
if (l_0.setHeight) {
|
|
l_0.setTargetBottom = true;
|
|
l_0.sourceBottom = (parentHeight - (topPx + heightPx)) / $getUnitSize(this$static, l_0.targetBottomUnit, true);
|
|
}
|
|
else {
|
|
l_0.setTargetHeight = true;
|
|
l_0.sourceHeight = (parentHeight - (topPx + bottomPx)) / $getUnitSize(this$static, l_0.targetHeightUnit, true);
|
|
}
|
|
}
|
|
else if (l_0.setHeight && !l_0.setTargetHeight) {
|
|
l_0.setHeight = false;
|
|
if (l_0.setTop) {
|
|
l_0.setTargetBottom = true;
|
|
l_0.sourceBottom = (parentHeight - (topPx + heightPx)) / $getUnitSize(this$static, l_0.targetBottomUnit, true);
|
|
}
|
|
else {
|
|
l_0.setTargetTop = true;
|
|
l_0.sourceTop = (parentHeight - (bottomPx + heightPx)) / $getUnitSize(this$static, l_0.targetTopUnit, true);
|
|
}
|
|
}
|
|
else if (l_0.setBottom && !l_0.setTargetBottom) {
|
|
l_0.setBottom = false;
|
|
if (l_0.setHeight) {
|
|
l_0.setTargetTop = true;
|
|
l_0.sourceTop = (parentHeight - (bottomPx + heightPx)) / $getUnitSize(this$static, l_0.targetTopUnit, true);
|
|
}
|
|
else {
|
|
l_0.setTargetHeight = true;
|
|
l_0.sourceHeight = (parentHeight - (topPx + bottomPx)) / $getUnitSize(this$static, l_0.targetHeightUnit, true);
|
|
}
|
|
}
|
|
l_0.setTop = l_0.setTargetTop;
|
|
l_0.setBottom = l_0.setTargetBottom;
|
|
l_0.setHeight = l_0.setTargetHeight;
|
|
l_0.topUnit = l_0.targetTopUnit;
|
|
l_0.bottomUnit = l_0.targetBottomUnit;
|
|
l_0.heightUnit = l_0.targetHeightUnit;
|
|
}
|
|
|
|
function $attachChild(this$static, child, userObject){
|
|
var container, layer;
|
|
container = $attachChild_0(this$static.parentElem, child);
|
|
layer = new Layout$Layer(container, child, userObject);
|
|
$add_8(this$static.layers, layer);
|
|
return layer;
|
|
}
|
|
|
|
function $getUnitSize(this$static, unit, vertical){
|
|
return $getUnitSizeInPixels(this$static.impl, this$static.parentElem, unit, vertical);
|
|
}
|
|
|
|
function $layout(this$static, duration, callback){
|
|
var child, l_0, l$iterator, l$iterator0, parentHeight, parentWidth;
|
|
!!this$static.animation && $cancel(this$static.animation);
|
|
if (duration == 0) {
|
|
for (l$iterator0 = new ArrayList$1(this$static.layers); l$iterator0.i < l$iterator0.this$01.array.length;) {
|
|
l_0 = $next_4(l$iterator0);
|
|
l_0.left_0 = l_0.sourceLeft = l_0.targetLeft;
|
|
l_0.top_0 = l_0.sourceTop = l_0.targetTop;
|
|
l_0.right = l_0.sourceRight = l_0.targetRight;
|
|
l_0.bottom_0 = l_0.sourceBottom = l_0.targetBottom;
|
|
l_0.width_0 = l_0.sourceWidth = l_0.targetWidth;
|
|
l_0.height_0 = l_0.sourceHeight = l_0.targetHeight;
|
|
l_0.setLeft = l_0.setTargetLeft;
|
|
l_0.setTop = l_0.setTargetTop;
|
|
l_0.setRight = l_0.setTargetRight;
|
|
l_0.setBottom = l_0.setTargetBottom;
|
|
l_0.setWidth = l_0.setTargetWidth;
|
|
l_0.setHeight = l_0.setTargetHeight;
|
|
l_0.leftUnit = l_0.targetLeftUnit;
|
|
l_0.topUnit = l_0.targetTopUnit;
|
|
l_0.rightUnit = l_0.targetRightUnit;
|
|
l_0.bottomUnit = l_0.targetBottomUnit;
|
|
l_0.widthUnit = l_0.targetWidthUnit;
|
|
l_0.heightUnit = l_0.targetHeightUnit;
|
|
$layout_0(l_0);
|
|
!!callback && (child = l_0.userObject , instanceOf(child, 209) && child.onResize_0());
|
|
}
|
|
return;
|
|
}
|
|
parentWidth = this$static.parentElem.clientWidth | 0;
|
|
parentHeight = this$static.parentElem.clientHeight | 0;
|
|
for (l$iterator = new ArrayList$1(this$static.layers); l$iterator.i < l$iterator.this$01.array.length;) {
|
|
l_0 = $next_4(l$iterator);
|
|
$adjustHorizontalConstraints(this$static, parentWidth, l_0);
|
|
$adjustVerticalConstraints(this$static, parentHeight, l_0);
|
|
}
|
|
this$static.animation = new Layout$1(this$static, callback);
|
|
$run_0(this$static.animation, duration, this$static.parentElem);
|
|
}
|
|
|
|
function $removeChild_0(this$static, layer){
|
|
$removeChild_1(layer.container, layer.child);
|
|
$remove_13(this$static.layers, layer);
|
|
}
|
|
|
|
function Layout(parent_0){
|
|
this.impl = new LayoutImpl;
|
|
this.layers = new ArrayList;
|
|
this.parentElem = parent_0;
|
|
$initParent(this.impl, parent_0);
|
|
}
|
|
|
|
defineClass(334, 1, {}, Layout);
|
|
var Lcom_google_gwt_layout_client_Layout_2_classLit = createForClass('com.google.gwt.layout.client', 'Layout', 334);
|
|
function Layout$1(this$0, val$callback){
|
|
this.this$01 = this$0;
|
|
this.val$callback2 = val$callback;
|
|
Animation.call(this);
|
|
}
|
|
|
|
defineClass(574, 287, {}, Layout$1);
|
|
_.onCancel = function onCancel_0(){
|
|
this.this$01.animation = null;
|
|
$layout(this.this$01, 0, null);
|
|
}
|
|
;
|
|
_.onComplete = function onComplete_0(){
|
|
this.this$01.animation = null;
|
|
$layout(this.this$01, 0, null);
|
|
}
|
|
;
|
|
_.onUpdate = function onUpdate(progress){
|
|
var child, l_0, l$iterator;
|
|
for (l$iterator = new ArrayList$1(this.this$01.layers); l$iterator.i < l$iterator.this$01.array.length;) {
|
|
l_0 = $next_4(l$iterator);
|
|
l_0.setTargetLeft && (l_0.left_0 = l_0.sourceLeft + (l_0.targetLeft - l_0.sourceLeft) * progress);
|
|
l_0.setTargetRight && (l_0.right = l_0.sourceRight + (l_0.targetRight - l_0.sourceRight) * progress);
|
|
l_0.setTargetTop && (l_0.top_0 = l_0.sourceTop + (l_0.targetTop - l_0.sourceTop) * progress);
|
|
l_0.setTargetBottom && (l_0.bottom_0 = l_0.sourceBottom + (l_0.targetBottom - l_0.sourceBottom) * progress);
|
|
l_0.setTargetWidth && (l_0.width_0 = l_0.sourceWidth + (l_0.targetWidth - l_0.sourceWidth) * progress);
|
|
l_0.setTargetHeight && (l_0.height_0 = l_0.sourceHeight + (l_0.targetHeight - l_0.sourceHeight) * progress);
|
|
$layout_0(l_0);
|
|
!!this.val$callback2 && (child = l_0.userObject , instanceOf(child, 209) && child.onResize_0());
|
|
}
|
|
}
|
|
;
|
|
var Lcom_google_gwt_layout_client_Layout$1_2_classLit = createForClass('com.google.gwt.layout.client', 'Layout/1', 574);
|
|
function $setBottomHeight(this$static, bottom, bottomUnit, height, heightUnit){
|
|
this$static.setTargetBottom = this$static.setTargetHeight = true;
|
|
this$static.setTargetTop = false;
|
|
this$static.targetBottom = bottom;
|
|
this$static.targetHeight = height;
|
|
this$static.targetBottomUnit = bottomUnit;
|
|
this$static.targetHeightUnit = heightUnit;
|
|
}
|
|
|
|
function $setLeftRight(this$static, left, leftUnit, right, rightUnit){
|
|
this$static.setTargetLeft = this$static.setTargetRight = true;
|
|
this$static.setTargetWidth = false;
|
|
this$static.targetLeft = left;
|
|
this$static.targetRight = right;
|
|
this$static.targetLeftUnit = leftUnit;
|
|
this$static.targetRightUnit = rightUnit;
|
|
}
|
|
|
|
function $setLeftWidth(this$static, left, leftUnit, width_0, widthUnit){
|
|
this$static.setTargetLeft = this$static.setTargetWidth = true;
|
|
this$static.setTargetRight = false;
|
|
this$static.targetLeft = left;
|
|
this$static.targetWidth = width_0;
|
|
this$static.targetLeftUnit = leftUnit;
|
|
this$static.targetWidthUnit = widthUnit;
|
|
}
|
|
|
|
function $setRightWidth(this$static, right, rightUnit, width_0, widthUnit){
|
|
this$static.setTargetRight = this$static.setTargetWidth = true;
|
|
this$static.setTargetLeft = false;
|
|
this$static.targetRight = right;
|
|
this$static.targetWidth = width_0;
|
|
this$static.targetRightUnit = rightUnit;
|
|
this$static.targetWidthUnit = widthUnit;
|
|
}
|
|
|
|
function $setTopBottom(this$static, top_0, topUnit, bottom, bottomUnit){
|
|
this$static.setTargetTop = this$static.setTargetBottom = true;
|
|
this$static.setTargetHeight = false;
|
|
this$static.targetTop = top_0;
|
|
this$static.targetBottom = bottom;
|
|
this$static.targetTopUnit = topUnit;
|
|
this$static.targetBottomUnit = bottomUnit;
|
|
}
|
|
|
|
function $setTopHeight(this$static, top_0, topUnit, height, heightUnit){
|
|
this$static.setTargetTop = this$static.setTargetHeight = true;
|
|
this$static.setTargetBottom = false;
|
|
this$static.targetTop = top_0;
|
|
this$static.targetHeight = height;
|
|
this$static.targetTopUnit = topUnit;
|
|
this$static.targetHeightUnit = heightUnit;
|
|
}
|
|
|
|
function Layout$Layer(container, child, userObject){
|
|
this.targetLeftUnit = ($clinit_Style$Unit() , PX);
|
|
this.targetTopUnit = PX;
|
|
this.targetRightUnit = PX;
|
|
this.targetBottomUnit = PX;
|
|
this.container = container;
|
|
this.child = child;
|
|
this.userObject = userObject;
|
|
}
|
|
|
|
defineClass(335, 1, {335:1}, Layout$Layer);
|
|
_.bottom_0 = 0;
|
|
_.height_0 = 0;
|
|
_.left_0 = 0;
|
|
_.right = 0;
|
|
_.setBottom = false;
|
|
_.setHeight = false;
|
|
_.setLeft = false;
|
|
_.setRight = false;
|
|
_.setTargetBottom = true;
|
|
_.setTargetHeight = false;
|
|
_.setTargetLeft = true;
|
|
_.setTargetRight = true;
|
|
_.setTargetTop = true;
|
|
_.setTargetWidth = false;
|
|
_.setTop = false;
|
|
_.setWidth = false;
|
|
_.sourceBottom = 0;
|
|
_.sourceHeight = 0;
|
|
_.sourceLeft = 0;
|
|
_.sourceRight = 0;
|
|
_.sourceTop = 0;
|
|
_.sourceWidth = 0;
|
|
_.targetBottom = 0;
|
|
_.targetHeight = 0;
|
|
_.targetLeft = 0;
|
|
_.targetRight = 0;
|
|
_.targetTop = 0;
|
|
_.targetWidth = 0;
|
|
_.top_0 = 0;
|
|
_.visible = true;
|
|
_.width_0 = 0;
|
|
var Lcom_google_gwt_layout_client_Layout$Layer_2_classLit = createForClass('com.google.gwt.layout.client', 'Layout/Layer', 335);
|
|
function $clinit_LayoutImpl(){
|
|
$clinit_LayoutImpl = emptyMethod;
|
|
fixedRuler = createRuler(($clinit_Style$Unit() , CM), CM);
|
|
$appendChild($doc.body, fixedRuler);
|
|
}
|
|
|
|
function $attachChild_0(parent_0, child){
|
|
var container;
|
|
container = $doc.createElement('div');
|
|
container.appendChild(child);
|
|
container.style['position'] = ($clinit_Style$Position() , 'absolute');
|
|
container.style['overflow'] = ($clinit_Style$Overflow() , 'hidden');
|
|
$fillParent(child);
|
|
parent_0.insertBefore(container, null);
|
|
return container;
|
|
}
|
|
|
|
function $fillParent(elem){
|
|
var style;
|
|
style = elem.style;
|
|
style['position'] = ($clinit_Style$Position() , 'absolute');
|
|
style['left'] = ($clinit_Style$Unit() , '0.0px');
|
|
style['top'] = '0.0px';
|
|
style['right'] = '0.0px';
|
|
style['bottom'] = '0.0px';
|
|
}
|
|
|
|
function $getUnitSizeInPixels(this$static, parent_0, unit, vertical){
|
|
if (!unit) {
|
|
return 1;
|
|
}
|
|
switch (unit.ordinal) {
|
|
case 1:
|
|
return (vertical?parent_0.clientHeight | 0:parent_0.clientWidth | 0) / 100;
|
|
case 2:
|
|
return ((this$static.relativeRuler.offsetWidth || 0) | 0) / 10;
|
|
case 3:
|
|
return ((this$static.relativeRuler.offsetHeight || 0) | 0) / 10;
|
|
case 7:
|
|
return ((fixedRuler.offsetWidth || 0) | 0) * 0.1;
|
|
case 8:
|
|
return ((fixedRuler.offsetWidth || 0) | 0) * $intern_34;
|
|
case 6:
|
|
return ((fixedRuler.offsetWidth || 0) | 0) * 0.254;
|
|
case 4:
|
|
return ((fixedRuler.offsetWidth || 0) | 0) * 0.00353;
|
|
case 5:
|
|
return ((fixedRuler.offsetWidth || 0) | 0) * 0.0423;
|
|
default:case 0:
|
|
return 1;
|
|
}
|
|
}
|
|
|
|
function $initParent(this$static, parent_0){
|
|
parent_0.style['position'] = ($clinit_Style$Position() , 'relative');
|
|
$appendChild(parent_0, this$static.relativeRuler = createRuler(($clinit_Style$Unit() , EM), EX));
|
|
}
|
|
|
|
function $layout_0(layer){
|
|
var style;
|
|
style = layer.container.style;
|
|
layer.visible?(style['display'] = '' , undefined):(style['display'] = ($clinit_Style$Display() , 'none') , undefined);
|
|
style['left'] = layer.setLeft?layer.left_0 + 'px':'';
|
|
style['top'] = layer.setTop?layer.top_0 + 'px':'';
|
|
style['right'] = layer.setRight?layer.right + 'px':'';
|
|
style['bottom'] = layer.setBottom?layer.bottom_0 + 'px':'';
|
|
style['width'] = layer.setWidth?layer.width_0 + 'px':'';
|
|
style['height'] = layer.setHeight?layer.height_0 + 'px':'';
|
|
style = layer.child.style;
|
|
switch (2) {
|
|
case 2:
|
|
style['left'] = ($clinit_Style$Unit() , '0.0px');
|
|
style['right'] = '0.0px';
|
|
}
|
|
switch (2) {
|
|
case 2:
|
|
style['top'] = ($clinit_Style$Unit() , '0.0px');
|
|
style['bottom'] = '0.0px';
|
|
}
|
|
}
|
|
|
|
function $removeChild_1(container, child){
|
|
var parent_0, parent0, style;
|
|
parent0 = $getParentElement(container);
|
|
!!parent0 && parent0.removeChild(container);
|
|
$getParentElement(child) == container && (parent_0 = $getParentElement(child) , !!parent_0 && parent_0.removeChild(child));
|
|
style = child.style;
|
|
style['position'] = '';
|
|
style['left'] = '';
|
|
style['top'] = '';
|
|
style['width'] = '';
|
|
style['height'] = '';
|
|
}
|
|
|
|
function LayoutImpl(){
|
|
$clinit_LayoutImpl();
|
|
}
|
|
|
|
function createRuler(widthUnit, heightUnit){
|
|
var ruler, style;
|
|
ruler = $doc.createElement('div');
|
|
ruler.innerHTML = ' ';
|
|
style = ruler.style;
|
|
style['position'] = ($clinit_Style$Position() , 'absolute');
|
|
style['zIndex'] = '-32767';
|
|
style['top'] = -20 + heightUnit.getType_0();
|
|
style['width'] = 10 + widthUnit.getType_0();
|
|
style['height'] = 10 + heightUnit.getType_0();
|
|
style['visibility'] = ($clinit_Style$Visibility() , 'hidden');
|
|
$set_0(($clinit_State() , HIDDEN), ruler, stampJavaTypeInfo(getClassLiteralForArray(Ljava_lang_Boolean_2_classLit, 1), $intern_3, 281, 8, [($clinit_Boolean() , true)]));
|
|
return ruler;
|
|
}
|
|
|
|
defineClass(796, 1, {}, LayoutImpl);
|
|
var fixedRuler;
|
|
var Lcom_google_gwt_layout_client_LayoutImpl_2_classLit = createForClass('com.google.gwt.layout.client', 'LayoutImpl', 796);
|
|
function $replace(this$static, input_0, replacement){
|
|
return input_0.replace(this$static, replacement);
|
|
}
|
|
|
|
function $test(this$static, input_0){
|
|
return this$static.test(input_0);
|
|
}
|
|
|
|
function ImageResourcePrototype(url_0){
|
|
this.left_0 = 0;
|
|
this.top_0 = 0;
|
|
this.height_0 = 9;
|
|
this.width_0 = 5;
|
|
this.url_0 = url_0;
|
|
}
|
|
|
|
defineClass(937, 1, {}, ImageResourcePrototype);
|
|
_.height_0 = 0;
|
|
_.left_0 = 0;
|
|
_.top_0 = 0;
|
|
_.width_0 = 0;
|
|
var Lcom_google_gwt_resources_client_impl_ImageResourcePrototype_2_classLit = createForClass('com.google.gwt.resources.client.impl', 'ImageResourcePrototype', 937);
|
|
function $append(this$static, styles){
|
|
$append_4(this$static.sb, styles.css);
|
|
return this$static;
|
|
}
|
|
|
|
function SafeStylesBuilder(){
|
|
this.sb = new StringBuilder;
|
|
}
|
|
|
|
defineClass(945, 1, {}, SafeStylesBuilder);
|
|
var Lcom_google_gwt_safecss_shared_SafeStylesBuilder_2_classLit = createForClass('com.google.gwt.safecss.shared', 'SafeStylesBuilder', 945);
|
|
function SafeStylesString(css){
|
|
verifySafeStylesConstraints(css);
|
|
this.css = css;
|
|
}
|
|
|
|
defineClass(205, 1, {1019:1, 205:1, 3:1}, SafeStylesString);
|
|
_.equals_0 = function equals_1(obj){
|
|
if (!instanceOf(obj, 205)) {
|
|
return false;
|
|
}
|
|
return $equals_1(this.css, obj.css);
|
|
}
|
|
;
|
|
_.hashCode_0 = function hashCode_3(){
|
|
return getHashCode_0(this.css);
|
|
}
|
|
;
|
|
var Lcom_google_gwt_safecss_shared_SafeStylesString_2_classLit = createForClass('com.google.gwt.safecss.shared', 'SafeStylesString', 205);
|
|
function verifySafeStylesConstraints(styles){
|
|
if (styles == null) {
|
|
throw toJs(new NullPointerException_0('css is null'));
|
|
}
|
|
}
|
|
|
|
function OnlyToBeUsedInGeneratedCodeStringBlessedAsSafeHtml(html){
|
|
if (html == null) {
|
|
throw toJs(new NullPointerException_0('html is null'));
|
|
}
|
|
this.html = html;
|
|
}
|
|
|
|
defineClass(949, 1, $intern_35, OnlyToBeUsedInGeneratedCodeStringBlessedAsSafeHtml);
|
|
_.asString = function asString(){
|
|
return this.html;
|
|
}
|
|
;
|
|
_.equals_0 = function equals_2(obj){
|
|
if (!instanceOf(obj, 458)) {
|
|
return false;
|
|
}
|
|
return $equals_1(this.html, obj.asString());
|
|
}
|
|
;
|
|
_.hashCode_0 = function hashCode_4(){
|
|
return getHashCode_0(this.html);
|
|
}
|
|
;
|
|
var Lcom_google_gwt_safehtml_shared_OnlyToBeUsedInGeneratedCodeStringBlessedAsSafeHtml_2_classLit = createForClass('com.google.gwt.safehtml.shared', 'OnlyToBeUsedInGeneratedCodeStringBlessedAsSafeHtml', 949);
|
|
function SafeHtmlString(html){
|
|
if (html == null) {
|
|
throw toJs(new NullPointerException_0('html is null'));
|
|
}
|
|
this.html = html;
|
|
}
|
|
|
|
defineClass(109, 1, $intern_35, SafeHtmlString);
|
|
_.asString = function asString_0(){
|
|
return this.html;
|
|
}
|
|
;
|
|
_.equals_0 = function equals_3(obj){
|
|
if (!instanceOf(obj, 458)) {
|
|
return false;
|
|
}
|
|
return $equals_1(this.html, obj.asString());
|
|
}
|
|
;
|
|
_.hashCode_0 = function hashCode_5(){
|
|
return getHashCode_0(this.html);
|
|
}
|
|
;
|
|
_.toString_0 = function toString_10(){
|
|
return 'safe: "' + this.html + '"';
|
|
}
|
|
;
|
|
var Lcom_google_gwt_safehtml_shared_SafeHtmlString_2_classLit = createForClass('com.google.gwt.safehtml.shared', 'SafeHtmlString', 109);
|
|
function $clinit_SafeHtmlUtils(){
|
|
$clinit_SafeHtmlUtils = emptyMethod;
|
|
new SafeHtmlString('');
|
|
HTML_CHARS_RE = new RegExp('[&<>\'"]');
|
|
AMP_RE = new RegExp('&', 'g');
|
|
GT_RE = new RegExp('>', 'g');
|
|
LT_RE = new RegExp('<', 'g');
|
|
SQUOT_RE = new RegExp("'", 'g');
|
|
QUOT_RE = new RegExp('"', 'g');
|
|
}
|
|
|
|
function htmlEscape(s){
|
|
$clinit_SafeHtmlUtils();
|
|
if (!$test(HTML_CHARS_RE, s)) {
|
|
return s;
|
|
}
|
|
s.indexOf('&') != -1 && (s = $replace(AMP_RE, s, '&'));
|
|
s.indexOf('<') != -1 && (s = $replace(LT_RE, s, '<'));
|
|
s.indexOf('>') != -1 && (s = $replace(GT_RE, s, '>'));
|
|
s.indexOf('"') != -1 && (s = $replace(QUOT_RE, s, '"'));
|
|
s.indexOf("'") != -1 && (s = $replace(SQUOT_RE, s, '''));
|
|
return s;
|
|
}
|
|
|
|
var AMP_RE, GT_RE, HTML_CHARS_RE, LT_RE, QUOT_RE, SQUOT_RE;
|
|
function SafeUriString(uri_0){
|
|
this.uri_0 = uri_0;
|
|
}
|
|
|
|
defineClass(277, 1, {1015:1, 277:1}, SafeUriString);
|
|
_.equals_0 = function equals_4(obj){
|
|
if (!instanceOf(obj, 277)) {
|
|
return false;
|
|
}
|
|
return $equals_1(this.uri_0, obj.uri_0);
|
|
}
|
|
;
|
|
_.hashCode_0 = function hashCode_6(){
|
|
return getHashCode_0(this.uri_0);
|
|
}
|
|
;
|
|
_.toString_0 = function toString_11(){
|
|
return 'safe: "' + this.uri_0 + '"';
|
|
}
|
|
;
|
|
var Lcom_google_gwt_safehtml_shared_SafeUriString_2_classLit = createForClass('com.google.gwt.safehtml.shared', 'SafeUriString', 277);
|
|
function $clinit_UriUtils(){
|
|
$clinit_UriUtils = emptyMethod;
|
|
new RegExp('%5B', 'g');
|
|
new RegExp('%5D', 'g');
|
|
}
|
|
|
|
function $getItem(this$static, key){
|
|
return $getItem_0(this$static.storage, key);
|
|
}
|
|
|
|
function $removeItem(this$static, key){
|
|
$removeItem_0(this$static.storage, key);
|
|
}
|
|
|
|
function $setItem(this$static, key, data_0){
|
|
$setItem_0(this$static.storage, key, data_0);
|
|
}
|
|
|
|
function Storage_0(storage){
|
|
this.storage = storage;
|
|
}
|
|
|
|
defineClass(68, 1, {}, Storage_0);
|
|
var localStorage_0, sessionStorage_0;
|
|
var Lcom_google_gwt_storage_client_Storage_2_classLit = createForClass('com.google.gwt.storage.client', 'Storage', 68);
|
|
function $clinit_Storage$StorageSupportDetector(){
|
|
$clinit_Storage$StorageSupportDetector = emptyMethod;
|
|
localStorageSupported = checkStorageSupport('localStorage');
|
|
sessionStorageSupported = checkStorageSupport('sessionStorage');
|
|
}
|
|
|
|
function checkStorageSupport(storage){
|
|
var c = '_gwt_dummy_';
|
|
try {
|
|
$wnd[storage].setItem(c, c);
|
|
$wnd[storage].removeItem(c);
|
|
return true;
|
|
}
|
|
catch (e) {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
var localStorageSupported = false, sessionStorageSupported = false;
|
|
function $getItem_0(storage, key){
|
|
return $wnd[storage].getItem(key);
|
|
}
|
|
|
|
function $getLength(storage){
|
|
return $wnd[storage].length;
|
|
}
|
|
|
|
function $key(storage, index_0){
|
|
return index_0 >= 0 && index_0 < $wnd[storage].length?$wnd[storage].key(index_0):null;
|
|
}
|
|
|
|
function $removeItem_0(storage, key){
|
|
$wnd[storage].getItem(key);
|
|
$wnd[storage].removeItem(key);
|
|
}
|
|
|
|
function $setItem_0(storage, key, data_0){
|
|
$wnd[storage].getItem(key);
|
|
$wnd[storage].setItem(key, data_0);
|
|
}
|
|
|
|
defineClass(991, 1, {});
|
|
var Lcom_google_gwt_text_shared_AbstractRenderer_2_classLit = createForClass('com.google.gwt.text.shared', 'AbstractRenderer', 991);
|
|
function PassthroughParser(){
|
|
}
|
|
|
|
defineClass(830, 1, {}, PassthroughParser);
|
|
var INSTANCE_0;
|
|
var Lcom_google_gwt_text_shared_testing_PassthroughParser_2_classLit = createForClass('com.google.gwt.text.shared.testing', 'PassthroughParser', 830);
|
|
function PassthroughRenderer(){
|
|
}
|
|
|
|
defineClass(829, 991, {}, PassthroughRenderer);
|
|
var INSTANCE_1;
|
|
var Lcom_google_gwt_text_shared_testing_PassthroughRenderer_2_classLit = createForClass('com.google.gwt.text.shared.testing', 'PassthroughRenderer', 829);
|
|
function $calcNewVelocity(initialVelocity, decelFactor, oldVelocity, minDecel){
|
|
var maxVelocityX, minVelocityX, newVelocity;
|
|
newVelocity = initialVelocity * decelFactor;
|
|
if (oldVelocity >= 0) {
|
|
maxVelocityX = $wnd.Math.max(0, oldVelocity - minDecel);
|
|
newVelocity = $wnd.Math.min(newVelocity, maxVelocityX);
|
|
}
|
|
else {
|
|
minVelocityX = $wnd.Math.min(0, oldVelocity + minDecel);
|
|
newVelocity = $wnd.Math.max(newVelocity, minVelocityX);
|
|
}
|
|
return newVelocity;
|
|
}
|
|
|
|
function $updateState(state){
|
|
var decelFactor, dist, elapsedMillis, ellapsedMillis, initialVelocity, minDecel, newVelocity, newVelocityX, newVelocityY, oldVelocity, position, totalEllapsedMillis;
|
|
ellapsedMillis = state.elapsedMillis;
|
|
totalEllapsedMillis = state.cumulativeElapsedMillis;
|
|
initialVelocity = state.initialVelocity;
|
|
oldVelocity = state.velocity;
|
|
decelFactor = $wnd.Math.pow(0.9993, totalEllapsedMillis);
|
|
minDecel = ellapsedMillis * 5.0E-4;
|
|
newVelocityX = $calcNewVelocity(initialVelocity.x_0, decelFactor, oldVelocity.x_0, minDecel);
|
|
newVelocityY = $calcNewVelocity(initialVelocity.y_0, decelFactor, oldVelocity.y_0, minDecel);
|
|
newVelocity = new Point(newVelocityX, newVelocityY);
|
|
state.velocity = newVelocity;
|
|
elapsedMillis = state.elapsedMillis;
|
|
dist = $mult(newVelocity, new Point(elapsedMillis, elapsedMillis));
|
|
position = state.position;
|
|
$setPosition(state, new Point(position.x_0 + dist.x_0, position.y_0 + dist.y_0));
|
|
if ($wnd.Math.abs(newVelocity.x_0) < $intern_36 && $wnd.Math.abs(newVelocity.y_0) < $intern_36) {
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
function DefaultMomentum(){
|
|
}
|
|
|
|
defineClass(946, 1, {}, DefaultMomentum);
|
|
var Lcom_google_gwt_touch_client_DefaultMomentum_2_classLit = createForClass('com.google.gwt.touch.client', 'DefaultMomentum', 946);
|
|
function $setCumulativeElapsedMillis(this$static, cumulativeElapsedMillis){
|
|
this$static.cumulativeElapsedMillis = cumulativeElapsedMillis;
|
|
}
|
|
|
|
function $setElapsedMillis(this$static, elapsedMillis){
|
|
this$static.elapsedMillis = elapsedMillis;
|
|
}
|
|
|
|
function $setPosition(this$static, position){
|
|
this$static.position = position;
|
|
}
|
|
|
|
function Momentum$State(initialPosition, initialVelocity){
|
|
this.initialVelocity = initialVelocity;
|
|
this.position = new Point_0(initialPosition);
|
|
this.velocity = new Point_0(initialVelocity);
|
|
}
|
|
|
|
defineClass(947, 1, {}, Momentum$State);
|
|
_.cumulativeElapsedMillis = 0;
|
|
_.elapsedMillis = 0;
|
|
var Lcom_google_gwt_touch_client_Momentum$State_2_classLit = createForClass('com.google.gwt.touch.client', 'Momentum/State', 947);
|
|
function $minus(this$static, c){
|
|
return new Point(this$static.x_0 - c.x_0, this$static.y_0 - c.y_0);
|
|
}
|
|
|
|
function $mult(this$static, c){
|
|
return new Point(this$static.x_0 * c.x_0, this$static.y_0 * c.y_0);
|
|
}
|
|
|
|
function $plus(this$static, c){
|
|
return new Point(this$static.x_0 + c.x_0, this$static.y_0 + c.y_0);
|
|
}
|
|
|
|
function Point(x_0, y_0){
|
|
this.x_0 = x_0;
|
|
this.y_0 = y_0;
|
|
}
|
|
|
|
function Point_0(c){
|
|
Point.call(this, c.x_0, c.y_0);
|
|
}
|
|
|
|
defineClass(112, 1, {112:1}, Point, Point_0);
|
|
_.equals_0 = function equals_5(obj){
|
|
var c;
|
|
if (!instanceOf(obj, 112)) {
|
|
return false;
|
|
}
|
|
c = obj;
|
|
return this.x_0 == c.x_0 && this.y_0 == c.y_0;
|
|
}
|
|
;
|
|
_.hashCode_0 = function hashCode_7(){
|
|
return round_int(this.x_0) ^ round_int(this.y_0);
|
|
}
|
|
;
|
|
_.toString_0 = function toString_12(){
|
|
return 'Point(' + this.x_0 + ',' + this.y_0 + ')';
|
|
}
|
|
;
|
|
_.x_0 = 0;
|
|
_.y_0 = 0;
|
|
var Lcom_google_gwt_touch_client_Point_2_classLit = createForClass('com.google.gwt.touch.client', 'Point', 112);
|
|
function $calculateEndVelocity(from, to){
|
|
var dist, time;
|
|
time = to.time - from.time;
|
|
if (time <= 0) {
|
|
return null;
|
|
}
|
|
dist = $minus(from.point, to.point);
|
|
return new Point(dist.x_0 / time, dist.y_0 / time);
|
|
}
|
|
|
|
function $cancelAll(this$static){
|
|
this$static.touching = false;
|
|
this$static.dragging = false;
|
|
this$static.momentumCommand = null;
|
|
}
|
|
|
|
function $getWidgetScrollPosition(this$static){
|
|
return new Point($getHorizontalScrollPosition(this$static.widget), $getVerticalScrollPosition(this$static.widget));
|
|
}
|
|
|
|
function $hitTest(point1, point2){
|
|
var absDiffX, absDiffY, diff;
|
|
diff = new Point(point1.x_0 - point2.x_0, point1.y_0 - point2.y_0);
|
|
absDiffX = $wnd.Math.abs(diff.x_0);
|
|
absDiffY = $wnd.Math.abs(diff.y_0);
|
|
return absDiffX <= 25 && absDiffY <= 25;
|
|
}
|
|
|
|
function $isClickScrollTriggeringTouch(this$static, clickPoint){
|
|
if (this$static.recentScrollTriggeringTouchPosition.point) {
|
|
return $hitTest(clickPoint, this$static.recentScrollTriggeringTouchPosition.point);
|
|
}
|
|
return false;
|
|
}
|
|
|
|
function $isClickTouchPositionDuringMomentum(this$static, clickPoint){
|
|
var currentTime, point, point$iterator, same;
|
|
currentTime = now_1();
|
|
same = false;
|
|
for (point$iterator = new ArrayList$1(this$static.touchPositionsDuringMomentum); point$iterator.i < point$iterator.this$01.array.length;) {
|
|
point = $next_4(point$iterator);
|
|
if (currentTime - point.time <= 2500 && $hitTest(clickPoint, point.point)) {
|
|
same = true;
|
|
break;
|
|
}
|
|
}
|
|
return same;
|
|
}
|
|
|
|
function $onDragEnd(this$static){
|
|
var endVelocity;
|
|
if (!this$static.momentum) {
|
|
return;
|
|
}
|
|
endVelocity = $calculateEndVelocity(this$static.recentTouchPosition, this$static.lastTouchPosition);
|
|
if (endVelocity) {
|
|
this$static.momentumCommand = new TouchScroller$MomentumCommand(this$static, endVelocity);
|
|
scheduleFixedDelayImpl(($clinit_SchedulerImpl() , this$static.momentumCommand), 16);
|
|
}
|
|
}
|
|
|
|
function $onTouchEnd(this$static){
|
|
if (!this$static.touching) {
|
|
return;
|
|
}
|
|
this$static.touching = false;
|
|
if (this$static.dragging) {
|
|
this$static.dragging = false;
|
|
$onDragEnd(this$static);
|
|
}
|
|
}
|
|
|
|
function $onTouchMove(this$static, event_0){
|
|
var absDiffX, absDiffY, diff, hMax, hMin, hPosition, touch, touchPoint, touchTime, touches, trackingTime, vMax, vPosition, diff_0, curScrollPosition;
|
|
if (!this$static.touching) {
|
|
return;
|
|
}
|
|
touch = (touches = event_0.nativeEvent.touches , touches.length > 0?touches[0]:null);
|
|
touchPoint = new Point((touch.pageX || 0) | 0, (touch.pageY || 0) | 0);
|
|
touchTime = now_1();
|
|
$setTemporalPoint(this$static.lastTouchPosition, touchPoint, touchTime);
|
|
if (!this$static.dragging) {
|
|
diff = $minus(touchPoint, this$static.startTouchPosition);
|
|
absDiffX = $wnd.Math.abs(diff.x_0);
|
|
absDiffY = $wnd.Math.abs(diff.y_0);
|
|
if (absDiffX > 5 || absDiffY > 5) {
|
|
$setTemporalPoint(this$static.recentScrollTriggeringTouchPosition, this$static.recentTouchPosition.point, this$static.recentTouchPosition.time);
|
|
if (absDiffX > absDiffY) {
|
|
hPosition = $getHorizontalScrollPosition(this$static.widget);
|
|
hMin = $getMinimumHorizontalScrollPosition_0(this$static.widget);
|
|
hMax = $getMaximumHorizontalScrollPosition_0(this$static.widget);
|
|
if (diff.x_0 < 0 && hMax <= hPosition) {
|
|
$cancelAll(this$static);
|
|
return;
|
|
}
|
|
else if (diff.x_0 > 0 && hMin >= hPosition) {
|
|
$cancelAll(this$static);
|
|
return;
|
|
}
|
|
}
|
|
else {
|
|
vPosition = $getVerticalScrollPosition(this$static.widget);
|
|
vMax = $getMaximumVerticalScrollPosition(this$static.widget);
|
|
if (diff.y_0 < 0 && vMax <= vPosition) {
|
|
$cancelAll(this$static);
|
|
return;
|
|
}
|
|
else if (diff.y_0 > 0 && 0 >= vPosition) {
|
|
$cancelAll(this$static);
|
|
return;
|
|
}
|
|
}
|
|
this$static.dragging = true;
|
|
}
|
|
}
|
|
!!event_0.nativeEvent && (event_0.nativeEvent.preventDefault() , undefined);
|
|
if (this$static.dragging) {
|
|
diff_0 = $minus(this$static.startTouchPosition, this$static.lastTouchPosition.point);
|
|
curScrollPosition = $plus(this$static.startScrollPosition, diff_0);
|
|
$setHorizontalScrollPosition(this$static.widget, round_int(curScrollPosition.x_0));
|
|
$setVerticalScrollPosition(this$static.widget, round_int(curScrollPosition.y_0));
|
|
trackingTime = touchTime - this$static.recentTouchPosition.time;
|
|
if (trackingTime > 200 && !!this$static.recentTouchPositionOnDeck) {
|
|
$setTemporalPoint(this$static.recentTouchPosition, this$static.recentTouchPositionOnDeck.point, this$static.recentTouchPositionOnDeck.time);
|
|
this$static.recentTouchPositionOnDeck = null;
|
|
}
|
|
else
|
|
trackingTime > 100 && !this$static.recentTouchPositionOnDeck && (this$static.recentTouchPositionOnDeck = new TouchScroller$TemporalPoint_0(touchPoint, touchTime));
|
|
}
|
|
}
|
|
|
|
function $onTouchStart(this$static, event_0){
|
|
var startTouchTime, touch, touches;
|
|
$setTemporalPoint(this$static.recentScrollTriggeringTouchPosition, null, 0);
|
|
if (this$static.touching) {
|
|
return;
|
|
}
|
|
touch = (touches = event_0.nativeEvent.touches , touches.length > 0?touches[0]:null);
|
|
this$static.startTouchPosition = new Point((touch.pageX || 0) | 0, (touch.pageY || 0) | 0);
|
|
startTouchTime = now_1();
|
|
$setTemporalPoint(this$static.recentTouchPosition, this$static.startTouchPosition, startTouchTime);
|
|
$setTemporalPoint(this$static.lastTouchPosition, this$static.startTouchPosition, startTouchTime);
|
|
this$static.recentTouchPositionOnDeck = null;
|
|
if (this$static.momentumCommand) {
|
|
$add_8(this$static.touchPositionsDuringMomentum, new TouchScroller$TemporalPoint_0(this$static.startTouchPosition, startTouchTime));
|
|
scheduleFixedDelayImpl(($clinit_SchedulerImpl() , this$static.momentumTouchRemovalCommand), 2500);
|
|
}
|
|
this$static.startScrollPosition = new Point($getHorizontalScrollPosition(this$static.widget), $getVerticalScrollPosition(this$static.widget));
|
|
$cancelAll(this$static);
|
|
this$static.touching = true;
|
|
}
|
|
|
|
function $removeAttachHandler(this$static){
|
|
if (this$static.attachHandlerReg) {
|
|
$removeHandler(this$static.attachHandlerReg.real);
|
|
this$static.attachHandlerReg = null;
|
|
}
|
|
}
|
|
|
|
function $removeBustClickHandler(this$static){
|
|
if (this$static.bustClickHandlerReg) {
|
|
$removeHandler(this$static.bustClickHandlerReg.real);
|
|
this$static.bustClickHandlerReg = null;
|
|
}
|
|
}
|
|
|
|
function $setMomentum(this$static, momentum){
|
|
this$static.momentum = momentum;
|
|
}
|
|
|
|
function $setTargetWidget(this$static, widget){
|
|
var reg, reg$iterator;
|
|
if (this$static.widget == widget) {
|
|
return;
|
|
}
|
|
$cancelAll(this$static);
|
|
for (reg$iterator = new ArrayList$1(this$static.handlerRegs); reg$iterator.i < reg$iterator.this$01.array.length;) {
|
|
reg = $next_4(reg$iterator);
|
|
$removeHandler(reg.real);
|
|
}
|
|
this$static.handlerRegs.array = initUnidimensionalArray(Ljava_lang_Object_2_classLit, $intern_3, 1, 0, 5, 1);
|
|
$removeAttachHandler(this$static);
|
|
$removeBustClickHandler(this$static);
|
|
this$static.widget = widget;
|
|
widget.attached && ($removeBustClickHandler(this$static) , this$static.bustClickHandlerReg = addNativePreviewHandler(new TouchScroller$6(this$static)));
|
|
this$static.attachHandlerReg = $addHandler(widget, new TouchScroller$1(this$static), (!TYPE_17 && (TYPE_17 = new GwtEvent$Type) , TYPE_17));
|
|
$add_8(this$static.handlerRegs, $addDomHandler(widget, new TouchScroller$2(this$static), ($clinit_TouchStartEvent() , $clinit_TouchStartEvent() , TYPE_16)));
|
|
$add_8(this$static.handlerRegs, $addDomHandler(widget, new TouchScroller$3(this$static), ($clinit_TouchMoveEvent() , $clinit_TouchMoveEvent() , TYPE_15)));
|
|
$add_8(this$static.handlerRegs, $addDomHandler(widget, new TouchScroller$4(this$static), ($clinit_TouchEndEvent() , $clinit_TouchEndEvent() , TYPE_14)));
|
|
$add_8(this$static.handlerRegs, $addDomHandler(widget, new TouchScroller$5(this$static), ($clinit_TouchCancelEvent() , $clinit_TouchCancelEvent() , TYPE_13)));
|
|
}
|
|
|
|
function $setWidgetScrollPosition(this$static, position){
|
|
$setHorizontalScrollPosition(this$static.widget, round_int(position.x_0));
|
|
$setVerticalScrollPosition(this$static.widget, round_int(position.y_0));
|
|
}
|
|
|
|
function $setupBustClickHandler(this$static){
|
|
$removeBustClickHandler(this$static);
|
|
this$static.bustClickHandlerReg = addNativePreviewHandler(new TouchScroller$6(this$static));
|
|
}
|
|
|
|
function TouchScroller(){
|
|
this.handlerRegs = new ArrayList;
|
|
this.lastTouchPosition = new TouchScroller$TemporalPoint;
|
|
this.recentTouchPosition = new TouchScroller$TemporalPoint;
|
|
this.recentScrollTriggeringTouchPosition = new TouchScroller$TemporalPoint;
|
|
this.touchPositionsDuringMomentum = new ArrayList;
|
|
this.momentumTouchRemovalCommand = new TouchScroller$MomentumTouchRemovalCommand(this);
|
|
$setMomentum(this, new DefaultMomentum);
|
|
}
|
|
|
|
defineClass(906, 1, {}, TouchScroller);
|
|
_.dragging = false;
|
|
_.touching = false;
|
|
var isSupported;
|
|
var Lcom_google_gwt_touch_client_TouchScroller_2_classLit = createForClass('com.google.gwt.touch.client', 'TouchScroller', 906);
|
|
function TouchScroller$1(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(910, 1, {1016:1, 11:1}, TouchScroller$1);
|
|
var Lcom_google_gwt_touch_client_TouchScroller$1_2_classLit = createForClass('com.google.gwt.touch.client', 'TouchScroller/1', 910);
|
|
function TouchScroller$2(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(911, 1, $intern_37, TouchScroller$2);
|
|
_.onTouchStart = function onTouchStart(event_0){
|
|
$onTouchStart(this.this$01, event_0);
|
|
}
|
|
;
|
|
var Lcom_google_gwt_touch_client_TouchScroller$2_2_classLit = createForClass('com.google.gwt.touch.client', 'TouchScroller/2', 911);
|
|
function TouchScroller$3(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(912, 1, {1000:1, 11:1}, TouchScroller$3);
|
|
_.onTouchMove = function onTouchMove(event_0){
|
|
$onTouchMove(this.this$01, event_0);
|
|
}
|
|
;
|
|
var Lcom_google_gwt_touch_client_TouchScroller$3_2_classLit = createForClass('com.google.gwt.touch.client', 'TouchScroller/3', 912);
|
|
function TouchScroller$4(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(913, 1, $intern_38, TouchScroller$4);
|
|
_.onTouchEnd = function onTouchEnd(event_0){
|
|
$onTouchEnd(this.this$01);
|
|
}
|
|
;
|
|
var Lcom_google_gwt_touch_client_TouchScroller$4_2_classLit = createForClass('com.google.gwt.touch.client', 'TouchScroller/4', 913);
|
|
function TouchScroller$5(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(914, 1, $intern_39, TouchScroller$5);
|
|
_.onTouchCancel = function onTouchCancel(event_0){
|
|
$onTouchEnd(this.this$01);
|
|
}
|
|
;
|
|
var Lcom_google_gwt_touch_client_TouchScroller$5_2_classLit = createForClass('com.google.gwt.touch.client', 'TouchScroller/5', 914);
|
|
function TouchScroller$6(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(447, 1, $intern_40, TouchScroller$6);
|
|
_.onPreviewNativeEvent = function onPreviewNativeEvent(event_0){
|
|
var clickPoint;
|
|
if (1 == $getTypeInt(event_0.nativeEvent)) {
|
|
clickPoint = new Point((event_0.nativeEvent.clientX || 0) | 0, (event_0.nativeEvent.clientY || 0) | 0);
|
|
if ($isClickScrollTriggeringTouch(this.this$01, clickPoint) || $isClickTouchPositionDuringMomentum(this.this$01, clickPoint)) {
|
|
event_0.isCanceled = true;
|
|
event_0.nativeEvent.stopPropagation();
|
|
event_0.nativeEvent.preventDefault();
|
|
}
|
|
}
|
|
}
|
|
;
|
|
var Lcom_google_gwt_touch_client_TouchScroller$6_2_classLit = createForClass('com.google.gwt.touch.client', 'TouchScroller/6', 447);
|
|
function $finish(this$static){
|
|
if (this$static.windowResizeHandler) {
|
|
$removeHandler(this$static.windowResizeHandler.real);
|
|
this$static.windowResizeHandler = null;
|
|
}
|
|
this$static == this$static.this$01.momentumCommand && (this$static.this$01.momentumCommand = null);
|
|
}
|
|
|
|
function TouchScroller$MomentumCommand(this$0, endVelocity){
|
|
this.this$01 = this$0;
|
|
this.duration = new Duration;
|
|
this.initialPosition = $getWidgetScrollPosition(this.this$01);
|
|
this.state = new Momentum$State(this.initialPosition, endVelocity);
|
|
this.windowResizeHandler = addResizeHandler(new TouchScroller$MomentumCommand$1(this));
|
|
}
|
|
|
|
defineClass(907, 1, {}, TouchScroller$MomentumCommand);
|
|
_.execute_0 = function execute_3(){
|
|
var cumulativeElapsedMillis, hMax, hMin, hPos, notDone, vMax, vPos;
|
|
if (this != this.this$01.momentumCommand) {
|
|
$finish(this);
|
|
return false;
|
|
}
|
|
cumulativeElapsedMillis = $elapsedMillis(this.duration);
|
|
$setElapsedMillis(this.state, cumulativeElapsedMillis - this.lastElapsedMillis);
|
|
this.lastElapsedMillis = cumulativeElapsedMillis;
|
|
$setCumulativeElapsedMillis(this.state, cumulativeElapsedMillis);
|
|
notDone = $updateState(this.state);
|
|
notDone || $finish(this);
|
|
$setWidgetScrollPosition(this.this$01, this.state.position);
|
|
hPos = round_int(this.state.position.x_0);
|
|
hMin = $getMinimumHorizontalScrollPosition_0(this.this$01.widget);
|
|
hMax = $getMaximumHorizontalScrollPosition_0(this.this$01.widget);
|
|
vMax = $getMaximumVerticalScrollPosition(this.this$01.widget);
|
|
vPos = round_int(this.state.position.y_0);
|
|
if ((vMax <= vPos || 0 >= vPos) && (hMax <= hPos || hMin >= hPos)) {
|
|
$finish(this);
|
|
return false;
|
|
}
|
|
return notDone;
|
|
}
|
|
;
|
|
_.lastElapsedMillis = 0;
|
|
var Lcom_google_gwt_touch_client_TouchScroller$MomentumCommand_2_classLit = createForClass('com.google.gwt.touch.client', 'TouchScroller/MomentumCommand', 907);
|
|
function TouchScroller$MomentumCommand$1(this$1){
|
|
this.this$11 = this$1;
|
|
}
|
|
|
|
defineClass(909, 1, $intern_41, TouchScroller$MomentumCommand$1);
|
|
_.onResize = function onResize(event_0){
|
|
$finish(this.this$11);
|
|
}
|
|
;
|
|
var Lcom_google_gwt_touch_client_TouchScroller$MomentumCommand$1_2_classLit = createForClass('com.google.gwt.touch.client', 'TouchScroller/MomentumCommand/1', 909);
|
|
function TouchScroller$MomentumTouchRemovalCommand(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(908, 1, {}, TouchScroller$MomentumTouchRemovalCommand);
|
|
_.execute_0 = function execute_4(){
|
|
var currentTime, iter, point;
|
|
currentTime = now_1();
|
|
iter = new ArrayList$1(this.this$01.touchPositionsDuringMomentum);
|
|
while (iter.i < iter.this$01.array.length) {
|
|
point = $next_4(iter);
|
|
currentTime - point.time >= 2500 && $remove_14(iter);
|
|
}
|
|
return this.this$01.touchPositionsDuringMomentum.array.length != 0;
|
|
}
|
|
;
|
|
var Lcom_google_gwt_touch_client_TouchScroller$MomentumTouchRemovalCommand_2_classLit = createForClass('com.google.gwt.touch.client', 'TouchScroller/MomentumTouchRemovalCommand', 908);
|
|
function $setTemporalPoint(this$static, point, time){
|
|
this$static.point = point;
|
|
this$static.time = time;
|
|
}
|
|
|
|
function TouchScroller$TemporalPoint(){
|
|
}
|
|
|
|
function TouchScroller$TemporalPoint_0(point, time){
|
|
this.point = point;
|
|
this.time = time;
|
|
}
|
|
|
|
defineClass(226, 1, {226:1}, TouchScroller$TemporalPoint, TouchScroller$TemporalPoint_0);
|
|
_.time = 0;
|
|
var Lcom_google_gwt_touch_client_TouchScroller$TemporalPoint_2_classLit = createForClass('com.google.gwt.touch.client', 'TouchScroller/TemporalPoint', 226);
|
|
defineClass(950, 1, {11:1});
|
|
var Lcom_google_gwt_user_client_BaseListenerWrapper_2_classLit = createForClass('com.google.gwt.user.client', 'BaseListenerWrapper', 950);
|
|
function $clinit_DOM(){
|
|
$clinit_DOM = emptyMethod;
|
|
$clinit_DOMImplStandard();
|
|
}
|
|
|
|
function dispatchEvent_0(evt, elem){
|
|
$clinit_DOM();
|
|
var eventListener;
|
|
eventListener = getEventListener(elem);
|
|
if (!eventListener) {
|
|
return false;
|
|
}
|
|
dispatchEvent_1(evt, elem, eventListener);
|
|
return true;
|
|
}
|
|
|
|
function dispatchEvent_1(evt, elem, listener){
|
|
$clinit_DOM();
|
|
var prevCurrentEvent;
|
|
prevCurrentEvent = currentEvent;
|
|
currentEvent = evt;
|
|
elem == sCaptureElem && $eventGetTypeInt(evt.type) == 8192 && (sCaptureElem = null);
|
|
listener.onBrowserEvent(evt);
|
|
currentEvent = prevCurrentEvent;
|
|
}
|
|
|
|
function insertChild(parent_0, child, index_0){
|
|
$clinit_DOM();
|
|
$insertChild(parent_0, resolve(child), index_0);
|
|
}
|
|
|
|
function isPotential(o){
|
|
$clinit_DOM();
|
|
try {
|
|
return !!o && !!o.__gwt_resolve;
|
|
}
|
|
catch (e) {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
function previewEvent(evt){
|
|
$clinit_DOM();
|
|
var ret;
|
|
ret = fire_4(handlers_0, evt);
|
|
if (!ret && !!evt) {
|
|
evt.stopPropagation();
|
|
evt.preventDefault();
|
|
}
|
|
return ret;
|
|
}
|
|
|
|
function releaseCapture(elem){
|
|
$clinit_DOM();
|
|
!!sCaptureElem && elem == sCaptureElem && (sCaptureElem = null);
|
|
$maybeInitializeEventSystem();
|
|
($clinit_DOMImplStandard() , captureElem) == elem && (captureElem = null);
|
|
}
|
|
|
|
function resolve(maybePotential){
|
|
$clinit_DOM();
|
|
return maybePotential.__gwt_resolve?maybePotential.__gwt_resolve():maybePotential;
|
|
}
|
|
|
|
function setCapture(elem){
|
|
$clinit_DOM();
|
|
sCaptureElem = elem;
|
|
$maybeInitializeEventSystem();
|
|
$clinit_DOMImplStandard() , captureElem = elem;
|
|
}
|
|
|
|
function sinkEvents_0(elem, eventBits){
|
|
$clinit_DOM();
|
|
$maybeInitializeEventSystem();
|
|
$sinkEventsImpl(elem, eventBits);
|
|
}
|
|
|
|
var currentEvent = null, sCaptureElem;
|
|
function $onModuleLoad(){
|
|
var allowedModes, currentMode, i;
|
|
currentMode = $doc.compatMode;
|
|
allowedModes = stampJavaTypeInfo(getClassLiteralForArray(Ljava_lang_String_2_classLit, 1), $intern_23, 2, 6, ['CSS1Compat']);
|
|
for (i = 0; i < allowedModes.length; i++) {
|
|
if ($equals_1(allowedModes[i], currentMode)) {
|
|
return;
|
|
}
|
|
}
|
|
allowedModes.length == 1 && $equals_1('CSS1Compat', allowedModes[0]) && $equals_1('BackCompat', currentMode)?"GWT no longer supports Quirks Mode (document.compatMode=' BackCompat').<br>Make sure your application's host HTML page has a Standards Mode (document.compatMode=' CSS1Compat') doctype,<br>e.g. by using <!doctype html> at the start of your application's HTML page.<br><br>To continue using this unsupported rendering mode and risk layout problems, suppress this message by adding<br>the following line to your*.gwt.xml module file:<br> <extend-configuration-property name=\"document.compatMode\" value=\"" + currentMode + '"/>':"Your *.gwt.xml module configuration prohibits the use of the current document rendering mode (document.compatMode=' " + currentMode + "').<br>Modify your application's host HTML page doctype, or update your custom " + "'document.compatMode' configuration property settings.";
|
|
}
|
|
|
|
function $getTypeInt(this$static){
|
|
return $clinit_DOM() , $eventGetTypeInt(this$static.type);
|
|
}
|
|
|
|
function addNativePreviewHandler(handler){
|
|
$clinit_DOM();
|
|
$maybeInitializeEventSystem();
|
|
!TYPE_21 && (TYPE_21 = new GwtEvent$Type);
|
|
if (!handlers_0) {
|
|
handlers_0 = new HandlerManager_0(null, true);
|
|
singleton = new Event$NativePreviewEvent;
|
|
}
|
|
return $addHandler_0(handlers_0, TYPE_21, handler);
|
|
}
|
|
|
|
function getEventsSunk(elem){
|
|
return $clinit_DOM() , elem.__eventBits || 0;
|
|
}
|
|
|
|
function getTypeInt(typeName){
|
|
return $eventGetTypeInt(($clinit_DOM() , typeName));
|
|
}
|
|
|
|
function releaseCapture_0(elem){
|
|
$clinit_DOM();
|
|
!!sCaptureElem && elem == sCaptureElem && (sCaptureElem = null);
|
|
$maybeInitializeEventSystem();
|
|
($clinit_DOMImplStandard() , captureElem) == elem && (captureElem = null);
|
|
}
|
|
|
|
function setCapture_0(elem){
|
|
$clinit_DOM();
|
|
sCaptureElem = elem;
|
|
$maybeInitializeEventSystem();
|
|
$clinit_DOMImplStandard() , captureElem = elem;
|
|
}
|
|
|
|
function sinkEvents_1(elem, eventBits){
|
|
$clinit_DOM();
|
|
$maybeInitializeEventSystem();
|
|
$sinkEventsImpl(elem, eventBits);
|
|
}
|
|
|
|
var handlers_0;
|
|
function $revive(this$static){
|
|
this$static.dead = false;
|
|
this$static.source = null;
|
|
this$static.isCanceled = false;
|
|
this$static.isConsumed = false;
|
|
this$static.isFirstHandler = true;
|
|
this$static.nativeEvent = null;
|
|
}
|
|
|
|
function $setNativeEvent_0(this$static, nativeEvent){
|
|
this$static.nativeEvent = nativeEvent;
|
|
}
|
|
|
|
function Event$NativePreviewEvent(){
|
|
}
|
|
|
|
function fire_4(handlers, nativeEvent){
|
|
var lastIsCanceled, lastIsConsumed, lastIsFirstHandler, lastNativeEvent, ret;
|
|
if (!!TYPE_21 && !!handlers && $isEventHandled(handlers, TYPE_21)) {
|
|
lastIsCanceled = singleton.isCanceled;
|
|
lastIsConsumed = singleton.isConsumed;
|
|
lastIsFirstHandler = singleton.isFirstHandler;
|
|
lastNativeEvent = singleton.nativeEvent;
|
|
$revive(singleton);
|
|
$setNativeEvent_0(singleton, nativeEvent);
|
|
$fireEvent_0(handlers, singleton);
|
|
ret = !(singleton.isCanceled && !singleton.isConsumed);
|
|
singleton.isCanceled = lastIsCanceled;
|
|
singleton.isConsumed = lastIsConsumed;
|
|
singleton.isFirstHandler = lastIsFirstHandler;
|
|
singleton.nativeEvent = lastNativeEvent;
|
|
return ret;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
defineClass(483, 978, {}, Event$NativePreviewEvent);
|
|
_.dispatch = function dispatch_21(handler){
|
|
handler.onPreviewNativeEvent(this);
|
|
singleton.isFirstHandler = false;
|
|
}
|
|
;
|
|
_.getAssociatedType = function getAssociatedType_22(){
|
|
return TYPE_21;
|
|
}
|
|
;
|
|
_.revive = function revive_0(){
|
|
$revive(this);
|
|
}
|
|
;
|
|
_.isCanceled = false;
|
|
_.isConsumed = false;
|
|
_.isFirstHandler = false;
|
|
var TYPE_21, singleton;
|
|
var Lcom_google_gwt_user_client_Event$NativePreviewEvent_2_classLit = createForClass('com.google.gwt.user.client', 'Event/NativePreviewEvent', 483);
|
|
function $clinit_History(){
|
|
$clinit_History = emptyMethod;
|
|
new History$HistoryImpl;
|
|
historyEventSource = new History$HistoryEventSource;
|
|
token = getDecodedHash();
|
|
}
|
|
|
|
function addValueChangeHandler(handler){
|
|
$clinit_History();
|
|
return $addValueChangeHandler(historyEventSource, handler);
|
|
}
|
|
|
|
function getDecodedHash(){
|
|
var hashToken, href_0, hashLoc;
|
|
hashToken = (href_0 = $wnd.location.href , hashLoc = href_0.indexOf('#') , hashLoc > 0?href_0.substring(hashLoc):'');
|
|
if (hashToken == null || hashToken.length == 0) {
|
|
return '';
|
|
}
|
|
return $decode(hashToken.substr(1));
|
|
}
|
|
|
|
function onHashChanged(){
|
|
$clinit_History();
|
|
var hashToken;
|
|
hashToken = getDecodedHash();
|
|
if (!$equals_1(hashToken, token)) {
|
|
token = hashToken;
|
|
fire_3(historyEventSource, hashToken);
|
|
}
|
|
}
|
|
|
|
var historyEventSource, token;
|
|
function $addValueChangeHandler(this$static, handler){
|
|
return $addHandler_0(this$static.handlers, (!TYPE_20 && (TYPE_20 = new GwtEvent$Type) , TYPE_20), handler);
|
|
}
|
|
|
|
function History$HistoryEventSource(){
|
|
this.handlers = new HandlerManager(null);
|
|
}
|
|
|
|
defineClass(904, 1, {210:1, 25:1}, History$HistoryEventSource);
|
|
_.fireEvent = function fireEvent_1(event_0){
|
|
$fireEvent_0(this.handlers, event_0);
|
|
}
|
|
;
|
|
var Lcom_google_gwt_user_client_History$HistoryEventSource_2_classLit = createForClass('com.google.gwt.user.client', 'History/HistoryEventSource', 904);
|
|
function History$HistoryImpl(){
|
|
var handler;
|
|
handler = $entry(onHashChanged);
|
|
$wnd.addEventListener('hashchange', handler, false);
|
|
}
|
|
|
|
defineClass(905, 1, {}, History$HistoryImpl);
|
|
var Lcom_google_gwt_user_client_History$HistoryImpl_2_classLit = createForClass('com.google.gwt.user.client', 'History/HistoryImpl', 905);
|
|
function $decode(toDecode){
|
|
return $wnd.decodeURI(toDecode.replace('%23', '#'));
|
|
}
|
|
|
|
function addCloseHandler(handler){
|
|
maybeInitializeCloseHandlers();
|
|
return addHandler(TYPE_18?TYPE_18:(TYPE_18 = new GwtEvent$Type), handler);
|
|
}
|
|
|
|
function addHandler(type_0, handler){
|
|
return $addHandler_0((!handlers_1 && (handlers_1 = new Window$WindowHandlers) , handlers_1), type_0, handler);
|
|
}
|
|
|
|
function addResizeHandler(handler){
|
|
maybeInitializeCloseHandlers();
|
|
maybeInitializeResizeHandlers();
|
|
return addHandler((!TYPE_19 && (TYPE_19 = new GwtEvent$Type) , TYPE_19), handler);
|
|
}
|
|
|
|
function addWindowClosingHandler(handler){
|
|
maybeInitializeCloseHandlers();
|
|
return addHandler(($clinit_Window$ClosingEvent() , $clinit_Window$ClosingEvent() , TYPE_22), handler);
|
|
}
|
|
|
|
function alert_0(msg){
|
|
$wnd.alert(msg);
|
|
}
|
|
|
|
function confirm_2(msg){
|
|
return $wnd.confirm(msg);
|
|
}
|
|
|
|
function maybeInitializeCloseHandlers(){
|
|
if (!closeHandlersInitialized) {
|
|
$initHandler('function __gwt_initWindowCloseHandler(beforeunload, unload) {\n var wnd = window\n , oldOnBeforeUnload = wnd.onbeforeunload\n , oldOnUnload = wnd.onunload;\n \n wnd.onbeforeunload = function(evt) {\n var ret, oldRet;\n try {\n ret = beforeunload();\n } finally {\n oldRet = oldOnBeforeUnload && oldOnBeforeUnload(evt);\n }\n // Avoid returning null as IE6 will coerce it into a string.\n // Ensure that "" gets returned properly.\n if (ret != null) {\n return ret;\n }\n if (oldRet != null) {\n return oldRet;\n }\n // returns undefined.\n };\n \n wnd.onunload = function(evt) {\n try {\n unload();\n } finally {\n oldOnUnload && oldOnUnload(evt);\n wnd.onresize = null;\n wnd.onscroll = null;\n wnd.onbeforeunload = null;\n wnd.onunload = null;\n }\n };\n \n // Remove the reference once we\'ve initialize the handler\n wnd.__gwt_initWindowCloseHandler = undefined;\n}\n', new WindowImplIE$1);
|
|
closeHandlersInitialized = true;
|
|
}
|
|
}
|
|
|
|
function maybeInitializeResizeHandlers(){
|
|
if (!resizeHandlersInitialized) {
|
|
$initHandler("function __gwt_initWindowResizeHandler(resize) {\n var wnd = window, oldOnResize = wnd.onresize;\n \n wnd.onresize = function(evt) {\n try {\n resize();\n } finally {\n oldOnResize && oldOnResize(evt);\n }\n };\n \n // Remove the reference once we've initialize the handler\n wnd.__gwt_initWindowResizeHandler = undefined;\n}\n", new WindowImplIE$2);
|
|
resizeHandlersInitialized = true;
|
|
}
|
|
}
|
|
|
|
function onClosed(){
|
|
closeHandlersInitialized && fire_1((!handlers_1 && (handlers_1 = new Window$WindowHandlers) , handlers_1), false);
|
|
}
|
|
|
|
function onClosing(){
|
|
var event_0;
|
|
if (closeHandlersInitialized) {
|
|
event_0 = new Window$ClosingEvent;
|
|
!!handlers_1 && $fireEvent_0(handlers_1, event_0);
|
|
return event_0.message_0;
|
|
}
|
|
return null;
|
|
}
|
|
|
|
function onResize_0(){
|
|
var height, width_0;
|
|
if (resizeHandlersInitialized) {
|
|
width_0 = $getClientWidth($doc);
|
|
height = $getClientHeight($doc);
|
|
if (lastResizeWidth != width_0 || lastResizeHeight != height) {
|
|
lastResizeWidth = width_0;
|
|
lastResizeHeight = height;
|
|
fire_2((!handlers_1 && (handlers_1 = new Window$WindowHandlers) , handlers_1), width_0);
|
|
}
|
|
}
|
|
}
|
|
|
|
var closeHandlersInitialized = false, handlers_1, lastResizeHeight = 0, lastResizeWidth = 0, resizeHandlersInitialized = false;
|
|
function $clinit_Window$ClosingEvent(){
|
|
$clinit_Window$ClosingEvent = emptyMethod;
|
|
TYPE_22 = new GwtEvent$Type;
|
|
}
|
|
|
|
function $setMessage(this$static, message){
|
|
this$static.message_0 = message;
|
|
}
|
|
|
|
function Window$ClosingEvent(){
|
|
$clinit_Window$ClosingEvent();
|
|
}
|
|
|
|
defineClass(485, 978, {}, Window$ClosingEvent);
|
|
_.dispatch = function dispatch_22(handler){
|
|
handler.this$01.app.unsavedChanges && !($wnd.openFile != undefined) && $setMessage(this, LS('Are you sure? There are unsaved changes.'));
|
|
}
|
|
;
|
|
_.getAssociatedType = function getAssociatedType_23(){
|
|
return TYPE_22;
|
|
}
|
|
;
|
|
_.message_0 = null;
|
|
var TYPE_22;
|
|
var Lcom_google_gwt_user_client_Window$ClosingEvent_2_classLit = createForClass('com.google.gwt.user.client', 'Window/ClosingEvent', 485);
|
|
function Window$WindowHandlers(){
|
|
HandlerManager.call(this, null);
|
|
}
|
|
|
|
defineClass(283, 214, {64:1, 25:1}, Window$WindowHandlers);
|
|
var Lcom_google_gwt_user_client_Window$WindowHandlers_2_classLit = createForClass('com.google.gwt.user.client', 'Window/WindowHandlers', 283);
|
|
function $eventGetTypeInt(eventType){
|
|
switch (eventType) {
|
|
case 'blur':
|
|
return $intern_42;
|
|
case 'change':
|
|
return $intern_24;
|
|
case 'click':
|
|
return 1;
|
|
case 'dblclick':
|
|
return 2;
|
|
case 'focus':
|
|
return $intern_43;
|
|
case 'keydown':
|
|
return 128;
|
|
case 'keypress':
|
|
return 256;
|
|
case 'keyup':
|
|
return 512;
|
|
case 'load':
|
|
return 32768;
|
|
case 'losecapture':
|
|
return 8192;
|
|
case 'mousedown':
|
|
return 4;
|
|
case 'mousemove':
|
|
return 64;
|
|
case 'mouseout':
|
|
return 32;
|
|
case 'mouseover':
|
|
return 16;
|
|
case 'mouseup':
|
|
return 8;
|
|
case 'scroll':
|
|
return $intern_44;
|
|
case 'error':
|
|
return $intern_45;
|
|
case 'DOMMouseScroll':
|
|
case 'mousewheel':
|
|
return $intern_46;
|
|
case 'contextmenu':
|
|
return $intern_47;
|
|
case 'paste':
|
|
return $intern_29;
|
|
case 'touchstart':
|
|
return $intern_48;
|
|
case 'touchmove':
|
|
return $intern_49;
|
|
case 'touchend':
|
|
return $intern_30;
|
|
case 'touchcancel':
|
|
return $intern_50;
|
|
case 'gesturestart':
|
|
return $intern_51;
|
|
case 'gesturechange':
|
|
return $intern_52;
|
|
case 'gestureend':
|
|
return $intern_53;
|
|
default:return -1;
|
|
}
|
|
}
|
|
|
|
function $maybeInitializeEventSystem(){
|
|
if (!eventSystemIsInitialized) {
|
|
$initEventSystem();
|
|
eventSystemIsInitialized = true;
|
|
}
|
|
}
|
|
|
|
function getEventListener(elem){
|
|
var maybeListener = elem.__listener;
|
|
return !instanceOfJso(maybeListener) && instanceOf(maybeListener, 27)?maybeListener:null;
|
|
}
|
|
|
|
function setEventListener(elem, listener){
|
|
elem.__listener = listener;
|
|
}
|
|
|
|
var eventSystemIsInitialized = false;
|
|
function $clinit_DOMImplStandard(){
|
|
$clinit_DOMImplStandard = emptyMethod;
|
|
bitlessEventDispatchers = {_default_:dispatchEvent_3, dragenter:dispatchDragEvent, dragover:dispatchDragEvent};
|
|
captureEventDispatchers = {click:dispatchCapturedMouseEvent, dblclick:dispatchCapturedMouseEvent, mousedown:dispatchCapturedMouseEvent, mouseup:dispatchCapturedMouseEvent, mousemove:dispatchCapturedMouseEvent, mouseover:dispatchCapturedMouseEvent, mouseout:dispatchCapturedMouseEvent, mousewheel:dispatchCapturedMouseEvent, keydown:dispatchCapturedEvent, keyup:dispatchCapturedEvent, keypress:dispatchCapturedEvent, touchstart:dispatchCapturedMouseEvent, touchend:dispatchCapturedMouseEvent, touchmove:dispatchCapturedMouseEvent, touchcancel:dispatchCapturedMouseEvent, gesturestart:dispatchCapturedMouseEvent, gestureend:dispatchCapturedMouseEvent, gesturechange:dispatchCapturedMouseEvent};
|
|
}
|
|
|
|
function $getChild(elem, index_0){
|
|
var count = 0, child = elem.firstChild;
|
|
while (child) {
|
|
if (child.nodeType == 1) {
|
|
if (index_0 == count)
|
|
return child;
|
|
++count;
|
|
}
|
|
child = child.nextSibling;
|
|
}
|
|
return null;
|
|
}
|
|
|
|
function $getChildCount(elem){
|
|
var count = 0, child = elem.firstChild;
|
|
while (child) {
|
|
child.nodeType == 1 && ++count;
|
|
child = child.nextSibling;
|
|
}
|
|
return count;
|
|
}
|
|
|
|
function $initEventSystem(){
|
|
dispatchEvent_2 = $entry(dispatchEvent_3);
|
|
dispatchUnhandledEvent = $entry(dispatchUnhandledEvent_0);
|
|
var foreach = foreach_0;
|
|
var bitlessEvents = bitlessEventDispatchers;
|
|
foreach(bitlessEvents, function(e, fn){
|
|
bitlessEvents[e] = $entry(fn);
|
|
}
|
|
);
|
|
var captureEvents_0 = captureEventDispatchers;
|
|
foreach(captureEvents_0, function(e, fn){
|
|
captureEvents_0[e] = $entry(fn);
|
|
}
|
|
);
|
|
foreach(captureEvents_0, function(e, fn){
|
|
$wnd.addEventListener(e, fn, true);
|
|
}
|
|
);
|
|
}
|
|
|
|
function $insertChild(parent_0, toAdd, index_0){
|
|
var count = 0, child = parent_0.firstChild, before = null;
|
|
while (child) {
|
|
if (child.nodeType == 1) {
|
|
if (count == index_0) {
|
|
before = child;
|
|
break;
|
|
}
|
|
++count;
|
|
}
|
|
child = child.nextSibling;
|
|
}
|
|
parent_0.insertBefore(toAdd, before);
|
|
}
|
|
|
|
function $sinkBitlessEvent_0(elem, eventTypeName){
|
|
$maybeInitializeEventSystem();
|
|
$sinkBitlessEventImpl(elem, eventTypeName);
|
|
$equals_1('dragover', eventTypeName) && $sinkBitlessEventImpl(elem, 'dragenter');
|
|
}
|
|
|
|
function $sinkBitlessEventImpl(elem, eventTypeName){
|
|
var dispatchMap = bitlessEventDispatchers;
|
|
var dispatcher = dispatchMap[eventTypeName] || dispatchMap['_default_'];
|
|
elem.addEventListener(eventTypeName, dispatcher, false);
|
|
}
|
|
|
|
function $sinkEventsImpl(elem, bits){
|
|
var chMask = (elem.__eventBits || 0) ^ bits;
|
|
elem.__eventBits = bits;
|
|
if (!chMask)
|
|
return;
|
|
chMask & 1 && (elem.onclick = bits & 1?dispatchEvent_2:null);
|
|
chMask & 2 && (elem.ondblclick = bits & 2?dispatchEvent_2:null);
|
|
chMask & 4 && (elem.onmousedown = bits & 4?dispatchEvent_2:null);
|
|
chMask & 8 && (elem.onmouseup = bits & 8?dispatchEvent_2:null);
|
|
chMask & 16 && (elem.onmouseover = bits & 16?dispatchEvent_2:null);
|
|
chMask & 32 && (elem.onmouseout = bits & 32?dispatchEvent_2:null);
|
|
chMask & 64 && (elem.onmousemove = bits & 64?dispatchEvent_2:null);
|
|
chMask & 128 && (elem.onkeydown = bits & 128?dispatchEvent_2:null);
|
|
chMask & 256 && (elem.onkeypress = bits & 256?dispatchEvent_2:null);
|
|
chMask & 512 && (elem.onkeyup = bits & 512?dispatchEvent_2:null);
|
|
chMask & $intern_24 && (elem.onchange = bits & $intern_24?dispatchEvent_2:null);
|
|
chMask & $intern_43 && (elem.onfocus = bits & $intern_43?dispatchEvent_2:null);
|
|
chMask & $intern_42 && (elem.onblur = bits & $intern_42?dispatchEvent_2:null);
|
|
chMask & 8192 && (elem.onlosecapture = bits & 8192?dispatchEvent_2:null);
|
|
chMask & $intern_44 && (elem.onscroll = bits & $intern_44?dispatchEvent_2:null);
|
|
chMask & 32768 && (elem.onload = bits & 32768?dispatchUnhandledEvent:null);
|
|
chMask & $intern_45 && (elem.onerror = bits & $intern_45?dispatchEvent_2:null);
|
|
chMask & $intern_46 && (elem.onmousewheel = bits & $intern_46?dispatchEvent_2:null);
|
|
chMask & $intern_47 && (elem.oncontextmenu = bits & $intern_47?dispatchEvent_2:null);
|
|
chMask & $intern_29 && (elem.onpaste = bits & $intern_29?dispatchEvent_2:null);
|
|
chMask & $intern_48 && (elem.ontouchstart = bits & $intern_48?dispatchEvent_2:null);
|
|
chMask & $intern_49 && (elem.ontouchmove = bits & $intern_49?dispatchEvent_2:null);
|
|
chMask & $intern_30 && (elem.ontouchend = bits & $intern_30?dispatchEvent_2:null);
|
|
chMask & $intern_50 && (elem.ontouchcancel = bits & $intern_50?dispatchEvent_2:null);
|
|
chMask & $intern_51 && (elem.ongesturestart = bits & $intern_51?dispatchEvent_2:null);
|
|
chMask & $intern_52 && (elem.ongesturechange = bits & $intern_52?dispatchEvent_2:null);
|
|
chMask & $intern_53 && (elem.ongestureend = bits & $intern_53?dispatchEvent_2:null);
|
|
}
|
|
|
|
function dispatchCapturedEvent(evt){
|
|
previewEvent(evt);
|
|
}
|
|
|
|
function dispatchCapturedMouseEvent(evt){
|
|
var cancelled;
|
|
cancelled = !previewEvent(evt);
|
|
if (cancelled || !captureElem) {
|
|
return;
|
|
}
|
|
dispatchEvent_0(evt, captureElem) && (evt.stopPropagation() , undefined);
|
|
}
|
|
|
|
function dispatchDragEvent(evt){
|
|
evt.preventDefault();
|
|
dispatchEvent_3(evt);
|
|
}
|
|
|
|
function dispatchEvent_3(evt){
|
|
var element;
|
|
element = getFirstAncestorWithListener(evt);
|
|
if (!element) {
|
|
return;
|
|
}
|
|
dispatchEvent_1(evt, element.nodeType != 1?null:element, getEventListener(element));
|
|
}
|
|
|
|
function dispatchUnhandledEvent_0(evt){
|
|
var element;
|
|
element = evt.currentTarget || $wnd;
|
|
element['__gwtLastUnhandledEvent'] = evt.type;
|
|
dispatchEvent_3(evt);
|
|
}
|
|
|
|
function getFirstAncestorWithListener(evt){
|
|
var curElem;
|
|
curElem = evt.currentTarget || $wnd;
|
|
while (!!curElem && !getEventListener(curElem)) {
|
|
curElem = curElem.parentNode;
|
|
}
|
|
return curElem;
|
|
}
|
|
|
|
var bitlessEventDispatchers, captureElem, captureEventDispatchers, dispatchEvent_2, dispatchUnhandledEvent;
|
|
function $get(this$static, elem){
|
|
var index_0;
|
|
index_0 = getIndex(elem);
|
|
if (index_0 < 0) {
|
|
return null;
|
|
}
|
|
return $get_2(this$static.uiObjectList, index_0);
|
|
}
|
|
|
|
function $put(this$static, uiObject){
|
|
var index_0;
|
|
if (!this$static.freeList) {
|
|
index_0 = this$static.uiObjectList.array.length;
|
|
$add_8(this$static.uiObjectList, uiObject);
|
|
}
|
|
else {
|
|
index_0 = this$static.freeList.index_0;
|
|
$set_1(this$static.uiObjectList, index_0, uiObject);
|
|
this$static.freeList = this$static.freeList.next_0;
|
|
}
|
|
($clinit_DOM() , uiObject.element)['__uiObjectID'] = index_0;
|
|
}
|
|
|
|
function $removeByElement(this$static, elem){
|
|
var index_0;
|
|
index_0 = getIndex(elem);
|
|
elem['__uiObjectID'] = null;
|
|
$set_1(this$static.uiObjectList, index_0, null);
|
|
this$static.freeList = new ElementMapperImpl$FreeNode(index_0, this$static.freeList);
|
|
}
|
|
|
|
function ElementMapperImpl(){
|
|
this.uiObjectList = new ArrayList;
|
|
}
|
|
|
|
function getIndex(elem){
|
|
var index_0 = elem['__uiObjectID'];
|
|
return index_0 == null?-1:index_0;
|
|
}
|
|
|
|
defineClass(819, 1, {}, ElementMapperImpl);
|
|
_.freeList = null;
|
|
var Lcom_google_gwt_user_client_impl_ElementMapperImpl_2_classLit = createForClass('com.google.gwt.user.client.impl', 'ElementMapperImpl', 819);
|
|
function ElementMapperImpl$FreeNode(index_0, next){
|
|
this.index_0 = index_0;
|
|
this.next_0 = next;
|
|
}
|
|
|
|
defineClass(820, 1, {}, ElementMapperImpl$FreeNode);
|
|
_.index_0 = 0;
|
|
var Lcom_google_gwt_user_client_impl_ElementMapperImpl$FreeNode_2_classLit = createForClass('com.google.gwt.user.client.impl', 'ElementMapperImpl/FreeNode', 820);
|
|
function foreach_0(map_0, fn){
|
|
for (var e in map_0) {
|
|
map_0.hasOwnProperty(e) && fn(e, map_0[e]);
|
|
}
|
|
}
|
|
|
|
function $initHandler(initFunc, cmd){
|
|
var scriptElem;
|
|
scriptElem = $createScriptElement($doc, initFunc);
|
|
$appendChild($doc.body, scriptElem);
|
|
cmd.execute_1();
|
|
$removeChild($doc.body, scriptElem);
|
|
}
|
|
|
|
function WindowImplIE$1(){
|
|
}
|
|
|
|
defineClass(564, 1, {}, WindowImplIE$1);
|
|
_.execute_1 = function execute_5(){
|
|
$wnd.__gwt_initWindowCloseHandler($entry(onClosing), $entry(onClosed));
|
|
}
|
|
;
|
|
var Lcom_google_gwt_user_client_impl_WindowImplIE$1_2_classLit = createForClass('com.google.gwt.user.client.impl', 'WindowImplIE/1', 564);
|
|
function WindowImplIE$2(){
|
|
}
|
|
|
|
defineClass(565, 1, {}, WindowImplIE$2);
|
|
_.execute_1 = function execute_6(){
|
|
$wnd.__gwt_initWindowResizeHandler($entry(onResize_0));
|
|
}
|
|
;
|
|
var Lcom_google_gwt_user_client_impl_WindowImplIE$2_2_classLit = createForClass('com.google.gwt.user.client.impl', 'WindowImplIE/2', 565);
|
|
function $adopt(this$static, child){
|
|
$setParent(child, this$static);
|
|
}
|
|
|
|
defineClass(981, 24, $intern_54);
|
|
_.add_0 = function add_3(child){
|
|
throw toJs(new UnsupportedOperationException_0('This panel does not support no-arg add()'));
|
|
}
|
|
;
|
|
_.doAttachChildren = function doAttachChildren_0(){
|
|
tryCommand(this, ($clinit_AttachDetachException() , attachCommand));
|
|
}
|
|
;
|
|
_.doDetachChildren = function doDetachChildren_0(){
|
|
tryCommand(this, ($clinit_AttachDetachException() , detachCommand));
|
|
}
|
|
;
|
|
var Lcom_google_gwt_user_client_ui_Panel_2_classLit = createForClass('com.google.gwt.user.client.ui', 'Panel', 981);
|
|
function $add(this$static, child, container){
|
|
$removeFromParent(child);
|
|
$add_6(this$static.children, child);
|
|
$clinit_DOM();
|
|
$appendChild(container, resolve(child.element));
|
|
$setParent(child, this$static);
|
|
}
|
|
|
|
function $adjustIndex(this$static, child, beforeIndex){
|
|
var idx;
|
|
$checkIndexBoundsForInsertion(this$static, beforeIndex);
|
|
if (child.parent_0 == this$static) {
|
|
idx = $indexOf(this$static.children, child);
|
|
idx < beforeIndex && --beforeIndex;
|
|
}
|
|
return beforeIndex;
|
|
}
|
|
|
|
function $checkIndexBoundsForInsertion(this$static, index_0){
|
|
if (index_0 < 0 || index_0 > this$static.children.size_0) {
|
|
throw toJs(new IndexOutOfBoundsException);
|
|
}
|
|
}
|
|
|
|
function $getWidget(this$static, index_0){
|
|
return $get_0(this$static.children, index_0);
|
|
}
|
|
|
|
function $getWidgetIndex(this$static, child){
|
|
return $indexOf(this$static.children, child);
|
|
}
|
|
|
|
function $insert(this$static, child, container, beforeIndex){
|
|
beforeIndex = $adjustIndex(this$static, child, beforeIndex);
|
|
$removeFromParent(child);
|
|
$insert_3(this$static.children, child, beforeIndex);
|
|
$clinit_DOM();
|
|
$appendChild(container, resolve(child.element));
|
|
$setParent(child, this$static);
|
|
}
|
|
|
|
function $remove(this$static, index_0){
|
|
return $remove_4(this$static, $get_0(this$static.children, index_0));
|
|
}
|
|
|
|
function $remove_0(this$static, w){
|
|
var elem;
|
|
if (w.parent_0 != this$static) {
|
|
return false;
|
|
}
|
|
try {
|
|
$setParent(w, null);
|
|
}
|
|
finally {
|
|
elem = ($clinit_DOM() , w.element);
|
|
$removeChild((null , $getParentElement(elem)), elem);
|
|
$remove_6(this$static.children, w);
|
|
}
|
|
return true;
|
|
}
|
|
|
|
function ComplexPanel(){
|
|
this.children = new WidgetCollection(this);
|
|
}
|
|
|
|
defineClass(238, 981, $intern_54);
|
|
_.iterator = function iterator_0(){
|
|
return new WidgetCollection$WidgetIterator(this.children);
|
|
}
|
|
;
|
|
_.remove_0 = function remove_0(w){
|
|
return $remove_0(this, w);
|
|
}
|
|
;
|
|
var Lcom_google_gwt_user_client_ui_ComplexPanel_2_classLit = createForClass('com.google.gwt.user.client.ui', 'ComplexPanel', 238);
|
|
function $add_0(this$static, w){
|
|
$add(this$static, w, ($clinit_DOM() , this$static.element));
|
|
}
|
|
|
|
function $remove_1(this$static, w){
|
|
var removed;
|
|
removed = $remove_0(this$static, w);
|
|
removed && changeToStaticPositioning(($clinit_DOM() , w.element));
|
|
return removed;
|
|
}
|
|
|
|
function changeToStaticPositioning(elem){
|
|
elem.style['left'] = '';
|
|
elem.style['top'] = '';
|
|
elem.style['position'] = '';
|
|
}
|
|
|
|
defineClass(670, 238, $intern_54);
|
|
_.add_0 = function add_4(w){
|
|
$add_0(this, w);
|
|
}
|
|
;
|
|
_.remove_0 = function remove_1(w){
|
|
return $remove_1(this, w);
|
|
}
|
|
;
|
|
var Lcom_google_gwt_user_client_ui_AbsolutePanel_2_classLit = createForClass('com.google.gwt.user.client.ui', 'AbsolutePanel', 670);
|
|
function create_1(resource){
|
|
return new ClippedImagePrototype(resource.url_0, resource.left_0, resource.top_0, resource.width_0, resource.height_0);
|
|
}
|
|
|
|
defineClass(993, 1, {});
|
|
var Lcom_google_gwt_user_client_ui_AbstractImagePrototype_2_classLit = createForClass('com.google.gwt.user.client.ui', 'AbstractImagePrototype', 993);
|
|
function $clinit_HasHorizontalAlignment(){
|
|
$clinit_HasHorizontalAlignment = emptyMethod;
|
|
ALIGN_CENTER = new HasHorizontalAlignment$HorizontalAlignmentConstant(($clinit_Style$TextAlign() , 'center'));
|
|
new HasHorizontalAlignment$HorizontalAlignmentConstant('justify');
|
|
ALIGN_LEFT = new HasHorizontalAlignment$HorizontalAlignmentConstant('left');
|
|
ALIGN_RIGHT = new HasHorizontalAlignment$HorizontalAlignmentConstant('right');
|
|
ALIGN_LOCALE_START = ($clinit_LocaleInfo() , ALIGN_LEFT);
|
|
ALIGN_LOCALE_END = ALIGN_RIGHT;
|
|
ALIGN_DEFAULT = ALIGN_LOCALE_START;
|
|
}
|
|
|
|
var ALIGN_CENTER, ALIGN_DEFAULT, ALIGN_LEFT, ALIGN_LOCALE_END, ALIGN_LOCALE_START, ALIGN_RIGHT;
|
|
function Anchor_0(text_0, href_0){
|
|
$setElement(this, $doc.createElement('a'));
|
|
($clinit_DOM() , this.element).className = 'gwt-Anchor';
|
|
this.directionalTextHelper = new DirectionalTextHelper(this.element);
|
|
$setTextOrHtml(this.directionalTextHelper, text_0, false);
|
|
$setHref(this.element, href_0);
|
|
}
|
|
|
|
defineClass(198, 82, {71:1, 119:1, 94:1, 122:1, 85:1, 98:1, 121:1, 69:1, 70:1, 72:1, 73:1, 75:1, 74:1, 76:1, 77:1, 78:1, 120:1, 96:1, 97:1, 95:1, 124:1, 125:1, 123:1, 86:1, 90:1, 88:1, 89:1, 87:1, 91:1, 102:1, 101:1, 100:1, 99:1, 28:1, 25:1, 207:1, 134:1, 60:1, 27:1, 82:1, 116:1, 248:1, 206:1, 105:1, 115:1, 59:1, 227:1, 146:1, 50:1, 23:1, 196:1, 29:1, 92:1, 117:1, 118:1, 93:1, 22:1, 24:1}, Anchor_0);
|
|
_.getTabIndex = function getTabIndex_0(){
|
|
return $getTabIndex(($clinit_DOM() , this.element));
|
|
}
|
|
;
|
|
_.setTabIndex = function setTabIndex_0(index_0){
|
|
$setTabIndex(($clinit_DOM() , this.element), index_0);
|
|
}
|
|
;
|
|
var Lcom_google_gwt_user_client_ui_Anchor_2_classLit = createForClass('com.google.gwt.user.client.ui', 'Anchor', 198);
|
|
function $clinit_AttachDetachException(){
|
|
$clinit_AttachDetachException = emptyMethod;
|
|
attachCommand = new AttachDetachException$1;
|
|
detachCommand = new AttachDetachException$2;
|
|
}
|
|
|
|
function AttachDetachException(causes){
|
|
UmbrellaException_0.call(this, causes);
|
|
}
|
|
|
|
function tryCommand(hasWidgets, c){
|
|
$clinit_AttachDetachException();
|
|
var caught, e, w, w$iterator;
|
|
caught = null;
|
|
for (w$iterator = hasWidgets.iterator(); w$iterator.hasNext_0();) {
|
|
w = w$iterator.next_1();
|
|
try {
|
|
c.execute_2(w);
|
|
}
|
|
catch ($e0) {
|
|
$e0 = toJava($e0);
|
|
if (instanceOf($e0, 42)) {
|
|
e = $e0;
|
|
!caught && (caught = new HashSet);
|
|
$put_0(caught.map_0, e, caught);
|
|
}
|
|
else
|
|
throw toJs($e0);
|
|
}
|
|
}
|
|
if (caught) {
|
|
throw toJs(new AttachDetachException(caught));
|
|
}
|
|
}
|
|
|
|
defineClass(570, 333, $intern_19, AttachDetachException);
|
|
var attachCommand, detachCommand;
|
|
var Lcom_google_gwt_user_client_ui_AttachDetachException_2_classLit = createForClass('com.google.gwt.user.client.ui', 'AttachDetachException', 570);
|
|
function AttachDetachException$1(){
|
|
}
|
|
|
|
defineClass(571, 1, {}, AttachDetachException$1);
|
|
_.execute_2 = function execute_7(w){
|
|
w.onAttach();
|
|
}
|
|
;
|
|
var Lcom_google_gwt_user_client_ui_AttachDetachException$1_2_classLit = createForClass('com.google.gwt.user.client.ui', 'AttachDetachException/1', 571);
|
|
function AttachDetachException$2(){
|
|
}
|
|
|
|
defineClass(572, 1, {}, AttachDetachException$2);
|
|
_.execute_2 = function execute_8(w){
|
|
w.onDetach();
|
|
}
|
|
;
|
|
var Lcom_google_gwt_user_client_ui_AttachDetachException$2_2_classLit = createForClass('com.google.gwt.user.client.ui', 'AttachDetachException/2', 572);
|
|
function $setHTML(this$static, html){
|
|
$setInnerHTML(($clinit_DOM() , this$static.element), html);
|
|
}
|
|
|
|
function ButtonBase(elem){
|
|
FocusWidget.call(this, elem);
|
|
}
|
|
|
|
defineClass(190, 82, {71:1, 119:1, 94:1, 122:1, 85:1, 98:1, 121:1, 69:1, 70:1, 72:1, 73:1, 75:1, 74:1, 76:1, 77:1, 78:1, 120:1, 96:1, 97:1, 95:1, 124:1, 125:1, 123:1, 86:1, 90:1, 88:1, 89:1, 87:1, 91:1, 102:1, 101:1, 100:1, 99:1, 28:1, 25:1, 60:1, 27:1, 190:1, 82:1, 116:1, 105:1, 115:1, 59:1, 50:1, 23:1, 29:1, 92:1, 117:1, 118:1, 93:1, 22:1, 24:1});
|
|
var Lcom_google_gwt_user_client_ui_ButtonBase_2_classLit = createForClass('com.google.gwt.user.client.ui', 'ButtonBase', 190);
|
|
function Button(){
|
|
var e;
|
|
ButtonBase.call(this, (e = $doc.createElement('BUTTON') , e.setAttribute('type', 'button') , e));
|
|
($clinit_DOM() , this.element).className = 'gwt-Button';
|
|
}
|
|
|
|
function Button_0(html){
|
|
Button_1.call(this, html.html);
|
|
}
|
|
|
|
function Button_1(html){
|
|
Button.call(this);
|
|
$setInnerHTML(($clinit_DOM() , this.element), html);
|
|
}
|
|
|
|
defineClass(31, 190, {71:1, 119:1, 94:1, 122:1, 85:1, 98:1, 121:1, 69:1, 70:1, 72:1, 73:1, 75:1, 74:1, 76:1, 77:1, 78:1, 120:1, 96:1, 97:1, 95:1, 124:1, 125:1, 123:1, 86:1, 90:1, 88:1, 89:1, 87:1, 91:1, 102:1, 101:1, 100:1, 99:1, 28:1, 25:1, 60:1, 27:1, 31:1, 190:1, 82:1, 116:1, 105:1, 115:1, 59:1, 50:1, 23:1, 29:1, 92:1, 117:1, 118:1, 93:1, 22:1, 24:1}, Button, Button_0, Button_1);
|
|
var Lcom_google_gwt_user_client_ui_Button_2_classLit = createForClass('com.google.gwt.user.client.ui', 'Button', 31);
|
|
function $getWidgetTd(this$static, w){
|
|
if (w.parent_0 != this$static) {
|
|
return null;
|
|
}
|
|
return $clinit_DOM() , $getParentElement(w.element);
|
|
}
|
|
|
|
function $setCellHorizontalAlignment(td, align_0){
|
|
($clinit_DOM() , td)['align'] = align_0.textAlignString;
|
|
}
|
|
|
|
function $setCellVerticalAlignment(td, align_0){
|
|
$setCellVerticalAlignment_0(($clinit_DOM() , td), align_0);
|
|
}
|
|
|
|
function $setCellVerticalAlignment_0(td, align_0){
|
|
td.style['verticalAlign'] = align_0.verticalAlignString;
|
|
}
|
|
|
|
function $setCellVerticalAlignment_1(this$static, w, align_0){
|
|
var td;
|
|
td = $getWidgetTd(this$static, w);
|
|
!!td && $setCellVerticalAlignment_0(($clinit_DOM() , td), align_0);
|
|
}
|
|
|
|
function CellPanel(){
|
|
ComplexPanel.call(this);
|
|
this.table = ($clinit_DOM() , $doc.createElement('table'));
|
|
this.body_0 = $doc.createElement('tbody');
|
|
$appendChild(this.table, resolve(this.body_0));
|
|
$setElement(this, this.table);
|
|
}
|
|
|
|
defineClass(336, 238, $intern_54);
|
|
var Lcom_google_gwt_user_client_ui_CellPanel_2_classLit = createForClass('com.google.gwt.user.client.ui', 'CellPanel', 336);
|
|
function $addValueChangeHandler_0(this$static, handler){
|
|
if (!this$static.valueChangeHandlerInitialized) {
|
|
this$static.ensureDomEventHandlers();
|
|
this$static.valueChangeHandlerInitialized = true;
|
|
}
|
|
return $addHandler(this$static, handler, (!TYPE_20 && (TYPE_20 = new GwtEvent$Type) , TYPE_20));
|
|
}
|
|
|
|
function $getValue(this$static){
|
|
return this$static.attached?($clinit_Boolean() , this$static.inputElem.checked?true:false):($clinit_Boolean() , this$static.inputElem.defaultChecked?true:false);
|
|
}
|
|
|
|
function $setEnabled_0(this$static, enabled){
|
|
$setDisabled(this$static.inputElem, !enabled);
|
|
enabled?$setStyleName_0(this$static, getStylePrimaryName(($clinit_DOM() , this$static.element)) + '-' + 'disabled', false):$setStyleName_0(this$static, getStylePrimaryName(($clinit_DOM() , this$static.element)) + '-' + 'disabled', true);
|
|
}
|
|
|
|
function $setValue(this$static, value_0){
|
|
var oldValue;
|
|
value_0 == null && (value_0 = ($clinit_Boolean() , FALSE));
|
|
oldValue = this$static.attached?($clinit_Boolean() , this$static.inputElem.checked?true:false):($clinit_Boolean() , this$static.inputElem.defaultChecked?true:false);
|
|
$setChecked(this$static.inputElem, (checkCriticalNotNull(value_0) , value_0));
|
|
$setDefaultChecked(this$static.inputElem, (checkCriticalNotNull(value_0) , value_0));
|
|
checkCriticalNotNull(value_0);
|
|
if (value_0 == oldValue) {
|
|
return;
|
|
}
|
|
}
|
|
|
|
function CheckBox(elem){
|
|
var uid;
|
|
ButtonBase.call(this, ($clinit_DOM() , $doc.createElement('span')));
|
|
this.inputElem = elem;
|
|
this.labelElem = $doc.createElement('label');
|
|
$appendChild(this.element, this.inputElem);
|
|
$appendChild(this.element, this.labelElem);
|
|
uid = $createUniqueId($doc);
|
|
this.inputElem['id'] = uid;
|
|
$setHtmlFor(this.labelElem, uid);
|
|
this.directionalTextHelper = new DirectionalTextHelper(this.labelElem);
|
|
!!this.inputElem && (this.inputElem.tabIndex = 0 , undefined);
|
|
}
|
|
|
|
function CheckBox_0(label_0){
|
|
CheckBox.call(this, ($clinit_DOM() , $createCheckInputElement($doc)));
|
|
this.element.className = 'gwt-CheckBox';
|
|
$setTextOrHtml(this.directionalTextHelper, label_0, false);
|
|
}
|
|
|
|
defineClass(166, 190, $intern_55);
|
|
_.ensureDomEventHandlers = function ensureDomEventHandlers(){
|
|
$addDomHandler(this, new CheckBox$1(this), ($clinit_ClickEvent() , $clinit_ClickEvent() , TYPE_1));
|
|
}
|
|
;
|
|
_.getTabIndex = function getTabIndex_1(){
|
|
return $getTabIndex(this.inputElem);
|
|
}
|
|
;
|
|
_.onLoad = function onLoad_0(){
|
|
$clinit_DOM();
|
|
this.inputElem.__listener = this;
|
|
}
|
|
;
|
|
_.onUnload = function onUnload_0(){
|
|
$clinit_DOM();
|
|
this.inputElem.__listener = null;
|
|
$setValue(this, this.attached?($clinit_Boolean() , this.inputElem.checked?true:false):($clinit_Boolean() , this.inputElem.defaultChecked?true:false));
|
|
}
|
|
;
|
|
_.setTabIndex = function setTabIndex_1(index_0){
|
|
!!this.inputElem && $setTabIndex(this.inputElem, index_0);
|
|
}
|
|
;
|
|
_.sinkEvents = function sinkEvents_2(eventBitsToAdd){
|
|
this.eventsToSink == -1?sinkEvents_1(this.inputElem, eventBitsToAdd | getEventsSunk(this.inputElem)):this.eventsToSink == -1?sinkEvents_0(($clinit_DOM() , this.element), eventBitsToAdd | (this.element.__eventBits || 0)):(this.eventsToSink |= eventBitsToAdd);
|
|
}
|
|
;
|
|
_.valueChangeHandlerInitialized = false;
|
|
var Lcom_google_gwt_user_client_ui_CheckBox_2_classLit = createForClass('com.google.gwt.user.client.ui', 'CheckBox', 166);
|
|
function CheckBox$1(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(710, 1, $intern_56, CheckBox$1);
|
|
_.onClick = function onClick(event_0){
|
|
fire_3(this.this$01, $getValue(this.this$01));
|
|
}
|
|
;
|
|
var Lcom_google_gwt_user_client_ui_CheckBox$1_2_classLit = createForClass('com.google.gwt.user.client.ui', 'CheckBox/1', 710);
|
|
function $checkInit(this$static){
|
|
if (!this$static.widget) {
|
|
throw toJs(new IllegalStateException_0('initWidget() is not called yet'));
|
|
}
|
|
}
|
|
|
|
function $initWidget(this$static, widget){
|
|
var elem;
|
|
if (this$static.widget) {
|
|
throw toJs(new IllegalStateException_0('Composite.initWidget() may only be called once.'));
|
|
}
|
|
if (!widget) {
|
|
throw toJs(new NullPointerException_0('widget cannot be null'));
|
|
}
|
|
$removeFromParent(widget);
|
|
elem = ($clinit_DOM() , widget.element);
|
|
$setElement_0(this$static, elem);
|
|
($clinit_PotentialElement() , isPotential(elem)) && $setResolver(elem, this$static);
|
|
this$static.widget = widget;
|
|
$setParent(widget, this$static);
|
|
}
|
|
|
|
defineClass(983, 24, $intern_4);
|
|
_.isAttached = function isAttached_0(){
|
|
if (this.widget) {
|
|
return this.widget.attached;
|
|
}
|
|
return false;
|
|
}
|
|
;
|
|
_.onAttach = function onAttach_1(){
|
|
$checkInit(this);
|
|
if (this.eventsToSink != -1) {
|
|
$sinkEvents(this.widget, this.eventsToSink);
|
|
this.eventsToSink = -1;
|
|
}
|
|
$onAttach(this.widget);
|
|
$clinit_DOM();
|
|
this.element.__listener = this;
|
|
fire_0(this, true);
|
|
}
|
|
;
|
|
_.onBrowserEvent = function onBrowserEvent_0(event_0){
|
|
$onBrowserEvent(this, event_0);
|
|
$onBrowserEvent(this.widget, event_0);
|
|
}
|
|
;
|
|
_.onDetach = function onDetach_0(){
|
|
try {
|
|
fire_0(this, false);
|
|
}
|
|
finally {
|
|
$onDetach(this.widget);
|
|
}
|
|
}
|
|
;
|
|
_.resolvePotentialElement = function resolvePotentialElement_0(){
|
|
$setElement(this, $resolvePotentialElement());
|
|
return $clinit_DOM() , this.element;
|
|
}
|
|
;
|
|
var Lcom_google_gwt_user_client_ui_Composite_2_classLit = createForClass('com.google.gwt.user.client.ui', 'Composite', 983);
|
|
function $add_1(this$static, w){
|
|
if (this$static.getWidget()) {
|
|
throw toJs(new IllegalStateException_0('SimplePanel can only contain one child widget'));
|
|
}
|
|
this$static.setWidget(w);
|
|
}
|
|
|
|
function $remove_2(this$static, w){
|
|
if (this$static.widget != w) {
|
|
return false;
|
|
}
|
|
try {
|
|
$setParent(w, null);
|
|
}
|
|
finally {
|
|
$removeChild(this$static.getContainerElement(), ($clinit_DOM() , w.element));
|
|
this$static.widget = null;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
function $setWidget(this$static, w){
|
|
if (w == this$static.widget) {
|
|
return;
|
|
}
|
|
!!w && $removeFromParent(w);
|
|
!!this$static.widget && this$static.remove_0(this$static.widget);
|
|
this$static.widget = w;
|
|
if (w) {
|
|
$clinit_DOM();
|
|
$appendChild(this$static.getContainerElement(), resolve($getElement(this$static.widget)));
|
|
$setParent(w, this$static);
|
|
}
|
|
}
|
|
|
|
function SimplePanel(){
|
|
SimplePanel_0.call(this, ($clinit_DOM() , $doc.createElement('div')));
|
|
}
|
|
|
|
function SimplePanel_0(elem){
|
|
$setElement_0(this, ($clinit_DOM() , elem));
|
|
}
|
|
|
|
defineClass(255, 981, $intern_54);
|
|
_.add_0 = function add_5(w){
|
|
$add_1(this, w);
|
|
}
|
|
;
|
|
_.getContainerElement = function getContainerElement(){
|
|
return $clinit_DOM() , this.element;
|
|
}
|
|
;
|
|
_.getWidget = function getWidget(){
|
|
return this.widget;
|
|
}
|
|
;
|
|
_.iterator = function iterator_1(){
|
|
return new SimplePanel$1(this);
|
|
}
|
|
;
|
|
_.remove_0 = function remove_2(w){
|
|
return $remove_2(this, w);
|
|
}
|
|
;
|
|
_.setWidget = function setWidget(w){
|
|
$setWidget(this, w);
|
|
}
|
|
;
|
|
var Lcom_google_gwt_user_client_ui_SimplePanel_2_classLit = createForClass('com.google.gwt.user.client.ui', 'SimplePanel', 255);
|
|
function $center(this$static){
|
|
var elem, initiallyAnimated, initiallyShowing, left, top_0;
|
|
initiallyShowing = this$static.showing;
|
|
initiallyAnimated = this$static.isAnimationEnabled;
|
|
if (!initiallyShowing) {
|
|
($clinit_DOM() , this$static.element).style['visibility'] = 'hidden';
|
|
!!this$static.glass && (this$static.glass.style['visibility'] = 'hidden' , undefined);
|
|
this$static.isAnimationEnabled = false;
|
|
this$static.show();
|
|
}
|
|
elem = ($clinit_DOM() , this$static.element);
|
|
elem.style['left'] = ($clinit_Style$Unit() , '0.0px');
|
|
elem.style['top'] = '0.0px';
|
|
left = $getClientWidth($doc) - $getPropertyInt(this$static.element, 'offsetWidth') >> 1;
|
|
top_0 = $getClientHeight($doc) - $getPropertyInt(this$static.element, 'offsetHeight') >> 1;
|
|
$setPopupPosition(this$static, $wnd.Math.max(($wnd.pageXOffset | 0) + left, 0), $wnd.Math.max(($wnd.pageYOffset | 0) + top_0, 0));
|
|
if (!initiallyShowing) {
|
|
this$static.isAnimationEnabled = initiallyAnimated;
|
|
if (initiallyAnimated) {
|
|
this$static.element.style['clip'] = 'rect(0px, 0px, 0px, 0px)';
|
|
this$static.element.style['visibility'] = 'visible';
|
|
!!this$static.glass && (this$static.glass.style['visibility'] = 'visible' , undefined);
|
|
$run(this$static.resizeAnimation, 200, now_1(), null);
|
|
}
|
|
else {
|
|
this$static.element.style['visibility'] = 'visible';
|
|
!!this$static.glass && (this$static.glass.style['visibility'] = 'visible' , undefined);
|
|
}
|
|
}
|
|
}
|
|
|
|
function $eventTargetsPopup(this$static, event_0){
|
|
var target;
|
|
target = event_0.target;
|
|
if (is_0(target)) {
|
|
return isOrHasChildImpl(($clinit_DOM() , this$static.element), target);
|
|
}
|
|
return false;
|
|
}
|
|
|
|
function $hide(this$static, autoClosed){
|
|
if (!this$static.showing) {
|
|
return;
|
|
}
|
|
$setState(this$static.resizeAnimation, false, false);
|
|
fire_1(this$static, autoClosed);
|
|
}
|
|
|
|
function $maybeUpdateSize(this$static){
|
|
var w;
|
|
w = this$static.widget;
|
|
if (w) {
|
|
this$static.desiredHeight != null && w.setHeight_0(this$static.desiredHeight);
|
|
this$static.desiredWidth != null && w.setWidth_0(this$static.desiredWidth);
|
|
}
|
|
}
|
|
|
|
function $previewNativeEvent(this$static, event_0){
|
|
var eventTargetsPopupOrPartner, nativeEvent, target, type_0;
|
|
if (event_0.isCanceled || !this$static.previewAllNativeEvents && event_0.isConsumed) {
|
|
this$static.modal && (event_0.isCanceled = true);
|
|
return;
|
|
}
|
|
this$static.onPreviewNativeEvent(event_0);
|
|
if (event_0.isCanceled) {
|
|
return;
|
|
}
|
|
nativeEvent = event_0.nativeEvent;
|
|
eventTargetsPopupOrPartner = $eventTargetsPopup(this$static, nativeEvent);
|
|
eventTargetsPopupOrPartner && (event_0.isConsumed = true);
|
|
this$static.modal && (event_0.isCanceled = true);
|
|
type_0 = ($clinit_DOM() , $eventGetTypeInt(nativeEvent.type));
|
|
switch (type_0) {
|
|
case 512:
|
|
case 256:
|
|
case 128:
|
|
{
|
|
return;
|
|
}
|
|
|
|
case 4:
|
|
case $intern_48:
|
|
{
|
|
if (sCaptureElem) {
|
|
event_0.isConsumed = true;
|
|
return;
|
|
}
|
|
}
|
|
|
|
if (!eventTargetsPopupOrPartner && this$static.autoHide) {
|
|
this$static.hide(true);
|
|
return;
|
|
}
|
|
|
|
break;
|
|
case 8:
|
|
case 64:
|
|
case 1:
|
|
case 2:
|
|
case $intern_30:
|
|
{
|
|
if (sCaptureElem) {
|
|
event_0.isConsumed = true;
|
|
return;
|
|
}
|
|
break;
|
|
}
|
|
|
|
case $intern_43:
|
|
{
|
|
target = nativeEvent.target;
|
|
if (this$static.modal && !eventTargetsPopupOrPartner && !!target) {
|
|
target.blur && target != $doc.body && target.blur();
|
|
event_0.isCanceled = true;
|
|
return;
|
|
}
|
|
break;
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
function $setAnimationType(this$static, type_0){
|
|
this$static.animType = type_0?type_0:($clinit_PopupPanel$AnimationType() , CENTER_1);
|
|
}
|
|
|
|
function $setGlassEnabled(this$static){
|
|
this$static.isGlassEnabled = true;
|
|
if (!this$static.glass) {
|
|
this$static.glass = $doc.createElement('div');
|
|
$setClassName(this$static.glass, this$static.glassStyleName);
|
|
this$static.glass.style['position'] = ($clinit_Style$Position() , 'absolute');
|
|
this$static.glass.style['left'] = ($clinit_Style$Unit() , '0.0px');
|
|
this$static.glass.style['top'] = '0.0px';
|
|
}
|
|
}
|
|
|
|
function $setPopupPosition(this$static, left, top_0){
|
|
var elem;
|
|
this$static.leftPosition = left;
|
|
this$static.topPosition = top_0;
|
|
left -= 0;
|
|
top_0 -= 0;
|
|
elem = ($clinit_DOM() , this$static.element);
|
|
elem.style['left'] = left + ($clinit_Style$Unit() , 'px');
|
|
elem.style['top'] = top_0 + 'px';
|
|
}
|
|
|
|
function $setPopupPositionAndShow(this$static, callback){
|
|
($clinit_DOM() , this$static.element).style['visibility'] = 'hidden';
|
|
!!this$static.glass && (this$static.glass.style['visibility'] = 'hidden' , undefined);
|
|
this$static.show();
|
|
callback.setPosition($getPropertyInt(this$static.element, 'offsetWidth'), $getPropertyInt(this$static.element, 'offsetHeight'));
|
|
this$static.element.style['visibility'] = 'visible';
|
|
!!this$static.glass && (this$static.glass.style['visibility'] = 'visible' , undefined);
|
|
}
|
|
|
|
function $setVisible_0(this$static){
|
|
($clinit_DOM() , this$static.element).style['visibility'] = 'hidden';
|
|
!!this$static.glass && (this$static.glass.style['visibility'] = 'hidden' , undefined);
|
|
}
|
|
|
|
function $setWidget_0(this$static, w){
|
|
$setWidget(this$static, w);
|
|
$maybeUpdateSize(this$static);
|
|
}
|
|
|
|
function $show(this$static){
|
|
if (this$static.showing) {
|
|
return;
|
|
}
|
|
else
|
|
this$static.attached && $removeFromParent(this$static);
|
|
$setState(this$static.resizeAnimation, true, false);
|
|
}
|
|
|
|
function $updateHandlers(this$static){
|
|
if (this$static.nativePreviewHandlerRegistration) {
|
|
$removeHandler(this$static.nativePreviewHandlerRegistration.real);
|
|
this$static.nativePreviewHandlerRegistration = null;
|
|
}
|
|
if (this$static.historyHandlerRegistration) {
|
|
$removeHandler(this$static.historyHandlerRegistration.real);
|
|
this$static.historyHandlerRegistration = null;
|
|
}
|
|
if (this$static.showing) {
|
|
this$static.nativePreviewHandlerRegistration = addNativePreviewHandler(new PopupPanel$3(this$static));
|
|
this$static.historyHandlerRegistration = addValueChangeHandler(new PopupPanel$4(this$static));
|
|
}
|
|
}
|
|
|
|
function PopupPanel(){
|
|
SimplePanel.call(this);
|
|
this.glassResizer = new PopupPanel$1(this);
|
|
this.animType = ($clinit_PopupPanel$AnimationType() , CENTER_1);
|
|
this.glassStyleName = 'gwt-PopupPanelGlass';
|
|
this.isAnimationEnabled = false;
|
|
this.leftPosition = -1;
|
|
this.resizeAnimation = new PopupPanel$ResizeAnimation(this);
|
|
this.topPosition = -1;
|
|
$appendChild(($clinit_DOM() , this.element), $doc.createElement('div'));
|
|
$setPopupPosition(this, 0, 0);
|
|
$getParentElement($getFirstChildElement(this.element)).className = 'gwt-PopupPanel';
|
|
(null , $getFirstChildElement(this.element)).className = 'popupContent';
|
|
}
|
|
|
|
function PopupPanel_0(autoHide){
|
|
PopupPanel.call(this);
|
|
this.autoHide = autoHide;
|
|
this.autoHideOnHistoryEvents = autoHide;
|
|
}
|
|
|
|
defineClass(48, 255, $intern_57, PopupPanel_0);
|
|
_.getContainerElement = function getContainerElement_0(){
|
|
return $clinit_DOM() , $getFirstChildElement(this.element);
|
|
}
|
|
;
|
|
_.getOffsetHeight = function getOffsetHeight_0(){
|
|
return $getPropertyInt(($clinit_DOM() , this.element), 'offsetHeight');
|
|
}
|
|
;
|
|
_.getStyleElement = function getStyleElement_0(){
|
|
return $getParentElement(($clinit_DOM() , $getFirstChildElement(this.element)));
|
|
}
|
|
;
|
|
_.hide = function hide(autoClosed){
|
|
$hide(this, autoClosed);
|
|
}
|
|
;
|
|
_.onPreviewNativeEvent = function onPreviewNativeEvent_0(event_0){
|
|
event_0.isFirstHandler && false && (event_0.isCanceled = true);
|
|
}
|
|
;
|
|
_.onUnload = function onUnload_1(){
|
|
this.showing && $setState(this.resizeAnimation, false, true);
|
|
}
|
|
;
|
|
_.setHeight_0 = function setHeight_0(height){
|
|
this.desiredHeight = height;
|
|
$maybeUpdateSize(this);
|
|
height.length == 0 && (this.desiredHeight = null);
|
|
}
|
|
;
|
|
_.setWidget = function setWidget_0(w){
|
|
$setWidget_0(this, w);
|
|
}
|
|
;
|
|
_.setWidth_0 = function setWidth_0(width_0){
|
|
this.desiredWidth = width_0;
|
|
$maybeUpdateSize(this);
|
|
width_0.length == 0 && (this.desiredWidth = null);
|
|
}
|
|
;
|
|
_.show = function show_0(){
|
|
$show(this);
|
|
}
|
|
;
|
|
_.autoHide = false;
|
|
_.autoHideOnHistoryEvents = false;
|
|
_.isAnimationEnabled = false;
|
|
_.isGlassEnabled = false;
|
|
_.leftPosition = 0;
|
|
_.modal = false;
|
|
_.previewAllNativeEvents = false;
|
|
_.showing = false;
|
|
_.topPosition = 0;
|
|
var Lcom_google_gwt_user_client_ui_PopupPanel_2_classLit = createForClass('com.google.gwt.user.client.ui', 'PopupPanel', 48);
|
|
function $setWidget_1(this$static, w){
|
|
$setWidget(this$static.decPanel, w);
|
|
$maybeUpdateSize(this$static);
|
|
}
|
|
|
|
function DecoratedPopupPanel(autoHide, modal, prefix){
|
|
var rowStyles;
|
|
PopupPanel_0.call(this, autoHide);
|
|
this.modal = modal;
|
|
rowStyles = stampJavaTypeInfo(getClassLiteralForArray(Ljava_lang_String_2_classLit, 1), $intern_23, 2, 6, [prefix + 'Top', prefix + 'Middle', prefix + 'Bottom']);
|
|
this.decPanel = new DecoratorPanel(rowStyles);
|
|
$setStyleName(this.decPanel, '');
|
|
setStylePrimaryName($getParentElement(($clinit_DOM() , $getFirstChildElement(this.element))), 'gwt-DecoratedPopupPanel');
|
|
$setWidget_0(this, this.decPanel);
|
|
setStyleName($getFirstChildElement(this.element), 'popupContent', false);
|
|
setStyleName($getContainerElement(this.decPanel), prefix + 'Content', true);
|
|
}
|
|
|
|
defineClass(329, 48, $intern_57);
|
|
_.doAttachChildren = function doAttachChildren_1(){
|
|
$onAttach(this.decPanel);
|
|
}
|
|
;
|
|
_.doDetachChildren = function doDetachChildren_1(){
|
|
$onDetach(this.decPanel);
|
|
}
|
|
;
|
|
_.getWidget = function getWidget_0(){
|
|
return this.decPanel.widget;
|
|
}
|
|
;
|
|
_.iterator = function iterator_2(){
|
|
return new SimplePanel$1(this.decPanel);
|
|
}
|
|
;
|
|
_.remove_0 = function remove_3(w){
|
|
return $remove_2(this.decPanel, w);
|
|
}
|
|
;
|
|
_.setWidget = function setWidget_1(w){
|
|
$setWidget_1(this, w);
|
|
}
|
|
;
|
|
var Lcom_google_gwt_user_client_ui_DecoratedPopupPanel_2_classLit = createForClass('com.google.gwt.user.client.ui', 'DecoratedPopupPanel', 329);
|
|
function $getCellElement(this$static){
|
|
var td, tr;
|
|
tr = ($clinit_DOM() , $getChild(this$static.tbody, 0));
|
|
td = (null , $getChild(tr, 1));
|
|
return null , $getFirstChildElement(td);
|
|
}
|
|
|
|
function $getContainerElement(this$static){
|
|
return $clinit_DOM() , this$static.containerElem;
|
|
}
|
|
|
|
function DecoratorPanel(rowStyles){
|
|
var i, row, table, trElem;
|
|
SimplePanel_0.call(this, ($clinit_DOM() , $doc.createElement('table')));
|
|
table = this.element;
|
|
this.tbody = $doc.createElement('tbody');
|
|
$appendChild(table, resolve(this.tbody));
|
|
table['cellSpacing'] = 0;
|
|
table['cellPadding'] = 0;
|
|
for (i = 0; i < rowStyles.length; i++) {
|
|
row = (trElem = $doc.createElement('tr') , trElem.className = rowStyles[i] || '' , undefined , $clinit_LocaleInfo() , $appendChild(trElem, resolve(createTD(rowStyles[i] + 'Left'))) , $appendChild(trElem, resolve(createTD(rowStyles[i] + 'Center'))) , $appendChild(trElem, resolve(createTD(rowStyles[i] + 'Right'))) , trElem);
|
|
$appendChild(this.tbody, resolve(row));
|
|
i == 1 && (this.containerElem = $getFirstChildElement($getChild(row, 1)));
|
|
}
|
|
this.element.className = 'gwt-DecoratorPanel';
|
|
}
|
|
|
|
function createTD(styleName){
|
|
var inner, tdElem;
|
|
tdElem = ($clinit_DOM() , $doc.createElement('td'));
|
|
inner = $doc.createElement('div');
|
|
$appendChild(tdElem, resolve(inner));
|
|
tdElem.className = styleName || '';
|
|
inner.className = styleName + 'Inner' || '';
|
|
return tdElem;
|
|
}
|
|
|
|
defineClass(814, 255, $intern_54, DecoratorPanel);
|
|
_.getContainerElement = function getContainerElement_1(){
|
|
return $getContainerElement(this);
|
|
}
|
|
;
|
|
var Lcom_google_gwt_user_client_ui_DecoratorPanel_2_classLit = createForClass('com.google.gwt.user.client.ui', 'DecoratorPanel', 814);
|
|
function $beginDragging(this$static, event_0){
|
|
$onMouseDown(this$static, $getX(event_0), $getY(event_0));
|
|
}
|
|
|
|
function $continueDragging(this$static, event_0){
|
|
$onMouseMove(this$static, $getX(event_0), $getY(event_0));
|
|
}
|
|
|
|
function $endDragging(this$static, event_0){
|
|
$onMouseUp(($getX(event_0) , $getY(event_0) , this$static));
|
|
}
|
|
|
|
function $hide_0(this$static, autoClosed){
|
|
if (this$static.resizeHandlerRegistration) {
|
|
$removeHandler(this$static.resizeHandlerRegistration.real);
|
|
this$static.resizeHandlerRegistration = null;
|
|
}
|
|
$hide(this$static, autoClosed);
|
|
}
|
|
|
|
function $isCaptionEvent(this$static, event_0){
|
|
var target;
|
|
target = event_0.target;
|
|
if (is_0(target)) {
|
|
return isOrHasChildImpl($getParentElement(($clinit_DOM() , $getCellElement(this$static.decPanel))), target);
|
|
}
|
|
return false;
|
|
}
|
|
|
|
function $onMouseDown(this$static, x_0, y_0){
|
|
$clinit_DOM();
|
|
if (!sCaptureElem) {
|
|
this$static.dragging_0 = true;
|
|
setCapture(this$static.element);
|
|
this$static.dragStartX = x_0;
|
|
this$static.dragStartY = y_0;
|
|
}
|
|
}
|
|
|
|
function $onMouseMove(this$static, x_0, y_0){
|
|
var absX, absY;
|
|
if (this$static.dragging_0) {
|
|
absX = x_0 + $getAbsoluteLeft_0(($clinit_DOM() , this$static.element));
|
|
absY = y_0 + ($getBoundingClientRectTop(this$static.element) + $wnd.pageYOffset | 0);
|
|
if (absX < this$static.clientLeft || absX >= this$static.windowWidth || absY < this$static.clientTop) {
|
|
return;
|
|
}
|
|
$setPopupPosition(this$static, absX - this$static.dragStartX, absY - this$static.dragStartY);
|
|
}
|
|
}
|
|
|
|
function $onMouseUp(this$static){
|
|
this$static.dragging_0 = false;
|
|
releaseCapture(($clinit_DOM() , this$static.element));
|
|
}
|
|
|
|
function $setText(this$static, text_0){
|
|
$setText_0(this$static.caption, text_0);
|
|
}
|
|
|
|
function $show_0(this$static){
|
|
!this$static.resizeHandlerRegistration && (this$static.resizeHandlerRegistration = addResizeHandler(new DialogBox$1(this$static)));
|
|
$show(this$static);
|
|
}
|
|
|
|
function DialogBox(captionWidget){
|
|
var mouseHandler, td;
|
|
DecoratedPopupPanel.call(this, false, true, 'dialog');
|
|
$removeFromParent(captionWidget);
|
|
this.caption = captionWidget;
|
|
td = ($clinit_DOM() , $getCellElement(this.decPanel));
|
|
$appendChild(td, resolve($getElement(this.caption)));
|
|
$adopt(this, this.caption);
|
|
$getParentElement($getFirstChildElement(this.element)).className = 'gwt-DialogBox';
|
|
this.windowWidth = $getClientWidth($doc);
|
|
this.clientLeft = 0;
|
|
this.clientTop = 0;
|
|
mouseHandler = new DialogBox$MouseHandler(this);
|
|
$addDomHandler(this, mouseHandler, ($clinit_MouseDownEvent() , $clinit_MouseDownEvent() , TYPE_7));
|
|
$addDomHandler(this, mouseHandler, ($clinit_MouseUpEvent() , $clinit_MouseUpEvent() , TYPE_11));
|
|
$addDomHandler(this, mouseHandler, ($clinit_MouseMoveEvent() , $clinit_MouseMoveEvent() , TYPE_8));
|
|
$addDomHandler(this, mouseHandler, ($clinit_MouseOverEvent() , $clinit_MouseOverEvent() , TYPE_10));
|
|
$addDomHandler(this, mouseHandler, ($clinit_MouseOutEvent() , $clinit_MouseOutEvent() , TYPE_9));
|
|
}
|
|
|
|
defineClass(256, 329, $intern_58);
|
|
_.doAttachChildren = function doAttachChildren_2(){
|
|
try {
|
|
$onAttach(this.decPanel);
|
|
}
|
|
finally {
|
|
$onAttach(this.caption);
|
|
}
|
|
}
|
|
;
|
|
_.doDetachChildren = function doDetachChildren_2(){
|
|
try {
|
|
$onDetach(this.decPanel);
|
|
}
|
|
finally {
|
|
$onDetach(this.caption);
|
|
}
|
|
}
|
|
;
|
|
_.hide = function hide_0(autoClosed){
|
|
$hide_0(this, autoClosed);
|
|
}
|
|
;
|
|
_.onBrowserEvent = function onBrowserEvent_1(event_0){
|
|
switch ($clinit_DOM() , $eventGetTypeInt(event_0.type)) {
|
|
case 4:
|
|
case 8:
|
|
case 64:
|
|
case 16:
|
|
case 32:
|
|
if (!this.dragging_0 && !$isCaptionEvent(this, event_0)) {
|
|
return;
|
|
}
|
|
|
|
}
|
|
$onBrowserEvent(this, event_0);
|
|
}
|
|
;
|
|
_.onPreviewNativeEvent = function onPreviewNativeEvent_1(event_0){
|
|
var nativeEvent;
|
|
nativeEvent = event_0.nativeEvent;
|
|
!event_0.isCanceled && $getTypeInt(event_0.nativeEvent) == 4 && $isCaptionEvent(this, nativeEvent) && (nativeEvent.preventDefault() , undefined);
|
|
event_0.isFirstHandler && false && (event_0.isCanceled = true);
|
|
}
|
|
;
|
|
_.show = function show_1(){
|
|
$show_0(this);
|
|
}
|
|
;
|
|
_.clientLeft = 0;
|
|
_.clientTop = 0;
|
|
_.dragStartX = 0;
|
|
_.dragStartY = 0;
|
|
_.dragging_0 = false;
|
|
_.windowWidth = 0;
|
|
var Lcom_google_gwt_user_client_ui_DialogBox_2_classLit = createForClass('com.google.gwt.user.client.ui', 'DialogBox', 256);
|
|
function DialogBox$1(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(126, 1, $intern_41, DialogBox$1);
|
|
_.onResize = function onResize_1(event_0){
|
|
this.this$01.windowWidth = event_0.width_0;
|
|
}
|
|
;
|
|
var Lcom_google_gwt_user_client_ui_DialogBox$1_2_classLit = createForClass('com.google.gwt.user.client.ui', 'DialogBox/1', 126);
|
|
function $clinit_HasAutoHorizontalAlignment(){
|
|
$clinit_HasAutoHorizontalAlignment = emptyMethod;
|
|
ALIGN_CONTENT_START = new HasHorizontalAlignment$AutoHorizontalAlignmentConstant;
|
|
}
|
|
|
|
var ALIGN_CONTENT_START;
|
|
function $setHorizontalAlignment(this$static, align_0){
|
|
this$static.autoHorizontalAlignment = align_0;
|
|
$updateHorizontalAlignment(this$static);
|
|
}
|
|
|
|
function $updateHorizontalAlignment(this$static){
|
|
var align_0;
|
|
!this$static.autoHorizontalAlignment?(align_0 = null):this$static.autoHorizontalAlignment?(align_0 = this$static.autoHorizontalAlignment):(align_0 = this$static.autoHorizontalAlignment == ($clinit_HasAutoHorizontalAlignment() , ALIGN_CONTENT_START)?startOf(this$static.directionalTextHelper.textDir):endOf(this$static.directionalTextHelper.textDir));
|
|
if (align_0 != this$static.horzAlign) {
|
|
this$static.horzAlign = align_0;
|
|
($clinit_DOM() , this$static.element).style['textAlign'] = !this$static.horzAlign?'':this$static.horzAlign.textAlignString;
|
|
}
|
|
}
|
|
|
|
function LabelBase(element){
|
|
$setElement_0(this, ($clinit_DOM() , element));
|
|
this.directionalTextHelper = new DirectionalTextHelper(this.element);
|
|
}
|
|
|
|
defineClass(176, 24, {28:1, 25:1, 134:1, 27:1, 315:1, 227:1, 23:1, 196:1, 29:1, 176:1, 22:1, 24:1});
|
|
var Lcom_google_gwt_user_client_ui_LabelBase_2_classLit = createForClass('com.google.gwt.user.client.ui', 'LabelBase', 176);
|
|
function $setText_0(this$static, text_0){
|
|
$setTextOrHtml(this$static.directionalTextHelper, text_0, false);
|
|
$updateHorizontalAlignment(this$static);
|
|
}
|
|
|
|
function Label(){
|
|
LabelBase.call(this, $doc.createElement('div'));
|
|
($clinit_DOM() , this.element).className = 'gwt-Label';
|
|
}
|
|
|
|
function Label_0(element){
|
|
LabelBase.call(this, ($equalsIgnoreCase('span', element.tagName) , element));
|
|
}
|
|
|
|
function Label_1(text_0){
|
|
Label.call(this);
|
|
$setTextOrHtml(this.directionalTextHelper, text_0, false);
|
|
$updateHorizontalAlignment(this);
|
|
}
|
|
|
|
function Label_2(text_0){
|
|
Label_1.call(this, text_0);
|
|
($clinit_DOM() , this.element).style['whiteSpace'] = ($clinit_Style$WhiteSpace() , 'normal');
|
|
}
|
|
|
|
defineClass(33, 176, $intern_59, Label, Label_1, Label_2);
|
|
var Lcom_google_gwt_user_client_ui_Label_2_classLit = createForClass('com.google.gwt.user.client.ui', 'Label', 33);
|
|
function HTML(){
|
|
Label_0.call(this, $doc.createElement('div'));
|
|
($clinit_DOM() , this.element).className = 'gwt-HTML';
|
|
}
|
|
|
|
function HTML_0(html){
|
|
HTML.call(this);
|
|
$setTextOrHtml(this.directionalTextHelper, html, true);
|
|
$updateHorizontalAlignment(this);
|
|
}
|
|
|
|
defineClass(257, 33, $intern_60, HTML_0);
|
|
var Lcom_google_gwt_user_client_ui_HTML_2_classLit = createForClass('com.google.gwt.user.client.ui', 'HTML', 257);
|
|
function DialogBox$CaptionImpl(){
|
|
HTML.call(this);
|
|
($clinit_DOM() , this.element).className = 'Caption';
|
|
}
|
|
|
|
defineClass(517, 257, $intern_60, DialogBox$CaptionImpl);
|
|
var Lcom_google_gwt_user_client_ui_DialogBox$CaptionImpl_2_classLit = createForClass('com.google.gwt.user.client.ui', 'DialogBox/CaptionImpl', 517);
|
|
function DialogBox$MouseHandler(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(518, 1, {208:1, 457:1, 173:1, 228:1, 316:1, 11:1}, DialogBox$MouseHandler);
|
|
_.onMouseDown = function onMouseDown(event_0){
|
|
$beginDragging(this.this$01, event_0);
|
|
}
|
|
;
|
|
_.onMouseMove = function onMouseMove(event_0){
|
|
$continueDragging(this.this$01, event_0);
|
|
}
|
|
;
|
|
_.onMouseOut = function onMouseOut(event_0){
|
|
}
|
|
;
|
|
_.onMouseOver = function onMouseOver(event_0){
|
|
}
|
|
;
|
|
_.onMouseUp = function onMouseUp(event_0){
|
|
$endDragging(this.this$01, event_0);
|
|
}
|
|
;
|
|
var Lcom_google_gwt_user_client_ui_DialogBox$MouseHandler_2_classLit = createForClass('com.google.gwt.user.client.ui', 'DialogBox/MouseHandler', 518);
|
|
function $setTextOrHtml(this$static, content_0, isHtml){
|
|
isHtml?$setInnerHTML(this$static.element, content_0):$setInnerText(this$static.element, content_0);
|
|
if (this$static.textDir != this$static.initialElementDir) {
|
|
this$static.textDir = this$static.initialElementDir;
|
|
setDirectionOnElement(this$static.element, this$static.initialElementDir);
|
|
}
|
|
}
|
|
|
|
function DirectionalTextHelper(element){
|
|
this.element = element;
|
|
this.initialElementDir = getDirectionOnElement(element);
|
|
this.textDir = this.initialElementDir;
|
|
}
|
|
|
|
defineClass(292, 1, {134:1}, DirectionalTextHelper);
|
|
var Lcom_google_gwt_user_client_ui_DirectionalTextHelper_2_classLit = createForClass('com.google.gwt.user.client.ui', 'DirectionalTextHelper', 292);
|
|
function $addEast(this$static, widget, size_0){
|
|
$insert_0(this$static, widget, ($clinit_DockLayoutPanel$Direction() , EAST), size_0);
|
|
}
|
|
|
|
function $addNorth(this$static, widget, size_0){
|
|
$insert_0(this$static, widget, ($clinit_DockLayoutPanel$Direction() , NORTH), size_0);
|
|
}
|
|
|
|
function $doLayout(this$static){
|
|
var bottom, child, child$iterator, data_0, layer, left, right, top_0;
|
|
left = 0;
|
|
top_0 = 0;
|
|
right = 0;
|
|
bottom = 0;
|
|
for (child$iterator = new WidgetCollection$WidgetIterator(this$static.children); child$iterator.index_0 < child$iterator.this$01.size_0;) {
|
|
child = $next_1(child$iterator);
|
|
data_0 = child.layoutData;
|
|
layer = data_0.layer;
|
|
if (data_0.hidden) {
|
|
layer.visible = false;
|
|
continue;
|
|
}
|
|
switch ($getResolvedDirection(data_0.direction_0).ordinal) {
|
|
case 0:
|
|
$setLeftRight(layer, left, this$static.unit, right, this$static.unit);
|
|
$setTopHeight(layer, top_0, this$static.unit, data_0.size_0, this$static.unit);
|
|
top_0 += data_0.size_0;
|
|
break;
|
|
case 2:
|
|
$setLeftRight(layer, left, this$static.unit, right, this$static.unit);
|
|
$setBottomHeight(layer, bottom, this$static.unit, data_0.size_0, this$static.unit);
|
|
bottom += data_0.size_0;
|
|
break;
|
|
case 3:
|
|
$setTopBottom(layer, top_0, this$static.unit, bottom, this$static.unit);
|
|
$setLeftWidth(layer, left, this$static.unit, data_0.size_0, this$static.unit);
|
|
left += data_0.size_0;
|
|
break;
|
|
case 1:
|
|
$setTopBottom(layer, top_0, this$static.unit, bottom, this$static.unit);
|
|
$setRightWidth(layer, right, this$static.unit, data_0.size_0, this$static.unit);
|
|
right += data_0.size_0;
|
|
break;
|
|
case 4:
|
|
$setLeftRight(layer, left, this$static.unit, right, this$static.unit);
|
|
$setTopBottom(layer, top_0, this$static.unit, bottom, this$static.unit);
|
|
}
|
|
layer.visible = true;
|
|
}
|
|
}
|
|
|
|
function $getResolvedDirection(direction){
|
|
if (direction == ($clinit_DockLayoutPanel$Direction() , LINE_START)) {
|
|
return $clinit_LocaleInfo() , WEST;
|
|
}
|
|
else if (direction == LINE_END) {
|
|
return $clinit_LocaleInfo() , EAST;
|
|
}
|
|
return direction;
|
|
}
|
|
|
|
function $insert_0(this$static, widget, direction, size_0){
|
|
var children, data_0, layer;
|
|
$removeFromParent(widget);
|
|
children = this$static.children;
|
|
$insert_3(children, widget, children.size_0);
|
|
direction == ($clinit_DockLayoutPanel$Direction() , CENTER_0) && (this$static.center = widget);
|
|
layer = $attachChild(this$static.layout, ($clinit_DOM() , widget.element), widget);
|
|
data_0 = new DockLayoutPanel$LayoutData(direction, size_0, layer);
|
|
widget.layoutData = data_0;
|
|
$setParent(widget, this$static);
|
|
$schedule_0(this$static.layoutCmd);
|
|
}
|
|
|
|
function $setWidgetHidden(this$static, widget, hidden){
|
|
var data_0;
|
|
data_0 = widget.layoutData;
|
|
if (data_0.hidden == hidden) {
|
|
return;
|
|
}
|
|
data_0.hidden = hidden;
|
|
$schedule_0(this$static.layoutCmd);
|
|
}
|
|
|
|
function DockLayoutPanel(unit){
|
|
ComplexPanel.call(this);
|
|
this.unit = unit;
|
|
$setElement(this, $doc.createElement('div'));
|
|
this.layout = new Layout(($clinit_DOM() , this.element));
|
|
this.layoutCmd = new DockLayoutPanel$DockAnimateCommand(this, this.layout);
|
|
}
|
|
|
|
defineClass(568, 238, $intern_61, DockLayoutPanel);
|
|
_.add_0 = function add_6(widget){
|
|
$insert_0(this, widget, ($clinit_DockLayoutPanel$Direction() , CENTER_0), 0);
|
|
}
|
|
;
|
|
_.onAttach = function onAttach_2(){
|
|
$onAttach(this);
|
|
}
|
|
;
|
|
_.onDetach = function onDetach_1(){
|
|
$onDetach(this);
|
|
}
|
|
;
|
|
_.onResize_0 = function onResize_2(){
|
|
var child, child$iterator;
|
|
for (child$iterator = new WidgetCollection$WidgetIterator(this.children); child$iterator.index_0 < child$iterator.this$01.size_0;) {
|
|
child = $next_1(child$iterator);
|
|
instanceOf(child, 209) && child.onResize_0();
|
|
}
|
|
}
|
|
;
|
|
_.remove_0 = function remove_4(w){
|
|
var data_0, removed;
|
|
removed = $remove_0(this, w);
|
|
if (removed) {
|
|
w == this.center && (this.center = null);
|
|
data_0 = w.layoutData;
|
|
$removeChild_0(this.layout, data_0.layer);
|
|
}
|
|
return removed;
|
|
}
|
|
;
|
|
var Lcom_google_gwt_user_client_ui_DockLayoutPanel_2_classLit = createForClass('com.google.gwt.user.client.ui', 'DockLayoutPanel', 568);
|
|
function $clinit_DockLayoutPanel$Direction(){
|
|
$clinit_DockLayoutPanel$Direction = emptyMethod;
|
|
NORTH = new DockLayoutPanel$Direction('NORTH', 0);
|
|
EAST = new DockLayoutPanel$Direction('EAST', 1);
|
|
SOUTH = new DockLayoutPanel$Direction('SOUTH', 2);
|
|
WEST = new DockLayoutPanel$Direction('WEST', 3);
|
|
CENTER_0 = new DockLayoutPanel$Direction('CENTER', 4);
|
|
LINE_START = new DockLayoutPanel$Direction('LINE_START', 5);
|
|
LINE_END = new DockLayoutPanel$Direction('LINE_END', 6);
|
|
}
|
|
|
|
function DockLayoutPanel$Direction(enum$name, enum$ordinal){
|
|
Enum.call(this, enum$name, enum$ordinal);
|
|
}
|
|
|
|
function values_12(){
|
|
$clinit_DockLayoutPanel$Direction();
|
|
return stampJavaTypeInfo(getClassLiteralForArray(Lcom_google_gwt_user_client_ui_DockLayoutPanel$Direction_2_classLit, 1), $intern_3, 178, 0, [NORTH, EAST, SOUTH, WEST, CENTER_0, LINE_START, LINE_END]);
|
|
}
|
|
|
|
defineClass(178, 15, {178:1, 3:1, 16:1, 15:1}, DockLayoutPanel$Direction);
|
|
var CENTER_0, EAST, LINE_END, LINE_START, NORTH, SOUTH, WEST;
|
|
var Lcom_google_gwt_user_client_ui_DockLayoutPanel$Direction_2_classLit = createForEnum('com.google.gwt.user.client.ui', 'DockLayoutPanel/Direction', 178, values_12);
|
|
function $schedule_0(this$static){
|
|
this$static.duration = 0;
|
|
this$static.canceled_0 = false;
|
|
if (!this$static.scheduled) {
|
|
this$static.scheduled = true;
|
|
$scheduleFinally(($clinit_SchedulerImpl() , INSTANCE), this$static);
|
|
}
|
|
}
|
|
|
|
function LayoutCommand(layout){
|
|
this.layout = layout;
|
|
}
|
|
|
|
defineClass(332, 1, {}, LayoutCommand);
|
|
_.doBeforeLayout = function doBeforeLayout(){
|
|
}
|
|
;
|
|
_.execute_1 = function execute_9(){
|
|
this.scheduled = false;
|
|
if (this.canceled_0) {
|
|
return;
|
|
}
|
|
this.doBeforeLayout();
|
|
$layout(this.layout, this.duration, new LayoutCommand$1);
|
|
}
|
|
;
|
|
_.canceled_0 = false;
|
|
_.duration = 0;
|
|
_.scheduled = false;
|
|
var Lcom_google_gwt_user_client_ui_LayoutCommand_2_classLit = createForClass('com.google.gwt.user.client.ui', 'LayoutCommand', 332);
|
|
function DockLayoutPanel$DockAnimateCommand(this$0, layout){
|
|
this.this$01 = this$0;
|
|
LayoutCommand.call(this, layout);
|
|
}
|
|
|
|
defineClass(569, 332, {}, DockLayoutPanel$DockAnimateCommand);
|
|
_.doBeforeLayout = function doBeforeLayout_0(){
|
|
$doLayout(this.this$01);
|
|
}
|
|
;
|
|
var Lcom_google_gwt_user_client_ui_DockLayoutPanel$DockAnimateCommand_2_classLit = createForClass('com.google.gwt.user.client.ui', 'DockLayoutPanel/DockAnimateCommand', 569);
|
|
function DockLayoutPanel$LayoutData(direction, size_0, layer){
|
|
this.direction_0 = direction;
|
|
this.size_0 = size_0;
|
|
this.layer = layer;
|
|
}
|
|
|
|
defineClass(331, 1, {331:1}, DockLayoutPanel$LayoutData);
|
|
_.hidden = false;
|
|
_.size_0 = 0;
|
|
var Lcom_google_gwt_user_client_ui_DockLayoutPanel$LayoutData_2_classLit = createForClass('com.google.gwt.user.client.ui', 'DockLayoutPanel/LayoutData', 331);
|
|
function $setName_0(this$static, name_0){
|
|
$setName(($clinit_DOM() , this$static.element), name_0);
|
|
}
|
|
|
|
function FileUpload(){
|
|
FileUpload_0.call(this, $createInputElement($doc, 'file'));
|
|
($clinit_DOM() , this.element).className = 'gwt-FileUpload';
|
|
}
|
|
|
|
function FileUpload_0(element){
|
|
$setElement_0(this, ($clinit_DOM() , element));
|
|
}
|
|
|
|
defineClass(240, 82, {71:1, 119:1, 94:1, 122:1, 85:1, 98:1, 121:1, 69:1, 70:1, 72:1, 73:1, 75:1, 74:1, 76:1, 77:1, 78:1, 120:1, 96:1, 97:1, 95:1, 124:1, 125:1, 123:1, 86:1, 90:1, 88:1, 89:1, 87:1, 91:1, 102:1, 101:1, 100:1, 99:1, 28:1, 25:1, 27:1, 82:1, 116:1, 105:1, 115:1, 146:1, 23:1, 29:1, 92:1, 117:1, 118:1, 93:1, 22:1, 24:1}, FileUpload);
|
|
var Lcom_google_gwt_user_client_ui_FileUpload_2_classLit = createForClass('com.google.gwt.user.client.ui', 'FileUpload', 240);
|
|
function $addCells(tbody, row, num){
|
|
var i, rowElem, tdElement;
|
|
rowElem = tbody.rows[row];
|
|
for (i = 0; i < num; i++) {
|
|
tdElement = $doc.createElement('td');
|
|
rowElem.appendChild(tdElement);
|
|
}
|
|
}
|
|
|
|
function $checkCellBounds(this$static, row, column){
|
|
var cellSize;
|
|
$checkRowBounds(this$static, row);
|
|
if (column < 0) {
|
|
throw toJs(new IndexOutOfBoundsException_0('Column ' + column + ' must be non-negative: ' + column));
|
|
}
|
|
cellSize = this$static.numColumns;
|
|
if (cellSize <= column) {
|
|
throw toJs(new IndexOutOfBoundsException_0('Column index: ' + column + ', Column size: ' + this$static.numColumns));
|
|
}
|
|
}
|
|
|
|
function $checkRowBounds(this$static, row){
|
|
var rowSize;
|
|
rowSize = this$static.getRowCount();
|
|
if (row >= rowSize || row < 0) {
|
|
throw toJs(new IndexOutOfBoundsException_0('Row index: ' + row + ', Row size: ' + rowSize));
|
|
}
|
|
}
|
|
|
|
function $cleanCell(this$static, row, column, clearInnerHTML){
|
|
var td;
|
|
td = $getRawElement(this$static.cellFormatter, row, column);
|
|
$internalClearCell(this$static, ($clinit_DOM() , td), clearInnerHTML);
|
|
return td;
|
|
}
|
|
|
|
function $getDOMCellCount(tableBody, row){
|
|
var rowElement;
|
|
rowElement = tableBody.rows[row];
|
|
return rowElement.cells.length;
|
|
}
|
|
|
|
function $getDOMRowCount(tbody){
|
|
return ($clinit_DOM() , tbody).rows.length;
|
|
}
|
|
|
|
function $internalClearCell(this$static, td, clearInnerHTML){
|
|
var maybeChild, widget;
|
|
maybeChild = ($clinit_DOM() , $getFirstChildElement(td));
|
|
widget = null;
|
|
!!maybeChild && (widget = $get(this$static.widgetMap, maybeChild));
|
|
if (widget) {
|
|
$remove_3(this$static, widget);
|
|
return true;
|
|
}
|
|
else {
|
|
clearInnerHTML && (td.innerHTML = '' , undefined);
|
|
return false;
|
|
}
|
|
}
|
|
|
|
function $remove_3(this$static, widget){
|
|
var elem;
|
|
if (widget.parent_0 != this$static) {
|
|
return false;
|
|
}
|
|
try {
|
|
$setParent(widget, null);
|
|
}
|
|
finally {
|
|
elem = ($clinit_DOM() , widget.element);
|
|
$removeChild((null , $getParentElement(elem)), elem);
|
|
$removeByElement(this$static.widgetMap, elem);
|
|
}
|
|
return true;
|
|
}
|
|
|
|
function $removeRow(this$static, row){
|
|
var column, columnCount, td;
|
|
columnCount = this$static.numColumns;
|
|
for (column = 0; column < columnCount; ++column) {
|
|
td = $getRawElement(this$static.cellFormatter, row, column);
|
|
$internalClearCell(this$static, ($clinit_DOM() , td), false);
|
|
}
|
|
$removeChild(this$static.bodyElem, $getRow(this$static.bodyElem, row));
|
|
}
|
|
|
|
function $setCellFormatter(this$static, cellFormatter){
|
|
this$static.cellFormatter = cellFormatter;
|
|
}
|
|
|
|
function $setColumnFormatter(this$static, formatter){
|
|
!!this$static.columnFormatter && (formatter.columnGroup = this$static.columnFormatter.columnGroup);
|
|
this$static.columnFormatter = formatter;
|
|
$prepareColumnGroup(this$static.columnFormatter);
|
|
}
|
|
|
|
function $setRowFormatter(this$static, rowFormatter){
|
|
this$static.rowFormatter = rowFormatter;
|
|
}
|
|
|
|
function $setText_1(this$static, row, text_0){
|
|
var td;
|
|
$prepareCell(this$static, row, 0);
|
|
td = $cleanCell(this$static, row, 0, text_0 == null);
|
|
text_0 != null && (td.textContent = text_0 || '' , undefined);
|
|
}
|
|
|
|
function $setWidget_2(this$static, row, column, widget){
|
|
var td;
|
|
this$static.prepareCell(row, column);
|
|
td = $cleanCell(this$static, row, column, true);
|
|
if (widget) {
|
|
$removeFromParent(widget);
|
|
$put(this$static.widgetMap, widget);
|
|
$clinit_DOM();
|
|
$appendChild(td, resolve(widget.element));
|
|
$setParent(widget, this$static);
|
|
}
|
|
}
|
|
|
|
function HTMLTable(){
|
|
this.widgetMap = new ElementMapperImpl;
|
|
this.tableElem = ($clinit_DOM() , $doc.createElement('table'));
|
|
this.bodyElem = $doc.createElement('tbody');
|
|
$appendChild(this.tableElem, resolve(this.bodyElem));
|
|
$setElement(this, this.tableElem);
|
|
}
|
|
|
|
defineClass(342, 981, $intern_62);
|
|
_.iterator = function iterator_3(){
|
|
return new HTMLTable$1(this);
|
|
}
|
|
;
|
|
_.remove_0 = function remove_5(widget){
|
|
return $remove_3(this, widget);
|
|
}
|
|
;
|
|
var Lcom_google_gwt_user_client_ui_HTMLTable_2_classLit = createForClass('com.google.gwt.user.client.ui', 'HTMLTable', 342);
|
|
function $prepareCell(this$static, row, column){
|
|
var cellCount, required;
|
|
$prepareRow(this$static, row);
|
|
if (column < 0) {
|
|
throw toJs(new IndexOutOfBoundsException_0('Cannot create a column with a negative index: ' + column));
|
|
}
|
|
cellCount = ($checkRowBounds(this$static, row) , $getDOMCellCount(($clinit_DOM() , this$static.bodyElem), row));
|
|
required = column + 1 - cellCount;
|
|
required > 0 && $addCells(this$static.bodyElem, row, required);
|
|
}
|
|
|
|
function $prepareRow(this$static, row){
|
|
var i, rowCount, tr;
|
|
if (row < 0) {
|
|
throw toJs(new IndexOutOfBoundsException_0('Cannot create a row with a negative index: ' + row));
|
|
}
|
|
rowCount = $getDOMRowCount(this$static.bodyElem);
|
|
for (i = rowCount; i <= row; i++) {
|
|
i != $getDOMRowCount(this$static.bodyElem) && $checkRowBounds(this$static, i);
|
|
tr = ($clinit_DOM() , $doc.createElement('tr'));
|
|
insertChild(this$static.bodyElem, tr, i);
|
|
}
|
|
}
|
|
|
|
function FlexTable(){
|
|
HTMLTable.call(this);
|
|
$setCellFormatter(this, new FlexTable$FlexCellFormatter(this));
|
|
$setRowFormatter(this, new HTMLTable$RowFormatter(this));
|
|
$setColumnFormatter(this, new HTMLTable$ColumnFormatter(this));
|
|
}
|
|
|
|
defineClass(740, 342, $intern_62, FlexTable);
|
|
_.getRowCount = function getRowCount(){
|
|
return $getDOMRowCount(this.bodyElem);
|
|
}
|
|
;
|
|
_.prepareCell = function prepareCell(row, column){
|
|
$prepareCell(this, row, column);
|
|
}
|
|
;
|
|
_.prepareRow = function prepareRow(row){
|
|
$prepareRow(this, row);
|
|
}
|
|
;
|
|
var Lcom_google_gwt_user_client_ui_FlexTable_2_classLit = createForClass('com.google.gwt.user.client.ui', 'FlexTable', 740);
|
|
function $getCellElement_0(tbody, row, col){
|
|
return tbody.rows[row].cells[col];
|
|
}
|
|
|
|
function $getRawElement(this$static, row, column){
|
|
return $getCellElement_0(this$static.this$01.bodyElem, row, column);
|
|
}
|
|
|
|
function $setVerticalAlignment(this$static, row, column, align_0){
|
|
this$static.this$01.prepareCell(row, column);
|
|
$getCellElement_0(this$static.this$01.bodyElem, row, column).style['verticalAlign'] = align_0.verticalAlignString;
|
|
}
|
|
|
|
function HTMLTable$CellFormatter(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(343, 1, {}, HTMLTable$CellFormatter);
|
|
var Lcom_google_gwt_user_client_ui_HTMLTable$CellFormatter_2_classLit = createForClass('com.google.gwt.user.client.ui', 'HTMLTable/CellFormatter', 343);
|
|
function FlexTable$FlexCellFormatter(this$0){
|
|
HTMLTable$CellFormatter.call(this, this$0);
|
|
}
|
|
|
|
defineClass(741, 343, {}, FlexTable$FlexCellFormatter);
|
|
var Lcom_google_gwt_user_client_ui_FlexTable$FlexCellFormatter_2_classLit = createForClass('com.google.gwt.user.client.ui', 'FlexTable/FlexCellFormatter', 741);
|
|
function $add_2(this$static, w){
|
|
$add(this$static, w, ($clinit_DOM() , this$static.element));
|
|
}
|
|
|
|
function FlowPanel(){
|
|
ComplexPanel.call(this);
|
|
$setElement(this, $doc.createElement('div'));
|
|
}
|
|
|
|
defineClass(219, 238, $intern_54, FlowPanel);
|
|
_.add_0 = function add_7(w){
|
|
$add_2(this, w);
|
|
}
|
|
;
|
|
var Lcom_google_gwt_user_client_ui_FlowPanel_2_classLit = createForClass('com.google.gwt.user.client.ui', 'FlowPanel', 219);
|
|
function Frame_0(){
|
|
$setElement(this, $doc.createElement('iframe'));
|
|
($clinit_DOM() , this.element).className = 'gwt-Frame';
|
|
this.element.src = 'iframe.html';
|
|
}
|
|
|
|
defineClass(338, 24, $intern_4, Frame_0);
|
|
var Lcom_google_gwt_user_client_ui_Frame_2_classLit = createForClass('com.google.gwt.user.client.ui', 'Frame', 338);
|
|
function $prepareRow_0(this$static, row){
|
|
if (row < 0) {
|
|
throw toJs(new IndexOutOfBoundsException_0('Cannot access a row with a negative index: ' + row));
|
|
}
|
|
if (row >= this$static.numRows) {
|
|
throw toJs(new IndexOutOfBoundsException_0('Row index: ' + row + ', Row size: ' + this$static.numRows));
|
|
}
|
|
}
|
|
|
|
function $removeRow_0(this$static, row){
|
|
$removeRow(this$static, row);
|
|
--this$static.numRows;
|
|
}
|
|
|
|
function $resizeColumns(this$static, columns){
|
|
var i, j, td, tr, tr_0, td_0, td_1;
|
|
if (this$static.numColumns == columns) {
|
|
return;
|
|
}
|
|
if (columns < 0) {
|
|
throw toJs(new IndexOutOfBoundsException_0('Cannot set number of columns to ' + columns));
|
|
}
|
|
if (this$static.numColumns > columns) {
|
|
for (i = 0; i < this$static.numRows; i++) {
|
|
for (j = this$static.numColumns - 1; j >= columns; j--) {
|
|
$checkCellBounds(this$static, i, j);
|
|
td = $cleanCell(this$static, i, j, false);
|
|
tr = $getRow(this$static.bodyElem, i);
|
|
tr.removeChild(td);
|
|
}
|
|
}
|
|
}
|
|
else {
|
|
for (i = 0; i < this$static.numRows; i++) {
|
|
for (j = this$static.numColumns; j < columns; j++) {
|
|
tr_0 = $getRow(this$static.bodyElem, i);
|
|
td_0 = (td_1 = ($clinit_DOM() , $doc.createElement('td')) , td_1.innerHTML = ' ' , $clinit_DOM() , td_1);
|
|
$insertChild(tr_0, resolve(td_0), j);
|
|
}
|
|
}
|
|
}
|
|
this$static.numColumns = columns;
|
|
$resizeColumnGroup(this$static.columnFormatter, columns, false);
|
|
}
|
|
|
|
function $resizeRows(this$static, rows_0){
|
|
if (this$static.numRows == rows_0) {
|
|
return;
|
|
}
|
|
if (rows_0 < 0) {
|
|
throw toJs(new IndexOutOfBoundsException_0('Cannot set number of rows to ' + rows_0));
|
|
}
|
|
if (this$static.numRows < rows_0) {
|
|
addRows(($clinit_DOM() , this$static.bodyElem), rows_0 - this$static.numRows, this$static.numColumns);
|
|
this$static.numRows = rows_0;
|
|
}
|
|
else {
|
|
while (this$static.numRows > rows_0) {
|
|
$removeRow_0(this$static, this$static.numRows - 1);
|
|
}
|
|
}
|
|
}
|
|
|
|
function Grid(rows_0, columns){
|
|
HTMLTable.call(this);
|
|
$setCellFormatter(this, new HTMLTable$CellFormatter(this));
|
|
$setRowFormatter(this, new HTMLTable$RowFormatter(this));
|
|
$setColumnFormatter(this, new HTMLTable$ColumnFormatter(this));
|
|
$resizeColumns(this, columns);
|
|
$resizeRows(this, rows_0);
|
|
}
|
|
|
|
function addRows(table, rows_0, columns){
|
|
var td = $doc.createElement('td');
|
|
td.innerHTML = ' ';
|
|
var row = $doc.createElement('tr');
|
|
for (var cellNum = 0; cellNum < columns; cellNum++) {
|
|
var cell = td.cloneNode(true);
|
|
row.appendChild(cell);
|
|
}
|
|
table.appendChild(row);
|
|
for (var rowNum = 1; rowNum < rows_0; rowNum++) {
|
|
table.appendChild(row.cloneNode(true));
|
|
}
|
|
}
|
|
|
|
defineClass(169, 342, $intern_62, Grid);
|
|
_.getRowCount = function getRowCount_0(){
|
|
return this.numRows;
|
|
}
|
|
;
|
|
_.prepareCell = function prepareCell_0(row, column){
|
|
$prepareRow_0(this, row);
|
|
if (column < 0) {
|
|
throw toJs(new IndexOutOfBoundsException_0('Cannot access a column with a negative index: ' + column));
|
|
}
|
|
if (column >= this.numColumns) {
|
|
throw toJs(new IndexOutOfBoundsException_0('Column index: ' + column + ', Column size: ' + this.numColumns));
|
|
}
|
|
}
|
|
;
|
|
_.prepareRow = function prepareRow_0(row){
|
|
$prepareRow_0(this, row);
|
|
}
|
|
;
|
|
_.numColumns = 0;
|
|
_.numRows = 0;
|
|
var Lcom_google_gwt_user_client_ui_Grid_2_classLit = createForClass('com.google.gwt.user.client.ui', 'Grid', 169);
|
|
function $findNext(this$static){
|
|
while (++this$static.nextIndex < this$static.widgetList.array.length) {
|
|
if ($get_2(this$static.widgetList, this$static.nextIndex) != null) {
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
|
|
function $next(this$static){
|
|
var result;
|
|
if (this$static.nextIndex >= this$static.widgetList.array.length) {
|
|
throw toJs(new NoSuchElementException);
|
|
}
|
|
result = $get_2(this$static.widgetList, this$static.nextIndex);
|
|
this$static.lastIndex = this$static.nextIndex;
|
|
$findNext(this$static);
|
|
return result;
|
|
}
|
|
|
|
function HTMLTable$1(this$0){
|
|
this.this$01 = this$0;
|
|
this.widgetList = this.this$01.widgetMap.uiObjectList;
|
|
$findNext(this);
|
|
}
|
|
|
|
defineClass(742, 1, {}, HTMLTable$1);
|
|
_.next_1 = function next_0(){
|
|
return $next(this);
|
|
}
|
|
;
|
|
_.hasNext_0 = function hasNext(){
|
|
return this.nextIndex < this.widgetList.array.length;
|
|
}
|
|
;
|
|
_.remove_1 = function remove_6(){
|
|
var w;
|
|
if (this.lastIndex < 0) {
|
|
throw toJs(new IllegalStateException);
|
|
}
|
|
w = $get_2(this.widgetList, this.lastIndex);
|
|
$removeFromParent(w);
|
|
this.lastIndex = -1;
|
|
}
|
|
;
|
|
_.lastIndex = -1;
|
|
_.nextIndex = -1;
|
|
var Lcom_google_gwt_user_client_ui_HTMLTable$1_2_classLit = createForClass('com.google.gwt.user.client.ui', 'HTMLTable/1', 742);
|
|
function $prepareColumnGroup(this$static){
|
|
if (!this$static.columnGroup) {
|
|
this$static.columnGroup = ($clinit_DOM() , $doc.createElement('colgroup'));
|
|
insertChild(this$static.this$01.tableElem, this$static.columnGroup, 0);
|
|
$appendChild(this$static.columnGroup, resolve($doc.createElement('col')));
|
|
}
|
|
}
|
|
|
|
function $resizeColumnGroup(this$static, columns, growOnly){
|
|
var i, num;
|
|
columns = $wnd.Math.max(columns, 1);
|
|
num = this$static.columnGroup.childNodes.length;
|
|
if (num < columns) {
|
|
for (i = num; i < columns; i++) {
|
|
$appendChild(this$static.columnGroup, $doc.createElement('col'));
|
|
}
|
|
}
|
|
else if (!growOnly && num > columns) {
|
|
for (i = num; i > columns; i--) {
|
|
$removeChild(this$static.columnGroup, this$static.columnGroup.lastChild);
|
|
}
|
|
}
|
|
}
|
|
|
|
function HTMLTable$ColumnFormatter(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(344, 1, {}, HTMLTable$ColumnFormatter);
|
|
var Lcom_google_gwt_user_client_ui_HTMLTable$ColumnFormatter_2_classLit = createForClass('com.google.gwt.user.client.ui', 'HTMLTable/ColumnFormatter', 344);
|
|
function $getRow(tbody, row){
|
|
return $getRow_0(($clinit_DOM() , tbody), row);
|
|
}
|
|
|
|
function $getRow_0(tbody, row){
|
|
return $clinit_DOM() , tbody.rows[row];
|
|
}
|
|
|
|
function $setVisible_1(this$static, row, visible){
|
|
var e;
|
|
e = (this$static.this$01.prepareRow(row) , $clinit_DOM() , $getRow(this$static.this$01.bodyElem, row));
|
|
setVisible(e, visible);
|
|
}
|
|
|
|
function HTMLTable$RowFormatter(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(345, 1, {}, HTMLTable$RowFormatter);
|
|
var Lcom_google_gwt_user_client_ui_HTMLTable$RowFormatter_2_classLit = createForClass('com.google.gwt.user.client.ui', 'HTMLTable/RowFormatter', 345);
|
|
function $clinit_HasVerticalAlignment(){
|
|
$clinit_HasVerticalAlignment = emptyMethod;
|
|
ALIGN_BOTTOM = new HasVerticalAlignment$VerticalAlignmentConstant('bottom');
|
|
ALIGN_MIDDLE = new HasVerticalAlignment$VerticalAlignmentConstant('middle');
|
|
ALIGN_TOP = new HasVerticalAlignment$VerticalAlignmentConstant('top');
|
|
}
|
|
|
|
var ALIGN_BOTTOM, ALIGN_MIDDLE, ALIGN_TOP;
|
|
function HasHorizontalAlignment$AutoHorizontalAlignmentConstant(){
|
|
}
|
|
|
|
defineClass(525, 1, {}, HasHorizontalAlignment$AutoHorizontalAlignmentConstant);
|
|
var Lcom_google_gwt_user_client_ui_HasHorizontalAlignment$AutoHorizontalAlignmentConstant_2_classLit = createForClass('com.google.gwt.user.client.ui', 'HasHorizontalAlignment/AutoHorizontalAlignmentConstant', 525);
|
|
function HasHorizontalAlignment$HorizontalAlignmentConstant(textAlignString){
|
|
this.textAlignString = textAlignString;
|
|
}
|
|
|
|
function endOf(direction){
|
|
return direction == ($clinit_HasDirection$Direction() , LTR)?($clinit_HasHorizontalAlignment() , ALIGN_RIGHT):direction == RTL?($clinit_HasHorizontalAlignment() , ALIGN_LEFT):($clinit_HasHorizontalAlignment() , ALIGN_LOCALE_END);
|
|
}
|
|
|
|
function startOf(direction){
|
|
return direction == ($clinit_HasDirection$Direction() , LTR)?($clinit_HasHorizontalAlignment() , ALIGN_LEFT):direction == RTL?($clinit_HasHorizontalAlignment() , ALIGN_RIGHT):($clinit_HasHorizontalAlignment() , ALIGN_LOCALE_START);
|
|
}
|
|
|
|
defineClass(258, 525, {}, HasHorizontalAlignment$HorizontalAlignmentConstant);
|
|
var Lcom_google_gwt_user_client_ui_HasHorizontalAlignment$HorizontalAlignmentConstant_2_classLit = createForClass('com.google.gwt.user.client.ui', 'HasHorizontalAlignment/HorizontalAlignmentConstant', 258);
|
|
function HasVerticalAlignment$VerticalAlignmentConstant(verticalAlignString){
|
|
this.verticalAlignString = verticalAlignString;
|
|
}
|
|
|
|
defineClass(288, 1, {}, HasVerticalAlignment$VerticalAlignmentConstant);
|
|
var Lcom_google_gwt_user_client_ui_HasVerticalAlignment$VerticalAlignmentConstant_2_classLit = createForClass('com.google.gwt.user.client.ui', 'HasVerticalAlignment/VerticalAlignmentConstant', 288);
|
|
function $add_3(this$static, w){
|
|
var td, td_0;
|
|
td = (td_0 = ($clinit_DOM() , $doc.createElement('td')) , $setCellHorizontalAlignment(td_0, this$static.horzAlign) , $setCellVerticalAlignment(td_0, this$static.vertAlign) , td_0);
|
|
$appendChild(this$static.tableRow, resolve(td));
|
|
$add(this$static, w, td);
|
|
}
|
|
|
|
function $setHorizontalAlignment_0(this$static, align_0){
|
|
this$static.horzAlign = align_0;
|
|
}
|
|
|
|
function $setVerticalAlignment_0(this$static, align_0){
|
|
this$static.vertAlign = align_0;
|
|
}
|
|
|
|
function HorizontalPanel(){
|
|
CellPanel.call(this);
|
|
this.horzAlign = ($clinit_HasHorizontalAlignment() , ALIGN_DEFAULT);
|
|
this.vertAlign = ($clinit_HasVerticalAlignment() , ALIGN_TOP);
|
|
this.tableRow = ($clinit_DOM() , $doc.createElement('tr'));
|
|
$appendChild(this.body_0, resolve(this.tableRow));
|
|
this.table['cellSpacing'] = '0';
|
|
this.table['cellPadding'] = '0';
|
|
}
|
|
|
|
defineClass(81, 336, $intern_63, HorizontalPanel);
|
|
_.add_0 = function add_8(w){
|
|
$add_3(this, w);
|
|
}
|
|
;
|
|
_.remove_0 = function remove_7(w){
|
|
var removed, td;
|
|
td = ($clinit_DOM() , $getParentElement(w.element));
|
|
removed = $remove_0(this, w);
|
|
removed && $removeChild(this.tableRow, td);
|
|
return removed;
|
|
}
|
|
;
|
|
var Lcom_google_gwt_user_client_ui_HorizontalPanel_2_classLit = createForClass('com.google.gwt.user.client.ui', 'HorizontalPanel', 81);
|
|
function InlineLabel(){
|
|
Label_0.call(this, $doc.createElement('span'));
|
|
($clinit_DOM() , this.element).className = 'gwt-InlineLabel';
|
|
$setTextOrHtml(this.directionalTextHelper, '', false);
|
|
$updateHorizontalAlignment(this);
|
|
}
|
|
|
|
defineClass(290, 33, $intern_59, InlineLabel);
|
|
var Lcom_google_gwt_user_client_ui_InlineLabel_2_classLit = createForClass('com.google.gwt.user.client.ui', 'InlineLabel', 290);
|
|
function LayoutCommand$1(){
|
|
}
|
|
|
|
defineClass(573, 1, {}, LayoutCommand$1);
|
|
var Lcom_google_gwt_user_client_ui_LayoutCommand$1_2_classLit = createForClass('com.google.gwt.user.client.ui', 'LayoutCommand/1', 573);
|
|
function $add_4(this$static, widget){
|
|
$insert_1(this$static, widget, this$static.children.size_0);
|
|
}
|
|
|
|
function $insert_1(this$static, widget, beforeIndex){
|
|
var layer;
|
|
$removeFromParent(widget);
|
|
$insert_3(this$static.children, widget, beforeIndex);
|
|
layer = $attachChild(this$static.layout, ($clinit_DOM() , widget.element), widget);
|
|
widget.layoutData = layer;
|
|
$setParent(widget, this$static);
|
|
$schedule_0(this$static.layoutCmd);
|
|
}
|
|
|
|
function $onResize(this$static){
|
|
var child, child$iterator;
|
|
for (child$iterator = new WidgetCollection$WidgetIterator(this$static.children); child$iterator.index_0 < child$iterator.this$01.size_0;) {
|
|
child = $next_1(child$iterator);
|
|
instanceOf(child, 209) && child.onResize_0();
|
|
}
|
|
}
|
|
|
|
defineClass(649, 238, $intern_61);
|
|
_.add_0 = function add_9(widget){
|
|
$add_4(this, widget);
|
|
}
|
|
;
|
|
_.onAttach = function onAttach_3(){
|
|
$onAttach(this);
|
|
}
|
|
;
|
|
_.onDetach = function onDetach_2(){
|
|
$onDetach(this);
|
|
}
|
|
;
|
|
_.onResize_0 = function onResize_3(){
|
|
$onResize(this);
|
|
}
|
|
;
|
|
_.remove_0 = function remove_8(w){
|
|
var removed;
|
|
removed = $remove_0(this, w);
|
|
removed && $removeChild_0(this.layout, w.layoutData);
|
|
return removed;
|
|
}
|
|
;
|
|
var Lcom_google_gwt_user_client_ui_LayoutPanel_2_classLit = createForClass('com.google.gwt.user.client.ui', 'LayoutPanel', 649);
|
|
function $addItem(this$static, item_0){
|
|
$insertItem(this$static, item_0, item_0, -1);
|
|
}
|
|
|
|
function $checkIndex(this$static, index_0){
|
|
if (index_0 < 0 || index_0 >= ($clinit_DOM() , this$static.element).options.length) {
|
|
throw toJs(new IndexOutOfBoundsException);
|
|
}
|
|
}
|
|
|
|
function $getItemText(this$static, index_0){
|
|
$checkIndex(this$static, index_0);
|
|
return $getOptionText(($clinit_DOM() , this$static.element).options[index_0]);
|
|
}
|
|
|
|
function $getOptionText(option){
|
|
var text_0;
|
|
text_0 = option.text;
|
|
option.hasAttribute('bidiwrapped') && text_0.length > 1 && (text_0 = $substring_0(text_0, 1, text_0.length - 1));
|
|
return text_0;
|
|
}
|
|
|
|
function $getSelectedItemText(this$static){
|
|
var index_0;
|
|
index_0 = ($clinit_DOM() , this$static.element).selectedIndex;
|
|
return index_0 == -1?null:($checkIndex(this$static, index_0) , $getOptionText(this$static.element.options[index_0]));
|
|
}
|
|
|
|
function $insertItem(this$static, item_0, value_0, index_0){
|
|
var before, itemCount, option, select;
|
|
select = ($clinit_DOM() , this$static.element);
|
|
option = $doc.createElement('option');
|
|
option.text = item_0;
|
|
option.removeAttribute('bidiwrapped');
|
|
option.value = value_0;
|
|
itemCount = select.options.length;
|
|
(index_0 < 0 || index_0 > itemCount) && (index_0 = itemCount);
|
|
if (index_0 == itemCount) {
|
|
select.add(option, null);
|
|
}
|
|
else {
|
|
before = select.options[index_0];
|
|
select.add(option, before);
|
|
}
|
|
}
|
|
|
|
function $removeItem_1(this$static, index_0){
|
|
$checkIndex(this$static, index_0);
|
|
$selectRemoveOption(($clinit_DOM() , this$static.element), index_0);
|
|
}
|
|
|
|
function $setItemSelected(this$static){
|
|
$checkIndex(this$static, 0);
|
|
($clinit_DOM() , this$static.element).options[0].selected = true;
|
|
}
|
|
|
|
function $setSelectedIndex_0(this$static, index_0){
|
|
$setSelectedIndex(($clinit_DOM() , this$static.element), index_0);
|
|
}
|
|
|
|
function $setVisibleItemCount(this$static, visibleItems){
|
|
$setSize(($clinit_DOM() , this$static.element), visibleItems);
|
|
}
|
|
|
|
function ListBox(){
|
|
FocusWidget.call(this, $doc.createElement('select'));
|
|
($clinit_DOM() , this.element).className = 'gwt-ListBox';
|
|
}
|
|
|
|
defineClass(180, 82, $intern_64, ListBox);
|
|
var Lcom_google_gwt_user_client_ui_ListBox_2_classLit = createForClass('com.google.gwt.user.client.ui', 'ListBox', 180);
|
|
defineClass(951, 950, {11:1});
|
|
var Lcom_google_gwt_user_client_ui_ListenerWrapper_2_classLit = createForClass('com.google.gwt.user.client.ui', 'ListenerWrapper', 951);
|
|
function ListenerWrapper$WrappedPopupListener(listener){
|
|
this.listener = listener;
|
|
}
|
|
|
|
defineClass(952, 951, $intern_65, ListenerWrapper$WrappedPopupListener);
|
|
_.onClose = function onClose(event_0){
|
|
$onPopupClosed(this.listener, event_0.autoClosed);
|
|
}
|
|
;
|
|
var Lcom_google_gwt_user_client_ui_ListenerWrapper$WrappedPopupListener_2_classLit = createForClass('com.google.gwt.user.client.ui', 'ListenerWrapper/WrappedPopupListener', 952);
|
|
function $addItem_0(this$static, item_0){
|
|
return $insertItem_0(this$static, item_0, this$static.allItems.array.length);
|
|
}
|
|
|
|
function $addItemElement(this$static, beforeIndex, tdElem){
|
|
var tr;
|
|
if (this$static.vertical) {
|
|
tr = ($clinit_DOM() , $doc.createElement('tr'));
|
|
insertChild(this$static.body_0, tr, beforeIndex);
|
|
$appendChild(tr, resolve(tdElem));
|
|
}
|
|
else {
|
|
tr = ($clinit_DOM() , $getChild(this$static.body_0, 0));
|
|
$insertChild(tr, resolve(tdElem), beforeIndex);
|
|
}
|
|
}
|
|
|
|
function $addSeparator(this$static, separator){
|
|
return $insertSeparator(this$static, separator, this$static.allItems.array.length);
|
|
}
|
|
|
|
function $clearItems(this$static){
|
|
var container, item_0, item$iterator;
|
|
$selectItem(this$static, null);
|
|
container = this$static.vertical?this$static.body_0:($clinit_DOM() , $getChild(this$static.body_0, 0));
|
|
while ($clinit_DOM() , $getChildCount(container) > 0) {
|
|
$removeChild(container, $getChild(container, 0));
|
|
}
|
|
for (item$iterator = new ArrayList$1(this$static.allItems); item$iterator.i < item$iterator.this$01.array.length;) {
|
|
item_0 = $next_4(item$iterator);
|
|
item_0.element['colSpan'] = 1;
|
|
instanceOf(item_0, 197)?item_0:(item_0.parentMenu = null);
|
|
}
|
|
this$static.items.array = initUnidimensionalArray(Ljava_lang_Object_2_classLit, $intern_3, 1, 0, 5, 1);
|
|
this$static.allItems.array = initUnidimensionalArray(Ljava_lang_Object_2_classLit, $intern_3, 1, 0, 5, 1);
|
|
}
|
|
|
|
function $close(this$static, focus_0){
|
|
if (this$static.parentMenu) {
|
|
$hide(this$static.parentMenu.popup, !focus_0);
|
|
focus_0 && $focus(this$static.parentMenu);
|
|
}
|
|
}
|
|
|
|
function $doItemAction(this$static, item_0, fireCommand, focus_0){
|
|
var cmd;
|
|
if (!item_0.enabled) {
|
|
return;
|
|
}
|
|
$selectItem(this$static, item_0);
|
|
if (fireCommand && !!item_0.command) {
|
|
this$static.parentMenu?$close(this$static, false):$selectItem(this$static, null);
|
|
($clinit_DOM() , this$static.element).blur();
|
|
cmd = item_0.command;
|
|
$scheduleFinally(($clinit_SchedulerImpl() , INSTANCE), new MenuBar$1(cmd));
|
|
if (this$static.shownChildMenu) {
|
|
$onHide(this$static.shownChildMenu, focus_0);
|
|
$hide(this$static.popup, false);
|
|
this$static.shownChildMenu = null;
|
|
$selectItem(this$static, null);
|
|
}
|
|
}
|
|
else if (item_0.subMenu) {
|
|
if (!this$static.shownChildMenu) {
|
|
$openPopup(this$static, item_0);
|
|
}
|
|
else if (item_0.subMenu != this$static.shownChildMenu) {
|
|
$onHide(this$static.shownChildMenu, focus_0);
|
|
$hide(this$static.popup, false);
|
|
$openPopup(this$static, item_0);
|
|
}
|
|
else if (fireCommand && !this$static.autoOpen) {
|
|
$onHide(this$static.shownChildMenu, focus_0);
|
|
$hide(this$static.popup, false);
|
|
this$static.shownChildMenu = null;
|
|
$selectItem(this$static, item_0);
|
|
}
|
|
}
|
|
else if (this$static.autoOpen && !!this$static.shownChildMenu) {
|
|
$onHide(this$static.shownChildMenu, focus_0);
|
|
$hide(this$static.popup, false);
|
|
this$static.shownChildMenu = null;
|
|
}
|
|
}
|
|
|
|
function $findItem(this$static, hItem){
|
|
var item_0, item$iterator;
|
|
for (item$iterator = new ArrayList$1(this$static.items); item$iterator.i < item$iterator.this$01.array.length;) {
|
|
item_0 = $next_4(item$iterator);
|
|
if (isOrHasChildImpl(($clinit_DOM() , item_0.element), hItem)) {
|
|
return item_0;
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
|
|
function $focus(this$static){
|
|
($clinit_DOM() , this$static.element).focus();
|
|
}
|
|
|
|
function $init_0(this$static, vertical, subMenuIcon){
|
|
var outer, table, tr, e;
|
|
this$static.subMenuIcon = subMenuIcon;
|
|
table = ($clinit_DOM() , $doc.createElement('table'));
|
|
this$static.body_0 = $doc.createElement('tbody');
|
|
$appendChild(table, resolve(this$static.body_0));
|
|
if (!vertical) {
|
|
tr = $doc.createElement('tr');
|
|
$appendChild(this$static.body_0, resolve(tr));
|
|
}
|
|
this$static.vertical = vertical;
|
|
outer = (e = $doc.createElement('div') , e.tabIndex = 0 , undefined , e);
|
|
$appendChild(outer, resolve(table));
|
|
$setElement_0(this$static, outer);
|
|
$clinit_Roles();
|
|
$set(MENUBAR, this$static.element);
|
|
this$static.eventsToSink == -1?sinkEvents_0(this$static.element, 2225 | (this$static.element.__eventBits || 0)):(this$static.eventsToSink |= 2225);
|
|
this$static.element.className = 'gwt-MenuBar';
|
|
vertical?$setStyleName_0(this$static, getStylePrimaryName(this$static.element) + '-' + 'vertical', true):$setStyleName_0(this$static, getStylePrimaryName(this$static.element) + '-' + 'horizontal', true);
|
|
this$static.element.style['outline'] = '0px';
|
|
this$static.element.setAttribute('hideFocus', 'true');
|
|
$addDomHandler(this$static, new MenuBar$2(this$static), ($clinit_BlurEvent() , $clinit_BlurEvent() , TYPE));
|
|
}
|
|
|
|
function $insertItem_0(this$static, item_0, beforeIndex){
|
|
var i, itemsIndex;
|
|
if (beforeIndex < 0 || beforeIndex > this$static.allItems.array.length) {
|
|
throw toJs(new IndexOutOfBoundsException);
|
|
}
|
|
$add_7(this$static.allItems, beforeIndex, item_0);
|
|
itemsIndex = 0;
|
|
for (i = 0; i < beforeIndex; i++) {
|
|
instanceOf($get_2(this$static.allItems, i), 40) && ++itemsIndex;
|
|
}
|
|
$add_7(this$static.items, itemsIndex, item_0);
|
|
$addItemElement(this$static, beforeIndex, ($clinit_DOM() , item_0.element));
|
|
item_0.parentMenu = this$static;
|
|
$setStyleName_0(item_0, getStylePrimaryName(item_0.element) + '-' + 'selected', false);
|
|
$updateSubmenuIcon(this$static, item_0);
|
|
return item_0;
|
|
}
|
|
|
|
function $insertSeparator(this$static, separator, beforeIndex){
|
|
if (beforeIndex < 0 || beforeIndex > this$static.allItems.array.length) {
|
|
throw toJs(new IndexOutOfBoundsException);
|
|
}
|
|
this$static.vertical && (($clinit_DOM() , separator.element)['colSpan'] = 2 , undefined);
|
|
$addItemElement(this$static, beforeIndex, ($clinit_DOM() , separator.element));
|
|
$add_7(this$static.allItems, beforeIndex, separator);
|
|
return separator;
|
|
}
|
|
|
|
function $itemOver(this$static, item_0, focus_0){
|
|
var focus_1;
|
|
if (!item_0) {
|
|
if (!!this$static.selectedItem && !!this$static.shownChildMenu && this$static.shownChildMenu == this$static.selectedItem.subMenu) {
|
|
return;
|
|
}
|
|
}
|
|
if (!!item_0 && !item_0.enabled) {
|
|
return;
|
|
}
|
|
$selectItem(this$static, item_0);
|
|
focus_0 && this$static.focusOnHover && (($clinit_DOM() , this$static.element).focus() , undefined);
|
|
!!item_0 && (!!this$static.shownChildMenu || !!this$static.parentMenu || this$static.autoOpen) && $doItemAction(this$static, item_0, false, this$static.focusOnHover);
|
|
}
|
|
|
|
function $moveSelectionDown(this$static){
|
|
if ($selectFirstItemIfNoneSelected(this$static)) {
|
|
return;
|
|
}
|
|
if (this$static.vertical) {
|
|
$selectNextItem(this$static);
|
|
}
|
|
else {
|
|
if (!!this$static.selectedItem.subMenu && this$static.selectedItem.subMenu.items.array.length != 0 && (!this$static.shownChildMenu || !this$static.shownChildMenu.selectedItem)) {
|
|
!this$static.shownChildMenu && $doItemAction(this$static, this$static.selectedItem, false, true);
|
|
$focus(this$static.selectedItem.subMenu);
|
|
}
|
|
else
|
|
!!this$static.parentMenu && (this$static.parentMenu.vertical?$selectNextItem(this$static.parentMenu):$moveSelectionDown(this$static.parentMenu));
|
|
}
|
|
}
|
|
|
|
function $moveSelectionUp(this$static){
|
|
if ($selectFirstItemIfNoneSelected(this$static)) {
|
|
return;
|
|
}
|
|
!this$static.shownChildMenu && this$static.vertical?$selectPrevItem(this$static):!!this$static.parentMenu && this$static.parentMenu.vertical?$selectPrevItem(this$static.parentMenu):$close(this$static, true);
|
|
}
|
|
|
|
function $moveToNextItem(this$static){
|
|
if ($selectFirstItemIfNoneSelected(this$static)) {
|
|
return;
|
|
}
|
|
if (this$static.vertical) {
|
|
if (!!this$static.selectedItem.subMenu && this$static.selectedItem.subMenu.items.array.length != 0 && (!this$static.shownChildMenu || !this$static.shownChildMenu.selectedItem)) {
|
|
!this$static.shownChildMenu && $doItemAction(this$static, this$static.selectedItem, false, true);
|
|
$focus(this$static.selectedItem.subMenu);
|
|
}
|
|
else
|
|
!!this$static.parentMenu && (this$static.parentMenu.vertical?$moveToNextItem(this$static.parentMenu):$selectNextItem(this$static.parentMenu));
|
|
}
|
|
else {
|
|
$selectNextItem(this$static);
|
|
}
|
|
}
|
|
|
|
function $moveToPrevItem(this$static){
|
|
if ($selectFirstItemIfNoneSelected(this$static)) {
|
|
return;
|
|
}
|
|
this$static.vertical?!!this$static.parentMenu && !this$static.parentMenu.vertical?$selectPrevItem(this$static.parentMenu):$close(this$static, true):$selectPrevItem(this$static);
|
|
}
|
|
|
|
function $onBrowserEvent_0(this$static, event_0){
|
|
var item_0, keyCode;
|
|
item_0 = $findItem(this$static, ($clinit_DOM() , event_0.target));
|
|
switch ($eventGetTypeInt(event_0.type)) {
|
|
case 1:
|
|
{
|
|
this$static.element.focus();
|
|
!!item_0 && $doItemAction(this$static, item_0, true, true);
|
|
break;
|
|
}
|
|
|
|
case 16:
|
|
{
|
|
!!item_0 && $itemOver(this$static, item_0, true);
|
|
break;
|
|
}
|
|
|
|
case 32:
|
|
{
|
|
!!item_0 && $itemOver(this$static, null, false);
|
|
break;
|
|
}
|
|
|
|
case $intern_43:
|
|
{
|
|
$selectFirstItemIfNoneSelected(this$static);
|
|
break;
|
|
}
|
|
|
|
case 128:
|
|
{
|
|
keyCode = event_0.keyCode | 0;
|
|
$clinit_LocaleInfo();
|
|
keyCode = maybeSwapArrowKeysForRtl(keyCode, false);
|
|
switch (keyCode) {
|
|
case 37:
|
|
$moveToPrevItem(this$static);
|
|
event_0.stopPropagation();
|
|
event_0.preventDefault();
|
|
break;
|
|
case 39:
|
|
$moveToNextItem(this$static);
|
|
event_0.stopPropagation();
|
|
event_0.preventDefault();
|
|
break;
|
|
case 38:
|
|
$moveSelectionUp(this$static);
|
|
event_0.stopPropagation();
|
|
event_0.preventDefault();
|
|
break;
|
|
case 40:
|
|
$moveSelectionDown(this$static);
|
|
event_0.stopPropagation();
|
|
event_0.preventDefault();
|
|
break;
|
|
case 27:
|
|
this$static.parentMenu?$close(this$static, false):$selectItem(this$static, null);
|
|
!this$static.parentMenu && !!this$static.popup && $hide(this$static.popup, false);
|
|
event_0.stopPropagation();
|
|
event_0.preventDefault();
|
|
break;
|
|
case 9:
|
|
this$static.parentMenu?$close(this$static, false):$selectItem(this$static, null);
|
|
!this$static.parentMenu && !!this$static.popup && $hide(this$static.popup, false);
|
|
break;
|
|
case 13:
|
|
if (!$selectFirstItemIfNoneSelected(this$static)) {
|
|
$doItemAction(this$static, this$static.selectedItem, true, true);
|
|
event_0.stopPropagation();
|
|
event_0.preventDefault();
|
|
}
|
|
|
|
}
|
|
break;
|
|
}
|
|
|
|
}
|
|
$onBrowserEvent(this$static, event_0);
|
|
}
|
|
|
|
function $onHide(this$static, focus_0){
|
|
var focus_1;
|
|
if (this$static.shownChildMenu) {
|
|
$onHide(this$static.shownChildMenu, focus_0);
|
|
$hide(this$static.popup, false);
|
|
focus_0 && (($clinit_DOM() , this$static.element).focus() , undefined);
|
|
}
|
|
}
|
|
|
|
function $onPopupClosed(this$static, autoClosed){
|
|
autoClosed && (this$static.parentMenu?$close(this$static, false):$selectItem(this$static, null));
|
|
$onHide(this$static, !autoClosed && this$static.focusOnHover);
|
|
fire_1(this$static, false);
|
|
this$static.shownChildMenu = null;
|
|
this$static.popup = null;
|
|
!!this$static.parentMenu && !!this$static.parentMenu.popup && (this$static.parentMenu.popup.previewAllNativeEvents = true , undefined);
|
|
}
|
|
|
|
function $openPopup(this$static, item_0){
|
|
!!this$static.parentMenu && !!this$static.parentMenu.popup && (this$static.parentMenu.popup.previewAllNativeEvents = false , undefined);
|
|
this$static.shownChildMenu = item_0.subMenu;
|
|
$selectItem(this$static.shownChildMenu, null);
|
|
this$static.shownChildMenu.parentMenu = this$static;
|
|
this$static.popup = new MenuBar$MenuPopup(this$static);
|
|
$setWidget_1(this$static.popup, this$static.shownChildMenu);
|
|
$addHandler(this$static.popup, new ListenerWrapper$WrappedPopupListener(this$static), TYPE_18?TYPE_18:(TYPE_18 = new GwtEvent$Type));
|
|
$setPopupPositionAndShow(this$static.popup, new MenuBar$3(this$static, item_0));
|
|
}
|
|
|
|
function $selectFirstItemIfNoneSelected(this$static){
|
|
var nextItem, nextItem$iterator;
|
|
if (!this$static.selectedItem) {
|
|
for (nextItem$iterator = new ArrayList$1(this$static.items); nextItem$iterator.i < nextItem$iterator.this$01.array.length;) {
|
|
nextItem = $next_4(nextItem$iterator);
|
|
if (nextItem.enabled) {
|
|
$selectItem(this$static, nextItem);
|
|
break;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
function $selectItem(this$static, item_0){
|
|
var td, tr;
|
|
if (item_0 == this$static.selectedItem) {
|
|
return;
|
|
}
|
|
if (this$static.selectedItem) {
|
|
$setSelectionStyle(this$static.selectedItem);
|
|
if (this$static.vertical) {
|
|
tr = ($clinit_DOM() , $getParentElement($getElement(this$static.selectedItem)));
|
|
if ($getChildCount(tr) == 2) {
|
|
td = $getChild(tr, 1);
|
|
setStyleName(td, 'subMenuIcon-selected', false);
|
|
}
|
|
}
|
|
}
|
|
if (item_0) {
|
|
$setStyleName_0(item_0, getStylePrimaryName(($clinit_DOM() , item_0.element)) + '-' + 'selected', true);
|
|
if (this$static.vertical) {
|
|
tr = $getParentElement(item_0.element);
|
|
if ($getChildCount(tr) == 2) {
|
|
td = $getChild(tr, 1);
|
|
setStyleName(td, 'subMenuIcon-selected', true);
|
|
}
|
|
}
|
|
$clinit_Roles();
|
|
$setAriaActivedescendantProperty(this$static.element, new Id(item_0.element));
|
|
}
|
|
this$static.selectedItem = item_0;
|
|
}
|
|
|
|
function $selectNextItem(this$static){
|
|
var firstIndex, index_0, itemToBeSelected;
|
|
if (!this$static.selectedItem) {
|
|
return;
|
|
}
|
|
index_0 = $indexOf_3(this$static.items, this$static.selectedItem, 0);
|
|
firstIndex = index_0;
|
|
while (true) {
|
|
index_0 = index_0 + 1;
|
|
index_0 == this$static.items.array.length && (index_0 = 0);
|
|
if (index_0 == firstIndex) {
|
|
itemToBeSelected = $get_2(this$static.items, firstIndex);
|
|
break;
|
|
}
|
|
else {
|
|
itemToBeSelected = $get_2(this$static.items, index_0);
|
|
if (itemToBeSelected.enabled) {
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
$selectItem(this$static, itemToBeSelected);
|
|
!!this$static.shownChildMenu && $doItemAction(this$static, itemToBeSelected, false, true);
|
|
}
|
|
|
|
function $selectPrevItem(this$static){
|
|
var firstIndex, index_0, itemToBeSelected;
|
|
if (!this$static.selectedItem) {
|
|
return;
|
|
}
|
|
index_0 = $indexOf_3(this$static.items, this$static.selectedItem, 0);
|
|
firstIndex = index_0;
|
|
while (true) {
|
|
index_0 = index_0 - 1;
|
|
index_0 < 0 && (index_0 = this$static.items.array.length - 1);
|
|
if (index_0 == firstIndex) {
|
|
itemToBeSelected = $get_2(this$static.items, firstIndex);
|
|
break;
|
|
}
|
|
else {
|
|
itemToBeSelected = $get_2(this$static.items, index_0);
|
|
if (itemToBeSelected.enabled) {
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
$selectItem(this$static, itemToBeSelected);
|
|
!!this$static.shownChildMenu && $doItemAction(this$static, itemToBeSelected, false, true);
|
|
}
|
|
|
|
function $updateSubmenuIcon(this$static, item_0){
|
|
var container, idx, submenu, td, tdCount, tr;
|
|
if (!this$static.vertical) {
|
|
return;
|
|
}
|
|
idx = $indexOf_3(this$static.allItems, item_0, 0);
|
|
if (idx == -1) {
|
|
return;
|
|
}
|
|
container = this$static.vertical?this$static.body_0:($clinit_DOM() , $getChild(this$static.body_0, 0));
|
|
tr = ($clinit_DOM() , $getChild(container, idx));
|
|
tdCount = $getChildCount(tr);
|
|
submenu = item_0.subMenu;
|
|
if (!submenu) {
|
|
tdCount == 2 && $removeChild(tr, $getChild(tr, 1));
|
|
item_0.element['colSpan'] = 2;
|
|
}
|
|
else if (tdCount == 1) {
|
|
item_0.element['colSpan'] = 1;
|
|
td = $doc.createElement('td');
|
|
td['vAlign'] = 'middle';
|
|
$setInnerHTML(td, $getSafeHtml_0(this$static.subMenuIcon).html);
|
|
td.className = 'subMenuIcon';
|
|
$appendChild(tr, resolve(td));
|
|
}
|
|
}
|
|
|
|
function MenuBar(){
|
|
MenuBar_0.call(this, false);
|
|
}
|
|
|
|
function MenuBar_0(vertical){
|
|
this.allItems = new ArrayList;
|
|
this.items = new ArrayList;
|
|
$init_0(this, vertical, create_1(($clinit_MenuBar_Resources_default_InlineClientBundleGenerator$menuBarSubMenuIconInitializer() , menuBarSubMenuIcon)));
|
|
}
|
|
|
|
defineClass(58, 24, $intern_66, MenuBar, MenuBar_0);
|
|
_.onBrowserEvent = function onBrowserEvent_2(event_0){
|
|
$onBrowserEvent_0(this, event_0);
|
|
}
|
|
;
|
|
_.onDetach = function onDetach_3(){
|
|
!!this.popup && $hide(this.popup, false);
|
|
$onDetach(this);
|
|
}
|
|
;
|
|
_.autoOpen = false;
|
|
_.focusOnHover = true;
|
|
_.subMenuIcon = null;
|
|
_.vertical = false;
|
|
var Lcom_google_gwt_user_client_ui_MenuBar_2_classLit = createForClass('com.google.gwt.user.client.ui', 'MenuBar', 58);
|
|
function MenuBar$1(val$cmd){
|
|
this.val$cmd2 = val$cmd;
|
|
}
|
|
|
|
defineClass(548, 1, {}, MenuBar$1);
|
|
_.execute_1 = function execute_10(){
|
|
this.val$cmd2.execute_1();
|
|
}
|
|
;
|
|
var Lcom_google_gwt_user_client_ui_MenuBar$1_2_classLit = createForClass('com.google.gwt.user.client.ui', 'MenuBar/1', 548);
|
|
function MenuBar$2(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(549, 1, {1008:1, 11:1}, MenuBar$2);
|
|
var Lcom_google_gwt_user_client_ui_MenuBar$2_2_classLit = createForClass('com.google.gwt.user.client.ui', 'MenuBar/2', 549);
|
|
function MenuBar$3(this$0, val$item){
|
|
this.this$01 = this$0;
|
|
this.val$item2 = val$item;
|
|
}
|
|
|
|
defineClass(550, 1, {}, MenuBar$3);
|
|
_.setPosition = function setPosition(offsetWidth, offsetHeight){
|
|
this.this$01.vertical?$positionNextTo(this.this$01.popup, this.val$item2):$positionBelow(this.this$01.popup, this.val$item2);
|
|
}
|
|
;
|
|
var Lcom_google_gwt_user_client_ui_MenuBar$3_2_classLit = createForClass('com.google.gwt.user.client.ui', 'MenuBar/3', 550);
|
|
function $leftOf(object){
|
|
return $getAbsoluteLeft_0(($clinit_DOM() , object.element));
|
|
}
|
|
|
|
function $positionBelow(this$static, target){
|
|
var left, top_0;
|
|
top_0 = $getAbsoluteTop(this$static.this$01) + $getOffsetHeight(this$static.this$01);
|
|
left = this$static.towardsEast?$getAbsoluteLeft_0(($clinit_DOM() , target.element)):$getAbsoluteLeft_0(($clinit_DOM() , target.element)) + $getPropertyInt(target.element, 'offsetWidth') - $getPropertyInt(this$static.element, 'offsetWidth');
|
|
$setPositionInClient(this$static, left, top_0);
|
|
}
|
|
|
|
function $positionNextTo(this$static, target){
|
|
var left, leftIfTowardEast, leftIfTowardWest, offsetTop, overflowIfTowardsEast, overflowIfTowardsWest, top_0;
|
|
offsetTop = $getAbsoluteTop(target.subMenu) - ($getBoundingClientRectTop(($clinit_DOM() , this$static.element)) + $wnd.pageYOffset | 0);
|
|
top_0 = ($getBoundingClientRectTop(target.element) + $wnd.pageYOffset | 0) - offsetTop;
|
|
leftIfTowardEast = $rightOf(this$static.this$01);
|
|
leftIfTowardWest = $leftOf(this$static.this$01) - $getPropertyInt(this$static.element, 'offsetWidth');
|
|
overflowIfTowardsEast = leftIfTowardEast + $getPropertyInt(this$static.element, 'offsetWidth') - (($wnd.pageXOffset | 0) + $getClientWidth($doc));
|
|
overflowIfTowardsWest = ($wnd.pageXOffset | 0) - leftIfTowardWest;
|
|
overflowIfTowardsEast <= 0 && overflowIfTowardsWest <= 0?!!this$static.this$01.parentMenu && !!this$static.this$01.parentMenu.popup && (this$static.towardsEast = this$static.this$01.parentMenu.popup.towardsEast):(this$static.towardsEast = overflowIfTowardsEast < overflowIfTowardsWest);
|
|
left = this$static.towardsEast?leftIfTowardEast:leftIfTowardWest;
|
|
$setPositionInClient(this$static, left, top_0);
|
|
}
|
|
|
|
function $rightOf(object){
|
|
return $getAbsoluteLeft_0(($clinit_DOM() , object.element)) + $getPropertyInt(object.element, 'offsetWidth');
|
|
}
|
|
|
|
function $setPositionInClient(this$static, left, top_0){
|
|
if ($getPropertyInt(($clinit_DOM() , this$static.element), 'offsetWidth') < $getClientWidth($doc)) {
|
|
left = $wnd.Math.min(left, ($wnd.pageXOffset | 0) + $getClientWidth($doc) - $getPropertyInt(this$static.element, 'offsetWidth'));
|
|
left = $wnd.Math.max($wnd.pageXOffset | 0, left);
|
|
}
|
|
$setPopupPosition(this$static, left, top_0);
|
|
}
|
|
|
|
function MenuBar$MenuPopup(this$0){
|
|
var primaryStyleName;
|
|
this.this$01 = this$0;
|
|
DecoratedPopupPanel.call(this, true, false, 'menuPopup');
|
|
this.towardsEast = ($clinit_LocaleInfo() , true);
|
|
$setAnimationType(this, ($clinit_PopupPanel$AnimationType() , ONE_WAY_CORNER));
|
|
this.isAnimationEnabled = false;
|
|
$getParentElement(($clinit_DOM() , $getFirstChildElement(this.element))).className = 'gwt-MenuBarPopup';
|
|
primaryStyleName = getStylePrimaryName(this$0.element);
|
|
$equals_1('gwt-MenuBar', primaryStyleName) || setStyleName($getParentElement($getFirstChildElement(this.element)), primaryStyleName + 'Popup', true);
|
|
this.previewAllNativeEvents = true;
|
|
}
|
|
|
|
defineClass(547, 329, $intern_57, MenuBar$MenuPopup);
|
|
_.onPreviewNativeEvent = function onPreviewNativeEvent_2(event_0){
|
|
var parentMenuElement, target;
|
|
if (!event_0.isCanceled) {
|
|
switch ($getTypeInt(event_0.nativeEvent)) {
|
|
case 4:
|
|
target = event_0.nativeEvent.target;
|
|
parentMenuElement = $getElement(this.this$01);
|
|
if (isOrHasChildImpl(parentMenuElement, target)) {
|
|
event_0.isCanceled = true;
|
|
return;
|
|
}
|
|
|
|
event_0.isFirstHandler && false && (event_0.isCanceled = true);
|
|
event_0.isCanceled && $selectItem(this.this$01, null);
|
|
return;
|
|
}
|
|
}
|
|
event_0.isFirstHandler && false && (event_0.isCanceled = true);
|
|
}
|
|
;
|
|
_.towardsEast = false;
|
|
var Lcom_google_gwt_user_client_ui_MenuBar$MenuPopup_2_classLit = createForClass('com.google.gwt.user.client.ui', 'MenuBar/MenuPopup', 547);
|
|
var menuBarSubMenuIcon;
|
|
function $clinit_MenuBar_Resources_default_InlineClientBundleGenerator$menuBarSubMenuIconInitializer(){
|
|
$clinit_MenuBar_Resources_default_InlineClientBundleGenerator$menuBarSubMenuIconInitializer = emptyMethod;
|
|
menuBarSubMenuIcon = new ImageResourcePrototype(($clinit_UriUtils() , new SafeUriString(($clinit_LocaleInfo() , 'data:image/gif;base64,R0lGODlhBQAJAIAAAAAAAAAAACH5BAEAAAEALAAAAAAFAAkAAAIMRB5gp9v2YlJsJRQKADs='))));
|
|
}
|
|
|
|
function $setCommand(this$static, cmd){
|
|
this$static.command = cmd;
|
|
}
|
|
|
|
function $setEnabled_1(this$static, enabled){
|
|
enabled?$setStyleName_0(this$static, getStylePrimaryName(($clinit_DOM() , this$static.element)) + '-' + 'disabled', false):$setStyleName_0(this$static, getStylePrimaryName(($clinit_DOM() , this$static.element)) + '-' + 'disabled', true);
|
|
this$static.enabled = enabled;
|
|
}
|
|
|
|
function $setScheduledCommand(this$static, cmd){
|
|
this$static.command = cmd;
|
|
}
|
|
|
|
function $setSelectionStyle(this$static){
|
|
$setStyleName_0(this$static, getStylePrimaryName(($clinit_DOM() , this$static.element)) + '-' + 'selected', false);
|
|
}
|
|
|
|
function $setSubMenu(this$static, subMenu){
|
|
this$static.subMenu = subMenu;
|
|
!!this$static.parentMenu && $updateSubmenuIcon(this$static.parentMenu, this$static);
|
|
if (subMenu) {
|
|
($clinit_DOM() , subMenu.element).tabIndex = -1;
|
|
$clinit_Roles();
|
|
$setAriaHaspopupProperty(this$static.element, true);
|
|
}
|
|
else {
|
|
$clinit_Roles();
|
|
$setAriaHaspopupProperty(($clinit_DOM() , this$static.element), false);
|
|
}
|
|
}
|
|
|
|
function MenuItem(html, cmd){
|
|
MenuItem_4.call(this, html.html, cmd);
|
|
}
|
|
|
|
function MenuItem_0(html, subMenu){
|
|
MenuItem_5.call(this, html.html, subMenu);
|
|
}
|
|
|
|
function MenuItem_1(text_0, cmd){
|
|
MenuItem_3.call(this, text_0, false);
|
|
this.command = cmd;
|
|
}
|
|
|
|
function MenuItem_2(text_0, subMenu){
|
|
MenuItem_3.call(this, text_0, false);
|
|
$setSubMenu(this, subMenu);
|
|
}
|
|
|
|
function MenuItem_3(text_0, asHTML){
|
|
$setElement_0(this, ($clinit_DOM() , $doc.createElement('td')));
|
|
$setStyleName_0(this, getStylePrimaryName(this.element) + '-' + 'selected', false);
|
|
asHTML?$setInnerHTML(this.element, text_0):$setInnerText(this.element, text_0);
|
|
this.element.className = 'gwt-MenuItem';
|
|
$setAttribute(this.element, 'id', $createUniqueId($doc));
|
|
$clinit_Roles();
|
|
$set(MENUITEM, this.element);
|
|
}
|
|
|
|
function MenuItem_4(text_0, cmd){
|
|
MenuItem_3.call(this, text_0, true);
|
|
this.command = cmd;
|
|
}
|
|
|
|
function MenuItem_5(text_0, subMenu){
|
|
MenuItem_3.call(this, text_0, true);
|
|
$setSubMenu(this, subMenu);
|
|
}
|
|
|
|
defineClass(40, 22, $intern_67, MenuItem, MenuItem_0, MenuItem_1, MenuItem_2);
|
|
_.enabled = true;
|
|
var Lcom_google_gwt_user_client_ui_MenuItem_2_classLit = createForClass('com.google.gwt.user.client.ui', 'MenuItem', 40);
|
|
function MenuItemSeparator(){
|
|
var div;
|
|
$setElement_0(this, ($clinit_DOM() , $doc.createElement('td')));
|
|
this.element.className = 'gwt-MenuItemSeparator';
|
|
div = $doc.createElement('div');
|
|
$appendChild(this.element, resolve(div));
|
|
div.className = 'menuSeparatorInner';
|
|
}
|
|
|
|
defineClass(197, 22, {23:1, 197:1, 22:1}, MenuItemSeparator);
|
|
var Lcom_google_gwt_user_client_ui_MenuItemSeparator_2_classLit = createForClass('com.google.gwt.user.client.ui', 'MenuItemSeparator', 197);
|
|
function $onResize_0(this$static){
|
|
var height, style, width_0, winHeight, winWidth;
|
|
style = this$static.this$01.glass.style;
|
|
winWidth = $getClientWidth($doc);
|
|
winHeight = $getClientHeight($doc);
|
|
style['display'] = ($clinit_Style$Display() , 'none');
|
|
style['width'] = ($clinit_Style$Unit() , '0.0px');
|
|
style['height'] = '0.0px';
|
|
width_0 = $getScrollWidth($doc);
|
|
height = $getScrollHeight($doc);
|
|
style['width'] = $wnd.Math.max(width_0, winWidth) + 'px';
|
|
style['height'] = $wnd.Math.max(height, winHeight) + 'px';
|
|
style['display'] = 'block';
|
|
}
|
|
|
|
function PopupPanel$1(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(521, 1, $intern_41, PopupPanel$1);
|
|
_.onResize = function onResize_4(event_0){
|
|
$onResize_0(this);
|
|
}
|
|
;
|
|
var Lcom_google_gwt_user_client_ui_PopupPanel$1_2_classLit = createForClass('com.google.gwt.user.client.ui', 'PopupPanel/1', 521);
|
|
function PopupPanel$3(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(522, 1, $intern_40, PopupPanel$3);
|
|
_.onPreviewNativeEvent = function onPreviewNativeEvent_3(event_0){
|
|
$previewNativeEvent(this.this$01, event_0);
|
|
}
|
|
;
|
|
var Lcom_google_gwt_user_client_ui_PopupPanel$3_2_classLit = createForClass('com.google.gwt.user.client.ui', 'PopupPanel/3', 522);
|
|
function PopupPanel$4(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(523, 1, $intern_68, PopupPanel$4);
|
|
_.onValueChange = function onValueChange(event_0){
|
|
this.this$01.autoHideOnHistoryEvents && this.this$01.hide(false);
|
|
}
|
|
;
|
|
var Lcom_google_gwt_user_client_ui_PopupPanel$4_2_classLit = createForClass('com.google.gwt.user.client.ui', 'PopupPanel/4', 523);
|
|
function $clinit_PopupPanel$AnimationType(){
|
|
$clinit_PopupPanel$AnimationType = emptyMethod;
|
|
CENTER_1 = new PopupPanel$AnimationType('CENTER', 0);
|
|
ONE_WAY_CORNER = new PopupPanel$AnimationType('ONE_WAY_CORNER', 1);
|
|
ROLL_DOWN = new PopupPanel$AnimationType('ROLL_DOWN', 2);
|
|
}
|
|
|
|
function PopupPanel$AnimationType(enum$name, enum$ordinal){
|
|
Enum.call(this, enum$name, enum$ordinal);
|
|
}
|
|
|
|
function values_13(){
|
|
$clinit_PopupPanel$AnimationType();
|
|
return stampJavaTypeInfo(getClassLiteralForArray(Lcom_google_gwt_user_client_ui_PopupPanel$AnimationType_2_classLit, 1), $intern_3, 236, 0, [CENTER_1, ONE_WAY_CORNER, ROLL_DOWN]);
|
|
}
|
|
|
|
defineClass(236, 15, {236:1, 3:1, 16:1, 15:1}, PopupPanel$AnimationType);
|
|
var CENTER_1, ONE_WAY_CORNER, ROLL_DOWN;
|
|
var Lcom_google_gwt_user_client_ui_PopupPanel$AnimationType_2_classLit = createForEnum('com.google.gwt.user.client.ui', 'PopupPanel/AnimationType', 236, values_13);
|
|
function $maybeShowGlass(this$static){
|
|
if (this$static.showing) {
|
|
if (this$static.curPanel.isGlassEnabled) {
|
|
$appendChild($doc.body, this$static.curPanel.glass);
|
|
this$static.resizeRegistration = addResizeHandler(this$static.curPanel.glassResizer);
|
|
$onResize_0(this$static.curPanel.glassResizer);
|
|
this$static.glassShowing = true;
|
|
}
|
|
}
|
|
else if (this$static.glassShowing) {
|
|
$removeChild($doc.body, this$static.curPanel.glass);
|
|
$removeHandler(this$static.resizeRegistration.real);
|
|
this$static.resizeRegistration = null;
|
|
this$static.glassShowing = false;
|
|
}
|
|
}
|
|
|
|
function $onComplete(this$static){
|
|
if (!this$static.showing) {
|
|
$maybeShowGlass(this$static);
|
|
this$static.isUnloading || $remove_1(($clinit_RootPanel() , get_1()), this$static.curPanel);
|
|
}
|
|
$getElement(this$static.curPanel).style['clip'] = 'rect(auto, auto, auto, auto)';
|
|
$getElement(this$static.curPanel).style['overflow'] = 'visible';
|
|
}
|
|
|
|
function $onInstantaneousRun(this$static){
|
|
$maybeShowGlass(this$static);
|
|
if (this$static.showing) {
|
|
$getElement(this$static.curPanel).style['position'] = 'absolute';
|
|
this$static.curPanel.topPosition != -1 && $setPopupPosition(this$static.curPanel, this$static.curPanel.leftPosition, this$static.curPanel.topPosition);
|
|
$add_0(($clinit_RootPanel() , get_1()), this$static.curPanel);
|
|
}
|
|
else {
|
|
this$static.isUnloading || $remove_1(($clinit_RootPanel() , get_1()), this$static.curPanel);
|
|
}
|
|
$getElement(this$static.curPanel).style['overflow'] = 'visible';
|
|
}
|
|
|
|
function $onUpdate(this$static, progress){
|
|
var bottom, height, left, right, top_0, width_0;
|
|
this$static.showing || (progress = 1 - progress);
|
|
top_0 = 0;
|
|
left = 0;
|
|
right = 0;
|
|
bottom = 0;
|
|
height = round_int(progress * this$static.offsetHeight_0);
|
|
width_0 = round_int(progress * this$static.offsetWidth_0);
|
|
switch (this$static.curPanel.animType.ordinal) {
|
|
case 2:
|
|
right = this$static.offsetWidth_0;
|
|
bottom = height;
|
|
break;
|
|
case 0:
|
|
top_0 = this$static.offsetHeight_0 - height >> 1;
|
|
left = this$static.offsetWidth_0 - width_0 >> 1;
|
|
right = left + width_0;
|
|
bottom = top_0 + height;
|
|
break;
|
|
case 1:
|
|
$clinit_LocaleInfo();
|
|
right = width_0;
|
|
bottom = height;
|
|
}
|
|
$setClip($getElement(this$static.curPanel), 'rect(' + top_0 + 'px, ' + right + 'px, ' + bottom + 'px, ' + left + 'px)');
|
|
}
|
|
|
|
function $setState(this$static, showing, isUnloading){
|
|
var animate;
|
|
this$static.isUnloading = isUnloading;
|
|
$cancel(this$static);
|
|
if (this$static.showTimer) {
|
|
$cancel_0(this$static.showTimer);
|
|
this$static.showTimer = null;
|
|
$onComplete(this$static);
|
|
}
|
|
this$static.curPanel.showing = showing;
|
|
$updateHandlers(this$static.curPanel);
|
|
animate = !isUnloading && this$static.curPanel.isAnimationEnabled;
|
|
this$static.curPanel.animType != ($clinit_PopupPanel$AnimationType() , CENTER_1) && !showing && (animate = false);
|
|
this$static.showing = showing;
|
|
if (animate) {
|
|
if (showing) {
|
|
$maybeShowGlass(this$static);
|
|
$getElement(this$static.curPanel).style['position'] = 'absolute';
|
|
this$static.curPanel.topPosition != -1 && $setPopupPosition(this$static.curPanel, this$static.curPanel.leftPosition, this$static.curPanel.topPosition);
|
|
$getElement(this$static.curPanel).style['clip'] = 'rect(0px, 0px, 0px, 0px)';
|
|
$add_0(($clinit_RootPanel() , get_1()), this$static.curPanel);
|
|
this$static.showTimer = new PopupPanel$ResizeAnimation$1(this$static);
|
|
$schedule(this$static.showTimer, 1);
|
|
}
|
|
else {
|
|
$run(this$static, 200, now_1(), null);
|
|
}
|
|
}
|
|
else {
|
|
$onInstantaneousRun(this$static);
|
|
}
|
|
}
|
|
|
|
function PopupPanel$ResizeAnimation(panel){
|
|
Animation.call(this);
|
|
this.curPanel = panel;
|
|
}
|
|
|
|
defineClass(519, 287, {}, PopupPanel$ResizeAnimation);
|
|
_.onComplete = function onComplete_1(){
|
|
$onComplete(this);
|
|
}
|
|
;
|
|
_.onStart = function onStart_0(){
|
|
this.offsetHeight_0 = $getPropertyInt($getElement(this.curPanel), 'offsetHeight');
|
|
this.offsetWidth_0 = $getPropertyInt($getElement(this.curPanel), 'offsetWidth');
|
|
$getElement(this.curPanel).style['overflow'] = 'hidden';
|
|
$onUpdate(this, (1 + $wnd.Math.cos($intern_1)) / 2);
|
|
}
|
|
;
|
|
_.onUpdate = function onUpdate_0(progress){
|
|
$onUpdate(this, progress);
|
|
}
|
|
;
|
|
_.curPanel = null;
|
|
_.glassShowing = false;
|
|
_.isUnloading = false;
|
|
_.offsetHeight_0 = 0;
|
|
_.offsetWidth_0 = -1;
|
|
_.showing = false;
|
|
var Lcom_google_gwt_user_client_ui_PopupPanel$ResizeAnimation_2_classLit = createForClass('com.google.gwt.user.client.ui', 'PopupPanel/ResizeAnimation', 519);
|
|
function PopupPanel$ResizeAnimation$1(this$1){
|
|
this.this$11 = this$1;
|
|
Timer.call(this);
|
|
}
|
|
|
|
defineClass(520, 213, {}, PopupPanel$ResizeAnimation$1);
|
|
_.run = function run_2(){
|
|
this.this$11.showTimer = null;
|
|
$run_0(this.this$11, 200, null);
|
|
}
|
|
;
|
|
var Lcom_google_gwt_user_client_ui_PopupPanel$ResizeAnimation$1_2_classLit = createForClass('com.google.gwt.user.client.ui', 'PopupPanel/ResizeAnimation/1', 520);
|
|
function $clinit_PotentialElement(){
|
|
$clinit_PotentialElement = emptyMethod;
|
|
declareShim();
|
|
}
|
|
|
|
function $setResolver(this$static, resolver){
|
|
$clinit_PotentialElement();
|
|
this$static.__gwt_resolve = buildResolveCallback(resolver);
|
|
}
|
|
|
|
function buildResolveCallback(resolver){
|
|
return function(){
|
|
this.__gwt_resolve = cannotResolveTwice;
|
|
return resolver.resolvePotentialElement();
|
|
}
|
|
;
|
|
}
|
|
|
|
function cannotResolveTwice(){
|
|
throw 'A PotentialElement cannot be resolved twice.';
|
|
}
|
|
|
|
function declareShim(){
|
|
var shim = function(){
|
|
}
|
|
;
|
|
shim.prototype = {className:'', clientHeight:0, clientWidth:0, dir:'', getAttribute:function(name_0, value_0){
|
|
return this[name_0];
|
|
}
|
|
, href:'', id:'', lang:'', nodeType:1, removeAttribute:function(name_0, value_0){
|
|
this[name_0] = undefined;
|
|
}
|
|
, setAttribute:function(name_0, value_0){
|
|
this[name_0] = value_0;
|
|
}
|
|
, src:'', style:{}, title:''};
|
|
$wnd.GwtPotentialElementShim = shim;
|
|
}
|
|
|
|
function $sinkEvents_0(this$static, eventBitsToAdd){
|
|
if (this$static.eventsToSink == -1) {
|
|
sinkEvents_1(this$static.inputElem, eventBitsToAdd | getEventsSunk(this$static.inputElem));
|
|
sinkEvents_1(this$static.labelElem, eventBitsToAdd | getEventsSunk(this$static.labelElem));
|
|
}
|
|
else {
|
|
this$static.eventsToSink == -1?sinkEvents_1(this$static.inputElem, eventBitsToAdd | getEventsSunk(this$static.inputElem)):this$static.eventsToSink == -1?sinkEvents_0(($clinit_DOM() , this$static.element), eventBitsToAdd | (this$static.element.__eventBits || 0)):(this$static.eventsToSink |= eventBitsToAdd);
|
|
}
|
|
}
|
|
|
|
function RadioButton(name_0, label_0){
|
|
CheckBox.call(this, ($clinit_DOM() , $createInputRadioElement($doc, name_0)));
|
|
this.element.className = 'gwt-RadioButton';
|
|
$sinkEvents_0(this, 1);
|
|
$sinkEvents_0(this, 8);
|
|
$sinkEvents_0(this, $intern_42);
|
|
$sinkEvents_0(this, 128);
|
|
$setTextOrHtml(this.directionalTextHelper, label_0, false);
|
|
}
|
|
|
|
defineClass(159, 166, $intern_55, RadioButton);
|
|
_.ensureDomEventHandlers = function ensureDomEventHandlers_0(){
|
|
}
|
|
;
|
|
_.onBrowserEvent = function onBrowserEvent_3(event_0){
|
|
var target;
|
|
switch ($clinit_DOM() , $eventGetTypeInt(event_0.type)) {
|
|
case 8:
|
|
case $intern_42:
|
|
case 128:
|
|
this.oldValue = this.attached?($clinit_Boolean() , this.inputElem.checked?true:false):($clinit_Boolean() , this.inputElem.defaultChecked?true:false);
|
|
break;
|
|
case 1:
|
|
target = event_0.target;
|
|
if (is_0(target) && isOrHasChildImpl(this.labelElem, target)) {
|
|
this.oldValue = this.attached?($clinit_Boolean() , this.inputElem.checked?true:false):($clinit_Boolean() , this.inputElem.defaultChecked?true:false);
|
|
return;
|
|
}
|
|
|
|
$onBrowserEvent(this, event_0);
|
|
fireIfNotEqual(this, this.oldValue, this.attached?($clinit_Boolean() , this.inputElem.checked?true:false):($clinit_Boolean() , this.inputElem.defaultChecked?true:false));
|
|
return;
|
|
}
|
|
$onBrowserEvent(this, event_0);
|
|
}
|
|
;
|
|
_.sinkEvents = function sinkEvents_3(eventBitsToAdd){
|
|
$sinkEvents_0(this, eventBitsToAdd);
|
|
}
|
|
;
|
|
var Lcom_google_gwt_user_client_ui_RadioButton_2_classLit = createForClass('com.google.gwt.user.client.ui', 'RadioButton', 159);
|
|
function RootLayoutPanel(){
|
|
ComplexPanel.call(this);
|
|
$setElement(this, $doc.createElement('div'));
|
|
this.layout = new Layout(($clinit_DOM() , this.element));
|
|
this.layoutCmd = new LayoutCommand(this.layout);
|
|
addResizeHandler(new RootLayoutPanel$1(this));
|
|
}
|
|
|
|
function get_0(){
|
|
if (!singleton_0) {
|
|
singleton_0 = new RootLayoutPanel;
|
|
$add_0(($clinit_RootPanel() , get_1()), singleton_0);
|
|
}
|
|
return singleton_0;
|
|
}
|
|
|
|
defineClass(650, 649, $intern_61, RootLayoutPanel);
|
|
_.onLoad = function onLoad_1(){
|
|
$fillParent(this.layout.parentElem);
|
|
}
|
|
;
|
|
var singleton_0;
|
|
var Lcom_google_gwt_user_client_ui_RootLayoutPanel_2_classLit = createForClass('com.google.gwt.user.client.ui', 'RootLayoutPanel', 650);
|
|
function RootLayoutPanel$1(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(651, 1, $intern_41, RootLayoutPanel$1);
|
|
_.onResize = function onResize_5(event_0){
|
|
$onResize(this.this$01);
|
|
}
|
|
;
|
|
var Lcom_google_gwt_user_client_ui_RootLayoutPanel$1_2_classLit = createForClass('com.google.gwt.user.client.ui', 'RootLayoutPanel/1', 651);
|
|
function $clinit_RootPanel(){
|
|
$clinit_RootPanel = emptyMethod;
|
|
maybeDetachCommand = new RootPanel$1;
|
|
rootPanels = new HashMap;
|
|
widgetsToDetach = new HashSet;
|
|
}
|
|
|
|
function RootPanel(elem){
|
|
ComplexPanel.call(this);
|
|
$setElement_0(this, ($clinit_DOM() , elem));
|
|
$onAttach(this);
|
|
}
|
|
|
|
function detachNow(widget){
|
|
$clinit_RootPanel();
|
|
try {
|
|
widget.onDetach();
|
|
}
|
|
finally {
|
|
$remove_15(widgetsToDetach, widget);
|
|
}
|
|
}
|
|
|
|
function detachWidgets(){
|
|
$clinit_RootPanel();
|
|
try {
|
|
tryCommand(widgetsToDetach, maybeDetachCommand);
|
|
}
|
|
finally {
|
|
$reset_13(widgetsToDetach.map_0);
|
|
$reset_13(rootPanels);
|
|
}
|
|
}
|
|
|
|
function get_1(){
|
|
$clinit_RootPanel();
|
|
var rp;
|
|
rp = $get_1(rootPanels, null);
|
|
if (rp) {
|
|
return rp;
|
|
}
|
|
if ($size(rootPanels) == 0) {
|
|
addCloseHandler(new RootPanel$2);
|
|
$clinit_LocaleInfo();
|
|
}
|
|
rp = new RootPanel$DefaultRootPanel;
|
|
$put_0(rootPanels, null, rp);
|
|
$add_9(widgetsToDetach, rp);
|
|
return rp;
|
|
}
|
|
|
|
defineClass(289, 670, $intern_69);
|
|
var maybeDetachCommand, rootPanels, widgetsToDetach;
|
|
var Lcom_google_gwt_user_client_ui_RootPanel_2_classLit = createForClass('com.google.gwt.user.client.ui', 'RootPanel', 289);
|
|
function RootPanel$1(){
|
|
}
|
|
|
|
defineClass(672, 1, {}, RootPanel$1);
|
|
_.execute_2 = function execute_11(w){
|
|
w.isAttached() && w.onDetach();
|
|
}
|
|
;
|
|
var Lcom_google_gwt_user_client_ui_RootPanel$1_2_classLit = createForClass('com.google.gwt.user.client.ui', 'RootPanel/1', 672);
|
|
function RootPanel$2(){
|
|
}
|
|
|
|
defineClass(673, 1, $intern_65, RootPanel$2);
|
|
_.onClose = function onClose_0(closeEvent){
|
|
detachWidgets();
|
|
}
|
|
;
|
|
var Lcom_google_gwt_user_client_ui_RootPanel$2_2_classLit = createForClass('com.google.gwt.user.client.ui', 'RootPanel/2', 673);
|
|
function RootPanel$DefaultRootPanel(){
|
|
RootPanel.call(this, $doc.body);
|
|
}
|
|
|
|
defineClass(671, 289, $intern_69, RootPanel$DefaultRootPanel);
|
|
var Lcom_google_gwt_user_client_ui_RootPanel$DefaultRootPanel_2_classLit = createForClass('com.google.gwt.user.client.ui', 'RootPanel/DefaultRootPanel', 671);
|
|
function $getMaximumHorizontalScrollPosition(scrollable){
|
|
return $isRtl(scrollable)?0:((scrollable.scrollWidth || 0) | 0) - (scrollable.clientWidth | 0);
|
|
}
|
|
|
|
function $getMinimumHorizontalScrollPosition(scrollable){
|
|
return $isRtl(scrollable)?(scrollable.clientWidth | 0) - ((scrollable.scrollWidth || 0) | 0):0;
|
|
}
|
|
|
|
function $isRtl(scrollable){
|
|
var computedStyle = $doc.defaultView.getComputedStyle(scrollable, null);
|
|
return computedStyle.getPropertyValue('direction') == 'rtl';
|
|
}
|
|
|
|
function ScrollImpl(){
|
|
}
|
|
|
|
defineClass(299, 1, {}, ScrollImpl);
|
|
var impl_0;
|
|
var Lcom_google_gwt_user_client_ui_ScrollImpl_2_classLit = createForClass('com.google.gwt.user.client.ui', 'ScrollImpl', 299);
|
|
function $getHorizontalScrollPosition(this$static){
|
|
return $getScrollLeft(($clinit_DOM() , this$static.scrollableElem));
|
|
}
|
|
|
|
function $getMaximumHorizontalScrollPosition_0(this$static){
|
|
return $getMaximumHorizontalScrollPosition((!impl_0 && (impl_0 = new ScrollImpl) , $clinit_DOM() , this$static.scrollableElem));
|
|
}
|
|
|
|
function $getMaximumVerticalScrollPosition(this$static){
|
|
return ((($clinit_DOM() , this$static.scrollableElem).scrollHeight || 0) | 0) - (this$static.scrollableElem.clientHeight | 0);
|
|
}
|
|
|
|
function $getMinimumHorizontalScrollPosition_0(this$static){
|
|
return $getMinimumHorizontalScrollPosition((!impl_0 && (impl_0 = new ScrollImpl) , $clinit_DOM() , this$static.scrollableElem));
|
|
}
|
|
|
|
function $getVerticalScrollPosition(this$static){
|
|
return (($clinit_DOM() , this$static.scrollableElem).scrollTop || 0) | 0;
|
|
}
|
|
|
|
function $setHorizontalScrollPosition(this$static, position){
|
|
$setScrollLeft(($clinit_DOM() , this$static.scrollableElem), position);
|
|
}
|
|
|
|
function $setTouchScrollingDisabled(this$static){
|
|
var scroller;
|
|
if (this$static.touchScroller) {
|
|
return false;
|
|
}
|
|
this$static.touchScroller = (scroller = (isSupported == null && (isSupported = ($clinit_Boolean() , !impl && (impl = new TouchEvent$TouchSupportDetectorNo) , false)) , $booleanValue(isSupported)?new TouchScroller:null) , !!scroller && $setTargetWidget(scroller, this$static) , scroller);
|
|
return !this$static.touchScroller;
|
|
}
|
|
|
|
function $setVerticalScrollPosition(this$static, position){
|
|
$setScrollTop(($clinit_DOM() , this$static.scrollableElem), position);
|
|
}
|
|
|
|
function ScrollPanel(){
|
|
SimplePanel.call(this);
|
|
this.scrollableElem = ($clinit_DOM() , this.element);
|
|
this.containerElem = $doc.createElement('div');
|
|
$appendChild(this.scrollableElem, this.containerElem);
|
|
this.scrollableElem.style['overflow'] = ($clinit_Style$Overflow() , 'auto');
|
|
this.scrollableElem.style['position'] = ($clinit_Style$Position() , 'relative');
|
|
this.containerElem.style['position'] = 'relative';
|
|
this.scrollableElem.style['zoom'] = '1';
|
|
this.containerElem.style['zoom'] = '1';
|
|
$setTouchScrollingDisabled(this);
|
|
!impl_0 && (impl_0 = new ScrollImpl);
|
|
}
|
|
|
|
defineClass(739, 255, $intern_61, ScrollPanel);
|
|
_.getContainerElement = function getContainerElement_2(){
|
|
return $clinit_DOM() , this.containerElem;
|
|
}
|
|
;
|
|
_.onAttach = function onAttach_4(){
|
|
$onAttach(this);
|
|
$clinit_DOM();
|
|
this.scrollableElem.__listener = this;
|
|
}
|
|
;
|
|
_.onDetach = function onDetach_4(){
|
|
$clinit_DOM();
|
|
this.scrollableElem.__listener = null;
|
|
$onDetach(this);
|
|
}
|
|
;
|
|
_.onResize_0 = function onResize_6(){
|
|
var child;
|
|
child = this.widget;
|
|
!!child && instanceOf(child, 209) && child.onResize_0();
|
|
}
|
|
;
|
|
_.setHeight_0 = function setHeight_1(height){
|
|
($clinit_DOM() , this.element).style['height'] = height;
|
|
}
|
|
;
|
|
_.setWidth_0 = function setWidth_1(width_0){
|
|
($clinit_DOM() , this.element).style['width'] = width_0;
|
|
}
|
|
;
|
|
var Lcom_google_gwt_user_client_ui_ScrollPanel_2_classLit = createForClass('com.google.gwt.user.client.ui', 'ScrollPanel', 739);
|
|
function $next_0(this$static){
|
|
if (!this$static.hasElement || !this$static.this$01.widget) {
|
|
throw toJs(new NoSuchElementException);
|
|
}
|
|
this$static.hasElement = false;
|
|
return this$static.returned = this$static.this$01.widget;
|
|
}
|
|
|
|
function SimplePanel$1(this$0){
|
|
this.this$01 = this$0;
|
|
this.hasElement = !!this.this$01.widget;
|
|
}
|
|
|
|
defineClass(330, 1, {}, SimplePanel$1);
|
|
_.next_1 = function next_1(){
|
|
return $next_0(this);
|
|
}
|
|
;
|
|
_.hasNext_0 = function hasNext_0(){
|
|
return this.hasElement;
|
|
}
|
|
;
|
|
_.remove_1 = function remove_9(){
|
|
!!this.returned && this.this$01.remove_0(this.returned);
|
|
}
|
|
;
|
|
_.hasElement = false;
|
|
_.returned = null;
|
|
var Lcom_google_gwt_user_client_ui_SimplePanel$1_2_classLit = createForClass('com.google.gwt.user.client.ui', 'SimplePanel/1', 330);
|
|
function $addValueChangeHandler_1(this$static, handler){
|
|
if (!this$static.valueChangeHandlerInitialized) {
|
|
this$static.valueChangeHandlerInitialized = true;
|
|
$addDomHandler(this$static, new ValueBoxBase$1(this$static), ($clinit_ChangeEvent() , $clinit_ChangeEvent() , TYPE_0));
|
|
}
|
|
return $addHandler(this$static, handler, (!TYPE_20 && (TYPE_20 = new GwtEvent$Type) , TYPE_20));
|
|
}
|
|
|
|
function $getText(this$static){
|
|
return $getPropertyString(($clinit_DOM() , this$static.element), 'value');
|
|
}
|
|
|
|
function $getValueOrThrow(this$static){
|
|
var parseResult, text_0;
|
|
text_0 = $getPropertyString(($clinit_DOM() , this$static.element), 'value');
|
|
parseResult = (checkCriticalNotNull(text_0) , text_0);
|
|
if ($equals_1('', text_0)) {
|
|
return null;
|
|
}
|
|
return parseResult;
|
|
}
|
|
|
|
function $selectAll(this$static){
|
|
var length_0;
|
|
length_0 = $getPropertyString(($clinit_DOM() , this$static.element), 'value').length;
|
|
length_0 > 0 && $setSelectionRange(this$static, length_0);
|
|
}
|
|
|
|
function $setSelectionRange(this$static, length_0){
|
|
if (!this$static.attached) {
|
|
return;
|
|
}
|
|
if (length_0 < 0) {
|
|
throw toJs(new IndexOutOfBoundsException_0('Length must be a positive integer. Length: ' + length_0));
|
|
}
|
|
if (length_0 > $getPropertyString(($clinit_DOM() , this$static.element), 'value').length) {
|
|
throw toJs(new IndexOutOfBoundsException_0('From Index: 0 To Index: ' + length_0 + ' Text Length: ' + $getPropertyString(this$static.element, 'value').length));
|
|
}
|
|
$setSelectionRange_0(this$static.element, 0, length_0);
|
|
}
|
|
|
|
function $setText_2(this$static, text_0){
|
|
($clinit_DOM() , this$static.element)['value'] = text_0 != null?text_0:'';
|
|
}
|
|
|
|
function ValueBoxBase(elem){
|
|
FocusWidget.call(this, elem);
|
|
$clinit_LocaleInfo();
|
|
}
|
|
|
|
defineClass(711, 82, $intern_70);
|
|
_.onBrowserEvent = function onBrowserEvent_4(event_0){
|
|
var type_0;
|
|
type_0 = ($clinit_DOM() , $eventGetTypeInt(event_0.type));
|
|
(type_0 & 896) != 0?$onBrowserEvent(this, event_0):$onBrowserEvent(this, event_0);
|
|
}
|
|
;
|
|
_.onLoad = function onLoad_2(){
|
|
}
|
|
;
|
|
_.valueChangeHandlerInitialized = false;
|
|
var Lcom_google_gwt_user_client_ui_ValueBoxBase_2_classLit = createForClass('com.google.gwt.user.client.ui', 'ValueBoxBase', 711);
|
|
function $clinit_TextBoxBase(){
|
|
$clinit_TextBoxBase = emptyMethod;
|
|
$clinit_ValueBoxBase$TextAlignment();
|
|
}
|
|
|
|
function TextBoxBase(elem){
|
|
ValueBoxBase.call(this, (!INSTANCE_1 && (INSTANCE_1 = new PassthroughRenderer) , !INSTANCE_0 && (INSTANCE_0 = new PassthroughParser) , elem));
|
|
}
|
|
|
|
defineClass(340, 711, $intern_70);
|
|
var Lcom_google_gwt_user_client_ui_TextBoxBase_2_classLit = createForClass('com.google.gwt.user.client.ui', 'TextBoxBase', 340);
|
|
function $setVisibleLines(this$static, lines){
|
|
$setRows(($clinit_DOM() , this$static.element), lines);
|
|
}
|
|
|
|
function TextArea_0(){
|
|
$clinit_TextBoxBase();
|
|
TextBoxBase.call(this, $doc.createElement('textarea'));
|
|
($clinit_DOM() , this.element).className = 'gwt-TextArea';
|
|
}
|
|
|
|
defineClass(167, 340, $intern_70, TextArea_0);
|
|
var Lcom_google_gwt_user_client_ui_TextArea_2_classLit = createForClass('com.google.gwt.user.client.ui', 'TextArea', 167);
|
|
function $setMaxLength(this$static){
|
|
($clinit_DOM() , this$static.element).maxLength = 15;
|
|
}
|
|
|
|
function $setVisibleLength(this$static){
|
|
($clinit_DOM() , this$static.element).size = 50;
|
|
}
|
|
|
|
function TextBox(){
|
|
$clinit_TextBoxBase();
|
|
TextBox_0.call(this, $createInputElement($doc, 'text'));
|
|
}
|
|
|
|
function TextBox_0(element){
|
|
TextBoxBase.call(this, element);
|
|
($clinit_DOM() , this.element).className = 'gwt-TextBox';
|
|
}
|
|
|
|
defineClass(127, 340, {172:1, 71:1, 119:1, 94:1, 122:1, 85:1, 98:1, 121:1, 69:1, 70:1, 72:1, 73:1, 75:1, 74:1, 76:1, 77:1, 78:1, 120:1, 96:1, 97:1, 95:1, 124:1, 125:1, 123:1, 86:1, 90:1, 88:1, 89:1, 87:1, 91:1, 102:1, 101:1, 100:1, 99:1, 28:1, 210:1, 25:1, 207:1, 134:1, 27:1, 230:1, 82:1, 116:1, 105:1, 115:1, 146:1, 50:1, 229:1, 23:1, 29:1, 92:1, 117:1, 118:1, 93:1, 127:1, 22:1, 24:1}, TextBox);
|
|
var Lcom_google_gwt_user_client_ui_TextBox_2_classLit = createForClass('com.google.gwt.user.client.ui', 'TextBox', 127);
|
|
function ValueBoxBase$1(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(716, 1, $intern_71, ValueBoxBase$1);
|
|
_.onChange = function onChange(event_0){
|
|
var raw;
|
|
fire_3(this.this$01, (raw = $getValueOrThrow(this.this$01) , raw == null?'':raw));
|
|
}
|
|
;
|
|
var Lcom_google_gwt_user_client_ui_ValueBoxBase$1_2_classLit = createForClass('com.google.gwt.user.client.ui', 'ValueBoxBase/1', 716);
|
|
function $clinit_ValueBoxBase$TextAlignment(){
|
|
$clinit_ValueBoxBase$TextAlignment = emptyMethod;
|
|
CENTER_2 = new ValueBoxBase$TextAlignment$1;
|
|
JUSTIFY_0 = new ValueBoxBase$TextAlignment$2;
|
|
LEFT_0 = new ValueBoxBase$TextAlignment$3;
|
|
RIGHT_0 = new ValueBoxBase$TextAlignment$4;
|
|
}
|
|
|
|
function ValueBoxBase$TextAlignment(enum$name, enum$ordinal){
|
|
Enum.call(this, enum$name, enum$ordinal);
|
|
}
|
|
|
|
function values_14(){
|
|
$clinit_ValueBoxBase$TextAlignment();
|
|
return stampJavaTypeInfo(getClassLiteralForArray(Lcom_google_gwt_user_client_ui_ValueBoxBase$TextAlignment_2_classLit, 1), $intern_3, 168, 0, [CENTER_2, JUSTIFY_0, LEFT_0, RIGHT_0]);
|
|
}
|
|
|
|
defineClass(168, 15, $intern_72);
|
|
var CENTER_2, JUSTIFY_0, LEFT_0, RIGHT_0;
|
|
var Lcom_google_gwt_user_client_ui_ValueBoxBase$TextAlignment_2_classLit = createForEnum('com.google.gwt.user.client.ui', 'ValueBoxBase/TextAlignment', 168, values_14);
|
|
function ValueBoxBase$TextAlignment$1(){
|
|
ValueBoxBase$TextAlignment.call(this, 'CENTER', 0);
|
|
}
|
|
|
|
defineClass(712, 168, $intern_72, ValueBoxBase$TextAlignment$1);
|
|
var Lcom_google_gwt_user_client_ui_ValueBoxBase$TextAlignment$1_2_classLit = createForEnum('com.google.gwt.user.client.ui', 'ValueBoxBase/TextAlignment/1', 712, null);
|
|
function ValueBoxBase$TextAlignment$2(){
|
|
ValueBoxBase$TextAlignment.call(this, 'JUSTIFY', 1);
|
|
}
|
|
|
|
defineClass(713, 168, $intern_72, ValueBoxBase$TextAlignment$2);
|
|
var Lcom_google_gwt_user_client_ui_ValueBoxBase$TextAlignment$2_2_classLit = createForEnum('com.google.gwt.user.client.ui', 'ValueBoxBase/TextAlignment/2', 713, null);
|
|
function ValueBoxBase$TextAlignment$3(){
|
|
ValueBoxBase$TextAlignment.call(this, 'LEFT', 2);
|
|
}
|
|
|
|
defineClass(714, 168, $intern_72, ValueBoxBase$TextAlignment$3);
|
|
var Lcom_google_gwt_user_client_ui_ValueBoxBase$TextAlignment$3_2_classLit = createForEnum('com.google.gwt.user.client.ui', 'ValueBoxBase/TextAlignment/3', 714, null);
|
|
function ValueBoxBase$TextAlignment$4(){
|
|
ValueBoxBase$TextAlignment.call(this, 'RIGHT', 3);
|
|
}
|
|
|
|
defineClass(715, 168, $intern_72, ValueBoxBase$TextAlignment$4);
|
|
var Lcom_google_gwt_user_client_ui_ValueBoxBase$TextAlignment$4_2_classLit = createForEnum('com.google.gwt.user.client.ui', 'ValueBoxBase/TextAlignment/4', 715, null);
|
|
function $add_5(this$static, w){
|
|
var td, tr;
|
|
tr = ($clinit_DOM() , $doc.createElement('tr'));
|
|
td = $createAlignedTd(this$static);
|
|
$appendChild(tr, resolve(td));
|
|
$appendChild(this$static.body_0, resolve(tr));
|
|
$add(this$static, w, td);
|
|
}
|
|
|
|
function $createAlignedTd(this$static){
|
|
var td;
|
|
td = ($clinit_DOM() , $doc.createElement('td'));
|
|
$setCellHorizontalAlignment(td, this$static.horzAlign);
|
|
$setCellVerticalAlignment(td, this$static.vertAlign);
|
|
return td;
|
|
}
|
|
|
|
function $insert_2(this$static, w, beforeIndex){
|
|
var td, tr;
|
|
$checkIndexBoundsForInsertion(this$static, beforeIndex);
|
|
tr = ($clinit_DOM() , $doc.createElement('tr'));
|
|
td = $createAlignedTd(this$static);
|
|
$appendChild(tr, resolve(td));
|
|
insertChild(this$static.body_0, tr, beforeIndex);
|
|
$insert(this$static, w, td, beforeIndex);
|
|
}
|
|
|
|
function $remove_4(this$static, w){
|
|
var removed, td;
|
|
td = ($clinit_DOM() , $getParentElement(w.element));
|
|
removed = $remove_0(this$static, w);
|
|
removed && $removeChild(this$static.body_0, $getParentElement(td));
|
|
return removed;
|
|
}
|
|
|
|
function VerticalPanel(){
|
|
CellPanel.call(this);
|
|
this.horzAlign = ($clinit_HasHorizontalAlignment() , ALIGN_DEFAULT);
|
|
this.vertAlign = ($clinit_HasVerticalAlignment() , ALIGN_TOP);
|
|
($clinit_DOM() , this.table)['cellSpacing'] = '0';
|
|
this.table['cellPadding'] = '0';
|
|
}
|
|
|
|
defineClass(84, 336, $intern_63, VerticalPanel);
|
|
_.add_0 = function add_10(w){
|
|
$add_5(this, w);
|
|
}
|
|
;
|
|
_.remove_0 = function remove_10(w){
|
|
return $remove_4(this, w);
|
|
}
|
|
;
|
|
var Lcom_google_gwt_user_client_ui_VerticalPanel_2_classLit = createForClass('com.google.gwt.user.client.ui', 'VerticalPanel', 84);
|
|
function $add_6(this$static, w){
|
|
$insert_3(this$static, w, this$static.size_0);
|
|
}
|
|
|
|
function $get_0(this$static, index_0){
|
|
if (index_0 < 0 || index_0 >= this$static.size_0) {
|
|
throw toJs(new IndexOutOfBoundsException);
|
|
}
|
|
return this$static.array[index_0];
|
|
}
|
|
|
|
function $indexOf(this$static, w){
|
|
var i;
|
|
for (i = 0; i < this$static.size_0; ++i) {
|
|
if (this$static.array[i] == w) {
|
|
return i;
|
|
}
|
|
}
|
|
return -1;
|
|
}
|
|
|
|
function $insert_3(this$static, w, beforeIndex){
|
|
var i, i0, newArray;
|
|
if (beforeIndex < 0 || beforeIndex > this$static.size_0) {
|
|
throw toJs(new IndexOutOfBoundsException);
|
|
}
|
|
if (this$static.size_0 == this$static.array.length) {
|
|
newArray = initUnidimensionalArray(Lcom_google_gwt_user_client_ui_Widget_2_classLit, $intern_3, 24, this$static.array.length * 2, 0, 1);
|
|
for (i0 = 0; i0 < this$static.array.length; ++i0) {
|
|
newArray[i0] = this$static.array[i0];
|
|
}
|
|
this$static.array = newArray;
|
|
}
|
|
++this$static.size_0;
|
|
for (i = this$static.size_0 - 1; i > beforeIndex; --i) {
|
|
this$static.array[i] = this$static.array[i - 1];
|
|
}
|
|
this$static.array[beforeIndex] = w;
|
|
}
|
|
|
|
function $remove_5(this$static, index_0){
|
|
var i;
|
|
if (index_0 < 0 || index_0 >= this$static.size_0) {
|
|
throw toJs(new IndexOutOfBoundsException);
|
|
}
|
|
--this$static.size_0;
|
|
for (i = index_0; i < this$static.size_0; ++i) {
|
|
this$static.array[i] = this$static.array[i + 1];
|
|
}
|
|
this$static.array[this$static.size_0] = null;
|
|
}
|
|
|
|
function $remove_6(this$static, w){
|
|
var index_0;
|
|
index_0 = $indexOf(this$static, w);
|
|
if (index_0 == -1) {
|
|
throw toJs(new NoSuchElementException);
|
|
}
|
|
$remove_5(this$static, index_0);
|
|
}
|
|
|
|
function WidgetCollection(parent_0){
|
|
this.parent_0 = parent_0;
|
|
this.array = initUnidimensionalArray(Lcom_google_gwt_user_client_ui_Widget_2_classLit, $intern_3, 24, 4, 0, 1);
|
|
}
|
|
|
|
defineClass(797, 1, $intern_73, WidgetCollection);
|
|
_.iterator = function iterator_4(){
|
|
return new WidgetCollection$WidgetIterator(this);
|
|
}
|
|
;
|
|
_.size_0 = 0;
|
|
var Lcom_google_gwt_user_client_ui_WidgetCollection_2_classLit = createForClass('com.google.gwt.user.client.ui', 'WidgetCollection', 797);
|
|
function $next_1(this$static){
|
|
if (this$static.index_0 >= this$static.this$01.size_0) {
|
|
throw toJs(new NoSuchElementException);
|
|
}
|
|
this$static.currentWidget = this$static.this$01.array[this$static.index_0];
|
|
++this$static.index_0;
|
|
return this$static.currentWidget;
|
|
}
|
|
|
|
function WidgetCollection$WidgetIterator(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(244, 1, {}, WidgetCollection$WidgetIterator);
|
|
_.next_1 = function next_2(){
|
|
return $next_1(this);
|
|
}
|
|
;
|
|
_.hasNext_0 = function hasNext_1(){
|
|
return this.index_0 < this.this$01.size_0;
|
|
}
|
|
;
|
|
_.remove_1 = function remove_11(){
|
|
if (!this.currentWidget) {
|
|
throw toJs(new IllegalStateException);
|
|
}
|
|
this.this$01.parent_0.remove_0(this.currentWidget);
|
|
--this.index_0;
|
|
this.currentWidget = null;
|
|
}
|
|
;
|
|
_.index_0 = 0;
|
|
var Lcom_google_gwt_user_client_ui_WidgetCollection$WidgetIterator_2_classLit = createForClass('com.google.gwt.user.client.ui', 'WidgetCollection/WidgetIterator', 244);
|
|
function $clinit_ClippedImageImpl(){
|
|
$clinit_ClippedImageImpl = emptyMethod;
|
|
clearImage = ($clinit_UriUtils() , new SafeUriString(getModuleBaseURL() + 'clear.cache.gif'));
|
|
}
|
|
|
|
function $getSafeHtml(url_0, left, top_0, width_0, height){
|
|
var builder;
|
|
builder = new SafeStylesBuilder;
|
|
$append($append($append(builder, new SafeStylesString('width:' + width_0 + ($clinit_Style$Unit() , 'px') + ';')), new SafeStylesString('height:' + height + 'px' + ';')), new SafeStylesString('background:' + ('url(' + url_0.uri_0 + ') ' + 'no-repeat ' + (-left + 'px ') + (-top_0 + 'px')) + ';'));
|
|
return !template_0 && (template_0 = new ClippedImageImpl_TemplateImpl) , $image(clearImage, new SafeStylesString((new SafeStylesString(builder.sb.string)).css));
|
|
}
|
|
|
|
var clearImage, template_0;
|
|
function $image(arg0, arg1){
|
|
var sb;
|
|
sb = new StringBuilder;
|
|
sb.string += "<img src='";
|
|
$append_4(sb, htmlEscape(arg0.uri_0));
|
|
sb.string += "' style='";
|
|
$append_4(sb, htmlEscape(arg1.css));
|
|
sb.string += "' border='0'>";
|
|
return new OnlyToBeUsedInGeneratedCodeStringBlessedAsSafeHtml(sb.string);
|
|
}
|
|
|
|
function ClippedImageImpl_TemplateImpl(){
|
|
}
|
|
|
|
defineClass(948, 1, {}, ClippedImageImpl_TemplateImpl);
|
|
var Lcom_google_gwt_user_client_ui_impl_ClippedImageImpl_1TemplateImpl_2_classLit = createForClass('com.google.gwt.user.client.ui.impl', 'ClippedImageImpl_TemplateImpl', 948);
|
|
function $clinit_ClippedImagePrototype(){
|
|
$clinit_ClippedImagePrototype = emptyMethod;
|
|
$clinit_ClippedImageImpl();
|
|
}
|
|
|
|
function $getSafeHtml_0(this$static){
|
|
return $getSafeHtml(this$static.url_0, this$static.left_0, this$static.top_0, this$static.width_0, this$static.height_0);
|
|
}
|
|
|
|
function ClippedImagePrototype(url_0, left, top_0, width_0, height){
|
|
$clinit_ClippedImagePrototype();
|
|
this.url_0 = url_0;
|
|
this.left_0 = left;
|
|
this.top_0 = top_0;
|
|
this.width_0 = width_0;
|
|
this.height_0 = height;
|
|
}
|
|
|
|
defineClass(831, 993, {}, ClippedImagePrototype);
|
|
_.height_0 = 0;
|
|
_.left_0 = 0;
|
|
_.top_0 = 0;
|
|
_.url_0 = null;
|
|
_.width_0 = 0;
|
|
var Lcom_google_gwt_user_client_ui_impl_ClippedImagePrototype_2_classLit = createForClass('com.google.gwt.user.client.ui.impl', 'ClippedImagePrototype', 831);
|
|
function $setClip(popup, rect){
|
|
popup.style['clip'] = rect;
|
|
}
|
|
|
|
function $setSelectionRange_0(elem, pos, length_0){
|
|
try {
|
|
elem.setSelectionRange(pos, pos + length_0);
|
|
}
|
|
catch (e) {
|
|
}
|
|
}
|
|
|
|
function assertCompileTimeUserAgent(){
|
|
var runtimeValue;
|
|
runtimeValue = $getRuntimeValue();
|
|
if (!$equals_1('ie10', runtimeValue)) {
|
|
throw toJs(new UserAgentAsserter$UserAgentAssertionError(runtimeValue));
|
|
}
|
|
}
|
|
|
|
function Error_0(message, cause){
|
|
Throwable.call(this, message, cause);
|
|
}
|
|
|
|
defineClass(279, 42, $intern_6);
|
|
var Ljava_lang_Error_2_classLit = createForClass('java.lang', 'Error', 279);
|
|
defineClass(132, 279, $intern_6);
|
|
var Ljava_lang_AssertionError_2_classLit = createForClass('java.lang', 'AssertionError', 132);
|
|
function UserAgentAsserter$UserAgentAssertionError(runtimeValue){
|
|
Error_0.call(this, 'Possible problem with your *.gwt.xml module file.\nThe compile time user.agent value (ie10) does not match the runtime user.agent value (' + runtimeValue + ').\n' + 'Expect more errors.' == null?'null':toString_9('Possible problem with your *.gwt.xml module file.\nThe compile time user.agent value (ie10) does not match the runtime user.agent value (' + runtimeValue + ').\n' + 'Expect more errors.'), instanceOf('Possible problem with your *.gwt.xml module file.\nThe compile time user.agent value (ie10) does not match the runtime user.agent value (' + runtimeValue + ').\n' + 'Expect more errors.', 42)?'Possible problem with your *.gwt.xml module file.\nThe compile time user.agent value (ie10) does not match the runtime user.agent value (' + runtimeValue + ').\n' + 'Expect more errors.':null);
|
|
}
|
|
|
|
defineClass(459, 132, $intern_6, UserAgentAsserter$UserAgentAssertionError);
|
|
var Lcom_google_gwt_useragent_client_UserAgentAsserter$UserAgentAssertionError_2_classLit = createForClass('com.google.gwt.useragent.client', 'UserAgentAsserter/UserAgentAssertionError', 459);
|
|
function $getRuntimeValue(){
|
|
var ua = navigator.userAgent.toLowerCase();
|
|
var docMode = $doc.documentMode;
|
|
if (function(){
|
|
return ua.indexOf('webkit') != -1;
|
|
}
|
|
())
|
|
return 'safari';
|
|
if (function(){
|
|
return ua.indexOf('msie') != -1 && docMode >= 10 && docMode < 11;
|
|
}
|
|
())
|
|
return 'ie10';
|
|
if (function(){
|
|
return ua.indexOf('msie') != -1 && docMode >= 9 && docMode < 11;
|
|
}
|
|
())
|
|
return 'ie9';
|
|
if (function(){
|
|
return ua.indexOf('msie') != -1 && docMode >= 8 && docMode < 11;
|
|
}
|
|
())
|
|
return 'ie8';
|
|
if (function(){
|
|
return ua.indexOf('gecko') != -1 || docMode >= 11;
|
|
}
|
|
())
|
|
return 'gecko1_8';
|
|
return 'unknown';
|
|
}
|
|
|
|
function $clearOnReadyStateChange(this$static){
|
|
this$static.onreadystatechange = function(){
|
|
}
|
|
;
|
|
}
|
|
|
|
function $open(this$static, httpMethod, url_0){
|
|
this$static.open(httpMethod, url_0, true);
|
|
}
|
|
|
|
function $setOnReadyStateChange(this$static, handler){
|
|
var _this = this$static;
|
|
this$static.onreadystatechange = $entry(function(){
|
|
handler.onReadyStateChange(_this);
|
|
}
|
|
);
|
|
}
|
|
|
|
function DOMException_0(message){
|
|
RuntimeException_0.call(this, message);
|
|
}
|
|
|
|
defineClass(355, 83, $intern_7);
|
|
var Lcom_google_gwt_xml_client_DOMException_2_classLit = createForClass('com.google.gwt.xml.client', 'DOMException', 355);
|
|
function $clinit_XMLParser(){
|
|
$clinit_XMLParser = emptyMethod;
|
|
impl_1 = ($clinit_XMLParserImpl() , $clinit_XMLParserImpl() , impl_2);
|
|
}
|
|
|
|
var impl_1;
|
|
function DOMItem(jso){
|
|
this.jsObject = jso;
|
|
}
|
|
|
|
defineClass(128, 1, $intern_74);
|
|
_.equals_0 = function equals_6(o){
|
|
if (instanceOf(o, 128)) {
|
|
return this.jsObject == o.jsObject;
|
|
}
|
|
return false;
|
|
}
|
|
;
|
|
_.getJsObject = function getJsObject(){
|
|
return this.jsObject;
|
|
}
|
|
;
|
|
_.hashCode_0 = function hashCode_8(){
|
|
return $hashCode(this.jsObject);
|
|
}
|
|
;
|
|
var Lcom_google_gwt_xml_client_impl_DOMItem_2_classLit = createForClass('com.google.gwt.xml.client.impl', 'DOMItem', 128);
|
|
function $appendChild_0(this$static, newChild){
|
|
var appendChildResults, e, newChildJs;
|
|
try {
|
|
newChildJs = newChild.jsObject;
|
|
appendChildResults = appendChild(this$static.jsObject, newChildJs);
|
|
return build(appendChildResults);
|
|
}
|
|
catch ($e0) {
|
|
$e0 = toJava($e0);
|
|
if (instanceOf($e0, 135)) {
|
|
e = $e0;
|
|
throw toJs(new DOMNodeException(e, this$static));
|
|
}
|
|
else
|
|
throw toJs($e0);
|
|
}
|
|
}
|
|
|
|
function $removeChild_2(this$static, oldChild){
|
|
var e, oldChildJs, removeChildResults;
|
|
try {
|
|
oldChildJs = oldChild.jsObject;
|
|
removeChildResults = removeChild(this$static.jsObject, oldChildJs);
|
|
return build(removeChildResults);
|
|
}
|
|
catch ($e0) {
|
|
$e0 = toJava($e0);
|
|
if (instanceOf($e0, 135)) {
|
|
e = $e0;
|
|
throw toJs(new DOMNodeException(e, this$static));
|
|
}
|
|
else
|
|
throw toJs($e0);
|
|
}
|
|
}
|
|
|
|
function NodeImpl(jso){
|
|
DOMItem.call(this, jso);
|
|
}
|
|
|
|
function build(node){
|
|
var nodeType;
|
|
if (!node) {
|
|
return null;
|
|
}
|
|
nodeType = getNodeType(node);
|
|
switch (nodeType) {
|
|
case 2:
|
|
return new AttrImpl(node);
|
|
case 4:
|
|
return new CDATASectionImpl(node);
|
|
case 8:
|
|
return new CommentImpl(node);
|
|
case 11:
|
|
return new DocumentFragmentImpl(node);
|
|
case 9:
|
|
return new DocumentImpl(node);
|
|
case 1:
|
|
return new ElementImpl(node);
|
|
case 7:
|
|
return new ProcessingInstructionImpl(node);
|
|
case 3:
|
|
return new TextImpl(node);
|
|
default:return new NodeImpl(node);
|
|
}
|
|
}
|
|
|
|
defineClass(199, 128, $intern_74, NodeImpl);
|
|
_.toString_0 = function toString_13(){
|
|
return $clinit_XMLParserImpl() , $toStringImpl(this);
|
|
}
|
|
;
|
|
var Lcom_google_gwt_xml_client_impl_NodeImpl_2_classLit = createForClass('com.google.gwt.xml.client.impl', 'NodeImpl', 199);
|
|
function AttrImpl(o){
|
|
NodeImpl.call(this, o);
|
|
}
|
|
|
|
defineClass(896, 199, $intern_74, AttrImpl);
|
|
var Lcom_google_gwt_xml_client_impl_AttrImpl_2_classLit = createForClass('com.google.gwt.xml.client.impl', 'AttrImpl', 896);
|
|
function CharacterDataImpl(o){
|
|
NodeImpl.call(this, o);
|
|
}
|
|
|
|
defineClass(368, 199, $intern_74);
|
|
var Lcom_google_gwt_xml_client_impl_CharacterDataImpl_2_classLit = createForClass('com.google.gwt.xml.client.impl', 'CharacterDataImpl', 368);
|
|
function TextImpl(o){
|
|
CharacterDataImpl.call(this, o);
|
|
}
|
|
|
|
defineClass(369, 368, $intern_75, TextImpl);
|
|
_.toString_0 = function toString_14(){
|
|
var b, i, x_0;
|
|
b = new StringBuilder;
|
|
x_0 = $split_1(getData(this.jsObject), '(?=[;&<>\'"])', -1);
|
|
for (i = 0; i < x_0.length; i++) {
|
|
if ($startsWith(x_0[i], ';')) {
|
|
b.string += ';';
|
|
$append_4(b, x_0[i].substr(1));
|
|
}
|
|
else if ($startsWith(x_0[i], '&')) {
|
|
b.string += '&';
|
|
$append_4(b, x_0[i].substr(1));
|
|
}
|
|
else if ($startsWith(x_0[i], '"')) {
|
|
b.string += '"';
|
|
$append_4(b, x_0[i].substr(1));
|
|
}
|
|
else if ($startsWith(x_0[i], "'")) {
|
|
b.string += ''';
|
|
$append_4(b, x_0[i].substr(1));
|
|
}
|
|
else if ($startsWith(x_0[i], '<')) {
|
|
b.string += '<';
|
|
$append_4(b, x_0[i].substr(1));
|
|
}
|
|
else if ($startsWith(x_0[i], '>')) {
|
|
b.string += '>';
|
|
$append_4(b, x_0[i].substr(1));
|
|
}
|
|
else {
|
|
b.string += '' + x_0[i];
|
|
}
|
|
}
|
|
return b.string;
|
|
}
|
|
;
|
|
var Lcom_google_gwt_xml_client_impl_TextImpl_2_classLit = createForClass('com.google.gwt.xml.client.impl', 'TextImpl', 369);
|
|
function CDATASectionImpl(o){
|
|
TextImpl.call(this, o);
|
|
}
|
|
|
|
defineClass(897, 369, $intern_75, CDATASectionImpl);
|
|
_.toString_0 = function toString_15(){
|
|
var b;
|
|
b = new StringBuilder_1('<![CDATA[');
|
|
$append_4(b, getData(this.jsObject));
|
|
b.string += ']]>';
|
|
return b.string;
|
|
}
|
|
;
|
|
var Lcom_google_gwt_xml_client_impl_CDATASectionImpl_2_classLit = createForClass('com.google.gwt.xml.client.impl', 'CDATASectionImpl', 897);
|
|
function CommentImpl(o){
|
|
CharacterDataImpl.call(this, o);
|
|
}
|
|
|
|
defineClass(898, 368, $intern_74, CommentImpl);
|
|
_.toString_0 = function toString_16(){
|
|
var b;
|
|
b = new StringBuilder_1('<!--');
|
|
$append_4(b, getData(this.jsObject));
|
|
b.string += '-->';
|
|
return b.string;
|
|
}
|
|
;
|
|
var Lcom_google_gwt_xml_client_impl_CommentImpl_2_classLit = createForClass('com.google.gwt.xml.client.impl', 'CommentImpl', 898);
|
|
function DOMNodeException(e, item_0){
|
|
DOMException_0.call(this, 'Error during DOM manipulation of: ' + summarize(item_0.toString_0()));
|
|
$initCause(this, e);
|
|
}
|
|
|
|
defineClass(204, 355, $intern_7, DOMNodeException);
|
|
var Lcom_google_gwt_xml_client_impl_DOMNodeException_2_classLit = createForClass('com.google.gwt.xml.client.impl', 'DOMNodeException', 204);
|
|
function DOMParseException(contents, e){
|
|
DOMException_0.call(this, 'Failed to parse: ' + $substring_0(contents, 0, $wnd.Math.min(contents.length, 128)));
|
|
$initCause(this, e);
|
|
}
|
|
|
|
function summarize(text_0){
|
|
return $substring_0(text_0, 0, $wnd.Math.min(text_0.length, 128));
|
|
}
|
|
|
|
defineClass(826, 355, $intern_7, DOMParseException);
|
|
var Lcom_google_gwt_xml_client_impl_DOMParseException_2_classLit = createForClass('com.google.gwt.xml.client.impl', 'DOMParseException', 826);
|
|
function DocumentFragmentImpl(o){
|
|
NodeImpl.call(this, o);
|
|
}
|
|
|
|
defineClass(899, 199, $intern_74, DocumentFragmentImpl);
|
|
var Lcom_google_gwt_xml_client_impl_DocumentFragmentImpl_2_classLit = createForClass('com.google.gwt.xml.client.impl', 'DocumentFragmentImpl', 899);
|
|
function $createElement(this$static, tagName){
|
|
var e;
|
|
try {
|
|
return build(createElement(this$static.jsObject, tagName));
|
|
}
|
|
catch ($e0) {
|
|
$e0 = toJava($e0);
|
|
if (instanceOf($e0, 135)) {
|
|
e = $e0;
|
|
throw toJs(new DOMNodeException(e, this$static));
|
|
}
|
|
else
|
|
throw toJs($e0);
|
|
}
|
|
}
|
|
|
|
function $createTextNode(this$static, data_0){
|
|
var e;
|
|
try {
|
|
return build(createTextNode(this$static.jsObject, data_0));
|
|
}
|
|
catch ($e0) {
|
|
$e0 = toJava($e0);
|
|
if (instanceOf($e0, 135)) {
|
|
e = $e0;
|
|
throw toJs(new DOMNodeException(e, this$static));
|
|
}
|
|
else
|
|
throw toJs($e0);
|
|
}
|
|
}
|
|
|
|
function $importNode(this$static, importedNode){
|
|
var e;
|
|
try {
|
|
return build(($clinit_XMLParserImpl() , $importNodeImpl(this$static.jsObject, importedNode.jsObject, true)));
|
|
}
|
|
catch ($e0) {
|
|
$e0 = toJava($e0);
|
|
if (instanceOf($e0, 135)) {
|
|
e = $e0;
|
|
throw toJs(new DOMNodeException(e, this$static));
|
|
}
|
|
else
|
|
throw toJs($e0);
|
|
}
|
|
}
|
|
|
|
function DocumentImpl(o){
|
|
NodeImpl.call(this, o);
|
|
}
|
|
|
|
defineClass(900, 199, {1013:1, 128:1}, DocumentImpl);
|
|
var Lcom_google_gwt_xml_client_impl_DocumentImpl_2_classLit = createForClass('com.google.gwt.xml.client.impl', 'DocumentImpl', 900);
|
|
function $getAttribute(this$static, tagName){
|
|
return getAttribute(this$static.jsObject, tagName);
|
|
}
|
|
|
|
function $removeAttribute(this$static){
|
|
var e;
|
|
try {
|
|
removeAttribute(this$static.jsObject, 'x');
|
|
}
|
|
catch ($e0) {
|
|
$e0 = toJava($e0);
|
|
if (instanceOf($e0, 135)) {
|
|
e = $e0;
|
|
throw toJs(new DOMNodeException(e, this$static));
|
|
}
|
|
else
|
|
throw toJs($e0);
|
|
}
|
|
}
|
|
|
|
function $setAttribute_0(this$static, name_0, value_0){
|
|
var e;
|
|
try {
|
|
setAttribute(this$static.jsObject, name_0, value_0);
|
|
}
|
|
catch ($e0) {
|
|
$e0 = toJava($e0);
|
|
if (instanceOf($e0, 135)) {
|
|
e = $e0;
|
|
throw toJs(new DOMNodeException(e, this$static));
|
|
}
|
|
else
|
|
throw toJs($e0);
|
|
}
|
|
}
|
|
|
|
function ElementImpl(o){
|
|
NodeImpl.call(this, o);
|
|
}
|
|
|
|
defineClass(901, 199, {1014:1, 128:1}, ElementImpl);
|
|
var Lcom_google_gwt_xml_client_impl_ElementImpl_2_classLit = createForClass('com.google.gwt.xml.client.impl', 'ElementImpl', 901);
|
|
function $item(this$static, index_0){
|
|
return build(item_3(this$static.jsObject, index_0));
|
|
}
|
|
|
|
function NodeListImpl(o){
|
|
DOMItem.call(this, o);
|
|
}
|
|
|
|
defineClass(170, 128, $intern_74, NodeListImpl);
|
|
_.getLength = function getLength(){
|
|
return getLength_1(this.jsObject);
|
|
}
|
|
;
|
|
_.item_0 = function item_1(index_0){
|
|
return $item(this, index_0);
|
|
}
|
|
;
|
|
_.toString_0 = function toString_17(){
|
|
var b, i;
|
|
b = new StringBuilder;
|
|
for (i = 0; i < this.getLength(); i++) {
|
|
$append_4(b, this.item_0(i).toString_0());
|
|
}
|
|
return b.string;
|
|
}
|
|
;
|
|
var Lcom_google_gwt_xml_client_impl_NodeListImpl_2_classLit = createForClass('com.google.gwt.xml.client.impl', 'NodeListImpl', 170);
|
|
function NamedNodeMapImpl(o){
|
|
NodeListImpl.call(this, o);
|
|
}
|
|
|
|
defineClass(452, 170, $intern_74, NamedNodeMapImpl);
|
|
_.getLength = function getLength_0(){
|
|
return getLength_1(this.jsObject);
|
|
}
|
|
;
|
|
_.item_0 = function item_2(index_0){
|
|
return build(item_3(this.jsObject, index_0));
|
|
}
|
|
;
|
|
var Lcom_google_gwt_xml_client_impl_NamedNodeMapImpl_2_classLit = createForClass('com.google.gwt.xml.client.impl', 'NamedNodeMapImpl', 452);
|
|
function ProcessingInstructionImpl(o){
|
|
NodeImpl.call(this, o);
|
|
}
|
|
|
|
defineClass(902, 199, $intern_74, ProcessingInstructionImpl);
|
|
_.toString_0 = function toString_18(){
|
|
return $clinit_XMLParserImpl() , $toStringImpl(this);
|
|
}
|
|
;
|
|
var Lcom_google_gwt_xml_client_impl_ProcessingInstructionImpl_2_classLit = createForClass('com.google.gwt.xml.client.impl', 'ProcessingInstructionImpl', 902);
|
|
function $clinit_XMLParserImpl(){
|
|
$clinit_XMLParserImpl = emptyMethod;
|
|
impl_2 = new XMLParserImplStandard;
|
|
}
|
|
|
|
function $parse_2(this$static, contents){
|
|
var e;
|
|
try {
|
|
return build($parseImpl(this$static, contents));
|
|
}
|
|
catch ($e0) {
|
|
$e0 = toJava($e0);
|
|
if (instanceOf($e0, 135)) {
|
|
e = $e0;
|
|
throw toJs(new DOMParseException(contents, e));
|
|
}
|
|
else
|
|
throw toJs($e0);
|
|
}
|
|
}
|
|
|
|
function appendChild(jsObject, newChildJs){
|
|
$clinit_XMLParserImpl();
|
|
return jsObject.appendChild(newChildJs);
|
|
}
|
|
|
|
function createElement(jsObject, tagName){
|
|
$clinit_XMLParserImpl();
|
|
return jsObject.createElement(tagName);
|
|
}
|
|
|
|
function createTextNode(jsObject, data_0){
|
|
$clinit_XMLParserImpl();
|
|
return jsObject.createTextNode(data_0);
|
|
}
|
|
|
|
function getAttribute(o, name_0){
|
|
$clinit_XMLParserImpl();
|
|
return o.getAttribute(name_0);
|
|
}
|
|
|
|
function getAttributes(t){
|
|
$clinit_XMLParserImpl();
|
|
return t.attributes;
|
|
}
|
|
|
|
function getChildNodes(t){
|
|
$clinit_XMLParserImpl();
|
|
return t.childNodes;
|
|
}
|
|
|
|
function getData(o){
|
|
$clinit_XMLParserImpl();
|
|
return o.data;
|
|
}
|
|
|
|
function getDocumentElement(o){
|
|
$clinit_XMLParserImpl();
|
|
return o.documentElement;
|
|
}
|
|
|
|
function getLength_1(o){
|
|
$clinit_XMLParserImpl();
|
|
return o.length;
|
|
}
|
|
|
|
function getNextSibling(o){
|
|
$clinit_XMLParserImpl();
|
|
return o.nextSibling;
|
|
}
|
|
|
|
function getNodeName(o){
|
|
$clinit_XMLParserImpl();
|
|
return o.nodeName;
|
|
}
|
|
|
|
function getNodeType(jsObject){
|
|
$clinit_XMLParserImpl();
|
|
var out = jsObject.nodeType;
|
|
return out == null?-1:out;
|
|
}
|
|
|
|
function getNodeValue(o){
|
|
$clinit_XMLParserImpl();
|
|
return o.nodeValue;
|
|
}
|
|
|
|
function getTagName(o){
|
|
$clinit_XMLParserImpl();
|
|
return o.tagName;
|
|
}
|
|
|
|
function hasChildNodes(jsObject){
|
|
$clinit_XMLParserImpl();
|
|
return jsObject.hasChildNodes();
|
|
}
|
|
|
|
function item_3(t, index_0){
|
|
$clinit_XMLParserImpl();
|
|
if (index_0 >= t.length) {
|
|
return null;
|
|
}
|
|
return t.item(index_0);
|
|
}
|
|
|
|
function removeAttribute(jsObject, name_0){
|
|
$clinit_XMLParserImpl();
|
|
jsObject.removeAttribute(name_0);
|
|
}
|
|
|
|
function removeChild(jsObject, oldChildJs){
|
|
$clinit_XMLParserImpl();
|
|
return jsObject.removeChild(oldChildJs);
|
|
}
|
|
|
|
function setAttribute(jsObject, name_0, value_0){
|
|
$clinit_XMLParserImpl();
|
|
jsObject.setAttribute(name_0, value_0);
|
|
}
|
|
|
|
defineClass(990, 1, {});
|
|
var impl_2;
|
|
var Lcom_google_gwt_xml_client_impl_XMLParserImpl_2_classLit = createForClass('com.google.gwt.xml.client.impl', 'XMLParserImpl', 990);
|
|
function $createDocumentImpl(){
|
|
return document.implementation.createDocument('', '', null);
|
|
}
|
|
|
|
function $importNodeImpl(jsObject, importedNode, deep){
|
|
return jsObject.importNode(importedNode, deep);
|
|
}
|
|
|
|
function $parseImpl(this$static, contents){
|
|
var domParser = this$static.domParser;
|
|
var result = domParser.parseFromString(contents, 'text/xml');
|
|
var roottag = result.documentElement;
|
|
if (roottag.tagName == 'parsererror' && roottag.namespaceURI == 'http://www.mozilla.org/newlayout/xml/parsererror.xml') {
|
|
throw new Error(roottag.firstChild.data);
|
|
}
|
|
return result;
|
|
}
|
|
|
|
function $toStringImpl(node){
|
|
var jsNode = node.getJsObject();
|
|
return (new XMLSerializer).serializeToString(jsNode);
|
|
}
|
|
|
|
function XMLParserImplStandard(){
|
|
this.domParser = new DOMParser;
|
|
}
|
|
|
|
defineClass(825, 990, {}, XMLParserImplStandard);
|
|
var Lcom_google_gwt_xml_client_impl_XMLParserImplStandard_2_classLit = createForClass('com.google.gwt.xml.client.impl', 'XMLParserImplStandard', 825);
|
|
function $removeHandler(this$static){
|
|
$doRemove(this$static.this$01, this$static.val$type2, this$static.val$source3, this$static.val$handler4);
|
|
}
|
|
|
|
function SimpleEventBus$1(this$0, val$type, val$handler){
|
|
this.this$01 = this$0;
|
|
this.val$type2 = val$type;
|
|
this.val$source3 = null;
|
|
this.val$handler4 = val$handler;
|
|
}
|
|
|
|
defineClass(488, 1, {}, SimpleEventBus$1);
|
|
var Lcom_google_web_bindery_event_shared_SimpleEventBus$1_2_classLit = createForClass('com.google.web.bindery.event.shared', 'SimpleEventBus/1', 488);
|
|
function SimpleEventBus$2(this$0, val$type, val$handler){
|
|
this.this$01 = this$0;
|
|
this.val$type2 = val$type;
|
|
this.val$source3 = null;
|
|
this.val$handler4 = val$handler;
|
|
}
|
|
|
|
defineClass(489, 1, {998:1}, SimpleEventBus$2);
|
|
_.execute_1 = function execute_12(){
|
|
$doAddNow(this.this$01, this.val$type2, this.val$source3, this.val$handler4);
|
|
}
|
|
;
|
|
var Lcom_google_web_bindery_event_shared_SimpleEventBus$2_2_classLit = createForClass('com.google.web.bindery.event.shared', 'SimpleEventBus/2', 489);
|
|
function SimpleEventBus$3(this$0, val$type, val$source, val$handler){
|
|
this.this$01 = this$0;
|
|
this.val$type2 = val$type;
|
|
this.val$source3 = val$source;
|
|
this.val$handler4 = val$handler;
|
|
}
|
|
|
|
defineClass(490, 1, {998:1}, SimpleEventBus$3);
|
|
_.execute_1 = function execute_13(){
|
|
$doRemoveNow(this.this$01, this.val$type2, this.val$source3, this.val$handler4);
|
|
}
|
|
;
|
|
var Lcom_google_web_bindery_event_shared_SimpleEventBus$3_2_classLit = createForClass('com.google.web.bindery.event.shared', 'SimpleEventBus/3', 490);
|
|
function $$init_0(this$static){
|
|
}
|
|
|
|
function $addCurCount(c, a){
|
|
if (c == 100 || c == -100)
|
|
return c;
|
|
return c + a;
|
|
}
|
|
|
|
function $addJSMethods(this$static){
|
|
var that = this$static;
|
|
this$static.getType = $entry(function(){
|
|
return that.getClassName();
|
|
}
|
|
);
|
|
this$static.getInfo = $entry(function(){
|
|
return that.getInfoJS();
|
|
}
|
|
);
|
|
this$static.getVoltageDiff = $entry(function(){
|
|
return that.getVoltageDiff_0();
|
|
}
|
|
);
|
|
this$static.getVoltage = $entry(function(n){
|
|
return that.getVoltageJS(n);
|
|
}
|
|
);
|
|
this$static.getCurrent = $entry(function(){
|
|
return that.getCurrent_0();
|
|
}
|
|
);
|
|
this$static.getLabelName = $entry(function(){
|
|
return that.getName();
|
|
}
|
|
);
|
|
this$static.getPostCount = $entry(function(){
|
|
return that.getPostCount_0();
|
|
}
|
|
);
|
|
}
|
|
|
|
function $addRoutingObstacleWithLeads(this$static, router, width_0){
|
|
var pa, pb;
|
|
if (this$static.x_0 == this$static.x2 || this$static.y_0 == this$static.y2) {
|
|
$addWire(router, this$static.x_0, this$static.y_0, this$static.x2, this$static.y2);
|
|
pa = $interpPoint_0(this$static.lead1, this$static.lead2, 0, width_0);
|
|
pb = $interpPoint_0(this$static.lead1, this$static.lead2, 1, -width_0);
|
|
$addObstacle(router, pa.x_0, pa.y_0, pb.x_0, pb.y_0);
|
|
}
|
|
}
|
|
|
|
function $adjustBbox(this$static, x1, y1, x2, y2){
|
|
var q;
|
|
if (x1 > x2) {
|
|
q = x1;
|
|
x1 = x2;
|
|
x2 = q;
|
|
}
|
|
if (y1 > y2) {
|
|
q = y1;
|
|
y1 = y2;
|
|
y2 = q;
|
|
}
|
|
x1 = min_1(this$static.boundingBox.x_0, x1);
|
|
y1 = min_1(this$static.boundingBox.y_0, y1);
|
|
x2 = max_1(this$static.boundingBox.x_0 + this$static.boundingBox.width_0, x2);
|
|
y2 = max_1(this$static.boundingBox.y_0 + this$static.boundingBox.height_0, y2);
|
|
$setBounds(this$static.boundingBox, x1, y1, x2 - x1, y2 - y1);
|
|
}
|
|
|
|
function $adjustBbox_0(this$static, p1, p2){
|
|
$adjustBbox(this$static, p1.x_0, p1.y_0, p2.x_0, p2.y_0);
|
|
}
|
|
|
|
function $adjustLeadsToGrid(this$static, flipX, flipY){
|
|
var adjx, adjy, cx, cy, roundx, roundy;
|
|
cx = (this$static.point1.x_0 + this$static.point2.x_0) / 2 | 0;
|
|
cy = (this$static.point1.y_0 + this$static.point2.y_0) / 2 | 0;
|
|
roundx = flipX?1:-1;
|
|
roundy = flipY?1:-1;
|
|
adjx = $snapGrid_0(app_0, cx + roundx) - cx;
|
|
adjy = $snapGrid_0(app_0, cy + roundy) - cy;
|
|
$move_0(this$static.lead1, adjx, adjy);
|
|
$move_0(this$static.lead2, adjx, adjy);
|
|
}
|
|
|
|
function $allocNodes(this$static){
|
|
var n;
|
|
n = this$static.getPostCount_0() + this$static.getInternalNodeCount();
|
|
if (this$static.nodes == null || this$static.nodes.length != n) {
|
|
this$static.nodes = initUnidimensionalArray(Lcom_lushprojects_circuitjs1_client_CircuitNode_2_classLit, $intern_3, 175, n, 0, 1);
|
|
this$static.volts = initUnidimensionalArray(D_classLit, $intern_76, 7, n, 15, 1);
|
|
}
|
|
}
|
|
|
|
function $allowMove(this$static, dx, dy){
|
|
var ce, ce$iterator, nx, nx2, ny, ny2;
|
|
nx = this$static.x_0 + dx;
|
|
ny = this$static.y_0 + dy;
|
|
nx2 = this$static.x2 + dx;
|
|
ny2 = this$static.y2 + dy;
|
|
for (ce$iterator = new ArrayList$1(app_0.elmList.arrayList); ce$iterator.i < ce$iterator.this$01.array.length;) {
|
|
ce = $next_4(ce$iterator);
|
|
if (ce.x_0 == nx && ce.y_0 == ny && ce.x2 == nx2 && ce.y2 == ny2)
|
|
return false;
|
|
if (ce.x_0 == nx2 && ce.y_0 == ny2 && ce.x2 == nx && ce.y2 == ny)
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
function $calcArrow(a, b, al, aw){
|
|
var adx, ady, l_0, p1, p2, poly;
|
|
poly = new Polygon;
|
|
p1 = new Point_1;
|
|
p2 = new Point_1;
|
|
adx = b.x_0 - a.x_0;
|
|
ady = b.y_0 - a.y_0;
|
|
l_0 = $wnd.Math.sqrt(adx * adx + ady * ady);
|
|
$addPoint(poly, b.x_0, b.y_0);
|
|
$interpPoint2(a, b, p1, p2, 1 - al / l_0, aw);
|
|
$addPoint(poly, p1.x_0, p1.y_0);
|
|
$addPoint(poly, p2.x_0, p2.y_0);
|
|
return poly;
|
|
}
|
|
|
|
function $calcLeads(this$static, len){
|
|
if (this$static.dn < len || len == 0) {
|
|
this$static.lead1 = this$static.point1;
|
|
this$static.lead2 = this$static.point2;
|
|
return;
|
|
}
|
|
this$static.lead1 = $interpPoint(this$static.point1, this$static.point2, (this$static.dn - len) / (2 * this$static.dn));
|
|
this$static.lead2 = $interpPoint(this$static.point1, this$static.point2, (this$static.dn + len) / (2 * this$static.dn));
|
|
}
|
|
|
|
function $comparePair(x1, x2, y1, y2){
|
|
return x1 == y1 && x2 == y2 || x1 == y2 && x2 == y1;
|
|
}
|
|
|
|
function $createPolygon(a, b, c){
|
|
var p;
|
|
p = new Polygon;
|
|
$addPoint(p, a.x_0, a.y_0);
|
|
$addPoint(p, b.x_0, b.y_0);
|
|
$addPoint(p, c.x_0, c.y_0);
|
|
return p;
|
|
}
|
|
|
|
function $createPolygon_0(a, b, c, d){
|
|
var p;
|
|
p = new Polygon;
|
|
$addPoint(p, a.x_0, a.y_0);
|
|
$addPoint(p, b.x_0, b.y_0);
|
|
$addPoint(p, c.x_0, c.y_0);
|
|
$addPoint(p, d.x_0, d.y_0);
|
|
return p;
|
|
}
|
|
|
|
function $createPolygon_1(a){
|
|
var i, p;
|
|
p = new Polygon;
|
|
for (i = 0; i != a.length; i++)
|
|
$addPoint(p, a[i].x_0, a[i].y_0);
|
|
return p;
|
|
}
|
|
|
|
function $drag(this$static, xx, yy){
|
|
xx = $snapGrid_0(app_0, xx);
|
|
yy = $snapGrid_0(app_0, yy);
|
|
this$static.noDiagonal && ($wnd.Math.abs(this$static.x_0 - xx) < $wnd.Math.abs(this$static.y_0 - yy)?(xx = this$static.x_0):(yy = this$static.y_0));
|
|
this$static.x2 = xx;
|
|
this$static.y2 = yy;
|
|
this$static.setPoints();
|
|
}
|
|
|
|
function $dragPlace(this$static, xa, ya, vertical){
|
|
var len;
|
|
vertical = this$static.getDragVertical(vertical);
|
|
len = this$static.getDragLength();
|
|
this$static.x_0 = xa;
|
|
this$static.y_0 = ya;
|
|
this$static.x2 = xa + (vertical?0:len);
|
|
this$static.y2 = ya + (vertical?len:0);
|
|
this$static.setPoints();
|
|
}
|
|
|
|
function $draw2Leads(this$static, g){
|
|
$setVoltageColor(this$static, g, this$static.volts[0]);
|
|
drawThickLine_0(g, this$static.point1, this$static.lead1, 3);
|
|
$setVoltageColor(this$static, g, this$static.volts[1]);
|
|
drawThickLine_0(g, this$static.lead2, this$static.point2, 3);
|
|
}
|
|
|
|
function $drawCenteredText(this$static, g, s, x_0, y_0, cx){
|
|
var h2, w;
|
|
w = round_int($measureText(g.context, s).width);
|
|
h2 = g.currentFontSize / 2 | 0;
|
|
g.context.save();
|
|
g.savedFontSize = g.currentFontSize;
|
|
g.context.textBaseline = 'middle';
|
|
if (cx) {
|
|
g.context.textAlign = 'center';
|
|
$adjustBbox(this$static, x_0 - (w / 2 | 0), y_0 - h2, x_0 + (w / 2 | 0), y_0 + h2);
|
|
}
|
|
else {
|
|
$adjustBbox(this$static, x_0, y_0 - h2, x_0 + w, y_0 + h2);
|
|
}
|
|
cx && (g.context.textAlign = 'center' , undefined);
|
|
$fillText(g.context, s, x_0, y_0);
|
|
g.context.restore();
|
|
g.currentFontSize = g.savedFontSize;
|
|
}
|
|
|
|
function $drawCoil(this$static, g, hs, p1, p2, v1, v2){
|
|
var grad, len, loop, loopCt, start_0;
|
|
len = distance(p1, p2);
|
|
g.context.save();
|
|
g.savedFontSize = g.currentFontSize;
|
|
g.context.lineWidth = 3;
|
|
$transform(g.context, (p2.x_0 - p1.x_0) / len, (p2.y_0 - p1.y_0) / len, -(p2.y_0 - p1.y_0) / len, (p2.x_0 - p1.x_0) / len, p1.x_0, p1.y_0);
|
|
if (app_0.menus.voltsCheckItem.on) {
|
|
grad = $createLinearGradient(g.context, 0, 0, len, 0);
|
|
$addColorStop(grad, 0, $getHexValue($getVoltageColor(this$static, v1)));
|
|
$addColorStop(grad, 1, $getHexValue($getVoltageColor(this$static, v2)));
|
|
$setStrokeStyleWeb(g.context, grad);
|
|
}
|
|
$setLineCap(g.context, ($clinit_Context2d$LineCap() , ROUND).value_0);
|
|
$scale(g.context, 1, hs > 0?1:-1);
|
|
loopCt = round_int($wnd.Math.ceil(len / 11));
|
|
for (loop = 0; loop != loopCt; loop++) {
|
|
g.context.beginPath();
|
|
start_0 = len * loop / loopCt;
|
|
$moveTo(g.context, start_0, 0);
|
|
$arc(g.context, len * (loop + 0.5) / loopCt, 0, len / (2 * loopCt), $intern_1, $intern_2);
|
|
$lineTo(g.context, len * (loop + 1) / loopCt, 0);
|
|
g.context.stroke();
|
|
}
|
|
g.context.restore();
|
|
g.currentFontSize = g.savedFontSize;
|
|
}
|
|
|
|
function $drawDots(g, pa, pb, pos){
|
|
var ctx, di, dn, dx, dy, x0, y0;
|
|
if (!app_0.ui.app.simRunning || pos == 0 || !app_0.menus.dotsCheckItem.on)
|
|
return;
|
|
dx = pb.x_0 - pa.x_0;
|
|
dy = pb.y_0 - pa.y_0;
|
|
dn = $wnd.Math.sqrt(dx * dx + dy * dy);
|
|
$setColor_0(g, currentColor_0);
|
|
if (pos == 100 || pos == -100) {
|
|
g.context.save();
|
|
g.savedFontSize = g.currentFontSize;
|
|
ctx = g.context;
|
|
ctx.lineWidth = 4;
|
|
ctx.globalAlpha = 0.5;
|
|
ctx.beginPath();
|
|
$moveTo(ctx, pa.x_0, pa.y_0);
|
|
$lineTo(ctx, pb.x_0, pb.y_0);
|
|
ctx.stroke();
|
|
g.context.restore();
|
|
g.currentFontSize = g.savedFontSize;
|
|
pos = Math.random() * 16;
|
|
}
|
|
pos %= 16;
|
|
pos < 0 && (pos += 16);
|
|
for (di = pos; di < dn; di += 16) {
|
|
x0 = round_int(pa.x_0 + di * dx / dn);
|
|
y0 = round_int(pa.y_0 + di * dy / dn);
|
|
$fillRect(g.context, x0 - 2, y0 - 2, 4, 4);
|
|
}
|
|
}
|
|
|
|
function $drawHandles(this$static, g, c){
|
|
if (this$static.getNumHandles() == 0)
|
|
return;
|
|
$setColor_0(g, c);
|
|
this$static.lastHandleGrabbed == -1?$fillRect_0(g, this$static.x_0 - 3, this$static.y_0 - 3, 7, 7):this$static.lastHandleGrabbed == 0 && $fillRect_0(g, this$static.x_0 - 4, this$static.y_0 - 4, 9, 9);
|
|
this$static.getNumHandles() > 1 && (this$static.lastHandleGrabbed == -1?$fillRect_0(g, this$static.x2 - 3, this$static.y2 - 3, 7, 7):this$static.lastHandleGrabbed == 1 && $fillRect_0(g, this$static.x2 - 4, this$static.y2 - 4, 9, 9));
|
|
}
|
|
|
|
function $drawLabeledNode(this$static, g, str, pt1, pt2){
|
|
var h, lineOver, w, x_0, y_0, ya;
|
|
g.context.save();
|
|
g.savedFontSize = g.currentFontSize;
|
|
$setFont_0(g, valueFont);
|
|
lineOver = false;
|
|
if ($equals_1(str.substr(0, 1), '/')) {
|
|
lineOver = true;
|
|
str = str.substr(1);
|
|
}
|
|
w = round_int($measureText(g.context, str).width);
|
|
h = g.currentFontSize;
|
|
g.context.textBaseline = 'middle';
|
|
x_0 = pt2.x_0;
|
|
y_0 = pt2.y_0;
|
|
if (pt1.y_0 != pt2.y_0) {
|
|
x_0 -= w / 2 | 0;
|
|
y_0 += sign_0(pt2.y_0 - pt1.y_0) * h;
|
|
}
|
|
else {
|
|
pt2.x_0 > pt1.x_0?(x_0 += 4):(x_0 -= 4 + w);
|
|
}
|
|
$fillText(g.context, str, x_0, y_0);
|
|
$adjustBbox(this$static, x_0, y_0 - (h / 2 | 0), x_0 + w, y_0 + (h / 2 | 0));
|
|
g.context.restore();
|
|
g.currentFontSize = g.savedFontSize;
|
|
if (lineOver) {
|
|
ya = y_0 - (h / 2 | 0) - 1;
|
|
$drawLine(g, x_0, ya, x_0 + w, ya);
|
|
}
|
|
}
|
|
|
|
function $drawPosts(this$static, g){
|
|
var i, p;
|
|
if (app_0.mouse.dragElm != this$static && !(mouseElmRef == this$static || this$static.selected_0 || $containsKey(app_0.mouse.scopePlotRoles, this$static) || instanceOf(mouseElmRef, 21) && $getElm_0(mouseElmRef.elmScope) == this$static || $isOnHighlightedNet(this$static)))
|
|
return;
|
|
if (app_0.mouse.mouseMode == 2 || app_0.mouse.mouseMode == 3)
|
|
return;
|
|
for (i = 0; i != this$static.getPostCount_0(); i++) {
|
|
p = this$static.getPost(i);
|
|
$setColor_0(g, whiteColor);
|
|
$fillOval(g, p.x_0 - 3, p.y_0 - 3, 7);
|
|
}
|
|
$drawScopeTerminalLabels(this$static, g);
|
|
}
|
|
|
|
function $drawScopeTerminalLabels(this$static, g){
|
|
var mp, pp, swap;
|
|
if (this$static.getPostCount_0() != 2)
|
|
return;
|
|
if (!$containsKey(app_0.mouse.scopePlotRoles, this$static))
|
|
return;
|
|
if (this$static.dn == 0)
|
|
return;
|
|
$setColor_0(g, selectColor_0);
|
|
$setFont_0(g, unitsFont);
|
|
g.context.save();
|
|
g.savedFontSize = g.currentFontSize;
|
|
g.context.textBaseline = 'middle';
|
|
g.context.textAlign = 'center';
|
|
swap = instanceOf(this$static, 56);
|
|
pp = $interpPoint_0(this$static.point1, this$static.point2, 10 / this$static.dn, 8);
|
|
$drawString(g, swap?'\u2212':'+', pp.x_0, pp.y_0);
|
|
mp = $interpPoint_0(this$static.point1, this$static.point2, 1 - 10 / this$static.dn, 8);
|
|
$drawString(g, swap?'+':'\u2212', mp.x_0, mp.y_0);
|
|
g.context.restore();
|
|
g.currentFontSize = g.savedFontSize;
|
|
}
|
|
|
|
function $drawValues(this$static, g, s, hs){
|
|
var dpx, dpy, w, xc, xx, ya, yc;
|
|
if (s == null)
|
|
return;
|
|
g.context.save();
|
|
g.savedFontSize = g.currentFontSize;
|
|
$setFont_0(g, valueFont);
|
|
w = round_int($measureText(g.context, s).width);
|
|
$setColor_0(g, whiteColor);
|
|
ya = g.currentFontSize / 2 | 0;
|
|
if (instanceOf(this$static, 47) || instanceOf(this$static, 272)) {
|
|
xc = this$static.x2;
|
|
yc = this$static.y2;
|
|
}
|
|
else {
|
|
xc = (this$static.x2 + this$static.x_0) / 2 | 0;
|
|
yc = (this$static.y2 + this$static.y_0) / 2 | 0;
|
|
}
|
|
dpx = round_int(this$static.dpx1 * hs);
|
|
dpy = round_int(this$static.dpy1 * hs);
|
|
if (dpx == 0)
|
|
$fillText(g.context, s, xc - (w / 2 | 0), yc - (dpy < 0?-dpy:dpy) - 2);
|
|
else {
|
|
xx = xc + (dpx < 0?-dpx:dpx) + 2;
|
|
(instanceOf(this$static, 56) || this$static.x_0 < this$static.x2 && this$static.y_0 > this$static.y2) && (xx = xc - (w + (dpx < 0?-dpx:dpx) + 2));
|
|
$fillText(g.context, s, xx, yc + dpy + ya);
|
|
}
|
|
g.context.restore();
|
|
g.currentFontSize = g.savedFontSize;
|
|
}
|
|
|
|
function $flipPosts(this$static){
|
|
var oldx, oldy;
|
|
oldx = this$static.x_0;
|
|
oldy = this$static.y_0;
|
|
this$static.x_0 = this$static.x2;
|
|
this$static.y_0 = this$static.y2;
|
|
this$static.x2 = oldx;
|
|
this$static.y2 = oldy;
|
|
this$static.setPoints();
|
|
}
|
|
|
|
function $flipX(this$static, center2){
|
|
this$static.x_0 = center2 - this$static.x_0;
|
|
this$static.x2 = center2 - this$static.x2;
|
|
this$static.initBoundingBox();
|
|
this$static.setPoints();
|
|
}
|
|
|
|
function $flipXY(this$static, xmy){
|
|
var nx, nx2, ny, ny2;
|
|
nx = this$static.y_0 + xmy;
|
|
ny = this$static.x_0 - xmy;
|
|
nx2 = this$static.y2 + xmy;
|
|
ny2 = this$static.x2 - xmy;
|
|
this$static.x_0 = nx;
|
|
this$static.y_0 = ny;
|
|
this$static.x2 = nx2;
|
|
this$static.y2 = ny2;
|
|
this$static.initBoundingBox();
|
|
this$static.setPoints();
|
|
}
|
|
|
|
function $flipY(this$static, center2){
|
|
this$static.y_0 = center2 - this$static.y_0;
|
|
this$static.y2 = center2 - this$static.y2;
|
|
this$static.initBoundingBox();
|
|
this$static.setPoints();
|
|
}
|
|
|
|
function $getBasicInfo(this$static, arr){
|
|
arr[1] = 'I = ' + getUnitText($wnd.Math.abs(this$static.getCurrent_0()), 'A', false);
|
|
arr[2] = 'Vd = ' + getUnitText($wnd.Math.abs(this$static.getVoltageDiff_0()), 'V', false);
|
|
return 3;
|
|
}
|
|
|
|
function $getHandleGrabbedClose(this$static, xtest, ytest, minSize){
|
|
this$static.lastHandleGrabbed = -1;
|
|
distanceSq(this$static.x_0, this$static.y_0, this$static.x2, this$static.y2) >= minSize && (distanceSq(this$static.x_0, this$static.y_0, xtest, ytest) <= 25?(this$static.lastHandleGrabbed = 0):this$static.getNumHandles() > 1 && distanceSq(this$static.x2, this$static.y2, xtest, ytest) <= 25 && (this$static.lastHandleGrabbed = 1));
|
|
return this$static.lastHandleGrabbed;
|
|
}
|
|
|
|
function $getLeadPost(this$static, px, py){
|
|
if (!!this$static.lead1 && this$static.lead1 != this$static.point1 && pointOnSegmentInterior(this$static.point1.x_0, this$static.point1.y_0, this$static.lead1.x_0, this$static.lead1.y_0, px, py))
|
|
return 0;
|
|
if (!!this$static.lead2 && this$static.lead2 != this$static.point2 && pointOnSegmentInterior(this$static.lead2.x_0, this$static.lead2.y_0, this$static.point2.x_0, this$static.point2.y_0, px, py))
|
|
return 1;
|
|
if (!this$static.lead1 && this$static.getPostCount_0() == 1 && pointOnSegmentInterior(this$static.point1.x_0, this$static.point1.y_0, this$static.point2.x_0, this$static.point2.y_0, px, py))
|
|
return 0;
|
|
return -1;
|
|
}
|
|
|
|
function $getNode(this$static, n){
|
|
return this$static.nodes[n];
|
|
}
|
|
|
|
function $getNodeAtPoint(this$static, pt){
|
|
var i;
|
|
for (i = 0; i != this$static.getPostCount_0(); i++) {
|
|
if ($equals(this$static.getPost(i), pt))
|
|
return i;
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
function $getNodeCount(this$static){
|
|
return this$static.getPostCount_0() + this$static.getInternalNodeCount();
|
|
}
|
|
|
|
function $getPost(this$static, n){
|
|
return n == 0?this$static.point1:n == 1?this$static.point2:null;
|
|
}
|
|
|
|
function $getPostVoltage(this$static, x_0){
|
|
return this$static.volts[x_0];
|
|
}
|
|
|
|
function $getSchmittPolygon(this$static, gsize, ctr){
|
|
var h1, h2, hs, len, pts;
|
|
pts = $newPointArray(6);
|
|
hs = 3 * gsize;
|
|
h1 = 3 * gsize;
|
|
h2 = h1 * 2;
|
|
len = distance(this$static.lead1, this$static.lead2);
|
|
pts[0] = $interpPoint_0(this$static.lead1, this$static.lead2, ctr - h2 / len, hs);
|
|
pts[1] = $interpPoint_0(this$static.lead1, this$static.lead2, ctr + h1 / len, hs);
|
|
pts[2] = $interpPoint_0(this$static.lead1, this$static.lead2, ctr + h1 / len, -hs);
|
|
pts[3] = $interpPoint_0(this$static.lead1, this$static.lead2, ctr + h2 / len, -hs);
|
|
pts[4] = $interpPoint_0(this$static.lead1, this$static.lead2, ctr - h1 / len, -hs);
|
|
pts[5] = $interpPoint_0(this$static.lead1, this$static.lead2, ctr - h1 / len, hs);
|
|
return $createPolygon_1(pts);
|
|
}
|
|
|
|
function $getVoltageColor(this$static, volts){
|
|
var c;
|
|
if (mouseElmRef == this$static || this$static.selected_0 || $containsKey(app_0.mouse.scopePlotRoles, this$static) || instanceOf(mouseElmRef, 21) && $getElm_0(mouseElmRef.elmScope) == this$static || $isOnHighlightedNet(this$static)) {
|
|
return selectColor_0;
|
|
}
|
|
if (!app_0.menus.voltsCheckItem.on) {
|
|
return whiteColor;
|
|
}
|
|
isNaN(volts) && (volts = 0);
|
|
c = round_int((volts + voltageRange) * (colorScaleCount - 1) / (voltageRange * 2));
|
|
c < 0 && (c = 0);
|
|
c >= colorScaleCount && (c = colorScaleCount - 1);
|
|
return colorScale[c];
|
|
}
|
|
|
|
function $interpPoint(a, b, f){
|
|
var p;
|
|
p = new Point_1;
|
|
p.x_0 = round_int($wnd.Math.floor(a.x_0 * (1 - f) + b.x_0 * f + $intern_77));
|
|
p.y_0 = round_int($wnd.Math.floor(a.y_0 * (1 - f) + b.y_0 * f + $intern_77));
|
|
return p;
|
|
}
|
|
|
|
function $interpPoint_0(a, b, f, g){
|
|
var p;
|
|
p = new Point_1;
|
|
$interpPoint_2(a, b, p, f, g);
|
|
return p;
|
|
}
|
|
|
|
function $interpPoint_1(a, b, c, f){
|
|
c.x_0 = round_int($wnd.Math.floor(a.x_0 * (1 - f) + b.x_0 * f + $intern_77));
|
|
c.y_0 = round_int($wnd.Math.floor(a.y_0 * (1 - f) + b.y_0 * f + $intern_77));
|
|
}
|
|
|
|
function $interpPoint_2(a, b, c, f, g){
|
|
var gx, gy;
|
|
gx = b.y_0 - a.y_0;
|
|
gy = a.x_0 - b.x_0;
|
|
g /= $wnd.Math.sqrt(gx * gx + gy * gy);
|
|
c.x_0 = round_int($wnd.Math.floor(a.x_0 * (1 - f) + b.x_0 * f + g * gx + $intern_77));
|
|
c.y_0 = round_int($wnd.Math.floor(a.y_0 * (1 - f) + b.y_0 * f + g * gy + $intern_77));
|
|
}
|
|
|
|
function $interpPoint2(a, b, c, d, f, g){
|
|
var gx, gy;
|
|
gx = b.y_0 - a.y_0;
|
|
gy = a.x_0 - b.x_0;
|
|
g /= $wnd.Math.sqrt(gx * gx + gy * gy);
|
|
c.x_0 = round_int($wnd.Math.floor(a.x_0 * (1 - f) + b.x_0 * f + g * gx + $intern_77));
|
|
c.y_0 = round_int($wnd.Math.floor(a.y_0 * (1 - f) + b.y_0 * f + g * gy + $intern_77));
|
|
d.x_0 = round_int($wnd.Math.floor(a.x_0 * (1 - f) + b.x_0 * f - g * gx + $intern_77));
|
|
d.y_0 = round_int($wnd.Math.floor(a.y_0 * (1 - f) + b.y_0 * f - g * gy + $intern_77));
|
|
}
|
|
|
|
function $isMouseElm(this$static){
|
|
return mouseElmRef == this$static;
|
|
}
|
|
|
|
function $isOnHighlightedNet(this$static){
|
|
var i;
|
|
if (!app_0.mouse.highlightedNode)
|
|
return false;
|
|
for (i = 0; i != this$static.getPostCount_0(); i++)
|
|
if (this$static.nodes[i] == app_0.mouse.highlightedNode)
|
|
return true;
|
|
return false;
|
|
}
|
|
|
|
function $lineDistanceSq(xa, ya, xb, yb, gx, gy){
|
|
var dbot, dtop;
|
|
dtop = (yb - ya) * gx - (xb - xa) * gy + xb * ya - yb * xa;
|
|
dbot = (yb - ya) * (yb - ya) + (xb - xa) * (xb - xa);
|
|
return dtop * dtop / dbot | 0;
|
|
}
|
|
|
|
function $move(this$static, dx, dy){
|
|
this$static.x_0 += dx;
|
|
this$static.y_0 += dy;
|
|
this$static.x2 += dx;
|
|
this$static.y2 += dy;
|
|
$translate_0(this$static.boundingBox, dx, dy);
|
|
this$static.setPoints();
|
|
}
|
|
|
|
function $movePoint(this$static, n, dx, dy){
|
|
var oldx, oldx2, oldy, oldy2;
|
|
oldx = this$static.x_0;
|
|
oldy = this$static.y_0;
|
|
oldx2 = this$static.x2;
|
|
oldy2 = this$static.y2;
|
|
this$static.noDiagonal && (this$static.x_0 == this$static.x2?(dx = 0):(dy = 0));
|
|
if (n == 0) {
|
|
this$static.x_0 += dx;
|
|
this$static.y_0 += dy;
|
|
}
|
|
else {
|
|
this$static.x2 += dx;
|
|
this$static.y2 += dy;
|
|
}
|
|
if (this$static.x_0 == this$static.x2 && this$static.y_0 == this$static.y2) {
|
|
this$static.x_0 = oldx;
|
|
this$static.y_0 = oldy;
|
|
this$static.x2 = oldx2;
|
|
this$static.y2 = oldy2;
|
|
}
|
|
this$static.setPoints();
|
|
}
|
|
|
|
function $needsHighlight(this$static){
|
|
return mouseElmRef == this$static || this$static.selected_0 || $containsKey(app_0.mouse.scopePlotRoles, this$static) || instanceOf(mouseElmRef, 21) && $getElm_0(mouseElmRef.elmScope) == this$static || $isOnHighlightedNet(this$static);
|
|
}
|
|
|
|
function $newPointArray(n){
|
|
var a;
|
|
a = initUnidimensionalArray(Lcom_lushprojects_circuitjs1_client_Point_2_classLit, $intern_78, 14, n, 0, 1);
|
|
while (n > 0)
|
|
a[--n] = new Point_1;
|
|
return a;
|
|
}
|
|
|
|
function $reset(this$static){
|
|
var i;
|
|
for (i = 0; i != this$static.getPostCount_0() + this$static.getInternalNodeCount(); i++)
|
|
this$static.volts[i] = 0;
|
|
this$static.curcount_0 = 0;
|
|
}
|
|
|
|
function $setBbox(this$static, x1, y1, x2, y2){
|
|
var q;
|
|
if (x1 > x2) {
|
|
q = x1;
|
|
x1 = x2;
|
|
x2 = q;
|
|
}
|
|
if (y1 > y2) {
|
|
q = y1;
|
|
y1 = y2;
|
|
y2 = q;
|
|
}
|
|
$setBounds(this$static.boundingBox, x1, y1, x2 - x1 + 1, y2 - y1 + 1);
|
|
}
|
|
|
|
function $setBbox_0(this$static, p1, p2, w){
|
|
var dpx, dpy;
|
|
$setBbox(this$static, p1.x_0, p1.y_0, p2.x_0, p2.y_0);
|
|
dpx = round_int(this$static.dpx1 * w);
|
|
dpy = round_int(this$static.dpy1 * w);
|
|
$adjustBbox(this$static, p1.x_0 + dpx, p1.y_0 + dpy, p1.x_0 - dpx, p1.y_0 - dpy);
|
|
}
|
|
|
|
function $setPoints(this$static){
|
|
this$static.dx = this$static.x2 - this$static.x_0;
|
|
this$static.dy = this$static.y2 - this$static.y_0;
|
|
this$static.dn = $wnd.Math.sqrt(this$static.dx * this$static.dx + this$static.dy * this$static.dy);
|
|
this$static.dpx1 = this$static.dy / this$static.dn;
|
|
this$static.dpy1 = -this$static.dx / this$static.dn;
|
|
this$static.dsign = this$static.dy == 0?sign_0(this$static.dx):sign_0(this$static.dy);
|
|
this$static.point1 = new Point_2(this$static.x_0, this$static.y_0);
|
|
this$static.point2 = new Point_2(this$static.x2, this$static.y2);
|
|
}
|
|
|
|
function $setPosition_0(this$static, x_, y_, x2_, y2_){
|
|
this$static.x_0 = x_;
|
|
this$static.y_0 = y_;
|
|
this$static.x2 = x2_;
|
|
this$static.y2 = y2_;
|
|
this$static.initBoundingBox();
|
|
this$static.setPoints();
|
|
}
|
|
|
|
function $setPositionFromXml(this$static, elem){
|
|
var x_0, xs;
|
|
x_0 = getAttribute(elem.jsObject, 'x');
|
|
if (x_0 == null)
|
|
return;
|
|
xs = $split_1(x_0, ' ', 0);
|
|
$setPosition_0(this$static, __parseAndValidateInt(xs[0], 10), __parseAndValidateInt(xs[1], 10), __parseAndValidateInt(xs[2], 10), __parseAndValidateInt(xs[3], 10));
|
|
}
|
|
|
|
function $setPowerColor(this$static, g, w0){
|
|
var i;
|
|
if (!app_0.menus.powerCheckItem.on)
|
|
return;
|
|
if (mouseElmRef == this$static || this$static.selected_0 || $containsKey(app_0.mouse.scopePlotRoles, this$static) || instanceOf(mouseElmRef, 21) && $getElm_0(mouseElmRef.elmScope) == this$static || $isOnHighlightedNet(this$static)) {
|
|
$setColor_0(g, selectColor_0);
|
|
return;
|
|
}
|
|
w0 *= powerMult;
|
|
i = round_int((colorScaleCount / 2 | 0) + (colorScaleCount / 2 | 0) * -w0);
|
|
i < 0 && (i = 0);
|
|
i >= colorScaleCount && (i = colorScaleCount - 1);
|
|
$setColor_0(g, colorScale[i]);
|
|
}
|
|
|
|
function $setPowerColor_0(this$static, g){
|
|
if (!app_0.menus.powerCheckItem.on)
|
|
return;
|
|
$setPowerColor(this$static, g, this$static.getPower());
|
|
}
|
|
|
|
function $setSelected(this$static, x_0){
|
|
this$static.selected_0 = x_0;
|
|
}
|
|
|
|
function $setVoltageColor(this$static, g, volts){
|
|
$setColor_0(g, $getVoltageColor(this$static, volts));
|
|
}
|
|
|
|
function $snapGrid(z_0){
|
|
return $snapGrid_0(app_0, z_0);
|
|
}
|
|
|
|
function $swapDragEndpoints(this$static){
|
|
var tx, ty;
|
|
tx = this$static.x_0;
|
|
ty = this$static.y_0;
|
|
this$static.x_0 = this$static.x2;
|
|
this$static.y_0 = this$static.y2;
|
|
this$static.x2 = tx;
|
|
this$static.y2 = ty;
|
|
this$static.setPoints();
|
|
}
|
|
|
|
function $updateDotCount(cur, cc){
|
|
var cadd;
|
|
if (!app_0.ui.app.simRunning)
|
|
return cc;
|
|
cadd = cur * currentMult_0;
|
|
if (cadd > 6 || cadd < -6)
|
|
return 100;
|
|
cc == 100 && (cc = 0);
|
|
cadd %= 8;
|
|
return cc + cadd;
|
|
}
|
|
|
|
function $validateRailNode(this$static, n){
|
|
var fpi;
|
|
fpi = new FindPathInfo(2, this$static, this$static.nodes[n], sim_0);
|
|
if ($findPath(fpi, ground)) {
|
|
$stop(sim_0, 'Path to ground with no resistance!', this$static);
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
function CircuitElm(xx, yy){
|
|
$$init_0(this);
|
|
this.x_0 = this.x2 = xx;
|
|
this.y_0 = this.y2 = yy;
|
|
this.flags = this.getDefaultFlags();
|
|
$allocNodes(this);
|
|
this.initBoundingBox();
|
|
}
|
|
|
|
function CircuitElm_0(xa, ya, xb, yb, f){
|
|
$$init_0(this);
|
|
this.x_0 = xa;
|
|
this.y_0 = ya;
|
|
this.x2 = xb;
|
|
this.y2 = yb;
|
|
this.flags = f;
|
|
$allocNodes(this);
|
|
this.initBoundingBox();
|
|
}
|
|
|
|
function abs_0(x_0){
|
|
return x_0 < 0?-x_0:x_0;
|
|
}
|
|
|
|
function distance(p1, p2){
|
|
var x_0, y_0;
|
|
x_0 = p1.x_0 - p2.x_0;
|
|
y_0 = p1.y_0 - p2.y_0;
|
|
return $wnd.Math.sqrt(x_0 * x_0 + y_0 * y_0);
|
|
}
|
|
|
|
function drawPolygon(g, p){
|
|
$drawPolyline(g, p.xpoints, p.ypoints, p.npoints);
|
|
}
|
|
|
|
function drawPost(g, pt){
|
|
$setColor_0(g, whiteColor);
|
|
$fillOval(g, pt.x_0 - 3, pt.y_0 - 3, 7);
|
|
}
|
|
|
|
function drawThickCircle(g, cx, cy, ri){
|
|
g.context.lineWidth = 3;
|
|
g.context.beginPath();
|
|
$arc(g.context, cx, cy, ri * 0.98, 0, $intern_2);
|
|
g.context.stroke();
|
|
g.context.lineWidth = 1;
|
|
}
|
|
|
|
function drawThickLine(g, x_0, y_0, x2, y2){
|
|
g.context.lineWidth = 3;
|
|
$drawLine(g, x_0, y_0, x2, y2);
|
|
g.context.lineWidth = 1;
|
|
}
|
|
|
|
function drawThickLine_0(g, pa, pb, width_0){
|
|
$setLineWidth(g.context, width_0);
|
|
$drawLine(g, pa.x_0, pa.y_0, pb.x_0, pb.y_0);
|
|
g.context.lineWidth = 1;
|
|
}
|
|
|
|
function drawThickPolygon(g, p){
|
|
drawThickPolygon_0(g, p.xpoints, p.ypoints, p.npoints);
|
|
}
|
|
|
|
function drawThickPolygon_0(g, xs, ys, c){
|
|
g.context.lineWidth = 3;
|
|
$drawPolyline(g, xs, ys, c);
|
|
g.context.lineWidth = 1;
|
|
}
|
|
|
|
function getTimeText(v){
|
|
var h, m;
|
|
if (v >= 60) {
|
|
h = $wnd.Math.floor(v / 3600);
|
|
v -= 3600 * h;
|
|
m = $wnd.Math.floor(v / 60);
|
|
v -= 60 * m;
|
|
if (h == 0)
|
|
return m + ':' + (v >= 10?'':'0') + $format_0(showFormat, v);
|
|
return h + ':' + (m >= 10?'':'0') + m + ':' + (v >= 10?'':'0') + $format_0(showFormat, v);
|
|
}
|
|
return getUnitText(v, 's', false);
|
|
}
|
|
|
|
function getUnitText(v, u, sf){
|
|
var sp, va;
|
|
sp = sf?'':' ';
|
|
va = $wnd.Math.abs(v);
|
|
if (va < $intern_79)
|
|
return '0' + sp + u;
|
|
if (va < $intern_80)
|
|
return $format_0(sf?shortFormat:showFormat, v * $intern_81) + sp + 'p' + u;
|
|
if (va < $intern_82)
|
|
return $format_0(sf?shortFormat:showFormat, v * $intern_32) + sp + 'n' + u;
|
|
if (va < $intern_83)
|
|
return $format_0(sf?shortFormat:showFormat, v * $intern_84) + sp + muString + u;
|
|
if (va < 1)
|
|
return $format_0(sf?shortFormat:showFormat, v * $intern_22) + sp + 'm' + u;
|
|
if (va < $intern_22)
|
|
return $format_0(sf?shortFormat:showFormat, v) + sp + u;
|
|
if (va < $intern_84)
|
|
return $format_0(sf?shortFormat:showFormat, v * $intern_83) + sp + 'k' + u;
|
|
if (va < $intern_32)
|
|
return $format_0(sf?shortFormat:showFormat, v * $intern_82) + sp + 'M' + u;
|
|
if (va < $intern_81)
|
|
return $format_0(sf?shortFormat:showFormat, v * $intern_80) + sp + 'G' + u;
|
|
return $format_0(($clinit_NumberFormat() , new NumberFormat_0('#.##E000', $getDefaultNative())), v) + sp + u;
|
|
}
|
|
|
|
function getUnitTextWithScale(val, utext, scale, fixed_0){
|
|
var nf;
|
|
if ($wnd.Math.abs(val) > $intern_81)
|
|
return getUnitText(val, utext, false);
|
|
nf = fixed_0?fixedFormat:showFormat;
|
|
if (scale == 1)
|
|
return $format_0(nf, val) + ' ' + utext;
|
|
if (scale == 2)
|
|
return $format_0(nf, $intern_22 * val) + ' m' + utext;
|
|
if (scale == 3)
|
|
return $format_0(nf, $intern_84 * val) + ' ' + muString + utext;
|
|
return getUnitText(val, utext, false);
|
|
}
|
|
|
|
function initClass(app_, sim_){
|
|
var s1, s2, sf, stor;
|
|
sim_0 = sim_;
|
|
app_0 = app_;
|
|
colorScale = initUnidimensionalArray(Lcom_lushprojects_circuitjs1_client_Color_2_classLit, $intern_3, 43, colorScaleCount, 0, 1);
|
|
ps1 = new Point_1;
|
|
ps2 = new Point_1;
|
|
stor = (!localStorage_0 && ($clinit_Storage$StorageSupportDetector() , localStorageSupported) && (localStorage_0 = new Storage_0('localStorage')) , localStorage_0);
|
|
decimalDigits = 3;
|
|
shortDecimalDigits = 1;
|
|
if (stor) {
|
|
s1 = $getItem_0(stor.storage, 'decimalDigits');
|
|
s2 = $getItem_0(stor.storage, 'decimalDigitsShort');
|
|
s1 != null && (decimalDigits = __parseAndValidateInt(s1, 10));
|
|
s2 != null && (shortDecimalDigits = __parseAndValidateInt(s2, 10));
|
|
sf = $getItem_0(stor.storage, 'valueFontSize');
|
|
sf != null && (valueFontSize = __parseAndValidateInt(sf, 10));
|
|
}
|
|
setDecimalDigits(decimalDigits, false, false);
|
|
setDecimalDigits(shortDecimalDigits, true, false);
|
|
unitsFont = new Font('SansSerif', 0, 12);
|
|
valueFont = new Font('SansSerif', 0, valueFontSize);
|
|
}
|
|
|
|
function max_1(a, b){
|
|
return a > b?a:b;
|
|
}
|
|
|
|
function min_1(a, b){
|
|
return a < b?a:b;
|
|
}
|
|
|
|
function pointOnSegmentInterior(ax, ay, bx, by, px, py){
|
|
var maxx, maxy, minx, miny;
|
|
if (px == ax && py == ay || px == bx && py == by)
|
|
return false;
|
|
if (ax == bx && px == ax) {
|
|
miny = $wnd.Math.min(ay, by);
|
|
maxy = $wnd.Math.max(ay, by);
|
|
return py > miny && py < maxy;
|
|
}
|
|
else if (ay == by && py == ay) {
|
|
minx = $wnd.Math.min(ax, bx);
|
|
maxx = $wnd.Math.max(ax, bx);
|
|
return px > minx && px < maxx;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
function setColorScale(){
|
|
var i, v;
|
|
!positiveColor_0 && (positiveColor_0 = ($clinit_Color() , green));
|
|
!negativeColor_0 && (negativeColor_0 = ($clinit_Color() , red));
|
|
!neutralColor_0 && (neutralColor_0 = ($clinit_Color() , gray));
|
|
for (i = 0; i != colorScaleCount; i++) {
|
|
v = i * 2 / colorScaleCount - 1;
|
|
v < 0?(colorScale[i] = new Color_0(neutralColor_0, negativeColor_0, -v)):(colorScale[i] = new Color_0(neutralColor_0, positiveColor_0, v));
|
|
}
|
|
}
|
|
|
|
function setDecimalDigits(num, sf, save){
|
|
var ct, nf, s, stor;
|
|
sf?(shortDecimalDigits = num):(decimalDigits = num);
|
|
s = '####.';
|
|
ct = num;
|
|
for (; ct > 0; ct--)
|
|
s += '#';
|
|
nf = ($clinit_NumberFormat() , new NumberFormat_0(s, $getDefaultNative()));
|
|
sf?(shortFormat = nf):(showFormat = nf);
|
|
if (save) {
|
|
stor = (!localStorage_0 && ($clinit_Storage$StorageSupportDetector() , localStorageSupported) && (localStorage_0 = new Storage_0('localStorage')) , localStorage_0);
|
|
!!stor && $setItem_0(stor.storage, sf?'decimalDigitsShort':'decimalDigits', '' + num);
|
|
}
|
|
if (!sf) {
|
|
s = '####.';
|
|
ct = num;
|
|
for (; ct > 0; ct--)
|
|
s += '0';
|
|
fixedFormat = new NumberFormat_0(s, $getDefaultNative());
|
|
}
|
|
}
|
|
|
|
function setValueFontSize(size_0){
|
|
var stor;
|
|
valueFontSize = size_0;
|
|
valueFont = new Font('SansSerif', 0, valueFontSize);
|
|
stor = (!localStorage_0 && ($clinit_Storage$StorageSupportDetector() , localStorageSupported) && (localStorage_0 = new Storage_0('localStorage')) , localStorage_0);
|
|
!!stor && $setItem(stor, 'valueFontSize', '' + valueFontSize);
|
|
}
|
|
|
|
function sign_0(x_0){
|
|
return x_0 < 0?-1:x_0 == 0?0:1;
|
|
}
|
|
|
|
defineClass(8, 1, $intern_85);
|
|
_.addRoutingObstacle = function addRoutingObstacle(router){
|
|
if (this.x_0 == this.x2 || this.y_0 == this.y2) {
|
|
$addWire(router, this.x_0, this.y_0, this.x2, this.y2);
|
|
!!this.lead1 && !!this.lead2 && $addObstacle(router, this.lead1.x_0, this.lead1.y_0, this.lead2.x_0, this.lead2.y_0);
|
|
}
|
|
}
|
|
;
|
|
_.calculateCurrent = function calculateCurrent(){
|
|
}
|
|
;
|
|
_.canFlipX = function canFlipX_0(){
|
|
return true;
|
|
}
|
|
;
|
|
_.canFlipXY = function canFlipXY_0(){
|
|
return this.canFlipX() || this.canFlipY();
|
|
}
|
|
;
|
|
_.canFlipY = function canFlipY_0(){
|
|
return true;
|
|
}
|
|
;
|
|
_.canShowValueInScope = function canShowValueInScope(v){
|
|
return false;
|
|
}
|
|
;
|
|
_.canViewInScope = function canViewInScope(){
|
|
return this.getPostCount_0() <= 2;
|
|
}
|
|
;
|
|
_.creationFailed = function creationFailed(){
|
|
return this.x_0 == this.x2 && this.y_0 == this.y2;
|
|
}
|
|
;
|
|
_.delete_0 = function delete_0(){
|
|
mouseElmRef == this && (mouseElmRef = null);
|
|
$deleteSliders(app_0, this);
|
|
}
|
|
;
|
|
_.doDots = function doDots(g){
|
|
this.curcount_0 = $updateDotCount(this.current_0, this.curcount_0);
|
|
app_0.mouse.dragElm == this || $drawDots(g, this.point1, this.point2, this.curcount_0);
|
|
}
|
|
;
|
|
_.doStep = function doStep(){
|
|
}
|
|
;
|
|
_.drag = function drag(xx, yy){
|
|
$drag(this, xx, yy);
|
|
}
|
|
;
|
|
_.dragPlace = function dragPlace(xa, ya, vertical){
|
|
$dragPlace(this, xa, ya, vertical);
|
|
}
|
|
;
|
|
_.draggingDone = function draggingDone(){
|
|
}
|
|
;
|
|
_.draw = function draw(g){
|
|
}
|
|
;
|
|
_.dumpXml = function dumpXml(doc, elem){
|
|
dumpAttr_1(elem, 'x', this.x_0 + ' ' + this.y_0 + ' ' + this.x2 + ' ' + this.y2);
|
|
dumpAttr_0(elem, 'f', this.flags);
|
|
}
|
|
;
|
|
_.dumpXmlModel = function dumpXmlModel(doc){
|
|
}
|
|
;
|
|
_.dumpXmlState = function dumpXmlState(doc, elem){
|
|
}
|
|
;
|
|
_.flipX = function flipX_0(center2, count){
|
|
$flipX(this, center2);
|
|
}
|
|
;
|
|
_.flipXY = function flipXY(xmy, count){
|
|
$flipXY(this, xmy);
|
|
}
|
|
;
|
|
_.flipY = function flipY_0(center2, count){
|
|
$flipY(this, center2);
|
|
}
|
|
;
|
|
_.getBusWidth = function getBusWidth(){
|
|
return 1;
|
|
}
|
|
;
|
|
_.getChildElmList = function getChildElmList(){
|
|
return null;
|
|
}
|
|
;
|
|
_.getClassName = function getClassName(){
|
|
return $replace_0($getName(this.___clazz), 'com.lushprojects.circuitjs1.client.', '');
|
|
}
|
|
;
|
|
_.getConnectedPost = function getConnectedPost(){
|
|
return this.point2;
|
|
}
|
|
;
|
|
_.getConnectedPost_0 = function getConnectedPost_0(n){
|
|
return this.getConnectedPost();
|
|
}
|
|
;
|
|
_.getConnection = function getConnection(n1, n2){
|
|
return true;
|
|
}
|
|
;
|
|
_.getCurrent_0 = function getCurrent(){
|
|
return this.current_0;
|
|
}
|
|
;
|
|
_.getCurrentIntoNode = function getCurrentIntoNode(n){
|
|
return n == 0 && this.getPostCount_0() == 2?-this.current_0:this.current_0;
|
|
}
|
|
;
|
|
_.getDefaultFlags = function getDefaultFlags(){
|
|
return 0;
|
|
}
|
|
;
|
|
_.getDialogTitle = function getDialogTitle(){
|
|
var name_0;
|
|
name_0 = this.getElmType();
|
|
if (name_0 == null)
|
|
return 'Edit Component';
|
|
return 'Edit ' + name_0.substr(0, 1).toUpperCase() + name_0.substr(1);
|
|
}
|
|
;
|
|
_.getDragLength = function getDragLength(){
|
|
return 64;
|
|
}
|
|
;
|
|
_.getDragVertical = function getDragVertical(requestedVertical){
|
|
return requestedVertical;
|
|
}
|
|
;
|
|
_.getDumpClass = function getDumpClass(){
|
|
return this.___clazz;
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType(){
|
|
return 0;
|
|
}
|
|
;
|
|
_.getEditInfo = function getEditInfo(n){
|
|
return null;
|
|
}
|
|
;
|
|
_.getElmType = function getElmType(){
|
|
var info;
|
|
info = initUnidimensionalArray(Ljava_lang_String_2_classLit, $intern_23, 2, 10, 6, 1);
|
|
this.getInfo_0(info);
|
|
return info[0];
|
|
}
|
|
;
|
|
_.getInfo_0 = function getInfo(arr){
|
|
}
|
|
;
|
|
_.getInfoJS = function getInfoJS(){
|
|
var arr, i, jsarr;
|
|
jsarr = [];
|
|
arr = initUnidimensionalArray(Ljava_lang_String_2_classLit, $intern_23, 2, 20, 6, 1);
|
|
this.getInfo_0(arr);
|
|
for (i = 0; arr[i] != null; i++) {
|
|
jsarr[jsarr.length] = arr[i];
|
|
}
|
|
return jsarr;
|
|
}
|
|
;
|
|
_.getInternalNodeCount = function getInternalNodeCount(){
|
|
return 0;
|
|
}
|
|
;
|
|
_.getMatrixConnection = function getMatrixConnection(n1, n2){
|
|
return this.getConnection(n1, n2);
|
|
}
|
|
;
|
|
_.getMouseDistance = function getMouseDistance(gx, gy){
|
|
if (this.getPostCount_0() == 0)
|
|
return distanceSq(gx, gy, (this.x2 + this.x_0) / 2 | 0, (this.y2 + this.y_0) / 2 | 0);
|
|
return $lineDistanceSq(this.x_0, this.y_0, this.x2, this.y2, gx, gy);
|
|
}
|
|
;
|
|
_.getNumHandles = function getNumHandles(){
|
|
return this.getPostCount_0();
|
|
}
|
|
;
|
|
_.getPost = function getPost(n){
|
|
return $getPost(this, n);
|
|
}
|
|
;
|
|
_.getPostCount_0 = function getPostCount(){
|
|
return 2;
|
|
}
|
|
;
|
|
_.getPostWidth = function getPostWidth(n){
|
|
return 1;
|
|
}
|
|
;
|
|
_.getPower = function getPower(){
|
|
return this.getVoltageDiff_0() * this.current_0;
|
|
}
|
|
;
|
|
_.getScopeText = function getScopeText(v){
|
|
var info;
|
|
info = initUnidimensionalArray(Ljava_lang_String_2_classLit, $intern_23, 2, 10, 6, 1);
|
|
this.getInfo_0(info);
|
|
return info[0];
|
|
}
|
|
;
|
|
_.getScopeUnits = function getScopeUnits(x_0){
|
|
return x_0 == 3?1:x_0 == 7?2:0;
|
|
}
|
|
;
|
|
_.getScopeValue = function getScopeValue(x_0){
|
|
return x_0 == 3?this.getCurrent_0():x_0 == 7?this.getPower():this.getVoltageDiff_0();
|
|
}
|
|
;
|
|
_.getShortcut = function getShortcut(){
|
|
return 0;
|
|
}
|
|
;
|
|
_.getVoltageDiff_0 = function getVoltageDiff(){
|
|
return this.volts[0] - this.volts[1];
|
|
}
|
|
;
|
|
_.getVoltageJS = function getVoltageJS(n){
|
|
if (n >= this.volts.length)
|
|
return 0;
|
|
return this.volts[n];
|
|
}
|
|
;
|
|
_.getVoltageSourceCount = function getVoltageSourceCount(){
|
|
return 0;
|
|
}
|
|
;
|
|
_.getWireSegments = function getWireSegments(list){
|
|
var b, bw, ep0, ep1, p0, p1;
|
|
bw = this.getBusWidth();
|
|
for (b = 0; b < bw; b++) {
|
|
p0 = this.getPost(b);
|
|
p1 = this.getConnectedPost_0(b);
|
|
ep0 = p0.x_0 + ',' + p0.y_0 + ',' + p0.z_0;
|
|
ep1 = !!p1 && !$equals(p1, p0)?p1.x_0 + ',' + p1.y_0 + ',' + p1.z_0:null;
|
|
$add_11(list, new SimulationManager$WireSegment(this, b, ep0, ep1));
|
|
}
|
|
}
|
|
;
|
|
_.getXmlDumpType = function getXmlDumpType(){
|
|
var t;
|
|
t = this.getDumpType();
|
|
if (t > 64 && t < 127)
|
|
return String.fromCharCode(t & $intern_8);
|
|
return $replace_0($replace_0($getName(this.___clazz), 'com.lushprojects.circuitjs1.client.', ''), 'Elm', '');
|
|
}
|
|
;
|
|
_.hasGroundConnection = function hasGroundConnection(n1){
|
|
return false;
|
|
}
|
|
;
|
|
_.initBoundingBox = function initBoundingBox(){
|
|
this.boundingBox = new Rectangle;
|
|
$setBounds(this.boundingBox, min_1(this.x_0, this.x2), min_1(this.y_0, this.y2), abs_0(this.x2 - this.x_0) + 1, abs_0(this.y2 - this.y_0) + 1);
|
|
}
|
|
;
|
|
_.isIdealCapacitor = function isIdealCapacitor(){
|
|
return false;
|
|
}
|
|
;
|
|
_.isRemovableWire = function isRemovableWire(){
|
|
return false;
|
|
}
|
|
;
|
|
_.isWireEquivalent = function isWireEquivalent(){
|
|
return false;
|
|
}
|
|
;
|
|
_.move = function move(dx, dy){
|
|
$move(this, dx, dy);
|
|
}
|
|
;
|
|
_.nonLinear_0 = function nonLinear(){
|
|
return false;
|
|
}
|
|
;
|
|
_.preStamp = function preStamp(){
|
|
}
|
|
;
|
|
_.reset_0 = function reset_0(){
|
|
$reset(this);
|
|
}
|
|
;
|
|
_.selectRect = function selectRect(r, add_0){
|
|
$intersects(r, this.boundingBox)?(this.selected_0 = true):add_0 || (this.selected_0 = false);
|
|
}
|
|
;
|
|
_.setCurrent = function setCurrent(vs, c){
|
|
this.current_0 = c;
|
|
}
|
|
;
|
|
_.setEditValue = function setEditValue(n, ei){
|
|
}
|
|
;
|
|
_.setHighVoltage = function setHighVoltage(hv){
|
|
}
|
|
;
|
|
_.setMouseElm = function setMouseElm(v){
|
|
v?(mouseElmRef = this):mouseElmRef == this && (mouseElmRef = null);
|
|
}
|
|
;
|
|
_.setNode = function setNode(p, n){
|
|
this.nodes[p] = n;
|
|
}
|
|
;
|
|
_.setNodeVoltage = function setNodeVoltage(n, c){
|
|
this.volts[n] = c;
|
|
this.calculateCurrent();
|
|
}
|
|
;
|
|
_.setParentList = function setParentList(elmList){
|
|
}
|
|
;
|
|
_.setPoints = function setPoints(){
|
|
$setPoints(this);
|
|
}
|
|
;
|
|
_.setVoltageSource = function setVoltageSource(n, v){
|
|
this.voltSource = v;
|
|
}
|
|
;
|
|
_.setWireCurrent = function setWireCurrent(bit, c){
|
|
this.current_0 = c;
|
|
}
|
|
;
|
|
_.stamp = function stamp(){
|
|
}
|
|
;
|
|
_.startIteration = function startIteration(){
|
|
}
|
|
;
|
|
_.stepFinished = function stepFinished(){
|
|
}
|
|
;
|
|
_.undumpXml = function undumpXml(xml){
|
|
this.flags = $parseIntAttr(xml, 'f', this.flags);
|
|
}
|
|
;
|
|
_.updateModels = function updateModels(){
|
|
}
|
|
;
|
|
_.validate = function validate(){
|
|
return true;
|
|
}
|
|
;
|
|
_.curcount_0 = 0;
|
|
_.current_0 = 0;
|
|
_.dn = 0;
|
|
_.dpx1 = 0;
|
|
_.dpy1 = 0;
|
|
_.dsign = 0;
|
|
_.dx = 0;
|
|
_.dy = 0;
|
|
_.flags = 0;
|
|
_.inComposite = false;
|
|
_.lastHandleGrabbed = -1;
|
|
_.noDiagonal = false;
|
|
_.selected_0 = false;
|
|
_.x_0 = 0;
|
|
_.x2 = 0;
|
|
_.y_0 = 0;
|
|
_.y2 = 0;
|
|
var app_0, colorScale, colorScaleCount = 201, currentColor_0, currentMult_0 = 0, decimalDigits = 0, fixedFormat, lightGrayColor, mouseElmRef = null, negativeColor_0, neutralColor_0, positiveColor_0, powerMult = 0, ps1, ps2, selectColor_0, shortDecimalDigits = 0, shortFormat, showFormat, sim_0, unitsFont, valueFont, valueFontSize = 12, voltageRange = 5, whiteColor;
|
|
var Lcom_lushprojects_circuitjs1_client_CircuitElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'CircuitElm', 8);
|
|
function $drawWaveform(this$static, g, center){
|
|
var i, s, showF, showV, xc, xc2, yc, yy;
|
|
$setColor_0(g, mouseElmRef == this$static || this$static.selected_0 || $containsKey(app_0.mouse.scopePlotRoles, this$static) || instanceOf(mouseElmRef, 21) && $getElm_0(mouseElmRef.elmScope) == this$static || $isOnHighlightedNet(this$static)?selectColor_0:($clinit_Color() , gray));
|
|
$setPowerColor_0(this$static, g);
|
|
xc = center.x_0;
|
|
yc = center.y_0;
|
|
this$static.waveform != 6 && drawThickCircle(g, xc, yc, 17);
|
|
$adjustBbox(this$static, xc - 17, yc - 17, xc + 17, yc + 17);
|
|
switch (this$static.waveform) {
|
|
case 2:
|
|
xc2 = round_int(16 * this$static.dutyCycle - 8 + xc);
|
|
xc2 = xc - 8 + 3 > (xc + 8 - 3 < xc2?xc + 8 - 3:xc2)?xc - 8 + 3:xc + 8 - 3 < xc2?xc + 8 - 3:xc2;
|
|
drawThickLine(g, xc - 8, yc - 8, xc - 8, yc);
|
|
drawThickLine(g, xc - 8, yc - 8, xc2, yc - 8);
|
|
drawThickLine(g, xc2, yc - 8, xc2, yc + 8);
|
|
drawThickLine(g, xc + 8, yc + 8, xc2, yc + 8);
|
|
drawThickLine(g, xc + 8, yc, xc + 8, yc + 8);
|
|
break;
|
|
case 5:
|
|
yc += 4;
|
|
drawThickLine(g, xc - 8, yc - 8, xc - 8, yc);
|
|
drawThickLine(g, xc - 8, yc - 8, xc - 4, yc - 8);
|
|
drawThickLine(g, xc - 4, yc - 8, xc - 4, yc);
|
|
drawThickLine(g, xc - 4, yc, xc + 8, yc);
|
|
break;
|
|
case 4:
|
|
drawThickLine(g, xc, yc - 8, xc - 8, yc);
|
|
drawThickLine(g, xc, yc - 8, xc, yc + 8);
|
|
drawThickLine(g, xc, yc + 8, xc + 8, yc);
|
|
break;
|
|
case 3:
|
|
{
|
|
drawThickLine(g, xc - 10, yc, xc - 5, yc - 8);
|
|
drawThickLine(g, xc - 5, yc - 8, xc, yc);
|
|
drawThickLine(g, xc, yc, xc + 5, yc + 8);
|
|
drawThickLine(g, xc + 5, yc + 8, xc + 10, yc);
|
|
break;
|
|
}
|
|
|
|
case 6:
|
|
{
|
|
$setColor_0(g, mouseElmRef == this$static || this$static.selected_0 || $containsKey(app_0.mouse.scopePlotRoles, this$static) || instanceOf(mouseElmRef, 21) && $getElm_0(mouseElmRef.elmScope) == this$static || $isOnHighlightedNet(this$static)?selectColor_0:whiteColor);
|
|
$setPowerColor_0(this$static, g);
|
|
$drawLabeledNode(this$static, g, LS('Noise'), this$static.point1, this$static.lead1);
|
|
break;
|
|
}
|
|
|
|
case 1:
|
|
{
|
|
g.context.beginPath();
|
|
g.context.lineWidth = 3;
|
|
for (i = -10; i <= 10; i++) {
|
|
yy = yc + round_int(0.95 * $wnd.Math.sin(i * $intern_1 / 10) * 8);
|
|
i == -10?$moveTo(g.context, xc + -10, yy):$lineTo(g.context, xc + i, yy);
|
|
}
|
|
g.context.stroke();
|
|
g.context.lineWidth = 1;
|
|
break;
|
|
}
|
|
|
|
}
|
|
if (instanceOf(this$static, 47) && (this$static.dx == 0 || this$static.dy == 0)) {
|
|
showV = (this$static.flags & 64) != 0;
|
|
showF = app_0.menus.showValuesCheckItem.on && this$static.waveform != 6;
|
|
s = null;
|
|
showV && showF?(s = $getShortVoltageText(this$static) + ' ' + getUnitText(this$static.frequency, 'Hz', true)):showV?(s = $getShortVoltageText(this$static)):showF && (s = getUnitText(this$static.frequency, 'Hz', true));
|
|
s != null && $drawValues(this$static, g, s, 17);
|
|
}
|
|
}
|
|
|
|
function $dumpXml(this$static, elem){
|
|
dumpAttr_1(elem, 'x', this$static.x_0 + ' ' + this$static.y_0 + ' ' + this$static.x2 + ' ' + this$static.y2);
|
|
dumpAttr_0(elem, 'f', this$static.flags);
|
|
dumpAttr_0(elem, 'wf', this$static.waveform);
|
|
this$static.waveform != 0 && dumpAttr(elem, 'fr', this$static.frequency);
|
|
dumpAttr(elem, 'maxv', this$static.maxVoltage_0);
|
|
this$static.bias != 0 && dumpAttr(elem, 'bias', this$static.bias);
|
|
this$static.phaseShift != 0 && dumpAttr(elem, 'phaseShift', this$static.phaseShift);
|
|
this$static.dutyCycle != 0.5 && dumpAttr(elem, 'dutyCycle', this$static.dutyCycle);
|
|
this$static.riseTime != 0 && dumpAttr(elem, 'riseTime', this$static.riseTime);
|
|
this$static.internalResistance != 0 && dumpAttr(elem, 'ir', this$static.internalResistance);
|
|
}
|
|
|
|
function $getInfo(this$static, arr){
|
|
var i;
|
|
switch (this$static.waveform) {
|
|
case 0:
|
|
case 7:
|
|
arr[0] = 'voltage source';
|
|
break;
|
|
case 1:
|
|
arr[0] = 'A/C source';
|
|
break;
|
|
case 2:
|
|
arr[0] = 'square wave gen';
|
|
break;
|
|
case 5:
|
|
arr[0] = 'pulse gen';
|
|
break;
|
|
case 4:
|
|
arr[0] = 'sawtooth gen';
|
|
break;
|
|
case 3:
|
|
arr[0] = 'triangle gen';
|
|
break;
|
|
case 6:
|
|
arr[0] = 'noise gen';
|
|
}
|
|
arr[1] = 'I = ' + getUnitText(this$static.current_0, 'A', false);
|
|
arr[2] = (instanceOf(this$static, 47)?'V = ':'Vd = ') + getUnitText(this$static.getVoltageDiff_0(), 'V', false);
|
|
i = 3;
|
|
if (this$static.waveform != 0 && this$static.waveform != 7 && this$static.waveform != 6) {
|
|
arr[i++] = 'f = ' + getUnitText(this$static.frequency, 'Hz', false);
|
|
arr[i++] = 'Vmax = ' + getUnitText(this$static.maxVoltage_0, 'V', false);
|
|
this$static.bias == 0 && (arr[i++] = 'V(rms) = ' + getUnitText(this$static.maxVoltage_0 * $getRmsMultiplier(this$static), 'V', false));
|
|
this$static.bias != 0?(arr[i++] = 'Voff = ' + getUnitText(this$static.bias, 'V', false)):this$static.frequency > 500 && (arr[i++] = 'wavelength = ' + getUnitText(299790000 / this$static.frequency, 'm', false));
|
|
}
|
|
this$static.waveform == 0 && this$static.current_0 != 0 && app_0.showResistanceInVoltageSources && (arr[i++] = '(R = ' + getUnitText(this$static.maxVoltage_0 / this$static.current_0, ohmString, false) + ')');
|
|
arr[i++] = 'P = ' + getUnitText(-this$static.getVoltageDiff_0() * this$static.current_0, 'W', false);
|
|
}
|
|
|
|
function $getRmsMultiplier(this$static){
|
|
switch (this$static.waveform) {
|
|
case 2:
|
|
default:case 0:
|
|
return 1;
|
|
case 1:
|
|
return 1 / $wnd.Math.sqrt(2);
|
|
case 4:
|
|
case 3:
|
|
return 1 / $wnd.Math.sqrt(3);
|
|
case 5:
|
|
return $wnd.Math.sqrt(this$static.dutyCycle);
|
|
}
|
|
}
|
|
|
|
function $getShortVoltageText(this$static){
|
|
if (this$static.bias != 0)
|
|
return getUnitText(this$static.bias + this$static.maxVoltage_0, 'V', true);
|
|
if ($useRmsDisplay(this$static, this$static.maxVoltage_0))
|
|
return getUnitText(this$static.maxVoltage_0 * $getRmsMultiplier(this$static), 'V', true) + 'rms';
|
|
return getUnitText(this$static.maxVoltage_0, 'V', true);
|
|
}
|
|
|
|
function $setFrequency(this$static, newFreq){
|
|
var maxfreq, oldfreq;
|
|
oldfreq = this$static.frequency;
|
|
this$static.frequency = newFreq;
|
|
maxfreq = 1 / (8 * sim_0.maxTimeStep);
|
|
this$static.frequency > maxfreq && (confirm_2(LS('Adjust timestep to allow for higher frequencies?'))?(sim_0.maxTimeStep = 1 / (32 * this$static.frequency)):(this$static.frequency = maxfreq));
|
|
this$static.freqTimeZero = this$static.frequency == 0?0:sim_0.t - oldfreq * (sim_0.t - this$static.freqTimeZero) / this$static.frequency;
|
|
}
|
|
|
|
function $setFrequencyFromTimes(this$static, highTime, lowTime){
|
|
var newDuty, newFreq;
|
|
newFreq = 1 / (highTime + lowTime);
|
|
newDuty = highTime / (highTime + lowTime);
|
|
$setFrequency(this$static, newFreq);
|
|
this$static.dutyCycle = newDuty;
|
|
}
|
|
|
|
function $triangleFunc(x_0){
|
|
if (x_0 < $intern_1)
|
|
return x_0 * $intern_86 - 1;
|
|
return 1 - (x_0 - $intern_1) * $intern_86;
|
|
}
|
|
|
|
function $undumpXml(this$static, xml){
|
|
this$static.flags = $parseIntAttr(xml, 'f', this$static.flags);
|
|
this$static.waveform = $parseIntAttr(xml, 'wf', this$static.waveform);
|
|
this$static.frequency = $parseDoubleAttr(xml, 'fr', this$static.frequency);
|
|
this$static.maxVoltage_0 = $parseDoubleAttr(xml, 'maxv', this$static.maxVoltage_0);
|
|
this$static.bias = $parseDoubleAttr(xml, 'bias', this$static.bias);
|
|
this$static.phaseShift = $parseDoubleAttr(xml, 'phaseShift', this$static.phaseShift);
|
|
this$static.dutyCycle = $parseDoubleAttr(xml, 'dutyCycle', this$static.dutyCycle);
|
|
this$static.riseTime = $parseDoubleAttr(xml, 'riseTime', this$static.riseTime);
|
|
this$static.internalResistance = $parseDoubleAttr(xml, 'ir', 0);
|
|
}
|
|
|
|
function $useRmsDisplay(this$static, peakValue){
|
|
var rmsMult, rmsVal;
|
|
rmsMult = $getRmsMultiplier(this$static);
|
|
rmsVal = peakValue * rmsMult;
|
|
return rmsMult != 1 && $wnd.Math.abs(peakValue) > $intern_87 && $wnd.Math.abs(rmsVal * $intern_88 - toDouble_0(fromDouble_0($wnd.Math.round(rmsVal * $intern_88)))) < $wnd.Math.abs(peakValue * $intern_88 - toDouble_0(fromDouble_0($wnd.Math.round(peakValue * $intern_88))));
|
|
}
|
|
|
|
function VoltageElm(xx, yy, wf){
|
|
CircuitElm.call(this, xx, yy);
|
|
this.waveform = wf;
|
|
this.maxVoltage_0 = 5;
|
|
this.frequency = 60;
|
|
this.dutyCycle = 0.5;
|
|
this.flags |= 16;
|
|
this.reset_0();
|
|
}
|
|
|
|
function VoltageElm_0(xa, ya, xb, yb, f, st){
|
|
CircuitElm_0.call(this, xa, ya, xb, yb, f);
|
|
this.maxVoltage_0 = 5;
|
|
this.frequency = 40;
|
|
this.waveform = 0;
|
|
this.dutyCycle = 0.5;
|
|
try {
|
|
this.waveform = (new Integer_0($nextToken(st))).value_0;
|
|
this.frequency = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.maxVoltage_0 = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.bias = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.phaseShift = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.dutyCycle = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
}
|
|
catch ($e0) {
|
|
$e0 = toJava($e0);
|
|
if (!instanceOf($e0, 13))
|
|
throw toJs($e0);
|
|
}
|
|
if ((this.flags & 2) != 0) {
|
|
this.flags &= -3;
|
|
this.phaseShift = $intern_89;
|
|
}
|
|
(this.flags & 4) == 0 && this.waveform == 5 && (this.dutyCycle = $intern_90);
|
|
this.reset_0();
|
|
}
|
|
|
|
defineClass(56, 8, $intern_91, VoltageElm_0);
|
|
_.addRoutingObstacle = function addRoutingObstacle_0(wr){
|
|
$addRoutingObstacleWithLeads(this, wr, 16);
|
|
}
|
|
;
|
|
_.doStep = function doStep_0(){
|
|
this.waveform != 0 && $updateVoltageSource(this.voltSource, this.getVoltage_0());
|
|
}
|
|
;
|
|
_.dragPlace = function dragPlace_0(xa, ya, vertical){
|
|
$dragPlace(this, xa, ya, vertical);
|
|
$swapDragEndpoints(this);
|
|
}
|
|
;
|
|
_.draw = function draw_0(g){
|
|
var hs, inds, pA, pB, plusPoint, s, showF, showV, w, xc, yc;
|
|
$setBbox(this, this.x_0, this.y_0, this.x2, this.y2);
|
|
$draw2Leads(this, g);
|
|
if (this.waveform == 0 && (this.flags & 8) != 0) {
|
|
$setBbox_0(this, this.point1, this.point2, 17);
|
|
$interpPoint_1(this.lead1, this.lead2, ps1, 0.5);
|
|
xc = ps1.x_0;
|
|
yc = ps1.y_0;
|
|
$setColor_0(g, mouseElmRef == this || this.selected_0 || $containsKey(app_0.mouse.scopePlotRoles, this) || instanceOf(mouseElmRef, 21) && $getElm_0(mouseElmRef.elmScope) == this || $isOnHighlightedNet(this)?selectColor_0:($clinit_Color() , gray));
|
|
$setPowerColor_0(this, g);
|
|
drawThickCircle(g, xc, yc, 17);
|
|
$adjustBbox(this, xc - 17, yc - 17, xc + 17, yc + 17);
|
|
$interpPoint2(this.lead1, this.lead2, ps1, ps2, 0.74, 4);
|
|
drawThickLine_0(g, ps1, ps2, 3);
|
|
pA = $interpPoint(this.lead1, this.lead2, 0.6223529411764706);
|
|
pB = $interpPoint(this.lead1, this.lead2, 0.8576470588235294);
|
|
drawThickLine_0(g, pA, pB, 3);
|
|
$interpPoint2(this.lead1, this.lead2, ps1, ps2, 0.26, 4);
|
|
drawThickLine_0(g, ps1, ps2, 3);
|
|
}
|
|
else if (this.waveform == 0) {
|
|
$setVoltageColor(this, g, this.volts[0]);
|
|
$setPowerColor_0(this, g);
|
|
$interpPoint2(this.lead1, this.lead2, ps1, ps2, 0, 10);
|
|
drawThickLine_0(g, ps1, ps2, 3);
|
|
$setVoltageColor(this, g, this.volts[1]);
|
|
$setPowerColor_0(this, g);
|
|
$setBbox_0(this, this.point1, this.point2, 16);
|
|
$interpPoint2(this.lead1, this.lead2, ps1, ps2, 1, 16);
|
|
drawThickLine_0(g, ps1, ps2, 3);
|
|
}
|
|
else {
|
|
$setBbox_0(this, this.point1, this.point2, 17);
|
|
$interpPoint_1(this.lead1, this.lead2, ps1, 0.5);
|
|
$drawWaveform(this, g, ps1);
|
|
this.bias > 0 || this.bias == 0 && this.waveform == 5?(inds = '+'):(inds = '*');
|
|
$setColor_0(g, whiteColor);
|
|
$setFont_0(g, unitsFont);
|
|
plusPoint = $interpPoint_0(this.point1, this.point2, (this.dn / 2 + 17 + 4) / this.dn, 10 * this.dsign);
|
|
plusPoint.y_0 += 4;
|
|
w = round_int($measureText(g.context, inds).width);
|
|
$drawString(g, inds, plusPoint.x_0 - (w / 2 | 0), plusPoint.y_0);
|
|
}
|
|
if (this.dx == 0 || this.dy == 0) {
|
|
showV = (this.flags & 16) != 0;
|
|
showF = app_0.menus.showValuesCheckItem.on && this.waveform != 0 && this.waveform != 6;
|
|
s = null;
|
|
showV && showF?(s = $getShortVoltageText(this) + ' ' + getUnitText(this.frequency, 'Hz', true)):showV?(s = $getShortVoltageText(this)):showF && (s = getUnitText(this.frequency, 'Hz', true));
|
|
if (s != null) {
|
|
hs = this.waveform == 0 && (this.flags & 8) == 0?16:17;
|
|
$drawValues(this, g, s, hs);
|
|
}
|
|
}
|
|
this.curcount_0 = $updateDotCount(this.current_0, this.curcount_0);
|
|
if (app_0.mouse.dragElm != this) {
|
|
if (this.waveform == 0 && (this.flags & 8) == 0)
|
|
$drawDots(g, this.point1, this.point2, this.curcount_0);
|
|
else {
|
|
$drawDots(g, this.point1, this.lead1, this.curcount_0);
|
|
$drawDots(g, this.point2, this.lead2, -this.curcount_0);
|
|
}
|
|
}
|
|
$drawPosts(this, g);
|
|
}
|
|
;
|
|
_.dumpXml = function dumpXml_0(doc, elem){
|
|
$dumpXml(this, elem);
|
|
}
|
|
;
|
|
_.getDragVertical = function getDragVertical_0(requestedVertical){
|
|
return true;
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_0(){
|
|
return 118;
|
|
}
|
|
;
|
|
_.getEditInfo = function getEditInfo_0(n){
|
|
var ei, n2, svFlag;
|
|
if (n == 0)
|
|
return $setUnitStep(new EditInfo_0(this.waveform == 0?'Voltage':'Max Voltage', this.maxVoltage_0, -20, 20));
|
|
if (n == 1) {
|
|
ei = new EditInfo_0('Waveform', this.waveform, -1, -1);
|
|
ei.choice = new Choice;
|
|
$addItem(ei.choice, LS('D/C'));
|
|
$addItem(ei.choice, LS('A/C'));
|
|
$addItem(ei.choice, LS('Square Wave'));
|
|
$addItem(ei.choice, LS('Triangle'));
|
|
$addItem(ei.choice, LS('Sawtooth'));
|
|
$addItem(ei.choice, LS('Pulse'));
|
|
$addItem(ei.choice, LS('Noise'));
|
|
$select(ei.choice, this.waveform);
|
|
return ei;
|
|
}
|
|
if (n == 2)
|
|
return $setUnitStep(new EditInfo_0('DC Offset (V)', this.bias, -20, 20));
|
|
if (n == 3) {
|
|
ei = new EditInfo('Internal Resistance (ohms)', this.internalResistance);
|
|
ei.nonNegative = true;
|
|
return ei;
|
|
}
|
|
if (n == 4 && !(instanceOf(this, 47) && (this.waveform == 0 || this.waveform == 7))) {
|
|
ei = new EditInfo_0('', 0, -1, -1);
|
|
svFlag = instanceOf(this, 47)?64:16;
|
|
ei.checkbox = new Checkbox_0('Show Voltage', (this.flags & svFlag) != 0);
|
|
return ei;
|
|
}
|
|
if (n == 5 && this.waveform == 0 && !instanceOf(this, 47)) {
|
|
ei = new EditInfo_0('', 0, -1, -1);
|
|
ei.checkbox = new Checkbox_0('Circle Symbol', (this.flags & 8) != 0);
|
|
return ei;
|
|
}
|
|
if (this.waveform == 0 || this.waveform == 6)
|
|
return null;
|
|
n2 = n - 5;
|
|
if (this.waveform == 5 || this.waveform == 2) {
|
|
if (n2 == 0) {
|
|
ei = new EditInfo_0('Specify As', 0, -1, -1);
|
|
ei.choice = new Choice;
|
|
$addItem(ei.choice, LS('Frequency/Duty Cycle'));
|
|
$addItem(ei.choice, LS('High Time/Low Time'));
|
|
$select(ei.choice, (this.flags & 32) != 0 && (this.waveform == 5 || this.waveform == 2)?1:0);
|
|
ei.newColumn = true;
|
|
return ei;
|
|
}
|
|
if (n2 == 1) {
|
|
if ((this.flags & 32) != 0 && (this.waveform == 5 || this.waveform == 2))
|
|
return new EditInfo_0('High Time (s)', this.dutyCycle / this.frequency, 0, 0);
|
|
return new EditInfo_0('Frequency (Hz)', this.frequency, 4, 500);
|
|
}
|
|
if (n2 == 2)
|
|
return $setDimensionless(new EditInfo_0('Phase Offset (degrees)', this.phaseShift * 180 / $intern_1, -180, 180));
|
|
if (n2 == 3) {
|
|
if ((this.flags & 32) != 0 && (this.waveform == 5 || this.waveform == 2))
|
|
return new EditInfo_0('Low Time (s)', (1 - this.dutyCycle) / this.frequency, 0, 0);
|
|
return $setDimensionless(new EditInfo_0('Duty Cycle', this.dutyCycle * 100, 0, 100));
|
|
}
|
|
if (n2 == 4)
|
|
return new EditInfo_0('Rise/Fall Time (s)', this.riseTime, 0, 0);
|
|
}
|
|
else {
|
|
if (n2 == 0)
|
|
return new EditInfo_0('Frequency (Hz)', this.frequency, 4, 500);
|
|
if (n2 == 1)
|
|
return $setDimensionless(new EditInfo_0('Phase Offset (degrees)', this.phaseShift * 180 / $intern_1, -180, 180));
|
|
}
|
|
return null;
|
|
}
|
|
;
|
|
_.getInfo_0 = function getInfo_0(arr){
|
|
$getInfo(this, arr);
|
|
}
|
|
;
|
|
_.getInternalNodeCount = function getInternalNodeCount_0(){
|
|
return this.internalResistance > 0?1:0;
|
|
}
|
|
;
|
|
_.getPower = function getPower_0(){
|
|
return -this.getVoltageDiff_0() * this.current_0;
|
|
}
|
|
;
|
|
_.getVoltage_0 = function getVoltage(){
|
|
var dutyPhase, halfRise, risePhase, t, w, wm;
|
|
if (this.waveform != 0 && app_0.dcAnalysisFlag)
|
|
return this.bias;
|
|
w = $intern_2 * (sim_0.t - this.freqTimeZero) * this.frequency + this.phaseShift;
|
|
switch (this.waveform) {
|
|
case 0:
|
|
return this.maxVoltage_0 + this.bias;
|
|
case 1:
|
|
return $wnd.Math.sin(w) * this.maxVoltage_0 + this.bias;
|
|
case 2:
|
|
{
|
|
wm = w % $intern_2;
|
|
dutyPhase = $intern_2 * this.dutyCycle;
|
|
if (this.riseTime > 0) {
|
|
risePhase = this.riseTime * this.frequency * 2 * $intern_1;
|
|
halfRise = risePhase / 2;
|
|
if (wm < halfRise) {
|
|
t = (wm + halfRise) / risePhase;
|
|
return this.bias + this.maxVoltage_0 * (2 * t - 1);
|
|
}
|
|
else if (wm < dutyPhase - halfRise)
|
|
return this.bias + this.maxVoltage_0;
|
|
else if (wm < dutyPhase + halfRise) {
|
|
t = (wm - dutyPhase + halfRise) / risePhase;
|
|
return this.bias + this.maxVoltage_0 * (1 - 2 * t);
|
|
}
|
|
else if (wm < $intern_2 - halfRise)
|
|
return this.bias - this.maxVoltage_0;
|
|
else {
|
|
t = (wm - ($intern_2 - halfRise)) / risePhase;
|
|
return this.bias + this.maxVoltage_0 * (2 * t - 1);
|
|
}
|
|
}
|
|
return this.bias + (wm > dutyPhase?-this.maxVoltage_0:this.maxVoltage_0);
|
|
}
|
|
|
|
case 3:
|
|
return this.bias + $triangleFunc(w % $intern_2) * this.maxVoltage_0;
|
|
case 4:
|
|
return this.bias + w % $intern_2 * (this.maxVoltage_0 / $intern_1) - this.maxVoltage_0;
|
|
case 5:
|
|
{
|
|
wm = w % $intern_2;
|
|
dutyPhase = $intern_2 * this.dutyCycle;
|
|
if (this.riseTime > 0) {
|
|
risePhase = this.riseTime * this.frequency * 2 * $intern_1;
|
|
halfRise = risePhase / 2;
|
|
if (wm < halfRise) {
|
|
t = (wm + halfRise) / risePhase;
|
|
return this.bias + this.maxVoltage_0 * t;
|
|
}
|
|
else if (wm < dutyPhase - halfRise)
|
|
return this.bias + this.maxVoltage_0;
|
|
else if (wm < dutyPhase + halfRise) {
|
|
t = (wm - dutyPhase + halfRise) / risePhase;
|
|
return this.bias + this.maxVoltage_0 * (1 - t);
|
|
}
|
|
else if (wm < $intern_2 - halfRise)
|
|
return this.bias;
|
|
else {
|
|
t = (wm - ($intern_2 - halfRise)) / risePhase;
|
|
return this.bias + this.maxVoltage_0 * t;
|
|
}
|
|
}
|
|
return wm < dutyPhase?this.maxVoltage_0 + this.bias:this.bias;
|
|
}
|
|
|
|
case 6:
|
|
return this.noiseValue;
|
|
default:return 0;
|
|
}
|
|
}
|
|
;
|
|
_.getVoltageDiff_0 = function getVoltageDiff_0(){
|
|
return this.volts[1] - this.volts[0];
|
|
}
|
|
;
|
|
_.getVoltageSourceCount = function getVoltageSourceCount_0(){
|
|
return 1;
|
|
}
|
|
;
|
|
_.reset_0 = function reset_1(){
|
|
this.freqTimeZero = 0;
|
|
this.curcount_0 = 0;
|
|
}
|
|
;
|
|
_.setEditValue = function setEditValue_0(n, ei){
|
|
var highTime, lowTime, n2, oldFlags, ow, svFlag;
|
|
n == 0 && (this.maxVoltage_0 = ei.value_0);
|
|
n == 2 && (this.bias = ei.value_0);
|
|
n == 3 && (this.internalResistance = ei.value_0);
|
|
if (n == 4 && !!ei.checkbox) {
|
|
svFlag = instanceOf(this, 47)?64:16;
|
|
this.flags = $changeFlag(ei, this.flags, svFlag);
|
|
}
|
|
if (n == 5 && this.waveform == 0 && !!ei.checkbox && !instanceOf(this, 47)) {
|
|
this.flags = $changeFlag(ei, this.flags, 8);
|
|
this.setPoints();
|
|
}
|
|
if (n == 1) {
|
|
ow = this.waveform;
|
|
this.waveform = $getElement(ei.choice).selectedIndex;
|
|
if (this.waveform == 0 && ow != 0) {
|
|
ei.newDialog = true;
|
|
this.bias = 0;
|
|
}
|
|
else
|
|
this.waveform != ow && (ei.newDialog = true);
|
|
this.waveform == 5 && ow != 5?(this.dutyCycle = $intern_90):ow == 5 && this.waveform != 5 && (this.dutyCycle = 0.5);
|
|
this.setPoints();
|
|
}
|
|
n2 = n - 5;
|
|
if (this.waveform == 5 || this.waveform == 2) {
|
|
if (n2 == 0 && !!ei.choice) {
|
|
oldFlags = this.flags;
|
|
this.flags = $getElement(ei.choice).selectedIndex == 1?this.flags | 32:this.flags & -33;
|
|
this.flags != oldFlags && (ei.newDialog = true);
|
|
}
|
|
if (n2 == 1) {
|
|
if ((this.flags & 32) != 0 && (this.waveform == 5 || this.waveform == 2)) {
|
|
highTime = ei.value_0;
|
|
lowTime = (1 - this.dutyCycle) / this.frequency;
|
|
highTime > 0 && lowTime > 0 && $setFrequencyFromTimes(this, highTime, lowTime);
|
|
}
|
|
else
|
|
ei.value_0 != 0 && $setFrequency(this, ei.value_0);
|
|
}
|
|
if (n2 == 2) {
|
|
this.phaseShift = ei.value_0 * $intern_1 / 180;
|
|
this.phaseShift = (this.phaseShift % $intern_2 + $intern_2) % $intern_2;
|
|
}
|
|
if (n2 == 3) {
|
|
if ((this.flags & 32) != 0 && (this.waveform == 5 || this.waveform == 2)) {
|
|
highTime = this.dutyCycle / this.frequency;
|
|
lowTime = ei.value_0;
|
|
highTime > 0 && lowTime > 0 && $setFrequencyFromTimes(this, highTime, lowTime);
|
|
}
|
|
else {
|
|
this.dutyCycle = ei.value_0 * $intern_34;
|
|
}
|
|
}
|
|
n2 == 4 && (this.riseTime = ei.value_0);
|
|
}
|
|
else {
|
|
n2 == 0 && this.waveform != 0 && ei.value_0 != 0 && $setFrequency(this, ei.value_0);
|
|
if (n2 == 1) {
|
|
this.phaseShift = ei.value_0 * $intern_1 / 180;
|
|
this.phaseShift = (this.phaseShift % $intern_2 + $intern_2) % $intern_2;
|
|
}
|
|
}
|
|
}
|
|
;
|
|
_.setPoints = function setPoints_0(){
|
|
$setPoints(this);
|
|
this.waveform == 0 && (this.flags & 8) != 0?$calcLeads(this, 34):$calcLeads(this, this.waveform == 0 || this.waveform == 7?8:34);
|
|
}
|
|
;
|
|
_.setVoltageSource = function setVoltageSource_0(n, v){
|
|
this.voltSource = v;
|
|
this.internalResistance > 0?$setNodes(v, this.nodes[0], this.nodes[2]):$setNodes(v, this.nodes[0], this.nodes[1]);
|
|
}
|
|
;
|
|
_.stamp = function stamp_0(){
|
|
var vsNode2;
|
|
vsNode2 = this.internalResistance > 0?this.nodes[2]:this.nodes[1];
|
|
this.waveform == 0?$stampVoltageSource_0(this.nodes[0], vsNode2, this.voltSource, this.getVoltage_0()):$stampVoltageSource(this.nodes[0], vsNode2, this.voltSource);
|
|
this.internalResistance > 0 && $stampResistor(this.nodes[2], this.nodes[1], this.internalResistance);
|
|
}
|
|
;
|
|
_.stepFinished = function stepFinished_0(){
|
|
this.waveform == 6 && (this.noiseValue = ($nextDouble(app_0.random_0) * 2 - 1) * this.maxVoltage_0 + this.bias);
|
|
}
|
|
;
|
|
_.undumpXml = function undumpXml_0(xml){
|
|
$undumpXml(this, xml);
|
|
}
|
|
;
|
|
_.validate = function validate_0(){
|
|
var fpi;
|
|
if (this.internalResistance > 0)
|
|
return true;
|
|
if (this.getPostCount_0() == 2) {
|
|
fpi = new FindPathInfo(2, this, this.nodes[1], sim_0);
|
|
if ($findPath(fpi, this.nodes[0])) {
|
|
this.internalResistance = $intern_83;
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
;
|
|
_.bias = 0;
|
|
_.dutyCycle = 0;
|
|
_.freqTimeZero = 0;
|
|
_.frequency = 0;
|
|
_.internalResistance = 0;
|
|
_.maxVoltage_0 = 0;
|
|
_.noiseValue = 0;
|
|
_.phaseShift = 0;
|
|
_.riseTime = 0;
|
|
_.waveform = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_VoltageElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'VoltageElm', 56);
|
|
function $drawRailText(this$static, g, s){
|
|
$setColor_0(g, mouseElmRef == this$static || this$static.selected_0 || $containsKey(app_0.mouse.scopePlotRoles, this$static) || instanceOf(mouseElmRef, 21) && $getElm_0(mouseElmRef.elmScope) == this$static || $isOnHighlightedNet(this$static)?selectColor_0:whiteColor);
|
|
$setPowerColor_0(this$static, g);
|
|
$drawLabeledNode(this$static, g, s, this$static.point1, this$static.lead1);
|
|
}
|
|
|
|
function $validateRailNode_0(this$static){
|
|
var fpi;
|
|
fpi = new FindPathInfo(2, this$static, this$static.nodes[0], sim_0);
|
|
if ($findPath(fpi, ground)) {
|
|
this$static.internalResistance = $intern_83;
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
function RailElm(xx, yy){
|
|
VoltageElm.call(this, xx, yy, 0);
|
|
}
|
|
|
|
function RailElm_0(xx, yy, wf){
|
|
VoltageElm.call(this, xx, yy, wf);
|
|
}
|
|
|
|
function RailElm_1(xa, ya, xb, yb, f, st){
|
|
VoltageElm_0.call(this, xa, ya, xb, yb, f, st);
|
|
}
|
|
|
|
defineClass(47, 56, $intern_92, RailElm, RailElm_1);
|
|
_.addRoutingObstacle = function addRoutingObstacle_1(router){
|
|
$addWire(router, this.point1.x_0, this.point1.y_0, this.point2.x_0, this.point2.y_0);
|
|
$addObstacle(router, this.point2.x_0 - 17, this.point2.y_0 - 17, this.point2.x_0 + 17, this.point2.y_0 + 17);
|
|
}
|
|
;
|
|
_.doStep = function doStep_1(){
|
|
this.waveform != 0 && $updateVoltageSource(this.voltSource, this.getVoltage_0());
|
|
}
|
|
;
|
|
_.draw = function draw_1(g){
|
|
var rt, w;
|
|
rt = this.getRailText();
|
|
w = rt == null?17:$measureText(g.context, rt).width / 2;
|
|
w > this.dn * 0.8 && (w = this.dn * 0.8);
|
|
this.lead1 = $interpPoint(this.point1, this.point2, 1 - w / this.dn);
|
|
$setBbox_0(this, this.point1, this.point2, 17);
|
|
$setVoltageColor(this, g, this.volts[0]);
|
|
drawThickLine_0(g, this.point1, this.lead1, 3);
|
|
this.drawRail(g);
|
|
$drawPosts(this, g);
|
|
this.curcount_0 = $updateDotCount(-this.current_0, this.curcount_0);
|
|
app_0.mouse.dragElm == this || $drawDots(g, this.point1, this.lead1, this.curcount_0);
|
|
}
|
|
;
|
|
_.drawRail = function drawRail(g){
|
|
var s, v;
|
|
if (this.waveform == 2 && (this.flags & 1) != 0)
|
|
$drawRailText(this, g, 'CLK');
|
|
else if (this.waveform == 0 || this.waveform == 7) {
|
|
$setColor_0(g, mouseElmRef == this || this.selected_0 || $containsKey(app_0.mouse.scopePlotRoles, this) || instanceOf(mouseElmRef, 21) && $getElm_0(mouseElmRef.elmScope) == this || $isOnHighlightedNet(this)?selectColor_0:whiteColor);
|
|
$setPowerColor_0(this, g);
|
|
v = this.getVoltage_0();
|
|
$wnd.Math.abs(v) < 1?(s = $format_0(showFormat, v) + ' V'):(s = getUnitText(v, 'V', true));
|
|
this.getVoltage_0() > 0 && (s = '+' + s);
|
|
$drawLabeledNode(this, g, s, this.point1, this.lead1);
|
|
}
|
|
else {
|
|
$drawWaveform(this, g, this.point2);
|
|
}
|
|
}
|
|
;
|
|
_.getDragVertical = function getDragVertical_1(requestedVertical){
|
|
return requestedVertical;
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_1(){
|
|
return 82;
|
|
}
|
|
;
|
|
_.getPostCount_0 = function getPostCount_0(){
|
|
return 1;
|
|
}
|
|
;
|
|
_.getRailText = function getRailText(){
|
|
return null;
|
|
}
|
|
;
|
|
_.getShortcut = function getShortcut_0(){
|
|
return 86;
|
|
}
|
|
;
|
|
_.getVoltageDiff_0 = function getVoltageDiff_1(){
|
|
return this.volts[0];
|
|
}
|
|
;
|
|
_.hasGroundConnection = function hasGroundConnection_0(n1){
|
|
return true;
|
|
}
|
|
;
|
|
_.setPoints = function setPoints_1(){
|
|
$setPoints(this);
|
|
this.waveform == 0 && (this.flags & 8) != 0?$calcLeads(this, 34):$calcLeads(this, this.waveform == 0 || this.waveform == 7?8:34);
|
|
this.lead1 = $interpPoint(this.point1, this.point2, 1 - 17 / this.dn);
|
|
}
|
|
;
|
|
_.setVoltageSource = function setVoltageSource_1(n, v){
|
|
this.voltSource = v;
|
|
this.internalResistance > 0?$setNodes(v, this.nodes[0], this.nodes[2]):$setNodes(v, this.nodes[0], this.nodes[1]);
|
|
this.internalResistance > 0?$setNodes(v, ground, this.nodes[1]):$setNodes(v, ground, this.nodes[0]);
|
|
}
|
|
;
|
|
_.stamp = function stamp_1(){
|
|
var vsNode;
|
|
vsNode = this.internalResistance > 0?this.nodes[1]:this.nodes[0];
|
|
this.waveform == 0?$stampVoltageSource_0(ground, vsNode, this.voltSource, this.getVoltage_0()):$stampVoltageSource(ground, vsNode, this.voltSource);
|
|
this.internalResistance > 0 && $stampResistor(this.nodes[1], this.nodes[0], this.internalResistance);
|
|
}
|
|
;
|
|
_.validate = function validate_1(){
|
|
return this.internalResistance > 0 || $validateRailNode_0(this);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_RailElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'RailElm', 47);
|
|
function ACRailElm(xx, yy){
|
|
RailElm_0.call(this, xx, yy, 1);
|
|
this.maxVoltage_0 = 120 * $wnd.Math.sqrt(2);
|
|
}
|
|
|
|
defineClass(928, 47, $intern_92, ACRailElm);
|
|
_.getDumpClass = function getDumpClass_0(){
|
|
return Lcom_lushprojects_circuitjs1_client_RailElm_2_classLit;
|
|
}
|
|
;
|
|
_.getShortcut = function getShortcut_1(){
|
|
return 0;
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_ACRailElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ACRailElm', 928);
|
|
function ACVoltageElm(xx, yy){
|
|
VoltageElm.call(this, xx, yy, 1);
|
|
this.maxVoltage_0 = 120 * $wnd.Math.sqrt(2);
|
|
}
|
|
|
|
defineClass(919, 56, $intern_91, ACVoltageElm);
|
|
_.getDumpClass = function getDumpClass_1(){
|
|
return Lcom_lushprojects_circuitjs1_client_VoltageElm_2_classLit;
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_ACVoltageElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ACVoltageElm', 919);
|
|
function $clinit_ChipElm(){
|
|
$clinit_ChipElm = emptyMethod;
|
|
sideFlipXY = stampJavaTypeInfo(getClassLiteralForArray(I_classLit, 1), $intern_25, 7, 15, [2, 3, 0, 1]);
|
|
}
|
|
|
|
function $addRoutingObstacle(this$static, router){
|
|
$addObstacle(router, this$static.rectPointsX[0], this$static.rectPointsY[0], this$static.rectPointsX[2], this$static.rectPointsY[2]);
|
|
}
|
|
|
|
function $doStep(this$static){
|
|
var i, p;
|
|
for (i = 0; i != this$static.getPostCount_0(); i++) {
|
|
p = this$static.pins[i];
|
|
p.output && $updateVoltageSource(p.voltSource, p.value_0?this$static.highVoltage:0);
|
|
}
|
|
}
|
|
|
|
function $drawChip(this$static, g){
|
|
var a, asc, availSpace, b, f, f2, fsz, hasVertical, i, p, sw, text_0, tx, ya;
|
|
g.context.save();
|
|
g.savedFontSize = g.currentFontSize;
|
|
f = new Font('normal', 0, 10 * this$static.csize);
|
|
hasVertical = false;
|
|
for (i = 0; i != this$static.getPostCount_0(); i++)
|
|
if (this$static.pins[i].side == 0 || this$static.pins[i].side == 1) {
|
|
hasVertical = true;
|
|
break;
|
|
}
|
|
for (i = 0; i != this$static.getPostCount_0(); i++) {
|
|
$setFont_0(g, f);
|
|
p = this$static.pins[i];
|
|
if (p.busZ > 0)
|
|
continue;
|
|
$setVoltageColor(this$static, g, this$static.volts[i]);
|
|
a = p.post;
|
|
b = p.stub;
|
|
drawThickLine_0(g, a, b, p.busWidth > 1?5:3);
|
|
p.curcount = $updateDotCount(p.current, p.curcount);
|
|
$drawDots(g, b, a, p.curcount);
|
|
if (p.bubble) {
|
|
$setColor_0(g, $getBackgroundColor(app_0.ui));
|
|
drawThickCircle(g, p.bubbleX, p.bubbleY, 1);
|
|
$setColor_0(g, lightGrayColor);
|
|
drawThickCircle(g, p.bubbleX, p.bubbleY, 3);
|
|
}
|
|
if (p.clockPointsX != null) {
|
|
$setColor_0(g, lightGrayColor);
|
|
$drawPolyline(g, p.clockPointsX, p.clockPointsY, 3);
|
|
}
|
|
$setColor_0(g, p.selected_0?selectColor_0:whiteColor);
|
|
fsz = 10 * this$static.csize;
|
|
availSpace = this$static.cspc * 2 - 8;
|
|
!hasVertical && this$static.sizeX > 2 && (availSpace = this$static.cspc * 2.5 + this$static.cspc * (this$static.sizeX - 3));
|
|
text_0 = p.busWidth > 1?p.text_0 + '/' + p.busWidth:p.text_0;
|
|
while (true) {
|
|
sw = round_int($measureText(g.context, text_0).width);
|
|
if (sw > availSpace) {
|
|
fsz -= 1;
|
|
f2 = new Font('normal', 0, fsz);
|
|
$setFont_0(g, f2);
|
|
continue;
|
|
}
|
|
asc = g.currentFontSize;
|
|
p.side == $flippedXSide(this$static, 2)?(tx = p.textloc.x_0 - (this$static.cspc - 5)):p.side == $flippedXSide(this$static, 3)?(tx = p.textloc.x_0 + (this$static.cspc - 5) - sw):(tx = p.textloc.x_0 - (sw / 2 | 0));
|
|
$drawString(g, text_0, tx, p.textloc.y_0 + (asc / 3 | 0));
|
|
if (p.lineOver) {
|
|
ya = p.textloc.y_0 - asc + (asc / 3 | 0);
|
|
$drawLine(g, tx, ya, tx + sw, ya);
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
this$static.drawLabel(g, this$static.labelX, this$static.labelY);
|
|
$setColor_0(g, mouseElmRef == this$static || this$static.selected_0 || $containsKey(app_0.mouse.scopePlotRoles, this$static) || instanceOf(mouseElmRef, 21) && $getElm_0(mouseElmRef.elmScope) == this$static || $isOnHighlightedNet(this$static)?selectColor_0:lightGrayColor);
|
|
drawThickPolygon_0(g, this$static.rectPointsX, this$static.rectPointsY, 4);
|
|
$drawPosts(this$static, g);
|
|
g.context.restore();
|
|
g.currentFontSize = g.savedFontSize;
|
|
}
|
|
|
|
function $dumpXml_0(this$static, elem){
|
|
dumpAttr_1(elem, 'x', this$static.x_0 + ' ' + this$static.y_0 + ' ' + this$static.x2 + ' ' + this$static.y2);
|
|
dumpAttr_0(elem, 'f', this$static.flags);
|
|
this$static.bits > 0 && dumpAttr_0(elem, 'bi', this$static.bits);
|
|
this$static.highVoltage != 5 && dumpAttr(elem, 'hv', this$static.highVoltage);
|
|
this$static.bitOrder != 0 && dumpAttr_0(elem, 'bo', this$static.bitOrder);
|
|
}
|
|
|
|
function $dumpXmlState(this$static, elem){
|
|
var i;
|
|
for (i = 0; i != this$static.getPostCount_0(); i++) {
|
|
this$static.pins[i].state && this$static.volts[i] > 0 && dumpAttr(elem, 'v' + i, this$static.volts[i]);
|
|
}
|
|
}
|
|
|
|
function $flippedXSide(this$static, s){
|
|
if ((this$static.flags & $intern_24) == 0)
|
|
return s;
|
|
if (s == 2)
|
|
return 3;
|
|
if (s == 3)
|
|
return 2;
|
|
return s;
|
|
}
|
|
|
|
function $getInfo_0(this$static, arr){
|
|
var a, i, j, p, shown, t, value_0, number;
|
|
arr[0] = this$static.getChipName();
|
|
a = 1;
|
|
shown = 0;
|
|
for (i = 0; i != this$static.getPostCount_0(); i++) {
|
|
p = this$static.pins[i];
|
|
arr[a] != null?(arr[a] += '; '):(arr[a] = '');
|
|
t = p.text_0;
|
|
p.lineOver && (t += "'");
|
|
p.clock && (t = 'Clk');
|
|
if (p.busWidth > 1) {
|
|
value_0 = 0;
|
|
for (j = 0; j < p.busWidth; j++)
|
|
this$static.volts[i + j] > this$static.highVoltage / 2 && (value_0 |= 1 << this$static.pins[i + j].busZ);
|
|
arr[a] += t + ' = ' + value_0 + ' / 0x' + (number = value_0 >>> 0 , number.toString(16)).toUpperCase();
|
|
i += p.busWidth - 1;
|
|
}
|
|
else
|
|
arr[a] += t + ' = ' + getUnitText(this$static.volts[i], 'V', false);
|
|
++shown % 2 == 0 && ++a;
|
|
}
|
|
}
|
|
|
|
function $getPinPos(this$static, xp, yp, currentSide, pos){
|
|
var curDist, dE, dS, distE, distN, distS, distW, minDist, minDist0, side, x0, xd, xr, y0, yd, yr;
|
|
x0 = this$static.x_0 + this$static.cspc2;
|
|
y0 = this$static.y_0;
|
|
xr = x0 - this$static.cspc;
|
|
yr = y0 - this$static.cspc;
|
|
xd = (xp - xr) / this$static.cspc2 - 0.5;
|
|
yd = (yp - yr) / this$static.cspc2 - 0.5;
|
|
if (xd >= 0 && xd <= this$static.sizeX && yd >= 0 && yd <= this$static.sizeY) {
|
|
dE = this$static.sizeX - xd;
|
|
dS = this$static.sizeY - yd;
|
|
curDist = currentSide == 0?yd:currentSide == 1?dS:currentSide == 2?xd:dE;
|
|
minDist0 = $wnd.Math.min($wnd.Math.min(xd, dE), $wnd.Math.min(yd, dS));
|
|
curDist <= minDist0 + 1?(side = currentSide):(side = minDist0 == yd?0:minDist0 == dS?1:minDist0 == xd?2:3);
|
|
pos[0] = side == 0 || side == 1?$wnd.Math.max(0, $wnd.Math.min(toInt_0(fromDouble_0($wnd.Math.round(xd))), this$static.sizeX - 1)):$wnd.Math.max(0, $wnd.Math.min(toInt_0(fromDouble_0($wnd.Math.round(yd))), this$static.sizeY - 1));
|
|
pos[1] = side;
|
|
return true;
|
|
}
|
|
distW = xd < 0?-xd:$intern_93;
|
|
distE = xd > this$static.sizeX?xd - this$static.sizeX:$intern_93;
|
|
distN = yd < 0?-yd:$intern_93;
|
|
distS = yd > this$static.sizeY?yd - this$static.sizeY:$intern_93;
|
|
minDist = $wnd.Math.min($wnd.Math.min(distW, distE), $wnd.Math.min(distN, distS));
|
|
if (minDist == distN) {
|
|
pos[0] = $wnd.Math.max(0, $wnd.Math.min(toInt_0(fromDouble_0($wnd.Math.round(xd))), this$static.sizeX - 1));
|
|
pos[1] = 0;
|
|
}
|
|
else if (minDist == distS) {
|
|
pos[0] = $wnd.Math.max(0, $wnd.Math.min(toInt_0(fromDouble_0($wnd.Math.round(xd))), this$static.sizeX - 1));
|
|
pos[1] = 1;
|
|
}
|
|
else if (minDist == distW) {
|
|
pos[0] = $wnd.Math.max(0, $wnd.Math.min(toInt_0(fromDouble_0($wnd.Math.round(yd))), this$static.sizeY - 1));
|
|
pos[1] = 2;
|
|
}
|
|
else {
|
|
pos[0] = $wnd.Math.max(0, $wnd.Math.min(toInt_0(fromDouble_0($wnd.Math.round(yd))), this$static.sizeY - 1));
|
|
pos[1] = 3;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
function $getPost_0(this$static, n){
|
|
return this$static.pins[n].post;
|
|
}
|
|
|
|
function $getPostWidth(this$static, n){
|
|
return this$static.pins[n].busWidth;
|
|
}
|
|
|
|
function $makeBitPins(this$static, count, pos, side, offset, name_0, output, state, reversed){
|
|
var i, ii;
|
|
for (i = 0; i != count; i++) {
|
|
ii = reversed?offset + count - 1 - i:offset + i;
|
|
if (this$static.bitOrder == 2) {
|
|
this$static.pins[ii] = new ChipElm$Pin(this$static, pos, side, name_0);
|
|
this$static.pins[ii].busWidth = count;
|
|
this$static.pins[ii].busZ = i;
|
|
}
|
|
else
|
|
this$static.bitOrder == 1?(this$static.pins[ii] = new ChipElm$Pin(this$static, pos + i, side, name_0 + i)):(this$static.pins[ii] = new ChipElm$Pin(this$static, pos + (count - 1 - i), side, name_0 + i));
|
|
this$static.pins[ii].output = output;
|
|
this$static.pins[ii].state = state;
|
|
}
|
|
}
|
|
|
|
function $reset_0(this$static){
|
|
var i;
|
|
for (i = 0; i != this$static.getPostCount_0(); i++) {
|
|
this$static.pins[i].value_0 = false;
|
|
this$static.pins[i].curcount = 0;
|
|
this$static.volts[i] = 0;
|
|
}
|
|
this$static.lastClock = false;
|
|
}
|
|
|
|
function $setEditValue(this$static, n, ei){
|
|
if (this$static.isDigitalChip()) {
|
|
if (n == 0) {
|
|
this$static.highVoltage = ei.value_0;
|
|
return;
|
|
}
|
|
--n;
|
|
}
|
|
if (this$static.allowBus()) {
|
|
if (n == 0) {
|
|
this$static.bitOrder = $getElement(ei.choice).selectedIndex;
|
|
this$static.setupPins();
|
|
$setPoints_0(this$static);
|
|
return;
|
|
}
|
|
--n;
|
|
}
|
|
this$static.setChipEditValue(n, ei);
|
|
}
|
|
|
|
function $setPoints_0(this$static){
|
|
var i, p, x0, xr, xs, y0, yr, ys;
|
|
this$static.x2 - this$static.x_0 > this$static.sizeX * this$static.cspc2 && app_0.mouse.dragElm == this$static && $setSize_0(this$static, 2);
|
|
x0 = this$static.x_0 + this$static.cspc2;
|
|
y0 = this$static.y_0;
|
|
xr = x0 - this$static.cspc;
|
|
yr = y0 - this$static.cspc;
|
|
this$static.flippedSizeX = this$static.sizeX;
|
|
this$static.flippedSizeY = this$static.sizeY;
|
|
if ((this$static.flags & $intern_42) != 0) {
|
|
this$static.flippedSizeX = this$static.sizeY;
|
|
this$static.flippedSizeY = this$static.sizeX;
|
|
}
|
|
xs = this$static.flippedSizeX * this$static.cspc2;
|
|
ys = this$static.flippedSizeY * this$static.cspc2;
|
|
for (i = 0; i != this$static.getPostCount_0(); i++) {
|
|
p = this$static.pins[i];
|
|
p.side = p.side0;
|
|
(this$static.flags & $intern_42) != 0 && (p.side = sideFlipXY[p.side]);
|
|
switch (p.side) {
|
|
case 0:
|
|
$setPoint(p, x0, y0, 1, 0, 0, -1, 0, 0);
|
|
break;
|
|
case 1:
|
|
$setPoint(p, x0, y0, 1, 0, 0, 1, 0, ys - this$static.cspc2);
|
|
break;
|
|
case 2:
|
|
$setPoint(p, x0, y0, 0, 1, -1, 0, 0, 0);
|
|
break;
|
|
case 3:
|
|
$setPoint(p, x0, y0, 0, 1, 1, 0, xs - this$static.cspc2, 0);
|
|
}
|
|
}
|
|
this$static.rectPointsX = stampJavaTypeInfo(getClassLiteralForArray(I_classLit, 1), $intern_25, 7, 15, [xr, xr + xs, xr + xs, xr]);
|
|
this$static.rectPointsY = stampJavaTypeInfo(getClassLiteralForArray(I_classLit, 1), $intern_25, 7, 15, [yr, yr, yr + ys, yr + ys]);
|
|
$setBbox(this$static, xr, yr, this$static.rectPointsX[2], this$static.rectPointsY[2]);
|
|
this$static.labelX = xr + (xs / 2 | 0);
|
|
this$static.labelY = yr + (ys / 2 | 0);
|
|
}
|
|
|
|
function $setSize_0(this$static, s){
|
|
this$static.csize = s;
|
|
this$static.cspc = 8 * s;
|
|
this$static.cspc2 = this$static.cspc * 2;
|
|
this$static.flags &= -2;
|
|
this$static.flags |= s == 1?1:0;
|
|
}
|
|
|
|
function $setVoltageSource(this$static, j, vs){
|
|
var i, p;
|
|
for (i = 0; i != this$static.getPostCount_0(); i++) {
|
|
p = this$static.pins[i];
|
|
if (p.output && j-- == 0) {
|
|
p.voltSource = vs;
|
|
$setNodes(vs, ground, this$static.nodes[i]);
|
|
return;
|
|
}
|
|
}
|
|
$clinit_System();
|
|
}
|
|
|
|
function $stamp(this$static){
|
|
var i, p, vsc;
|
|
vsc = 0;
|
|
for (i = 0; i != this$static.getPostCount_0(); i++) {
|
|
p = this$static.pins[i];
|
|
if (p.output) {
|
|
$stampVoltageSource(ground, this$static.nodes[i], p.voltSource);
|
|
++vsc;
|
|
}
|
|
}
|
|
vsc != this$static.getVoltageSourceCount() && (console.log('voltage source count does not match number of outputs') , undefined);
|
|
}
|
|
|
|
function $startIteration(this$static){
|
|
var i, p;
|
|
for (i = 0; i != this$static.getPostCount_0(); i++) {
|
|
p = this$static.pins[i];
|
|
p.output || (p.value_0 = this$static.volts[i] > this$static.highVoltage / 2);
|
|
}
|
|
this$static.execute_3();
|
|
}
|
|
|
|
function $undumpXml_0(this$static, xml){
|
|
var i, stateRestore;
|
|
stateRestore = $parseStringAttr(xml, 'ix', null) != null;
|
|
stateRestore || (this$static.flags = 0);
|
|
this$static.flags = $parseIntAttr(xml, 'f', this$static.flags);
|
|
this$static.bits = $parseIntAttr(xml, 'bi', this$static.bits);
|
|
this$static.highVoltage = $parseDoubleAttr(xml, 'hv', this$static.highVoltage);
|
|
this$static.bitOrder = $parseIntAttr(xml, 'bo', this$static.bitOrder);
|
|
if (!stateRestore) {
|
|
this$static.setupPins();
|
|
$setSize_0(this$static, (this$static.flags & 1) != 0?1:2);
|
|
}
|
|
for (i = 0; i != this$static.getPostCount_0(); i++) {
|
|
this$static.volts[i] = $parseDoubleAttr(xml, 'v' + i, 0);
|
|
this$static.pins != null && (this$static.pins[i].value_0 = this$static.volts[i] > this$static.highVoltage / 2);
|
|
}
|
|
}
|
|
|
|
function $writeOutput(this$static, n, value_0){
|
|
this$static.pins[n].output || (console.log('pin ' + n + ' is not an output!') , undefined);
|
|
this$static.pins[n].value_0 = value_0;
|
|
}
|
|
|
|
function ChipElm(xx, yy){
|
|
$clinit_ChipElm();
|
|
CircuitElm.call(this, xx, yy);
|
|
this.needsBits() && (this.bits = this.defaultBitCount());
|
|
this.highVoltage = 5;
|
|
this.noDiagonal = true;
|
|
this.setupPins();
|
|
$setSize_0(this, app_0.menus.smallGridCheckItem.on?1:2);
|
|
}
|
|
|
|
function ChipElm_0(xa, ya, xb, yb, f, st){
|
|
$clinit_ChipElm();
|
|
var i;
|
|
CircuitElm_0.call(this, xa, ya, xb, yb, f);
|
|
this.needsBits() && ($hasMoreTokens(st)?(this.bits = (new Integer_0($nextToken(st))).value_0):(this.bits = this.defaultBitCount()));
|
|
this.highVoltage = (this.flags & 8192) != 0?__parseAndValidateDouble($nextToken(st)):5;
|
|
this.noDiagonal = true;
|
|
this.setupPins();
|
|
$setSize_0(this, (f & 1) != 0?1:2);
|
|
for (i = 0; i != this.getPostCount_0(); i++) {
|
|
if (this.pins == null)
|
|
this.volts[i] = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
else if (this.pins[i].state) {
|
|
this.volts[i] = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.pins[i].value_0 = this.volts[i] > this.highVoltage / 2;
|
|
}
|
|
}
|
|
}
|
|
|
|
function readBits(st, output){
|
|
var bitIndex, i, integer;
|
|
integer = 0;
|
|
bitIndex = $intern_0;
|
|
for (i = 0; i < output.length; i++) {
|
|
if (bitIndex >= 32)
|
|
if ($hasMoreTokens(st)) {
|
|
integer = __parseAndValidateInt($nextToken(st), 10);
|
|
bitIndex = 0;
|
|
}
|
|
else
|
|
break;
|
|
output[i] = (integer & 1 << bitIndex) != 0;
|
|
++bitIndex;
|
|
}
|
|
}
|
|
|
|
function readBitsFromString(s, output){
|
|
var bitIndex, i, integer, st;
|
|
st = new StringTokenizer_0(s, ' ');
|
|
integer = 0;
|
|
bitIndex = $intern_0;
|
|
for (i = 0; i < output.length; i++) {
|
|
if (bitIndex >= 32)
|
|
if ($hasMoreTokens(st)) {
|
|
integer = __parseAndValidateInt($nextToken(st), 10);
|
|
bitIndex = 0;
|
|
}
|
|
else
|
|
break;
|
|
output[i] = (integer & 1 << bitIndex) != 0;
|
|
++bitIndex;
|
|
}
|
|
}
|
|
|
|
function writeBitsToString(data_0){
|
|
var bitIndex, i, integer, sb;
|
|
sb = new StringBuilder;
|
|
integer = 0;
|
|
bitIndex = 0;
|
|
for (i = 0; i < data_0.length; i++) {
|
|
if (bitIndex >= 32) {
|
|
sb.string.length > 0 && (sb.string += ' ' , sb);
|
|
sb.string += integer;
|
|
integer = 0;
|
|
bitIndex = 0;
|
|
}
|
|
data_0[i] && (integer |= 1 << bitIndex);
|
|
++bitIndex;
|
|
}
|
|
sb.string.length > 0 && (sb.string += ' ' , sb);
|
|
sb.string += integer;
|
|
return sb.string;
|
|
}
|
|
|
|
defineClass(32, 8, $intern_85);
|
|
_.addRoutingObstacle = function addRoutingObstacle_2(router){
|
|
$addRoutingObstacle(this, router);
|
|
}
|
|
;
|
|
_.allowBus = function allowBus(){
|
|
return false;
|
|
}
|
|
;
|
|
_.defaultBitCount = function defaultBitCount(){
|
|
return 4;
|
|
}
|
|
;
|
|
_.doStep = function doStep_2(){
|
|
$doStep(this);
|
|
}
|
|
;
|
|
_.drag = function drag_0(xx, yy){
|
|
yy = $snapGrid_0(app_0, yy);
|
|
if (xx < this.x_0)
|
|
;
|
|
else {
|
|
this.y_0 = this.y2 = yy;
|
|
this.x2 = min_1($snapGrid_0(app_0, xx), this.x_0 + (this.sizeX + 1) * this.cspc2);
|
|
}
|
|
$setPoints_0(this);
|
|
}
|
|
;
|
|
_.draw = function draw_2(g){
|
|
$drawChip(this, g);
|
|
}
|
|
;
|
|
_.drawLabel = function drawLabel(g, x_0, y_0){
|
|
}
|
|
;
|
|
_.dumpXml = function dumpXml_1(doc, elem){
|
|
$dumpXml_0(this, elem);
|
|
}
|
|
;
|
|
_.dumpXmlState = function dumpXmlState_0(doc, elem){
|
|
$dumpXmlState(this, elem);
|
|
}
|
|
;
|
|
_.execute_3 = function execute_14(){
|
|
}
|
|
;
|
|
_.flipX = function flipX_1(center2, count){
|
|
var xs;
|
|
this.flags ^= $intern_24;
|
|
if (count != 1) {
|
|
xs = (this.flippedSizeX + 1) * this.cspc2;
|
|
this.x_0 = center2 - this.x_0 - xs;
|
|
this.x2 = center2 - this.x2;
|
|
}
|
|
$setPoints_0(this);
|
|
}
|
|
;
|
|
_.flipXY = function flipXY_0(xmy, count){
|
|
this.flags ^= $intern_42;
|
|
(this.flags & $intern_24) != 0 != ((this.flags & $intern_43) != 0) && (this.flags ^= 3072);
|
|
if (count != 1) {
|
|
this.x_0 += this.cspc2;
|
|
$flipXY(this, xmy);
|
|
this.x_0 -= this.cspc2;
|
|
}
|
|
$setPoints_0(this);
|
|
}
|
|
;
|
|
_.flipY = function flipY_1(center2, count){
|
|
var ys;
|
|
this.flags ^= $intern_43;
|
|
if (count != 1) {
|
|
ys = (this.flippedSizeY - 1) * this.cspc2;
|
|
this.y_0 = center2 - this.y_0 - ys;
|
|
this.y2 = center2 - this.y2;
|
|
}
|
|
$setPoints_0(this);
|
|
}
|
|
;
|
|
_.getChipEditInfo = function getChipEditInfo(n){
|
|
return null;
|
|
}
|
|
;
|
|
_.getChipName = function getChipName(){
|
|
return 'chip';
|
|
}
|
|
;
|
|
_.getConnection = function getConnection_0(n1, n2){
|
|
return false;
|
|
}
|
|
;
|
|
_.getCurrentIntoNode = function getCurrentIntoNode_0(n){
|
|
if (n < 0 || n >= this.pins.length)
|
|
return 0;
|
|
return this.pins[n].current;
|
|
}
|
|
;
|
|
_.getEditInfo = function getEditInfo_1(n){
|
|
var ei;
|
|
if (this.isDigitalChip()) {
|
|
if (n == 0)
|
|
return $setUnitStep(new EditInfo('High Logic Voltage', this.highVoltage));
|
|
--n;
|
|
}
|
|
if (this.allowBus()) {
|
|
if (n == 0) {
|
|
ei = new EditInfo_0('Bit Order', 0, -1, -1);
|
|
ei.choice = new Choice;
|
|
$addItem(ei.choice, LS('MSB First'));
|
|
$addItem(ei.choice, LS('LSB First'));
|
|
$addItem(ei.choice, LS('Bus'));
|
|
$select(ei.choice, this.bitOrder);
|
|
return ei;
|
|
}
|
|
--n;
|
|
}
|
|
return this.getChipEditInfo(n);
|
|
}
|
|
;
|
|
_.getInfo_0 = function getInfo_1(arr){
|
|
$getInfo_0(this, arr);
|
|
}
|
|
;
|
|
_.getNumHandles = function getNumHandles_0(){
|
|
return 0;
|
|
}
|
|
;
|
|
_.getPost = function getPost_0(n){
|
|
return $getPost_0(this, n);
|
|
}
|
|
;
|
|
_.getPostWidth = function getPostWidth_0(n){
|
|
return $getPostWidth(this, n);
|
|
}
|
|
;
|
|
_.hasGroundConnection = function hasGroundConnection_1(n1){
|
|
return this.pins[n1].output;
|
|
}
|
|
;
|
|
_.initBoundingBox = function initBoundingBox_0(){
|
|
var fsx, fsy, xr, xs, yr, ys;
|
|
this.boundingBox = new Rectangle;
|
|
$setBounds(this.boundingBox, min_1(this.x_0, this.x2), min_1(this.y_0, this.y2), abs_0(this.x2 - this.x_0) + 1, abs_0(this.y2 - this.y_0) + 1);
|
|
if (this.pins == null || this.cspc == 0)
|
|
return;
|
|
xr = this.x_0 + this.cspc2 - this.cspc;
|
|
yr = this.y_0 - this.cspc;
|
|
fsx = (this.flags & $intern_42) != 0?this.sizeY:this.sizeX;
|
|
fsy = (this.flags & $intern_42) != 0?this.sizeX:this.sizeY;
|
|
xs = fsx * this.cspc2;
|
|
ys = fsy * this.cspc2;
|
|
$setBbox(this, xr, yr, xr + xs, yr + ys);
|
|
}
|
|
;
|
|
_.isDigitalChip = function isDigitalChip(){
|
|
return true;
|
|
}
|
|
;
|
|
_.needsBits = function needsBits(){
|
|
return false;
|
|
}
|
|
;
|
|
_.reset_0 = function reset_2(){
|
|
$reset_0(this);
|
|
}
|
|
;
|
|
_.setChipEditValue = function setChipEditValue(n, ei){
|
|
}
|
|
;
|
|
_.setCurrent = function setCurrent_0(vs, c){
|
|
var i;
|
|
for (i = 0; i != this.getPostCount_0(); i++)
|
|
this.pins[i].output && this.pins[i].voltSource == vs && (this.pins[i].current = c);
|
|
}
|
|
;
|
|
_.setEditValue = function setEditValue_1(n, ei){
|
|
$setEditValue(this, n, ei);
|
|
}
|
|
;
|
|
_.setHighVoltage = function setHighVoltage_0(hv){
|
|
this.highVoltage = hv;
|
|
}
|
|
;
|
|
_.setPoints = function setPoints_2(){
|
|
$setPoints_0(this);
|
|
}
|
|
;
|
|
_.setVoltageSource = function setVoltageSource_2(j, vs){
|
|
$setVoltageSource(this, j, vs);
|
|
}
|
|
;
|
|
_.stamp = function stamp_2(){
|
|
$stamp(this);
|
|
}
|
|
;
|
|
_.startIteration = function startIteration_0(){
|
|
$startIteration(this);
|
|
}
|
|
;
|
|
_.undumpXml = function undumpXml_1(xml){
|
|
$undumpXml_0(this, xml);
|
|
}
|
|
;
|
|
_.validate = function validate_2(){
|
|
var i;
|
|
for (i = 0; i != this.getPostCount_0(); i++)
|
|
if (this.pins[i].output && !$validateRailNode(this, i))
|
|
return false;
|
|
return true;
|
|
}
|
|
;
|
|
_.bitOrder = 0;
|
|
_.bits = 0;
|
|
_.csize = 0;
|
|
_.cspc = 0;
|
|
_.cspc2 = 0;
|
|
_.flippedSizeX = 0;
|
|
_.flippedSizeY = 0;
|
|
_.highVoltage = 0;
|
|
_.labelX = 0;
|
|
_.labelY = 0;
|
|
_.lastClock = false;
|
|
_.sizeX = 0;
|
|
_.sizeY = 0;
|
|
var sideFlipXY;
|
|
var Lcom_lushprojects_circuitjs1_client_ChipElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ChipElm', 32);
|
|
function $setupPins(this$static){
|
|
var bitsY;
|
|
this$static.sizeX = 2;
|
|
bitsY = this$static.bitOrder == 2?1:this$static.bits > 2?this$static.bits:2;
|
|
this$static.sizeY = bitsY > 2?bitsY:2;
|
|
this$static.pins = initUnidimensionalArray(Lcom_lushprojects_circuitjs1_client_ChipElm$Pin_2_classLit, $intern_3, 9, this$static.bits + 2, 0, 1);
|
|
$makeBitPins(this$static, this$static.bits, 0, 3, 0, 'D', true, false, false);
|
|
this$static.pins[this$static.bits] = new ChipElm$Pin(this$static, 0, 2, 'In');
|
|
this$static.pins[this$static.bits + 1] = new ChipElm$Pin(this$static, this$static.sizeY - 1, 2, 'V+');
|
|
$allocNodes(this$static);
|
|
}
|
|
|
|
function ADCElm(xx, yy){
|
|
$clinit_ChipElm();
|
|
ChipElm.call(this, xx, yy);
|
|
}
|
|
|
|
function ADCElm_0(xa, ya, xb, yb, f, st){
|
|
$clinit_ChipElm();
|
|
ChipElm_0.call(this, xa, ya, xb, yb, f, st);
|
|
}
|
|
|
|
defineClass(392, 32, $intern_85, ADCElm, ADCElm_0);
|
|
_.allowBus = function allowBus_0(){
|
|
return true;
|
|
}
|
|
;
|
|
_.execute_3 = function execute_15(){
|
|
var i, imax, ival, val;
|
|
imax = (1 << this.bits) - 1;
|
|
val = imax * this.volts[this.bits] / this.volts[this.bits + 1];
|
|
ival = round_int(val);
|
|
ival = imax < (0 > ival?0:ival)?imax:0 > ival?0:ival;
|
|
for (i = 0; i != this.bits; i++)
|
|
this.pins[i].value_0 = (ival & 1 << i) != 0;
|
|
}
|
|
;
|
|
_.getChipEditInfo = function getChipEditInfo_0(n){
|
|
if (n == 0)
|
|
return $setDimensionless(new EditInfo_0('# of Bits', this.bits, 1, 1));
|
|
return null;
|
|
}
|
|
;
|
|
_.getChipName = function getChipName_0(){
|
|
return 'ADC';
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_2(){
|
|
return 167;
|
|
}
|
|
;
|
|
_.getPostCount_0 = function getPostCount_1(){
|
|
return this.bits + 2;
|
|
}
|
|
;
|
|
_.getVoltageSourceCount = function getVoltageSourceCount_1(){
|
|
return this.bits;
|
|
}
|
|
;
|
|
_.isDigitalChip = function isDigitalChip_0(){
|
|
return false;
|
|
}
|
|
;
|
|
_.needsBits = function needsBits_0(){
|
|
return true;
|
|
}
|
|
;
|
|
_.setChipEditValue = function setChipEditValue_0(n, ei){
|
|
if (n == 0) {
|
|
if (ei.value_0 >= 2) {
|
|
this.bits = round_int(ei.value_0);
|
|
$setupPins(this);
|
|
$setPoints_0(this);
|
|
}
|
|
else
|
|
ei.error = 'must be >= 2';
|
|
}
|
|
}
|
|
;
|
|
_.setupPins = function setupPins(){
|
|
$setupPins(this);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_ADCElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ADCElm', 392);
|
|
function $drawWaveform_0(this$static, g, center){
|
|
var xc, yc;
|
|
$setColor_0(g, mouseElmRef == this$static || this$static.selected_0 || $containsKey(app_0.mouse.scopePlotRoles, this$static) || instanceOf(mouseElmRef, 21) && $getElm_0(mouseElmRef.elmScope) == this$static || $isOnHighlightedNet(this$static)?selectColor_0:($clinit_Color() , gray));
|
|
$setPowerColor_0(this$static, g);
|
|
xc = center.x_0;
|
|
yc = center.y_0;
|
|
drawThickCircle(g, xc, yc, 17);
|
|
$adjustBbox(this$static, xc - 17, yc - 17, xc + 17, yc + 17);
|
|
}
|
|
|
|
function AMElm(xx, yy){
|
|
CircuitElm.call(this, xx, yy);
|
|
this.maxVoltage = 5;
|
|
this.carrierfreq = $intern_22;
|
|
this.signalfreq = 40;
|
|
this.freqTimeZero = 0;
|
|
this.curcount_0 = 0;
|
|
}
|
|
|
|
function AMElm_0(xa, ya, xb, yb, f, st){
|
|
CircuitElm_0.call(this, xa, ya, xb, yb, f);
|
|
this.carrierfreq = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.signalfreq = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.maxVoltage = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
(this.flags & 2) != 0 && (this.flags &= -3);
|
|
this.freqTimeZero = 0;
|
|
this.curcount_0 = 0;
|
|
}
|
|
|
|
defineClass(403, 8, $intern_85, AMElm, AMElm_0);
|
|
_.doStep = function doStep_3(){
|
|
var w;
|
|
$updateVoltageSource(this.voltSource, (w = $intern_2 * (sim_0.t - this.freqTimeZero) , ($wnd.Math.sin(w * this.signalfreq) + 1) / 2 * $wnd.Math.sin(w * this.carrierfreq) * this.maxVoltage));
|
|
}
|
|
;
|
|
_.draw = function draw_3(g){
|
|
var f, w;
|
|
$setBbox_0(this, this.point1, this.point2, 17);
|
|
$setVoltageColor(this, g, this.volts[0]);
|
|
drawThickLine_0(g, this.point1, this.lead1, 3);
|
|
f = new Font('SansSerif', 0, 12);
|
|
$setFont_0(g, f);
|
|
$setColor_0(g, mouseElmRef == this || this.selected_0 || $containsKey(app_0.mouse.scopePlotRoles, this) || instanceOf(mouseElmRef, 21) && $getElm_0(mouseElmRef.elmScope) == this || $isOnHighlightedNet(this)?selectColor_0:whiteColor);
|
|
$setPowerColor_0(this, g);
|
|
w = $intern_2 * (sim_0.t - this.freqTimeZero);
|
|
($wnd.Math.sin(w * this.signalfreq) + 1) / 2 * $wnd.Math.sin(w * this.carrierfreq) * this.maxVoltage;
|
|
$drawCenteredText(this, g, 'AM', this.x2, this.y2, true);
|
|
$drawWaveform_0(this, g, this.point2);
|
|
$drawPosts(this, g);
|
|
this.curcount_0 = $updateDotCount(-this.current_0, this.curcount_0);
|
|
app_0.mouse.dragElm == this || $drawDots(g, this.point1, this.lead1, this.curcount_0);
|
|
}
|
|
;
|
|
_.dumpXml = function dumpXml_2(doc, elem){
|
|
dumpAttr_1(elem, 'x', this.x_0 + ' ' + this.y_0 + ' ' + this.x2 + ' ' + this.y2);
|
|
dumpAttr_0(elem, 'f', this.flags);
|
|
dumpAttr(elem, 'cf', this.carrierfreq);
|
|
dumpAttr(elem, 'sf', this.signalfreq);
|
|
dumpAttr(elem, 'mv', this.maxVoltage);
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_3(){
|
|
return 200;
|
|
}
|
|
;
|
|
_.getEditInfo = function getEditInfo_2(n){
|
|
if (n == 0)
|
|
return $setUnitStep(new EditInfo_0('Max Voltage', this.maxVoltage, -20, 20));
|
|
if (n == 1)
|
|
return new EditInfo_0('Carrier Frequency (Hz)', this.carrierfreq, 4, 500);
|
|
if (n == 2)
|
|
return new EditInfo_0('Signal Frequency (Hz)', this.signalfreq, 4, 500);
|
|
return null;
|
|
}
|
|
;
|
|
_.getInfo_0 = function getInfo_2(arr){
|
|
arr[0] = 'AM Source';
|
|
arr[1] = 'I = ' + getUnitText(this.current_0, 'A', false);
|
|
arr[2] = 'V = ' + getUnitText(this.volts[0], 'V', false);
|
|
arr[3] = 'cf = ' + getUnitText(this.carrierfreq, 'Hz', false);
|
|
arr[4] = 'sf = ' + getUnitText(this.signalfreq, 'Hz', false);
|
|
arr[5] = 'Vmax = ' + getUnitText(this.maxVoltage, 'V', false);
|
|
}
|
|
;
|
|
_.getPostCount_0 = function getPostCount_2(){
|
|
return 1;
|
|
}
|
|
;
|
|
_.getPower = function getPower_1(){
|
|
return -this.volts[0] * this.current_0;
|
|
}
|
|
;
|
|
_.getVoltageDiff_0 = function getVoltageDiff_2(){
|
|
return this.volts[0];
|
|
}
|
|
;
|
|
_.getVoltageSourceCount = function getVoltageSourceCount_2(){
|
|
return 1;
|
|
}
|
|
;
|
|
_.hasGroundConnection = function hasGroundConnection_2(n1){
|
|
return true;
|
|
}
|
|
;
|
|
_.reset_0 = function reset_3(){
|
|
this.freqTimeZero = 0;
|
|
this.curcount_0 = 0;
|
|
}
|
|
;
|
|
_.setEditValue = function setEditValue_2(n, ei){
|
|
n == 0 && (this.maxVoltage = ei.value_0);
|
|
n == 1 && (this.carrierfreq = ei.value_0);
|
|
n == 2 && (this.signalfreq = ei.value_0);
|
|
}
|
|
;
|
|
_.setPoints = function setPoints_3(){
|
|
$setPoints(this);
|
|
this.lead1 = $interpPoint(this.point1, this.point2, 1 - 17 / this.dn);
|
|
}
|
|
;
|
|
_.stamp = function stamp_3(){
|
|
$stampVoltageSource(ground, this.nodes[0], this.voltSource);
|
|
}
|
|
;
|
|
_.undumpXml = function undumpXml_2(xml){
|
|
this.flags = $parseIntAttr(xml, 'f', this.flags);
|
|
this.carrierfreq = $parseDoubleAttr(xml, 'cf', this.carrierfreq);
|
|
this.signalfreq = $parseDoubleAttr(xml, 'sf', this.signalfreq);
|
|
this.maxVoltage = $parseDoubleAttr(xml, 'mv', this.maxVoltage);
|
|
this.freqTimeZero = 0;
|
|
this.curcount_0 = 0;
|
|
}
|
|
;
|
|
_.validate = function validate_3(){
|
|
return $validateRailNode(this, 0);
|
|
}
|
|
;
|
|
_.carrierfreq = 0;
|
|
_.freqTimeZero = 0;
|
|
_.maxVoltage = 0;
|
|
_.signalfreq = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_AMElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'AMElm', 403);
|
|
function AboutBox(){
|
|
var sstor;
|
|
PopupPanel.call(this);
|
|
sstor = (!sessionStorage_0 && ($clinit_Storage$StorageSupportDetector() , sessionStorageSupported) && (sessionStorage_0 = new Storage_0('sessionStorage')) , sessionStorage_0);
|
|
$setItem_0(sstor.storage, 'versionString', '4.1.4js');
|
|
this.vp = new VerticalPanel;
|
|
$setWidget_0(this, this.vp);
|
|
$setWidth(this.vp, '400px');
|
|
$add_5(this.vp, new HTML_0('<iframe src="about.html" width="400" height="430" scrolling="auto" frameborder="0"><\/iframe><br>'));
|
|
$add_5(this.vp, this.okButton = new Button_1('OK'));
|
|
$addDomHandler(this.okButton, new AboutBox$1(this), ($clinit_ClickEvent() , $clinit_ClickEvent() , TYPE_1));
|
|
$center(this);
|
|
$show(this);
|
|
}
|
|
|
|
defineClass(684, 48, $intern_57, AboutBox);
|
|
var Lcom_lushprojects_circuitjs1_client_AboutBox_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'AboutBox', 684);
|
|
function AboutBox$1(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(685, 1, $intern_56, AboutBox$1);
|
|
_.onClick = function onClick_0(event_0){
|
|
$hide(this.this$01, false);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_AboutBox$1_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'AboutBox/1', 685);
|
|
function $createSlider(this$static, sim){
|
|
var ei, value_0;
|
|
if (!this$static.elm)
|
|
return false;
|
|
ei = this$static.elm.getEditInfo(this$static.editItem);
|
|
if (!ei)
|
|
return false;
|
|
if (this$static.sharedSlider)
|
|
return true;
|
|
if (this$static.sliderText.length == 0)
|
|
return false;
|
|
value_0 = ei.value_0;
|
|
$createSlider_0(this$static, sim, value_0);
|
|
return true;
|
|
}
|
|
|
|
function $createSlider_0(this$static, sim, value_0){
|
|
var intValue;
|
|
$addWidgetToVerticalPanel(sim, this$static.label_0 = new Label_1(LS(this$static.sliderText)));
|
|
$addStyleName(this$static.label_0, 'topSpace');
|
|
intValue = $valueToSliderPosition(this$static, value_0);
|
|
$addWidgetToVerticalPanel(sim, this$static.slider = new Scrollbar_1(intValue, this$static, this$static.elm));
|
|
$setStepSize(this$static.slider, this$static.sliderStep * 100 / (this$static.maxValue - this$static.minValue));
|
|
}
|
|
|
|
function $deleteSlider(this$static, sim){
|
|
try {
|
|
$removeWidgetFromVerticalPanel(sim, this$static.label_0);
|
|
$removeWidgetFromVerticalPanel(sim, this$static.slider);
|
|
}
|
|
catch ($e0) {
|
|
$e0 = toJava($e0);
|
|
if (!instanceOf($e0, 13))
|
|
throw toJs($e0);
|
|
}
|
|
}
|
|
|
|
function $dumpXml_1(this$static, doc, root, app){
|
|
var ae, ei;
|
|
ae = $createElement(doc, 'adj');
|
|
dumpAttr_0(ae, 'e', $locateElm(app, this$static.elm));
|
|
dumpAttr_0(ae, 'ei', this$static.editItem);
|
|
dumpAttr_1(ae, 'en', (ei = this$static.elm.getEditInfo(this$static.editItem) , ei?ei.name_0:''));
|
|
dumpAttr(ae, 'mn', this$static.minValue);
|
|
dumpAttr(ae, 'mx', this$static.maxValue);
|
|
dumpAttr_1(ae, 'st', this$static.sliderText);
|
|
this$static.sliderStep > 0 && dumpAttr(ae, 'stp', this$static.sliderStep);
|
|
!!this$static.sharedSlider && dumpAttr_0(ae, 'ss', $indexOf_4(app.adjustables, this$static.sharedSlider));
|
|
this$static.logarithmic && (checkAttr(ae, 'log') , $setAttribute_0(ae, 'log', '1'));
|
|
$appendChild_0(root, ae);
|
|
}
|
|
|
|
function $setMouseElm(this$static){
|
|
!!this$static.slider && $draw_6(this$static.slider);
|
|
}
|
|
|
|
function $setSliderValue(this$static, value_0){
|
|
var intValue;
|
|
if (this$static.sharedSlider) {
|
|
$setSliderValue(this$static.sharedSlider, value_0);
|
|
return;
|
|
}
|
|
intValue = $valueToSliderPosition(this$static, value_0);
|
|
this$static.settingValue = true;
|
|
$setValue_2(this$static.slider, intValue);
|
|
this$static.settingValue = false;
|
|
}
|
|
|
|
function $sliderBeingShared(this$static){
|
|
var adj, i;
|
|
for (i = 0; i != theApp.adjustables.arrayList.array.length; i++) {
|
|
adj = $get_4(theApp.adjustables, i);
|
|
if (adj.sharedSlider == this$static)
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
function $sliderPositionToValue(this$static, pos){
|
|
var logMax, logMin;
|
|
if (this$static.logarithmic && this$static.minValue > 0) {
|
|
logMin = $wnd.Math.log(this$static.minValue);
|
|
logMax = $wnd.Math.log(this$static.maxValue);
|
|
return $wnd.Math.exp(logMin + (logMax - logMin) * pos / 100);
|
|
}
|
|
return this$static.minValue + (this$static.maxValue - this$static.minValue) * pos / 100;
|
|
}
|
|
|
|
function $valueToSliderPosition(this$static, value_0){
|
|
var logMax, logMin;
|
|
if (this$static.logarithmic && this$static.minValue > 0) {
|
|
logMin = $wnd.Math.log(this$static.minValue);
|
|
logMax = $wnd.Math.log(this$static.maxValue);
|
|
return round_int(($wnd.Math.log(value_0) - logMin) / (logMax - logMin) * 100);
|
|
}
|
|
return round_int((value_0 - this$static.minValue) * 100 / (this$static.maxValue - this$static.minValue));
|
|
}
|
|
|
|
function Adjustable(ce, item_0){
|
|
var ei;
|
|
this.minValue = 1;
|
|
this.maxValue = $intern_22;
|
|
this.flags = 0;
|
|
this.elm = ce;
|
|
this.editItem = item_0;
|
|
ei = ce.getEditInfo(this.editItem);
|
|
if (!!ei && ei.maxVal > 0) {
|
|
this.minValue = ei.minVal;
|
|
this.maxValue = ei.maxVal;
|
|
}
|
|
}
|
|
|
|
function Adjustable_0(st, sim){
|
|
var ano, e, ei;
|
|
e = __parseAndValidateInt($nextToken(st), 10);
|
|
if (e == -1)
|
|
return;
|
|
try {
|
|
ei = $nextToken(st);
|
|
if ($equals_1(ei.substr(0, 1), 'F')) {
|
|
this.flags = __parseAndValidateInt(ei.substr(1), 10);
|
|
ei = $nextToken(st);
|
|
}
|
|
this.editItem = __parseAndValidateInt(ei, 10);
|
|
this.minValue = __parseAndValidateDouble($nextToken(st));
|
|
this.maxValue = __parseAndValidateDouble($nextToken(st));
|
|
if ((this.flags & 1) != 0) {
|
|
ano = __parseAndValidateInt($nextToken(st), 10);
|
|
this.sharedSlider = ano == -1?null:$get_4(sim.adjustables, ano);
|
|
}
|
|
this.sliderText = unescape_0($nextToken(st));
|
|
}
|
|
catch ($e0) {
|
|
$e0 = toJava($e0);
|
|
if (!instanceOf($e0, 13))
|
|
throw toJs($e0);
|
|
}
|
|
this.logarithmic = (this.flags & 2) != 0;
|
|
try {
|
|
this.sliderStep = __parseAndValidateDouble($nextToken(st));
|
|
}
|
|
catch ($e1) {
|
|
$e1 = toJava($e1);
|
|
if (!instanceOf($e1, 13))
|
|
throw toJs($e1);
|
|
}
|
|
try {
|
|
this.elm = $getElm(sim, e);
|
|
}
|
|
catch ($e2) {
|
|
$e2 = toJava($e2);
|
|
if (!instanceOf($e2, 13))
|
|
throw toJs($e2);
|
|
}
|
|
}
|
|
|
|
function findEditItemByName(elm, name_0, fallbackIndex){
|
|
var ei, i;
|
|
if (name_0 != null && name_0.length > 0) {
|
|
for (i = 0;; i++) {
|
|
ei = elm.getEditInfo(i);
|
|
if (!ei)
|
|
break;
|
|
if ($equals_1(name_0, ei.name_0))
|
|
return i;
|
|
}
|
|
}
|
|
return fallbackIndex;
|
|
}
|
|
|
|
function reorderAdjustables(){
|
|
var adj, i, newList, oldList;
|
|
newList = new Vector;
|
|
oldList = theApp.adjustables;
|
|
for (i = 0; i != oldList.arrayList.array.length; i++) {
|
|
adj = (checkArrayElementIndex(i, oldList.arrayList.array.length) , $get_2(oldList.arrayList, i));
|
|
!adj.sharedSlider && $add_8(newList.arrayList, adj);
|
|
}
|
|
for (i = 0; i != oldList.arrayList.array.length; i++) {
|
|
adj = (checkArrayElementIndex(i, oldList.arrayList.array.length) , $get_2(oldList.arrayList, i));
|
|
!!adj.sharedSlider && $add_8(newList.arrayList, adj);
|
|
}
|
|
theApp.adjustables = newList;
|
|
}
|
|
|
|
function undumpXml_3(xml, app){
|
|
var adj, e, ei, elm, en, item_0, ss;
|
|
e = $parseIntAttr(xml, 'e', -1);
|
|
if (e == -1)
|
|
return;
|
|
ei = $parseIntAttr(xml, 'ei', 0);
|
|
en = $parseStringAttr(xml, 'en', null);
|
|
elm = $getElm(app, e);
|
|
item_0 = findEditItemByName(elm, en, ei);
|
|
adj = new Adjustable(elm, item_0);
|
|
adj.minValue = $parseDoubleAttr(xml, 'mn', 1);
|
|
adj.maxValue = $parseDoubleAttr(xml, 'mx', $intern_22);
|
|
adj.sliderText = $parseStringAttr(xml, 'st', '');
|
|
adj.sliderStep = $parseDoubleAttr(xml, 'stp', 0);
|
|
ss = $parseIntAttr(xml, 'ss', -1);
|
|
ss != -1 && (adj.sharedSlider = $get_4(app.adjustables, ss));
|
|
adj.logarithmic = $parseIntAttr(xml, 'log', 0) != 0;
|
|
$add_11(app.adjustables, adj);
|
|
}
|
|
|
|
defineClass(263, 1, {263:1}, Adjustable, Adjustable_0);
|
|
_.execute_1 = function execute_16(){
|
|
var adj, i, sim, ei, val, result, step;
|
|
if (this.settingValue)
|
|
return;
|
|
sim = theApp;
|
|
for (i = 0; i != sim.adjustables.arrayList.array.length; i++) {
|
|
adj = $get_4(sim.adjustables, i);
|
|
(adj == this || adj.sharedSlider == this) && (theApp.analyzeFlag = true , ei = adj.elm.getEditInfo(adj.editItem) , ei.value_0 = (val = !adj.sharedSlider?adj.slider.val_0:adj.sharedSlider.slider.val_0 , result = $sliderPositionToValue(adj, val) , step = adj.sharedSlider?adj.sharedSlider.sliderStep:adj.sliderStep , step > 0 && (result = adj.minValue + toDouble_0(fromDouble_0($wnd.Math.round((result - adj.minValue) / step))) * step) , result) , adj.elm.setEditValue(adj.editItem, ei) , $repaint(theApp.ui) , undefined);
|
|
}
|
|
}
|
|
;
|
|
_.editItem = 0;
|
|
_.flags = 0;
|
|
_.logarithmic = false;
|
|
_.maxValue = 0;
|
|
_.minValue = 0;
|
|
_.settingValue = false;
|
|
_.sliderStep = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_Adjustable_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'Adjustable', 263);
|
|
function $$init_1(this$static){
|
|
this$static.zerocount = 0;
|
|
this$static.rmsI = 0;
|
|
this$static.maxI = 0;
|
|
this$static.minI = 0;
|
|
this$static.selectedValue = 0;
|
|
this$static.increasingI = true;
|
|
this$static.decreasingI = true;
|
|
}
|
|
|
|
function AmmeterElm(xx, yy){
|
|
CircuitElm.call(this, xx, yy);
|
|
$$init_1(this);
|
|
this.flags = 3;
|
|
this.scale_0 = 0;
|
|
}
|
|
|
|
function AmmeterElm_0(xa, ya, xb, yb, f, st){
|
|
CircuitElm_0.call(this, xa, ya, xb, yb, f);
|
|
$$init_1(this);
|
|
this.scale_0 = 0;
|
|
this.meter = __parseAndValidateInt($nextToken(st), 10);
|
|
try {
|
|
this.scale_0 = __parseAndValidateInt($nextToken(st), 10);
|
|
}
|
|
catch ($e0) {
|
|
$e0 = toJava($e0);
|
|
if (!instanceOf($e0, 13))
|
|
throw toJs($e0);
|
|
}
|
|
}
|
|
|
|
defineClass(428, 8, $intern_85, AmmeterElm, AmmeterElm_0);
|
|
_.draw = function draw_4(g){
|
|
var plusPoint, s, w, width_0;
|
|
$setVoltageColor(this, g, this.volts[0]);
|
|
width_0 = 4;
|
|
if ((this.flags & 2) != 0) {
|
|
$calcLeads(this, 24);
|
|
$setVoltageColor(this, g, this.volts[0]);
|
|
drawThickLine_0(g, this.point1, this.lead1, 3);
|
|
drawThickLine_0(g, this.lead2, this.point2, 3);
|
|
$setColor_0(g, mouseElmRef == this || this.selected_0 || $containsKey(app_0.mouse.scopePlotRoles, this) || instanceOf(mouseElmRef, 21) && $getElm_0(mouseElmRef.elmScope) == this || $isOnHighlightedNet(this)?selectColor_0:lightGrayColor);
|
|
drawThickCircle(g, this.center.x_0, this.center.y_0, 12);
|
|
$drawCenteredText(this, g, 'A', this.center.x_0, this.center.y_0, true);
|
|
$setColor_0(g, whiteColor);
|
|
$setFont_0(g, unitsFont);
|
|
plusPoint = $interpPoint_0(this.point1, this.point2, (this.dn / 2 - 12 - 4) / this.dn, -10 * this.dsign);
|
|
this.y2 > this.y_0 && (plusPoint.y_0 += 4);
|
|
this.y_0 > this.y2 && (plusPoint.y_0 += 3);
|
|
w = round_int(g.context.measureText('+').width);
|
|
$drawString(g, '+', plusPoint.x_0 - (w / 2 | 0), plusPoint.y_0);
|
|
width_0 = 12;
|
|
}
|
|
else {
|
|
drawThickLine_0(g, this.point1, this.point2, 3);
|
|
$fillPolygon(g, this.arrowPoly);
|
|
}
|
|
this.curcount_0 = $updateDotCount(this.current_0, this.curcount_0);
|
|
app_0.mouse.dragElm == this || $drawDots(g, this.point1, this.point2, this.curcount_0);
|
|
$setBbox_0(this, this.point1, this.point2, width_0);
|
|
s = 'A';
|
|
switch (this.meter) {
|
|
case 0:
|
|
s = getUnitTextWithScale(this.current_0, 'A', this.scale_0, false);
|
|
break;
|
|
case 1:
|
|
s = getUnitTextWithScale(this.rmsI, 'A(rms)', this.scale_0, false);
|
|
}
|
|
$drawValues(this, g, s, width_0);
|
|
$drawPosts(this, g);
|
|
}
|
|
;
|
|
_.dumpXml = function dumpXml_3(doc, elem){
|
|
dumpAttr_1(elem, 'x', this.x_0 + ' ' + this.y_0 + ' ' + this.x2 + ' ' + this.y2);
|
|
dumpAttr_0(elem, 'f', this.flags);
|
|
dumpAttr_0(elem, 'me', this.meter);
|
|
dumpAttr_0(elem, 'sc', this.scale_0);
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_4(){
|
|
return 370;
|
|
}
|
|
;
|
|
_.getEditInfo = function getEditInfo_3(n){
|
|
var ei;
|
|
if (n == 0) {
|
|
ei = new EditInfo_0('Value', this.selectedValue, -1, -1);
|
|
ei.choice = new Choice;
|
|
$addItem(ei.choice, LS('Current'));
|
|
$addItem(ei.choice, LS('RMS Current'));
|
|
$select(ei.choice, this.meter);
|
|
return ei;
|
|
}
|
|
if (n == 1) {
|
|
ei = new EditInfo('Scale', 0);
|
|
ei.choice = new Choice;
|
|
$addItem(ei.choice, LS('Auto'));
|
|
$addItem(ei.choice, LS('A'));
|
|
$addItem(ei.choice, LS('mA'));
|
|
$addItem(ei.choice, LS(muString + 'A'));
|
|
$select(ei.choice, this.scale_0);
|
|
return ei;
|
|
}
|
|
if (n == 2) {
|
|
return createCheckbox('Circular Symbol', (this.flags & 2) != 0);
|
|
}
|
|
return null;
|
|
}
|
|
;
|
|
_.getInfo_0 = function getInfo_3(arr){
|
|
arr[0] = 'Ammeter';
|
|
switch (this.meter) {
|
|
case 0:
|
|
arr[1] = 'I = ' + getUnitText(this.current_0, 'A', false);
|
|
break;
|
|
case 1:
|
|
arr[1] = 'Irms = ' + getUnitText(this.rmsI, 'A', false);
|
|
}
|
|
}
|
|
;
|
|
_.getPower = function getPower_2(){
|
|
return 0;
|
|
}
|
|
;
|
|
_.getVoltageDiff_0 = function getVoltageDiff_3(){
|
|
return this.volts[0];
|
|
}
|
|
;
|
|
_.getVoltageSourceCount = function getVoltageSourceCount_3(){
|
|
return 1;
|
|
}
|
|
;
|
|
_.isWireEquivalent = function isWireEquivalent_0(){
|
|
return true;
|
|
}
|
|
;
|
|
_.setEditValue = function setEditValue_3(n, ei){
|
|
n == 0 && (this.meter = $getElement(ei.choice).selectedIndex);
|
|
n == 1 && (this.scale_0 = $getElement(ei.choice).selectedIndex);
|
|
n == 2 && (this.flags = $changeFlag(ei, this.flags, 2));
|
|
}
|
|
;
|
|
_.setPoints = function setPoints_4(){
|
|
$setPoints(this);
|
|
this.mid = $interpPoint(this.point1, this.point2, 0.6);
|
|
this.center = $interpPoint(this.point1, this.point2, 0.5);
|
|
this.arrowPoly = $calcArrow(this.point1, this.mid, 14, 7);
|
|
}
|
|
;
|
|
_.setVoltageSource = function setVoltageSource_3(n, v){
|
|
this.voltSource = v;
|
|
$setNodes(v, this.nodes[0], this.nodes[1]);
|
|
}
|
|
;
|
|
_.stamp = function stamp_4(){
|
|
$stampVoltageSource_0(this.nodes[0], this.nodes[1], this.voltSource, 0);
|
|
}
|
|
;
|
|
_.stepFinished = function stepFinished_1(){
|
|
++this.count;
|
|
this.total += this.current_0 * this.current_0;
|
|
if (this.current_0 > this.maxI && this.increasingI) {
|
|
this.maxI = this.current_0;
|
|
this.increasingI = true;
|
|
this.decreasingI = false;
|
|
}
|
|
if (this.current_0 < this.maxI && this.increasingI) {
|
|
this.minI = this.current_0;
|
|
this.increasingI = false;
|
|
this.decreasingI = true;
|
|
this.total = this.total / this.count;
|
|
this.rmsI = $wnd.Math.sqrt(this.total);
|
|
isNaN(this.rmsI) && (this.rmsI = 0);
|
|
this.count = 0;
|
|
this.total = 0;
|
|
}
|
|
if (this.current_0 < this.minI && this.decreasingI) {
|
|
this.minI = this.current_0;
|
|
this.increasingI = false;
|
|
this.decreasingI = true;
|
|
}
|
|
if (this.current_0 > this.minI && this.decreasingI) {
|
|
this.maxI = this.current_0;
|
|
this.increasingI = true;
|
|
this.decreasingI = false;
|
|
this.total = this.total / this.count;
|
|
this.rmsI = $wnd.Math.sqrt(this.total);
|
|
isNaN(this.rmsI) && (this.rmsI = 0);
|
|
this.count = 0;
|
|
this.total = 0;
|
|
}
|
|
if (this.current_0 == 0) {
|
|
++this.zerocount;
|
|
if (this.zerocount > 5) {
|
|
this.total = 0;
|
|
this.rmsI = 0;
|
|
this.maxI = 0;
|
|
this.minI = 0;
|
|
}
|
|
}
|
|
else {
|
|
this.zerocount = 0;
|
|
}
|
|
switch (this.meter) {
|
|
case 0:
|
|
this.selectedValue = this.current_0;
|
|
break;
|
|
case 1:
|
|
this.selectedValue = this.rmsI;
|
|
}
|
|
}
|
|
;
|
|
_.undumpXml = function undumpXml_4(xml){
|
|
this.flags = $parseIntAttr(xml, 'f', this.flags);
|
|
this.meter = $parseIntAttr(xml, 'me', this.meter);
|
|
this.scale_0 = $parseIntAttr(xml, 'sc', this.scale_0);
|
|
}
|
|
;
|
|
_.count = 0;
|
|
_.decreasingI = false;
|
|
_.increasingI = false;
|
|
_.maxI = 0;
|
|
_.meter = 0;
|
|
_.minI = 0;
|
|
_.rmsI = 0;
|
|
_.scale_0 = 0;
|
|
_.selectedValue = 0;
|
|
_.total = 0;
|
|
_.zerocount = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_AmmeterElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'AmmeterElm', 428);
|
|
function $setupPins_0(this$static){
|
|
var i;
|
|
this$static.inputCount = 1 << this$static.selectBitCount;
|
|
this$static.sizeX = this$static.selectBitCount + 1;
|
|
this$static.sizeY = this$static.inputCount + 1;
|
|
this$static.pins = initUnidimensionalArray(Lcom_lushprojects_circuitjs1_client_ChipElm$Pin_2_classLit, $intern_3, 9, this$static.inputCount + this$static.selectBitCount + 1, 0, 1);
|
|
for (i = 0; i != this$static.inputCount; i++)
|
|
this$static.pins[i] = new ChipElm$Pin(this$static, i, 2, 'I' + i);
|
|
for (i = 0; i != this$static.selectBitCount; i++)
|
|
this$static.pins[this$static.inputCount + i] = new ChipElm$Pin(this$static, i + 1, 1, 'S' + i);
|
|
this$static.outputPin = this$static.inputCount + this$static.selectBitCount;
|
|
this$static.pins[this$static.outputPin] = new ChipElm$Pin(this$static, 0, 3, 'Z');
|
|
$allocNodes(this$static);
|
|
}
|
|
|
|
function AnalogMuxElm(xx, yy){
|
|
$clinit_ChipElm();
|
|
ChipElm.call(this, xx, yy);
|
|
this.selectBitCount = 2;
|
|
this.r_on = 20;
|
|
this.r_off = $intern_94;
|
|
this.threshold = 2.5;
|
|
this.flags |= 2;
|
|
$setupPins_0(this);
|
|
}
|
|
|
|
function AnalogMuxElm_0(xa, ya, xb, yb, f, st){
|
|
$clinit_ChipElm();
|
|
ChipElm_0.call(this, xa, ya, xb, yb, f, st);
|
|
this.selectBitCount = 2;
|
|
this.r_on = 20;
|
|
this.r_off = $intern_94;
|
|
this.threshold = 2.5;
|
|
try {
|
|
this.selectBitCount = __parseAndValidateInt($nextToken(st), 10);
|
|
this.r_on = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.r_off = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.threshold = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
}
|
|
catch ($e0) {
|
|
$e0 = toJava($e0);
|
|
if (!instanceOf($e0, 13))
|
|
throw toJs($e0);
|
|
}
|
|
$setupPins_0(this);
|
|
}
|
|
|
|
defineClass(396, 32, $intern_85, AnalogMuxElm, AnalogMuxElm_0);
|
|
_.calculateCurrent = function calculateCurrent_0(){
|
|
var c, i, i0, i1, outputCurrent, selectedInput;
|
|
selectedInput = 0;
|
|
for (i0 = 0; i0 != this.selectBitCount; i0++)
|
|
this.volts[this.inputCount + i0] > this.threshold && (selectedInput |= 1 << i0);
|
|
outputCurrent = 0;
|
|
for (i1 = 0; i1 != this.inputCount; i1++) {
|
|
if (i1 == selectedInput) {
|
|
c = (this.volts[i1] - this.volts[this.outputPin]) / this.r_on;
|
|
this.pins[i1].current = -c;
|
|
outputCurrent += c;
|
|
}
|
|
else if ((this.flags & 2) != 0) {
|
|
this.pins[i1].current = -this.volts[i1] / this.r_off;
|
|
}
|
|
else {
|
|
c = (this.volts[i1] - this.volts[this.outputPin]) / this.r_off;
|
|
this.pins[i1].current = -c;
|
|
outputCurrent += c;
|
|
}
|
|
}
|
|
this.pins[this.outputPin].current = outputCurrent;
|
|
for (i = 0; i != this.selectBitCount; i++)
|
|
this.pins[this.inputCount + i].current = 0;
|
|
}
|
|
;
|
|
_.doStep = function doStep_4(){
|
|
var i, i0, selectedInput;
|
|
selectedInput = 0;
|
|
for (i0 = 0; i0 != this.selectBitCount; i0++)
|
|
this.volts[this.inputCount + i0] > this.threshold && (selectedInput |= 1 << i0);
|
|
for (i = 0; i != this.inputCount; i++) {
|
|
i == selectedInput?$stampResistor(this.nodes[i], this.nodes[this.outputPin], this.r_on):(this.flags & 2) != 0?$stampResistor(this.nodes[i], ground, this.r_off):$stampResistor(this.nodes[i], this.nodes[this.outputPin], this.r_off);
|
|
}
|
|
}
|
|
;
|
|
_.dumpXml = function dumpXml_4(doc, elem){
|
|
$dumpXml_0(this, elem);
|
|
dumpAttr_0(elem, 'sb', this.selectBitCount);
|
|
dumpAttr(elem, 'ron', this.r_on);
|
|
dumpAttr(elem, 'rof', this.r_off);
|
|
dumpAttr(elem, 'thr', this.threshold);
|
|
}
|
|
;
|
|
_.getChipEditInfo = function getChipEditInfo_1(n){
|
|
if (n == 0)
|
|
return $setDimensionless(new EditInfo_0('# of Select Bits', this.selectBitCount, 1, 8));
|
|
if (n == 1)
|
|
return $setPositive(new EditInfo_0('On Resistance (ohms)', this.r_on, 0, 0));
|
|
if (n == 2)
|
|
return $setPositive(new EditInfo_0('Off Resistance (ohms)', this.r_off, 0, 0));
|
|
if (n == 3)
|
|
return new EditInfo_0('Threshold Voltage', this.threshold, 0, 0);
|
|
if (n == 4)
|
|
return createCheckbox('Pulldown Resistor', (this.flags & 2) != 0);
|
|
return null;
|
|
}
|
|
;
|
|
_.getChipName = function getChipName_1(){
|
|
return 'Analog Mux';
|
|
}
|
|
;
|
|
_.getConnection = function getConnection_1(n1, n2){
|
|
if (n1 >= this.inputCount && n1 < this.outputPin)
|
|
return false;
|
|
if (n2 >= this.inputCount && n2 < this.outputPin)
|
|
return false;
|
|
return true;
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_5(){
|
|
return 432;
|
|
}
|
|
;
|
|
_.getInfo_0 = function getInfo_4(arr){
|
|
var i, selectedInput;
|
|
arr[0] = 'analog multiplexer';
|
|
selectedInput = 0;
|
|
for (i = 0; i != this.selectBitCount; i++)
|
|
this.volts[this.inputCount + i] > this.threshold && (selectedInput |= 1 << i);
|
|
arr[1] = 'selected: I' + selectedInput;
|
|
arr[2] = 'Vout = ' + getUnitText(this.volts[this.outputPin], 'V', false);
|
|
}
|
|
;
|
|
_.getPostCount_0 = function getPostCount_3(){
|
|
return this.inputCount + this.selectBitCount + 1;
|
|
}
|
|
;
|
|
_.getVoltageSourceCount = function getVoltageSourceCount_4(){
|
|
return 0;
|
|
}
|
|
;
|
|
_.hasGroundConnection = function hasGroundConnection_3(n1){
|
|
return (this.flags & 2) != 0 && n1 < this.inputCount;
|
|
}
|
|
;
|
|
_.nonLinear_0 = function nonLinear_0(){
|
|
return true;
|
|
}
|
|
;
|
|
_.setChipEditValue = function setChipEditValue_1(n, ei){
|
|
if (n == 0) {
|
|
if (ei.value_0 >= 1 && ei.value_0 <= 6) {
|
|
this.selectBitCount = round_int(ei.value_0);
|
|
$setupPins_0(this);
|
|
$setPoints_0(this);
|
|
}
|
|
else
|
|
ei.error = 'must be between 1 and 6';
|
|
return;
|
|
}
|
|
n == 1 && ei.value_0 > 0 && (this.r_on = ei.value_0);
|
|
n == 2 && ei.value_0 > 0 && (this.r_off = ei.value_0);
|
|
n == 3 && (this.threshold = ei.value_0);
|
|
n == 4 && (this.flags = $changeFlag(ei, this.flags, 2));
|
|
}
|
|
;
|
|
_.setupPins = function setupPins_0(){
|
|
$setupPins_0(this);
|
|
}
|
|
;
|
|
_.stamp = function stamp_5(){
|
|
var i;
|
|
for (i = 0; i != this.inputCount; i++)
|
|
;
|
|
}
|
|
;
|
|
_.undumpXml = function undumpXml_5(xml){
|
|
this.selectBitCount = $parseIntAttr(xml, 'sb', this.selectBitCount);
|
|
$undumpXml_0(this, xml);
|
|
this.r_on = $parseDoubleAttr(xml, 'ron', this.r_on);
|
|
this.r_off = $parseDoubleAttr(xml, 'rof', this.r_off);
|
|
this.threshold = $parseDoubleAttr(xml, 'thr', this.threshold);
|
|
}
|
|
;
|
|
_.inputCount = 0;
|
|
_.outputPin = 0;
|
|
_.r_off = 0;
|
|
_.r_on = 0;
|
|
_.selectBitCount = 0;
|
|
_.threshold = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_AnalogMuxElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'AnalogMuxElm', 396);
|
|
function $getEditInfo(this$static, n){
|
|
var ei;
|
|
if (n == 0) {
|
|
ei = new EditInfo_0('', 0, -1, -1);
|
|
ei.checkbox = new Checkbox_0('Normally closed', (this$static.flags & 1) != 0);
|
|
return ei;
|
|
}
|
|
if (n == 1)
|
|
return $setPositive(new EditInfo_0('On Resistance (ohms)', this$static.r_on, 0, 0));
|
|
if (n == 2)
|
|
return $setPositive(new EditInfo_0('Off Resistance (ohms)', this$static.r_off, 0, 0));
|
|
if (n == 3)
|
|
return createCheckbox('Pulldown Resistor', (this$static.flags & 2) != 0);
|
|
if (n == 4)
|
|
return new EditInfo_0('Threshold', this$static.threshold, 10, -10);
|
|
return null;
|
|
}
|
|
|
|
function $setEditValue_0(this$static, n, ei){
|
|
n == 0 && (this$static.flags = $getState(ei.checkbox)?this$static.flags | 1:this$static.flags & -2);
|
|
n == 1 && ei.value_0 > 0 && (this$static.r_on = ei.value_0);
|
|
n == 2 && ei.value_0 > 0 && (this$static.r_off = ei.value_0);
|
|
n == 3 && (this$static.flags = $changeFlag(ei, this$static.flags, 2));
|
|
n == 4 && (this$static.threshold = ei.value_0);
|
|
}
|
|
|
|
function $setPoints_1(this$static){
|
|
$setPoints(this$static);
|
|
$calcLeads(this$static, 32);
|
|
$adjustLeadsToGrid(this$static, (this$static.flags & 4) != 0, (this$static.flags & 8) != 0);
|
|
this$static.ps = new Point_1;
|
|
this$static.ps1 = new Point_1;
|
|
this$static.openhs = (this$static.flags & 4) != 0 != ((this$static.flags & 8) != 0) != ((this$static.flags & 16) != 0)?-16:16;
|
|
this$static.point3 = $interpPoint_0(this$static.lead1, this$static.lead2, 0.5, -this$static.openhs);
|
|
this$static.lead3 = $interpPoint_0(this$static.lead1, this$static.lead2, 0.5, -this$static.openhs / 2 | 0);
|
|
}
|
|
|
|
function AnalogSwitchElm(xx, yy){
|
|
CircuitElm.call(this, xx, yy);
|
|
this.r_on = 20;
|
|
this.r_off = $intern_94;
|
|
this.threshold = 2.5;
|
|
this.noDiagonal = true;
|
|
this.flags |= 2;
|
|
}
|
|
|
|
function AnalogSwitchElm_0(xa, ya, xb, yb, f, st){
|
|
CircuitElm_0.call(this, xa, ya, xb, yb, f);
|
|
this.r_on = 20;
|
|
this.r_off = $intern_94;
|
|
this.threshold = 2.5;
|
|
this.noDiagonal = true;
|
|
try {
|
|
this.r_on = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.r_off = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.threshold = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
}
|
|
catch ($e0) {
|
|
$e0 = toJava($e0);
|
|
if (!instanceOf($e0, 13))
|
|
throw toJs($e0);
|
|
}
|
|
}
|
|
|
|
defineClass(268, 8, $intern_85, AnalogSwitchElm, AnalogSwitchElm_0);
|
|
_.calculateCurrent = function calculateCurrent_1(){
|
|
if (this.resistance == 0)
|
|
return;
|
|
(this.flags & 2) != 0 && this.open_0?(this.current_0 = 0):(this.current_0 = (this.volts[0] - this.volts[1]) / this.resistance);
|
|
}
|
|
;
|
|
_.doStep = function doStep_5(){
|
|
this.open_0 = this.volts[2] < this.threshold;
|
|
(this.flags & 1) != 0 && (this.open_0 = !this.open_0);
|
|
if (!((this.flags & 2) != 0 && this.open_0)) {
|
|
this.resistance = this.open_0?this.r_off:this.r_on;
|
|
$stampResistor(this.nodes[0], this.nodes[1], this.resistance);
|
|
}
|
|
}
|
|
;
|
|
_.draw = function draw_5(g){
|
|
var hs1, hs2;
|
|
hs1 = this.open_0?0:2;
|
|
hs2 = this.open_0?this.openhs:2;
|
|
$setBbox_0(this, this.point1, this.point2, this.openhs);
|
|
$draw2Leads(this, g);
|
|
$setColor_0(g, lightGrayColor);
|
|
$interpPoint_2(this.lead1, this.lead2, this.ps1, 0, hs1);
|
|
$interpPoint_2(this.lead1, this.lead2, this.ps, 1, hs2);
|
|
drawThickLine_0(g, this.ps1, this.ps, 3);
|
|
$setVoltageColor(this, g, this.volts[2]);
|
|
drawThickLine_0(g, this.point3, this.lead3, 3);
|
|
this.open_0 || (this.curcount_0 = $updateDotCount(this.current_0, this.curcount_0) , app_0.mouse.dragElm == this || $drawDots(g, this.point1, this.point2, this.curcount_0));
|
|
$drawPosts(this, g);
|
|
}
|
|
;
|
|
_.dumpXml = function dumpXml_5(doc, elem){
|
|
dumpAttr_1(elem, 'x', this.x_0 + ' ' + this.y_0 + ' ' + this.x2 + ' ' + this.y2);
|
|
dumpAttr_0(elem, 'f', this.flags);
|
|
dumpAttr(elem, 'ron', this.r_on);
|
|
dumpAttr(elem, 'roff', this.r_off);
|
|
dumpAttr(elem, 'th', this.threshold);
|
|
}
|
|
;
|
|
_.flipX = function flipX_2(c2, count){
|
|
this.flags ^= 4;
|
|
$flipX(this, c2);
|
|
}
|
|
;
|
|
_.flipXY = function flipXY_1(c2, count){
|
|
this.flags ^= 16;
|
|
$flipXY(this, c2);
|
|
}
|
|
;
|
|
_.flipY = function flipY_2(c2, count){
|
|
this.flags ^= 8;
|
|
$flipY(this, c2);
|
|
}
|
|
;
|
|
_.getConnection = function getConnection_2(n1, n2){
|
|
if (n1 == 2 || n2 == 2)
|
|
return false;
|
|
return true;
|
|
}
|
|
;
|
|
_.getCurrentIntoNode = function getCurrentIntoNode_1(n){
|
|
if (n == 2)
|
|
return 0;
|
|
if (n == 0)
|
|
return -this.current_0;
|
|
return this.current_0;
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_6(){
|
|
return 159;
|
|
}
|
|
;
|
|
_.getEditInfo = function getEditInfo_4(n){
|
|
return $getEditInfo(this, n);
|
|
}
|
|
;
|
|
_.getInfo_0 = function getInfo_5(arr){
|
|
arr[0] = 'analog switch';
|
|
arr[1] = this.open_0?'open':'closed';
|
|
arr[2] = 'Vd = ' + getUnitText($wnd.Math.abs(this.volts[0] - this.volts[1]), 'V', false);
|
|
arr[3] = 'I = ' + getUnitText($wnd.Math.abs(this.current_0), 'A', false);
|
|
arr[4] = 'Vc = ' + getUnitText(this.volts[2], 'V', false);
|
|
}
|
|
;
|
|
_.getPost = function getPost_1(n){
|
|
return n == 0?this.point1:n == 1?this.point2:this.point3;
|
|
}
|
|
;
|
|
_.getPostCount_0 = function getPostCount_4(){
|
|
return 3;
|
|
}
|
|
;
|
|
_.getXmlDumpType = function getXmlDumpType_0(){
|
|
return 'as';
|
|
}
|
|
;
|
|
_.hasGroundConnection = function hasGroundConnection_4(n1){
|
|
return (this.flags & 2) != 0 && n1 < 2;
|
|
}
|
|
;
|
|
_.nonLinear_0 = function nonLinear_1(){
|
|
return true;
|
|
}
|
|
;
|
|
_.setEditValue = function setEditValue_4(n, ei){
|
|
$setEditValue_0(this, n, ei);
|
|
}
|
|
;
|
|
_.setPoints = function setPoints_5(){
|
|
$setPoints_1(this);
|
|
}
|
|
;
|
|
_.stamp = function stamp_6(){
|
|
if ((this.flags & 2) != 0) {
|
|
$stampResistor(this.nodes[0], ground, this.r_off);
|
|
$stampResistor(this.nodes[1], ground, this.r_off);
|
|
}
|
|
}
|
|
;
|
|
_.undumpXml = function undumpXml_6(xml){
|
|
this.flags = $parseIntAttr(xml, 'f', this.flags);
|
|
this.r_on = $parseDoubleAttr(xml, 'ron', this.r_on);
|
|
this.r_off = $parseDoubleAttr(xml, 'roff', this.r_off);
|
|
this.threshold = $parseDoubleAttr(xml, 'th', this.threshold);
|
|
}
|
|
;
|
|
_.open_0 = false;
|
|
_.openhs = 0;
|
|
_.r_off = 0;
|
|
_.r_on = 0;
|
|
_.resistance = 0;
|
|
_.threshold = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_AnalogSwitchElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'AnalogSwitchElm', 268);
|
|
function AnalogSwitch2Elm(xx, yy){
|
|
AnalogSwitchElm.call(this, xx, yy);
|
|
}
|
|
|
|
function AnalogSwitch2Elm_0(xa, ya, xb, yb, f, st){
|
|
AnalogSwitchElm_0.call(this, xa, ya, xb, yb, f, st);
|
|
}
|
|
|
|
defineClass(407, 268, $intern_85, AnalogSwitch2Elm, AnalogSwitch2Elm_0);
|
|
_.calculateCurrent = function calculateCurrent_2(){
|
|
this.open_0?(this.current_0 = (this.volts[0] - this.volts[2]) / this.r_on):(this.current_0 = (this.volts[0] - this.volts[1]) / this.r_on);
|
|
}
|
|
;
|
|
_.doStep = function doStep_6(){
|
|
this.open_0 = this.volts[3] < this.threshold;
|
|
(this.flags & 1) != 0 && (this.open_0 = !this.open_0);
|
|
if (this.open_0) {
|
|
$stampResistor(this.nodes[0], this.nodes[2], this.r_on);
|
|
(this.flags & 2) != 0 || $stampResistor(this.nodes[0], this.nodes[1], this.r_off);
|
|
}
|
|
else {
|
|
$stampResistor(this.nodes[0], this.nodes[1], this.r_on);
|
|
(this.flags & 2) != 0 || $stampResistor(this.nodes[0], this.nodes[2], this.r_off);
|
|
}
|
|
}
|
|
;
|
|
_.draw = function draw_6(g){
|
|
var inverted, position;
|
|
$setBbox_0(this, this.point1, this.point2, this.openhs);
|
|
$setVoltageColor(this, g, this.volts[0]);
|
|
drawThickLine_0(g, this.point1, this.lead1, 3);
|
|
$setVoltageColor(this, g, this.volts[1]);
|
|
drawThickLine_0(g, this.swpoles[0], this.swposts[0], 3);
|
|
$setVoltageColor(this, g, this.volts[2]);
|
|
drawThickLine_0(g, this.swpoles[1], this.swposts[1], 3);
|
|
$setColor_0(g, lightGrayColor);
|
|
position = this.open_0?1:0;
|
|
drawThickLine_0(g, this.lead1, this.swpoles[position], 3);
|
|
this.curcount_0 = $updateDotCount(this.current_0, this.curcount_0);
|
|
$drawDots(g, this.point1, this.lead1, this.curcount_0);
|
|
$drawDots(g, this.swpoles[position], this.swposts[position], this.curcount_0);
|
|
$drawPosts(this, g);
|
|
if (mouseElmRef == this || this.selected_0 || $containsKey(app_0.mouse.scopePlotRoles, this) || instanceOf(mouseElmRef, 21) && $getElm_0(mouseElmRef.elmScope) == this || $isOnHighlightedNet(this)) {
|
|
inverted = (this.flags & 1) != 0;
|
|
$setColor_0(g, selectColor_0);
|
|
$drawCenteredText(this, g, inverted?'NC':'NO', this.labelPts[0].x_0, this.labelPts[0].y_0, true);
|
|
$drawCenteredText(this, g, inverted?'NO':'NC', this.labelPts[1].x_0, this.labelPts[1].y_0, true);
|
|
}
|
|
}
|
|
;
|
|
_.getConnection = function getConnection_3(n1, n2){
|
|
return n1 != 3 && n2 != 3;
|
|
}
|
|
;
|
|
_.getCurrentIntoNode = function getCurrentIntoNode_2(n){
|
|
var position;
|
|
if (n == 0)
|
|
return -this.current_0;
|
|
position = this.open_0?1:0;
|
|
if (n == position + 1)
|
|
return this.current_0;
|
|
return 0;
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_7(){
|
|
return 160;
|
|
}
|
|
;
|
|
_.getEditInfo = function getEditInfo_5(n){
|
|
var ei;
|
|
if (n == 0) {
|
|
ei = new EditInfo_0('', 0, -1, -1);
|
|
ei.checkbox = new Checkbox_0('Swap NO/NC', (this.flags & 1) != 0);
|
|
return ei;
|
|
}
|
|
return $getEditInfo(this, n);
|
|
}
|
|
;
|
|
_.getInfo_0 = function getInfo_6(arr){
|
|
arr[0] = 'analog switch (SPDT)';
|
|
arr[1] = 'I = ' + getUnitText($wnd.Math.abs(this.current_0), 'A', false);
|
|
}
|
|
;
|
|
_.getPost = function getPost_2(n){
|
|
return n == 0?this.point1:n == 3?this.ctlPoint:this.swposts[n - 1];
|
|
}
|
|
;
|
|
_.getPostCount_0 = function getPostCount_5(){
|
|
return 4;
|
|
}
|
|
;
|
|
_.getXmlDumpType = function getXmlDumpType_1(){
|
|
return 'as2';
|
|
}
|
|
;
|
|
_.hasGroundConnection = function hasGroundConnection_5(n){
|
|
return (this.flags & 2) != 0 && (n == 1 || n == 2);
|
|
}
|
|
;
|
|
_.setEditValue = function setEditValue_5(n, ei){
|
|
if (n == 0) {
|
|
this.flags = $getState(ei.checkbox)?this.flags | 1:this.flags & -2;
|
|
return;
|
|
}
|
|
$setEditValue_0(this, n, ei);
|
|
}
|
|
;
|
|
_.setPoints = function setPoints_6(){
|
|
$setPoints_1(this);
|
|
$calcLeads(this, 32);
|
|
$adjustLeadsToGrid(this, (this.flags & 4) != 0, (this.flags & 8) != 0);
|
|
this.swposts = $newPointArray(2);
|
|
this.swpoles = $newPointArray(2);
|
|
this.labelPts = $newPointArray(2);
|
|
$interpPoint2(this.lead1, this.lead2, this.swpoles[0], this.swpoles[1], 1, this.openhs);
|
|
$interpPoint2(this.point1, this.point2, this.swposts[0], this.swposts[1], 1, this.openhs);
|
|
$interpPoint2(this.point1, this.point2, this.labelPts[0], this.labelPts[1], 1 - 10 / this.dn, this.openhs + (this.openhs > 0?10:-10));
|
|
this.ctlPoint = $interpPoint_0(this.lead1, this.lead2, 0.5, this.openhs);
|
|
}
|
|
;
|
|
_.stamp = function stamp_7(){
|
|
if ((this.flags & 2) != 0) {
|
|
$stampResistor(this.nodes[1], ground, this.r_off);
|
|
$stampResistor(this.nodes[2], ground, this.r_off);
|
|
}
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_AnalogSwitch2Elm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'AnalogSwitch2Elm', 407);
|
|
function $createEuroGatePolygon(this$static){
|
|
var pts;
|
|
pts = $newPointArray(4);
|
|
$interpPoint2(this$static.lead1, this$static.lead2, pts[0], pts[1], 0, this$static.hs2);
|
|
$interpPoint2(this$static.lead1, this$static.lead2, pts[3], pts[2], 1, this$static.hs2);
|
|
this$static.gatePoly = $createPolygon_1(pts);
|
|
}
|
|
|
|
function $getEditInfo_0(this$static, n){
|
|
if (n == 0)
|
|
return $setDimensionless(new EditInfo_0('# of Inputs', this$static.inputCount, 1, 8));
|
|
if (n == 1)
|
|
return $setUnitStep(new EditInfo_0('High Logic Voltage', this$static.highVoltage, 1, 10));
|
|
if (n == 2)
|
|
return createCheckbox('Schmitt Inputs', (this$static.flags & 2) != 0);
|
|
if (n == 3)
|
|
return createCheckbox('Invert Inputs', (this$static.flags & 4) != 0);
|
|
if (n == 4)
|
|
return new EditInfo_0('Propagation Delay (s)', this$static.propagationDelay, 0, 0);
|
|
return null;
|
|
}
|
|
|
|
function $getInput(this$static, x_0){
|
|
var high, res;
|
|
high = (this$static.flags & 4) == 0;
|
|
if ((this$static.flags & 2) == 0)
|
|
return this$static.volts[x_0] > this$static.highVoltage * 0.5?high:!high;
|
|
(this$static.inputStates == null || this$static.inputStates.length != this$static.inputCount) && (this$static.inputStates = initUnidimensionalArray(Z_classLit, $intern_95, 7, this$static.inputCount, 16, 1));
|
|
res = this$static.volts[x_0] > this$static.highVoltage * (this$static.inputStates[x_0]?0.35:0.55);
|
|
this$static.inputStates[x_0] = res;
|
|
return res?high:!high;
|
|
}
|
|
|
|
function $setEditValue_1(this$static, n, ei){
|
|
if (n == 0) {
|
|
if (ei.value_0 >= 1) {
|
|
this$static.inputCount = round_int(ei.value_0);
|
|
$allocNodes(this$static);
|
|
$setupVolts(this$static);
|
|
this$static.setPoints();
|
|
}
|
|
else
|
|
ei.error = 'must be >= 1';
|
|
}
|
|
n == 1 && (this$static.highVoltage = lastHighVoltage = ei.value_0);
|
|
if (n == 2) {
|
|
$getState(ei.checkbox)?(this$static.flags |= 2):(this$static.flags &= -3);
|
|
lastSchmitt = (this$static.flags & 2) != 0;
|
|
this$static.setPoints();
|
|
}
|
|
if (n == 3) {
|
|
this$static.flags = $changeFlag(ei, this$static.flags, 4);
|
|
this$static.setPoints();
|
|
}
|
|
n == 4 && (this$static.propagationDelay = ei.value_0);
|
|
}
|
|
|
|
function $setPoints_2(this$static){
|
|
var adj, hs, i, i0;
|
|
$setPoints(this$static);
|
|
this$static.inputStates = initUnidimensionalArray(Z_classLit, $intern_95, 7, this$static.inputCount, 16, 1);
|
|
this$static.dn > 150 && app_0.mouse.dragElm == this$static && $setSize_1(this$static, 2);
|
|
hs = this$static.gheight;
|
|
this$static.ww = this$static.gwidth2;
|
|
this$static.ww > this$static.dn / 2 && (this$static.ww = round_int(this$static.dn / 2));
|
|
this$static.isInverting() && this$static.ww + 8 > this$static.dn / 2 && (this$static.ww = round_int(this$static.dn / 2 - 8));
|
|
$calcLeads(this$static, this$static.ww * 2);
|
|
this$static.inPosts = initUnidimensionalArray(Lcom_lushprojects_circuitjs1_client_Point_2_classLit, $intern_78, 14, this$static.inputCount, 0, 1);
|
|
this$static.inGates = initUnidimensionalArray(Lcom_lushprojects_circuitjs1_client_Point_2_classLit, $intern_78, 14, this$static.inputCount, 0, 1);
|
|
i0 = -this$static.inputCount / 2 | 0;
|
|
(this$static.flags & 4) != 0?(this$static.icircles = initUnidimensionalArray(Lcom_lushprojects_circuitjs1_client_Point_2_classLit, $intern_78, 14, this$static.inputCount, 0, 1)):(this$static.icircles = null);
|
|
for (i = 0; i != this$static.inputCount; ++i , i0++) {
|
|
i0 == 0 && (this$static.inputCount & 1) == 0 && ++i0;
|
|
adj = this$static.getLeadAdjustment(i);
|
|
this$static.inPosts[i] = $interpPoint_0(this$static.point1, this$static.point2, 0, hs * i0);
|
|
this$static.inGates[i] = $interpPoint_0(this$static.lead1, this$static.lead2, this$static.icircles != null?-8 / (this$static.ww * 2) + adj:adj, hs * i0);
|
|
this$static.icircles != null && (this$static.icircles[i] = $interpPoint_0(this$static.lead1, this$static.lead2, -4 / (this$static.ww * 2), hs * i0));
|
|
}
|
|
this$static.hs2 = this$static.gwidth * ((this$static.inputCount / 2 | 0) + 1);
|
|
$setBbox_0(this$static, this$static.point1, this$static.point2, this$static.hs2);
|
|
(this$static.flags & 2) != 0 && (this$static.schmittPoly = $getSchmittPolygon(this$static, this$static.gsize, 0.4699999988079071));
|
|
}
|
|
|
|
function $setSize_1(this$static, s){
|
|
this$static.gsize = s;
|
|
this$static.gwidth = 7 * s;
|
|
this$static.gwidth2 = 14 * s;
|
|
this$static.gheight = 8 * s;
|
|
this$static.flags &= -2;
|
|
this$static.flags |= s == 1?1:0;
|
|
}
|
|
|
|
function $setupVolts(this$static){
|
|
var i;
|
|
for (i = 0; i != this$static.inputCount; i++)
|
|
this$static.volts[i] = this$static.lastOutput ^ this$static.isInverting()?this$static.highVoltage:0;
|
|
}
|
|
|
|
function GateElm(xx, yy){
|
|
CircuitElm.call(this, xx, yy);
|
|
this.inputCount = 2;
|
|
this.noDiagonal = true;
|
|
this.inputCount = 2;
|
|
$allocNodes(this);
|
|
$setupVolts(this);
|
|
this.highVoltage = lastHighVoltage;
|
|
lastSchmitt && (this.flags |= 2);
|
|
$setSize_1(this, app_0.menus.smallGridCheckItem.on?1:2);
|
|
}
|
|
|
|
function GateElm_0(xa, ya, xb, yb, f, st){
|
|
var lastOutputVoltage;
|
|
CircuitElm_0.call(this, xa, ya, xb, yb, f);
|
|
this.inputCount = 2;
|
|
this.inputCount = (new Integer_0($nextToken(st))).value_0;
|
|
lastOutputVoltage = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.noDiagonal = true;
|
|
this.highVoltage = 5;
|
|
try {
|
|
this.highVoltage = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
}
|
|
catch ($e0) {
|
|
$e0 = toJava($e0);
|
|
if (!instanceOf($e0, 13))
|
|
throw toJs($e0);
|
|
}
|
|
this.lastOutput = lastOutputVoltage > this.highVoltage * 0.5;
|
|
$setSize_1(this, (f & 1) != 0?1:2);
|
|
$allocNodes(this);
|
|
$setupVolts(this);
|
|
}
|
|
|
|
defineClass(269, 8, $intern_85);
|
|
_.addRoutingObstacle = function addRoutingObstacle_3(router){
|
|
var hs2, i, leadDist, pa, pb;
|
|
for (i = 0; i < this.inputCount; i++)
|
|
$addWire(router, this.inPosts[i].x_0, this.inPosts[i].y_0, this.inGates[i].x_0, this.inGates[i].y_0);
|
|
$addWire(router, this.lead2.x_0, this.lead2.y_0, this.point2.x_0, this.point2.y_0);
|
|
leadDist = distance(this.lead1, this.lead2);
|
|
hs2 = this.gwidth * ((this.inputCount / 2 | 0) + 1);
|
|
pa = $interpPoint_0(this.lead1, this.lead2, -8 / leadDist, hs2);
|
|
pb = $interpPoint_0(this.lead1, this.lead2, 1, -hs2);
|
|
$addObstacle(router, pa.x_0, pa.y_0, pb.x_0, pb.y_0);
|
|
}
|
|
;
|
|
_.doStep = function doStep_7(){
|
|
var f, res;
|
|
f = this.calcFunction();
|
|
this.isInverting() && (f = !f);
|
|
if (this.propagationDelay == 0 && this.lastTime != sim_0.t) {
|
|
if (this.lastOutput == !f) {
|
|
if (this.oscillationCount++ > 50) {
|
|
this.oscillationCount = 0;
|
|
$getrand(app_0, 10) > 5 && (f = this.lastOutput);
|
|
}
|
|
}
|
|
else
|
|
this.oscillationCount = 0;
|
|
this.lastTime = sim_0.t;
|
|
}
|
|
if (this.propagationDelay > 0) {
|
|
if (f != this.lastOutput) {
|
|
if (this.delayEndTime == 0)
|
|
this.delayEndTime = sim_0.t + this.propagationDelay;
|
|
else if (sim_0.t >= this.delayEndTime) {
|
|
this.lastOutput = f;
|
|
this.delayEndTime = 0;
|
|
}
|
|
}
|
|
else {
|
|
this.delayEndTime = 0;
|
|
}
|
|
}
|
|
else {
|
|
this.lastOutput = f;
|
|
}
|
|
res = this.lastOutput?this.highVoltage:0;
|
|
$updateVoltageSource(this.voltSource, res);
|
|
}
|
|
;
|
|
_.draw = function draw_7(g){
|
|
var center, i;
|
|
for (i = 0; i != this.inputCount; i++) {
|
|
$setVoltageColor(this, g, this.volts[i]);
|
|
drawThickLine_0(g, this.inPosts[i], this.inGates[i], 3);
|
|
}
|
|
$setVoltageColor(this, g, this.volts[this.inputCount]);
|
|
drawThickLine_0(g, this.lead2, this.point2, 3);
|
|
$setColor_0(g, mouseElmRef == this || this.selected_0 || $containsKey(app_0.mouse.scopePlotRoles, this) || instanceOf(mouseElmRef, 21) && $getElm_0(mouseElmRef.elmScope) == this || $isOnHighlightedNet(this)?selectColor_0:lightGrayColor);
|
|
if (app_0.menus.euroGatesCheckItem.on) {
|
|
drawThickPolygon(g, this.gatePoly);
|
|
center = $interpPoint(this.point1, this.point2, 0.5);
|
|
$drawCenteredText(this, g, this.getGateText(), center.x_0, center.y_0 - 6 * this.gsize, true);
|
|
}
|
|
else
|
|
this.drawGatePolygon(g);
|
|
g.context.lineWidth = 2;
|
|
(this.flags & 2) != 0 && drawPolygon(g, this.schmittPoly);
|
|
g.context.lineWidth = 1;
|
|
this.isInverting() && drawThickCircle(g, this.pcircle.x_0, this.pcircle.y_0, 3);
|
|
if (this.icircles != null)
|
|
for (i = 0; i != this.inputCount; i++)
|
|
drawThickCircle(g, this.icircles[i].x_0, this.icircles[i].y_0, 3);
|
|
this.curcount_0 = $updateDotCount(this.current_0, this.curcount_0);
|
|
$drawDots(g, this.lead2, this.point2, this.curcount_0);
|
|
$drawPosts(this, g);
|
|
}
|
|
;
|
|
_.drawGatePolygon = function drawGatePolygon(g){
|
|
drawThickPolygon(g, this.gatePoly);
|
|
}
|
|
;
|
|
_.dumpXml = function dumpXml_6(doc, elem){
|
|
dumpAttr_1(elem, 'x', this.x_0 + ' ' + this.y_0 + ' ' + this.x2 + ' ' + this.y2);
|
|
dumpAttr_0(elem, 'f', this.flags);
|
|
this.highVoltage != 5 && dumpAttr(elem, 'hi', this.highVoltage);
|
|
this.inputCount != 2 && dumpAttr_0(elem, 'in', this.inputCount);
|
|
this.propagationDelay != 0 && dumpAttr(elem, 'pd', this.propagationDelay);
|
|
}
|
|
;
|
|
_.dumpXmlState = function dumpXmlState_1(doc, elem){
|
|
this.volts[this.inputCount] != 0 && dumpAttr(elem, 'o', this.volts[this.inputCount]);
|
|
}
|
|
;
|
|
_.getConnection = function getConnection_4(n1, n2){
|
|
return false;
|
|
}
|
|
;
|
|
_.getCurrentIntoNode = function getCurrentIntoNode_3(n){
|
|
if (n == this.inputCount)
|
|
return this.current_0;
|
|
return 0;
|
|
}
|
|
;
|
|
_.getDragLength = function getDragLength_0(){
|
|
return 96;
|
|
}
|
|
;
|
|
_.getEditInfo = function getEditInfo_6(n){
|
|
return $getEditInfo_0(this, n);
|
|
}
|
|
;
|
|
_.getGateText = function getGateText(){
|
|
return null;
|
|
}
|
|
;
|
|
_.getInfo_0 = function getInfo_7(arr){
|
|
arr[0] = this.getGateName();
|
|
arr[1] = 'Vout = ' + getUnitText(this.volts[this.inputCount], 'V', false);
|
|
arr[2] = 'Iout = ' + getUnitText(this.current_0, 'A', false);
|
|
this.propagationDelay > 0 && (arr[3] = 'delay = ' + getUnitText(this.propagationDelay, 's', false));
|
|
}
|
|
;
|
|
_.getLeadAdjustment = function getLeadAdjustment(ix){
|
|
return 0;
|
|
}
|
|
;
|
|
_.getPost = function getPost_3(n){
|
|
if (n == this.inputCount)
|
|
return this.point2;
|
|
return this.inPosts[n];
|
|
}
|
|
;
|
|
_.getPostCount_0 = function getPostCount_6(){
|
|
return this.inputCount + 1;
|
|
}
|
|
;
|
|
_.getVoltageSourceCount = function getVoltageSourceCount_5(){
|
|
return 1;
|
|
}
|
|
;
|
|
_.getXmlDumpType = function getXmlDumpType_2(){
|
|
return $replace_0($replace_0($getName(this.___clazz), 'com.lushprojects.circuitjs1.client.', ''), 'GateElm', '');
|
|
}
|
|
;
|
|
_.hasGroundConnection = function hasGroundConnection_6(n1){
|
|
return n1 == this.inputCount;
|
|
}
|
|
;
|
|
_.isInverting = function isInverting(){
|
|
return false;
|
|
}
|
|
;
|
|
_.setEditValue = function setEditValue_6(n, ei){
|
|
$setEditValue_1(this, n, ei);
|
|
}
|
|
;
|
|
_.setHighVoltage = function setHighVoltage_1(hv){
|
|
this.highVoltage = hv;
|
|
}
|
|
;
|
|
_.setPoints = function setPoints_7(){
|
|
$setPoints_2(this);
|
|
}
|
|
;
|
|
_.stamp = function stamp_8(){
|
|
$stampVoltageSource(ground, this.nodes[this.inputCount], this.voltSource);
|
|
}
|
|
;
|
|
_.undumpXml = function undumpXml_7(xml){
|
|
var lastOutputVoltage, stateRestore;
|
|
stateRestore = $parseStringAttr(xml, 'ix', null) != null;
|
|
stateRestore || (this.flags = 0);
|
|
this.flags = $parseIntAttr(xml, 'f', this.flags);
|
|
this.highVoltage = $parseDoubleAttr(xml, 'hi', this.highVoltage);
|
|
this.inputCount = $parseIntAttr(xml, 'in', this.inputCount);
|
|
this.propagationDelay = $parseDoubleAttr(xml, 'pd', this.propagationDelay);
|
|
lastOutputVoltage = $parseDoubleAttr(xml, 'o', 0);
|
|
this.lastOutput = lastOutputVoltage > this.highVoltage * 0.5;
|
|
$setSize_1(this, (this.flags & 1) != 0?1:2);
|
|
$allocNodes(this);
|
|
$setupVolts(this);
|
|
}
|
|
;
|
|
_.validate = function validate_4(){
|
|
return $validateRailNode(this, this.inputCount);
|
|
}
|
|
;
|
|
_.delayEndTime = 0;
|
|
_.gheight = 0;
|
|
_.gsize = 0;
|
|
_.gwidth = 0;
|
|
_.gwidth2 = 0;
|
|
_.highVoltage = 0;
|
|
_.hs2 = 0;
|
|
_.inputCount = 0;
|
|
_.lastOutput = false;
|
|
_.lastTime = 0;
|
|
_.oscillationCount = 0;
|
|
_.propagationDelay = 0;
|
|
_.ww = 0;
|
|
var lastHighVoltage = 5, lastSchmitt = false;
|
|
var Lcom_lushprojects_circuitjs1_client_GateElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'GateElm', 269);
|
|
function $ellipse(g, x_0, y_0, rx, ry, ro, sa, ea, ccw){
|
|
rx >= 0 && ry >= 0 && g.ellipse(x_0, y_0, rx, ry, ro, sa, ea, ccw);
|
|
}
|
|
|
|
function AndGateElm(xx, yy){
|
|
GateElm.call(this, xx, yy);
|
|
}
|
|
|
|
function AndGateElm_0(xa, ya, xb, yb, f, st){
|
|
GateElm_0.call(this, xa, ya, xb, yb, f, st);
|
|
}
|
|
|
|
defineClass(270, 269, $intern_85, AndGateElm, AndGateElm_0);
|
|
_.calcFunction = function calcFunction(){
|
|
var f, i;
|
|
f = true;
|
|
for (i = 0; i != this.inputCount; i++)
|
|
f = f & $getInput(this, i);
|
|
return f;
|
|
}
|
|
;
|
|
_.drawGatePolygon = function drawGatePolygon_0(g){
|
|
var ang1, ang2, rx, ry;
|
|
g.context.lineWidth = 3;
|
|
g.context.beginPath();
|
|
$moveTo(g.context, this.gatePoly.xpoints[0], this.gatePoly.ypoints[0]);
|
|
ang1 = $intern_96 * sign_0(this.dx);
|
|
ang2 = $intern_89 * sign_0(this.dx);
|
|
rx = this.ww;
|
|
ry = this.hs2;
|
|
if (this.dx == 0) {
|
|
ang1 = this.dy > 0?0:$intern_1;
|
|
ang2 = this.dy > 0?$intern_1:0;
|
|
rx = this.hs2;
|
|
ry = this.ww;
|
|
}
|
|
$ellipse(g.context, this.gatePoly.xpoints[2], this.gatePoly.ypoints[2], rx, ry, 0, ang1, ang2, false);
|
|
$lineTo(g.context, this.gatePoly.xpoints[4], this.gatePoly.ypoints[4]);
|
|
g.context.closePath();
|
|
g.context.stroke();
|
|
g.context.lineWidth = 1;
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_8(){
|
|
return 150;
|
|
}
|
|
;
|
|
_.getGateName = function getGateName(){
|
|
return 'AND gate';
|
|
}
|
|
;
|
|
_.getGateText = function getGateText_0(){
|
|
return '&';
|
|
}
|
|
;
|
|
_.getShortcut = function getShortcut_2(){
|
|
return 50;
|
|
}
|
|
;
|
|
_.setPoints = function setPoints_8(){
|
|
var triPoints;
|
|
$setPoints_2(this);
|
|
if (app_0.menus.euroGatesCheckItem.on) {
|
|
$createEuroGatePolygon(this);
|
|
}
|
|
else {
|
|
triPoints = $newPointArray(5);
|
|
$interpPoint2(this.lead1, this.lead2, triPoints[0], triPoints[4], 0, this.hs2);
|
|
$interpPoint2(this.lead1, this.lead2, triPoints[1], triPoints[3], 0.5, this.hs2);
|
|
$interpPoint_1(this.lead1, this.lead2, triPoints[2], 0.5);
|
|
this.gatePoly = $createPolygon_1(triPoints);
|
|
}
|
|
if (this.isInverting()) {
|
|
this.pcircle = $interpPoint(this.point1, this.point2, 0.5 + (this.ww + 4) / this.dn);
|
|
this.lead2 = $interpPoint(this.point1, this.point2, 0.5 + (this.ww + 8) / this.dn);
|
|
}
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_AndGateElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'AndGateElm', 270);
|
|
function AntennaElm(xx, yy){
|
|
RailElm_0.call(this, xx, yy, 1);
|
|
}
|
|
|
|
function AntennaElm_0(xa, ya, xb, yb, f, st){
|
|
RailElm_1.call(this, xa, ya, xb, yb, f, st);
|
|
this.waveform = 1;
|
|
}
|
|
|
|
defineClass(391, 47, $intern_92, AntennaElm, AntennaElm_0);
|
|
_.drawRail = function drawRail_0(g){
|
|
$drawRailText(this, g, 'Ant');
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_9(){
|
|
return 65;
|
|
}
|
|
;
|
|
_.getEditInfo = function getEditInfo_7(n){
|
|
return null;
|
|
}
|
|
;
|
|
_.getInfo_0 = function getInfo_8(arr){
|
|
$getInfo(this, arr);
|
|
arr[0] = 'Antenna (amplified)';
|
|
}
|
|
;
|
|
_.getShortcut = function getShortcut_3(){
|
|
return 0;
|
|
}
|
|
;
|
|
_.getVoltage_0 = function getVoltage_0(){
|
|
var fm;
|
|
fm = 3 * $wnd.Math.sin(this.fmphase);
|
|
return $wnd.Math.sin($intern_2 * sim_0.t * 3000) * (1.3 + $wnd.Math.sin($intern_2 * sim_0.t * 12)) * 3 + $wnd.Math.sin($intern_2 * sim_0.t * 2710) * (1.3 + $wnd.Math.sin($intern_2 * sim_0.t * 13)) * 3 + $wnd.Math.sin($intern_2 * sim_0.t * 2433) * (1.3 + $wnd.Math.sin($intern_2 * sim_0.t * 14)) * 3 + fm;
|
|
}
|
|
;
|
|
_.stepFinished = function stepFinished_2(){
|
|
this.fmphase += $intern_2 * (2200 + $wnd.Math.sin($intern_2 * sim_0.t * 13) * 100) * sim_0.timeStep;
|
|
}
|
|
;
|
|
_.fmphase = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_AntennaElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'AntennaElm', 391);
|
|
function AudioFileEntry(){
|
|
}
|
|
|
|
defineClass(356, 1, {356:1}, AudioFileEntry);
|
|
var Lcom_lushprojects_circuitjs1_client_AudioFileEntry_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'AudioFileEntry', 356);
|
|
function $clinit_AudioInputElm(){
|
|
$clinit_AudioInputElm = emptyMethod;
|
|
audioFileMap = new HashMap;
|
|
}
|
|
|
|
function $genFileNumber(this$static){
|
|
var ent;
|
|
if (this$static.data_0) {
|
|
this$static.fileNum == 0 && (this$static.fileNum = fileNumCounter++);
|
|
ent = new AudioFileEntry;
|
|
ent.fileName = this$static.fileName;
|
|
ent.data_0 = this$static.data_0;
|
|
$put_0(audioFileMap, valueOf_0(this$static.fileNum), ent);
|
|
}
|
|
}
|
|
|
|
function $lookupFileNumber(this$static){
|
|
var ent;
|
|
ent = $get_1(audioFileMap, valueOf_0(this$static.fileNum));
|
|
if (ent) {
|
|
this$static.fileName = ent.fileName;
|
|
this$static.data_0 = ent.data_0;
|
|
}
|
|
}
|
|
|
|
function AudioInputElm(xx, yy){
|
|
$clinit_AudioInputElm();
|
|
RailElm_0.call(this, xx, yy, 1);
|
|
this.maxVoltage = 5;
|
|
}
|
|
|
|
function AudioInputElm_0(xa, ya, xb, yb, f, st){
|
|
$clinit_AudioInputElm();
|
|
RailElm_1.call(this, xa, ya, xb, yb, f, st);
|
|
this.waveform = 1;
|
|
this.maxVoltage = __parseAndValidateDouble($nextToken(st));
|
|
this.startPosition = __parseAndValidateDouble($nextToken(st));
|
|
this.fileNum = __parseAndValidateInt($nextToken(st), 10);
|
|
$lookupFileNumber(this);
|
|
this.samplingRate = lastSamplingRate;
|
|
}
|
|
|
|
function fetchLoadFileData(elm, uploadElement){
|
|
$clinit_AudioInputElm();
|
|
var oFiles = uploadElement.files;
|
|
var context = new (window.AudioContext || window.webkitAudioContext);
|
|
elm.setSamplingRate(context.sampleRate);
|
|
if (oFiles.length >= 1) {
|
|
var reader = new FileReader;
|
|
reader.onload = function(e_0){
|
|
context.decodeAudioData(reader.result, function(buffer){
|
|
var data_0 = buffer.getChannelData(0);
|
|
elm.gotAudioData(data_0);
|
|
}
|
|
, function(e){
|
|
console.log('Error with decoding audio data' + e.err);
|
|
}
|
|
);
|
|
}
|
|
;
|
|
reader.readAsArrayBuffer(oFiles[0]);
|
|
}
|
|
}
|
|
|
|
defineClass(357, 47, $intern_92, AudioInputElm, AudioInputElm_0);
|
|
_.drawRail = function drawRail_1(g){
|
|
$drawRailText(this, g, this.fileName == null?LS('No file'):this.fileName);
|
|
}
|
|
;
|
|
_.dumpXml = function dumpXml_7(doc, elem){
|
|
$dumpXml(this, elem);
|
|
dumpAttr(elem, 'ma', this.maxVoltage);
|
|
dumpAttr(elem, 'st', this.startPosition);
|
|
$genFileNumber(this);
|
|
dumpAttr_0(elem, 'fi', this.fileNum);
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_10(){
|
|
return 411;
|
|
}
|
|
;
|
|
_.getEditInfo = function getEditInfo_8(n){
|
|
var ei, file, thisElm;
|
|
if (n == 0) {
|
|
ei = new EditInfo_0('', 0, -1, -1);
|
|
thisElm = this;
|
|
file = new FileUpload;
|
|
ei.widget = file;
|
|
$addDomHandler(file, new AudioInputElm$1(this, file, thisElm), ($clinit_ChangeEvent() , $clinit_ChangeEvent() , TYPE_0));
|
|
return ei;
|
|
}
|
|
if (n == 1)
|
|
return $setUnitStep(new EditInfo('Max Voltage', this.maxVoltage));
|
|
if (n == 2)
|
|
return new EditInfo('Start Position (s)', this.startPosition);
|
|
return null;
|
|
}
|
|
;
|
|
_.getInfo_0 = function getInfo_9(arr){
|
|
var dur;
|
|
arr[0] = 'audio input';
|
|
if (!this.data_0) {
|
|
arr[1] = 'no file loaded';
|
|
return;
|
|
}
|
|
arr[1] = 'V = ' + getUnitText(this.volts[0], 'V', false);
|
|
arr[2] = 'pos = ' + getUnitText(this.timeOffset, 's', false);
|
|
dur = this.data_0.length / this.samplingRate;
|
|
arr[3] = 'dur = ' + getUnitText(dur, 's', false);
|
|
}
|
|
;
|
|
_.getRailText = function getRailText_0(){
|
|
return this.fileName == null?LS('No file'):this.fileName;
|
|
}
|
|
;
|
|
_.getShortcut = function getShortcut_4(){
|
|
return 0;
|
|
}
|
|
;
|
|
_.getVoltage_0 = function getVoltage_1(){
|
|
var dptr, frac, iptr, value1, value2;
|
|
if (!this.data_0)
|
|
return 0;
|
|
this.timeOffset < this.startPosition && (this.timeOffset = this.startPosition);
|
|
dptr = this.timeOffset * this.samplingRate;
|
|
iptr = round_int(dptr);
|
|
frac = dptr - iptr;
|
|
if (iptr >= this.data_0.length)
|
|
return 0;
|
|
value1 = this.data_0[iptr];
|
|
value2 = iptr + 1 < this.data_0.length?this.data_0[iptr + 1]:0;
|
|
return (value1 * (1 - frac) + value2 * frac) * this.maxVoltage;
|
|
}
|
|
;
|
|
_.getXmlDumpType = function getXmlDumpType_3(){
|
|
return 'ain';
|
|
}
|
|
;
|
|
_.gotAudioData = function gotAudioData(d){
|
|
this.data_0 = d;
|
|
lastSamplingRate = this.samplingRate;
|
|
lastSamplingRate_0 = this.samplingRate;
|
|
}
|
|
;
|
|
_.reset_0 = function reset_4(){
|
|
this.timeOffset = this.startPosition;
|
|
}
|
|
;
|
|
_.setEditValue = function setEditValue_7(n, ei){
|
|
n == 1 && (this.maxVoltage = ei.value_0);
|
|
n == 2 && (this.startPosition = ei.value_0);
|
|
}
|
|
;
|
|
_.setSamplingRate = function setSamplingRate(sr){
|
|
this.samplingRate = sr;
|
|
}
|
|
;
|
|
_.stepFinished = function stepFinished_3(){
|
|
this.timeOffset += sim_0.timeStep;
|
|
}
|
|
;
|
|
_.undumpXml = function undumpXml_8(xml){
|
|
$undumpXml(this, xml);
|
|
this.maxVoltage = $parseDoubleAttr(xml, 'ma', this.maxVoltage);
|
|
this.startPosition = $parseDoubleAttr(xml, 'st', this.startPosition);
|
|
this.fileNum = $parseIntAttr(xml, 'fi', this.fileNum);
|
|
$lookupFileNumber(this);
|
|
this.samplingRate = lastSamplingRate;
|
|
}
|
|
;
|
|
_.fileNum = 0;
|
|
_.maxVoltage = 0;
|
|
_.samplingRate = 0;
|
|
_.startPosition = 0;
|
|
_.timeOffset = 0;
|
|
var audioFileMap, fileNumCounter = 1, lastSamplingRate = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_AudioInputElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'AudioInputElm', 357);
|
|
function AudioInputElm$1(this$0, val$file, val$thisElm){
|
|
this.this$01 = this$0;
|
|
this.val$file2 = val$file;
|
|
this.val$thisElm3 = val$thisElm;
|
|
}
|
|
|
|
defineClass(827, 1, $intern_71, AudioInputElm$1);
|
|
_.onChange = function onChange_0(event_0){
|
|
this.this$01.fileName = $replaceAll($replaceAll($getElement(this.val$file2).value, '^.*\\\\', ''), '\\.[^.]*$', '');
|
|
fetchLoadFileData(this.val$thisElm3, $getElement(this.val$file2));
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_AudioInputElm$1_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'AudioInputElm/1', 827);
|
|
function $$init_2(this$static){
|
|
this$static.dataSampleCount = 0;
|
|
this$static.nextDataSample = 0;
|
|
this$static.samplingRateChoices = stampJavaTypeInfo(getClassLiteralForArray(I_classLit, 1), $intern_25, 7, 15, [8000, 11025, 16000, 22050, 44100, 48000]);
|
|
}
|
|
|
|
function $createButton(this$static){
|
|
$addWidgetToVerticalPanel(app_0, this$static.button_0 = new Button_1(''));
|
|
$setStylePrimaryName(this$static.button_0, 'topButton');
|
|
$setButtonLabel(this$static);
|
|
$addDomHandler(this$static.button_0, new AudioOutputElm$1(this$static), ($clinit_ClickEvent() , $clinit_ClickEvent() , TYPE_1));
|
|
}
|
|
|
|
function $getNextLabelNum(){
|
|
var ce, ce$iterator, ln, num;
|
|
num = 1;
|
|
if (!sim_0.elmList)
|
|
return 0;
|
|
for (ce$iterator = new ArrayList$1(sim_0.elmList.arrayList); ce$iterator.i < ce$iterator.this$01.array.length;) {
|
|
ce = $next_4(ce$iterator);
|
|
if (!instanceOf(ce, 245))
|
|
continue;
|
|
ln = ce.labelNum;
|
|
ln >= num && (num = ln + 1);
|
|
}
|
|
return num;
|
|
}
|
|
|
|
function $play(this$static){
|
|
var adj, arr, base, ct, fade, fadeLen, fadeMult, fadeOut, i, max_0, min_0, mult, s;
|
|
arr = [];
|
|
ct = this$static.dataPtr;
|
|
base = 0;
|
|
if (this$static.dataFull) {
|
|
ct = this$static.dataCount;
|
|
base = this$static.dataPtr;
|
|
}
|
|
if (ct * this$static.sampleStep < 0.05) {
|
|
alert_0(LS('Audio data is not ready yet. Increase simulation speed to make data ready sooner.'));
|
|
return;
|
|
}
|
|
max_0 = -100000000;
|
|
min_0 = $intern_97;
|
|
for (i = 0; i != ct; i++) {
|
|
this$static.data_0[i] > max_0 && (max_0 = this$static.data_0[i]);
|
|
this$static.data_0[i] < min_0 && (min_0 = this$static.data_0[i]);
|
|
}
|
|
adj = -(max_0 + min_0) / 2;
|
|
mult = 8191.5 / (max_0 + adj);
|
|
fadeLen = this$static.samplingRate / 20 | 0;
|
|
fadeOut = ct - fadeLen;
|
|
fadeMult = mult / fadeLen;
|
|
for (i = 0; i != ct; i++) {
|
|
fade = i < fadeLen?i * fadeMult:i > fadeOut?(ct - i) * fadeMult:mult;
|
|
s = round_int((this$static.data_0[(i + base) % this$static.dataCount] + adj) * fade);
|
|
arr[arr.length] = s;
|
|
}
|
|
playJS(arr, this$static.samplingRate);
|
|
}
|
|
|
|
function $setButtonLabel(this$static){
|
|
var label_0;
|
|
label_0 = '▶ ' + LS('Play Audio');
|
|
this$static.labelNum > 1 && (label_0 += ' ' + this$static.labelNum);
|
|
$setHTML(this$static.button_0, label_0);
|
|
}
|
|
|
|
function $setDataCount(this$static){
|
|
this$static.dataCount = round_int(this$static.samplingRate * this$static.duration);
|
|
this$static.data_0 = initUnidimensionalArray(D_classLit, $intern_76, 7, this$static.dataCount, 15, 1);
|
|
this$static.dataStart = sim_0.t;
|
|
this$static.dataPtr = 0;
|
|
this$static.dataFull = false;
|
|
this$static.sampleStep = 1 / this$static.samplingRate;
|
|
this$static.nextDataSample = sim_0.t + this$static.sampleStep;
|
|
}
|
|
|
|
function $setTimeStep(this$static){
|
|
var target;
|
|
target = this$static.sampleStep / 8;
|
|
if (sim_0.maxTimeStep != target) {
|
|
if (okToChangeTimeStep || confirm_2(LS('Adjust timestep for best audio quality and performance?'))) {
|
|
sim_0.maxTimeStep = target;
|
|
okToChangeTimeStep = true;
|
|
}
|
|
}
|
|
}
|
|
|
|
function AudioOutputElm(xx, yy){
|
|
CircuitElm.call(this, xx, yy);
|
|
$$init_2(this);
|
|
this.duration = 1;
|
|
this.samplingRate = lastSamplingRate_0;
|
|
this.labelNum = $getNextLabelNum();
|
|
$setDataCount(this);
|
|
$createButton(this);
|
|
}
|
|
|
|
function AudioOutputElm_0(xa, ya, xb, yb, f, st){
|
|
CircuitElm_0.call(this, xa, ya, xb, yb, f);
|
|
$$init_2(this);
|
|
this.duration = __parseAndValidateDouble($nextToken(st));
|
|
this.samplingRate = __parseAndValidateInt($nextToken(st), 10);
|
|
this.labelNum = __parseAndValidateInt($nextToken(st), 10);
|
|
$setDataCount(this);
|
|
$createButton(this);
|
|
}
|
|
|
|
function playJS(samples, sampleRate){
|
|
var Wav = function(opt_params){
|
|
this._sampleRate = opt_params && opt_params.sampleRate?opt_params.sampleRate:44100;
|
|
this._channels = opt_params && opt_params.channels?opt_params.channels:2;
|
|
this._eof = true;
|
|
this._bufferNeedle = 0;
|
|
}
|
|
;
|
|
Wav.prototype.setBuffer = function(buffer){
|
|
this._buffer = this.getWavInt16Array(buffer);
|
|
this._bufferNeedle = 0;
|
|
this._internalBuffer = '';
|
|
this._hasOutputHeader = false;
|
|
this._eof = false;
|
|
}
|
|
;
|
|
Wav.prototype.getBuffer = function(len){
|
|
var rt;
|
|
if (this._bufferNeedle + len >= this._buffer.length) {
|
|
rt = new Int16Array(this._buffer.length - this._bufferNeedle);
|
|
this._eof = true;
|
|
}
|
|
else {
|
|
rt = new Int16Array(len);
|
|
}
|
|
for (var i = 0; i < rt.length; i++) {
|
|
rt[i] = this._buffer[i + this._bufferNeedle];
|
|
}
|
|
this._bufferNeedle += rt.length;
|
|
return rt.buffer;
|
|
}
|
|
;
|
|
Wav.prototype.eof = function(){
|
|
return this._eof;
|
|
}
|
|
;
|
|
Wav.prototype.getWavInt16Array = function(buffer){
|
|
var intBuffer = new Int16Array(buffer.length + 23), tmp;
|
|
intBuffer[0] = 18770;
|
|
intBuffer[1] = 17990;
|
|
intBuffer[2] = 2 * buffer.length + 15 & $intern_8;
|
|
intBuffer[3] = (2 * buffer.length + 15 & $intern_98) >> 16;
|
|
intBuffer[4] = 16727;
|
|
intBuffer[5] = 17750;
|
|
intBuffer[6] = 28006;
|
|
intBuffer[7] = 8308;
|
|
intBuffer[8] = 18;
|
|
intBuffer[9] = 0;
|
|
intBuffer[10] = 1;
|
|
intBuffer[11] = this._channels;
|
|
intBuffer[12] = this._sampleRate & $intern_8;
|
|
intBuffer[13] = (this._sampleRate & $intern_98) >> 16;
|
|
intBuffer[14] = 2 * this._channels * this._sampleRate & $intern_8;
|
|
intBuffer[15] = (2 * this._channels * this._sampleRate & $intern_98) >> 16;
|
|
intBuffer[16] = 2 * this._channels;
|
|
intBuffer[17] = 16;
|
|
intBuffer[18] = 0;
|
|
intBuffer[19] = 24932;
|
|
intBuffer[20] = 24948;
|
|
intBuffer[21] = 2 * buffer.length & $intern_8;
|
|
intBuffer[22] = (2 * buffer.length & $intern_98) >> 16;
|
|
for (var i = 0; i < buffer.length; i++)
|
|
intBuffer[i + 23] = buffer[i];
|
|
return intBuffer;
|
|
}
|
|
;
|
|
var i_0 = 0, wav = new Wav({sampleRate:sampleRate, channels:1});
|
|
wav.setBuffer(samples);
|
|
var srclist = [];
|
|
while (!wav.eof()) {
|
|
srclist.push(wav.getBuffer($intern_22));
|
|
}
|
|
var oldblob = $doc.audioBlob;
|
|
var oldobj = $doc.audioObject;
|
|
if (oldblob) {
|
|
oldobj.parentNode.removeChild(oldobj);
|
|
URL.revokeObjectURL(oldblob);
|
|
}
|
|
var b = new Blob(srclist, {type:'audio/wav'});
|
|
var url_0 = URL.createObjectURL(b);
|
|
$doc.audioBlob = url_0;
|
|
var audio = $doc.createElement('audio');
|
|
$doc.audioObject = audio;
|
|
audio.src = url_0;
|
|
$doc.body.appendChild(audio);
|
|
audio.play();
|
|
}
|
|
|
|
defineClass(245, 8, {245:1, 8:1, 10:1}, AudioOutputElm, AudioOutputElm_0);
|
|
_.delete_0 = function delete_1(){
|
|
$removeWidgetFromVerticalPanel(app_0, this.button_0);
|
|
mouseElmRef == this && (mouseElmRef = null);
|
|
$deleteSliders(app_0, this);
|
|
}
|
|
;
|
|
_.draggingDone = function draggingDone_0(){
|
|
$setTimeStep(this);
|
|
}
|
|
;
|
|
_.draw = function draw_8(g){
|
|
var f, pct, s, selected, textWidth;
|
|
g.context.save();
|
|
g.savedFontSize = g.currentFontSize;
|
|
selected = mouseElmRef == this || this.selected_0 || $containsKey(app_0.mouse.scopePlotRoles, this) || instanceOf(mouseElmRef, 21) && $getElm_0(mouseElmRef.elmScope) == this || $isOnHighlightedNet(this);
|
|
f = new Font('SansSerif', selected?1:0, 14);
|
|
s = 'Audio Out';
|
|
this.labelNum > 1 && (s = 'Audio ' + this.labelNum);
|
|
$setFont_0(g, f);
|
|
textWidth = round_int($measureText(g.context, s).width);
|
|
$setColor_0(g, ($clinit_Color() , darkGray));
|
|
pct = this.dataFull?textWidth:textWidth * this.dataPtr / this.dataCount | 0;
|
|
$fillRect_0(g, this.x2 - (textWidth / 2 | 0), this.y2 - 10, pct, 20);
|
|
$setColor_0(g, selected?selectColor_0:whiteColor);
|
|
$interpPoint_1(this.point1, this.point2, this.lead1, 1 - (textWidth / 2 + 8) / this.dn);
|
|
$setBbox_0(this, this.point1, this.lead1, 0);
|
|
$drawCenteredText(this, g, s, this.x2, this.y2, true);
|
|
$setVoltageColor(this, g, this.volts[0]);
|
|
selected && $setColor_0(g, selectColor_0);
|
|
drawThickLine_0(g, this.point1, this.lead1, 3);
|
|
$drawPosts(this, g);
|
|
g.context.restore();
|
|
g.currentFontSize = g.savedFontSize;
|
|
}
|
|
;
|
|
_.dumpXml = function dumpXml_8(doc, elem){
|
|
dumpAttr_1(elem, 'x', this.x_0 + ' ' + this.y_0 + ' ' + this.x2 + ' ' + this.y2);
|
|
dumpAttr_0(elem, 'f', this.flags);
|
|
dumpAttr(elem, 'du', this.duration);
|
|
dumpAttr_0(elem, 'sa', this.samplingRate);
|
|
dumpAttr_0(elem, 'la', this.labelNum);
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_11(){
|
|
return 211;
|
|
}
|
|
;
|
|
_.getEditInfo = function getEditInfo_9(n){
|
|
var a, date, dtf, ei, fname, i, url_0;
|
|
if (n == 0) {
|
|
ei = $setPositive(new EditInfo_0('Duration (s)', this.duration, 0, 5));
|
|
return ei;
|
|
}
|
|
if (n == 1) {
|
|
ei = new EditInfo_0('Sampling Rate', 0, -1, -1);
|
|
ei.choice = new Choice;
|
|
for (i = 0; i != this.samplingRateChoices.length; i++) {
|
|
$addItem(ei.choice, LS(this.samplingRateChoices[i] + ''));
|
|
this.samplingRateChoices[i] == this.samplingRate && $select(ei.choice, i);
|
|
}
|
|
return ei;
|
|
}
|
|
if (n == 2) {
|
|
ei = new EditInfo_0('', 0, -1, -1);
|
|
url_0 = $doc.audioBlob;
|
|
if (url_0 == null)
|
|
return null;
|
|
date = new Date_0;
|
|
dtf = ($clinit_DateTimeFormat_0() , getFormat('yyyyMMdd-HHmm', $getDateTimeFormatInfo(($clinit_LocaleInfo() , $clinit_LocaleInfo() , instance_0))));
|
|
fname = 'audio-' + $format(dtf, date, null) + '.circuitjs.wav';
|
|
a = new Anchor_0(LS('Download last played audio'), url_0);
|
|
$setAttribute(($clinit_DOM() , a.element), 'Download', fname);
|
|
ei.widget = a;
|
|
return ei;
|
|
}
|
|
return null;
|
|
}
|
|
;
|
|
_.getInfo_0 = function getInfo_10(arr){
|
|
var ct, dur;
|
|
arr[0] = 'audio output';
|
|
arr[1] = 'V = ' + getUnitText(this.volts[0], 'V', false);
|
|
ct = this.dataFull?this.dataCount:this.dataPtr;
|
|
dur = this.sampleStep * ct;
|
|
arr[2] = 'start = ' + getUnitText(this.dataFull?sim_0.t - this.duration:this.dataStart, 's', false);
|
|
arr[3] = 'dur = ' + getUnitText(dur, 's', false);
|
|
arr[4] = 'samples = ' + ct + (this.dataFull?'':'/' + this.dataCount);
|
|
}
|
|
;
|
|
_.getPostCount_0 = function getPostCount_7(){
|
|
return 1;
|
|
}
|
|
;
|
|
_.getVoltageDiff_0 = function getVoltageDiff_4(){
|
|
return this.volts[0];
|
|
}
|
|
;
|
|
_.getXmlDumpType = function getXmlDumpType_4(){
|
|
return 'aout';
|
|
}
|
|
;
|
|
_.reset_0 = function reset_5(){
|
|
this.dataPtr = 0;
|
|
this.dataFull = false;
|
|
this.dataSampleCount = 0;
|
|
this.nextDataSample = 0;
|
|
this.dataSample = 0;
|
|
}
|
|
;
|
|
_.setEditValue = function setEditValue_8(n, ei){
|
|
var nsr;
|
|
if (n == 0 && ei.value_0 > 0) {
|
|
this.duration = ei.value_0;
|
|
$setDataCount(this);
|
|
}
|
|
if (n == 1) {
|
|
nsr = this.samplingRateChoices[$getElement(ei.choice).selectedIndex];
|
|
if (nsr != this.samplingRate) {
|
|
this.samplingRate = nsr;
|
|
lastSamplingRate_0 = nsr;
|
|
$setDataCount(this);
|
|
$setTimeStep(this);
|
|
}
|
|
}
|
|
}
|
|
;
|
|
_.setPoints = function setPoints_9(){
|
|
$setPoints(this);
|
|
this.lead1 = new Point_1;
|
|
}
|
|
;
|
|
_.stepFinished = function stepFinished_4(){
|
|
this.dataSample += this.volts[0];
|
|
++this.dataSampleCount;
|
|
if (sim_0.t >= this.nextDataSample) {
|
|
this.nextDataSample += this.sampleStep;
|
|
this.data_0[this.dataPtr++] = this.dataSample / this.dataSampleCount;
|
|
this.dataSampleCount = 0;
|
|
this.dataSample = 0;
|
|
if (this.dataPtr >= this.dataCount) {
|
|
this.dataPtr = 0;
|
|
this.dataFull = true;
|
|
}
|
|
}
|
|
}
|
|
;
|
|
_.undumpXml = function undumpXml_9(xml){
|
|
this.flags = $parseIntAttr(xml, 'f', this.flags);
|
|
this.duration = $parseDoubleAttr(xml, 'du', this.duration);
|
|
this.samplingRate = $parseIntAttr(xml, 'sa', this.samplingRate);
|
|
this.labelNum = $parseIntAttr(xml, 'la', this.labelNum);
|
|
$setDataCount(this);
|
|
$setButtonLabel(this);
|
|
}
|
|
;
|
|
_.dataCount = 0;
|
|
_.dataFull = false;
|
|
_.dataPtr = 0;
|
|
_.dataSample = 0;
|
|
_.dataSampleCount = 0;
|
|
_.dataStart = 0;
|
|
_.duration = 0;
|
|
_.labelNum = 0;
|
|
_.nextDataSample = 0;
|
|
_.sampleStep = 0;
|
|
_.samplingRate = 0;
|
|
var lastSamplingRate_0 = 8000, okToChangeTimeStep = false;
|
|
var Lcom_lushprojects_circuitjs1_client_AudioOutputElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'AudioOutputElm', 245);
|
|
function AudioOutputElm$1(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(823, 1, $intern_56, AudioOutputElm$1);
|
|
_.onClick = function onClick_1(event_0){
|
|
$play(this.this$01);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_AudioOutputElm$1_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'AudioOutputElm/1', 823);
|
|
function $clinit_BatteryElm(){
|
|
$clinit_BatteryElm = emptyMethod;
|
|
batteryTypeNames = stampJavaTypeInfo(getClassLiteralForArray(Ljava_lang_String_2_classLit, 1), $intern_23, 2, 6, ['Alkaline 1.5V', 'Lithium-Ion', 'NiMH 1.2V', 'NiCd 1.2V', 'Lead-Acid']);
|
|
batteryTypeTables = stampJavaTypeInfo(getClassLiteralForArray(Ljava_lang_String_2_classLit, 1), $intern_23, 2, 6, ['0=0.8\n10=0.95\n20=1.05\n40=1.18\n60=1.28\n80=1.38\n90=1.43\n100=1.55\n', '0=3.00\n5=3.30\n10=3.45\n20=3.55\n30=3.62\n40=3.68\n50=3.73\n60=3.79\n70=3.87\n80=3.97\n90=4.08\n95=4.15\n100=4.20\n', '0=1.00\n10=1.15\n20=1.20\n50=1.25\n80=1.30\n90=1.33\n100=1.40\n', '0=1.00\n10=1.15\n20=1.20\n50=1.22\n80=1.25\n90=1.28\n100=1.35\n', '0=1.75\n10=1.90\n20=1.95\n50=2.05\n80=2.10\n90=2.12\n100=2.15\n']);
|
|
batteryTypeDefaults = stampJavaTypeInfo(getClassLiteralForArray(D_classLit, 2), $intern_3, 12, 0, [stampJavaTypeInfo(getClassLiteralForArray(D_classLit, 1), $intern_76, 7, 15, [2.5, 0.15, 0.25, 1500]), stampJavaTypeInfo(getClassLiteralForArray(D_classLit, 1), $intern_76, 7, 15, [3, 0.025, $intern_36, 2000]), stampJavaTypeInfo(getClassLiteralForArray(D_classLit, 1), $intern_76, 7, 15, [2, 0.03, 0.04, 1800]), stampJavaTypeInfo(getClassLiteralForArray(D_classLit, 1), $intern_76, 7, 15, [1, $intern_36, 0.025, 1200]), stampJavaTypeInfo(getClassLiteralForArray(D_classLit, 1), $intern_76, 7, 15, [10, 0.008, 0.012, 5000])]);
|
|
}
|
|
|
|
function $getVoltageForSoc(this$static, socFrac){
|
|
var slope, socPct, v0, v10;
|
|
socPct = socFrac * 100;
|
|
if (socPct < 0) {
|
|
v0 = $interpSocTable(this$static, 0);
|
|
v10 = $interpSocTable(this$static, 10);
|
|
slope = (v10 - v0) / 10;
|
|
return v0 + slope * 3 * socPct;
|
|
}
|
|
return $interpSocTable(this$static, socPct);
|
|
}
|
|
|
|
function $interpSocTable(this$static, socPct){
|
|
var a, b, frac, i, n;
|
|
if (!this$static.socTable || this$static.socTable.arrayList.array.length == 0)
|
|
return 3.7;
|
|
if (this$static.socTable.arrayList.array.length == 1)
|
|
return $get_4(this$static.socTable, 0)[1];
|
|
if (socPct <= $get_4(this$static.socTable, 0)[0])
|
|
return $get_4(this$static.socTable, 0)[1];
|
|
n = this$static.socTable.arrayList.array.length;
|
|
if (socPct >= $get_4(this$static.socTable, n - 1)[0])
|
|
return $get_4(this$static.socTable, n - 1)[1];
|
|
for (i = 0; i < n - 1; i++) {
|
|
a = $get_4(this$static.socTable, i);
|
|
b = $get_4(this$static.socTable, i + 1);
|
|
if (socPct >= a[0] && socPct <= b[0]) {
|
|
if (b[0] === a[0])
|
|
return a[1];
|
|
frac = (socPct - a[0]) / (b[0] - a[0]);
|
|
return a[1] + frac * (b[1] - a[1]);
|
|
}
|
|
}
|
|
return $get_4(this$static.socTable, n - 1)[1];
|
|
}
|
|
|
|
function $parseSocTable(this$static, ei){
|
|
var cur, eq, i, i0, j, line, lines, socPct, v;
|
|
this$static.socTable = new Vector;
|
|
if (this$static.socVoltageTable == null || this$static.socVoltageTable.length == 0)
|
|
return;
|
|
lines = $split_1(this$static.socVoltageTable, '\n', 0);
|
|
for (i0 = 0; i0 != lines.length; i0++) {
|
|
line = $trim(lines[i0]);
|
|
if (line.length == 0)
|
|
continue;
|
|
eq = $indexOf_1(line, fromCodePoint(61));
|
|
if (eq < 0) {
|
|
!!ei && (ei.error = 'missing =: ' + line);
|
|
continue;
|
|
}
|
|
try {
|
|
socPct = __parseAndValidateDouble($trim(line.substr(0, eq)));
|
|
v = __parseAndValidateDouble($trim(line.substr(eq + 1)));
|
|
$add_11(this$static.socTable, stampJavaTypeInfo(getClassLiteralForArray(D_classLit, 1), $intern_76, 7, 15, [socPct, v]));
|
|
}
|
|
catch ($e0) {
|
|
$e0 = toJava($e0);
|
|
if (instanceOf($e0, 13)) {
|
|
!!ei && (ei.error = 'bad line: ' + line);
|
|
}
|
|
else
|
|
throw toJs($e0);
|
|
}
|
|
}
|
|
for (i = 1; i < this$static.socTable.arrayList.array.length; i++) {
|
|
cur = $get_4(this$static.socTable, i);
|
|
j = i - 1;
|
|
while (j >= 0 && $get_4(this$static.socTable, j)[0] > cur[0]) {
|
|
$set_2(this$static.socTable, j + 1, $get_4(this$static.socTable, j));
|
|
--j;
|
|
}
|
|
$set_2(this$static.socTable, j + 1, cur);
|
|
}
|
|
}
|
|
|
|
function $reset_1(this$static){
|
|
this$static.soc = clampSoc(this$static.initialSoc);
|
|
this$static.capVoltDiff = this$static.capCurrent = this$static.curSourceValue = 0;
|
|
this$static.curcount_0 = 0;
|
|
}
|
|
|
|
function BatteryElm(xx, yy){
|
|
$clinit_BatteryElm();
|
|
CircuitElm.call(this, xx, yy);
|
|
this.r0 = $intern_34;
|
|
this.r1 = $intern_36;
|
|
this.c1 = 2000;
|
|
this.capacityAh = 2;
|
|
this.initialSoc = 1;
|
|
this.flags |= 3;
|
|
this.batteryType = 1;
|
|
this.socVoltageTable = batteryTypeTables[this.batteryType];
|
|
$parseSocTable(this, null);
|
|
$reset_1(this);
|
|
}
|
|
|
|
function clampSoc(s){
|
|
if (s < 0)
|
|
return 0;
|
|
if (s > 1)
|
|
return 1;
|
|
return s;
|
|
}
|
|
|
|
defineClass(300, 8, {300:1, 8:1, 10:1}, BatteryElm);
|
|
_.addRoutingObstacle = function addRoutingObstacle_4(wr){
|
|
$addRoutingObstacleWithLeads(this, wr, 16);
|
|
}
|
|
;
|
|
_.doStep = function doStep_8(){
|
|
$updateVoltageSource(this.voltSource, $getVoltageForSoc(this, this.soc));
|
|
$stampCurrentSource(this.nodes[3], this.nodes[1], this.curSourceValue);
|
|
}
|
|
;
|
|
_.dragPlace = function dragPlace_1(xa, ya, vertical){
|
|
$dragPlace(this, xa, ya, vertical);
|
|
$swapDragEndpoints(this);
|
|
}
|
|
;
|
|
_.draw = function draw_9(g){
|
|
var s, showSoc, showV;
|
|
$setBbox(this, this.x_0, this.y_0, this.x2, this.y2);
|
|
$draw2Leads(this, g);
|
|
$setVoltageColor(this, g, this.volts[0]);
|
|
$setPowerColor_0(this, g);
|
|
$interpPoint2(this.lead1, this.lead2, ps1, ps2, 0, 10);
|
|
drawThickLine_0(g, ps1, ps2, 3);
|
|
$setVoltageColor(this, g, this.volts[1]);
|
|
$setPowerColor_0(this, g);
|
|
$setBbox_0(this, this.point1, this.point2, 16);
|
|
$interpPoint2(this.lead1, this.lead2, ps1, ps2, 1, 16);
|
|
drawThickLine_0(g, ps1, ps2, 3);
|
|
if (this.dx == 0 || this.dy == 0) {
|
|
showV = (this.flags & 1) != 0;
|
|
showSoc = (this.flags & 2) != 0;
|
|
s = null;
|
|
showV && showSoc?(s = getUnitText($getVoltageForSoc(this, this.soc), 'V', true) + ' ' + (toString_8(fromDouble_0($wnd.Math.round(this.soc * 100))) + '%')):showV?(s = getUnitText($getVoltageForSoc(this, this.soc), 'V', true)):showSoc && (s = toString_8(fromDouble_0($wnd.Math.round(this.soc * 100))) + '%');
|
|
s != null && $drawValues(this, g, s, 16);
|
|
}
|
|
this.curcount_0 = $updateDotCount(this.current_0, this.curcount_0);
|
|
app_0.mouse.dragElm == this || $drawDots(g, this.point1, this.point2, this.curcount_0);
|
|
$drawPosts(this, g);
|
|
}
|
|
;
|
|
_.dumpXml = function dumpXml_9(doc, elem){
|
|
dumpAttr_1(elem, 'x', this.x_0 + ' ' + this.y_0 + ' ' + this.x2 + ' ' + this.y2);
|
|
dumpAttr_0(elem, 'f', this.flags);
|
|
dumpAttr(elem, 'r0', this.r0);
|
|
dumpAttr(elem, 'r1', this.r1);
|
|
dumpAttr(elem, 'c1', this.c1);
|
|
dumpAttr(elem, 'cap', this.capacityAh);
|
|
dumpAttr(elem, 'isoc', this.initialSoc);
|
|
dumpAttr_0(elem, 'bt', this.batteryType);
|
|
this.batteryType == -1 && this.socVoltageTable != null && this.socVoltageTable.length > 0 && $appendChild_0(elem, $createTextNode(doc, this.socVoltageTable));
|
|
}
|
|
;
|
|
_.dumpXmlState = function dumpXmlState_2(doc, elem){
|
|
dumpAttr(elem, 'soc', this.soc);
|
|
}
|
|
;
|
|
_.getDragVertical = function getDragVertical_2(requestedVertical){
|
|
return true;
|
|
}
|
|
;
|
|
_.getEditInfo = function getEditInfo_10(n){
|
|
var ei, i;
|
|
if (n == 0) {
|
|
ei = new EditInfo_0('Battery Type', this.batteryType, -1, -1);
|
|
ei.choice = new Choice;
|
|
for (i = 0; i != batteryTypeNames.length; i++)
|
|
$addItem(ei.choice, LS(batteryTypeNames[i]));
|
|
$addItem(ei.choice, LS('Custom'));
|
|
$select(ei.choice, this.batteryType == -1?batteryTypeNames.length:this.batteryType);
|
|
return ei;
|
|
}
|
|
if (n == 1)
|
|
return $setPositive(new EditInfo('Capacity (Ah)', this.capacityAh));
|
|
if (n == 2)
|
|
return $setDimensionless(new EditInfo_0('Initial State of Charge (%)', this.initialSoc * 100, 0, 100));
|
|
if (n == 3)
|
|
return $setPositive(new EditInfo('R0, Ohmic Resistance (ohms)', this.r0));
|
|
if (n == 4)
|
|
return $setPositive(new EditInfo('R1, Polarization Resistance (ohms)', this.r1));
|
|
if (n == 5)
|
|
return $setPositive(new EditInfo('C1, Polarization Capacitance (F)', this.c1));
|
|
if (n == 6) {
|
|
ei = new EditInfo_0('', 0, -1, -1);
|
|
ei.checkbox = new Checkbox_0('Show Voltage', (this.flags & 1) != 0);
|
|
return ei;
|
|
}
|
|
if (n == 7) {
|
|
ei = new EditInfo_0('', 0, -1, -1);
|
|
ei.checkbox = new Checkbox_0('Show State of Charge', (this.flags & 2) != 0);
|
|
return ei;
|
|
}
|
|
if (n == 8 && this.batteryType == -1) {
|
|
ei = new EditInfo('SOC(%) = Voltage Table', 0);
|
|
ei.textArea = new TextArea_0;
|
|
$setVisibleLines(ei.textArea, 6);
|
|
$setText_2(ei.textArea, this.socVoltageTable);
|
|
return ei;
|
|
}
|
|
return null;
|
|
}
|
|
;
|
|
_.getInfo_0 = function getInfo_11(arr){
|
|
arr[0] = LS('battery') + ' (' + LS(this.batteryType >= 0 && this.batteryType < batteryTypeNames.length?batteryTypeNames[this.batteryType]:'Custom') + ')';
|
|
arr[1] = 'I = ' + getUnitText(this.current_0, 'A', false);
|
|
arr[2] = 'Vd = ' + getUnitText(this.volts[1] - this.volts[0], 'V', false);
|
|
arr[3] = 'SOC = ' + (toString_8(fromDouble_0($wnd.Math.round(this.soc * 100))) + '%');
|
|
arr[4] = 'P = ' + getUnitText(-(this.volts[1] - this.volts[0]) * this.current_0, 'W', false);
|
|
}
|
|
;
|
|
_.getInternalNodeCount = function getInternalNodeCount_1(){
|
|
return 2;
|
|
}
|
|
;
|
|
_.getPower = function getPower_3(){
|
|
return -(this.volts[1] - this.volts[0]) * this.current_0;
|
|
}
|
|
;
|
|
_.getVoltageDiff_0 = function getVoltageDiff_5(){
|
|
return this.volts[1] - this.volts[0];
|
|
}
|
|
;
|
|
_.getVoltageSourceCount = function getVoltageSourceCount_6(){
|
|
return 1;
|
|
}
|
|
;
|
|
_.reset_0 = function reset_6(){
|
|
$reset_1(this);
|
|
}
|
|
;
|
|
_.setEditValue = function setEditValue_9(n, ei){
|
|
var d, oldType, sel, v;
|
|
if (n == 0 && !!ei.choice) {
|
|
oldType = this.batteryType;
|
|
sel = $getElement(ei.choice).selectedIndex;
|
|
this.batteryType = sel >= batteryTypeNames.length?-1:sel;
|
|
if (this.batteryType != -1) {
|
|
this.socVoltageTable = batteryTypeTables[this.batteryType];
|
|
if (this.batteryType != oldType) {
|
|
d = batteryTypeDefaults[this.batteryType];
|
|
this.capacityAh = d[0];
|
|
this.r0 = d[1];
|
|
this.r1 = d[2];
|
|
this.c1 = d[3];
|
|
}
|
|
}
|
|
else
|
|
oldType != -1 && (this.socVoltageTable = batteryTypeTables[oldType]);
|
|
$parseSocTable(this, null);
|
|
this.batteryType != oldType && (ei.newDialog = true);
|
|
}
|
|
n == 1 && (this.capacityAh = ei.value_0);
|
|
if (n == 2) {
|
|
v = ei.value_0;
|
|
v < 0 && (v = 0);
|
|
v > 100 && (v = 100);
|
|
this.initialSoc = v * $intern_34;
|
|
}
|
|
n == 3 && (this.r0 = ei.value_0);
|
|
n == 4 && (this.r1 = ei.value_0);
|
|
n == 5 && (this.c1 = ei.value_0);
|
|
n == 6 && !!ei.checkbox && (this.flags = $changeFlag(ei, this.flags, 1));
|
|
n == 7 && !!ei.checkbox && (this.flags = $changeFlag(ei, this.flags, 2));
|
|
if (n == 8) {
|
|
this.socVoltageTable = $getText(ei.textArea);
|
|
$parseSocTable(this, ei);
|
|
}
|
|
}
|
|
;
|
|
_.setPoints = function setPoints_10(){
|
|
$setPoints(this);
|
|
$calcLeads(this, 8);
|
|
}
|
|
;
|
|
_.setVoltageSource = function setVoltageSource_4(n, v){
|
|
this.voltSource = v;
|
|
$setNodes(v, this.nodes[0], this.nodes[2]);
|
|
}
|
|
;
|
|
_.stamp = function stamp_9(){
|
|
$stampVoltageSource(this.nodes[0], this.nodes[2], this.voltSource);
|
|
$stampResistor(this.nodes[2], this.nodes[3], this.r0);
|
|
$stampResistor(this.nodes[3], this.nodes[1], this.r1);
|
|
app_0.dcAnalysisFlag?(this.compResistance = $intern_97):(this.compResistance = sim_0.timeStep / (2 * this.c1));
|
|
$stampResistor(this.nodes[3], this.nodes[1], this.compResistance);
|
|
}
|
|
;
|
|
_.startIteration = function startIteration_1(){
|
|
app_0.dcAnalysisFlag?(this.curSourceValue = 0):(this.curSourceValue = -this.capVoltDiff / this.compResistance - this.capCurrent);
|
|
}
|
|
;
|
|
_.stepFinished = function stepFinished_5(){
|
|
this.capVoltDiff = this.volts[3] - this.volts[1];
|
|
this.compResistance > 0 && (this.capCurrent = this.capVoltDiff / this.compResistance + this.curSourceValue);
|
|
if (this.capacityAh > 0 && !app_0.dcAnalysisFlag) {
|
|
this.soc -= this.current_0 * sim_0.timeStep / (3600 * this.capacityAh);
|
|
this.soc > 1 && (this.soc = 1);
|
|
}
|
|
}
|
|
;
|
|
_.undumpXml = function undumpXml_10(xml){
|
|
var e;
|
|
this.flags = $parseIntAttr(xml, 'f', this.flags);
|
|
this.r0 = $parseDoubleAttr(xml, 'r0', $intern_34);
|
|
this.r1 = $parseDoubleAttr(xml, 'r1', $intern_36);
|
|
this.c1 = $parseDoubleAttr(xml, 'c1', 2000);
|
|
this.capacityAh = $parseDoubleAttr(xml, 'cap', 2);
|
|
this.initialSoc = clampSoc($parseDoubleAttr(xml, 'isoc', 1));
|
|
this.soc = $wnd.Math.min(1, $parseDoubleAttr(xml, 'soc', this.initialSoc));
|
|
this.batteryType = $parseIntAttr(xml, 'bt', 1);
|
|
if (this.batteryType == -1) {
|
|
this.socVoltageTable = '';
|
|
try {
|
|
this.socVoltageTable = $parseContents(xml);
|
|
}
|
|
catch ($e0) {
|
|
$e0 = toJava($e0);
|
|
if (instanceOf($e0, 13)) {
|
|
e = $e0;
|
|
console.log('exception in undump ' + e);
|
|
}
|
|
else
|
|
throw toJs($e0);
|
|
}
|
|
(this.socVoltageTable == null || this.socVoltageTable.length == 0) && (this.socVoltageTable = batteryTypeTables[1]);
|
|
}
|
|
else
|
|
this.socVoltageTable = this.batteryType >= 0 && this.batteryType < batteryTypeTables.length?batteryTypeTables[this.batteryType]:batteryTypeTables[1];
|
|
$parseSocTable(this, null);
|
|
}
|
|
;
|
|
_.batteryType = 0;
|
|
_.c1 = 0;
|
|
_.capCurrent = 0;
|
|
_.capVoltDiff = 0;
|
|
_.capacityAh = 0;
|
|
_.compResistance = 0;
|
|
_.curSourceValue = 0;
|
|
_.initialSoc = 0;
|
|
_.r0 = 0;
|
|
_.r1 = 0;
|
|
_.soc = 0;
|
|
var batteryTypeDefaults, batteryTypeNames, batteryTypeTables;
|
|
var Lcom_lushprojects_circuitjs1_client_BatteryElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'BatteryElm', 300);
|
|
function GraphicElm(xx, yy){
|
|
CircuitElm.call(this, xx, yy);
|
|
}
|
|
|
|
function GraphicElm_0(xa, ya, xb, yb, flags){
|
|
CircuitElm_0.call(this, xa, ya, xb, yb, flags);
|
|
}
|
|
|
|
defineClass(133, 8, $intern_99, GraphicElm);
|
|
_.getPostCount_0 = function getPostCount_8(){
|
|
return 0;
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_GraphicElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'GraphicElm', 133);
|
|
function BoxElm(xx, yy){
|
|
GraphicElm.call(this, xx, yy);
|
|
this.x2 = xx;
|
|
this.y2 = yy;
|
|
$setBbox(this, this.x_0, this.y_0, this.x2, this.y2);
|
|
}
|
|
|
|
function BoxElm_0(xa, ya, xb, yb, f){
|
|
GraphicElm_0.call(this, xa, ya, xb, yb, f);
|
|
this.x2 = xb;
|
|
this.y2 = yb;
|
|
$setBbox(this, this.x_0, this.y_0, this.x2, this.y2);
|
|
}
|
|
|
|
defineClass(374, 133, $intern_99, BoxElm, BoxElm_0);
|
|
_.creationFailed = function creationFailed_0(){
|
|
return $wnd.Math.abs(this.x2 - this.x_0) < 32 || $wnd.Math.abs(this.y2 - this.y_0) < 32;
|
|
}
|
|
;
|
|
_.drag = function drag_1(xx, yy){
|
|
this.x2 = xx;
|
|
this.y2 = yy;
|
|
}
|
|
;
|
|
_.draw = function draw_10(g){
|
|
$setColor_0(g, mouseElmRef == this || this.selected_0 || $containsKey(app_0.mouse.scopePlotRoles, this) || instanceOf(mouseElmRef, 21) && $getElm_0(mouseElmRef.elmScope) == this || $isOnHighlightedNet(this)?selectColor_0:($clinit_Color() , GRAY));
|
|
$setBbox(this, this.x_0, this.y_0, this.x2, this.y2);
|
|
setLineDash(g.context, 16, 6);
|
|
this.x_0 < this.x2 && this.y_0 < this.y2?$drawRect(g, this.x_0, this.y_0, this.x2 - this.x_0, this.y2 - this.y_0):this.x_0 > this.x2 && this.y_0 < this.y2?$drawRect(g, this.x2, this.y_0, this.x_0 - this.x2, this.y2 - this.y_0):this.x_0 < this.x2 && this.y_0 > this.y2?$drawRect(g, this.x_0, this.y2, this.x2 - this.x_0, this.y_0 - this.y2):$drawRect(g, this.x2, this.y2, this.x_0 - this.x2, this.y_0 - this.y2);
|
|
setLineDash(g.context, 0, 0);
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_12(){
|
|
return 98;
|
|
}
|
|
;
|
|
_.getEditInfo = function getEditInfo_11(n){
|
|
return null;
|
|
}
|
|
;
|
|
_.getInfo_0 = function getInfo_12(arr){
|
|
}
|
|
;
|
|
_.getMouseDistance = function getMouseDistance_0(gx, gy){
|
|
var dx1, dx2, dy1, dy2;
|
|
dx1 = $wnd.Math.abs(gx - this.x_0);
|
|
dy1 = $wnd.Math.abs(gy - this.y_0);
|
|
dx2 = $wnd.Math.abs(gx - this.x2);
|
|
dy2 = $wnd.Math.abs(gy - this.y2);
|
|
if ($wnd.Math.abs(dx1) < 10)
|
|
return dx1 * dx1;
|
|
if ($wnd.Math.abs(dx2) < 10)
|
|
return dx2 * dx2;
|
|
if ($wnd.Math.abs(dy1) < 10)
|
|
return dy1 * dy1;
|
|
if ($wnd.Math.abs(dy2) < 10)
|
|
return dy2 * dy2;
|
|
return -1;
|
|
}
|
|
;
|
|
_.getShortcut = function getShortcut_5(){
|
|
return 0;
|
|
}
|
|
;
|
|
_.selectRect = function selectRect_0(r, add_0){
|
|
$contains_0(r, this.boundingBox)?(this.selected_0 = true):add_0 || (this.selected_0 = false);
|
|
}
|
|
;
|
|
_.setEditValue = function setEditValue_10(n, ei){
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_BoxElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'BoxElm', 374);
|
|
function $dumpXml_2(this$static, elem){
|
|
dumpAttr_1(elem, 'x', this$static.x_0 + ' ' + this$static.y_0 + ' ' + this$static.x2 + ' ' + this$static.y2);
|
|
dumpAttr_0(elem, 'f', this$static.flags);
|
|
this$static.position != 0 && dumpAttr_0(elem, 'p', this$static.position);
|
|
this$static.momentary && dumpAttr_2(elem, 'mm', this$static.momentary);
|
|
this$static.label_0 != null && dumpAttr_1(elem, 'lab', this$static.label_0);
|
|
this$static.keyShortcut != null && dumpAttr_1(elem, 'key', this$static.keyShortcut);
|
|
this$static.resistance != 0 && dumpAttr(elem, 'r', this$static.resistance);
|
|
}
|
|
|
|
function $getEditInfo_1(this$static, n){
|
|
var ei;
|
|
if (n == 0) {
|
|
ei = new EditInfo_0('', 0, -1, -1);
|
|
ei.checkbox = new Checkbox_0('Momentary Switch', this$static.momentary);
|
|
return ei;
|
|
}
|
|
if (n == 1)
|
|
return createCheckbox('IEC Symbol', (this$static.flags & 2) != 0);
|
|
if (n == 2)
|
|
return new EditInfo_1('Label (for linking)', this$static.label_0 == null?'':this$static.label_0);
|
|
if (n == 3)
|
|
return new EditInfo_1('Keyboard Shortcut', this$static.keyShortcut == null?'':this$static.keyShortcut);
|
|
if (n == 4) {
|
|
ei = new EditInfo('On Resistance (ohms)', this$static.resistance);
|
|
ei.nonNegative = true;
|
|
return ei;
|
|
}
|
|
return null;
|
|
}
|
|
|
|
function $mouseUp(this$static){
|
|
this$static.momentary && this$static.toggle();
|
|
}
|
|
|
|
function $setEditValue_2(this$static, n, ei){
|
|
var s;
|
|
n == 0 && (this$static.momentary = $getState(ei.checkbox));
|
|
if (n == 1) {
|
|
this$static.flags = $changeFlag(ei, this$static.flags, 2);
|
|
this$static.setPoints();
|
|
}
|
|
if (n == 2) {
|
|
this$static.label_0 = $getText(ei.textf);
|
|
if (this$static.label_0.length == 0) {
|
|
this$static.label_0 = null;
|
|
this$static.flags &= -5;
|
|
}
|
|
else
|
|
this$static.flags |= 4;
|
|
}
|
|
n == 3 && (s = $trim($getText(ei.textf)) , s.length == 0?(this$static.keyShortcut = null):(this$static.keyShortcut = s.substr(0, 1).toLowerCase()));
|
|
n == 4 && (this$static.resistance = ei.value_0);
|
|
}
|
|
|
|
function $setPoints_3(this$static){
|
|
$setPoints(this$static);
|
|
$calcLeads(this$static, 32);
|
|
this$static.ps = new Point_1;
|
|
this$static.ps2 = new Point_1;
|
|
if ((this$static.flags & 2) != 0) {
|
|
this$static.extraPoints = $newPointArray(7);
|
|
$interpPoint_2(this$static.lead1, this$static.lead2, this$static.extraPoints[0], 0.5, 8);
|
|
$interpPoint_2(this$static.lead1, this$static.lead2, this$static.extraPoints[1], 0.5, 24);
|
|
$interpPoint_2(this$static.lead1, this$static.lead2, this$static.extraPoints[2], 0.4, 24);
|
|
$interpPoint_2(this$static.lead1, this$static.lead2, this$static.extraPoints[3], 0.6, 24);
|
|
$interpPoint_2(this$static.lead1, this$static.lead2, this$static.extraPoints[4], 0.5, 19);
|
|
$interpPoint_2(this$static.lead1, this$static.lead2, this$static.extraPoints[5], 0.4, 16);
|
|
$interpPoint_2(this$static.lead1, this$static.lead2, this$static.extraPoints[6], 0.5, 13);
|
|
}
|
|
}
|
|
|
|
function $toggle(this$static){
|
|
var i, o, s2;
|
|
++this$static.position;
|
|
this$static.position >= this$static.posCount && (this$static.position = 0);
|
|
if (this$static.label_0 != null) {
|
|
for (i = 0; i != sim_0.elmList.arrayList.array.length; i++) {
|
|
o = $elementAt(sim_0.elmList, i);
|
|
if (instanceOf(o, 61) && o !== this$static) {
|
|
s2 = o;
|
|
$equals_1(this$static.label_0, s2.label_0) && (++s2.position , s2.position >= s2.posCount && (s2.position = 0));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
function $undumpXml_1(this$static, xml){
|
|
this$static.flags = $parseIntAttr(xml, 'f', this$static.flags);
|
|
this$static.position = $parseIntAttr(xml, 'p', this$static.position);
|
|
this$static.momentary = $parseBooleanAttr(xml, 'mm', this$static.momentary);
|
|
this$static.label_0 = $parseStringAttr(xml, 'lab', this$static.label_0);
|
|
this$static.keyShortcut = $parseStringAttr(xml, 'key', this$static.keyShortcut);
|
|
this$static.resistance = $parseDoubleAttr(xml, 'r', 0);
|
|
}
|
|
|
|
function SwitchElm(xx, yy){
|
|
CircuitElm.call(this, xx, yy);
|
|
this.momentary = false;
|
|
this.position = 0;
|
|
this.posCount = 2;
|
|
this.label_0 = null;
|
|
this.keyShortcut = null;
|
|
}
|
|
|
|
function SwitchElm_0(xa, ya, xb, yb, f, st){
|
|
var str;
|
|
CircuitElm_0.call(this, xa, ya, xb, yb, f);
|
|
str = $nextToken(st);
|
|
$compareTo(str, 'true') == 0?(this.position = instanceOf(this, 186)?0:1):$compareTo(str, 'false') == 0?(this.position = instanceOf(this, 186)?1:0):(this.position = (new Integer_0(str)).value_0);
|
|
this.momentary = $booleanValue(($clinit_Boolean() , $equalsIgnoreCase('true', $nextToken(st))));
|
|
this.posCount = 2;
|
|
this.label_0 = null;
|
|
(this.flags & 4) != 0 && (this.label_0 = unescape_0($nextToken(st)));
|
|
}
|
|
|
|
function SwitchElm_1(xx, yy, mm){
|
|
CircuitElm.call(this, xx, yy);
|
|
this.position = mm?1:0;
|
|
this.momentary = mm;
|
|
this.posCount = 2;
|
|
this.label_0 = null;
|
|
this.keyShortcut = null;
|
|
}
|
|
|
|
defineClass(61, 8, $intern_100, SwitchElm, SwitchElm_0);
|
|
_.addRoutingObstacle = function addRoutingObstacle_5(router){
|
|
var pa, pb;
|
|
if (this.x_0 == this.x2 || this.y_0 == this.y2) {
|
|
$addWire(router, this.x_0, this.y_0, this.x2, this.y2);
|
|
pa = $interpPoint_0(this.lead1, this.lead2, 0, 0);
|
|
pb = $interpPoint_0(this.lead1, this.lead2, 1, 16);
|
|
$addObstacle(router, pa.x_0, pa.y_0, pb.x_0, pb.y_0);
|
|
}
|
|
}
|
|
;
|
|
_.calculateCurrent = function calculateCurrent_3(){
|
|
this.position == 1?(this.current_0 = 0):this.resistance > 0?(this.current_0 = (this.volts[0] - this.volts[1]) / this.resistance):this.inComposite && (this.current_0 = (this.volts[0] - this.volts[1]) / $intern_83);
|
|
}
|
|
;
|
|
_.draw = function draw_11(g){
|
|
var hs1, hs2;
|
|
hs1 = this.position == 1?0:2;
|
|
hs2 = this.position == 1?16:2;
|
|
$setBbox_0(this, this.point1, this.point2, 16);
|
|
$draw2Leads(this, g);
|
|
this.position == 0 && (this.curcount_0 = $updateDotCount(this.current_0, this.curcount_0) , app_0.mouse.dragElm == this || $drawDots(g, this.point1, this.point2, this.curcount_0));
|
|
mouseElmRef == this || this.selected_0 || $containsKey(app_0.mouse.scopePlotRoles, this) || instanceOf(mouseElmRef, 21) && $getElm_0(mouseElmRef.elmScope) == this || $isOnHighlightedNet(this) || $setColor_0(g, whiteColor);
|
|
$interpPoint_2(this.lead1, this.lead2, this.ps, 0, hs1);
|
|
$interpPoint_2(this.lead1, this.lead2, this.ps2, 1, hs2);
|
|
drawThickLine_0(g, this.ps, this.ps2, 3);
|
|
if (this.label_0 != null) {
|
|
$setColor_0(g, mouseElmRef == this || this.selected_0 || $containsKey(app_0.mouse.scopePlotRoles, this) || instanceOf(mouseElmRef, 21) && $getElm_0(mouseElmRef.elmScope) == this || $isOnHighlightedNet(this)?selectColor_0:whiteColor);
|
|
if ($wnd.Math.abs(this.dy) > $wnd.Math.abs(this.dx))
|
|
$drawString(g, this.label_0, this.x_0 + 10, (this.y_0 < this.y2?this.lead1:this.lead2).y_0 - 5);
|
|
else {
|
|
g.context.save();
|
|
g.savedFontSize = g.currentFontSize;
|
|
g.context.textAlign = 'center';
|
|
$drawString(g, this.label_0, (this.x_0 + this.x2) / 2 | 0, this.x2 > this.x_0?this.y_0 + 15:this.y_0 - 15);
|
|
g.context.restore();
|
|
g.currentFontSize = g.savedFontSize;
|
|
}
|
|
}
|
|
if ((this.flags & 2) != 0) {
|
|
$drawLine_0(g, this.extraPoints[2], this.extraPoints[3]);
|
|
setLineDash(g.context, 3, 3);
|
|
$interpPoint_2(this.lead1, this.lead2, this.extraPoints[0], 0.5, this.position == 1?8:2);
|
|
if (this.momentary)
|
|
$drawLine_0(g, this.extraPoints[1], this.extraPoints[0]);
|
|
else {
|
|
$drawLine_0(g, this.extraPoints[6], this.extraPoints[0]);
|
|
$drawLine_0(g, this.extraPoints[1], this.extraPoints[4]);
|
|
}
|
|
setLineDash(g.context, 0, 0);
|
|
if (!this.momentary) {
|
|
$drawLine_0(g, this.extraPoints[4], this.extraPoints[5]);
|
|
$drawLine_0(g, this.extraPoints[6], this.extraPoints[5]);
|
|
}
|
|
}
|
|
$drawPosts(this, g);
|
|
}
|
|
;
|
|
_.dumpXml = function dumpXml_10(doc, elem){
|
|
$dumpXml_2(this, elem);
|
|
}
|
|
;
|
|
_.getConnection = function getConnection_5(n1, n2){
|
|
return this.position == 0;
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_13(){
|
|
return 115;
|
|
}
|
|
;
|
|
_.getEditInfo = function getEditInfo_12(n){
|
|
return $getEditInfo_1(this, n);
|
|
}
|
|
;
|
|
_.getElmType = function getElmType_0(){
|
|
return 'switch (SPST)';
|
|
}
|
|
;
|
|
_.getInfo_0 = function getInfo_13(arr){
|
|
arr[0] = this.momentary?'push switch (SPST)':'switch (SPST)';
|
|
if (this.position == 1) {
|
|
arr[1] = 'open';
|
|
arr[2] = 'Vd = ' + getUnitText($wnd.Math.abs(this.getVoltageDiff_0()), 'V', false);
|
|
}
|
|
else {
|
|
arr[1] = 'closed';
|
|
arr[2] = 'V = ' + getUnitText(this.volts[0], 'V', false);
|
|
arr[3] = 'I = ' + getUnitText($wnd.Math.abs(this.current_0), 'A', false);
|
|
}
|
|
}
|
|
;
|
|
_.getShortcut = function getShortcut_6(){
|
|
return 115;
|
|
}
|
|
;
|
|
_.getSwitchRect = function getSwitchRect(){
|
|
$interpPoint_2(this.lead1, this.lead2, this.ps, 0, 16);
|
|
return $union($union(new Rectangle_1(this.lead1), new Rectangle_1(this.lead2)), new Rectangle_1(this.ps));
|
|
}
|
|
;
|
|
_.isRemovableWire = function isRemovableWire_0(){
|
|
return this.position == 0 && !this.inComposite && this.resistance == 0;
|
|
}
|
|
;
|
|
_.isWireEquivalent = function isWireEquivalent_1(){
|
|
return this.position == 0 && !this.inComposite && this.resistance == 0;
|
|
}
|
|
;
|
|
_.setEditValue = function setEditValue_11(n, ei){
|
|
$setEditValue_2(this, n, ei);
|
|
}
|
|
;
|
|
_.setPoints = function setPoints_11(){
|
|
$setPoints_3(this);
|
|
}
|
|
;
|
|
_.stamp = function stamp_10(){
|
|
this.position == 0 && (this.resistance > 0?$stampResistor(this.nodes[0], this.nodes[1], this.resistance):this.inComposite && $stampResistor(this.nodes[0], this.nodes[1], $intern_83));
|
|
}
|
|
;
|
|
_.toggle = function toggle(){
|
|
$toggle(this);
|
|
}
|
|
;
|
|
_.undumpXml = function undumpXml_11(xml){
|
|
$undumpXml_1(this, xml);
|
|
}
|
|
;
|
|
_.momentary = false;
|
|
_.posCount = 0;
|
|
_.position = 0;
|
|
_.resistance = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_SwitchElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'SwitchElm', 61);
|
|
function BusLogicInputElm(xx, yy){
|
|
SwitchElm.call(this, xx, yy);
|
|
this.busWidth = 4;
|
|
this.value_0 = 0;
|
|
this.hiV = 5;
|
|
this.loV = 0;
|
|
}
|
|
|
|
defineClass(929, 61, $intern_100, BusLogicInputElm);
|
|
_.calculateCurrent = function calculateCurrent_4(){
|
|
}
|
|
;
|
|
_.draw = function draw_12(g){
|
|
var f, i, s;
|
|
g.context.save();
|
|
g.savedFontSize = g.currentFontSize;
|
|
f = new Font('SansSerif', 1, 20);
|
|
$setFont_0(g, f);
|
|
$setColor_0(g, mouseElmRef == this || this.selected_0 || $containsKey(app_0.mouse.scopePlotRoles, this) || instanceOf(mouseElmRef, 21) && $getElm_0(mouseElmRef.elmScope) == this || $isOnHighlightedNet(this)?selectColor_0:whiteColor);
|
|
s = '' + this.value_0;
|
|
$interpPoint_1(this.point1, this.point2, this.lead1, 1 - ((round_int($measureText(g.context, s).width) / 2 | 0) + 8) / this.dn);
|
|
$setBbox_0(this, this.point1, this.lead1, 0);
|
|
$drawCenteredText(this, g, s, this.x2, this.y2, true);
|
|
$setVoltageColor(this, g, this.volts[0]);
|
|
drawThickLine_0(g, this.point1, this.lead1, 5);
|
|
if (this.currents != null) {
|
|
this.current_0 = 0;
|
|
for (i = 0; i < this.currents.length; i++)
|
|
this.current_0 += this.currents[i];
|
|
}
|
|
this.curcount_0 = $updateDotCount(this.current_0, this.curcount_0);
|
|
$drawDots(g, this.point1, this.lead1, -this.curcount_0);
|
|
$drawPosts(this, g);
|
|
g.context.restore();
|
|
g.currentFontSize = g.savedFontSize;
|
|
}
|
|
;
|
|
_.dumpXml = function dumpXml_11(doc, elem){
|
|
$dumpXml_2(this, elem);
|
|
dumpAttr_0(elem, 'bw', this.busWidth);
|
|
this.value_0 != 0 && dumpAttr_0(elem, 'va', this.value_0);
|
|
this.hiV != 5 && dumpAttr(elem, 'hi', this.hiV);
|
|
this.loV != 0 && dumpAttr(elem, 'lo', this.loV);
|
|
}
|
|
;
|
|
_.getCurrentIntoNode = function getCurrentIntoNode_4(n){
|
|
return this.currents[n];
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_14(){
|
|
return 0;
|
|
}
|
|
;
|
|
_.getEditInfo = function getEditInfo_13(n){
|
|
if (n == 0)
|
|
return $setDimensionless(new EditInfo_0('Bus Width', this.busWidth, 2, 32));
|
|
if (n == 1)
|
|
return $setDimensionless(new EditInfo('Value', this.value_0));
|
|
if (n == 2)
|
|
return $setUnitStep(new EditInfo('High Voltage', this.hiV));
|
|
if (n == 3)
|
|
return $setUnitStep(new EditInfo('Low Voltage', this.loV));
|
|
return null;
|
|
}
|
|
;
|
|
_.getInfo_0 = function getInfo_14(arr){
|
|
var number;
|
|
arr[0] = 'bus input (' + this.busWidth + ')';
|
|
arr[1] = 'value = ' + this.value_0;
|
|
arr[2] = 'hex = 0x' + (number = this.value_0 >>> 0 , number.toString(16)).toUpperCase();
|
|
}
|
|
;
|
|
_.getNumHandles = function getNumHandles_1(){
|
|
return 1;
|
|
}
|
|
;
|
|
_.getPost = function getPost_4(n){
|
|
return new Point_3(this.x_0, this.y_0, n);
|
|
}
|
|
;
|
|
_.getPostCount_0 = function getPostCount_9(){
|
|
return this.busWidth;
|
|
}
|
|
;
|
|
_.getPostWidth = function getPostWidth_1(n){
|
|
return this.busWidth;
|
|
}
|
|
;
|
|
_.getShortcut = function getShortcut_7(){
|
|
return 0;
|
|
}
|
|
;
|
|
_.getSwitchRect = function getSwitchRect_0(){
|
|
return new Rectangle_0(this.x2 - 10, this.y2 - 10, 20, 20);
|
|
}
|
|
;
|
|
_.getVoltageSourceCount = function getVoltageSourceCount_7(){
|
|
return this.busWidth;
|
|
}
|
|
;
|
|
_.getXmlDumpType = function getXmlDumpType_5(){
|
|
return 'bli';
|
|
}
|
|
;
|
|
_.hasGroundConnection = function hasGroundConnection_7(n){
|
|
return true;
|
|
}
|
|
;
|
|
_.isRemovableWire = function isRemovableWire_1(){
|
|
return false;
|
|
}
|
|
;
|
|
_.isWireEquivalent = function isWireEquivalent_2(){
|
|
return false;
|
|
}
|
|
;
|
|
_.setCurrent = function setCurrent_1(vs, c){
|
|
var i;
|
|
for (i = 0; i < this.busWidth; i++)
|
|
if (this.voltageSources[i] == vs) {
|
|
this.currents[i] = this.current_0 = c;
|
|
break;
|
|
}
|
|
}
|
|
;
|
|
_.setEditValue = function setEditValue_12(n, ei){
|
|
if (n == 0) {
|
|
if (ei.value_0 >= 2) {
|
|
this.busWidth = round_int(ei.value_0);
|
|
$allocNodes(this);
|
|
}
|
|
else
|
|
ei.error = 'must be >= 2';
|
|
}
|
|
n == 1 && (this.value_0 = round_int(ei.value_0));
|
|
n == 2 && (this.hiV = ei.value_0);
|
|
n == 3 && (this.loV = ei.value_0);
|
|
}
|
|
;
|
|
_.setPoints = function setPoints_12(){
|
|
$setPoints_3(this);
|
|
this.lead1 = new Point_1;
|
|
}
|
|
;
|
|
_.setVoltageSource = function setVoltageSource_5(n, v){
|
|
if (this.voltageSources == null || this.voltageSources.length != this.busWidth) {
|
|
this.voltageSources = initUnidimensionalArray(Lcom_lushprojects_circuitjs1_client_VoltageSource_2_classLit, $intern_3, 136, this.busWidth, 0, 1);
|
|
this.currents = initUnidimensionalArray(D_classLit, $intern_76, 7, this.busWidth, 15, 1);
|
|
}
|
|
this.voltageSources[n] = v;
|
|
}
|
|
;
|
|
_.stamp = function stamp_11(){
|
|
var i, v;
|
|
for (i = 0; i < this.busWidth; i++) {
|
|
v = (this.value_0 & 1 << i) != 0?this.hiV:this.loV;
|
|
$stampVoltageSource_0(ground, this.nodes[i], this.voltageSources[i], v);
|
|
}
|
|
}
|
|
;
|
|
_.toggle = function toggle_0(){
|
|
++this.value_0;
|
|
this.value_0 >= 1 << this.busWidth && (this.value_0 = 0);
|
|
}
|
|
;
|
|
_.undumpXml = function undumpXml_12(xml){
|
|
$undumpXml_1(this, xml);
|
|
this.busWidth = $parseIntAttr(xml, 'bw', this.busWidth);
|
|
this.value_0 = $parseIntAttr(xml, 'va', 0);
|
|
this.hiV = $parseDoubleAttr(xml, 'hi', this.hiV);
|
|
this.loV = $parseDoubleAttr(xml, 'lo', this.loV);
|
|
}
|
|
;
|
|
_.busWidth = 0;
|
|
_.hiV = 0;
|
|
_.loV = 0;
|
|
_.value_0 = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_BusLogicInputElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'BusLogicInputElm', 929);
|
|
function $setupPins_1(this$static){
|
|
var i, i0, ii;
|
|
this$static.sizeX = 2;
|
|
this$static.sizeY = this$static.bits;
|
|
this$static.currents = initUnidimensionalArray(D_classLit, $intern_76, 7, this$static.bits, 15, 1);
|
|
this$static.pins = initUnidimensionalArray(Lcom_lushprojects_circuitjs1_client_ChipElm$Pin_2_classLit, $intern_3, 9, this$static.bits * 2, 0, 1);
|
|
for (i0 = 0; i0 != this$static.bits; i0++) {
|
|
this$static.pins[i0] = new ChipElm$Pin(this$static, 0, 2, 'Bus');
|
|
this$static.pins[i0].busWidth = this$static.bits;
|
|
this$static.pins[i0].busZ = i0;
|
|
}
|
|
for (i = 0; i != this$static.bits; i++) {
|
|
ii = i + this$static.bits;
|
|
this$static.pins[ii] = new ChipElm$Pin(this$static, this$static.bits - 1 - i, 3, '' + i);
|
|
}
|
|
}
|
|
|
|
function BusSplitterElm(xx, yy){
|
|
$clinit_ChipElm();
|
|
ChipElm.call(this, xx, yy);
|
|
}
|
|
|
|
function BusSplitterElm_0(xa, ya, xb, yb, f, st){
|
|
$clinit_ChipElm();
|
|
ChipElm_0.call(this, xa, ya, xb, yb, f, st);
|
|
}
|
|
|
|
defineClass(266, 32, {266:1, 8:1, 10:1}, BusSplitterElm, BusSplitterElm_0);
|
|
_.getBusWidth = function getBusWidth_0(){
|
|
return this.bits;
|
|
}
|
|
;
|
|
_.getChipEditInfo = function getChipEditInfo_2(n){
|
|
if (n == 0)
|
|
return $setDimensionless(new EditInfo_0('# of Bits', this.bits, 1, 1));
|
|
return null;
|
|
}
|
|
;
|
|
_.getChipName = function getChipName_2(){
|
|
return 'Bus Splitter';
|
|
}
|
|
;
|
|
_.getConnectedPost_0 = function getConnectedPost_1(n){
|
|
return $getPost_0(this, n + this.bits);
|
|
}
|
|
;
|
|
_.getConnection = function getConnection_6(n1, n2){
|
|
return $wnd.Math.abs(n1 - n2) == this.bits;
|
|
}
|
|
;
|
|
_.getCurrentIntoNode = function getCurrentIntoNode_5(n){
|
|
if (n < this.bits)
|
|
return -this.currents[n];
|
|
return this.currents[n - this.bits];
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_15(){
|
|
return 433;
|
|
}
|
|
;
|
|
_.getPostCount_0 = function getPostCount_10(){
|
|
return this.bits * 2;
|
|
}
|
|
;
|
|
_.getVoltageSourceCount = function getVoltageSourceCount_8(){
|
|
return 0;
|
|
}
|
|
;
|
|
_.getXmlDumpType = function getXmlDumpType_6(){
|
|
return 'bs';
|
|
}
|
|
;
|
|
_.isRemovableWire = function isRemovableWire_2(){
|
|
return true;
|
|
}
|
|
;
|
|
_.isWireEquivalent = function isWireEquivalent_3(){
|
|
return true;
|
|
}
|
|
;
|
|
_.needsBits = function needsBits_1(){
|
|
return true;
|
|
}
|
|
;
|
|
_.setChipEditValue = function setChipEditValue_2(n, ei){
|
|
if (n == 0) {
|
|
if (ei.value_0 >= 2) {
|
|
this.bits = round_int(ei.value_0);
|
|
$setupPins_1(this);
|
|
$setPoints_0(this);
|
|
}
|
|
else
|
|
ei.error = 'must be >= 2';
|
|
}
|
|
}
|
|
;
|
|
_.setWireCurrent = function setWireCurrent_0(bit, c){
|
|
var i, total;
|
|
this.currents[bit] = c;
|
|
this.pins[bit + this.bits].current = c;
|
|
total = 0;
|
|
for (i = 0; i < this.bits; i++)
|
|
total += this.currents[i];
|
|
this.pins[0].current = -total;
|
|
}
|
|
;
|
|
_.setupPins = function setupPins_1(){
|
|
$setupPins_1(this);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_BusSplitterElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'BusSplitterElm', 266);
|
|
function $setupPins_2(this$static){
|
|
var dataY;
|
|
this$static.dataBits == 0 && (this$static.dataBits = 4);
|
|
this$static.sizeX = 2;
|
|
dataY = this$static.bitOrder == 2?1:this$static.dataBits;
|
|
this$static.sizeY = dataY + 2;
|
|
this$static.bits = this$static.dataBits;
|
|
this$static.pins = initUnidimensionalArray(Lcom_lushprojects_circuitjs1_client_ChipElm$Pin_2_classLit, $intern_3, 9, 2 + 2 * this$static.dataBits, 0, 1);
|
|
this$static.pins[0] = new ChipElm$Pin(this$static, 0, 2, 'OE');
|
|
this$static.pins[0].lineOver = true;
|
|
this$static.pins[1] = new ChipElm$Pin(this$static, 0, 3, 'DIR');
|
|
this$static.aNodes = 2;
|
|
this$static.bNodes = 2 + this$static.dataBits;
|
|
this$static.intNodes = 2 + 2 * this$static.dataBits;
|
|
$makeBitPins(this$static, this$static.dataBits, this$static.sizeY - dataY, 2, this$static.aNodes, 'A', false, false, true);
|
|
$makeBitPins(this$static, this$static.dataBits, this$static.sizeY - dataY, 3, this$static.bNodes, 'B', false, false, true);
|
|
$allocNodes(this$static);
|
|
}
|
|
|
|
function BusTransceiverElm(xx, yy){
|
|
$clinit_ChipElm();
|
|
ChipElm.call(this, xx, yy);
|
|
this.dataBits = 4;
|
|
$setupPins_2(this);
|
|
}
|
|
|
|
defineClass(924, 32, $intern_85, BusTransceiverElm);
|
|
_.allowBus = function allowBus_1(){
|
|
return true;
|
|
}
|
|
;
|
|
_.defaultBitCount = function defaultBitCount_0(){
|
|
return 4;
|
|
}
|
|
;
|
|
_.doStep = function doStep_9(){
|
|
var dirAtoB, i, outputEnabled, rDst, srcVal;
|
|
outputEnabled = this.volts[0] < this.highVoltage / 2;
|
|
dirAtoB = this.volts[1] > this.highVoltage / 2;
|
|
for (i = 0; i < this.dataBits; i++) {
|
|
dirAtoB?(srcVal = this.volts[this.aNodes + i] > this.highVoltage / 2):(srcVal = this.volts[this.bNodes + i] > this.highVoltage / 2);
|
|
$updateVoltageSource(this.vSources[i], srcVal?this.highVoltage:0);
|
|
rDst = outputEnabled?1:$intern_94;
|
|
if (dirAtoB) {
|
|
$stampResistor(this.nodes[this.intNodes + i], this.nodes[this.aNodes + i], $intern_97);
|
|
$stampResistor(this.nodes[this.intNodes + i], this.nodes[this.bNodes + i], rDst);
|
|
}
|
|
else {
|
|
$stampResistor(this.nodes[this.intNodes + i], this.nodes[this.aNodes + i], rDst);
|
|
$stampResistor(this.nodes[this.intNodes + i], this.nodes[this.bNodes + i], $intern_97);
|
|
}
|
|
}
|
|
}
|
|
;
|
|
_.dumpXml = function dumpXml_12(doc, elem){
|
|
$dumpXml_0(this, elem);
|
|
dumpAttr_0(elem, 'db', this.dataBits);
|
|
}
|
|
;
|
|
_.getChipEditInfo = function getChipEditInfo_3(n){
|
|
if (n == 0)
|
|
return $setDimensionless(new EditInfo_0('# of Bits', this.dataBits, 1, 1));
|
|
return null;
|
|
}
|
|
;
|
|
_.getChipName = function getChipName_3(){
|
|
return 'Bus Transceiver';
|
|
}
|
|
;
|
|
_.getInfo_0 = function getInfo_15(arr){
|
|
var dirAtoB, outputEnabled;
|
|
arr[0] = 'bus transceiver';
|
|
outputEnabled = this.volts[0] < this.highVoltage / 2;
|
|
dirAtoB = this.volts[1] > this.highVoltage / 2;
|
|
arr[1] = outputEnabled?dirAtoB?'A\u2192B':'B\u2192A':'hi-Z';
|
|
}
|
|
;
|
|
_.getInternalNodeCount = function getInternalNodeCount_2(){
|
|
return this.dataBits;
|
|
}
|
|
;
|
|
_.getMatrixConnection = function getMatrixConnection_0(n1, n2){
|
|
var i;
|
|
for (i = 0; i < this.dataBits; i++) {
|
|
if ($comparePair(n1, n2, this.intNodes + i, this.aNodes + i))
|
|
return true;
|
|
if ($comparePair(n1, n2, this.intNodes + i, this.bNodes + i))
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
;
|
|
_.getPostCount_0 = function getPostCount_11(){
|
|
return 2 + 2 * this.dataBits;
|
|
}
|
|
;
|
|
_.getVoltageSourceCount = function getVoltageSourceCount_9(){
|
|
return this.dataBits;
|
|
}
|
|
;
|
|
_.nonLinear_0 = function nonLinear_2(){
|
|
return true;
|
|
}
|
|
;
|
|
_.setChipEditValue = function setChipEditValue_3(n, ei){
|
|
if (n == 0) {
|
|
if (ei.value_0 >= 1 && ei.value_0 <= 16) {
|
|
this.dataBits = round_int(ei.value_0);
|
|
$setupPins_2(this);
|
|
$setPoints_0(this);
|
|
}
|
|
else
|
|
ei.error = 'must be between 1 and 16';
|
|
}
|
|
}
|
|
;
|
|
_.setVoltageSource = function setVoltageSource_6(j, vs){
|
|
(this.vSources == null || this.vSources.length != this.dataBits) && (this.vSources = initUnidimensionalArray(Lcom_lushprojects_circuitjs1_client_VoltageSource_2_classLit, $intern_3, 136, this.dataBits, 0, 1));
|
|
this.vSources[j] = vs;
|
|
$setNodes(vs, ground, this.nodes[this.intNodes + j]);
|
|
}
|
|
;
|
|
_.setupPins = function setupPins_2(){
|
|
$setupPins_2(this);
|
|
}
|
|
;
|
|
_.stamp = function stamp_12(){
|
|
var i;
|
|
for (i = 0; i < this.dataBits; i++) {
|
|
$stampVoltageSource(ground, this.nodes[this.intNodes + i], this.vSources[i]);
|
|
}
|
|
}
|
|
;
|
|
_.undumpXml = function undumpXml_13(xml){
|
|
$undumpXml_0(this, xml);
|
|
this.dataBits = $parseIntAttr(xml, 'db', this.dataBits);
|
|
$setupPins_2(this);
|
|
}
|
|
;
|
|
_.aNodes = 0;
|
|
_.bNodes = 0;
|
|
_.dataBits = 0;
|
|
_.intNodes = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_BusTransceiverElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'BusTransceiverElm', 924);
|
|
function CC2Elm(xx, yy){
|
|
$clinit_ChipElm();
|
|
ChipElm.call(this, xx, yy);
|
|
this.gain = 1;
|
|
}
|
|
|
|
function CC2Elm_0(xa, ya, xb, yb, f, st){
|
|
$clinit_ChipElm();
|
|
ChipElm_0.call(this, xa, ya, xb, yb, f, st);
|
|
this.gain = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
}
|
|
|
|
defineClass(308, 32, $intern_85, CC2Elm, CC2Elm_0);
|
|
_.calculateCurrent = function calculateCurrent_5(){
|
|
this.pins[2].current = this.pins[0].current * this.gain;
|
|
}
|
|
;
|
|
_.draw = function draw_13(g){
|
|
$drawChip(this, g);
|
|
}
|
|
;
|
|
_.dumpXml = function dumpXml_13(doc, elem){
|
|
$dumpXml_0(this, elem);
|
|
dumpAttr(elem, 'ga', this.gain);
|
|
}
|
|
;
|
|
_.getChipName = function getChipName_4(){
|
|
return 'CC2';
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_16(){
|
|
return 179;
|
|
}
|
|
;
|
|
_.getElmType = function getElmType_1(){
|
|
return 'CCII';
|
|
}
|
|
;
|
|
_.getInfo_0 = function getInfo_16(arr){
|
|
arr[0] = this.gain == 1?'CCII+~':'CCII-~';
|
|
arr[1] = 'X,Y = ' + getUnitText(this.volts[0], 'V', false);
|
|
arr[2] = 'Z = ' + getUnitText(this.volts[2], 'V', false);
|
|
arr[3] = 'I = ' + getUnitText(this.pins[0].current, 'A', false);
|
|
}
|
|
;
|
|
_.getMatrixConnection = function getMatrixConnection_1(n1, n2){
|
|
return true;
|
|
}
|
|
;
|
|
_.getPostCount_0 = function getPostCount_12(){
|
|
return 3;
|
|
}
|
|
;
|
|
_.getVoltageSourceCount = function getVoltageSourceCount_10(){
|
|
return 1;
|
|
}
|
|
;
|
|
_.isDigitalChip = function isDigitalChip_1(){
|
|
return false;
|
|
}
|
|
;
|
|
_.setupPins = function setupPins_3(){
|
|
this.sizeX = 2;
|
|
this.sizeY = 3;
|
|
this.pins = initUnidimensionalArray(Lcom_lushprojects_circuitjs1_client_ChipElm$Pin_2_classLit, $intern_3, 9, 3, 0, 1);
|
|
this.pins[0] = new ChipElm$Pin(this, 0, 2, 'X');
|
|
this.pins[0].output = true;
|
|
this.pins[1] = new ChipElm$Pin(this, 2, 2, 'Y');
|
|
this.pins[2] = new ChipElm$Pin(this, 1, 3, 'Z');
|
|
}
|
|
;
|
|
_.stamp = function stamp_13(){
|
|
$stampVoltageSource(ground, this.nodes[0], this.pins[0].voltSource);
|
|
$stampVCVS(ground, this.nodes[1], 1, this.pins[0].voltSource);
|
|
$stampCCCS(ground, this.nodes[2], this.pins[0].voltSource, this.gain);
|
|
}
|
|
;
|
|
_.undumpXml = function undumpXml_14(xml){
|
|
$undumpXml_0(this, xml);
|
|
this.gain = $parseDoubleAttr(xml, 'ga', this.gain);
|
|
}
|
|
;
|
|
_.gain = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_CC2Elm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'CC2Elm', 308);
|
|
function CC2NegElm(xx, yy){
|
|
$clinit_ChipElm();
|
|
ChipElm.call(this, xx, yy);
|
|
this.gain = -1;
|
|
}
|
|
|
|
defineClass(903, 308, $intern_85, CC2NegElm);
|
|
_.getDumpClass = function getDumpClass_2(){
|
|
return Lcom_lushprojects_circuitjs1_client_CC2Elm_2_classLit;
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_CC2NegElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'CC2NegElm', 903);
|
|
function $getConvergeLimit(){
|
|
if (sim_0.subIterations < 10)
|
|
return $intern_83;
|
|
if (sim_0.subIterations < 200)
|
|
return $intern_34;
|
|
return 0.1;
|
|
}
|
|
|
|
function $getInfo_1(this$static, arr){
|
|
var i;
|
|
$getInfo_0(this$static, arr);
|
|
for (i = 0; arr[i] != null; i++)
|
|
;
|
|
arr[i] = 'I = ' + getUnitText(this$static.pins[this$static.inputCount].current, 'A', false);
|
|
}
|
|
|
|
function $parseExpr(this$static, ei){
|
|
var err, parser;
|
|
parser = new ExprParser(this$static.exprString);
|
|
this$static.expr = $parseExpression(parser);
|
|
err = parser.err_0;
|
|
if (err != null) {
|
|
ei.errorFieldName = 'Output Function';
|
|
$setError(ei, LS('Parse error in expression') + ': ' + this$static.exprString + ': ' + err);
|
|
}
|
|
}
|
|
|
|
function $setChipEditValue(this$static, n, ei){
|
|
if (n == 0) {
|
|
this$static.exprString = $getText(ei.textf);
|
|
$parseExpr(this$static, ei);
|
|
return;
|
|
}
|
|
if (n == 1) {
|
|
if (ei.value_0 < 0 || ei.value_0 > 8)
|
|
return;
|
|
this$static.inputCount = round_int(ei.value_0);
|
|
this$static.setupPins();
|
|
$allocNodes(this$static);
|
|
$setPoints_0(this$static);
|
|
}
|
|
}
|
|
|
|
function $setExpr(this$static, expr){
|
|
this$static.exprString = expr;
|
|
$parseExpr(this$static, null);
|
|
}
|
|
|
|
function VCCSElm(xx, yy){
|
|
$clinit_ChipElm();
|
|
ChipElm.call(this, xx, yy);
|
|
this.inputCount = 2;
|
|
this.exprString = '.1*(a-b)';
|
|
$parseExpr(this, null);
|
|
this.setupPins();
|
|
}
|
|
|
|
function VCCSElm_0(xa, ya, xb, yb, f, st){
|
|
$clinit_ChipElm();
|
|
ChipElm_0.call(this, xa, ya, xb, yb, f, st);
|
|
this.inputCount = __parseAndValidateInt($nextToken(st), 10);
|
|
this.exprString = unescape_0($nextToken(st));
|
|
$parseExpr(this, null);
|
|
this.setupPins();
|
|
}
|
|
|
|
defineClass(181, 32, $intern_85, VCCSElm, VCCSElm_0);
|
|
_.doStep = function doStep_10(){
|
|
var convergeLimit, dv, dx, i, rs, v, v0, v2;
|
|
if (this.broken) {
|
|
this.pins[this.inputCount].current = 0;
|
|
this.pins[this.inputCount + 1].current = 0;
|
|
$stampResistor(this.nodes[this.inputCount], this.nodes[this.inputCount + 1], $intern_97);
|
|
return;
|
|
}
|
|
convergeLimit = $getConvergeLimit();
|
|
for (i = 0; i != this.inputCount; i++) {
|
|
$wnd.Math.abs(this.volts[i] - this.lastVolts[i]) > convergeLimit && (sim_0.converged = false);
|
|
}
|
|
if (this.expr) {
|
|
for (i = 0; i != this.inputCount; i++)
|
|
this.exprState.values[i] = this.volts[i];
|
|
this.exprState.t = sim_0.t;
|
|
v0 = -$eval(this.expr, this.exprState);
|
|
rs = v0;
|
|
for (i = 0; i != this.inputCount; i++) {
|
|
dv = this.volts[i] - this.lastVolts[i];
|
|
$wnd.Math.abs(dv) < $intern_82 && (dv = $intern_82);
|
|
this.exprState.values[i] = this.volts[i];
|
|
v = -$eval(this.expr, this.exprState);
|
|
this.exprState.values[i] = this.volts[i] - dv;
|
|
v2 = -$eval(this.expr, this.exprState);
|
|
dx = (v - v2) / dv;
|
|
$wnd.Math.abs(dx) < $intern_82 && (dx = dx > 0?$intern_82:$intern_101);
|
|
$stampVCCurrentSource(this.nodes[this.inputCount], this.nodes[this.inputCount + 1], this.nodes[i], ground, dx);
|
|
rs -= dx * this.volts[i];
|
|
this.exprState.values[i] = this.volts[i];
|
|
}
|
|
$stampCurrentSource(this.nodes[this.inputCount], this.nodes[this.inputCount + 1], rs);
|
|
this.pins[this.inputCount].current = -v0;
|
|
this.pins[this.inputCount + 1].current = v0;
|
|
}
|
|
for (i = 0; i != this.inputCount; i++)
|
|
this.lastVolts[i] = this.volts[i];
|
|
}
|
|
;
|
|
_.draw = function draw_14(g){
|
|
$drawChip(this, g);
|
|
}
|
|
;
|
|
_.dumpXml = function dumpXml_14(doc, elem){
|
|
$dumpXml_0(this, elem);
|
|
dumpAttr_0(elem, 'ic', this.inputCount);
|
|
dumpAttr_1(elem, 'ex', this.exprString);
|
|
}
|
|
;
|
|
_.getChipEditInfo = function getChipEditInfo_4(n){
|
|
var ei;
|
|
if (n == 0) {
|
|
ei = new EditInfo_0('<a href="customfunction.html" target="_blank">' + LS('Output Function') + '<\/a>', 0, -1, -1);
|
|
ei.text_0 = this.exprString;
|
|
ei.noSliders = true;
|
|
return ei;
|
|
}
|
|
if (n == 1)
|
|
return $setDimensionless(new EditInfo_0('# of Inputs', this.inputCount, 1, 8));
|
|
return null;
|
|
}
|
|
;
|
|
_.getChipName = function getChipName_5(){
|
|
return 'VCCS~';
|
|
}
|
|
;
|
|
_.getConnection = function getConnection_7(n1, n2){
|
|
return $comparePair(this.inputCount, this.inputCount + 1, n1, n2);
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_17(){
|
|
return 213;
|
|
}
|
|
;
|
|
_.getInfo_0 = function getInfo_17(arr){
|
|
$getInfo_1(this, arr);
|
|
}
|
|
;
|
|
_.getMatrixConnection = function getMatrixConnection_2(n1, n2){
|
|
return true;
|
|
}
|
|
;
|
|
_.getPostCount_0 = function getPostCount_13(){
|
|
return this.inputCount + 2;
|
|
}
|
|
;
|
|
_.getVoltageSourceCount = function getVoltageSourceCount_11(){
|
|
return 0;
|
|
}
|
|
;
|
|
_.hasCurrentOutput = function hasCurrentOutput(){
|
|
return true;
|
|
}
|
|
;
|
|
_.hasGroundConnection = function hasGroundConnection_8(n1){
|
|
return false;
|
|
}
|
|
;
|
|
_.isDigitalChip = function isDigitalChip_2(){
|
|
return false;
|
|
}
|
|
;
|
|
_.nonLinear_0 = function nonLinear_3(){
|
|
return true;
|
|
}
|
|
;
|
|
_.reset_0 = function reset_7(){
|
|
$reset_0(this);
|
|
$reset_4(this.exprState);
|
|
}
|
|
;
|
|
_.setChipEditValue = function setChipEditValue_4(n, ei){
|
|
$setChipEditValue(this, n, ei);
|
|
}
|
|
;
|
|
_.setupPins = function setupPins_4(){
|
|
var i;
|
|
this.sizeX = 2;
|
|
this.sizeY = this.inputCount > 2?this.inputCount:2;
|
|
this.pins = initUnidimensionalArray(Lcom_lushprojects_circuitjs1_client_ChipElm$Pin_2_classLit, $intern_3, 9, this.inputCount + 2, 0, 1);
|
|
for (i = 0; i != this.inputCount; i++)
|
|
this.pins[i] = new ChipElm$Pin(this, i, 2, String.fromCharCode(65 + i & $intern_8));
|
|
this.pins[this.inputCount] = new ChipElm$Pin(this, 0, 3, 'C+');
|
|
this.pins[this.inputCount + 1] = new ChipElm$Pin(this, 1, 3, 'C-');
|
|
this.lastVolts = initUnidimensionalArray(D_classLit, $intern_76, 7, this.inputCount, 15, 1);
|
|
this.exprState = new ExprState;
|
|
$allocNodes(this);
|
|
}
|
|
;
|
|
_.stamp = function stamp_14(){
|
|
}
|
|
;
|
|
_.stepFinished = function stepFinished_6(){
|
|
$updateLastValues(this.exprState, this.pins[this.inputCount].current);
|
|
}
|
|
;
|
|
_.undumpXml = function undumpXml_15(xml){
|
|
$undumpXml_0(this, xml);
|
|
this.inputCount = $parseIntAttr(xml, 'ic', this.inputCount);
|
|
this.exprString = $parseStringAttr(xml, 'ex', this.exprString);
|
|
$parseExpr(this, null);
|
|
this.setupPins();
|
|
}
|
|
;
|
|
_.validate = function validate_5(){
|
|
var fpi;
|
|
fpi = new FindPathInfo(1, this, this.nodes[this.inputCount], sim_0);
|
|
this.hasCurrentOutput() && !$findPath(fpi, this.nodes[1 + this.inputCount])?(this.broken = true):(this.broken = false);
|
|
return true;
|
|
}
|
|
;
|
|
_.broken = false;
|
|
_.inputCount = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_VCCSElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'VCCSElm', 181);
|
|
function $setCurrentExprValue(this$static, n, cur){
|
|
n == 0 && this$static.inputPairCount < 9 && (this$static.exprState.values[8] = cur);
|
|
this$static.exprState.values[n] = cur;
|
|
}
|
|
|
|
function $setupPins_3(this$static){
|
|
var i;
|
|
this$static.sizeX = 2;
|
|
this$static.sizeY = this$static.inputCount > 2?this$static.inputCount:2;
|
|
this$static.pins = initUnidimensionalArray(Lcom_lushprojects_circuitjs1_client_ChipElm$Pin_2_classLit, $intern_3, 9, this$static.inputCount + 2, 0, 1);
|
|
this$static.inputPairCount = this$static.inputCount / 2 | 0;
|
|
for (i = 0; i != this$static.inputPairCount; i++) {
|
|
this$static.pins[i * 2] = new ChipElm$Pin(this$static, i * 2, 2, String.fromCharCode(65 + i & $intern_8) + '+');
|
|
this$static.pins[i * 2 + 1] = new ChipElm$Pin(this$static, i * 2 + 1, 2, String.fromCharCode(65 + i & $intern_8) + '-');
|
|
this$static.pins[i * 2 + 1].output = true;
|
|
}
|
|
this$static.pins[i * 2] = new ChipElm$Pin(this$static, 0, 3, 'O+');
|
|
this$static.pins[i * 2].output = true;
|
|
this$static.pins[i * 2 + 1] = new ChipElm$Pin(this$static, 1, 3, 'O-');
|
|
this$static.exprState = new ExprState;
|
|
this$static.lastCurrents = initUnidimensionalArray(D_classLit, $intern_76, 7, this$static.inputPairCount + 1, 15, 1);
|
|
$allocNodes(this$static);
|
|
}
|
|
|
|
function CCCSElm(xx, yy){
|
|
$clinit_ChipElm();
|
|
VCCSElm.call(this, xx, yy);
|
|
this.exprString = '2*a';
|
|
$parseExpr(this, null);
|
|
}
|
|
|
|
function CCCSElm_0(xa, ya, xb, yb, f, st){
|
|
$clinit_ChipElm();
|
|
VCCSElm_0.call(this, xa, ya, xb, yb, f, st);
|
|
$setupPins_3(this);
|
|
}
|
|
|
|
defineClass(307, 181, {307:1, 8:1, 10:1}, CCCSElm, CCCSElm_0);
|
|
_.doStep = function doStep_11(){
|
|
var convergeLimit, cur, dv, dx, i, rs, v, v0, v2;
|
|
if (this.broken) {
|
|
this.pins[this.inputCount].current = 0;
|
|
this.pins[this.inputCount + 1].current = 0;
|
|
$stampResistor(this.nodes[this.inputCount], this.nodes[this.inputCount + 1], $intern_97);
|
|
return;
|
|
}
|
|
if ((this.flags & FLAG_SPICE) != 0) {
|
|
for (i = 0; i != this.inputPairCount; i++)
|
|
this.pins[i * 2 + 1].current = this.voltageSources[i].current_0;
|
|
}
|
|
convergeLimit = $getConvergeLimit() * 0.1;
|
|
for (i = 0; i <= this.inputPairCount; i++) {
|
|
cur = this.pins[i * 2 + 1].current;
|
|
$wnd.Math.abs(cur - this.lastCurrents[i]) > convergeLimit && (sim_0.converged = false);
|
|
}
|
|
for (i = 0; i <= this.inputPairCount; i++)
|
|
this.lastCurrents[i] = this.pins[i * 2 + 1].current;
|
|
if (this.expr) {
|
|
for (i = 0; i != this.inputPairCount; i++)
|
|
$setCurrentExprValue(this, i, this.pins[i * 2 + 1].current);
|
|
this.exprState.t = sim_0.t;
|
|
v0 = $eval(this.expr, this.exprState);
|
|
rs = v0;
|
|
this.pins[this.inputCount].current = v0;
|
|
this.pins[this.inputCount + 1].current = -v0;
|
|
for (i = 0; i != this.inputPairCount; i++) {
|
|
cur = this.pins[i * 2 + 1].current;
|
|
dv = cur - this.lastCurrents[i];
|
|
$wnd.Math.abs(dv) < $intern_82 && (dv = $intern_82);
|
|
i == 0 && this.inputPairCount < 9 && (this.exprState.values[8] = cur);
|
|
this.exprState.values[i] = cur;
|
|
v = $eval(this.expr, this.exprState);
|
|
i == 0 && this.inputPairCount < 9 && (this.exprState.values[8] = cur - dv);
|
|
this.exprState.values[i] = cur - dv;
|
|
v2 = $eval(this.expr, this.exprState);
|
|
dx = (v - v2) / dv;
|
|
$wnd.Math.abs(dx) < $intern_82 && (dx = dx > 0?$intern_82:$intern_101);
|
|
$stampCCCS(this.nodes[this.inputCount + 1], this.nodes[this.inputCount], this.pins[i * 2 + 1].voltSource, dx);
|
|
rs -= dx * cur;
|
|
i == 0 && this.inputPairCount < 9 && (this.exprState.values[8] = cur);
|
|
this.exprState.values[i] = cur;
|
|
}
|
|
$stampCurrentSource(this.nodes[this.inputCount + 1], this.nodes[this.inputCount], rs);
|
|
}
|
|
}
|
|
;
|
|
_.getChipName = function getChipName_6(){
|
|
return 'CCCS';
|
|
}
|
|
;
|
|
_.getConnection = function getConnection_8(n1, n2){
|
|
return (n1 / 2 | 0) == (n2 / 2 | 0);
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_18(){
|
|
return 215;
|
|
}
|
|
;
|
|
_.getInfo_0 = function getInfo_18(arr){
|
|
var i, j;
|
|
$getInfo_1(this, arr);
|
|
i = 1;
|
|
for (j = 0; j != this.inputCount; j += 2)
|
|
arr[i++] = this.pins[j].text_0 + ' = ' + getUnitText(-this.pins[j].current, 'A', false);
|
|
arr[i++] = this.pins[j].text_0 + ' = ' + getUnitText(this.volts[j], 'V', false) + '; ' + this.pins[j + 1].text_0 + ' = ' + getUnitText(this.volts[j + 1], 'V', false);
|
|
arr[i++] = 'I = ' + getUnitText(this.pins[j].current, 'A', false);
|
|
arr[i++] = null;
|
|
}
|
|
;
|
|
_.getPostCount_0 = function getPostCount_14(){
|
|
return this.inputCount + 2;
|
|
}
|
|
;
|
|
_.getVoltageSourceCount = function getVoltageSourceCount_12(){
|
|
return (this.flags & FLAG_SPICE) != 0?0:this.inputPairCount;
|
|
}
|
|
;
|
|
_.hasCurrentOutput = function hasCurrentOutput_0(){
|
|
return true;
|
|
}
|
|
;
|
|
_.setCurrent = function setCurrent_2(vs, c){
|
|
var i;
|
|
for (i = 0; i != this.inputCount; i += 2)
|
|
if (this.pins[i + 1].voltSource == vs) {
|
|
this.pins[i].current = -c;
|
|
this.pins[i + 1].current = c;
|
|
return;
|
|
}
|
|
}
|
|
;
|
|
_.setEditValue = function setEditValue_13(n, ei){
|
|
if (n == 1) {
|
|
if (ei.value_0 < 0 || ei.value_0 > 8 || ei.value_0 % 2 == 1)
|
|
return;
|
|
this.inputCount = round_int(ei.value_0);
|
|
$setupPins_3(this);
|
|
$allocNodes(this);
|
|
$setPoints_0(this);
|
|
}
|
|
else
|
|
$setEditValue(this, n, ei);
|
|
}
|
|
;
|
|
_.setParentList = function setParentList_0(elmList){
|
|
var ce, i, j;
|
|
if ((this.flags & FLAG_SPICE) == 0)
|
|
return;
|
|
this.voltageSources = initUnidimensionalArray(Lcom_lushprojects_circuitjs1_client_VoltageElm_2_classLit, $intern_3, 56, this.inputPairCount, 0, 1);
|
|
for (i = 0; i != this.inputCount; i += 2) {
|
|
for (j = 0; j != elmList.arrayList.array.length; j++) {
|
|
ce = (checkArrayElementIndex(j, elmList.arrayList.array.length) , $get_2(elmList.arrayList, j));
|
|
if (!instanceOf(ce, 56))
|
|
continue;
|
|
ce.nodes[0] == this.nodes[i] && ce.nodes[1] == this.nodes[i + 1] && (this.voltageSources[i / 2 | 0] = ce);
|
|
}
|
|
}
|
|
}
|
|
;
|
|
_.setVoltageSource = function setVoltageSource_7(j, vs){
|
|
if ((this.flags & FLAG_SPICE) != 0)
|
|
this.pins[this.inputCount].voltSource = vs;
|
|
else {
|
|
$setVoltageSource(this, j, vs);
|
|
$setNodes(vs, this.nodes[j * 2], this.nodes[j * 2 + 1]);
|
|
}
|
|
}
|
|
;
|
|
_.setupPins = function setupPins_5(){
|
|
$setupPins_3(this);
|
|
}
|
|
;
|
|
_.stamp = function stamp_15(){
|
|
var i, vn1;
|
|
if ((this.flags & FLAG_SPICE) != 0) {
|
|
for (i = 0; i != this.inputCount; i += 2)
|
|
this.pins[i + 1].voltSource = this.voltageSources[i / 2 | 0].voltSource;
|
|
}
|
|
else {
|
|
for (i = 0; i != this.inputCount; i += 2) {
|
|
vn1 = this.pins[i + 1].voltSource;
|
|
$stampVoltageSource_0(this.nodes[i], this.nodes[i + 1], vn1, 0);
|
|
}
|
|
}
|
|
}
|
|
;
|
|
_.stepFinished = function stepFinished_7(){
|
|
$updateLastValues(this.exprState, this.pins[this.inputCount].current);
|
|
}
|
|
;
|
|
_.inputPairCount = 0;
|
|
var FLAG_SPICE = 2;
|
|
var Lcom_lushprojects_circuitjs1_client_CCCSElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'CCCSElm', 307);
|
|
function $setCurrentExprValue_0(this$static, n, cur){
|
|
n == 0 && this$static.inputPairCount < 9 && (this$static.exprState.values[8] = cur);
|
|
this$static.exprState.values[n] = cur;
|
|
}
|
|
|
|
function $setupPins_4(this$static){
|
|
var i;
|
|
this$static.sizeX = 2;
|
|
this$static.sizeY = this$static.inputCount > 2?this$static.inputCount:2;
|
|
this$static.inputPairCount = this$static.inputCount / 2 | 0;
|
|
this$static.pins = initUnidimensionalArray(Lcom_lushprojects_circuitjs1_client_ChipElm$Pin_2_classLit, $intern_3, 9, this$static.inputCount + 2, 0, 1);
|
|
for (i = 0; i != this$static.inputPairCount; i++) {
|
|
this$static.pins[i * 2] = new ChipElm$Pin(this$static, i * 2, 2, String.fromCharCode(65 + i & $intern_8) + '+');
|
|
this$static.pins[i * 2 + 1] = new ChipElm$Pin(this$static, i * 2 + 1, 2, String.fromCharCode(65 + i & $intern_8) + '-');
|
|
this$static.pins[i * 2 + 1].output = true;
|
|
}
|
|
this$static.pins[i * 2] = new ChipElm$Pin(this$static, 0, 3, 'V+');
|
|
this$static.pins[i * 2].output = true;
|
|
this$static.pins[i * 2 + 1] = new ChipElm$Pin(this$static, 1, 3, 'V-');
|
|
this$static.exprState = new ExprState;
|
|
this$static.lastCurrents = initUnidimensionalArray(D_classLit, $intern_76, 7, this$static.inputPairCount, 15, 1);
|
|
$allocNodes(this$static);
|
|
}
|
|
|
|
function CCVSElm(xx, yy){
|
|
$clinit_ChipElm();
|
|
VCCSElm.call(this, xx, yy);
|
|
this.exprString = '2*a';
|
|
$parseExpr(this, null);
|
|
}
|
|
|
|
function CCVSElm_0(xa, ya, xb, yb, f, st){
|
|
$clinit_ChipElm();
|
|
VCCSElm_0.call(this, xa, ya, xb, yb, f, st);
|
|
$setupPins_4(this);
|
|
}
|
|
|
|
defineClass(293, 181, $intern_85, CCVSElm, CCVSElm_0);
|
|
_.doStep = function doStep_12(){
|
|
var convergeLimitCurrent, convergeLimitVoltage, cur, dv, dx, i, rs, v, v0, v2, vni, vno;
|
|
if ((this.flags & FLAG_SPICE_0) != 0) {
|
|
for (i = 0; i != this.inputPairCount; i++)
|
|
this.pins[i * 2 + 1].current = this.voltageSources[i].current_0;
|
|
}
|
|
convergeLimitCurrent = $getConvergeLimit() * 0.1;
|
|
for (i = 0; i != this.inputPairCount; i++) {
|
|
cur = this.pins[i * 2 + 1].current;
|
|
$wnd.Math.abs(cur - this.lastCurrents[i]) > convergeLimitCurrent && (sim_0.converged = false);
|
|
}
|
|
convergeLimitVoltage = $getConvergeLimit();
|
|
$wnd.Math.abs(this.volts[this.inputCount] - this.volts[this.inputCount + 1] - this.lastOutput) > convergeLimitVoltage && (sim_0.converged = false);
|
|
vno = this.outputVS;
|
|
if (this.expr) {
|
|
for (i = 0; i != this.inputPairCount; i++)
|
|
$setCurrentExprValue_0(this, i, this.pins[i * 2 + 1].current);
|
|
this.exprState.t = sim_0.t;
|
|
v0 = $eval(this.expr, this.exprState);
|
|
rs = v0;
|
|
for (i = 0; i != this.inputPairCount; i++) {
|
|
cur = this.pins[i * 2 + 1].current;
|
|
dv = cur - this.lastCurrents[i];
|
|
vni = this.pins[i * 2 + 1].voltSource;
|
|
$wnd.Math.abs(dv) < $intern_82 && $intern_82;
|
|
i == 0 && this.inputPairCount < 9 && (this.exprState.values[8] = cur);
|
|
this.exprState.values[i] = cur;
|
|
v = $eval(this.expr, this.exprState);
|
|
i == 0 && this.inputPairCount < 9 && (this.exprState.values[8] = cur - $intern_80);
|
|
this.exprState.values[i] = cur - $intern_80;
|
|
v2 = $eval(this.expr, this.exprState);
|
|
dx = (v - v2) / $intern_80;
|
|
$wnd.Math.abs(dx) < $intern_82 && (dx = dx > 0?$intern_82:$intern_101);
|
|
$stampMatrix_2(vno, vni, -dx);
|
|
rs -= dx * cur;
|
|
i == 0 && this.inputPairCount < 9 && (this.exprState.values[8] = cur);
|
|
this.exprState.values[i] = cur;
|
|
}
|
|
vno.matrix.rightSide[vno.row - 1] += rs;
|
|
}
|
|
for (i = 0; i != this.inputPairCount; i++)
|
|
this.lastCurrents[i] = this.pins[i * 2 + 1].current;
|
|
this.lastOutput = this.volts[this.inputCount] - this.volts[this.inputCount + 1];
|
|
}
|
|
;
|
|
_.getChipName = function getChipName_7(){
|
|
return 'CCVS';
|
|
}
|
|
;
|
|
_.getConnection = function getConnection_9(n1, n2){
|
|
return (n1 / 2 | 0) == (n2 / 2 | 0);
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_19(){
|
|
return 214;
|
|
}
|
|
;
|
|
_.getInfo_0 = function getInfo_19(arr){
|
|
var i, j;
|
|
$getInfo_1(this, arr);
|
|
i = 1;
|
|
for (j = 0; j != this.inputCount; j += 2)
|
|
arr[i++] = this.pins[j].text_0 + ' = ' + getUnitText(-this.pins[j].current, 'A', false);
|
|
arr[i++] = this.pins[j].text_0 + ' = ' + getUnitText(this.volts[j], 'V', false) + '; ' + this.pins[j + 1].text_0 + ' = ' + getUnitText(this.volts[j + 1], 'V', false);
|
|
arr[i++] = 'I = ' + getUnitText(this.pins[j].current, 'A', false);
|
|
arr[i++] = null;
|
|
}
|
|
;
|
|
_.getPostCount_0 = function getPostCount_15(){
|
|
return this.inputCount + 2;
|
|
}
|
|
;
|
|
_.getVoltageSourceCount = function getVoltageSourceCount_13(){
|
|
return (this.flags & FLAG_SPICE_0) != 0?1:1 + this.inputPairCount;
|
|
}
|
|
;
|
|
_.hasCurrentOutput = function hasCurrentOutput_1(){
|
|
return false;
|
|
}
|
|
;
|
|
_.setChipEditValue = function setChipEditValue_5(n, ei){
|
|
if (n == 1) {
|
|
if (ei.value_0 < 0 || ei.value_0 > 8 || ei.value_0 % 2 == 1)
|
|
return;
|
|
this.inputCount = round_int(ei.value_0);
|
|
$setupPins_4(this);
|
|
$allocNodes(this);
|
|
$setPoints_0(this);
|
|
}
|
|
else
|
|
$setChipEditValue(this, n, ei);
|
|
}
|
|
;
|
|
_.setCurrent = function setCurrent_3(vs, c){
|
|
var i;
|
|
if ((this.flags & FLAG_SPICE_0) != 0) {
|
|
i = this.inputCount;
|
|
}
|
|
else {
|
|
for (i = 0; i != this.inputCount; i += 2)
|
|
if (this.pins[i + 1].voltSource == vs) {
|
|
this.pins[i].current = -c;
|
|
this.pins[i + 1].current = c;
|
|
return;
|
|
}
|
|
}
|
|
if (this.pins[i].voltSource == vs) {
|
|
this.pins[i].current = c;
|
|
this.pins[i + 1].current = -c;
|
|
}
|
|
}
|
|
;
|
|
_.setParentList = function setParentList_1(elmList){
|
|
var ce, i, j;
|
|
if ((this.flags & FLAG_SPICE_0) == 0)
|
|
return;
|
|
this.voltageSources = initUnidimensionalArray(Lcom_lushprojects_circuitjs1_client_VoltageElm_2_classLit, $intern_3, 56, this.inputPairCount, 0, 1);
|
|
for (i = 0; i != this.inputCount; i += 2) {
|
|
for (j = 0; j != elmList.arrayList.array.length; j++) {
|
|
ce = (checkArrayElementIndex(j, elmList.arrayList.array.length) , $get_2(elmList.arrayList, j));
|
|
if (!instanceOf(ce, 56))
|
|
continue;
|
|
ce.nodes[0] == this.nodes[i] && ce.nodes[1] == this.nodes[i + 1] && (this.voltageSources[i / 2 | 0] = ce);
|
|
}
|
|
}
|
|
}
|
|
;
|
|
_.setVoltageSource = function setVoltageSource_8(j, vs){
|
|
if ((this.flags & FLAG_SPICE_0) != 0) {
|
|
this.pins[this.inputCount].voltSource = vs;
|
|
$setNodes(vs, this.nodes[this.inputCount + 1], this.nodes[this.inputCount]);
|
|
}
|
|
else {
|
|
$setVoltageSource(this, j, vs);
|
|
j < this.inputPairCount?$setNodes(vs, this.nodes[j * 2], this.nodes[j * 2 + 1]):$setNodes(vs, this.nodes[this.inputCount + 1], this.nodes[this.inputCount]);
|
|
}
|
|
}
|
|
;
|
|
_.setupPins = function setupPins_6(){
|
|
$setupPins_4(this);
|
|
}
|
|
;
|
|
_.stamp = function stamp_16(){
|
|
var i, vn1, vn2;
|
|
if ((this.flags & FLAG_SPICE_0) != 0) {
|
|
for (i = 0; i != this.inputCount; i += 2)
|
|
this.pins[i + 1].voltSource = this.voltageSources[i / 2 | 0].voltSource;
|
|
}
|
|
else {
|
|
for (i = 0; i != this.inputCount; i += 2) {
|
|
vn1 = this.pins[i + 1].voltSource;
|
|
$stampVoltageSource_0(this.nodes[i], this.nodes[i + 1], vn1, 0);
|
|
}
|
|
}
|
|
vn2 = this.pins[this.inputCount].voltSource;
|
|
this.outputVS = vn2;
|
|
$stampVoltageSource(this.nodes[this.inputCount + 1], this.nodes[this.inputCount], vn2);
|
|
}
|
|
;
|
|
_.stepFinished = function stepFinished_8(){
|
|
var i;
|
|
$updateLastValues(this.exprState, this.volts[this.inputCount] - this.volts[this.inputCount + 1]);
|
|
for (i = 0; i != this.inputPairCount; i++)
|
|
this.exprState.lastValues[i] = this.pins[i * 2 + 1].current;
|
|
}
|
|
;
|
|
_.inputPairCount = 0;
|
|
_.lastOutput = 0;
|
|
var FLAG_SPICE_0 = 2;
|
|
var Lcom_lushprojects_circuitjs1_client_CCVSElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'CCVSElm', 293);
|
|
function $calculateCurrent(this$static){
|
|
var voltdiff;
|
|
voltdiff = this$static.volts[0] - this$static.volts[this$static.capNode2];
|
|
if (app_0.dcAnalysisFlag) {
|
|
this$static.current_0 = voltdiff / $intern_97;
|
|
return;
|
|
}
|
|
this$static.compResistance > 0 && (this$static.current_0 = voltdiff / this$static.compResistance + this$static.curSourceValue);
|
|
}
|
|
|
|
function $draw(this$static, g){
|
|
var i, s;
|
|
$setBbox_0(this$static, this$static.point1, this$static.point2, 12);
|
|
$setVoltageColor(this$static, g, this$static.volts[0]);
|
|
drawThickLine_0(g, this$static.point1, this$static.lead1, 3);
|
|
$setPowerColor_0(this$static, g);
|
|
drawThickLine_0(g, this$static.plate1[0], this$static.plate1[1], 3);
|
|
app_0.menus.powerCheckItem.on && $setColor_0(g, ($clinit_Color() , gray));
|
|
$setVoltageColor(this$static, g, this$static.volts[1]);
|
|
drawThickLine_0(g, this$static.point2, this$static.lead2, 3);
|
|
$setPowerColor_0(this$static, g);
|
|
if (this$static.platePoints == null)
|
|
drawThickLine_0(g, this$static.plate2[0], this$static.plate2[1], 3);
|
|
else {
|
|
for (i = 0; i != this$static.platePoints.length - 1; i++)
|
|
drawThickLine_0(g, this$static.platePoints[i], this$static.platePoints[i + 1], 3);
|
|
}
|
|
this$static.curcount_0 = $updateDotCount(this$static.current_0, this$static.curcount_0);
|
|
if (app_0.mouse.dragElm != this$static) {
|
|
$drawDots(g, this$static.point1, this$static.lead1, this$static.curcount_0);
|
|
$drawDots(g, this$static.point2, this$static.lead2, -this$static.curcount_0);
|
|
}
|
|
$drawPosts(this$static, g);
|
|
if (app_0.menus.showValuesCheckItem.on) {
|
|
s = getUnitText(this$static.capacitance, 'F', true);
|
|
$drawValues(this$static, g, s, 12);
|
|
}
|
|
}
|
|
|
|
function $dumpXml_3(this$static, elem){
|
|
dumpAttr_1(elem, 'x', this$static.x_0 + ' ' + this$static.y_0 + ' ' + this$static.x2 + ' ' + this$static.y2);
|
|
dumpAttr_0(elem, 'f', this$static.flags);
|
|
dumpAttr(elem, 'c', this$static.capacitance);
|
|
dumpAttr(elem, 'iv', this$static.initialVoltage);
|
|
dumpAttr(elem, 'sr', this$static.seriesResistance);
|
|
}
|
|
|
|
function $getEditInfo_2(this$static, n){
|
|
var ei;
|
|
if (n == 0)
|
|
return new EditInfo_0('Capacitance (F)', this$static.capacitance, $intern_82, $intern_83);
|
|
if (n == 1) {
|
|
ei = new EditInfo_0('', 0, -1, -1);
|
|
ei.checkbox = new Checkbox_0('Trapezoidal Approximation', (this$static.flags & 2) == 0);
|
|
return ei;
|
|
}
|
|
if (n == 2)
|
|
return new EditInfo('Initial Voltage (on Reset)', this$static.initialVoltage);
|
|
if (n == 3)
|
|
return new EditInfo('Series Resistance', this$static.seriesResistance);
|
|
return null;
|
|
}
|
|
|
|
function $getInfo_2(this$static, arr){
|
|
arr[0] = 'capacitor';
|
|
arr[1] = 'I = ' + getUnitText($wnd.Math.abs(this$static.current_0), 'A', false);
|
|
arr[2] = 'Vd = ' + getUnitText($wnd.Math.abs(this$static.volts[0] - this$static.volts[1]), 'V', false);
|
|
arr[3] = 'C = ' + getUnitText(this$static.capacitance, 'F', false);
|
|
arr[4] = 'P = ' + getUnitText((this$static.volts[0] - this$static.volts[1]) * this$static.current_0, 'W', false);
|
|
arr[5] = 'Q = ' + getUnitText(this$static.capacitance * this$static.voltdiff, 'C', false);
|
|
}
|
|
|
|
function $setCapacitance(this$static, c){
|
|
this$static.capacitance = c;
|
|
}
|
|
|
|
function $setEditValue_3(this$static, n, ei){
|
|
n == 0 && (this$static.capacitance = ei.value_0 > 0?ei.value_0:$intern_102);
|
|
n == 1 && ($getState(ei.checkbox)?(this$static.flags &= -3):(this$static.flags |= 2));
|
|
n == 2 && (this$static.initialVoltage = ei.value_0);
|
|
if (n == 3) {
|
|
this$static.seriesResistance = ei.value_0;
|
|
$allocNodes(this$static);
|
|
}
|
|
}
|
|
|
|
function $setPoints_4(this$static){
|
|
var f;
|
|
$setPoints(this$static);
|
|
f = (this$static.dn / 2 - 4) / this$static.dn;
|
|
this$static.lead1 = $interpPoint(this$static.point1, this$static.point2, f);
|
|
this$static.lead2 = $interpPoint(this$static.point1, this$static.point2, 1 - f);
|
|
this$static.plate1 = $newPointArray(2);
|
|
this$static.plate2 = $newPointArray(2);
|
|
$interpPoint2(this$static.point1, this$static.point2, this$static.plate1[0], this$static.plate1[1], f, 12);
|
|
$interpPoint2(this$static.point1, this$static.point2, this$static.plate2[0], this$static.plate2[1], 1 - f, 12);
|
|
}
|
|
|
|
function $undumpXml_2(this$static, xml){
|
|
this$static.flags = $parseIntAttr(xml, 'f', this$static.flags);
|
|
this$static.capacitance = $parseDoubleAttr(xml, 'c', this$static.capacitance);
|
|
this$static.initialVoltage = $parseDoubleAttr(xml, 'iv', this$static.initialVoltage);
|
|
this$static.seriesResistance = $parseDoubleAttr(xml, 'sr', this$static.seriesResistance);
|
|
this$static.voltdiff = $parseDoubleAttr(xml, 'vd', this$static.voltdiff);
|
|
$allocNodes(this$static);
|
|
}
|
|
|
|
function CapacitorElm(xx, yy){
|
|
CircuitElm.call(this, xx, yy);
|
|
this.capacitance = 1.0E-5;
|
|
this.initialVoltage = $intern_83;
|
|
}
|
|
|
|
function CapacitorElm_0(xa, ya, xb, yb, f, st){
|
|
CircuitElm_0.call(this, xa, ya, xb, yb, f);
|
|
this.capacitance = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.voltdiff = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.initialVoltage = $intern_83;
|
|
try {
|
|
this.initialVoltage = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
(this.flags & 4) != 0 && (this.seriesResistance = $doubleValue(__parseAndValidateDouble($nextToken(st))));
|
|
}
|
|
catch ($e0) {
|
|
$e0 = toJava($e0);
|
|
if (!instanceOf($e0, 13))
|
|
throw toJs($e0);
|
|
}
|
|
$allocNodes(this);
|
|
}
|
|
|
|
defineClass(143, 8, $intern_103, CapacitorElm, CapacitorElm_0);
|
|
_.addRoutingObstacle_0 = function addRoutingObstacle_6(wr){
|
|
$addRoutingObstacleWithLeads(this, wr, 12);
|
|
}
|
|
;
|
|
_.addRoutingObstacle = function(wr){
|
|
this.addRoutingObstacle_0(wr);
|
|
}
|
|
;
|
|
_.calculateCurrent = function calculateCurrent_6(){
|
|
$calculateCurrent(this);
|
|
}
|
|
;
|
|
_.doStep = function doStep_13(){
|
|
if (app_0.dcAnalysisFlag)
|
|
return;
|
|
$stampCurrentSource(this.nodes[0], this.nodes[this.capNode2], this.curSourceValue);
|
|
}
|
|
;
|
|
_.draw = function draw_15(g){
|
|
$draw(this, g);
|
|
}
|
|
;
|
|
_.dumpXml = function dumpXml_15(doc, elem){
|
|
$dumpXml_3(this, elem);
|
|
}
|
|
;
|
|
_.dumpXmlState = function dumpXmlState_3(doc, elem){
|
|
dumpAttr(elem, 'vd', this.voltdiff);
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_20(){
|
|
return 99;
|
|
}
|
|
;
|
|
_.getEditInfo = function getEditInfo_14(n){
|
|
return $getEditInfo_2(this, n);
|
|
}
|
|
;
|
|
_.getInfo_0 = function getInfo_20(arr){
|
|
$getInfo_2(this, arr);
|
|
}
|
|
;
|
|
_.getInternalNodeCount = function getInternalNodeCount_3(){
|
|
return !app_0.dcAnalysisFlag && this.seriesResistance > 0?1:0;
|
|
}
|
|
;
|
|
_.getScopeText = function getScopeText_0(v){
|
|
return LS('capacitor') + ', ' + getUnitText(this.capacitance, 'F', false);
|
|
}
|
|
;
|
|
_.getScopeUnits = function getScopeUnits_0(x_0){
|
|
if (x_0 == 8)
|
|
return 4;
|
|
return x_0 == 3?1:x_0 == 7?2:0;
|
|
}
|
|
;
|
|
_.getScopeValue = function getScopeValue_0(x_0){
|
|
if (x_0 == 8)
|
|
return this.capacitance * this.voltdiff;
|
|
return x_0 == 3?this.current_0:x_0 == 7?(this.volts[0] - this.volts[1]) * this.current_0:this.volts[0] - this.volts[1];
|
|
}
|
|
;
|
|
_.getShortcut = function getShortcut_8(){
|
|
return 99;
|
|
}
|
|
;
|
|
_.isIdealCapacitor_0 = function isIdealCapacitor_0(){
|
|
return this.seriesResistance == 0;
|
|
}
|
|
;
|
|
_.isIdealCapacitor = function(){
|
|
return this.isIdealCapacitor_0();
|
|
}
|
|
;
|
|
_.reset_0 = function reset_8(){
|
|
$reset(this);
|
|
this.current_0 = this.curcount_0 = this.curSourceValue = 0;
|
|
this.voltdiff = this.initialVoltage;
|
|
}
|
|
;
|
|
_.setEditValue = function setEditValue_14(n, ei){
|
|
$setEditValue_3(this, n, ei);
|
|
}
|
|
;
|
|
_.setNodeVoltage = function setNodeVoltage_0(n, c){
|
|
this.volts[n] = c;
|
|
}
|
|
;
|
|
_.setPoints = function setPoints_13(){
|
|
$setPoints_4(this);
|
|
}
|
|
;
|
|
_.stamp = function stamp_17(){
|
|
if (app_0.dcAnalysisFlag) {
|
|
$stampResistor(this.nodes[0], this.nodes[1], $intern_97);
|
|
this.curSourceValue = 0;
|
|
this.capNode2 = 1;
|
|
return;
|
|
}
|
|
this.capNode2 = this.seriesResistance > 0?2:1;
|
|
(this.flags & 2) == 0?(this.compResistance = sim_0.timeStep / (2 * this.capacitance)):(this.compResistance = sim_0.timeStep / this.capacitance);
|
|
$stampResistor(this.nodes[0], this.nodes[this.capNode2], this.compResistance);
|
|
this.seriesResistance > 0 && $stampResistor(this.nodes[1], this.nodes[2], this.seriesResistance);
|
|
}
|
|
;
|
|
_.startIteration = function startIteration_2(){
|
|
(this.flags & 2) == 0?(this.curSourceValue = -this.voltdiff / this.compResistance - this.current_0):(this.curSourceValue = -this.voltdiff / this.compResistance);
|
|
}
|
|
;
|
|
_.stepFinished = function stepFinished_9(){
|
|
this.voltdiff = this.volts[0] - this.volts[this.capNode2];
|
|
$calculateCurrent(this);
|
|
}
|
|
;
|
|
_.undumpXml = function undumpXml_16(xml){
|
|
$undumpXml_2(this, xml);
|
|
}
|
|
;
|
|
_.validate = function validate_6(){
|
|
var fpi;
|
|
if (this.seriesResistance == 0) {
|
|
fpi = new FindPathInfo(3, this, this.nodes[1], sim_0);
|
|
if ($findPath(fpi, this.nodes[0])) {
|
|
console.log(this + ' shorted');
|
|
$reset(this);
|
|
this.voltdiff = this.current_0 = this.curcount_0 = this.curSourceValue = 0;
|
|
}
|
|
else {
|
|
fpi = new FindPathInfo(4, this, this.nodes[1], sim_0);
|
|
if ($findPath(fpi, this.nodes[0])) {
|
|
this.seriesResistance = 0.1;
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
;
|
|
_.capNode2 = 0;
|
|
_.capacitance = 0;
|
|
_.compResistance = 0;
|
|
_.curSourceValue = 0;
|
|
_.initialVoltage = 0;
|
|
_.seriesResistance = 0;
|
|
_.voltdiff = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_CapacitorElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'CapacitorElm', 143);
|
|
function $getState(this$static){
|
|
return $booleanValue(this$static.attached?($clinit_Boolean() , this$static.inputElem.checked?true:false):($clinit_Boolean() , this$static.inputElem.defaultChecked?true:false));
|
|
}
|
|
|
|
function $setState_0(this$static, s){
|
|
$setValue(this$static, ($clinit_Boolean() , s?true:false));
|
|
}
|
|
|
|
function Checkbox(s){
|
|
CheckBox_0.call(this, LS(s));
|
|
}
|
|
|
|
function Checkbox_0(s, b){
|
|
CheckBox_0.call(this, LS(s));
|
|
$setValue(this, ($clinit_Boolean() , b?true:false));
|
|
}
|
|
|
|
defineClass(34, 166, {172:1, 71:1, 119:1, 94:1, 122:1, 85:1, 98:1, 121:1, 69:1, 70:1, 72:1, 73:1, 75:1, 74:1, 76:1, 77:1, 78:1, 120:1, 96:1, 97:1, 95:1, 124:1, 125:1, 123:1, 86:1, 90:1, 88:1, 89:1, 87:1, 91:1, 102:1, 101:1, 100:1, 99:1, 28:1, 210:1, 25:1, 134:1, 60:1, 27:1, 230:1, 190:1, 166:1, 82:1, 116:1, 248:1, 206:1, 105:1, 115:1, 59:1, 146:1, 50:1, 229:1, 23:1, 196:1, 29:1, 92:1, 117:1, 118:1, 93:1, 22:1, 24:1, 34:1}, Checkbox, Checkbox_0);
|
|
var Lcom_lushprojects_circuitjs1_client_Checkbox_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'Checkbox', 34);
|
|
function CheckboxAlignedMenuItem(s, cmd){
|
|
MenuItem.call(this, ($clinit_SafeHtmlUtils() , new SafeHtmlString(checkBoxHtml + ' <\/div>' + s)), cmd);
|
|
}
|
|
|
|
defineClass(142, 40, $intern_67, CheckboxAlignedMenuItem);
|
|
var Lcom_lushprojects_circuitjs1_client_CheckboxAlignedMenuItem_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'CheckboxAlignedMenuItem', 142);
|
|
function $$init_3(this$static){
|
|
this$static.on = false;
|
|
this$static.name_0 = '';
|
|
this$static.shortcut = '';
|
|
this$static.extcmd = null;
|
|
}
|
|
|
|
function $setCommand_0(this$static, cmd){
|
|
this$static.extcmd = cmd;
|
|
}
|
|
|
|
function $setShortcut(this$static, s){
|
|
this$static.shortcut = s;
|
|
}
|
|
|
|
function $setState_1(this$static, newstate){
|
|
var s, shortcutText;
|
|
this$static.on = newstate;
|
|
this$static.on?(s = checkBoxHtml + '✔<\/div>' + this$static.name_0):(s = checkBoxHtml + ' <\/div>' + this$static.name_0);
|
|
if (this$static.shortcut != '') {
|
|
shortcutText = displayText(this$static.shortcut);
|
|
if (shortcutText.length == 1) {
|
|
s = s + '<div style="display:inline-block;width:20px;right:10px;text-align:center;position:absolute;">' + shortcutText + '<\/div>';
|
|
}
|
|
else {
|
|
s = s + '<span style="display:inline-block; width: 60px;"><\/span>';
|
|
s = s + '<div style="display:inline-block;right:10px;text-align:right;position:absolute;">' + shortcutText + '<\/div>';
|
|
}
|
|
}
|
|
$setInnerHTML(($clinit_DOM() , this$static.element), s);
|
|
}
|
|
|
|
function CheckboxMenuItem(s){
|
|
MenuItem_1.call(this, s, null);
|
|
$$init_3(this);
|
|
this.command = this;
|
|
this.name_0 = s;
|
|
$setState_1(this, false);
|
|
}
|
|
|
|
function CheckboxMenuItem_0(s, cmd){
|
|
MenuItem_1.call(this, s, null);
|
|
$$init_3(this);
|
|
this.command = this;
|
|
this.extcmd = cmd;
|
|
this.name_0 = s;
|
|
$setState_1(this, false);
|
|
}
|
|
|
|
function CheckboxMenuItem_1(s, c){
|
|
CheckboxMenuItem.call(this, s);
|
|
this.shortcut = c;
|
|
}
|
|
|
|
defineClass(108, 40, {60:1, 105:1, 59:1, 50:1, 23:1, 40:1, 22:1, 108:1}, CheckboxMenuItem, CheckboxMenuItem_0, CheckboxMenuItem_1);
|
|
_.execute_1 = function execute_17(){
|
|
$setState_1(this, !this.on);
|
|
if (this.extcmd) {
|
|
this.extcmd.execute_1();
|
|
$repaint(theApp.ui);
|
|
}
|
|
}
|
|
;
|
|
_.on = false;
|
|
var checkBoxHtml = '<div style="display:inline-block;width:15px;">';
|
|
var Lcom_lushprojects_circuitjs1_client_CheckboxMenuItem_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'CheckboxMenuItem', 108);
|
|
function $fixName(this$static){
|
|
var result;
|
|
if ($startsWith(this$static.text_0, '/')) {
|
|
this$static.text_0 = this$static.text_0.substr(1);
|
|
this$static.lineOver = true;
|
|
}
|
|
else if ($startsWith(this$static.text_0, '#')) {
|
|
this$static.text_0 = this$static.text_0.substr(1);
|
|
this$static.bubble = true;
|
|
}
|
|
result = $replaceAll(this$static.text_0, 'CLK:', '');
|
|
if (result.length != this$static.text_0.length) {
|
|
this$static.clock = true;
|
|
this$static.text_0 = result;
|
|
}
|
|
result = $replaceAll(this$static.text_0, 'INV:', '');
|
|
if (result.length != this$static.text_0.length) {
|
|
this$static.bubble = true;
|
|
this$static.text_0 = result;
|
|
}
|
|
if ($compareToIgnoreCase(this$static.text_0, 'clk') == 0) {
|
|
this$static.text_0 = '';
|
|
this$static.clock = true;
|
|
}
|
|
}
|
|
|
|
function $setPoint(this$static, px, py, dx, dy, dax, day, sx, sy){
|
|
var busExtra, xa, ya;
|
|
if ((this$static.this$01.flags & $intern_24) != 0) {
|
|
dx = -dx;
|
|
dax = -dax;
|
|
px += this$static.this$01.cspc2 * (this$static.this$01.flippedSizeX - 1);
|
|
sx = -sx;
|
|
}
|
|
if ((this$static.this$01.flags & $intern_43) != 0) {
|
|
dy = -dy;
|
|
day = -day;
|
|
py += this$static.this$01.cspc2 * (this$static.this$01.flippedSizeY - 1);
|
|
sy = -sy;
|
|
}
|
|
xa = px + this$static.this$01.cspc2 * dx * this$static.pos + sx;
|
|
ya = py + this$static.this$01.cspc2 * dy * this$static.pos + sy;
|
|
this$static.post = new Point_2(xa + dax * this$static.this$01.cspc2, ya + day * this$static.this$01.cspc2);
|
|
busExtra = this$static.busWidth > 1?2:0;
|
|
this$static.stub = new Point_2(xa + dax * (this$static.this$01.cspc + busExtra), ya + day * (this$static.this$01.cspc + busExtra));
|
|
this$static.textloc = new Point_2(xa, ya);
|
|
this$static.post.z_0 = this$static.busZ;
|
|
if (this$static.bubble) {
|
|
this$static.bubbleX = xa + dax * 10 * this$static.this$01.csize;
|
|
this$static.bubbleY = ya + day * 10 * this$static.this$01.csize;
|
|
}
|
|
if (this$static.clock) {
|
|
if (this$static.clockPointsX == null) {
|
|
this$static.clockPointsX = initUnidimensionalArray(I_classLit, $intern_25, 7, 3, 15, 1);
|
|
this$static.clockPointsY = initUnidimensionalArray(I_classLit, $intern_25, 7, 3, 15, 1);
|
|
}
|
|
this$static.clockPointsX[0] = xa + dax * this$static.this$01.cspc - (dx * this$static.this$01.cspc / 2 | 0);
|
|
this$static.clockPointsY[0] = ya + day * this$static.this$01.cspc - (dy * this$static.this$01.cspc / 2 | 0);
|
|
this$static.clockPointsX[1] = xa;
|
|
this$static.clockPointsY[1] = ya;
|
|
this$static.clockPointsX[2] = xa + dax * this$static.this$01.cspc + (dx * this$static.this$01.cspc / 2 | 0);
|
|
this$static.clockPointsY[2] = ya + day * this$static.this$01.cspc + (dy * this$static.this$01.cspc / 2 | 0);
|
|
if (this$static.text_0.length > 0) {
|
|
this$static.clockPointsX[1] += dax * this$static.this$01.cspc / 2 | 0;
|
|
this$static.clockPointsY[1] += day * this$static.this$01.cspc / 2 | 0;
|
|
this$static.textloc.x_0 -= dax * this$static.this$01.cspc / 2 | 0;
|
|
this$static.textloc.y_0 -= day * this$static.this$01.cspc / 4 | 0;
|
|
}
|
|
}
|
|
else {
|
|
this$static.clockPointsX = null;
|
|
this$static.clockPointsY = null;
|
|
}
|
|
}
|
|
|
|
function ChipElm$Pin(this$0, p, s, t){
|
|
this.this$01 = this$0;
|
|
this.pos = p;
|
|
this.side0 = this.side = s;
|
|
this.text_0 = t;
|
|
}
|
|
|
|
defineClass(9, 1, {9:1}, ChipElm$Pin);
|
|
_.bubble = false;
|
|
_.bubbleX = 0;
|
|
_.bubbleY = 0;
|
|
_.busWidth = 1;
|
|
_.busZ = 0;
|
|
_.clock = false;
|
|
_.curcount = 0;
|
|
_.current = 0;
|
|
_.lineOver = false;
|
|
_.output = false;
|
|
_.pos = 0;
|
|
_.selected_0 = false;
|
|
_.side = 0;
|
|
_.side0 = 0;
|
|
_.state = false;
|
|
_.value_0 = false;
|
|
var Lcom_lushprojects_circuitjs1_client_ChipElm$Pin_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ChipElm/Pin', 9);
|
|
function $select(this$static, i){
|
|
$setSelectedIndex(($clinit_DOM() , this$static.element), i);
|
|
}
|
|
|
|
function Choice(){
|
|
ListBox.call(this);
|
|
}
|
|
|
|
defineClass(49, 180, $intern_64, Choice);
|
|
var Lcom_lushprojects_circuitjs1_client_Choice_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'Choice', 49);
|
|
function $addWidgetToVerticalPanel(this$static, w){
|
|
$addWidgetToVerticalPanel_0(this$static.ui, w);
|
|
}
|
|
|
|
function $deleteSliders(this$static, elm){
|
|
var adj, i;
|
|
if (!this$static.adjustables)
|
|
return;
|
|
for (i = this$static.adjustables.arrayList.array.length - 1; i >= 0; i--) {
|
|
adj = $get_4(this$static.adjustables, i);
|
|
if (adj.elm == elm) {
|
|
$deleteSlider(adj, this$static);
|
|
$remove_18(this$static.adjustables, i);
|
|
}
|
|
}
|
|
}
|
|
|
|
function $dumpCircuit(this$static){
|
|
var dump_0, xml;
|
|
clearDumpedFlags_0();
|
|
clearDumpedFlags();
|
|
clearDumpedFlags_1();
|
|
clearDumpedFlags_4();
|
|
clearDumpedFlags_2();
|
|
clearDumpedFlags_3();
|
|
xml = new XMLSerializer_0(this$static);
|
|
dump_0 = $dumpCircuit_0(xml);
|
|
return dump_0;
|
|
}
|
|
|
|
function $findAdjustable(this$static, elm, item_0){
|
|
var a, i;
|
|
for (i = 0; i != this$static.adjustables.arrayList.array.length; i++) {
|
|
a = $get_4(this$static.adjustables, i);
|
|
if (a.elm == elm && a.editItem == item_0)
|
|
return a;
|
|
}
|
|
return null;
|
|
}
|
|
|
|
function $getEditingModelName(this$static){
|
|
if (this$static.contextStack.arrayList.array.length == 0)
|
|
return null;
|
|
return $lastElement(this$static.contextStack).modelName;
|
|
}
|
|
|
|
function $getElm(this$static, n){
|
|
if (n >= this$static.elmList.arrayList.array.length)
|
|
return null;
|
|
return $get_4(this$static.elmList, n);
|
|
}
|
|
|
|
function $getHint(this$static){
|
|
var c1, c2, ce, ie, re;
|
|
c1 = $getElm(this$static, this$static.hintItem1);
|
|
c2 = $getElm(this$static, this$static.hintItem2);
|
|
if (!c1 || !c2)
|
|
return null;
|
|
if (this$static.hintType == 1) {
|
|
if (!instanceOf(c1, 194))
|
|
return null;
|
|
if (!instanceOf(c2, 143))
|
|
return null;
|
|
ie = c1;
|
|
ce = c2;
|
|
return LS('res.f = ') + getUnitText(1 / ($intern_2 * $wnd.Math.sqrt(ie.inductance * ce.capacitance)), 'Hz', false);
|
|
}
|
|
if (this$static.hintType == 2) {
|
|
if (!instanceOf(c1, 184))
|
|
return null;
|
|
if (!instanceOf(c2, 143))
|
|
return null;
|
|
re = c1;
|
|
ce = c2;
|
|
return 'RC = ' + getUnitText(re.resistance * ce.capacitance, 's', false);
|
|
}
|
|
if (this$static.hintType == 3) {
|
|
if (!instanceOf(c1, 184))
|
|
return null;
|
|
if (!instanceOf(c2, 143))
|
|
return null;
|
|
re = c1;
|
|
ce = c2;
|
|
return LS('f.3db = ') + getUnitText(1 / ($intern_2 * re.resistance * ce.capacitance), 'Hz', false);
|
|
}
|
|
if (this$static.hintType == 5) {
|
|
if (!instanceOf(c1, 184))
|
|
return null;
|
|
if (!instanceOf(c2, 194))
|
|
return null;
|
|
re = c1;
|
|
ie = c2;
|
|
return LS('f.3db = ') + getUnitText(re.resistance / ($intern_2 * ie.inductance), 'Hz', false);
|
|
}
|
|
if (this$static.hintType == 4) {
|
|
if (!instanceOf(c1, 184))
|
|
return null;
|
|
if (!instanceOf(c2, 143))
|
|
return null;
|
|
re = c1;
|
|
ce = c2;
|
|
return LS('fc = ') + getUnitText(1 / ($intern_2 * re.resistance * ce.capacitance), 'Hz', false);
|
|
}
|
|
return null;
|
|
}
|
|
|
|
function $getIterCount(this$static){
|
|
if (this$static.ui.speedBar.val_0 == 0)
|
|
return 0;
|
|
return 0.1 * $wnd.Math.exp((this$static.ui.speedBar.val_0 - 61) / 24);
|
|
}
|
|
|
|
function $getLabelTextForClass(this$static, cls){
|
|
return $getLabelTextForClass_0(this$static.ui, cls);
|
|
}
|
|
|
|
function $getrand(this$static, x_0){
|
|
var q;
|
|
q = round_int($nextInternal(this$static.random_0, 32));
|
|
q < 0 && (q = -q);
|
|
return q % x_0;
|
|
}
|
|
|
|
function $importCircuitFromText(this$static, circuitText, subcircuitsOnly){
|
|
var flags;
|
|
flags = subcircuitsOnly?5:0;
|
|
subcircuitsOnly || (this$static.contextStack.arrayList.array = initUnidimensionalArray(Ljava_lang_Object_2_classLit, $intern_3, 1, 0, 5, 1) , $updateContextButtons(this$static.ui));
|
|
if (circuitText != null) {
|
|
$readCircuit_0(this$static.loader, circuitText, flags);
|
|
lastFileName = null;
|
|
$allowSave(this$static.ui, false);
|
|
}
|
|
}
|
|
|
|
function $init_1(this$static){
|
|
var cct, ctz, currentColor, e, electronFileName, meta, mouseModeReq, negativeColor, neutralColor, node, positiveColor, qp, running, selectColor, val;
|
|
meta = $doc.createElement('meta');
|
|
meta.name = 'viewport';
|
|
meta.content = 'width=device-width';
|
|
node = $doc.getElementsByTagName('head');
|
|
node[0].appendChild(meta);
|
|
running = true;
|
|
initClass(this$static, this$static.sim);
|
|
this$static.ui = new UIManager(this$static);
|
|
this$static.undoManager = new UndoManager(this$static);
|
|
$readRecovery(this$static.undoManager);
|
|
this$static.imageExporter = new ImageExporter(this$static);
|
|
this$static.commands = new CommandManager(this$static);
|
|
qp = new QueryParameters;
|
|
positiveColor = null;
|
|
negativeColor = null;
|
|
neutralColor = null;
|
|
selectColor = null;
|
|
currentColor = null;
|
|
mouseModeReq = null;
|
|
try {
|
|
cct = $getStringValue(qp.map_0, 'cct');
|
|
cct != null && (this$static.startCircuitText_0 = $replace_0(cct, '%24', '$'));
|
|
this$static.startCircuitText_0 == null && (this$static.startCircuitText_0 = $wnd.startCircuitText);
|
|
ctz = $getStringValue(qp.map_0, 'ctz');
|
|
ctz != null && (this$static.startCircuitText_0 = $wnd.LZString.decompressFromEncodedURIComponent(ctz));
|
|
this$static.startCircuit = $getStringValue(qp.map_0, 'startCircuit');
|
|
this$static.startLabel = $getStringValue(qp.map_0, 'startLabel');
|
|
this$static.startCircuitLink = $getStringValue(qp.map_0, 'startCircuitLink');
|
|
running = (val = $getStringValue(qp.map_0, 'running') , val == null || val == '1' || $equalsIgnoreCase(val, 'true'));
|
|
positiveColor = $getStringValue(qp.map_0, 'positiveColor');
|
|
negativeColor = $getStringValue(qp.map_0, 'negativeColor');
|
|
neutralColor = $getStringValue(qp.map_0, 'neutralColor');
|
|
selectColor = $getStringValue(qp.map_0, 'selectColor');
|
|
currentColor = $getStringValue(qp.map_0, 'currentColor');
|
|
mouseModeReq = $getStringValue(qp.map_0, 'mouseMode');
|
|
}
|
|
catch ($e0) {
|
|
$e0 = toJava($e0);
|
|
if (!instanceOf($e0, 13))
|
|
throw toJs($e0);
|
|
}
|
|
this$static.transform_0 = initUnidimensionalArray(D_classLit, $intern_76, 7, 6, 15, 1);
|
|
this$static.shortcuts = new HashMap;
|
|
this$static.elmList = new Vector;
|
|
$init_3(this$static.ui);
|
|
this$static.adjustables = new Vector;
|
|
this$static.random_0 = new Random;
|
|
$setColors(this$static.ui, positiveColor, negativeColor, neutralColor, selectColor, currentColor);
|
|
$setWheelSensitivity(this$static.ui);
|
|
try {
|
|
loadModelsFromStorage();
|
|
}
|
|
catch ($e1) {
|
|
$e1 = toJava($e1);
|
|
if (instanceOf($e1, 13)) {
|
|
e = $e1;
|
|
console.log('Exception: ' + e);
|
|
}
|
|
else
|
|
throw toJs($e1);
|
|
}
|
|
this$static.loader = new CircuitLoader(this$static, this$static.sim, this$static.scopeManager, this$static.menus);
|
|
if (loadingTestCircuit) {
|
|
this$static.startCircuitText_0 = this$static.startCircuit = null;
|
|
}
|
|
else if (this$static.startCircuitText_0 != null) {
|
|
$getSetupList(this$static.menus, false);
|
|
$readCircuit_0(this$static.loader, this$static.startCircuitText_0, 0);
|
|
electronFileName = $wnd.startCircuitFileName;
|
|
electronFileName != null && $setCircuitTitle_0(this$static.ui, electronFileName);
|
|
this$static.unsavedChanges = false;
|
|
}
|
|
else {
|
|
if (this$static.stopMessage == null && this$static.startCircuitLink != null) {
|
|
$readCircuit_0(this$static.loader, '', 0);
|
|
$getSetupList(this$static.menus, false);
|
|
sim_2 = this$static;
|
|
doImportDropboxLink(this$static.startCircuitLink, ($clinit_Boolean() , false));
|
|
}
|
|
else {
|
|
$readCircuit_0(this$static.loader, '', 0);
|
|
if (this$static.stopMessage == null && this$static.startCircuit != null) {
|
|
$getSetupList(this$static.menus, false);
|
|
$readSetupFile(this$static.menus, this$static.startCircuit, this$static.startLabel);
|
|
}
|
|
else
|
|
$getSetupList(this$static.menus, true);
|
|
}
|
|
}
|
|
mouseModeReq != null && $menuPerformed(this$static.commands, 'main', mouseModeReq);
|
|
$enableUndoRedo(this$static.undoManager);
|
|
$enablePaste(this$static.commands);
|
|
this$static.jsInterface = new JSInterface(this$static);
|
|
$setupJSInterface(this$static.jsInterface);
|
|
$setSimRunning_0(this$static.ui, running);
|
|
}
|
|
|
|
function $isMobile(element){
|
|
if (!element)
|
|
return false;
|
|
var style = getComputedStyle(element);
|
|
return style.display != 'none';
|
|
}
|
|
|
|
function $locateElm(this$static, elm){
|
|
var i;
|
|
for (i = 0; i != this$static.elmList.arrayList.array.length; i++)
|
|
if (maskUndefined(elm) === maskUndefined($elementAt(this$static.elmList, i)))
|
|
return i;
|
|
return -1;
|
|
}
|
|
|
|
function $needAnalyze(this$static){
|
|
this$static.analyzeFlag = true;
|
|
$repaint(this$static.ui);
|
|
$enableDisableMenuItems(this$static.mouse);
|
|
}
|
|
|
|
function $popContextAndGetChangedModels(this$static){
|
|
var ctx;
|
|
if (this$static.contextStack.arrayList.array.length == 0)
|
|
return new Vector;
|
|
ctx = $remove_18(this$static.contextStack, this$static.contextStack.arrayList.array.length - 1);
|
|
$readCircuit_0(this$static.loader, ctx.circuitDump, 2);
|
|
this$static.transform_0 = ctx.transform_0;
|
|
this$static.undoManager.undoStack = ctx.undoStack;
|
|
this$static.undoManager.redoStack = ctx.redoStack;
|
|
$enableUndoRedo(this$static.undoManager);
|
|
$updateContextButtons(this$static.ui);
|
|
return ctx.changedModels;
|
|
}
|
|
|
|
function $pushContext(this$static, modelName){
|
|
var ctx, i;
|
|
ctx = new CircuitContext;
|
|
ctx.circuitDump = $dumpCircuit(this$static);
|
|
ctx.undoStack = this$static.undoManager.undoStack;
|
|
ctx.redoStack = this$static.undoManager.redoStack;
|
|
ctx.transform_0 = initUnidimensionalArray(D_classLit, $intern_76, 7, this$static.transform_0.length, 15, 1);
|
|
for (i = 0; i < this$static.transform_0.length; i++)
|
|
ctx.transform_0[i] = this$static.transform_0[i];
|
|
ctx.modelName = modelName;
|
|
$add_11(this$static.contextStack, ctx);
|
|
this$static.undoManager.undoStack = new Vector;
|
|
this$static.undoManager.redoStack = new Vector;
|
|
$enableUndoRedo(this$static.undoManager);
|
|
$updateContextButtons(this$static.ui);
|
|
}
|
|
|
|
function $readCircuit(this$static, s){
|
|
$readCircuit_0(this$static.loader, s, 0);
|
|
}
|
|
|
|
function $refreshModels(this$static, modelName){
|
|
var cce, ce, ce$iterator;
|
|
for (ce$iterator = new ArrayList$1(this$static.elmList.arrayList); ce$iterator.i < ce$iterator.this$01.array.length;) {
|
|
ce = $next_4(ce$iterator);
|
|
if (instanceOf(ce, 200)) {
|
|
cce = ce;
|
|
if ($equals_1(cce.modelName, modelName)) {
|
|
cce.model = null;
|
|
cce.model = null;
|
|
$updateModels_0(cce, null);
|
|
}
|
|
}
|
|
}
|
|
$needAnalyze(this$static);
|
|
}
|
|
|
|
function $register(elm){
|
|
var className, cs, s, s0, t, xt;
|
|
if (!dumpTypeMap) {
|
|
dumpTypeMap = new HashMap;
|
|
xmlDumpTypeMap = new HashMap;
|
|
}
|
|
if (!elm)
|
|
return;
|
|
t = elm.getDumpType();
|
|
cs = elm.getDumpClass();
|
|
className = ($ensureNamesAreInitialized(cs) , cs.typeName);
|
|
className = $substring(className, $lastIndexOf(className, fromCodePoint(46)) + 1);
|
|
if (t > 0) {
|
|
s0 = $get_1(dumpTypeMap, valueOf_0(t));
|
|
s0 != null?$equals_1(s0, className) || (console.log('dump type conflict for ' + className + ' ' + t) , undefined):$put_0(dumpTypeMap, valueOf_0(t), className);
|
|
}
|
|
xt = elm.getXmlDumpType();
|
|
s = $getStringValue(xmlDumpTypeMap, xt);
|
|
s != null?$equals_1(s, className) || (console.log('xml dump type conflict for ' + className + ' ' + xt) , undefined):$putStringValue(xmlDumpTypeMap, xt, className);
|
|
}
|
|
|
|
function $removeWidgetFromVerticalPanel(this$static, w){
|
|
$removeWidgetFromVerticalPanel_0(this$static.ui, w);
|
|
}
|
|
|
|
function $resetEditingContext(this$static){
|
|
this$static.contextStack.arrayList.array = initUnidimensionalArray(Ljava_lang_Object_2_classLit, $intern_3, 1, 0, 5, 1);
|
|
$updateContextButtons(this$static.ui);
|
|
}
|
|
|
|
function $setCircuitTitle(this$static, s){
|
|
$setCircuitTitle_0(this$static.ui, s);
|
|
}
|
|
|
|
function $setMouseMode(this$static, mode){
|
|
$setMouseMode_0(this$static.ui, mode);
|
|
}
|
|
|
|
function $setSimRunning(this$static, s){
|
|
$setSimRunning_0(this$static.ui, s);
|
|
}
|
|
|
|
function $setStopElm(this$static, ce, msg){
|
|
this$static.stopElm = ce;
|
|
this$static.stopMessage = msg;
|
|
}
|
|
|
|
function $snapGrid_0(this$static, x_0){
|
|
return x_0 + this$static.gridRound & this$static.gridMask;
|
|
}
|
|
|
|
function $updateModels(this$static){
|
|
var ce, ce$iterator;
|
|
for (ce$iterator = new ArrayList$1(this$static.elmList.arrayList); ce$iterator.i < ce$iterator.this$01.array.length;) {
|
|
ce = $next_4(ce$iterator);
|
|
ce.updateModels();
|
|
}
|
|
}
|
|
|
|
function CirSim(){
|
|
this.postDrawList = new Vector;
|
|
this.badConnectionList = new Vector;
|
|
this.contextStack = new Vector;
|
|
this.timer = new CirSim$1(this);
|
|
theApp = this;
|
|
this.sim = new SimulationManager(this);
|
|
}
|
|
|
|
function console_0(text_0){
|
|
console.log(text_0);
|
|
}
|
|
|
|
function constructElement(n, x1, y1){
|
|
var elm, ix, name_0;
|
|
elm = $create(n, x1, y1);
|
|
if (elm)
|
|
return elm;
|
|
if (n == 'VoltageElm')
|
|
return new DCVoltageElm(x1, y1);
|
|
if (n == 'TransistorElm')
|
|
return new NTransistorElm(x1, y1);
|
|
if (n == 'MosfetElm')
|
|
return new NMosfetElm(x1, y1);
|
|
if (n == 'JfetElm')
|
|
return new NJfetElm(x1, y1);
|
|
if (n == 'DarlingtonElm')
|
|
return new NDarlingtonElm(x1, y1);
|
|
if (n == 'DecadeElm' || n == 'RingCounterElm')
|
|
return new RingCounterElm(x1, y1);
|
|
if (n == 'UserDefinedLogicElm' || n == 'CustomLogicElm')
|
|
return new CustomLogicElm(x1, y1);
|
|
if ($equals_1(n.substr(0, 19), 'CustomCompositeElm:')) {
|
|
ix = $indexOf_1(n, fromCodePoint(58)) + 1;
|
|
name_0 = n.substr(ix);
|
|
return new CustomCompositeElm_1(x1, y1, name_0);
|
|
}
|
|
return null;
|
|
}
|
|
|
|
function createCe(tint, x1, y1, x2, y2, f, st){
|
|
var name_0;
|
|
if (tint == 110)
|
|
return new NoiseElm_0(x1, y1, x2, y2, f, st);
|
|
name_0 = $get_1(dumpTypeMap, valueOf_0(tint));
|
|
if (name_0 == null)
|
|
return null;
|
|
return $create_0(name_0, x1, y1, x2, y2, f, st);
|
|
}
|
|
|
|
function debugger_0(){
|
|
debugger;
|
|
}
|
|
|
|
defineClass(462, 1, $intern_40, CirSim);
|
|
_.onPreviewNativeEvent = function onPreviewNativeEvent_4(e){
|
|
$onPreviewNativeEvent(this.ui, e);
|
|
}
|
|
;
|
|
_.analyzeFlag = false;
|
|
_.autoDCOnReset = false;
|
|
_.consoleExceptionOccurred = false;
|
|
_.dcAnalysisFlag = false;
|
|
_.developerMode = false;
|
|
_.dumpMatrix = false;
|
|
_.gridMask = 0;
|
|
_.gridRound = 0;
|
|
_.gridSize = 0;
|
|
_.hintItem1 = 0;
|
|
_.hintItem2 = 0;
|
|
_.hintType = -1;
|
|
_.minFrameRate = 20;
|
|
_.savedFlag = false;
|
|
_.showResistanceInVoltageSources = false;
|
|
_.simRunning = false;
|
|
_.startCircuit = null;
|
|
_.startCircuitLink = null;
|
|
_.startCircuitText_0 = null;
|
|
_.startLabel = null;
|
|
_.unsavedChanges = false;
|
|
var aboutBox, customLogicEditDialog, dialogShowing, diodeModelEditDialog, dumpTypeMap, editDialog_0, scrollValuePopup, theApp, typeScrollPopup, xmlDumpTypeMap;
|
|
var Lcom_lushprojects_circuitjs1_client_CirSim_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'CirSim', 462);
|
|
function CirSim$1(this$0){
|
|
this.this$01 = this$0;
|
|
Timer.call(this);
|
|
}
|
|
|
|
defineClass(482, 213, {}, CirSim$1);
|
|
_.run = function run_3(){
|
|
var e;
|
|
try {
|
|
$updateCircuit(this.this$01.ui);
|
|
}
|
|
catch ($e0) {
|
|
$e0 = toJava($e0);
|
|
if (instanceOf($e0, 13)) {
|
|
e = $e0;
|
|
debugger_0();
|
|
console.log('exception in updateCircuit ' + e);
|
|
$printStackTraceImpl(e, ($clinit_System() , err_0), '');
|
|
this.this$01.consoleExceptionOccurred = true;
|
|
}
|
|
else
|
|
throw toJs($e0);
|
|
}
|
|
this.this$01.consoleExceptionOccurred && $drawExceptionIndicator(this.this$01.ui);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_CirSim$1_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'CirSim/1', 482);
|
|
function CircuitContext(){
|
|
this.changedModels = new Vector;
|
|
}
|
|
|
|
defineClass(323, 1, {323:1}, CircuitContext);
|
|
var Lcom_lushprojects_circuitjs1_client_CircuitContext_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'CircuitContext', 323);
|
|
function $clearCircuit(this$static){
|
|
var ce, ce$iterator;
|
|
$clearMouseElm(this$static.app.mouse);
|
|
for (ce$iterator = new ArrayList$1(this$static.app.elmList.arrayList); ce$iterator.i < ce$iterator.this$01.array.length;) {
|
|
ce = $next_4(ce$iterator);
|
|
ce.delete_0();
|
|
}
|
|
$resetTime(this$static.sim);
|
|
this$static.sim.solverType = 0;
|
|
this$static.app.elmList.arrayList.array = initUnidimensionalArray(Ljava_lang_Object_2_classLit, $intern_3, 1, 0, 5, 1);
|
|
this$static.app.hintType = -1;
|
|
this$static.sim.maxTimeStep = 5.0E-6;
|
|
this$static.sim.minTimeStep = 5.0E-11;
|
|
$setState_1(this$static.menus.dotsCheckItem, false);
|
|
$setState_1(this$static.menus.smallGridCheckItem, false);
|
|
$setState_1(this$static.menus.powerCheckItem, false);
|
|
$setState_1(this$static.menus.voltsCheckItem, true);
|
|
$setState_1(this$static.menus.showValuesCheckItem, true);
|
|
this$static.app.autoDCOnReset = false;
|
|
$setGrid(this$static.app.ui);
|
|
$setValue_2(this$static.app.ui.speedBar, 117);
|
|
$setValue_2(this$static.app.ui.currentBar, 50);
|
|
$setValue_2(this$static.app.ui.powerBar, 50);
|
|
voltageRange = 5;
|
|
this$static.scopes.scopeCount = 0;
|
|
this$static.sim.lastIterTime = 0;
|
|
this$static.app.contextStack.arrayList.array.length == 0 && ($reset_13(localModelMap) , ++sequenceNumber);
|
|
if (this$static.app.ui.subcircuitStack.arrayList.array.length != 0) {
|
|
this$static.app.ui.subcircuitStack.arrayList.array = initUnidimensionalArray(Ljava_lang_Object_2_classLit, $intern_3, 1, 0, 5, 1);
|
|
this$static.app.ui.elmList = this$static.app.elmList;
|
|
$updateSubcircuitPath(this$static.app.ui);
|
|
}
|
|
}
|
|
|
|
function $finishReadCircuit(this$static, flags){
|
|
var i;
|
|
$setPowerBarEnable(this$static.app.ui);
|
|
if ((flags & 1) == 0) {
|
|
for (i = 0; i < this$static.app.adjustables.arrayList.array.length; i++) {
|
|
$createSlider($get_4(this$static.app.adjustables, i), this$static.app) || $remove_18(this$static.app.adjustables, i--);
|
|
}
|
|
}
|
|
$needAnalyze(this$static.app);
|
|
(flags & 2) == 0 && $centerCircuit(this$static.app.ui);
|
|
(flags & 4) != 0 && $updateModels(this$static.app);
|
|
$clinit_AudioInputElm();
|
|
$reset_13(audioFileMap);
|
|
$clinit_DataInputElm();
|
|
$reset_13(dataFileMap);
|
|
}
|
|
|
|
function $loadFileFromURL(this$static, url_0){
|
|
var requestBuilder;
|
|
requestBuilder = new RequestBuilder(($clinit_RequestBuilder() , GET), url_0);
|
|
try {
|
|
$sendRequest(requestBuilder, new CircuitLoader$2(this$static));
|
|
}
|
|
catch ($e0) {
|
|
$e0 = toJava($e0);
|
|
if (!instanceOf($e0, 156))
|
|
throw toJs($e0);
|
|
}
|
|
}
|
|
|
|
function $readCircuit_0(this$static, text_0, flags){
|
|
var lastArg, xml;
|
|
if ($equals_1(text_0.substr(0, 1), '<')) {
|
|
(flags & 1) == 0 && $clearCircuit(this$static);
|
|
xml = new XMLDeserializer(this$static.app);
|
|
$readCircuit_3(xml, text_0, flags);
|
|
return;
|
|
}
|
|
$readCircuit_1(this$static, $getBytes((lastArg = text_0 , $clinit_EmulatedCharset() , lastArg)), flags);
|
|
(flags & 8) == 0 && $setCircuitTitle(this$static.app, null);
|
|
}
|
|
|
|
function $readCircuit_1(this$static, b, flags){
|
|
var adj, ee, f, l_0, len, line, linelen, newce, p, sc, st, subs, tint, type_0, x1, x2, y1, y2, name_0, model;
|
|
len = b.length;
|
|
(flags & 1) == 0 && $clearCircuit(this$static);
|
|
subs = (flags & 4) != 0;
|
|
p = 0;
|
|
while (p < len) {
|
|
linelen = len - p;
|
|
for (l_0 = 0; l_0 != len - p; l_0++) {
|
|
if (b[l_0 + p] == 10 || b[l_0 + p] == 13) {
|
|
linelen = l_0++;
|
|
l_0 + p < b.length && b[l_0 + p] == 10 && ++l_0;
|
|
break;
|
|
}
|
|
}
|
|
line = valueOf_2($decodeString(b, p, ($clinit_EmulatedCharset() , linelen)));
|
|
st = new StringTokenizer_0(line, ' +\t\n\r\f');
|
|
while ($hasMoreTokens(st)) {
|
|
type_0 = $nextToken(st);
|
|
tint = (checkCriticalStringElementIndex(0, type_0.length) , type_0.charCodeAt(0));
|
|
try {
|
|
if (subs && tint != 46)
|
|
continue;
|
|
if (tint == 111) {
|
|
sc = new Scope(this$static.app, this$static.sim);
|
|
$undump_2(sc.serializer, st);
|
|
$addScope(this$static.scopes, sc);
|
|
break;
|
|
}
|
|
if (tint == 104) {
|
|
this$static.app.hintType = __parseAndValidateInt($nextToken(st), 10);
|
|
this$static.app.hintItem1 = __parseAndValidateInt($nextToken(st), 10);
|
|
this$static.app.hintItem2 = __parseAndValidateInt($nextToken(st), 10);
|
|
break;
|
|
}
|
|
if (tint == 36) {
|
|
$readOptions(this$static, st, flags);
|
|
break;
|
|
}
|
|
if (tint == 33) {
|
|
name_0 = unescape_0($nextToken(st));
|
|
model = getModelWithName_0(name_0);
|
|
model.flags = (new Integer_0($nextToken(st))).value_0;
|
|
model.inputs = $split_1(unescape_0($nextToken(st)), ',', 0);
|
|
model.outputs = $split_1(unescape_0($nextToken(st)), ',', 0);
|
|
model.infoText = unescape_0($nextToken(st));
|
|
model.rules_0 = unescape_0($nextToken(st));
|
|
$parseRules(model, null);
|
|
break;
|
|
}
|
|
if (tint == 37 || tint == 63 || tint == 66) {
|
|
break;
|
|
}
|
|
tint >= 48 && tint <= 57 && (tint = __parseAndValidateInt(type_0, 10));
|
|
if (tint == 34) {
|
|
undumpModel_0(st);
|
|
break;
|
|
}
|
|
if (tint == 32) {
|
|
undumpModel_1(st);
|
|
break;
|
|
}
|
|
if (tint == 38) {
|
|
adj = new Adjustable_0(st, this$static.app);
|
|
!!adj.elm && $add_11(this$static.app.adjustables, adj);
|
|
break;
|
|
}
|
|
if (tint == 46) {
|
|
undumpModel(st);
|
|
break;
|
|
}
|
|
x1 = __parseAndValidateInt($nextToken(st), 10);
|
|
y1 = __parseAndValidateInt($nextToken(st), 10);
|
|
x2 = __parseAndValidateInt($nextToken(st), 10);
|
|
y2 = __parseAndValidateInt($nextToken(st), 10);
|
|
f = __parseAndValidateInt($nextToken(st), 10);
|
|
newce = createCe(tint, x1, y1, x2, y2, f, st);
|
|
if (!newce) {
|
|
console.log('unrecognized dump type: ' + type_0);
|
|
break;
|
|
}
|
|
newce.setPoints();
|
|
$addElement(this$static.app.elmList, newce);
|
|
}
|
|
catch ($e0) {
|
|
$e0 = toJava($e0);
|
|
if (instanceOf($e0, 13)) {
|
|
ee = $e0;
|
|
$printStackTraceImpl(ee, ($clinit_System() , err_0), '');
|
|
console.log('exception while undumping ' + ee);
|
|
this$static.app.consoleExceptionOccurred = true;
|
|
break;
|
|
}
|
|
else
|
|
throw toJs($e0);
|
|
}
|
|
break;
|
|
}
|
|
p += l_0;
|
|
}
|
|
$finishReadCircuit(this$static, flags);
|
|
}
|
|
|
|
function $readCircuitFlags(this$static, flags){
|
|
$setState_1(this$static.menus.dotsCheckItem, (flags & 1) != 0);
|
|
$setState_1(this$static.menus.smallGridCheckItem, (flags & 2) != 0);
|
|
$setState_1(this$static.menus.voltsCheckItem, (flags & 4) == 0);
|
|
$setState_1(this$static.menus.powerCheckItem, (flags & 8) == 8);
|
|
$setState_1(this$static.menus.showValuesCheckItem, (flags & 16) == 0);
|
|
this$static.sim.adjustTimeStep = (flags & 64) != 0;
|
|
this$static.app.autoDCOnReset = (flags & 128) != 0;
|
|
}
|
|
|
|
function $readOptions(this$static, st, importFlags){
|
|
var flags, sp, sp2;
|
|
flags = __parseAndValidateInt($nextToken(st), 10);
|
|
if ((importFlags & 1) != 0) {
|
|
(flags & 2) != 0 && $setState_1(this$static.menus.smallGridCheckItem, true);
|
|
return;
|
|
}
|
|
$readCircuitFlags(this$static, flags);
|
|
this$static.sim.maxTimeStep = this$static.sim.timeStep = __parseAndValidateDouble($nextToken(st));
|
|
sp = __parseAndValidateDouble($nextToken(st));
|
|
sp2 = round_int($wnd.Math.log(10 * sp) * 24 + 61.5);
|
|
$setValue_2(this$static.app.ui.speedBar, sp2);
|
|
$setValue_2(this$static.app.ui.currentBar, __parseAndValidateInt($nextToken(st), 10));
|
|
voltageRange = __parseAndValidateDouble($nextToken(st));
|
|
try {
|
|
$setValue_2(this$static.app.ui.powerBar, __parseAndValidateInt($nextToken(st), 10));
|
|
this$static.sim.minTimeStep = __parseAndValidateDouble($nextToken(st));
|
|
}
|
|
catch ($e0) {
|
|
$e0 = toJava($e0);
|
|
if (!instanceOf($e0, 13))
|
|
throw toJs($e0);
|
|
}
|
|
$setGrid(this$static.app.ui);
|
|
}
|
|
|
|
function CircuitLoader(app, sim, scopes, menus){
|
|
this.app = app;
|
|
this.sim = sim;
|
|
this.scopes = scopes;
|
|
this.menus = menus;
|
|
}
|
|
|
|
defineClass(543, 1, {}, CircuitLoader);
|
|
var Lcom_lushprojects_circuitjs1_client_CircuitLoader_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'CircuitLoader', 543);
|
|
function CircuitLoader$2(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(544, 1, {}, CircuitLoader$2);
|
|
_.onError = function onError(request, exception){
|
|
alert_0(LS("Can't load circuit!"));
|
|
}
|
|
;
|
|
_.onResponseReceived = function onResponseReceived(request, response){
|
|
var text_0;
|
|
if (response.xmlHttpRequest.status == 200) {
|
|
text_0 = response.xmlHttpRequest.responseText;
|
|
$readCircuit_0(this.this$01, text_0, 8);
|
|
$allowSave(this.this$01.app.ui, false);
|
|
this.this$01.app.unsavedChanges = false;
|
|
}
|
|
else {
|
|
alert_0(LS("Can't load circuit!"));
|
|
}
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_CircuitLoader$2_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'CircuitLoader/2', 544);
|
|
function CircuitMatrix(){
|
|
this.nodeList = new Vector;
|
|
this.voltageSourceList = new Vector;
|
|
}
|
|
|
|
defineClass(285, 1, {285:1}, CircuitMatrix);
|
|
_.nodeCount = 0;
|
|
_.nonLinear = false;
|
|
_.size_0 = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_CircuitMatrix_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'CircuitMatrix', 285);
|
|
function CircuitNode(){
|
|
this.links_0 = new Vector;
|
|
}
|
|
|
|
defineClass(175, 1, {175:1}, CircuitNode);
|
|
_.toString_0 = function toString_19(){
|
|
return 'node ' + this.index_0;
|
|
}
|
|
;
|
|
_.index_0 = 0;
|
|
_.internal = false;
|
|
_.row = 0;
|
|
var ground;
|
|
var Lcom_lushprojects_circuitjs1_client_CircuitNode_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'CircuitNode', 175);
|
|
function CircuitNodeLink(){
|
|
}
|
|
|
|
defineClass(183, 1, {183:1}, CircuitNodeLink);
|
|
_.num = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_CircuitNodeLink_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'CircuitNodeLink', 183);
|
|
function ClockElm(xx, yy){
|
|
RailElm_0.call(this, xx, yy, 2);
|
|
this.maxVoltage_0 = 2.5;
|
|
this.bias = 2.5;
|
|
this.frequency = 100;
|
|
this.flags |= 1;
|
|
}
|
|
|
|
defineClass(925, 47, $intern_92, ClockElm);
|
|
_.getDumpClass = function getDumpClass_3(){
|
|
return Lcom_lushprojects_circuitjs1_client_RailElm_2_classLit;
|
|
}
|
|
;
|
|
_.getShortcut = function getShortcut_9(){
|
|
return 0;
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_ClockElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ClockElm', 925);
|
|
function $clinit_Color(){
|
|
$clinit_Color = emptyMethod;
|
|
white = new Color(255, 255, 255);
|
|
lightGray = new Color(192, 192, 192);
|
|
gray = new Color(128, 128, 128);
|
|
GRAY = new Color(128, 128, 128);
|
|
dark_gray = new Color(64, 64, 64);
|
|
darkGray = new Color(64, 64, 64);
|
|
black = new Color(0, 0, 0);
|
|
red = new Color(255, 0, 0);
|
|
new Color(255, 175, 175);
|
|
new Color(255, 200, 0);
|
|
yellow = new Color(255, 255, 0);
|
|
green = new Color(0, 255, 0);
|
|
new Color(255, 0, 255);
|
|
cyan = new Color(0, 255, 255);
|
|
blue = new Color(0, 0, 255);
|
|
new Color_1('');
|
|
}
|
|
|
|
function $getHexValue(this$static){
|
|
var number, number_0, number_1;
|
|
if (this$static.colorText != null) {
|
|
return this$static.colorText;
|
|
}
|
|
return '#' + $pad((number = this$static.r >>> 0 , number.toString(16))) + $pad((number_0 = this$static.g >>> 0 , number_0.toString(16))) + $pad((number_1 = this$static.b >>> 0 , number_1.toString(16)));
|
|
}
|
|
|
|
function $pad(in_0){
|
|
if (in_0.length == 0) {
|
|
return '00';
|
|
}
|
|
if (in_0.length == 1) {
|
|
return '0' + in_0;
|
|
}
|
|
return in_0;
|
|
}
|
|
|
|
function Color(r, g, b){
|
|
$clinit_Color();
|
|
this.r = r;
|
|
this.g = g;
|
|
this.b = b;
|
|
}
|
|
|
|
function Color_0(c1, c2, mix){
|
|
$clinit_Color();
|
|
var m0;
|
|
m0 = 1 - mix;
|
|
this.r = round_int(c1.r * m0 + c2.r * mix);
|
|
this.g = round_int(c1.g * m0 + c2.g * mix);
|
|
this.b = round_int(c1.b * m0 + c2.b * mix);
|
|
}
|
|
|
|
function Color_1(colorText){
|
|
$clinit_Color();
|
|
var bs, gs, rs;
|
|
this.colorText = colorText;
|
|
if ($equals_1(colorText.substr(0, 1), '#') && colorText.length == 7) {
|
|
rs = colorText.substr(1, 2);
|
|
gs = colorText.substr(3, 2);
|
|
bs = colorText.substr(5, 2);
|
|
this.r = __parseAndValidateInt(rs, 16);
|
|
this.g = __parseAndValidateInt(gs, 16);
|
|
this.b = __parseAndValidateInt(bs, 16);
|
|
}
|
|
}
|
|
|
|
defineClass(43, 1, {43:1}, Color, Color_0, Color_1);
|
|
_.toString_0 = function toString_20(){
|
|
if (this.colorText != null) {
|
|
return this.colorText;
|
|
}
|
|
return 'red=' + this.r + ', green=' + this.g + ', blue=' + this.b;
|
|
}
|
|
;
|
|
_.b = 0;
|
|
_.colorText = null;
|
|
_.g = 0;
|
|
_.r = 0;
|
|
var GRAY, black, blue, cyan, darkGray, dark_gray, gray, green, lightGray, red, white, yellow;
|
|
var Lcom_lushprojects_circuitjs1_client_Color_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'Color', 43);
|
|
function $copyOfSelectedElms(this$static){
|
|
var ce, doc, elem, i, root;
|
|
doc = ($clinit_XMLParser() , build($createDocumentImpl()));
|
|
root = $createElement(doc, 'cir');
|
|
$appendChild_0(doc, root);
|
|
clearDumpedFlags_0();
|
|
clearDumpedFlags();
|
|
clearDumpedFlags_1();
|
|
clearDumpedFlags_4();
|
|
clearDumpedFlags_2();
|
|
for (i = this$static.app.elmList.arrayList.array.length - 1; i >= 0; i--) {
|
|
ce = $get_4(this$static.app.elmList, i);
|
|
ce.dumpXmlModel(doc);
|
|
if (ce.selected_0 && !instanceOf(ce, 21)) {
|
|
elem = $createElement(doc, ce.getXmlDumpType());
|
|
ce.dumpXml(doc, elem);
|
|
ce.dumpXmlState(doc, elem);
|
|
$appendChild_0(root, elem);
|
|
}
|
|
}
|
|
return $clinit_XMLParserImpl() , $toStringImpl(doc);
|
|
}
|
|
|
|
function $countSelected(this$static){
|
|
var ce, ce$iterator, count;
|
|
count = 0;
|
|
for (ce$iterator = new ArrayList$1(this$static.app.elmList.arrayList); ce$iterator.i < ce$iterator.this$01.array.length;) {
|
|
ce = $next_4(ce$iterator);
|
|
ce.selected_0 && ++count;
|
|
}
|
|
return count;
|
|
}
|
|
|
|
function $doCreateSubcircuit(){
|
|
var dlg;
|
|
dlg = new EditCompositeModelDialog;
|
|
if (!$createModel(dlg))
|
|
return;
|
|
$createDialog(dlg);
|
|
dialogShowing = dlg;
|
|
dialogShowing.show();
|
|
}
|
|
|
|
function $doDelete(this$static, pushUndoFlag){
|
|
var ce, hasDeleted, i;
|
|
pushUndoFlag && $pushUndo(this$static.app.undoManager);
|
|
hasDeleted = false;
|
|
for (i = this$static.app.elmList.arrayList.array.length - 1; i >= 0; i--) {
|
|
ce = $get_4(this$static.app.elmList, i);
|
|
if (ce.selected_0 || mouseElmRef == ce) {
|
|
mouseElmRef == ce && $setMouseElm_0(this$static.app.mouse, null);
|
|
ce.delete_0();
|
|
$removeElementAt(this$static.app.elmList, i);
|
|
hasDeleted = true;
|
|
}
|
|
}
|
|
if (hasDeleted) {
|
|
$deleteUnusedScopeElms(this$static.app.scopeManager);
|
|
$needAnalyze(this$static.app);
|
|
$writeRecoveryToStorage(this$static.app.undoManager);
|
|
}
|
|
}
|
|
|
|
function $doEdit(this$static, eable){
|
|
$clearSelection(this$static.app.mouse);
|
|
$pushUndo(this$static.app.undoManager);
|
|
if (editDialog_0) {
|
|
$setVisible_0(editDialog_0);
|
|
editDialog_0 = null;
|
|
}
|
|
editDialog_0 = new EditDialog(eable, this$static.app);
|
|
$show_0(editDialog_0);
|
|
}
|
|
|
|
function $doPaste(this$static, dump_0){
|
|
var bb, ce, ce$iterator, dx, dy, flags, gx, gy, i, mdx, mdy, newbb, oldbb, oldsz, spaceh, spacew;
|
|
$pushUndo(this$static.app.undoManager);
|
|
$clearSelection(this$static.app.mouse);
|
|
oldbb = null;
|
|
for (ce$iterator = new ArrayList$1(this$static.app.elmList.arrayList); ce$iterator.i < ce$iterator.this$01.array.length;) {
|
|
ce = $next_4(ce$iterator);
|
|
bb = ce.boundingBox;
|
|
oldbb?(oldbb = $union(oldbb, bb)):(oldbb = bb);
|
|
}
|
|
oldsz = this$static.app.elmList.arrayList.array.length;
|
|
flags = 1;
|
|
oldsz > 0 && (flags |= 2);
|
|
if (dump_0 != null)
|
|
$readCircuit_0(this$static.app.loader, dump_0, flags);
|
|
else {
|
|
$readClipboardFromStorage(this$static);
|
|
$readCircuit_0(this$static.app.loader, this$static.clipboard_0, flags);
|
|
}
|
|
newbb = null;
|
|
for (i = oldsz; i != this$static.app.elmList.arrayList.array.length; i++) {
|
|
ce = $get_4(this$static.app.elmList, i);
|
|
ce.selected_0 = true;
|
|
bb = ce.boundingBox;
|
|
newbb?(newbb = $union(newbb, bb)):(newbb = bb);
|
|
}
|
|
if (!!oldbb && !!newbb) {
|
|
dx = 0;
|
|
dy = 0;
|
|
spacew = this$static.app.circuitArea.width_0 - oldbb.width_0 - newbb.width_0;
|
|
spaceh = this$static.app.circuitArea.height_0 - oldbb.height_0 - newbb.height_0;
|
|
if (!$intersects(oldbb, newbb)) {
|
|
dx = $snapGrid_0(this$static.app, oldbb.x_0 - newbb.x_0);
|
|
dy = $snapGrid_0(this$static.app, oldbb.y_0 - newbb.y_0);
|
|
}
|
|
spacew > spaceh?(dx = $snapGrid_0(this$static.app, oldbb.x_0 + oldbb.width_0 - newbb.x_0 + this$static.app.gridSize)):(dy = $snapGrid_0(this$static.app, oldbb.y_0 + oldbb.height_0 - newbb.y_0 + this$static.app.gridSize));
|
|
if (this$static.app.mouse.mouseCursorX > 0 && $contains(this$static.app.circuitArea, this$static.app.mouse.mouseCursorX, this$static.app.mouse.mouseCursorY)) {
|
|
gx = $inverseTransformX(this$static.app.mouse, this$static.app.mouse.mouseCursorX);
|
|
gy = $inverseTransformY(this$static.app.mouse, this$static.app.mouse.mouseCursorY);
|
|
mdx = $snapGrid_0(this$static.app, gx - (newbb.x_0 + (newbb.width_0 / 2 | 0)));
|
|
mdy = $snapGrid_0(this$static.app, gy - (newbb.y_0 + (newbb.height_0 / 2 | 0)));
|
|
for (i = oldsz; i != this$static.app.elmList.arrayList.array.length; i++) {
|
|
if (!$allowMove($get_4(this$static.app.elmList, i), mdx, mdy))
|
|
break;
|
|
}
|
|
if (i == this$static.app.elmList.arrayList.array.length) {
|
|
dx = mdx;
|
|
dy = mdy;
|
|
}
|
|
}
|
|
for (i = oldsz; i != this$static.app.elmList.arrayList.array.length; i++) {
|
|
ce = $get_4(this$static.app.elmList, i);
|
|
ce.move(dx, dy);
|
|
}
|
|
}
|
|
$needAnalyze(this$static.app);
|
|
$writeRecoveryToStorage(this$static.app.undoManager);
|
|
}
|
|
|
|
function $doSliders(this$static, ce){
|
|
$clearSelection(this$static.app.mouse);
|
|
$pushUndo(this$static.app.undoManager);
|
|
dialogShowing = new SliderDialog(ce, this$static.app);
|
|
dialogShowing.show();
|
|
}
|
|
|
|
function $enablePaste(this$static){
|
|
(this$static.clipboard_0 == null || this$static.clipboard_0.length == 0) && $readClipboardFromStorage(this$static);
|
|
$setEnabled_1(this$static.app.menus.pasteItem, this$static.clipboard_0 != null && this$static.clipboard_0.length > 0);
|
|
}
|
|
|
|
function $menuPerformed(this$static, menu, item_0){
|
|
var contextPanel, cv, cv0, elm, i, n, newScope, s, sp, dump_0, dump_1, dump_2, clearSel, s_0, d, element;
|
|
contextPanel = this$static.app.ui.contextPanel;
|
|
if ((menu == 'edit' || menu == 'main' || menu == 'scopes') && $isReadOnly(this$static.app.ui)) {
|
|
alert_0(LS('Editing disabled. Re-enable from the Options menu.'));
|
|
return;
|
|
}
|
|
item_0 == 'about' && (aboutBox = new AboutBox);
|
|
if (item_0 == 'importfromlocalfile') {
|
|
$pushUndo(this$static.app.undoManager);
|
|
$wnd.openFile != undefined?electronOpenFile():($doc.getElementById('LoadFileElement').click() , undefined);
|
|
}
|
|
item_0 == 'newwindow' && ($wnd.newWindow() , undefined);
|
|
item_0 == 'save' && electronSave($dumpCircuit(this$static.app));
|
|
item_0 == 'saveas' && electronSaveAs($dumpCircuit(this$static.app));
|
|
item_0 == 'importfromtext' && (dialogShowing = new ImportFromTextDialog(this$static.app));
|
|
item_0 == 'importfromdropbox' && (dialogShowing = new ImportFromDropboxDialog(this$static.app));
|
|
if (item_0 == 'exportasurl') {
|
|
dump_0 = $dumpCircuit(this$static.app);
|
|
dialogShowing = new ExportAsUrlDialog(dump_0);
|
|
dialogShowing.show();
|
|
this$static.app.unsavedChanges = false;
|
|
}
|
|
if (item_0 == 'exportaslocalfile') {
|
|
dump_1 = $dumpCircuit(this$static.app);
|
|
dialogShowing = new ExportAsLocalFileDialog(dump_1);
|
|
dialogShowing.show();
|
|
this$static.app.unsavedChanges = false;
|
|
}
|
|
if (item_0 == 'exportastext') {
|
|
dump_2 = $dumpCircuit(this$static.app);
|
|
dialogShowing = new ExportAsTextDialog(this$static.app, dump_2);
|
|
dialogShowing.show();
|
|
this$static.app.unsavedChanges = false;
|
|
}
|
|
item_0 == 'exportasimage' && $doExportAsImage(this$static.app.imageExporter);
|
|
if (item_0 == 'copypng') {
|
|
cv0 = $getCircuitAsCanvas(this$static.app.imageExporter, 1);
|
|
clipboardWriteImage(($clinit_DOM() , cv0.element));
|
|
!!this$static.app.ui.contextPanel && $hide(this$static.app.ui.contextPanel, false);
|
|
}
|
|
item_0 == 'exportassvg' && $doExportAsSVG(this$static.app.imageExporter);
|
|
item_0 == 'createsubcircuit' && $doCreateSubcircuit();
|
|
item_0 == 'dcanalysis' && (this$static.app.dcAnalysisFlag = true , $resetAction(this$static.app.ui));
|
|
item_0 == 'print' && (cv = $getCircuitAsCanvas(this$static.app.imageExporter, 0) , $printCanvas(($clinit_DOM() , cv.element)));
|
|
item_0 == 'recover' && $doRecover(this$static.app.undoManager);
|
|
(menu == 'elm' || menu == 'scopepop') && !!contextPanel && $hide(contextPanel, false);
|
|
if (menu == 'options' && item_0 == 'shortcuts') {
|
|
dialogShowing = new ShortcutsDialog(this$static.app);
|
|
dialogShowing.show();
|
|
}
|
|
if (item_0 == 'subcircuits') {
|
|
dialogShowing = new SubcircuitDialog;
|
|
dialogShowing.show();
|
|
}
|
|
if (item_0 == 'search') {
|
|
dialogShowing = new SearchDialog(this$static.app);
|
|
dialogShowing.show();
|
|
}
|
|
menu == 'options' && item_0 == 'other' && $doEdit(this$static, new EditOptions(this$static.app, this$static.app.sim));
|
|
item_0 == 'devtools' && ($wnd.toggleDevTools() , undefined);
|
|
item_0 == 'undo' && $doUndo(this$static.app.undoManager);
|
|
item_0 == 'redo' && $doRedo(this$static.app.undoManager);
|
|
item_0 == 'runstop' && $setSimRunning(this$static.app, !this$static.app.ui.app.simRunning);
|
|
if (menu == 'key' && !!this$static.app.mouse.mouseElm) {
|
|
this$static.app.mouse.menuElm = this$static.app.mouse.mouseElm;
|
|
menu = 'elm';
|
|
}
|
|
menu != 'elm' && (this$static.app.mouse.menuElm = null);
|
|
item_0 == 'cut' && ($pushUndo(this$static.app.undoManager) , $setMenuSelection(this$static) , this$static.clipboard_0 = $copyOfSelectedElms(this$static) , $writeClipboardToStorage(this$static) , $doDelete(this$static, true) , (this$static.clipboard_0 == null || this$static.clipboard_0.length == 0) && $readClipboardFromStorage(this$static) , $setEnabled_1(this$static.app.menus.pasteItem, this$static.clipboard_0 != null && this$static.clipboard_0.length > 0) , undefined);
|
|
item_0 == 'copy' && (clearSel = !!this$static.app.mouse.menuElm && !this$static.app.mouse.menuElm.selected_0 , $setMenuSelection(this$static) , this$static.clipboard_0 = $copyOfSelectedElms(this$static) , clearSel && $clearSelection(this$static.app.mouse) , $writeClipboardToStorage(this$static) , (this$static.clipboard_0 == null || this$static.clipboard_0.length == 0) && $readClipboardFromStorage(this$static) , $setEnabled_1(this$static.app.menus.pasteItem, this$static.clipboard_0 != null && this$static.clipboard_0.length > 0) , undefined);
|
|
item_0 == 'paste' && $doPaste(this$static, null);
|
|
item_0 == 'duplicate' && ($setMenuSelection(this$static) , s_0 = $copyOfSelectedElms(this$static) , $doPaste(this$static, s_0) , undefined);
|
|
item_0 == 'flip' && $doFlip(this$static.app.mouse);
|
|
item_0 == 'split' && $doSplit(this$static.app.mouse, this$static.app.mouse.menuElm);
|
|
item_0 == 'selectAll' && $doSelectAll(this$static.app.mouse);
|
|
if (item_0 == 'centercircuit') {
|
|
$pushUndo(this$static.app.undoManager);
|
|
$centerCircuit(this$static.app.ui);
|
|
}
|
|
if (item_0 == 'rotate') {
|
|
$pushUndo(this$static.app.undoManager);
|
|
$rotate(this$static);
|
|
}
|
|
if (item_0 == 'mirror') {
|
|
$pushUndo(this$static.app.undoManager);
|
|
$mirror(this$static);
|
|
}
|
|
if (item_0 == 'convertWires') {
|
|
$pushUndo(this$static.app.undoManager);
|
|
convertWires(this$static.app);
|
|
$needAnalyze(this$static.app);
|
|
}
|
|
item_0 == 'createTest' && $pushUndo(this$static.app.undoManager);
|
|
item_0 == 'stackAll' && $stackAll(this$static.app.scopeManager);
|
|
item_0 == 'unstackAll' && $unstackAll(this$static.app.scopeManager);
|
|
item_0 == 'combineAll' && $combineAll(this$static.app.scopeManager);
|
|
item_0 == 'separateAll' && $separateAll(this$static.app.scopeManager);
|
|
item_0 == 'zoomin' && $zoomCircuit(this$static.app.mouse, 20, true);
|
|
item_0 == 'zoomout' && $zoomCircuit(this$static.app.mouse, -20, true);
|
|
item_0 == 'zoom100' && $setCircuitScale(this$static.app.mouse, 1, true);
|
|
menu == 'elm' && item_0 == 'edit' && $doEdit(this$static, this$static.app.mouse.menuElm);
|
|
if (item_0 == 'delete') {
|
|
menu != 'elm' && (this$static.app.mouse.menuElm = null);
|
|
$pushUndo(this$static.app.undoManager);
|
|
$doDelete(this$static, true);
|
|
}
|
|
item_0 == 'sliders' && $doSliders(this$static, this$static.app.mouse.menuElm);
|
|
if (item_0 == 'viewInScope' && !!this$static.app.mouse.menuElm) {
|
|
for (i = 0; i != this$static.app.scopeManager.scopeCount; i++)
|
|
if (!$getElm_0(this$static.app.scopeManager.scopes[i]))
|
|
break;
|
|
if (i == this$static.app.scopeManager.scopeCount) {
|
|
if (this$static.app.scopeManager.scopeCount == this$static.app.scopeManager.scopes.length)
|
|
return;
|
|
++this$static.app.scopeManager.scopeCount;
|
|
this$static.app.scopeManager.scopes[i] = new Scope(this$static.app, this$static.app.sim);
|
|
this$static.app.scopeManager.scopes[i].position = i;
|
|
}
|
|
$setElm(this$static.app.scopeManager.scopes[i], this$static.app.mouse.menuElm);
|
|
i > 0 && (this$static.app.scopeManager.scopes[i].speed = this$static.app.scopeManager.scopes[i - 1].speed);
|
|
}
|
|
if (item_0 == 'viewInFloatScope' && !!this$static.app.mouse.menuElm) {
|
|
newScope = new ScopeElm($snapGrid_0(this$static.app, this$static.app.mouse.menuElm.x_0 + 50), $snapGrid_0(this$static.app, this$static.app.mouse.menuElm.y_0 + 50));
|
|
$addElement(this$static.app.elmList, newScope);
|
|
$setScopeElm(newScope, this$static.app.mouse.menuElm);
|
|
$needAnalyze(this$static.app);
|
|
}
|
|
if ($equals_1(item_0.substr(0, 10), 'addToScope') && !!this$static.app.mouse.menuElm) {
|
|
n = __parseAndValidateInt(item_0.substr(10), 10);
|
|
n < this$static.app.scopeManager.scopeCount + $countScopeElms(this$static.app.scopeManager) && (n < this$static.app.scopeManager.scopeCount?$addElm(this$static.app.scopeManager.scopes[n], this$static.app.mouse.menuElm):$addElm($getNthScopeElm(this$static.app.scopeManager, n - this$static.app.scopeManager.scopeCount).elmScope, this$static.app.mouse.menuElm));
|
|
this$static.app.scopeManager.scopeMenuSelected = -1;
|
|
}
|
|
if (menu == 'scopepop') {
|
|
$pushUndo(this$static.app.undoManager);
|
|
this$static.app.scopeManager.menuScope != -1?(s = this$static.app.scopeManager.scopes[this$static.app.scopeManager.menuScope]):(s = this$static.app.mouse.mouseElm.elmScope);
|
|
if (item_0 == 'dock') {
|
|
if (this$static.app.scopeManager.scopeCount == this$static.app.scopeManager.scopes.length)
|
|
return;
|
|
this$static.app.scopeManager.scopes[this$static.app.scopeManager.scopeCount] = this$static.app.mouse.mouseElm.elmScope;
|
|
this$static.app.mouse.mouseElm.elmScope = null;
|
|
this$static.app.scopeManager.scopes[this$static.app.scopeManager.scopeCount].position = this$static.app.scopeManager.scopeCount;
|
|
++this$static.app.scopeManager.scopeCount;
|
|
$doDelete(this$static, false);
|
|
}
|
|
if (item_0 == 'undock') {
|
|
elm = $getElm_0(s);
|
|
newScope = new ScopeElm($snapGrid_0(this$static.app, elm.x_0 + 50), $snapGrid_0(this$static.app, elm.y_0 + 50));
|
|
$addElement(this$static.app.elmList, newScope);
|
|
$setElmScope(newScope, this$static.app.scopeManager.scopes[this$static.app.scopeManager.menuScope]);
|
|
for (i = this$static.app.scopeManager.menuScope; i < this$static.app.scopeManager.scopeCount; i++)
|
|
this$static.app.scopeManager.scopes[i] = this$static.app.scopeManager.scopes[i + 1];
|
|
--this$static.app.scopeManager.scopeCount;
|
|
$needAnalyze(this$static.app);
|
|
}
|
|
item_0 == 'remove' && $setElm(s, null);
|
|
item_0 == 'removeplot' && $removePlot(s, this$static.app.scopeManager.menuPlot);
|
|
item_0 == 'speed2' && $speedUp(s);
|
|
item_0 == 'speed1/2' && (s.speed < $intern_24 && (s.speed *= 2) , $resetGraph(s, false));
|
|
item_0 == 'maxscale' && $maxScale(s);
|
|
item_0 == 'stack' && $stackScope(this$static.app.scopeManager, this$static.app.scopeManager.menuScope);
|
|
item_0 == 'unstack' && $unstackScope(this$static.app.scopeManager, this$static.app.scopeManager.menuScope);
|
|
item_0 == 'combine' && $combineScope(this$static.app.scopeManager, this$static.app.scopeManager.menuScope);
|
|
item_0 == 'selecty' && $selectY(s);
|
|
item_0 == 'reset' && $resetGraph(s, true);
|
|
item_0 == 'exportcsv' && $exportCSV(s);
|
|
item_0 == 'properties' && (s.properties = new ScopePropertiesDialog(s.app, s) , dialogShowing = s.properties);
|
|
$deleteUnusedScopeElms(this$static.app.scopeManager);
|
|
}
|
|
if (menu == 'circuits' && item_0.indexOf('setup ') == 0) {
|
|
$pushUndo(this$static.app.undoManager);
|
|
sp = $indexOf_2(item_0, fromCodePoint(32), 6);
|
|
$readSetupFile(this$static.app.menus, item_0.substr(6, sp - 6), item_0.substr(sp + 1));
|
|
}
|
|
if (item_0 == 'newblankcircuit') {
|
|
$pushUndo(this$static.app.undoManager);
|
|
$readSetupFile(this$static.app.menus, 'blank.txt', 'Blank Circuit');
|
|
}
|
|
if (menu == 'main') {
|
|
!!contextPanel && $hide(contextPanel, false);
|
|
$setMouseMode(this$static.app, 0);
|
|
item_0.length > 0 && (this$static.app.ui.mouseModeStr = item_0);
|
|
$compareTo(item_0, 'DragAll') == 0?$setMouseMode(this$static.app, 1):$compareTo(item_0, 'DragRow') == 0?$setMouseMode(this$static.app, 2):$compareTo(item_0, 'DragColumn') == 0?$setMouseMode(this$static.app, 3):$compareTo(item_0, 'DragSelected') == 0?$setMouseMode(this$static.app, 4):$compareTo(item_0, 'DragPost') == 0?$setMouseMode(this$static.app, 5):$compareTo(item_0, 'Select') == 0 && $setMouseMode(this$static.app, 6);
|
|
$updateToolbar(this$static.app.ui);
|
|
this$static.app.mouse.tempMouseMode = this$static.app.mouse.mouseMode;
|
|
}
|
|
if (item_0 == 'fullscreen') {
|
|
isFullScreen?(d = $doc , d.exitFullscreen?d.exitFullscreen():d.mozExitFullScreen?d.mozExitFullScreen():d.webkitExitFullscreen?d.webkitExitFullscreen():d.msExitFullscreen && d.msExitFullscreen() , undefined , isFullScreen = false):(element = $doc.documentElement , element.requestFullscreen?element.requestFullscreen():element.mozRequestFullScreen?element.mozRequestFullScreen():element.webkitRequestFullscreen?element.webkitRequestFullscreen():element.msRequestFullscreen && element.msRequestFullscreen() , undefined , isFullScreen = true);
|
|
$centerCircuit(this$static.app.ui);
|
|
}
|
|
$repaint(this$static.app.ui);
|
|
}
|
|
|
|
function $mirror(this$static){
|
|
var ce, ce$iterator, center2, fi;
|
|
fi = $prepareFlip(this$static);
|
|
center2 = fi.cx * 2;
|
|
for (ce$iterator = new ArrayList$1(this$static.app.elmList.arrayList); ce$iterator.i < ce$iterator.this$01.array.length;) {
|
|
ce = $next_4(ce$iterator);
|
|
(ce.selected_0 || fi.count == 0) && ce.flipX(center2, fi.count);
|
|
}
|
|
$needAnalyze(this$static.app);
|
|
}
|
|
|
|
function $prepareFlip(this$static){
|
|
var ce, ce$iterator, count, fi, maxx, maxy, minx, miny;
|
|
$pushUndo(this$static.app.undoManager);
|
|
$setMenuSelection(this$static);
|
|
minx = 30000;
|
|
maxx = $intern_104;
|
|
miny = 30000;
|
|
maxy = $intern_104;
|
|
count = $countSelected(this$static);
|
|
for (ce$iterator = new ArrayList$1(this$static.app.elmList.arrayList); ce$iterator.i < ce$iterator.this$01.array.length;) {
|
|
ce = $next_4(ce$iterator);
|
|
if (ce.selected_0 || count == 0) {
|
|
minx = $wnd.Math.min(ce.x_0, $wnd.Math.min(ce.x2, minx));
|
|
maxx = $wnd.Math.max(ce.x_0, $wnd.Math.max(ce.x2, maxx));
|
|
miny = $wnd.Math.min(ce.y_0, $wnd.Math.min(ce.y2, miny));
|
|
maxy = $wnd.Math.max(ce.y_0, $wnd.Math.max(ce.y2, maxy));
|
|
}
|
|
}
|
|
fi = new CommandManager$FlipInfo;
|
|
fi.cx = (minx + maxx) / 2 | 0;
|
|
fi.cy = (miny + maxy) / 2 | 0;
|
|
fi.count = count;
|
|
return fi;
|
|
}
|
|
|
|
function $readClipboardFromStorage(this$static){
|
|
var stor;
|
|
stor = (!localStorage_0 && ($clinit_Storage$StorageSupportDetector() , localStorageSupported) && (localStorage_0 = new Storage_0('localStorage')) , localStorage_0);
|
|
if (!stor)
|
|
return;
|
|
this$static.clipboard_0 = $getItem_0(stor.storage, 'circuitClipboard');
|
|
}
|
|
|
|
function $rotate(this$static){
|
|
var ce, ce$iterator, center2, fi, xmy;
|
|
fi = $prepareFlip(this$static);
|
|
center2 = fi.cy * 2;
|
|
xmy = $snapGrid_0(this$static.app, fi.cx - fi.cy);
|
|
for (ce$iterator = new ArrayList$1(this$static.app.elmList.arrayList); ce$iterator.i < ce$iterator.this$01.array.length;) {
|
|
ce = $next_4(ce$iterator);
|
|
if (ce.selected_0 || fi.count == 0) {
|
|
ce.flipXY(xmy, fi.count);
|
|
ce.flipY(center2, fi.count);
|
|
}
|
|
}
|
|
$needAnalyze(this$static.app);
|
|
}
|
|
|
|
function $setMenuSelection(this$static){
|
|
if (this$static.app.mouse.menuElm) {
|
|
if (this$static.app.mouse.menuElm.selected_0)
|
|
return;
|
|
$clearSelection(this$static.app.mouse);
|
|
this$static.app.mouse.menuElm.selected_0 = true;
|
|
}
|
|
}
|
|
|
|
function $writeClipboardToStorage(this$static){
|
|
var stor;
|
|
stor = (!localStorage_0 && ($clinit_Storage$StorageSupportDetector() , localStorageSupported) && (localStorage_0 = new Storage_0('localStorage')) , localStorage_0);
|
|
if (!stor)
|
|
return;
|
|
$setItem(stor, 'circuitClipboard', this$static.clipboard_0);
|
|
}
|
|
|
|
function CommandManager(app){
|
|
this.app = app;
|
|
}
|
|
|
|
function electronOpenFile(){
|
|
$wnd.openFile(function(text_0, name_0){
|
|
var app;
|
|
app = theApp;
|
|
doLoadCallback_0(text_0, name_0);
|
|
$allowSave(app.ui, true);
|
|
}
|
|
);
|
|
}
|
|
|
|
function electronSave(dump_0){
|
|
var app;
|
|
$wnd.saveFile(null, dump_0);
|
|
app = theApp;
|
|
app.savedFlag = true;
|
|
$repaint(app.ui);
|
|
}
|
|
|
|
function electronSaveAs(dump_0){
|
|
$wnd.showSaveDialog().then(function(file){
|
|
if (file.canceled)
|
|
return;
|
|
$wnd.saveFile(file, dump_0);
|
|
electronSaveAsCallback(file.filePath.toString());
|
|
}
|
|
);
|
|
}
|
|
|
|
function electronSaveAsCallback(s){
|
|
var app;
|
|
s = $substring(s, $lastIndexOf(s, fromCodePoint(47)) + 1);
|
|
s = $substring(s, $lastIndexOf(s, fromCodePoint(92)) + 1);
|
|
app = theApp;
|
|
$setCircuitTitle_0(app.ui, s);
|
|
$allowSave(app.ui, true);
|
|
app.savedFlag = true;
|
|
$repaint(app.ui);
|
|
}
|
|
|
|
defineClass(540, 1, {}, CommandManager);
|
|
var Lcom_lushprojects_circuitjs1_client_CommandManager_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'CommandManager', 540);
|
|
function CommandManager$FlipInfo(){
|
|
}
|
|
|
|
defineClass(541, 1, {}, CommandManager$FlipInfo);
|
|
_.count = 0;
|
|
_.cx = 0;
|
|
_.cy = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_CommandManager$FlipInfo_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'CommandManager/FlipInfo', 541);
|
|
function $$init_4(this$static){
|
|
this$static.numPosts = 0;
|
|
this$static.numNodes = 0;
|
|
}
|
|
|
|
function $buildCompNodeList(this$static){
|
|
var ce, cn, cnLink, compNodeHash, entry, entry$iterator, i, i0, i1, inodes, j, nodeOfThisPost, stNodes, thisPost;
|
|
compNodeHash = new HashMap;
|
|
this$static.compNodeList = new Vector;
|
|
for (i0 = 0; i0 != this$static.compElmList.arrayList.array.length; i0++) {
|
|
ce = $get_4(this$static.compElmList, i0);
|
|
stNodes = new StringTokenizer_0(this$static.compNodeInfo[i0], ' +\t');
|
|
thisPost = 0;
|
|
while ($hasMoreTokens(stNodes)) {
|
|
nodeOfThisPost = __parseAndValidateInt($nextToken(stNodes), 10);
|
|
if (nodeOfThisPost == 0) {
|
|
ce.setNode(thisPost, ground);
|
|
ce.setNodeVoltage(thisPost, 0);
|
|
++thisPost;
|
|
continue;
|
|
}
|
|
cnLink = new CircuitNodeLink;
|
|
cnLink.num = thisPost;
|
|
cnLink.elm = ce;
|
|
if ($containsKey(compNodeHash, valueOf_0(nodeOfThisPost))) {
|
|
cn = $get_1(compNodeHash, valueOf_0(nodeOfThisPost));
|
|
$add_11(cn.links_0, cnLink);
|
|
}
|
|
else {
|
|
cn = new CircuitNode;
|
|
$add_11(cn.links_0, cnLink);
|
|
$put_0(compNodeHash, valueOf_0(nodeOfThisPost), cn);
|
|
}
|
|
++thisPost;
|
|
}
|
|
}
|
|
try {
|
|
for (i1 = 0; i1 < this$static.extNodeIds.length; i1++) {
|
|
if ($containsKey(compNodeHash, valueOf_0(this$static.extNodeIds[i1]))) {
|
|
$add_11(this$static.compNodeList, $get_1(compNodeHash, valueOf_0(this$static.extNodeIds[i1])));
|
|
$remove_7(compNodeHash, valueOf_0(this$static.extNodeIds[i1]));
|
|
}
|
|
else
|
|
throw toJs(new IllegalArgumentException);
|
|
}
|
|
}
|
|
catch ($e0) {
|
|
$e0 = toJava($e0);
|
|
if (instanceOf($e0, 53)) {
|
|
this$static.compNodeList = null;
|
|
return;
|
|
}
|
|
else
|
|
throw toJs($e0);
|
|
}
|
|
for (entry$iterator = new AbstractHashMap$EntrySetIterator((new AbstractHashMap$EntrySet(compNodeHash)).this$01); entry$iterator.hasNext;) {
|
|
entry = $next_2(entry$iterator);
|
|
$add_11(this$static.compNodeList, entry.getValue());
|
|
}
|
|
for (i = 0; i != this$static.compElmList.arrayList.array.length; i++) {
|
|
ce = $get_4(this$static.compElmList, i);
|
|
inodes = ce.getInternalNodeCount();
|
|
for (j = 0; j != inodes; j++) {
|
|
cnLink = new CircuitNodeLink;
|
|
cnLink.num = j + ce.getPostCount_0();
|
|
cnLink.elm = ce;
|
|
cn = new CircuitNode;
|
|
$add_11(cn.links_0, cnLink);
|
|
$add_11(this$static.compNodeList, cn);
|
|
}
|
|
}
|
|
this$static.numNodes = this$static.compNodeList.arrayList.array.length;
|
|
}
|
|
|
|
function $getCurrentIntoNode(this$static, n){
|
|
var c, cnLinks, i;
|
|
c = 0;
|
|
if (!this$static.compNodeList)
|
|
return 0;
|
|
cnLinks = $get_4(this$static.compNodeList, n).links_0;
|
|
for (i = 0; i < cnLinks.arrayList.array.length; i++) {
|
|
c += (checkArrayElementIndex(i, cnLinks.arrayList.array.length) , $get_2(cnLinks.arrayList, i)).elm.getCurrentIntoNode((checkArrayElementIndex(i, cnLinks.arrayList.array.length) , $get_2(cnLinks.arrayList, i)).num);
|
|
}
|
|
return c;
|
|
}
|
|
|
|
function $getPower(this$static){
|
|
var i, power;
|
|
power = 0;
|
|
for (i = 0; i < this$static.compElmList.arrayList.array.length; i++)
|
|
power += $get_4(this$static.compElmList, i).getPower();
|
|
return power;
|
|
}
|
|
|
|
function $loadComposite(this$static, stIn, model, externalNodes){
|
|
var ceType, dumpedCe, flags, line, modelLinet, newce, nodeInfoList, nodeStr, sp, stCe, tint;
|
|
modelLinet = new StringTokenizer_0(model, '\r');
|
|
this$static.compElmList = new Vector;
|
|
nodeInfoList = new Vector;
|
|
while ($hasMoreTokens(modelLinet)) {
|
|
line = $nextToken(modelLinet);
|
|
sp = $indexOf_1(line, fromCodePoint(32));
|
|
ceType = line.substr(0, sp);
|
|
nodeStr = line.substr(sp + 1);
|
|
newce = constructElement(ceType, 0, 0);
|
|
if (stIn) {
|
|
tint = newce.getDumpType();
|
|
dumpedCe = $nextToken(stIn);
|
|
(this$static.flags & 1) != 0 && (dumpedCe = unescape_0(dumpedCe));
|
|
stCe = new StringTokenizer_0(dumpedCe, (this$static.flags & 1) != 0?' ':'_');
|
|
flags = (new Integer_0($nextToken(stCe))).value_0;
|
|
newce = createCe(tint, 0, 0, 0, 0, flags, stCe);
|
|
}
|
|
if (!newce) {
|
|
console.log('failed to create ' + ceType + ' in CompositeElm');
|
|
continue;
|
|
}
|
|
instanceOf(newce, 160) && (newce.flags |= 1);
|
|
newce.inComposite = true;
|
|
$add_11(this$static.compElmList, newce);
|
|
$add_8(nodeInfoList.arrayList, nodeStr);
|
|
}
|
|
this$static.compNodeInfo = $toArray_1(nodeInfoList, initUnidimensionalArray(Ljava_lang_String_2_classLit, $intern_23, 2, 0, 6, 1));
|
|
this$static.extNodeIds = externalNodes;
|
|
this$static.numPosts = this$static.numNodes = externalNodes.length;
|
|
this$static.posts = initUnidimensionalArray(Lcom_lushprojects_circuitjs1_client_Point_2_classLit, $intern_78, 14, this$static.numPosts, 0, 1);
|
|
this$static.flags |= 1;
|
|
}
|
|
|
|
function $loadCompositeXml(this$static, elmEntries, externalNodes){
|
|
var childElem, childElem$iterator, className, newce, nn, nodeInfoList, tagName, xml;
|
|
xml = new XMLDeserializer(theApp);
|
|
this$static.compElmList = new Vector;
|
|
nodeInfoList = new Vector;
|
|
for (childElem$iterator = new ArrayList$1(elmEntries.arrayList); childElem$iterator.i < childElem$iterator.this$01.array.length;) {
|
|
childElem = $next_4(childElem$iterator);
|
|
tagName = getTagName(childElem.jsObject);
|
|
className = $getStringValue(xmlDumpTypeMap, tagName);
|
|
if (className == null)
|
|
continue;
|
|
if ($equals_1(className, 'WireElm') || $equals_1(className, 'RoutedWireElm') || $equals_1(className, 'LabeledNodeElm') || $equals_1(className, 'ScopeElm') || $equals_1(className, 'GraphicElm') || $equals_1(className, 'GroundElm') && getAttribute(childElem.jsObject, 'x') != null) {
|
|
continue;
|
|
}
|
|
newce = constructElement(className, 0, 0);
|
|
instanceOf(newce, 160) && (newce.flags |= 1);
|
|
xml.currentXmlElement = childElem;
|
|
newce.undumpXml(xml);
|
|
newce.inComposite = true;
|
|
$add_11(this$static.compElmList, newce);
|
|
nn = getAttribute(childElem.jsObject, 'nn');
|
|
$add_8(nodeInfoList.arrayList, nn != null?nn:'');
|
|
}
|
|
this$static.compNodeInfo = $toArray_1(nodeInfoList, initUnidimensionalArray(Ljava_lang_String_2_classLit, $intern_23, 2, 0, 6, 1));
|
|
this$static.extNodeIds = externalNodes;
|
|
this$static.numPosts = this$static.numNodes = externalNodes.length;
|
|
this$static.posts = initUnidimensionalArray(Lcom_lushprojects_circuitjs1_client_Point_2_classLit, $intern_78, 14, this$static.numPosts, 0, 1);
|
|
this$static.flags |= 1;
|
|
}
|
|
|
|
function $reset_2(this$static){
|
|
var i;
|
|
for (i = 0; i < this$static.compElmList.arrayList.array.length; i++)
|
|
$get_4(this$static.compElmList, i).reset_0();
|
|
}
|
|
|
|
function $setPost(this$static, n, p){
|
|
this$static.posts[n] = p;
|
|
}
|
|
|
|
function $undumpXml_3(this$static, xml){
|
|
var ce, ce$iterator, ce0, elem, elem$iterator, ix, state;
|
|
this$static.flags = $parseIntAttr(xml, 'f', this$static.flags);
|
|
state = xml.currentXmlElement;
|
|
for (elem$iterator = new ArrayList$1($getChildElements(xml)); elem$iterator.i < elem$iterator.this$01.array.length;) {
|
|
elem = $next_4(elem$iterator);
|
|
xml.currentXmlElement = elem;
|
|
ix = $parseIntAttr(xml, 'ix', -1);
|
|
if (ix >= this$static.compElmList.arrayList.array.length) {
|
|
console.log('ix ' + ix);
|
|
for (ce$iterator = new ArrayList$1(this$static.compElmList.arrayList); ce$iterator.i < ce$iterator.this$01.array.length;) {
|
|
ce0 = $next_4(ce$iterator);
|
|
console.log('cel ' + ce0);
|
|
}
|
|
}
|
|
ce = $get_4(this$static.compElmList, ix);
|
|
if (!$equals_1(getTagName(elem.jsObject), ce.getXmlDumpType()))
|
|
throw toJs(new RuntimeException_0('dump type mismatch for composite child: ' + ix));
|
|
ce.undumpXml(xml);
|
|
}
|
|
xml.currentXmlElement = state;
|
|
}
|
|
|
|
function CompositeElm(xx, yy){
|
|
CircuitElm.call(this, xx, yy);
|
|
$$init_4(this);
|
|
}
|
|
|
|
function CompositeElm_0(xa, ya, xb, yb, f){
|
|
CircuitElm_0.call(this, xa, ya, xb, yb, f);
|
|
$$init_4(this);
|
|
}
|
|
|
|
function CompositeElm_1(xa, ya, xb, yb, f, st, s, externalNodes){
|
|
CircuitElm_0.call(this, xa, ya, xb, yb, f);
|
|
$$init_4(this);
|
|
$loadComposite(this, st, s, externalNodes);
|
|
$buildCompNodeList(this);
|
|
$allocNodes(this);
|
|
}
|
|
|
|
function CompositeElm_2(xx, yy, s, externalNodes){
|
|
CircuitElm.call(this, xx, yy);
|
|
$$init_4(this);
|
|
$loadComposite(this, null, s, externalNodes);
|
|
$buildCompNodeList(this);
|
|
$allocNodes(this);
|
|
}
|
|
|
|
defineClass(110, 8, $intern_85);
|
|
_.canViewInScope_0 = function canViewInScope_0(){
|
|
return false;
|
|
}
|
|
;
|
|
_.canViewInScope = function(){
|
|
return this.canViewInScope_0();
|
|
}
|
|
;
|
|
_.delete_1 = function delete_2(){
|
|
var i;
|
|
if (this.compElmList)
|
|
for (i = 0; i < this.compElmList.arrayList.array.length; i++)
|
|
$get_4(this.compElmList, i).delete_0();
|
|
mouseElmRef == this && (mouseElmRef = null);
|
|
$deleteSliders(app_0, this);
|
|
}
|
|
;
|
|
_.delete_0 = function(){
|
|
this.delete_1();
|
|
}
|
|
;
|
|
_.dumpXmlState = function dumpXmlState_4(doc, elem){
|
|
var attrs, ce, child, i;
|
|
for (i = 0; i != this.compElmList.arrayList.array.length; i++) {
|
|
ce = $get_4(this.compElmList, i);
|
|
child = $createElement(doc, ce.getXmlDumpType());
|
|
ce.dumpXmlState(doc, child);
|
|
attrs = new NamedNodeMapImpl(getAttributes(child.jsObject));
|
|
if (getLength_1(attrs.jsObject) == 0 && !hasChildNodes(child.jsObject))
|
|
continue;
|
|
checkAttr(child, 'ix');
|
|
$setAttribute_0(child, 'ix', '' + i);
|
|
$appendChild_0(elem, child);
|
|
}
|
|
}
|
|
;
|
|
_.getChildElmList = function getChildElmList_0(){
|
|
return this.compElmList;
|
|
}
|
|
;
|
|
_.getConnection_0 = function getConnection_10(n1, n2){
|
|
return false;
|
|
}
|
|
;
|
|
_.getConnection = function(n1, n2){
|
|
return this.getConnection_0(n1, n2);
|
|
}
|
|
;
|
|
_.getCurrentIntoNode = function getCurrentIntoNode_6(n){
|
|
return $getCurrentIntoNode(this, n);
|
|
}
|
|
;
|
|
_.getInternalNodeCount = function getInternalNodeCount_4(){
|
|
return this.numNodes - this.numPosts;
|
|
}
|
|
;
|
|
_.getPost = function getPost_5(n){
|
|
return this.posts[n];
|
|
}
|
|
;
|
|
_.getPostCount_0 = function getPostCount_16(){
|
|
return this.numPosts;
|
|
}
|
|
;
|
|
_.getPower_0 = function getPower_4(){
|
|
return $getPower(this);
|
|
}
|
|
;
|
|
_.getPower = function(){
|
|
return this.getPower_0();
|
|
}
|
|
;
|
|
_.hasGroundConnection_0 = function hasGroundConnection_9(n1){
|
|
return false;
|
|
}
|
|
;
|
|
_.hasGroundConnection = function(n1){
|
|
return this.hasGroundConnection_0(n1);
|
|
}
|
|
;
|
|
_.preStamp = function preStamp_0(){
|
|
var ce, ce$iterator;
|
|
for (ce$iterator = new ArrayList$1(this.compElmList.arrayList); ce$iterator.i < ce$iterator.this$01.array.length;) {
|
|
ce = $next_4(ce$iterator);
|
|
ce.preStamp();
|
|
}
|
|
$buildCompNodeList(this);
|
|
$allocNodes(this);
|
|
}
|
|
;
|
|
_.reset_1 = function reset_9(){
|
|
$reset_2(this);
|
|
}
|
|
;
|
|
_.reset_0 = function(){
|
|
this.reset_1();
|
|
}
|
|
;
|
|
_.setNode_0 = function setNode_0(p, n){
|
|
var cnLinks, i;
|
|
this.nodes[p] = n;
|
|
if (!this.compNodeList)
|
|
return;
|
|
cnLinks = $get_4(this.compNodeList, p).links_0;
|
|
for (i = 0; i < cnLinks.arrayList.array.length; i++) {
|
|
(checkArrayElementIndex(i, cnLinks.arrayList.array.length) , $get_2(cnLinks.arrayList, i)).elm.setNode((checkArrayElementIndex(i, cnLinks.arrayList.array.length) , $get_2(cnLinks.arrayList, i)).num, n);
|
|
}
|
|
}
|
|
;
|
|
_.setNode = function(p, n){
|
|
this.setNode_0(p, n);
|
|
}
|
|
;
|
|
_.stamp_0 = function stamp_18(){
|
|
var ce, i;
|
|
for (i = 0; i < this.compElmList.arrayList.array.length; i++) {
|
|
ce = $get_4(this.compElmList, i);
|
|
ce.setParentList(this.compElmList);
|
|
}
|
|
}
|
|
;
|
|
_.stamp = function(){
|
|
this.stamp_0();
|
|
}
|
|
;
|
|
_.undumpXml = function undumpXml_17(xml){
|
|
$undumpXml_3(this, xml);
|
|
}
|
|
;
|
|
_.numNodes = 0;
|
|
_.numPosts = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_CompositeElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'CompositeElm', 110);
|
|
function $clinit_ComparatorElm(){
|
|
$clinit_ComparatorElm = emptyMethod;
|
|
modelExternalNodes = stampJavaTypeInfo(getClassLiteralForArray(I_classLit, 1), $intern_25, 7, 15, [2, 1, 4]);
|
|
}
|
|
|
|
function $setSize_2(this$static, s){
|
|
this$static.opsize = s;
|
|
this$static.opheight = 8 * s;
|
|
this$static.opwidth = 13 * s;
|
|
this$static.flags = this$static.flags & -3 | (s == 1?2:0);
|
|
}
|
|
|
|
function ComparatorElm(xx, yy){
|
|
$clinit_ComparatorElm();
|
|
CompositeElm_2.call(this, xx, yy, modelString, modelExternalNodes);
|
|
this.noDiagonal = true;
|
|
$setSize_2(this, app_0.menus.smallGridCheckItem.on?1:2);
|
|
}
|
|
|
|
function ComparatorElm_0(xa, ya, xb, yb, f, st){
|
|
$clinit_ComparatorElm();
|
|
CompositeElm_1.call(this, xa, ya, xb, yb, f, st, modelString, modelExternalNodes);
|
|
this.noDiagonal = true;
|
|
$setSize_2(this, (f & 2) != 0?1:2);
|
|
}
|
|
|
|
defineClass(422, 110, $intern_85, ComparatorElm, ComparatorElm_0);
|
|
_.draw = function draw_16(g){
|
|
$setBbox_0(this, this.point1, this.point2, this.opheight * 2);
|
|
$setVoltageColor(this, g, this.volts[0]);
|
|
drawThickLine_0(g, this.in1p[0], this.in1p[1], 3);
|
|
$setVoltageColor(this, g, this.volts[1]);
|
|
drawThickLine_0(g, this.in2p[0], this.in2p[1], 3);
|
|
$setColor_0(g, mouseElmRef == this || this.selected_0 || $containsKey(app_0.mouse.scopePlotRoles, this) || instanceOf(mouseElmRef, 21) && $getElm_0(mouseElmRef.elmScope) == this || $isOnHighlightedNet(this)?selectColor_0:lightGrayColor);
|
|
$setPowerColor_0(this, g);
|
|
drawThickPolygon(g, this.triangle);
|
|
$setFont_0(g, this.plusFont);
|
|
$drawCenteredText(this, g, '-', this.textp[0].x_0, this.textp[0].y_0 - 2, true);
|
|
$drawCenteredText(this, g, '+', this.textp[1].x_0, this.textp[1].y_0, true);
|
|
$drawCenteredText(this, g, '\u2265?', this.textp[2].x_0, this.textp[2].y_0, true);
|
|
$setVoltageColor(this, g, this.volts[2]);
|
|
drawThickLine_0(g, this.lead2, this.point2, 3);
|
|
this.curcount_0 = $updateDotCount(-$getCurrentIntoNode(this, 2), this.curcount_0);
|
|
$drawDots(g, this.point2, this.lead2, this.curcount_0);
|
|
$drawPosts(this, g);
|
|
}
|
|
;
|
|
_.flipX = function flipX_3(c2, count){
|
|
this.dx == 0 && (this.flags ^= 4);
|
|
$flipX(this, c2);
|
|
}
|
|
;
|
|
_.flipXY = function flipXY_2(xmy, count){
|
|
this.flags ^= 4;
|
|
$flipXY(this, xmy);
|
|
}
|
|
;
|
|
_.flipY = function flipY_3(c2, count){
|
|
this.dy == 0 && (this.flags ^= 4);
|
|
$flipY(this, c2);
|
|
}
|
|
;
|
|
_.getConnection_0 = function getConnection_11(n1, n2){
|
|
return false;
|
|
}
|
|
;
|
|
_.getDumpType_0 = function getDumpType_21(){
|
|
return 401;
|
|
}
|
|
;
|
|
_.getDumpType = function(){
|
|
return this.getDumpType_0();
|
|
}
|
|
;
|
|
_.getInfo_0 = function getInfo_21(arr){
|
|
arr[0] = 'Comparator';
|
|
arr[1] = 'V+ = ' + getUnitText(this.volts[1], 'V', false);
|
|
arr[2] = 'V- = ' + getUnitText(this.volts[0], 'V', false);
|
|
}
|
|
;
|
|
_.setPoints = function setPoints_14(){
|
|
var hs, sgn, tris, ww;
|
|
$setPoints(this);
|
|
this.dn > 150 && app_0.mouse.dragElm == this && $setSize_2(this, 2);
|
|
ww = this.opwidth;
|
|
ww > this.dn / 2 && (ww = round_int(this.dn / 2));
|
|
$calcLeads(this, ww * 2);
|
|
hs = this.opheight * this.dsign;
|
|
this.in1p = $newPointArray(2);
|
|
this.in2p = $newPointArray(2);
|
|
this.textp = $newPointArray(3);
|
|
sgn = (this.flags & 4) != 0?-1:1;
|
|
$interpPoint2(this.point1, this.point2, this.in1p[0], this.in2p[0], 0, hs * sgn);
|
|
$interpPoint2(this.lead1, this.lead2, this.in1p[1], this.in2p[1], 0, hs * sgn);
|
|
$interpPoint2(this.lead1, this.lead2, this.textp[0], this.textp[1], 0.2, hs * sgn);
|
|
$interpPoint_2(this.lead1, this.lead2, this.textp[2], 0.5, 0);
|
|
tris = $newPointArray(2);
|
|
$interpPoint2(this.lead1, this.lead2, tris[0], tris[1], 0, hs * 2);
|
|
this.triangle = $createPolygon(tris[0], tris[1], this.lead2);
|
|
this.plusFont = new Font('SansSerif', 0, this.opsize == 2?14:10);
|
|
$setPost(this, 0, this.in1p[0]);
|
|
$setPost(this, 1, this.in2p[0]);
|
|
$setPost(this, 2, this.point2);
|
|
}
|
|
;
|
|
_.opheight = 0;
|
|
_.opsize = 0;
|
|
_.opwidth = 0;
|
|
var modelExternalNodes, modelString = 'OpAmpElm 1 2 3\rAnalogSwitchElm 4 5 3\rGroundElm 5';
|
|
var Lcom_lushprojects_circuitjs1_client_ComparatorElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ComparatorElm', 422);
|
|
function $setupPins_5(this$static){
|
|
var bitsY, p;
|
|
this$static.sizeX = 2;
|
|
bitsY = this$static.bitOrder == 2?1:this$static.bits;
|
|
this$static.sizeY = bitsY + 3;
|
|
this$static.pins = initUnidimensionalArray(Lcom_lushprojects_circuitjs1_client_ChipElm$Pin_2_classLit, $intern_3, 9, this$static.bits * 2 + 6, 0, 1);
|
|
$makeBitPins(this$static, this$static.bits, 1, 3, 0, 'Q', true, true, true);
|
|
$makeBitPins(this$static, this$static.bits, 1, 2, this$static.bits, 'I', false, false, true);
|
|
p = this$static.bits * 2;
|
|
this$static.clk = p;
|
|
this$static.clr = p + 1;
|
|
this$static.enp = p + 2;
|
|
this$static.rco = p + 3;
|
|
this$static.load = p + 4;
|
|
this$static.ent = p + 5;
|
|
this$static.pins[this$static.clk] = new ChipElm$Pin(this$static, 0, 2, '');
|
|
this$static.pins[this$static.clk].clock = true;
|
|
this$static.pins[this$static.clr] = new ChipElm$Pin(this$static, bitsY + 1, 2, 'CLR');
|
|
this$static.pins[this$static.clr].bubble = true;
|
|
this$static.pins[this$static.enp] = new ChipElm$Pin(this$static, bitsY + 2, 2, 'EnP');
|
|
this$static.pins[this$static.rco] = new ChipElm$Pin(this$static, 0, 3, 'RCO');
|
|
this$static.pins[this$static.rco].output = true;
|
|
this$static.pins[this$static.load] = new ChipElm$Pin(this$static, bitsY + 1, 3, 'LOAD');
|
|
this$static.pins[this$static.load].bubble = true;
|
|
this$static.pins[this$static.ent] = new ChipElm$Pin(this$static, bitsY + 2, 3, 'EnT');
|
|
}
|
|
|
|
function Counter2Elm(xx, yy){
|
|
$clinit_ChipElm();
|
|
ChipElm.call(this, xx, yy);
|
|
}
|
|
|
|
function Counter2Elm_0(xa, ya, xb, yb, f, st){
|
|
$clinit_ChipElm();
|
|
ChipElm_0.call(this, xa, ya, xb, yb, f, st);
|
|
try {
|
|
this.modulus = __parseAndValidateInt($nextToken(st), 10);
|
|
}
|
|
catch ($e0) {
|
|
$e0 = toJava($e0);
|
|
if (!instanceOf($e0, 13))
|
|
throw toJs($e0);
|
|
}
|
|
}
|
|
|
|
defineClass(442, 32, $intern_85, Counter2Elm, Counter2Elm_0);
|
|
_.allowBus = function allowBus_2(){
|
|
return true;
|
|
}
|
|
;
|
|
_.dumpXml = function dumpXml_16(doc, elem){
|
|
$dumpXml_0(this, elem);
|
|
dumpAttr_0(elem, 'mo', this.modulus);
|
|
}
|
|
;
|
|
_.execute_3 = function execute_18(){
|
|
var i, lastBit, realmod, value_0;
|
|
if (this.pins[this.clk].value_0 && !this.lastClock) {
|
|
if (this.pins[this.enp].value_0 && this.pins[this.ent].value_0) {
|
|
value_0 = 0;
|
|
lastBit = this.bits - 1;
|
|
for (i = 0; i != this.bits; i++)
|
|
this.pins[lastBit - i].value_0 && (value_0 |= 1 << i);
|
|
++value_0;
|
|
realmod = this.modulus == 0?1 << this.bits:this.modulus;
|
|
value_0 %= realmod;
|
|
for (i = 0; i != this.bits; i++) {
|
|
this.pins[lastBit - i].output || (console.log('pin ' + (lastBit - i) + ' is not an output!') , undefined);
|
|
this.pins[lastBit - i].value_0 = (value_0 & 1 << i) != 0;
|
|
}
|
|
this.carry = value_0 == realmod - 1;
|
|
}
|
|
if (!this.pins[this.load].value_0) {
|
|
for (i = 0; i != this.bits; i++)
|
|
$writeOutput(this, i, this.pins[i + this.bits].value_0);
|
|
value_0 = 0;
|
|
lastBit = this.bits - 1;
|
|
for (i = 0; i != this.bits; i++)
|
|
this.pins[lastBit - i].value_0 && (value_0 |= 1 << i);
|
|
realmod = this.modulus == 0?1 << this.bits:this.modulus;
|
|
this.carry = value_0 == realmod - 1;
|
|
}
|
|
}
|
|
if (!this.pins[this.clr].value_0) {
|
|
for (i = 0; i != this.bits; i++) {
|
|
this.pins[i].output || (console.log('pin ' + i + ' is not an output!') , undefined);
|
|
this.pins[i].value_0 = false;
|
|
}
|
|
this.carry = false;
|
|
}
|
|
this.lastClock = this.pins[this.clk].value_0;
|
|
$writeOutput(this, this.rco, this.carry && this.pins[this.ent].value_0);
|
|
}
|
|
;
|
|
_.getChipEditInfo = function getChipEditInfo_5(n){
|
|
if (n == 0)
|
|
return $setDimensionless(new EditInfo_0('# of Bits', this.bits, 1, 1));
|
|
if (n == 1)
|
|
return $setDimensionless(new EditInfo_0('Modulus', this.modulus, 1, 1));
|
|
return null;
|
|
}
|
|
;
|
|
_.getChipName = function getChipName_8(){
|
|
if (this.modulus == 0)
|
|
return 'Counter';
|
|
return LS('Counter') + ('' + LS(' (mod ')) + this.modulus + ')';
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_22(){
|
|
return 421;
|
|
}
|
|
;
|
|
_.getPostCount_0 = function getPostCount_17(){
|
|
return this.bits * 2 + 6;
|
|
}
|
|
;
|
|
_.getVoltageSourceCount = function getVoltageSourceCount_14(){
|
|
return this.bits + 1;
|
|
}
|
|
;
|
|
_.getXmlDumpType = function getXmlDumpType_7(){
|
|
return 'ctr2';
|
|
}
|
|
;
|
|
_.needsBits = function needsBits_2(){
|
|
return true;
|
|
}
|
|
;
|
|
_.setChipEditValue = function setChipEditValue_6(n, ei){
|
|
if (n == 0) {
|
|
if (ei.value_0 >= 2) {
|
|
this.bits = round_int(ei.value_0);
|
|
$setupPins_5(this);
|
|
$setPoints_0(this);
|
|
$allocNodes(this);
|
|
}
|
|
else
|
|
ei.error = 'must be >= 2';
|
|
}
|
|
n == 1 && (this.modulus = round_int(ei.value_0));
|
|
}
|
|
;
|
|
_.setupPins = function setupPins_7(){
|
|
$setupPins_5(this);
|
|
}
|
|
;
|
|
_.undumpXml = function undumpXml_18(xml){
|
|
$undumpXml_0(this, xml);
|
|
this.modulus = $parseIntAttr(xml, 'mo', this.modulus);
|
|
this.pins[this.clr].value_0 = true;
|
|
this.volts[this.clr] = this.highVoltage;
|
|
}
|
|
;
|
|
_.carry = false;
|
|
_.clk = 0;
|
|
_.clr = 0;
|
|
_.enp = 0;
|
|
_.ent = 0;
|
|
_.load = 0;
|
|
_.modulus = 0;
|
|
_.rco = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_Counter2Elm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'Counter2Elm', 442);
|
|
function $setupPins_6(this$static){
|
|
this$static.sizeX = 2;
|
|
this$static.sizeY = this$static.bitOrder == 2?3:this$static.bits;
|
|
this$static.pins = initUnidimensionalArray(Lcom_lushprojects_circuitjs1_client_ChipElm$Pin_2_classLit, $intern_3, 9, (this$static.flags & 4) != 0?this$static.bits + 3:this$static.bits + 2, 0, 1);
|
|
this$static.pins[0] = new ChipElm$Pin(this$static, 0, 2, '');
|
|
this$static.pins[0].clock = true;
|
|
this$static.pins[0].bubble = (this$static.flags & 8) != 0;
|
|
this$static.pins[1] = new ChipElm$Pin(this$static, this$static.sizeY - 1, 2, 'R');
|
|
this$static.pins[1].bubble = this$static.invertreset;
|
|
$makeBitPins(this$static, this$static.bits, 0, 3, 2, 'Q', true, true, true);
|
|
(this$static.flags & 4) != 0 && (this$static.pins[this$static.bits + 2] = new ChipElm$Pin(this$static, this$static.sizeY - 2, 2, 'U/D'));
|
|
$allocNodes(this$static);
|
|
}
|
|
|
|
function CounterElm(xx, yy){
|
|
$clinit_ChipElm();
|
|
ChipElm.call(this, xx, yy);
|
|
}
|
|
|
|
function CounterElm_0(xa, ya, xb, yb, f, st){
|
|
$clinit_ChipElm();
|
|
ChipElm_0.call(this, xa, ya, xb, yb, f, st);
|
|
this.invertreset = true;
|
|
try {
|
|
this.invertreset = ($clinit_Boolean() , $equalsIgnoreCase('true', $nextToken(st)));
|
|
this.modulus = __parseAndValidateInt($nextToken(st), 10);
|
|
}
|
|
catch ($e0) {
|
|
$e0 = toJava($e0);
|
|
if (!instanceOf($e0, 13))
|
|
throw toJs($e0);
|
|
}
|
|
this.pins[1].bubble = this.invertreset;
|
|
}
|
|
|
|
defineClass(412, 32, $intern_85, CounterElm, CounterElm_0);
|
|
_.allowBus = function allowBus_3(){
|
|
return true;
|
|
}
|
|
;
|
|
_.dumpXml = function dumpXml_17(doc, elem){
|
|
$dumpXml_0(this, elem);
|
|
dumpAttr_2(elem, 'in', this.invertreset);
|
|
dumpAttr_0(elem, 'mo', this.modulus);
|
|
}
|
|
;
|
|
_.execute_3 = function execute_19(){
|
|
var dir_0, i, lastBit, neg, value_0;
|
|
neg = (this.flags & 8) != 0;
|
|
if (this.pins[0].value_0 != neg && this.lastClock == neg) {
|
|
value_0 = 0;
|
|
dir_0 = 1;
|
|
(this.flags & 4) != 0 && this.pins[this.bits + 2].value_0 && (dir_0 = -1);
|
|
lastBit = 2 + this.bits - 1;
|
|
for (i = 0; i != this.bits; i++)
|
|
this.pins[lastBit - i].value_0 && (value_0 |= 1 << i);
|
|
value_0 += dir_0;
|
|
this.modulus != 0 && (value_0 = (value_0 + this.modulus) % this.modulus);
|
|
for (i = 0; i != this.bits; i++)
|
|
this.pins[lastBit - i].value_0 = (value_0 & 1 << i) != 0;
|
|
}
|
|
if (!this.pins[1].value_0 == this.invertreset) {
|
|
for (i = 0; i != this.bits; i++)
|
|
this.pins[i + 2].value_0 = false;
|
|
}
|
|
this.lastClock = this.pins[0].value_0;
|
|
}
|
|
;
|
|
_.getChipEditInfo = function getChipEditInfo_6(n){
|
|
var ei;
|
|
if (n == 0) {
|
|
ei = new EditInfo_0('', 0, -1, -1);
|
|
ei.checkbox = new Checkbox_0('Invert reset pin', this.invertreset);
|
|
return ei;
|
|
}
|
|
if (n == 1)
|
|
return $setDimensionless(new EditInfo_0('# of Bits', this.bits, 1, 1));
|
|
if (n == 2)
|
|
return $setDimensionless(new EditInfo_0('Modulus', this.modulus, 1, 1));
|
|
if (n == 3) {
|
|
ei = new EditInfo_0('', 0, -1, -1);
|
|
ei.checkbox = new Checkbox_0('Up/Down Pin', (this.flags & 4) != 0);
|
|
return ei;
|
|
}
|
|
if (n == 4) {
|
|
ei = new EditInfo_0('', 0, -1, -1);
|
|
ei.checkbox = new Checkbox_0('Negative Edge Triggered', (this.flags & 8) != 0);
|
|
return ei;
|
|
}
|
|
return null;
|
|
}
|
|
;
|
|
_.getChipName = function getChipName_9(){
|
|
if (this.modulus == 0)
|
|
return 'Counter';
|
|
return LS('Counter') + ('' + LS(' (mod ')) + this.modulus + ')';
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_23(){
|
|
return 164;
|
|
}
|
|
;
|
|
_.getPostCount_0 = function getPostCount_18(){
|
|
return (this.flags & 4) != 0?this.bits + 3:this.bits + 2;
|
|
}
|
|
;
|
|
_.getVoltageSourceCount = function getVoltageSourceCount_15(){
|
|
return this.bits;
|
|
}
|
|
;
|
|
_.getXmlDumpType = function getXmlDumpType_8(){
|
|
return 'ctr';
|
|
}
|
|
;
|
|
_.needsBits = function needsBits_3(){
|
|
return true;
|
|
}
|
|
;
|
|
_.setChipEditValue = function setChipEditValue_7(n, ei){
|
|
if (n == 0) {
|
|
this.invertreset = $getState(ei.checkbox);
|
|
$setupPins_6(this);
|
|
$setPoints_0(this);
|
|
}
|
|
if (n == 1) {
|
|
if (ei.value_0 >= 3) {
|
|
this.bits = round_int(ei.value_0);
|
|
$setupPins_6(this);
|
|
$setPoints_0(this);
|
|
}
|
|
else
|
|
ei.error = 'must be >= 3';
|
|
}
|
|
n == 2 && (this.modulus = round_int(ei.value_0));
|
|
if (n == 3) {
|
|
this.flags = $changeFlag(ei, this.flags, 4);
|
|
$setupPins_6(this);
|
|
$setPoints_0(this);
|
|
}
|
|
if (n == 4) {
|
|
this.flags = $changeFlag(ei, this.flags, 8);
|
|
$setupPins_6(this);
|
|
$setPoints_0(this);
|
|
}
|
|
}
|
|
;
|
|
_.setupPins = function setupPins_8(){
|
|
$setupPins_6(this);
|
|
}
|
|
;
|
|
_.undumpXml = function undumpXml_19(xml){
|
|
$undumpXml_0(this, xml);
|
|
this.invertreset = $parseBooleanAttr(xml, 'in', this.invertreset);
|
|
this.modulus = $parseIntAttr(xml, 'mo', this.modulus);
|
|
this.pins[1].bubble = this.invertreset;
|
|
}
|
|
;
|
|
_.invertreset = false;
|
|
_.modulus = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_CounterElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'CounterElm', 412);
|
|
function $ensureArrays(this$static){
|
|
if (this$static.voltageSources == null) {
|
|
this$static.voltageSources = initUnidimensionalArray(Lcom_lushprojects_circuitjs1_client_VoltageSource_2_classLit, $intern_3, 136, 2, 0, 1);
|
|
this$static.currents = initUnidimensionalArray(D_classLit, $intern_76, 7, 2, 15, 1);
|
|
this$static.curcounts = initUnidimensionalArray(D_classLit, $intern_76, 7, 2, 15, 1);
|
|
}
|
|
}
|
|
|
|
function $setPoints_5(this$static){
|
|
var dp, i, offset;
|
|
$setPoints_3(this$static);
|
|
$calcLeads(this$static, 32);
|
|
$ensureArrays(this$static);
|
|
this$static.throwPosts = $newPointArray(4);
|
|
this$static.throwLeads = $newPointArray(8);
|
|
this$static.poleLeads = $newPointArray(2);
|
|
this$static.polePosts = $newPointArray(2);
|
|
this$static.linePoints = $newPointArray(2);
|
|
this$static.crossPoints = $newPointArray(6);
|
|
for (i = 0; i != 2; i++) {
|
|
offset = -i * 16 * 3;
|
|
$interpPoint_2(this$static.point1, this$static.point2, this$static.polePosts[i], 0, offset);
|
|
$interpPoint_2(this$static.lead1, this$static.lead2, this$static.poleLeads[i], 0, offset);
|
|
$interpPoint_2(this$static.point1, this$static.point2, this$static.throwPosts[i * 2], 1, offset - 16);
|
|
$interpPoint_2(this$static.lead1, this$static.lead2, this$static.throwLeads[i * 4], 1, offset - 16);
|
|
$interpPoint_2(this$static.point1, this$static.point2, this$static.throwPosts[i * 2 + 1], 1, offset + 16);
|
|
$interpPoint_2(this$static.lead1, this$static.lead2, this$static.throwLeads[i * 4 + 1], 1, offset + 16);
|
|
$interpPoint_2(this$static.lead1, this$static.lead2, this$static.throwLeads[i * 4 + 2], 1, offset + 5.28);
|
|
(this$static.flags & 2) != 0?$interpPoint_2(this$static.lead1, this$static.lead2, this$static.throwLeads[i * 4 + 3], 1.2, offset - 5.28):$interpPoint_2(this$static.lead1, this$static.lead2, this$static.throwLeads[i * 4 + 3], 1, offset - 16);
|
|
}
|
|
dp = 16 / this$static.dn;
|
|
$interpPoint_2(this$static.point1, this$static.point2, this$static.crossPoints[0], 1 + dp, 16);
|
|
$interpPoint_2(this$static.point1, this$static.point2, this$static.crossPoints[1], 1 + dp * 2, 16);
|
|
$interpPoint_2(this$static.point1, this$static.point2, this$static.crossPoints[2], 1 + dp * 3, 16);
|
|
$interpPoint_2(this$static.point1, this$static.point2, this$static.crossPoints[3], 1 + dp * 2, -16);
|
|
$interpPoint_2(this$static.point1, this$static.point2, this$static.crossPoints[4], 1 + dp, -64);
|
|
$interpPoint_2(this$static.point1, this$static.point2, this$static.crossPoints[5], 1 + dp * 3, -64);
|
|
}
|
|
|
|
function CrossSwitchElm(xx, yy){
|
|
SwitchElm_1.call(this, xx, yy, false);
|
|
this.noDiagonal = true;
|
|
}
|
|
|
|
function CrossSwitchElm_0(xa, ya, xb, yb, f, st){
|
|
SwitchElm_0.call(this, xa, ya, xb, yb, f, st);
|
|
this.noDiagonal = true;
|
|
}
|
|
|
|
defineClass(404, 61, $intern_100, CrossSwitchElm, CrossSwitchElm_0);
|
|
_.calculateCurrent = function calculateCurrent_7(){
|
|
var dst, i;
|
|
if (this.resistance > 0)
|
|
for (i = 0; i != 2; i++) {
|
|
dst = this.position == 0?i * 2 + 1:3 - i * 2;
|
|
this.currents[i] = (this.volts[i * 2] - this.volts[dst]) / this.resistance;
|
|
}
|
|
}
|
|
;
|
|
_.draw = function draw_17(g){
|
|
var adj, i, offset;
|
|
$setBbox_0(this, this.point1, this.point2, 1);
|
|
$adjustBbox_0(this, this.crossPoints[2], this.crossPoints[5]);
|
|
$setVoltageColor(this, g, this.volts[1]);
|
|
drawThickLine_0(g, this.crossPoints[1], this.crossPoints[2], 3);
|
|
drawThickLine_0(g, this.crossPoints[1], this.crossPoints[3], 3);
|
|
drawThickLine_0(g, this.crossPoints[3], this.throwPosts[0], 3);
|
|
drawThickLine_0(g, this.throwPosts[0], this.throwPosts[3], 3);
|
|
$setVoltageColor(this, g, this.volts[3]);
|
|
drawThickLine_0(g, this.throwPosts[2], this.crossPoints[5], 3);
|
|
drawThickLine_0(g, this.throwPosts[1], this.crossPoints[0], 3);
|
|
drawThickLine_0(g, this.crossPoints[0], this.crossPoints[4], 3);
|
|
for (i = 0; i != 2; i++) {
|
|
$setVoltageColor(this, g, this.volts[i * 2]);
|
|
drawThickLine_0(g, this.polePosts[i], this.poleLeads[i], 3);
|
|
$setVoltageColor(this, g, this.volts[i * 2 + 1]);
|
|
(this.flags & 2) != 0 && drawThickLine_0(g, this.throwLeads[i * 4], this.throwLeads[i * 4 + 2], 3);
|
|
drawThickLine_0(g, this.throwPosts[i * 2], this.throwLeads[i * 4], 3);
|
|
$setVoltageColor(this, g, this.volts[3 - i * 2]);
|
|
drawThickLine_0(g, this.throwPosts[i * 2 + 1], this.throwLeads[i * 4 + 1], 3);
|
|
mouseElmRef == this || this.selected_0 || $containsKey(app_0.mouse.scopePlotRoles, this) || instanceOf(mouseElmRef, 21) && $getElm_0(mouseElmRef.elmScope) == this || $isOnHighlightedNet(this) || $setColor_0(g, ($clinit_Color() , lightGray));
|
|
if (i < 1) {
|
|
offset = -i * 16 * 3;
|
|
adj = this.position * -3;
|
|
$interpPoint_2(this.point1, this.point2, this.linePoints[0], 0.5, offset - 16 * (0.5 - this.position) + adj);
|
|
$interpPoint_2(this.point1, this.point2, this.linePoints[1], 0.5, offset - 48 - 16 * (0.5 - this.position) + 7 + adj);
|
|
setLineDash(g.context, 4, 4);
|
|
$drawLine_0(g, this.linePoints[0], this.linePoints[1]);
|
|
setLineDash(g.context, 0, 0);
|
|
}
|
|
mouseElmRef == this || this.selected_0 || $containsKey(app_0.mouse.scopePlotRoles, this) || instanceOf(mouseElmRef, 21) && $getElm_0(mouseElmRef.elmScope) == this || $isOnHighlightedNet(this) || $setColor_0(g, whiteColor);
|
|
drawThickLine_0(g, this.poleLeads[i], this.throwLeads[i * 4 + 3 - this.position * 2], 3);
|
|
this.curcounts[i] = $updateDotCount(this.currents[i], this.curcounts[i]);
|
|
$drawDots(g, this.polePosts[i], this.poleLeads[i], this.curcounts[i]);
|
|
$drawDots(g, this.throwLeads[i * 4 + this.position], this.throwPosts[i * 2 + this.position], this.curcounts[i]);
|
|
i == 1 && this.position == 0 && $drawDots(g, this.throwPosts[2], this.crossPoints[5], this.curcounts[1]);
|
|
if (i == 0 && this.position == 1) {
|
|
$drawDots(g, this.throwPosts[1], this.crossPoints[0], this.curcounts[0]);
|
|
$drawDots(g, this.crossPoints[0], this.crossPoints[4], this.curcounts[0]);
|
|
$drawDots(g, this.crossPoints[4], this.crossPoints[5], this.curcounts[0]);
|
|
}
|
|
i == 1 && this.position == 1 && $drawDots(g, this.throwPosts[3], this.throwPosts[0], this.curcounts[1]);
|
|
$drawDots(g, this.throwPosts[0], this.crossPoints[3], this.curcounts[this.position]);
|
|
$drawDots(g, this.crossPoints[3], this.crossPoints[1], this.curcounts[this.position]);
|
|
$drawDots(g, this.crossPoints[1], this.crossPoints[2], this.curcounts[this.position]);
|
|
}
|
|
$drawPosts(this, g);
|
|
drawPost(g, this.throwPosts[0]);
|
|
drawPost(g, this.crossPoints[4]);
|
|
}
|
|
;
|
|
_.getConnection = function getConnection_12(n1, n2){
|
|
return this.position == 0?n1 == 0 && n2 == 1 || n1 == 1 && n2 == 0 || n1 == 2 && n2 == 3 || n1 == 3 && n2 == 2:n1 == 0 && n2 == 3 || n1 == 3 && n2 == 0 || n1 == 2 && n2 == 1 || n1 == 1 && n2 == 2;
|
|
}
|
|
;
|
|
_.getCurrentIntoNode = function getCurrentIntoNode_7(n){
|
|
if (n == 0 || n == 2)
|
|
return -this.currents[n / 2 | 0];
|
|
if (this.position == 0)
|
|
return this.currents[n / 2 | 0];
|
|
return this.currents[1 - (n / 2 | 0)];
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_24(){
|
|
return 430;
|
|
}
|
|
;
|
|
_.getEditInfo = function getEditInfo_15(n){
|
|
var ei;
|
|
if (n == 0)
|
|
return createCheckbox('IEC Symbol', (this.flags & 2) != 0);
|
|
if (n == 1)
|
|
return new EditInfo_1('Keyboard Shortcut', this.keyShortcut == null?'':this.keyShortcut);
|
|
if (n == 2) {
|
|
ei = new EditInfo('On Resistance (ohms)', this.resistance);
|
|
ei.nonNegative = true;
|
|
return ei;
|
|
}
|
|
return null;
|
|
}
|
|
;
|
|
_.getElmType = function getElmType_2(){
|
|
return 'cross switch';
|
|
}
|
|
;
|
|
_.getInfo_0 = function getInfo_22(arr){
|
|
var i;
|
|
arr[0] = 'cross switch';
|
|
for (i = 0; i != 2; i++)
|
|
arr[i + 1] = 'I' + (i + 1) + ' = ' + getUnitText($wnd.Math.abs(this.currents[i]), 'A', false);
|
|
}
|
|
;
|
|
_.getPost = function getPost_6(n){
|
|
if (n == 0 || n == 2)
|
|
return this.polePosts[n / 2 | 0];
|
|
if (n == 1)
|
|
return this.crossPoints[2];
|
|
return this.crossPoints[5];
|
|
}
|
|
;
|
|
_.getPostCount_0 = function getPostCount_19(){
|
|
return 4;
|
|
}
|
|
;
|
|
_.getShortcut = function getShortcut_10(){
|
|
return 0;
|
|
}
|
|
;
|
|
_.getSwitchRect = function getSwitchRect_1(){
|
|
return $union($union(new Rectangle_1(this.poleLeads[0]), new Rectangle_1(this.throwLeads[1])), new Rectangle_1(this.throwLeads[4]));
|
|
}
|
|
;
|
|
_.getVoltageSourceCount = function getVoltageSourceCount_16(){
|
|
return this.resistance > 0?0:2;
|
|
}
|
|
;
|
|
_.isRemovableWire = function isRemovableWire_3(){
|
|
return false;
|
|
}
|
|
;
|
|
_.isWireEquivalent = function isWireEquivalent_4(){
|
|
return this.resistance == 0;
|
|
}
|
|
;
|
|
_.setCurrent = function setCurrent_4(vs, c){
|
|
vs == this.voltageSources[0]?(this.currents[0] = c):(this.currents[1] = c);
|
|
}
|
|
;
|
|
_.setEditValue = function setEditValue_15(n, ei){
|
|
var s;
|
|
if (n == 0) {
|
|
this.flags = $changeFlag(ei, this.flags, 2);
|
|
$setPoints_5(this);
|
|
}
|
|
n == 1 && (s = $trim($getText(ei.textf)) , s.length == 0?(this.keyShortcut = null):(this.keyShortcut = s.substr(0, 1).toLowerCase()));
|
|
n == 2 && (this.resistance = ei.value_0);
|
|
}
|
|
;
|
|
_.setPoints = function setPoints_15(){
|
|
$setPoints_5(this);
|
|
}
|
|
;
|
|
_.setVoltageSource = function setVoltageSource_9(j, vs){
|
|
$ensureArrays(this);
|
|
this.voltageSources[j] = vs;
|
|
$setNodes(vs, this.nodes[j * 2], this.nodes[j * 2 + 1]);
|
|
}
|
|
;
|
|
_.stamp = function stamp_19(){
|
|
var i;
|
|
$ensureArrays(this);
|
|
if (this.position == 0) {
|
|
for (i = 0; i != 2; i++) {
|
|
this.resistance > 0?$stampResistor(this.nodes[i * 2], this.nodes[i * 2 + 1], this.resistance):$stampVoltageSource_0(this.nodes[i * 2], this.nodes[i * 2 + 1], this.voltageSources[i], 0);
|
|
}
|
|
}
|
|
else {
|
|
for (i = 0; i != 2; i++) {
|
|
this.resistance > 0?$stampResistor(this.nodes[i * 2], this.nodes[3 - i * 2], this.resistance):$stampVoltageSource_0(this.nodes[i * 2], this.nodes[3 - i * 2], this.voltageSources[i], 0);
|
|
}
|
|
}
|
|
}
|
|
;
|
|
_.validate = function validate_7(){
|
|
var dst, fpi, i;
|
|
if (this.resistance > 0)
|
|
return true;
|
|
for (i = 0; i != 2; i++) {
|
|
dst = this.position == 0?i * 2 + 1:3 - i * 2;
|
|
fpi = new FindPathInfo(2, this, this.nodes[i * 2], sim_0);
|
|
if ($findPath(fpi, this.nodes[dst])) {
|
|
this.resistance = $intern_83;
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_CrossSwitchElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'CrossSwitchElm', 404);
|
|
function $clinit_CrystalElm(){
|
|
$clinit_CrystalElm = emptyMethod;
|
|
modelExternalNodes_0 = stampJavaTypeInfo(getClassLiteralForArray(I_classLit, 1), $intern_25, 7, 15, [1, 2]);
|
|
}
|
|
|
|
function $initCrystal(this$static){
|
|
var c1, c2, i1, r1;
|
|
c1 = $get_4(this$static.compElmList, 0);
|
|
$setCapacitance(c1, this$static.parallelCapacitance);
|
|
c2 = $get_4(this$static.compElmList, 1);
|
|
$setCapacitance(c2, this$static.seriesCapacitance);
|
|
i1 = $get_4(this$static.compElmList, 2);
|
|
$setInductance(i1, this$static.inductance);
|
|
r1 = $get_4(this$static.compElmList, 3);
|
|
$setResistance(r1, this$static.resistance);
|
|
}
|
|
|
|
function CrystalElm(xx, yy){
|
|
$clinit_CrystalElm();
|
|
CompositeElm_2.call(this, xx, yy, modelString_0, modelExternalNodes_0);
|
|
this.flags = 2;
|
|
this.parallelCapacitance = 2.87E-11;
|
|
this.seriesCapacitance = 1.0E-13;
|
|
this.inductance = 0.0025;
|
|
this.resistance = 6.4;
|
|
$initCrystal(this);
|
|
}
|
|
|
|
function CrystalElm_0(xa, ya, xb, yb, f, st){
|
|
$clinit_CrystalElm();
|
|
var c1, c2, i1, r1;
|
|
CompositeElm_1.call(this, xa, ya, xb, yb, f, st, modelString_0, modelExternalNodes_0);
|
|
c1 = $get_4(this.compElmList, 0);
|
|
this.parallelCapacitance = c1.capacitance;
|
|
c2 = $get_4(this.compElmList, 1);
|
|
this.seriesCapacitance = c2.capacitance;
|
|
i1 = $get_4(this.compElmList, 2);
|
|
this.inductance = i1.inductance;
|
|
r1 = $get_4(this.compElmList, 3);
|
|
this.resistance = r1.resistance;
|
|
$initCrystal(this);
|
|
}
|
|
|
|
defineClass(379, 110, $intern_85, CrystalElm, CrystalElm_0);
|
|
_.canViewInScope_0 = function canViewInScope_1(){
|
|
return true;
|
|
}
|
|
;
|
|
_.draw = function draw_18(g){
|
|
var fs, i, s;
|
|
$setBbox_0(this, this.point1, this.point2, 12);
|
|
$setVoltageColor(this, g, this.volts[0]);
|
|
drawThickLine_0(g, this.point1, this.lead1, 3);
|
|
$setPowerColor_0(this, g);
|
|
drawThickLine_0(g, this.plate1[0], this.plate1[1], 3);
|
|
app_0.menus.powerCheckItem.on && $setColor_0(g, ($clinit_Color() , gray));
|
|
$setVoltageColor(this, g, this.volts[1]);
|
|
drawThickLine_0(g, this.point2, this.lead2, 3);
|
|
$setPowerColor_0(this, g);
|
|
drawThickLine_0(g, this.plate2[0], this.plate2[1], 3);
|
|
$setVoltageColor(this, g, 0.5 * (this.volts[0] + this.volts[1]));
|
|
for (i = 0; i != 4; i++)
|
|
drawThickLine_0(g, this.sandwichPoints[i], this.sandwichPoints[(i + 1) % 4], 3);
|
|
this.curcount_0 = $updateDotCount(this.current_0, this.curcount_0);
|
|
if (app_0.mouse.dragElm != this) {
|
|
$drawDots(g, this.point1, this.lead1, this.curcount_0);
|
|
$drawDots(g, this.point2, this.lead2, -this.curcount_0);
|
|
}
|
|
$drawPosts(this, g);
|
|
if ((this.flags & 2) != 0) {
|
|
fs = 1 / ($wnd.Math.sqrt(this.inductance * this.seriesCapacitance) * $intern_1 * 2);
|
|
s = getUnitText(fs, 'Hz', true);
|
|
$drawValues(this, g, s, 12);
|
|
}
|
|
}
|
|
;
|
|
_.dumpXml = function dumpXml_18(doc, elem){
|
|
dumpAttr_1(elem, 'x', this.x_0 + ' ' + this.y_0 + ' ' + this.x2 + ' ' + this.y2);
|
|
dumpAttr_0(elem, 'f', this.flags);
|
|
dumpAttr(elem, 'pc', this.parallelCapacitance);
|
|
dumpAttr(elem, 'sc', this.seriesCapacitance);
|
|
dumpAttr(elem, 'in', this.inductance);
|
|
dumpAttr(elem, 'r', this.resistance);
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_25(){
|
|
return 412;
|
|
}
|
|
;
|
|
_.getEditInfo = function getEditInfo_16(n){
|
|
var ei;
|
|
if (n == 0)
|
|
return $setPositive(new EditInfo('<a href="crystal.html" target="_blank">' + LS('Parallel Capacitance') + '<\/a>', this.parallelCapacitance));
|
|
if (n == 1)
|
|
return $setPositive(new EditInfo('Series Capacitance (F)', this.seriesCapacitance));
|
|
if (n == 2)
|
|
return $setPositive(new EditInfo_0('Inductance (H)', this.inductance, 0, 0));
|
|
if (n == 3)
|
|
return $setPositive(new EditInfo_0('Resistance (' + ohmString + ')', this.resistance, 0, 0));
|
|
if (n == 4) {
|
|
ei = new EditInfo_0('', 0, -1, -1);
|
|
ei.checkbox = new Checkbox_0('Show Frequency', (this.flags & 2) != 0);
|
|
return ei;
|
|
}
|
|
return null;
|
|
}
|
|
;
|
|
_.getInfo_0 = function getInfo_23(arr){
|
|
var cSer, fp, fs, q;
|
|
arr[0] = 'crystal';
|
|
arr[1] = 'I = ' + getUnitText($wnd.Math.abs(this.current_0), 'A', false);
|
|
arr[2] = 'Vd = ' + getUnitText($wnd.Math.abs(this.volts[0] - this.volts[1]), 'V', false);
|
|
fs = 1 / ($wnd.Math.sqrt(this.inductance * this.seriesCapacitance) * $intern_1 * 2);
|
|
cSer = this.parallelCapacitance * this.seriesCapacitance / (this.parallelCapacitance + this.seriesCapacitance);
|
|
fp = 1 / ($wnd.Math.sqrt(this.inductance * cSer) * $intern_1 * 2);
|
|
q = $intern_2 * fs * this.inductance / this.resistance;
|
|
arr[3] = 'fs = ' + getUnitText(fs, 'Hz', false);
|
|
arr[4] = 'fp = ' + getUnitText(fp, 'Hz', false);
|
|
arr[5] = 'Q = ' + getUnitText(q, '', false);
|
|
arr[6] = 'P = ' + getUnitText($getPower(this), 'W', false);
|
|
}
|
|
;
|
|
_.getXmlDumpType = function getXmlDumpType_9(){
|
|
return 'cr';
|
|
}
|
|
;
|
|
_.setEditValue = function setEditValue_16(n, ei){
|
|
n == 0 && ei.value_0 > 0 && (this.parallelCapacitance = ei.value_0);
|
|
n == 1 && ei.value_0 > 0 && (this.seriesCapacitance = ei.value_0);
|
|
n == 2 && ei.value_0 > 0 && (this.inductance = ei.value_0);
|
|
n == 3 && ei.value_0 > 0 && (this.resistance = ei.value_0);
|
|
n == 4 && (this.flags = $changeFlag(ei, this.flags, 2));
|
|
$initCrystal(this);
|
|
}
|
|
;
|
|
_.setPoints = function setPoints_16(){
|
|
var f, f2;
|
|
$setPoints(this);
|
|
f = (this.dn / 2 - 10) / this.dn;
|
|
this.lead1 = $interpPoint(this.point1, this.point2, f);
|
|
this.lead2 = $interpPoint(this.point1, this.point2, 1 - f);
|
|
this.plate1 = $newPointArray(2);
|
|
this.plate2 = $newPointArray(2);
|
|
$interpPoint2(this.point1, this.point2, this.plate1[0], this.plate1[1], f, 8);
|
|
$interpPoint2(this.point1, this.point2, this.plate2[0], this.plate2[1], 1 - f, 8);
|
|
this.sandwichPoints = $newPointArray(4);
|
|
f2 = (this.dn / 2 - 5) / this.dn;
|
|
$interpPoint2(this.point1, this.point2, this.sandwichPoints[0], this.sandwichPoints[1], f2, 10);
|
|
$interpPoint2(this.point1, this.point2, this.sandwichPoints[3], this.sandwichPoints[2], 1 - f2, 10);
|
|
$setPost(this, 0, this.point1);
|
|
$setPost(this, 1, this.point2);
|
|
}
|
|
;
|
|
_.stepFinished_0 = function stepFinished_10(){
|
|
this.current_0 = $getCurrentIntoNode(this, 1);
|
|
}
|
|
;
|
|
_.stepFinished = function(){
|
|
this.stepFinished_0();
|
|
}
|
|
;
|
|
_.undumpXml = function undumpXml_20(xml){
|
|
$undumpXml_3(this, xml);
|
|
this.resistance = $parseDoubleAttr(xml, 'r', this.resistance);
|
|
this.inductance = $parseDoubleAttr(xml, 'in', this.inductance);
|
|
this.parallelCapacitance = $parseDoubleAttr(xml, 'pc', this.parallelCapacitance);
|
|
this.seriesCapacitance = $parseDoubleAttr(xml, 'sc', this.seriesCapacitance);
|
|
$initCrystal(this);
|
|
}
|
|
;
|
|
_.inductance = 0;
|
|
_.parallelCapacitance = 0;
|
|
_.resistance = 0;
|
|
_.seriesCapacitance = 0;
|
|
var modelExternalNodes_0, modelString_0 = 'CapacitorElm 1 2\rCapacitorElm 1 3\rInductorElm 3 4\rResistorElm 4 2';
|
|
var Lcom_lushprojects_circuitjs1_client_CrystalElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'CrystalElm', 379);
|
|
function $setBroken(this$static, b){
|
|
this$static.broken = b && !(this$static.maxVoltage > 0);
|
|
}
|
|
|
|
function $setPoints_6(this$static){
|
|
var p2;
|
|
$setPoints(this$static);
|
|
$calcLeads(this$static, 26);
|
|
this$static.ashaft1 = $interpPoint(this$static.lead1, this$static.lead2, 0.25);
|
|
this$static.ashaft2 = $interpPoint(this$static.lead1, this$static.lead2, 0.6);
|
|
this$static.center = $interpPoint(this$static.lead1, this$static.lead2, 0.5);
|
|
p2 = $interpPoint(this$static.lead1, this$static.lead2, 0.75);
|
|
this$static.arrow = $calcArrow(this$static.center, p2, 4, 4);
|
|
}
|
|
|
|
function CurrentElm(xx, yy){
|
|
CircuitElm.call(this, xx, yy);
|
|
this.currentValue = $intern_34;
|
|
this.maxVoltage = 0;
|
|
}
|
|
|
|
function CurrentElm_0(xa, ya, xb, yb, f, st){
|
|
CircuitElm_0.call(this, xa, ya, xb, yb, f);
|
|
try {
|
|
this.currentValue = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.maxVoltage = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
}
|
|
catch ($e0) {
|
|
$e0 = toJava($e0);
|
|
if (!instanceOf($e0, 13))
|
|
throw toJs($e0);
|
|
}
|
|
this.currentValue == 0 && (this.currentValue = $intern_34);
|
|
}
|
|
|
|
defineClass(202, 8, $intern_105, CurrentElm, CurrentElm_0);
|
|
_.doStep = function doStep_14(){
|
|
var absG, arg, g, i, maxStep, sech2, tanhArg, vMid, vStart, vWidth, vd, vt;
|
|
if (this.broken || !(this.maxVoltage > 0))
|
|
return;
|
|
vd = this.volts[1] - this.volts[0];
|
|
vStart = 0.95 * this.maxVoltage;
|
|
vWidth = this.maxVoltage - vStart;
|
|
vMid = (vStart + this.maxVoltage) / 2;
|
|
vt = $wnd.Math.max(vWidth / 5, $intern_83);
|
|
if (this.lastVoltDiff < vStart && vd > vStart) {
|
|
vd = vStart;
|
|
sim_0.converged = false;
|
|
}
|
|
else if (this.lastVoltDiff > this.maxVoltage && vd < this.maxVoltage) {
|
|
vd = this.maxVoltage;
|
|
sim_0.converged = false;
|
|
}
|
|
else if (this.lastVoltDiff >= vStart && this.lastVoltDiff <= this.maxVoltage) {
|
|
maxStep = $wnd.Math.max(vWidth / 4, $intern_34);
|
|
if (vd > this.lastVoltDiff + maxStep) {
|
|
vd = this.lastVoltDiff + maxStep;
|
|
sim_0.converged = false;
|
|
}
|
|
else if (vd < this.lastVoltDiff - maxStep) {
|
|
vd = this.lastVoltDiff - maxStep;
|
|
sim_0.converged = false;
|
|
}
|
|
}
|
|
this.lastVoltDiff = vd;
|
|
arg = (vd - vMid) / vt;
|
|
tanhArg = tanh(arg);
|
|
i = this.currentValue * 0.5 * (1 - tanhArg);
|
|
sech2 = 1 - tanhArg * tanhArg;
|
|
g = -this.currentValue * 0.5 * sech2 / vt * vd;
|
|
absG = $wnd.Math.abs(g) + $intern_82;
|
|
$stampResistor(this.nodes[0], this.nodes[1], 1 / absG);
|
|
$stampCurrentSource(this.nodes[0], this.nodes[1], i - g * vd);
|
|
this.current_0 = i;
|
|
}
|
|
;
|
|
_.draw = function draw_19(g){
|
|
var s;
|
|
$draw2Leads(this, g);
|
|
$setVoltageColor(this, g, (this.volts[0] + this.volts[1]) / 2);
|
|
$setPowerColor_0(this, g);
|
|
drawThickCircle(g, this.center.x_0, this.center.y_0, 12);
|
|
drawThickLine_0(g, this.ashaft1, this.ashaft2, 3);
|
|
$fillPolygon(g, this.arrow);
|
|
$setBbox_0(this, this.point1, this.point2, 12);
|
|
this.curcount_0 = $updateDotCount(this.current_0, this.curcount_0);
|
|
app_0.mouse.dragElm == this || $drawDots(g, this.point1, this.point2, this.curcount_0);
|
|
if (app_0.menus.showValuesCheckItem.on && this.current_0 != 0) {
|
|
s = getUnitText(this.current_0, 'A', true);
|
|
(this.dx == 0 || this.dy == 0) && $drawValues(this, g, s, 12);
|
|
}
|
|
$drawPosts(this, g);
|
|
}
|
|
;
|
|
_.dumpXml = function dumpXml_19(doc, elem){
|
|
dumpAttr_1(elem, 'x', this.x_0 + ' ' + this.y_0 + ' ' + this.x2 + ' ' + this.y2);
|
|
dumpAttr_0(elem, 'f', this.flags);
|
|
dumpAttr(elem, 'cu', this.currentValue);
|
|
this.maxVoltage > 0 && dumpAttr(elem, 'mv', this.maxVoltage);
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_26(){
|
|
return 105;
|
|
}
|
|
;
|
|
_.getEditInfo = function getEditInfo_17(n){
|
|
if (n == 0)
|
|
return new EditInfo_0('Current (A)', this.currentValue, 0, 0.1);
|
|
if (n == 1)
|
|
return $setUnitStep(new EditInfo_0('Max Voltage (V, 0=unlimited)', this.maxVoltage, 0, 0));
|
|
return null;
|
|
}
|
|
;
|
|
_.getInfo_0 = function getInfo_24(arr){
|
|
var i;
|
|
arr[0] = 'current source';
|
|
i = $getBasicInfo(this, arr);
|
|
arr[i++] = 'P = ' + getUnitText(-(this.volts[1] - this.volts[0]) * this.current_0, 'W', false);
|
|
this.maxVoltage > 0 && (arr[i++] = 'Vmax = ' + getUnitText(this.maxVoltage, 'V', false));
|
|
}
|
|
;
|
|
_.getPower = function getPower_5(){
|
|
return -(this.volts[1] - this.volts[0]) * this.current_0;
|
|
}
|
|
;
|
|
_.getVoltageDiff_0 = function getVoltageDiff_6(){
|
|
return this.volts[1] - this.volts[0];
|
|
}
|
|
;
|
|
_.nonLinear_0 = function nonLinear_4(){
|
|
return this.maxVoltage > 0;
|
|
}
|
|
;
|
|
_.reset_0 = function reset_10(){
|
|
$reset(this);
|
|
this.lastVoltDiff = 0;
|
|
}
|
|
;
|
|
_.setEditValue = function setEditValue_17(n, ei){
|
|
n == 0 && (this.currentValue = ei.value_0);
|
|
n == 1 && ei.value_0 >= 0 && (this.maxVoltage = ei.value_0);
|
|
}
|
|
;
|
|
_.setPoints = function setPoints_17(){
|
|
$setPoints_6(this);
|
|
}
|
|
;
|
|
_.stamp = function stamp_20(){
|
|
if (this.broken) {
|
|
$stampResistor(this.nodes[0], this.nodes[1], $intern_97);
|
|
this.current_0 = 0;
|
|
}
|
|
else if (this.maxVoltage > 0)
|
|
;
|
|
else {
|
|
$stampCurrentSource(this.nodes[0], this.nodes[1], this.currentValue);
|
|
this.current_0 = this.currentValue;
|
|
}
|
|
}
|
|
;
|
|
_.undumpXml = function undumpXml_21(xml){
|
|
this.flags = $parseIntAttr(xml, 'f', this.flags);
|
|
this.currentValue = $parseDoubleAttr(xml, 'cu', this.currentValue);
|
|
this.maxVoltage = $parseDoubleAttr(xml, 'mv', 0);
|
|
}
|
|
;
|
|
_.validate = function validate_8(){
|
|
var fpi;
|
|
fpi = new FindPathInfo(1, this, this.nodes[1], sim_0);
|
|
$setBroken(this, !$findPath(fpi, this.nodes[0]));
|
|
return true;
|
|
}
|
|
;
|
|
_.broken = false;
|
|
_.currentValue = 0;
|
|
_.lastVoltDiff = 0;
|
|
_.maxVoltage = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_CurrentElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'CurrentElm', 202);
|
|
function $allocPins(this$static, n){
|
|
this$static.pins = initUnidimensionalArray(Lcom_lushprojects_circuitjs1_client_ChipElm$Pin_2_classLit, $intern_3, 9, n, 0, 1);
|
|
}
|
|
|
|
function $setLabel(this$static, text_0){
|
|
this$static.label_0 = text_0;
|
|
}
|
|
|
|
function $setPin(this$static, n, p, s, t){
|
|
this$static.pins[n] = new ChipElm$Pin(this$static, p, s, t);
|
|
$fixName(this$static.pins[n]);
|
|
}
|
|
|
|
function CustomCompositeChipElm(xx, yy){
|
|
$clinit_ChipElm();
|
|
ChipElm.call(this, xx, yy);
|
|
$setSize_0(this, 2);
|
|
}
|
|
|
|
defineClass(295, 32, $intern_85, CustomCompositeChipElm);
|
|
_.drawLabel = function drawLabel_0(g, x_0, y_0){
|
|
if (this.label_0 == null)
|
|
return;
|
|
g.context.save();
|
|
g.savedFontSize = g.currentFontSize;
|
|
g.context.textBaseline = 'middle';
|
|
g.context.textAlign = 'center';
|
|
$drawString(g, this.label_0, x_0, y_0);
|
|
g.context.restore();
|
|
g.currentFontSize = g.savedFontSize;
|
|
}
|
|
;
|
|
_.getPostCount_0 = function getPostCount_20(){
|
|
return this.pins == null?1:this.pins.length;
|
|
}
|
|
;
|
|
_.getVoltageSourceCount = function getVoltageSourceCount_17(){
|
|
return 0;
|
|
}
|
|
;
|
|
_.needsBits = function needsBits_4(){
|
|
return false;
|
|
}
|
|
;
|
|
_.setupPins = function setupPins_9(){
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_CustomCompositeChipElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'CustomCompositeChipElm', 295);
|
|
function $buildDisplayElmList(this$static){
|
|
var allElms, ce, childElem, childElem$iterator, className, compIdx, elmEntries, tagName, xml;
|
|
allElms = new Vector_0(this$static.compElmList);
|
|
elmEntries = $getElmEntries(this$static.model);
|
|
xml = new XMLDeserializer(app_0);
|
|
compIdx = 0;
|
|
for (childElem$iterator = new ArrayList$1(elmEntries.arrayList); childElem$iterator.i < childElem$iterator.this$01.array.length;) {
|
|
childElem = $next_4(childElem$iterator);
|
|
tagName = getTagName(childElem.jsObject);
|
|
className = $getStringValue(xmlDumpTypeMap, tagName);
|
|
if (className == null)
|
|
continue;
|
|
if ($equals_1(className, 'WireElm') || $equals_1(className, 'RoutedWireElm') || $equals_1(className, 'LabeledNodeElm') || $equals_1(className, 'ScopeElm') || $equals_1(className, 'GraphicElm') || $equals_1(className, 'GroundElm') && getAttribute(childElem.jsObject, 'x') != null) {
|
|
ce = constructElement(className, 0, 0);
|
|
xml.currentXmlElement = childElem;
|
|
ce.undumpXml(xml);
|
|
$add_8(allElms.arrayList, ce);
|
|
}
|
|
else {
|
|
ce = $get_4(this$static.compElmList, compIdx++);
|
|
}
|
|
$setPositionFromXml(ce, childElem);
|
|
}
|
|
return allElms;
|
|
}
|
|
|
|
function $canViewComponents(this$static){
|
|
var childElem, childElem$iterator, elmEntries;
|
|
elmEntries = $getElmEntries(this$static.model);
|
|
new XMLDeserializer(app_0);
|
|
for (childElem$iterator = new ArrayList$1(elmEntries.arrayList); childElem$iterator.i < childElem$iterator.this$01.array.length;) {
|
|
childElem = $next_4(childElem$iterator);
|
|
if (getAttribute(childElem.jsObject, 'x') != null)
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
function $dumpXmlModel(this$static, doc){
|
|
var i;
|
|
if (this$static.compElmList) {
|
|
for (i = 0; i < this$static.compElmList.arrayList.array.length; i++)
|
|
$get_4(this$static.compElmList, i).dumpXmlModel(doc);
|
|
}
|
|
this$static.model.builtin || this$static.model.dumped || $dumpXml_4(this$static.model, doc);
|
|
}
|
|
|
|
function $onDoubleClick(this$static){
|
|
$canViewComponents(this$static)?$pushSubcircuit(app_0.ui, this$static, $buildDisplayElmList(this$static)):$isReadOnly(app_0.ui) || $doEdit(app_0.commands, this$static);
|
|
}
|
|
|
|
function $propagateHighVoltage(this$static){
|
|
var ce, i;
|
|
if (this$static.highVoltage == 0)
|
|
return;
|
|
for (i = 0; i != this$static.compElmList.arrayList.array.length; i++) {
|
|
ce = $get_4(this$static.compElmList, i);
|
|
ce.setHighVoltage(this$static.highVoltage);
|
|
instanceOf(ce, 200) && $propagateHighVoltage(ce);
|
|
}
|
|
}
|
|
|
|
function $setPoints_7(this$static){
|
|
var i, pin;
|
|
this$static.chip = new CustomCompositeChipElm(this$static.x_0, this$static.y_0);
|
|
this$static.chip.x2 = this$static.x2;
|
|
this$static.chip.y2 = this$static.y2;
|
|
this$static.chip.flags = this$static.flags & 7168;
|
|
this$static.x2 - this$static.x_0 > this$static.model.sizeX * 16 && app_0.mouse.dragElm == this$static && (this$static.flags &= -3);
|
|
$setSize_0(this$static.chip, (this$static.flags & 2) != 0?1:2);
|
|
$setLabel(this$static.chip, (this$static.model.flags & 1) != 0?this$static.model.name_0:null);
|
|
this$static.chip.sizeX = this$static.model.sizeX;
|
|
this$static.chip.sizeY = this$static.model.sizeY;
|
|
$allocPins(this$static.chip, this$static.postCount);
|
|
for (i = 0; i != this$static.postCount; i++) {
|
|
pin = $get_4(this$static.model.extList, i);
|
|
$setPin(this$static.chip, i, pin.pos, pin.side, pin.name_0);
|
|
this$static.chip.pins[i].busWidth = pin.busWidth;
|
|
this$static.chip.pins[i].busZ = pin.busZ;
|
|
}
|
|
$setPoints_0(this$static.chip);
|
|
this$static.boundingBox = this$static.chip.boundingBox;
|
|
for (i = 0; i != this$static.postCount; i++)
|
|
$setPost(this$static, i, $getPost_0(this$static.chip, i));
|
|
}
|
|
|
|
function $updateModels_0(this$static, st){
|
|
var externalNodes, i;
|
|
if (!!this$static.model && $equals_1(this$static.model.name_0, this$static.modelName))
|
|
return;
|
|
this$static.model = getModelWithName(this$static.modelName);
|
|
if (!this$static.model)
|
|
return;
|
|
this$static.postCount = this$static.model.extList.arrayList.array.length;
|
|
externalNodes = initUnidimensionalArray(I_classLit, $intern_25, 7, this$static.postCount, 15, 1);
|
|
for (i = 0; i != this$static.postCount; i++)
|
|
externalNodes[i] = $get_4(this$static.model.extList, i).node;
|
|
st?$loadComposite(this$static, st, $getNodeList(this$static.model), externalNodes):$loadCompositeXml(this$static, $getElmEntries(this$static.model), externalNodes);
|
|
$propagateHighVoltage(this$static);
|
|
$allocNodes(this$static);
|
|
$setPoints_7(this$static);
|
|
}
|
|
|
|
function CustomCompositeElm(xx, yy){
|
|
CompositeElm.call(this, xx, yy);
|
|
this.modelName = xx == 0 && yy == 0?'default':lastModelName;
|
|
this.flags |= 1;
|
|
app_0.menus.smallGridCheckItem.on && (this.flags |= 2);
|
|
this.model = null;
|
|
$updateModels_0(this, null);
|
|
}
|
|
|
|
function CustomCompositeElm_0(xa, ya, xb, yb, f, st){
|
|
CompositeElm_0.call(this, xa, ya, xb, yb, f);
|
|
this.modelName = unescape_0($nextToken(st));
|
|
$updateModels_0(this, st);
|
|
}
|
|
|
|
function CustomCompositeElm_1(xx, yy, name_0){
|
|
CompositeElm.call(this, xx, yy);
|
|
this.modelName = name_0;
|
|
this.flags |= 1;
|
|
app_0.menus.smallGridCheckItem.on && (this.flags |= 2);
|
|
this.model = null;
|
|
$updateModels_0(this, null);
|
|
}
|
|
|
|
defineClass(200, 110, {8:1, 200:1, 10:1}, CustomCompositeElm, CustomCompositeElm_0, CustomCompositeElm_1);
|
|
_.addRoutingObstacle = function addRoutingObstacle_7(router){
|
|
$addRoutingObstacle(this.chip, router);
|
|
}
|
|
;
|
|
_.draw = function draw_20(g){
|
|
var i;
|
|
for (i = 0; i != this.postCount; i++) {
|
|
this.chip.volts[i] = this.volts[i];
|
|
this.chip.pins[i].current = $getCurrentIntoNode(this, i);
|
|
}
|
|
$setSelected(this.chip, mouseElmRef == this || this.selected_0 || $containsKey(app_0.mouse.scopePlotRoles, this) || instanceOf(mouseElmRef, 21) && $getElm_0(mouseElmRef.elmScope) == this || $isOnHighlightedNet(this));
|
|
$drawChip(this.chip, g);
|
|
}
|
|
;
|
|
_.dumpXml = function dumpXml_20(doc, elem){
|
|
$dumpXmlModel(this, doc);
|
|
dumpAttr_1(elem, 'x', this.x_0 + ' ' + this.y_0 + ' ' + this.x2 + ' ' + this.y2);
|
|
dumpAttr_0(elem, 'f', this.flags);
|
|
dumpAttr_1(elem, 'mo', this.modelName);
|
|
this.highVoltage != 0 && dumpAttr(elem, 'hv', this.highVoltage);
|
|
}
|
|
;
|
|
_.dumpXmlModel = function dumpXmlModel_0(doc){
|
|
$dumpXmlModel(this, doc);
|
|
}
|
|
;
|
|
_.flipX = function flipX_4(center2, count){
|
|
var xs;
|
|
this.flags ^= $intern_24;
|
|
if (count != 1) {
|
|
xs = (this.chip.flippedSizeX + 1) * this.chip.cspc2;
|
|
this.x_0 = center2 - this.x_0 - xs;
|
|
this.x2 = center2 - this.x2;
|
|
}
|
|
$setPoints_7(this);
|
|
}
|
|
;
|
|
_.flipXY = function flipXY_3(xmy, count){
|
|
this.flags ^= $intern_42;
|
|
(this.flags & $intern_24) != 0 != ((this.flags & $intern_43) != 0) && (this.flags ^= 3072);
|
|
if (count != 1) {
|
|
this.x_0 += this.chip.cspc2;
|
|
$flipXY(this, xmy);
|
|
this.x_0 -= this.chip.cspc2;
|
|
}
|
|
$setPoints_7(this);
|
|
}
|
|
;
|
|
_.flipY = function flipY_4(center2, count){
|
|
var xs;
|
|
this.flags ^= $intern_43;
|
|
if (count != 1) {
|
|
xs = (this.chip.flippedSizeY - 1) * this.chip.cspc2;
|
|
this.y_0 = center2 - this.y_0 - xs;
|
|
this.y2 = center2 - this.y2;
|
|
}
|
|
$setPoints_7(this);
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_27(){
|
|
return 410;
|
|
}
|
|
;
|
|
_.getEditInfo = function getEditInfo_18(n){
|
|
var ccm, ei, hvIdx, i;
|
|
this.model.internal && (n += 2);
|
|
if (n == 0) {
|
|
ei = new EditInfo_0('<a href="subcircuits.html" target="_blank">' + LS('Model Name') + '<\/a>', 0, -1, -1);
|
|
this.models = getModelList();
|
|
ei.choice = new Choice;
|
|
for (i = 0; i != this.models.arrayList.array.length; i++) {
|
|
ccm = $get_4(this.models, i);
|
|
$addItem(ei.choice, LS(ccm.name_0));
|
|
ccm == this.model && $select(ei.choice, i);
|
|
}
|
|
return ei;
|
|
}
|
|
if (n == 1) {
|
|
ei = new EditInfo_0('', 0, -1, -1);
|
|
ei.button_0 = new Button_1(LS('Edit Pin Layout'));
|
|
return ei;
|
|
}
|
|
if (n == 2 && $canViewComponents(this)) {
|
|
ei = new EditInfo_0('', 0, -1, -1);
|
|
ei.button_0 = new Button_1(LS('View Components'));
|
|
return ei;
|
|
}
|
|
hvIdx = $canViewComponents(this)?3:2;
|
|
if (n == hvIdx)
|
|
return $setUnitStep(new EditInfo_0('High Logic Voltage (0=default)', this.highVoltage, 0, 10));
|
|
if (n == hvIdx + 1 && $canLoadModelCircuit(this.model)) {
|
|
ei = new EditInfo_0('', 0, -1, -1);
|
|
ei.button_0 = new Button_1(LS('Edit Model'));
|
|
return ei;
|
|
}
|
|
return null;
|
|
}
|
|
;
|
|
_.getElmType = function getElmType_3(){
|
|
return 'subcircuit';
|
|
}
|
|
;
|
|
_.getInfo_0 = function getInfo_25(arr){
|
|
var a, ent, i, j, value_0, number;
|
|
this.model.builtin && $startsWith(this.model.name_0, '~')?(arr[0] = this.model.name_0.substr(1)):(arr[0] = 'subcircuit (' + this.model.name_0 + ')');
|
|
a = 1;
|
|
for (i = 0; i != this.postCount; i++) {
|
|
if (a >= arr.length)
|
|
break;
|
|
ent = $get_4(this.model.extList, i);
|
|
if (ent.busZ > 0)
|
|
continue;
|
|
if (ent.busWidth > 1) {
|
|
value_0 = 0;
|
|
for (j = 0; j < ent.busWidth; j++)
|
|
this.volts[i + j] > this.chip.highVoltage / 2 && (value_0 |= 1 << j);
|
|
arr[a] = ent.name_0 + ' = ' + value_0 + ' / 0x' + (number = value_0 >>> 0 , number.toString(16)).toUpperCase();
|
|
}
|
|
else {
|
|
arr[a] = ent.name_0 + ' = ' + getUnitText(this.volts[i], 'V', false);
|
|
}
|
|
++a;
|
|
}
|
|
}
|
|
;
|
|
_.getNumHandles = function getNumHandles_2(){
|
|
return 0;
|
|
}
|
|
;
|
|
_.getPostCount_0 = function getPostCount_21(){
|
|
return this.postCount;
|
|
}
|
|
;
|
|
_.getPostWidth = function getPostWidth_2(n){
|
|
return this.chip?$getPostWidth(this.chip, n):1;
|
|
}
|
|
;
|
|
_.getXmlDumpType = function getXmlDumpType_10(){
|
|
return 'cc';
|
|
}
|
|
;
|
|
_.setEditValue = function setEditValue_18(n, ei){
|
|
var dlg, hvIdx, xml;
|
|
this.model.internal && (n += 2);
|
|
if (n == 0) {
|
|
this.model = $get_4(this.models, $getElement(ei.choice).selectedIndex);
|
|
lastModelName = this.modelName = this.model.name_0;
|
|
this.model = null;
|
|
$updateModels_0(this, null);
|
|
$setPoints_7(this);
|
|
return;
|
|
}
|
|
if (n == 1) {
|
|
if ($equals_1(this.model.name_0, 'default')) {
|
|
alert_0(LS("Can't edit this model."));
|
|
return;
|
|
}
|
|
dlg = new EditCompositeModelDialog;
|
|
$setModel(dlg, this.model);
|
|
$createDialog(dlg);
|
|
dialogShowing = dlg;
|
|
!dlg.resizeHandlerRegistration && (dlg.resizeHandlerRegistration = addResizeHandler(new DialogBox$1(dlg)));
|
|
$show(dlg);
|
|
$drawChip_0(dlg);
|
|
return;
|
|
}
|
|
if (n == 2) {
|
|
$pushSubcircuit(app_0.ui, this, $buildDisplayElmList(this));
|
|
$closeDialog_0(editDialog_0);
|
|
}
|
|
hvIdx = $canViewComponents(this)?3:2;
|
|
if (n == hvIdx) {
|
|
this.highVoltage = ei.value_0;
|
|
$propagateHighVoltage(this);
|
|
}
|
|
if (n == hvIdx + 1) {
|
|
$pushContext(app_0, this.model.name_0);
|
|
if (this.model.modelCircuit != null)
|
|
$readCircuit(app_0, this.model.modelCircuit);
|
|
else {
|
|
xml = new XMLDeserializer(app_0);
|
|
$readCircuit_2(xml, this.model.elmDoc);
|
|
}
|
|
$closeDialog_0(editDialog_0);
|
|
}
|
|
}
|
|
;
|
|
_.setHighVoltage = function setHighVoltage_2(hv){
|
|
this.highVoltage = hv;
|
|
}
|
|
;
|
|
_.setPoints = function setPoints_18(){
|
|
$setPoints_7(this);
|
|
}
|
|
;
|
|
_.undumpXml = function undumpXml_22(xml){
|
|
this.modelName = $parseStringAttr(xml, 'mo', this.modelName);
|
|
this.highVoltage = $parseDoubleAttr(xml, 'hv', 0);
|
|
this.model = null;
|
|
$updateModels_0(this, null);
|
|
$undumpXml_3(this, xml);
|
|
}
|
|
;
|
|
_.updateModels_0 = function updateModels_0(){
|
|
this.model = null;
|
|
$updateModels_0(this, null);
|
|
}
|
|
;
|
|
_.updateModels = function(){
|
|
this.updateModels_0();
|
|
}
|
|
;
|
|
_.highVoltage = 0;
|
|
_.postCount = 0;
|
|
var lastModelName = 'default';
|
|
var Lcom_lushprojects_circuitjs1_client_CustomCompositeElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'CustomCompositeElm', 200);
|
|
function $buildXmlElement(this$static, doc, elem){
|
|
var bcs, children, ent, ext, i, i0, imported, node;
|
|
dumpAttr_1(elem, 'nm', this$static.name_0);
|
|
dumpAttr_0(elem, 'f', this$static.flags);
|
|
dumpAttr_0(elem, 'sx', this$static.sizeX);
|
|
dumpAttr_0(elem, 'sy', this$static.sizeY);
|
|
bcs = $busNodesConsecutive(this$static);
|
|
bcs && (checkAttr(elem, 'bcs') , $setAttribute_0(elem, 'bcs', '1'));
|
|
for (i0 = 0; i0 != this$static.extList.arrayList.array.length; i0++) {
|
|
ent = $get_4(this$static.extList, i0);
|
|
if (bcs && ent.busZ > 0)
|
|
continue;
|
|
ext = $createElement(doc, 'ext');
|
|
dumpAttr_1(ext, 'nm', ent.name_0);
|
|
dumpAttr_0(ext, 'nd', ent.node);
|
|
dumpAttr_0(ext, 'ps', ent.pos);
|
|
dumpAttr_0(ext, 'sd', ent.side);
|
|
if (ent.busWidth > 1) {
|
|
dumpAttr_0(ext, 'bw', ent.busWidth);
|
|
bcs || dumpAttr_0(ext, 'bz', ent.busZ);
|
|
}
|
|
$appendChild_0(elem, ext);
|
|
}
|
|
children = new NodeListImpl(getChildNodes(build(getDocumentElement(this$static.elmDoc.jsObject)).jsObject));
|
|
for (i = 0; i < getLength_1(children.jsObject); i++) {
|
|
node = build(item_3(children.jsObject, i));
|
|
if (getNodeType(node.jsObject) != 1)
|
|
continue;
|
|
imported = $importNode(doc, node);
|
|
$appendChild_0(elem, imported);
|
|
}
|
|
}
|
|
|
|
function $busNodesConsecutive(this$static){
|
|
var ent, i;
|
|
for (i = 0; i < this$static.extList.arrayList.array.length; i++) {
|
|
ent = $get_4(this$static.extList, i);
|
|
if (ent.busZ > 0 && ent.node != $get_4(this$static.extList, i - 1).node + 1)
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
function $canLoadModelCircuit(this$static){
|
|
var children, i, node;
|
|
if (this$static.modelCircuit != null && this$static.modelCircuit.length > 0)
|
|
return true;
|
|
if (this$static.elmDoc) {
|
|
children = new NodeListImpl(getChildNodes(build(getDocumentElement(this$static.elmDoc.jsObject)).jsObject));
|
|
for (i = 0; i < getLength_1(children.jsObject); i++) {
|
|
node = build(item_3(children.jsObject, i));
|
|
if (getNodeType(node.jsObject) == 1) {
|
|
if (getAttribute(node.jsObject, 'x') != null)
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
function $convertOldFormatToXml(this$static, nodeList, elmDump){
|
|
var ce, ceFlags, ceType, child, dumpedCe, elmSt, line, modelLinet, nn, root, stCe, stModel;
|
|
this$static.elmDoc = ($clinit_XMLParser() , build($createDocumentImpl()));
|
|
root = $createElement(this$static.elmDoc, 'elms');
|
|
$appendChild_0(this$static.elmDoc, root);
|
|
modelLinet = new StringTokenizer_0(nodeList, '\r');
|
|
elmSt = new StringTokenizer_0(elmDump, ' ');
|
|
while ($hasMoreTokens(modelLinet)) {
|
|
line = $nextToken(modelLinet);
|
|
stModel = new StringTokenizer_0(line, ' +\t\n\r\f');
|
|
ceType = $nextToken(stModel);
|
|
nn = '';
|
|
while ($hasMoreTokens(stModel)) {
|
|
nn.length > 0 && (nn += ' ');
|
|
nn += $nextToken(stModel);
|
|
}
|
|
ce = constructElement(ceType, 0, 0);
|
|
if ($hasMoreTokens(elmSt)) {
|
|
dumpedCe = unescape_0($nextToken(elmSt));
|
|
stCe = new StringTokenizer_0(dumpedCe, ' ');
|
|
ceFlags = __parseAndValidateInt($nextToken(stCe), 10);
|
|
ce = createCe(ce.getDumpType(), 0, 0, 0, 0, ceFlags, stCe);
|
|
}
|
|
instanceOf(ce, 160) && (ce.flags |= 1);
|
|
child = $createElement(this$static.elmDoc, ce.getXmlDumpType());
|
|
dumpAttr_1(child, 'nn', nn);
|
|
ce.dumpXml(this$static.elmDoc, child);
|
|
$removeAttribute(child);
|
|
$appendChild_0(root, child);
|
|
}
|
|
}
|
|
|
|
function $dumpXml_4(this$static, doc){
|
|
var elem;
|
|
if (this$static.internal)
|
|
return;
|
|
this$static.dumped = true;
|
|
elem = $createElement(doc, 'ccm');
|
|
$buildXmlElement(this$static, doc, elem);
|
|
$appendChild_0(build(getDocumentElement(doc.jsObject)), elem);
|
|
}
|
|
|
|
function $getElmEntries(this$static){
|
|
var children, entries, i, node;
|
|
entries = new Vector;
|
|
children = new NodeListImpl(getChildNodes(build(getDocumentElement(this$static.elmDoc.jsObject)).jsObject));
|
|
for (i = 0; i < getLength_1(children.jsObject); i++) {
|
|
node = build(item_3(children.jsObject, i));
|
|
getNodeType(node.jsObject) == 1 && $add_8(entries.arrayList, node);
|
|
}
|
|
return entries;
|
|
}
|
|
|
|
function $getNodeList(this$static){
|
|
var child, child$iterator, className, nn, nodeList, tagName;
|
|
nodeList = '';
|
|
for (child$iterator = new ArrayList$1($getElmEntries(this$static).arrayList); child$iterator.i < child$iterator.this$01.array.length;) {
|
|
child = $next_4(child$iterator);
|
|
tagName = getTagName(child.jsObject);
|
|
className = $getStringValue(xmlDumpTypeMap, tagName);
|
|
if (className == null)
|
|
continue;
|
|
nn = getAttribute(child.jsObject, 'nn');
|
|
nodeList.length > 0 && (nodeList += '\r');
|
|
nodeList += className + (nn != null && nn.length > 0?' ' + nn:'');
|
|
}
|
|
return nodeList;
|
|
}
|
|
|
|
function $isSaved(this$static){
|
|
var stor;
|
|
if (this$static.name_0 == null)
|
|
return false;
|
|
stor = (!localStorage_0 && ($clinit_Storage$StorageSupportDetector() , localStorageSupported) && (localStorage_0 = new Storage_0('localStorage')) , localStorage_0);
|
|
if (!stor)
|
|
return false;
|
|
return $getItem(stor, 'subcircuit:' + this$static.name_0) != null;
|
|
}
|
|
|
|
function $parseXmlElement(this$static, xml){
|
|
var bcs, bw, child, child$iterator, ent, imported, j, n, p, root, s, sd, tagName;
|
|
this$static.flags = $parseIntAttr(xml, 'f', this$static.flags);
|
|
this$static.sizeX = $parseIntAttr(xml, 'sx', this$static.sizeX);
|
|
this$static.sizeY = $parseIntAttr(xml, 'sy', this$static.sizeY);
|
|
bcs = $parseIntAttr(xml, 'bcs', 0) != 0;
|
|
this$static.extList = new Vector;
|
|
this$static.elmDoc = ($clinit_XMLParser() , build($createDocumentImpl()));
|
|
root = $createElement(this$static.elmDoc, 'elms');
|
|
$appendChild_0(this$static.elmDoc, root);
|
|
for (child$iterator = new ArrayList$1($getChildElements(xml)); child$iterator.i < child$iterator.this$01.array.length;) {
|
|
child = $next_4(child$iterator);
|
|
if ($equals_1(getTagName(child.jsObject), 'ext')) {
|
|
xml.currentXmlElement = child;
|
|
s = $parseStringAttr(xml, 'nm', '');
|
|
n = $parseIntAttr(xml, 'nd', 0);
|
|
p = $parseIntAttr(xml, 'ps', 0);
|
|
sd = $parseIntAttr(xml, 'sd', 0);
|
|
bw = $parseIntAttr(xml, 'bw', 1);
|
|
if (bcs && bw > 1) {
|
|
for (j = 0; j < bw; j++) {
|
|
ent = new ExtListEntry_0(s, n + j, p, sd);
|
|
ent.busWidth = bw;
|
|
ent.busZ = j;
|
|
$add_11(this$static.extList, ent);
|
|
}
|
|
}
|
|
else {
|
|
ent = new ExtListEntry_0(s, n, p, sd);
|
|
ent.busWidth = bw;
|
|
ent.busZ = $parseIntAttr(xml, 'bz', 0);
|
|
$add_11(this$static.extList, ent);
|
|
}
|
|
}
|
|
else {
|
|
imported = $importNode(this$static.elmDoc, child);
|
|
$appendChild_0(root, imported);
|
|
tagName = getTagName(child.jsObject);
|
|
xml.currentXmlElement = child;
|
|
$equals_1(tagName, 'dm')?undumpModelXml_1(xml):$equals_1(tagName, 'rlm')?undumpModelXml_2(xml):$equals_1(tagName, 'tm')?undumpModelXml_3(xml):$equals_1(tagName, 'clm') && undumpModelXml_0(xml);
|
|
}
|
|
}
|
|
}
|
|
|
|
function $setName_1(this$static, n){
|
|
if ($removeStringValue(localModelMap, this$static.name_0) != null) {
|
|
this$static.name_0 = n;
|
|
$putStringValue(localModelMap, this$static.name_0, this$static);
|
|
}
|
|
else {
|
|
$removeStringValue(globalModelMap, this$static.name_0);
|
|
this$static.name_0 = n;
|
|
$putStringValue(globalModelMap, this$static.name_0, this$static);
|
|
}
|
|
++sequenceNumber;
|
|
}
|
|
|
|
function $setSaved(this$static, sv){
|
|
var doc, root, stor;
|
|
stor = (!localStorage_0 && ($clinit_Storage$StorageSupportDetector() , localStorageSupported) && (localStorage_0 = new Storage_0('localStorage')) , localStorage_0);
|
|
if (!stor)
|
|
return;
|
|
if (sv) {
|
|
doc = ($clinit_XMLParser() , build($createDocumentImpl()));
|
|
root = $createElement(doc, 'ccm');
|
|
$appendChild_0(doc, root);
|
|
$buildXmlElement(this$static, doc, root);
|
|
$setItem(stor, 'subcircuit:' + this$static.name_0, ($clinit_XMLParserImpl() , $toStringImpl(doc)));
|
|
$putStringValue(globalModelMap, this$static.name_0, this$static);
|
|
}
|
|
else
|
|
$removeItem(stor, 'subcircuit:' + this$static.name_0);
|
|
}
|
|
|
|
function $setShowLabel(this$static, sl){
|
|
this$static.flags = sl?this$static.flags | 1:this$static.flags & -2;
|
|
}
|
|
|
|
function $undump(this$static, st){
|
|
var elmDump, extCount, i, n, nodeList, p, s, sd;
|
|
this$static.flags = __parseAndValidateInt($nextToken(st), 10);
|
|
this$static.sizeX = __parseAndValidateInt($nextToken(st), 10);
|
|
this$static.sizeY = __parseAndValidateInt($nextToken(st), 10);
|
|
extCount = __parseAndValidateInt($nextToken(st), 10);
|
|
this$static.extList = new Vector;
|
|
for (i = 0; i != extCount; i++) {
|
|
s = unescape_0($nextToken(st));
|
|
n = __parseAndValidateInt($nextToken(st), 10);
|
|
p = __parseAndValidateInt($nextToken(st), 10);
|
|
sd = __parseAndValidateInt($nextToken(st), 10);
|
|
$add_11(this$static.extList, new ExtListEntry_0(s, n, p, sd));
|
|
}
|
|
nodeList = unescape_0($nextToken(st));
|
|
elmDump = unescape_0($nextToken(st));
|
|
$convertOldFormatToXml(this$static, nodeList, elmDump);
|
|
}
|
|
|
|
function CustomCompositeModel(){
|
|
}
|
|
|
|
function clearDumpedFlags(){
|
|
var it, pair;
|
|
if (!globalModelMap)
|
|
return;
|
|
it = new AbstractHashMap$EntrySetIterator((new AbstractHashMap$EntrySet(globalModelMap)).this$01);
|
|
while (it.hasNext) {
|
|
pair = $next_2(it);
|
|
pair.getValue().dumped = false;
|
|
}
|
|
it = new AbstractHashMap$EntrySetIterator((new AbstractHashMap$EntrySet(localModelMap)).this$01);
|
|
while (it.hasNext) {
|
|
pair = $next_2(it);
|
|
pair.getValue().dumped = false;
|
|
}
|
|
}
|
|
|
|
function getModelList(){
|
|
var dm, it, merged, pair, vector;
|
|
merged = new HashMap_1(globalModelMap);
|
|
$putAll(merged, localModelMap);
|
|
vector = new Vector;
|
|
it = new AbstractHashMap$EntrySetIterator((new AbstractHashMap$EntrySet(merged)).this$01);
|
|
while (it.hasNext) {
|
|
pair = $next_2(it);
|
|
dm = pair.getValue();
|
|
if (dm.internal)
|
|
continue;
|
|
$add_8(vector.arrayList, dm);
|
|
}
|
|
$clinit_Collections();
|
|
$sort(vector.arrayList, null);
|
|
return vector;
|
|
}
|
|
|
|
function getModelWithName(name_0){
|
|
var lm, extList, d, lm_0;
|
|
!globalModelMap && (globalModelMap = new HashMap , localModelMap = new HashMap , extList = new Vector , $add_11(extList, new ExtListEntry) , d = (lm_0 = new CustomCompositeModel , lm_0.name_0 = 'default' , lm_0.extList = extList , $convertOldFormatToXml(lm_0, 'GroundElm 1', '0 0') , $putStringValue(localModelMap, 'default', lm_0) , ++sequenceNumber , lm_0) , d.sizeX = d.sizeY = 1 , d.builtin = true , $removeStringValue(localModelMap, d.name_0) , $putStringValue(globalModelMap, d.name_0, d) , sequenceNumber = 1 , loadInternalModels() , undefined);
|
|
lm = $getStringValue(localModelMap, name_0);
|
|
if (lm) {
|
|
return lm;
|
|
}
|
|
lm = $getStringValue(globalModelMap, name_0);
|
|
return lm;
|
|
}
|
|
|
|
function loadInternalModels(){
|
|
var i, model, models, st;
|
|
models = stampJavaTypeInfo(getClassLiteralForArray(Ljava_lang_String_2_classLit, 1), $intern_23, 2, 6, ['. ~LM317-v2 0 2 2 3 adj 2 1 1 in 1 0 2 out 3 0 3 JfetElm\\s3\\s4\\s1\\s\\rResistorElm\\s5\\s39\\rCapacitorElm\\s39\\s6\\rCapacitorElm\\s39\\s5\\rTransistorElm\\s39\\s5\\s6\\s\\rResistorElm\\s7\\s40\\rCapacitorElm\\s40\\s8\\rCapacitorElm\\s40\\s5\\rTransistorElm\\s40\\s5\\s8\\s\\rResistorElm\\s5\\s41\\rCapacitorElm\\s41\\s9\\rCapacitorElm\\s41\\s7\\rTransistorElm\\s41\\s7\\s9\\s\\rResistorElm\\s7\\s42\\rCapacitorElm\\s42\\s3\\rCapacitorElm\\s42\\s10\\rTransistorElm\\s42\\s10\\s3\\s\\rResistorElm\\s10\\s43\\rCapacitorElm\\s43\\s11\\rCapacitorElm\\s43\\s3\\rTransistorElm\\s43\\s3\\s11\\s\\rResistorElm\\s10\\s44\\rCapacitorElm\\s44\\s13\\rCapacitorElm\\s44\\s12\\rTransistorElm\\s44\\s12\\s13\\s\\rResistorElm\\s5\\s45\\rCapacitorElm\\s45\\s14\\rCapacitorElm\\s45\\s11\\rTransistorElm\\s45\\s11\\s14\\s\\rResistorElm\\s12\\s46\\rCapacitorElm\\s46\\s11\\rCapacitorElm\\s46\\s15\\rTransistorElm\\s46\\s15\\s11\\s\\rResistorElm\\s5\\s47\\rCapacitorElm\\s47\\s17\\rCapacitorElm\\s47\\s16\\rTransistorElm\\s47\\s16\\s17\\s\\rResistorElm\\s15\\s48\\rCapacitorElm\\s48\\s18\\rCapacitorElm\\s48\\s16\\rTransistorElm\\s48\\s16\\s18\\s\\rResistorElm\\s19\\s49\\rCapacitorElm\\s49\\s16\\rCapacitorElm\\s49\\s3\\rTransistorElm\\s49\\s3\\s16\\s\\rResistorElm\\s20\\s50\\rCapacitorElm\\s50\\s19\\rCapacitorElm\\s50\\s1\\rTransistorElm\\s50\\s1\\s19\\s\\rResistorElm\\s5\\s51\\rCapacitorElm\\s51\\s21\\rCapacitorElm\\s51\\s20\\rTransistorElm\\s51\\s20\\s21\\s\\rResistorElm\\s22\\s52\\rCapacitorElm\\s52\\s20\\rCapacitorElm\\s52\\s3\\rTransistorElm\\s52\\s3\\s20\\s\\rResistorElm\\s23\\s53\\rCapacitorElm\\s53\\s16\\rCapacitorElm\\s53\\s22\\rTransistorElm\\s53\\s22\\s16\\s\\rResistorElm\\s3\\s54\\rCapacitorElm\\s54\\s24\\rCapacitorElm\\s54\\s22\\rTransistorElm\\s54\\s22\\s24\\s\\rResistorElm\\s23\\s55\\rCapacitorElm\\s55\\s16\\rCapacitorElm\\s55\\s23\\rTransistorElm\\s55\\s23\\s16\\s\\rResistorElm\\s3\\s56\\rCapacitorElm\\s56\\s25\\rCapacitorElm\\s56\\s23\\rTransistorElm\\s56\\s23\\s25\\s\\rResistorElm\\s26\\s57\\rCapacitorElm\\s57\\s16\\rCapacitorElm\\s57\\s3\\rTransistorElm\\s57\\s3\\s16\\s\\rResistorElm\\s27\\s58\\rCapacitorElm\\s58\\s3\\rCapacitorElm\\s58\\s26\\rTransistorElm\\s58\\s26\\s3\\s\\rResistorElm\\s28\\s59\\rCapacitorElm\\s59\\s1\\rCapacitorElm\\s59\\s28\\rTransistorElm\\s59\\s28\\s1\\s\\rResistorElm\\s28\\s60\\rCapacitorElm\\s60\\s1\\rCapacitorElm\\s60\\s16\\rTransistorElm\\s60\\s16\\s1\\s\\rResistorElm\\s16\\s61\\rCapacitorElm\\s61\\s29\\rCapacitorElm\\s61\\s28\\rTransistorElm\\s61\\s28\\s29\\s\\rResistorElm\\s31\\s62\\rCapacitorElm\\s62\\s32\\rCapacitorElm\\s62\\s30\\rTransistorElm\\s62\\s30\\s32\\s\\rResistorElm\\s31\\s63\\rCapacitorElm\\s63\\s33\\rCapacitorElm\\s63\\s30\\rTransistorElm\\s63\\s30\\s33\\s\\rResistorElm\\s34\\s64\\rCapacitorElm\\s64\\s35\\rCapacitorElm\\s64\\s1\\rTransistorElm\\s64\\s1\\s35\\s\\rResistorElm\\s35\\s65\\rCapacitorElm\\s65\\s36\\rCapacitorElm\\s65\\s1\\rTransistorElm\\s65\\s1\\s36\\s\\rDiodeElm\\s3\\s4\\rDiodeElm\\s37\\s1\\rDiodeElm\\s32\\s38\\rResistorElm\\s1\\s6\\rResistorElm\\s1\\s9\\rResistorElm\\s1\\s14\\rResistorElm\\s1\\s17\\rResistorElm\\s1\\s21\\rResistorElm\\s4\\s7\\rResistorElm\\s7\\s10\\rResistorElm\\s11\\s12\\rResistorElm\\s8\\s3\\rResistorElm\\s13\\s3\\rResistorElm\\s15\\s3\\rResistorElm\\s18\\s3\\rResistorElm\\s19\\s3\\rResistorElm\\s2\\s24\\rResistorElm\\s24\\s25\\rResistorElm\\s16\\s26\\rResistorElm\\s16\\s31\\rResistorElm\\s29\\s35\\rResistorElm\\s16\\s34\\rResistorElm\\s27\\s30\\rResistorElm\\s30\\s31\\rResistorElm\\s3\\s35\\rResistorElm\\s37\\s38\\rResistorElm\\s33\\s32\\rResistorElm\\s33\\s36\\rResistorElm\\s36\\s3\\rCapacitorElm\\s22\\s3\\rCapacitorElm\\s22\\s2\\rCapacitorElm\\s26\\s27\\rCapacitorElm\\s5\\s3\\rCapacitorElm\\s28\\s3\\rCapacitorElm\\s23\\s3\\r 0\\\\s-7\\\\s0.0001\\s0\\\\s200\\s2\\\\s1.5000000000000002e-13\\\\s0\\\\s0\\s2\\\\s1e-13\\\\s0\\\\s0\\s0\\\\s-1\\\\s0\\\\s0\\\\s40\\\\s~lm317-qpl-A0.1\\s0\\\\s500\\s2\\\\s4e-13\\\\s0\\\\s0\\s2\\\\s2e-13\\\\s0\\\\s0\\s0\\\\s1\\\\s0\\\\s0\\\\s80\\\\s~lm317-qnl-A0.2\\s0\\\\s200\\s2\\\\s1.5000000000000002e-13\\\\s0\\\\s0\\s2\\\\s1e-13\\\\s0\\\\s0\\s0\\\\s-1\\\\s0\\\\s0\\\\s40\\\\s~lm317-qpl-A0.1\\s0\\\\s500\\s2\\\\s4e-13\\\\s0\\\\s0\\s2\\\\s2e-13\\\\s0\\\\s0\\s0\\\\s1\\\\s0\\\\s0\\\\s80\\\\s~lm317-qnl-A0.2\\s0\\\\s100\\s2\\\\s3.0000000000000003e-13\\\\s0\\\\s0\\s2\\\\s2e-13\\\\s0\\\\s0\\s0\\\\s-1\\\\s0\\\\s0\\\\s40\\\\s~lm317-qpl-A0.2\\s0\\\\s500\\s2\\\\s4e-13\\\\s0\\\\s0\\s2\\\\s2e-13\\\\s0\\\\s0\\s0\\\\s1\\\\s0\\\\s0\\\\s80\\\\s~lm317-qnl-A0.2\\s0\\\\s100\\s2\\\\s3.0000000000000003e-13\\\\s0\\\\s0\\s2\\\\s2e-13\\\\s0\\\\s0\\s0\\\\s-1\\\\s0\\\\s0\\\\s40\\\\s~lm317-qpl-A0.2\\s0\\\\s100\\s2\\\\s3.0000000000000003e-13\\\\s0\\\\s0\\s2\\\\s2e-13\\\\s0\\\\s0\\s0\\\\s-1\\\\s0\\\\s0\\\\s40\\\\s~lm317-qpl-A0.2\\s0\\\\s100\\s2\\\\s3.0000000000000003e-13\\\\s0\\\\s0\\s2\\\\s2e-13\\\\s0\\\\s0\\s0\\\\s-1\\\\s0\\\\s0\\\\s40\\\\s~lm317-qpl-A0.2\\s0\\\\s500\\s2\\\\s4e-13\\\\s0\\\\s0\\s2\\\\s2e-13\\\\s0\\\\s0\\s0\\\\s1\\\\s0\\\\s0\\\\s80\\\\s~lm317-qnl-A0.2\\s0\\\\s100\\s2\\\\s3.0000000000000003e-13\\\\s0\\\\s0\\s2\\\\s2e-13\\\\s0\\\\s0\\s0\\\\s-1\\\\s0\\\\s0\\\\s40\\\\s~lm317-qpl-A0.2\\s0\\\\s500\\s2\\\\s4e-13\\\\s0\\\\s0\\s2\\\\s2e-13\\\\s0\\\\s0\\s0\\\\s1\\\\s0\\\\s0\\\\s80\\\\s~lm317-qnl-A0.2\\s0\\\\s100\\s2\\\\s3.0000000000000003e-13\\\\s0\\\\s0\\s2\\\\s2e-13\\\\s0\\\\s0\\s0\\\\s-1\\\\s0\\\\s0\\\\s40\\\\s~lm317-qpl-A0.2\\s0\\\\s100\\s2\\\\s3.0000000000000003e-13\\\\s0\\\\s0\\s2\\\\s2e-13\\\\s0\\\\s0\\s0\\\\s-1\\\\s0\\\\s0\\\\s40\\\\s~lm317-qpl-A0.2\\s0\\\\s100\\s2\\\\s3.0000000000000003e-13\\\\s0\\\\s0\\s2\\\\s2e-13\\\\s0\\\\s0\\s0\\\\s-1\\\\s0\\\\s0\\\\s40\\\\s~lm317-qpl-A0.2\\s0\\\\s500\\s2\\\\s4e-13\\\\s0\\\\s0\\s2\\\\s2e-13\\\\s0\\\\s0\\s0\\\\s1\\\\s0\\\\s0\\\\s80\\\\s~lm317-qnl-A0.2\\s0\\\\s100\\s2\\\\s3.0000000000000003e-13\\\\s0\\\\s0\\s2\\\\s2e-13\\\\s0\\\\s0\\s0\\\\s-1\\\\s0\\\\s0\\\\s40\\\\s~lm317-qpl-A0.2\\s0\\\\s50\\s2\\\\s4e-12\\\\s0\\\\s0\\s2\\\\s2e-12\\\\s0\\\\s0\\s0\\\\s1\\\\s0\\\\s0\\\\s80\\\\s~lm317-qnl-A2\\s0\\\\s100\\s2\\\\s3.0000000000000003e-13\\\\s0\\\\s0\\s2\\\\s2e-13\\\\s0\\\\s0\\s0\\\\s-1\\\\s0\\\\s0\\\\s40\\\\s~lm317-qpl-A0.2\\s0\\\\s500\\s2\\\\s4e-13\\\\s0\\\\s0\\s2\\\\s2e-13\\\\s0\\\\s0\\s0\\\\s1\\\\s0\\\\s0\\\\s80\\\\s~lm317-qnl-A0.2\\s0\\\\s10\\s2\\\\s3e-12\\\\s0\\\\s0\\s2\\\\s2e-12\\\\s0\\\\s0\\s0\\\\s-1\\\\s0\\\\s0\\\\s40\\\\s~lm317-qpl-A2\\s0\\\\s10\\s2\\\\s3e-12\\\\s0\\\\s0\\s2\\\\s2e-12\\\\s0\\\\s0\\s0\\\\s-1\\\\s0\\\\s0\\\\s40\\\\s~lm317-qpl-A2\\s0\\\\s50\\s2\\\\s4e-12\\\\s0\\\\s0\\s2\\\\s2e-12\\\\s0\\\\s0\\s0\\\\s1\\\\s0\\\\s0\\\\s80\\\\s~lm317-qnl-A2\\s0\\\\s500\\s2\\\\s4e-13\\\\s0\\\\s0\\s2\\\\s2e-13\\\\s0\\\\s0\\s0\\\\s1\\\\s0\\\\s0\\\\s80\\\\s~lm317-qnl-A0.2\\s0\\\\s500\\s2\\\\s4e-13\\\\s0\\\\s0\\s2\\\\s2e-13\\\\s0\\\\s0\\s0\\\\s1\\\\s0\\\\s0\\\\s80\\\\s~lm317-qnl-A0.2\\s0\\\\s20\\s2\\\\s1e-11\\\\s0\\\\s0\\s2\\\\s5e-12\\\\s0\\\\s0\\s0\\\\s1\\\\s0\\\\s0\\\\s80\\\\s~lm317-qnl-A5\\s0\\\\s2\\s2\\\\s1e-10\\\\s0\\\\s0\\s2\\\\s5e-11\\\\s0\\\\s0\\s0\\\\s1\\\\s0\\\\s0\\\\s80\\\\s~lm317-qnl-A50\\s2\\\\s~lm317-dz\\s2\\\\s~lm317-dz\\s2\\\\s~lm317-dz\\s0\\\\s310\\s0\\\\s310\\s0\\\\s190\\s0\\\\s82\\s0\\\\s5600\\s0\\\\s100000\\s0\\\\s130\\s0\\\\s12400\\s0\\\\s180\\s0\\\\s4100\\s0\\\\s5800\\s0\\\\s72\\s0\\\\s5100\\s0\\\\s12000\\s0\\\\s2400\\s0\\\\s6700\\s0\\\\s12000\\s0\\\\s130\\s0\\\\s370\\s0\\\\s13000\\s0\\\\s400\\s0\\\\s160\\s0\\\\s18000\\s0\\\\s160\\s0\\\\s3\\s0\\\\s0.1\\s2\\\\s3e-11\\\\s0\\\\s0\\s2\\\\s3e-11\\\\s0\\\\s0\\s2\\\\s5e-12\\\\s0\\\\s0\\s2\\\\s2e-12\\\\s0\\\\s0\\s2\\\\s1e-12\\\\s0\\\\s0\\s2\\\\s1e-12\\\\s0\\\\s0', '. ~TL431 0 1 3 3 A 2 0 1 C 1 0 0 ref 3 1 2 ResistorElm\\s3\\s18\\rCapacitorElm\\s18\\s4\\rCapacitorElm\\s18\\s1\\rTransistorElm\\s18\\s1\\s4\\s\\rResistorElm\\s4\\s5\\rResistorElm\\s5\\s6\\rResistorElm\\s5\\s7\\rResistorElm\\s6\\s19\\rCapacitorElm\\s19\\s2\\rCapacitorElm\\s19\\s6\\rTransistorElm\\s19\\s6\\s2\\s\\rResistorElm\\s6\\s20\\rCapacitorElm\\s20\\s8\\rCapacitorElm\\s20\\s7\\rTransistorElm\\s20\\s7\\s8\\s\\rResistorElm\\s8\\s2\\rResistorElm\\s4\\s21\\rCapacitorElm\\s21\\s10\\rCapacitorElm\\s21\\s9\\rTransistorElm\\s21\\s9\\s10\\s\\rResistorElm\\s10\\s11\\rResistorElm\\s7\\s22\\rCapacitorElm\\s22\\s2\\rCapacitorElm\\s22\\s11\\rTransistorElm\\s22\\s11\\s2\\s\\rResistorElm\\s13\\s23\\rCapacitorElm\\s23\\s2\\rCapacitorElm\\s23\\s12\\rTransistorElm\\s23\\s12\\s2\\s\\rResistorElm\\s9\\s24\\rCapacitorElm\\s24\\s14\\rCapacitorElm\\s24\\s9\\rTransistorElm\\s24\\s9\\s14\\s\\rResistorElm\\s9\\s25\\rCapacitorElm\\s25\\s15\\rCapacitorElm\\s25\\s12\\rTransistorElm\\s25\\s12\\s15\\s\\rResistorElm\\s1\\s14\\rResistorElm\\s1\\s15\\rResistorElm\\s12\\s26\\rCapacitorElm\\s26\\s16\\rCapacitorElm\\s26\\s1\\rTransistorElm\\s26\\s1\\s16\\s\\rResistorElm\\s17\\s16\\rResistorElm\\s17\\s27\\rCapacitorElm\\s27\\s2\\rCapacitorElm\\s27\\s1\\rTransistorElm\\s27\\s1\\s2\\s\\rResistorElm\\s17\\s2\\rResistorElm\\s12\\s28\\rCapacitorElm\\s28\\s3\\rCapacitorElm\\s28\\s12\\rTransistorElm\\s28\\s12\\s3\\s\\rDiodeElm\\s2\\s12\\rResistorElm\\s13\\s6\\rDiodeElm\\s2\\s1\\rCapacitorElm\\s1\\s12\\rCapacitorElm\\s7\\s11\\r 0\\\\s40\\s2\\\\s1e-12\\\\s0\\\\s0\\s2\\\\s2e-12\\\\s0\\\\s0\\s0\\\\s1\\\\s0\\\\s0\\\\s140\\\\s~tl431ed-qn_ed\\s0\\\\s3280\\s0\\\\s2400\\s0\\\\s7200\\s0\\\\s33.333333333333336\\s2\\\\s1.2e-12\\\\s0\\\\s0\\s2\\\\s2.4e-12\\\\s0\\\\s0\\s0\\\\s1\\\\s0\\\\s0\\\\s140\\\\s~tl431ed-qn_ed-A1.2\\s0\\\\s18.18181818181818\\s2\\\\s2.2000000000000003e-12\\\\s0\\\\s0\\s2\\\\s4.400000000000001e-12\\\\s0\\\\s0\\s0\\\\s1\\\\s0\\\\s0\\\\s140\\\\s~tl431ed-qn_ed-A2.2\\s0\\\\s800\\s0\\\\s40\\s2\\\\s1e-12\\\\s0\\\\s0\\s2\\\\s2e-12\\\\s0\\\\s0\\s0\\\\s1\\\\s0\\\\s0\\\\s140\\\\s~tl431ed-qn_ed\\s0\\\\s4000\\s0\\\\s40\\s2\\\\s1e-12\\\\s0\\\\s0\\s2\\\\s2e-12\\\\s0\\\\s0\\s0\\\\s1\\\\s0\\\\s0\\\\s140\\\\s~tl431ed-qn_ed\\s0\\\\s80\\s2\\\\s5e-13\\\\s0\\\\s0\\s2\\\\s1e-12\\\\s0\\\\s0\\s0\\\\s1\\\\s0\\\\s0\\\\s140\\\\s~tl431ed-qn_ed-A0.5\\s0\\\\s80\\s2\\\\s1e-12\\\\s0\\\\s0\\s2\\\\s3e-12\\\\s0\\\\s0\\s0\\\\s-1\\\\s0\\\\s0\\\\s60\\\\s~tl431ed-qp_ed\\s0\\\\s80\\s2\\\\s1e-12\\\\s0\\\\s0\\s2\\\\s3e-12\\\\s0\\\\s0\\s0\\\\s-1\\\\s0\\\\s0\\\\s60\\\\s~tl431ed-qp_ed\\s0\\\\s800\\s0\\\\s800\\s0\\\\s40\\s2\\\\s1e-12\\\\s0\\\\s0\\s2\\\\s2e-12\\\\s0\\\\s0\\s0\\\\s1\\\\s0\\\\s0\\\\s140\\\\s~tl431ed-qn_ed\\s0\\\\s150\\s0\\\\s8\\s2\\\\s5e-12\\\\s0\\\\s0\\s2\\\\s1e-11\\\\s0\\\\s0\\s0\\\\s1\\\\s0\\\\s0\\\\s140\\\\s~tl431ed-qn_ed-A5\\s0\\\\s10000\\s0\\\\s40\\s2\\\\s1e-12\\\\s0\\\\s0\\s2\\\\s2e-12\\\\s0\\\\s0\\s0\\\\s1\\\\s0\\\\s0\\\\s140\\\\s~tl431ed-qn_ed\\s2\\\\s~tl431ed-d_ed\\s0\\\\s1000\\s2\\\\s~tl431ed-d_ed\\s2\\\\s1e-11\\\\s0\\\\s0\\s2\\\\s2e-11\\\\s0\\\\s0']);
|
|
for (i = 0; i != models.length; i++) {
|
|
st = new StringTokenizer_0(models[i], ' ');
|
|
$nextToken(st);
|
|
model = undumpModel(st);
|
|
model.internal = model.builtin = true;
|
|
$removeStringValue(localModelMap, model.name_0);
|
|
$putStringValue(globalModelMap, model.name_0, model);
|
|
}
|
|
}
|
|
|
|
function loadModelsFromStorage(){
|
|
var data_0, e, firstLine, i, key, len, lineLen, model, st, stor, doc, root, xml, modelName, model_0;
|
|
stor = (!localStorage_0 && ($clinit_Storage$StorageSupportDetector() , localStorageSupported) && (localStorage_0 = new Storage_0('localStorage')) , localStorage_0);
|
|
if (stor) {
|
|
len = $getLength(stor.storage);
|
|
for (i = 0; i != len; i++) {
|
|
key = $key(stor.storage, i);
|
|
if (!$equals_1(key.substr(0, 11), 'subcircuit:'))
|
|
continue;
|
|
data_0 = $getItem_0(stor.storage, key);
|
|
try {
|
|
if ($equals_1(data_0.substr(0, 1), '<')) {
|
|
doc = ($clinit_XMLParser() , $parse_2(impl_1, data_0));
|
|
root = build(getDocumentElement(doc.jsObject));
|
|
xml = new XMLDeserializer(theApp);
|
|
xml.currentXmlElement = root;
|
|
modelName = $parseStringAttr(xml, 'nm', null);
|
|
model_0 = new CustomCompositeModel;
|
|
model_0.name_0 = modelName;
|
|
$parseXmlElement(model_0, xml);
|
|
$putStringValue(globalModelMap, modelName, model_0);
|
|
++sequenceNumber;
|
|
}
|
|
else {
|
|
firstLine = data_0;
|
|
lineLen = $indexOf_1(data_0, fromCodePoint(10));
|
|
lineLen != -1 && (firstLine = data_0.substr(0, lineLen));
|
|
st = new StringTokenizer_0(firstLine, ' ');
|
|
if ($nextToken(st) == '.') {
|
|
model = undumpModel(st);
|
|
lineLen != -1 && (model.modelCircuit = data_0.substr(lineLen + 1));
|
|
$removeStringValue(localModelMap, model.name_0);
|
|
$putStringValue(globalModelMap, model.name_0, model);
|
|
}
|
|
}
|
|
}
|
|
catch ($e0) {
|
|
$e0 = toJava($e0);
|
|
if (instanceOf($e0, 13)) {
|
|
e = $e0;
|
|
console.log('Exception: ' + e);
|
|
}
|
|
else
|
|
throw toJs($e0);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
function undumpModel(st){
|
|
var model, name_0;
|
|
name_0 = unescape_0($nextToken(st));
|
|
model = getModelWithName(name_0);
|
|
if (!model) {
|
|
model = new CustomCompositeModel;
|
|
model.name_0 = name_0;
|
|
$putStringValue(localModelMap, name_0, model);
|
|
++sequenceNumber;
|
|
}
|
|
else if ($hasStringValue(globalModelMap, name_0) && !$hasStringValue(localModelMap, name_0)) {
|
|
model = new CustomCompositeModel;
|
|
model.name_0 = name_0;
|
|
$putStringValue(localModelMap, name_0, model);
|
|
++sequenceNumber;
|
|
}
|
|
$undump(model, st);
|
|
return model;
|
|
}
|
|
|
|
function undumpModelXml(xml){
|
|
var model, name_0;
|
|
name_0 = $parseStringAttr(xml, 'nm', null);
|
|
model = getModelWithName(name_0);
|
|
if (!model) {
|
|
model = new CustomCompositeModel;
|
|
model.name_0 = name_0;
|
|
$putStringValue(localModelMap, name_0, model);
|
|
++sequenceNumber;
|
|
}
|
|
else if ($hasStringValue(globalModelMap, name_0) && !$hasStringValue(localModelMap, name_0)) {
|
|
model = new CustomCompositeModel;
|
|
model.name_0 = name_0;
|
|
$putStringValue(localModelMap, name_0, model);
|
|
++sequenceNumber;
|
|
}
|
|
$parseXmlElement(model, xml);
|
|
return model;
|
|
}
|
|
|
|
defineClass(189, 1, {189:1, 16:1}, CustomCompositeModel);
|
|
_.compareTo = function compareTo_0(dm){
|
|
return $compareTo(this.name_0, dm.name_0);
|
|
}
|
|
;
|
|
_.builtin = false;
|
|
_.dumped = false;
|
|
_.flags = 0;
|
|
_.internal = false;
|
|
_.sizeX = 0;
|
|
_.sizeY = 0;
|
|
var globalModelMap, localModelMap, sequenceNumber = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_CustomCompositeModel_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'CustomCompositeModel', 189);
|
|
function $setupPins_7(this$static){
|
|
var i;
|
|
if (this$static.modelName == null) {
|
|
this$static.postCount = this$static.bits;
|
|
$allocNodes(this$static);
|
|
return;
|
|
}
|
|
this$static.model = getModelWithName_0(this$static.modelName);
|
|
this$static.inputCount = this$static.model.inputs.length;
|
|
this$static.outputCount = this$static.model.outputs.length;
|
|
this$static.sizeY = this$static.inputCount > this$static.outputCount?this$static.inputCount:this$static.outputCount;
|
|
this$static.sizeY == 0 && (this$static.sizeY = 1);
|
|
this$static.sizeX = 2;
|
|
this$static.postCount = this$static.inputCount + this$static.outputCount;
|
|
this$static.pins = initUnidimensionalArray(Lcom_lushprojects_circuitjs1_client_ChipElm$Pin_2_classLit, $intern_3, 9, this$static.postCount, 0, 1);
|
|
for (i = 0; i != this$static.inputCount; i++) {
|
|
this$static.pins[i] = new ChipElm$Pin(this$static, i, 2, this$static.model.inputs[i]);
|
|
$fixName(this$static.pins[i]);
|
|
}
|
|
for (i = 0; i != this$static.outputCount; i++) {
|
|
this$static.pins[i + this$static.inputCount] = new ChipElm$Pin(this$static, i, 3, this$static.model.outputs[i]);
|
|
this$static.pins[i + this$static.inputCount].output = true;
|
|
$fixName(this$static.pins[i + this$static.inputCount]);
|
|
}
|
|
this$static.lastValues = initUnidimensionalArray(Z_classLit, $intern_95, 7, this$static.postCount, 16, 1);
|
|
this$static.patternValues = initUnidimensionalArray(Z_classLit, $intern_95, 7, 26, 16, 1);
|
|
this$static.highImpedance = initUnidimensionalArray(Z_classLit, $intern_95, 7, this$static.postCount, 16, 1);
|
|
}
|
|
|
|
function $updateModels_1(this$static){
|
|
this$static.model = getModelWithNameOrCopy(this$static.modelName, this$static.model);
|
|
$setupPins_7(this$static);
|
|
$allocNodes(this$static);
|
|
$setPoints_0(this$static);
|
|
}
|
|
|
|
function CustomLogicElm(xx, yy){
|
|
$clinit_ChipElm();
|
|
ChipElm.call(this, xx, yy);
|
|
this.modelName = lastModelName_0;
|
|
$setupPins_7(this);
|
|
}
|
|
|
|
function CustomLogicElm_0(xa, ya, xb, yb, f, st){
|
|
$clinit_ChipElm();
|
|
var i;
|
|
ChipElm_0.call(this, xa, ya, xb, yb, f, st);
|
|
this.modelName = unescape_0($nextToken(st));
|
|
$updateModels_1(this);
|
|
for (i = 0; i != this.postCount; i++) {
|
|
if (this.pins[i].output) {
|
|
this.volts[i] = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.pins[i].value_0 = this.volts[i] > this.highVoltage / 2;
|
|
}
|
|
}
|
|
}
|
|
|
|
defineClass(305, 32, $intern_85, CustomLogicElm, CustomLogicElm_0);
|
|
_.doStep = function doStep_15(){
|
|
var add_0, i, p;
|
|
add_0 = !!this.model && this.model.triState?this.outputCount:0;
|
|
for (i = 0; i != this.postCount; i++) {
|
|
p = this.pins[i];
|
|
if (p.output) {
|
|
$updateVoltageSource(p.voltSource, p.value_0?this.highVoltage:0);
|
|
!!this.model && this.model.triState && $stampResistor(this.nodes[i + add_0], this.nodes[i], this.highImpedance[i]?$intern_97:$intern_83);
|
|
}
|
|
}
|
|
}
|
|
;
|
|
_.dumpXml = function dumpXml_21(doc, elem){
|
|
this.model.dumped || $dumpXml_5(this.model, doc);
|
|
$dumpXml_0(this, elem);
|
|
dumpAttr_1(elem, 'mo', this.modelName);
|
|
}
|
|
;
|
|
_.execute_3 = function execute_20(){
|
|
var i, j, j0, rl, rr, x_0;
|
|
for (i = 0; i != this.model.rulesLeft.arrayList.array.length; i++) {
|
|
rl = $get_4(this.model.rulesLeft, i);
|
|
for (j0 = 0; j0 != rl.length; j0++) {
|
|
x_0 = (checkCriticalStringElementIndex(j0, rl.length) , rl.charCodeAt(j0));
|
|
if (x_0 == 48 || x_0 == 49) {
|
|
if (this.pins[j0].value_0 == (x_0 == 49))
|
|
continue;
|
|
break;
|
|
}
|
|
if (x_0 == 63)
|
|
continue;
|
|
if (x_0 == 43) {
|
|
if (this.pins[j0].value_0 && !this.lastValues[j0])
|
|
continue;
|
|
break;
|
|
}
|
|
if (x_0 == 45) {
|
|
if (!this.pins[j0].value_0 && this.lastValues[j0])
|
|
continue;
|
|
break;
|
|
}
|
|
if (x_0 >= 97 && x_0 <= 122) {
|
|
this.patternValues[x_0 - 97] = this.pins[j0].value_0;
|
|
continue;
|
|
}
|
|
if (x_0 >= 65 && x_0 <= 122) {
|
|
if (this.patternValues[x_0 - 65] != this.pins[j0].value_0)
|
|
break;
|
|
continue;
|
|
}
|
|
}
|
|
if (j0 != rl.length)
|
|
continue;
|
|
rr = $get_4(this.model.rulesRight, i);
|
|
for (j0 = 0; j0 != rr.length; j0++) {
|
|
x_0 = (checkCriticalStringElementIndex(j0, rr.length) , rr.charCodeAt(j0));
|
|
this.highImpedance[j0 + this.inputCount] = false;
|
|
x_0 >= 97 && x_0 <= 122?(this.pins[j0 + this.inputCount].value_0 = this.patternValues[x_0 - 97]):x_0 == 95?(this.highImpedance[j0 + this.inputCount] = true):(this.pins[j0 + this.inputCount].value_0 = x_0 == 49);
|
|
}
|
|
break;
|
|
}
|
|
for (j = 0; j != this.postCount; j++)
|
|
this.lastValues[j] = this.pins[j].value_0;
|
|
}
|
|
;
|
|
_.getChipEditInfo = function getChipEditInfo_7(n){
|
|
var ei;
|
|
if (n == 0) {
|
|
ei = new EditInfo_0('Model Name', 0, -1, -1);
|
|
ei.text_0 = this.modelName;
|
|
ei.noSliders = true;
|
|
return ei;
|
|
}
|
|
if (n == 1) {
|
|
ei = new EditInfo_0('', 0, -1, -1);
|
|
ei.button_0 = new Button_1(LS('Edit Model'));
|
|
return ei;
|
|
}
|
|
return null;
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_28(){
|
|
return 208;
|
|
}
|
|
;
|
|
_.getElmType = function getElmType_4(){
|
|
return 'custom logic';
|
|
}
|
|
;
|
|
_.getInfo_0 = function getInfo_26(arr){
|
|
$getInfo_0(this, arr);
|
|
arr[0] = this.model.infoText;
|
|
}
|
|
;
|
|
_.getInternalNodeCount = function getInternalNodeCount_5(){
|
|
return !!this.model && this.model.triState?this.outputCount:0;
|
|
}
|
|
;
|
|
_.getPostCount_0 = function getPostCount_22(){
|
|
return this.postCount;
|
|
}
|
|
;
|
|
_.getVoltageSourceCount = function getVoltageSourceCount_18(){
|
|
return this.outputCount;
|
|
}
|
|
;
|
|
_.getXmlDumpType = function getXmlDumpType_11(){
|
|
return 'cl';
|
|
}
|
|
;
|
|
_.nonLinear_0 = function nonLinear_5(){
|
|
return !!this.model && this.model.triState;
|
|
}
|
|
;
|
|
_.setChipEditValue = function setChipEditValue_8(n, ei){
|
|
var editDialog, newModelName;
|
|
if (n == 0) {
|
|
newModelName = $getText(ei.textf);
|
|
if ($equals_1(this.modelName, newModelName))
|
|
return;
|
|
this.modelName = lastModelName_0 = $getText(ei.textf);
|
|
this.model = getModelWithNameOrCopy(this.modelName, this.model);
|
|
$setupPins_7(this);
|
|
$allocNodes(this);
|
|
$setPoints_0(this);
|
|
return;
|
|
}
|
|
if (n == 1) {
|
|
editDialog = new EditDialog(this.model, app_0);
|
|
customLogicEditDialog = editDialog;
|
|
!editDialog.resizeHandlerRegistration && (editDialog.resizeHandlerRegistration = addResizeHandler(new DialogBox$1(editDialog)));
|
|
$show(editDialog);
|
|
return;
|
|
}
|
|
}
|
|
;
|
|
_.setupPins = function setupPins_10(){
|
|
$setupPins_7(this);
|
|
}
|
|
;
|
|
_.stamp = function stamp_21(){
|
|
var add_0, i, p;
|
|
add_0 = !!this.model && this.model.triState?this.outputCount:0;
|
|
for (i = 0; i != this.postCount; i++) {
|
|
p = this.pins[i];
|
|
p.output && $stampVoltageSource(ground, this.nodes[i + add_0], p.voltSource);
|
|
}
|
|
}
|
|
;
|
|
_.undumpXml = function undumpXml_23(xml){
|
|
$undumpXml_0(this, xml);
|
|
this.modelName = $parseStringAttr(xml, 'mo', null);
|
|
$updateModels_1(this);
|
|
}
|
|
;
|
|
_.updateModels_0 = function updateModels_1(){
|
|
$updateModels_1(this);
|
|
}
|
|
;
|
|
_.updateModels = function(){
|
|
this.updateModels_0();
|
|
}
|
|
;
|
|
_.inputCount = 0;
|
|
_.outputCount = 0;
|
|
_.postCount = 0;
|
|
var lastModelName_0 = 'default';
|
|
var Lcom_lushprojects_circuitjs1_client_CustomLogicElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'CustomLogicElm', 305);
|
|
function $arrayToList(arr){
|
|
var i, x_0;
|
|
if (arr == null)
|
|
return '';
|
|
if (arr.length == 0)
|
|
return '';
|
|
x_0 = arr[0];
|
|
for (i = 1; i < arr.length; i++)
|
|
x_0 += ',' + arr[i];
|
|
return x_0;
|
|
}
|
|
|
|
function $dumpXml_5(this$static, doc){
|
|
var elem;
|
|
this$static.dumped = true;
|
|
elem = $createElement(doc, 'clm');
|
|
dumpAttr_1(elem, 'nm', this$static.name_0);
|
|
dumpAttr_0(elem, 'f', this$static.flags);
|
|
dumpAttr_1(elem, 'in', $arrayToList(this$static.inputs));
|
|
dumpAttr_1(elem, 'o', $arrayToList(this$static.outputs));
|
|
dumpAttr_1(elem, 'if', this$static.infoText);
|
|
$appendChild_0(elem, $createTextNode(doc, this$static.rules_0));
|
|
$appendChild_0(build(getDocumentElement(doc.jsObject)), elem);
|
|
}
|
|
|
|
function $parseRules(this$static, ei){
|
|
var i, j, lines, newRl, rl, rr, s, s0, used, x_0;
|
|
lines = $split_1(this$static.rules_0, '\n', 0);
|
|
this$static.rulesLeft = new Vector;
|
|
this$static.rulesRight = new Vector;
|
|
this$static.triState = false;
|
|
for (i = 0; i != lines.length; i++) {
|
|
s = $trim(lines[i].toLowerCase());
|
|
if (s.length == 0 || $equals_1(s.substr(0, 1), '#'))
|
|
continue;
|
|
s0 = $split_1($replaceAll(s, ' ', ''), '=', 0);
|
|
if (s0.length != 2) {
|
|
!!ei && (ei.error = 'error on line ' + (i + 1));
|
|
return;
|
|
}
|
|
if (s0[0].length < this$static.inputs.length) {
|
|
!!ei && $setError(ei, 'must have >= ' + this$static.inputs.length + ' digits on left side (line ' + (i + 1) + ')');
|
|
return;
|
|
}
|
|
if (s0[0].length > this$static.inputs.length + this$static.outputs.length) {
|
|
!!ei && $setError(ei, 'must have <= ' + (this$static.inputs.length + this$static.outputs.length) + ' digits on left side (line ' + (i + 1) + ')');
|
|
return;
|
|
}
|
|
if (s0[1].length != this$static.outputs.length) {
|
|
!!ei && $setError(ei, 'must have ' + this$static.outputs.length + ' digits on right side (line ' + (i + 1) + ')');
|
|
return;
|
|
}
|
|
rl = s0[0];
|
|
used = initUnidimensionalArray(Z_classLit, $intern_95, 7, 26, 16, 1);
|
|
newRl = '';
|
|
for (j = 0; j != rl.length; j++) {
|
|
x_0 = (checkCriticalStringElementIndex(j, rl.length) , rl.charCodeAt(j));
|
|
if (x_0 == 63 || x_0 == 43 || x_0 == 45 || x_0 == 48 || x_0 == 49) {
|
|
newRl += String.fromCharCode(x_0);
|
|
continue;
|
|
}
|
|
if (x_0 < 97 || x_0 > 122) {
|
|
!!ei && (ei.error = 'error on line ' + (i + 1));
|
|
return;
|
|
}
|
|
if (used[x_0 - 97]) {
|
|
newRl += String.fromCharCode(x_0 + 65 - 97 & $intern_8);
|
|
continue;
|
|
}
|
|
used[x_0 - 97] = true;
|
|
newRl += String.fromCharCode(x_0);
|
|
}
|
|
rr = s0[1];
|
|
rr.indexOf('_') != -1 && (this$static.triState = true);
|
|
$add_11(this$static.rulesLeft, newRl);
|
|
$add_11(this$static.rulesRight, s0[1]);
|
|
}
|
|
}
|
|
|
|
function CustomLogicModel(){
|
|
this.inputs = $split_1('A,B', ',', 0);
|
|
this.outputs = $split_1('C,D', ',', 0);
|
|
this.rulesLeft = new Vector;
|
|
this.rulesRight = new Vector;
|
|
this.rules_0 = '';
|
|
}
|
|
|
|
function CustomLogicModel_0(copy){
|
|
this.flags = copy.flags;
|
|
this.inputs = copy.inputs;
|
|
this.outputs = copy.outputs;
|
|
this.infoText = copy.infoText;
|
|
this.rules_0 = copy.rules_0;
|
|
this.rulesLeft = copy.rulesLeft;
|
|
this.rulesRight = copy.rulesRight;
|
|
}
|
|
|
|
function clearDumpedFlags_0(){
|
|
var it, pair;
|
|
if (!modelMap)
|
|
return;
|
|
it = new AbstractHashMap$EntrySetIterator((new AbstractHashMap$EntrySet(modelMap)).this$01);
|
|
while (it.hasNext) {
|
|
pair = $next_2(it);
|
|
pair.getValue().dumped = false;
|
|
}
|
|
}
|
|
|
|
function getModelWithName_0(name_0){
|
|
var lm;
|
|
!modelMap && (modelMap = new HashMap);
|
|
lm = $getStringValue(modelMap, name_0);
|
|
if (lm)
|
|
return lm;
|
|
lm = new CustomLogicModel;
|
|
lm.name_0 = name_0;
|
|
lm.infoText = $equals_1(name_0, 'default')?'custom logic':name_0;
|
|
$putStringValue(modelMap, name_0, lm);
|
|
return lm;
|
|
}
|
|
|
|
function getModelWithNameOrCopy(name_0, oldmodel){
|
|
var lm;
|
|
!modelMap && (modelMap = new HashMap);
|
|
lm = $getStringValue(modelMap, name_0);
|
|
if (lm)
|
|
return lm;
|
|
lm = new CustomLogicModel_0(oldmodel);
|
|
lm.name_0 = name_0;
|
|
lm.infoText = name_0;
|
|
$putStringValue(modelMap, name_0, lm);
|
|
return lm;
|
|
}
|
|
|
|
function undumpModelXml_0(xml){
|
|
var model, name_0;
|
|
name_0 = $parseStringAttr(xml, 'nm', null);
|
|
model = getModelWithName_0(name_0);
|
|
model.flags = $parseIntAttr(xml, 'f', model.flags);
|
|
model.inputs = $split_1($parseStringAttr(xml, 'in', null), ',', 0);
|
|
model.outputs = $split_1($parseStringAttr(xml, 'o', null), ',', 0);
|
|
model.infoText = $parseStringAttr(xml, 'if', null);
|
|
model.rules_0 = $trim($parseContents(xml));
|
|
$parseRules(model, null);
|
|
}
|
|
|
|
function unescape_0(s){
|
|
var c, i;
|
|
if ($equals_1(s, '\\0'))
|
|
return '';
|
|
for (i = 0; i < s.length; i++) {
|
|
checkCriticalStringElementIndex(i, s.length);
|
|
if (s.charCodeAt(i) == 92) {
|
|
c = (checkCriticalStringElementIndex(i + 1, s.length) , s.charCodeAt(i + 1));
|
|
c == 110?(s = s.substr(0, i) + '\n' + s.substr(i + 2)):c == 114?(s = s.substr(0, i) + '\r' + s.substr(i + 2)):c == 115?(s = s.substr(0, i) + ' ' + s.substr(i + 2)):c == 112?(s = s.substr(0, i) + '+' + s.substr(i + 2)):c == 113?(s = s.substr(0, i) + '=' + s.substr(i + 2)):c == 104?(s = s.substr(0, i) + '#' + s.substr(i + 2)):c == 97?(s = s.substr(0, i) + '&' + s.substr(i + 2)):(s = s.substr(0, i) + ('' + s.substr(i + 1)));
|
|
}
|
|
}
|
|
return s;
|
|
}
|
|
|
|
defineClass(291, 1, {291:1, 10:1}, CustomLogicModel, CustomLogicModel_0);
|
|
_.getDialogTitle = function getDialogTitle_0(){
|
|
return 'Edit Custom Logic Model';
|
|
}
|
|
;
|
|
_.getEditInfo = function getEditInfo_19(n){
|
|
var ei;
|
|
if (n == 0) {
|
|
ei = new EditInfo_0('Inputs', 0, -1, -1);
|
|
ei.text_0 = $arrayToList(this.inputs);
|
|
return ei;
|
|
}
|
|
if (n == 1) {
|
|
ei = new EditInfo_0('Outputs', 0, -1, -1);
|
|
ei.text_0 = $arrayToList(this.outputs);
|
|
return ei;
|
|
}
|
|
if (n == 2) {
|
|
ei = new EditInfo_0('Info Text', 0, -1, -1);
|
|
ei.text_0 = this.infoText;
|
|
return ei;
|
|
}
|
|
if (n == 3) {
|
|
ei = new EditInfo_0('<a href="customlogic.html" target="_blank">' + LS('Definition') + '<\/a>', 0, -1, -1);
|
|
ei.errorFieldName = 'Definition';
|
|
ei.textArea = new TextArea_0;
|
|
$setVisibleLines(ei.textArea, 5);
|
|
$setText_2(ei.textArea, this.rules_0);
|
|
return ei;
|
|
}
|
|
return null;
|
|
}
|
|
;
|
|
_.setEditValue = function setEditValue_19(n, ei){
|
|
n == 0 && (this.inputs = $split_1($getText(ei.textf), ',', 0));
|
|
n == 1 && (this.outputs = $split_1($getText(ei.textf), ',', 0));
|
|
n == 2 && (this.infoText = $getText(ei.textf));
|
|
if (n == 3) {
|
|
this.rules_0 = $getText(ei.textArea);
|
|
$parseRules(this, ei);
|
|
}
|
|
n == 4 && ($getState(ei.checkbox)?(this.flags |= FLAG_SCHMITT):(this.flags &= ~FLAG_SCHMITT));
|
|
$updateModels(theApp);
|
|
}
|
|
;
|
|
_.dumped = false;
|
|
_.flags = 0;
|
|
_.triState = false;
|
|
var FLAG_SCHMITT = 1, modelMap;
|
|
var Lcom_lushprojects_circuitjs1_client_CustomLogicModel_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'CustomLogicModel', 291);
|
|
function $parseDescription(this$static, desc, ei){
|
|
var coilNum, n, nodeNum, s, secondary, st, tok;
|
|
st = new StringTokenizer_1(desc, ',:+', true);
|
|
this$static.coilCount = this$static.nodeCount = 0;
|
|
while ($hasMoreTokens(st)) {
|
|
s = $nextToken(st);
|
|
s == '+' && --this$static.nodeCount;
|
|
if (s == ',' || s == '+' || s == ':')
|
|
continue;
|
|
this$static.nodeCount += 2;
|
|
++this$static.coilCount;
|
|
}
|
|
if (this$static.coilCount == 0) {
|
|
!!ei && (ei.error = 'no coils defined');
|
|
return false;
|
|
}
|
|
this$static.coilNodes = initUnidimensionalArray(I_classLit, $intern_25, 7, this$static.coilCount, 15, 1);
|
|
this$static.coilInductances = initUnidimensionalArray(D_classLit, $intern_76, 7, this$static.coilCount, 15, 1);
|
|
(this$static.coilCurrents == null || this$static.coilCurrents.length != this$static.coilCount) && (this$static.coilCurrents = initUnidimensionalArray(D_classLit, $intern_76, 7, this$static.coilCount, 15, 1));
|
|
this$static.coilCurCounts = initUnidimensionalArray(D_classLit, $intern_76, 7, this$static.coilCount, 15, 1);
|
|
this$static.coilCurSourceValues = initUnidimensionalArray(D_classLit, $intern_76, 7, this$static.coilCount, 15, 1);
|
|
this$static.coilPolarities = initUnidimensionalArray(D_classLit, $intern_76, 7, this$static.coilCount, 15, 1);
|
|
this$static.nodePoints = $newPointArray(this$static.nodeCount);
|
|
this$static.nodeTaps = $newPointArray(this$static.nodeCount);
|
|
this$static.nodeCurrents = initUnidimensionalArray(D_classLit, $intern_76, 7, this$static.nodeCount, 15, 1);
|
|
this$static.nodeCurCounts = initUnidimensionalArray(D_classLit, $intern_76, 7, this$static.nodeCount, 15, 1);
|
|
st = new StringTokenizer_1(desc, ',:+', true);
|
|
nodeNum = 0;
|
|
coilNum = 0;
|
|
this$static.primaryCoils = 0;
|
|
secondary = false;
|
|
this$static.needDots = false;
|
|
while (true) {
|
|
tok = $nextToken(st);
|
|
try {
|
|
n = __parseAndValidateDouble(tok);
|
|
}
|
|
catch ($e0) {
|
|
$e0 = toJava($e0);
|
|
if (instanceOf($e0, 13)) {
|
|
!!ei && (ei.error = "expected number, got '" + tok + "'");
|
|
return false;
|
|
}
|
|
else
|
|
throw toJs($e0);
|
|
}
|
|
if (n == 0) {
|
|
!!ei && (ei.error = 'turns ratio cannot be zero');
|
|
return false;
|
|
}
|
|
this$static.coilNodes[coilNum] = nodeNum;
|
|
this$static.coilInductances[coilNum] = n * n * this$static.inductance;
|
|
this$static.coilPolarities[coilNum] = 1;
|
|
if (n < 0) {
|
|
this$static.coilPolarities[coilNum] = -1;
|
|
this$static.needDots = true;
|
|
}
|
|
nodeNum += 2;
|
|
++coilNum;
|
|
secondary || (this$static.primaryCoils = coilNum);
|
|
if (!$hasMoreTokens(st))
|
|
break;
|
|
tok = $nextToken(st);
|
|
if (tok == ',')
|
|
continue;
|
|
if (tok == '+') {
|
|
--nodeNum;
|
|
continue;
|
|
}
|
|
if (tok == ':') {
|
|
if (secondary) {
|
|
!!ei && (ei.error = "only one ':' separator allowed");
|
|
return false;
|
|
}
|
|
secondary = true;
|
|
continue;
|
|
}
|
|
!!ei && (ei.error = "unexpected '" + tok + "'");
|
|
return false;
|
|
}
|
|
$allocNodes(this$static);
|
|
$setPoints_8(this$static);
|
|
this$static.xformMatrix = null;
|
|
return true;
|
|
}
|
|
|
|
function $setPoints_8(this$static){
|
|
var c, cd, ce, dotp, h, i, maxWidth, n, nn, offset, primaryNodes, step;
|
|
$setPoints(this$static);
|
|
this$static.point2.y_0 = this$static.point1.y_0;
|
|
this$static.flip = (this$static.flags & 1) != 0?-1:1;
|
|
primaryNodes = this$static.primaryCoils == this$static.coilCount?this$static.nodeCount:this$static.coilNodes[this$static.primaryCoils];
|
|
this$static.dn = $wnd.Math.abs(this$static.point1.x_0 - this$static.point2.x_0);
|
|
ce = 0.5 - 12 / this$static.dn;
|
|
cd = 0.5 - 2 / this$static.dn;
|
|
maxWidth = 0;
|
|
for (step = 0; step != 2; step++) {
|
|
c = 0;
|
|
offset = 0;
|
|
for (i = 0; i != this$static.nodeCount; i++) {
|
|
i == primaryNodes && (offset = 0);
|
|
if (step == 1) {
|
|
(i == primaryNodes - 1 || i == this$static.nodeCount - 1) && (offset = maxWidth);
|
|
$interpPoint_2(this$static.point1, this$static.point2, this$static.nodePoints[i], i < primaryNodes?0:1, -offset * this$static.flip);
|
|
$interpPoint_2(this$static.point1, this$static.point2, this$static.nodeTaps[i], i < primaryNodes?ce:1 - ce, -offset * this$static.flip);
|
|
}
|
|
maxWidth = $wnd.Math.max(maxWidth, offset);
|
|
nn = c < this$static.coilCount?this$static.coilNodes[c]:-1;
|
|
if (nn == i) {
|
|
++c;
|
|
offset += this$static.width_0;
|
|
}
|
|
else {
|
|
offset += 16;
|
|
}
|
|
}
|
|
}
|
|
this$static.ptCore = $newPointArray(4);
|
|
for (i = 0; i != 4; i += 2) {
|
|
h = i == 2?-maxWidth * this$static.flip:0;
|
|
$interpPoint_2(this$static.point1, this$static.point2, this$static.ptCore[i], cd, h);
|
|
$interpPoint_2(this$static.point1, this$static.point2, this$static.ptCore[i + 1], 1 - cd, h);
|
|
}
|
|
if (this$static.needDots) {
|
|
this$static.dots = initUnidimensionalArray(Lcom_lushprojects_circuitjs1_client_Point_2_classLit, $intern_78, 14, this$static.coilCount, 0, 1);
|
|
dotp = $wnd.Math.abs(7 / this$static.width_0);
|
|
for (i = 0; i != this$static.coilCount; i++) {
|
|
n = this$static.coilNodes[i];
|
|
this$static.dots[i] = $interpPoint_0(this$static.nodeTaps[n], this$static.nodeTaps[n + 1], this$static.coilPolarities[i] > 0?dotp:1 - dotp, i < this$static.primaryCoils?-7:7);
|
|
}
|
|
}
|
|
else
|
|
this$static.dots = null;
|
|
}
|
|
|
|
function CustomTransformerElm(xx, yy){
|
|
CircuitElm.call(this, xx, yy);
|
|
this.inductance = 4;
|
|
this.width_0 = 32;
|
|
this.noDiagonal = true;
|
|
this.couplingCoef = 0.999;
|
|
this.description = '1,1:1';
|
|
$parseDescription(this, this.description, null);
|
|
}
|
|
|
|
function CustomTransformerElm_0(xa, ya, xb, yb, f, st){
|
|
var i, str;
|
|
CircuitElm_0.call(this, xa, ya, xb, yb, f);
|
|
this.width_0 = 32;
|
|
this.inductance = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.couplingCoef = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
str = $nextToken(st);
|
|
this.description = unescape_0(str);
|
|
this.coilCount = (new Integer_0($nextToken(st))).value_0;
|
|
this.coilCurrents = initUnidimensionalArray(D_classLit, $intern_76, 7, this.coilCount, 15, 1);
|
|
for (i = 0; i != this.coilCount; i++)
|
|
this.coilCurrents[i] = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.noDiagonal = true;
|
|
$parseDescription(this, this.description, null);
|
|
}
|
|
|
|
defineClass(371, 8, $intern_85, CustomTransformerElm, CustomTransformerElm_0);
|
|
_.calculateCurrent = function calculateCurrent_8(){
|
|
var i, j, n, ni, val, voltdiff;
|
|
for (i = 0; i != this.nodeCount; i++)
|
|
this.nodeCurrents[i] = 0;
|
|
for (i = 0; i != this.coilCount; i++) {
|
|
val = this.coilCurSourceValues[i];
|
|
if (this.xformMatrix != null) {
|
|
for (j = 0; j != this.coilCount; j++) {
|
|
n = this.coilNodes[j];
|
|
voltdiff = this.volts[n] - this.volts[n + 1];
|
|
val += voltdiff * this.xformMatrix[i][j];
|
|
}
|
|
}
|
|
this.coilCurrents[i] = val;
|
|
ni = this.coilNodes[i];
|
|
this.nodeCurrents[ni] += val;
|
|
this.nodeCurrents[ni + 1] -= val;
|
|
}
|
|
}
|
|
;
|
|
_.canFlipXY = function canFlipXY_1(){
|
|
return false;
|
|
}
|
|
;
|
|
_.doStep = function doStep_16(){
|
|
var i, n;
|
|
for (i = 0; i != this.coilCount; i++) {
|
|
n = this.coilNodes[i];
|
|
$stampCurrentSource(this.nodes[n], this.nodes[n + 1], this.coilCurSourceValues[i]);
|
|
}
|
|
}
|
|
;
|
|
_.drag = function drag_2(xx, yy){
|
|
xx = $snapGrid_0(app_0, xx);
|
|
yy = $snapGrid_0(app_0, yy);
|
|
xx == this.x_0 && (yy = this.y_0);
|
|
this.x2 = xx;
|
|
this.y2 = yy;
|
|
$setPoints_8(this);
|
|
}
|
|
;
|
|
_.draw = function draw_21(g){
|
|
var i, n, ni;
|
|
for (i = 0; i != this.nodeCount; i++) {
|
|
$setVoltageColor(this, g, this.volts[i]);
|
|
drawThickLine_0(g, this.nodePoints[i], this.nodeTaps[i], 3);
|
|
}
|
|
for (i = 0; i != this.coilCount; i++) {
|
|
n = this.coilNodes[i];
|
|
$setVoltageColor(this, g, this.volts[n]);
|
|
$setPowerColor(this, g, this.coilCurrents[i] * (this.volts[n] - this.volts[n + 1]));
|
|
$drawCoil(this, g, i >= this.primaryCoils?-6 * this.flip:6 * this.flip, this.nodeTaps[n], this.nodeTaps[n + 1], this.volts[n], this.volts[n + 1]);
|
|
if (this.dots != null) {
|
|
$setColor_0(g, mouseElmRef == this || this.selected_0 || $containsKey(app_0.mouse.scopePlotRoles, this) || instanceOf(mouseElmRef, 21) && $getElm_0(mouseElmRef.elmScope) == this || $isOnHighlightedNet(this)?selectColor_0:lightGrayColor);
|
|
$fillOval(g, this.dots[i].x_0 - 2, this.dots[i].y_0 - 2, 5);
|
|
}
|
|
}
|
|
$setColor_0(g, mouseElmRef == this || this.selected_0 || $containsKey(app_0.mouse.scopePlotRoles, this) || instanceOf(mouseElmRef, 21) && $getElm_0(mouseElmRef.elmScope) == this || $isOnHighlightedNet(this)?selectColor_0:lightGrayColor);
|
|
for (i = 0; i != 2; i++) {
|
|
drawThickLine_0(g, this.ptCore[i], this.ptCore[i + 2], 3);
|
|
}
|
|
for (i = 0; i != this.coilCount; i++) {
|
|
this.coilCurCounts[i] = $updateDotCount(this.coilCurrents[i], this.coilCurCounts[i]);
|
|
ni = this.coilNodes[i];
|
|
$drawDots(g, this.nodeTaps[ni], this.nodeTaps[ni + 1], this.coilCurCounts[i]);
|
|
}
|
|
for (i = 0; i != this.nodeCount; i++) {
|
|
this.nodeCurCounts[i] = $updateDotCount(this.nodeCurrents[i], this.nodeCurCounts[i]);
|
|
$drawDots(g, this.nodePoints[i], this.nodeTaps[i], this.nodeCurCounts[i]);
|
|
}
|
|
$drawPosts(this, g);
|
|
$setBbox_0(this, this.nodePoints[0], this.nodePoints[this.nodeCount - 1], 0);
|
|
$adjustBbox_0(this, this.ptCore[0], this.ptCore[3]);
|
|
}
|
|
;
|
|
_.dumpXml = function dumpXml_22(doc, elem){
|
|
dumpAttr_1(elem, 'x', this.x_0 + ' ' + this.y_0 + ' ' + this.x2 + ' ' + this.y2);
|
|
dumpAttr_0(elem, 'f', this.flags);
|
|
dumpAttr(elem, 'in', this.inductance);
|
|
dumpAttr(elem, 'cc', this.couplingCoef);
|
|
dumpAttr_1(elem, 'ds', this.description);
|
|
dumpAttr_0(elem, 'nc', this.coilCount);
|
|
}
|
|
;
|
|
_.dumpXmlState = function dumpXmlState_5(doc, elem){
|
|
var i, s;
|
|
s = '';
|
|
for (i = 0; i != this.coilCount; i++) {
|
|
i > 0 && (s += ' ');
|
|
s += this.coilCurrents[i];
|
|
}
|
|
dumpAttr_1(elem, 'ci', s);
|
|
}
|
|
;
|
|
_.flipX = function flipX_5(c2, count){
|
|
this.flags ^= 1;
|
|
$flipX(this, c2);
|
|
}
|
|
;
|
|
_.flipY = function flipY_5(c2, count){
|
|
this.flags ^= 1;
|
|
$flipY(this, c2);
|
|
}
|
|
;
|
|
_.getConnection = function getConnection_13(n1, n2){
|
|
var i;
|
|
for (i = 0; i != this.coilCount; i++)
|
|
if ($comparePair(n1, n2, this.coilNodes[i], this.coilNodes[i] + 1))
|
|
return true;
|
|
return false;
|
|
}
|
|
;
|
|
_.getCurrentIntoNode = function getCurrentIntoNode_8(n){
|
|
return -this.nodeCurrents[n];
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_29(){
|
|
return 406;
|
|
}
|
|
;
|
|
_.getEditInfo = function getEditInfo_20(n){
|
|
var ei;
|
|
if (n == 0)
|
|
return $setPositive(new EditInfo_0('Base Inductance (H)', this.inductance, $intern_34, 5));
|
|
if (n == 1) {
|
|
ei = new EditInfo_0('<a href="customtransformer.html" target="_blank">' + LS('Description') + '<\/a>', 0, -1, -1);
|
|
ei.errorFieldName = 'Description';
|
|
ei.text_0 = this.description;
|
|
ei.noSliders = true;
|
|
return ei;
|
|
}
|
|
if (n == 2)
|
|
return $setPositive($setDimensionless(new EditInfo_0('Coupling Coefficient', this.couplingCoef, 0, 1)));
|
|
if (n == 3) {
|
|
ei = new EditInfo_0('', 0, -1, -1);
|
|
ei.checkbox = new Checkbox_0('Trapezoidal Approximation', (this.flags & 2) == 0);
|
|
return ei;
|
|
}
|
|
return null;
|
|
}
|
|
;
|
|
_.getInfo_0 = function getInfo_27(arr){
|
|
var i, ni;
|
|
arr[0] = 'transformer (custom)';
|
|
arr[1] = 'L = ' + getUnitText(this.inductance, 'H', false);
|
|
for (i = 0; i != this.coilCount; i++) {
|
|
if (2 + i * 2 >= arr.length)
|
|
break;
|
|
ni = this.coilNodes[i];
|
|
arr[2 + i * 2] = 'Vd' + (i + 1) + ' = ' + getUnitText(this.volts[ni] - this.volts[ni + 1], 'V', false);
|
|
arr[3 + i * 2] = 'I' + (i + 1) + ' = ' + getUnitText(this.coilCurrents[i], 'A', false);
|
|
}
|
|
}
|
|
;
|
|
_.getMatrixConnection = function getMatrixConnection_3(n1, n2){
|
|
return true;
|
|
}
|
|
;
|
|
_.getPost = function getPost_7(n){
|
|
return this.nodePoints[n];
|
|
}
|
|
;
|
|
_.getPostCount_0 = function getPostCount_23(){
|
|
return this.nodeCount;
|
|
}
|
|
;
|
|
_.reset_0 = function reset_11(){
|
|
var i;
|
|
for (i = 0; i != this.coilCount; i++)
|
|
this.coilCurrents[i] = this.coilCurSourceValues[i] = this.coilCurCounts[i] = 0;
|
|
for (i = 0; i != this.nodeCount; i++)
|
|
this.volts[i] = this.nodeCurrents[i] = this.nodeCurCounts[i] = 0;
|
|
}
|
|
;
|
|
_.setEditValue = function setEditValue_20(n, ei){
|
|
var s;
|
|
if (n == 0 && ei.value_0 > 0) {
|
|
this.inductance = ei.value_0;
|
|
$parseDescription(this, this.description, null);
|
|
}
|
|
if (n == 1) {
|
|
s = $getText(ei.textf);
|
|
if (s != this.description) {
|
|
$parseDescription(this, s, ei)?(this.description = s):$parseDescription(this, this.description, null);
|
|
$setPoints_8(this);
|
|
}
|
|
}
|
|
if (n == 2) {
|
|
if (ei.value_0 > 0 && ei.value_0 < 1) {
|
|
this.couplingCoef = ei.value_0;
|
|
$parseDescription(this, this.description, null);
|
|
}
|
|
else
|
|
ei.error = 'must be > 0 and < 1';
|
|
}
|
|
if (n == 3) {
|
|
$getState(ei.checkbox)?(this.flags &= -3):(this.flags |= 2);
|
|
$parseDescription(this, this.description, null);
|
|
}
|
|
}
|
|
;
|
|
_.setPoints = function setPoints_19(){
|
|
$setPoints_8(this);
|
|
}
|
|
;
|
|
_.stamp = function stamp_22(){
|
|
var i, j, ni, nj, ts;
|
|
this.xformMatrix = initMultidimensionalArray(D_classLit, [$intern_3, $intern_76], [12, 7], 15, [this.coilCount, this.coilCount], 2);
|
|
for (i = 0; i != this.coilCount; i++)
|
|
this.xformMatrix[i][i] = this.coilInductances[i];
|
|
for (i = 0; i != this.coilCount; i++)
|
|
for (j = 0; j != i; j++)
|
|
this.xformMatrix[i][j] = this.xformMatrix[j][i] = this.couplingCoef * $wnd.Math.sqrt(this.coilInductances[i] * this.coilInductances[j]) * this.coilPolarities[i] * this.coilPolarities[j];
|
|
invertMatrix(this.xformMatrix, this.coilCount);
|
|
ts = (this.flags & 2) == 0?sim_0.timeStep / 2:sim_0.timeStep;
|
|
for (i = 0; i != this.coilCount; i++)
|
|
for (j = 0; j != this.coilCount; j++) {
|
|
this.xformMatrix[i][j] *= ts;
|
|
ni = this.coilNodes[i];
|
|
nj = this.coilNodes[j];
|
|
i == j?$stampConductance(this.nodes[ni], this.nodes[ni + 1], this.xformMatrix[i][i]):$stampVCCurrentSource(this.nodes[ni], this.nodes[ni + 1], this.nodes[nj], this.nodes[nj + 1], this.xformMatrix[i][j]);
|
|
}
|
|
for (i = 0; i != this.nodeCount; i++)
|
|
;
|
|
}
|
|
;
|
|
_.startIteration = function startIteration_3(){
|
|
var i, j, n, val, voltdiff;
|
|
for (i = 0; i != this.coilCount; i++) {
|
|
val = this.coilCurrents[i];
|
|
if ((this.flags & 2) == 0) {
|
|
for (j = 0; j != this.coilCount; j++) {
|
|
n = this.coilNodes[j];
|
|
voltdiff = this.volts[n] - this.volts[n + 1];
|
|
val += voltdiff * this.xformMatrix[i][j];
|
|
}
|
|
}
|
|
this.coilCurSourceValues[i] = val;
|
|
}
|
|
}
|
|
;
|
|
_.undumpXml = function undumpXml_24(xml){
|
|
var ci, i, st;
|
|
this.flags = $parseIntAttr(xml, 'f', this.flags);
|
|
this.inductance = $parseDoubleAttr(xml, 'in', this.inductance);
|
|
this.couplingCoef = $parseDoubleAttr(xml, 'cc', this.couplingCoef);
|
|
this.description = $parseStringAttr(xml, 'ds', this.description);
|
|
this.coilCount = $parseIntAttr(xml, 'nc', this.coilCount);
|
|
this.coilCurrents = initUnidimensionalArray(D_classLit, $intern_76, 7, this.coilCount, 15, 1);
|
|
ci = $parseStringAttr(xml, 'ci', null);
|
|
if (ci != null) {
|
|
st = new StringTokenizer_0(ci, ' ');
|
|
for (i = 0; i != this.coilCount && $hasMoreTokens(st); i++)
|
|
this.coilCurrents[i] = __parseAndValidateDouble($nextToken(st));
|
|
}
|
|
$parseDescription(this, this.description, null);
|
|
}
|
|
;
|
|
_.coilCount = 0;
|
|
_.couplingCoef = 0;
|
|
_.flip = 0;
|
|
_.inductance = 0;
|
|
_.needDots = false;
|
|
_.nodeCount = 0;
|
|
_.primaryCoils = 0;
|
|
_.width_0 = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_CustomTransformerElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'CustomTransformerElm', 371);
|
|
function $setupPins_8(this$static){
|
|
var bitsY;
|
|
this$static.sizeX = 2;
|
|
bitsY = this$static.bitOrder == 2?1:this$static.bits > 2?this$static.bits:2;
|
|
this$static.sizeY = bitsY > 2?bitsY:2;
|
|
this$static.pins = initUnidimensionalArray(Lcom_lushprojects_circuitjs1_client_ChipElm$Pin_2_classLit, $intern_3, 9, this$static.bits + 2, 0, 1);
|
|
$makeBitPins(this$static, this$static.bits, 0, 2, 0, 'D', false, false, false);
|
|
this$static.pins[this$static.bits] = new ChipElm$Pin(this$static, 0, 3, 'O');
|
|
this$static.pins[this$static.bits].output = true;
|
|
this$static.pins[this$static.bits + 1] = new ChipElm$Pin(this$static, this$static.sizeY - 1, 3, 'V+');
|
|
$allocNodes(this$static);
|
|
}
|
|
|
|
function DACElm(xx, yy){
|
|
$clinit_ChipElm();
|
|
ChipElm.call(this, xx, yy);
|
|
}
|
|
|
|
function DACElm_0(xa, ya, xb, yb, f, st){
|
|
$clinit_ChipElm();
|
|
ChipElm_0.call(this, xa, ya, xb, yb, f, st);
|
|
}
|
|
|
|
defineClass(411, 32, $intern_85, DACElm, DACElm_0);
|
|
_.allowBus = function allowBus_4(){
|
|
return true;
|
|
}
|
|
;
|
|
_.doStep = function doStep_17(){
|
|
var i, ival, ivalmax, v;
|
|
ival = 0;
|
|
for (i = 0; i != this.bits; i++)
|
|
this.volts[i] > this.highVoltage / 2 && (ival |= 1 << i);
|
|
ivalmax = (1 << this.bits) - 1;
|
|
v = ival * this.volts[this.bits + 1] / ivalmax;
|
|
$updateVoltageSource(this.pins[this.bits].voltSource, v);
|
|
}
|
|
;
|
|
_.getChipEditInfo = function getChipEditInfo_8(n){
|
|
if (n == 0)
|
|
return $setDimensionless(new EditInfo_0('# of Bits', this.bits, 1, 1));
|
|
return null;
|
|
}
|
|
;
|
|
_.getChipName = function getChipName_10(){
|
|
return 'DAC';
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_30(){
|
|
return 166;
|
|
}
|
|
;
|
|
_.getPostCount_0 = function getPostCount_24(){
|
|
return this.bits + 2;
|
|
}
|
|
;
|
|
_.getVoltageSourceCount = function getVoltageSourceCount_19(){
|
|
return 1;
|
|
}
|
|
;
|
|
_.isDigitalChip = function isDigitalChip_3(){
|
|
return false;
|
|
}
|
|
;
|
|
_.needsBits = function needsBits_5(){
|
|
return true;
|
|
}
|
|
;
|
|
_.setChipEditValue = function setChipEditValue_9(n, ei){
|
|
if (n == 0) {
|
|
if (ei.value_0 >= 2) {
|
|
this.bits = round_int(ei.value_0);
|
|
$setupPins_8(this);
|
|
$setPoints_0(this);
|
|
}
|
|
else
|
|
ei.error = 'must be >= 2';
|
|
}
|
|
}
|
|
;
|
|
_.setupPins = function setupPins_11(){
|
|
$setupPins_8(this);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_DACElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'DACElm', 411);
|
|
function $$init_5(this$static){
|
|
this$static.voltSources = initUnidimensionalArray(Lcom_lushprojects_circuitjs1_client_VoltageSource_2_classLit, $intern_3, 136, 2, 0, 1);
|
|
}
|
|
|
|
function $interpPointFix(a, b, c, f, g){
|
|
var gx, gy;
|
|
gx = b.y_0 - a.y_0;
|
|
gy = a.x_0 - b.x_0;
|
|
c.x_0 = toInt_0(fromDouble_0($wnd.Math.round(a.x_0 * (1 - f) + b.x_0 * f + g * gx)));
|
|
c.y_0 = toInt_0(fromDouble_0($wnd.Math.round(a.y_0 * (1 - f) + b.y_0 * f + g * gy)));
|
|
}
|
|
|
|
function DCMotorElm(xx, yy){
|
|
CircuitElm.call(this, xx, yy);
|
|
$$init_5(this);
|
|
this.ind = new Inductor(sim_0);
|
|
this.indInertia = new Inductor(sim_0);
|
|
this.inductance = 0.5;
|
|
this.resistance = 1;
|
|
this.angle = $intern_89;
|
|
this.speed = 0;
|
|
this.K = 0.15;
|
|
this.b = 0.05;
|
|
this.J = $intern_36;
|
|
this.Kb = 0.15;
|
|
this.gearRatio = 1;
|
|
this.tau = 0;
|
|
$setup_1(this.ind, this.inductance, 0, 2);
|
|
$setup_1(this.indInertia, this.J, 0, 2);
|
|
}
|
|
|
|
function DCMotorElm_0(xa, ya, xb, yb, f, st){
|
|
CircuitElm_0.call(this, xa, ya, xb, yb, f);
|
|
$$init_5(this);
|
|
this.angle = $intern_89;
|
|
this.speed = 0;
|
|
this.inductance = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.resistance = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.K = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.Kb = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.J = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.b = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.gearRatio = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.tau = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.ind = new Inductor(sim_0);
|
|
this.indInertia = new Inductor(sim_0);
|
|
$setup_1(this.ind, this.inductance, 0, 2);
|
|
$setup_1(this.indInertia, this.J, 0, 2);
|
|
}
|
|
|
|
function drawThickerLine(g, pa, pb){
|
|
g.context.lineWidth = 6;
|
|
$drawLine(g, pa.x_0, pa.y_0, pb.x_0, pb.y_0);
|
|
g.context.lineWidth = 1;
|
|
}
|
|
|
|
defineClass(372, 8, $intern_85, DCMotorElm, DCMotorElm_0);
|
|
_.calculateCurrent = function calculateCurrent_9(){
|
|
this.coilCurrent = $calculateCurrent_1(this.ind, this.volts[0] - this.volts[2]);
|
|
this.inertiaCurrent = $calculateCurrent_1(this.indInertia, this.volts[4] - this.volts[5]);
|
|
this.speed = this.inertiaCurrent;
|
|
}
|
|
;
|
|
_.doStep = function doStep_18(){
|
|
$updateVoltageSource(this.voltSources[1], this.coilCurrent * this.K);
|
|
$updateVoltageSource(this.voltSources[0], this.inertiaCurrent * this.Kb);
|
|
$doStep_1(this.ind);
|
|
$doStep_1(this.indInertia);
|
|
}
|
|
;
|
|
_.draw = function draw_22(g){
|
|
var angleAux, cc;
|
|
$setBbox_0(this, this.point1, this.point2, 18);
|
|
$draw2Leads(this, g);
|
|
this.curcount_0 = $updateDotCount(this.current_0, this.curcount_0);
|
|
app_0.mouse.dragElm == this || $drawDots(g, this.point1, this.point2, this.curcount_0);
|
|
$setPowerColor_0(this, g);
|
|
cc = new Color(165, 165, 165);
|
|
$setColor_0(g, cc);
|
|
$fillOval(g, this.motorCenter.x_0 - 18, this.motorCenter.y_0 - 18, 36);
|
|
cc = new Color(10, 10, 10);
|
|
$setColor_0(g, cc);
|
|
angleAux = toDouble_0(fromDouble_0($wnd.Math.round(this.angle * 300))) / 300;
|
|
$fillOval(g, this.motorCenter.x_0 - 8, this.motorCenter.y_0 - 8, 16);
|
|
$setColor_0(g, cc);
|
|
$interpPointFix(this.lead1, this.lead2, ps1, 0.5 + 0.28 * $wnd.Math.cos(angleAux * this.gearRatio), 0.28 * $wnd.Math.sin(angleAux * this.gearRatio));
|
|
$interpPointFix(this.lead1, this.lead2, ps2, 0.5 - 0.28 * $wnd.Math.cos(angleAux * this.gearRatio), -0.28 * $wnd.Math.sin(angleAux * this.gearRatio));
|
|
drawThickerLine(g, ps1, ps2);
|
|
$interpPointFix(this.lead1, this.lead2, ps1, 0.5 + 0.28 * $wnd.Math.cos(angleAux * this.gearRatio + $intern_106), 0.28 * $wnd.Math.sin(angleAux * this.gearRatio + $intern_106));
|
|
$interpPointFix(this.lead1, this.lead2, ps2, 0.5 - 0.28 * $wnd.Math.cos(angleAux * this.gearRatio + $intern_106), -0.28 * $wnd.Math.sin(angleAux * this.gearRatio + $intern_106));
|
|
drawThickerLine(g, ps1, ps2);
|
|
$interpPointFix(this.lead1, this.lead2, ps1, 0.5 + 0.28 * $wnd.Math.cos(angleAux * this.gearRatio + $intern_107), 0.28 * $wnd.Math.sin(angleAux * this.gearRatio + $intern_107));
|
|
$interpPointFix(this.lead1, this.lead2, ps2, 0.5 - 0.28 * $wnd.Math.cos(angleAux * this.gearRatio + $intern_107), -0.28 * $wnd.Math.sin(angleAux * this.gearRatio + $intern_107));
|
|
drawThickerLine(g, ps1, ps2);
|
|
$drawPosts(this, g);
|
|
}
|
|
;
|
|
_.dumpXml = function dumpXml_23(doc, elem){
|
|
dumpAttr_1(elem, 'x', this.x_0 + ' ' + this.y_0 + ' ' + this.x2 + ' ' + this.y2);
|
|
dumpAttr_0(elem, 'f', this.flags);
|
|
dumpAttr(elem, 'in', this.inductance);
|
|
dumpAttr(elem, 'rs', this.resistance);
|
|
dumpAttr(elem, 'k', this.K);
|
|
dumpAttr(elem, 'kb', this.Kb);
|
|
dumpAttr(elem, 'j', this.J);
|
|
dumpAttr(elem, 'b', this.b);
|
|
dumpAttr(elem, 'gr', this.gearRatio);
|
|
dumpAttr(elem, 'ta', this.tau);
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_31(){
|
|
return 415;
|
|
}
|
|
;
|
|
_.getEditInfo = function getEditInfo_21(n){
|
|
if (n == 0)
|
|
return $setPositive(new EditInfo_0('Armature inductance (H)', this.inductance, 0, 0));
|
|
if (n == 1)
|
|
return $setPositive(new EditInfo_0('Armature Resistance (ohms)', this.resistance, 0, 0));
|
|
if (n == 2)
|
|
return $setPositive(new EditInfo_0('Torque constant (Nm/A)', this.K, 0, 0));
|
|
if (n == 3)
|
|
return $setPositive(new EditInfo_0('Moment of inertia (Kg.m^2)', this.J, 0, 0));
|
|
if (n == 4)
|
|
return $setPositive(new EditInfo_0('Friction coefficient (Nms/rad)', this.b, 0, 0));
|
|
if (n == 5)
|
|
return $setPositive(new EditInfo_0('Gear Ratio', this.gearRatio, 0, 0));
|
|
return null;
|
|
}
|
|
;
|
|
_.getInfo_0 = function getInfo_28(arr){
|
|
arr[0] = 'DC Motor';
|
|
arr[1] = 'I = ' + getUnitText($wnd.Math.abs(this.current_0), 'A', false);
|
|
arr[2] = 'Vd = ' + getUnitText($wnd.Math.abs(this.volts[0] - this.volts[1]), 'V', false);
|
|
arr[3] = LS('speed') + ' = ' + getUnitText(60 * $wnd.Math.abs(this.speed) / $intern_2, LS('RPM'), false);
|
|
arr[4] = 'L = ' + getUnitText(this.inductance, 'H', false);
|
|
arr[5] = 'R = ' + getUnitText(this.resistance, ohmString, false);
|
|
arr[6] = 'P = ' + getUnitText((this.volts[0] - this.volts[1]) * this.current_0, 'W', false);
|
|
}
|
|
;
|
|
_.getInternalNodeCount = function getInternalNodeCount_6(){
|
|
return 4;
|
|
}
|
|
;
|
|
_.getPostCount_0 = function getPostCount_25(){
|
|
return 2;
|
|
}
|
|
;
|
|
_.getVoltageSourceCount = function getVoltageSourceCount_20(){
|
|
return 2;
|
|
}
|
|
;
|
|
_.reset_0 = function reset_12(){
|
|
$reset(this);
|
|
$resetTo(this.ind, 0);
|
|
$resetTo(this.indInertia, 0);
|
|
this.coilCurrent = 0;
|
|
this.inertiaCurrent = 0;
|
|
}
|
|
;
|
|
_.setCurrent = function setCurrent_5(vs, c){
|
|
vs == this.voltSources[0] && (this.current_0 = c);
|
|
}
|
|
;
|
|
_.setEditValue = function setEditValue_21(n, ei){
|
|
if (n == 0 && ei.value_0 > 0) {
|
|
this.inductance = ei.value_0;
|
|
$setup_1(this.ind, this.inductance, this.current_0, 2);
|
|
}
|
|
n == 1 && ei.value_0 > 0 && (this.resistance = ei.value_0);
|
|
if (n == 2 && ei.value_0 > 0) {
|
|
this.K = ei.value_0;
|
|
this.Kb = this.K;
|
|
}
|
|
if (n == 3 && ei.value_0 > 0) {
|
|
this.J = ei.value_0;
|
|
$setup_1(this.indInertia, this.J, this.inertiaCurrent, 2);
|
|
}
|
|
n == 4 && ei.value_0 > 0 && (this.b = ei.value_0);
|
|
n == 5 && ei.value_0 > 0 && (this.gearRatio = ei.value_0);
|
|
}
|
|
;
|
|
_.setPoints = function setPoints_20(){
|
|
$setPoints(this);
|
|
$calcLeads(this, 36);
|
|
this.motorCenter = $interpPoint(this.point1, this.point2, 0.5);
|
|
$allocNodes(this);
|
|
}
|
|
;
|
|
_.setVoltageSource = function setVoltageSource_10(n, v){
|
|
this.voltSources[n] = v;
|
|
n == 0?$setNodes(v, this.nodes[3], this.nodes[1]):$setNodes(v, this.nodes[4], ground);
|
|
}
|
|
;
|
|
_.stamp = function stamp_23(){
|
|
$stamp_2(this.ind, this.nodes[0], this.nodes[2]);
|
|
$stampResistor(this.nodes[2], this.nodes[3], this.resistance);
|
|
$stampVoltageSource(this.nodes[3], this.nodes[1], this.voltSources[0]);
|
|
$stamp_2(this.indInertia, this.nodes[4], this.nodes[5]);
|
|
$stampResistor(this.nodes[5], ground, this.b);
|
|
$stampVoltageSource(this.nodes[4], ground, this.voltSources[1]);
|
|
}
|
|
;
|
|
_.startIteration = function startIteration_4(){
|
|
$startIteration_0(this.ind, this.volts[0] - this.volts[2]);
|
|
$startIteration_0(this.indInertia, this.volts[4] - this.volts[5]);
|
|
this.angle = this.angle + this.speed * sim_0.timeStep;
|
|
}
|
|
;
|
|
_.undumpXml = function undumpXml_25(xml){
|
|
this.flags = $parseIntAttr(xml, 'f', this.flags);
|
|
this.inductance = $parseDoubleAttr(xml, 'in', this.inductance);
|
|
this.resistance = $parseDoubleAttr(xml, 'rs', this.resistance);
|
|
this.K = $parseDoubleAttr(xml, 'k', this.K);
|
|
this.Kb = $parseDoubleAttr(xml, 'kb', this.Kb);
|
|
this.J = $parseDoubleAttr(xml, 'j', this.J);
|
|
this.b = $parseDoubleAttr(xml, 'b', this.b);
|
|
this.gearRatio = $parseDoubleAttr(xml, 'gr', this.gearRatio);
|
|
this.tau = $parseDoubleAttr(xml, 'ta', this.tau);
|
|
this.ind = new Inductor(sim_0);
|
|
this.indInertia = new Inductor(sim_0);
|
|
$setup_1(this.ind, this.inductance, 0, 2);
|
|
$setup_1(this.indInertia, this.J, 0, 2);
|
|
}
|
|
;
|
|
_.J = 0;
|
|
_.K = 0;
|
|
_.Kb = 0;
|
|
_.angle = 0;
|
|
_.b = 0;
|
|
_.coilCurrent = 0;
|
|
_.gearRatio = 0;
|
|
_.inductance = 0;
|
|
_.inertiaCurrent = 0;
|
|
_.resistance = 0;
|
|
_.speed = 0;
|
|
_.tau = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_DCMotorElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'DCMotorElm', 372);
|
|
function DCVoltageElm(xx, yy){
|
|
VoltageElm.call(this, xx, yy, 0);
|
|
}
|
|
|
|
defineClass(363, 56, $intern_91, DCVoltageElm);
|
|
_.getDumpClass = function getDumpClass_4(){
|
|
return Lcom_lushprojects_circuitjs1_client_VoltageElm_2_classLit;
|
|
}
|
|
;
|
|
_.getShortcut = function getShortcut_11(){
|
|
return 118;
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_DCVoltageElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'DCVoltageElm', 363);
|
|
function $setupPins_9(this$static){
|
|
this$static.sizeX = 2;
|
|
this$static.sizeY = 3;
|
|
this$static.pins = initUnidimensionalArray(Lcom_lushprojects_circuitjs1_client_ChipElm$Pin_2_classLit, $intern_3, 9, 4 + ((this$static.flags & 2) != 0 || (this$static.flags & 4) != 0?1:0) + ((this$static.flags & 4) != 0?1:0), 0, 1);
|
|
this$static.pins[0] = new ChipElm$Pin(this$static, 0, 2, 'D');
|
|
this$static.pins[1] = new ChipElm$Pin(this$static, 0, 3, 'Q');
|
|
this$static.pins[1].output = this$static.pins[1].state = true;
|
|
this$static.pins[2] = new ChipElm$Pin(this$static, (this$static.flags & 4) != 0?1:2, 3, 'Q');
|
|
this$static.pins[2].output = true;
|
|
this$static.pins[2].lineOver = true;
|
|
this$static.pins[3] = new ChipElm$Pin(this$static, 1, 2, '');
|
|
this$static.pins[3].clock = true;
|
|
if ((this$static.flags & 4) != 0) {
|
|
this$static.pins[5] = new ChipElm$Pin(this$static, 2, 2, 'S');
|
|
this$static.pins[4] = new ChipElm$Pin(this$static, 2, 3, 'R');
|
|
this$static.pins[4].bubble = this$static.pins[5].bubble = (this$static.flags & 8) != 0;
|
|
}
|
|
else {
|
|
if ((this$static.flags & 2) != 0 || (this$static.flags & 4) != 0) {
|
|
this$static.pins[4] = new ChipElm$Pin(this$static, 2, 2, 'R');
|
|
this$static.pins[4].bubble = (this$static.flags & 8) != 0;
|
|
}
|
|
}
|
|
}
|
|
|
|
function DFlipFlopElm(xx, yy){
|
|
$clinit_ChipElm();
|
|
ChipElm.call(this, xx, yy);
|
|
this.pins[2].value_0 = !this.pins[1].value_0;
|
|
}
|
|
|
|
function DFlipFlopElm_0(xa, ya, xb, yb, f, st){
|
|
$clinit_ChipElm();
|
|
ChipElm_0.call(this, xa, ya, xb, yb, f, st);
|
|
this.pins[2].value_0 = !this.pins[1].value_0;
|
|
this.justLoaded = true;
|
|
}
|
|
|
|
defineClass(446, 32, $intern_85, DFlipFlopElm, DFlipFlopElm_0);
|
|
_.execute_3 = function execute_21(){
|
|
var isReset, isSet;
|
|
if (this.justLoaded) {
|
|
this.justLoaded = false;
|
|
return;
|
|
}
|
|
isSet = false;
|
|
isReset = false;
|
|
(this.flags & 4) != 0 && this.pins[5].value_0 != ((this.flags & 8) != 0) && (isSet = true);
|
|
((this.flags & 2) != 0 || (this.flags & 4) != 0) && this.pins[4].value_0 != ((this.flags & 8) != 0) && (isReset = true);
|
|
if (isSet || isReset) {
|
|
this.pins[1].output || (console.log('pin 1 is not an output!') , undefined);
|
|
this.pins[1].value_0 = false;
|
|
this.pins[2].output || (console.log('pin 2 is not an output!') , undefined);
|
|
this.pins[2].value_0 = false;
|
|
isSet && (this.pins[1].output || (console.log('pin 1 is not an output!') , undefined) , this.pins[1].value_0 = true);
|
|
isReset && (this.pins[2].output || (console.log('pin 2 is not an output!') , undefined) , this.pins[2].value_0 = true);
|
|
}
|
|
else {
|
|
this.pins[3].value_0 && !this.lastClock && $writeOutput(this, 1, this.pins[0].value_0);
|
|
$writeOutput(this, 2, !this.pins[1].value_0);
|
|
}
|
|
this.lastClock = this.pins[3].value_0;
|
|
}
|
|
;
|
|
_.getChipEditInfo = function getChipEditInfo_9(n){
|
|
var ei;
|
|
if (n == 0) {
|
|
ei = new EditInfo_0('', 0, -1, -1);
|
|
ei.checkbox = new Checkbox_0('Reset Pin', (this.flags & 2) != 0 || (this.flags & 4) != 0);
|
|
return ei;
|
|
}
|
|
if (n == 1) {
|
|
ei = new EditInfo_0('', 0, -1, -1);
|
|
ei.checkbox = new Checkbox_0('Set Pin', (this.flags & 4) != 0);
|
|
return ei;
|
|
}
|
|
if (n == 2) {
|
|
ei = new EditInfo_0('', 0, -1, -1);
|
|
ei.checkbox = new Checkbox_0('Invert Set/Reset', (this.flags & 8) != 0);
|
|
return ei;
|
|
}
|
|
return null;
|
|
}
|
|
;
|
|
_.getChipName = function getChipName_11(){
|
|
return 'D flip-flop';
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_32(){
|
|
return 155;
|
|
}
|
|
;
|
|
_.getPostCount_0 = function getPostCount_26(){
|
|
return 4 + ((this.flags & 2) != 0 || (this.flags & 4) != 0?1:0) + ((this.flags & 4) != 0?1:0);
|
|
}
|
|
;
|
|
_.getVoltageSourceCount = function getVoltageSourceCount_21(){
|
|
return 2;
|
|
}
|
|
;
|
|
_.reset_0 = function reset_13(){
|
|
$reset_0(this);
|
|
this.volts[2] = this.highVoltage;
|
|
this.pins[2].value_0 = true;
|
|
}
|
|
;
|
|
_.setChipEditValue = function setChipEditValue_10(n, ei){
|
|
if (n == 0) {
|
|
$getState(ei.checkbox)?(this.flags |= 2):(this.flags &= -3);
|
|
$setupPins_9(this);
|
|
$allocNodes(this);
|
|
$setPoints_0(this);
|
|
}
|
|
if (n == 1) {
|
|
$getState(ei.checkbox)?(this.flags |= 4):(this.flags &= -5);
|
|
$setupPins_9(this);
|
|
$allocNodes(this);
|
|
$setPoints_0(this);
|
|
}
|
|
if (n == 2) {
|
|
this.flags = $changeFlag(ei, this.flags, 8);
|
|
$setupPins_9(this);
|
|
$setPoints_0(this);
|
|
}
|
|
}
|
|
;
|
|
_.setupPins = function setupPins_12(){
|
|
$setupPins_9(this);
|
|
}
|
|
;
|
|
_.justLoaded = false;
|
|
var Lcom_lushprojects_circuitjs1_client_DFlipFlopElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'DFlipFlopElm', 446);
|
|
function $ensureArrays_0(this$static){
|
|
if (this$static.voltageSources == null || this$static.voltageSources.length != this$static.poleCount) {
|
|
this$static.voltageSources = initUnidimensionalArray(Lcom_lushprojects_circuitjs1_client_VoltageSource_2_classLit, $intern_3, 136, this$static.poleCount, 0, 1);
|
|
this$static.currents = initUnidimensionalArray(D_classLit, $intern_76, 7, this$static.poleCount, 15, 1);
|
|
this$static.curcounts = initUnidimensionalArray(D_classLit, $intern_76, 7, this$static.poleCount, 15, 1);
|
|
}
|
|
}
|
|
|
|
function $flip(this$static){
|
|
this$static.dx == 0 && (this$static.x_0 = this$static.x2 = this$static.x_0 - round_int(this$static.dpx1 * 16 * 3));
|
|
this$static.dy == 0 && (this$static.y_0 = this$static.y2 = this$static.y_0 - round_int(this$static.dpy1 * 16 * 3));
|
|
this$static.position = 1 - this$static.position;
|
|
}
|
|
|
|
function $setPoints_9(this$static){
|
|
var i, offset;
|
|
$setPoints_3(this$static);
|
|
$calcLeads(this$static, 32);
|
|
$ensureArrays_0(this$static);
|
|
this$static.throwPosts = $newPointArray(2 * this$static.poleCount);
|
|
this$static.throwLeads = $newPointArray(4 * this$static.poleCount);
|
|
this$static.poleLeads = $newPointArray(this$static.poleCount);
|
|
this$static.polePosts = $newPointArray(this$static.poleCount);
|
|
this$static.linePoints = $newPointArray(2);
|
|
for (i = 0; i != this$static.poleCount; i++) {
|
|
offset = -i * 16 * 3;
|
|
$interpPoint_2(this$static.point1, this$static.point2, this$static.polePosts[i], 0, offset);
|
|
$interpPoint_2(this$static.lead1, this$static.lead2, this$static.poleLeads[i], 0, offset);
|
|
$interpPoint_2(this$static.point1, this$static.point2, this$static.throwPosts[i * 2], 1, offset - 16);
|
|
$interpPoint_2(this$static.lead1, this$static.lead2, this$static.throwLeads[i * 4], 1, offset - 16);
|
|
$interpPoint_2(this$static.point1, this$static.point2, this$static.throwPosts[i * 2 + 1], 1, offset + 16);
|
|
$interpPoint_2(this$static.lead1, this$static.lead2, this$static.throwLeads[i * 4 + 1], 1, offset + 16);
|
|
$interpPoint_2(this$static.lead1, this$static.lead2, this$static.throwLeads[i * 4 + 2], 1, offset + 5.28);
|
|
(this$static.flags & 2) != 0?$interpPoint_2(this$static.lead1, this$static.lead2, this$static.throwLeads[i * 4 + 3], 1.2, offset - 5.28):$interpPoint_2(this$static.lead1, this$static.lead2, this$static.throwLeads[i * 4 + 3], 1, offset - 16);
|
|
}
|
|
}
|
|
|
|
function DPDTSwitchElm(xx, yy){
|
|
SwitchElm_1.call(this, xx, yy, false);
|
|
this.noDiagonal = true;
|
|
this.poleCount = 2;
|
|
}
|
|
|
|
function DPDTSwitchElm_0(xa, ya, xb, yb, f, st){
|
|
SwitchElm_0.call(this, xa, ya, xb, yb, f, st);
|
|
try {
|
|
this.poleCount = (new Integer_0($nextToken(st))).value_0;
|
|
}
|
|
catch ($e0) {
|
|
$e0 = toJava($e0);
|
|
if (!instanceOf($e0, 13))
|
|
throw toJs($e0);
|
|
}
|
|
this.noDiagonal = true;
|
|
}
|
|
|
|
defineClass(414, 61, $intern_100, DPDTSwitchElm, DPDTSwitchElm_0);
|
|
_.calculateCurrent = function calculateCurrent_10(){
|
|
var i;
|
|
if (this.resistance > 0)
|
|
for (i = 0; i != this.poleCount; i++)
|
|
this.currents[i] = (this.volts[i * 3] - this.volts[i * 3 + 1 + this.position]) / this.resistance;
|
|
}
|
|
;
|
|
_.draw = function draw_23(g){
|
|
var i, offset;
|
|
$setBbox_0(this, this.point1, this.point2, 1);
|
|
$adjustBbox_0(this, this.throwPosts[1], this.throwPosts[this.poleCount * 2 - 2]);
|
|
for (i = 0; i != this.poleCount; i++) {
|
|
$setVoltageColor(this, g, this.volts[i * 3]);
|
|
drawThickLine_0(g, this.polePosts[i], this.poleLeads[i], 3);
|
|
$setVoltageColor(this, g, this.volts[i * 3 + 1]);
|
|
drawThickLine_0(g, this.throwPosts[i * 2], this.throwLeads[i * 4], 3);
|
|
(this.flags & 2) != 0 && drawThickLine_0(g, this.throwLeads[i * 4], this.throwLeads[i * 4 + 2], 3);
|
|
$setVoltageColor(this, g, this.volts[i * 3 + 2]);
|
|
drawThickLine_0(g, this.throwPosts[i * 2 + 1], this.throwLeads[i * 4 + 1], 3);
|
|
mouseElmRef == this || this.selected_0 || $containsKey(app_0.mouse.scopePlotRoles, this) || instanceOf(mouseElmRef, 21) && $getElm_0(mouseElmRef.elmScope) == this || $isOnHighlightedNet(this) || $setColor_0(g, ($clinit_Color() , lightGray));
|
|
if (i < this.poleCount - 1) {
|
|
offset = -i * 16 * 3;
|
|
$interpPoint_2(this.point1, this.point2, this.linePoints[0], 0.5, offset - 16 * (0.5 - this.position) - 4 * this.position);
|
|
$interpPoint_2(this.point1, this.point2, this.linePoints[1], 0.5, offset - 48 - 16 * (0.5 - this.position) + 3 + 8 * (1 - this.position));
|
|
setLineDash(g.context, 4, 4);
|
|
$drawLine_0(g, this.linePoints[0], this.linePoints[1]);
|
|
setLineDash(g.context, 0, 0);
|
|
}
|
|
mouseElmRef == this || this.selected_0 || $containsKey(app_0.mouse.scopePlotRoles, this) || instanceOf(mouseElmRef, 21) && $getElm_0(mouseElmRef.elmScope) == this || $isOnHighlightedNet(this) || $setColor_0(g, whiteColor);
|
|
drawThickLine_0(g, this.poleLeads[i], this.throwLeads[i * 4 + 3 - this.position * 2], 3);
|
|
this.curcounts[i] = $updateDotCount(this.currents[i], this.curcounts[i]);
|
|
$drawDots(g, this.polePosts[i], this.poleLeads[i], this.curcounts[i]);
|
|
$drawDots(g, this.throwLeads[i * 4 + this.position], this.throwPosts[i * 2 + this.position], this.curcounts[i]);
|
|
}
|
|
$drawPosts(this, g);
|
|
}
|
|
;
|
|
_.dumpXml = function dumpXml_24(doc, elem){
|
|
$dumpXml_2(this, elem);
|
|
dumpAttr_0(elem, 'po', this.poleCount);
|
|
}
|
|
;
|
|
_.flipX = function flipX_6(c2, count){
|
|
$flip(this);
|
|
$flipX(this, c2);
|
|
}
|
|
;
|
|
_.flipXY = function flipXY_4(c2, count){
|
|
$flip(this);
|
|
$flipXY(this, c2);
|
|
}
|
|
;
|
|
_.flipY = function flipY_6(c2, count){
|
|
$flip(this);
|
|
$flipY(this, c2);
|
|
}
|
|
;
|
|
_.getConnection = function getConnection_14(n1, n2){
|
|
var i;
|
|
for (i = 0; i != this.poleCount; i++)
|
|
if ($comparePair(n1, n2, i * 3, i * 3 + 1 + this.position))
|
|
return true;
|
|
return false;
|
|
}
|
|
;
|
|
_.getCurrentIntoNode = function getCurrentIntoNode_9(n){
|
|
var n3, t;
|
|
t = n / 3 | 0;
|
|
n3 = n % 3;
|
|
if (n3 == 0)
|
|
return -this.currents[t];
|
|
if (n3 == this.position + 1)
|
|
return this.currents[t];
|
|
return 0;
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_33(){
|
|
return 429;
|
|
}
|
|
;
|
|
_.getEditInfo = function getEditInfo_22(n){
|
|
var ei;
|
|
if (n == 0)
|
|
return $setDimensionless(new EditInfo_0('# of Poles', this.poleCount, 2, 10));
|
|
if (n == 1)
|
|
return createCheckbox('IEC Symbol', (this.flags & 2) != 0);
|
|
if (n == 2)
|
|
return new EditInfo_1('Keyboard Shortcut', this.keyShortcut == null?'':this.keyShortcut);
|
|
if (n == 3) {
|
|
ei = new EditInfo('On Resistance (ohms)', this.resistance);
|
|
ei.nonNegative = true;
|
|
return ei;
|
|
}
|
|
return null;
|
|
}
|
|
;
|
|
_.getElmType = function getElmType_5(){
|
|
return 'switch (DPDT)';
|
|
}
|
|
;
|
|
_.getInfo_0 = function getInfo_29(arr){
|
|
var i;
|
|
arr[0] = this.poleCount == 2?'switch (DPDT)':'switch (' + this.poleCount + 'PDT)';
|
|
for (i = 0; i != this.poleCount; i++)
|
|
arr[i + 1] = 'I' + (i + 1) + ' = ' + getUnitText($wnd.Math.abs(this.currents[i]), 'A', false);
|
|
}
|
|
;
|
|
_.getPost = function getPost_8(n){
|
|
var n3, t;
|
|
t = n / 3 | 0;
|
|
n3 = n % 3;
|
|
if (n3 == 0)
|
|
return this.polePosts[t];
|
|
return this.throwPosts[t * 2 + n3 - 1];
|
|
}
|
|
;
|
|
_.getPostCount_0 = function getPostCount_27(){
|
|
return 3 * this.poleCount;
|
|
}
|
|
;
|
|
_.getShortcut = function getShortcut_12(){
|
|
return 0;
|
|
}
|
|
;
|
|
_.getSwitchRect = function getSwitchRect_2(){
|
|
return $union($union(new Rectangle_1(this.poleLeads[0]), new Rectangle_1(this.throwLeads[1])), new Rectangle_1(this.throwLeads[this.poleCount * 4 - 4]));
|
|
}
|
|
;
|
|
_.getVoltageSourceCount = function getVoltageSourceCount_22(){
|
|
return this.resistance > 0?0:this.poleCount;
|
|
}
|
|
;
|
|
_.getXmlDumpType = function getXmlDumpType_12(){
|
|
return 'dpdt';
|
|
}
|
|
;
|
|
_.isRemovableWire = function isRemovableWire_4(){
|
|
return false;
|
|
}
|
|
;
|
|
_.isWireEquivalent = function isWireEquivalent_5(){
|
|
return this.resistance == 0;
|
|
}
|
|
;
|
|
_.setCurrent = function setCurrent_6(vs, c){
|
|
var i;
|
|
for (i = 0; i != this.poleCount; i++)
|
|
vs == this.voltageSources[i] && (this.currents[i] = c);
|
|
}
|
|
;
|
|
_.setEditValue = function setEditValue_22(n, ei){
|
|
var s;
|
|
if (n == 0) {
|
|
if (ei.value_0 >= 2) {
|
|
this.poleCount = round_int(ei.value_0);
|
|
$allocNodes(this);
|
|
$setPoints_9(this);
|
|
}
|
|
else
|
|
ei.error = 'must be >= 2';
|
|
}
|
|
if (n == 1) {
|
|
this.flags = $changeFlag(ei, this.flags, 2);
|
|
$setPoints_9(this);
|
|
}
|
|
n == 2 && (s = $trim($getText(ei.textf)) , s.length == 0?(this.keyShortcut = null):(this.keyShortcut = s.substr(0, 1).toLowerCase()));
|
|
n == 3 && (this.resistance = ei.value_0);
|
|
}
|
|
;
|
|
_.setPoints = function setPoints_21(){
|
|
$setPoints_9(this);
|
|
}
|
|
;
|
|
_.setVoltageSource = function setVoltageSource_11(j, vs){
|
|
$ensureArrays_0(this);
|
|
this.voltageSources[j] = vs;
|
|
$setNodes(vs, this.nodes[j * 3], this.nodes[this.position + 1 + j * 3]);
|
|
}
|
|
;
|
|
_.stamp = function stamp_24(){
|
|
var i;
|
|
$ensureArrays_0(this);
|
|
for (i = 0; i != this.poleCount; i++) {
|
|
this.resistance > 0?$stampResistor(this.nodes[i * 3], this.nodes[this.position + 1 + i * 3], this.resistance):$stampVoltageSource_1(this.voltageSources[i]);
|
|
}
|
|
}
|
|
;
|
|
_.undumpXml = function undumpXml_26(xml){
|
|
$undumpXml_1(this, xml);
|
|
this.poleCount = $parseIntAttr(xml, 'po', this.poleCount);
|
|
}
|
|
;
|
|
_.validate = function validate_9(){
|
|
var fpi, i;
|
|
if (this.resistance > 0)
|
|
return true;
|
|
for (i = 0; i != this.poleCount; i++) {
|
|
fpi = new FindPathInfo(2, this, this.nodes[i * 3], sim_0);
|
|
if ($findPath(fpi, $getNode(this, i * 3 + 1 + this.position))) {
|
|
this.resistance = $intern_83;
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
;
|
|
_.poleCount = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_DPDTSwitchElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'DPDTSwitchElm', 414);
|
|
function $clinit_DarlingtonElm(){
|
|
$clinit_DarlingtonElm = emptyMethod;
|
|
modelExternalNodes_1 = stampJavaTypeInfo(getClassLiteralForArray(I_classLit, 1), $intern_25, 7, 15, [1, 2, 3]);
|
|
}
|
|
|
|
function DarlingtonElm(xa, ya, xb, yb, f, st){
|
|
$clinit_DarlingtonElm();
|
|
CompositeElm_1.call(this, xa, ya, xb, yb, f, st, modelString_1, modelExternalNodes_1);
|
|
this.pnp = (new Integer_0($nextToken(st))).value_0;
|
|
this.noDiagonal = true;
|
|
}
|
|
|
|
function DarlingtonElm_0(xx, yy, pnpflag){
|
|
CompositeElm_2.call(this, xx, yy, modelString_1, modelExternalNodes_1);
|
|
this.pnp = pnpflag?-1:1;
|
|
$get_4(this.compElmList, 0).pnp = this.pnp;
|
|
$get_4(this.compElmList, 1).pnp = this.pnp;
|
|
this.noDiagonal = true;
|
|
}
|
|
|
|
defineClass(303, 110, $intern_85, DarlingtonElm);
|
|
_.canFlipY = function canFlipY_1(){
|
|
return false;
|
|
}
|
|
;
|
|
_.draw = function draw_24(g){
|
|
var ds;
|
|
$setBbox_0(this, this.point1, this.point2, 16);
|
|
$setPowerColor_0(this, g);
|
|
$setVoltageColor(this, g, this.volts[1]);
|
|
drawThickLine_0(g, this.coll[0], this.coll[1], 3);
|
|
drawThickLine_0(g, this.coll2[0], this.coll2[1], 3);
|
|
drawThickLine_0(g, this.coll[0], this.coll2[0], 3);
|
|
$setVoltageColor(this, g, this.volts[2]);
|
|
drawThickLine_0(g, this.emit[0], this.emit[1], 3);
|
|
$setColor_0(g, lightGrayColor);
|
|
$fillPolygon(g, this.arrowPoly);
|
|
$setVoltageColor(this, g, this.volts[0]);
|
|
app_0.menus.powerCheckItem.on && $setColor_0(g, ($clinit_Color() , gray));
|
|
drawThickLine_0(g, this.point1, this.base, 3);
|
|
this.curcount_b = $updateDotCount($getCurrentIntoNode(this, 0), this.curcount_b);
|
|
$drawDots(g, this.base, this.point1, this.curcount_b);
|
|
this.curcount_c = $updateDotCount($getCurrentIntoNode(this, 1), this.curcount_c);
|
|
$drawDots(g, this.coll[1], this.coll[0], this.curcount_c);
|
|
this.curcount_e = $updateDotCount($getCurrentIntoNode(this, 2), this.curcount_e);
|
|
$drawDots(g, this.emit[1], this.emit[0], this.curcount_e);
|
|
$setVoltageColor(this, g, this.volts[0]);
|
|
$setPowerColor_0(this, g);
|
|
$fillPolygon(g, this.rectPoly);
|
|
if ((mouseElmRef == this || this.selected_0 || $containsKey(app_0.mouse.scopePlotRoles, this) || instanceOf(mouseElmRef, 21) && $getElm_0(mouseElmRef.elmScope) == this || $isOnHighlightedNet(this) || app_0.mouse.dragElm == this) && this.dy == 0) {
|
|
$setColor_0(g, whiteColor);
|
|
ds = sign_0(this.dx);
|
|
$drawString(g, 'B', this.base.x_0 - 10 * ds, this.base.y_0 - 5);
|
|
$drawString(g, 'C', this.coll[0].x_0 - 3 + 9 * ds, this.coll[0].y_0 + 4);
|
|
$drawString(g, 'E', this.emit[0].x_0 - 3 + 9 * ds, this.emit[0].y_0 + 4);
|
|
}
|
|
$drawPosts(this, g);
|
|
}
|
|
;
|
|
_.dumpXml = function dumpXml_25(doc, elem){
|
|
dumpAttr_1(elem, 'x', this.x_0 + ' ' + this.y_0 + ' ' + this.x2 + ' ' + this.y2);
|
|
dumpAttr_0(elem, 'f', this.flags);
|
|
dumpAttr_0(elem, 'pnp', this.pnp);
|
|
}
|
|
;
|
|
_.getDumpType_0 = function getDumpType_34(){
|
|
return 400;
|
|
}
|
|
;
|
|
_.getDumpType = function(){
|
|
return this.getDumpType_0();
|
|
}
|
|
;
|
|
_.getElmType = function getElmType_6(){
|
|
return 'darlington pair';
|
|
}
|
|
;
|
|
_.getInfo_0 = function getInfo_30(arr){
|
|
var vbc, vbe, vce;
|
|
arr[0] = LS('darlington pair') + ' (' + (this.pnp == -1?'PNP)':'NPN)');
|
|
vbc = this.volts[0] - this.volts[1];
|
|
vbe = this.volts[0] - this.volts[2];
|
|
vce = this.volts[1] - this.volts[2];
|
|
arr[1] = 'Ic = ' + getUnitText(-$getCurrentIntoNode(this, 1), 'A', false);
|
|
arr[2] = 'Ib = ' + getUnitText(-$getCurrentIntoNode(this, 0), 'A', false);
|
|
arr[3] = 'Vbe = ' + getUnitText(vbe, 'V', false);
|
|
arr[4] = 'Vbc = ' + getUnitText(vbc, 'V', false);
|
|
arr[5] = 'Vce = ' + getUnitText(vce, 'V', false);
|
|
}
|
|
;
|
|
_.getXmlDumpType = function getXmlDumpType_13(){
|
|
return 'dar';
|
|
}
|
|
;
|
|
_.reset_1 = function reset_14(){
|
|
$reset_2(this);
|
|
this.curcount_c = this.curcount_e = this.curcount_b = 0;
|
|
}
|
|
;
|
|
_.setPoints = function setPoints_22(){
|
|
var hs2, pt;
|
|
$setPoints(this);
|
|
hs2 = 16 * this.dsign * this.pnp;
|
|
this.coll = $newPointArray(2);
|
|
this.coll2 = $newPointArray(2);
|
|
this.emit = $newPointArray(2);
|
|
$interpPoint2(this.point1, this.point2, this.coll[0], this.emit[0], 1, hs2);
|
|
this.coll2[0] = $interpPoint_0(this.point1, this.point2, 1, hs2 - 5 * this.dsign * this.pnp);
|
|
this.rect_0 = $newPointArray(4);
|
|
$interpPoint2(this.point1, this.point2, this.rect_0[0], this.rect_0[1], 1 - 16 / this.dn, 16);
|
|
$interpPoint2(this.point1, this.point2, this.rect_0[2], this.rect_0[3], 1 - 13 / this.dn, 16);
|
|
$interpPoint2(this.point1, this.point2, this.coll[1], this.emit[1], 1 - 13 / this.dn, 6 * this.dsign * this.pnp);
|
|
this.coll2[1] = $interpPoint_0(this.point1, this.point2, 1 - 13 / this.dn, this.dsign * this.pnp);
|
|
this.base = new Point_1;
|
|
$interpPoint_1(this.point1, this.point2, this.base, 1 - 16 / this.dn);
|
|
this.rectPoly = $createPolygon_0(this.rect_0[0], this.rect_0[2], this.rect_0[3], this.rect_0[1]);
|
|
if (this.pnp == 1)
|
|
this.arrowPoly = $calcArrow(this.emit[1], this.emit[0], 8, 4);
|
|
else {
|
|
pt = $interpPoint_0(this.point1, this.point2, 1 - 11 / this.dn, -5 * this.dsign * this.pnp);
|
|
this.arrowPoly = $calcArrow(this.emit[0], pt, 8, 4);
|
|
}
|
|
$setPost(this, 0, this.point1);
|
|
$setPost(this, 1, this.coll[0]);
|
|
$setPost(this, 2, this.emit[0]);
|
|
}
|
|
;
|
|
_.undumpXml = function undumpXml_27(xml){
|
|
$undumpXml_3(this, xml);
|
|
this.pnp = $parseIntAttr(xml, 'pnp', this.pnp);
|
|
$get_4(this.compElmList, 0).pnp = this.pnp;
|
|
$get_4(this.compElmList, 1).pnp = this.pnp;
|
|
}
|
|
;
|
|
_.curcount_b = 0;
|
|
_.curcount_c = 0;
|
|
_.curcount_e = 0;
|
|
_.pnp = 0;
|
|
var modelExternalNodes_1, modelString_1 = 'NTransistorElm 1 2 4\rNTransistorElm 4 2 3';
|
|
var Lcom_lushprojects_circuitjs1_client_DarlingtonElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'DarlingtonElm', 303);
|
|
function DataFileEntry(){
|
|
}
|
|
|
|
defineClass(358, 1, {358:1}, DataFileEntry);
|
|
var Lcom_lushprojects_circuitjs1_client_DataFileEntry_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'DataFileEntry', 358);
|
|
function $clinit_DataInputElm(){
|
|
$clinit_DataInputElm = emptyMethod;
|
|
dataFileMap = new HashMap;
|
|
}
|
|
|
|
function DataInputElm(xx, yy){
|
|
$clinit_DataInputElm();
|
|
RailElm_0.call(this, xx, yy, 1);
|
|
this.scaleFactor = 1;
|
|
this.sampleLength = $intern_83;
|
|
}
|
|
|
|
function DataInputElm_0(xa, ya, xb, yb, f, st){
|
|
$clinit_DataInputElm();
|
|
var ent;
|
|
RailElm_1.call(this, xa, ya, xb, yb, f, st);
|
|
this.waveform = 1;
|
|
this.sampleLength = __parseAndValidateDouble($nextToken(st));
|
|
this.scaleFactor = __parseAndValidateDouble($nextToken(st));
|
|
this.fileNum = __parseAndValidateInt($nextToken(st), 10);
|
|
ent = $get_1(dataFileMap, valueOf_0(this.fileNum));
|
|
if (ent) {
|
|
this.fileName = ent.fileName;
|
|
this.data_0 = ent.data_0;
|
|
}
|
|
}
|
|
|
|
function fetchLoadFileData_0(elm, uploadElement){
|
|
$clinit_DataInputElm();
|
|
var oFiles = uploadElement.files;
|
|
if (oFiles.length >= 1) {
|
|
var reader = new FileReader;
|
|
reader.onload = function(e){
|
|
var text_0 = reader.result;
|
|
elm.doLoadCallback(text_0, oFiles[0].name);
|
|
}
|
|
;
|
|
reader.readAsText(oFiles[0]);
|
|
}
|
|
}
|
|
|
|
defineClass(359, 47, $intern_92, DataInputElm, DataInputElm_0);
|
|
_.doLoadCallback = function doLoadCallback(s, t){
|
|
var arr, d, i, msg, parseError;
|
|
arr = $split_1(s, '\r*\n', 0);
|
|
this.data_0 = new ArrayList;
|
|
parseError = false;
|
|
for (i = 0; i != arr.length; i++) {
|
|
if (arr[i].length == 0)
|
|
continue;
|
|
if ($charAt_0(arr[i], 0) == 35)
|
|
continue;
|
|
try {
|
|
d = __parseAndValidateDouble(arr[i]);
|
|
$add_8(this.data_0, d);
|
|
}
|
|
catch ($e0) {
|
|
$e0 = toJava($e0);
|
|
if (instanceOf($e0, 13)) {
|
|
console.log('parse error on line ' + i);
|
|
parseError = true;
|
|
}
|
|
else
|
|
throw toJs($e0);
|
|
}
|
|
}
|
|
if (this.data_0.array.length == 0 || parseError) {
|
|
msg = parseError?'Error parsing data file.\n\n':'No data found in file.\n\n';
|
|
msg += 'Expected format:\n- One numeric voltage value per line\n- Lines starting with # are treated as comments\n- Blank lines are ignored\n\nExample:\n# my data\n1.5\n2.3\n-0.5';
|
|
$wnd.alert(msg);
|
|
}
|
|
}
|
|
;
|
|
_.drawRail = function drawRail_2(g){
|
|
$drawRailText(this, g, this.fileName == null?LS('No file'):this.fileName);
|
|
}
|
|
;
|
|
_.dumpXml = function dumpXml_26(doc, elem){
|
|
$dumpXml(this, elem);
|
|
dumpAttr(elem, 'sl', this.sampleLength);
|
|
dumpAttr(elem, 'sf', this.scaleFactor);
|
|
}
|
|
;
|
|
_.dumpXmlState = function dumpXmlState_6(doc, elem){
|
|
var ent;
|
|
if (this.data_0) {
|
|
this.fileNum == 0 && (this.fileNum = fileNumCounter_0++);
|
|
ent = new DataFileEntry;
|
|
ent.fileName = this.fileName;
|
|
ent.data_0 = this.data_0;
|
|
$put_0(dataFileMap, valueOf_0(this.fileNum), ent);
|
|
dumpAttr_0(elem, 'fn', this.fileNum);
|
|
}
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_35(){
|
|
return 424;
|
|
}
|
|
;
|
|
_.getEditInfo = function getEditInfo_23(n){
|
|
var ei, file, thisElm;
|
|
if (n == 0) {
|
|
ei = new EditInfo_0('', 0, -1, -1);
|
|
thisElm = this;
|
|
file = new FileUpload;
|
|
ei.widget = file;
|
|
$addDomHandler(file, new DataInputElm$1(this, file, thisElm), ($clinit_ChangeEvent() , $clinit_ChangeEvent() , TYPE_0));
|
|
return ei;
|
|
}
|
|
if (n == 1)
|
|
return new EditInfo('Scale Factor', this.scaleFactor);
|
|
if (n == 2)
|
|
return new EditInfo('Sample Length (s)', this.sampleLength);
|
|
if (n == 3)
|
|
return createCheckbox('Repeat', (this.flags & 256) != 0);
|
|
return null;
|
|
}
|
|
;
|
|
_.getInfo_0 = function getInfo_31(arr){
|
|
var dur;
|
|
arr[0] = 'data input';
|
|
if (!this.data_0) {
|
|
arr[1] = 'no file loaded';
|
|
return;
|
|
}
|
|
arr[1] = 'V = ' + getUnitText(this.volts[0], 'V', false);
|
|
arr[2] = 'pos = ' + getUnitText(this.timeOffset, 's', false);
|
|
dur = this.data_0.array.length * this.sampleLength;
|
|
arr[3] = 'dur = ' + getUnitText(dur, 's', false);
|
|
}
|
|
;
|
|
_.getRailText = function getRailText_1(){
|
|
return this.fileName == null?LS('No file'):this.fileName;
|
|
}
|
|
;
|
|
_.getShortcut = function getShortcut_13(){
|
|
return 0;
|
|
}
|
|
;
|
|
_.getVoltage_0 = function getVoltage_2(){
|
|
var ptr;
|
|
if (!this.data_0 || this.data_0.array.length == 0)
|
|
return 0;
|
|
ptr = round_int(this.timeOffset / this.sampleLength);
|
|
ptr < 0 && (ptr = 0);
|
|
if (ptr >= this.data_0.array.length) {
|
|
if ((this.flags & 256) != 0) {
|
|
ptr = 0;
|
|
this.timeOffset = 0;
|
|
}
|
|
else
|
|
ptr = this.data_0.array.length - 1;
|
|
}
|
|
return $doubleValue($get_2(this.data_0, ptr)) * this.scaleFactor;
|
|
}
|
|
;
|
|
_.reset_0 = function reset_15(){
|
|
this.timeOffset = 0;
|
|
}
|
|
;
|
|
_.setEditValue = function setEditValue_23(n, ei){
|
|
n == 1 && (this.scaleFactor = ei.value_0);
|
|
n == 2 && (this.sampleLength = ei.value_0);
|
|
n == 3 && (this.flags = $changeFlag(ei, this.flags, 256));
|
|
}
|
|
;
|
|
_.stepFinished = function stepFinished_11(){
|
|
this.timeOffset += sim_0.timeStep;
|
|
}
|
|
;
|
|
_.undumpXml = function undumpXml_28(xml){
|
|
var ent;
|
|
$undumpXml(this, xml);
|
|
this.sampleLength = $parseDoubleAttr(xml, 'sl', this.sampleLength);
|
|
this.scaleFactor = $parseDoubleAttr(xml, 'sf', this.scaleFactor);
|
|
this.fileNum = $parseIntAttr(xml, 'fn', 0);
|
|
ent = $get_1(dataFileMap, valueOf_0(this.fileNum));
|
|
if (ent) {
|
|
this.fileName = ent.fileName;
|
|
this.data_0 = ent.data_0;
|
|
}
|
|
}
|
|
;
|
|
_.fileNum = 0;
|
|
_.sampleLength = 0;
|
|
_.scaleFactor = 0;
|
|
_.timeOffset = 0;
|
|
var dataFileMap, fileNumCounter_0 = 1;
|
|
var Lcom_lushprojects_circuitjs1_client_DataInputElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'DataInputElm', 359);
|
|
function DataInputElm$1(this$0, val$file, val$thisElm){
|
|
this.this$01 = this$0;
|
|
this.val$file2 = val$file;
|
|
this.val$thisElm3 = val$thisElm;
|
|
}
|
|
|
|
defineClass(828, 1, $intern_71, DataInputElm$1);
|
|
_.onChange = function onChange_1(event_0){
|
|
this.this$01.fileName = $replaceAll($replaceAll($getElement(this.val$file2).value, '^.*\\\\', ''), '\\.[^.]*$', '');
|
|
fetchLoadFileData_0(this.val$thisElm3, $getElement(this.val$file2));
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_DataInputElm$1_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'DataInputElm/1', 828);
|
|
function $setDataCount_0(this$static, ct){
|
|
this$static.dataCount = ct;
|
|
this$static.data_0 = initUnidimensionalArray(D_classLit, $intern_76, 7, this$static.dataCount, 15, 1);
|
|
this$static.dataPtr = 0;
|
|
this$static.dataFull = false;
|
|
}
|
|
|
|
function DataRecorderElm(xx, yy){
|
|
CircuitElm.call(this, xx, yy);
|
|
$setDataCount_0(this, 10240);
|
|
}
|
|
|
|
function DataRecorderElm_0(xa, ya, xb, yb, f, st){
|
|
CircuitElm_0.call(this, xa, ya, xb, yb, f);
|
|
$setDataCount_0(this, __parseAndValidateInt($nextToken(st), 10));
|
|
}
|
|
|
|
defineClass(382, 8, $intern_85, DataRecorderElm, DataRecorderElm_0);
|
|
_.draw = function draw_25(g){
|
|
var f, s, selected;
|
|
g.context.save();
|
|
g.savedFontSize = g.currentFontSize;
|
|
selected = mouseElmRef == this || this.selected_0 || $containsKey(app_0.mouse.scopePlotRoles, this) || instanceOf(mouseElmRef, 21) && $getElm_0(mouseElmRef.elmScope) == this || $isOnHighlightedNet(this);
|
|
f = new Font('SansSerif', selected?1:0, 14);
|
|
$setFont_0(g, f);
|
|
$setColor_0(g, selected?selectColor_0:whiteColor);
|
|
$setBbox_0(this, this.point1, this.lead1, 0);
|
|
s = LS('export');
|
|
$drawLabeledNode(this, g, s, this.point1, this.lead1);
|
|
$setVoltageColor(this, g, this.volts[0]);
|
|
selected && $setColor_0(g, selectColor_0);
|
|
drawThickLine_0(g, this.point1, this.lead1, 3);
|
|
$drawPosts(this, g);
|
|
g.context.restore();
|
|
g.currentFontSize = g.savedFontSize;
|
|
}
|
|
;
|
|
_.dumpXml = function dumpXml_27(doc, elem){
|
|
dumpAttr_1(elem, 'x', this.x_0 + ' ' + this.y_0 + ' ' + this.x2 + ' ' + this.y2);
|
|
dumpAttr_0(elem, 'f', this.flags);
|
|
dumpAttr_0(elem, 'dc', this.dataCount);
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_36(){
|
|
return 210;
|
|
}
|
|
;
|
|
_.getEditInfo = function getEditInfo_24(n){
|
|
var a, dataStr, date, dtf, ei, fname, i, url_0, datain, oldblob, blob, url_1;
|
|
if (n == 0) {
|
|
ei = $setPositive($setDimensionless(new EditInfo_0('# of Data Points', this.dataCount, -1, -1)));
|
|
return ei;
|
|
}
|
|
if (n == 1) {
|
|
ei = new EditInfo_0('', 0, -1, -1);
|
|
dataStr = '# time step = ' + sim_0.timeStep + ' sec\n';
|
|
if (this.dataFull) {
|
|
for (i = 0; i != this.dataCount; i++)
|
|
dataStr += this.data_0[(i + this.dataPtr) % this.dataCount] + '\n';
|
|
}
|
|
else {
|
|
for (i = 0; i != this.dataPtr; i++)
|
|
dataStr += this.data_0[i] + '\n';
|
|
}
|
|
url_0 = (datain = [''] , datain[0] = dataStr , oldblob = $doc.recorderBlob , oldblob && URL.revokeObjectURL(oldblob) , blob = new Blob(datain, {type:'text/plain'}) , url_1 = URL.createObjectURL(blob) , $doc.recorderBlob = url_1 , url_1);
|
|
date = new Date_0;
|
|
dtf = ($clinit_DateTimeFormat_0() , getFormat('yyyyMMdd-HHmm', $getDateTimeFormatInfo(($clinit_LocaleInfo() , $clinit_LocaleInfo() , instance_0))));
|
|
fname = 'data-' + $format(dtf, date, null) + '.circuitjs.txt';
|
|
a = new Anchor_0(fname, url_0);
|
|
$setAttribute(($clinit_DOM() , a.element), 'Download', fname);
|
|
ei.widget = a;
|
|
return ei;
|
|
}
|
|
return null;
|
|
}
|
|
;
|
|
_.getInfo_0 = function getInfo_32(arr){
|
|
arr[0] = 'data export';
|
|
arr[1] = 'V = ' + getUnitText(this.volts[0], 'V', false);
|
|
arr[2] = (this.dataFull?this.dataCount:this.dataPtr) + '/' + this.dataCount;
|
|
}
|
|
;
|
|
_.getPostCount_0 = function getPostCount_28(){
|
|
return 1;
|
|
}
|
|
;
|
|
_.getVoltageDiff_0 = function getVoltageDiff_7(){
|
|
return this.volts[0];
|
|
}
|
|
;
|
|
_.reset_0 = function reset_16(){
|
|
this.dataPtr = 0;
|
|
this.dataFull = false;
|
|
this.lastTimeStepCount = 0;
|
|
}
|
|
;
|
|
_.setEditValue = function setEditValue_24(n, ei){
|
|
n == 0 && ei.value_0 > 0 && $setDataCount_0(this, round_int(ei.value_0));
|
|
if (n == 1)
|
|
return;
|
|
}
|
|
;
|
|
_.setPoints = function setPoints_23(){
|
|
$setPoints(this);
|
|
this.lead1 = $interpPoint(this.point1, this.point2, 1 - 8 / this.dn);
|
|
}
|
|
;
|
|
_.stepFinished = function stepFinished_12(){
|
|
if (this.lastTimeStepCount == sim_0.timeStepCount)
|
|
return;
|
|
this.data_0[this.dataPtr++] = this.volts[0];
|
|
this.lastTimeStepCount = sim_0.timeStepCount;
|
|
if (this.dataPtr >= this.dataCount) {
|
|
this.dataPtr = 0;
|
|
this.dataFull = true;
|
|
}
|
|
}
|
|
;
|
|
_.undumpXml = function undumpXml_29(xml){
|
|
this.flags = $parseIntAttr(xml, 'f', this.flags);
|
|
$setDataCount_0(this, $parseIntAttr(xml, 'dc', this.dataCount));
|
|
}
|
|
;
|
|
_.dataCount = 0;
|
|
_.dataFull = false;
|
|
_.dataPtr = 0;
|
|
_.lastTimeStepCount = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_DataRecorderElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'DataRecorderElm', 382);
|
|
function $readSelectValue(this$static){
|
|
var i, sel;
|
|
sel = 0;
|
|
for (i = 0; i < this$static.selectBitCount; i++)
|
|
this$static.pins[this$static.selectPin + i].value_0 && (sel |= 1 << i);
|
|
return sel;
|
|
}
|
|
|
|
function $setupPins_10(this$static){
|
|
var g, i, inputPinCount, n, outputPinCount;
|
|
this$static.selectBitCount == 0 && (this$static.selectBitCount = 2);
|
|
this$static.outputCount = 1 << this$static.selectBitCount;
|
|
if (this$static.outputMode == 2) {
|
|
inputPinCount = this$static.dataBusWidth;
|
|
outputPinCount = this$static.outputCount * this$static.dataBusWidth;
|
|
this$static.sizeX = this$static.selectBitCount + 1;
|
|
this$static.sizeY = this$static.outputCount + 1;
|
|
this$static.pins = initUnidimensionalArray(Lcom_lushprojects_circuitjs1_client_ChipElm$Pin_2_classLit, $intern_3, 9, inputPinCount + this$static.selectBitCount + outputPinCount, 0, 1);
|
|
this$static.inputPin = 0;
|
|
for (i = 0; i < this$static.dataBusWidth; i++) {
|
|
this$static.pins[i] = new ChipElm$Pin(this$static, 0, 2, 'Q');
|
|
this$static.pins[i].busWidth = this$static.dataBusWidth;
|
|
this$static.pins[i].busZ = i;
|
|
}
|
|
this$static.selectPin = inputPinCount;
|
|
for (i = 0; i < this$static.selectBitCount; i++) {
|
|
n = this$static.selectPin + i;
|
|
if ((this$static.flags & 8) != 0) {
|
|
this$static.pins[n] = new ChipElm$Pin(this$static, 0, 1, 'S');
|
|
this$static.pins[n].busWidth = this$static.selectBitCount;
|
|
this$static.pins[n].busZ = i;
|
|
}
|
|
else {
|
|
this$static.pins[n] = new ChipElm$Pin(this$static, i + 1, 1, 'S' + i);
|
|
}
|
|
}
|
|
this$static.outputPin = this$static.selectPin + this$static.selectBitCount;
|
|
for (g = 0; g < this$static.outputCount; g++) {
|
|
for (i = 0; i < this$static.dataBusWidth; i++) {
|
|
n = this$static.outputPin + g * this$static.dataBusWidth + i;
|
|
this$static.pins[n] = new ChipElm$Pin(this$static, g, 3, 'Q' + g);
|
|
this$static.pins[n].output = true;
|
|
this$static.pins[n].busWidth = this$static.dataBusWidth;
|
|
this$static.pins[n].busZ = i;
|
|
}
|
|
}
|
|
}
|
|
else if (this$static.outputMode == 1) {
|
|
this$static.sizeX = this$static.selectBitCount + 1;
|
|
this$static.sizeY = 3;
|
|
this$static.pins = initUnidimensionalArray(Lcom_lushprojects_circuitjs1_client_ChipElm$Pin_2_classLit, $intern_3, 9, 1 + this$static.selectBitCount + this$static.outputCount, 0, 1);
|
|
this$static.inputPin = 0;
|
|
this$static.pins[0] = new ChipElm$Pin(this$static, 0, 2, 'Q');
|
|
this$static.selectPin = 1;
|
|
for (i = 0; i < this$static.selectBitCount; i++) {
|
|
n = this$static.selectPin + i;
|
|
if ((this$static.flags & 8) != 0) {
|
|
this$static.pins[n] = new ChipElm$Pin(this$static, 0, 1, 'S');
|
|
this$static.pins[n].busWidth = this$static.selectBitCount;
|
|
this$static.pins[n].busZ = i;
|
|
}
|
|
else {
|
|
this$static.pins[n] = new ChipElm$Pin(this$static, i + 1, 1, 'S' + i);
|
|
}
|
|
}
|
|
this$static.outputPin = this$static.selectPin + this$static.selectBitCount;
|
|
for (i = 0; i < this$static.outputCount; i++) {
|
|
n = this$static.outputPin + i;
|
|
this$static.pins[n] = new ChipElm$Pin(this$static, 1, 3, 'Q');
|
|
this$static.pins[n].output = true;
|
|
this$static.pins[n].busWidth = this$static.outputCount;
|
|
this$static.pins[n].busZ = i;
|
|
}
|
|
}
|
|
else {
|
|
this$static.sizeX = 1 + this$static.selectBitCount;
|
|
this$static.sizeY = 1 + this$static.outputCount;
|
|
this$static.pins = initUnidimensionalArray(Lcom_lushprojects_circuitjs1_client_ChipElm$Pin_2_classLit, $intern_3, 9, 1 + this$static.selectBitCount + this$static.outputCount, 0, 1);
|
|
this$static.outputPin = 0;
|
|
for (i = 0; i < this$static.outputCount; i++) {
|
|
this$static.pins[i] = new ChipElm$Pin(this$static, i, 3, 'Q' + i);
|
|
this$static.pins[i].output = true;
|
|
}
|
|
this$static.selectPin = this$static.outputCount;
|
|
for (i = 0; i < this$static.selectBitCount; i++) {
|
|
n = this$static.selectPin + i;
|
|
if ((this$static.flags & 8) != 0) {
|
|
this$static.pins[n] = new ChipElm$Pin(this$static, 0, 1, 'S');
|
|
this$static.pins[n].busWidth = this$static.selectBitCount;
|
|
this$static.pins[n].busZ = i;
|
|
}
|
|
else {
|
|
this$static.pins[n] = new ChipElm$Pin(this$static, i, 1, 'S' + i);
|
|
}
|
|
}
|
|
this$static.inputPin = this$static.outputCount + this$static.selectBitCount;
|
|
this$static.pins[this$static.inputPin] = new ChipElm$Pin(this$static, 0, 2, 'Q');
|
|
}
|
|
$allocNodes(this$static);
|
|
}
|
|
|
|
function DeMultiplexerElm(xx, yy){
|
|
$clinit_ChipElm();
|
|
ChipElm.call(this, xx, yy);
|
|
this.dataBusWidth = 4;
|
|
}
|
|
|
|
function DeMultiplexerElm_0(xa, ya, xb, yb, f, st){
|
|
$clinit_ChipElm();
|
|
ChipElm_0.call(this, xa, ya, xb, yb, f, st);
|
|
this.dataBusWidth = 4;
|
|
try {
|
|
this.selectBitCount = __parseAndValidateInt($nextToken(st), 10);
|
|
$setupPins_10(this);
|
|
$allocNodes(this);
|
|
}
|
|
catch ($e0) {
|
|
$e0 = toJava($e0);
|
|
if (!instanceOf($e0, 13))
|
|
throw toJs($e0);
|
|
}
|
|
}
|
|
|
|
defineClass(401, 32, $intern_85, DeMultiplexerElm, DeMultiplexerElm_0);
|
|
_.dumpXml = function dumpXml_28(doc, elem){
|
|
$dumpXml_0(this, elem);
|
|
dumpAttr_0(elem, 'se', this.selectBitCount);
|
|
this.outputMode != 0 && dumpAttr_0(elem, 'om', this.outputMode);
|
|
this.dataBusWidth != 4 && dumpAttr_0(elem, 'dw', this.dataBusWidth);
|
|
}
|
|
;
|
|
_.execute_3 = function execute_22(){
|
|
var i, i0, idle, selectedValue, width_0;
|
|
selectedValue = $readSelectValue(this);
|
|
width_0 = this.outputMode == 2?this.dataBusWidth:1;
|
|
idle = (this.flags & 16) != 0;
|
|
for (i0 = 0; i0 < this.outputCount * width_0; i0++)
|
|
this.pins[this.outputPin + i0].value_0 = idle;
|
|
for (i = 0; i < width_0; i++)
|
|
this.pins[this.outputPin + selectedValue * width_0 + i].value_0 = this.pins[this.inputPin + i].value_0;
|
|
}
|
|
;
|
|
_.getChipEditInfo = function getChipEditInfo_10(n){
|
|
var ei;
|
|
if (n == 0)
|
|
return $setDimensionless(new EditInfo('# of Select Bits', this.selectBitCount));
|
|
if (n == 1) {
|
|
ei = new EditInfo_0('Output Mode', 0, -1, -1);
|
|
ei.choice = new Choice;
|
|
$addItem(ei.choice, LS('Individual Outputs'));
|
|
$addItem(ei.choice, LS('Bus Output (Bit Distribute)'));
|
|
$addItem(ei.choice, LS('Bus Input/Output'));
|
|
$select(ei.choice, this.outputMode);
|
|
return ei;
|
|
}
|
|
if (n == 2)
|
|
return createCheckbox('Bus Select', (this.flags & 8) != 0);
|
|
if (n == 3)
|
|
return createCheckbox('Keep Inactive Outputs High (74139)', (this.flags & 16) != 0);
|
|
if (n == 4 && this.outputMode == 2)
|
|
return $setDimensionless(new EditInfo_0('Data Bus Width', this.dataBusWidth, 2, 32));
|
|
return null;
|
|
}
|
|
;
|
|
_.getChipName = function getChipName_12(){
|
|
return 'Demultiplexer';
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_37(){
|
|
return 185;
|
|
}
|
|
;
|
|
_.getPostCount_0 = function getPostCount_29(){
|
|
if (this.outputMode == 2)
|
|
return this.dataBusWidth + this.selectBitCount + this.outputCount * this.dataBusWidth;
|
|
if (this.outputMode == 1)
|
|
return 1 + this.selectBitCount + this.outputCount;
|
|
return 1 + this.selectBitCount + this.outputCount;
|
|
}
|
|
;
|
|
_.getVoltageSourceCount = function getVoltageSourceCount_23(){
|
|
if (this.outputMode == 2)
|
|
return this.outputCount * this.dataBusWidth;
|
|
return this.outputCount;
|
|
}
|
|
;
|
|
_.getXmlDumpType = function getXmlDumpType_14(){
|
|
return 'dmux';
|
|
}
|
|
;
|
|
_.setChipEditValue = function setChipEditValue_11(n, ei){
|
|
if (n == 0) {
|
|
if (ei.value_0 >= 1 && ei.value_0 <= 6) {
|
|
this.selectBitCount = round_int(ei.value_0);
|
|
$setupPins_10(this);
|
|
$setPoints_0(this);
|
|
}
|
|
else
|
|
ei.error = 'must be between 1 and 6';
|
|
}
|
|
if (n == 1) {
|
|
this.outputMode = $getElement(ei.choice).selectedIndex;
|
|
$setupPins_10(this);
|
|
$setPoints_0(this);
|
|
}
|
|
if (n == 2) {
|
|
this.flags = $changeFlag(ei, this.flags, 8);
|
|
$setupPins_10(this);
|
|
$setPoints_0(this);
|
|
}
|
|
n == 3 && (this.flags = $changeFlag(ei, this.flags, 16));
|
|
if (n == 4) {
|
|
if (ei.value_0 >= 2) {
|
|
this.dataBusWidth = round_int(ei.value_0);
|
|
$setupPins_10(this);
|
|
$setPoints_0(this);
|
|
}
|
|
else
|
|
ei.error = 'must be >= 2';
|
|
}
|
|
}
|
|
;
|
|
_.setupPins = function setupPins_13(){
|
|
$setupPins_10(this);
|
|
}
|
|
;
|
|
_.undumpXml = function undumpXml_30(xml){
|
|
$undumpXml_0(this, xml);
|
|
this.selectBitCount = $parseIntAttr(xml, 'se', this.selectBitCount);
|
|
this.outputMode = $parseIntAttr(xml, 'om', 0);
|
|
this.dataBusWidth = $parseIntAttr(xml, 'dw', 4);
|
|
$setupPins_10(this);
|
|
$allocNodes(this);
|
|
}
|
|
;
|
|
_.dataBusWidth = 0;
|
|
_.inputPin = 0;
|
|
_.outputCount = 0;
|
|
_.outputMode = 0;
|
|
_.outputPin = 0;
|
|
_.selectBitCount = 0;
|
|
_.selectPin = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_DeMultiplexerElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'DeMultiplexerElm', 401);
|
|
function $setupPins_11(this$static){
|
|
this$static.sizeX = 3;
|
|
this$static.sizeY = this$static.bitOrder == 2?2:this$static.bitCount;
|
|
this$static.pins = initUnidimensionalArray(Lcom_lushprojects_circuitjs1_client_ChipElm$Pin_2_classLit, $intern_3, 9, this$static.bitCount, 0, 1);
|
|
$makeBitPins(this$static, this$static.bitCount, 0, 2, 0, 'I', false, false, false);
|
|
$allocNodes(this$static);
|
|
}
|
|
|
|
function DecimalDisplayElm(xx, yy){
|
|
$clinit_ChipElm();
|
|
ChipElm.call(this, xx, yy);
|
|
this.bitCount = 4;
|
|
$setupPins_11(this);
|
|
}
|
|
|
|
function DecimalDisplayElm_0(xa, ya, xb, yb, f, st){
|
|
$clinit_ChipElm();
|
|
ChipElm_0.call(this, xa, ya, xb, yb, f, st);
|
|
this.bitCount = 4;
|
|
try {
|
|
this.bitCount = __parseAndValidateInt($nextToken(st), 10);
|
|
this.displayMode = __parseAndValidateInt($nextToken(st), 10);
|
|
}
|
|
catch ($e0) {
|
|
$e0 = toJava($e0);
|
|
if (!instanceOf($e0, 13))
|
|
throw toJs($e0);
|
|
}
|
|
$setupPins_11(this);
|
|
}
|
|
|
|
defineClass(440, 32, $intern_85, DecimalDisplayElm, DecimalDisplayElm_0);
|
|
_.allowBus = function allowBus_5(){
|
|
return true;
|
|
}
|
|
;
|
|
_.draw = function draw_26(g){
|
|
var i, str, value_0, w, xl, yl, number, number_0;
|
|
$drawChip(this, g);
|
|
xl = this.x_0 + this.cspc + this.flippedSizeX * this.cspc;
|
|
yl = this.y_0 - this.cspc + this.flippedSizeY * this.cspc;
|
|
(this.flags & $intern_42) != 0 && (yl += (this.flags & $intern_43) != 0?-this.cspc / 2 | 0:this.cspc / 2 | 0);
|
|
g.context.save();
|
|
g.savedFontSize = g.currentFontSize;
|
|
$setFont_0(g, new Font('SansSerif', 0, 15 * this.csize));
|
|
$setColor_0(g, whiteColor);
|
|
g.context.textBaseline = 'middle';
|
|
value_0 = 0;
|
|
for (i = 0; i != this.bitCount; i++)
|
|
this.pins[i].value_0 && (value_0 |= 1 << i);
|
|
switch (this.displayMode) {
|
|
case 1:
|
|
str = (number = value_0 >>> 0 , number.toString(16)).toUpperCase();
|
|
break;
|
|
case 2:
|
|
str = (number_0 = value_0 >>> 0 , number_0.toString(8));
|
|
break;
|
|
default:str = '' + value_0;
|
|
}
|
|
w = round_int($measureText(g.context, str).width);
|
|
$drawString(g, str, xl + 5 * this.csize - (w / 2 | 0), yl);
|
|
g.context.restore();
|
|
g.currentFontSize = g.savedFontSize;
|
|
}
|
|
;
|
|
_.dumpXml = function dumpXml_29(doc, elem){
|
|
$dumpXml_0(this, elem);
|
|
dumpAttr_0(elem, 'bc', this.bitCount);
|
|
dumpAttr_0(elem, 'dm', this.displayMode);
|
|
}
|
|
;
|
|
_.getChipEditInfo = function getChipEditInfo_11(n){
|
|
var ei;
|
|
if (n == 0)
|
|
return $setDimensionless(new EditInfo_0('# of Bits', this.bitCount, 1, 8));
|
|
if (n == 1) {
|
|
ei = new EditInfo_0('Display Mode', 0, -1, -1);
|
|
ei.choice = new Choice;
|
|
$addItem(ei.choice, LS('Decimal'));
|
|
$addItem(ei.choice, LS('Hexadecimal'));
|
|
$addItem(ei.choice, LS('Octal'));
|
|
$select(ei.choice, this.displayMode);
|
|
return ei;
|
|
}
|
|
return null;
|
|
}
|
|
;
|
|
_.getChipName = function getChipName_13(){
|
|
switch (this.displayMode) {
|
|
case 1:
|
|
return 'hex display';
|
|
case 2:
|
|
return 'octal display';
|
|
default:return 'decimal display';
|
|
}
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_38(){
|
|
return 419;
|
|
}
|
|
;
|
|
_.getPostCount_0 = function getPostCount_30(){
|
|
return this.bitCount;
|
|
}
|
|
;
|
|
_.getVoltageSourceCount = function getVoltageSourceCount_24(){
|
|
return 0;
|
|
}
|
|
;
|
|
_.getXmlDumpType = function getXmlDumpType_15(){
|
|
return 'dd';
|
|
}
|
|
;
|
|
_.setChipEditValue = function setChipEditValue_12(n, ei){
|
|
var newBitCount;
|
|
if (n == 0) {
|
|
if (ei.value_0 >= 1 && ei.value_0 <= 16) {
|
|
newBitCount = round_int(ei.value_0);
|
|
if (newBitCount != this.bitCount) {
|
|
this.bitCount = newBitCount;
|
|
$setupPins_11(this);
|
|
$setPoints_0(this);
|
|
}
|
|
}
|
|
else
|
|
ei.error = 'must be between 1 and 16';
|
|
return;
|
|
}
|
|
n == 1 && (this.displayMode = $getElement(ei.choice).selectedIndex);
|
|
}
|
|
;
|
|
_.setupPins = function setupPins_14(){
|
|
$setupPins_11(this);
|
|
}
|
|
;
|
|
_.undumpXml = function undumpXml_31(xml){
|
|
$undumpXml_0(this, xml);
|
|
this.bitCount = $parseIntAttr(xml, 'bc', this.bitCount);
|
|
this.displayMode = $parseIntAttr(xml, 'dm', this.displayMode);
|
|
$setupPins_11(this);
|
|
}
|
|
;
|
|
_.bitCount = 0;
|
|
_.displayMode = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_DecimalDisplayElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'DecimalDisplayElm', 440);
|
|
function DelayBufferElm(xx, yy){
|
|
CircuitElm.call(this, xx, yy);
|
|
this.noDiagonal = true;
|
|
this.threshold = 2.5;
|
|
this.highVoltage = 5;
|
|
}
|
|
|
|
function DelayBufferElm_0(xa, ya, xb, yb, f, st){
|
|
CircuitElm_0.call(this, xa, ya, xb, yb, f);
|
|
this.noDiagonal = true;
|
|
this.delay = __parseAndValidateDouble($nextToken(st));
|
|
this.threshold = 2.5;
|
|
this.highVoltage = 5;
|
|
try {
|
|
this.threshold = __parseAndValidateDouble($nextToken(st));
|
|
this.highVoltage = __parseAndValidateDouble($nextToken(st));
|
|
}
|
|
catch ($e0) {
|
|
$e0 = toJava($e0);
|
|
if (!instanceOf($e0, 13))
|
|
throw toJs($e0);
|
|
}
|
|
}
|
|
|
|
defineClass(427, 8, $intern_85, DelayBufferElm, DelayBufferElm_0);
|
|
_.doStep = function doStep_19(){
|
|
var inState, outState;
|
|
inState = this.volts[0] > this.threshold;
|
|
outState = this.volts[1] > this.threshold;
|
|
inState != outState?sim_0.t >= this.delayEndTime && (outState = inState):(this.delayEndTime = sim_0.t + this.delay);
|
|
$updateVoltageSource(this.voltSource, outState?this.highVoltage:0);
|
|
}
|
|
;
|
|
_.draw = function draw_27(g){
|
|
$drawPosts(this, g);
|
|
$draw2Leads(this, g);
|
|
$setColor_0(g, mouseElmRef == this || this.selected_0 || $containsKey(app_0.mouse.scopePlotRoles, this) || instanceOf(mouseElmRef, 21) && $getElm_0(mouseElmRef.elmScope) == this || $isOnHighlightedNet(this)?selectColor_0:lightGrayColor);
|
|
drawThickPolygon(g, this.gatePoly);
|
|
app_0.menus.euroGatesCheckItem.on && $drawCenteredText(this, g, '1', this.center.x_0, this.center.y_0 - 6, true);
|
|
this.curcount_0 = $updateDotCount(this.current_0, this.curcount_0);
|
|
$drawDots(g, this.lead2, this.point2, this.curcount_0);
|
|
}
|
|
;
|
|
_.dumpXml = function dumpXml_30(doc, elem){
|
|
dumpAttr_1(elem, 'x', this.x_0 + ' ' + this.y_0 + ' ' + this.x2 + ' ' + this.y2);
|
|
dumpAttr_0(elem, 'f', this.flags);
|
|
dumpAttr(elem, 'dl', this.delay);
|
|
dumpAttr(elem, 'th', this.threshold);
|
|
dumpAttr(elem, 'hv', this.highVoltage);
|
|
}
|
|
;
|
|
_.getConnection = function getConnection_15(n1, n2){
|
|
return false;
|
|
}
|
|
;
|
|
_.getCurrentIntoNode = function getCurrentIntoNode_10(n){
|
|
if (n == 1)
|
|
return this.current_0;
|
|
return 0;
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_39(){
|
|
return 422;
|
|
}
|
|
;
|
|
_.getEditInfo = function getEditInfo_25(n){
|
|
if (n == 0)
|
|
return new EditInfo_0('Delay (s)', this.delay, 0, 0);
|
|
if (n == 1)
|
|
return new EditInfo_0('Threshold (V)', this.threshold, 0, 0);
|
|
if (n == 2)
|
|
return $setUnitStep(new EditInfo_0('High Logic Voltage', this.highVoltage, 0, 0));
|
|
return null;
|
|
}
|
|
;
|
|
_.getInfo_0 = function getInfo_33(arr){
|
|
arr[0] = LS('buffer');
|
|
arr[1] = LS('delay = ') + getUnitText(this.delay, 's', false);
|
|
arr[2] = 'Vi = ' + getUnitText(this.volts[0], 'V', false);
|
|
arr[3] = 'Vo = ' + getUnitText(this.volts[1], 'V', false);
|
|
}
|
|
;
|
|
_.getVoltageDiff_0 = function getVoltageDiff_8(){
|
|
return this.volts[0];
|
|
}
|
|
;
|
|
_.getVoltageSourceCount = function getVoltageSourceCount_25(){
|
|
return 1;
|
|
}
|
|
;
|
|
_.hasGroundConnection = function hasGroundConnection_10(n1){
|
|
return n1 == 1;
|
|
}
|
|
;
|
|
_.setEditValue = function setEditValue_25(n, ei){
|
|
n == 0 && (this.delay = ei.value_0);
|
|
n == 1 && (this.threshold = ei.value_0);
|
|
n == 2 && (this.highVoltage = ei.value_0);
|
|
}
|
|
;
|
|
_.setHighVoltage = function setHighVoltage_3(hv){
|
|
this.highVoltage = hv;
|
|
}
|
|
;
|
|
_.setPoints = function setPoints_24(){
|
|
var l2, pts, triPoints, ww;
|
|
$setPoints(this);
|
|
ww = 14;
|
|
14 > this.dn / 2 && (ww = round_int(this.dn / 2));
|
|
this.lead1 = $interpPoint(this.point1, this.point2, 0.5 - ww / this.dn);
|
|
this.lead2 = $interpPoint(this.point1, this.point2, 0.5 + ww / this.dn);
|
|
if (app_0.menus.euroGatesCheckItem.on) {
|
|
pts = $newPointArray(4);
|
|
l2 = $interpPoint(this.point1, this.point2, 0.5 + (ww - 5) / this.dn);
|
|
$interpPoint2(this.lead1, l2, pts[0], pts[1], 0, 16);
|
|
$interpPoint2(this.lead1, l2, pts[3], pts[2], 1, 16);
|
|
this.gatePoly = $createPolygon_1(pts);
|
|
this.center = $interpPoint(this.lead1, l2, 0.5);
|
|
}
|
|
else {
|
|
triPoints = $newPointArray(3);
|
|
$interpPoint2(this.lead1, this.lead2, triPoints[0], triPoints[1], 0, 16);
|
|
triPoints[2] = $interpPoint(this.point1, this.point2, 0.5 + ww / this.dn);
|
|
this.gatePoly = $createPolygon_1(triPoints);
|
|
}
|
|
$setBbox_0(this, this.point1, this.point2, 16);
|
|
}
|
|
;
|
|
_.stamp = function stamp_25(){
|
|
$stampVoltageSource(ground, this.nodes[1], this.voltSource);
|
|
}
|
|
;
|
|
_.undumpXml = function undumpXml_32(xml){
|
|
this.flags = $parseIntAttr(xml, 'f', this.flags);
|
|
this.delay = $parseDoubleAttr(xml, 'dl', this.delay);
|
|
this.threshold = $parseDoubleAttr(xml, 'th', this.threshold);
|
|
this.highVoltage = $parseDoubleAttr(xml, 'hv', this.highVoltage);
|
|
}
|
|
;
|
|
_.delay = 0;
|
|
_.delayEndTime = 0;
|
|
_.highVoltage = 0;
|
|
_.threshold = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_DelayBufferElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'DelayBufferElm', 427);
|
|
function $createDiodes(this$static){
|
|
this$static.diode1 = new Diode(sim_0);
|
|
this$static.diode2 = new Diode(sim_0);
|
|
$setup(this$static.diode1, getModelWithName_1('default'));
|
|
$setup(this$static.diode2, getModelWithName_1('default'));
|
|
}
|
|
|
|
function DiacElm(xx, yy){
|
|
CircuitElm.call(this, xx, yy);
|
|
this.offresistance = $intern_97;
|
|
this.onresistance = 500;
|
|
this.breakdown = 30;
|
|
this.holdcurrent = $intern_34;
|
|
this.state = false;
|
|
$createDiodes(this);
|
|
}
|
|
|
|
function DiacElm_0(xa, ya, xb, yb, f, st){
|
|
CircuitElm_0.call(this, xa, ya, xb, yb, f);
|
|
this.onresistance = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.offresistance = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.breakdown = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.holdcurrent = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
$createDiodes(this);
|
|
}
|
|
|
|
defineClass(381, 8, $intern_85, DiacElm, DiacElm_0);
|
|
_.calculateCurrent = function calculateCurrent_11(){
|
|
var r;
|
|
r = this.state?this.onresistance:this.offresistance;
|
|
this.current_0 = (this.volts[0] - this.volts[2]) / r + (this.volts[0] - this.volts[3]) / r;
|
|
}
|
|
;
|
|
_.doStep = function doStep_20(){
|
|
var r;
|
|
r = this.state?this.onresistance:this.offresistance;
|
|
$stampResistor(this.nodes[0], this.nodes[2], r);
|
|
$stampResistor(this.nodes[0], this.nodes[3], r);
|
|
$doStep_0(this.diode1, this.volts[2] - this.volts[1]);
|
|
$doStep_0(this.diode2, this.volts[1] - this.volts[3]);
|
|
}
|
|
;
|
|
_.draw = function draw_28(g){
|
|
var v1, v2;
|
|
v1 = this.volts[0];
|
|
v2 = this.volts[1];
|
|
$setBbox_0(this, this.point1, this.point2, 6);
|
|
$draw2Leads(this, g);
|
|
$setColor_0(g, $getVoltageColor(this, v1));
|
|
$setPowerColor_0(this, g);
|
|
drawThickLine_0(g, this.plate1[0], this.plate1[1], 3);
|
|
$setColor_0(g, $getVoltageColor(this, v2));
|
|
$setPowerColor_0(this, g);
|
|
drawThickLine_0(g, this.plate2[0], this.plate2[1], 3);
|
|
$fillPolygon(g, this.arrows[0]);
|
|
$setColor_0(g, $getVoltageColor(this, v1));
|
|
$setPowerColor_0(this, g);
|
|
$fillPolygon(g, this.arrows[1]);
|
|
$setPowerColor_0(this, g);
|
|
this.curcount_0 = $updateDotCount(this.current_0, this.curcount_0);
|
|
app_0.mouse.dragElm == this || $drawDots(g, this.point1, this.point2, this.curcount_0);
|
|
$drawPosts(this, g);
|
|
}
|
|
;
|
|
_.dumpXml = function dumpXml_31(doc, elem){
|
|
dumpAttr_1(elem, 'x', this.x_0 + ' ' + this.y_0 + ' ' + this.x2 + ' ' + this.y2);
|
|
dumpAttr_0(elem, 'f', this.flags);
|
|
dumpAttr(elem, 'ron', this.onresistance);
|
|
dumpAttr(elem, 'roff', this.offresistance);
|
|
dumpAttr(elem, 'bd', this.breakdown);
|
|
dumpAttr(elem, 'hc', this.holdcurrent);
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_40(){
|
|
return 203;
|
|
}
|
|
;
|
|
_.getEditInfo = function getEditInfo_26(n){
|
|
if (n == 0)
|
|
return new EditInfo_0('On resistance (ohms)', this.onresistance, 0, 0);
|
|
if (n == 1)
|
|
return new EditInfo_0('Off resistance (ohms)', this.offresistance, 0, 0);
|
|
if (n == 2)
|
|
return new EditInfo_0('Breakdown voltage (volts)', this.breakdown, 0, 0);
|
|
if (n == 3)
|
|
return new EditInfo_0('Hold current (amps)', this.holdcurrent, 0, 0);
|
|
return null;
|
|
}
|
|
;
|
|
_.getInfo_0 = function getInfo_34(arr){
|
|
arr[0] = 'DIAC';
|
|
arr[1] = 'I = ' + getUnitText($wnd.Math.abs(this.current_0), 'A', false);
|
|
arr[2] = 'Vd = ' + getUnitText($wnd.Math.abs(this.volts[0] - this.volts[1]), 'V', false);
|
|
arr[3] = this.state?'on':'off';
|
|
arr[4] = 'Ron = ' + getUnitText(this.onresistance, ohmString, false);
|
|
arr[5] = 'Roff = ' + getUnitText(this.offresistance, ohmString, false);
|
|
arr[6] = 'Vbrkdn = ' + getUnitText(this.breakdown, 'V', false);
|
|
arr[7] = 'Ihold = ' + getUnitText(this.holdcurrent, 'A', false);
|
|
arr[8] = 'P = ' + getUnitText((this.volts[0] - this.volts[1]) * this.current_0, 'W', false);
|
|
}
|
|
;
|
|
_.getInternalNodeCount = function getInternalNodeCount_7(){
|
|
return 2;
|
|
}
|
|
;
|
|
_.nonLinear_0 = function nonLinear_6(){
|
|
return true;
|
|
}
|
|
;
|
|
_.setEditValue = function setEditValue_26(n, ei){
|
|
ei.value_0 > 0 && n == 0 && (this.onresistance = ei.value_0);
|
|
ei.value_0 > 0 && n == 1 && (this.offresistance = ei.value_0);
|
|
ei.value_0 > 0 && n == 2 && (this.breakdown = ei.value_0);
|
|
ei.value_0 > 0 && n == 3 && (this.holdcurrent = ei.value_0);
|
|
}
|
|
;
|
|
_.setPoints = function setPoints_25(){
|
|
var i, p1, p2, p3, sgn;
|
|
$setPoints(this);
|
|
$calcLeads(this, 16);
|
|
this.plate1 = $newPointArray(2);
|
|
this.plate2 = $newPointArray(2);
|
|
$interpPoint2(this.lead1, this.lead2, this.plate1[0], this.plate1[1], 0, 16);
|
|
$interpPoint2(this.lead1, this.lead2, this.plate2[0], this.plate2[1], 1, 16);
|
|
this.arrows = initUnidimensionalArray(Lcom_lushprojects_circuitjs1_client_Polygon_2_classLit, $intern_3, 201, 2, 0, 1);
|
|
for (i = 0; i != 2; i++) {
|
|
sgn = -1 + i * 2;
|
|
p1 = $interpPoint_0(this.lead1, this.lead2, i, 8 * sgn);
|
|
p2 = $interpPoint_0(this.lead1, this.lead2, 1 - i, 16 * sgn);
|
|
p3 = $interpPoint_0(this.lead1, this.lead2, 1 - i, 0);
|
|
this.arrows[i] = $createPolygon(p1, p2, p3);
|
|
}
|
|
}
|
|
;
|
|
_.stamp = function stamp_26(){
|
|
$stamp_0(this.diode1, this.nodes[2], this.nodes[1]);
|
|
$stamp_0(this.diode2, this.nodes[1], this.nodes[3]);
|
|
}
|
|
;
|
|
_.startIteration = function startIteration_5(){
|
|
var vd;
|
|
vd = this.volts[0] - this.volts[1];
|
|
$wnd.Math.abs(this.current_0) < this.holdcurrent && (this.state = false);
|
|
$wnd.Math.abs(vd) > this.breakdown && (this.state = true);
|
|
}
|
|
;
|
|
_.undumpXml = function undumpXml_33(xml){
|
|
this.flags = $parseIntAttr(xml, 'f', this.flags);
|
|
this.onresistance = $parseDoubleAttr(xml, 'ron', this.onresistance);
|
|
this.offresistance = $parseDoubleAttr(xml, 'roff', this.offresistance);
|
|
this.breakdown = $parseDoubleAttr(xml, 'bd', this.breakdown);
|
|
this.holdcurrent = $parseDoubleAttr(xml, 'hc', this.holdcurrent);
|
|
}
|
|
;
|
|
_.breakdown = 0;
|
|
_.holdcurrent = 0;
|
|
_.offresistance = 0;
|
|
_.onresistance = 0;
|
|
_.state = false;
|
|
var Lcom_lushprojects_circuitjs1_client_DiacElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'DiacElm', 381);
|
|
function $closeDialog(this$static){
|
|
$hide_0(this$static, false);
|
|
dialogShowing == this$static && (dialogShowing = null);
|
|
}
|
|
|
|
function Dialog(){
|
|
DialogBox.call(this, new DialogBox$CaptionImpl);
|
|
this.closeOnEnter = true;
|
|
}
|
|
|
|
defineClass(140, 256, $intern_58);
|
|
_.apply_0 = function apply_1(){
|
|
return true;
|
|
}
|
|
;
|
|
_.closeDialog = function closeDialog(){
|
|
$closeDialog(this);
|
|
}
|
|
;
|
|
_.enterPressed = function enterPressed(){
|
|
this.closeOnEnter && this.apply_0() && this.closeDialog();
|
|
}
|
|
;
|
|
_.closeOnEnter = false;
|
|
var Lcom_lushprojects_circuitjs1_client_Dialog_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'Dialog', 140);
|
|
function $calculateCurrent_0(this$static, voltdiff){
|
|
if (voltdiff >= 0 || this$static.zvoltage == 0)
|
|
return this$static.leakage * ($wnd.Math.exp(voltdiff * this$static.vdcoef) - 1);
|
|
return this$static.leakage * ($wnd.Math.exp(voltdiff * this$static.vdcoef) - $wnd.Math.exp((-voltdiff - this$static.zoffset) * $intern_108) - 1);
|
|
}
|
|
|
|
function $doStep_0(this$static, voltdiff){
|
|
var eval_0, geq, gmin, nc;
|
|
$wnd.Math.abs(voltdiff - this$static.lastvoltdiff) > $intern_34 && (this$static.sim.converged = false);
|
|
voltdiff = $limitStep(this$static, voltdiff, this$static.lastvoltdiff);
|
|
this$static.lastvoltdiff = voltdiff;
|
|
gmin = this$static.leakage * $intern_34;
|
|
if (this$static.sim.subIterations > 100) {
|
|
gmin = $wnd.Math.exp(-9 * $wnd.Math.log(10) * (1 - this$static.sim.subIterations / 3000));
|
|
gmin > 0.1 && (gmin = 0.1);
|
|
}
|
|
if (voltdiff >= 0 || this$static.zvoltage == 0) {
|
|
eval_0 = $wnd.Math.exp(voltdiff * this$static.vdcoef);
|
|
geq = this$static.vdcoef * this$static.leakage * eval_0 + gmin;
|
|
nc = (eval_0 - 1) * this$static.leakage - geq * voltdiff;
|
|
$stampConductance(this$static.nodes[0], this$static.nodes[1], geq);
|
|
$stampCurrentSource(this$static.nodes[0], this$static.nodes[1], nc);
|
|
}
|
|
else {
|
|
geq = this$static.leakage * (this$static.vdcoef * $wnd.Math.exp(voltdiff * this$static.vdcoef) + $intern_108 * $wnd.Math.exp((-voltdiff - this$static.zoffset) * $intern_108)) + gmin;
|
|
nc = this$static.leakage * ($wnd.Math.exp(voltdiff * this$static.vdcoef) - $wnd.Math.exp((-voltdiff - this$static.zoffset) * $intern_108) - 1) + geq * -voltdiff;
|
|
$stampConductance(this$static.nodes[0], this$static.nodes[1], geq);
|
|
$stampCurrentSource(this$static.nodes[0], this$static.nodes[1], nc);
|
|
}
|
|
}
|
|
|
|
function $limitStep(this$static, vnew, vold){
|
|
var arg;
|
|
if (vnew > this$static.vcrit && $wnd.Math.abs(vnew - vold) > this$static.vscale + this$static.vscale) {
|
|
if (vold > 0) {
|
|
arg = 1 + (vnew - vold) / this$static.vscale;
|
|
arg > 0?(vnew = vold + this$static.vscale * $wnd.Math.log(arg)):(vnew = this$static.vcrit);
|
|
}
|
|
else {
|
|
vnew = this$static.vscale * $wnd.Math.log(vnew / this$static.vscale);
|
|
}
|
|
this$static.sim.converged = false;
|
|
}
|
|
else if (vnew < 0 && this$static.zoffset != 0) {
|
|
vnew = -vnew - this$static.zoffset;
|
|
vold = -vold - this$static.zoffset;
|
|
if (vnew > this$static.vzcrit && $wnd.Math.abs(vnew - vold) > 0.05173) {
|
|
if (vold > 0) {
|
|
arg = 1 + (vnew - vold) / $intern_109;
|
|
arg > 0?(vnew = vold + $intern_109 * $wnd.Math.log(arg)):(vnew = this$static.vzcrit);
|
|
}
|
|
else {
|
|
vnew = $intern_109 * $wnd.Math.log(vnew / $intern_109);
|
|
}
|
|
this$static.sim.converged = false;
|
|
}
|
|
vnew = -(vnew + this$static.zoffset);
|
|
}
|
|
return vnew;
|
|
}
|
|
|
|
function $setup(this$static, model){
|
|
this$static.leakage = model.saturationCurrent;
|
|
this$static.zvoltage = model.breakdownVoltage;
|
|
this$static.vscale = model.vscale;
|
|
this$static.vdcoef = model.vdcoef;
|
|
this$static.vcrit = this$static.vscale * $wnd.Math.log(this$static.vscale / ($wnd.Math.sqrt(2) * this$static.leakage));
|
|
this$static.vzcrit = $intern_109 * $wnd.Math.log($intern_109 / ($wnd.Math.sqrt(2) * this$static.leakage));
|
|
this$static.zvoltage == 0?(this$static.zoffset = 0):(this$static.zoffset = this$static.zvoltage - $wnd.Math.log(-(1 + -0.005 / this$static.leakage)) / $intern_108);
|
|
}
|
|
|
|
function $stamp_0(this$static, n0, n1){
|
|
this$static.nodes[0] = n0;
|
|
this$static.nodes[1] = n1;
|
|
}
|
|
|
|
function Diode(s){
|
|
this.sim = s;
|
|
this.nodes = initUnidimensionalArray(Lcom_lushprojects_circuitjs1_client_CircuitNode_2_classLit, $intern_3, 175, 2, 0, 1);
|
|
}
|
|
|
|
defineClass(130, 1, {130:1}, Diode);
|
|
_.lastvoltdiff = 0;
|
|
_.leakage = 0;
|
|
_.vcrit = 0;
|
|
_.vdcoef = 0;
|
|
_.vscale = 0;
|
|
_.vzcrit = 0;
|
|
_.zoffset = 0;
|
|
_.zvoltage = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_Diode_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'Diode', 130);
|
|
function $draw_0(this$static, g){
|
|
$drawDiode(this$static, g);
|
|
this$static.curcount_0 = $updateDotCount(this$static.current_0, this$static.curcount_0);
|
|
app_0.mouse.dragElm == this$static || $drawDots(g, this$static.point1, this$static.point2, this$static.curcount_0);
|
|
$drawPosts(this$static, g);
|
|
}
|
|
|
|
function $drawDiode(this$static, g){
|
|
var v1, v2;
|
|
$setBbox_0(this$static, this$static.point1, this$static.point2, 8);
|
|
v1 = this$static.volts[0];
|
|
v2 = this$static.volts[1];
|
|
$draw2Leads(this$static, g);
|
|
$setColor_0(g, $getVoltageColor(this$static, v1));
|
|
$setPowerColor_0(this$static, g);
|
|
$fillPolygon(g, this$static.poly_0);
|
|
$setColor_0(g, $getVoltageColor(this$static, v2));
|
|
$setPowerColor_0(this$static, g);
|
|
drawThickLine_0(g, this$static.cathode_0[0], this$static.cathode_0[1], 3);
|
|
}
|
|
|
|
function $dumpXml_6(this$static, doc, elem){
|
|
this$static.model.builtIn || this$static.model.dumped || $dumpXml_7(this$static.model, doc);
|
|
dumpAttr_1(elem, 'x', this$static.x_0 + ' ' + this$static.y_0 + ' ' + this$static.x2 + ' ' + this$static.y2);
|
|
dumpAttr_0(elem, 'f', this$static.flags);
|
|
dumpAttr_1(elem, 'mo', this$static.modelName);
|
|
}
|
|
|
|
function $getEditInfo_3(this$static, n){
|
|
var dm, ei, i;
|
|
if (n == 0) {
|
|
ei = new EditInfo_0('Model', 0, -1, -1);
|
|
this$static.models = getModelList_0(instanceOf(this$static, 276));
|
|
ei.choice = new Choice;
|
|
for (i = 0; i != this$static.models.arrayList.array.length; i++) {
|
|
dm = $get_4(this$static.models, i);
|
|
$addItem(ei.choice, LS($getDescription(dm)));
|
|
dm == this$static.model && $select(ei.choice, i);
|
|
}
|
|
return ei;
|
|
}
|
|
if (n == 1) {
|
|
ei = new EditInfo_0('', 0, -1, -1);
|
|
ei.button_0 = new Button_1(LS('Create New Simple Model'));
|
|
return ei;
|
|
}
|
|
if (n == 2) {
|
|
ei = new EditInfo_0('', 0, -1, -1);
|
|
ei.button_0 = new Button_1(LS('Create New Advanced Model'));
|
|
return ei;
|
|
}
|
|
if (n == 3) {
|
|
if (this$static.model.readOnly)
|
|
return null;
|
|
ei = new EditInfo_0('', 0, -1, -1);
|
|
ei.button_0 = new Button_1(LS('Edit Model'));
|
|
return ei;
|
|
}
|
|
return null;
|
|
}
|
|
|
|
function $getInfo_3(this$static, arr){
|
|
this$static.model.oldStyle?(arr[0] = 'diode'):(arr[0] = LS('diode') + ' (' + this$static.modelName + ')');
|
|
arr[1] = 'I = ' + getUnitText(this$static.current_0, 'A', false);
|
|
arr[2] = 'Vd = ' + getUnitText(this$static.volts[0] - this$static.volts[1], 'V', false);
|
|
arr[3] = 'P = ' + getUnitText((this$static.volts[0] - this$static.volts[1]) * this$static.current_0, 'W', false);
|
|
this$static.model.oldStyle && (arr[4] = 'Vf = ' + getUnitText(this$static.model.fwdrop, 'V', false));
|
|
}
|
|
|
|
function $newModelCreated(this$static, dm){
|
|
this$static.model = dm;
|
|
this$static.modelName = this$static.model.name_0;
|
|
$setup_0(this$static);
|
|
}
|
|
|
|
function $reset_3(this$static){
|
|
this$static.diode.lastvoltdiff = 0;
|
|
this$static.volts[0] = this$static.volts[1] = this$static.curcount_0 = 0;
|
|
this$static.hasResistance && (this$static.volts[2] = 0);
|
|
}
|
|
|
|
function $setEditValue_4(this$static, n, ei){
|
|
var editDialog, newModel;
|
|
if (n == 0) {
|
|
this$static.model = $get_4(this$static.models, $getElement(ei.choice).selectedIndex);
|
|
this$static.modelName = this$static.model.name_0;
|
|
$setup_0(this$static);
|
|
ei.newDialog = true;
|
|
return;
|
|
}
|
|
if (n == 1 || n == 2) {
|
|
newModel = new DiodeModel_1(this$static.model);
|
|
newModel.flags = n == 1?1:0;
|
|
(newModel.flags & 1) != 0 && (newModel.forwardCurrent == 0 && (newModel.forwardCurrent = 1) , newModel.forwardVoltage = newModel.emissionCoefficient * $intern_109 * $wnd.Math.log(newModel.forwardCurrent / newModel.saturationCurrent + 1));
|
|
editDialog = new EditDiodeModelDialog(newModel, app_0, this$static);
|
|
diodeModelEditDialog = editDialog;
|
|
!editDialog.resizeHandlerRegistration && (editDialog.resizeHandlerRegistration = addResizeHandler(new DialogBox$1(editDialog)));
|
|
$show(editDialog);
|
|
return;
|
|
}
|
|
if (n == 3) {
|
|
if (this$static.model.readOnly) {
|
|
alert_0(LS('This model cannot be modified. Change the model name to allow customization.'));
|
|
return;
|
|
}
|
|
(this$static.model.flags & 1) != 0 && $setForwardVoltage(this$static.model);
|
|
editDialog = new EditDiodeModelDialog(this$static.model, app_0, null);
|
|
diodeModelEditDialog = editDialog;
|
|
!editDialog.resizeHandlerRegistration && (editDialog.resizeHandlerRegistration = addResizeHandler(new DialogBox$1(editDialog)));
|
|
$show(editDialog);
|
|
return;
|
|
}
|
|
}
|
|
|
|
function $setPoints_10(this$static){
|
|
var pa;
|
|
$setPoints(this$static);
|
|
$calcLeads(this$static, 16);
|
|
this$static.cathode_0 = $newPointArray(2);
|
|
pa = $newPointArray(2);
|
|
$interpPoint2(this$static.lead1, this$static.lead2, pa[0], pa[1], 0, 8);
|
|
$interpPoint2(this$static.lead1, this$static.lead2, this$static.cathode_0[0], this$static.cathode_0[1], 1, 8);
|
|
this$static.poly_0 = $createPolygon(pa[0], pa[1], this$static.lead2);
|
|
}
|
|
|
|
function $setup_0(this$static){
|
|
this$static.model = getModelWithNameOrCopy_0(this$static.modelName, this$static.model);
|
|
this$static.modelName = this$static.model.name_0;
|
|
$setup(this$static.diode, this$static.model);
|
|
this$static.hasResistance = this$static.model.seriesResistance > 0;
|
|
this$static.diodeEndNode = this$static.hasResistance?2:1;
|
|
$allocNodes(this$static);
|
|
}
|
|
|
|
function $stamp_1(this$static){
|
|
if (this$static.hasResistance) {
|
|
$stamp_0(this$static.diode, this$static.nodes[0], this$static.nodes[2]);
|
|
$stampResistor(this$static.nodes[1], this$static.nodes[2], this$static.model.seriesResistance);
|
|
}
|
|
else
|
|
$stamp_0(this$static.diode, this$static.nodes[0], this$static.nodes[1]);
|
|
}
|
|
|
|
function $undumpXml_4(this$static, xml){
|
|
this$static.flags = $parseIntAttr(xml, 'f', this$static.flags);
|
|
this$static.modelName = $parseStringAttr(xml, 'mo', this$static.modelName);
|
|
$setup_0(this$static);
|
|
}
|
|
|
|
function DiodeElm(xx, yy){
|
|
CircuitElm.call(this, xx, yy);
|
|
this.modelName = lastModelName_1;
|
|
this.diode = new Diode(sim_0);
|
|
$setup_0(this);
|
|
}
|
|
|
|
function DiodeElm_0(xa, ya, xb, yb, f, st){
|
|
var fwdrop;
|
|
CircuitElm_0.call(this, xa, ya, xb, yb, f);
|
|
this.diode = new Diode(sim_0);
|
|
fwdrop = 0.805904783;
|
|
if ((f & 2) != 0) {
|
|
this.modelName = unescape_0($nextToken(st));
|
|
}
|
|
else {
|
|
if ((f & 1) > 0) {
|
|
try {
|
|
fwdrop = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
}
|
|
catch ($e0) {
|
|
$e0 = toJava($e0);
|
|
if (!instanceOf($e0, 13))
|
|
throw toJs($e0);
|
|
}
|
|
}
|
|
this.model = getModelWithParameters(fwdrop, 0);
|
|
this.modelName = this.model.name_0;
|
|
}
|
|
$setup_0(this);
|
|
}
|
|
|
|
defineClass(154, 8, $intern_110, DiodeElm, DiodeElm_0);
|
|
_.addRoutingObstacle = function addRoutingObstacle_8(router){
|
|
$addRoutingObstacleWithLeads(this, router, 8);
|
|
}
|
|
;
|
|
_.calculateCurrent = function calculateCurrent_12(){
|
|
this.current_0 = $calculateCurrent_0(this.diode, this.volts[0] - this.volts[this.diodeEndNode]);
|
|
}
|
|
;
|
|
_.doStep = function doStep_21(){
|
|
$doStep_0(this.diode, this.volts[0] - this.volts[this.diodeEndNode]);
|
|
}
|
|
;
|
|
_.draw = function draw_29(g){
|
|
$draw_0(this, g);
|
|
}
|
|
;
|
|
_.dumpXml = function dumpXml_32(doc, elem){
|
|
$dumpXml_6(this, doc, elem);
|
|
}
|
|
;
|
|
_.dumpXmlModel = function dumpXmlModel_1(doc){
|
|
this.model.builtIn || this.model.dumped || $dumpXml_7(this.model, doc);
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_41(){
|
|
return 100;
|
|
}
|
|
;
|
|
_.getEditInfo = function getEditInfo_27(n){
|
|
return $getEditInfo_3(this, n);
|
|
}
|
|
;
|
|
_.getElmType = function getElmType_7(){
|
|
return 'diode';
|
|
}
|
|
;
|
|
_.getInfo_0 = function getInfo_35(arr){
|
|
$getInfo_3(this, arr);
|
|
}
|
|
;
|
|
_.getInternalNodeCount = function getInternalNodeCount_8(){
|
|
return this.hasResistance?1:0;
|
|
}
|
|
;
|
|
_.getShortcut = function getShortcut_14(){
|
|
return 100;
|
|
}
|
|
;
|
|
_.nonLinear_0 = function nonLinear_7(){
|
|
return true;
|
|
}
|
|
;
|
|
_.reset_0 = function reset_17(){
|
|
$reset_3(this);
|
|
}
|
|
;
|
|
_.setEditValue = function setEditValue_27(n, ei){
|
|
$setEditValue_4(this, n, ei);
|
|
}
|
|
;
|
|
_.setPoints = function setPoints_26(){
|
|
$setPoints_10(this);
|
|
}
|
|
;
|
|
_.stamp = function stamp_27(){
|
|
$stamp_1(this);
|
|
}
|
|
;
|
|
_.stepFinished = function stepFinished_13(){
|
|
$wnd.Math.abs(this.current_0) > $intern_81 && $stop(sim_0, 'max current exceeded', this);
|
|
}
|
|
;
|
|
_.undumpXml = function undumpXml_34(xml){
|
|
$undumpXml_4(this, xml);
|
|
}
|
|
;
|
|
_.updateModels_0 = function updateModels_2(){
|
|
$setup_0(this);
|
|
}
|
|
;
|
|
_.updateModels = function(){
|
|
this.updateModels_0();
|
|
}
|
|
;
|
|
_.diodeEndNode = 0;
|
|
_.hasResistance = false;
|
|
var lastModelName_1 = 'default';
|
|
var Lcom_lushprojects_circuitjs1_client_DiodeElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'DiodeElm', 154);
|
|
function $dumpXml_7(this$static, doc){
|
|
var elem;
|
|
this$static.dumped = true;
|
|
elem = $createElement(doc, 'dm');
|
|
dumpAttr_1(elem, 'nm', this$static.name_0);
|
|
dumpAttr_0(elem, 'f', this$static.flags);
|
|
dumpAttr(elem, 'is', this$static.saturationCurrent);
|
|
dumpAttr(elem, 'rs', this$static.seriesResistance);
|
|
dumpAttr(elem, 'n', this$static.emissionCoefficient);
|
|
dumpAttr(elem, 'bv', this$static.breakdownVoltage);
|
|
this$static.forwardCurrent > 0 && dumpAttr(elem, 'fi', this$static.forwardCurrent);
|
|
$appendChild_0(build(getDocumentElement(doc.jsObject)), elem);
|
|
}
|
|
|
|
function $getDescription(this$static){
|
|
if (this$static.description == null)
|
|
return this$static.name_0;
|
|
return this$static.name_0 + ' (' + LS(this$static.description) + ')';
|
|
}
|
|
|
|
function $pickName(this$static){
|
|
var n, num;
|
|
this$static.breakdownVoltage > 0 && this$static.breakdownVoltage < 20?(this$static.name_0 = 'zener-' + $format_0(showFormat, this$static.breakdownVoltage)):(this$static.flags & 1) != 0?(this$static.name_0 = 'fwdrop=' + $format_0(showFormat, this$static.forwardVoltage)):(this$static.name_0 = 'diodemodel');
|
|
if ($getStringValue(modelMap_0, this$static.name_0) != null) {
|
|
num = 2;
|
|
for (;; num++) {
|
|
n = this$static.name_0 + '-' + num;
|
|
if ($getStringValue(modelMap_0, n) == null) {
|
|
this$static.name_0 = n;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
function $setForwardVoltage(this$static){
|
|
this$static.forwardCurrent == 0 && (this$static.forwardCurrent = 1);
|
|
this$static.forwardVoltage = this$static.emissionCoefficient * $intern_109 * $wnd.Math.log(this$static.forwardCurrent / this$static.saturationCurrent + 1);
|
|
}
|
|
|
|
function $setInternal(this$static){
|
|
this$static.internal = true;
|
|
return this$static;
|
|
}
|
|
|
|
function $undump_0(this$static, st){
|
|
this$static.flags = (new Integer_0($nextToken(st))).value_0;
|
|
this$static.saturationCurrent = __parseAndValidateDouble($nextToken(st));
|
|
this$static.seriesResistance = __parseAndValidateDouble($nextToken(st));
|
|
this$static.emissionCoefficient = __parseAndValidateDouble($nextToken(st));
|
|
this$static.breakdownVoltage = __parseAndValidateDouble($nextToken(st));
|
|
try {
|
|
this$static.forwardCurrent = __parseAndValidateDouble($nextToken(st));
|
|
}
|
|
catch ($e0) {
|
|
$e0 = toJava($e0);
|
|
if (!instanceOf($e0, 13))
|
|
throw toJs($e0);
|
|
}
|
|
$updateModel(this$static);
|
|
}
|
|
|
|
function $updateModel(this$static){
|
|
this$static.vscale = this$static.emissionCoefficient * $intern_109;
|
|
this$static.vdcoef = 1 / this$static.vscale;
|
|
this$static.fwdrop = $wnd.Math.log(1 / this$static.saturationCurrent + 1) * this$static.emissionCoefficient * $intern_109;
|
|
}
|
|
|
|
function DiodeModel(){
|
|
this.saturationCurrent = $intern_79;
|
|
this.seriesResistance = 0;
|
|
this.emissionCoefficient = 1;
|
|
this.breakdownVoltage = 0;
|
|
$updateModel(this);
|
|
}
|
|
|
|
function DiodeModel_0(sc, sr, ec, bv, d){
|
|
this.saturationCurrent = sc;
|
|
this.seriesResistance = sr;
|
|
this.emissionCoefficient = ec;
|
|
this.breakdownVoltage = bv;
|
|
this.description = d;
|
|
$updateModel(this);
|
|
}
|
|
|
|
function DiodeModel_1(copy){
|
|
this.flags = copy.flags;
|
|
this.saturationCurrent = copy.saturationCurrent;
|
|
this.seriesResistance = copy.seriesResistance;
|
|
this.emissionCoefficient = copy.emissionCoefficient;
|
|
this.breakdownVoltage = copy.breakdownVoltage;
|
|
this.forwardCurrent = copy.forwardCurrent;
|
|
$updateModel(this);
|
|
}
|
|
|
|
function addDefaultModel(name_0, dm){
|
|
$putStringValue(modelMap_0, name_0, dm);
|
|
dm.readOnly = dm.builtIn = true;
|
|
dm.name_0 = name_0;
|
|
}
|
|
|
|
function clearDumpedFlags_1(){
|
|
var it, pair;
|
|
if (!modelMap_0)
|
|
return;
|
|
it = new AbstractHashMap$EntrySetIterator((new AbstractHashMap$EntrySet(modelMap_0)).this$01);
|
|
while (it.hasNext) {
|
|
pair = $next_2(it);
|
|
pair.getValue().dumped = false;
|
|
}
|
|
}
|
|
|
|
function createModelMap(){
|
|
if (modelMap_0)
|
|
return;
|
|
modelMap_0 = new HashMap;
|
|
addDefaultModel('spice-default', new DiodeModel_0($intern_79, 0, 1, 0, null));
|
|
addDefaultModel('default', new DiodeModel_0($intern_111, 0, 2, 0, null));
|
|
addDefaultModel('default-zener', new DiodeModel_0($intern_111, 0, 2, 5.6, null));
|
|
addDefaultModel('old-default-led', $setInternal(new DiodeModel_0(2.2349907006671927E-18, 0, 2, 0, null)));
|
|
addDefaultModel('default-led', new DiodeModel_0(9.32E-11, 0.042, 3.73, 0, null));
|
|
addDefaultModel('default-optocoupler-led', new DiodeModel_0(1.714E-7, 0, 4.077, 0, null));
|
|
addDefaultModel('1N5711', new DiodeModel_0(3.15E-7, 2.8, 2.03, 70, 'Schottky'));
|
|
addDefaultModel('1N5712', new DiodeModel_0(6.8E-10, 12, 1.003, 20, 'Schottky'));
|
|
addDefaultModel('BAT85', new DiodeModel_0(2.076E-7, 2.326, 1.023, 33, 'Schottky'));
|
|
addDefaultModel('1N34', $setInternal(new DiodeModel_0(2.0E-10, 0.084, 2.19, 60, 'germanium')));
|
|
addDefaultModel('1N4004', new DiodeModel_0(1.88E-8, 0.0286, 2, 400, 'general purpose'));
|
|
addDefaultModel('1N4148', new DiodeModel_0(4.352E-9, 0.6458, 1.906, 75, 'switching'));
|
|
addDefaultModel('x2n2646-emitter', $setInternal(new DiodeModel_0(2.13E-11, 0, 1.8, 0, null)));
|
|
loadInternalModel('~tl431ed-d_ed 0 1e-14 5 1 0 0');
|
|
loadInternalModel('~lm317-dz 0 1e-14 0 1 6.3 0');
|
|
}
|
|
|
|
function getModelList_0(zener){
|
|
var dm, it, pair, vector;
|
|
vector = new Vector;
|
|
it = new AbstractHashMap$EntrySetIterator((new AbstractHashMap$EntrySet(modelMap_0)).this$01);
|
|
while (it.hasNext) {
|
|
pair = $next_2(it);
|
|
dm = pair.getValue();
|
|
if (dm.internal)
|
|
continue;
|
|
if (zener && dm.breakdownVoltage == 0)
|
|
continue;
|
|
$indexOf_3(vector.arrayList, dm, 0) != -1 || $add_8(vector.arrayList, dm);
|
|
}
|
|
$clinit_Collections();
|
|
$sort(vector.arrayList, null);
|
|
return vector;
|
|
}
|
|
|
|
function getModelWithName_1(name_0){
|
|
var lm;
|
|
createModelMap();
|
|
lm = $getStringValue(modelMap_0, name_0);
|
|
if (lm)
|
|
return lm;
|
|
lm = new DiodeModel;
|
|
lm.name_0 = name_0;
|
|
$putStringValue(modelMap_0, name_0, lm);
|
|
return lm;
|
|
}
|
|
|
|
function getModelWithNameOrCopy_0(name_0, oldmodel){
|
|
var lm;
|
|
createModelMap();
|
|
lm = $getStringValue(modelMap_0, name_0);
|
|
if (lm)
|
|
return lm;
|
|
if (!oldmodel) {
|
|
console.log('model not found: ' + name_0);
|
|
return getModelWithName_1('default');
|
|
}
|
|
lm = new DiodeModel_1(oldmodel);
|
|
lm.name_0 = name_0;
|
|
$putStringValue(modelMap_0, name_0, lm);
|
|
return lm;
|
|
}
|
|
|
|
function getModelWithParameters(fwdrop, zvoltage){
|
|
var dm, dm0, it, leakage, name_0, pair;
|
|
createModelMap();
|
|
it = new AbstractHashMap$EntrySetIterator((new AbstractHashMap$EntrySet(modelMap_0)).this$01);
|
|
while (it.hasNext) {
|
|
pair = $next_2(it);
|
|
dm0 = pair.getValue();
|
|
if ($wnd.Math.abs(dm0.fwdrop - fwdrop) < $intern_112 && dm0.seriesResistance == 0 && $wnd.Math.abs(dm0.breakdownVoltage - zvoltage) < $intern_112 && dm0.emissionCoefficient == 2)
|
|
return dm0;
|
|
}
|
|
leakage = 1 / ($wnd.Math.exp(fwdrop * 19.331142470520007) - 1);
|
|
name_0 = 'fwdrop=' + fwdrop;
|
|
zvoltage != 0 && (name_0 = name_0 + ' zvoltage=' + zvoltage);
|
|
dm = getModelWithName_1(name_0);
|
|
dm.saturationCurrent = leakage;
|
|
dm.emissionCoefficient = 2;
|
|
dm.breakdownVoltage = zvoltage;
|
|
dm.readOnly = dm.oldStyle = true;
|
|
$updateModel(dm);
|
|
return dm;
|
|
}
|
|
|
|
function loadInternalModel(s){
|
|
var dm, st;
|
|
st = new StringTokenizer(s);
|
|
dm = undumpModel_0(st);
|
|
dm.builtIn = dm.internal = true;
|
|
}
|
|
|
|
function undumpModel_0(st){
|
|
var dm, name_0;
|
|
name_0 = unescape_0($nextToken(st));
|
|
dm = getModelWithName_1(name_0);
|
|
$undump_0(dm, st);
|
|
return dm;
|
|
}
|
|
|
|
function undumpModelXml_1(xml){
|
|
var dm, name_0;
|
|
name_0 = $parseStringAttr(xml, 'nm', null);
|
|
dm = getModelWithName_1(name_0);
|
|
dm.flags = $parseIntAttr(xml, 'f', dm.flags);
|
|
dm.saturationCurrent = $parseDoubleAttr(xml, 'is', dm.saturationCurrent);
|
|
dm.seriesResistance = $parseDoubleAttr(xml, 'rs', dm.seriesResistance);
|
|
dm.emissionCoefficient = $parseDoubleAttr(xml, 'n', dm.emissionCoefficient);
|
|
dm.breakdownVoltage = $parseDoubleAttr(xml, 'bv', dm.breakdownVoltage);
|
|
dm.forwardCurrent = $parseDoubleAttr(xml, 'fi', dm.forwardCurrent);
|
|
$updateModel(dm);
|
|
return dm;
|
|
}
|
|
|
|
defineClass(113, 1, {113:1, 10:1, 16:1}, DiodeModel, DiodeModel_0, DiodeModel_1);
|
|
_.compareTo = function compareTo_1(dm){
|
|
return $compareTo(this.name_0, dm.name_0);
|
|
}
|
|
;
|
|
_.getDialogTitle = function getDialogTitle_1(){
|
|
return 'Edit Diode Model';
|
|
}
|
|
;
|
|
_.getEditInfo = function getEditInfo_28(n){
|
|
var ei;
|
|
if (n == 0) {
|
|
ei = new EditInfo('Model Name', 0);
|
|
ei.text_0 = this.name_0 == null?'':this.name_0;
|
|
return ei;
|
|
}
|
|
if (n == 1)
|
|
return new EditInfo_0('Saturation Current', this.saturationCurrent, -1, -1);
|
|
if ((this.flags & 1) != 0) {
|
|
if (n == 2)
|
|
return new EditInfo_0('Forward Voltage', this.forwardVoltage, -1, -1);
|
|
if (n == 3)
|
|
return new EditInfo_0('Current At Above Voltage (A)', this.forwardCurrent, -1, -1);
|
|
}
|
|
else {
|
|
if (n == 2)
|
|
return new EditInfo_0('Series Resistance', this.seriesResistance, -1, -1);
|
|
if (n == 3)
|
|
return new EditInfo_0('<a href="diodecalc.html" target="_blank">' + LS('Emission Coefficient') + '<\/a>', this.emissionCoefficient, -1, -1);
|
|
}
|
|
if (n == 4)
|
|
return new EditInfo_0('Breakdown Voltage', this.breakdownVoltage, -1, -1);
|
|
return null;
|
|
}
|
|
;
|
|
_.setEditValue = function setEditValue_28(n, ei){
|
|
if (n == 0) {
|
|
this.name_0 = $getText(ei.textf);
|
|
this.name_0.length > 0 && $putStringValue(modelMap_0, this.name_0, this);
|
|
}
|
|
n == 1 && (this.saturationCurrent = ei.value_0);
|
|
if ((this.flags & 1) != 0) {
|
|
n == 2 && (this.forwardVoltage = ei.value_0);
|
|
n == 3 && (this.forwardCurrent = ei.value_0);
|
|
this.forwardCurrent > 0 && this.forwardVoltage > 0 && (this.emissionCoefficient = this.forwardVoltage / $wnd.Math.log(this.forwardCurrent / this.saturationCurrent + 1) / $intern_109);
|
|
this.seriesResistance = 0;
|
|
}
|
|
else {
|
|
n == 2 && (this.seriesResistance = ei.value_0);
|
|
n == 3 && (this.emissionCoefficient = ei.value_0);
|
|
}
|
|
n == 4 && (this.breakdownVoltage = $wnd.Math.abs(ei.value_0));
|
|
$updateModel(this);
|
|
$updateModels(theApp);
|
|
}
|
|
;
|
|
_.breakdownVoltage = 0;
|
|
_.builtIn = false;
|
|
_.dumped = false;
|
|
_.emissionCoefficient = 0;
|
|
_.flags = 0;
|
|
_.forwardCurrent = 0;
|
|
_.forwardVoltage = 0;
|
|
_.fwdrop = 0;
|
|
_.internal = false;
|
|
_.oldStyle = false;
|
|
_.readOnly = false;
|
|
_.saturationCurrent = 0;
|
|
_.seriesResistance = 0;
|
|
_.vdcoef = 0;
|
|
_.vscale = 0;
|
|
var modelMap_0;
|
|
var Lcom_lushprojects_circuitjs1_client_DiodeModel_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'DiodeModel', 113);
|
|
function $adjustChipSize(this$static, dx, dy){
|
|
var i, i0, i1, needShift, p, pe;
|
|
if (dx < 0) {
|
|
for (i = 0; i != this$static.postCount; i++) {
|
|
p = this$static.chip.pins[i];
|
|
if (p.busZ > 0)
|
|
continue;
|
|
if ((p.side == 0 || p.side == 1) && p.pos >= this$static.chip.sizeX + dx)
|
|
return;
|
|
}
|
|
}
|
|
if (dy < 0) {
|
|
needShift = false;
|
|
for (i0 = 0; i0 != this$static.postCount; i0++) {
|
|
p = this$static.chip.pins[i0];
|
|
if (p.busZ > 0)
|
|
continue;
|
|
if ((p.side == 3 || p.side == 2) && p.pos >= this$static.chip.sizeY + dy) {
|
|
needShift = true;
|
|
break;
|
|
}
|
|
}
|
|
if (needShift) {
|
|
for (i1 = 0; i1 != this$static.postCount; i1++) {
|
|
p = this$static.chip.pins[i1];
|
|
if (p.busZ > 0)
|
|
continue;
|
|
if ((p.side == 3 || p.side == 2) && p.pos == 0)
|
|
return;
|
|
}
|
|
for (i = 0; i != this$static.postCount; i++) {
|
|
pe = $get_4(this$static.model.extList, i);
|
|
(pe.side == 3 || pe.side == 2) && (pe.pos -= 1);
|
|
}
|
|
}
|
|
}
|
|
if (this$static.chip.sizeX + dx < 1 || this$static.chip.sizeY + dy < 1)
|
|
return;
|
|
this$static.model.sizeX += dx;
|
|
this$static.model.sizeY += dy;
|
|
$createPinsFromModel(this$static);
|
|
$drawChip_0(this$static);
|
|
}
|
|
|
|
function $createDialog(this$static){
|
|
var b, cancelButton, canvas, heightLabel, hp, okButton, scopeLabel, scopePanel, widthLabel;
|
|
this$static.vp = new VerticalPanel;
|
|
$setWidget_1(this$static, this$static.vp);
|
|
$setText(this$static, LS('Edit Subcircuit Pin Layout'));
|
|
$add_5(this$static.vp, new Label_1(LS('Drag the pins to the desired position')));
|
|
new Date_0;
|
|
canvas = createIfSupported();
|
|
($clinit_DOM() , canvas.element).style['width'] = '400 px';
|
|
canvas.element.style['height'] = '400 px';
|
|
canvas.element.width = 400;
|
|
canvas.element.height = 400;
|
|
$add_5(this$static.vp, canvas);
|
|
doTouchHandlers(null, canvas.element);
|
|
this$static.context = canvas.element.getContext('2d');
|
|
this$static.chip = new CustomCompositeChipElm(50, 50);
|
|
this$static.chip.x2 = 200;
|
|
this$static.chip.y2 = 50;
|
|
this$static.selectedPin = -1;
|
|
$createPinsFromModel(this$static);
|
|
if (this$static.model.name_0 == null) {
|
|
$add_5(this$static.vp, new Label_1(LS('Model Name')));
|
|
this$static.modelNameTextBox = new TextBox;
|
|
$add_5(this$static.vp, this$static.modelNameTextBox);
|
|
$addValueChangeHandler_1(this$static.modelNameTextBox, new EditCompositeModelDialog$2(this$static));
|
|
}
|
|
hp = new HorizontalPanel;
|
|
$setVerticalAlignment_0(hp, ($clinit_HasVerticalAlignment() , ALIGN_MIDDLE));
|
|
widthLabel = new Label_1(LS('Width'));
|
|
widthLabel.element.style['marginRight'] = ($clinit_Style$Unit() , '6.0px');
|
|
$add_3(hp, widthLabel);
|
|
$add_3(hp, b = new Button_1('+'));
|
|
$addDomHandler(b, new EditCompositeModelDialog$3(this$static), ($clinit_ClickEvent() , $clinit_ClickEvent() , TYPE_1));
|
|
$add_3(hp, b = new Button_1('-'));
|
|
b.element.style['marginRight'] = '10.0px';
|
|
$addDomHandler(b, new EditCompositeModelDialog$4(this$static), (null , TYPE_1));
|
|
heightLabel = new Label_1(LS('Height'));
|
|
heightLabel.element.style['marginRight'] = '6.0px';
|
|
$add_3(hp, heightLabel);
|
|
$add_3(hp, b = new Button_1('+'));
|
|
$addDomHandler(b, new EditCompositeModelDialog$5(this$static), (null , TYPE_1));
|
|
$add_3(hp, b = new Button_1('-'));
|
|
$addDomHandler(b, new EditCompositeModelDialog$6(this$static), (null , TYPE_1));
|
|
$add_5(this$static.vp, hp);
|
|
setStyleName(hp.element, 'topSpace', true);
|
|
$add_5(this$static.vp, this$static.labelCheck = new Checkbox(LS('Show Label')));
|
|
$setState_0(this$static.labelCheck, (this$static.model.flags & 1) != 0);
|
|
$addDomHandler(this$static.labelCheck, new EditCompositeModelDialog$7(this$static), (null , TYPE_1));
|
|
scopePanel = new HorizontalPanel;
|
|
$setVerticalAlignment_0(scopePanel, ALIGN_MIDDLE);
|
|
setStyleName(scopePanel.element, 'topSpace', true);
|
|
scopeLabel = new Label_1(LS('Scope:'));
|
|
scopeLabel.element.style['marginRight'] = '8.0px';
|
|
$add_3(scopePanel, scopeLabel);
|
|
this$static.scopeChoice = new Choice;
|
|
$addItem(this$static.scopeChoice, LS(LS('This Circuit')));
|
|
$addItem(this$static.scopeChoice, LS(LS('This Session')));
|
|
$addItem(this$static.scopeChoice, LS(LS('Save Across Sessions')));
|
|
$isSaved(this$static.model)?$select(this$static.scopeChoice, 2):this$static.model.name_0 != null && $hasStringValue(globalModelMap, this$static.model.name_0)?$select(this$static.scopeChoice, 1):$select(this$static.scopeChoice, 0);
|
|
$add_3(scopePanel, this$static.scopeChoice);
|
|
$add_5(this$static.vp, scopePanel);
|
|
$addDomHandler(canvas, this$static, ($clinit_MouseDownEvent() , $clinit_MouseDownEvent() , TYPE_7));
|
|
$addDomHandler(canvas, this$static, ($clinit_MouseUpEvent() , $clinit_MouseUpEvent() , TYPE_11));
|
|
$addDomHandler(canvas, this$static, ($clinit_MouseMoveEvent() , $clinit_MouseMoveEvent() , TYPE_8));
|
|
$addDomHandler(canvas, this$static, ($clinit_MouseOutEvent() , $clinit_MouseOutEvent() , TYPE_9));
|
|
$addDomHandler(canvas, this$static, ($clinit_MouseOverEvent() , $clinit_MouseOverEvent() , TYPE_10));
|
|
hp = new HorizontalPanel;
|
|
hp.element.style['width'] = '100%';
|
|
$setHorizontalAlignment_0(hp, ($clinit_HasHorizontalAlignment() , ALIGN_LEFT));
|
|
hp.element.className = 'topSpace';
|
|
$add_5(this$static.vp, hp);
|
|
$add_3(hp, okButton = new Button_1(LS('OK')));
|
|
$setHorizontalAlignment_0(hp, ALIGN_RIGHT);
|
|
$add_3(hp, cancelButton = new Button_1(LS('Cancel')));
|
|
$addDomHandler(cancelButton, new EditCompositeModelDialog$8(this$static), (null , TYPE_1));
|
|
$addDomHandler(okButton, new EditCompositeModelDialog$9(this$static), (null , TYPE_1));
|
|
$center(this$static);
|
|
}
|
|
|
|
function $createModel(this$static){
|
|
var i, minHeight, nodeSet, pin, pinsNS, pinsWE, postCount, sideCounts, xOffsetLeft, xOffsetRight;
|
|
nodeSet = new HashSet;
|
|
this$static.model = $getCircuitAsComposite(theSim);
|
|
if (!this$static.model)
|
|
return false;
|
|
if (this$static.model.extList.arrayList.array.length == 0) {
|
|
alert_0(LS('Device has no external inputs/outputs!'));
|
|
return false;
|
|
}
|
|
$clinit_Collections();
|
|
$sort_0(this$static.model.extList, new EditCompositeModelDialog$1);
|
|
postCount = this$static.model.extList.arrayList.array.length;
|
|
sideCounts = stampJavaTypeInfo(getClassLiteralForArray(I_classLit, 1), $intern_25, 7, 15, [0, 0, 0, 0]);
|
|
for (i = 0; i != postCount; i++) {
|
|
pin = $get_4(this$static.model.extList, i);
|
|
pin.busZ == 0 && (sideCounts[pin.side] += 1);
|
|
if ($contains_3(nodeSet, valueOf_0(pin.node))) {
|
|
alert_0(LS("Can't have two input/output nodes connected!"));
|
|
return false;
|
|
}
|
|
$add_9(nodeSet, valueOf_0(pin.node));
|
|
}
|
|
xOffsetLeft = sideCounts[2] > 0?1:0;
|
|
xOffsetRight = sideCounts[3] > 0?1:0;
|
|
for (i = 0; i != postCount; i++) {
|
|
pin = $get_4(this$static.model.extList, i);
|
|
(pin.side == 0 || pin.side == 1) && (pin.pos += xOffsetLeft);
|
|
}
|
|
minHeight = sideCounts[0] > 0 && sideCounts[1] > 0?2:1;
|
|
pinsNS = $wnd.Math.max(sideCounts[0], sideCounts[1]);
|
|
pinsWE = $wnd.Math.max(sideCounts[2], sideCounts[3]);
|
|
this$static.model.sizeX = $wnd.Math.max(2, pinsNS + xOffsetLeft + xOffsetRight);
|
|
this$static.model.sizeY = $wnd.Math.max(minHeight, pinsWE);
|
|
return true;
|
|
}
|
|
|
|
function $createPinsFromModel(this$static){
|
|
var i, pin;
|
|
this$static.postCount = this$static.model.extList.arrayList.array.length;
|
|
$allocPins(this$static.chip, this$static.postCount);
|
|
this$static.chip.sizeX = this$static.model.sizeX;
|
|
this$static.chip.sizeY = this$static.model.sizeY;
|
|
for (i = 0; i != this$static.postCount; i++) {
|
|
pin = $get_4(this$static.model.extList, i);
|
|
$setPin(this$static.chip, i, pin.pos, pin.side, pin.name_0);
|
|
this$static.chip.pins[i].busWidth = pin.busWidth;
|
|
this$static.chip.pins[i].busZ = pin.busZ;
|
|
this$static.chip.volts[i] = 0;
|
|
$contains_3(this$static.selectedPins, valueOf_0(i)) && (this$static.chip.pins[i].selected_0 = true);
|
|
}
|
|
$setPoints_0(this$static.chip);
|
|
}
|
|
|
|
function $drawChip_0(this$static){
|
|
var g, scaleh, scalew;
|
|
g = new Graphics(this$static.context);
|
|
scalew = this$static.context.canvas.width / (this$static.chip.boundingBox.width_0 + this$static.chip.boundingBox.x_0 * 2);
|
|
scaleh = this$static.context.canvas.height / (this$static.chip.boundingBox.height_0 + this$static.chip.boundingBox.y_0 * 2);
|
|
this$static.scale_0 = 1 / $wnd.Math.min(scalew, scaleh);
|
|
$setFillStyleWeb(this$static.context, $getHexValue($getBackgroundColor(theApp.ui)));
|
|
this$static.context.setTransform(1, 0, 0, 1, 0, 0);
|
|
$fillRect(this$static.context, 0, 0, this$static.context.canvas.width, this$static.context.canvas.height);
|
|
$setTransform(this$static.context, 1 / this$static.scale_0, 0, 0, 1 / this$static.scale_0, 0, 0);
|
|
$setLabel(this$static.chip, $booleanValue($getValue(this$static.labelCheck))?this$static.modelNameTextBox?$getText(this$static.modelNameTextBox):this$static.model.name_0:null);
|
|
$drawChip(this$static.chip, g);
|
|
}
|
|
|
|
function $enterPressed(this$static){
|
|
var app, changedModels, m, m$iterator, name_0, savedModel, scope_0;
|
|
if (this$static.modelNameTextBox) {
|
|
name_0 = $getText(this$static.modelNameTextBox);
|
|
if (name_0.length == 0) {
|
|
alert_0(LS('Please enter a model name.'));
|
|
return;
|
|
}
|
|
$setName_1(this$static.model, lastModelName = name_0);
|
|
}
|
|
scope_0 = $getElement(this$static.scopeChoice).selectedIndex;
|
|
$removeStringValue(localModelMap, this$static.model.name_0);
|
|
$removeStringValue(globalModelMap, this$static.model.name_0);
|
|
$setSaved(this$static.model, false);
|
|
scope_0 == 0?$putStringValue(localModelMap, this$static.model.name_0, this$static.model):scope_0 == 1?$putStringValue(globalModelMap, this$static.model.name_0, this$static.model):$setSaved(this$static.model, true);
|
|
$updateModels(theApp);
|
|
$needAnalyze(theApp);
|
|
!this$static.popContext && theApp.contextStack.arrayList.array.length != 0 && $add_11($lastElement(theApp.contextStack).changedModels, this$static.model);
|
|
if (this$static.popContext) {
|
|
app = theApp;
|
|
savedModel = this$static.model;
|
|
changedModels = $popContextAndGetChangedModels(app);
|
|
$add_8(changedModels.arrayList, savedModel);
|
|
for (m$iterator = new ArrayList$1(changedModels.arrayList); m$iterator.i < m$iterator.this$01.array.length;) {
|
|
m = $next_4(m$iterator);
|
|
$putStringValue(localModelMap, m.name_0, m);
|
|
++sequenceNumber;
|
|
$refreshModels(app, m.name_0);
|
|
}
|
|
app.contextStack.arrayList.array.length == 0 || $addAll_1($lastElement(app.contextStack).changedModels, changedModels);
|
|
}
|
|
$hide_0(this$static, false);
|
|
dialogShowing == this$static && (dialogShowing = null);
|
|
}
|
|
|
|
function $findNearestPin(this$static, x_0, y_0){
|
|
var best, bestdist, dist, dx, dy, i, p;
|
|
bestdist = 20;
|
|
best = -1;
|
|
for (i = 0; i != this$static.postCount; i++) {
|
|
p = this$static.chip.pins[i];
|
|
if (p.busZ > 0)
|
|
continue;
|
|
dx = round_int(x_0 * this$static.scale_0) - p.textloc.x_0;
|
|
dy = round_int(y_0 * this$static.scale_0) - p.textloc.y_0;
|
|
dist = !isNaN(dx) && !isFinite(dx) || !isNaN(dy) && !isFinite(dy)?$intern_26:$wnd.Math.sqrt(dx * dx + dy * dy);
|
|
if (dist < bestdist) {
|
|
bestdist = dist;
|
|
best = i;
|
|
}
|
|
}
|
|
return best;
|
|
}
|
|
|
|
function $mouseMoved(this$static, x_0, y_0){
|
|
var anchor, available, contiguous, delta, displaced, entry, groupPos, groupSize, hoveredPin, i, i0, i1, idx, idx$iterator, idx$iterator0, idx$iterator1, j, k, k0, k1, maxNewPos, maxOff, minOff, newPos, newSide, off, origPos, outerIter, outerIter0, outerIter1, pj, pjj, pos, px, py, sameSide, sameSideCount, selSide2, slot, slots, taken, x1, x2, y1, y2, x1_0, y1_0, w, h;
|
|
if (this$static.rubberBand) {
|
|
this$static.rubberBandX2 = x_0;
|
|
this$static.rubberBandY2 = y_0;
|
|
x1 = $wnd.Math.min(this$static.rubberBandX1, this$static.rubberBandX2);
|
|
x2 = $wnd.Math.max(this$static.rubberBandX1, this$static.rubberBandX2);
|
|
y1 = $wnd.Math.min(this$static.rubberBandY1, this$static.rubberBandY2);
|
|
y2 = $wnd.Math.max(this$static.rubberBandY1, this$static.rubberBandY2);
|
|
selSide2 = $size(this$static.selectedPins.map_0) == 0?-1:$get_4(this$static.model.extList, (entry = $next_2((outerIter = new AbstractHashMap$EntrySetIterator((new AbstractHashMap$EntrySet((new AbstractMap$1(this$static.selectedPins.map_0)).this$01)).this$01) , new AbstractMap$1$1(outerIter)).val$outerIter2) , entry.getKey()).value_0).side;
|
|
if (selSide2 == -1) {
|
|
for (i0 = 0; i0 != this$static.postCount; i0++) {
|
|
if (this$static.chip.pins[i0].busZ > 0)
|
|
continue;
|
|
px = round_int(this$static.chip.pins[i0].textloc.x_0 / this$static.scale_0);
|
|
py = round_int(this$static.chip.pins[i0].textloc.y_0 / this$static.scale_0);
|
|
if (px >= x1 && px <= x2 && py >= y1 && py <= y2) {
|
|
selSide2 = $get_4(this$static.model.extList, i0).side;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
for (i = 0; i != this$static.postCount; i++) {
|
|
this$static.chip.pins[i].selected_0 = $contains_3(this$static.selectedPins, valueOf_0(i));
|
|
if (this$static.chip.pins[i].busZ > 0)
|
|
continue;
|
|
px = round_int(this$static.chip.pins[i].textloc.x_0 / this$static.scale_0);
|
|
py = round_int(this$static.chip.pins[i].textloc.y_0 / this$static.scale_0);
|
|
px >= x1 && px <= x2 && py >= y1 && py <= y2 && $get_4(this$static.model.extList, i).side == selSide2 && (this$static.chip.pins[i].selected_0 = true);
|
|
}
|
|
$drawChip_0(this$static);
|
|
x1_0 = $wnd.Math.min(this$static.rubberBandX1, this$static.rubberBandX2);
|
|
y1_0 = $wnd.Math.min(this$static.rubberBandY1, this$static.rubberBandY2);
|
|
w = $wnd.Math.abs(this$static.rubberBandX2 - this$static.rubberBandX1);
|
|
h = $wnd.Math.abs(this$static.rubberBandY2 - this$static.rubberBandY1);
|
|
this$static.context.save();
|
|
this$static.context.setTransform(1, 0, 0, 1, 0, 0);
|
|
this$static.context.fillStyle = 'rgba(68,136,255,0.15)';
|
|
$fillRect(this$static.context, x1_0, y1_0, w, h);
|
|
this$static.context.strokeStyle = '#4488ff';
|
|
this$static.context.lineWidth = 1;
|
|
$strokeRect(this$static.context, x1_0, y1_0, w, h);
|
|
this$static.context.restore();
|
|
return;
|
|
}
|
|
if (this$static.dragging) {
|
|
if (this$static.selectedPin < 0)
|
|
return;
|
|
pos = initUnidimensionalArray(I_classLit, $intern_25, 7, 2, 15, 1);
|
|
if (!$getPinPos(this$static.chip, round_int(x_0 * this$static.scale_0), round_int(y_0 * this$static.scale_0), this$static.dragCurrentSide, pos))
|
|
return;
|
|
this$static.dragCurrentSide = pos[1];
|
|
for (i0 = 0; i0 < this$static.postCount; i0++) {
|
|
$get_4(this$static.model.extList, i0).pos = this$static.dragStartPosArr[i0];
|
|
$get_4(this$static.model.extList, i0).side = this$static.dragStartSideArr[i0];
|
|
}
|
|
newSide = pos[1];
|
|
maxNewPos = newSide == 0 || newSide == 1?this$static.chip.sizeX - 1:this$static.chip.sizeY - 1;
|
|
minOff = $intern_0;
|
|
maxOff = $intern_113;
|
|
sameSideCount = 0;
|
|
for (idx$iterator0 = (outerIter0 = new AbstractHashMap$EntrySetIterator((new AbstractHashMap$EntrySet((new AbstractMap$1(this$static.selectedPins.map_0)).this$01)).this$01) , new AbstractMap$1$1(outerIter0)); idx$iterator0.val$outerIter2.hasNext;) {
|
|
idx = (entry = $next_2(idx$iterator0.val$outerIter2) , entry.getKey()).value_0;
|
|
if (this$static.dragStartSideArr[idx] != this$static.dragStartSide)
|
|
continue;
|
|
++sameSideCount;
|
|
off = this$static.dragStartPosArr[idx] - this$static.dragStartPos;
|
|
off < minOff && (minOff = off);
|
|
off > maxOff && (maxOff = off);
|
|
}
|
|
groupSize = maxOff - minOff + 1;
|
|
if (groupSize > maxNewPos + 1) {
|
|
newSide = this$static.dragStartSide;
|
|
maxNewPos = newSide == 0 || newSide == 1?this$static.chip.sizeX - 1:this$static.chip.sizeY - 1;
|
|
}
|
|
anchor = $wnd.Math.max(-minOff, $wnd.Math.min(maxNewPos - maxOff, pos[0]));
|
|
delta = anchor - this$static.dragStartPos;
|
|
sameSide = newSide == this$static.dragStartSide;
|
|
contiguous = groupSize == sameSideCount;
|
|
if (sameSide && contiguous) {
|
|
for (i = 0; i < this$static.postCount; i++) {
|
|
if ($contains_3(this$static.selectedPins, valueOf_0(i)) || this$static.chip.pins[i].busZ > 0)
|
|
continue;
|
|
if (this$static.dragStartSideArr[i] != this$static.dragStartSide)
|
|
continue;
|
|
origPos = this$static.dragStartPosArr[i];
|
|
delta >= 0?(newPos = origPos >= this$static.dragStartPos + maxOff + 1 && origPos <= anchor + maxOff?origPos - groupSize:origPos):(newPos = origPos >= anchor + minOff && origPos <= this$static.dragStartPos + minOff - 1?origPos + groupSize:origPos);
|
|
if (newPos != origPos) {
|
|
pj = $get_4(this$static.model.extList, i);
|
|
pj.pos = newPos;
|
|
for (j = 0; j < this$static.postCount; j++) {
|
|
pjj = $get_4(this$static.model.extList, j);
|
|
$equals_1(pjj.name_0, pj.name_0) && pjj.busWidth == pj.busWidth && (pjj.pos = newPos);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else {
|
|
groupPos = new HashSet;
|
|
for (idx$iterator1 = (outerIter1 = new AbstractHashMap$EntrySetIterator((new AbstractHashMap$EntrySet((new AbstractMap$1(this$static.selectedPins.map_0)).this$01)).this$01) , new AbstractMap$1$1(outerIter1)); idx$iterator1.val$outerIter2.hasNext;) {
|
|
idx = (entry = $next_2(idx$iterator1.val$outerIter2) , entry.getKey()).value_0;
|
|
if (this$static.dragStartSideArr[idx] != this$static.dragStartSide)
|
|
continue;
|
|
$add_9(groupPos, valueOf_0(anchor + this$static.dragStartPosArr[idx] - this$static.dragStartPos));
|
|
}
|
|
displaced = new Vector;
|
|
for (i1 = 0; i1 < this$static.postCount; i1++) {
|
|
if ($contains_3(this$static.selectedPins, valueOf_0(i1)) || this$static.chip.pins[i1].busZ > 0)
|
|
continue;
|
|
if (this$static.dragStartSideArr[i1] != newSide)
|
|
continue;
|
|
$contains_3(groupPos, valueOf_0(this$static.dragStartPosArr[i1])) && $add_11(displaced, valueOf_0(i1));
|
|
}
|
|
taken = new HashSet;
|
|
for (i = 0; i < this$static.postCount; i++) {
|
|
if ($contains_3(this$static.selectedPins, valueOf_0(i)) || this$static.chip.pins[i].busZ > 0)
|
|
continue;
|
|
this$static.dragStartSideArr[i] == newSide && !$contains_3(groupPos, valueOf_0(this$static.dragStartPosArr[i])) && $add_9(taken, valueOf_0(this$static.dragStartPosArr[i]));
|
|
}
|
|
available = new Vector;
|
|
for (slot = 0; slot <= maxNewPos; slot++)
|
|
!$contains_3(groupPos, valueOf_0(slot)) && !$contains_3(taken, valueOf_0(slot)) && $add_11(available, valueOf_0(slot));
|
|
$clinit_Collections();
|
|
$sort_0(displaced, new EditCompositeModelDialog$10(this$static));
|
|
$sort(available.arrayList, null);
|
|
slots = new Vector;
|
|
if (delta >= 0) {
|
|
for (k0 = available.arrayList.array.length - 1; k0 >= 0 && slots.arrayList.array.length < displaced.arrayList.array.length; k0--)
|
|
(checkArrayElementIndex(k0, available.arrayList.array.length) , $get_2(available.arrayList, k0)).value_0 < anchor && $add_11(slots, (checkArrayElementIndex(k0, available.arrayList.array.length) , $get_2(available.arrayList, k0)));
|
|
for (k1 = 0; k1 < available.arrayList.array.length && slots.arrayList.array.length < displaced.arrayList.array.length; k1++)
|
|
(checkArrayElementIndex(k1, available.arrayList.array.length) , $get_2(available.arrayList, k1)).value_0 > anchor + maxOff && $add_11(slots, (checkArrayElementIndex(k1, available.arrayList.array.length) , $get_2(available.arrayList, k1)));
|
|
}
|
|
else {
|
|
for (k0 = 0; k0 < available.arrayList.array.length && slots.arrayList.array.length < displaced.arrayList.array.length; k0++)
|
|
(checkArrayElementIndex(k0, available.arrayList.array.length) , $get_2(available.arrayList, k0)).value_0 > anchor + maxOff && $add_11(slots, (checkArrayElementIndex(k0, available.arrayList.array.length) , $get_2(available.arrayList, k0)));
|
|
for (k1 = available.arrayList.array.length - 1; k1 >= 0 && slots.arrayList.array.length < displaced.arrayList.array.length; k1--)
|
|
(checkArrayElementIndex(k1, available.arrayList.array.length) , $get_2(available.arrayList, k1)).value_0 < anchor && $add_11(slots, (checkArrayElementIndex(k1, available.arrayList.array.length) , $get_2(available.arrayList, k1)));
|
|
}
|
|
$sort(slots.arrayList, null);
|
|
for (k = 0; k < displaced.arrayList.array.length && k < slots.arrayList.array.length; k++) {
|
|
newPos = (checkArrayElementIndex(k, slots.arrayList.array.length) , $get_2(slots.arrayList, k)).value_0;
|
|
pj = $get_4(this$static.model.extList, (checkArrayElementIndex(k, displaced.arrayList.array.length) , $get_2(displaced.arrayList, k)).value_0);
|
|
pj.pos = newPos;
|
|
for (j = 0; j < this$static.postCount; j++) {
|
|
pjj = $get_4(this$static.model.extList, j);
|
|
$equals_1(pjj.name_0, pj.name_0) && pjj.busWidth == pj.busWidth && (pjj.pos = newPos);
|
|
}
|
|
}
|
|
}
|
|
for (idx$iterator = (outerIter = new AbstractHashMap$EntrySetIterator((new AbstractHashMap$EntrySet((new AbstractMap$1(this$static.selectedPins.map_0)).this$01)).this$01) , new AbstractMap$1$1(outerIter)); idx$iterator.val$outerIter2.hasNext;) {
|
|
idx = (entry = $next_2(idx$iterator.val$outerIter2) , entry.getKey()).value_0;
|
|
if (this$static.dragStartSideArr[idx] != this$static.dragStartSide)
|
|
continue;
|
|
newPos = anchor + this$static.dragStartPosArr[idx] - this$static.dragStartPos;
|
|
pj = $get_4(this$static.model.extList, idx);
|
|
pj.pos = newPos;
|
|
pj.side = newSide;
|
|
for (j = 0; j < this$static.postCount; j++) {
|
|
pjj = $get_4(this$static.model.extList, j);
|
|
if ($equals_1(pjj.name_0, pj.name_0) && pjj.busWidth == pj.busWidth) {
|
|
pjj.pos = newPos;
|
|
pjj.side = newSide;
|
|
}
|
|
}
|
|
}
|
|
$createPinsFromModel(this$static);
|
|
$drawChip_0(this$static);
|
|
}
|
|
else {
|
|
hoveredPin = $findNearestPin(this$static, x_0, y_0);
|
|
for (i = 0; i != this$static.postCount; i++)
|
|
this$static.chip.pins[i].selected_0 = $contains_3(this$static.selectedPins, valueOf_0(i)) || i == hoveredPin;
|
|
$drawChip_0(this$static);
|
|
}
|
|
}
|
|
|
|
function $setModel(this$static, m){
|
|
this$static.model = m;
|
|
}
|
|
|
|
function $updatePinHighlight(this$static){
|
|
var i;
|
|
for (i = 0; i != this$static.postCount; i++)
|
|
this$static.chip.pins[i].selected_0 = $contains_3(this$static.selectedPins, valueOf_0(i));
|
|
}
|
|
|
|
function EditCompositeModelDialog(){
|
|
Dialog.call(this);
|
|
this.modelNameTextBox = null;
|
|
this.scopeChoice = null;
|
|
this.labelCheck = null;
|
|
this.selectedPins = new HashSet;
|
|
this.closeOnEnter = true;
|
|
}
|
|
|
|
function pinIsOccupied(pos, side, placed, sizeX, sizeY){
|
|
var g, p, p$iterator;
|
|
g = pinToGrid(pos, side, sizeX, sizeY);
|
|
if (g < 0)
|
|
return true;
|
|
for (p$iterator = new ArrayList$1(placed.arrayList); p$iterator.i < p$iterator.this$01.array.length;) {
|
|
p = $next_4(p$iterator);
|
|
if (pinToGrid(p[0], p[1], sizeX, sizeY) == g)
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
function pinToGrid(pos, side, sizeX, sizeY){
|
|
if (side == 0)
|
|
return pos;
|
|
if (side == 1)
|
|
return pos + sizeX * (sizeY - 1);
|
|
if (side == 2)
|
|
return pos * sizeX;
|
|
if (side == 3)
|
|
return pos * sizeX + sizeX - 1;
|
|
return -1;
|
|
}
|
|
|
|
function preservePinLayout(newModel, existingModel){
|
|
var anchor, anchor$iterator, anyPreserved, curSizeX, curSizeY, ent, ent$iterator, expansion, foundPos, i, i0, matched, maxPos, n, ns, old, old$iterator, p, placed, side;
|
|
n = newModel.extList.arrayList.array.length;
|
|
matched = initUnidimensionalArray(Z_classLit, $intern_95, 7, n, 16, 1);
|
|
anyPreserved = false;
|
|
placed = new Vector;
|
|
for (i0 = 0; i0 < n; i0++) {
|
|
ent = $get_4(newModel.extList, i0);
|
|
if (ent.busZ != 0)
|
|
continue;
|
|
for (old$iterator = new ArrayList$1(existingModel.extList.arrayList); old$iterator.i < old$iterator.this$01.array.length;) {
|
|
old = $next_4(old$iterator);
|
|
if (old.busZ == 0 && $equals_1(old.name_0, ent.name_0)) {
|
|
ent.pos = old.pos;
|
|
ent.side = old.side;
|
|
matched[i0] = true;
|
|
anyPreserved = true;
|
|
break;
|
|
}
|
|
}
|
|
matched[i0] && $add_11(placed, stampJavaTypeInfo(getClassLiteralForArray(I_classLit, 1), $intern_25, 7, 15, [ent.pos, ent.side]));
|
|
}
|
|
if (!anyPreserved)
|
|
return;
|
|
newModel.sizeX = existingModel.sizeX;
|
|
newModel.sizeY = existingModel.sizeY;
|
|
for (i = 0; i < n; i++) {
|
|
if (matched[i])
|
|
continue;
|
|
ent = $get_4(newModel.extList, i);
|
|
if (ent.busZ != 0)
|
|
continue;
|
|
side = ent.side;
|
|
ns = side == 0 || side == 1;
|
|
foundPos = -1;
|
|
for (expansion = 0; expansion <= n && foundPos < 0; expansion++) {
|
|
curSizeX = newModel.sizeX + (ns?expansion:0);
|
|
curSizeY = newModel.sizeY + (ns?0:expansion);
|
|
maxPos = ns?curSizeX:curSizeY;
|
|
for (p = 0; p < maxPos; p++) {
|
|
if (!pinIsOccupied(p, side, placed, curSizeX, curSizeY)) {
|
|
foundPos = p;
|
|
newModel.sizeX = curSizeX;
|
|
newModel.sizeY = curSizeY;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
ent.pos = foundPos >= 0?foundPos:0;
|
|
$add_11(placed, stampJavaTypeInfo(getClassLiteralForArray(I_classLit, 1), $intern_25, 7, 15, [ent.pos, side]));
|
|
}
|
|
for (ent$iterator = new ArrayList$1(newModel.extList.arrayList); ent$iterator.i < ent$iterator.this$01.array.length;) {
|
|
ent = $next_4(ent$iterator);
|
|
if (ent.busZ == 0)
|
|
continue;
|
|
for (anchor$iterator = new ArrayList$1(newModel.extList.arrayList); anchor$iterator.i < anchor$iterator.this$01.array.length;) {
|
|
anchor = $next_4(anchor$iterator);
|
|
if (anchor.busZ == 0 && $equals_1(anchor.name_0, ent.name_0)) {
|
|
ent.pos = anchor.pos;
|
|
ent.side = anchor.side;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
defineClass(261, 140, {208:1, 457:1, 173:1, 228:1, 316:1, 28:1, 64:1, 11:1, 25:1, 60:1, 27:1, 67:1, 59:1, 50:1, 23:1, 44:1, 29:1, 48:1, 22:1, 24:1, 36:1, 107:1}, EditCompositeModelDialog);
|
|
_.enterPressed = function enterPressed_0(){
|
|
$enterPressed(this);
|
|
}
|
|
;
|
|
_.onMouseDown = function onMouseDown_0(event_0){
|
|
var entry, hSide, hoveredPin, i, ok, outerIter, pe, sp, x_0, y_0;
|
|
x_0 = $getX(event_0);
|
|
y_0 = $getY(event_0);
|
|
hoveredPin = $findNearestPin(this, x_0, y_0);
|
|
if (hoveredPin < 0) {
|
|
!!event_0.nativeEvent.shiftKey || $reset_13(this.selectedPins.map_0);
|
|
this.rubberBand = true;
|
|
this.rubberBandX1 = this.rubberBandX2 = x_0;
|
|
this.rubberBandY1 = this.rubberBandY2 = y_0;
|
|
$updatePinHighlight(this);
|
|
$drawChip_0(this);
|
|
return;
|
|
}
|
|
this.rubberBand = false;
|
|
if (event_0.nativeEvent.shiftKey) {
|
|
if ($contains_3(this.selectedPins, valueOf_0(hoveredPin))) {
|
|
$remove_15(this.selectedPins, valueOf_0(hoveredPin));
|
|
}
|
|
else {
|
|
hSide = $get_4(this.model.extList, hoveredPin).side;
|
|
ok = $size(this.selectedPins.map_0) == 0;
|
|
ok || (ok = $get_4(this.model.extList, (entry = $next_2((outerIter = new AbstractHashMap$EntrySetIterator((new AbstractHashMap$EntrySet((new AbstractMap$1(this.selectedPins.map_0)).this$01)).this$01) , new AbstractMap$1$1(outerIter)).val$outerIter2) , entry.getKey()).value_0).side == hSide);
|
|
ok && $add_9(this.selectedPins, valueOf_0(hoveredPin));
|
|
}
|
|
}
|
|
else {
|
|
if (!$contains_3(this.selectedPins, valueOf_0(hoveredPin))) {
|
|
$reset_13(this.selectedPins.map_0);
|
|
$add_9(this.selectedPins, valueOf_0(hoveredPin));
|
|
}
|
|
}
|
|
this.selectedPin = hoveredPin;
|
|
this.dragStartPosArr = initUnidimensionalArray(I_classLit, $intern_25, 7, this.postCount, 15, 1);
|
|
this.dragStartSideArr = initUnidimensionalArray(I_classLit, $intern_25, 7, this.postCount, 15, 1);
|
|
for (i = 0; i < this.postCount; i++) {
|
|
pe = $get_4(this.model.extList, i);
|
|
this.dragStartPosArr[i] = pe.pos;
|
|
this.dragStartSideArr[i] = pe.side;
|
|
}
|
|
sp = $get_4(this.model.extList, this.selectedPin);
|
|
this.dragStartPos = sp.pos;
|
|
this.dragStartSide = this.dragCurrentSide = sp.side;
|
|
$updatePinHighlight(this);
|
|
this.dragging = true;
|
|
$drawChip_0(this);
|
|
}
|
|
;
|
|
_.onMouseMove = function onMouseMove_0(event_0){
|
|
$mouseMoved(this, $getX(event_0), $getY(event_0));
|
|
}
|
|
;
|
|
_.onMouseOut = function onMouseOut_0(event_0){
|
|
}
|
|
;
|
|
_.onMouseOver = function onMouseOver_0(event_0){
|
|
}
|
|
;
|
|
_.onMouseUp = function onMouseUp_0(event_0){
|
|
var entry, i, outerIter, px, py, selSide, x1, x2, y1, y2;
|
|
if (this.rubberBand) {
|
|
x1 = $wnd.Math.min(this.rubberBandX1, this.rubberBandX2);
|
|
x2 = $wnd.Math.max(this.rubberBandX1, this.rubberBandX2);
|
|
y1 = $wnd.Math.min(this.rubberBandY1, this.rubberBandY2);
|
|
y2 = $wnd.Math.max(this.rubberBandY1, this.rubberBandY2);
|
|
selSide = $size(this.selectedPins.map_0) == 0?-1:$get_4(this.model.extList, (entry = $next_2((outerIter = new AbstractHashMap$EntrySetIterator((new AbstractHashMap$EntrySet((new AbstractMap$1(this.selectedPins.map_0)).this$01)).this$01) , new AbstractMap$1$1(outerIter)).val$outerIter2) , entry.getKey()).value_0).side;
|
|
for (i = 0; i != this.postCount; i++) {
|
|
if (this.chip.pins[i].busZ > 0)
|
|
continue;
|
|
px = round_int(this.chip.pins[i].textloc.x_0 / this.scale_0);
|
|
py = round_int(this.chip.pins[i].textloc.y_0 / this.scale_0);
|
|
if (px >= x1 && px <= x2 && py >= y1 && py <= y2) {
|
|
selSide == -1 && (selSide = $get_4(this.model.extList, i).side);
|
|
$get_4(this.model.extList, i).side == selSide && $add_9(this.selectedPins, valueOf_0(i));
|
|
}
|
|
}
|
|
this.rubberBand = false;
|
|
$updatePinHighlight(this);
|
|
$drawChip_0(this);
|
|
}
|
|
this.dragging = false;
|
|
}
|
|
;
|
|
_.show = function show_2(){
|
|
!this.resizeHandlerRegistration && (this.resizeHandlerRegistration = addResizeHandler(new DialogBox$1(this)));
|
|
$show(this);
|
|
$drawChip_0(this);
|
|
}
|
|
;
|
|
_.dragCurrentSide = 0;
|
|
_.dragStartPos = 0;
|
|
_.dragStartSide = 0;
|
|
_.dragging = false;
|
|
_.popContext = false;
|
|
_.postCount = 0;
|
|
_.rubberBand = false;
|
|
_.rubberBandX1 = 0;
|
|
_.rubberBandX2 = 0;
|
|
_.rubberBandY1 = 0;
|
|
_.rubberBandY2 = 0;
|
|
_.scale_0 = 0;
|
|
_.selectedPin = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_EditCompositeModelDialog_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'EditCompositeModelDialog', 261);
|
|
function EditCompositeModelDialog$1(){
|
|
}
|
|
|
|
defineClass(729, 1, {}, EditCompositeModelDialog$1);
|
|
_.compare = function compare_1(a, b){
|
|
return $compareTo(a.name_0.toLowerCase(), b.name_0.toLowerCase());
|
|
}
|
|
;
|
|
_.equals_0 = function equals_7(other){
|
|
return this === other;
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_EditCompositeModelDialog$1_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'EditCompositeModelDialog/1', 729);
|
|
function EditCompositeModelDialog$10(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(738, 1, {}, EditCompositeModelDialog$10);
|
|
_.compare = function compare_2(a, b){
|
|
return this.this$01.dragStartPosArr[a.value_0] - this.this$01.dragStartPosArr[b.value_0];
|
|
}
|
|
;
|
|
_.equals_0 = function equals_8(other){
|
|
return this === other;
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_EditCompositeModelDialog$10_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'EditCompositeModelDialog/10', 738);
|
|
function EditCompositeModelDialog$2(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(730, 1, $intern_68, EditCompositeModelDialog$2);
|
|
_.onValueChange = function onValueChange_0(event_0){
|
|
$drawChip_0(this.this$01);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_EditCompositeModelDialog$2_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'EditCompositeModelDialog/2', 730);
|
|
function EditCompositeModelDialog$3(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(731, 1, $intern_56, EditCompositeModelDialog$3);
|
|
_.onClick = function onClick_2(event_0){
|
|
$adjustChipSize(this.this$01, 1, 0);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_EditCompositeModelDialog$3_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'EditCompositeModelDialog/3', 731);
|
|
function EditCompositeModelDialog$4(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(732, 1, $intern_56, EditCompositeModelDialog$4);
|
|
_.onClick = function onClick_3(event_0){
|
|
$adjustChipSize(this.this$01, -1, 0);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_EditCompositeModelDialog$4_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'EditCompositeModelDialog/4', 732);
|
|
function EditCompositeModelDialog$5(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(733, 1, $intern_56, EditCompositeModelDialog$5);
|
|
_.onClick = function onClick_4(event_0){
|
|
$adjustChipSize(this.this$01, 0, 1);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_EditCompositeModelDialog$5_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'EditCompositeModelDialog/5', 733);
|
|
function EditCompositeModelDialog$6(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(734, 1, $intern_56, EditCompositeModelDialog$6);
|
|
_.onClick = function onClick_5(event_0){
|
|
$adjustChipSize(this.this$01, 0, -1);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_EditCompositeModelDialog$6_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'EditCompositeModelDialog/6', 734);
|
|
function EditCompositeModelDialog$7(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(735, 1, $intern_56, EditCompositeModelDialog$7);
|
|
_.onClick = function onClick_6(event_0){
|
|
$setShowLabel(this.this$01.model, $booleanValue($getValue(this.this$01.labelCheck)));
|
|
$drawChip_0(this.this$01);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_EditCompositeModelDialog$7_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'EditCompositeModelDialog/7', 735);
|
|
function EditCompositeModelDialog$8(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(736, 1, $intern_56, EditCompositeModelDialog$8);
|
|
_.onClick = function onClick_7(event_0){
|
|
$closeDialog(this.this$01);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_EditCompositeModelDialog$8_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'EditCompositeModelDialog/8', 736);
|
|
function EditCompositeModelDialog$9(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(737, 1, $intern_56, EditCompositeModelDialog$9);
|
|
_.onClick = function onClick_8(event_0){
|
|
$enterPressed(this.this$01);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_EditCompositeModelDialog$9_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'EditCompositeModelDialog/9', 737);
|
|
function $clinit_EditDialog(){
|
|
$clinit_EditDialog = emptyMethod;
|
|
noCommaFormat = ($clinit_NumberFormat() , new NumberFormat_0('####.##########', $getDefaultNative()));
|
|
}
|
|
|
|
function $addRepeatingStepHandler(this$static, button, ei, dir_0){
|
|
var repeatTimer, startRepeatTimer, stop_0, touchStop;
|
|
repeatTimer = new EditDialog$9(this$static, ei, dir_0);
|
|
startRepeatTimer = new EditDialog$10(repeatTimer);
|
|
$addDomHandler(button, new EditDialog$11(this$static, ei, dir_0, startRepeatTimer), ($clinit_MouseDownEvent() , $clinit_MouseDownEvent() , TYPE_7));
|
|
stop_0 = new EditDialog$12(startRepeatTimer, repeatTimer);
|
|
$addDomHandler(button, stop_0, ($clinit_MouseUpEvent() , $clinit_MouseUpEvent() , TYPE_11));
|
|
$addDomHandler(button, new EditDialog$13(startRepeatTimer, repeatTimer), ($clinit_MouseOutEvent() , $clinit_MouseOutEvent() , TYPE_9));
|
|
$addDomHandler(button, new EditDialog$14(this$static, ei, dir_0, startRepeatTimer), ($clinit_TouchStartEvent() , $clinit_TouchStartEvent() , TYPE_16));
|
|
touchStop = new EditDialog$15(startRepeatTimer, repeatTimer);
|
|
$addDomHandler(button, touchStop, ($clinit_TouchEndEvent() , $clinit_TouchEndEvent() , TYPE_14));
|
|
$addDomHandler(button, new EditDialog$16(startRepeatTimer, repeatTimer), ($clinit_TouchCancelEvent() , $clinit_TouchCancelEvent() , TYPE_13));
|
|
}
|
|
|
|
function $apply(this$static){
|
|
var adj, d, ei, field, i, msg;
|
|
for (i = 0; i != this$static.einfocount; i++) {
|
|
ei = this$static.einfos[i];
|
|
ei.error = null;
|
|
if (!!ei.textf && ei.text_0 == null) {
|
|
try {
|
|
d = $parseUnits(this$static, ei);
|
|
ei.value_0 = d;
|
|
}
|
|
catch ($e0) {
|
|
$e0 = toJava($e0);
|
|
if (!instanceOf($e0, 13))
|
|
throw toJs($e0);
|
|
}
|
|
}
|
|
ei.positive && ei.value_0 <= 0 && (ei.error = 'must be > 0');
|
|
ei.nonNegative && ei.value_0 < 0 && (ei.error = 'must be >= 0');
|
|
if (!!ei.button_0 || !!ei.choice)
|
|
continue;
|
|
ei.error == null && this$static.elm.setEditValue(i, ei);
|
|
if (ei.error != null) {
|
|
msg = ei.error;
|
|
field = ei.errorFieldName != null?ei.errorFieldName:ei.name_0;
|
|
field != null && field.length > 0 && (msg = field + ': ' + msg);
|
|
$setText_0(this$static.errorLabel, msg);
|
|
$setVisible(this$static.errorLabel, true);
|
|
return false;
|
|
}
|
|
if (instanceOf(this$static.elm, 8)) {
|
|
adj = $findAdjustable(this$static.cframe, this$static.elm, i);
|
|
!!adj && $setSliderValue(adj, ei.value_0);
|
|
}
|
|
if (ei.newDialog)
|
|
break;
|
|
}
|
|
$setVisible(this$static.errorLabel, false);
|
|
$needAnalyze(this$static.cframe);
|
|
return true;
|
|
}
|
|
|
|
function $buildDialog(this$static){
|
|
var ei, first, hp, i, l_0, name_0, vp, row, minus, plus;
|
|
hp = new HorizontalPanel;
|
|
vp = new VerticalPanel;
|
|
$insert_2(this$static.mainPanel, hp, $getWidgetIndex(this$static.mainPanel, this$static.bottomButtonPanel));
|
|
$add_3(hp, vp);
|
|
first = true;
|
|
for (i = 0;; i++) {
|
|
this$static.einfos[i] = this$static.elm.getEditInfo(i);
|
|
if (!this$static.einfos[i])
|
|
break;
|
|
ei = this$static.einfos[i];
|
|
if (vp.children.size_0 > 15 || ei.newColumn) {
|
|
vp = new VerticalPanel;
|
|
$add_3(hp, vp);
|
|
($clinit_DOM() , vp.element).style['paddingLeft'] = ($clinit_Style$Unit() , '10.0px');
|
|
first = true;
|
|
}
|
|
name_0 = LS(ei.name_0);
|
|
$startsWith(ei.name_0, '<')?$add_5(vp, l_0 = new HTML_0(name_0)):$add_5(vp, l_0 = new Label_1(name_0));
|
|
!first && !!l_0 && (($clinit_DOM() , l_0.element).className = 'topSpace' , undefined);
|
|
first = false;
|
|
if (ei.choice) {
|
|
$add_5(vp, ei.choice);
|
|
$addDomHandler(ei.choice, new EditDialog$5(this$static), ($clinit_ChangeEvent() , $clinit_ChangeEvent() , TYPE_0));
|
|
}
|
|
else if (ei.checkbox) {
|
|
$add_5(vp, ei.checkbox);
|
|
$addValueChangeHandler_0(ei.checkbox, new EditDialog$6(this$static));
|
|
}
|
|
else if (ei.button_0) {
|
|
$add_5(vp, ei.button_0);
|
|
if (ei.loadFile) {
|
|
$add_5(vp, ei.loadFile);
|
|
$addDomHandler(ei.button_0, new EditDialog$7, ($clinit_ClickEvent() , $clinit_ClickEvent() , TYPE_1));
|
|
}
|
|
else {
|
|
$addDomHandler(ei.button_0, new EditDialog$8(this$static), ($clinit_ClickEvent() , $clinit_ClickEvent() , TYPE_1));
|
|
}
|
|
}
|
|
else if (ei.textArea) {
|
|
$add_5(vp, ei.textArea);
|
|
!this$static.firstTextBox && (this$static.firstTextBox = ei.textArea);
|
|
this$static.closeOnEnter = false;
|
|
}
|
|
else if (ei.widget) {
|
|
$add_5(vp, ei.widget);
|
|
}
|
|
else {
|
|
ei.textf = new TextBox;
|
|
!this$static.firstTextBox && (this$static.firstTextBox = ei.textf);
|
|
if (ei.text_0 != null) {
|
|
$setText_2(ei.textf, ei.text_0);
|
|
ei.isColor?($getElement(ei.textf).setAttribute('type', 'color') , undefined):$setVisibleLength(ei.textf);
|
|
$add_5(vp, ei.textf);
|
|
}
|
|
else {
|
|
$setText_2(ei.textf, $unitString(this$static, ei));
|
|
$add_5(vp, (row = new HorizontalPanel , $setVerticalAlignment_0(row, ($clinit_HasVerticalAlignment() , ALIGN_MIDDLE)) , minus = new Button_1('\u2212') , plus = new Button_1('+') , ($clinit_DOM() , minus.element).style['width'] = '2em' , undefined , plus.element.style['width'] = '2em' , undefined , disableTouchCallout(minus) , disableTouchCallout(plus) , $addRepeatingStepHandler(this$static, minus, ei, -1) , $addRepeatingStepHandler(this$static, plus, ei, 1) , $add_3(row, minus) , $add_3(row, ei.textf) , $add_3(row, plus) , row));
|
|
}
|
|
}
|
|
}
|
|
this$static.einfocount = i;
|
|
}
|
|
|
|
function $clearDialog(this$static){
|
|
while ($getWidget(this$static.mainPanel, 0) != this$static.bottomButtonPanel)
|
|
$remove(this$static.mainPanel, 0);
|
|
}
|
|
|
|
function $closeDialog_0(this$static){
|
|
$hide_0(this$static, false);
|
|
dialogShowing == this$static && (dialogShowing = null);
|
|
editDialog_0 == this$static && (editDialog_0 = null);
|
|
customLogicEditDialog == this$static && (customLogicEditDialog = null);
|
|
}
|
|
|
|
function $itemStateChanged(this$static, e){
|
|
var applied, changed, ei, i, src_0;
|
|
src_0 = e.source;
|
|
changed = false;
|
|
applied = false;
|
|
for (i = 0; i != this$static.einfocount; i++) {
|
|
ei = this$static.einfos[i];
|
|
if (maskUndefined(ei.choice) === maskUndefined(src_0) || maskUndefined(ei.checkbox) === maskUndefined(src_0) || maskUndefined(ei.button_0) === maskUndefined(src_0)) {
|
|
if ((maskUndefined(ei.button_0) === maskUndefined(src_0) || maskUndefined(ei.choice) === maskUndefined(src_0)) && !ei.newDialog) {
|
|
this$static.apply_0();
|
|
applied = true;
|
|
}
|
|
this$static.elm.setEditValue(i, ei);
|
|
ei.newDialog && (changed = true);
|
|
$needAnalyze(this$static.cframe);
|
|
}
|
|
}
|
|
if (changed) {
|
|
applied || this$static.apply_0();
|
|
$clearDialog(this$static);
|
|
$buildDialog(this$static);
|
|
}
|
|
}
|
|
|
|
function $parseUnits(this$static, ei){
|
|
var rmsMult, s, suffixlength;
|
|
s = $trim($getPropertyString($getElement(ei.textf), 'value'));
|
|
if (!!this$static.elm && instanceOf(this$static.elm, 56) && (suffixlength = 'rms'.length , $equals_1(s.substr(s.length - suffixlength, suffixlength), 'rms'))) {
|
|
s = $trim($substring_0(s, 0, s.length - 3));
|
|
rmsMult = $getRmsMultiplier(this$static.elm);
|
|
if (rmsMult > 0) {
|
|
return parseUnits(s) / rmsMult;
|
|
}
|
|
}
|
|
return parseUnits(s);
|
|
}
|
|
|
|
function $resetDialog(this$static){
|
|
$clearDialog(this$static);
|
|
$buildDialog(this$static);
|
|
}
|
|
|
|
function $stepValue(this$static, ei, dir_0){
|
|
var cur, linearStep, next;
|
|
try {
|
|
cur = $parseUnits(this$static, ei);
|
|
}
|
|
catch ($e0) {
|
|
$e0 = toJava($e0);
|
|
if (instanceOf($e0, 13)) {
|
|
cur = ei.value_0;
|
|
}
|
|
else
|
|
throw toJs($e0);
|
|
}
|
|
linearStep = ei.dimensionless || ei.unitStep;
|
|
next = linearStep?cur + dir_0:stepE12(cur, dir_0);
|
|
$setText_2(ei.textf, unitString(ei, next));
|
|
}
|
|
|
|
function $unitString(this$static, ei){
|
|
var ve;
|
|
if (!!this$static.elm && instanceOf(this$static.elm, 56)) {
|
|
ve = this$static.elm;
|
|
if ($useRmsDisplay(ve, ei.value_0))
|
|
return unitString(ei, ei.value_0 * $getRmsMultiplier(ve)) + 'rms';
|
|
}
|
|
return unitString(ei, ei.value_0);
|
|
}
|
|
|
|
function EditDialog(ce, f){
|
|
$clinit_EditDialog();
|
|
var ftb, title_0;
|
|
Dialog.call(this);
|
|
title_0 = ce.getDialogTitle();
|
|
$setText(this, LS(title_0));
|
|
this.cframe = f;
|
|
this.elm = ce;
|
|
this.mainPanel = new VerticalPanel;
|
|
$setWidget_1(this, this.mainPanel);
|
|
this.einfos = initUnidimensionalArray(Lcom_lushprojects_circuitjs1_client_EditInfo_2_classLit, $intern_3, 5, 20, 0, 1);
|
|
this.bottomButtonPanel = new HorizontalPanel;
|
|
$setWidth(this.bottomButtonPanel, '100%');
|
|
$setHorizontalAlignment_0(this.bottomButtonPanel, ($clinit_HasHorizontalAlignment() , ALIGN_LEFT));
|
|
$setStyleName(this.bottomButtonPanel, 'topSpace');
|
|
$add_5(this.mainPanel, this.bottomButtonPanel);
|
|
this.applyButton = new Button_1(LS('Apply'));
|
|
$add_3(this.bottomButtonPanel, this.applyButton);
|
|
$addDomHandler(this.applyButton, new EditDialog$1(this), ($clinit_ClickEvent() , $clinit_ClickEvent() , TYPE_1));
|
|
$add_3(this.bottomButtonPanel, this.okButton = new Button_1(LS('OK')));
|
|
$addDomHandler(this.okButton, new EditDialog$2(this), (null , TYPE_1));
|
|
$setHorizontalAlignment_0(this.bottomButtonPanel, ALIGN_RIGHT);
|
|
$add_3(this.bottomButtonPanel, this.cancelButton = new Button_1(LS('Cancel')));
|
|
$addDomHandler(this.cancelButton, new EditDialog$3(this), (null , TYPE_1));
|
|
$buildDialog(this);
|
|
this.errorLabel = new Label;
|
|
$getElement(this.errorLabel).style['color'] = 'red';
|
|
$setVisible(this.errorLabel, false);
|
|
$insert_2(this.mainPanel, this.errorLabel, $getWidgetIndex(this.mainPanel, this.bottomButtonPanel));
|
|
$center(this);
|
|
if (this.firstTextBox) {
|
|
ftb = this.firstTextBox;
|
|
$scheduleDeferred(($clinit_SchedulerImpl() , INSTANCE), new EditDialog$4(ftb));
|
|
}
|
|
}
|
|
|
|
function disableTouchCallout(button){
|
|
var style;
|
|
style = ($clinit_DOM() , button.element).style;
|
|
style['webkitTouchCallout'] = 'none';
|
|
style['webkitUserSelect'] = 'none';
|
|
style['userSelect'] = 'none';
|
|
style['touchAction'] = 'manipulation';
|
|
}
|
|
|
|
function parseUnits(s){
|
|
$clinit_EditDialog();
|
|
var len, mult, rmsMult, suffixlength, uc;
|
|
s = $trim(s);
|
|
rmsMult = 1;
|
|
suffixlength = 'rms'.length;
|
|
if ($equals_1(s.substr(s.length - suffixlength, suffixlength), 'rms')) {
|
|
s = $trim($substring_0(s, 0, s.length - 3));
|
|
rmsMult = 1.4142135623730951;
|
|
}
|
|
s = $replaceAll(s, '([0-9]+)([pPnNuUmMkKgG])([0-9]+)', '$1.$3$2');
|
|
s = $replaceAll(s, '[mM][eE][gG]$', 'M');
|
|
if ((new RegExp('^(^-?[0-9]*\\.?[0-9]+[eE][+-]?[0-9]+$)$')).test(s))
|
|
return __parseAndValidateDouble(s) * rmsMult;
|
|
len = s.length;
|
|
uc = (checkCriticalStringElementIndex(len - 1, s.length) , s.charCodeAt(len - 1));
|
|
mult = 1;
|
|
switch (uc) {
|
|
case 102:
|
|
case 70:
|
|
mult = $intern_114;
|
|
break;
|
|
case 112:
|
|
case 80:
|
|
mult = $intern_102;
|
|
break;
|
|
case 110:
|
|
case 78:
|
|
mult = $intern_80;
|
|
break;
|
|
case 117:
|
|
case 85:
|
|
mult = $intern_82;
|
|
break;
|
|
case 109:
|
|
mult = $intern_83;
|
|
break;
|
|
case 107:
|
|
case 75:
|
|
mult = $intern_22;
|
|
break;
|
|
case 77:
|
|
mult = $intern_84;
|
|
break;
|
|
case 71:
|
|
case 103:
|
|
mult = $intern_32;
|
|
}
|
|
mult != 1 && (s = $trim(s.substr(0, len - 1)));
|
|
return $parse_0(noCommaFormat, s) * mult * rmsMult;
|
|
}
|
|
|
|
function stepE12(value_0, dir_0){
|
|
var av, decade, e12, i, idx, sign;
|
|
e12 = ($clinit_ScrollValuePopup() , e12_0);
|
|
if (value_0 == 0)
|
|
return dir_0 > 0?e12[0]:-e12[0];
|
|
sign = value_0 < 0?-1:1;
|
|
av = $wnd.Math.abs(value_0);
|
|
decade = round_int($wnd.Math.floor($wnd.Math.log(av) * $wnd.Math.LOG10E));
|
|
idx = 0;
|
|
for (i = 0; i < e12.length; i++) {
|
|
e12[i] * $wnd.Math.pow(10, decade) <= av * 1.0000001 && (idx = i);
|
|
}
|
|
idx += dir_0;
|
|
if (idx < 0) {
|
|
idx = e12.length - 1;
|
|
--decade;
|
|
}
|
|
else if (idx >= e12.length) {
|
|
idx = 0;
|
|
++decade;
|
|
}
|
|
return sign * e12[idx] * $wnd.Math.pow(10, decade);
|
|
}
|
|
|
|
function unitString(ei, v){
|
|
$clinit_EditDialog();
|
|
var va;
|
|
va = $wnd.Math.abs(v);
|
|
if (!!ei && ei.dimensionless)
|
|
return $format_0(noCommaFormat, v);
|
|
if (!isNaN(va) && !isFinite(va))
|
|
return $format_0(noCommaFormat, v);
|
|
if (v == 0)
|
|
return '0';
|
|
if (va < $intern_102)
|
|
return $format_0(noCommaFormat, v * 1000000000000000) + 'f';
|
|
if (va < $intern_80)
|
|
return $format_0(noCommaFormat, v * $intern_81) + 'p';
|
|
if (va < $intern_82)
|
|
return $format_0(noCommaFormat, v * $intern_32) + 'n';
|
|
if (va < $intern_83)
|
|
return $format_0(noCommaFormat, v * $intern_84) + 'u';
|
|
if (va < 1)
|
|
return $format_0(noCommaFormat, v * $intern_22) + 'm';
|
|
if (va < $intern_22)
|
|
return $format_0(noCommaFormat, v);
|
|
if (va < $intern_84)
|
|
return $format_0(noCommaFormat, v * $intern_83) + 'k';
|
|
if (va < $intern_32)
|
|
return $format_0(noCommaFormat, v * $intern_82) + 'M';
|
|
return $format_0(noCommaFormat, v * $intern_80) + 'G';
|
|
}
|
|
|
|
defineClass(215, 140, $intern_58, EditDialog);
|
|
_.apply_0 = function apply_2(){
|
|
return $apply(this);
|
|
}
|
|
;
|
|
_.closeDialog = function closeDialog_0(){
|
|
$closeDialog_0(this);
|
|
}
|
|
;
|
|
_.einfocount = 0;
|
|
var noCommaFormat;
|
|
var Lcom_lushprojects_circuitjs1_client_EditDialog_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'EditDialog', 215);
|
|
function EditDialog$1(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(501, 1, $intern_56, EditDialog$1);
|
|
_.onClick = function onClick_9(event_0){
|
|
this.this$01.apply_0();
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_EditDialog$1_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'EditDialog/1', 501);
|
|
function EditDialog$10(val$repeatTimer){
|
|
this.val$repeatTimer2 = val$repeatTimer;
|
|
Timer.call(this);
|
|
}
|
|
|
|
defineClass(510, 213, {}, EditDialog$10);
|
|
_.run = function run_4(){
|
|
$scheduleRepeating(this.val$repeatTimer2, 120);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_EditDialog$10_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'EditDialog/10', 510);
|
|
function EditDialog$11(this$0, val$ei, val$dir, val$startRepeatTimer){
|
|
this.this$01 = this$0;
|
|
this.val$ei2 = val$ei;
|
|
this.val$dir3 = val$dir;
|
|
this.val$startRepeatTimer4 = val$startRepeatTimer;
|
|
}
|
|
|
|
defineClass(511, 1, $intern_115, EditDialog$11);
|
|
_.onMouseDown = function onMouseDown_1(e){
|
|
$stepValue(this.this$01, this.val$ei2, this.val$dir3);
|
|
$schedule(this.val$startRepeatTimer4, 400);
|
|
}
|
|
;
|
|
_.val$dir3 = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_EditDialog$11_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'EditDialog/11', 511);
|
|
function EditDialog$12(val$startRepeatTimer, val$repeatTimer){
|
|
this.val$startRepeatTimer2 = val$startRepeatTimer;
|
|
this.val$repeatTimer3 = val$repeatTimer;
|
|
}
|
|
|
|
defineClass(512, 1, {316:1, 11:1}, EditDialog$12);
|
|
_.onMouseUp = function onMouseUp_1(e){
|
|
$cancel_0(this.val$startRepeatTimer2);
|
|
$cancel_0(this.val$repeatTimer3);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_EditDialog$12_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'EditDialog/12', 512);
|
|
function EditDialog$13(val$startRepeatTimer, val$repeatTimer){
|
|
this.val$startRepeatTimer2 = val$startRepeatTimer;
|
|
this.val$repeatTimer3 = val$repeatTimer;
|
|
}
|
|
|
|
defineClass(513, 1, $intern_116, EditDialog$13);
|
|
_.onMouseOut = function onMouseOut_1(e){
|
|
$cancel_0(this.val$startRepeatTimer2);
|
|
$cancel_0(this.val$repeatTimer3);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_EditDialog$13_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'EditDialog/13', 513);
|
|
function EditDialog$14(this$0, val$ei, val$dir, val$startRepeatTimer){
|
|
this.this$01 = this$0;
|
|
this.val$ei2 = val$ei;
|
|
this.val$dir3 = val$dir;
|
|
this.val$startRepeatTimer4 = val$startRepeatTimer;
|
|
}
|
|
|
|
defineClass(514, 1, $intern_37, EditDialog$14);
|
|
_.onTouchStart = function onTouchStart_0(e){
|
|
!!e.nativeEvent && (e.nativeEvent.preventDefault() , undefined);
|
|
$stepValue(this.this$01, this.val$ei2, this.val$dir3);
|
|
$schedule(this.val$startRepeatTimer4, 400);
|
|
}
|
|
;
|
|
_.val$dir3 = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_EditDialog$14_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'EditDialog/14', 514);
|
|
function EditDialog$15(val$startRepeatTimer, val$repeatTimer){
|
|
this.val$startRepeatTimer2 = val$startRepeatTimer;
|
|
this.val$repeatTimer3 = val$repeatTimer;
|
|
}
|
|
|
|
defineClass(515, 1, $intern_38, EditDialog$15);
|
|
_.onTouchEnd = function onTouchEnd_0(e){
|
|
$cancel_0(this.val$startRepeatTimer2);
|
|
$cancel_0(this.val$repeatTimer3);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_EditDialog$15_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'EditDialog/15', 515);
|
|
function EditDialog$16(val$startRepeatTimer, val$repeatTimer){
|
|
this.val$startRepeatTimer2 = val$startRepeatTimer;
|
|
this.val$repeatTimer3 = val$repeatTimer;
|
|
}
|
|
|
|
defineClass(516, 1, $intern_39, EditDialog$16);
|
|
_.onTouchCancel = function onTouchCancel_0(e){
|
|
$cancel_0(this.val$startRepeatTimer2);
|
|
$cancel_0(this.val$repeatTimer3);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_EditDialog$16_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'EditDialog/16', 516);
|
|
function EditDialog$2(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(502, 1, $intern_56, EditDialog$2);
|
|
_.onClick = function onClick_10(event_0){
|
|
this.this$01.apply_0() && this.this$01.closeDialog();
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_EditDialog$2_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'EditDialog/2', 502);
|
|
function EditDialog$3(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(503, 1, $intern_56, EditDialog$3);
|
|
_.onClick = function onClick_11(event_0){
|
|
this.this$01.closeDialog();
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_EditDialog$3_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'EditDialog/3', 503);
|
|
function EditDialog$4(val$ftb){
|
|
this.val$ftb2 = val$ftb;
|
|
}
|
|
|
|
defineClass(504, 1, {}, EditDialog$4);
|
|
_.execute_1 = function execute_23(){
|
|
$setFocus(this.val$ftb2);
|
|
$selectAll(this.val$ftb2);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_EditDialog$4_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'EditDialog/4', 504);
|
|
function EditDialog$5(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(505, 1, $intern_71, EditDialog$5);
|
|
_.onChange = function onChange_2(e){
|
|
$itemStateChanged(this.this$01, e);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_EditDialog$5_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'EditDialog/5', 505);
|
|
function EditDialog$6(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(506, 1, $intern_68, EditDialog$6);
|
|
_.onValueChange = function onValueChange_1(e){
|
|
$itemStateChanged(this.this$01, e);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_EditDialog$6_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'EditDialog/6', 506);
|
|
function EditDialog$7(){
|
|
}
|
|
|
|
defineClass(507, 1, $intern_56, EditDialog$7);
|
|
_.onClick = function onClick_12(event_0){
|
|
$doc.getElementById('EditDialogLoadFileElement').click();
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_EditDialog$7_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'EditDialog/7', 507);
|
|
function EditDialog$8(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(508, 1, $intern_56, EditDialog$8);
|
|
_.onClick = function onClick_13(event_0){
|
|
$itemStateChanged(this.this$01, event_0);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_EditDialog$8_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'EditDialog/8', 508);
|
|
function EditDialog$9(this$0, val$ei, val$dir){
|
|
this.this$01 = this$0;
|
|
this.val$ei2 = val$ei;
|
|
this.val$dir3 = val$dir;
|
|
Timer.call(this);
|
|
}
|
|
|
|
defineClass(509, 213, {}, EditDialog$9);
|
|
_.run = function run_5(){
|
|
$stepValue(this.this$01, this.val$ei2, this.val$dir3);
|
|
}
|
|
;
|
|
_.val$dir3 = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_EditDialog$9_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'EditDialog/9', 509);
|
|
defineClass(938, 240, $intern_117);
|
|
_.onChange = function onChange_3(e){
|
|
$handle();
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_EditDialogLoadFile_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'EditDialogLoadFile', 938);
|
|
function EditDiodeModelDialog(dm, f, de){
|
|
$clinit_EditDialog();
|
|
EditDialog.call(this, dm, f);
|
|
this.model = dm;
|
|
this.diodeElm = de;
|
|
$removeFromParent(this.applyButton);
|
|
}
|
|
|
|
defineClass(456, 215, $intern_58, EditDiodeModelDialog);
|
|
_.apply_0 = function apply_3(){
|
|
if (!$apply(this))
|
|
return false;
|
|
(this.model.name_0 == null || this.model.name_0.length == 0) && $pickName(this.model);
|
|
!!this.diodeElm && $newModelCreated(this.diodeElm, this.model);
|
|
return true;
|
|
}
|
|
;
|
|
_.closeDialog = function closeDialog_1(){
|
|
var edlg;
|
|
$closeDialog_0(this);
|
|
edlg = editDialog_0;
|
|
console.log('resetting dialog ' + edlg);
|
|
!!edlg && ($clearDialog(edlg) , $buildDialog(edlg));
|
|
diodeModelEditDialog = null;
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_EditDiodeModelDialog_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'EditDiodeModelDialog', 456);
|
|
function $$init_6(this$static){
|
|
}
|
|
|
|
function $changeFlag(this$static, flags, bit){
|
|
if ($getState(this$static.checkbox))
|
|
return flags | bit;
|
|
return flags & ~bit;
|
|
}
|
|
|
|
function $changeFlagInverted(this$static, flags, bit){
|
|
if (!$getState(this$static.checkbox))
|
|
return flags | bit;
|
|
return flags & ~bit;
|
|
}
|
|
|
|
function $disallowSliders(this$static){
|
|
this$static.noSliders = true;
|
|
return this$static;
|
|
}
|
|
|
|
function $newColumn(this$static){
|
|
this$static.newColumn = true;
|
|
return this$static;
|
|
}
|
|
|
|
function $setDimensionless(this$static){
|
|
this$static.dimensionless = true;
|
|
return this$static;
|
|
}
|
|
|
|
function $setError(this$static, s){
|
|
this$static.error = s;
|
|
}
|
|
|
|
function $setIsColor(this$static){
|
|
this$static.isColor = true;
|
|
return this$static;
|
|
}
|
|
|
|
function $setPositive(this$static){
|
|
this$static.positive = true;
|
|
return this$static;
|
|
}
|
|
|
|
function $setUnitStep(this$static){
|
|
this$static.unitStep = true;
|
|
return this$static;
|
|
}
|
|
|
|
function EditInfo(n, val){
|
|
$$init_6(this);
|
|
this.name_0 = n;
|
|
this.value_0 = val;
|
|
this.dimensionless = false;
|
|
}
|
|
|
|
function EditInfo_0(n, val, mn, mx){
|
|
$$init_6(this);
|
|
this.name_0 = n;
|
|
this.value_0 = val;
|
|
this.dimensionless = false;
|
|
this.minVal = mn;
|
|
this.maxVal = mx;
|
|
}
|
|
|
|
function EditInfo_1(n, txt){
|
|
$$init_6(this);
|
|
this.name_0 = n;
|
|
this.text_0 = txt;
|
|
this.dimensionless = this.noSliders = true;
|
|
}
|
|
|
|
function createCheckbox(name_0, flag){
|
|
var ei;
|
|
ei = new EditInfo_0('', 0, -1, -1);
|
|
ei.checkbox = new Checkbox_0(name_0, flag);
|
|
return ei;
|
|
}
|
|
|
|
defineClass(5, 1, {5:1}, EditInfo, EditInfo_0, EditInfo_1);
|
|
_.dimensionless = false;
|
|
_.isColor = false;
|
|
_.loadFile = null;
|
|
_.maxVal = 0;
|
|
_.minVal = 0;
|
|
_.newColumn = false;
|
|
_.newDialog = false;
|
|
_.noSliders = false;
|
|
_.nonNegative = false;
|
|
_.positive = false;
|
|
_.unitStep = false;
|
|
_.value_0 = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_EditInfo_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'EditInfo', 5);
|
|
function EditMosfetModelDialog(mm, f, me){
|
|
$clinit_EditDialog();
|
|
EditDialog.call(this, mm, f);
|
|
this.model = mm;
|
|
this.mosfetElm = me;
|
|
$removeFromParent(this.applyButton);
|
|
}
|
|
|
|
defineClass(454, 215, $intern_58, EditMosfetModelDialog);
|
|
_.apply_0 = function apply_4(){
|
|
var ok;
|
|
ok = $apply(this);
|
|
(this.model.name_0 == null || this.model.name_0.length == 0) && $pickName_0(this.model);
|
|
!!this.mosfetElm && $newModelCreated_0(this.mosfetElm, this.model);
|
|
return ok;
|
|
}
|
|
;
|
|
_.closeDialog = function closeDialog_2(){
|
|
var edlg;
|
|
$closeDialog_0(this);
|
|
edlg = editDialog_0;
|
|
console.log('resetting dialog ' + edlg);
|
|
!!edlg && ($clearDialog(edlg) , $buildDialog(edlg));
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_EditMosfetModelDialog_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'EditMosfetModelDialog', 454);
|
|
function $setColor(name_0, ei, def){
|
|
var stor, val;
|
|
val = $getText(ei.textf);
|
|
val.length == 0 && (val = $getHexValue(def));
|
|
stor = (!localStorage_0 && ($clinit_Storage$StorageSupportDetector() , localStorageSupported) && (localStorage_0 = new Storage_0('localStorage')) , localStorage_0);
|
|
!!stor && $setItem_0(stor.storage, name_0, val);
|
|
return new Color_1(val);
|
|
}
|
|
|
|
function EditOptions(a, s){
|
|
this.app = a;
|
|
this.sim = s;
|
|
}
|
|
|
|
defineClass(705, 1, {10:1}, EditOptions);
|
|
_.getDialogTitle = function getDialogTitle_2(){
|
|
return 'Other Options';
|
|
}
|
|
;
|
|
_.getEditInfo = function getEditInfo_29(n){
|
|
var ei;
|
|
if (n == 0)
|
|
return $setPositive(new EditInfo_0('Time step size (s)', this.sim.maxTimeStep, 0, 0));
|
|
if (n == 1)
|
|
return $setPositive(new EditInfo_0('Range for voltage color (V)', voltageRange, 0, 0));
|
|
if (n == 2) {
|
|
ei = new EditInfo_0('Change Language', 0, -1, -1);
|
|
ei.choice = new Choice;
|
|
$addItem(ei.choice, LS('(no change)'));
|
|
$addItem(ei.choice, LS('\u010Ce\u0161tina'));
|
|
$addItem(ei.choice, LS('Dansk'));
|
|
$addItem(ei.choice, LS('Deutsch'));
|
|
$addItem(ei.choice, LS('English'));
|
|
$addItem(ei.choice, LS('Espa\xF1ol'));
|
|
$addItem(ei.choice, LS('Fran\xE7ais'));
|
|
$addItem(ei.choice, LS('Italiano'));
|
|
$addItem(ei.choice, LS('Norsk bokm\xE5l'));
|
|
$addItem(ei.choice, LS('Polski'));
|
|
$addItem(ei.choice, LS('Portugu\xEAs'));
|
|
$addItem(ei.choice, LS('\u0420\u0443\u0441\u0441\u043A\u0438\u0439'));
|
|
$addItem(ei.choice, LS('\u4E2D\u6587 (\u4E2D\u56FD\u5927\u9646)'));
|
|
$addItem(ei.choice, LS('\u4E2D\u6587 (\u53F0\u6E7E)'));
|
|
$addItem(ei.choice, LS('\u65E5\u672C\u8A9E'));
|
|
$addItem(ei.choice, LS('\uD55C\uAD6D\uC5B4'));
|
|
return ei;
|
|
}
|
|
if (n == 3)
|
|
return $newColumn($setIsColor(new EditInfo_1('Positive Color', $getHexValue(positiveColor_0))));
|
|
if (n == 4)
|
|
return $setIsColor(new EditInfo_1('Negative Color', $getHexValue(negativeColor_0)));
|
|
if (n == 5)
|
|
return $setIsColor(new EditInfo_1('Neutral Color', $getHexValue(neutralColor_0)));
|
|
if (n == 6)
|
|
return $setIsColor(new EditInfo_1('Selection Color', $getHexValue(selectColor_0)));
|
|
if (n == 7)
|
|
return $setIsColor(new EditInfo_1('Current Color', $getHexValue(currentColor_0)));
|
|
if (n == 8) {
|
|
ei = new EditInfo_0('', 0, -1, -1);
|
|
ei.button_0 = new Button_1(LS('Reset Colors to Default'));
|
|
return ei;
|
|
}
|
|
if (n == 9)
|
|
return new EditInfo('# of Decimal Digits (short format)', shortDecimalDigits);
|
|
if (n == 10)
|
|
return $newColumn(new EditInfo('# of Decimal Digits (long format)', decimalDigits));
|
|
if (n == 11) {
|
|
ei = new EditInfo_0('', 0, -1, -1);
|
|
ei.checkbox = new Checkbox_0('Developer Mode', this.app.developerMode);
|
|
return ei;
|
|
}
|
|
if (n == 12)
|
|
return $setPositive(new EditInfo('Minimum Target Frame Rate', this.app.minFrameRate));
|
|
if (n == 13)
|
|
return $setPositive(new EditInfo('Mouse Wheel Sensitivity', this.app.mouse.wheelSensitivity));
|
|
if (n == 14) {
|
|
ei = new EditInfo_0('', 0, -1, -1);
|
|
ei.checkbox = new Checkbox_0('Auto-Run DC Operating Point on Reset', this.app.autoDCOnReset);
|
|
return ei;
|
|
}
|
|
if (n == 15) {
|
|
ei = new EditInfo_0('', 0, -1, -1);
|
|
ei.checkbox = new Checkbox_0('Auto-Adjust Timestep', this.sim.adjustTimeStep);
|
|
return ei;
|
|
}
|
|
if (n == 16) {
|
|
ei = new EditInfo_0('Matrix Solver', 0, -1, -1);
|
|
ei.choice = new Choice;
|
|
$addItem(ei.choice, LS(LS('Auto')));
|
|
$addItem(ei.choice, LS(LS("Dense (Crout's LU)")));
|
|
$addItem(ei.choice, LS(LS('Sparse (CSC LU)')));
|
|
$select(ei.choice, this.sim.solverType);
|
|
return ei;
|
|
}
|
|
if (n == 17)
|
|
return new EditInfo('Value Label Font Size', valueFontSize);
|
|
if (n == 18 && this.sim.adjustTimeStep)
|
|
return $setPositive(new EditInfo_0('Minimum time step size (s)', this.sim.minTimeStep, 0, 0));
|
|
return null;
|
|
}
|
|
;
|
|
_.setEditValue = function setEditValue_29(n, ei){
|
|
var lang_0, langString, newType, stor;
|
|
if (n == 0) {
|
|
this.sim.maxTimeStep = ei.value_0;
|
|
okToChangeTimeStep = false;
|
|
}
|
|
n == 1 && (voltageRange = ei.value_0);
|
|
if (n == 2) {
|
|
lang_0 = $getElement(ei.choice).selectedIndex;
|
|
if (lang_0 == 0)
|
|
return;
|
|
langString = null;
|
|
switch (lang_0) {
|
|
case 1:
|
|
langString = 'csx';
|
|
break;
|
|
case 2:
|
|
langString = 'da';
|
|
break;
|
|
case 3:
|
|
langString = 'de';
|
|
break;
|
|
case 4:
|
|
langString = 'en';
|
|
break;
|
|
case 5:
|
|
langString = 'es';
|
|
break;
|
|
case 6:
|
|
langString = 'fr';
|
|
break;
|
|
case 7:
|
|
langString = 'it';
|
|
break;
|
|
case 8:
|
|
langString = 'nb';
|
|
break;
|
|
case 9:
|
|
langString = 'pl';
|
|
break;
|
|
case 10:
|
|
langString = 'pt';
|
|
break;
|
|
case 11:
|
|
langString = 'ru';
|
|
break;
|
|
case 12:
|
|
langString = 'zh';
|
|
break;
|
|
case 13:
|
|
langString = 'zh-tw';
|
|
break;
|
|
case 14:
|
|
langString = 'ja';
|
|
break;
|
|
case 15:
|
|
langString = 'kr';
|
|
}
|
|
if (langString == null)
|
|
return;
|
|
stor = (!localStorage_0 && ($clinit_Storage$StorageSupportDetector() , localStorageSupported) && (localStorage_0 = new Storage_0('localStorage')) , localStorage_0);
|
|
if (!stor) {
|
|
alert_0(LS("Can't set language"));
|
|
return;
|
|
}
|
|
$setItem_0(stor.storage, 'language', langString);
|
|
confirm_2(LS('Must restart to set language. Restart now?')) && ($wnd.location.reload() , undefined);
|
|
}
|
|
if (n == 3) {
|
|
positiveColor_0 = $setColor('positiveColor', ei, ($clinit_Color() , green));
|
|
setColorScale();
|
|
}
|
|
if (n == 4) {
|
|
negativeColor_0 = $setColor('negativeColor', ei, ($clinit_Color() , red));
|
|
setColorScale();
|
|
}
|
|
if (n == 5) {
|
|
neutralColor_0 = $setColor('neutralColor', ei, ($clinit_Color() , gray));
|
|
setColorScale();
|
|
}
|
|
n == 6 && (selectColor_0 = $setColor('selectColor', ei, ($clinit_Color() , cyan)));
|
|
n == 7 && (currentColor_0 = $setColor('currentColor', ei, ($clinit_Color() , yellow)));
|
|
if (n == 8) {
|
|
stor = (!localStorage_0 && ($clinit_Storage$StorageSupportDetector() , localStorageSupported) && (localStorage_0 = new Storage_0('localStorage')) , localStorage_0);
|
|
if (stor) {
|
|
$removeItem_0(stor.storage, 'positiveColor');
|
|
$removeItem_0(stor.storage, 'negativeColor');
|
|
$removeItem_0(stor.storage, 'neutralColor');
|
|
$removeItem_0(stor.storage, 'selectColor');
|
|
$removeItem_0(stor.storage, 'currentColor');
|
|
}
|
|
$setColors(this.app.ui, null, null, null, null, null);
|
|
ei.newDialog = true;
|
|
}
|
|
n == 9 && setDecimalDigits(round_int(ei.value_0), true, true);
|
|
n == 10 && setDecimalDigits(round_int(ei.value_0), false, true);
|
|
n == 11 && (this.app.developerMode = $getState(ei.checkbox));
|
|
n == 12 && (this.app.minFrameRate = ei.value_0);
|
|
if (n == 13) {
|
|
this.app.mouse.wheelSensitivity = ei.value_0;
|
|
stor = (!localStorage_0 && ($clinit_Storage$StorageSupportDetector() , localStorageSupported) && (localStorage_0 = new Storage_0('localStorage')) , localStorage_0);
|
|
!!stor && $setItem(stor, 'wheelSensitivity', '' + this.app.mouse.wheelSensitivity);
|
|
}
|
|
n == 14 && (this.app.autoDCOnReset = $getState(ei.checkbox));
|
|
if (n == 15) {
|
|
this.sim.adjustTimeStep = $getState(ei.checkbox);
|
|
ei.newDialog = true;
|
|
}
|
|
if (n == 16) {
|
|
newType = $getElement(ei.choice).selectedIndex;
|
|
if (newType != this.sim.solverType) {
|
|
this.sim.solverType = newType;
|
|
$needAnalyze(this.app);
|
|
}
|
|
}
|
|
n == 17 && setValueFontSize(ei.value_0 > 0?round_int(ei.value_0):12);
|
|
n == 18 && ei.value_0 > 0 && (this.sim.minTimeStep = ei.value_0);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_EditOptions_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'EditOptions', 705);
|
|
function EditRelayModelDialog(rm, f, re){
|
|
$clinit_EditDialog();
|
|
EditDialog.call(this, rm, f);
|
|
this.model = rm;
|
|
this.relayElm = re;
|
|
$removeFromParent(this.applyButton);
|
|
}
|
|
|
|
defineClass(455, 215, $intern_58, EditRelayModelDialog);
|
|
_.apply_0 = function apply_5(){
|
|
if (!$apply(this))
|
|
return false;
|
|
(this.model.name_0 == null || this.model.name_0.length == 0) && $pickName_1(this.model);
|
|
!!this.relayElm && $newModelCreated_2(this.relayElm, this.model);
|
|
return true;
|
|
}
|
|
;
|
|
_.closeDialog = function closeDialog_3(){
|
|
var edlg;
|
|
$closeDialog_0(this);
|
|
edlg = editDialog_0;
|
|
!!edlg && ($clearDialog(edlg) , $buildDialog(edlg));
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_EditRelayModelDialog_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'EditRelayModelDialog', 455);
|
|
function EditTransistorModelDialog(dm, f, te){
|
|
$clinit_EditDialog();
|
|
EditDialog.call(this, dm, f);
|
|
this.model = dm;
|
|
this.transistorElm = te;
|
|
$removeFromParent(this.applyButton);
|
|
}
|
|
|
|
defineClass(453, 215, $intern_58, EditTransistorModelDialog);
|
|
_.apply_0 = function apply_6(){
|
|
if (!$apply(this))
|
|
return false;
|
|
(this.model.name_0 == null || this.model.name_0.length == 0) && $pickName_2(this.model);
|
|
!!this.transistorElm && $newModelCreated_1(this.transistorElm, this.model);
|
|
return true;
|
|
}
|
|
;
|
|
_.closeDialog = function closeDialog_4(){
|
|
var edlg;
|
|
$closeDialog_0(this);
|
|
edlg = editDialog_0;
|
|
console.log('resetting dialog ' + edlg);
|
|
!!edlg && ($clearDialog(edlg) , $buildDialog(edlg));
|
|
diodeModelEditDialog = null;
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_EditTransistorModelDialog_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'EditTransistorModelDialog', 453);
|
|
function $create(className, x1, y1){
|
|
if ($equals_1('ACVoltageElm', className)) {
|
|
return new ACVoltageElm(x1, y1);
|
|
}
|
|
if ($equals_1('NJfetElm', className)) {
|
|
return new NJfetElm(x1, y1);
|
|
}
|
|
if ($equals_1('PolarCapacitorElm', className)) {
|
|
return new PolarCapacitorElm(x1, y1);
|
|
}
|
|
if ($equals_1('CustomTransformerElm', className)) {
|
|
return new CustomTransformerElm(x1, y1);
|
|
}
|
|
if ($equals_1('DCMotorElm', className)) {
|
|
return new DCMotorElm(x1, y1);
|
|
}
|
|
if ($equals_1('PTransistorElm', className)) {
|
|
return new PTransistorElm(x1, y1);
|
|
}
|
|
if ($equals_1('FuseElm', className)) {
|
|
return new FuseElm(x1, y1);
|
|
}
|
|
if ($equals_1('BoxElm', className)) {
|
|
return new BoxElm(x1, y1);
|
|
}
|
|
if ($equals_1('ROMElm', className)) {
|
|
return new ROMElm(x1, y1);
|
|
}
|
|
if ($equals_1('TFlipFlopElm', className)) {
|
|
return new TFlipFlopElm(x1, y1);
|
|
}
|
|
if ($equals_1('RelayElm', className)) {
|
|
return new RelayElm(x1, y1);
|
|
}
|
|
if ($equals_1('MultiplexerElm', className)) {
|
|
return new MultiplexerElm(x1, y1);
|
|
}
|
|
if ($equals_1('CrystalElm', className)) {
|
|
return new CrystalElm(x1, y1);
|
|
}
|
|
if ($equals_1('AnalogSwitchElm', className)) {
|
|
return new AnalogSwitchElm(x1, y1);
|
|
}
|
|
if ($equals_1('RoutedWireElm', className)) {
|
|
return new RoutedWireElm(x1, y1);
|
|
}
|
|
if ($equals_1('HalfAdderElm', className)) {
|
|
return new HalfAdderElm(x1, y1);
|
|
}
|
|
if ($equals_1('BusSplitterElm', className)) {
|
|
return new BusSplitterElm(x1, y1);
|
|
}
|
|
if ($equals_1('OpAmpElm', className)) {
|
|
return new OpAmpElm(x1, y1);
|
|
}
|
|
if ($equals_1('DiacElm', className)) {
|
|
return new DiacElm(x1, y1);
|
|
}
|
|
if ($equals_1('DataRecorderElm', className)) {
|
|
return new DataRecorderElm(x1, y1);
|
|
}
|
|
if ($equals_1('TestPointElm', className)) {
|
|
return new TestPointElm(x1, y1);
|
|
}
|
|
if ($equals_1('OutputElm', className)) {
|
|
return new OutputElm(x1, y1);
|
|
}
|
|
if ($equals_1('AndGateElm', className)) {
|
|
return new AndGateElm(x1, y1);
|
|
}
|
|
if ($equals_1('TimeDelayRelayElm', className)) {
|
|
return new TimeDelayRelayElm(x1, y1);
|
|
}
|
|
if ($equals_1('GroundElm', className)) {
|
|
return new GroundElm(x1, y1);
|
|
}
|
|
if ($equals_1('MotorProtectionSwitchElm', className)) {
|
|
return new MotorProtectionSwitchElm(x1, y1);
|
|
}
|
|
if ($equals_1('SCRElm', className)) {
|
|
return new SCRElm(x1, y1);
|
|
}
|
|
if ($equals_1('SipoShiftElm', className)) {
|
|
return new SipoShiftElm(x1, y1);
|
|
}
|
|
if ($equals_1('SparkGapElm', className)) {
|
|
return new SparkGapElm(x1, y1);
|
|
}
|
|
if ($equals_1('OTAElm', className)) {
|
|
return new OTAElm(x1, y1);
|
|
}
|
|
if ($equals_1('TriStateElm', className)) {
|
|
return new TriStateElm(x1, y1);
|
|
}
|
|
if ($equals_1('PhaseCompElm', className)) {
|
|
return new PhaseCompElm(x1, y1);
|
|
}
|
|
if ($equals_1('AntennaElm', className)) {
|
|
return new AntennaElm(x1, y1);
|
|
}
|
|
if ($equals_1('ADCElm', className)) {
|
|
return new ADCElm(x1, y1);
|
|
}
|
|
if ($equals_1('TransformerElm', className)) {
|
|
return new TransformerElm(x1, y1);
|
|
}
|
|
if ($equals_1('SquareRailElm', className)) {
|
|
return new SquareRailElm(x1, y1);
|
|
}
|
|
if ($equals_1('NMosfetElm', className)) {
|
|
return new NMosfetElm(x1, y1);
|
|
}
|
|
if ($equals_1('ExtVoltageElm', className)) {
|
|
return new ExtVoltageElm(x1, y1);
|
|
}
|
|
if ($equals_1('OpAmpRealElm', className)) {
|
|
return new OpAmpRealElm(x1, y1);
|
|
}
|
|
if ($equals_1('DiodeElm', className)) {
|
|
return new DiodeElm(x1, y1);
|
|
}
|
|
if ($equals_1('NortonAmpElm', className)) {
|
|
return new NortonAmpElm(x1, y1);
|
|
}
|
|
if ($equals_1('OptocouplerElm', className)) {
|
|
return new OptocouplerElm(x1, y1);
|
|
}
|
|
if ($equals_1('NoiseElm', className)) {
|
|
return new NoiseElm(x1, y1);
|
|
}
|
|
if ($equals_1('AnalogMuxElm', className)) {
|
|
return new AnalogMuxElm(x1, y1);
|
|
}
|
|
if ($equals_1('AudioInputElm', className)) {
|
|
return new AudioInputElm(x1, y1);
|
|
}
|
|
if ($equals_1('OrGateElm', className)) {
|
|
return new OrGateElm(x1, y1);
|
|
}
|
|
if ($equals_1('LEDArrayElm', className)) {
|
|
return new LEDArrayElm(x1, y1);
|
|
}
|
|
if ($equals_1('RelayCoilElm', className)) {
|
|
return new RelayCoilElm(x1, y1);
|
|
}
|
|
if ($equals_1('InstructionDisplayElm', className)) {
|
|
return new InstructionDisplayElm(x1, y1);
|
|
}
|
|
if ($equals_1('OhmMeterElm', className)) {
|
|
return new OhmMeterElm(x1, y1);
|
|
}
|
|
if ($equals_1('SchmittElm', className)) {
|
|
return new SchmittElm(x1, y1);
|
|
}
|
|
if ($equals_1('DeMultiplexerElm', className)) {
|
|
return new DeMultiplexerElm(x1, y1);
|
|
}
|
|
if ($equals_1('CapacitorElm', className)) {
|
|
return new CapacitorElm(x1, y1);
|
|
}
|
|
if ($equals_1('AudioOutputElm', className)) {
|
|
return new AudioOutputElm(x1, y1);
|
|
}
|
|
if ($equals_1('CustomCompositeChipElm', className)) {
|
|
return new CustomCompositeChipElm(x1, y1);
|
|
}
|
|
if ($equals_1('SweepElm', className)) {
|
|
return new SweepElm(x1, y1);
|
|
}
|
|
if ($equals_1('TappedTransformerElm', className)) {
|
|
return new TappedTransformerElm(x1, y1);
|
|
}
|
|
if ($equals_1('SwitchElm', className)) {
|
|
return new SwitchElm(x1, y1);
|
|
}
|
|
if ($equals_1('AMElm', className)) {
|
|
return new AMElm(x1, y1);
|
|
}
|
|
if ($equals_1('DCVoltageElm', className)) {
|
|
return new DCVoltageElm(x1, y1);
|
|
}
|
|
if ($equals_1('BusTransceiverElm', className)) {
|
|
return new BusTransceiverElm(x1, y1);
|
|
}
|
|
if ($equals_1('CrossSwitchElm', className)) {
|
|
return new CrossSwitchElm(x1, y1);
|
|
}
|
|
if ($equals_1('TransLineElm', className)) {
|
|
return new TransLineElm(x1, y1);
|
|
}
|
|
if ($equals_1('UnijunctionElm', className)) {
|
|
return new UnijunctionElm(x1, y1);
|
|
}
|
|
if ($equals_1('AnalogSwitch2Elm', className)) {
|
|
return new AnalogSwitch2Elm(x1, y1);
|
|
}
|
|
if ($equals_1('NDarlingtonElm', className)) {
|
|
return new NDarlingtonElm(x1, y1);
|
|
}
|
|
if ($equals_1('VCVSElm', className)) {
|
|
return new VCVSElm(x1, y1);
|
|
}
|
|
if ($equals_1('WattmeterElm', className)) {
|
|
return new WattmeterElm(x1, y1);
|
|
}
|
|
if ($equals_1('CurrentElm', className)) {
|
|
return new CurrentElm(x1, y1);
|
|
}
|
|
if ($equals_1('LabeledNodeElm', className)) {
|
|
return new LabeledNodeElm(x1, y1);
|
|
}
|
|
if ($equals_1('VCCSElm', className)) {
|
|
return new VCCSElm(x1, y1);
|
|
}
|
|
if ($equals_1('CustomLogicElm', className)) {
|
|
return new CustomLogicElm(x1, y1);
|
|
}
|
|
if ($equals_1('VarRailElm', className)) {
|
|
return new VarRailElm(x1, y1);
|
|
}
|
|
if ($equals_1('LDRElm', className)) {
|
|
return new LDRElm(x1, y1);
|
|
}
|
|
if ($equals_1('PotElm', className)) {
|
|
return new PotElm(x1, y1);
|
|
}
|
|
if ($equals_1('ClockElm', className)) {
|
|
return new ClockElm(x1, y1);
|
|
}
|
|
if ($equals_1('DACElm', className)) {
|
|
return new DACElm(x1, y1);
|
|
}
|
|
if ($equals_1('LogicOutputElm', className)) {
|
|
return new LogicOutputElm(x1, y1);
|
|
}
|
|
if ($equals_1('CounterElm', className)) {
|
|
return new CounterElm(x1, y1);
|
|
}
|
|
if ($equals_1('LineElm', className)) {
|
|
return new LineElm(x1, y1);
|
|
}
|
|
if ($equals_1('NTransistorElm', className)) {
|
|
return new NTransistorElm(x1, y1);
|
|
}
|
|
if ($equals_1('DPDTSwitchElm', className)) {
|
|
return new DPDTSwitchElm(x1, y1);
|
|
}
|
|
if ($equals_1('GyratorElm', className)) {
|
|
return new GyratorElm(x1, y1);
|
|
}
|
|
if ($equals_1('InductorElm', className)) {
|
|
return new InductorElm(x1, y1);
|
|
}
|
|
if ($equals_1('WireElm', className)) {
|
|
return new WireElm(x1, y1);
|
|
}
|
|
if ($equals_1('PushSwitchElm', className)) {
|
|
return new PushSwitchElm(x1, y1);
|
|
}
|
|
if ($equals_1('TimerElm', className)) {
|
|
return new TimerElm(x1, y1);
|
|
}
|
|
if ($equals_1('NandGateElm', className)) {
|
|
return new NandGateElm(x1, y1);
|
|
}
|
|
if ($equals_1('ThermistorNTCElm', className)) {
|
|
return new ThermistorNTCElm(x1, y1);
|
|
}
|
|
if ($equals_1('RailElm', className)) {
|
|
return new RailElm(x1, y1);
|
|
}
|
|
if ($equals_1('DataInputElm', className)) {
|
|
return new DataInputElm(x1, y1);
|
|
}
|
|
if ($equals_1('NorGateElm', className)) {
|
|
return new NorGateElm(x1, y1);
|
|
}
|
|
if ($equals_1('PJfetElm', className)) {
|
|
return new PJfetElm(x1, y1);
|
|
}
|
|
if ($equals_1('MonostableElm', className)) {
|
|
return new MonostableElm(x1, y1);
|
|
}
|
|
if ($equals_1('ResistorElm', className)) {
|
|
return new ResistorElm(x1, y1);
|
|
}
|
|
if ($equals_1('CCCSElm', className)) {
|
|
return new CCCSElm(x1, y1);
|
|
}
|
|
if ($equals_1('RelayContactElm', className)) {
|
|
return new RelayContactElm(x1, y1);
|
|
}
|
|
if ($equals_1('StopTriggerElm', className)) {
|
|
return new StopTriggerElm(x1, y1);
|
|
}
|
|
if ($equals_1('ACRailElm', className)) {
|
|
return new ACRailElm(x1, y1);
|
|
}
|
|
if ($equals_1('TextElm', className)) {
|
|
return new TextElm(x1, y1);
|
|
}
|
|
if ($equals_1('ComparatorElm', className)) {
|
|
return new ComparatorElm(x1, y1);
|
|
}
|
|
if ($equals_1('BatteryElm', className)) {
|
|
return new BatteryElm(x1, y1);
|
|
}
|
|
if ($equals_1('CustomCompositeElm', className)) {
|
|
return new CustomCompositeElm(x1, y1);
|
|
}
|
|
if ($equals_1('TriacElm', className)) {
|
|
return new TriacElm(x1, y1);
|
|
}
|
|
if ($equals_1('InverterElm', className)) {
|
|
return new InverterElm(x1, y1);
|
|
}
|
|
if ($equals_1('SeqGenElm', className)) {
|
|
return new SeqGenElm(x1, y1);
|
|
}
|
|
if ($equals_1('VCOElm', className)) {
|
|
return new VCOElm(x1, y1);
|
|
}
|
|
if ($equals_1('DelayBufferElm', className)) {
|
|
return new DelayBufferElm(x1, y1);
|
|
}
|
|
if ($equals_1('BusLogicInputElm', className)) {
|
|
return new BusLogicInputElm(x1, y1);
|
|
}
|
|
if ($equals_1('AmmeterElm', className)) {
|
|
return new AmmeterElm(x1, y1);
|
|
}
|
|
if ($equals_1('PisoShiftElm', className)) {
|
|
return new PisoShiftElm(x1, y1);
|
|
}
|
|
if ($equals_1('CCVSElm', className)) {
|
|
return new CCVSElm(x1, y1);
|
|
}
|
|
if ($equals_1('Switch2Elm', className)) {
|
|
return new Switch2Elm(x1, y1);
|
|
}
|
|
if ($equals_1('LogicInputElm', className)) {
|
|
return new LogicInputElm(x1, y1);
|
|
}
|
|
if ($equals_1('MBBSwitchElm', className)) {
|
|
return new MBBSwitchElm(x1, y1);
|
|
}
|
|
if ($equals_1('ScopeElm', className)) {
|
|
return new ScopeElm(x1, y1);
|
|
}
|
|
if ($equals_1('SevenSegDecoderElm', className)) {
|
|
return new SevenSegDecoderElm(x1, y1);
|
|
}
|
|
if ($equals_1('XorGateElm', className)) {
|
|
return new XorGateElm(x1, y1);
|
|
}
|
|
if ($equals_1('TunnelDiodeElm', className)) {
|
|
return new TunnelDiodeElm(x1, y1);
|
|
}
|
|
if ($equals_1('XnorGateElm', className)) {
|
|
return new XnorGateElm(x1, y1);
|
|
}
|
|
if ($equals_1('ZenerElm', className)) {
|
|
return new ZenerElm(x1, y1);
|
|
}
|
|
if ($equals_1('LatchElm', className)) {
|
|
return new LatchElm(x1, y1);
|
|
}
|
|
if ($equals_1('LEDElm', className)) {
|
|
return new LEDElm(x1, y1);
|
|
}
|
|
if ($equals_1('FMElm', className)) {
|
|
return new FMElm(x1, y1);
|
|
}
|
|
if ($equals_1('CC2Elm', className)) {
|
|
return new CC2Elm(x1, y1);
|
|
}
|
|
if ($equals_1('FullAdderElm', className)) {
|
|
return new FullAdderElm(x1, y1);
|
|
}
|
|
if ($equals_1('MemristorElm', className)) {
|
|
return new MemristorElm(x1, y1);
|
|
}
|
|
if ($equals_1('OpAmpSwapElm', className)) {
|
|
return new OpAmpSwapElm(x1, y1);
|
|
}
|
|
if ($equals_1('VaractorElm', className)) {
|
|
return new VaractorElm(x1, y1);
|
|
}
|
|
if ($equals_1('LampElm', className)) {
|
|
return new LampElm(x1, y1);
|
|
}
|
|
if ($equals_1('InvertingSchmittElm', className)) {
|
|
return new InvertingSchmittElm(x1, y1);
|
|
}
|
|
if ($equals_1('ProbeElm', className)) {
|
|
return new ProbeElm(x1, y1);
|
|
}
|
|
if ($equals_1('GraphicElm', className)) {
|
|
return new GraphicElm(x1, y1);
|
|
}
|
|
if ($equals_1('DecimalDisplayElm', className)) {
|
|
return new DecimalDisplayElm(x1, y1);
|
|
}
|
|
if ($equals_1('SRAMElm', className)) {
|
|
return new SRAMElm(x1, y1);
|
|
}
|
|
if ($equals_1('ThreePhaseMotorElm', className)) {
|
|
return new ThreePhaseMotorElm(x1, y1);
|
|
}
|
|
if ($equals_1('RingCounterElm', className)) {
|
|
return new RingCounterElm(x1, y1);
|
|
}
|
|
if ($equals_1('Counter2Elm', className)) {
|
|
return new Counter2Elm(x1, y1);
|
|
}
|
|
if ($equals_1('CC2NegElm', className)) {
|
|
return new CC2NegElm(x1, y1);
|
|
}
|
|
if ($equals_1('JKFlipFlopElm', className)) {
|
|
return new JKFlipFlopElm(x1, y1);
|
|
}
|
|
if ($equals_1('SevenSegElm', className)) {
|
|
return new SevenSegElm(x1, y1);
|
|
}
|
|
if ($equals_1('TriodeElm', className)) {
|
|
return new TriodeElm(x1, y1);
|
|
}
|
|
if ($equals_1('PMosfetElm', className)) {
|
|
return new PMosfetElm(x1, y1);
|
|
}
|
|
if ($equals_1('DFlipFlopElm', className)) {
|
|
return new DFlipFlopElm(x1, y1);
|
|
}
|
|
if ($equals_1('PDarlingtonElm', className)) {
|
|
return new PDarlingtonElm(x1, y1);
|
|
}
|
|
return null;
|
|
}
|
|
|
|
function $create_0(className, x1, y1, x2, y2, f, st){
|
|
if ($equals_1('PolarCapacitorElm', className)) {
|
|
return new PolarCapacitorElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('CustomTransformerElm', className)) {
|
|
return new CustomTransformerElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('DCMotorElm', className)) {
|
|
return new DCMotorElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('FuseElm', className)) {
|
|
return new FuseElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('BoxElm', className)) {
|
|
return new BoxElm_0(x1, y1, x2, y2, f);
|
|
}
|
|
if ($equals_1('ROMElm', className)) {
|
|
return new ROMElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('TFlipFlopElm', className)) {
|
|
return new TFlipFlopElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('RelayElm', className)) {
|
|
return new RelayElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('MultiplexerElm', className)) {
|
|
return new MultiplexerElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('CrystalElm', className)) {
|
|
return new CrystalElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('AnalogSwitchElm', className)) {
|
|
return new AnalogSwitchElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('HalfAdderElm', className)) {
|
|
return new HalfAdderElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('BusSplitterElm', className)) {
|
|
return new BusSplitterElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('JfetElm', className)) {
|
|
return new JfetElm(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('OpAmpElm', className)) {
|
|
return new OpAmpElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('DiacElm', className)) {
|
|
return new DiacElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('DataRecorderElm', className)) {
|
|
return new DataRecorderElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('TestPointElm', className)) {
|
|
return new TestPointElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('OutputElm', className)) {
|
|
return new OutputElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('AndGateElm', className)) {
|
|
return new AndGateElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('TimeDelayRelayElm', className)) {
|
|
return new TimeDelayRelayElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('GroundElm', className)) {
|
|
return new GroundElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('MotorProtectionSwitchElm', className)) {
|
|
return new MotorProtectionSwitchElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('SCRElm', className)) {
|
|
return new SCRElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('SipoShiftElm', className)) {
|
|
return new SipoShiftElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('SparkGapElm', className)) {
|
|
return new SparkGapElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('OTAElm', className)) {
|
|
return new OTAElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('TriStateElm', className)) {
|
|
return new TriStateElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('PhaseCompElm', className)) {
|
|
return new PhaseCompElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('AntennaElm', className)) {
|
|
return new AntennaElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('ADCElm', className)) {
|
|
return new ADCElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('TransformerElm', className)) {
|
|
return new TransformerElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('ExtVoltageElm', className)) {
|
|
return new ExtVoltageElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('OpAmpRealElm', className)) {
|
|
return new OpAmpRealElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('DiodeElm', className)) {
|
|
return new DiodeElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('OptocouplerElm', className)) {
|
|
return new OptocouplerElm_0(x1, y1, x2, y2, f);
|
|
}
|
|
if ($equals_1('NoiseElm', className)) {
|
|
return new NoiseElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('AnalogMuxElm', className)) {
|
|
return new AnalogMuxElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('AudioInputElm', className)) {
|
|
return new AudioInputElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('OrGateElm', className)) {
|
|
return new OrGateElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('LEDArrayElm', className)) {
|
|
return new LEDArrayElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('RelayCoilElm', className)) {
|
|
return new RelayCoilElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('OhmMeterElm', className)) {
|
|
return new OhmMeterElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('SchmittElm', className)) {
|
|
return new SchmittElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('DeMultiplexerElm', className)) {
|
|
return new DeMultiplexerElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('CapacitorElm', className)) {
|
|
return new CapacitorElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('AudioOutputElm', className)) {
|
|
return new AudioOutputElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('SweepElm', className)) {
|
|
return new SweepElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('TappedTransformerElm', className)) {
|
|
return new TappedTransformerElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('SwitchElm', className)) {
|
|
return new SwitchElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('AMElm', className)) {
|
|
return new AMElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('CrossSwitchElm', className)) {
|
|
return new CrossSwitchElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('TransLineElm', className)) {
|
|
return new TransLineElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('UnijunctionElm', className)) {
|
|
return new UnijunctionElm_0(x1, y1, x2, y2, f);
|
|
}
|
|
if ($equals_1('AnalogSwitch2Elm', className)) {
|
|
return new AnalogSwitch2Elm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('VCVSElm', className)) {
|
|
return new VCVSElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('WattmeterElm', className)) {
|
|
return new WattmeterElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('CurrentElm', className)) {
|
|
return new CurrentElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('LabeledNodeElm', className)) {
|
|
return new LabeledNodeElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('VCCSElm', className)) {
|
|
return new VCCSElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('CustomLogicElm', className)) {
|
|
return new CustomLogicElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('VarRailElm', className)) {
|
|
return new VarRailElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('LDRElm', className)) {
|
|
return new LDRElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('PotElm', className)) {
|
|
return new PotElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('DACElm', className)) {
|
|
return new DACElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('LogicOutputElm', className)) {
|
|
return new LogicOutputElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('CounterElm', className)) {
|
|
return new CounterElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('LineElm', className)) {
|
|
return new LineElm_0(x1, y1, x2, y2, f);
|
|
}
|
|
if ($equals_1('MosfetElm', className)) {
|
|
return new MosfetElm(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('DPDTSwitchElm', className)) {
|
|
return new DPDTSwitchElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('InductorElm', className)) {
|
|
return new InductorElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('WireElm', className)) {
|
|
return new WireElm_0(x1, y1, x2, y2, f);
|
|
}
|
|
if ($equals_1('TimerElm', className)) {
|
|
return new TimerElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('NandGateElm', className)) {
|
|
return new NandGateElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('ThermistorNTCElm', className)) {
|
|
return new ThermistorNTCElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('RailElm', className)) {
|
|
return new RailElm_1(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('DataInputElm', className)) {
|
|
return new DataInputElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('NorGateElm', className)) {
|
|
return new NorGateElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('MonostableElm', className)) {
|
|
return new MonostableElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('ResistorElm', className)) {
|
|
return new ResistorElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('CCCSElm', className)) {
|
|
return new CCCSElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('RelayContactElm', className)) {
|
|
return new RelayContactElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('StopTriggerElm', className)) {
|
|
return new StopTriggerElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('TextElm', className)) {
|
|
return new TextElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('ComparatorElm', className)) {
|
|
return new ComparatorElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('CustomCompositeElm', className)) {
|
|
return new CustomCompositeElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('TriacElm', className)) {
|
|
return new TriacElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('InverterElm', className)) {
|
|
return new InverterElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('SeqGenElm', className)) {
|
|
return new SeqGenElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('VCOElm', className)) {
|
|
return new VCOElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('DelayBufferElm', className)) {
|
|
return new DelayBufferElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('AmmeterElm', className)) {
|
|
return new AmmeterElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('PisoShiftElm', className)) {
|
|
return new PisoShiftElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('CCVSElm', className)) {
|
|
return new CCVSElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('Switch2Elm', className)) {
|
|
return new Switch2Elm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('LogicInputElm', className)) {
|
|
return new LogicInputElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('MBBSwitchElm', className)) {
|
|
return new MBBSwitchElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('ScopeElm', className)) {
|
|
return new ScopeElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('SevenSegDecoderElm', className)) {
|
|
return new SevenSegDecoderElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('TransistorElm', className)) {
|
|
return new TransistorElm(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('XorGateElm', className)) {
|
|
return new XorGateElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('TunnelDiodeElm', className)) {
|
|
return new TunnelDiodeElm_0(x1, y1, x2, y2, f);
|
|
}
|
|
if ($equals_1('XnorGateElm', className)) {
|
|
return new XnorGateElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('ZenerElm', className)) {
|
|
return new ZenerElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('LatchElm', className)) {
|
|
return new LatchElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('LEDElm', className)) {
|
|
return new LEDElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('FMElm', className)) {
|
|
return new FMElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('CC2Elm', className)) {
|
|
return new CC2Elm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('FullAdderElm', className)) {
|
|
return new FullAdderElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('MemristorElm', className)) {
|
|
return new MemristorElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('VoltageElm', className)) {
|
|
return new VoltageElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('VaractorElm', className)) {
|
|
return new VaractorElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('LampElm', className)) {
|
|
return new LampElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('InvertingSchmittElm', className)) {
|
|
return new InvertingSchmittElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('ProbeElm', className)) {
|
|
return new ProbeElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('DecimalDisplayElm', className)) {
|
|
return new DecimalDisplayElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('DarlingtonElm', className)) {
|
|
return new DarlingtonElm(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('SRAMElm', className)) {
|
|
return new SRAMElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('ThreePhaseMotorElm', className)) {
|
|
return new ThreePhaseMotorElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('RingCounterElm', className)) {
|
|
return new RingCounterElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('Counter2Elm', className)) {
|
|
return new Counter2Elm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('JKFlipFlopElm', className)) {
|
|
return new JKFlipFlopElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('SevenSegElm', className)) {
|
|
return new SevenSegElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('TriodeElm', className)) {
|
|
return new TriodeElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
if ($equals_1('DFlipFlopElm', className)) {
|
|
return new DFlipFlopElm_0(x1, y1, x2, y2, f, st);
|
|
}
|
|
return null;
|
|
}
|
|
|
|
function $apply_0(this$static){
|
|
var a, fname;
|
|
fname = $getText(this$static.textBox);
|
|
fname.indexOf('.') != -1 || (fname += '' + this$static.ext);
|
|
a = new Anchor_0(fname, this$static.dataURL);
|
|
$setAttribute(($clinit_DOM() , a.element), 'Download', fname);
|
|
$add_5(this$static.vp, a);
|
|
a.element.click();
|
|
return true;
|
|
}
|
|
|
|
function ExportAsImageDialog(type_0){
|
|
var cancelButton, data_0, hp, okButton;
|
|
Dialog.call(this);
|
|
this.vp = new VerticalPanel;
|
|
$setWidget_1(this, this.vp);
|
|
$setText(this, LS('Save as Image'));
|
|
$add_5(this.vp, new Label_1(LS('File name:')));
|
|
this.textBox = new TextBox;
|
|
$setWidth(this.textBox, '250px');
|
|
$add_5(this.vp, this.textBox);
|
|
this.ext = '.png';
|
|
if (type_0 == 1) {
|
|
this.dataURL = $toDataUrl($getCircuitAsCanvas(theApp.imageExporter, 1));
|
|
}
|
|
else {
|
|
data_0 = $getCircuitAsSVG(theApp.imageExporter);
|
|
this.dataURL = 'data:text/plain;base64,' + window.btoa(unescape(encodeURIComponent(data_0)));
|
|
this.ext = '.svg';
|
|
}
|
|
$setText_2(this.textBox, defaultFileName(this.ext));
|
|
hp = new HorizontalPanel;
|
|
($clinit_DOM() , hp.element).style['width'] = '100%';
|
|
$setHorizontalAlignment_0(hp, ($clinit_HasHorizontalAlignment() , ALIGN_LEFT));
|
|
hp.element.className = 'topSpace';
|
|
$add_5(this.vp, hp);
|
|
$add_3(hp, okButton = new Button_1(LS('OK')));
|
|
$setHorizontalAlignment_0(hp, ALIGN_RIGHT);
|
|
$add_3(hp, cancelButton = new Button_1(LS('Cancel')));
|
|
$addDomHandler(okButton, new ExportAsImageDialog$1(this), ($clinit_ClickEvent() , $clinit_ClickEvent() , TYPE_1));
|
|
$addDomHandler(cancelButton, new ExportAsImageDialog$2(this), (null , TYPE_1));
|
|
$center(this);
|
|
}
|
|
|
|
defineClass(341, 140, $intern_58, ExportAsImageDialog);
|
|
_.apply_0 = function apply_7(){
|
|
return $apply_0(this);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_ExportAsImageDialog_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ExportAsImageDialog', 341);
|
|
function ExportAsImageDialog$1(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(727, 1, $intern_56, ExportAsImageDialog$1);
|
|
_.onClick = function onClick_14(event_0){
|
|
$apply_0(this.this$01);
|
|
$closeDialog(this.this$01);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_ExportAsImageDialog$1_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ExportAsImageDialog/1', 727);
|
|
function ExportAsImageDialog$2(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(728, 1, $intern_56, ExportAsImageDialog$2);
|
|
_.onClick = function onClick_15(event_0){
|
|
$closeDialog(this.this$01);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_ExportAsImageDialog$2_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ExportAsImageDialog/2', 728);
|
|
function $apply_1(this$static){
|
|
var a, fname;
|
|
fname = $getText(this$static.textBox);
|
|
fname.indexOf('.') != -1 || (fname += '.txt');
|
|
fname == null || $equals_1(fname.substr(0, 10), 'circuitjs-')?(lastFileName = null):(lastFileName = fname);
|
|
a = new Anchor_0(fname, this$static.url_0);
|
|
$setAttribute(($clinit_DOM() , a.element), 'Download', fname);
|
|
$add_5(this$static.vp, a);
|
|
a.element.click();
|
|
return true;
|
|
}
|
|
|
|
function ExportAsLocalFileDialog(data_0){
|
|
var cancelButton, date, dtf, fname, hp, okButton, datain, oldblob, blob, url_0;
|
|
Dialog.call(this);
|
|
this.vp = new VerticalPanel;
|
|
$setWidget_1(this, this.vp);
|
|
$setText(this, LS('Export as Local File'));
|
|
$add_5(this.vp, new Label_1(LS('File name:')));
|
|
this.textBox = new TextBox;
|
|
$setWidth(this.textBox, '250px');
|
|
$add_5(this.vp, this.textBox);
|
|
this.url_0 = (datain = [''] , datain[0] = data_0 , oldblob = $doc.exportBlob , oldblob && URL.revokeObjectURL(oldblob) , blob = new Blob(datain, {type:'text/plain'}) , url_0 = URL.createObjectURL(blob) , $doc.exportBlob = url_0 , url_0);
|
|
date = new Date_0;
|
|
if (lastFileName != null)
|
|
fname = lastFileName;
|
|
else {
|
|
dtf = ($clinit_DateTimeFormat_0() , getFormat('yyyyMMdd-HHmmss', $getDateTimeFormatInfo(($clinit_LocaleInfo() , $clinit_LocaleInfo() , instance_0))));
|
|
fname = 'circuitjs-' + $format(dtf, date, null) + '.txt';
|
|
}
|
|
$setText_2(this.textBox, fname);
|
|
hp = new HorizontalPanel;
|
|
($clinit_DOM() , hp.element).style['width'] = '100%';
|
|
$setHorizontalAlignment_0(hp, ($clinit_HasHorizontalAlignment() , ALIGN_LEFT));
|
|
hp.element.className = 'topSpace';
|
|
$add_5(this.vp, hp);
|
|
$add_3(hp, okButton = new Button_1(LS('OK')));
|
|
$setHorizontalAlignment_0(hp, ALIGN_RIGHT);
|
|
$add_3(hp, cancelButton = new Button_1(LS('Cancel')));
|
|
$addDomHandler(okButton, new ExportAsLocalFileDialog$1(this), ($clinit_ClickEvent() , $clinit_ClickEvent() , TYPE_1));
|
|
$addDomHandler(cancelButton, new ExportAsLocalFileDialog$2(this), (null , TYPE_1));
|
|
$center(this);
|
|
}
|
|
|
|
function setLastFileName(s){
|
|
s == null || $equals_1(s.substr(0, 10), 'circuitjs-')?(lastFileName = null):(lastFileName = s);
|
|
}
|
|
|
|
defineClass(681, 140, $intern_58, ExportAsLocalFileDialog);
|
|
_.apply_0 = function apply_8(){
|
|
return $apply_1(this);
|
|
}
|
|
;
|
|
var lastFileName;
|
|
var Lcom_lushprojects_circuitjs1_client_ExportAsLocalFileDialog_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ExportAsLocalFileDialog', 681);
|
|
function ExportAsLocalFileDialog$1(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(682, 1, $intern_56, ExportAsLocalFileDialog$1);
|
|
_.onClick = function onClick_16(event_0){
|
|
$apply_1(this.this$01);
|
|
$closeDialog(this.this$01);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_ExportAsLocalFileDialog$1_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ExportAsLocalFileDialog/1', 682);
|
|
function ExportAsLocalFileDialog$2(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(683, 1, $intern_56, ExportAsLocalFileDialog$2);
|
|
_.onClick = function onClick_17(event_0){
|
|
$closeDialog(this.this$01);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_ExportAsLocalFileDialog$2_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ExportAsLocalFileDialog/2', 683);
|
|
function ExportAsTextDialog(asim, s){
|
|
var copyButton, hp, importButton, okButton, ta;
|
|
Dialog.call(this);
|
|
this.closeOnEnter = false;
|
|
this.sim = asim;
|
|
this.vp = new VerticalPanel;
|
|
$setWidget_1(this, this.vp);
|
|
$setText(this, LS('Export as Text'));
|
|
$add_5(this.vp, new Label_1(LS('Text file for this circuit is...')));
|
|
$add_5(this.vp, ta = new TextArea_0);
|
|
($clinit_DOM() , ta.element).style['width'] = '400px';
|
|
ta.element.style['height'] = '300px';
|
|
ta.element['value'] = s != null?s:'';
|
|
this.textArea = ta;
|
|
hp = new HorizontalPanel;
|
|
hp.element.style['width'] = '100%';
|
|
$setHorizontalAlignment_0(hp, ($clinit_HasHorizontalAlignment() , ALIGN_LEFT));
|
|
hp.element.className = 'topSpace';
|
|
$add_5(this.vp, hp);
|
|
$add_3(hp, okButton = new Button_1(LS('OK')));
|
|
$add_3(hp, copyButton = new Button_1(LS('Copy to Clipboard')));
|
|
$setHorizontalAlignment_0(hp, ALIGN_RIGHT);
|
|
$add_3(hp, importButton = new Button_1(LS('Re-Import')));
|
|
$addDomHandler(okButton, new ExportAsTextDialog$1(this), ($clinit_ClickEvent() , $clinit_ClickEvent() , TYPE_1));
|
|
$addDomHandler(importButton, new ExportAsTextDialog$2(this), (null , TYPE_1));
|
|
$addDomHandler(copyButton, new ExportAsTextDialog$3(this), (null , TYPE_1));
|
|
$center(this);
|
|
}
|
|
|
|
defineClass(723, 140, $intern_58, ExportAsTextDialog);
|
|
var Lcom_lushprojects_circuitjs1_client_ExportAsTextDialog_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ExportAsTextDialog', 723);
|
|
function ExportAsTextDialog$1(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(724, 1, $intern_56, ExportAsTextDialog$1);
|
|
_.onClick = function onClick_18(event_0){
|
|
$closeDialog(this.this$01);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_ExportAsTextDialog$1_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ExportAsTextDialog/1', 724);
|
|
function ExportAsTextDialog$2(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(725, 1, $intern_56, ExportAsTextDialog$2);
|
|
_.onClick = function onClick_19(event_0){
|
|
var s;
|
|
$pushUndo(this.this$01.sim.undoManager);
|
|
$closeDialog(this.this$01);
|
|
s = $getText(this.this$01.textArea);
|
|
if (s != null) {
|
|
$readCircuit(this.this$01.sim, s);
|
|
$allowSave(this.this$01.sim.ui, false);
|
|
}
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_ExportAsTextDialog$2_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ExportAsTextDialog/2', 725);
|
|
function ExportAsTextDialog$3(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(726, 1, $intern_56, ExportAsTextDialog$3);
|
|
_.onClick = function onClick_20(event_0){
|
|
$setFocus(this.this$01.textArea);
|
|
$selectAll(this.this$01.textArea);
|
|
$doc.execCommand('copy');
|
|
$setSelectionRange(this.this$01.textArea, 0);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_ExportAsTextDialog$3_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ExportAsTextDialog/3', 726);
|
|
function $shortIsSupported(){
|
|
if ($wnd.openFile != undefined)
|
|
return false;
|
|
return true;
|
|
}
|
|
|
|
function ExportAsUrlDialog(dump_0){
|
|
var copyButton, hp, la1, okButton, query, start_0, regexp;
|
|
Dialog.call(this);
|
|
this.closeOnEnter = false;
|
|
start_0 = $split_1($wnd.location.href, '\\?', 0);
|
|
$wnd.openFile != undefined && (start_0[0] = 'https://www.falstad.com/circuit/circuitjs.html');
|
|
query = '?ctz=' + $wnd.LZString.compressToEncodedURIComponent(dump_0);
|
|
dump_0 = start_0[0] + query;
|
|
this.requrl = (throwIfNull('decodedURLComponent', query) , regexp = /%20/g , encodeURIComponent(query).replace(regexp, '+'));
|
|
this.vp = new VerticalPanel;
|
|
$setWidget_1(this, this.vp);
|
|
$setText(this, LS('Export as URL'));
|
|
$add_5(this.vp, new Label_1(LS('URL for this circuit is...')));
|
|
if (dump_0.length > 2000) {
|
|
$add_5(this.vp, la1 = new Label_2(LS('Warning: this URL is longer than 2000 characters and may not work in some browsers.')));
|
|
($clinit_DOM() , la1.element).style['width'] = '300px';
|
|
}
|
|
$add_5(this.vp, textArea = new TextArea_0);
|
|
$setWidth(textArea, '400px');
|
|
$setHeight(textArea, '300px');
|
|
$setText_2(textArea, dump_0);
|
|
hp = new HorizontalPanel;
|
|
($clinit_DOM() , hp.element).style['width'] = '100%';
|
|
hp.element.className = 'topSpace';
|
|
$setHorizontalAlignment_0(hp, ($clinit_HasHorizontalAlignment() , ALIGN_LEFT));
|
|
$add_3(hp, okButton = new Button_1(LS('OK')));
|
|
$add_3(hp, copyButton = new Button_1(LS('Copy to Clipboard')));
|
|
$add_5(this.vp, hp);
|
|
if ($shortIsSupported()) {
|
|
$setHorizontalAlignment_0(hp, ALIGN_RIGHT);
|
|
$add_3(hp, this.shortButton = new Button_1(LS('Create short URL')));
|
|
$addDomHandler(this.shortButton, new ExportAsUrlDialog$2(this), ($clinit_ClickEvent() , $clinit_ClickEvent() , TYPE_1));
|
|
}
|
|
$addDomHandler(okButton, new ExportAsUrlDialog$3(this), ($clinit_ClickEvent() , $clinit_ClickEvent() , TYPE_1));
|
|
$addDomHandler(copyButton, new ExportAsUrlDialog$4, (null , TYPE_1));
|
|
$center(this);
|
|
}
|
|
|
|
function createShort(urlin){
|
|
var requestBuilder, url_0;
|
|
url_0 = 'shortrelay.php?v=' + urlin;
|
|
$setText_2(textArea, 'Waiting for short URL for web service...');
|
|
requestBuilder = new RequestBuilder(($clinit_RequestBuilder() , GET), url_0);
|
|
try {
|
|
$sendRequest(requestBuilder, new ExportAsUrlDialog$1);
|
|
}
|
|
catch ($e0) {
|
|
$e0 = toJava($e0);
|
|
if (!instanceOf($e0, 156))
|
|
throw toJs($e0);
|
|
}
|
|
}
|
|
|
|
defineClass(718, 140, $intern_58, ExportAsUrlDialog);
|
|
var textArea;
|
|
var Lcom_lushprojects_circuitjs1_client_ExportAsUrlDialog_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ExportAsUrlDialog', 718);
|
|
function ExportAsUrlDialog$1(){
|
|
}
|
|
|
|
defineClass(719, 1, {}, ExportAsUrlDialog$1);
|
|
_.onError = function onError_0(request, exception){
|
|
}
|
|
;
|
|
_.onResponseReceived = function onResponseReceived_0(request, response){
|
|
var text_0;
|
|
if (response.xmlHttpRequest.status == 200) {
|
|
text_0 = response.xmlHttpRequest.responseText;
|
|
$setText_2(textArea, text_0);
|
|
}
|
|
else {
|
|
text_0 = 'Shortner error:' + response.xmlHttpRequest.statusText;
|
|
$setText_2(textArea, text_0);
|
|
}
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_ExportAsUrlDialog$1_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ExportAsUrlDialog/1', 719);
|
|
function ExportAsUrlDialog$2(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(720, 1, $intern_56, ExportAsUrlDialog$2);
|
|
_.onClick = function onClick_21(event_0){
|
|
$setVisible(this.this$01.shortButton, false);
|
|
createShort(this.this$01.requrl);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_ExportAsUrlDialog$2_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ExportAsUrlDialog/2', 720);
|
|
function ExportAsUrlDialog$3(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(721, 1, $intern_56, ExportAsUrlDialog$3);
|
|
_.onClick = function onClick_22(event_0){
|
|
$closeDialog(this.this$01);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_ExportAsUrlDialog$3_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ExportAsUrlDialog/3', 721);
|
|
function ExportAsUrlDialog$4(){
|
|
}
|
|
|
|
defineClass(722, 1, $intern_56, ExportAsUrlDialog$4);
|
|
_.onClick = function onClick_23(event_0){
|
|
$setFocus(textArea);
|
|
$selectAll(textArea);
|
|
$doc.execCommand('copy');
|
|
$setSelectionRange(textArea, 0);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_ExportAsUrlDialog$4_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ExportAsUrlDialog/4', 722);
|
|
function $eval(this$static, es){
|
|
var i, left, right, x_0;
|
|
left = null;
|
|
right = null;
|
|
if (!!this$static.children && this$static.children.arrayList.array.length > 0) {
|
|
left = $firstElement(this$static.children);
|
|
this$static.children.arrayList.array.length == 2 && (right = $lastElement(this$static.children));
|
|
}
|
|
switch (this$static.type_0) {
|
|
case 1:
|
|
return $eval(left, es) + $eval(right, es);
|
|
case 2:
|
|
return $eval(left, es) - $eval(right, es);
|
|
case 7:
|
|
return $eval(left, es) * $eval(right, es);
|
|
case 8:
|
|
return $eval(left, es) / $eval(right, es);
|
|
case 9:
|
|
return $wnd.Math.pow($eval(left, es), $eval(right, es));
|
|
case 33:
|
|
return $eval(left, es) != 0 || $eval(right, es) != 0?1:0;
|
|
case 34:
|
|
return $eval(left, es) != 0 && $eval(right, es) != 0?1:0;
|
|
case 35:
|
|
return $eval(left, es) == $eval(right, es)?1:0;
|
|
case 40:
|
|
return $eval(left, es) != $eval(right, es)?1:0;
|
|
case 36:
|
|
return $eval(left, es) <= $eval(right, es)?1:0;
|
|
case 37:
|
|
return $eval(left, es) >= $eval(right, es)?1:0;
|
|
case 38:
|
|
return $eval(left, es) < $eval(right, es)?1:0;
|
|
case 39:
|
|
return $eval(left, es) > $eval(right, es)?1:0;
|
|
case 32:
|
|
return $eval($get_4(this$static.children, $eval(left, es) != 0?1:2), es);
|
|
case 10:
|
|
return -$eval(left, es);
|
|
case 41:
|
|
return $eval(left, es) == 0?1:0;
|
|
case 6:
|
|
return this$static.value_0;
|
|
case 3:
|
|
return es.t;
|
|
case 11:
|
|
return $wnd.Math.sin($eval(left, es));
|
|
case 12:
|
|
return $wnd.Math.cos($eval(left, es));
|
|
case 13:
|
|
return $wnd.Math.abs($eval(left, es));
|
|
case 14:
|
|
return $wnd.Math.exp($eval(left, es));
|
|
case 15:
|
|
return $wnd.Math.log($eval(left, es));
|
|
case 16:
|
|
return $wnd.Math.sqrt($eval(left, es));
|
|
case 17:
|
|
return $wnd.Math.tan($eval(left, es));
|
|
case 44:
|
|
return $wnd.Math.asin($eval(left, es));
|
|
case 45:
|
|
return $wnd.Math.acos($eval(left, es));
|
|
case 46:
|
|
return $wnd.Math.atan($eval(left, es));
|
|
case 47:
|
|
return sinh($eval(left, es));
|
|
case 48:
|
|
return cosh($eval(left, es));
|
|
case 49:
|
|
return tanh($eval(left, es));
|
|
case 50:
|
|
return round_int($eval(left, es)) & round_int($eval(right, es));
|
|
case 51:
|
|
return round_int($eval(left, es)) | round_int($eval(right, es));
|
|
case 52:
|
|
return round_int($eval(left, es)) >> round_int($eval(right, es));
|
|
case 42:
|
|
return $wnd.Math.floor($eval(left, es));
|
|
case 43:
|
|
return $wnd.Math.ceil($eval(left, es));
|
|
case 20:
|
|
{
|
|
x_0 = $eval(left, es);
|
|
for (i = 1; i < this$static.children.arrayList.array.length; i++)
|
|
x_0 = $wnd.Math.min(x_0, $eval($get_4(this$static.children, i), es));
|
|
return x_0;
|
|
}
|
|
|
|
case 19:
|
|
{
|
|
x_0 = $eval(left, es);
|
|
for (i = 1; i < this$static.children.arrayList.array.length; i++)
|
|
x_0 = $wnd.Math.max(x_0, $eval($get_4(this$static.children, i), es));
|
|
return x_0;
|
|
}
|
|
|
|
case 21:
|
|
return $wnd.Math.min($wnd.Math.max($eval(left, es), $eval($get_4(this$static.children, 1), es)), $eval($get_4(this$static.children, 2), es));
|
|
case 26:
|
|
{
|
|
x_0 = $eval(left, es);
|
|
if (!right)
|
|
return x_0 < 0?0:1;
|
|
return x_0 > $eval(right, es)?0:x_0 < 0?0:1;
|
|
}
|
|
|
|
case 27:
|
|
{
|
|
x_0 = $eval(left, es);
|
|
return $eval($get_4(this$static.children, x_0 > 0?2:1), es);
|
|
}
|
|
|
|
case 23:
|
|
{
|
|
x_0 = $posmod($eval(left, es)) / $intern_1;
|
|
return x_0 < 1?-1 + x_0 * 2:3 - x_0 * 2;
|
|
}
|
|
|
|
case 24:
|
|
{
|
|
x_0 = $posmod($eval(left, es)) / $intern_1;
|
|
return x_0 - 1;
|
|
}
|
|
|
|
case 25:
|
|
return $eval(left, es) % $eval(right, es);
|
|
case 22:
|
|
return $pwl(es, this$static.children);
|
|
case 28:
|
|
return $wnd.Math.pow($wnd.Math.abs($eval(left, es)), $eval(right, es));
|
|
case 29:
|
|
{
|
|
x_0 = $eval(left, es);
|
|
if (x_0 < 0)
|
|
return -$wnd.Math.pow(-x_0, $eval(right, es));
|
|
return $wnd.Math.pow(x_0, $eval(right, es));
|
|
}
|
|
|
|
case 30:
|
|
return es.lastOutput;
|
|
case 31:
|
|
return theSim.timeStep;
|
|
default:if (this$static.type_0 >= 73)
|
|
return es.lastValues[this$static.type_0 - 73];
|
|
if (this$static.type_0 >= 63)
|
|
return (es.values[this$static.type_0 - 63] - es.lastValues[this$static.type_0 - 63]) / theSim.timeStep;
|
|
if (this$static.type_0 >= 53)
|
|
return es.values[this$static.type_0 - 53];
|
|
console.log('unknown\n');
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
function $posmod(x_0){
|
|
x_0 %= $intern_2;
|
|
return x_0 >= 0?x_0:x_0 + $intern_2;
|
|
}
|
|
|
|
function $pwl(es, args){
|
|
var i, x_0, x0, x1, y0, y1;
|
|
x_0 = $eval((checkArrayElementIndex(0, args.arrayList.array.length) , $get_2(args.arrayList, 0)), es);
|
|
x0 = $eval((checkArrayElementIndex(1, args.arrayList.array.length) , $get_2(args.arrayList, 1)), es);
|
|
y0 = $eval((checkArrayElementIndex(2, args.arrayList.array.length) , $get_2(args.arrayList, 2)), es);
|
|
if (x_0 < x0)
|
|
return y0;
|
|
x1 = $eval((checkArrayElementIndex(3, args.arrayList.array.length) , $get_2(args.arrayList, 3)), es);
|
|
y1 = $eval((checkArrayElementIndex(4, args.arrayList.array.length) , $get_2(args.arrayList, 4)), es);
|
|
i = 5;
|
|
while (true) {
|
|
if (x_0 < x1)
|
|
return y0 + (x_0 - x0) * (y1 - y0) / (x1 - x0);
|
|
if (i + 1 >= args.arrayList.array.length)
|
|
break;
|
|
x0 = x1;
|
|
y0 = y1;
|
|
x1 = $eval((checkArrayElementIndex(i, args.arrayList.array.length) , $get_2(args.arrayList, i)), es);
|
|
y1 = $eval((checkArrayElementIndex(i + 1, args.arrayList.array.length) , $get_2(args.arrayList, i + 1)), es);
|
|
i += 2;
|
|
}
|
|
return y1;
|
|
}
|
|
|
|
function Expr(v){
|
|
this.type_0 = v;
|
|
}
|
|
|
|
function Expr_0(vv){
|
|
this.type_0 = 6;
|
|
this.value_0 = vv;
|
|
}
|
|
|
|
function Expr_1(e1, e2, v){
|
|
this.children = new Vector;
|
|
$add_11(this.children, e1);
|
|
!!e2 && $add_11(this.children, e2);
|
|
this.type_0 = v;
|
|
}
|
|
|
|
defineClass(54, 1, {54:1}, Expr, Expr_0, Expr_1);
|
|
_.type_0 = 0;
|
|
_.value_0 = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_Expr_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'Expr', 54);
|
|
function $getToken(this$static){
|
|
var c, i;
|
|
while (this$static.pos < this$static.tlen && $charAt_0(this$static.text_0, this$static.pos) == 32)
|
|
++this$static.pos;
|
|
if (this$static.pos == this$static.tlen) {
|
|
this$static.token = '';
|
|
return;
|
|
}
|
|
i = this$static.pos;
|
|
c = $charAt_0(this$static.text_0, i);
|
|
if (c >= 48 && c <= 57 || c == 46) {
|
|
for (i = this$static.pos; i != this$static.tlen; i++) {
|
|
if ($charAt_0(this$static.text_0, i) == 101 || $charAt_0(this$static.text_0, i) == 69) {
|
|
++i;
|
|
i < this$static.tlen && ($charAt_0(this$static.text_0, i) == 43 || $charAt_0(this$static.text_0, i) == 45) && ++i;
|
|
}
|
|
if (!($charAt_0(this$static.text_0, i) >= 48 && $charAt_0(this$static.text_0, i) <= 57 || $charAt_0(this$static.text_0, i) == 46))
|
|
break;
|
|
}
|
|
}
|
|
else if (c >= 97 && c <= 122) {
|
|
for (i = this$static.pos; i != this$static.tlen; i++) {
|
|
if (!($charAt_0(this$static.text_0, i) >= 97 && $charAt_0(this$static.text_0, i) <= 122))
|
|
break;
|
|
}
|
|
}
|
|
else {
|
|
++i;
|
|
i < this$static.tlen && ($charAt_0(this$static.text_0, i) == c && (c == 124 || c == 38 || c == 60 || c == 62 || c == 61)?++i:(c == 60 || c == 62 || c == 33) && $charAt_0(this$static.text_0, i) == 61 && ++i);
|
|
}
|
|
this$static.token = $substring_0(this$static.text_0, this$static.pos, i);
|
|
this$static.pos = i;
|
|
}
|
|
|
|
function $parse_3(this$static){
|
|
var e, e2, e3, ret;
|
|
e = $parseOr(this$static);
|
|
if ($skip(this$static, '?')) {
|
|
e2 = $parseOr(this$static);
|
|
$skip(this$static, ':') || $setError_0(this$static, 'expected :, got ' + this$static.token);
|
|
e3 = $parse_3(this$static);
|
|
ret = new Expr_1(e, e2, 32);
|
|
$add_11(ret.children, e3);
|
|
return ret;
|
|
}
|
|
return e;
|
|
}
|
|
|
|
function $parseAdd(this$static){
|
|
var e;
|
|
e = $parseMult(this$static);
|
|
while (true) {
|
|
if ($skip(this$static, '+'))
|
|
e = new Expr_1(e, $parseMult(this$static), 1);
|
|
else if ($skip(this$static, '-'))
|
|
e = new Expr_1(e, $parseMult(this$static), 2);
|
|
else
|
|
break;
|
|
}
|
|
return e;
|
|
}
|
|
|
|
function $parseAnd(this$static){
|
|
var e;
|
|
e = $parseBitOr(this$static);
|
|
while ($skip(this$static, '&&')) {
|
|
e = new Expr_1(e, $parseBitOr(this$static), 34);
|
|
}
|
|
return e;
|
|
}
|
|
|
|
function $parseBitAnd(this$static){
|
|
var e;
|
|
e = $parseEquals(this$static);
|
|
while ($skip(this$static, '&')) {
|
|
e = new Expr_1(e, $parseEquals(this$static), 50);
|
|
}
|
|
return e;
|
|
}
|
|
|
|
function $parseBitOr(this$static){
|
|
var e;
|
|
e = $parseBitAnd(this$static);
|
|
while ($skip(this$static, '|')) {
|
|
e = new Expr_1(e, $parseBitAnd(this$static), 51);
|
|
}
|
|
return e;
|
|
}
|
|
|
|
function $parseCompare(this$static){
|
|
var e;
|
|
e = $parseShift(this$static);
|
|
if ($skip(this$static, '<='))
|
|
return new Expr_1(e, $parseShift(this$static), 36);
|
|
if ($skip(this$static, '>='))
|
|
return new Expr_1(e, $parseShift(this$static), 37);
|
|
if ($skip(this$static, '!='))
|
|
return new Expr_1(e, $parseShift(this$static), 40);
|
|
if ($skip(this$static, '<'))
|
|
return new Expr_1(e, $parseShift(this$static), 38);
|
|
if ($skip(this$static, '>'))
|
|
return new Expr_1(e, $parseShift(this$static), 39);
|
|
return e;
|
|
}
|
|
|
|
function $parseEquals(this$static){
|
|
var e;
|
|
e = $parseCompare(this$static);
|
|
if ($skip(this$static, '=='))
|
|
return new Expr_1(e, $parseCompare(this$static), 35);
|
|
return e;
|
|
}
|
|
|
|
function $parseExpression(this$static){
|
|
var e;
|
|
if (this$static.token.length == 0)
|
|
return new Expr_0(0);
|
|
e = $parse_3(this$static);
|
|
this$static.token.length > 0 && $setError_0(this$static, 'unexpected token: ' + this$static.token);
|
|
return e;
|
|
}
|
|
|
|
function $parseFunc(this$static, t){
|
|
var e;
|
|
$skip(this$static, '(') || $setError_0(this$static, 'expected (, got ' + this$static.token);
|
|
e = $parse_3(this$static);
|
|
$skip(this$static, ')') || $setError_0(this$static, 'expected ), got ' + this$static.token);
|
|
return new Expr_1(e, null, t);
|
|
}
|
|
|
|
function $parseFuncMulti(this$static, t, minArgs, maxArgs){
|
|
var args, e, e1, enext;
|
|
args = 1;
|
|
$skip(this$static, '(') || $setError_0(this$static, 'expected (, got ' + this$static.token);
|
|
e1 = $parse_3(this$static);
|
|
e = new Expr_1(e1, null, t);
|
|
while ($skip(this$static, ',')) {
|
|
enext = $parse_3(this$static);
|
|
$add_11(e.children, enext);
|
|
++args;
|
|
}
|
|
$skip(this$static, ')') || $setError_0(this$static, 'expected ), got ' + this$static.token);
|
|
(args < minArgs || args > maxArgs) && this$static.err_0 == null && (this$static.err_0 = 'bad number of function args: ' + args);
|
|
return e;
|
|
}
|
|
|
|
function $parseMult(this$static){
|
|
var e;
|
|
e = $parseUminus(this$static);
|
|
while (true) {
|
|
if ($skip(this$static, '*'))
|
|
e = new Expr_1(e, $parseUminus(this$static), 7);
|
|
else if ($skip(this$static, '/'))
|
|
e = new Expr_1(e, $parseUminus(this$static), 8);
|
|
else
|
|
break;
|
|
}
|
|
return e;
|
|
}
|
|
|
|
function $parseOr(this$static){
|
|
var e;
|
|
e = $parseAnd(this$static);
|
|
while ($skip(this$static, '||')) {
|
|
e = new Expr_1(e, $parseAnd(this$static), 33);
|
|
}
|
|
return e;
|
|
}
|
|
|
|
function $parsePow(this$static){
|
|
var e;
|
|
e = $parseTerm(this$static);
|
|
while (true) {
|
|
if ($skip(this$static, '^'))
|
|
e = new Expr_1(e, $parseTerm(this$static), 9);
|
|
else
|
|
break;
|
|
}
|
|
return e;
|
|
}
|
|
|
|
function $parseShift(this$static){
|
|
var e;
|
|
e = $parseAdd(this$static);
|
|
while ($skip(this$static, '>>')) {
|
|
e = new Expr_1(e, $parseAdd(this$static), 52);
|
|
}
|
|
return e;
|
|
}
|
|
|
|
function $parseTerm(this$static){
|
|
var c, e;
|
|
if ($skip(this$static, '(')) {
|
|
e = $parse_3(this$static);
|
|
$skip(this$static, ')') || $setError_0(this$static, 'expected ), got ' + this$static.token);
|
|
return e;
|
|
}
|
|
if ($skip(this$static, 't'))
|
|
return new Expr(3);
|
|
if (this$static.token.length == 1) {
|
|
c = $charAt_0(this$static.token, 0);
|
|
if (c >= 97 && c <= 105) {
|
|
$getToken(this$static);
|
|
return new Expr(53 + (c - 97));
|
|
}
|
|
}
|
|
if ($startsWith(this$static.token, 'last') && this$static.token.length == 5) {
|
|
c = $charAt_0(this$static.token, 4);
|
|
if (c >= 97 && c <= 105) {
|
|
$getToken(this$static);
|
|
return new Expr(73 + (c - 97));
|
|
}
|
|
}
|
|
if ($endsWith(this$static.token, 'dt') && $startsWith(this$static.token, 'd') && this$static.token.length == 4) {
|
|
c = $charAt_0(this$static.token, 1);
|
|
if (c >= 97 && c <= 105) {
|
|
$getToken(this$static);
|
|
return new Expr(63 + (c - 97));
|
|
}
|
|
}
|
|
if ($skip(this$static, 'lastoutput'))
|
|
return new Expr(30);
|
|
if ($skip(this$static, 'timestep'))
|
|
return new Expr(31);
|
|
if ($skip(this$static, 'pi'))
|
|
return new Expr_0($intern_1);
|
|
if ($skip(this$static, 'sin'))
|
|
return $parseFunc(this$static, 11);
|
|
if ($skip(this$static, 'cos'))
|
|
return $parseFunc(this$static, 12);
|
|
if ($skip(this$static, 'asin'))
|
|
return $parseFunc(this$static, 44);
|
|
if ($skip(this$static, 'acos'))
|
|
return $parseFunc(this$static, 45);
|
|
if ($skip(this$static, 'atan'))
|
|
return $parseFunc(this$static, 46);
|
|
if ($skip(this$static, 'sinh'))
|
|
return $parseFunc(this$static, 47);
|
|
if ($skip(this$static, 'cosh'))
|
|
return $parseFunc(this$static, 48);
|
|
if ($skip(this$static, 'tanh'))
|
|
return $parseFunc(this$static, 49);
|
|
if ($skip(this$static, 'abs'))
|
|
return $parseFunc(this$static, 13);
|
|
if ($skip(this$static, 'exp'))
|
|
return $parseFunc(this$static, 14);
|
|
if ($skip(this$static, 'log'))
|
|
return $parseFunc(this$static, 15);
|
|
if ($skip(this$static, 'sqrt'))
|
|
return $parseFunc(this$static, 16);
|
|
if ($skip(this$static, 'tan'))
|
|
return $parseFunc(this$static, 17);
|
|
if ($skip(this$static, 'tri'))
|
|
return $parseFunc(this$static, 23);
|
|
if ($skip(this$static, 'saw'))
|
|
return $parseFunc(this$static, 24);
|
|
if ($skip(this$static, 'floor'))
|
|
return $parseFunc(this$static, 42);
|
|
if ($skip(this$static, 'ceil'))
|
|
return $parseFunc(this$static, 43);
|
|
if ($skip(this$static, 'min'))
|
|
return $parseFuncMulti(this$static, 20, 2, $intern_22);
|
|
if ($skip(this$static, 'max'))
|
|
return $parseFuncMulti(this$static, 19, 2, $intern_22);
|
|
if ($skip(this$static, 'pwl'))
|
|
return $parseFuncMulti(this$static, 22, 2, $intern_22);
|
|
if ($skip(this$static, 'mod'))
|
|
return $parseFuncMulti(this$static, 25, 2, 2);
|
|
if ($skip(this$static, 'step'))
|
|
return $parseFuncMulti(this$static, 26, 1, 2);
|
|
if ($skip(this$static, 'select'))
|
|
return $parseFuncMulti(this$static, 27, 3, 3);
|
|
if ($skip(this$static, 'clamp'))
|
|
return $parseFuncMulti(this$static, 21, 3, 3);
|
|
if ($skip(this$static, 'pwr'))
|
|
return $parseFuncMulti(this$static, 28, 2, 2);
|
|
if ($skip(this$static, 'pwrs'))
|
|
return $parseFuncMulti(this$static, 29, 2, 2);
|
|
try {
|
|
e = new Expr_0($doubleValue(__parseAndValidateDouble(this$static.token)));
|
|
$getToken(this$static);
|
|
return e;
|
|
}
|
|
catch ($e0) {
|
|
$e0 = toJava($e0);
|
|
if (instanceOf($e0, 13)) {
|
|
this$static.token.length == 0?this$static.err_0 == null && (this$static.err_0 = 'unexpected end of input'):$setError_0(this$static, 'unrecognized token: ' + this$static.token);
|
|
return new Expr_0(0);
|
|
}
|
|
else
|
|
throw toJs($e0);
|
|
}
|
|
}
|
|
|
|
function $parseUminus(this$static){
|
|
$skip(this$static, '+');
|
|
if ($skip(this$static, '!'))
|
|
return new Expr_1($parseUminus(this$static), null, 41);
|
|
if ($skip(this$static, '-'))
|
|
return new Expr_1($parseUminus(this$static), null, 10);
|
|
return $parsePow(this$static);
|
|
}
|
|
|
|
function $setError_0(this$static, s){
|
|
this$static.err_0 == null && (this$static.err_0 = s);
|
|
}
|
|
|
|
function $skip(this$static, s){
|
|
if ($compareTo(this$static.token, s) != 0)
|
|
return false;
|
|
$getToken(this$static);
|
|
return true;
|
|
}
|
|
|
|
function ExprParser(s){
|
|
this.text_0 = s.toLowerCase();
|
|
this.tlen = this.text_0.length;
|
|
this.pos = 0;
|
|
this.err_0 = null;
|
|
$getToken(this);
|
|
}
|
|
|
|
defineClass(362, 1, {}, ExprParser);
|
|
_.pos = 0;
|
|
_.tlen = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_ExprParser_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ExprParser', 362);
|
|
function $reset_4(this$static){
|
|
var i;
|
|
for (i = 0; i != this$static.values.length; i++)
|
|
this$static.lastValues[i] = 0;
|
|
this$static.lastOutput = 0;
|
|
}
|
|
|
|
function $updateLastValues(this$static, lastOut){
|
|
var i;
|
|
this$static.lastOutput = lastOut;
|
|
for (i = 0; i != this$static.values.length; i++)
|
|
this$static.lastValues[i] = this$static.values[i];
|
|
}
|
|
|
|
function ExprState(){
|
|
this.values = initUnidimensionalArray(D_classLit, $intern_76, 7, 9, 15, 1);
|
|
this.lastValues = initUnidimensionalArray(D_classLit, $intern_76, 7, 9, 15, 1);
|
|
this.values[4] = 2.718281828459045;
|
|
}
|
|
|
|
defineClass(246, 1, {}, ExprState);
|
|
_.lastOutput = 0;
|
|
_.t = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_ExprState_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ExprState', 246);
|
|
function $$init_7(this$static){
|
|
}
|
|
|
|
function ExtListEntry(){
|
|
$$init_7(this);
|
|
this.name_0 = 'gnd';
|
|
this.node = 1;
|
|
this.side = 2;
|
|
}
|
|
|
|
function ExtListEntry_0(s, n, p, sd){
|
|
$$init_7(this);
|
|
this.name_0 = s;
|
|
this.node = n;
|
|
this.pos = p;
|
|
this.side = sd;
|
|
}
|
|
|
|
defineClass(216, 1, {216:1}, ExtListEntry, ExtListEntry_0);
|
|
_.busWidth = 1;
|
|
_.busZ = 0;
|
|
_.node = 0;
|
|
_.pos = 0;
|
|
_.side = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_ExtListEntry_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ExtListEntry', 216);
|
|
function ExtVoltageElm(xx, yy){
|
|
RailElm_0.call(this, xx, yy, 1);
|
|
this.name_0 = 'ext';
|
|
}
|
|
|
|
function ExtVoltageElm_0(xa, ya, xb, yb, f, st){
|
|
RailElm_1.call(this, xa, ya, xb, yb, f, st);
|
|
this.name_0 = unescape_0($nextToken(st));
|
|
this.waveform = 1;
|
|
}
|
|
|
|
defineClass(262, 47, {8:1, 10:1, 262:1, 47:1, 56:1}, ExtVoltageElm, ExtVoltageElm_0);
|
|
_.drawRail = function drawRail_3(g){
|
|
$drawRailText(this, g, this.name_0);
|
|
}
|
|
;
|
|
_.dumpXml = function dumpXml_33(doc, elem){
|
|
$dumpXml(this, elem);
|
|
dumpAttr_1(elem, 'nm', this.name_0);
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_42(){
|
|
return 418;
|
|
}
|
|
;
|
|
_.getEditInfo = function getEditInfo_30(n){
|
|
var ei;
|
|
if (n == 0) {
|
|
ei = new EditInfo_0('Name', 0, -1, -1);
|
|
ei.text_0 = this.name_0;
|
|
return ei;
|
|
}
|
|
return null;
|
|
}
|
|
;
|
|
_.getElmType = function getElmType_8(){
|
|
return 'ext. voltage';
|
|
}
|
|
;
|
|
_.getInfo_0 = function getInfo_36(arr){
|
|
$getInfo(this, arr);
|
|
arr[0] = LS('ext. voltage') + ' (' + this.name_0 + ')';
|
|
}
|
|
;
|
|
_.getShortcut = function getShortcut_15(){
|
|
return 0;
|
|
}
|
|
;
|
|
_.getVoltage_0 = function getVoltage_3(){
|
|
return this.voltage;
|
|
}
|
|
;
|
|
_.setEditValue = function setEditValue_30(n, ei){
|
|
n == 0 && (this.name_0 = $getText(ei.textf));
|
|
}
|
|
;
|
|
_.undumpXml = function undumpXml_35(xml){
|
|
$undumpXml(this, xml);
|
|
this.name_0 = $parseStringAttr(xml, 'nm', this.name_0);
|
|
}
|
|
;
|
|
_.voltage = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_ExtVoltageElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ExtVoltageElm', 262);
|
|
function $fft(this$static, real, imag){
|
|
var a, c, i, i0, i1, j, k, n1, n2, s, t, t1, t2;
|
|
for (i0 = 0; i0 < real.length; i0++) {
|
|
real[i0] *= this$static.winTable[i0];
|
|
imag[i0] *= this$static.winTable[i0];
|
|
}
|
|
j = 0;
|
|
n2 = real.length / 2 | 0;
|
|
for (i1 = 1; i1 < real.length - 1; i1++) {
|
|
n1 = n2;
|
|
while (j >= n1) {
|
|
j -= n1;
|
|
n1 = n1 / 2 | 0;
|
|
}
|
|
j += n1;
|
|
if (i1 < j) {
|
|
t1 = real[i1];
|
|
real[i1] = real[j];
|
|
real[j] = t1;
|
|
t1 = imag[i1];
|
|
imag[i1] = imag[j];
|
|
imag[j] = t1;
|
|
}
|
|
}
|
|
n2 = 1;
|
|
for (i = 0; i < this$static.bits; i++) {
|
|
n1 = n2;
|
|
n2 <<= 1;
|
|
a = 0;
|
|
for (j = 0; j < n1; j++) {
|
|
c = this$static.cosTable[a];
|
|
s = this$static.sinTable[a];
|
|
a += 1 << this$static.bits - i - 1;
|
|
for (k = j; k < real.length; k += n2) {
|
|
t = k + n1;
|
|
t1 = c * real[t] - s * imag[t];
|
|
t2 = s * real[t] + c * imag[t];
|
|
real[k + n1] = real[k] - t1;
|
|
imag[k + n1] = imag[k] - t2;
|
|
real[k] += t1;
|
|
imag[k] += t2;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
function $magnitude(this$static, real, imag){
|
|
return $wnd.Math.sqrt(real * real + imag * imag) / this$static.size_0;
|
|
}
|
|
|
|
function FFT(n){
|
|
var dtheta, i, i0, weight;
|
|
this.size_0 = n;
|
|
this.bits = round_int($wnd.Math.log(this.size_0) / $wnd.Math.log(2));
|
|
this.cosTable = initUnidimensionalArray(D_classLit, $intern_76, 7, this.size_0 / 2 | 0, 15, 1);
|
|
this.sinTable = initUnidimensionalArray(D_classLit, $intern_76, 7, this.size_0 / 2 | 0, 15, 1);
|
|
dtheta = -6.283185307179586 / this.size_0;
|
|
for (i0 = 0; i0 < this.cosTable.length; i0++) {
|
|
this.cosTable[i0] = $wnd.Math.cos(dtheta * i0);
|
|
this.sinTable[i0] = $wnd.Math.sin(dtheta * i0);
|
|
}
|
|
this.winTable = initUnidimensionalArray(D_classLit, $intern_76, 7, this.size_0, 15, 1);
|
|
for (i = 0; i < this.winTable.length; i++) {
|
|
weight = $wnd.Math.sin(i * $intern_1 / this.winTable.length);
|
|
this.winTable[i] = weight * 1.5707963267961471;
|
|
}
|
|
}
|
|
|
|
defineClass(361, 1, {}, FFT);
|
|
_.bits = 0;
|
|
_.size_0 = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_FFT_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'FFT', 361);
|
|
function $$init_8(this$static){
|
|
this$static.lasttime = 0;
|
|
this$static.funcx = 0;
|
|
}
|
|
|
|
function $drawWaveform_1(this$static, g, center){
|
|
var xc, yc;
|
|
$setColor_0(g, mouseElmRef == this$static || this$static.selected_0 || $containsKey(app_0.mouse.scopePlotRoles, this$static) || instanceOf(mouseElmRef, 21) && $getElm_0(mouseElmRef.elmScope) == this$static || $isOnHighlightedNet(this$static)?selectColor_0:($clinit_Color() , gray));
|
|
$setPowerColor_0(this$static, g);
|
|
xc = center.x_0;
|
|
yc = center.y_0;
|
|
drawThickCircle(g, xc, yc, 17);
|
|
$adjustBbox(this$static, xc - 17, yc - 17, xc + 17, yc + 17);
|
|
}
|
|
|
|
function $getVoltage(this$static){
|
|
var deltaT, signalamplitude, w;
|
|
deltaT = sim_0.t - this$static.lasttime;
|
|
this$static.lasttime = sim_0.t;
|
|
signalamplitude = $wnd.Math.sin($intern_2 * (sim_0.t - this$static.freqTimeZero) * this$static.signalfreq);
|
|
this$static.funcx += deltaT * (this$static.carrierfreq + signalamplitude * this$static.deviation);
|
|
w = $intern_2 * this$static.funcx;
|
|
return $wnd.Math.sin(w) * this$static.maxVoltage;
|
|
}
|
|
|
|
function FMElm(xx, yy){
|
|
CircuitElm.call(this, xx, yy);
|
|
$$init_8(this);
|
|
this.deviation = 200;
|
|
this.maxVoltage = 5;
|
|
this.carrierfreq = 800;
|
|
this.signalfreq = 40;
|
|
this.freqTimeZero = 0;
|
|
this.curcount_0 = 0;
|
|
}
|
|
|
|
function FMElm_0(xa, ya, xb, yb, f, st){
|
|
CircuitElm_0.call(this, xa, ya, xb, yb, f);
|
|
$$init_8(this);
|
|
this.carrierfreq = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.signalfreq = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.maxVoltage = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.deviation = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
(this.flags & 2) != 0 && (this.flags &= -3);
|
|
this.freqTimeZero = 0;
|
|
this.curcount_0 = 0;
|
|
}
|
|
|
|
defineClass(435, 8, $intern_85, FMElm, FMElm_0);
|
|
_.doStep = function doStep_22(){
|
|
$updateVoltageSource(this.voltSource, $getVoltage(this));
|
|
}
|
|
;
|
|
_.draw = function draw_30(g){
|
|
var f;
|
|
$setBbox_0(this, this.point1, this.point2, 17);
|
|
$setVoltageColor(this, g, this.volts[0]);
|
|
drawThickLine_0(g, this.point1, this.lead1, 3);
|
|
f = new Font('SansSerif', 0, 12);
|
|
$setFont_0(g, f);
|
|
$setColor_0(g, mouseElmRef == this || this.selected_0 || $containsKey(app_0.mouse.scopePlotRoles, this) || instanceOf(mouseElmRef, 21) && $getElm_0(mouseElmRef.elmScope) == this || $isOnHighlightedNet(this)?selectColor_0:whiteColor);
|
|
$setPowerColor_0(this, g);
|
|
$getVoltage(this);
|
|
$drawCenteredText(this, g, 'FM', this.x2, this.y2, true);
|
|
$drawWaveform_1(this, g, this.point2);
|
|
$drawPosts(this, g);
|
|
this.curcount_0 = $updateDotCount(-this.current_0, this.curcount_0);
|
|
app_0.mouse.dragElm == this || $drawDots(g, this.point1, this.lead1, this.curcount_0);
|
|
}
|
|
;
|
|
_.dumpXml = function dumpXml_34(doc, elem){
|
|
dumpAttr_1(elem, 'x', this.x_0 + ' ' + this.y_0 + ' ' + this.x2 + ' ' + this.y2);
|
|
dumpAttr_0(elem, 'f', this.flags);
|
|
dumpAttr(elem, 'cf', this.carrierfreq);
|
|
dumpAttr(elem, 'sf', this.signalfreq);
|
|
dumpAttr(elem, 'mv', this.maxVoltage);
|
|
dumpAttr(elem, 'dv', this.deviation);
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_43(){
|
|
return 201;
|
|
}
|
|
;
|
|
_.getEditInfo = function getEditInfo_31(n){
|
|
if (n == 0)
|
|
return $setUnitStep(new EditInfo_0('Max Voltage', this.maxVoltage, -20, 20));
|
|
if (n == 1)
|
|
return new EditInfo_0('Carrier Frequency (Hz)', this.carrierfreq, 4, 500);
|
|
if (n == 2)
|
|
return new EditInfo_0('Signal Frequency (Hz)', this.signalfreq, 4, 500);
|
|
if (n == 3)
|
|
return new EditInfo_0('Deviation (Hz)', this.deviation, 4, 500);
|
|
return null;
|
|
}
|
|
;
|
|
_.getInfo_0 = function getInfo_37(arr){
|
|
arr[0] = 'FM Source';
|
|
arr[1] = 'I = ' + getUnitText(this.current_0, 'A', false);
|
|
arr[2] = 'V = ' + getUnitText(this.volts[0], 'V', false);
|
|
arr[3] = 'cf = ' + getUnitText(this.carrierfreq, 'Hz', false);
|
|
arr[4] = 'sf = ' + getUnitText(this.signalfreq, 'Hz', false);
|
|
arr[5] = 'dev =' + getUnitText(this.deviation, 'Hz', false);
|
|
arr[6] = 'Vmax = ' + getUnitText(this.maxVoltage, 'V', false);
|
|
}
|
|
;
|
|
_.getPostCount_0 = function getPostCount_31(){
|
|
return 1;
|
|
}
|
|
;
|
|
_.getPower = function getPower_6(){
|
|
return -this.volts[0] * this.current_0;
|
|
}
|
|
;
|
|
_.getVoltageDiff_0 = function getVoltageDiff_9(){
|
|
return this.volts[0];
|
|
}
|
|
;
|
|
_.getVoltageSourceCount = function getVoltageSourceCount_26(){
|
|
return 1;
|
|
}
|
|
;
|
|
_.hasGroundConnection = function hasGroundConnection_11(n1){
|
|
return true;
|
|
}
|
|
;
|
|
_.reset_0 = function reset_18(){
|
|
this.freqTimeZero = 0;
|
|
this.curcount_0 = 0;
|
|
}
|
|
;
|
|
_.setEditValue = function setEditValue_31(n, ei){
|
|
n == 0 && (this.maxVoltage = ei.value_0);
|
|
n == 1 && (this.carrierfreq = ei.value_0);
|
|
n == 2 && (this.signalfreq = ei.value_0);
|
|
n == 3 && (this.deviation = ei.value_0);
|
|
}
|
|
;
|
|
_.setPoints = function setPoints_27(){
|
|
$setPoints(this);
|
|
this.lead1 = $interpPoint(this.point1, this.point2, 1 - 17 / this.dn);
|
|
}
|
|
;
|
|
_.stamp = function stamp_28(){
|
|
$stampVoltageSource(ground, this.nodes[0], this.voltSource);
|
|
}
|
|
;
|
|
_.undumpXml = function undumpXml_36(xml){
|
|
this.flags = $parseIntAttr(xml, 'f', this.flags);
|
|
this.carrierfreq = $parseDoubleAttr(xml, 'cf', this.carrierfreq);
|
|
this.signalfreq = $parseDoubleAttr(xml, 'sf', this.signalfreq);
|
|
this.maxVoltage = $parseDoubleAttr(xml, 'mv', this.maxVoltage);
|
|
this.deviation = $parseDoubleAttr(xml, 'dv', this.deviation);
|
|
this.freqTimeZero = 0;
|
|
this.curcount_0 = 0;
|
|
}
|
|
;
|
|
_.validate = function validate_10(){
|
|
return $validateRailNode(this, 0);
|
|
}
|
|
;
|
|
_.carrierfreq = 0;
|
|
_.deviation = 0;
|
|
_.freqTimeZero = 0;
|
|
_.funcx = 0;
|
|
_.lasttime = 0;
|
|
_.maxVoltage = 0;
|
|
_.signalfreq = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_FMElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'FMElm', 435);
|
|
function $checkElm(this$static, n1, ce){
|
|
var c, j, j0, k;
|
|
if (ce == this$static.firstElm)
|
|
return false;
|
|
if (this$static.type_0 == 1) {
|
|
if (instanceOf(ce, 202))
|
|
return false;
|
|
}
|
|
if (this$static.type_0 == 2) {
|
|
if (!(ce.isWireEquivalent() || instanceOf(ce, 56) || instanceOf(ce, 186) || instanceOf(ce, 160)))
|
|
return false;
|
|
}
|
|
if (this$static.type_0 == 3 && !ce.isWireEquivalent())
|
|
return false;
|
|
if (this$static.type_0 == 4) {
|
|
if (!(ce.isWireEquivalent() || ce.isIdealCapacitor() || instanceOf(ce, 56) || instanceOf(ce, 186)))
|
|
return false;
|
|
}
|
|
if (n1 == ground) {
|
|
for (j0 = 0; j0 != ce.getPostCount_0(); j0++)
|
|
if (ce.hasGroundConnection(j0) && $findPath(this$static, ce.nodes[j0]))
|
|
return true;
|
|
}
|
|
for (j = 0; j != ce.getPostCount_0(); j++) {
|
|
if (ce.nodes[j] == n1) {
|
|
if (ce.hasGroundConnection(j) && $findPath(this$static, ground))
|
|
return true;
|
|
if (this$static.type_0 == 1 && instanceOf(ce, 194)) {
|
|
c = ce.getCurrent_0();
|
|
j == 0 && (c = -c);
|
|
if ($wnd.Math.abs(c - this$static.firstElm.getCurrent_0()) > 1.0E-10)
|
|
continue;
|
|
}
|
|
for (k = 0; k != ce.getPostCount_0(); k++) {
|
|
if (j == k)
|
|
continue;
|
|
if (ce.getConnection(j, k) && $findPath(this$static, ce.nodes[k])) {
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
function $findPath(this$static, n1){
|
|
var ce, cnl, i;
|
|
if (n1 == this$static.dest)
|
|
return true;
|
|
if (this$static.visited[n1.index_0])
|
|
return false;
|
|
this$static.visited[n1.index_0] = true;
|
|
for (i = 0; i != n1.links_0.arrayList.array.length; i++) {
|
|
cnl = $get_4(n1.links_0, i);
|
|
ce = cnl.elm;
|
|
if ($checkElm(this$static, n1, ce))
|
|
return true;
|
|
}
|
|
if (n1 == ground) {
|
|
for (i = 0; i != this$static.sim.nodesWithGroundConnection.arrayList.array.length; i++)
|
|
if ($checkElm(this$static, ground, $get_4(this$static.sim.nodesWithGroundConnection, i)))
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
function FindPathInfo(type_, elm_, dest_, sim_){
|
|
this.dest = dest_;
|
|
this.type_0 = type_;
|
|
this.firstElm = elm_;
|
|
this.sim = sim_;
|
|
this.visited = initUnidimensionalArray(Z_classLit, $intern_95, 7, this.sim.nodeList.arrayList.array.length, 16, 1);
|
|
}
|
|
|
|
defineClass(144, 1, {}, FindPathInfo);
|
|
_.type_0 = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_FindPathInfo_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'FindPathInfo', 144);
|
|
function Font(name_0, style, size_0){
|
|
var styleStr;
|
|
styleStr = 'normal ';
|
|
name_0 == 'SansSerif' && (name_0 = 'sans-serif');
|
|
(style & 1) != 0 && (styleStr = 'bold ');
|
|
this.fontname = styleStr + size_0 + 'px ' + name_0;
|
|
this.size_0 = size_0;
|
|
}
|
|
|
|
defineClass(66, 1, {}, Font);
|
|
_.size_0 = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_Font_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'Font', 66);
|
|
function $setupPins_12(this$static){
|
|
var bitsY;
|
|
this$static.sizeX = 2;
|
|
bitsY = this$static.bitOrder == 2?1:this$static.bits;
|
|
this$static.sizeY = bitsY * 2 + 1;
|
|
this$static.pins = initUnidimensionalArray(Lcom_lushprojects_circuitjs1_client_ChipElm$Pin_2_classLit, $intern_3, 9, this$static.bits * 3 + 2, 0, 1);
|
|
$makeBitPins(this$static, this$static.bits, 0, 2, 0, 'A', false, false, false);
|
|
$makeBitPins(this$static, this$static.bits, bitsY, 2, this$static.bits, 'B', false, false, false);
|
|
$makeBitPins(this$static, this$static.bits, 2, 3, this$static.bits * 2, 'S', true, false, false);
|
|
this$static.carryIn = this$static.bits * 3;
|
|
this$static.carryOut = this$static.bits * 3 + 1;
|
|
this$static.pins[this$static.carryOut] = new ChipElm$Pin(this$static, 0, 3, 'C');
|
|
this$static.pins[this$static.carryOut].output = true;
|
|
this$static.pins[this$static.carryIn] = new ChipElm$Pin(this$static, bitsY * 2, 2, 'Cin');
|
|
$allocNodes(this$static);
|
|
}
|
|
|
|
function FullAdderElm(xx, yy){
|
|
$clinit_ChipElm();
|
|
ChipElm.call(this, xx, yy);
|
|
this.flags |= 2;
|
|
this.bits = 4;
|
|
$setupPins_12(this);
|
|
}
|
|
|
|
function FullAdderElm_0(xa, ya, xb, yb, f, st){
|
|
$clinit_ChipElm();
|
|
ChipElm_0.call(this, xa, ya, xb, yb, f, st);
|
|
(this.flags & 2) != 0 || (this.bits = 1);
|
|
$setupPins_12(this);
|
|
}
|
|
|
|
defineClass(436, 32, $intern_85, FullAdderElm, FullAdderElm_0);
|
|
_.allowBus = function allowBus_6(){
|
|
return (this.flags & 2) != 0;
|
|
}
|
|
;
|
|
_.execute_3 = function execute_24(){
|
|
var c, i, v;
|
|
c = this.pins[this.carryIn].value_0?1:0;
|
|
for (i = 0; i != this.bits; i++) {
|
|
v = (this.pins[i].value_0?1:0) + (this.pins[i + this.bits].value_0?1:0) + c;
|
|
c = v > 1?1:0;
|
|
$writeOutput(this, i + this.bits * 2, (v & 1) == 1);
|
|
}
|
|
$writeOutput(this, this.carryOut, c == 1);
|
|
}
|
|
;
|
|
_.getChipEditInfo = function getChipEditInfo_12(n){
|
|
if (n == 0)
|
|
return $setPositive($setDimensionless(new EditInfo_0('# of Bits', this.bits, 1, 1)));
|
|
return null;
|
|
}
|
|
;
|
|
_.getChipName = function getChipName_14(){
|
|
return 'Adder';
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_44(){
|
|
return 196;
|
|
}
|
|
;
|
|
_.getPostCount_0 = function getPostCount_32(){
|
|
return this.bits * 3 + 2;
|
|
}
|
|
;
|
|
_.getVoltageSourceCount = function getVoltageSourceCount_27(){
|
|
return this.bits + 1;
|
|
}
|
|
;
|
|
_.needsBits = function needsBits_6(){
|
|
return (this.flags & 2) != 0;
|
|
}
|
|
;
|
|
_.setChipEditValue = function setChipEditValue_13(n, ei){
|
|
if (n == 0) {
|
|
this.bits = round_int(ei.value_0);
|
|
this.flags |= 2;
|
|
$setupPins_12(this);
|
|
$setPoints_0(this);
|
|
$allocNodes(this);
|
|
return;
|
|
}
|
|
}
|
|
;
|
|
_.setupPins = function setupPins_15(){
|
|
$setupPins_12(this);
|
|
}
|
|
;
|
|
_.carryIn = 0;
|
|
_.carryOut = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_FullAdderElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'FullAdderElm', 436);
|
|
function $getTempColor(this$static){
|
|
var c, temp, val, x_0;
|
|
c = $getVoltageColor(this$static, this$static.volts[0]);
|
|
temp = this$static.heat / this$static.i2t;
|
|
if (temp < $intern_118) {
|
|
val = temp * 3;
|
|
x_0 = round_int(255 * val);
|
|
x_0 < 0 && (x_0 = 0);
|
|
return new Color(x_0 + ((255 - x_0) * c.r / 255 | 0), (255 - x_0) * c.g / 255 | 0, (255 - x_0) * c.b / 255 | 0);
|
|
}
|
|
if (temp < 0.6667) {
|
|
x_0 = round_int((temp - $intern_118) * 3 * 255);
|
|
x_0 < 0 && (x_0 = 0);
|
|
return new Color(255, x_0, 0);
|
|
}
|
|
if (temp < 1) {
|
|
x_0 = round_int((temp - $intern_119) * 3 * 255);
|
|
x_0 < 0 && (x_0 = 0);
|
|
return new Color(255, 255, x_0);
|
|
}
|
|
return $clinit_Color() , white;
|
|
}
|
|
|
|
function $setPoints_11(this$static){
|
|
var llen;
|
|
$setPoints(this$static);
|
|
llen = (this$static.flags & 1) != 0?32:16;
|
|
$calcLeads(this$static, llen);
|
|
}
|
|
|
|
function FuseElm(xx, yy){
|
|
CircuitElm.call(this, xx, yy);
|
|
this.i2t = 6.73;
|
|
this.resistance = 0.0613;
|
|
}
|
|
|
|
function FuseElm_0(xa, ya, xb, yb, f, st){
|
|
CircuitElm_0.call(this, xa, ya, xb, yb, f);
|
|
this.resistance = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.i2t = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.heat = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.blown = $booleanValue(($clinit_Boolean() , $equalsIgnoreCase('true', $nextToken(st))));
|
|
}
|
|
|
|
defineClass(373, 8, $intern_85, FuseElm, FuseElm_0);
|
|
_.calculateCurrent = function calculateCurrent_13(){
|
|
this.current_0 = (this.volts[0] - this.volts[1]) / (this.blown?$intern_32:this.resistance);
|
|
}
|
|
;
|
|
_.doStep = function doStep_23(){
|
|
$stampResistor(this.nodes[0], this.nodes[1], this.blown?$intern_32:this.resistance);
|
|
}
|
|
;
|
|
_.draw = function draw_31(g){
|
|
var i, len;
|
|
$setBbox_0(this, this.point1, this.point2, 6);
|
|
$draw2Leads(this, g);
|
|
len = distance(this.lead1, this.lead2);
|
|
g.context.save();
|
|
g.context.lineWidth = 3;
|
|
$transform(g.context, (this.lead2.x_0 - this.lead1.x_0) / len, (this.lead2.y_0 - this.lead1.y_0) / len, -(this.lead2.y_0 - this.lead1.y_0) / len, (this.lead2.x_0 - this.lead1.x_0) / len, this.lead1.x_0, this.lead1.y_0);
|
|
$setStrokeStyleWeb(g.context, $getHexValue($getTempColor(this)));
|
|
if ((this.flags & 1) != 0) {
|
|
if (!this.blown) {
|
|
g.context.beginPath();
|
|
g.context.moveTo(0, 0);
|
|
$lineTo(g.context, len, 0);
|
|
g.context.stroke();
|
|
$strokeRect(g.context, 0, -6, len, 12);
|
|
}
|
|
}
|
|
else {
|
|
if (!this.blown) {
|
|
g.context.beginPath();
|
|
g.context.moveTo(0, 0);
|
|
for (i = 0; i <= 16; i++)
|
|
$lineTo(g.context, i * len / 16, 6 * $wnd.Math.sin(i * $intern_1 * 2 / 16));
|
|
g.context.stroke();
|
|
}
|
|
}
|
|
g.context.restore();
|
|
this.curcount_0 = $updateDotCount(this.current_0, this.curcount_0);
|
|
app_0.mouse.dragElm == this || $drawDots(g, this.point1, this.point2, this.curcount_0);
|
|
$drawPosts(this, g);
|
|
}
|
|
;
|
|
_.dumpXml = function dumpXml_35(doc, elem){
|
|
dumpAttr_1(elem, 'x', this.x_0 + ' ' + this.y_0 + ' ' + this.x2 + ' ' + this.y2);
|
|
dumpAttr_0(elem, 'f', this.flags);
|
|
dumpAttr(elem, 're', this.resistance);
|
|
dumpAttr(elem, 'i2', this.i2t);
|
|
dumpAttr(elem, 'he', this.heat);
|
|
dumpAttr_2(elem, 'bl', this.blown);
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_45(){
|
|
return 404;
|
|
}
|
|
;
|
|
_.getEditInfo = function getEditInfo_32(n){
|
|
if (n == 0)
|
|
return $setPositive(new EditInfo_0('I2t', this.i2t, 0, 0));
|
|
if (n == 1)
|
|
return $setPositive(new EditInfo_0('Resistance', this.resistance, 0, 0));
|
|
if (n == 2)
|
|
return createCheckbox('IEC Symbol', (this.flags & 1) != 0);
|
|
return null;
|
|
}
|
|
;
|
|
_.getElmType = function getElmType_9(){
|
|
return 'fuse';
|
|
}
|
|
;
|
|
_.getInfo_0 = function getInfo_38(arr){
|
|
arr[0] = this.blown?'fuse (blown)':'fuse';
|
|
$getBasicInfo(this, arr);
|
|
arr[3] = 'R = ' + getUnitText(this.resistance, ohmString, false);
|
|
arr[4] = 'I2t = ' + this.i2t;
|
|
this.blown || (arr[5] = round_int(this.heat * 100 / this.i2t) + '% ' + LS('melted'));
|
|
}
|
|
;
|
|
_.nonLinear_0 = function nonLinear_8(){
|
|
return true;
|
|
}
|
|
;
|
|
_.reset_0 = function reset_19(){
|
|
$reset(this);
|
|
this.heat = 0;
|
|
this.blown = false;
|
|
}
|
|
;
|
|
_.setEditValue = function setEditValue_32(n, ei){
|
|
n == 0 && (this.i2t = ei.value_0);
|
|
n == 1 && (this.resistance = ei.value_0);
|
|
if (n == 2) {
|
|
this.flags = $changeFlag(ei, this.flags, 1);
|
|
$setPoints_11(this);
|
|
}
|
|
}
|
|
;
|
|
_.setPoints = function setPoints_28(){
|
|
$setPoints_11(this);
|
|
}
|
|
;
|
|
_.stamp = function stamp_29(){
|
|
}
|
|
;
|
|
_.startIteration = function startIteration_6(){
|
|
var i;
|
|
i = this.current_0;
|
|
this.heat += i * i * sim_0.timeStep;
|
|
this.heat -= sim_0.timeStep * this.i2t / 3;
|
|
this.heat < 0 && (this.heat = 0);
|
|
this.heat > this.i2t && (this.blown = true);
|
|
}
|
|
;
|
|
_.undumpXml = function undumpXml_37(xml){
|
|
this.flags = $parseIntAttr(xml, 'f', this.flags);
|
|
this.resistance = $parseDoubleAttr(xml, 're', this.resistance);
|
|
this.i2t = $parseDoubleAttr(xml, 'i2', this.i2t);
|
|
this.heat = $parseDoubleAttr(xml, 'he', this.heat);
|
|
this.blown = $parseBooleanAttr(xml, 'bl', this.blown);
|
|
}
|
|
;
|
|
_.blown = false;
|
|
_.heat = 0;
|
|
_.i2t = 0;
|
|
_.resistance = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_FuseElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'FuseElm', 373);
|
|
function $clipRect(this$static, width_0, height){
|
|
this$static.context.beginPath();
|
|
$rect(this$static.context, 0, 0, width_0, height);
|
|
this$static.context.clip();
|
|
}
|
|
|
|
function $drawLine(this$static, x1, y1, x2, y2){
|
|
this$static.context.beginPath();
|
|
$moveTo(this$static.context, x1, y1);
|
|
$lineTo(this$static.context, x2, y2);
|
|
this$static.context.stroke();
|
|
}
|
|
|
|
function $drawLine_0(this$static, x1, x2){
|
|
this$static.context.beginPath();
|
|
$moveTo(this$static.context, x1.x_0, x1.y_0);
|
|
$lineTo(this$static.context, x2.x_0, x2.y_0);
|
|
this$static.context.stroke();
|
|
}
|
|
|
|
function $drawPolyline(this$static, xpoints, ypoints, n){
|
|
var i;
|
|
this$static.context.beginPath();
|
|
for (i = 0; i < n; i++) {
|
|
i == 0?$moveTo(this$static.context, xpoints[0], ypoints[0]):$lineTo(this$static.context, xpoints[i], ypoints[i]);
|
|
}
|
|
this$static.context.closePath();
|
|
this$static.context.stroke();
|
|
}
|
|
|
|
function $drawRect(this$static, x_0, y_0, width_0, height){
|
|
$strokeRect(this$static.context, x_0, y_0, width_0, height);
|
|
}
|
|
|
|
function $drawString(this$static, s, x_0, y_0){
|
|
$fillText(this$static.context, s, x_0, y_0);
|
|
}
|
|
|
|
function $fillOval(this$static, x_0, y_0, width_0){
|
|
this$static.context.beginPath();
|
|
$arc(this$static.context, x_0 + (width_0 / 2 | 0), y_0 + (width_0 / 2 | 0), width_0 / 2 | 0, 0, 6.28318);
|
|
this$static.context.closePath();
|
|
this$static.context.fill();
|
|
}
|
|
|
|
function $fillPolygon(this$static, p){
|
|
var i;
|
|
this$static.context.beginPath();
|
|
for (i = 0; i < p.npoints; i++) {
|
|
i == 0?$moveTo(this$static.context, p.xpoints[0], p.ypoints[0]):$lineTo(this$static.context, p.xpoints[i], p.ypoints[i]);
|
|
}
|
|
this$static.context.closePath();
|
|
this$static.context.fill();
|
|
}
|
|
|
|
function $fillRect_0(this$static, x_0, y_0, width_0, height){
|
|
$fillRect(this$static.context, x_0, y_0, width_0, height);
|
|
}
|
|
|
|
function $setColor_0(this$static, color_0){
|
|
var colorString;
|
|
if (color_0) {
|
|
colorString = $getHexValue(color_0);
|
|
$setStrokeStyleWeb(this$static.context, colorString);
|
|
$setFillStyleWeb(this$static.context, colorString);
|
|
}
|
|
else {
|
|
$clinit_System();
|
|
}
|
|
}
|
|
|
|
function $setColor_1(this$static, color_0){
|
|
$setStrokeStyleWeb(this$static.context, color_0);
|
|
$setFillStyleWeb(this$static.context, color_0);
|
|
}
|
|
|
|
function $setFont_0(this$static, f){
|
|
if (f) {
|
|
$setFont(this$static.context, f.fontname);
|
|
this$static.currentFontSize = f.size_0;
|
|
}
|
|
}
|
|
|
|
function Graphics(context){
|
|
this.context = context;
|
|
this.currentFontSize = 12;
|
|
}
|
|
|
|
function distanceSq(x1, y1, x2, y2){
|
|
x2 -= x1;
|
|
y2 -= y1;
|
|
return x2 * x2 + y2 * y2;
|
|
}
|
|
|
|
function setLineDash(context, a, b){
|
|
a == 0?context.setLineDash([]):context.setLineDash([a, b]);
|
|
}
|
|
|
|
defineClass(260, 1, {}, Graphics);
|
|
_.currentFontSize = 0;
|
|
_.savedFontSize = 0;
|
|
var isFullScreen = false;
|
|
var Lcom_lushprojects_circuitjs1_client_Graphics_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'Graphics', 260);
|
|
function GroundElm(xx, yy){
|
|
CircuitElm.call(this, xx, yy);
|
|
this.symbolType = lastSymbolType;
|
|
}
|
|
|
|
function GroundElm_0(xa, ya, xb, yb, f, st){
|
|
CircuitElm_0.call(this, xa, ya, xb, yb, f);
|
|
if ($hasMoreTokens(st)) {
|
|
try {
|
|
this.symbolType = __parseAndValidateInt($nextToken(st), 10);
|
|
}
|
|
catch ($e0) {
|
|
$e0 = toJava($e0);
|
|
if (!instanceOf($e0, 13))
|
|
throw toJs($e0);
|
|
}
|
|
}
|
|
}
|
|
|
|
defineClass(160, 8, {8:1, 10:1, 160:1}, GroundElm, GroundElm_0);
|
|
_.addRoutingObstacle = function addRoutingObstacle_9(router){
|
|
var pa, pb;
|
|
$addWire(router, this.point1.x_0, this.point1.y_0, this.point2.x_0, this.point2.y_0);
|
|
pa = new Point_1;
|
|
pb = new Point_1;
|
|
$interpPoint2(this.point1, this.point2, pa, pb, 1 + 11 / this.dn, 10);
|
|
$addObstacle_0(router, stampJavaTypeInfo(getClassLiteralForArray(Lcom_lushprojects_circuitjs1_client_Point_2_classLit, 1), $intern_78, 14, 0, [pa, pb, this.point2]));
|
|
}
|
|
;
|
|
_.draw = function draw_32(g){
|
|
var a, b, i, p, ps3x, ps3y;
|
|
$setColor_0(g, $getVoltageColor(this, 0));
|
|
drawThickLine_0(g, this.point1, this.point2, 3);
|
|
if (this.symbolType == 0) {
|
|
for (i = 0; i != 3; i++) {
|
|
a = 10 - i * 4;
|
|
b = i * 5;
|
|
$interpPoint2(this.point1, this.point2, ps1, ps2, 1 + b / this.dn, a);
|
|
drawThickLine_0(g, ps1, ps2, 3);
|
|
}
|
|
}
|
|
else if (this.symbolType == 1) {
|
|
$interpPoint2(this.point1, this.point2, ps1, ps2, 1, 10);
|
|
drawThickLine_0(g, ps1, ps2, 3);
|
|
for (i = 0; i <= 2; i++) {
|
|
p = $interpPoint(ps1, ps2, i / 2);
|
|
drawThickLine(g, p.x_0, p.y_0, round_int(p.x_0 - 5 * this.dpx1 + 8 * this.dx / this.dn), round_int(p.y_0 + 8 * this.dy / this.dn - 5 * this.dpy1));
|
|
}
|
|
}
|
|
else if (this.symbolType == 2) {
|
|
$interpPoint2(this.point1, this.point2, ps1, ps2, 1, 10);
|
|
drawThickLine_0(g, ps1, ps2, 3);
|
|
ps3x = round_int(this.point2.x_0 + 10 * this.dx / this.dn);
|
|
ps3y = round_int(this.point2.y_0 + 10 * this.dy / this.dn);
|
|
drawThickLine(g, ps1.x_0, ps1.y_0, ps3x, ps3y);
|
|
drawThickLine(g, ps2.x_0, ps2.y_0, ps3x, ps3y);
|
|
}
|
|
else {
|
|
$interpPoint2(this.point1, this.point2, ps1, ps2, 1, 10);
|
|
drawThickLine_0(g, ps1, ps2, 3);
|
|
}
|
|
$interpPoint_1(this.point1, this.point2, ps2, 1 + 11 / this.dn);
|
|
this.curcount_0 = $updateDotCount(this.current_0, this.curcount_0);
|
|
app_0.mouse.dragElm == this || $drawDots(g, this.point1, this.point2, this.curcount_0);
|
|
$setBbox_0(this, this.point1, ps2, 11);
|
|
$drawPosts(this, g);
|
|
}
|
|
;
|
|
_.dumpXml = function dumpXml_36(doc, elem){
|
|
dumpAttr_1(elem, 'x', this.x_0 + ' ' + this.y_0 + ' ' + this.x2 + ' ' + this.y2);
|
|
dumpAttr_0(elem, 'f', this.flags);
|
|
this.symbolType != 0 && dumpAttr_0(elem, 'sy', this.symbolType);
|
|
}
|
|
;
|
|
_.getConnectedPost = function getConnectedPost_2(){
|
|
if (firstGround)
|
|
return firstGround;
|
|
firstGround = this.point1;
|
|
return null;
|
|
}
|
|
;
|
|
_.getCurrentIntoNode = function getCurrentIntoNode_11(n){
|
|
return -this.current_0;
|
|
}
|
|
;
|
|
_.getDragLength = function getDragLength_1(){
|
|
return 32;
|
|
}
|
|
;
|
|
_.getDragVertical = function getDragVertical_3(requestedVertical){
|
|
return true;
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_46(){
|
|
return 103;
|
|
}
|
|
;
|
|
_.getEditInfo = function getEditInfo_33(n){
|
|
var ei;
|
|
if (n == 0) {
|
|
ei = new EditInfo('Symbol', 0);
|
|
ei.choice = new Choice;
|
|
$addItem(ei.choice, LS('Earth'));
|
|
$addItem(ei.choice, LS('Chassis'));
|
|
$addItem(ei.choice, LS('Signal'));
|
|
$addItem(ei.choice, LS('Common'));
|
|
$select(ei.choice, this.symbolType);
|
|
return ei;
|
|
}
|
|
return null;
|
|
}
|
|
;
|
|
_.getInfo_0 = function getInfo_39(arr){
|
|
arr[0] = 'ground';
|
|
arr[1] = 'I = ' + getUnitText(this.current_0, 'A', false);
|
|
}
|
|
;
|
|
_.getPostCount_0 = function getPostCount_33(){
|
|
return 1;
|
|
}
|
|
;
|
|
_.getShortcut = function getShortcut_16(){
|
|
return 103;
|
|
}
|
|
;
|
|
_.getVoltageDiff_0 = function getVoltageDiff_10(){
|
|
return 0;
|
|
}
|
|
;
|
|
_.getVoltageSourceCount = function getVoltageSourceCount_28(){
|
|
return (this.flags & 1) != 0?1:0;
|
|
}
|
|
;
|
|
_.hasGroundConnection = function hasGroundConnection_12(n1){
|
|
return true;
|
|
}
|
|
;
|
|
_.isRemovableWire = function isRemovableWire_5(){
|
|
return true;
|
|
}
|
|
;
|
|
_.isWireEquivalent = function isWireEquivalent_6(){
|
|
return true;
|
|
}
|
|
;
|
|
_.setCurrent = function setCurrent_7(vs, c){
|
|
this.current_0 = (this.flags & 1) != 0?-c:c;
|
|
}
|
|
;
|
|
_.setEditValue = function setEditValue_33(n, ei){
|
|
n == 0 && (lastSymbolType = this.symbolType = $getElement(ei.choice).selectedIndex);
|
|
}
|
|
;
|
|
_.stamp = function stamp_30(){
|
|
(this.flags & 1) != 0 && $stampVoltageSource_0(ground, this.nodes[0], this.voltSource, 0);
|
|
}
|
|
;
|
|
_.undumpXml = function undumpXml_38(xml){
|
|
this.flags = $parseIntAttr(xml, 'f', this.flags);
|
|
this.symbolType = $parseIntAttr(xml, 'sy', 0);
|
|
}
|
|
;
|
|
_.symbolType = 0;
|
|
var firstGround, lastSymbolType = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_GroundElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'GroundElm', 160);
|
|
function $setPoints_12(this$static){
|
|
var cs, cx, cy, i;
|
|
$setPoints(this$static);
|
|
(this$static.flags & 8) != 0?(this$static.point2.x_0 = this$static.point1.x_0):(this$static.point2.y_0 = this$static.point1.y_0);
|
|
this$static.ptEnds = $newPointArray(4);
|
|
this$static.ptStub = $newPointArray(4);
|
|
this$static.ptEnds[0] = this$static.point1;
|
|
this$static.ptEnds[1] = this$static.point2;
|
|
this$static.flip = (this$static.flags & 16) != 0?-1:1;
|
|
$interpPoint_2(this$static.point1, this$static.point2, this$static.ptEnds[2], 0, -this$static.dsign * this$static.width_0 * this$static.flip);
|
|
$interpPoint_2(this$static.point1, this$static.point2, this$static.ptEnds[3], 1, -this$static.dsign * this$static.width_0 * this$static.flip);
|
|
cs = 0.5 - 12 / this$static.dn;
|
|
for (i = 0; i != 4; i += 2) {
|
|
$interpPoint_1(this$static.ptEnds[i], this$static.ptEnds[i + 1], this$static.ptStub[i], cs);
|
|
$interpPoint_1(this$static.ptEnds[i + 1], this$static.ptEnds[i], this$static.ptStub[i + 1], cs);
|
|
}
|
|
this$static.boxTL = this$static.ptStub[0];
|
|
this$static.boxTR = this$static.ptStub[1];
|
|
this$static.boxBL = this$static.ptStub[2];
|
|
this$static.boxBR = this$static.ptStub[3];
|
|
cx = (this$static.boxTL.x_0 + this$static.boxBR.x_0) / 2 | 0;
|
|
cy = (this$static.boxTL.y_0 + this$static.boxBR.y_0) / 2 | 0;
|
|
if ((this$static.flags & 8) != 0) {
|
|
this$static.arrowTail = new Point_2(cx, cy + 6);
|
|
this$static.arrowHead = new Point_2(cx, cy + 14);
|
|
}
|
|
else {
|
|
this$static.arrowTail = new Point_2(cx - 8, cy + 8);
|
|
this$static.arrowHead = new Point_2(cx + 8, cy + 8);
|
|
}
|
|
this$static.arrowPoly = $calcArrow(this$static.arrowTail, this$static.arrowHead, 4, 3);
|
|
}
|
|
|
|
function GyratorElm(xx, yy){
|
|
CircuitElm.call(this, xx, yy);
|
|
this.gyrResistance = $intern_22;
|
|
this.width_0 = 32;
|
|
this.noDiagonal = true;
|
|
this.current = initUnidimensionalArray(D_classLit, $intern_76, 7, 2, 15, 1);
|
|
this.curcount = initUnidimensionalArray(D_classLit, $intern_76, 7, 2, 15, 1);
|
|
}
|
|
|
|
defineClass(926, 8, $intern_85, GyratorElm);
|
|
_.calculateCurrent = function calculateCurrent_14(){
|
|
var g, v1, v2;
|
|
g = 1 / this.gyrResistance;
|
|
v1 = this.volts[0] - this.volts[2];
|
|
v2 = this.volts[1] - this.volts[3];
|
|
this.current[0] = g * v2;
|
|
this.current[1] = -g * v1;
|
|
}
|
|
;
|
|
_.drag = function drag_3(xx, yy){
|
|
xx = $snapGrid_0(app_0, xx);
|
|
yy = $snapGrid_0(app_0, yy);
|
|
abs_0(xx - this.x_0) > abs_0(yy - this.y_0)?(this.flags &= -9):(this.flags |= 8);
|
|
(this.flags & 8) != 0?(this.width_0 = -max_1(32, abs_0(xx - this.x_0))):(this.width_0 = max_1(32, abs_0(yy - this.y_0)));
|
|
xx == this.x_0 && (yy = this.y_0);
|
|
this.x2 = xx;
|
|
this.y2 = yy;
|
|
$setPoints_12(this);
|
|
}
|
|
;
|
|
_.draw = function draw_33(g){
|
|
var cx, cy, i;
|
|
for (i = 0; i != 4; i++) {
|
|
$setVoltageColor(this, g, this.volts[i]);
|
|
drawThickLine_0(g, this.ptEnds[i], this.ptStub[i], 3);
|
|
}
|
|
$setColor_0(g, mouseElmRef == this || this.selected_0 || $containsKey(app_0.mouse.scopePlotRoles, this) || instanceOf(mouseElmRef, 21) && $getElm_0(mouseElmRef.elmScope) == this || $isOnHighlightedNet(this)?selectColor_0:lightGrayColor);
|
|
drawThickLine_0(g, this.boxTL, this.boxTR, 3);
|
|
drawThickLine_0(g, this.boxTR, this.boxBR, 3);
|
|
drawThickLine_0(g, this.boxBR, this.boxBL, 3);
|
|
drawThickLine_0(g, this.boxBL, this.boxTL, 3);
|
|
cx = (this.boxTL.x_0 + this.boxBR.x_0) / 2 | 0;
|
|
cy = (this.boxTL.y_0 + this.boxBR.y_0) / 2 | 0;
|
|
$setFont_0(g, unitsFont);
|
|
$fillText(g.context, '\u03C0', cx - 4, cy - 1);
|
|
$drawLine(g, this.arrowTail.x_0, this.arrowTail.y_0, this.arrowHead.x_0, this.arrowHead.y_0);
|
|
$fillPolygon(g, this.arrowPoly);
|
|
for (i = 0; i != 2; i++) {
|
|
this.curcount[i] = $updateDotCount(this.current[i], this.curcount[i]);
|
|
$drawDots(g, this.ptEnds[i], this.ptStub[i], this.curcount[i]);
|
|
$drawDots(g, this.ptEnds[i + 2], this.ptStub[i + 2], -this.curcount[i]);
|
|
}
|
|
$drawPosts(this, g);
|
|
$setBbox_0(this, this.ptEnds[0], this.ptEnds[3], 0);
|
|
}
|
|
;
|
|
_.flipX = function flipX_7(c2, count){
|
|
(this.flags & 8) != 0 && (this.flags ^= 16);
|
|
$flipX(this, c2);
|
|
}
|
|
;
|
|
_.flipXY = function flipXY_5(xmy, count){
|
|
this.flags ^= 8;
|
|
this.width_0 *= -1;
|
|
$flipXY(this, xmy);
|
|
}
|
|
;
|
|
_.flipY = function flipY_7(c2, count){
|
|
(this.flags & 8) != 0 || (this.flags ^= 16);
|
|
$flipY(this, c2);
|
|
}
|
|
;
|
|
_.getConnection = function getConnection_16(n1, n2){
|
|
if (n1 == 0 && n2 == 2 || n1 == 2 && n2 == 0)
|
|
return true;
|
|
if (n1 == 1 && n2 == 3 || n1 == 3 && n2 == 1)
|
|
return true;
|
|
return false;
|
|
}
|
|
;
|
|
_.getCurrent_0 = function getCurrent_0(){
|
|
return this.current[0];
|
|
}
|
|
;
|
|
_.getCurrentIntoNode = function getCurrentIntoNode_12(n){
|
|
if (n < 2)
|
|
return -this.current[n];
|
|
return this.current[n - 2];
|
|
}
|
|
;
|
|
_.getEditInfo = function getEditInfo_34(n){
|
|
if (n == 0)
|
|
return new EditInfo_0('Gyration Resistance (\u2126)', this.gyrResistance, 1, 0);
|
|
return null;
|
|
}
|
|
;
|
|
_.getInfo_0 = function getInfo_40(arr){
|
|
arr[0] = 'gyrator';
|
|
arr[1] = 'R = ' + getUnitText(this.gyrResistance, '\u2126', false);
|
|
arr[2] = 'Vd1 = ' + getUnitText(this.volts[0] - this.volts[2], 'V', false);
|
|
arr[3] = 'Vd2 = ' + getUnitText(this.volts[1] - this.volts[3], 'V', false);
|
|
arr[4] = 'I1 = ' + getUnitText(this.current[0], 'A', false);
|
|
arr[5] = 'I2 = ' + getUnitText(this.current[1], 'A', false);
|
|
}
|
|
;
|
|
_.getMatrixConnection = function getMatrixConnection_4(n1, n2){
|
|
return true;
|
|
}
|
|
;
|
|
_.getPost = function getPost_9(n){
|
|
return this.ptEnds[n];
|
|
}
|
|
;
|
|
_.getPostCount_0 = function getPostCount_34(){
|
|
return 4;
|
|
}
|
|
;
|
|
_.reset_0 = function reset_20(){
|
|
this.current[0] = this.current[1] = this.volts[0] = this.volts[1] = this.volts[2] = this.volts[3] = 0;
|
|
this.curcount[0] = this.curcount[1] = 0;
|
|
}
|
|
;
|
|
_.setEditValue = function setEditValue_34(n, ei){
|
|
n == 0 && ei.value_0 > 0 && (this.gyrResistance = ei.value_0);
|
|
}
|
|
;
|
|
_.setPoints = function setPoints_29(){
|
|
$setPoints_12(this);
|
|
}
|
|
;
|
|
_.stamp = function stamp_31(){
|
|
var g;
|
|
g = 1 / this.gyrResistance;
|
|
$stampVCCurrentSource(this.nodes[0], this.nodes[2], this.nodes[1], this.nodes[3], g);
|
|
$stampVCCurrentSource(this.nodes[1], this.nodes[3], this.nodes[0], this.nodes[2], -g);
|
|
}
|
|
;
|
|
_.flip = 0;
|
|
_.gyrResistance = 0;
|
|
_.width_0 = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_GyratorElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'GyratorElm', 926);
|
|
function HalfAdderElm(xx, yy){
|
|
$clinit_ChipElm();
|
|
ChipElm.call(this, xx, yy);
|
|
}
|
|
|
|
function HalfAdderElm_0(xa, ya, xb, yb, f, st){
|
|
$clinit_ChipElm();
|
|
ChipElm_0.call(this, xa, ya, xb, yb, f, st);
|
|
}
|
|
|
|
defineClass(380, 32, $intern_85, HalfAdderElm, HalfAdderElm_0);
|
|
_.execute_3 = function execute_25(){
|
|
this.pins[0].value_0 = this.pins[2].value_0 ^ this.pins[3].value_0;
|
|
this.pins[1].value_0 = this.pins[2].value_0 && this.pins[3].value_0;
|
|
}
|
|
;
|
|
_.getChipName = function getChipName_15(){
|
|
return 'Half Adder';
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_47(){
|
|
return 195;
|
|
}
|
|
;
|
|
_.getPostCount_0 = function getPostCount_35(){
|
|
return 4;
|
|
}
|
|
;
|
|
_.getVoltageSourceCount = function getVoltageSourceCount_29(){
|
|
return 2;
|
|
}
|
|
;
|
|
_.setupPins = function setupPins_16(){
|
|
this.sizeX = 2;
|
|
this.sizeY = 2;
|
|
this.pins = initUnidimensionalArray(Lcom_lushprojects_circuitjs1_client_ChipElm$Pin_2_classLit, $intern_3, 9, 4, 0, 1);
|
|
this.pins[0] = new ChipElm$Pin(this, 0, 3, 'S');
|
|
this.pins[0].output = true;
|
|
this.pins[1] = new ChipElm$Pin(this, 1, 3, 'C');
|
|
this.pins[1].output = true;
|
|
this.pins[2] = new ChipElm$Pin(this, 0, 2, 'A');
|
|
this.pins[3] = new ChipElm$Pin(this, 1, 2, 'B');
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_HalfAdderElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'HalfAdderElm', 380);
|
|
function $doExportAsImage(this$static){
|
|
var base64, dataURL;
|
|
if ($wnd.openFile != undefined) {
|
|
dataURL = $toDataUrl($getCircuitAsCanvas(this$static, 1));
|
|
base64 = $substring(dataURL, $indexOf_1(dataURL, fromCodePoint(44)) + 1);
|
|
electronSaveBinaryFile(defaultFileName('.png'), base64);
|
|
return;
|
|
}
|
|
dialogShowing = new ExportAsImageDialog(1);
|
|
dialogShowing.show();
|
|
}
|
|
|
|
function $doExportAsSVG(this$static){
|
|
if (!$initializeSVGScriptIfNecessary(this$static, 'doExportAsSVG')) {
|
|
return;
|
|
}
|
|
if ($wnd.openFile != undefined) {
|
|
electronSaveTextFile(defaultFileName('.svg'), $getCircuitAsSVG(this$static));
|
|
return;
|
|
}
|
|
dialogShowing = new ExportAsImageDialog(2);
|
|
dialogShowing.show();
|
|
}
|
|
|
|
function $doExportAsSVGFromAPI(this$static){
|
|
var svg, hook;
|
|
if (!$initializeSVGScriptIfNecessary(this$static, 'doExportAsSVGFromAPI')) {
|
|
return;
|
|
}
|
|
svg = $getCircuitAsSVG(this$static);
|
|
hook = $wnd.CircuitJS1.onsvgrendered;
|
|
hook && hook($wnd.CircuitJS1, svg);
|
|
}
|
|
|
|
function $drawCircuitInContext(this$static, context, type_0, bounds, w, h){
|
|
var c, ce, ce$iterator, g, i, oldTransform, p, print_0, scale;
|
|
g = new Graphics(context);
|
|
context.setTransform(1, 0, 0, 1, 0, 0);
|
|
oldTransform = copyPrimitiveArray(this$static.sim.transform_0, initUnidimensionalArray(D_classLit, $intern_76, 7, 6, 15, 1));
|
|
scale = 1;
|
|
p = this$static.sim.menus.printableCheckItem.on;
|
|
c = this$static.sim.menus.dotsCheckItem.on;
|
|
print_0 = type_0 == 0;
|
|
print_0 && $setState_1(this$static.sim.menus.printableCheckItem, true);
|
|
if (this$static.sim.menus.printableCheckItem.on) {
|
|
whiteColor = ($clinit_Color() , black);
|
|
lightGrayColor = black;
|
|
$setColor_0(g, white);
|
|
}
|
|
else {
|
|
whiteColor = ($clinit_Color() , white);
|
|
lightGrayColor = lightGray;
|
|
$setColor_0(g, black);
|
|
}
|
|
$fillRect(g.context, 0, 0, w, h);
|
|
$setState_1(this$static.sim.menus.dotsCheckItem, false);
|
|
!!bounds && (scale = $wnd.Math.min(w / (bounds.width_0 + 140), h / (bounds.height_0 + 100)));
|
|
this$static.sim.transform_0[0] = this$static.sim.transform_0[3] = scale;
|
|
this$static.sim.transform_0[4] = -(bounds.x_0 - 70);
|
|
this$static.sim.transform_0[5] = -(bounds.y_0 - 50);
|
|
context.scale(scale, scale);
|
|
$translate(context, this$static.sim.transform_0[4], this$static.sim.transform_0[5]);
|
|
$setLineCap(context, ($clinit_Context2d$LineCap() , ROUND).value_0);
|
|
for (ce$iterator = new ArrayList$1(this$static.sim.elmList.arrayList); ce$iterator.i < ce$iterator.this$01.array.length;) {
|
|
ce = $next_4(ce$iterator);
|
|
ce.draw(g);
|
|
}
|
|
for (i = 0; i != this$static.sim.postDrawList.arrayList.array.length; i++) {
|
|
drawPost(g, $get_4(this$static.sim.postDrawList, i));
|
|
}
|
|
$setState_1(this$static.sim.menus.printableCheckItem, p);
|
|
$setState_1(this$static.sim.menus.dotsCheckItem, c);
|
|
this$static.sim.transform_0 = oldTransform;
|
|
}
|
|
|
|
function $getCircuitAsCanvas(this$static, type_0){
|
|
var bounds, context, cv, h, w;
|
|
cv = createIfSupported();
|
|
bounds = $getCircuitBounds(this$static.sim.ui);
|
|
w = bounds.width_0 * 2 + 140;
|
|
h = bounds.height_0 * 2 + 100;
|
|
$setWidth_0(($clinit_DOM() , cv.element), w);
|
|
$setHeight_0(cv.element, h);
|
|
context = cv.element.getContext('2d');
|
|
$drawCircuitInContext(this$static, context, type_0, bounds, w, h);
|
|
return cv;
|
|
}
|
|
|
|
function $getCircuitAsSVG(this$static){
|
|
var bounds, context, h, w;
|
|
bounds = $getCircuitBounds(this$static.sim.ui);
|
|
w = bounds.width_0 + 140;
|
|
h = bounds.height_0 + 100;
|
|
context = new C2S(w, h);
|
|
$drawCircuitInContext(this$static, context, 2, bounds, w, h);
|
|
return context.getSerializedSvg();
|
|
}
|
|
|
|
function $initializeSVGScriptIfNecessary(this$static, followupAction){
|
|
if (!this$static.loadedCanvas2SVG) {
|
|
$inject($setCallback(($clinit_ScriptInjector() , new ScriptInjector$FromUrl), new ImageExporter$1(this$static, followupAction)));
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
function $printCanvas(cv){
|
|
var img = cv.toDataURL('image/png');
|
|
var style = $doc.createElement('style');
|
|
style.id = 'circuit-print-style';
|
|
style.innerHTML = '@media print { body > *:not(#circuit-print-overlay) { display: none !important; } } #circuit-print-overlay { display: none; } @media print { @page { size: auto; margin: 10mm; } #circuit-print-overlay { display: block !important; width: 100%; height: 100%; } #circuit-print-overlay img { max-width: 100%; max-height: 100%; width: auto; height: auto; display: block; margin: 0 auto; page-break-inside: avoid; } }';
|
|
$doc.head.appendChild(style);
|
|
var overlay = $doc.createElement('div');
|
|
overlay.id = 'circuit-print-overlay';
|
|
var imgEl = $doc.createElement('img');
|
|
imgEl.src = img;
|
|
overlay.appendChild(imgEl);
|
|
$doc.body.appendChild(overlay);
|
|
setTimeout(function(){
|
|
$wnd.print();
|
|
$doc.body.removeChild(overlay);
|
|
$doc.head.removeChild(style);
|
|
}
|
|
, 500);
|
|
}
|
|
|
|
function ImageExporter(sim){
|
|
this.sim = sim;
|
|
}
|
|
|
|
function clipboardWriteImage(cv){
|
|
cv.toBlob(function(blob){
|
|
var promise = parent.navigator.clipboard.write([new ClipboardItem({'image/png':blob})]);
|
|
promise.then(function(x_0){
|
|
console.log(x_0);
|
|
}
|
|
);
|
|
}
|
|
);
|
|
}
|
|
|
|
function defaultFileName(ext){
|
|
var date, dtf;
|
|
date = new Date_0;
|
|
dtf = ($clinit_DateTimeFormat_0() , getFormat('yyyyMMdd-HHmm', $getDateTimeFormatInfo(($clinit_LocaleInfo() , $clinit_LocaleInfo() , instance_0))));
|
|
return 'circuit-' + $format(dtf, date, null) + ext;
|
|
}
|
|
|
|
function electronSaveBinaryFile(defaultName, base64Data){
|
|
$wnd.showSaveDialog(defaultName).then(function(file){
|
|
if (file.canceled)
|
|
return;
|
|
$wnd.saveFile(file, base64Data, 'base64');
|
|
}
|
|
);
|
|
}
|
|
|
|
function electronSaveTextFile(defaultName, data_0){
|
|
$wnd.showSaveDialog(defaultName).then(function(file){
|
|
if (file.canceled)
|
|
return;
|
|
$wnd.saveFile(file, data_0, 'utf8');
|
|
}
|
|
);
|
|
}
|
|
|
|
defineClass(538, 1, {}, ImageExporter);
|
|
_.loadedCanvas2SVG = false;
|
|
var Lcom_lushprojects_circuitjs1_client_ImageExporter_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ImageExporter', 538);
|
|
function $onSuccess(this$static){
|
|
this$static.this$01.loadedCanvas2SVG = true;
|
|
$equals_1(this$static.val$followupAction2, 'doExportAsSVG')?$doExportAsSVG(this$static.this$01):$equals_1(this$static.val$followupAction2, 'doExportAsSVGFromAPI') && $doExportAsSVGFromAPI(this$static.this$01);
|
|
}
|
|
|
|
function ImageExporter$1(this$0, val$followupAction){
|
|
this.this$01 = this$0;
|
|
this.val$followupAction2 = val$followupAction;
|
|
}
|
|
|
|
defineClass(539, 1, {}, ImageExporter$1);
|
|
_.onFailure = function onFailure(reason){
|
|
$wnd.alert("Can't load canvas2svg.js.");
|
|
}
|
|
;
|
|
_.onSuccess = function onSuccess(result){
|
|
var lastArg;
|
|
$onSuccess((lastArg = this , result , lastArg));
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_ImageExporter$1_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ImageExporter/1', 539);
|
|
function $doDropboxImport(){
|
|
var options = {success:function(files){
|
|
function reqListener(){
|
|
var text_0 = xhr.responseText;
|
|
$pushUndo(sim_1.undoManager);
|
|
$readCircuit(sim_1, text_0);
|
|
}
|
|
|
|
try {
|
|
if (files[0].bytes < $intern_120) {
|
|
var xhr = new XMLHttpRequest;
|
|
xhr.addEventListener('load', reqListener);
|
|
}
|
|
xhr.open('GET', files[0].link, false);
|
|
xhr.send();
|
|
}
|
|
catch (err) {
|
|
}
|
|
}
|
|
, linkType:'direct', multiselect:false};
|
|
$wnd.Dropbox.choose(options);
|
|
}
|
|
|
|
function ImportFromDropbox(asim){
|
|
sim_1 = asim;
|
|
$doDropboxImport();
|
|
}
|
|
|
|
function isSupported_0(){
|
|
try {
|
|
if (/Firefox[\/\s](\d+\.\d+)/.test(navigator.userAgent))
|
|
return false;
|
|
return !!$wnd.Dropbox.isBrowserSupported();
|
|
}
|
|
catch (err) {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
defineClass(717, 1, {}, ImportFromDropbox);
|
|
var sim_1;
|
|
var Lcom_lushprojects_circuitjs1_client_ImportFromDropbox_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ImportFromDropbox', 717);
|
|
function ImportFromDropboxDialog(csim){
|
|
Dialog.call(this);
|
|
sim_2 = csim;
|
|
this.closeOnEnter = false;
|
|
this.vp = new VerticalPanel;
|
|
$setWidget_1(this, this.vp);
|
|
$setText(this, LS('Import from Dropbox'));
|
|
if (isSupported_0()) {
|
|
$add_5(this.vp, new Label_1(LS('To open a file in your dropbox account using the chooser click below.')));
|
|
this.chooserButton = new Button_1(LS('Open Dropbox Chooser'));
|
|
$add_5(this.vp, this.chooserButton);
|
|
$addDomHandler(this.chooserButton, new ImportFromDropboxDialog$1(this), ($clinit_ClickEvent() , $clinit_ClickEvent() , TYPE_1));
|
|
this.la = new Label_1(LS('To open a shared Dropbox file from a Dropbox link paste the link below...'));
|
|
}
|
|
else {
|
|
$add_5(this.vp, new Label_1("This site, or your browser doesn't support the Dropbox chooser so you can't pick a file from your dropbox account."));
|
|
this.la = new Label_1('You can open a shared Dropbox file if you have a link. Paste the Dropbox link below...');
|
|
$setStyleName(this.la, 'topSpace');
|
|
}
|
|
$add_5(this.vp, this.la);
|
|
this.ta = new TextArea_0;
|
|
$setWidth(this.ta, '300px');
|
|
$setHeight(this.ta, '200px');
|
|
$add_5(this.vp, this.ta);
|
|
this.hp = new HorizontalPanel;
|
|
$setWidth(this.hp, '100%');
|
|
$add_5(this.vp, this.hp);
|
|
$setHorizontalAlignment_0(this.hp, ($clinit_HasHorizontalAlignment() , ALIGN_LEFT));
|
|
this.importButton = new Button_1(LS('Import From Dropbox Link'));
|
|
$addDomHandler(this.importButton, new ImportFromDropboxDialog$2(this), ($clinit_ClickEvent() , $clinit_ClickEvent() , TYPE_1));
|
|
$add_3(this.hp, this.importButton);
|
|
$setHorizontalAlignment_0(this.hp, ALIGN_RIGHT);
|
|
this.cancelButton = new Button_1(LS('Cancel'));
|
|
$add_3(this.hp, this.cancelButton);
|
|
$addDomHandler(this.cancelButton, new ImportFromDropboxDialog$3(this), (null , TYPE_1));
|
|
$center(this);
|
|
}
|
|
|
|
function doDropboxImport(link_0){
|
|
function reqListener(){
|
|
var text_0 = xhr.responseText;
|
|
$pushUndo(sim_2.undoManager);
|
|
$readCircuit(sim_2, text_0);
|
|
$allowSave(sim_2.ui, false);
|
|
}
|
|
|
|
try {
|
|
var xhr = new XMLHttpRequest;
|
|
xhr.addEventListener('load', reqListener);
|
|
xhr.open('GET', link_0, false);
|
|
xhr.send();
|
|
}
|
|
catch (err) {
|
|
}
|
|
}
|
|
|
|
function doImportDropboxLink(link_0, validateIsDropbox){
|
|
if ((checkCriticalNotNull(validateIsDropbox) , validateIsDropbox) && link_0.indexOf('https://www.dropbox.com/') != 0) {
|
|
$wnd.alert('Dropbox links must start https://www.dropbox.com/');
|
|
return;
|
|
}
|
|
link_0 = $replace_0(link_0, 'www.dropbox.com', 'dl.dropboxusercontent.com');
|
|
doDropboxImport(link_0);
|
|
}
|
|
|
|
defineClass(559, 140, $intern_58, ImportFromDropboxDialog);
|
|
var sim_2;
|
|
var Lcom_lushprojects_circuitjs1_client_ImportFromDropboxDialog_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ImportFromDropboxDialog', 559);
|
|
function ImportFromDropboxDialog$1(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(560, 1, $intern_56, ImportFromDropboxDialog$1);
|
|
_.onClick = function onClick_24(event_0){
|
|
$closeDialog(this.this$01);
|
|
new ImportFromDropbox(sim_2);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_ImportFromDropboxDialog$1_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ImportFromDropboxDialog/1', 560);
|
|
function ImportFromDropboxDialog$2(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(561, 1, $intern_56, ImportFromDropboxDialog$2);
|
|
_.onClick = function onClick_25(event_0){
|
|
$closeDialog(this.this$01);
|
|
doImportDropboxLink($getText(this.this$01.ta), ($clinit_Boolean() , true));
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_ImportFromDropboxDialog$2_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ImportFromDropboxDialog/2', 561);
|
|
function ImportFromDropboxDialog$3(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(562, 1, $intern_56, ImportFromDropboxDialog$3);
|
|
_.onClick = function onClick_26(event_0){
|
|
$closeDialog(this.this$01);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_ImportFromDropboxDialog$3_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ImportFromDropboxDialog/3', 562);
|
|
function ImportFromTextDialog(asim){
|
|
var cancelButton, okButton, subCheck;
|
|
Dialog.call(this);
|
|
this.sim = asim;
|
|
this.closeOnEnter = false;
|
|
this.vp = new VerticalPanel;
|
|
$setWidget_1(this, this.vp);
|
|
$setText(this, LS('Import from Text'));
|
|
$add_5(this.vp, new Label_1(LS('Paste the text file for your circuit here...')));
|
|
$add_5(this.vp, this.textArea = new TextArea_0);
|
|
$setWidth(this.textArea, '300px');
|
|
$setHeight(this.textArea, '200px');
|
|
$add_5(this.vp, subCheck = new Checkbox(LS('Load Subcircuits Only')));
|
|
this.hp = new HorizontalPanel;
|
|
$add_5(this.vp, this.hp);
|
|
$add_3(this.hp, okButton = new Button_1(LS('OK')));
|
|
$addDomHandler(okButton, new ImportFromTextDialog$1(this, subCheck), ($clinit_ClickEvent() , $clinit_ClickEvent() , TYPE_1));
|
|
$add_3(this.hp, cancelButton = new Button_1(LS('Cancel')));
|
|
$addDomHandler(cancelButton, new ImportFromTextDialog$2(this), (null , TYPE_1));
|
|
$center(this);
|
|
!this.resizeHandlerRegistration && (this.resizeHandlerRegistration = addResizeHandler(new DialogBox$1(this)));
|
|
$show(this);
|
|
}
|
|
|
|
defineClass(686, 140, $intern_58, ImportFromTextDialog);
|
|
var Lcom_lushprojects_circuitjs1_client_ImportFromTextDialog_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ImportFromTextDialog', 686);
|
|
function ImportFromTextDialog$1(this$0, val$subCheck){
|
|
this.this$01 = this$0;
|
|
this.val$subCheck2 = val$subCheck;
|
|
}
|
|
|
|
defineClass(687, 1, $intern_56, ImportFromTextDialog$1);
|
|
_.onClick = function onClick_27(event_0){
|
|
var s;
|
|
$pushUndo(this.this$01.sim.undoManager);
|
|
$closeDialog(this.this$01);
|
|
s = $getText(this.this$01.textArea);
|
|
$importCircuitFromText(this.this$01.sim, s, $getState(this.val$subCheck2));
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_ImportFromTextDialog$1_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ImportFromTextDialog/1', 687);
|
|
function ImportFromTextDialog$2(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(688, 1, $intern_56, ImportFromTextDialog$2);
|
|
_.onClick = function onClick_28(event_0){
|
|
$closeDialog(this.this$01);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_ImportFromTextDialog$2_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ImportFromTextDialog/2', 688);
|
|
function $calcEffectiveInductance(this$static, i){
|
|
var ratio;
|
|
if (this$static.saturationCurrent <= 0)
|
|
return this$static.inductance;
|
|
ratio = i / this$static.saturationCurrent;
|
|
return this$static.inductance / (1 + ratio * ratio);
|
|
}
|
|
|
|
function $calculateCurrent_1(this$static, voltdiff){
|
|
this$static.compResistance > 0 && (this$static.current = voltdiff / this$static.compResistance + this$static.curSourceValue);
|
|
return this$static.current;
|
|
}
|
|
|
|
function $doStep_1(this$static){
|
|
this$static.saturationCurrent > 0 && $stampConductance(this$static.nodes[0], this$static.nodes[1], 1 / this$static.compResistance);
|
|
$stampCurrentSource(this$static.nodes[0], this$static.nodes[1], this$static.curSourceValue);
|
|
}
|
|
|
|
function $reset_5(this$static){
|
|
this$static.curSourceValue = this$static.current = 0;
|
|
}
|
|
|
|
function $resetTo(this$static, c){
|
|
this$static.curSourceValue = this$static.current = c;
|
|
}
|
|
|
|
function $setup_1(this$static, ic, cr, f){
|
|
this$static.inductance = ic;
|
|
this$static.current = cr;
|
|
this$static.flags = f;
|
|
}
|
|
|
|
function $setup_2(this$static, ic, cr, f, isat){
|
|
$setup_1(this$static, ic, cr, f);
|
|
this$static.saturationCurrent = isat;
|
|
}
|
|
|
|
function $stamp_2(this$static, n0, n1){
|
|
this$static.nodes[0] = n0;
|
|
this$static.nodes[1] = n1;
|
|
if (this$static.saturationCurrent > 0)
|
|
;
|
|
else {
|
|
(this$static.flags & 2) == 0?(this$static.compResistance = 2 * this$static.inductance / this$static.sim.timeStep):(this$static.compResistance = this$static.inductance / this$static.sim.timeStep);
|
|
$stampResistor(this$static.nodes[0], this$static.nodes[1], this$static.compResistance);
|
|
}
|
|
}
|
|
|
|
function $startIteration_0(this$static, voltdiff){
|
|
var lEff;
|
|
if (this$static.saturationCurrent > 0) {
|
|
lEff = $calcEffectiveInductance(this$static, this$static.current);
|
|
(this$static.flags & 2) == 0?(this$static.compResistance = 2 * lEff / this$static.sim.timeStep):(this$static.compResistance = lEff / this$static.sim.timeStep);
|
|
}
|
|
(this$static.flags & 2) == 0?(this$static.curSourceValue = voltdiff / this$static.compResistance + this$static.current):(this$static.curSourceValue = this$static.current);
|
|
}
|
|
|
|
function Inductor(s){
|
|
this.sim = s;
|
|
this.nodes = initUnidimensionalArray(Lcom_lushprojects_circuitjs1_client_CircuitNode_2_classLit, $intern_3, 175, 2, 0, 1);
|
|
}
|
|
|
|
defineClass(145, 1, {}, Inductor);
|
|
_.compResistance = 0;
|
|
_.curSourceValue = 0;
|
|
_.current = 0;
|
|
_.flags = 0;
|
|
_.inductance = 0;
|
|
_.saturationCurrent = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_Inductor_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'Inductor', 145);
|
|
function $reset_6(this$static){
|
|
this$static.volts[0] = this$static.volts[1] = this$static.curcount_0 = 0;
|
|
this$static.current_0 = this$static.initialCurrent;
|
|
$resetTo(this$static.ind, this$static.initialCurrent);
|
|
}
|
|
|
|
function $setInductance(this$static, l_0){
|
|
this$static.inductance = l_0;
|
|
$setup_2(this$static.ind, this$static.inductance, this$static.current_0, this$static.flags, this$static.saturationCurrent);
|
|
}
|
|
|
|
function InductorElm(xx, yy){
|
|
CircuitElm.call(this, xx, yy);
|
|
this.ind = new Inductor(sim_0);
|
|
this.inductance = 1;
|
|
$setup_2(this.ind, this.inductance, this.current_0, this.flags, this.saturationCurrent);
|
|
}
|
|
|
|
function InductorElm_0(xa, ya, xb, yb, f, st){
|
|
CircuitElm_0.call(this, xa, ya, xb, yb, f);
|
|
this.ind = new Inductor(sim_0);
|
|
this.inductance = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.current_0 = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
try {
|
|
this.initialCurrent = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.saturationCurrent = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
}
|
|
catch ($e0) {
|
|
$e0 = toJava($e0);
|
|
if (!instanceOf($e0, 13))
|
|
throw toJs($e0);
|
|
}
|
|
$setup_2(this.ind, this.inductance, this.current_0, this.flags, this.saturationCurrent);
|
|
}
|
|
|
|
defineClass(194, 8, {8:1, 10:1, 194:1}, InductorElm, InductorElm_0);
|
|
_.calculateCurrent = function calculateCurrent_15(){
|
|
var voltdiff;
|
|
voltdiff = this.volts[0] - this.volts[1];
|
|
this.current_0 = $calculateCurrent_1(this.ind, voltdiff);
|
|
}
|
|
;
|
|
_.doStep = function doStep_24(){
|
|
$doStep_1(this.ind);
|
|
}
|
|
;
|
|
_.draw = function draw_34(g){
|
|
var s, v1, v2;
|
|
v1 = this.volts[0];
|
|
v2 = this.volts[1];
|
|
$setBbox_0(this, this.point1, this.point2, 8);
|
|
$draw2Leads(this, g);
|
|
$setPowerColor_0(this, g);
|
|
$drawCoil(this, g, 8, this.lead1, this.lead2, v1, v2);
|
|
if (app_0.menus.showValuesCheckItem.on) {
|
|
s = getUnitText(this.inductance, 'H', true);
|
|
$drawValues(this, g, s, 8);
|
|
}
|
|
this.curcount_0 = $updateDotCount(this.current_0, this.curcount_0);
|
|
app_0.mouse.dragElm == this || $drawDots(g, this.point1, this.point2, this.curcount_0);
|
|
$drawPosts(this, g);
|
|
}
|
|
;
|
|
_.dumpXml = function dumpXml_37(doc, elem){
|
|
dumpAttr_1(elem, 'x', this.x_0 + ' ' + this.y_0 + ' ' + this.x2 + ' ' + this.y2);
|
|
dumpAttr_0(elem, 'f', this.flags);
|
|
dumpAttr(elem, 'l', this.inductance);
|
|
dumpAttr(elem, 'ic', this.initialCurrent);
|
|
this.saturationCurrent != 0 && dumpAttr(elem, 'isat', this.saturationCurrent);
|
|
}
|
|
;
|
|
_.dumpXmlState = function dumpXmlState_7(doc, elem){
|
|
dumpAttr(elem, 'i', this.current_0);
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_48(){
|
|
return 108;
|
|
}
|
|
;
|
|
_.getEditInfo = function getEditInfo_35(n){
|
|
var ei;
|
|
if (n == 0)
|
|
return $setPositive(new EditInfo_0('Inductance (H)', this.inductance, $intern_34, 10));
|
|
if (n == 1) {
|
|
ei = new EditInfo_0('', 0, -1, -1);
|
|
ei.checkbox = new Checkbox_0('Trapezoidal Approximation', (this.ind.flags & 2) == 0);
|
|
return ei;
|
|
}
|
|
if (n == 2)
|
|
return new EditInfo('Initial Current (on Reset) (A)', this.initialCurrent);
|
|
if (n == 3)
|
|
return new EditInfo('Saturation Current (A) (0=none)', this.saturationCurrent);
|
|
return null;
|
|
}
|
|
;
|
|
_.getInfo_0 = function getInfo_41(arr){
|
|
var lEff;
|
|
arr[0] = this.saturationCurrent > 0?'inductor (sat)':'inductor';
|
|
arr[1] = 'I = ' + getUnitText($wnd.Math.abs(this.current_0), 'A', false);
|
|
arr[2] = 'Vd = ' + getUnitText($wnd.Math.abs(this.volts[0] - this.volts[1]), 'V', false);
|
|
arr[3] = 'L = ' + getUnitText(this.inductance, 'H', false);
|
|
arr[4] = 'P = ' + getUnitText((this.volts[0] - this.volts[1]) * this.current_0, 'W', false);
|
|
if (this.saturationCurrent > 0) {
|
|
lEff = $calcEffectiveInductance(this.ind, this.current_0);
|
|
arr[5] = 'Leff = ' + getUnitText(lEff, 'H', false);
|
|
arr[6] = 'Isat = ' + getUnitText(this.saturationCurrent, 'A', false);
|
|
}
|
|
}
|
|
;
|
|
_.getScopeText = function getScopeText_1(v){
|
|
return LS('inductor') + ', ' + getUnitText(this.inductance, 'H', false);
|
|
}
|
|
;
|
|
_.getShortcut = function getShortcut_17(){
|
|
return 76;
|
|
}
|
|
;
|
|
_.nonLinear_0 = function nonLinear_9(){
|
|
return this.ind.saturationCurrent > 0;
|
|
}
|
|
;
|
|
_.reset_0 = function reset_21(){
|
|
$reset_6(this);
|
|
}
|
|
;
|
|
_.setEditValue = function setEditValue_35(n, ei){
|
|
n == 0 && (this.inductance = ei.value_0);
|
|
n == 1 && ($getState(ei.checkbox)?(this.flags &= -3):(this.flags |= 2));
|
|
n == 2 && (this.initialCurrent = ei.value_0);
|
|
n == 3 && (ei.value_0 >= 0?(this.saturationCurrent = ei.value_0):(ei.error = 'must be >= 0'));
|
|
$setup_2(this.ind, this.inductance, this.current_0, this.flags, this.saturationCurrent);
|
|
}
|
|
;
|
|
_.setPoints = function setPoints_30(){
|
|
$setPoints(this);
|
|
$calcLeads(this, 32);
|
|
}
|
|
;
|
|
_.stamp = function stamp_32(){
|
|
$stamp_2(this.ind, this.nodes[0], this.nodes[1]);
|
|
}
|
|
;
|
|
_.startIteration = function startIteration_7(){
|
|
$startIteration_0(this.ind, this.volts[0] - this.volts[1]);
|
|
}
|
|
;
|
|
_.undumpXml = function undumpXml_39(xml){
|
|
this.flags = $parseIntAttr(xml, 'f', this.flags);
|
|
this.inductance = $parseDoubleAttr(xml, 'l', this.inductance);
|
|
this.initialCurrent = $parseDoubleAttr(xml, 'ic', this.initialCurrent);
|
|
this.current_0 = $parseDoubleAttr(xml, 'i', this.current_0);
|
|
this.saturationCurrent = $parseDoubleAttr(xml, 'isat', this.saturationCurrent);
|
|
$setup_2(this.ind, this.inductance, this.current_0, this.flags, this.saturationCurrent);
|
|
}
|
|
;
|
|
_.validate = function validate_11(){
|
|
var fpi;
|
|
fpi = new FindPathInfo(1, this, this.nodes[1], sim_0);
|
|
$findPath(fpi, this.nodes[0]) || $reset_6(this);
|
|
return true;
|
|
}
|
|
;
|
|
_.inductance = 0;
|
|
_.initialCurrent = 0;
|
|
_.saturationCurrent = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_InductorElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'InductorElm', 194);
|
|
function $getDisplayText(this$static){
|
|
var entry, i, value_0;
|
|
value_0 = $readInputValue(this$static);
|
|
for (i = 0; i != this$static.entries_0.arrayList.array.length; i++) {
|
|
entry = $get_4(this$static.entries_0, i);
|
|
if (value_0 >= entry.lo && value_0 <= entry.hi)
|
|
return $getText_0(entry, value_0);
|
|
}
|
|
return '' + value_0;
|
|
}
|
|
|
|
function $parseEntries(this$static, ei){
|
|
var dash, eq, hi, i, k, key, line, lines, lo, val, start_0;
|
|
this$static.entries_0 = new Vector;
|
|
if (this$static.lookupText == null || this$static.lookupText.length == 0)
|
|
return;
|
|
lines = $split_1(this$static.lookupText, '\n', 0);
|
|
for (i = 0; i != lines.length; i++) {
|
|
line = $trim(lines[i]);
|
|
if (line.length == 0)
|
|
continue;
|
|
eq = $indexOf_1(line, fromCodePoint(61));
|
|
if (eq < 0) {
|
|
!!ei && (ei.error = 'missing =: ' + line);
|
|
continue;
|
|
}
|
|
key = $trim(line.substr(0, eq));
|
|
val = line.substr(eq + 1);
|
|
try {
|
|
dash = (start_0 = 0 , $equals_1(key.substr(0, 2), '0x') || $equals_1(key.substr(0, 2), '0X')?(start_0 = 2):($equals_1(key.substr(0, 2), '0b') || $equals_1(key.substr(0, 2), '0B')) && (start_0 = 2) , $indexOf_2(key, fromCodePoint(45), start_0));
|
|
if (dash >= 0) {
|
|
lo = $parseNumber_0(key.substr(0, dash));
|
|
hi = $parseNumber_0(key.substr(dash + 1));
|
|
$add_11(this$static.entries_0, new InstructionDisplayElm$LookupEntry(lo, hi, val));
|
|
}
|
|
else {
|
|
k = $parseNumber_0(key);
|
|
$add_11(this$static.entries_0, new InstructionDisplayElm$LookupEntry(k, k, val));
|
|
}
|
|
}
|
|
catch ($e0) {
|
|
$e0 = toJava($e0);
|
|
if (!instanceOf($e0, 13))
|
|
throw toJs($e0);
|
|
}
|
|
}
|
|
}
|
|
|
|
function $parseNumber_0(s){
|
|
s = $trim(s);
|
|
if ($equals_1(s.substr(0, 2), '0x') || $equals_1(s.substr(0, 2), '0X'))
|
|
return __parseAndValidateInt(s.substr(2), 16);
|
|
if ($equals_1(s.substr(0, 2), '0b') || $equals_1(s.substr(0, 2), '0B'))
|
|
return __parseAndValidateInt(s.substr(2), 2);
|
|
return __parseAndValidateInt(s, 10);
|
|
}
|
|
|
|
function $readInputValue(this$static){
|
|
var i, value_0;
|
|
value_0 = 0;
|
|
for (i = 0; i != this$static.busWidth; i++)
|
|
this$static.volts[i] > this$static.threshold && (value_0 |= 1 << i);
|
|
return value_0;
|
|
}
|
|
|
|
function InstructionDisplayElm(xx, yy){
|
|
CircuitElm.call(this, xx, yy);
|
|
this.busWidth = 4;
|
|
this.threshold = 2.5;
|
|
this.entries_0 = new Vector;
|
|
this.lookupText = '0=text0\n1=text1\n0x2-0xF=other ({a})\n';
|
|
$parseEntries(this, null);
|
|
}
|
|
|
|
defineClass(923, 8, $intern_85, InstructionDisplayElm);
|
|
_.addRoutingObstacle = function addRoutingObstacle_10(router){
|
|
$addWire(router, this.point1.x_0, this.point1.y_0, this.x2, this.y2);
|
|
$addObstacle(router, this.x2 - 10, this.y2 - 10, this.x2 + 10, this.y2 + 10);
|
|
}
|
|
;
|
|
_.draw = function draw_35(g){
|
|
var f, s, selected;
|
|
g.context.save();
|
|
g.savedFontSize = g.currentFontSize;
|
|
selected = mouseElmRef == this || this.selected_0 || $containsKey(app_0.mouse.scopePlotRoles, this) || instanceOf(mouseElmRef, 21) && $getElm_0(mouseElmRef.elmScope) == this || $isOnHighlightedNet(this);
|
|
f = new Font('SansSerif', selected?1:0, 14);
|
|
$setFont_0(g, f);
|
|
$setColor_0(g, selected?selectColor_0:lightGrayColor);
|
|
s = $getDisplayText(this);
|
|
$interpPoint_1(this.point1, this.point2, this.lead1, 1 - ((round_int($measureText(g.context, s).width) / 2 | 0) + 8) / this.dn);
|
|
$setBbox_0(this, this.point1, this.lead1, 0);
|
|
$drawCenteredText(this, g, s, this.x2, this.y2, true);
|
|
$setVoltageColor(this, g, this.volts[0]);
|
|
selected && $setColor_0(g, selectColor_0);
|
|
drawThickLine_0(g, this.point1, this.lead1, 5);
|
|
$drawPosts(this, g);
|
|
g.context.restore();
|
|
g.currentFontSize = g.savedFontSize;
|
|
}
|
|
;
|
|
_.dumpXml = function dumpXml_38(doc, elem){
|
|
dumpAttr_1(elem, 'x', this.x_0 + ' ' + this.y_0 + ' ' + this.x2 + ' ' + this.y2);
|
|
dumpAttr_0(elem, 'f', this.flags);
|
|
dumpAttr_0(elem, 'bw', this.busWidth);
|
|
this.threshold != 2.5 && dumpAttr(elem, 'th', this.threshold);
|
|
this.lookupText != null && this.lookupText.length > 0 && $appendChild_0(elem, $createTextNode(doc, this.lookupText));
|
|
}
|
|
;
|
|
_.getConnection = function getConnection_17(n1, n2){
|
|
return false;
|
|
}
|
|
;
|
|
_.getEditInfo = function getEditInfo_36(n){
|
|
var ei;
|
|
if (n == 0)
|
|
return $setDimensionless(new EditInfo_0('Bus Width', this.busWidth, 2, 32));
|
|
if (n == 1)
|
|
return new EditInfo('Threshold Voltage', this.threshold);
|
|
if (n == 2) {
|
|
ei = new EditInfo('Lookup Table', 0);
|
|
ei.textArea = new TextArea_0;
|
|
$setVisibleLines(ei.textArea, 10);
|
|
$setText_2(ei.textArea, this.lookupText);
|
|
return ei;
|
|
}
|
|
return null;
|
|
}
|
|
;
|
|
_.getInfo_0 = function getInfo_42(arr){
|
|
var value_0, number;
|
|
arr[0] = 'instruction display';
|
|
value_0 = $readInputValue(this);
|
|
arr[1] = 'in = ' + value_0 + ' (0x' + (number = value_0 >>> 0 , number.toString(16)).toUpperCase() + ')';
|
|
arr[2] = 'text = ' + $getDisplayText(this);
|
|
}
|
|
;
|
|
_.getNumHandles = function getNumHandles_3(){
|
|
return 1;
|
|
}
|
|
;
|
|
_.getPost = function getPost_10(n){
|
|
return new Point_3(this.x_0, this.y_0, n);
|
|
}
|
|
;
|
|
_.getPostCount_0 = function getPostCount_36(){
|
|
return this.busWidth;
|
|
}
|
|
;
|
|
_.getPostWidth = function getPostWidth_3(n){
|
|
return this.busWidth;
|
|
}
|
|
;
|
|
_.getVoltageDiff_0 = function getVoltageDiff_11(){
|
|
return this.volts[0];
|
|
}
|
|
;
|
|
_.getVoltageSourceCount = function getVoltageSourceCount_30(){
|
|
return 0;
|
|
}
|
|
;
|
|
_.getXmlDumpType = function getXmlDumpType_16(){
|
|
return 'ins';
|
|
}
|
|
;
|
|
_.setEditValue = function setEditValue_36(n, ei){
|
|
if (n == 0) {
|
|
if (ei.value_0 >= 1 && ei.value_0 <= 32) {
|
|
this.busWidth = round_int(ei.value_0);
|
|
$allocNodes(this);
|
|
}
|
|
else
|
|
ei.error = 'must be between 1 and 32';
|
|
}
|
|
n == 1 && (this.threshold = ei.value_0);
|
|
if (n == 2) {
|
|
this.lookupText = $getText(ei.textArea);
|
|
$parseEntries(this, ei);
|
|
}
|
|
}
|
|
;
|
|
_.setPoints = function setPoints_31(){
|
|
$setPoints(this);
|
|
this.lead1 = new Point_1;
|
|
}
|
|
;
|
|
_.undumpXml = function undumpXml_40(xml){
|
|
var e;
|
|
this.flags = $parseIntAttr(xml, 'f', this.flags);
|
|
this.busWidth = $parseIntAttr(xml, 'bw', this.busWidth);
|
|
this.threshold = $parseDoubleAttr(xml, 'th', this.threshold);
|
|
this.lookupText = '';
|
|
try {
|
|
this.lookupText = $parseContents(xml);
|
|
}
|
|
catch ($e0) {
|
|
$e0 = toJava($e0);
|
|
if (instanceOf($e0, 13)) {
|
|
e = $e0;
|
|
console.log('exception in undump ' + e);
|
|
}
|
|
else
|
|
throw toJs($e0);
|
|
}
|
|
console_0('lookupText: ' + this.lookupText);
|
|
this.lookupText == null && (this.lookupText = '');
|
|
$parseEntries(this, null);
|
|
}
|
|
;
|
|
_.busWidth = 0;
|
|
_.threshold = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_InstructionDisplayElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'InstructionDisplayElm', 923);
|
|
function $getText_0(this$static, value_0){
|
|
var close_0, ep, es, expr, exprStr, intResult, open_0, pos, result, sb;
|
|
sb = new StringBuilder;
|
|
pos = 0;
|
|
while (pos < this$static.template.length) {
|
|
open_0 = $indexOf_0(this$static.template, 123, pos);
|
|
if (open_0 < 0) {
|
|
$append_4(sb, $substring(this$static.template, pos));
|
|
break;
|
|
}
|
|
$append_4(sb, $substring_0(this$static.template, pos, open_0));
|
|
close_0 = $indexOf_0(this$static.template, 125, open_0);
|
|
if (close_0 < 0) {
|
|
$append_4(sb, $substring(this$static.template, open_0));
|
|
break;
|
|
}
|
|
exprStr = $substring_0(this$static.template, open_0 + 1, close_0);
|
|
try {
|
|
ep = new ExprParser(exprStr);
|
|
expr = $parseExpression(ep);
|
|
if (ep.err_0 == null) {
|
|
es = new ExprState;
|
|
es.values[0] = value_0;
|
|
result = $eval(expr, es);
|
|
intResult = round_int(result);
|
|
result == intResult?(sb.string += intResult , sb):(sb.string += result , sb);
|
|
}
|
|
else {
|
|
console.log('ep.got error: ' + exprStr);
|
|
sb.string += '{' + exprStr + '}';
|
|
}
|
|
}
|
|
catch ($e0) {
|
|
$e0 = toJava($e0);
|
|
if (instanceOf($e0, 13)) {
|
|
sb.string += '{' + exprStr + '}';
|
|
}
|
|
else
|
|
throw toJs($e0);
|
|
}
|
|
pos = close_0 + 1;
|
|
}
|
|
return sb.string;
|
|
}
|
|
|
|
function InstructionDisplayElm$LookupEntry(lo, hi, template){
|
|
this.lo = lo;
|
|
this.hi = hi;
|
|
this.template = template;
|
|
}
|
|
|
|
defineClass(310, 1, {310:1}, InstructionDisplayElm$LookupEntry);
|
|
_.hi = 0;
|
|
_.lo = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_InstructionDisplayElm$LookupEntry_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'InstructionDisplayElm/LookupEntry', 310);
|
|
function InverterElm(xx, yy){
|
|
CircuitElm.call(this, xx, yy);
|
|
this.noDiagonal = true;
|
|
this.slewRate = 0.5;
|
|
this.highVoltage = lastHighVoltage;
|
|
}
|
|
|
|
function InverterElm_0(xa, ya, xb, yb, f, st){
|
|
CircuitElm_0.call(this, xa, ya, xb, yb, f);
|
|
this.noDiagonal = true;
|
|
this.slewRate = 0.5;
|
|
this.highVoltage = 5;
|
|
try {
|
|
this.slewRate = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.highVoltage = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
}
|
|
catch ($e0) {
|
|
$e0 = toJava($e0);
|
|
if (!instanceOf($e0, 13))
|
|
throw toJs($e0);
|
|
}
|
|
}
|
|
|
|
defineClass(424, 8, $intern_85, InverterElm, InverterElm_0);
|
|
_.addRoutingObstacle = function addRoutingObstacle_11(router){
|
|
$addRoutingObstacleWithLeads(this, router, 16);
|
|
}
|
|
;
|
|
_.doStep = function doStep_25(){
|
|
var maxStep, out;
|
|
out = this.volts[0] > this.highVoltage * 0.5?0:this.highVoltage;
|
|
maxStep = this.slewRate * sim_0.timeStep * $intern_32;
|
|
out = $wnd.Math.max($wnd.Math.min(this.lastOutputVoltage + maxStep, out), this.lastOutputVoltage - maxStep);
|
|
$updateVoltageSource(this.voltSource, out);
|
|
}
|
|
;
|
|
_.draw = function draw_36(g){
|
|
$drawPosts(this, g);
|
|
$draw2Leads(this, g);
|
|
$setColor_0(g, mouseElmRef == this || this.selected_0 || $containsKey(app_0.mouse.scopePlotRoles, this) || instanceOf(mouseElmRef, 21) && $getElm_0(mouseElmRef.elmScope) == this || $isOnHighlightedNet(this)?selectColor_0:lightGrayColor);
|
|
drawThickPolygon(g, this.gatePoly);
|
|
app_0.menus.euroGatesCheckItem.on && $drawCenteredText(this, g, '1', this.center.x_0, this.center.y_0 - 6, true);
|
|
drawThickCircle(g, this.pcircle.x_0, this.pcircle.y_0, 3);
|
|
this.curcount_0 = $updateDotCount(this.current_0, this.curcount_0);
|
|
$drawDots(g, this.lead2, this.point2, this.curcount_0);
|
|
}
|
|
;
|
|
_.dumpXml = function dumpXml_39(doc, elem){
|
|
dumpAttr_1(elem, 'x', this.x_0 + ' ' + this.y_0 + ' ' + this.x2 + ' ' + this.y2);
|
|
dumpAttr_0(elem, 'f', this.flags);
|
|
dumpAttr(elem, 'sl', this.slewRate);
|
|
dumpAttr(elem, 'hi', this.highVoltage);
|
|
}
|
|
;
|
|
_.getConnection = function getConnection_18(n1, n2){
|
|
return false;
|
|
}
|
|
;
|
|
_.getCurrentIntoNode = function getCurrentIntoNode_13(n){
|
|
if (n == 1)
|
|
return this.current_0;
|
|
return 0;
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_49(){
|
|
return 73;
|
|
}
|
|
;
|
|
_.getEditInfo = function getEditInfo_37(n){
|
|
if (n == 0)
|
|
return new EditInfo_0('Slew Rate (V/ns)', this.slewRate, 0, 0);
|
|
if (n == 1)
|
|
return $setUnitStep(new EditInfo_0('High Logic Voltage', this.highVoltage, 1, 10));
|
|
return null;
|
|
}
|
|
;
|
|
_.getInfo_0 = function getInfo_43(arr){
|
|
arr[0] = 'inverter';
|
|
arr[1] = 'Vi = ' + getUnitText(this.volts[0], 'V', false);
|
|
arr[2] = 'Vo = ' + getUnitText(this.volts[1], 'V', false);
|
|
}
|
|
;
|
|
_.getShortcut = function getShortcut_18(){
|
|
return 49;
|
|
}
|
|
;
|
|
_.getVoltageDiff_0 = function getVoltageDiff_12(){
|
|
return this.volts[0];
|
|
}
|
|
;
|
|
_.getVoltageSourceCount = function getVoltageSourceCount_31(){
|
|
return 1;
|
|
}
|
|
;
|
|
_.hasGroundConnection = function hasGroundConnection_13(n1){
|
|
return n1 == 1;
|
|
}
|
|
;
|
|
_.setEditValue = function setEditValue_37(n, ei){
|
|
n == 0 && (this.slewRate = ei.value_0);
|
|
n == 1 && (this.highVoltage = lastHighVoltage = ei.value_0);
|
|
}
|
|
;
|
|
_.setHighVoltage = function setHighVoltage_4(hv){
|
|
this.highVoltage = hv;
|
|
}
|
|
;
|
|
_.setPoints = function setPoints_32(){
|
|
var l2, pts, triPoints, ww;
|
|
$setPoints(this);
|
|
ww = 16;
|
|
16 > this.dn / 2 && (ww = round_int(this.dn / 2));
|
|
this.lead1 = $interpPoint(this.point1, this.point2, 0.5 - ww / this.dn);
|
|
this.lead2 = $interpPoint(this.point1, this.point2, 0.5 + (ww + 2) / this.dn);
|
|
this.pcircle = $interpPoint(this.point1, this.point2, 0.5 + (ww - 2) / this.dn);
|
|
if (app_0.menus.euroGatesCheckItem.on) {
|
|
pts = $newPointArray(4);
|
|
l2 = $interpPoint(this.point1, this.point2, 0.5 + (ww - 5) / this.dn);
|
|
$interpPoint2(this.lead1, l2, pts[0], pts[1], 0, 16);
|
|
$interpPoint2(this.lead1, l2, pts[3], pts[2], 1, 16);
|
|
this.gatePoly = $createPolygon_1(pts);
|
|
this.center = $interpPoint(this.lead1, l2, 0.5);
|
|
}
|
|
else {
|
|
triPoints = $newPointArray(3);
|
|
$interpPoint2(this.lead1, this.lead2, triPoints[0], triPoints[1], 0, 16);
|
|
triPoints[2] = $interpPoint(this.point1, this.point2, 0.5 + (ww - 5) / this.dn);
|
|
this.gatePoly = $createPolygon_1(triPoints);
|
|
}
|
|
$setBbox_0(this, this.point1, this.point2, 16);
|
|
}
|
|
;
|
|
_.stamp = function stamp_33(){
|
|
$stampVoltageSource(ground, this.nodes[1], this.voltSource);
|
|
}
|
|
;
|
|
_.startIteration = function startIteration_8(){
|
|
this.lastOutputVoltage = this.volts[1];
|
|
}
|
|
;
|
|
_.undumpXml = function undumpXml_41(xml){
|
|
this.flags = $parseIntAttr(xml, 'f', this.flags);
|
|
this.slewRate = $parseDoubleAttr(xml, 'sl', this.slewRate);
|
|
this.highVoltage = $parseDoubleAttr(xml, 'hi', this.highVoltage);
|
|
}
|
|
;
|
|
_.validate = function validate_12(){
|
|
return $validateRailNode(this, 1);
|
|
}
|
|
;
|
|
_.highVoltage = 0;
|
|
_.lastOutputVoltage = 0;
|
|
_.slewRate = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_InverterElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'InverterElm', 424);
|
|
function $setPoints_13(this$static){
|
|
var triPoints, ww;
|
|
$setPoints(this$static);
|
|
ww = 16;
|
|
16 > this$static.dn / 2 && (ww = round_int(this$static.dn / 2));
|
|
this$static.lead1 = $interpPoint(this$static.point1, this$static.point2, 0.5 - ww / this$static.dn);
|
|
this$static.lead2 = $interpPoint(this$static.point1, this$static.point2, 0.5 + (ww + 2) / this$static.dn);
|
|
this$static.pcircle = $interpPoint(this$static.point1, this$static.point2, 0.5 + (ww - 2) / this$static.dn);
|
|
triPoints = $newPointArray(3);
|
|
$interpPoint2(this$static.lead1, this$static.lead2, triPoints[0], triPoints[1], 0, 16);
|
|
triPoints[2] = $interpPoint(this$static.point1, this$static.point2, 0.5 + (ww - 5) / this$static.dn);
|
|
this$static.gatePoly = $createPolygon_1(triPoints);
|
|
this$static.symbolPoly = $getSchmittPolygon(this$static, 1, 0.30000001192092896);
|
|
$setBbox_0(this$static, this$static.point1, this$static.point2, 16);
|
|
}
|
|
|
|
function InvertingSchmittElm(xx, yy){
|
|
CircuitElm.call(this, xx, yy);
|
|
this.noDiagonal = true;
|
|
this.slewRate = 0.5;
|
|
this.state = false;
|
|
this.lowerTrigger = 1.66;
|
|
this.upperTrigger = 3.33;
|
|
this.logicOnLevel = 5;
|
|
this.logicOffLevel = 0;
|
|
}
|
|
|
|
function InvertingSchmittElm_0(xa, ya, xb, yb, f, st){
|
|
CircuitElm_0.call(this, xa, ya, xb, yb, f);
|
|
this.noDiagonal = true;
|
|
this.slewRate = 0.5;
|
|
this.lowerTrigger = 1.66;
|
|
this.upperTrigger = 3.33;
|
|
this.logicOnLevel = 5;
|
|
this.logicOffLevel = 0;
|
|
try {
|
|
this.slewRate = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.lowerTrigger = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.upperTrigger = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.logicOnLevel = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.logicOffLevel = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
}
|
|
catch ($e0) {
|
|
$e0 = toJava($e0);
|
|
if (!instanceOf($e0, 13))
|
|
throw toJs($e0);
|
|
}
|
|
}
|
|
|
|
defineClass(271, 8, $intern_85, InvertingSchmittElm, InvertingSchmittElm_0);
|
|
_.doStep = function doStep_26(){
|
|
var maxStep, out, v0;
|
|
v0 = this.volts[1];
|
|
if (this.state) {
|
|
if (this.volts[0] > this.upperTrigger) {
|
|
this.state = false;
|
|
out = this.logicOffLevel;
|
|
}
|
|
else {
|
|
out = this.logicOnLevel;
|
|
}
|
|
}
|
|
else {
|
|
if (this.volts[0] < this.lowerTrigger) {
|
|
this.state = true;
|
|
out = this.logicOnLevel;
|
|
}
|
|
else {
|
|
out = this.logicOffLevel;
|
|
}
|
|
}
|
|
maxStep = this.slewRate * sim_0.timeStep * $intern_32;
|
|
out = $wnd.Math.max($wnd.Math.min(v0 + maxStep, out), v0 - maxStep);
|
|
$updateVoltageSource(this.voltSource, out);
|
|
}
|
|
;
|
|
_.draw = function draw_37(g){
|
|
$drawPosts(this, g);
|
|
$draw2Leads(this, g);
|
|
$setColor_0(g, mouseElmRef == this || this.selected_0 || $containsKey(app_0.mouse.scopePlotRoles, this) || instanceOf(mouseElmRef, 21) && $getElm_0(mouseElmRef.elmScope) == this || $isOnHighlightedNet(this)?selectColor_0:lightGrayColor);
|
|
drawThickPolygon(g, this.gatePoly);
|
|
g.context.lineWidth = 2;
|
|
drawPolygon(g, this.symbolPoly);
|
|
g.context.lineWidth = 1;
|
|
drawThickCircle(g, this.pcircle.x_0, this.pcircle.y_0, 3);
|
|
this.curcount_0 = $updateDotCount(this.current_0, this.curcount_0);
|
|
$drawDots(g, this.lead2, this.point2, this.curcount_0);
|
|
}
|
|
;
|
|
_.dumpXml = function dumpXml_40(doc, elem){
|
|
dumpAttr_1(elem, 'x', this.x_0 + ' ' + this.y_0 + ' ' + this.x2 + ' ' + this.y2);
|
|
dumpAttr_0(elem, 'f', this.flags);
|
|
dumpAttr(elem, 'slr', this.slewRate);
|
|
dumpAttr(elem, 'lt', this.lowerTrigger);
|
|
dumpAttr(elem, 'ut', this.upperTrigger);
|
|
dumpAttr(elem, 'lon', this.logicOnLevel);
|
|
dumpAttr(elem, 'loff', this.logicOffLevel);
|
|
}
|
|
;
|
|
_.getConnection = function getConnection_19(n1, n2){
|
|
return false;
|
|
}
|
|
;
|
|
_.getCurrentIntoNode = function getCurrentIntoNode_14(n){
|
|
if (n == 1)
|
|
return this.current_0;
|
|
return 0;
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_50(){
|
|
return 183;
|
|
}
|
|
;
|
|
_.getEditInfo = function getEditInfo_38(n){
|
|
if (n == 0) {
|
|
this.dlt = this.lowerTrigger;
|
|
return new EditInfo_0('Lower threshold (V)', this.lowerTrigger, $intern_34, 5);
|
|
}
|
|
if (n == 1) {
|
|
this.dut = this.upperTrigger;
|
|
return new EditInfo_0('Upper threshold (V)', this.upperTrigger, $intern_34, 5);
|
|
}
|
|
if (n == 2)
|
|
return new EditInfo_0('Slew Rate (V/ns)', this.slewRate, 0, 0);
|
|
if (n == 3)
|
|
return $setUnitStep(new EditInfo_0('High Logic Voltage', this.logicOnLevel, 0, 0));
|
|
if (n == 4)
|
|
return $setUnitStep(new EditInfo_0('Low Voltage (V)', this.logicOffLevel, 0, 0));
|
|
return null;
|
|
}
|
|
;
|
|
_.getInfo_0 = function getInfo_44(arr){
|
|
arr[0] = 'inverting Schmitt trigger';
|
|
arr[1] = 'Vi = ' + getUnitText(this.volts[0], 'V', false);
|
|
arr[2] = 'Vo = ' + getUnitText(this.volts[1], 'V', false);
|
|
}
|
|
;
|
|
_.getVoltageDiff_0 = function getVoltageDiff_13(){
|
|
return this.volts[0];
|
|
}
|
|
;
|
|
_.getVoltageSourceCount = function getVoltageSourceCount_32(){
|
|
return 1;
|
|
}
|
|
;
|
|
_.hasGroundConnection = function hasGroundConnection_14(n1){
|
|
return n1 == 1;
|
|
}
|
|
;
|
|
_.setEditValue = function setEditValue_38(n, ei){
|
|
n == 0 && (this.dlt = ei.value_0);
|
|
n == 1 && (this.dut = ei.value_0);
|
|
n == 2 && (this.slewRate = ei.value_0);
|
|
n == 3 && (this.logicOnLevel = ei.value_0);
|
|
n == 4 && (this.logicOffLevel = ei.value_0);
|
|
if (this.dlt > this.dut) {
|
|
this.upperTrigger = this.dlt;
|
|
this.lowerTrigger = this.dut;
|
|
}
|
|
else {
|
|
this.upperTrigger = this.dut;
|
|
this.lowerTrigger = this.dlt;
|
|
}
|
|
}
|
|
;
|
|
_.setPoints = function setPoints_33(){
|
|
$setPoints_13(this);
|
|
}
|
|
;
|
|
_.stamp = function stamp_34(){
|
|
$stampVoltageSource(ground, this.nodes[1], this.voltSource);
|
|
}
|
|
;
|
|
_.undumpXml = function undumpXml_42(xml){
|
|
this.flags = $parseIntAttr(xml, 'f', this.flags);
|
|
this.slewRate = $parseDoubleAttr(xml, 'slr', this.slewRate);
|
|
this.lowerTrigger = $parseDoubleAttr(xml, 'lt', this.lowerTrigger);
|
|
this.upperTrigger = $parseDoubleAttr(xml, 'ut', this.upperTrigger);
|
|
this.logicOnLevel = $parseDoubleAttr(xml, 'lon', this.logicOnLevel);
|
|
this.logicOffLevel = $parseDoubleAttr(xml, 'loff', this.logicOffLevel);
|
|
}
|
|
;
|
|
_.dlt = 0;
|
|
_.dut = 0;
|
|
_.logicOffLevel = 0;
|
|
_.logicOnLevel = 0;
|
|
_.lowerTrigger = 0;
|
|
_.slewRate = 0;
|
|
_.state = false;
|
|
_.upperTrigger = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_InvertingSchmittElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'InvertingSchmittElm', 271);
|
|
function $setupPins_13(this$static){
|
|
this$static.sizeX = 2;
|
|
this$static.sizeY = 3;
|
|
this$static.pins = initUnidimensionalArray(Lcom_lushprojects_circuitjs1_client_ChipElm$Pin_2_classLit, $intern_3, 9, 5 + ((this$static.flags & 2) != 0?1:0), 0, 1);
|
|
this$static.pins[0] = new ChipElm$Pin(this$static, 0, 2, 'J');
|
|
this$static.pins[1] = new ChipElm$Pin(this$static, 1, 2, '');
|
|
this$static.pins[1].clock = true;
|
|
this$static.pins[1].bubble = (this$static.flags & 4) == 0;
|
|
this$static.pins[2] = new ChipElm$Pin(this$static, 2, 2, 'K');
|
|
this$static.pins[3] = new ChipElm$Pin(this$static, 0, 3, 'Q');
|
|
this$static.pins[3].output = this$static.pins[3].state = true;
|
|
this$static.pins[4] = new ChipElm$Pin(this$static, 2, 3, 'Q');
|
|
this$static.pins[4].output = true;
|
|
this$static.pins[4].lineOver = true;
|
|
if ((this$static.flags & 2) != 0) {
|
|
this$static.pins[5] = new ChipElm$Pin(this$static, 1, 3, 'R');
|
|
this$static.pins[5].bubble = (this$static.flags & 8) != 0;
|
|
}
|
|
}
|
|
|
|
function JKFlipFlopElm(xx, yy){
|
|
$clinit_ChipElm();
|
|
ChipElm.call(this, xx, yy);
|
|
}
|
|
|
|
function JKFlipFlopElm_0(xa, ya, xb, yb, f, st){
|
|
$clinit_ChipElm();
|
|
ChipElm_0.call(this, xa, ya, xb, yb, f, st);
|
|
this.pins[4].value_0 = !this.pins[3].value_0;
|
|
this.justLoaded = true;
|
|
}
|
|
|
|
defineClass(443, 32, $intern_85, JKFlipFlopElm, JKFlipFlopElm_0);
|
|
_.execute_3 = function execute_26(){
|
|
var q, transition;
|
|
if (this.justLoaded) {
|
|
this.justLoaded = false;
|
|
return;
|
|
}
|
|
(this.flags & 4) != 0?(transition = this.pins[1].value_0 && !this.lastClock):(transition = !this.pins[1].value_0 && this.lastClock);
|
|
if (transition) {
|
|
q = this.pins[3].value_0;
|
|
this.pins[0].value_0?this.pins[2].value_0?(q = !q):(q = true):this.pins[2].value_0 && (q = false);
|
|
this.pins[3].output || (console.log('pin 3 is not an output!') , undefined);
|
|
this.pins[3].value_0 = q;
|
|
}
|
|
this.lastClock = this.pins[1].value_0;
|
|
(this.flags & 2) != 0 && this.pins[5].value_0 != ((this.flags & 8) != 0) && (this.pins[3].output || (console.log('pin 3 is not an output!') , undefined) , this.pins[3].value_0 = false);
|
|
$writeOutput(this, 4, !this.pins[3].value_0);
|
|
}
|
|
;
|
|
_.getChipEditInfo = function getChipEditInfo_13(n){
|
|
var ei;
|
|
if (n == 0) {
|
|
ei = new EditInfo_0('', 0, -1, -1);
|
|
ei.checkbox = new Checkbox_0('Reset Pin', (this.flags & 2) != 0);
|
|
return ei;
|
|
}
|
|
if (n == 1) {
|
|
ei = new EditInfo_0('', 0, -1, -1);
|
|
ei.checkbox = new Checkbox_0('Positive Edge Triggered', (this.flags & 4) != 0);
|
|
return ei;
|
|
}
|
|
if (n == 2) {
|
|
ei = new EditInfo_0('', 0, -1, -1);
|
|
ei.checkbox = new Checkbox_0('Invert Reset', (this.flags & 8) != 0);
|
|
return ei;
|
|
}
|
|
return null;
|
|
}
|
|
;
|
|
_.getChipName = function getChipName_16(){
|
|
return 'JK flip-flop';
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_51(){
|
|
return 156;
|
|
}
|
|
;
|
|
_.getPostCount_0 = function getPostCount_37(){
|
|
return 5 + ((this.flags & 2) != 0?1:0);
|
|
}
|
|
;
|
|
_.getVoltageSourceCount = function getVoltageSourceCount_33(){
|
|
return 2;
|
|
}
|
|
;
|
|
_.setChipEditValue = function setChipEditValue_14(n, ei){
|
|
if (n == 0) {
|
|
$getState(ei.checkbox)?(this.flags |= 2):(this.flags &= -3);
|
|
$setupPins_13(this);
|
|
$allocNodes(this);
|
|
$setPoints_0(this);
|
|
}
|
|
if (n == 1) {
|
|
this.flags = $changeFlag(ei, this.flags, 4);
|
|
this.pins[1].bubble = (this.flags & 4) == 0;
|
|
}
|
|
if (n == 2) {
|
|
this.flags = $changeFlag(ei, this.flags, 8);
|
|
$setupPins_13(this);
|
|
$setPoints_0(this);
|
|
}
|
|
}
|
|
;
|
|
_.setupPins = function setupPins_17(){
|
|
$setupPins_13(this);
|
|
}
|
|
;
|
|
_.justLoaded = false;
|
|
var Lcom_lushprojects_circuitjs1_client_JKFlipFlopElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'JKFlipFlopElm', 443);
|
|
function $setupJSInterface(this$static){
|
|
var that = this$static;
|
|
$wnd.CircuitJS1 = {setSimRunning:$entry(function(run){
|
|
that.setSimRunning_0(run);
|
|
}
|
|
), getTime:$entry(function(){
|
|
return that.getTime_0();
|
|
}
|
|
), getTimeStep:$entry(function(){
|
|
return that.getTimeStep_0();
|
|
}
|
|
), setTimeStep:$entry(function(ts){
|
|
that.setTimeStep_0(ts);
|
|
}
|
|
), getMaxTimeStep:$entry(function(){
|
|
return that.getMaxTimeStep_0();
|
|
}
|
|
), setMaxTimeStep:$entry(function(ts){
|
|
that.setMaxTimeStep_0(ts);
|
|
}
|
|
), isRunning:$entry(function(){
|
|
return that.simIsRunning();
|
|
}
|
|
), getNodeVoltage:$entry(function(n){
|
|
return that.getLabeledNodeVoltage(n);
|
|
}
|
|
), setExtVoltage:$entry(function(n, v){
|
|
that.setExtVoltage_0(n, v);
|
|
}
|
|
), getElements:$entry(function(){
|
|
return that.getJSElements();
|
|
}
|
|
), getCircuitAsSVG:$entry(function(){
|
|
return that.doExportAsSVGFromAPI();
|
|
}
|
|
), exportCircuit:$entry(function(){
|
|
return that.dumpCircuit();
|
|
}
|
|
), importCircuit:$entry(function(circuit, subcircuitsOnly){
|
|
return that.importCircuitFromText(circuit, subcircuitsOnly);
|
|
}
|
|
)};
|
|
var hook = $wnd.oncircuitjsloaded;
|
|
hook && hook($wnd.CircuitJS1);
|
|
}
|
|
|
|
function JSInterface(app){
|
|
this.app = app;
|
|
}
|
|
|
|
defineClass(563, 1, {}, JSInterface);
|
|
_.doExportAsSVGFromAPI = function doExportAsSVGFromAPI(){
|
|
$doExportAsSVGFromAPI(this.app.imageExporter);
|
|
}
|
|
;
|
|
_.dumpCircuit = function dumpCircuit(){
|
|
return $dumpCircuit(this.app);
|
|
}
|
|
;
|
|
_.getJSElements = function getJSElements(){
|
|
var arr, ce, i;
|
|
arr = [];
|
|
for (i = 0; i != this.app.elmList.arrayList.array.length; i++) {
|
|
ce = $getElm(this.app, i);
|
|
$addJSMethods(ce);
|
|
arr[arr.length] = ce;
|
|
}
|
|
return arr;
|
|
}
|
|
;
|
|
_.getLabeledNodeVoltage = function getLabeledNodeVoltage(name_0){
|
|
return $getLabeledNodeVoltage(name_0);
|
|
}
|
|
;
|
|
_.getMaxTimeStep_0 = function getMaxTimeStep(){
|
|
return this.app.sim.maxTimeStep;
|
|
}
|
|
;
|
|
_.getTime_0 = function getTime(){
|
|
return this.app.sim.t;
|
|
}
|
|
;
|
|
_.getTimeStep_0 = function getTimeStep(){
|
|
return this.app.sim.timeStep;
|
|
}
|
|
;
|
|
_.importCircuitFromText = function importCircuitFromText(t, s){
|
|
$importCircuitFromText(this.app, t, s);
|
|
}
|
|
;
|
|
_.setExtVoltage_0 = function setExtVoltage(name_0, v){
|
|
var ce, eve, i;
|
|
for (i = 0; i != this.app.elmList.arrayList.array.length; i++) {
|
|
ce = $getElm(this.app, i);
|
|
if (instanceOf(ce, 262)) {
|
|
eve = ce;
|
|
$equals_1(eve.name_0, name_0) && (isNaN(v) || (eve.voltage = v));
|
|
}
|
|
}
|
|
}
|
|
;
|
|
_.setMaxTimeStep_0 = function setMaxTimeStep(ts){
|
|
this.app.sim.maxTimeStep = this.app.sim.timeStep = ts;
|
|
}
|
|
;
|
|
_.setSimRunning_0 = function setSimRunning(run){
|
|
$setSimRunning(this.app, run);
|
|
}
|
|
;
|
|
_.setTimeStep_0 = function setTimeStep(ts){
|
|
this.app.sim.timeStep = ts;
|
|
}
|
|
;
|
|
_.simIsRunning = function simIsRunning(){
|
|
return this.app.ui.app.simRunning;
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_JSInterface_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'JSInterface', 563);
|
|
function $$init_9(this$static){
|
|
this$static.FLAG_PNP = 1;
|
|
this$static.FLAG_SHOWVT = 2;
|
|
this$static.FLAG_FLIP = 8;
|
|
this$static.FLAG_DIGITAL_LEGACY = 4;
|
|
this$static.FLAG_HIDE_BULK_LEGACY = 16;
|
|
this$static.FLAG_BODY_DIODE_LEGACY = 32;
|
|
this$static.FLAG_BODY_TERMINAL_LEGACY = 64;
|
|
this$static.FLAG_SHOW_BODY_DIODE_LEGACY = 128;
|
|
this$static.mode = 0;
|
|
this$static.gm = 0;
|
|
}
|
|
|
|
function $calculate(this$static, finished){
|
|
var Gds, drain, ids0, lambda, realvds, realvgs, rs, source, vds, vgs, vgs_vt, vs;
|
|
if (finished)
|
|
vs = this$static.volts;
|
|
else {
|
|
vs = initUnidimensionalArray(D_classLit, $intern_76, 7, 3, 15, 1);
|
|
vs[0] = this$static.volts[0];
|
|
vs[1] = this$static.volts[1];
|
|
vs[2] = this$static.volts[2];
|
|
vs[1] > this$static.lastv1 + 0.5 && (vs[1] = this$static.lastv1 + 0.5);
|
|
vs[1] < this$static.lastv1 - 0.5 && (vs[1] = this$static.lastv1 - 0.5);
|
|
vs[2] > this$static.lastv2 + 0.5 && (vs[2] = this$static.lastv2 + 0.5);
|
|
vs[2] < this$static.lastv2 - 0.5 && (vs[2] = this$static.lastv2 - 0.5);
|
|
}
|
|
source = 1;
|
|
drain = 2;
|
|
if (this$static.pnp * vs[1] > this$static.pnp * vs[2]) {
|
|
source = 2;
|
|
drain = 1;
|
|
}
|
|
vgs = vs[0] - vs[source];
|
|
vds = vs[drain] - vs[source];
|
|
!finished && ($nonConvergence(this$static, this$static.lastv1, vs[1]) || $nonConvergence(this$static, this$static.lastv2, vs[2]) || $nonConvergence(this$static, this$static.lastv0, vs[0])) && (sim_0.converged = false);
|
|
this$static.lastv0 = vs[0];
|
|
this$static.lastv1 = vs[1];
|
|
this$static.lastv2 = vs[2];
|
|
realvgs = vgs;
|
|
realvds = vds;
|
|
vgs *= this$static.pnp;
|
|
vds *= this$static.pnp;
|
|
this$static.ids = 0;
|
|
this$static.gm = 0;
|
|
if (vgs < this$static.vt) {
|
|
Gds = $intern_112;
|
|
this$static.ids = vds * $intern_112;
|
|
this$static.mode = 0;
|
|
}
|
|
else if (vds < vgs - this$static.vt) {
|
|
lambda = this$static.model.lambda;
|
|
this$static.ids = this$static.beta_0 * ((vgs - this$static.vt) * vds - vds * vds * 0.5) * (1 + lambda * vds);
|
|
this$static.gm = this$static.beta_0 * vds * (1 + lambda * vds);
|
|
Gds = this$static.beta_0 * ((vgs - vds - this$static.vt) * (1 + lambda * vds) + lambda * ((vgs - this$static.vt) * vds - vds * vds * 0.5));
|
|
this$static.mode = 1;
|
|
}
|
|
else {
|
|
lambda = this$static.model.lambda;
|
|
vgs_vt = vgs - this$static.vt;
|
|
this$static.gm = this$static.beta_0 * vgs_vt * (1 + lambda * vds);
|
|
Gds = 0.5 * this$static.beta_0 * vgs_vt * vgs_vt * lambda;
|
|
Gds < $intern_112 && (Gds = $intern_112);
|
|
this$static.ids = 0.5 * this$static.beta_0 * vgs_vt * vgs_vt * (1 + lambda * vds);
|
|
this$static.mode = 2;
|
|
}
|
|
if (this$static.bodyDiodeSimulated) {
|
|
$doStep_0(this$static.diodeB1, this$static.pnp * (this$static.volts[this$static.bodyTerminal] - this$static.volts[1]));
|
|
this$static.diodeCurrent1 = $calculateCurrent_0(this$static.diodeB1, this$static.pnp * (this$static.volts[this$static.bodyTerminal] - this$static.volts[1])) * this$static.pnp;
|
|
$doStep_0(this$static.diodeB2, this$static.pnp * (this$static.volts[this$static.bodyTerminal] - this$static.volts[2]));
|
|
this$static.diodeCurrent2 = $calculateCurrent_0(this$static.diodeB2, this$static.pnp * (this$static.volts[this$static.bodyTerminal] - this$static.volts[2])) * this$static.pnp;
|
|
}
|
|
else
|
|
this$static.diodeCurrent1 = this$static.diodeCurrent2 = 0;
|
|
ids0 = this$static.ids;
|
|
(source == 2 && this$static.pnp == 1 || source == 1 && this$static.pnp == -1) && (this$static.ids = -this$static.ids);
|
|
if (finished)
|
|
return;
|
|
rs = -this$static.pnp * ids0 + Gds * realvds + this$static.gm * realvgs;
|
|
$stampMatrix(this$static.nodes[drain], this$static.nodes[drain], Gds);
|
|
$stampMatrix(this$static.nodes[drain], this$static.nodes[source], -Gds - this$static.gm);
|
|
$stampMatrix(this$static.nodes[drain], this$static.nodes[0], this$static.gm);
|
|
$stampMatrix(this$static.nodes[source], this$static.nodes[drain], -Gds);
|
|
$stampMatrix(this$static.nodes[source], this$static.nodes[source], Gds + this$static.gm);
|
|
$stampMatrix(this$static.nodes[source], this$static.nodes[0], -this$static.gm);
|
|
$stampRightSide(this$static.nodes[drain], rs);
|
|
$stampRightSide(this$static.nodes[source], -rs);
|
|
if (this$static.model.capGS > 0 && this$static.geqGS > 0) {
|
|
$stampMatrix(this$static.nodes[0], this$static.nodes[0], this$static.geqGS);
|
|
$stampMatrix(this$static.nodes[1], this$static.nodes[1], this$static.geqGS);
|
|
$stampMatrix(this$static.nodes[0], this$static.nodes[1], -this$static.geqGS);
|
|
$stampMatrix(this$static.nodes[1], this$static.nodes[0], -this$static.geqGS);
|
|
$stampRightSide(this$static.nodes[0], -this$static.ceqGS);
|
|
$stampRightSide(this$static.nodes[1], this$static.ceqGS);
|
|
}
|
|
if (this$static.model.capGD > 0 && this$static.geqGD > 0) {
|
|
$stampMatrix(this$static.nodes[0], this$static.nodes[0], this$static.geqGD);
|
|
$stampMatrix(this$static.nodes[2], this$static.nodes[2], this$static.geqGD);
|
|
$stampMatrix(this$static.nodes[0], this$static.nodes[2], -this$static.geqGD);
|
|
$stampMatrix(this$static.nodes[2], this$static.nodes[0], -this$static.geqGD);
|
|
$stampRightSide(this$static.nodes[0], -this$static.ceqGD);
|
|
$stampRightSide(this$static.nodes[2], this$static.ceqGD);
|
|
}
|
|
}
|
|
|
|
function $getFetInfo(this$static, arr, n){
|
|
var idx;
|
|
arr[0] = LS((this$static.pnp == -1?'p-':'n-') + n) + ' (' + this$static.modelName + ')';
|
|
arr[1] = 'Vt=' + getUnitText(this$static.pnp * this$static.vt, 'V', false) + ', \u03B2=' + this$static.beta_0;
|
|
arr[2] = (this$static.pnp == 1?'Ids = ':'Isd = ') + getUnitText(this$static.ids, 'A', false);
|
|
arr[3] = 'Vgs = ' + getUnitText(this$static.volts[0] - this$static.volts[this$static.pnp == -1?2:1], 'V', false);
|
|
arr[4] = (this$static.pnp == 1?'Vds = ':'Vsd = ') + getUnitText(this$static.volts[2] - this$static.volts[1], 'V', false);
|
|
arr[5] = LS(this$static.mode == 0?'off':this$static.mode == 1?'linear':'saturation');
|
|
arr[6] = 'gm = ' + getUnitText(this$static.gm, 'A/V', false);
|
|
arr[7] = 'P = ' + getUnitText(this$static.ids * (this$static.volts[2] - this$static.volts[1]) - this$static.diodeCurrent1 * (this$static.volts[1] - this$static.volts[this$static.bodyTerminal]) - this$static.diodeCurrent2 * (this$static.volts[2] - this$static.volts[this$static.bodyTerminal]), 'W', false);
|
|
idx = 8;
|
|
this$static.showBulk_0() && (arr[idx++] = 'Ib = ' + getUnitText(this$static.bodyTerminal == 1?-this$static.diodeCurrent1:this$static.bodyTerminal == 2?this$static.diodeCurrent2:-this$static.pnp * (this$static.diodeCurrent1 + this$static.diodeCurrent2), 'A', false));
|
|
this$static.model.capGS > 0 && (arr[idx++] = 'Cgs = ' + getUnitText(this$static.model.capGS, 'F', false));
|
|
this$static.model.capGD > 0 && (arr[idx] = 'Cgd = ' + getUnitText(this$static.model.capGD, 'F', false));
|
|
}
|
|
|
|
function $legacyModel(this$static, vt0, beta0, legacyFlags){
|
|
var legacyBodyDiode, legacyBodyTerminal, legacyDigital, legacyShowBodyDiode, legacyShowBulk;
|
|
legacyShowBulk = !this$static.isJfet() && (legacyFlags & (this$static.FLAG_DIGITAL_LEGACY | this$static.FLAG_HIDE_BULK_LEGACY)) == 0;
|
|
legacyDigital = (legacyFlags & this$static.FLAG_DIGITAL_LEGACY) != 0;
|
|
legacyBodyDiode = (legacyFlags & this$static.FLAG_BODY_DIODE_LEGACY) != 0;
|
|
legacyBodyTerminal = (legacyFlags & this$static.FLAG_BODY_TERMINAL_LEGACY) != 0;
|
|
legacyShowBodyDiode = (legacyFlags & this$static.FLAG_SHOW_BODY_DIODE_LEGACY) != 0;
|
|
this$static.flags &= ~(this$static.FLAG_DIGITAL_LEGACY | this$static.FLAG_HIDE_BULK_LEGACY | this$static.FLAG_BODY_DIODE_LEGACY | this$static.FLAG_BODY_TERMINAL_LEGACY | this$static.FLAG_SHOW_BODY_DIODE_LEGACY);
|
|
return getModelWithParameters_0(vt0, beta0, this$static.isJfet(), legacyShowBulk, legacyBodyDiode, legacyBodyTerminal, legacyDigital, legacyShowBodyDiode);
|
|
}
|
|
|
|
function $newModelCreated_0(this$static, mm){
|
|
this$static.model = mm;
|
|
this$static.modelName = this$static.model.name_0;
|
|
$setup_3(this$static);
|
|
}
|
|
|
|
function $nonConvergence(this$static, last, now_0){
|
|
var diff;
|
|
diff = $wnd.Math.abs(last - now_0);
|
|
this$static.beta_0 > 1 && (diff *= 100);
|
|
if (diff < $intern_34)
|
|
return false;
|
|
if (sim_0.subIterations > 10 && diff < $wnd.Math.abs(now_0) * $intern_83)
|
|
return false;
|
|
if (sim_0.subIterations > 100 && diff < $intern_34 + (sim_0.subIterations - 100) * $intern_87)
|
|
return false;
|
|
return true;
|
|
}
|
|
|
|
function $reset_7(this$static){
|
|
this$static.lastv1 = this$static.lastv2 = this$static.volts[0] = this$static.volts[1] = this$static.volts[2] = this$static.curcount_0 = 0;
|
|
this$static.curcount_body1 = this$static.curcount_body2 = this$static.curcount_gate = this$static.curcount_source = this$static.curcount_drain = 0;
|
|
this$static.capVoltGS = this$static.capVoltGD = this$static.capCurGS = this$static.capCurGD = 0;
|
|
this$static.geqGS = this$static.geqGD = this$static.ceqGS = this$static.ceqGD = 0;
|
|
this$static.diodeB1.lastvoltdiff = 0;
|
|
this$static.diodeB2.lastvoltdiff = 0;
|
|
this$static.bodyDiodeSimulated && (this$static.volts[this$static.bodyTerminal] = 0);
|
|
}
|
|
|
|
function $setPoints_14(this$static){
|
|
var a1, a2, b1, b2, dist, dp1, dp2, hs2, pa;
|
|
$setPoints(this$static);
|
|
hs2 = 16 * this$static.dsign;
|
|
(this$static.flags & this$static.FLAG_FLIP) != 0 && (hs2 = -hs2);
|
|
this$static.src_0 = $newPointArray(3);
|
|
this$static.drn = $newPointArray(3);
|
|
$interpPoint2(this$static.point1, this$static.point2, this$static.src_0[0], this$static.drn[0], 1, -hs2);
|
|
$interpPoint2(this$static.point1, this$static.point2, this$static.src_0[1], this$static.drn[1], 1 - 22 / this$static.dn, -hs2);
|
|
$interpPoint2(this$static.point1, this$static.point2, this$static.src_0[2], this$static.drn[2], 1 - 22 / this$static.dn, -hs2 * 4 / 3 | 0);
|
|
this$static.gate = $newPointArray(3);
|
|
$interpPoint2(this$static.point1, this$static.point2, this$static.gate[0], this$static.gate[2], 1 - 28 / this$static.dn, hs2 / 2 | 0);
|
|
$interpPoint_1(this$static.gate[0], this$static.gate[2], this$static.gate[1], 0.5);
|
|
if (this$static.showBulk_0()) {
|
|
this$static.body_0 = $newPointArray(2);
|
|
$interpPoint_1(this$static.src_0[0], this$static.drn[0], this$static.body_0[0], 0.5);
|
|
$interpPoint_1(this$static.src_0[1], this$static.drn[1], this$static.body_0[1], 0.5);
|
|
}
|
|
if (this$static.digitalSymbolShown) {
|
|
if (this$static.pnp == -1) {
|
|
$interpPoint_1(this$static.point1, this$static.point2, this$static.gate[1], 1 - 36 / this$static.dn);
|
|
dist = this$static.dsign < 0?32:31;
|
|
this$static.pcircle = $interpPoint(this$static.point1, this$static.point2, 1 - dist / this$static.dn);
|
|
this$static.pcircler = 3;
|
|
}
|
|
}
|
|
else {
|
|
this$static.pnp == 1?this$static.showBulk_0()?(this$static.arrowPoly_0 = $calcArrow(this$static.body_0[0], this$static.body_0[1], 12, 5)):(this$static.arrowPoly_0 = $calcArrow(this$static.src_0[1], this$static.src_0[0], 10, 4)):this$static.showBulk_0()?(this$static.arrowPoly_0 = $calcArrow(this$static.body_0[1], this$static.body_0[0], 12, 5)):(this$static.arrowPoly_0 = $calcArrow(this$static.drn[0], this$static.drn[1], 12, 5));
|
|
}
|
|
if (this$static.bodyDiodeSymbolShown) {
|
|
pa = $newPointArray(2);
|
|
if (this$static.bodyTerminalShown) {
|
|
this$static.bodyDiodeCathode = $newPointArray(2);
|
|
this$static.bodyDiodeCathode2 = $newPointArray(2);
|
|
a1 = this$static.pnp == 1?this$static.body_0[0]:this$static.src_0[0];
|
|
b1 = this$static.pnp == 1?this$static.src_0[0]:this$static.body_0[0];
|
|
dp1 = $interpPoint(a1, b1, 0.3);
|
|
dp2 = $interpPoint(a1, b1, 0.7);
|
|
$interpPoint2(dp1, dp2, pa[0], pa[1], 0, 3);
|
|
$interpPoint2(dp1, dp2, this$static.bodyDiodeCathode[0], this$static.bodyDiodeCathode[1], 1, 3);
|
|
this$static.bodyDiodePoly = $createPolygon(pa[0], pa[1], dp2);
|
|
pa = $newPointArray(2);
|
|
a2 = this$static.pnp == 1?this$static.body_0[0]:this$static.drn[0];
|
|
b2 = this$static.pnp == 1?this$static.drn[0]:this$static.body_0[0];
|
|
dp1 = $interpPoint(a2, b2, 0.3);
|
|
dp2 = $interpPoint(a2, b2, 0.7);
|
|
$interpPoint2(dp1, dp2, pa[0], pa[1], 0, 3);
|
|
$interpPoint2(dp1, dp2, this$static.bodyDiodeCathode2[0], this$static.bodyDiodeCathode2[1], 1, 3);
|
|
this$static.bodyDiodePoly2 = $createPolygon(pa[0], pa[1], dp2);
|
|
}
|
|
else {
|
|
this$static.bodyDiodeCathode = $newPointArray(2);
|
|
this$static.bodyDiodeLeads = $newPointArray(4);
|
|
dp1 = $interpPoint_0(this$static.src_0[0], this$static.drn[0], 0.3125, -hs2);
|
|
dp2 = $interpPoint_0(this$static.src_0[0], this$static.drn[0], 0.6875, -hs2);
|
|
$interpPoint2(dp1, dp2, pa[0], pa[1], 0, 6);
|
|
$interpPoint2(dp1, dp2, this$static.bodyDiodeCathode[0], this$static.bodyDiodeCathode[1], 1, 6);
|
|
this$static.bodyDiodePoly = $createPolygon(pa[0], pa[1], dp2);
|
|
this$static.bodyDiodeLeads[0] = $interpPoint_0(this$static.src_0[0], this$static.drn[0], 0, -hs2);
|
|
this$static.bodyDiodeLeads[1] = dp1;
|
|
this$static.bodyDiodeLeads[2] = dp2;
|
|
this$static.bodyDiodeLeads[3] = $interpPoint_0(this$static.src_0[0], this$static.drn[0], 1, -hs2);
|
|
}
|
|
}
|
|
}
|
|
|
|
function $setup_3(this$static){
|
|
this$static.model = getModelWithNameOrCopy_1(this$static.modelName, this$static.model, this$static.isJfet());
|
|
this$static.modelName = this$static.model.name_0;
|
|
this$static.vt = this$static.model.threshold;
|
|
this$static.beta_0 = this$static.model.beta_0;
|
|
this$static.bulkShown = this$static.model.showBulk;
|
|
this$static.digitalSymbolShown = !this$static.bulkShown && this$static.model.digitalSymbol;
|
|
this$static.bodyDiodeSimulated = this$static.bulkShown && this$static.model.bodyDiode;
|
|
this$static.bodyTerminalShown = this$static.bodyDiodeSimulated && this$static.model.bodyTerminal;
|
|
this$static.bodyDiodeSymbolShown = this$static.bodyDiodeSimulated && this$static.model.showBodyDiodeSymbol;
|
|
$allocNodes(this$static);
|
|
}
|
|
|
|
function $setupDiodes(this$static){
|
|
this$static.diodeB1 = new Diode(sim_0);
|
|
$setup(this$static.diodeB1, getModelWithName_1('default'));
|
|
this$static.diodeB2 = new Diode(sim_0);
|
|
$setup(this$static.diodeB2, getModelWithName_1('default'));
|
|
}
|
|
|
|
function $stamp_3(this$static){
|
|
this$static.bodyTerminalShown?(this$static.bodyTerminal = 3):(this$static.bodyTerminal = this$static.pnp == -1?2:1);
|
|
if (this$static.bodyDiodeSimulated) {
|
|
if (this$static.pnp == -1) {
|
|
$stamp_0(this$static.diodeB1, this$static.nodes[1], this$static.nodes[this$static.bodyTerminal]);
|
|
$stamp_0(this$static.diodeB2, this$static.nodes[2], this$static.nodes[this$static.bodyTerminal]);
|
|
}
|
|
else {
|
|
$stamp_0(this$static.diodeB1, this$static.nodes[this$static.bodyTerminal], this$static.nodes[1]);
|
|
$stamp_0(this$static.diodeB2, this$static.nodes[this$static.bodyTerminal], this$static.nodes[2]);
|
|
}
|
|
}
|
|
}
|
|
|
|
function MosfetElm(xa, ya, xb, yb, f, st){
|
|
var beta0, vt0;
|
|
CircuitElm_0.call(this, xa, ya, xb, yb, f);
|
|
$$init_9(this);
|
|
this.pnp = (f & this.FLAG_PNP) != 0?-1:1;
|
|
this.noDiagonal = true;
|
|
$setupDiodes(this);
|
|
vt0 = this.getDefaultThreshold();
|
|
beta0 = this.getBackwardCompatibilityBeta();
|
|
try {
|
|
vt0 = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
beta0 = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
}
|
|
catch ($e0) {
|
|
$e0 = toJava($e0);
|
|
if (!instanceOf($e0, 13))
|
|
throw toJs($e0);
|
|
}
|
|
this.model = $legacyModel(this, vt0, beta0, this.flags);
|
|
this.modelName = this.model.name_0;
|
|
$setup_3(this);
|
|
$allocNodes(this);
|
|
}
|
|
|
|
function MosfetElm_0(xx, yy, pnpflag){
|
|
CircuitElm.call(this, xx, yy);
|
|
$$init_9(this);
|
|
this.pnp = pnpflag?-1:1;
|
|
this.flags = pnpflag?this.FLAG_PNP:0;
|
|
this.noDiagonal = true;
|
|
$setupDiodes(this);
|
|
this.modelName = this.getLastModelName();
|
|
$setup_3(this);
|
|
}
|
|
|
|
defineClass(129, 8, $intern_121, MosfetElm);
|
|
_.addRoutingObstacle = function addRoutingObstacle_12(router){
|
|
$addObstacle_0(router, stampJavaTypeInfo(getClassLiteralForArray(Lcom_lushprojects_circuitjs1_client_Point_2_classLit, 1), $intern_78, 14, 0, [this.gate[0], this.gate[2], this.src_0[0], this.drn[0], this.src_0[2], this.drn[2]]));
|
|
$addWire(router, this.point1.x_0, this.point1.y_0, this.gate[1].x_0, this.gate[1].y_0);
|
|
}
|
|
;
|
|
_.canViewInScope = function canViewInScope_2(){
|
|
return true;
|
|
}
|
|
;
|
|
_.doStep = function doStep_27(){
|
|
$calculate(this, false);
|
|
}
|
|
;
|
|
_.draw = function draw_38(g){
|
|
var anode1, anode2, cathode1, cathode2, cur, dsx, dsyn, enhancement, extra, i, power, s, v;
|
|
$setBbox_0(this, this.point1, this.point2, 16);
|
|
$setVoltageColor(this, g, this.volts[1]);
|
|
drawThickLine_0(g, this.src_0[0], this.src_0[1], 3);
|
|
$setVoltageColor(this, g, this.volts[2]);
|
|
drawThickLine_0(g, this.drn[0], this.drn[1], 3);
|
|
$setPowerColor_0(this, g);
|
|
power = app_0.menus.powerCheckItem.on;
|
|
enhancement = this.vt > 0 && this.showBulk_0();
|
|
for (i = 0; i != 6; i++) {
|
|
if ((i == 1 || i == 4) && enhancement)
|
|
continue;
|
|
v = this.volts[1] + (this.volts[2] - this.volts[1]) * i / 6;
|
|
power || $setColor_0(g, $getVoltageColor(this, v));
|
|
$interpPoint_1(this.src_0[1], this.drn[1], ps1, i * $intern_122);
|
|
$interpPoint_1(this.src_0[1], this.drn[1], ps2, (i + 1) * $intern_122);
|
|
drawThickLine_0(g, ps1, ps2, 3);
|
|
}
|
|
power || $setVoltageColor(this, g, this.volts[1]);
|
|
drawThickLine_0(g, this.src_0[1], this.src_0[2], 3);
|
|
power || $setVoltageColor(this, g, this.volts[2]);
|
|
drawThickLine_0(g, this.drn[1], this.drn[2], 3);
|
|
if (this.showBulk_0()) {
|
|
$setVoltageColor(this, g, this.volts[this.bodyTerminal]);
|
|
this.bodyTerminalShown || drawThickLine_0(g, this.pnp == -1?this.drn[0]:this.src_0[0], this.body_0[0], 3);
|
|
drawThickLine_0(g, this.body_0[0], this.body_0[1], 3);
|
|
}
|
|
if (this.bodyDiodeSymbolShown) {
|
|
if (this.bodyTerminalShown) {
|
|
anode1 = this.pnp == 1?this.bodyTerminal:1;
|
|
cathode1 = this.pnp == 1?1:this.bodyTerminal;
|
|
$setVoltageColor(this, g, this.volts[anode1]);
|
|
$fillPolygon(g, this.bodyDiodePoly);
|
|
$setVoltageColor(this, g, this.volts[cathode1]);
|
|
$drawLine_0(g, this.bodyDiodeCathode[0], this.bodyDiodeCathode[1]);
|
|
anode2 = this.pnp == 1?this.bodyTerminal:2;
|
|
cathode2 = this.pnp == 1?2:this.bodyTerminal;
|
|
$setVoltageColor(this, g, this.volts[anode2]);
|
|
$fillPolygon(g, this.bodyDiodePoly2);
|
|
$setVoltageColor(this, g, this.volts[cathode2]);
|
|
$drawLine_0(g, this.bodyDiodeCathode2[0], this.bodyDiodeCathode2[1]);
|
|
}
|
|
else {
|
|
$setVoltageColor(this, g, this.volts[1]);
|
|
$fillPolygon(g, this.bodyDiodePoly);
|
|
drawThickLine_0(g, this.src_0[0], this.bodyDiodeLeads[0], 3);
|
|
drawThickLine_0(g, this.bodyDiodeLeads[0], this.bodyDiodeLeads[1], 3);
|
|
$setVoltageColor(this, g, this.volts[2]);
|
|
drawThickLine_0(g, this.bodyDiodeCathode[0], this.bodyDiodeCathode[1], 3);
|
|
drawThickLine_0(g, this.bodyDiodeLeads[2], this.bodyDiodeLeads[3], 3);
|
|
drawThickLine_0(g, this.drn[0], this.bodyDiodeLeads[3], 3);
|
|
$adjustBbox_0(this, this.bodyDiodeLeads[0], this.bodyDiodeLeads[3]);
|
|
}
|
|
}
|
|
if (!this.digitalSymbolShown) {
|
|
$setVoltageColor(this, g, this.volts[this.bodyTerminal]);
|
|
$fillPolygon(g, this.arrowPoly_0);
|
|
}
|
|
power && $setColor_0(g, ($clinit_Color() , gray));
|
|
$setVoltageColor(this, g, this.volts[0]);
|
|
drawThickLine_0(g, this.point1, this.gate[1], 3);
|
|
drawThickLine_0(g, this.gate[0], this.gate[2], 3);
|
|
this.digitalSymbolShown && this.pnp == -1 && drawThickCircle(g, this.pcircle.x_0, this.pcircle.y_0, this.pcircler);
|
|
if ((this.flags & this.FLAG_SHOWVT) != 0) {
|
|
s = '' + this.vt * this.pnp;
|
|
$setColor_0(g, whiteColor);
|
|
$setFont_0(g, unitsFont);
|
|
$drawCenteredText(this, g, s, this.x2 + 2, this.y2, false);
|
|
}
|
|
this.curcount_source = $updateDotCount(-(this.ids + this.capCurGS), this.curcount_source);
|
|
this.curcount_drain = $updateDotCount(-this.ids + this.capCurGD, this.curcount_drain);
|
|
$drawDots(g, this.src_0[0], this.src_0[1], this.curcount_source);
|
|
$drawDots(g, this.src_0[1], this.drn[1], this.curcount_source);
|
|
$drawDots(g, this.drn[1], this.drn[0], this.curcount_drain);
|
|
if (this.model.capGS > 0 || this.model.capGD > 0) {
|
|
this.curcount_gate = $updateDotCount(this.capCurGS + this.capCurGD, this.curcount_gate);
|
|
$drawDots(g, this.point1, this.gate[1], this.curcount_gate);
|
|
}
|
|
if (this.showBulk_0()) {
|
|
this.curcount_body1 = $updateDotCount(this.diodeCurrent1, this.curcount_body1);
|
|
this.curcount_body2 = $updateDotCount(this.diodeCurrent2, this.curcount_body2);
|
|
if (this.bodyDiodeSymbolShown && !this.bodyTerminalShown) {
|
|
cur = -this.curcount_body1 + this.curcount_body2;
|
|
$drawDots(g, this.src_0[0], this.bodyDiodeLeads[0], cur);
|
|
$drawDots(g, this.bodyDiodeLeads[0], this.bodyDiodeLeads[3], cur);
|
|
$drawDots(g, this.bodyDiodeLeads[3], this.drn[0], cur);
|
|
}
|
|
else {
|
|
$drawDots(g, this.src_0[0], this.body_0[0], -this.curcount_body1);
|
|
$drawDots(g, this.body_0[0], this.drn[0], this.curcount_body2);
|
|
}
|
|
}
|
|
if (mouseElmRef == this || this.selected_0 || $containsKey(app_0.mouse.scopePlotRoles, this) || instanceOf(mouseElmRef, 21) && $getElm_0(mouseElmRef.elmScope) == this || $isOnHighlightedNet(this) || app_0.mouse.dragElm == this) {
|
|
$setColor_0(g, whiteColor);
|
|
$setFont_0(g, unitsFont);
|
|
dsx = sign_0(this.dx);
|
|
sign_0(this.dy);
|
|
dsyn = this.dy == 0?0:1;
|
|
$drawString(g, 'G', this.gate[1].x_0 - (this.dx < 0?-2:12), this.gate[1].y_0 + (this.dy > 0?-5:12));
|
|
extra = this.bodyDiodeSymbolShown && !this.bodyTerminalShown && this.dy == 0?16 * this.dsign:0;
|
|
$drawString(g, this.pnp == -1?'D':'S', this.src_0[0].x_0 - 3 + 9 * (dsx - dsyn * this.pnp) + extra, this.src_0[0].y_0 + 4);
|
|
$drawString(g, this.pnp == -1?'S':'D', this.drn[0].x_0 - 3 + 9 * (dsx - dsyn * this.pnp) + extra, this.drn[0].y_0 + 4);
|
|
this.bodyTerminalShown && $drawString(g, 'B', this.body_0[0].x_0 - 3 + 9 * (dsx - dsyn * this.pnp), this.body_0[0].y_0 + 4);
|
|
}
|
|
$drawPosts(this, g);
|
|
}
|
|
;
|
|
_.dumpXml = function dumpXml_41(doc, elem){
|
|
this.model.builtIn || this.model.dumped || $dumpXml_8(this.model, doc);
|
|
dumpAttr_1(elem, 'x', this.x_0 + ' ' + this.y_0 + ' ' + this.x2 + ' ' + this.y2);
|
|
dumpAttr_0(elem, 'f', this.flags);
|
|
dumpAttr_1(elem, 'mo', this.modelName);
|
|
}
|
|
;
|
|
_.dumpXmlModel = function dumpXmlModel_2(doc){
|
|
this.model.builtIn || this.model.dumped || $dumpXml_8(this.model, doc);
|
|
}
|
|
;
|
|
_.flipX = function flipX_8(c2, count){
|
|
this.x_0 == this.x2 && (this.flags ^= this.FLAG_FLIP);
|
|
$flipX(this, c2);
|
|
}
|
|
;
|
|
_.flipXY = function flipXY_6(xmy, count){
|
|
this.flags ^= this.FLAG_FLIP;
|
|
$flipXY(this, xmy);
|
|
}
|
|
;
|
|
_.flipY = function flipY_8(c2, count){
|
|
this.y_0 == this.y2 && (this.flags ^= this.FLAG_FLIP);
|
|
$flipY(this, c2);
|
|
}
|
|
;
|
|
_.getBackwardCompatibilityBeta = function getBackwardCompatibilityBeta(){
|
|
return $intern_36;
|
|
}
|
|
;
|
|
_.getConnection = function getConnection_20(n1, n2){
|
|
if (this.model.capGS > 0 || this.model.capGD > 0)
|
|
return true;
|
|
return !(n1 == 0 || n2 == 0);
|
|
}
|
|
;
|
|
_.getCurrent_0 = function getCurrent_1(){
|
|
return this.ids;
|
|
}
|
|
;
|
|
_.getCurrentIntoNode = function getCurrentIntoNode_15(n){
|
|
var capCur, capCur0, gateCur;
|
|
if (n == 0) {
|
|
gateCur = 0;
|
|
this.model.capGS > 0 && this.geqGS > 0 && (gateCur -= this.geqGS * (this.volts[0] - this.volts[1]) + this.ceqGS);
|
|
this.model.capGD > 0 && this.geqGD > 0 && (gateCur -= this.geqGD * (this.volts[0] - this.volts[2]) + this.ceqGD);
|
|
return gateCur;
|
|
}
|
|
if (n == 3)
|
|
return -this.diodeCurrent1 - this.diodeCurrent2;
|
|
if (n == 1) {
|
|
capCur0 = this.model.capGS > 0 && this.geqGS > 0?this.geqGS * (this.volts[0] - this.volts[1]) + this.ceqGS:0;
|
|
return this.ids + this.diodeCurrent1 + capCur0;
|
|
}
|
|
capCur = this.model.capGD > 0 && this.geqGD > 0?this.geqGD * (this.volts[0] - this.volts[2]) + this.ceqGD:0;
|
|
return -this.ids + this.diodeCurrent2 + capCur;
|
|
}
|
|
;
|
|
_.getDefaultThreshold = function getDefaultThreshold(){
|
|
return 1.5;
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_52(){
|
|
return 102;
|
|
}
|
|
;
|
|
_.getEditInfo = function getEditInfo_39(n){
|
|
var ei, i, idx, mm;
|
|
if (n == 0) {
|
|
ei = new EditInfo_0('Model', 0, -1, -1);
|
|
this.models = getModelList_1(this.isJfet());
|
|
ei.choice = new Choice;
|
|
for (i = 0; i != this.models.arrayList.array.length; i++) {
|
|
mm = $get_4(this.models, i);
|
|
$addItem(ei.choice, LS($getDescription_0(mm)));
|
|
mm == this.model && $select(ei.choice, i);
|
|
}
|
|
return ei;
|
|
}
|
|
idx = 1;
|
|
if (this.hasSwapDS()) {
|
|
if (n == idx++) {
|
|
ei = new EditInfo_0('', 0, -1, -1);
|
|
ei.checkbox = new Checkbox_0('Swap D/S', (this.flags & this.FLAG_FLIP) != 0);
|
|
return ei;
|
|
}
|
|
}
|
|
if (n == idx) {
|
|
ei = new EditInfo_0('', 0, -1, -1);
|
|
ei.button_0 = new Button_1(LS('Create New Model'));
|
|
return ei;
|
|
}
|
|
if (n == idx + 1) {
|
|
if (this.model.readOnly)
|
|
return null;
|
|
ei = new EditInfo_0('', 0, -1, -1);
|
|
ei.button_0 = new Button_1(LS('Edit Model'));
|
|
return ei;
|
|
}
|
|
return null;
|
|
}
|
|
;
|
|
_.getElmType = function getElmType_10(){
|
|
return 'MOSFET';
|
|
}
|
|
;
|
|
_.getInfo_0 = function getInfo_45(arr){
|
|
$getFetInfo(this, arr, 'MOSFET');
|
|
}
|
|
;
|
|
_.getLastModelName = function getLastModelName(){
|
|
return lastModelName_2;
|
|
}
|
|
;
|
|
_.getMatrixConnection = function getMatrixConnection_5(n1, n2){
|
|
return true;
|
|
}
|
|
;
|
|
_.getPost = function getPost_11(n){
|
|
return n == 0?this.point1:n == 1?this.src_0[0]:n == 2?this.drn[0]:this.body_0[0];
|
|
}
|
|
;
|
|
_.getPostCount_0 = function getPostCount_38(){
|
|
return this.bodyTerminalShown?4:3;
|
|
}
|
|
;
|
|
_.getPower = function getPower_7(){
|
|
return this.ids * (this.volts[2] - this.volts[1]) - this.diodeCurrent1 * (this.volts[1] - this.volts[this.bodyTerminal]) - this.diodeCurrent2 * (this.volts[2] - this.volts[this.bodyTerminal]);
|
|
}
|
|
;
|
|
_.getScopeText = function getScopeText_2(v){
|
|
return LS((this.pnp == -1?'p-':'n-') + 'MOSFET');
|
|
}
|
|
;
|
|
_.getVoltageDiff_0 = function getVoltageDiff_14(){
|
|
return this.volts[2] - this.volts[1];
|
|
}
|
|
;
|
|
_.hasSwapDS = function hasSwapDS(){
|
|
return true;
|
|
}
|
|
;
|
|
_.isJfet = function isJfet(){
|
|
return false;
|
|
}
|
|
;
|
|
_.nonLinear_0 = function nonLinear_10(){
|
|
return true;
|
|
}
|
|
;
|
|
_.onMouseWheel = function onMouseWheel(e){
|
|
if (!!typeScrollPopup && typeScrollPopup.showing) {
|
|
$doDeltaY_0(typeScrollPopup, $eventGetMouseWheelVelocityY(e.nativeEvent));
|
|
return;
|
|
}
|
|
typeScrollPopup = new TypeScrollPopup((e.nativeEvent.clientX || 0) | 0, (e.nativeEvent.clientY || 0) | 0, $eventGetMouseWheelVelocityY(e.nativeEvent), this, app_0);
|
|
}
|
|
;
|
|
_.reset_0 = function reset_22(){
|
|
$reset_7(this);
|
|
}
|
|
;
|
|
_.setEditValue = function setEditValue_39(n, ei){
|
|
var editDialog, idx, newModel;
|
|
if (n == 0) {
|
|
this.model = $get_4(this.models, $getElement(ei.choice).selectedIndex);
|
|
this.modelName = this.model.name_0;
|
|
this.setLastModelName(this.modelName);
|
|
$setup_3(this);
|
|
ei.newDialog = true;
|
|
}
|
|
else {
|
|
idx = 1;
|
|
if (this.hasSwapDS() && n == idx++) {
|
|
this.flags = $getState(ei.checkbox)?this.flags | this.FLAG_FLIP:this.flags & ~this.FLAG_FLIP;
|
|
}
|
|
else if (n == idx) {
|
|
newModel = new MosfetModel_0(this.model);
|
|
editDialog = new EditMosfetModelDialog(newModel, app_0, this);
|
|
!editDialog.resizeHandlerRegistration && (editDialog.resizeHandlerRegistration = addResizeHandler(new DialogBox$1(editDialog)));
|
|
$show(editDialog);
|
|
return;
|
|
}
|
|
else if (n == idx + 1) {
|
|
if (this.model.readOnly) {
|
|
alert_0(LS('This model cannot be modified. Change the model name to allow customization.'));
|
|
return;
|
|
}
|
|
editDialog = new EditMosfetModelDialog(this.model, app_0, null);
|
|
!editDialog.resizeHandlerRegistration && (editDialog.resizeHandlerRegistration = addResizeHandler(new DialogBox$1(editDialog)));
|
|
$show(editDialog);
|
|
return;
|
|
}
|
|
}
|
|
$allocNodes(this);
|
|
this.setPoints();
|
|
}
|
|
;
|
|
_.setLastModelName = function setLastModelName(n){
|
|
lastModelName_2 = n;
|
|
}
|
|
;
|
|
_.setPoints = function setPoints_34(){
|
|
$setPoints_14(this);
|
|
}
|
|
;
|
|
_.showBulk_0 = function showBulk_0(){
|
|
return this.bulkShown;
|
|
}
|
|
;
|
|
_.stamp = function stamp_35(){
|
|
$stamp_3(this);
|
|
}
|
|
;
|
|
_.startIteration = function startIteration_9(){
|
|
if (sim_0.timeStep <= 0)
|
|
return;
|
|
if (this.model.capGS > 0) {
|
|
this.geqGS = this.model.capGS / sim_0.timeStep;
|
|
this.ceqGS = -this.geqGS * this.capVoltGS;
|
|
}
|
|
if (this.model.capGD > 0) {
|
|
this.geqGD = this.model.capGD / sim_0.timeStep;
|
|
this.ceqGD = -this.geqGD * this.capVoltGD;
|
|
}
|
|
}
|
|
;
|
|
_.stepFinished = function stepFinished_14(){
|
|
$calculate(this, true);
|
|
this.bodyTerminal == 1 && (this.diodeCurrent1 = -this.diodeCurrent2);
|
|
this.bodyTerminal == 2 && (this.diodeCurrent2 = -this.diodeCurrent1);
|
|
if (this.model.capGS > 0 && this.geqGS > 0) {
|
|
this.capVoltGS = this.volts[0] - this.volts[1];
|
|
this.capCurGS = this.geqGS * this.capVoltGS + this.ceqGS;
|
|
}
|
|
if (this.model.capGD > 0 && this.geqGD > 0) {
|
|
this.capVoltGD = this.volts[0] - this.volts[2];
|
|
this.capCurGD = this.geqGD * this.capVoltGD + this.ceqGD;
|
|
}
|
|
}
|
|
;
|
|
_.undumpXml = function undumpXml_43(xml){
|
|
var beta0, vt0;
|
|
this.flags = 0;
|
|
this.flags = $parseIntAttr(xml, 'f', this.flags);
|
|
this.modelName = $parseStringAttr(xml, 'mo', null);
|
|
if (this.modelName == null) {
|
|
vt0 = $parseDoubleAttr(xml, 'vt', this.getDefaultThreshold());
|
|
beta0 = $parseDoubleAttr(xml, 'be', this.getBackwardCompatibilityBeta());
|
|
this.model = $legacyModel(this, vt0, beta0, this.flags);
|
|
this.modelName = this.model.name_0;
|
|
}
|
|
$setup_3(this);
|
|
this.pnp = (this.flags & this.FLAG_PNP) != 0?-1:1;
|
|
}
|
|
;
|
|
_.updateModels_0 = function updateModels_3(){
|
|
$setup_3(this);
|
|
this.setPoints();
|
|
}
|
|
;
|
|
_.updateModels = function(){
|
|
this.updateModels_0();
|
|
}
|
|
;
|
|
_.FLAG_BODY_DIODE_LEGACY = 0;
|
|
_.FLAG_BODY_TERMINAL_LEGACY = 0;
|
|
_.FLAG_DIGITAL_LEGACY = 0;
|
|
_.FLAG_FLIP = 0;
|
|
_.FLAG_HIDE_BULK_LEGACY = 0;
|
|
_.FLAG_PNP = 0;
|
|
_.FLAG_SHOWVT = 0;
|
|
_.FLAG_SHOW_BODY_DIODE_LEGACY = 0;
|
|
_.beta_0 = 0;
|
|
_.bodyDiodeSimulated = false;
|
|
_.bodyDiodeSymbolShown = false;
|
|
_.bodyTerminal = 0;
|
|
_.bodyTerminalShown = false;
|
|
_.bulkShown = false;
|
|
_.capCurGD = 0;
|
|
_.capCurGS = 0;
|
|
_.capVoltGD = 0;
|
|
_.capVoltGS = 0;
|
|
_.ceqGD = 0;
|
|
_.ceqGS = 0;
|
|
_.curcount_body1 = 0;
|
|
_.curcount_body2 = 0;
|
|
_.curcount_drain = 0;
|
|
_.curcount_gate = 0;
|
|
_.curcount_source = 0;
|
|
_.digitalSymbolShown = false;
|
|
_.diodeCurrent1 = 0;
|
|
_.diodeCurrent2 = 0;
|
|
_.geqGD = 0;
|
|
_.geqGS = 0;
|
|
_.gm = 0;
|
|
_.ids = 0;
|
|
_.lastv0 = 0;
|
|
_.lastv1 = 0;
|
|
_.lastv2 = 0;
|
|
_.mode = 0;
|
|
_.pcircler = 0;
|
|
_.pnp = 0;
|
|
_.vt = 0;
|
|
var lastModelName_2 = 'default';
|
|
var Lcom_lushprojects_circuitjs1_client_MosfetElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'MosfetElm', 129);
|
|
function JfetElm(xa, ya, xb, yb, f, st){
|
|
MosfetElm.call(this, xa, ya, xb, yb, f, st);
|
|
this.noDiagonal = true;
|
|
this.diode = new Diode(sim_0);
|
|
$setup(this.diode, getModelWithName_1('default'));
|
|
}
|
|
|
|
function JfetElm_0(xx, yy, pnpflag){
|
|
MosfetElm_0.call(this, xx, yy, pnpflag);
|
|
this.noDiagonal = true;
|
|
this.diode = new Diode(sim_0);
|
|
$setup(this.diode, getModelWithName_1('default'));
|
|
}
|
|
|
|
defineClass(185, 129, $intern_123, JfetElm);
|
|
_.calculateCurrent = function calculateCurrent_16(){
|
|
this.gateCurrent = this.pnp * $calculateCurrent_0(this.diode, this.pnp * (this.volts[0] - this.volts[1]));
|
|
}
|
|
;
|
|
_.doStep = function doStep_28(){
|
|
$calculate(this, false);
|
|
$doStep_0(this.diode, this.pnp * (this.volts[0] - this.volts[1]));
|
|
}
|
|
;
|
|
_.draw = function draw_39(g){
|
|
$setBbox_0(this, this.point1, this.point2, 16);
|
|
$setVoltageColor(this, g, this.volts[1]);
|
|
drawThickLine_0(g, this.src_0[0], this.src_0[1], 3);
|
|
drawThickLine_0(g, this.src_0[1], this.src_0[2], 3);
|
|
$setVoltageColor(this, g, this.volts[2]);
|
|
drawThickLine_0(g, this.drn[0], this.drn[1], 3);
|
|
drawThickLine_0(g, this.drn[1], this.drn[2], 3);
|
|
$setVoltageColor(this, g, this.volts[0]);
|
|
drawThickLine_0(g, this.point1, this.gatePt, 3);
|
|
$fillPolygon(g, this.arrowPoly);
|
|
$setPowerColor_0(this, g);
|
|
$fillPolygon(g, this.gatePoly);
|
|
this.curcountd = $updateDotCount(-this.ids, this.curcountd);
|
|
this.curcountg = $updateDotCount(this.gateCurrent, this.curcountg);
|
|
this.curcounts = $updateDotCount(-this.gateCurrent - this.ids, this.curcounts);
|
|
if (this.curcountd != 0 || this.curcounts != 0) {
|
|
$drawDots(g, this.src_0[0], this.src_0[1], this.curcounts);
|
|
$drawDots(g, this.src_0[1], this.src_0[2], $addCurCount(this.curcounts, 8));
|
|
$drawDots(g, this.drn[0], this.drn[1], -this.curcountd);
|
|
$drawDots(g, this.drn[1], this.drn[2], -$addCurCount(this.curcountd, 8));
|
|
$drawDots(g, this.point1, this.gatePt, this.curcountg);
|
|
}
|
|
$drawPosts(this, g);
|
|
}
|
|
;
|
|
_.getBackwardCompatibilityBeta = function getBackwardCompatibilityBeta_0(){
|
|
return 0.00125;
|
|
}
|
|
;
|
|
_.getConnection = function getConnection_21(n1, n2){
|
|
return true;
|
|
}
|
|
;
|
|
_.getCurrentIntoNode = function getCurrentIntoNode_16(n){
|
|
if (n == 0)
|
|
return -this.gateCurrent;
|
|
if (n == 1)
|
|
return this.gateCurrent + this.ids;
|
|
return -this.ids;
|
|
}
|
|
;
|
|
_.getDefaultThreshold = function getDefaultThreshold_0(){
|
|
return -4;
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_53(){
|
|
return 106;
|
|
}
|
|
;
|
|
_.getElmType = function getElmType_11(){
|
|
return 'JFET';
|
|
}
|
|
;
|
|
_.getInfo_0 = function getInfo_46(arr){
|
|
$getFetInfo(this, arr, 'JFET');
|
|
}
|
|
;
|
|
_.getLastModelName = function getLastModelName_0(){
|
|
return lastJfetModelName;
|
|
}
|
|
;
|
|
_.getScopeText = function getScopeText_3(v){
|
|
return LS((this.pnp == -1?'p-':'n-') + 'JFET');
|
|
}
|
|
;
|
|
_.hasSwapDS = function hasSwapDS_0(){
|
|
return false;
|
|
}
|
|
;
|
|
_.isJfet = function isJfet_0(){
|
|
return true;
|
|
}
|
|
;
|
|
_.reset_0 = function reset_23(){
|
|
$reset_7(this);
|
|
this.diode.lastvoltdiff = 0;
|
|
}
|
|
;
|
|
_.setLastModelName = function setLastModelName_0(n){
|
|
lastJfetModelName = n;
|
|
}
|
|
;
|
|
_.setPoints = function setPoints_35(){
|
|
var hs2, ra, x_0;
|
|
$setPoints_14(this);
|
|
hs2 = 16 * this.dsign;
|
|
this.src_0 = $newPointArray(3);
|
|
this.drn = $newPointArray(3);
|
|
$interpPoint2(this.point1, this.point2, this.src_0[0], this.drn[0], 1, -hs2);
|
|
$interpPoint2(this.point1, this.point2, this.src_0[1], this.drn[1], 1, -hs2 / 2 | 0);
|
|
$interpPoint2(this.point1, this.point2, this.src_0[2], this.drn[2], 1 - 10 / this.dn, -hs2 / 2 | 0);
|
|
this.gatePt = $interpPoint(this.point1, this.point2, 1 - 14 / this.dn);
|
|
ra = $newPointArray(4);
|
|
$interpPoint2(this.point1, this.point2, ra[0], ra[1], 1 - 13 / this.dn, 16);
|
|
$interpPoint2(this.point1, this.point2, ra[2], ra[3], 1 - 10 / this.dn, 16);
|
|
this.gatePoly = $createPolygon_0(ra[0], ra[1], ra[3], ra[2]);
|
|
if (this.pnp == -1) {
|
|
x_0 = $interpPoint(this.gatePt, this.point1, 18 / this.dn);
|
|
this.arrowPoly = $calcArrow(this.gatePt, x_0, 8, 3);
|
|
}
|
|
else
|
|
this.arrowPoly = $calcArrow(this.point1, this.gatePt, 8, 3);
|
|
}
|
|
;
|
|
_.showBulk_0 = function showBulk_1(){
|
|
return false;
|
|
}
|
|
;
|
|
_.stamp = function stamp_36(){
|
|
$stamp_3(this);
|
|
this.pnp < 0?$stamp_0(this.diode, this.nodes[1], this.nodes[0]):$stamp_0(this.diode, this.nodes[0], this.nodes[1]);
|
|
}
|
|
;
|
|
_.curcountd = 0;
|
|
_.curcountg = 0;
|
|
_.curcounts = 0;
|
|
_.gateCurrent = 0;
|
|
var lastJfetModelName = 'default-jfet';
|
|
var Lcom_lushprojects_circuitjs1_client_JfetElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'JfetElm', 185);
|
|
function $clinit_KeyNames(){
|
|
$clinit_KeyNames = emptyMethod;
|
|
isMac = $wnd.navigator.platform.toLowerCase().indexOf('mac') != -1;
|
|
NONPRINTING_KEYCODES = stampJavaTypeInfo(getClassLiteralForArray(I_classLit, 1), $intern_25, 7, 15, [36, 35, 33, 34, 45, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123]);
|
|
}
|
|
|
|
function displayName(c){
|
|
var code_0, keyCode, mods, sb;
|
|
code_0 = c - 300;
|
|
if (code_0 < 0)
|
|
return null;
|
|
keyCode = code_0 & 255;
|
|
mods = code_0 >> 8;
|
|
if ((mods & -16) != 0)
|
|
return null;
|
|
sb = new StringBuilder;
|
|
(mods & 2) != 0 && (sb.string += 'Ctrl-' , sb);
|
|
(mods & 4) != 0 && $append_4(sb, isMac?'Opt-':'Alt-');
|
|
(mods & 8) != 0 && $append_4(sb, isMac?'Cmd-':'Win-');
|
|
(mods & 1) != 0 && (sb.string += 'Shift-' , sb);
|
|
$append_4(sb, keyLabel(keyCode));
|
|
return sb.string;
|
|
}
|
|
|
|
function displayText(shortcut){
|
|
$clinit_KeyNames();
|
|
var name_0;
|
|
if (shortcut == null || shortcut.length != 1)
|
|
return shortcut;
|
|
checkCriticalStringElementIndex(0, shortcut.length);
|
|
if (shortcut.charCodeAt(0) == 32)
|
|
return 'Space';
|
|
name_0 = displayName((checkCriticalStringElementIndex(0, shortcut.length) , shortcut.charCodeAt(0)));
|
|
return name_0 != null?name_0:shortcut;
|
|
}
|
|
|
|
function isModifierKeyCode(keyCode){
|
|
switch (keyCode) {
|
|
case 16:
|
|
case 17:
|
|
case 18:
|
|
case 91:
|
|
case 92:
|
|
case 93:
|
|
case 224:
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
function isNonPrinting(keyCode){
|
|
var i;
|
|
for (i = 0; i != NONPRINTING_KEYCODES.length; i++)
|
|
if (NONPRINTING_KEYCODES[i] == keyCode)
|
|
return true;
|
|
return false;
|
|
}
|
|
|
|
function keyCodeToPlaceholder(keyCode, shift_0, ctrl, alt_0, meta){
|
|
$clinit_KeyNames();
|
|
var mods;
|
|
if (!usesKeyCodePath(keyCode, ctrl, alt_0, meta))
|
|
return -1;
|
|
mods = (shift_0?1:0) | (ctrl?2:0) | (alt_0?4:0) | (meta?8:0);
|
|
return 300 + keyCode + (mods << 8);
|
|
}
|
|
|
|
function keyLabel(keyCode){
|
|
switch (keyCode) {
|
|
case 36:
|
|
return 'Home';
|
|
case 35:
|
|
return 'End';
|
|
case 33:
|
|
return 'Page Up';
|
|
case 34:
|
|
return 'Page Down';
|
|
case 45:
|
|
return 'Insert';
|
|
case 112:
|
|
return 'F1';
|
|
case 113:
|
|
return 'F2';
|
|
case 114:
|
|
return 'F3';
|
|
case 115:
|
|
return 'F4';
|
|
case 116:
|
|
return 'F5';
|
|
case 117:
|
|
return 'F6';
|
|
case 118:
|
|
return 'F7';
|
|
case 119:
|
|
return 'F8';
|
|
case 120:
|
|
return 'F9';
|
|
case 121:
|
|
return 'F10';
|
|
case 122:
|
|
return 'F11';
|
|
case 123:
|
|
return 'F12';
|
|
case 186:
|
|
return ';';
|
|
case 187:
|
|
return '=';
|
|
case 188:
|
|
return ',';
|
|
case 189:
|
|
return '-';
|
|
case 190:
|
|
return '.';
|
|
case 191:
|
|
return '/';
|
|
case 192:
|
|
return '`';
|
|
case 219:
|
|
return '[';
|
|
case 220:
|
|
return '\\';
|
|
case 221:
|
|
return ']';
|
|
case 222:
|
|
return "'";
|
|
}
|
|
if (keyCode >= 65 && keyCode <= 90)
|
|
return String.fromCharCode(keyCode & $intern_8);
|
|
if (keyCode >= 48 && keyCode <= 57)
|
|
return String.fromCharCode(keyCode & $intern_8);
|
|
return 'Key' + keyCode;
|
|
}
|
|
|
|
function usesKeyCodePath(keyCode, ctrl, alt_0, meta){
|
|
if (isModifierKeyCode(keyCode))
|
|
return false;
|
|
return ctrl || alt_0 || meta || isNonPrinting(keyCode);
|
|
}
|
|
|
|
var NONPRINTING_KEYCODES, isMac = false;
|
|
function $calcResistance(this$static, lux){
|
|
var r;
|
|
r = (this$static.maxLux - lux + 1) * 10;
|
|
r = toDouble_0(fromDouble_0($wnd.Math.round(r)));
|
|
return r;
|
|
}
|
|
|
|
function $createSlider_1(this$static){
|
|
var value_0;
|
|
$addWidgetToVerticalPanel(app_0, this$static.label_0 = new Label_1(this$static.sliderText));
|
|
$addStyleName(this$static.label_0, 'topSpace');
|
|
value_0 = round_int(this$static.position * 100);
|
|
$addWidgetToVerticalPanel(app_0, this$static.slider = new Scrollbar_1(value_0, this$static, this$static));
|
|
}
|
|
|
|
function $setPoints_15(this$static){
|
|
$setPoints(this$static);
|
|
$calcLeads(this$static, 32);
|
|
this$static.position = this$static.slider.val_0 * $intern_124 + $intern_87;
|
|
this$static.lux = this$static.maxLux * this$static.position + this$static.minLux;
|
|
this$static.resistance = $calcResistance(this$static, this$static.lux);
|
|
new Point_1;
|
|
new Point_1;
|
|
}
|
|
|
|
function LDRElm(xx, yy){
|
|
CircuitElm.call(this, xx, yy);
|
|
this.minLux = 0.1;
|
|
this.maxLux = $intern_88;
|
|
this.position = 0.34;
|
|
this.lux = this.maxLux * this.position + this.minLux;
|
|
this.resistance = $calcResistance(this, this.lux);
|
|
this.sliderText = LS('Light Brightness');
|
|
$createSlider_1(this);
|
|
}
|
|
|
|
function LDRElm_0(xa, ya, xb, yb, f, st){
|
|
CircuitElm_0.call(this, xa, ya, xb, yb, f);
|
|
this.minLux = 0.1;
|
|
this.maxLux = $intern_88;
|
|
this.position = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.lux = this.maxLux * this.position + this.minLux;
|
|
this.resistance = $calcResistance(this, this.lux);
|
|
this.sliderText = unescape_0($nextToken(st));
|
|
$createSlider_1(this);
|
|
}
|
|
|
|
defineClass(410, 8, $intern_125, LDRElm, LDRElm_0);
|
|
_.calculateCurrent = function calculateCurrent_17(){
|
|
this.current_0 = (this.volts[0] - this.volts[1]) / this.resistance;
|
|
}
|
|
;
|
|
_.delete_0 = function delete_3(){
|
|
$removeWidgetFromVerticalPanel(app_0, this.label_0);
|
|
$removeWidgetFromVerticalPanel(app_0, this.slider);
|
|
}
|
|
;
|
|
_.draw = function draw_40(g){
|
|
var grad, i, len, s, v1, v2;
|
|
v1 = this.volts[0];
|
|
v2 = this.volts[1];
|
|
$setBbox_0(this, this.point1, this.point2, 6);
|
|
$draw2Leads(this, g);
|
|
$setPowerColor_0(this, g);
|
|
len = distance(this.lead1, this.lead2);
|
|
g.context.save();
|
|
g.context.lineWidth = 3;
|
|
$transform(g.context, (this.lead2.x_0 - this.lead1.x_0) / len, (this.lead2.y_0 - this.lead1.y_0) / len, -(this.lead2.y_0 - this.lead1.y_0) / len, (this.lead2.x_0 - this.lead1.x_0) / len, this.lead1.x_0, this.lead1.y_0);
|
|
grad = $createLinearGradient(g.context, 0, 0, len, 0);
|
|
$addColorStop(grad, 0, $getHexValue($getVoltageColor(this, v1)));
|
|
$addColorStop(grad, 1, $getHexValue($getVoltageColor(this, v2)));
|
|
$setStrokeStyleWeb(g.context, grad);
|
|
if (app_0.menus.euroResistorCheckItem.on) {
|
|
$strokeRect(g.context, 0, -6, len, 12);
|
|
}
|
|
else {
|
|
g.context.beginPath();
|
|
g.context.moveTo(0, 0);
|
|
for (i = 0; i < 4; i++) {
|
|
$lineTo(g.context, (1 + 4 * i) * len / 16, 6);
|
|
$lineTo(g.context, (3 + 4 * i) * len / 16, -6);
|
|
}
|
|
$lineTo(g.context, len, 0);
|
|
g.context.stroke();
|
|
}
|
|
g.context.beginPath();
|
|
g.context.moveTo(-8, 26);
|
|
g.context.lineTo(8, 12);
|
|
g.context.moveTo(2, 12);
|
|
g.context.lineTo(8, 12);
|
|
g.context.lineTo(8, 18);
|
|
g.context.moveTo(12, 26);
|
|
g.context.lineTo(26, 12);
|
|
g.context.moveTo(20, 12);
|
|
g.context.lineTo(26, 12);
|
|
g.context.lineTo(26, 18);
|
|
g.context.stroke();
|
|
g.context.restore();
|
|
if (app_0.menus.showValuesCheckItem.on) {
|
|
this.lux = this.maxLux * this.position + this.minLux;
|
|
this.resistance = $calcResistance(this, this.lux);
|
|
s = getUnitText(this.resistance, '', true);
|
|
$drawValues(this, g, s + '\u03A9', 6);
|
|
}
|
|
this.curcount_0 = $updateDotCount(this.current_0, this.curcount_0);
|
|
app_0.mouse.dragElm == this || $drawDots(g, this.point1, this.point2, this.curcount_0);
|
|
$drawPosts(this, g);
|
|
}
|
|
;
|
|
_.dumpXml = function dumpXml_42(doc, elem){
|
|
dumpAttr_1(elem, 'x', this.x_0 + ' ' + this.y_0 + ' ' + this.x2 + ' ' + this.y2);
|
|
dumpAttr_0(elem, 'f', this.flags);
|
|
dumpAttr(elem, 'ps', this.position);
|
|
dumpAttr_1(elem, 'st', this.sliderText);
|
|
}
|
|
;
|
|
_.execute_1 = function execute_27(){
|
|
app_0.analyzeFlag = true;
|
|
$setPoints_15(this);
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_54(){
|
|
return 374;
|
|
}
|
|
;
|
|
_.getEditInfo = function getEditInfo_40(n){
|
|
var ei;
|
|
if (n == 0) {
|
|
ei = new EditInfo_0('Slider Text', 0, -1, -1);
|
|
ei.text_0 = this.sliderText;
|
|
return ei;
|
|
}
|
|
return null;
|
|
}
|
|
;
|
|
_.getInfo_0 = function getInfo_47(arr){
|
|
arr[0] = 'photoresistor';
|
|
arr[1] = 'I = ' + getUnitText($wnd.Math.abs(this.current_0), 'A', false);
|
|
arr[2] = 'Vd = ' + getUnitText($wnd.Math.abs(this.volts[0] - this.volts[1]), 'V', false);
|
|
arr[3] = 'R = ' + getUnitText(this.resistance, ohmString, false);
|
|
arr[4] = 'P = ' + getUnitText((this.volts[0] - this.volts[1]) * this.current_0, 'W', false);
|
|
}
|
|
;
|
|
_.getPostCount_0 = function getPostCount_39(){
|
|
return 2;
|
|
}
|
|
;
|
|
_.onMouseWheel = function onMouseWheel_0(e){
|
|
!!this.slider && $onMouseWheel_0(this.slider, e);
|
|
}
|
|
;
|
|
_.setEditValue = function setEditValue_40(n, ei){
|
|
if (n == 0) {
|
|
this.sliderText = $getText(ei.textf);
|
|
$setText_0(this.label_0, this.sliderText);
|
|
$setiFrameHeight(app_0.ui);
|
|
}
|
|
this.lux = this.maxLux * this.position + this.minLux;
|
|
this.resistance = $calcResistance(this, this.lux);
|
|
}
|
|
;
|
|
_.setMouseElm = function setMouseElm_0(v){
|
|
v?(mouseElmRef = this):mouseElmRef == this && (mouseElmRef = null);
|
|
!!this.slider && $draw_6(this.slider);
|
|
}
|
|
;
|
|
_.setPoints = function setPoints_36(){
|
|
$setPoints_15(this);
|
|
}
|
|
;
|
|
_.stamp = function stamp_37(){
|
|
this.lux = this.maxLux * this.position + this.minLux;
|
|
this.resistance = $calcResistance(this, this.lux);
|
|
$stampResistor(this.nodes[0], this.nodes[1], this.resistance);
|
|
}
|
|
;
|
|
_.undumpXml = function undumpXml_44(xml){
|
|
var value_0;
|
|
this.flags = $parseIntAttr(xml, 'f', this.flags);
|
|
this.position = $parseDoubleAttr(xml, 'ps', this.position);
|
|
this.sliderText = $parseStringAttr(xml, 'st', this.sliderText);
|
|
this.lux = this.maxLux * this.position + this.minLux;
|
|
this.resistance = $calcResistance(this, this.lux);
|
|
value_0 = round_int(this.position * 100);
|
|
$setValue_2(this.slider, value_0);
|
|
$setText_0(this.label_0, this.sliderText);
|
|
}
|
|
;
|
|
_.lux = 0;
|
|
_.maxLux = 0;
|
|
_.minLux = 0;
|
|
_.position = 0;
|
|
_.resistance = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_LDRElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'LDRElm', 410);
|
|
function $setColor_2(this$static, g, p){
|
|
var cc, w;
|
|
if (this$static.currents == null) {
|
|
$setColor_0(g, new Color(20, 0, 0));
|
|
return;
|
|
}
|
|
w = this$static.currents[p] / $intern_34;
|
|
w > 0 && (w = 255 * (1 + 0.2 * $wnd.Math.log(w)));
|
|
w > 255 && (w = 255);
|
|
w < 20 && (w = 20);
|
|
w = $wnd.Math.max(w, this$static.brightness[p]);
|
|
this$static.brightness[p] = w * this$static.decayMultiplier;
|
|
cc = new Color(round_int(w), 0, 0);
|
|
$setColor_0(g, cc);
|
|
}
|
|
|
|
function $setupPins_14(this$static){
|
|
var i;
|
|
if (this$static.sizeX == 0 || this$static.sizeY == 0) {
|
|
this$static.sizeX = this$static.sizeY = 8;
|
|
$allocNodes(this$static);
|
|
}
|
|
this$static.pins = initUnidimensionalArray(Lcom_lushprojects_circuitjs1_client_ChipElm$Pin_2_classLit, $intern_3, 9, this$static.sizeX + this$static.sizeY, 0, 1);
|
|
for (i = 0; i != this$static.sizeX; i++)
|
|
this$static.pins[i] = new ChipElm$Pin(this$static, i, 1, '');
|
|
for (i = 0; i != this$static.sizeY; i++)
|
|
this$static.pins[i + this$static.sizeX] = new ChipElm$Pin(this$static, i, 2, '');
|
|
this$static.brightness = initUnidimensionalArray(D_classLit, $intern_76, 7, this$static.sizeX * this$static.sizeY, 15, 1);
|
|
}
|
|
|
|
function LEDArrayElm(xx, yy){
|
|
$clinit_ChipElm();
|
|
ChipElm.call(this, xx, yy);
|
|
this.decayMultiplier = 1;
|
|
}
|
|
|
|
function LEDArrayElm_0(xa, ya, xb, yb, f, st){
|
|
$clinit_ChipElm();
|
|
ChipElm_0.call(this, xa, ya, xb, yb, f, st);
|
|
this.decayMultiplier = 1;
|
|
try {
|
|
this.sizeX = __parseAndValidateInt($nextToken(st), 10);
|
|
this.sizeY = __parseAndValidateInt($nextToken(st), 10);
|
|
}
|
|
catch ($e0) {
|
|
$e0 = toJava($e0);
|
|
if (!instanceOf($e0, 13))
|
|
throw toJs($e0);
|
|
}
|
|
$allocNodes(this);
|
|
$setupPins_14(this);
|
|
$setPoints_0(this);
|
|
}
|
|
|
|
defineClass(397, 32, $intern_85, LEDArrayElm, LEDArrayElm_0);
|
|
_.calculateCurrent = function calculateCurrent_18(){
|
|
var cur, i, ix, iy;
|
|
i = 0;
|
|
for (ix = 0; ix != this.sizeX; ix++)
|
|
this.pins[ix].current = 0;
|
|
if (this.diodes == null)
|
|
return;
|
|
for (iy = 0; iy != this.sizeY; iy++) {
|
|
cur = 0;
|
|
for (ix = 0; ix != this.sizeX; ++ix , i++) {
|
|
this.currents[i] = $calculateCurrent_0(this.diodes[i], this.volts[this.sizeX + iy] - this.volts[ix]);
|
|
cur += this.currents[i];
|
|
this.pins[ix].current += this.currents[i];
|
|
}
|
|
this.pins[iy + this.sizeX].current = -cur;
|
|
}
|
|
}
|
|
;
|
|
_.doStep = function doStep_29(){
|
|
var i, ix, iy;
|
|
$doStep(this);
|
|
i = 0;
|
|
for (iy = 0; iy != this.sizeY; iy++)
|
|
for (ix = 0; ix != this.sizeX; ++ix , i++)
|
|
$doStep_0(this.diodes[i], this.volts[this.sizeX + iy] - this.volts[ix]);
|
|
}
|
|
;
|
|
_.draw = function draw_41(g){
|
|
var elapsed, i, ix, iy;
|
|
elapsed = sim_0.t - this.lastDrawTime;
|
|
this.lastDrawTime = sim_0.t;
|
|
this.decayMultiplier = elapsed > 0?$wnd.Math.exp(-elapsed / 0.03):1;
|
|
$drawChip(this, g);
|
|
for (ix = 0; ix != this.sizeX; ix++)
|
|
for (iy = 0; iy != this.sizeY; iy++) {
|
|
i = ix + iy * this.sizeX;
|
|
$setColor_2(this, g, i);
|
|
(this.flags & $intern_42) != 0?$fillOval(g, this.pins[iy + this.sizeX].post.x_0 - (this.cspc / 2 | 0), this.pins[ix].post.y_0 - (this.cspc / 2 | 0), this.cspc):$fillOval(g, this.pins[ix].post.x_0 - (this.cspc / 2 | 0), this.pins[iy + this.sizeX].post.y_0 - (this.cspc / 2 | 0), this.cspc);
|
|
}
|
|
}
|
|
;
|
|
_.dumpXml = function dumpXml_43(doc, elem){
|
|
$dumpXml_0(this, elem);
|
|
dumpAttr_0(elem, 'sx', this.sizeX);
|
|
dumpAttr_0(elem, 'sy', this.sizeY);
|
|
}
|
|
;
|
|
_.getChipEditInfo = function getChipEditInfo_14(n){
|
|
if (n == 0)
|
|
return $setDimensionless(new EditInfo('Grid Width', this.sizeX));
|
|
if (n == 1)
|
|
return $setDimensionless(new EditInfo('Grid Height', this.sizeY));
|
|
return null;
|
|
}
|
|
;
|
|
_.getChipName = function getChipName_17(){
|
|
return 'LED array';
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_55(){
|
|
return 405;
|
|
}
|
|
;
|
|
_.getInfo_0 = function getInfo_48(arr){
|
|
arr[0] = 'LED array';
|
|
return;
|
|
}
|
|
;
|
|
_.getMatrixConnection = function getMatrixConnection_6(n1, n2){
|
|
return true;
|
|
}
|
|
;
|
|
_.getPostCount_0 = function getPostCount_40(){
|
|
return this.sizeX + this.sizeY;
|
|
}
|
|
;
|
|
_.getVoltageSourceCount = function getVoltageSourceCount_34(){
|
|
return 0;
|
|
}
|
|
;
|
|
_.isDigitalChip = function isDigitalChip_4(){
|
|
return false;
|
|
}
|
|
;
|
|
_.nonLinear_0 = function nonLinear_11(){
|
|
return true;
|
|
}
|
|
;
|
|
_.reset_0 = function reset_24(){
|
|
this.brightness = initUnidimensionalArray(D_classLit, $intern_76, 7, this.sizeX * this.sizeY, 15, 1);
|
|
}
|
|
;
|
|
_.setChipEditValue = function setChipEditValue_15(n, ei){
|
|
if (n == 0) {
|
|
if (ei.value_0 >= 2 && ei.value_0 <= 16) {
|
|
this.sizeX = round_int(ei.value_0);
|
|
$allocNodes(this);
|
|
$setupPins_14(this);
|
|
$setPoints_0(this);
|
|
}
|
|
else
|
|
ei.error = 'must be between 2 and 16';
|
|
return;
|
|
}
|
|
if (n == 1) {
|
|
if (ei.value_0 >= 2 && ei.value_0 <= 16) {
|
|
this.sizeY = round_int(ei.value_0);
|
|
$allocNodes(this);
|
|
$setupPins_14(this);
|
|
$setPoints_0(this);
|
|
}
|
|
else
|
|
ei.error = 'must be between 2 and 16';
|
|
return;
|
|
}
|
|
}
|
|
;
|
|
_.setupPins = function setupPins_18(){
|
|
$setupPins_14(this);
|
|
}
|
|
;
|
|
_.stamp = function stamp_38(){
|
|
var i, model;
|
|
$stamp(this);
|
|
this.diodes = initUnidimensionalArray(Lcom_lushprojects_circuitjs1_client_Diode_2_classLit, $intern_3, 130, this.sizeX * this.sizeY, 0, 1);
|
|
model = getModelWithName_1('default-led');
|
|
for (i = 0; i != this.diodes.length; i++) {
|
|
this.diodes[i] = new Diode(sim_0);
|
|
$setup(this.diodes[i], model);
|
|
$stamp_0(this.diodes[i], this.nodes[this.sizeX + (i / this.sizeX | 0)], this.nodes[i % this.sizeX]);
|
|
}
|
|
this.currents = initUnidimensionalArray(D_classLit, $intern_76, 7, this.diodes.length, 15, 1);
|
|
}
|
|
;
|
|
_.stepFinished = function stepFinished_15(){
|
|
var i;
|
|
for (i = 0; i != this.currents.length; i++)
|
|
$wnd.Math.abs(this.currents[i]) > $intern_81 && $stop(sim_0, 'max current exceeded', this);
|
|
}
|
|
;
|
|
_.undumpXml = function undumpXml_45(xml){
|
|
$undumpXml_0(this, xml);
|
|
this.sizeX = $parseIntAttr(xml, 'sx', this.sizeX);
|
|
this.sizeY = $parseIntAttr(xml, 'sy', this.sizeY);
|
|
$allocNodes(this);
|
|
$setupPins_14(this);
|
|
$setPoints_0(this);
|
|
}
|
|
;
|
|
_.decayMultiplier = 0;
|
|
_.lastDrawTime = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_LEDArrayElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'LEDArrayElm', 397);
|
|
function LEDElm(xx, yy){
|
|
DiodeElm.call(this, xx, yy);
|
|
this.modelName = lastLEDModelName;
|
|
$setup_0(this);
|
|
this.maxBrightnessCurrent = $intern_34;
|
|
this.colorR = 1;
|
|
this.colorG = this.colorB = 0;
|
|
}
|
|
|
|
function LEDElm_0(xa, ya, xb, yb, f, st){
|
|
DiodeElm_0.call(this, xa, ya, xb, yb, f, st);
|
|
if ((f & 3) == 0) {
|
|
this.model = getModelWithParameters(2.1024259, 0);
|
|
this.modelName = this.model.name_0;
|
|
console_0('model name wparams = ' + this.modelName);
|
|
$setup_0(this);
|
|
}
|
|
this.colorR = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.colorG = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.colorB = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.maxBrightnessCurrent = $intern_34;
|
|
try {
|
|
this.maxBrightnessCurrent = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
}
|
|
catch ($e0) {
|
|
$e0 = toJava($e0);
|
|
if (!instanceOf($e0, 13))
|
|
throw toJs($e0);
|
|
}
|
|
}
|
|
|
|
defineClass(434, 154, $intern_110, LEDElm, LEDElm_0);
|
|
_.draw = function draw_42(g){
|
|
var cc, cr, w;
|
|
if (mouseElmRef == this || this.selected_0 || $containsKey(app_0.mouse.scopePlotRoles, this) || instanceOf(mouseElmRef, 21) && $getElm_0(mouseElmRef.elmScope) == this || $isOnHighlightedNet(this) || app_0.mouse.dragElm == this) {
|
|
$draw_0(this, g);
|
|
return;
|
|
}
|
|
$setVoltageColor(this, g, this.volts[0]);
|
|
drawThickLine_0(g, this.point1, this.ledLead1, 3);
|
|
$setVoltageColor(this, g, this.volts[1]);
|
|
drawThickLine_0(g, this.ledLead2, this.point2, 3);
|
|
$setColor_0(g, ($clinit_Color() , gray));
|
|
cr = 12;
|
|
drawThickCircle(g, this.ledCenter.x_0, this.ledCenter.y_0, 12);
|
|
cr -= 4;
|
|
w = this.current_0 / this.maxBrightnessCurrent;
|
|
w > 0 && (w = 255 * (1 + 0.2 * $wnd.Math.log(w)));
|
|
w > 255 && (w = 255);
|
|
w < 0 && (w = 0);
|
|
cc = new Color(round_int(this.colorR * w), round_int(this.colorG * w), round_int(this.colorB * w));
|
|
$setColor_0(g, cc);
|
|
$fillOval(g, this.ledCenter.x_0 - cr, this.ledCenter.y_0 - cr, cr * 2);
|
|
$setBbox_0(this, this.point1, this.point2, cr);
|
|
this.curcount_0 = $updateDotCount(this.current_0, this.curcount_0);
|
|
$drawDots(g, this.point1, this.ledLead1, this.curcount_0);
|
|
$drawDots(g, this.point2, this.ledLead2, -this.curcount_0);
|
|
$drawPosts(this, g);
|
|
}
|
|
;
|
|
_.dumpXml = function dumpXml_44(doc, elem){
|
|
$dumpXml_6(this, doc, elem);
|
|
dumpAttr(elem, 'cr', this.colorR);
|
|
dumpAttr(elem, 'cg', this.colorG);
|
|
dumpAttr(elem, 'cb', this.colorB);
|
|
dumpAttr(elem, 'mbc', this.maxBrightnessCurrent);
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_56(){
|
|
return 162;
|
|
}
|
|
;
|
|
_.getEditInfo = function getEditInfo_41(n){
|
|
if (n == 0)
|
|
return $setDimensionless(new EditInfo_0('Red Value (0-1)', this.colorR, 0, 1));
|
|
if (n == 1)
|
|
return $setDimensionless(new EditInfo_0('Green Value (0-1)', this.colorG, 0, 1));
|
|
if (n == 2)
|
|
return $setDimensionless(new EditInfo_0('Blue Value (0-1)', this.colorB, 0, 1));
|
|
if (n == 3)
|
|
return new EditInfo_0('Max Brightness Current (A)', this.maxBrightnessCurrent, 0, 0.1);
|
|
return $getEditInfo_3(this, n - 4);
|
|
}
|
|
;
|
|
_.getElmType = function getElmType_12(){
|
|
return 'LED';
|
|
}
|
|
;
|
|
_.getInfo_0 = function getInfo_49(arr){
|
|
$getInfo_3(this, arr);
|
|
this.model.oldStyle?(arr[0] = 'LED'):(arr[0] = LS('LED') + ' (' + this.modelName + ')');
|
|
}
|
|
;
|
|
_.getShortcut = function getShortcut_19(){
|
|
return 108;
|
|
}
|
|
;
|
|
_.setEditValue = function setEditValue_41(n, ei){
|
|
n == 0 && (this.colorR = ei.value_0);
|
|
n == 1 && (this.colorG = ei.value_0);
|
|
n == 2 && (this.colorB = ei.value_0);
|
|
n == 3 && (this.maxBrightnessCurrent = ei.value_0);
|
|
$setEditValue_4(this, n - 4, ei);
|
|
}
|
|
;
|
|
_.setPoints = function setPoints_37(){
|
|
$setPoints_10(this);
|
|
this.ledLead1 = $interpPoint(this.point1, this.point2, 0.5 - 12 / this.dn);
|
|
this.ledLead2 = $interpPoint(this.point1, this.point2, 0.5 + 12 / this.dn);
|
|
this.ledCenter = $interpPoint(this.point1, this.point2, 0.5);
|
|
}
|
|
;
|
|
_.undumpXml = function undumpXml_46(xml){
|
|
$undumpXml_4(this, xml);
|
|
this.colorR = $parseDoubleAttr(xml, 'cr', this.colorR);
|
|
this.colorG = $parseDoubleAttr(xml, 'cg', this.colorG);
|
|
this.colorB = $parseDoubleAttr(xml, 'cb', this.colorB);
|
|
this.maxBrightnessCurrent = $parseDoubleAttr(xml, 'mbc', this.maxBrightnessCurrent);
|
|
}
|
|
;
|
|
_.colorB = 0;
|
|
_.colorG = 0;
|
|
_.colorR = 0;
|
|
_.maxBrightnessCurrent = 0;
|
|
var lastLEDModelName = 'default-led';
|
|
var Lcom_lushprojects_circuitjs1_client_LEDElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'LEDElm', 434);
|
|
function $$init_10(this$static){
|
|
this$static.busWidth = 1;
|
|
}
|
|
|
|
function $drawLabeledNode_0(this$static, g, str, pt1, pt2){
|
|
if ((this$static.flags & 8) != 0 && pt1.x_0 == pt2.x_0) {
|
|
$drawRotatedLabeledNode(this$static, g, str, pt1, pt2);
|
|
return;
|
|
}
|
|
$drawLabeledNode(this$static, g, str, pt1, pt2);
|
|
}
|
|
|
|
function $drawRotatedLabeledNode(this$static, g, str, pt1, pt2){
|
|
var dir_0, h, lineOver, offset, tx, ty, w, xa;
|
|
lineOver = false;
|
|
if ($equals_1(str.substr(0, 1), '/')) {
|
|
lineOver = true;
|
|
str = str.substr(1);
|
|
}
|
|
w = round_int($measureText(g.context, str).width);
|
|
h = g.currentFontSize;
|
|
g.context.save();
|
|
g.savedFontSize = g.currentFontSize;
|
|
g.context.textBaseline = 'middle';
|
|
dir_0 = sign_0(pt2.y_0 - pt1.y_0);
|
|
offset = h + $wnd.Math.max(0, (w / 2 | 0) - h);
|
|
tx = pt2.x_0;
|
|
ty = pt2.y_0 + dir_0 * offset;
|
|
$translate(g.context, tx, ty);
|
|
g.context.rotate($intern_96);
|
|
g.context.textAlign = 'center';
|
|
$fillText(g.context, str, 0, 0);
|
|
$adjustBbox(this$static, tx - (h / 2 | 0), ty - (w / 2 | 0), tx + (h / 2 | 0), ty + (w / 2 | 0));
|
|
g.context.restore();
|
|
g.currentFontSize = g.savedFontSize;
|
|
if (lineOver) {
|
|
xa = (-h / 2 | 0) - 1;
|
|
g.context.save();
|
|
g.savedFontSize = g.currentFontSize;
|
|
$translate(g.context, tx, ty);
|
|
g.context.rotate($intern_96);
|
|
$drawLine(g, -w / 2 | 0, xa, w / 2 | 0, xa);
|
|
g.context.restore();
|
|
g.currentFontSize = g.savedFontSize;
|
|
}
|
|
}
|
|
|
|
function $getBusValue(this$static){
|
|
var i, value_0;
|
|
value_0 = 0;
|
|
for (i = 0; i < this$static.busWidth; i++)
|
|
this$static.volts[i] > 2.5 && (value_0 |= 1 << i);
|
|
return value_0;
|
|
}
|
|
|
|
function $getConnectedPost(this$static, n){
|
|
var key, le, myPost;
|
|
key = this$static.busWidth > 1?this$static.text_0 + ':' + n:this$static.text_0;
|
|
myPost = $getPost_1(this$static, n);
|
|
le = $getStringValue(labelList, key);
|
|
if (le)
|
|
return le.point;
|
|
le = new LabeledNodeElm$LabelEntry;
|
|
le.point = myPost;
|
|
$putStringValue(labelList, key, le);
|
|
return null;
|
|
}
|
|
|
|
function $getPost_1(this$static, n){
|
|
if (this$static.busWidth == 1)
|
|
return this$static.point1;
|
|
return new Point_3(this$static.point1.x_0, this$static.point1.y_0, n);
|
|
}
|
|
|
|
function LabeledNodeElm(xx, yy){
|
|
CircuitElm.call(this, xx, yy);
|
|
$$init_10(this);
|
|
this.text_0 = 'label';
|
|
}
|
|
|
|
function LabeledNodeElm_0(xa, ya, xb, yb, f, st){
|
|
CircuitElm_0.call(this, xa, ya, xb, yb, f);
|
|
$$init_10(this);
|
|
this.text_0 = $nextToken(st);
|
|
if ((this.flags & 4) == 0) {
|
|
while ($hasMoreTokens(st))
|
|
this.text_0 += ' ' + $nextToken(st);
|
|
}
|
|
else {
|
|
this.text_0 = unescape_0(this.text_0);
|
|
}
|
|
}
|
|
|
|
function getByName(n){
|
|
var le;
|
|
if (!labelList)
|
|
return null;
|
|
le = $getStringValue(labelList, n);
|
|
if (!le)
|
|
return null;
|
|
return le.node;
|
|
}
|
|
|
|
function getLabelForNode(cn){
|
|
var ci, e, e$iterator, key;
|
|
if (!labelList || !cn)
|
|
return null;
|
|
for (e$iterator = new AbstractHashMap$EntrySetIterator((new AbstractHashMap$EntrySet(labelList)).this$01); e$iterator.hasNext;) {
|
|
e = $next_2(e$iterator);
|
|
if (e.getValue().node == cn) {
|
|
key = e.getKey();
|
|
ci = $lastIndexOf(key, fromCodePoint(58));
|
|
return ci < 0?key:key.substr(0, ci);
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
|
|
defineClass(193, 8, {8:1, 10:1, 193:1}, LabeledNodeElm, LabeledNodeElm_0);
|
|
_.draw = function draw_43(g){
|
|
var i;
|
|
$setVoltageColor(this, g, this.volts[0]);
|
|
drawThickLine_0(g, this.point1, this.lead1, this.busWidth > 1?5:3);
|
|
$setColor_0(g, mouseElmRef == this || this.selected_0 || $containsKey(app_0.mouse.scopePlotRoles, this) || instanceOf(mouseElmRef, 21) && $getElm_0(mouseElmRef.elmScope) == this || $isOnHighlightedNet(this)?selectColor_0:whiteColor);
|
|
$setPowerColor_0(this, g);
|
|
$interpPoint_1(this.point1, this.point2, ps2, 1 + 11 / this.dn);
|
|
$setBbox_0(this, this.point1, ps2, 17);
|
|
$drawLabeledNode_0(this, g, this.text_0, this.point1, this.lead1);
|
|
if (this.currents != null) {
|
|
this.current_0 = 0;
|
|
for (i = 0; i < this.currents.length; i++)
|
|
this.current_0 += this.currents[i];
|
|
}
|
|
this.curcount_0 = $updateDotCount(this.current_0, this.curcount_0);
|
|
$drawDots(g, this.point1, this.lead1, this.curcount_0);
|
|
$drawPosts(this, g);
|
|
}
|
|
;
|
|
_.dumpXml = function dumpXml_45(doc, elem){
|
|
dumpAttr_1(elem, 'x', this.x_0 + ' ' + this.y_0 + ' ' + this.x2 + ' ' + this.y2);
|
|
dumpAttr_0(elem, 'f', this.flags);
|
|
dumpAttr_1(elem, 'te', this.text_0);
|
|
}
|
|
;
|
|
_.getBusWidth = function getBusWidth_1(){
|
|
return this.busWidth;
|
|
}
|
|
;
|
|
_.getConnectedPost = function getConnectedPost_3(){
|
|
return $getConnectedPost(this, 0);
|
|
}
|
|
;
|
|
_.getConnectedPost_0 = function getConnectedPost_4(n){
|
|
return $getConnectedPost(this, n);
|
|
}
|
|
;
|
|
_.getConnection = function getConnection_22(n1, n2){
|
|
return n1 == n2;
|
|
}
|
|
;
|
|
_.getCurrentIntoNode = function getCurrentIntoNode_17(n){
|
|
if (this.currents != null)
|
|
return -this.currents[n];
|
|
return -this.current_0;
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_57(){
|
|
return 207;
|
|
}
|
|
;
|
|
_.getEditInfo = function getEditInfo_42(n){
|
|
var ei;
|
|
if (n == 0) {
|
|
ei = new EditInfo_0('Text', 0, -1, -1);
|
|
ei.text_0 = this.text_0;
|
|
return ei;
|
|
}
|
|
if (n == 1) {
|
|
ei = new EditInfo_0('', 0, -1, -1);
|
|
ei.checkbox = new Checkbox_0('Internal Node', (this.flags & 1) != 0);
|
|
return ei;
|
|
}
|
|
if (n == 2) {
|
|
ei = new EditInfo_0('', 0, -1, -1);
|
|
ei.checkbox = new Checkbox_0('Rotate Text When Vertical', (this.flags & 8) != 0);
|
|
return ei;
|
|
}
|
|
return null;
|
|
}
|
|
;
|
|
_.getElmType = function getElmType_13(){
|
|
return 'Labeled Node';
|
|
}
|
|
;
|
|
_.getInfo_0 = function getInfo_50(arr){
|
|
var value_0, number;
|
|
arr[0] = LS(this.text_0) + ' (' + LS('Labeled Node') + ')';
|
|
if (this.busWidth > 1) {
|
|
value_0 = $getBusValue(this);
|
|
arr[1] = 'value = ' + value_0;
|
|
arr[2] = 'hex = 0x' + (number = value_0 >>> 0 , number.toString(16)).toUpperCase();
|
|
}
|
|
else {
|
|
arr[1] = 'I = ' + getUnitText(this.current_0, 'A', false);
|
|
arr[2] = 'V = ' + getUnitText(this.volts[0], 'V', false);
|
|
}
|
|
}
|
|
;
|
|
_.getName = function getName(){
|
|
return this.text_0;
|
|
}
|
|
;
|
|
_.getPost = function getPost_12(n){
|
|
return $getPost_1(this, n);
|
|
}
|
|
;
|
|
_.getPostCount_0 = function getPostCount_41(){
|
|
return this.busWidth;
|
|
}
|
|
;
|
|
_.getPostWidth = function getPostWidth_4(n){
|
|
return this.busWidth;
|
|
}
|
|
;
|
|
_.getScopeText = function getScopeText_4(v){
|
|
return this.text_0;
|
|
}
|
|
;
|
|
_.getShortcut = function getShortcut_20(){
|
|
return 98;
|
|
}
|
|
;
|
|
_.getVoltageDiff_0 = function getVoltageDiff_15(){
|
|
return this.volts[0];
|
|
}
|
|
;
|
|
_.getWireSegments = function getWireSegments_0(list){
|
|
var b, ep0, ep1;
|
|
for (b = 0; b < this.busWidth; b++) {
|
|
ep0 = pointKey($getPost_1(this, b));
|
|
ep1 = this.busWidth > 1?'label:' + this.text_0 + ':' + b:'label:' + this.text_0;
|
|
$add_11(list, new SimulationManager$WireSegment(this, b, ep0, ep1));
|
|
}
|
|
}
|
|
;
|
|
_.getXmlDumpType = function getXmlDumpType_17(){
|
|
return 'ln';
|
|
}
|
|
;
|
|
_.isRemovableWire = function isRemovableWire_6(){
|
|
return true;
|
|
}
|
|
;
|
|
_.isWireEquivalent = function isWireEquivalent_7(){
|
|
return true;
|
|
}
|
|
;
|
|
_.setCurrent = function setCurrent_8(vs, c){
|
|
this.current_0 = c;
|
|
}
|
|
;
|
|
_.setEditValue = function setEditValue_42(n, ei){
|
|
n == 0 && (this.text_0 = $getText(ei.textf));
|
|
n == 1 && (this.flags = $changeFlag(ei, this.flags, 1));
|
|
n == 2 && (this.flags = $changeFlag(ei, this.flags, 8));
|
|
}
|
|
;
|
|
_.setNode = function setNode_1(p, n){
|
|
var key, le;
|
|
this.nodes[p] = n;
|
|
key = this.busWidth > 1?this.text_0 + ':' + p:this.text_0;
|
|
le = $getStringValue(labelList, key);
|
|
!!le && (le.node = n);
|
|
}
|
|
;
|
|
_.setPoints = function setPoints_38(){
|
|
$setPoints(this);
|
|
this.lead1 = $interpPoint(this.point1, this.point2, 1 - 17 / this.dn);
|
|
}
|
|
;
|
|
_.setWireCurrent = function setWireCurrent_1(bit, c){
|
|
this.currents != null?(this.currents[bit] = c):(this.current_0 = c);
|
|
}
|
|
;
|
|
_.undumpXml = function undumpXml_47(xml){
|
|
this.flags = $parseIntAttr(xml, 'f', this.flags);
|
|
this.text_0 = $parseStringAttr(xml, 'te', this.text_0);
|
|
}
|
|
;
|
|
_.busWidth = 0;
|
|
var labelList;
|
|
var Lcom_lushprojects_circuitjs1_client_LabeledNodeElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'LabeledNodeElm', 193);
|
|
function LabeledNodeElm$LabelEntry(){
|
|
}
|
|
|
|
defineClass(349, 1, {349:1}, LabeledNodeElm$LabelEntry);
|
|
var Lcom_lushprojects_circuitjs1_client_LabeledNodeElm$LabelEntry_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'LabeledNodeElm/LabelEntry', 349);
|
|
function $getTempColor_0(this$static){
|
|
var x_0;
|
|
if (this$static.temp < 1200) {
|
|
x_0 = round_int(255 * (this$static.temp - 800) / 400);
|
|
x_0 < 0 && (x_0 = 0);
|
|
return new Color(x_0, 0, 0);
|
|
}
|
|
if (this$static.temp < 1700) {
|
|
x_0 = round_int(255 * (this$static.temp - 1200) / 500);
|
|
x_0 < 0 && (x_0 = 0);
|
|
return new Color(255, x_0, 0);
|
|
}
|
|
if (this$static.temp < 2400) {
|
|
x_0 = round_int(255 * (this$static.temp - 1700) / 700);
|
|
x_0 < 0 && (x_0 = 0);
|
|
return new Color(255, 255, x_0);
|
|
}
|
|
return $clinit_Color() , white;
|
|
}
|
|
|
|
function $startIteration_1(this$static){
|
|
var cap, capc, capw, cr, nom_r, tp;
|
|
nom_r = this$static.nom_v * this$static.nom_v / this$static.nom_pow;
|
|
tp = this$static.temp > 5390?5390:this$static.temp;
|
|
this$static.resistance = nom_r * (1.26104 - 4.90662 * $wnd.Math.sqrt(17.1839 / tp - 0.00318794) - 7.8569 / (tp - 187.56));
|
|
cap = 1.57E-4 * this$static.nom_pow;
|
|
capw = cap * this$static.warmTime / 0.4;
|
|
capc = cap * this$static.coolTime / 0.4;
|
|
this$static.temp += (this$static.volts[0] - this$static.volts[1]) * this$static.current_0 * sim_0.timeStep / capw;
|
|
cr = 2600 / this$static.nom_pow;
|
|
this$static.temp -= sim_0.timeStep * (this$static.temp - 300) / (capc * cr);
|
|
}
|
|
|
|
function LampElm(xx, yy){
|
|
CircuitElm.call(this, xx, yy);
|
|
this.temp = 300;
|
|
this.nom_pow = 100;
|
|
this.nom_v = 120;
|
|
this.warmTime = 0.4;
|
|
this.coolTime = 0.4;
|
|
$startIteration_1(this);
|
|
}
|
|
|
|
function LampElm_0(xa, ya, xb, yb, f, st){
|
|
CircuitElm_0.call(this, xa, ya, xb, yb, f);
|
|
this.temp = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
isNaN(this.temp) && (this.temp = 300);
|
|
this.nom_pow = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.nom_v = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.warmTime = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.coolTime = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
$startIteration_1(this);
|
|
}
|
|
|
|
defineClass(439, 8, $intern_85, LampElm, LampElm_0);
|
|
_.calculateCurrent = function calculateCurrent_19(){
|
|
this.current_0 = (this.volts[0] - this.volts[1]) / this.resistance;
|
|
this.resistance == 0 && (this.current_0 = 0);
|
|
}
|
|
;
|
|
_.canShowValueInScope = function canShowValueInScope_0(x_0){
|
|
return x_0 == 2;
|
|
}
|
|
;
|
|
_.doStep = function doStep_30(){
|
|
$stampResistor(this.nodes[0], this.nodes[1], this.resistance);
|
|
}
|
|
;
|
|
_.draw = function draw_44(g){
|
|
var cc, v1, v2;
|
|
v1 = this.volts[0];
|
|
v2 = this.volts[1];
|
|
$setBbox_0(this, this.point1, this.point2, 4);
|
|
$adjustBbox(this, this.bulb.x_0 - this.bulbR, this.bulb.y_0 - this.bulbR, this.bulb.x_0 + this.bulbR, this.bulb.y_0 + this.bulbR);
|
|
$draw2Leads(this, g);
|
|
$setPowerColor_0(this, g);
|
|
$setColor_0(g, $getTempColor_0(this));
|
|
$fillOval(g, this.bulb.x_0 - this.bulbR, this.bulb.y_0 - this.bulbR, this.bulbR * 2);
|
|
$setColor_0(g, whiteColor);
|
|
drawThickCircle(g, this.bulb.x_0, this.bulb.y_0, this.bulbR);
|
|
$setColor_0(g, $getVoltageColor(this, v1));
|
|
drawThickLine_0(g, this.lead1, this.filament[0], 3);
|
|
$setColor_0(g, $getVoltageColor(this, v2));
|
|
drawThickLine_0(g, this.lead2, this.filament[1], 3);
|
|
$setColor_0(g, $getVoltageColor(this, (v1 + v2) * 0.5));
|
|
drawThickLine_0(g, this.filament[0], this.filament[1], 3);
|
|
this.curcount_0 = $updateDotCount(this.current_0, this.curcount_0);
|
|
if (app_0.mouse.dragElm != this) {
|
|
$drawDots(g, this.point1, this.lead1, this.curcount_0);
|
|
cc = $addCurCount(this.curcount_0, (this.dn - 16) / 2);
|
|
$drawDots(g, this.lead1, this.filament[0], cc);
|
|
cc = $addCurCount(cc, 24);
|
|
$drawDots(g, this.filament[0], this.filament[1], cc);
|
|
cc = $addCurCount(cc, 16);
|
|
$drawDots(g, this.filament[1], this.lead2, cc);
|
|
$addCurCount(cc, 24);
|
|
$drawDots(g, this.lead2, this.point2, this.curcount_0);
|
|
}
|
|
$drawPosts(this, g);
|
|
}
|
|
;
|
|
_.dumpXml = function dumpXml_46(doc, elem){
|
|
dumpAttr_1(elem, 'x', this.x_0 + ' ' + this.y_0 + ' ' + this.x2 + ' ' + this.y2);
|
|
dumpAttr_0(elem, 'f', this.flags);
|
|
dumpAttr(elem, 'te', this.temp);
|
|
dumpAttr(elem, 'np', this.nom_pow);
|
|
dumpAttr(elem, 'nv', this.nom_v);
|
|
dumpAttr(elem, 'wa', this.warmTime);
|
|
dumpAttr(elem, 'co', this.coolTime);
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_58(){
|
|
return 181;
|
|
}
|
|
;
|
|
_.getEditInfo = function getEditInfo_43(n){
|
|
if (n == 0)
|
|
return $setPositive(new EditInfo_0('Nominal Power', this.nom_pow, 0, 0));
|
|
if (n == 1)
|
|
return $setUnitStep($setPositive(new EditInfo_0('Nominal Voltage', this.nom_v, 0, 0)));
|
|
if (n == 2)
|
|
return $setPositive(new EditInfo_0('Warmup Time (s)', this.warmTime, 0, 0));
|
|
if (n == 3)
|
|
return $setPositive(new EditInfo_0('Cooldown Time (s)', this.coolTime, 0, 0));
|
|
return null;
|
|
}
|
|
;
|
|
_.getInfo_0 = function getInfo_51(arr){
|
|
arr[0] = 'lamp';
|
|
arr[1] = 'I = ' + getUnitText($wnd.Math.abs(this.current_0), 'A', false);
|
|
arr[2] = 'Vd = ' + getUnitText($wnd.Math.abs(this.volts[0] - this.volts[1]), 'V', false);
|
|
arr[3] = 'R = ' + getUnitText(this.resistance, ohmString, false);
|
|
arr[4] = 'P = ' + getUnitText((this.volts[0] - this.volts[1]) * this.current_0, 'W', false);
|
|
arr[5] = 'T = ' + round_int(this.temp) + ' K';
|
|
}
|
|
;
|
|
_.getScopeUnits = function getScopeUnits_1(x_0){
|
|
return x_0 == 2?3:x_0 == 3?1:x_0 == 7?2:0;
|
|
}
|
|
;
|
|
_.getScopeValue = function getScopeValue_1(x_0){
|
|
return x_0 == 2?this.resistance:x_0 == 3?this.current_0:x_0 == 7?(this.volts[0] - this.volts[1]) * this.current_0:this.volts[0] - this.volts[1];
|
|
}
|
|
;
|
|
_.nonLinear_0 = function nonLinear_12(){
|
|
return true;
|
|
}
|
|
;
|
|
_.reset_0 = function reset_25(){
|
|
$reset(this);
|
|
this.temp = 300;
|
|
$startIteration_1(this);
|
|
}
|
|
;
|
|
_.setEditValue = function setEditValue_43(n, ei){
|
|
n == 0 && ei.value_0 > 0 && (this.nom_pow = ei.value_0);
|
|
n == 1 && ei.value_0 > 0 && (this.nom_v = ei.value_0);
|
|
n == 2 && ei.value_0 > 0 && (this.warmTime = ei.value_0);
|
|
n == 3 && ei.value_0 > 0 && (this.coolTime = ei.value_0);
|
|
}
|
|
;
|
|
_.setPoints = function setPoints_39(){
|
|
var br;
|
|
$setPoints(this);
|
|
$calcLeads(this, 16);
|
|
this.bulbLead = $newPointArray(2);
|
|
this.filament = $newPointArray(2);
|
|
this.bulbR = 20;
|
|
this.filament[0] = $interpPoint_0(this.lead1, this.lead2, 0, 24);
|
|
this.filament[1] = $interpPoint_0(this.lead1, this.lead2, 1, 24);
|
|
br = 24 - $wnd.Math.sqrt(this.bulbR * this.bulbR - 256);
|
|
this.bulbLead[0] = $interpPoint_0(this.lead1, this.lead2, 0, br);
|
|
this.bulbLead[1] = $interpPoint_0(this.lead1, this.lead2, 1, br);
|
|
this.bulb = $interpPoint(this.filament[0], this.filament[1], 0.5);
|
|
}
|
|
;
|
|
_.stamp = function stamp_39(){
|
|
}
|
|
;
|
|
_.startIteration = function startIteration_10(){
|
|
$startIteration_1(this);
|
|
}
|
|
;
|
|
_.undumpXml = function undumpXml_48(xml){
|
|
this.flags = $parseIntAttr(xml, 'f', this.flags);
|
|
this.temp = $parseDoubleAttr(xml, 'te', this.temp);
|
|
this.nom_pow = $parseDoubleAttr(xml, 'np', this.nom_pow);
|
|
this.nom_v = $parseDoubleAttr(xml, 'nv', this.nom_v);
|
|
this.warmTime = $parseDoubleAttr(xml, 'wa', this.warmTime);
|
|
this.coolTime = $parseDoubleAttr(xml, 'co', this.coolTime);
|
|
}
|
|
;
|
|
_.bulbR = 0;
|
|
_.coolTime = 0;
|
|
_.nom_pow = 0;
|
|
_.nom_v = 0;
|
|
_.resistance = 0;
|
|
_.temp = 0;
|
|
_.warmTime = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_LampElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'LampElm', 439);
|
|
function $$init_11(this$static){
|
|
this$static.lastLoad = false;
|
|
}
|
|
|
|
function $doLoad(this$static){
|
|
var i, i0, inputEnabled;
|
|
if ((this$static.flags & 16) != 0 && this$static.pins[this$static.setPin].value_0) {
|
|
for (i0 = 0; i0 != this$static.bits; i0++)
|
|
this$static.outputValues[i0] = true;
|
|
this$static.lastLoad = this$static.pins[this$static.loadPin].value_0;
|
|
return;
|
|
}
|
|
if ((this$static.flags & 8) != 0 && this$static.pins[this$static.resetPin].value_0 != ((this$static.flags & 128) != 0)) {
|
|
for (i0 = 0; i0 != this$static.bits; i0++)
|
|
this$static.outputValues[i0] = false;
|
|
this$static.lastLoad = this$static.pins[this$static.loadPin].value_0;
|
|
return;
|
|
}
|
|
inputEnabled = true;
|
|
(this$static.flags & 96) >> 5 >= 1 && this$static.pins[this$static.ie1Pin].value_0 && (inputEnabled = false);
|
|
(this$static.flags & 96) >> 5 >= 2 && this$static.pins[this$static.ie2Pin].value_0 && (inputEnabled = false);
|
|
if (inputEnabled && this$static.pins[this$static.loadPin].value_0 && ((this$static.flags & 4) != 0 || !this$static.lastLoad))
|
|
for (i = 0; i != this$static.bits; i++)
|
|
this$static.outputValues[i] = this$static.pins[i].value_0;
|
|
this$static.lastLoad = this$static.pins[this$static.loadPin].value_0;
|
|
}
|
|
|
|
function $restoreOutputValues(this$static){
|
|
var i, ov;
|
|
ov = (this$static.outputValues == null && (this$static.outputValues = initUnidimensionalArray(Z_classLit, $intern_95, 7, this$static.bits, 16, 1)) , this$static.outputValues);
|
|
for (i = 0; i != this$static.bits; i++)
|
|
ov[i] = this$static.pins[i + this$static.bits].value_0;
|
|
}
|
|
|
|
function $setupPins_15(this$static){
|
|
var bitsY, extraLeftPins, ieCount, leftPos, oeCount, pinIndex, rightPos;
|
|
this$static.sizeX = 2;
|
|
ieCount = (this$static.flags & 96) >> 5;
|
|
oeCount = (this$static.flags & 96) >> 5;
|
|
extraLeftPins = ((this$static.flags & 8) != 0?1:0) + ((this$static.flags & 16) != 0?1:0) + ieCount;
|
|
bitsY = this$static.bitOrder == 2?1:this$static.bits;
|
|
this$static.sizeY = bitsY + 1 + extraLeftPins > bitsY + oeCount?bitsY + 1 + extraLeftPins:bitsY + oeCount;
|
|
this$static.pins = initUnidimensionalArray(Lcom_lushprojects_circuitjs1_client_ChipElm$Pin_2_classLit, $intern_3, 9, this$static.bits * 2 + 1 + ((this$static.flags & 8) != 0?1:0) + ((this$static.flags & 16) != 0?1:0) + ((this$static.flags & 96) >> 5) + ((this$static.flags & 96) >> 5), 0, 1);
|
|
$makeBitPins(this$static, this$static.bits, 0, 2, 0, 'I', false, false, false);
|
|
$makeBitPins(this$static, this$static.bits, 0, 3, this$static.bits, 'O', (this$static.flags & 96) >> 5 <= 0, (this$static.flags & 2) != 0, false);
|
|
pinIndex = this$static.bits * 2;
|
|
leftPos = bitsY;
|
|
this$static.pins[this$static.loadPin = pinIndex++] = new ChipElm$Pin(this$static, leftPos++, 2, (this$static.flags & 4) == 0?'':'Ld');
|
|
this$static.pins[this$static.loadPin].clock = (this$static.flags & 4) == 0;
|
|
if ((this$static.flags & 8) != 0) {
|
|
this$static.pins[this$static.resetPin = pinIndex++] = new ChipElm$Pin(this$static, leftPos++, 2, 'R');
|
|
this$static.pins[this$static.resetPin].lineOver = (this$static.flags & 128) != 0;
|
|
}
|
|
(this$static.flags & 16) != 0 && (this$static.pins[this$static.setPin = pinIndex++] = new ChipElm$Pin(this$static, leftPos++, 2, 'S'));
|
|
rightPos = leftPos;
|
|
if (ieCount >= 1) {
|
|
this$static.pins[this$static.ie1Pin = pinIndex++] = new ChipElm$Pin(this$static, leftPos++, 2, 'IE');
|
|
this$static.pins[this$static.ie1Pin].lineOver = true;
|
|
}
|
|
if (ieCount >= 2) {
|
|
this$static.pins[this$static.ie2Pin = pinIndex++] = new ChipElm$Pin(this$static, leftPos++, 2, 'IE');
|
|
this$static.pins[this$static.ie2Pin].lineOver = true;
|
|
}
|
|
if (oeCount >= 1) {
|
|
this$static.pins[this$static.oe1Pin = pinIndex++] = new ChipElm$Pin(this$static, rightPos++, 3, 'OE');
|
|
this$static.pins[this$static.oe1Pin].lineOver = true;
|
|
}
|
|
if (oeCount >= 2) {
|
|
this$static.pins[this$static.oe2Pin = pinIndex++] = new ChipElm$Pin(this$static, rightPos++, 3, 'OE');
|
|
this$static.pins[this$static.oe2Pin].lineOver = true;
|
|
}
|
|
this$static.intNodes = pinIndex;
|
|
$allocNodes(this$static);
|
|
}
|
|
|
|
function LatchElm(xx, yy){
|
|
$clinit_ChipElm();
|
|
ChipElm.call(this, xx, yy);
|
|
$$init_11(this);
|
|
this.flags |= 2;
|
|
$setupPins_15(this);
|
|
}
|
|
|
|
function LatchElm_0(xa, ya, xb, yb, f, st){
|
|
$clinit_ChipElm();
|
|
ChipElm_0.call(this, xa, ya, xb, yb, f, st);
|
|
$$init_11(this);
|
|
if ((this.flags & 2) == 0) {
|
|
this.flags |= 2;
|
|
$setupPins_15(this);
|
|
}
|
|
$restoreOutputValues(this);
|
|
}
|
|
|
|
defineClass(433, 32, $intern_85, LatchElm, LatchElm_0);
|
|
_.allowBus = function allowBus_7(){
|
|
return true;
|
|
}
|
|
;
|
|
_.doStep = function doStep_31(){
|
|
var i, outputEnabled, v;
|
|
if ((this.flags & 96) >> 5 <= 0) {
|
|
$doStep(this);
|
|
return;
|
|
}
|
|
outputEnabled = true;
|
|
(this.flags & 96) >> 5 >= 1 && this.pins[this.oe1Pin].value_0 && (outputEnabled = false);
|
|
(this.flags & 96) >> 5 >= 2 && this.pins[this.oe2Pin].value_0 && (outputEnabled = false);
|
|
for (i = 0; i < this.bits; i++) {
|
|
v = (this.outputValues == null && (this.outputValues = initUnidimensionalArray(Z_classLit, $intern_95, 7, this.bits, 16, 1)) , this.outputValues)[i]?this.highVoltage:0;
|
|
$updateVoltageSource(this.vSources[i], v);
|
|
outputEnabled?$stampResistor(this.nodes[this.intNodes + i], this.nodes[this.bits + i], 1):$stampResistor(this.nodes[this.bits + i], ground, $intern_97);
|
|
}
|
|
}
|
|
;
|
|
_.execute_3 = function execute_28(){
|
|
var i;
|
|
$doLoad(this);
|
|
for (i = 0; i != this.bits; i++)
|
|
this.pins[i + this.bits].value_0 = (this.outputValues == null && (this.outputValues = initUnidimensionalArray(Z_classLit, $intern_95, 7, this.bits, 16, 1)) , this.outputValues)[i];
|
|
}
|
|
;
|
|
_.getChipEditInfo = function getChipEditInfo_15(n){
|
|
var ei;
|
|
if (n == 0)
|
|
return $setDimensionless(new EditInfo_0('# of Bits', this.bits, 1, 1));
|
|
if (n == 1)
|
|
return createCheckbox('Edge Triggered', (this.flags & 4) == 0);
|
|
if (n == 2)
|
|
return createCheckbox('Reset Pin', (this.flags & 8) != 0);
|
|
if (n == 3)
|
|
return createCheckbox('Set Pin', (this.flags & 16) != 0);
|
|
if (n == 4) {
|
|
ei = new EditInfo('Enable Pins', 0);
|
|
ei.choice = new Choice;
|
|
$addItem(ei.choice, LS('None'));
|
|
$addItem(ei.choice, LS('1 Input/Output Enable'));
|
|
$addItem(ei.choice, LS('2 Input/Output Enables'));
|
|
$select(ei.choice, (this.flags & 96) >> 5);
|
|
return ei;
|
|
}
|
|
if (n == 5 && (this.flags & 8) != 0)
|
|
return createCheckbox('Invert Reset', (this.flags & 128) != 0);
|
|
return null;
|
|
}
|
|
;
|
|
_.getChipName = function getChipName_18(){
|
|
return (this.flags & 4) == 0?'Register':'Latch';
|
|
}
|
|
;
|
|
_.getConnection = function getConnection_23(n1, n2){
|
|
return false;
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_59(){
|
|
return 168;
|
|
}
|
|
;
|
|
_.getInternalNodeCount = function getInternalNodeCount_9(){
|
|
return (this.flags & 96) >> 5 > 0?this.bits:0;
|
|
}
|
|
;
|
|
_.getMatrixConnection = function getMatrixConnection_7(n1, n2){
|
|
var i;
|
|
if ((this.flags & 96) >> 5 > 0) {
|
|
for (i = 0; i < this.bits; i++)
|
|
if ($comparePair(n1, n2, this.intNodes + i, this.bits + i))
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
;
|
|
_.getPostCount_0 = function getPostCount_42(){
|
|
return this.bits * 2 + 1 + ((this.flags & 8) != 0?1:0) + ((this.flags & 16) != 0?1:0) + ((this.flags & 96) >> 5) + ((this.flags & 96) >> 5);
|
|
}
|
|
;
|
|
_.getVoltageSourceCount = function getVoltageSourceCount_35(){
|
|
return this.bits;
|
|
}
|
|
;
|
|
_.hasGroundConnection = function hasGroundConnection_15(n1){
|
|
if ((this.flags & 96) >> 5 > 0)
|
|
return n1 >= this.bits && n1 < this.bits * 2;
|
|
return this.pins[n1].output;
|
|
}
|
|
;
|
|
_.needsBits = function needsBits_7(){
|
|
return true;
|
|
}
|
|
;
|
|
_.nonLinear_0 = function nonLinear_13(){
|
|
return (this.flags & 96) >> 5 > 0;
|
|
}
|
|
;
|
|
_.reset_0 = function reset_26(){
|
|
$reset_0(this);
|
|
this.outputValues = null;
|
|
}
|
|
;
|
|
_.setChipEditValue = function setChipEditValue_16(n, ei){
|
|
var mode;
|
|
if (n == 0) {
|
|
if (ei.value_0 >= 2 && this.bits != round_int(ei.value_0)) {
|
|
this.bits = round_int(ei.value_0);
|
|
$setupPins_15(this);
|
|
$setPoints_0(this);
|
|
}
|
|
else
|
|
ei.value_0 < 2 && (ei.error = 'must be >= 2');
|
|
}
|
|
if (n == 1) {
|
|
this.flags = $changeFlagInverted(ei, this.flags, 4);
|
|
$setupPins_15(this);
|
|
$setPoints_0(this);
|
|
}
|
|
if (n == 2) {
|
|
this.flags = $changeFlag(ei, this.flags, 8);
|
|
$setupPins_15(this);
|
|
$allocNodes(this);
|
|
$setPoints_0(this);
|
|
ei.newDialog = true;
|
|
}
|
|
if (n == 3) {
|
|
this.flags = $changeFlag(ei, this.flags, 16);
|
|
$setupPins_15(this);
|
|
$allocNodes(this);
|
|
$setPoints_0(this);
|
|
}
|
|
if (n == 4) {
|
|
mode = $getElement(ei.choice).selectedIndex;
|
|
this.flags = this.flags & -97 | mode << 5;
|
|
$setupPins_15(this);
|
|
$allocNodes(this);
|
|
$setPoints_0(this);
|
|
}
|
|
if (n == 5) {
|
|
this.flags = $changeFlag(ei, this.flags, 128);
|
|
$setupPins_15(this);
|
|
$setPoints_0(this);
|
|
}
|
|
}
|
|
;
|
|
_.setVoltageSource = function setVoltageSource_12(j, vs){
|
|
if ((this.flags & 96) >> 5 > 0) {
|
|
(this.vSources == null || this.vSources.length != this.bits) && (this.vSources = initUnidimensionalArray(Lcom_lushprojects_circuitjs1_client_VoltageSource_2_classLit, $intern_3, 136, this.bits, 0, 1));
|
|
this.vSources[j] = vs;
|
|
$setNodes(vs, ground, this.nodes[this.intNodes + j]);
|
|
}
|
|
else {
|
|
$setVoltageSource(this, j, vs);
|
|
}
|
|
}
|
|
;
|
|
_.setupPins = function setupPins_19(){
|
|
$setupPins_15(this);
|
|
}
|
|
;
|
|
_.stamp = function stamp_40(){
|
|
var i;
|
|
if ((this.flags & 96) >> 5 <= 0) {
|
|
$stamp(this);
|
|
return;
|
|
}
|
|
for (i = 0; i < this.bits; i++) {
|
|
$stampVoltageSource(ground, this.nodes[this.intNodes + i], this.vSources[i]);
|
|
}
|
|
}
|
|
;
|
|
_.startIteration = function startIteration_11(){
|
|
var i, p;
|
|
if ((this.flags & 96) >> 5 <= 0) {
|
|
$startIteration(this);
|
|
return;
|
|
}
|
|
for (i = 0; i < this.bits * 2 + 1 + ((this.flags & 8) != 0?1:0) + ((this.flags & 16) != 0?1:0) + ((this.flags & 96) >> 5) + ((this.flags & 96) >> 5); i++) {
|
|
p = this.pins[i];
|
|
p.output || (p.value_0 = this.volts[i] > this.highVoltage / 2);
|
|
}
|
|
$doLoad(this);
|
|
}
|
|
;
|
|
_.undumpXml = function undumpXml_49(xml){
|
|
$undumpXml_0(this, xml);
|
|
$restoreOutputValues(this);
|
|
}
|
|
;
|
|
_.ie1Pin = 0;
|
|
_.ie2Pin = 0;
|
|
_.intNodes = 0;
|
|
_.lastLoad = false;
|
|
_.loadPin = 0;
|
|
_.oe1Pin = 0;
|
|
_.oe2Pin = 0;
|
|
_.resetPin = 0;
|
|
_.setPin = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_LatchElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'LatchElm', 433);
|
|
function LineElm(xx, yy){
|
|
GraphicElm.call(this, xx, yy);
|
|
this.x2 = xx;
|
|
this.y2 = yy;
|
|
$setBbox(this, this.x_0, this.y_0, this.x2, this.y2);
|
|
}
|
|
|
|
function LineElm_0(xa, ya, xb, yb, f){
|
|
GraphicElm_0.call(this, xa, ya, xb, yb, f);
|
|
this.x2 = xb;
|
|
this.y2 = yb;
|
|
$setBbox(this, this.x_0, this.y_0, this.x2, this.y2);
|
|
}
|
|
|
|
defineClass(413, 133, $intern_99, LineElm, LineElm_0);
|
|
_.creationFailed = function creationFailed_1(){
|
|
return hypot(this.x_0 - this.x2, this.y_0 - this.y2) < 16;
|
|
}
|
|
;
|
|
_.drag = function drag_4(xx, yy){
|
|
this.x2 = xx;
|
|
this.y2 = yy;
|
|
}
|
|
;
|
|
_.draw = function draw_45(g){
|
|
$setColor_0(g, mouseElmRef == this || this.selected_0 || $containsKey(app_0.mouse.scopePlotRoles, this) || instanceOf(mouseElmRef, 21) && $getElm_0(mouseElmRef.elmScope) == this || $isOnHighlightedNet(this)?selectColor_0:($clinit_Color() , GRAY));
|
|
$setBbox(this, this.x_0, this.y_0, this.x2, this.y2);
|
|
$drawLine(g, this.x_0, this.y_0, this.x2, this.y2);
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_60(){
|
|
return 423;
|
|
}
|
|
;
|
|
_.getEditInfo = function getEditInfo_44(n){
|
|
return null;
|
|
}
|
|
;
|
|
_.getInfo_0 = function getInfo_52(arr){
|
|
}
|
|
;
|
|
_.getMouseDistance = function getMouseDistance_1(gx, gy){
|
|
var d2;
|
|
d2 = $lineDistanceSq(this.x_0, this.y_0, this.x2, this.y2, gx, gy);
|
|
if (d2 <= 100)
|
|
return d2;
|
|
return -1;
|
|
}
|
|
;
|
|
_.getShortcut = function getShortcut_21(){
|
|
return 0;
|
|
}
|
|
;
|
|
_.setEditValue = function setEditValue_44(n, ei){
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_LineElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'LineElm', 413);
|
|
function LoadFile(s){
|
|
FileUpload.call(this);
|
|
sim_3 = s;
|
|
($clinit_DOM() , this.element).name = 'Import';
|
|
this.element.id = 'LoadFileElement';
|
|
$addDomHandler(this, this, ($clinit_ChangeEvent() , $clinit_ChangeEvent() , TYPE_0));
|
|
setStyleName(this.element, 'offScreen', true);
|
|
}
|
|
|
|
function doLoad(){
|
|
var oFiles = $doc.getElementById('LoadFileElement').files, nFiles = oFiles.length;
|
|
if (nFiles >= 1) {
|
|
if (oFiles[0].size >= 1280000)
|
|
alert('File too large!');
|
|
else {
|
|
var reader = new FileReader;
|
|
reader.onload = function(e){
|
|
var text_0 = reader.result;
|
|
doLoadCallback_0(text_0, oFiles[0].name);
|
|
}
|
|
;
|
|
reader.readAsText(oFiles[0]);
|
|
}
|
|
}
|
|
}
|
|
|
|
function doLoadCallback_0(s, t){
|
|
$pushUndo(sim_3.undoManager);
|
|
$resetEditingContext(sim_3);
|
|
$readCircuit_0(sim_3.loader, s, 0);
|
|
$createNewLoadFile(sim_3.ui);
|
|
$setCircuitTitle(sim_3, t);
|
|
t == null || $equals_1(t.substr(0, 10), 'circuitjs-')?(lastFileName = null):(lastFileName = t);
|
|
sim_3.unsavedChanges = false;
|
|
}
|
|
|
|
function isSupported_1(){
|
|
return !!($wnd.File && $wnd.FileReader);
|
|
}
|
|
|
|
defineClass(337, 240, $intern_117, LoadFile);
|
|
_.onChange = function onChange_4(e){
|
|
doLoad();
|
|
}
|
|
;
|
|
var sim_3;
|
|
var Lcom_lushprojects_circuitjs1_client_LoadFile_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'LoadFile', 337);
|
|
function LogicInputElm(xx, yy){
|
|
SwitchElm_1.call(this, xx, yy, false);
|
|
this.hiV = 5;
|
|
this.loV = 0;
|
|
}
|
|
|
|
function LogicInputElm_0(xa, ya, xb, yb, f, st){
|
|
SwitchElm_0.call(this, xa, ya, xb, yb, f, st);
|
|
try {
|
|
this.hiV = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.loV = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
}
|
|
catch ($e0) {
|
|
$e0 = toJava($e0);
|
|
if (instanceOf($e0, 13)) {
|
|
this.hiV = 5;
|
|
this.loV = 0;
|
|
}
|
|
else
|
|
throw toJs($e0);
|
|
}
|
|
(this.flags & 1) != 0 && (this.posCount = 3);
|
|
}
|
|
|
|
defineClass(186, 61, {8:1, 10:1, 186:1, 61:1}, LogicInputElm, LogicInputElm_0);
|
|
_.addRoutingObstacle = function addRoutingObstacle_13(router){
|
|
$addWire(router, this.point1.x_0, this.point1.y_0, this.lead1.x_0, this.lead1.y_0);
|
|
$addObstacle(router, this.x2 - 10, this.y2 - 10, this.x2 + 10, this.y2 + 10);
|
|
}
|
|
;
|
|
_.calculateCurrent = function calculateCurrent_20(){
|
|
}
|
|
;
|
|
_.doStep = function doStep_32(){
|
|
var v;
|
|
v = this.position == 0?this.loV:this.hiV;
|
|
(this.flags & 1) != 0 && (v = this.loV + this.position * (this.hiV - this.loV) * 0.5);
|
|
$updateVoltageSource(this.voltSource, v);
|
|
}
|
|
;
|
|
_.draw = function draw_46(g){
|
|
var f, s;
|
|
g.context.save();
|
|
g.savedFontSize = g.currentFontSize;
|
|
f = new Font('SansSerif', 1, 20);
|
|
$setFont_0(g, f);
|
|
$setColor_0(g, mouseElmRef == this || this.selected_0 || $containsKey(app_0.mouse.scopePlotRoles, this) || instanceOf(mouseElmRef, 21) && $getElm_0(mouseElmRef.elmScope) == this || $isOnHighlightedNet(this)?selectColor_0:whiteColor);
|
|
s = this.position == 0?'L':'H';
|
|
(this.flags & 3) != 0 && (s = '' + this.position);
|
|
$setBbox_0(this, this.point1, this.lead1, 0);
|
|
$drawCenteredText(this, g, s, this.x2, this.y2, true);
|
|
$setVoltageColor(this, g, this.volts[0]);
|
|
drawThickLine_0(g, this.point1, this.lead1, 3);
|
|
this.curcount_0 = $updateDotCount(this.current_0, this.curcount_0);
|
|
$drawDots(g, this.point1, this.lead1, -this.curcount_0);
|
|
$drawPosts(this, g);
|
|
g.context.restore();
|
|
g.currentFontSize = g.savedFontSize;
|
|
}
|
|
;
|
|
_.dumpXml = function dumpXml_47(doc, elem){
|
|
$dumpXml_2(this, elem);
|
|
this.hiV != 5 && dumpAttr(elem, 'hi', this.hiV);
|
|
this.loV != 0 && dumpAttr(elem, 'lo', this.loV);
|
|
}
|
|
;
|
|
_.getCurrentIntoNode = function getCurrentIntoNode_18(n){
|
|
return this.current_0;
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_61(){
|
|
return 76;
|
|
}
|
|
;
|
|
_.getEditInfo = function getEditInfo_45(n){
|
|
var ei;
|
|
if (n == 0) {
|
|
ei = new EditInfo_0('', 0, 0, 0);
|
|
ei.checkbox = new Checkbox_0('Momentary Switch', this.momentary);
|
|
return ei;
|
|
}
|
|
if (n == 1)
|
|
return $setUnitStep(new EditInfo_0('High Logic Voltage', this.hiV, 10, -10));
|
|
if (n == 2)
|
|
return $setUnitStep(new EditInfo_0('Low Voltage', this.loV, 10, -10));
|
|
if (n == 3) {
|
|
ei = new EditInfo_0('', 0, 0, 0);
|
|
ei.checkbox = new Checkbox_0('Numeric', (this.flags & 3) != 0);
|
|
return ei;
|
|
}
|
|
if (n == 4) {
|
|
ei = new EditInfo_0('', 0, 0, 0);
|
|
ei.checkbox = new Checkbox_0('Ternary', (this.flags & 1) != 0);
|
|
return ei;
|
|
}
|
|
if (n == 5)
|
|
return new EditInfo_1('Keyboard Shortcut', this.keyShortcut == null?'':this.keyShortcut);
|
|
return null;
|
|
}
|
|
;
|
|
_.getElmType = function getElmType_14(){
|
|
return 'logic input';
|
|
}
|
|
;
|
|
_.getInfo_0 = function getInfo_53(arr){
|
|
arr[0] = 'logic input';
|
|
arr[1] = this.position == 0?'low':'high';
|
|
(this.flags & 3) != 0 && (arr[1] = '' + this.position);
|
|
arr[1] += ' (' + getUnitText(this.volts[0], 'V', false) + ')';
|
|
arr[2] = 'I = ' + getUnitText(this.current_0, 'A', false);
|
|
}
|
|
;
|
|
_.getPostCount_0 = function getPostCount_43(){
|
|
return 1;
|
|
}
|
|
;
|
|
_.getShortcut = function getShortcut_22(){
|
|
return 105;
|
|
}
|
|
;
|
|
_.getSwitchRect = function getSwitchRect_3(){
|
|
return new Rectangle_0(this.x2 - 10, this.y2 - 10, 20, 20);
|
|
}
|
|
;
|
|
_.getVoltageDiff_0 = function getVoltageDiff_16(){
|
|
return this.volts[0];
|
|
}
|
|
;
|
|
_.getVoltageSourceCount = function getVoltageSourceCount_36(){
|
|
return 1;
|
|
}
|
|
;
|
|
_.hasGroundConnection = function hasGroundConnection_16(n1){
|
|
return true;
|
|
}
|
|
;
|
|
_.isRemovableWire = function isRemovableWire_7(){
|
|
return false;
|
|
}
|
|
;
|
|
_.isWireEquivalent = function isWireEquivalent_8(){
|
|
return false;
|
|
}
|
|
;
|
|
_.setCurrent = function setCurrent_9(vs, c){
|
|
this.current_0 = c;
|
|
}
|
|
;
|
|
_.setEditValue = function setEditValue_45(n, ei){
|
|
var s;
|
|
n == 0 && (this.momentary = $getState(ei.checkbox));
|
|
n == 1 && (this.hiV = ei.value_0);
|
|
n == 2 && (this.loV = ei.value_0);
|
|
n == 3 && ($getState(ei.checkbox)?(this.flags |= 2):(this.flags &= -3));
|
|
if (n == 4) {
|
|
$getState(ei.checkbox)?(this.flags |= 1):(this.flags &= -2);
|
|
this.posCount = (this.flags & 1) != 0?3:2;
|
|
}
|
|
n == 5 && (s = $trim($getText(ei.textf)) , s.length == 0?(this.keyShortcut = null):(this.keyShortcut = s.substr(0, 1).toLowerCase()));
|
|
}
|
|
;
|
|
_.setPoints = function setPoints_40(){
|
|
$setPoints_3(this);
|
|
this.lead1 = $interpPoint(this.point1, this.point2, 1 - 12 / this.dn);
|
|
}
|
|
;
|
|
_.stamp = function stamp_41(){
|
|
$stampVoltageSource(ground, this.nodes[0], this.voltSource);
|
|
}
|
|
;
|
|
_.undumpXml = function undumpXml_50(xml){
|
|
$undumpXml_1(this, xml);
|
|
this.hiV = $parseDoubleAttr(xml, 'hi', this.hiV);
|
|
this.loV = $parseDoubleAttr(xml, 'lo', this.loV);
|
|
}
|
|
;
|
|
_.validate = function validate_13(){
|
|
return $validateRailNode(this, 0);
|
|
}
|
|
;
|
|
_.hiV = 0;
|
|
_.loV = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_LogicInputElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'LogicInputElm', 186);
|
|
function LogicOutputElm(xx, yy){
|
|
CircuitElm.call(this, xx, yy);
|
|
this.threshold = 2.5;
|
|
}
|
|
|
|
function LogicOutputElm_0(xa, ya, xb, yb, f, st){
|
|
CircuitElm_0.call(this, xa, ya, xb, yb, f);
|
|
try {
|
|
this.threshold = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
}
|
|
catch ($e0) {
|
|
$e0 = toJava($e0);
|
|
if (instanceOf($e0, 13)) {
|
|
this.threshold = 2.5;
|
|
}
|
|
else
|
|
throw toJs($e0);
|
|
}
|
|
}
|
|
|
|
defineClass(264, 8, {8:1, 10:1, 264:1}, LogicOutputElm, LogicOutputElm_0);
|
|
_.addRoutingObstacle = function addRoutingObstacle_14(router){
|
|
$addWire(router, this.point1.x_0, this.point1.y_0, this.lead1.x_0, this.lead1.y_0);
|
|
$addObstacle(router, this.x2 - 10, this.y2 - 10, this.x2 + 10, this.y2 + 10);
|
|
}
|
|
;
|
|
_.draw = function draw_47(g){
|
|
var f, s;
|
|
g.context.save();
|
|
g.savedFontSize = g.currentFontSize;
|
|
f = new Font('SansSerif', 1, 20);
|
|
$setFont_0(g, f);
|
|
$setColor_0(g, lightGrayColor);
|
|
s = this.volts[0] < this.threshold?'L':'H';
|
|
(this.flags & 1) != 0?this.volts[0] > this.threshold * 1.5?(s = '2'):this.volts[0] > this.threshold * 0.5?(s = '1'):(s = '0'):(this.flags & 3) != 0 && (s = this.volts[0] < this.threshold?'0':'1');
|
|
this.value_0 = s;
|
|
$setBbox_0(this, this.point1, this.lead1, 0);
|
|
$drawCenteredText(this, g, s, this.x2, this.y2, true);
|
|
$setVoltageColor(this, g, this.volts[0]);
|
|
drawThickLine_0(g, this.point1, this.lead1, 3);
|
|
$drawPosts(this, g);
|
|
g.context.restore();
|
|
g.currentFontSize = g.savedFontSize;
|
|
}
|
|
;
|
|
_.dumpXml = function dumpXml_48(doc, elem){
|
|
dumpAttr_1(elem, 'x', this.x_0 + ' ' + this.y_0 + ' ' + this.x2 + ' ' + this.y2);
|
|
dumpAttr_0(elem, 'f', this.flags);
|
|
this.threshold != 2.5 && dumpAttr(elem, 'th', this.threshold);
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_62(){
|
|
return 77;
|
|
}
|
|
;
|
|
_.getEditInfo = function getEditInfo_46(n){
|
|
var ei;
|
|
if (n == 0)
|
|
return new EditInfo_0('Threshold', this.threshold, 10, -10);
|
|
if (n == 1) {
|
|
ei = new EditInfo_0('', 0, -1, -1);
|
|
ei.checkbox = new Checkbox_0('Current Required', (this.flags & 4) != 0);
|
|
return ei;
|
|
}
|
|
if (n == 2) {
|
|
ei = new EditInfo_0('', 0, 0, 0);
|
|
ei.checkbox = new Checkbox_0('Numeric', (this.flags & 3) != 0);
|
|
return ei;
|
|
}
|
|
if (n == 3) {
|
|
ei = new EditInfo_0('', 0, 0, 0);
|
|
ei.checkbox = new Checkbox_0('Ternary', (this.flags & 1) != 0);
|
|
return ei;
|
|
}
|
|
return null;
|
|
}
|
|
;
|
|
_.getInfo_0 = function getInfo_54(arr){
|
|
arr[0] = 'logic output';
|
|
arr[1] = this.volts[0] < this.threshold?'low':'high';
|
|
(this.flags & 3) != 0 && (arr[1] = this.value_0);
|
|
arr[2] = 'V = ' + getUnitText(this.volts[0], 'V', false);
|
|
}
|
|
;
|
|
_.getPostCount_0 = function getPostCount_44(){
|
|
return 1;
|
|
}
|
|
;
|
|
_.getShortcut = function getShortcut_23(){
|
|
return 111;
|
|
}
|
|
;
|
|
_.getVoltageDiff_0 = function getVoltageDiff_17(){
|
|
return this.volts[0];
|
|
}
|
|
;
|
|
_.setEditValue = function setEditValue_46(n, ei){
|
|
n == 0 && (this.threshold = ei.value_0);
|
|
n == 1 && ($getState(ei.checkbox)?(this.flags |= 4):(this.flags &= -5));
|
|
n == 2 && ($getState(ei.checkbox)?(this.flags |= 2):(this.flags &= -3));
|
|
n == 3 && ($getState(ei.checkbox)?(this.flags |= 1):(this.flags &= -2));
|
|
}
|
|
;
|
|
_.setPoints = function setPoints_41(){
|
|
$setPoints(this);
|
|
this.lead1 = $interpPoint(this.point1, this.point2, 1 - 12 / this.dn);
|
|
}
|
|
;
|
|
_.stamp = function stamp_42(){
|
|
(this.flags & 4) != 0 && $stampResistor(this.nodes[0], ground, $intern_84);
|
|
}
|
|
;
|
|
_.undumpXml = function undumpXml_51(xml){
|
|
this.flags = $parseIntAttr(xml, 'f', this.flags);
|
|
this.threshold = $parseDoubleAttr(xml, 'th', this.threshold);
|
|
}
|
|
;
|
|
_.threshold = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_LogicOutputElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'LogicOutputElm', 264);
|
|
function $setup_4(this$static){
|
|
this$static.noDiagonal = true;
|
|
this$static.voltSources = initUnidimensionalArray(Lcom_lushprojects_circuitjs1_client_VoltageSource_2_classLit, $intern_3, 136, 2, 0, 1);
|
|
this$static.currents = initUnidimensionalArray(D_classLit, $intern_76, 7, 2, 15, 1);
|
|
this$static.curcounts = initUnidimensionalArray(D_classLit, $intern_76, 7, 3, 15, 1);
|
|
}
|
|
|
|
function MBBSwitchElm(xx, yy){
|
|
SwitchElm_1.call(this, xx, yy, false);
|
|
$setup_4(this);
|
|
}
|
|
|
|
function MBBSwitchElm_0(xa, ya, xb, yb, f, st){
|
|
SwitchElm_0.call(this, xa, ya, xb, yb, f, st);
|
|
this.link_0 = (new Integer_0($nextToken(st))).value_0;
|
|
$setup_4(this);
|
|
}
|
|
|
|
defineClass(275, 61, {8:1, 10:1, 275:1, 61:1}, MBBSwitchElm, MBBSwitchElm_0);
|
|
_.calculateCurrent = function calculateCurrent_21(){
|
|
if (this.resistance > 0) {
|
|
this.currents[0] = this.both || this.position == 0?(this.volts[0] - this.volts[1]) / this.resistance:0;
|
|
this.currents[1] = this.both || this.position == 2?(this.volts[0] - this.volts[2]) / this.resistance:0;
|
|
return;
|
|
}
|
|
this.both || (this.currents[1 - (this.position / 2 | 0)] = 0);
|
|
}
|
|
;
|
|
_.draw = function draw_48(g){
|
|
var i;
|
|
$setBbox_0(this, this.point1, this.point2, 16);
|
|
$adjustBbox_0(this, this.swposts[0], this.swposts[1]);
|
|
$setVoltageColor(this, g, this.volts[0]);
|
|
drawThickLine_0(g, this.point1, this.lead1, 3);
|
|
for (i = 0; i != 2; i++) {
|
|
$setVoltageColor(this, g, this.volts[i + 1]);
|
|
drawThickLine_0(g, this.swpoles[i], this.swposts[i], 3);
|
|
}
|
|
mouseElmRef == this || this.selected_0 || $containsKey(app_0.mouse.scopePlotRoles, this) || instanceOf(mouseElmRef, 21) && $getElm_0(mouseElmRef.elmScope) == this || $isOnHighlightedNet(this) || $setColor_0(g, whiteColor);
|
|
(this.both || this.position == 0) && drawThickLine_0(g, this.lead1, this.swpoles[0], 3);
|
|
(this.both || this.position == 2) && drawThickLine_0(g, this.lead1, this.swpoles[1], 3);
|
|
for (i = 0; i != 2; i++) {
|
|
this.curcounts[i] = $updateDotCount(this.currents[i], this.curcounts[i]);
|
|
$drawDots(g, this.swpoles[i], this.swposts[i], this.curcounts[i]);
|
|
}
|
|
this.curcounts[2] = $updateDotCount(this.currents[0] + this.currents[1], this.curcounts[2]);
|
|
$drawDots(g, this.point1, this.lead1, this.curcounts[2]);
|
|
$drawPosts(this, g);
|
|
}
|
|
;
|
|
_.dumpXml = function dumpXml_49(doc, elem){
|
|
$dumpXml_2(this, elem);
|
|
dumpAttr_0(elem, 'li', this.link_0);
|
|
}
|
|
;
|
|
_.getConnection = function getConnection_24(n1, n2){
|
|
if (this.both)
|
|
return true;
|
|
return $comparePair(n1, n2, 0, 1 + (this.position / 2 | 0));
|
|
}
|
|
;
|
|
_.getCurrentIntoNode = function getCurrentIntoNode_19(n){
|
|
if (n == 0)
|
|
return -this.currents[0] - this.currents[1];
|
|
return this.currents[n - 1];
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_63(){
|
|
return 416;
|
|
}
|
|
;
|
|
_.getEditInfo = function getEditInfo_47(n){
|
|
var ei;
|
|
if (n == 1)
|
|
return $setDimensionless(new EditInfo_0('Switch Group', this.link_0, 0, 100));
|
|
if (n == 0)
|
|
return $getEditInfo_1(this, 0);
|
|
if (n == 2)
|
|
return new EditInfo_1('Keyboard Shortcut', this.keyShortcut == null?'':this.keyShortcut);
|
|
if (n == 3) {
|
|
ei = new EditInfo('On Resistance (ohms)', this.resistance);
|
|
ei.nonNegative = true;
|
|
return ei;
|
|
}
|
|
return null;
|
|
}
|
|
;
|
|
_.getElmType = function getElmType_15(){
|
|
return 'switch (SPDT, MBB)';
|
|
}
|
|
;
|
|
_.getInfo_0 = function getInfo_55(arr){
|
|
arr[0] = 'switch (' + (this.link_0 == 0?'S':'D') + 'PDT, MBB)';
|
|
arr[1] = 'I = ' + getUnitText($wnd.Math.abs(this.current_0), 'A', false);
|
|
}
|
|
;
|
|
_.getPost = function getPost_13(n){
|
|
return n == 0?this.point1:this.swposts[n - 1];
|
|
}
|
|
;
|
|
_.getPostCount_0 = function getPostCount_45(){
|
|
return 3;
|
|
}
|
|
;
|
|
_.getShortcut = function getShortcut_24(){
|
|
return 0;
|
|
}
|
|
;
|
|
_.getSwitchRect = function getSwitchRect_4(){
|
|
return $union($union(new Rectangle_1(this.lead1), new Rectangle_1(this.swpoles[0])), new Rectangle_1(this.swpoles[1]));
|
|
}
|
|
;
|
|
_.getVoltageSourceCount = function getVoltageSourceCount_37(){
|
|
this.both = this.position == 1 || this.position == 3;
|
|
if (this.resistance > 0)
|
|
return 0;
|
|
return this.both?2:1;
|
|
}
|
|
;
|
|
_.isRemovableWire = function isRemovableWire_8(){
|
|
return false;
|
|
}
|
|
;
|
|
_.isWireEquivalent = function isWireEquivalent_9(){
|
|
return this.resistance == 0;
|
|
}
|
|
;
|
|
_.setCurrent = function setCurrent_10(vs, c){
|
|
vs == this.voltSources[0]?(this.currents[this.both?0:this.position / 2 | 0] = c):vs == this.voltSources[1] && (this.currents[1] = c);
|
|
}
|
|
;
|
|
_.setEditValue = function setEditValue_47(n, ei){
|
|
var s;
|
|
n == 1?(this.link_0 = round_int(ei.value_0)):n == 2?(s = $trim($getText(ei.textf)) , s.length == 0?(this.keyShortcut = null):(this.keyShortcut = s.substr(0, 1).toLowerCase())):n == 3?(this.resistance = ei.value_0):$setEditValue_2(this, n, ei);
|
|
}
|
|
;
|
|
_.setPoints = function setPoints_42(){
|
|
var hs, i;
|
|
$setPoints_3(this);
|
|
$calcLeads(this, 32);
|
|
this.swposts = $newPointArray(2);
|
|
this.swpoles = $newPointArray(4);
|
|
for (i = 0; i != 2; i++) {
|
|
hs = -16 * i;
|
|
i == 0 && (hs = 16);
|
|
$interpPoint_2(this.lead1, this.lead2, this.swpoles[i], 1, hs);
|
|
$interpPoint_2(this.point1, this.point2, this.swposts[i], 1, hs);
|
|
}
|
|
this.posCount = 4;
|
|
}
|
|
;
|
|
_.setVoltageSource = function setVoltageSource_13(n, v){
|
|
this.voltSources[n] = v;
|
|
this.both?$setNodes(v, this.nodes[0], this.nodes[n + 1]):this.position == 0?$setNodes(v, this.nodes[0], this.nodes[1]):$setNodes(v, this.nodes[0], this.nodes[2]);
|
|
}
|
|
;
|
|
_.stamp = function stamp_43(){
|
|
var vs;
|
|
if (this.resistance > 0) {
|
|
(this.both || this.position == 0) && $stampResistor(this.nodes[0], this.nodes[1], this.resistance);
|
|
(this.both || this.position == 2) && $stampResistor(this.nodes[0], this.nodes[2], this.resistance);
|
|
return;
|
|
}
|
|
vs = 0;
|
|
(this.both || this.position == 0) && $stampVoltageSource_1(this.voltSources[vs++]);
|
|
(this.both || this.position == 2) && $stampVoltageSource_1(this.voltSources[vs++]);
|
|
}
|
|
;
|
|
_.toggle = function toggle_1(){
|
|
var i, o, s2;
|
|
$toggle(this);
|
|
if (this.link_0 != 0) {
|
|
for (i = 0; i != sim_0.elmList.arrayList.array.length; i++) {
|
|
o = $elementAt(sim_0.elmList, i);
|
|
if (instanceOf(o, 275)) {
|
|
s2 = o;
|
|
s2.link_0 == this.link_0 && (s2.position = this.position);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
;
|
|
_.undumpXml = function undumpXml_52(xml){
|
|
$undumpXml_1(this, xml);
|
|
this.link_0 = $parseIntAttr(xml, 'li', this.link_0);
|
|
}
|
|
;
|
|
_.validate = function validate_14(){
|
|
var b, fpi;
|
|
if (this.resistance > 0)
|
|
return true;
|
|
b = this.position == 1 || this.position == 3;
|
|
if (b || this.position == 0) {
|
|
fpi = new FindPathInfo(2, this, this.nodes[0], sim_0);
|
|
if ($findPath(fpi, this.nodes[1])) {
|
|
this.resistance = $intern_83;
|
|
return false;
|
|
}
|
|
}
|
|
if (b || this.position == 2) {
|
|
fpi = new FindPathInfo(2, this, this.nodes[0], sim_0);
|
|
if ($findPath(fpi, this.nodes[2])) {
|
|
this.resistance = $intern_83;
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
;
|
|
_.both = false;
|
|
_.link_0 = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_MBBSwitchElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'MBBSwitchElm', 275);
|
|
function MemristorElm(xx, yy){
|
|
CircuitElm.call(this, xx, yy);
|
|
this.r_on = 100;
|
|
this.r_off = 160 * this.r_on;
|
|
this.dopeWidth = 0;
|
|
this.totalWidth = $intern_112;
|
|
this.mobility = 1.0E-10;
|
|
this.resistance = 100;
|
|
}
|
|
|
|
function MemristorElm_0(xa, ya, xb, yb, f, st){
|
|
CircuitElm_0.call(this, xa, ya, xb, yb, f);
|
|
this.r_on = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.r_off = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.dopeWidth = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.totalWidth = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.mobility = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
try {
|
|
this.current_0 = __parseAndValidateDouble($nextToken(st));
|
|
}
|
|
catch ($e0) {
|
|
$e0 = toJava($e0);
|
|
if (!instanceOf($e0, 13))
|
|
throw toJs($e0);
|
|
}
|
|
this.resistance = 100;
|
|
}
|
|
|
|
defineClass(437, 8, $intern_85, MemristorElm, MemristorElm_0);
|
|
_.calculateCurrent = function calculateCurrent_22(){
|
|
this.current_0 = (this.volts[0] - this.volts[1]) / this.resistance;
|
|
}
|
|
;
|
|
_.canShowValueInScope = function canShowValueInScope_1(x_0){
|
|
return x_0 == 2;
|
|
}
|
|
;
|
|
_.doStep = function doStep_33(){
|
|
$stampResistor(this.nodes[0], this.nodes[1], this.resistance);
|
|
}
|
|
;
|
|
_.draw = function draw_49(g){
|
|
var hs, i, nx, ox, v, v1, v2;
|
|
ox = 0;
|
|
v1 = this.volts[0];
|
|
v2 = this.volts[1];
|
|
hs = 2 + round_int(8 * (1 - this.dopeWidth / this.totalWidth));
|
|
$setBbox_0(this, this.point1, this.point2, hs);
|
|
$draw2Leads(this, g);
|
|
$setPowerColor_0(this, g);
|
|
for (i = 0; i <= 6; i++) {
|
|
nx = (i & 1) == 0?1:-1;
|
|
i == 6 && (nx = 0);
|
|
v = v1 + (v2 - v1) * i / 6;
|
|
$setColor_0(g, $getVoltageColor(this, v));
|
|
$interpPoint_2(this.lead1, this.lead2, ps1, i * $intern_122, hs * ox);
|
|
$interpPoint_2(this.lead1, this.lead2, ps2, i * $intern_122, hs * nx);
|
|
drawThickLine_0(g, ps1, ps2, 3);
|
|
if (i == 6)
|
|
break;
|
|
$interpPoint_2(this.lead1, this.lead2, ps1, (i + 1) * $intern_122, hs * nx);
|
|
drawThickLine_0(g, ps1, ps2, 3);
|
|
ox = nx;
|
|
}
|
|
this.curcount_0 = $updateDotCount(this.current_0, this.curcount_0);
|
|
app_0.mouse.dragElm == this || $drawDots(g, this.point1, this.point2, this.curcount_0);
|
|
$drawPosts(this, g);
|
|
}
|
|
;
|
|
_.dumpXml = function dumpXml_50(doc, elem){
|
|
dumpAttr_1(elem, 'x', this.x_0 + ' ' + this.y_0 + ' ' + this.x2 + ' ' + this.y2);
|
|
dumpAttr_0(elem, 'f', this.flags);
|
|
dumpAttr(elem, 'ron', this.r_on);
|
|
dumpAttr(elem, 'rof', this.r_off);
|
|
dumpAttr(elem, 'do', this.dopeWidth);
|
|
dumpAttr(elem, 'to', this.totalWidth);
|
|
dumpAttr(elem, 'mo', this.mobility);
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_64(){
|
|
return 109;
|
|
}
|
|
;
|
|
_.getEditInfo = function getEditInfo_48(n){
|
|
if (n == 0)
|
|
return new EditInfo_0('Min Resistance (ohms)', this.r_on, 0, 0);
|
|
if (n == 1)
|
|
return new EditInfo_0('Max Resistance (ohms)', this.r_off, 0, 0);
|
|
if (n == 2)
|
|
return new EditInfo_0('Width of Doped Region (nm)', this.dopeWidth * $intern_32, 0, 0);
|
|
if (n == 3)
|
|
return new EditInfo_0('Total Width (nm)', this.totalWidth * $intern_32, 0, 0);
|
|
if (n == 4)
|
|
return new EditInfo_0('Mobility (um^2/(s*V))', this.mobility * $intern_81, 0, 0);
|
|
return null;
|
|
}
|
|
;
|
|
_.getInfo_0 = function getInfo_56(arr){
|
|
arr[0] = 'memristor';
|
|
arr[1] = 'I = ' + getUnitText($wnd.Math.abs(this.current_0), 'A', false);
|
|
arr[2] = 'Vd = ' + getUnitText($wnd.Math.abs(this.volts[0] - this.volts[1]), 'V', false);
|
|
arr[3] = 'R = ' + getUnitText(this.resistance, ohmString, false);
|
|
arr[4] = 'P = ' + getUnitText((this.volts[0] - this.volts[1]) * this.current_0, 'W', false);
|
|
}
|
|
;
|
|
_.getScopeUnits = function getScopeUnits_2(x_0){
|
|
return x_0 == 2?3:x_0 == 3?1:x_0 == 7?2:0;
|
|
}
|
|
;
|
|
_.getScopeValue = function getScopeValue_2(x_0){
|
|
return x_0 == 2?this.resistance:x_0 == 3?this.current_0:x_0 == 7?(this.volts[0] - this.volts[1]) * this.current_0:this.volts[0] - this.volts[1];
|
|
}
|
|
;
|
|
_.nonLinear_0 = function nonLinear_14(){
|
|
return true;
|
|
}
|
|
;
|
|
_.reset_0 = function reset_27(){
|
|
this.dopeWidth = 0;
|
|
}
|
|
;
|
|
_.setEditValue = function setEditValue_48(n, ei){
|
|
n == 0 && (this.r_on = ei.value_0);
|
|
n == 1 && (this.r_off = ei.value_0);
|
|
n == 2 && (this.dopeWidth = ei.value_0 * $intern_80);
|
|
n == 3 && (this.totalWidth = ei.value_0 * $intern_80);
|
|
n == 4 && (this.mobility = ei.value_0 * $intern_102);
|
|
}
|
|
;
|
|
_.setPoints = function setPoints_43(){
|
|
$setPoints(this);
|
|
$calcLeads(this, 32);
|
|
new Point_1;
|
|
new Point_1;
|
|
}
|
|
;
|
|
_.stamp = function stamp_44(){
|
|
}
|
|
;
|
|
_.startIteration = function startIteration_12(){
|
|
var wd;
|
|
wd = this.dopeWidth / this.totalWidth;
|
|
this.dopeWidth += sim_0.timeStep * this.mobility * this.r_on * this.current_0 / this.totalWidth;
|
|
this.dopeWidth < 0 && (this.dopeWidth = 0);
|
|
this.dopeWidth > this.totalWidth && (this.dopeWidth = this.totalWidth);
|
|
this.resistance = this.r_on * wd + this.r_off * (1 - wd);
|
|
}
|
|
;
|
|
_.undumpXml = function undumpXml_53(xml){
|
|
this.flags = $parseIntAttr(xml, 'f', this.flags);
|
|
this.r_on = $parseDoubleAttr(xml, 'ron', this.r_on);
|
|
this.r_off = $parseDoubleAttr(xml, 'rof', this.r_off);
|
|
this.dopeWidth = $parseDoubleAttr(xml, 'do', this.dopeWidth);
|
|
this.totalWidth = $parseDoubleAttr(xml, 'to', this.totalWidth);
|
|
this.mobility = $parseDoubleAttr(xml, 'mo', this.mobility);
|
|
}
|
|
;
|
|
_.dopeWidth = 0;
|
|
_.mobility = 0;
|
|
_.r_off = 0;
|
|
_.r_on = 0;
|
|
_.resistance = 0;
|
|
_.totalWidth = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_MemristorElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'MemristorElm', 437);
|
|
function $composeMainMenu(this$static, mainMenuBar, num){
|
|
var achipMenuBar, activeBlocMenuBar, activeMenuBar, chipMenuBar, gateMenuBar, inputMenuBar, mi, otherMenuBar, outputMenuBar, passMenuBar;
|
|
$makeClassCheckItems(this$static, mainMenuBar, stampJavaTypeInfo(getClassLiteralForArray(Ljava_lang_String_2_classLit, 1), $intern_23, 2, 6, ['Add Wire', 'WireElm', 'Add Routed Wire', 'RoutedWireElm', 'Add Resistor', 'ResistorElm']));
|
|
passMenuBar = new MenuBar_0(true);
|
|
$makeClassCheckItems(this$static, passMenuBar, stampJavaTypeInfo(getClassLiteralForArray(Ljava_lang_String_2_classLit, 1), $intern_23, 2, 6, ['Add Capacitor', 'CapacitorElm', 'Add Capacitor (polarized)', 'PolarCapacitorElm', 'Add Inductor', 'InductorElm', 'Add Switch', 'SwitchElm', 'Add Push Switch', 'PushSwitchElm', 'Add SPDT Switch', 'Switch2Elm', 'Add DPDT Switch', 'DPDTSwitchElm', 'Add Make-Before-Break Switch', 'MBBSwitchElm', 'Add Potentiometer', 'PotElm', 'Add Transformer', 'TransformerElm', 'Add Tapped Transformer', 'TappedTransformerElm', 'Add Custom Transformer', 'CustomTransformerElm', 'Add Transmission Line', 'TransLineElm', 'Add Relay', 'RelayElm', 'Add Relay Coil', 'RelayCoilElm', 'Add Relay Contact', 'RelayContactElm', 'Add Photoresistor', 'LDRElm', 'Add Thermistor', 'ThermistorNTCElm', 'Add Memristor', 'MemristorElm', 'Add Spark Gap', 'SparkGapElm', 'Add Fuse', 'FuseElm', 'Add Crystal', 'CrystalElm', 'Add Cross Switch', 'CrossSwitchElm', 'Add Gyrator', 'GyratorElm']));
|
|
$addItem_0(mainMenuBar, new MenuItem_0(($clinit_SafeHtmlUtils() , new SafeHtmlString(checkBoxHtml + LS(' <\/div>Passive Components'))), passMenuBar));
|
|
inputMenuBar = new MenuBar_0(true);
|
|
$makeClassCheckItems(this$static, inputMenuBar, stampJavaTypeInfo(getClassLiteralForArray(Ljava_lang_String_2_classLit, 1), $intern_23, 2, 6, ['Add Ground', 'GroundElm', 'Add Voltage Source (2-terminal)', 'DCVoltageElm', 'Add A/C Voltage Source (2-terminal)', 'ACVoltageElm', 'Add Voltage Source (1-terminal)', 'RailElm', 'Add A/C Voltage Source (1-terminal)', 'ACRailElm', 'Add Square Wave Source (1-terminal)', 'SquareRailElm', 'Add Clock', 'ClockElm', 'Add A/C Sweep', 'SweepElm', 'Add Battery', 'BatteryElm', 'Add Variable Voltage', 'VarRailElm', 'Add Antenna', 'AntennaElm', 'Add AM Source', 'AMElm', 'Add FM Source', 'FMElm', 'Add Current Source', 'CurrentElm', 'Add Noise Generator', 'NoiseElm', 'Add Audio Input', 'AudioInputElm', 'Add Data Input', 'DataInputElm', 'Add External Voltage (JavaScript)', 'ExtVoltageElm']));
|
|
$addItem_0(mainMenuBar, new MenuItem_0(new SafeHtmlString(checkBoxHtml + LS(' <\/div>Inputs and Sources')), inputMenuBar));
|
|
outputMenuBar = new MenuBar_0(true);
|
|
$makeClassCheckItems(this$static, outputMenuBar, stampJavaTypeInfo(getClassLiteralForArray(Ljava_lang_String_2_classLit, 1), $intern_23, 2, 6, ['Add Analog Output', 'OutputElm', 'Add LED', 'LEDElm', 'Add Lamp', 'LampElm', 'Add Text', 'TextElm', 'Add Box', 'BoxElm', 'Add Line', 'LineElm', 'Add Labeled Node', 'LabeledNodeElm', 'Add Voltmeter/Scope Probe', 'ProbeElm', 'Add Ohmmeter', 'OhmMeterElm', 'Add Ammeter', 'AmmeterElm', 'Add Wattmeter', 'WattmeterElm', 'Add Test Point', 'TestPointElm', 'Add Decimal Display', 'DecimalDisplayElm', 'Add Instruction Display', 'InstructionDisplayElm', 'Add LED Array', 'LEDArrayElm', 'Add Data Export', 'DataRecorderElm', 'Add Audio Output', 'AudioOutputElm', 'Add Stop Trigger', 'StopTriggerElm', 'Add DC Motor', 'DCMotorElm', 'Add 3-Phase Motor', 'ThreePhaseMotorElm']));
|
|
$addItem_0(mainMenuBar, new MenuItem_0(new SafeHtmlString(checkBoxHtml + LS(' <\/div>Outputs and Labels')), outputMenuBar));
|
|
$register(new CCVSElm(0, 0));
|
|
$register(new VCCSElm(0, 0));
|
|
activeMenuBar = new MenuBar_0(true);
|
|
$makeClassCheckItems(this$static, activeMenuBar, stampJavaTypeInfo(getClassLiteralForArray(Ljava_lang_String_2_classLit, 1), $intern_23, 2, 6, ['Add Diode', 'DiodeElm', 'Add Zener Diode', 'ZenerElm', 'Add Transistor (bipolar, NPN)', 'NTransistorElm', 'Add Transistor (bipolar, PNP)', 'PTransistorElm', 'Add MOSFET (N-Channel)', 'NMosfetElm', 'Add MOSFET (P-Channel)', 'PMosfetElm', 'Add JFET (N-Channel)', 'NJfetElm', 'Add JFET (P-Channel)', 'PJfetElm', 'Add SCR', 'SCRElm', 'Add DIAC', 'DiacElm', 'Add TRIAC', 'TriacElm', 'Add Darlington Pair (NPN)', 'NDarlingtonElm', 'Add Darlington Pair (PNP)', 'PDarlingtonElm', 'Add Varactor/Varicap', 'VaractorElm', 'Add Tunnel Diode', 'TunnelDiodeElm', 'Add Triode', 'TriodeElm', 'Add Unijunction Transistor', 'UnijunctionElm']));
|
|
$addItem_0(mainMenuBar, new MenuItem_0(new SafeHtmlString(checkBoxHtml + LS(' <\/div>Active Components')), activeMenuBar));
|
|
activeBlocMenuBar = new MenuBar_0(true);
|
|
$addItem_0(mainMenuBar, new MenuItem_0(new SafeHtmlString(checkBoxHtml + LS(' <\/div>Active Building Blocks')), activeBlocMenuBar));
|
|
gateMenuBar = new MenuBar_0(true);
|
|
$makeClassCheckItems(this$static, gateMenuBar, stampJavaTypeInfo(getClassLiteralForArray(Ljava_lang_String_2_classLit, 1), $intern_23, 2, 6, ['Add Logic Input', 'LogicInputElm', 'Add Logic Output', 'LogicOutputElm', 'Add Bus Input', 'BusLogicInputElm', 'Add Inverter', 'InverterElm', 'Add NAND Gate', 'NandGateElm', 'Add NOR Gate', 'NorGateElm', 'Add AND Gate', 'AndGateElm', 'Add OR Gate', 'OrGateElm', 'Add XOR Gate', 'XorGateElm', 'Add XNOR Gate', 'XnorGateElm']));
|
|
$addItem_0(mainMenuBar, new MenuItem_0(new SafeHtmlString(checkBoxHtml + LS(' <\/div>Logic Gates, Input and Output')), gateMenuBar));
|
|
chipMenuBar = new MenuBar_0(true);
|
|
$makeClassCheckItems(this$static, chipMenuBar, stampJavaTypeInfo(getClassLiteralForArray(Ljava_lang_String_2_classLit, 1), $intern_23, 2, 6, ['Add D Flip-Flop', 'DFlipFlopElm', 'Add JK Flip-Flop', 'JKFlipFlopElm', 'Add T Flip-Flop', 'TFlipFlopElm', 'Add 7 Segment LED', 'SevenSegElm', 'Add 7 Segment Decoder', 'SevenSegDecoderElm', 'Add Multiplexer', 'MultiplexerElm', 'Add Demultiplexer', 'DeMultiplexerElm', 'Add SIPO shift register', 'SipoShiftElm', 'Add PISO shift register', 'PisoShiftElm', 'Add Counter', 'CounterElm', 'Add Counter w/ Load', 'Counter2Elm', 'Add Ring Counter', 'DecadeElm', 'Add Latch/Register', 'LatchElm', 'Add Sequence generator', 'SeqGenElm', 'Add Adder', 'FullAdderElm', 'Add Half Adder', 'HalfAdderElm', 'Add Custom Logic', 'UserDefinedLogicElm', 'Add Static RAM', 'SRAMElm', 'Add ROM', 'ROMElm', 'Add Bus Transceiver', 'BusTransceiverElm', 'Add Bus Splitter', 'BusSplitterElm']));
|
|
$addItem_0(mainMenuBar, new MenuItem_0(new SafeHtmlString(checkBoxHtml + LS(' <\/div>Digital Chips')), chipMenuBar));
|
|
achipMenuBar = new MenuBar_0(true);
|
|
$makeClassCheckItems(this$static, achipMenuBar, stampJavaTypeInfo(getClassLiteralForArray(Ljava_lang_String_2_classLit, 1), $intern_23, 2, 6, ['Add 555 Timer', 'TimerElm', 'Add Phase Comparator', 'PhaseCompElm', 'Add DAC', 'DACElm', 'Add ADC', 'ADCElm', 'Add VCO', 'VCOElm', 'Add Monostable', 'MonostableElm']));
|
|
$addItem_0(mainMenuBar, new MenuItem_0(new SafeHtmlString(checkBoxHtml + LS(' <\/div>Analog and Hybrid Chips')), achipMenuBar));
|
|
$makeClassCheckItems(this$static, activeBlocMenuBar, stampJavaTypeInfo(getClassLiteralForArray(Ljava_lang_String_2_classLit, 1), $intern_23, 2, 6, ['Add Op Amp (ideal, - on top)', 'OpAmpElm', 'Add Op Amp (ideal, + on top)', 'OpAmpSwapElm', 'Add Op Amp (real)', 'OpAmpRealElm', 'Add Analog Switch (SPST)', 'AnalogSwitchElm', 'Add Analog Switch (SPDT)', 'AnalogSwitch2Elm', 'Add Analog Multiplexer', 'AnalogMuxElm', 'Add Tristate Buffer', 'TriStateElm', 'Add Schmitt Trigger', 'SchmittElm', 'Add Schmitt Trigger (Inverting)', 'InvertingSchmittElm', 'Add Delay Buffer', 'DelayBufferElm', 'Add CCII+', 'CC2Elm', 'Add CCII-', 'CC2NegElm', 'Add Comparator (Hi-Z/GND output)', 'ComparatorElm', 'Add OTA (LM13700 style)', 'OTAElm', 'Add Norton Amp (LM3900)', 'NortonAmpElm', 'Add Voltage-Controlled Voltage Source (VCVS)', 'VCVSElm', 'Add Voltage-Controlled Current Source (VCCS)', 'VCCSElm', 'Add Current-Controlled Voltage Source (CCVS)', 'CCVSElm', 'Add Current-Controlled Current Source (CCCS)', 'CCCSElm', 'Add Optocoupler', 'OptocouplerElm', 'Add Time Delay Relay', 'TimeDelayRelayElm', 'Add LM317', 'CustomCompositeElm:~LM317-v2', 'Add TL431', 'CustomCompositeElm:~TL431', 'Add Motor Protection Switch', 'MotorProtectionSwitchElm', 'Add Subcircuit Instance', 'CustomCompositeElm']));
|
|
this$static.subcircuitMenuBar == null && (this$static.subcircuitMenuBar = initUnidimensionalArray(Lcom_google_gwt_user_client_ui_MenuBar_2_classLit, $intern_3, 58, 2, 0, 1));
|
|
this$static.subcircuitMenuBar[num] = new MenuBar_0(true);
|
|
$addItem_0(mainMenuBar, new MenuItem_0(new SafeHtmlString(checkBoxHtml + LS(' <\/div>Subcircuits')), this$static.subcircuitMenuBar[num]));
|
|
otherMenuBar = new MenuBar_0(true);
|
|
$addItem_0(otherMenuBar, mi = $getClassCheckItem(this$static, LS('Drag All'), 'DragAll'));
|
|
$setShortcut(mi, LS('(Alt-drag)'));
|
|
$addItem_0(otherMenuBar, mi = $getClassCheckItem(this$static, LS('Drag Row'), 'DragRow'));
|
|
$setShortcut(mi, LS('(A-S-drag)'));
|
|
$addItem_0(otherMenuBar, mi = $getClassCheckItem(this$static, LS('Drag Column'), 'DragColumn'));
|
|
$setShortcut(mi, this$static.isMac?LS('(A-Cmd-drag)'):LS('(A-M-drag)'));
|
|
$addItem_0(otherMenuBar, $getClassCheckItem(this$static, LS('Drag Selected'), 'DragSelected'));
|
|
$addItem_0(otherMenuBar, mi = $getClassCheckItem(this$static, LS('Drag Post'), 'DragPost'));
|
|
$setShortcut(mi, '(' + this$static.ctrlMetaKey + 'drag)');
|
|
$addItem_0(mainMenuBar, new MenuItem_0(new SafeHtmlString(checkBoxHtml + LS(' <\/div>Drag')), otherMenuBar));
|
|
$addItem_0(mainMenuBar, mi = $getClassCheckItem(this$static, LS('Select/Drag Sel'), 'Select'));
|
|
$setShortcut(mi, LS('(space or Shift-drag)'));
|
|
}
|
|
|
|
function $getClassCheckItem(this$static, s, t){
|
|
return $getClassCheckItem_0(this$static.sim.ui, s, t);
|
|
}
|
|
|
|
function $getSetupList(this$static, openDefault){
|
|
var requestBuilder, url_0;
|
|
url_0 = getModuleBaseURL() + 'setuplist.txt';
|
|
requestBuilder = new RequestBuilder(($clinit_RequestBuilder() , GET), url_0);
|
|
try {
|
|
$sendRequest(requestBuilder, new Menus$7(this$static, openDefault));
|
|
}
|
|
catch ($e0) {
|
|
$e0 = toJava($e0);
|
|
if (!instanceOf($e0, 156))
|
|
throw toJs($e0);
|
|
}
|
|
}
|
|
|
|
function $iconMenuItem(icon, text_0, cmd){
|
|
var icoStr;
|
|
icoStr = '<i class="cirjsicon-' + icon + '"><\/i> ' + LS(text_0);
|
|
return new MenuItem(($clinit_SafeHtmlUtils() , new SafeHtmlString(icoStr)), cmd);
|
|
}
|
|
|
|
function $init_2(this$static){
|
|
var drawMenuBar, icoStr, m, os;
|
|
os = $wnd.navigator.platform;
|
|
this$static.isMac = os.toLowerCase().indexOf('mac') != -1;
|
|
this$static.ctrlMetaKey = this$static.isMac?LS('Cmd-'):LS('Ctrl-');
|
|
this$static.fileMenuBar = new MenuBar_0(true);
|
|
$wnd.openFile != undefined && $addItem_0(this$static.fileMenuBar, $menuItemWithShortcut('window', 'New Window...', LS(this$static.ctrlMetaKey + 'N'), new MyCommand('file', 'newwindow')));
|
|
$addItem_0(this$static.fileMenuBar, $iconMenuItem('doc-new', 'New Blank Circuit', new MyCommand('file', 'newblankcircuit')));
|
|
this$static.importFromLocalFileItem = $menuItemWithShortcut('folder', 'Open File...', LS(this$static.ctrlMetaKey + 'O'), new MyCommand('file', 'importfromlocalfile'));
|
|
$setEnabled_1(this$static.importFromLocalFileItem, isSupported_1());
|
|
$addItem_0(this$static.fileMenuBar, this$static.importFromLocalFileItem);
|
|
this$static.importFromTextItem = $iconMenuItem('doc-text', 'Import From Text...', new MyCommand('file', 'importfromtext'));
|
|
$addItem_0(this$static.fileMenuBar, this$static.importFromTextItem);
|
|
this$static.importFromDropboxItem = $iconMenuItem('dropbox', 'Import From Dropbox...', new MyCommand('file', 'importfromdropbox'));
|
|
$addItem_0(this$static.fileMenuBar, this$static.importFromDropboxItem);
|
|
if ($wnd.openFile != undefined) {
|
|
this$static.saveFileItem = $addItem_0(this$static.fileMenuBar, $menuItemWithShortcut('floppy', 'Save', LS(this$static.ctrlMetaKey + 'S'), new MyCommand('file', 'save')));
|
|
$addItem_0(this$static.fileMenuBar, $iconMenuItem('floppy', 'Save As...', new MyCommand('file', 'saveas')));
|
|
}
|
|
else {
|
|
this$static.exportAsLocalFileItem = $menuItemWithShortcut('floppy', 'Save As...', LS(this$static.ctrlMetaKey + 'S'), new MyCommand('file', 'exportaslocalfile'));
|
|
$setEnabled_1(this$static.exportAsLocalFileItem, !!('download' in $doc.createElement('a')));
|
|
$addItem_0(this$static.fileMenuBar, this$static.exportAsLocalFileItem);
|
|
}
|
|
this$static.exportAsUrlItem = $iconMenuItem('export', 'Export As Link...', new MyCommand('file', 'exportasurl'));
|
|
$addItem_0(this$static.fileMenuBar, this$static.exportAsUrlItem);
|
|
this$static.exportAsTextItem = $iconMenuItem('export', 'Export As Text...', new MyCommand('file', 'exportastext'));
|
|
$addItem_0(this$static.fileMenuBar, this$static.exportAsTextItem);
|
|
$addItem_0(this$static.fileMenuBar, $iconMenuItem('image', 'Save As Image...', new MyCommand('file', 'exportasimage')));
|
|
$addItem_0(this$static.fileMenuBar, $iconMenuItem('image', 'Copy Circuit Image to Clipboard', new MyCommand('file', 'copypng')));
|
|
$addItem_0(this$static.fileMenuBar, $iconMenuItem('image', 'Save As SVG...', new MyCommand('file', 'exportassvg')));
|
|
$addItem_0(this$static.fileMenuBar, $iconMenuItem('microchip', 'Create Subcircuit...', new MyCommand('file', 'createsubcircuit')));
|
|
$addItem_0(this$static.fileMenuBar, $iconMenuItem('magic', 'Find DC Operating Point', new MyCommand('file', 'dcanalysis')));
|
|
this$static.recoverItem = $iconMenuItem('back-in-time', 'Recover Auto-Save', new MyCommand('file', 'recover'));
|
|
$addItem_0(this$static.fileMenuBar, this$static.recoverItem);
|
|
this$static.printItem = $menuItemWithShortcut('print', 'Print...', LS(this$static.ctrlMetaKey + 'P'), new MyCommand('file', 'print'));
|
|
$addItem_0(this$static.fileMenuBar, this$static.printItem);
|
|
$addSeparator(this$static.fileMenuBar, new MenuItemSeparator);
|
|
$addItem_0(this$static.fileMenuBar, $iconMenuItem('resize-full-alt', 'Toggle Full Screen', new MyCommand('view', 'fullscreen')));
|
|
$addSeparator(this$static.fileMenuBar, new MenuItemSeparator);
|
|
this$static.aboutItem = (icoStr = '<i class="cirjsicon-info-circled"><\/i> ' + LS('About...') , new MenuItem(($clinit_SafeHtmlUtils() , new SafeHtmlString(icoStr)), null));
|
|
$addItem_0(this$static.fileMenuBar, this$static.aboutItem);
|
|
$setScheduledCommand(this$static.aboutItem, new MyCommand('file', 'about'));
|
|
this$static.menuBar = new MenuBar;
|
|
$addItem_0(this$static.menuBar, new MenuItem_2(LS('File'), this$static.fileMenuBar));
|
|
m = new MenuBar_0(true);
|
|
$addItem_0(m, this$static.undoItem = $menuItemWithShortcut('ccw', 'Undo', LS(this$static.ctrlMetaKey + 'Z'), new MyCommand('edit', 'undo')));
|
|
$addItem_0(m, this$static.redoItem = $menuItemWithShortcut('cw', 'Redo', LS(this$static.ctrlMetaKey + 'Y'), new MyCommand('edit', 'redo')));
|
|
$addSeparator(m, new MenuItemSeparator);
|
|
$addItem_0(m, this$static.cutItem = $menuItemWithShortcut('scissors', 'Cut', LS(this$static.ctrlMetaKey + 'X'), new MyCommand('edit', 'cut')));
|
|
$addItem_0(m, this$static.copyItem = $menuItemWithShortcut('copy', 'Copy', LS(this$static.ctrlMetaKey + 'C'), new MyCommand('edit', 'copy')));
|
|
$addItem_0(m, this$static.pasteItem = $menuItemWithShortcut('paste', 'Paste', LS(this$static.ctrlMetaKey + 'V'), new MyCommand('edit', 'paste')));
|
|
$setEnabled_1(this$static.pasteItem, false);
|
|
$addItem_0(m, $menuItemWithShortcut('clone', 'Duplicate', LS(this$static.ctrlMetaKey + 'D'), new MyCommand('edit', 'duplicate')));
|
|
$addSeparator(m, new MenuItemSeparator);
|
|
$addItem_0(m, $menuItemWithShortcut('select-all', 'Select All', LS(this$static.ctrlMetaKey + 'A'), new MyCommand('edit', 'selectAll')));
|
|
$addSeparator(m, new MenuItemSeparator);
|
|
$addItem_0(m, $menuItemWithShortcut('search', 'Find Component...', '/', new MyCommand('edit', 'search')));
|
|
$addItem_0(m, $iconMenuItem('target', weAreInUS(false)?'Center Circuit':'Centre Circuit', new MyCommand('edit', 'centercircuit')));
|
|
$addItem_0(m, $menuItemWithShortcut('zoom-11', 'Zoom 100%', '0', new MyCommand('zoom', 'zoom100')));
|
|
$addItem_0(m, $menuItemWithShortcut('zoom-in', 'Zoom In', '+', new MyCommand('zoom', 'zoomin')));
|
|
$addItem_0(m, $menuItemWithShortcut('zoom-out', 'Zoom Out', '-', new MyCommand('zoom', 'zoomout')));
|
|
$addItem_0(m, this$static.rotateItem = $iconMenuItem('cw', 'Rotate', new MyCommand('edit', 'rotate')));
|
|
$addItem_0(m, this$static.mirrorItem = $iconMenuItem('flip-x', 'Mirror', new MyCommand('edit', 'mirror')));
|
|
$addItem_0(this$static.menuBar, new MenuItem_2(LS('Edit'), m));
|
|
drawMenuBar = new MenuBar_0(true);
|
|
drawMenuBar.autoOpen = true;
|
|
$addItem_0(this$static.menuBar, new MenuItem_2(LS('Draw'), drawMenuBar));
|
|
m = new MenuBar_0(true);
|
|
$addItem_0(m, this$static.stackAllItem = $iconMenuItem('lines', 'Stack All', new MyCommand('scopes', 'stackAll')));
|
|
$addItem_0(m, this$static.unstackAllItem = $iconMenuItem('columns', 'Unstack All', new MyCommand('scopes', 'unstackAll')));
|
|
$addItem_0(m, this$static.combineAllItem = $iconMenuItem('object-group', 'Combine All', new MyCommand('scopes', 'combineAll')));
|
|
$addItem_0(m, this$static.separateAllItem = $iconMenuItem('object-ungroup', 'Separate All', new MyCommand('scopes', 'separateAll')));
|
|
$addItem_0(this$static.menuBar, new MenuItem_2(LS('Scopes'), m));
|
|
this$static.optionsMenuBar = m = new MenuBar_0(true);
|
|
$addItem_0(this$static.menuBar, new MenuItem_2(LS('Options'), this$static.optionsMenuBar));
|
|
$addItem_0(m, this$static.dotsCheckItem = new CheckboxMenuItem(LS('Show Current')));
|
|
$setState_1(this$static.dotsCheckItem, true);
|
|
$addItem_0(m, this$static.voltsCheckItem = new CheckboxMenuItem_0(LS('Show Voltage'), new Menus$1(this$static)));
|
|
$setState_1(this$static.voltsCheckItem, true);
|
|
$addItem_0(m, this$static.powerCheckItem = new CheckboxMenuItem_0(LS('Show Power'), new Menus$2(this$static)));
|
|
$addItem_0(m, this$static.showValuesCheckItem = new CheckboxMenuItem(LS('Show Values')));
|
|
$setState_1(this$static.showValuesCheckItem, true);
|
|
$addItem_0(m, this$static.smallGridCheckItem = new CheckboxMenuItem_0(LS('Small Grid'), new Menus$3(this$static)));
|
|
$addItem_0(m, this$static.toolbarCheckItem = new CheckboxMenuItem_0(LS('Toolbar'), new Menus$4(this$static)));
|
|
$addItem_0(m, this$static.crossHairCheckItem = new CheckboxMenuItem_0(LS('Show Cursor Crosshair'), new Menus$5(this$static)));
|
|
$addItem_0(m, this$static.euroResistorCheckItem = new CheckboxMenuItem(LS('European Resistors')));
|
|
$addItem_0(m, this$static.euroGatesCheckItem = new CheckboxMenuItem(LS('IEC Gates')));
|
|
$addItem_0(m, this$static.printableCheckItem = new CheckboxMenuItem(LS('White Background')));
|
|
$addItem_0(m, this$static.conventionCheckItem = new CheckboxMenuItem(LS('Conventional Current Motion')));
|
|
$addItem_0(m, this$static.noEditCheckItem = new CheckboxMenuItem(LS('Disable Editing')));
|
|
$addItem_0(m, this$static.mouseWheelEditCheckItem = new CheckboxMenuItem_0(LS('Edit Values With Mouse Wheel'), new Menus$6(this$static)));
|
|
$addItem_0(m, new CheckboxAlignedMenuItem(LS('Shortcuts...'), new MyCommand('options', 'shortcuts')));
|
|
$addItem_0(m, new CheckboxAlignedMenuItem(LS('Other Options...'), new MyCommand('options', 'other')));
|
|
$wnd.openFile != undefined && $addItem_0(m, new CheckboxAlignedMenuItem(LS('Toggle Dev Tools'), new MyCommand('options', 'devtools')));
|
|
m = new MenuBar_0(true);
|
|
$addItem_0(m, new MenuItem_1(LS('Convert Wires to Routed Wires'), new MyCommand('tools', 'convertWires')));
|
|
$addItem_0(m, new MenuItem_1(LS('Subcircuit Manager'), new MyCommand('tools', 'subcircuits')));
|
|
$addItem_0(this$static.menuBar, new MenuItem_2(LS('Tools'), m));
|
|
this$static.mainMenuBar = new MenuBar_0(true);
|
|
this$static.mainMenuBar.autoOpen = true;
|
|
$composeMainMenu(this$static, this$static.mainMenuBar, 0);
|
|
$composeMainMenu(this$static, drawMenuBar, 1);
|
|
this$static.elmMenuBar = new MenuBar_0(true);
|
|
this$static.elmMenuBar.autoOpen = true;
|
|
$addItem_0(this$static.elmMenuBar, this$static.elmEditMenuItem = new MenuItem_1(LS('Edit...'), new MyCommand('elm', 'edit')));
|
|
$addItem_0(this$static.elmMenuBar, this$static.elmScopeMenuItem = new MenuItem_1(LS('View in New Scope'), new MyCommand('elm', 'viewInScope')));
|
|
$addItem_0(this$static.elmMenuBar, this$static.elmFloatScopeMenuItem = new MenuItem_1(LS('View in New Undocked Scope'), new MyCommand('elm', 'viewInFloatScope')));
|
|
$addItem_0(this$static.elmMenuBar, this$static.elmAddScopeMenuItem = new MenuItem_1(LS('Add to Existing Scope'), new MyCommand('elm', 'addToScope0')));
|
|
$addItem_0(this$static.elmMenuBar, new MenuItem_1(LS('Cut'), new MyCommand('elm', 'cut')));
|
|
$addItem_0(this$static.elmMenuBar, new MenuItem_1(LS('Copy'), new MyCommand('elm', 'copy')));
|
|
$addItem_0(this$static.elmMenuBar, new MenuItem_1(LS('Delete'), new MyCommand('elm', 'delete')));
|
|
$addItem_0(this$static.elmMenuBar, new MenuItem_1(LS('Duplicate'), new MyCommand('elm', 'duplicate')));
|
|
$addItem_0(this$static.elmMenuBar, new MenuItem_1(LS('Swap Terminals'), new MyCommand('elm', 'flip')));
|
|
$addItem_0(this$static.elmMenuBar, this$static.elmRotateMenuItem = new MenuItem_1(LS('Rotate'), new MyCommand('elm', 'rotate')));
|
|
$addItem_0(this$static.elmMenuBar, this$static.elmMirrorMenuItem = new MenuItem_1(LS('Mirror'), new MyCommand('elm', 'mirror')));
|
|
$addItem_0(this$static.elmMenuBar, this$static.elmSplitMenuItem = $menuItemWithShortcut('', 'Split Wire Manually', LS(this$static.ctrlMetaKey + 'click'), new MyCommand('elm', 'split')));
|
|
$addItem_0(this$static.elmMenuBar, this$static.elmSliderMenuItem = new MenuItem_1(LS('Sliders...'), new MyCommand('elm', 'sliders')));
|
|
}
|
|
|
|
function $makeClassCheckItems(this$static, mb, items){
|
|
var i;
|
|
for (i = 0; i < items.length; i += 2)
|
|
$addItem_0(mb, $getClassCheckItem(this$static, LS(items[i]), items[i + 1]));
|
|
}
|
|
|
|
function $menuItemWithShortcut(icon, text_0, shortcut, cmd){
|
|
var nbsp, schtml, sn;
|
|
nbsp = ' ';
|
|
icon == '' && (nbsp = '');
|
|
schtml = shortcut.length <= 1?'<div style="display:inline-block;width:20px;right:10px;text-align:center;position:absolute;">' + shortcut + '<\/div>':'<div style="display:inline-block;right:10px;text-align:right;position:absolute;">' + shortcut + '<\/div>';
|
|
sn = '<div style="white-space:nowrap"><div style="display:inline-block;width:100%;"><i class="cirjsicon-' + icon + '"><\/i>' + nbsp + LS(text_0) + '<\/div>' + schtml + '<\/div>';
|
|
return new MenuItem(($clinit_SafeHtmlUtils() , new SafeHtmlString(sn)), cmd);
|
|
}
|
|
|
|
function $processSetupList(this$static, b, openDefault){
|
|
var currentMenuBar, file, first, i, l_0, lastArg, len, line, n, p, stack_0, stackptr, startCircuit, startLabel, title_0;
|
|
len = b.length;
|
|
stack_0 = initUnidimensionalArray(Lcom_google_gwt_user_client_ui_MenuBar_2_classLit, $intern_3, 58, 6, 0, 1);
|
|
stackptr = 0;
|
|
currentMenuBar = new MenuBar_0(true);
|
|
currentMenuBar.autoOpen = true;
|
|
$addItem_0(this$static.menuBar, new MenuItem_2(LS('Circuits'), currentMenuBar));
|
|
stack_0[stackptr++] = currentMenuBar;
|
|
for (p = 0; p < len;) {
|
|
for (l_0 = 0; l_0 != len - p; l_0++)
|
|
if (b[l_0 + p] == 10 || b[l_0 + p] == 13) {
|
|
++l_0;
|
|
break;
|
|
}
|
|
line = valueOf_2($decodeString(b, p, (lastArg = l_0 - 1 , $clinit_EmulatedCharset() , lastArg)));
|
|
if (line.length == 0 || (checkCriticalStringElementIndex(0, line.length) , line.charCodeAt(0) == 35))
|
|
;
|
|
else {
|
|
checkCriticalStringElementIndex(0, line.length);
|
|
if (line.charCodeAt(0) == 43) {
|
|
n = new MenuBar_0(true);
|
|
n.autoOpen = true;
|
|
$addItem_0(currentMenuBar, new MenuItem_2(LS(line.substr(1)), n));
|
|
currentMenuBar = stack_0[stackptr++] = n;
|
|
}
|
|
else {
|
|
checkCriticalStringElementIndex(0, line.length);
|
|
if (line.charCodeAt(0) == 45) {
|
|
currentMenuBar = stack_0[--stackptr - 1];
|
|
}
|
|
else {
|
|
i = $indexOf_1(line, fromCodePoint(32));
|
|
if (i > 0) {
|
|
title_0 = LS(line.substr(i + 1));
|
|
first = false;
|
|
checkCriticalStringElementIndex(0, line.length);
|
|
line.charCodeAt(0) == 62 && (first = true);
|
|
file = line.substr(first?1:0, i - (first?1:0));
|
|
$addItem_0(currentMenuBar, new MenuItem_1(title_0, new MyCommand('circuits', 'setup ' + file + ' ' + title_0)));
|
|
startCircuit = this$static.sim.startCircuit;
|
|
startLabel = this$static.sim.startLabel;
|
|
$equals_1(file, startCircuit) && startLabel == null && $setCircuitTitle(this$static.sim, title_0);
|
|
first && startCircuit == null && openDefault && this$static.sim.stopMessage == null && $readSetupFile(this$static, file, title_0);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
p += l_0;
|
|
}
|
|
}
|
|
|
|
function $readSetupFile(this$static, str, title_0){
|
|
var url_0;
|
|
$clinit_System();
|
|
$resetEditingContext(this$static.sim);
|
|
url_0 = getModuleBaseURL() + 'circuits/' + str;
|
|
$loadFileFromURL(this$static.sim.loader, url_0);
|
|
title_0 != null && $setCircuitTitle(this$static.sim, title_0);
|
|
this$static.sim.unsavedChanges = false;
|
|
setLastFileName($equals_1(str, 'blank.txt')?null:str);
|
|
}
|
|
|
|
function Menus(sim_){
|
|
this.sim = sim_;
|
|
}
|
|
|
|
defineClass(551, 1, {}, Menus);
|
|
_.isMac = false;
|
|
var Lcom_lushprojects_circuitjs1_client_Menus_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'Menus', 551);
|
|
function Menus$1(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(552, 1, {}, Menus$1);
|
|
_.execute_1 = function execute_29(){
|
|
this.this$01.voltsCheckItem.on && $setState_1(this.this$01.powerCheckItem, false);
|
|
$setPowerBarEnable(this.this$01.sim.ui);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_Menus$1_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'Menus/1', 552);
|
|
function Menus$2(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(553, 1, {}, Menus$2);
|
|
_.execute_1 = function execute_30(){
|
|
this.this$01.powerCheckItem.on && $setState_1(this.this$01.voltsCheckItem, false);
|
|
$setPowerBarEnable(this.this$01.sim.ui);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_Menus$2_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'Menus/2', 553);
|
|
function Menus$3(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(554, 1, {}, Menus$3);
|
|
_.execute_1 = function execute_31(){
|
|
$setGrid(this.this$01.sim.ui);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_Menus$3_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'Menus/3', 554);
|
|
function Menus$4(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(555, 1, {}, Menus$4);
|
|
_.execute_1 = function execute_32(){
|
|
$setToolbar(this.this$01.sim.ui);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_Menus$4_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'Menus/4', 555);
|
|
function Menus$5(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(556, 1, {}, Menus$5);
|
|
_.execute_1 = function execute_33(){
|
|
$setOptionInStorage('crossHair', this.this$01.crossHairCheckItem.on);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_Menus$5_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'Menus/5', 556);
|
|
function Menus$6(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(557, 1, {}, Menus$6);
|
|
_.execute_1 = function execute_34(){
|
|
$setOptionInStorage('mouseWheelEdit', this.this$01.mouseWheelEditCheckItem.on);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_Menus$6_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'Menus/6', 557);
|
|
function Menus$7(this$0, val$openDefault){
|
|
this.this$01 = this$0;
|
|
this.val$openDefault2 = val$openDefault;
|
|
}
|
|
|
|
defineClass(558, 1, {}, Menus$7);
|
|
_.onError = function onError_1(request, exception){
|
|
alert_0(LS("Can't load circuit list!"));
|
|
}
|
|
;
|
|
_.onResponseReceived = function onResponseReceived_1(request, response){
|
|
var lastArg, text_0;
|
|
if (response.xmlHttpRequest.status == 200) {
|
|
text_0 = response.xmlHttpRequest.responseText;
|
|
$processSetupList(this.this$01, $getBytes((lastArg = text_0 , $clinit_EmulatedCharset() , lastArg)), this.val$openDefault2);
|
|
}
|
|
else {
|
|
alert_0(LS("Can't load circuit list!"));
|
|
}
|
|
}
|
|
;
|
|
_.val$openDefault2 = false;
|
|
var Lcom_lushprojects_circuitjs1_client_Menus$7_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'Menus/7', 558);
|
|
function $$init_12(this$static){
|
|
this$static.prevInputValue = false;
|
|
this$static.retriggerable = false;
|
|
this$static.triggered = false;
|
|
this$static.lastRisingEdge = 0;
|
|
this$static.delay = $intern_34;
|
|
}
|
|
|
|
function $reset_8(this$static){
|
|
$reset_0(this$static);
|
|
this$static.pins[2].value_0 = true;
|
|
this$static.triggered = this$static.prevInputValue = false;
|
|
}
|
|
|
|
function MonostableElm(xx, yy){
|
|
$clinit_ChipElm();
|
|
ChipElm.call(this, xx, yy);
|
|
$$init_12(this);
|
|
$reset_8(this);
|
|
}
|
|
|
|
function MonostableElm_0(xa, ya, xb, yb, f, st){
|
|
$clinit_ChipElm();
|
|
ChipElm_0.call(this, xa, ya, xb, yb, f, st);
|
|
$$init_12(this);
|
|
this.retriggerable = $booleanValue(($clinit_Boolean() , $equalsIgnoreCase('true', $nextToken(st))));
|
|
this.delay = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
$reset_8(this);
|
|
}
|
|
|
|
defineClass(419, 32, $intern_85, MonostableElm, MonostableElm_0);
|
|
_.dumpXml = function dumpXml_51(doc, elem){
|
|
$dumpXml_0(this, elem);
|
|
dumpAttr_2(elem, 'rt', this.retriggerable);
|
|
dumpAttr(elem, 'dl', this.delay);
|
|
}
|
|
;
|
|
_.execute_3 = function execute_35(){
|
|
if (this.pins[0].value_0 && this.prevInputValue != this.pins[0].value_0 && (this.retriggerable || !this.triggered)) {
|
|
this.lastRisingEdge = sim_0.t;
|
|
this.pins[1].value_0 = true;
|
|
this.pins[2].value_0 = false;
|
|
this.triggered = true;
|
|
}
|
|
if (this.triggered && sim_0.t > this.lastRisingEdge + this.delay) {
|
|
this.pins[1].value_0 = false;
|
|
this.pins[2].value_0 = true;
|
|
this.triggered = false;
|
|
}
|
|
this.prevInputValue = this.pins[0].value_0;
|
|
}
|
|
;
|
|
_.getChipEditInfo = function getChipEditInfo_16(n){
|
|
var ei;
|
|
if (n == 0) {
|
|
ei = new EditInfo_0('', 0, -1, -1);
|
|
ei.checkbox = new Checkbox_0('Retriggerable', this.retriggerable);
|
|
return ei;
|
|
}
|
|
if (n == 1) {
|
|
ei = new EditInfo_0('Period (s)', this.delay, $intern_83, 0.1);
|
|
return ei;
|
|
}
|
|
return null;
|
|
}
|
|
;
|
|
_.getChipName = function getChipName_19(){
|
|
return 'Monostable';
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_65(){
|
|
return 194;
|
|
}
|
|
;
|
|
_.getPostCount_0 = function getPostCount_46(){
|
|
return 3;
|
|
}
|
|
;
|
|
_.getVoltageSourceCount = function getVoltageSourceCount_38(){
|
|
return 2;
|
|
}
|
|
;
|
|
_.reset_0 = function reset_28(){
|
|
$reset_8(this);
|
|
}
|
|
;
|
|
_.setChipEditValue = function setChipEditValue_17(n, ei){
|
|
n == 0 && (this.retriggerable = $getState(ei.checkbox));
|
|
n == 1 && (this.delay = ei.value_0);
|
|
}
|
|
;
|
|
_.setupPins = function setupPins_20(){
|
|
this.sizeX = 2;
|
|
this.sizeY = 2;
|
|
this.pins = initUnidimensionalArray(Lcom_lushprojects_circuitjs1_client_ChipElm$Pin_2_classLit, $intern_3, 9, 3, 0, 1);
|
|
this.pins[0] = new ChipElm$Pin(this, 0, 2, '');
|
|
this.pins[0].clock = true;
|
|
this.pins[1] = new ChipElm$Pin(this, 0, 3, 'Q');
|
|
this.pins[1].output = true;
|
|
this.pins[2] = new ChipElm$Pin(this, 1, 3, 'Q');
|
|
this.pins[2].output = true;
|
|
this.pins[2].lineOver = true;
|
|
}
|
|
;
|
|
_.undumpXml = function undumpXml_54(xml){
|
|
$undumpXml_0(this, xml);
|
|
this.retriggerable = $parseBooleanAttr(xml, 'rt', this.retriggerable);
|
|
this.delay = $parseDoubleAttr(xml, 'dl', this.delay);
|
|
$reset_8(this);
|
|
}
|
|
;
|
|
_.delay = 0;
|
|
_.lastRisingEdge = 0;
|
|
_.prevInputValue = false;
|
|
_.retriggerable = false;
|
|
_.triggered = false;
|
|
var Lcom_lushprojects_circuitjs1_client_MonostableElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'MonostableElm', 419);
|
|
function $dumpXml_8(this$static, doc){
|
|
var elem;
|
|
this$static.dumped = true;
|
|
elem = $createElement(doc, 'mm');
|
|
dumpAttr_1(elem, 'nm', this$static.name_0);
|
|
dumpAttr_0(elem, 'f', this$static.flags);
|
|
dumpAttr(elem, 'vt', this$static.threshold);
|
|
dumpAttr(elem, 'be', this$static.beta_0);
|
|
this$static.lambda != 0 && dumpAttr(elem, 'la', this$static.lambda);
|
|
this$static.capGS != 0 && dumpAttr(elem, 'cgs', this$static.capGS);
|
|
this$static.capGD != 0 && dumpAttr(elem, 'cgd', this$static.capGD);
|
|
dumpAttr_0(elem, 'sb', this$static.showBulk?1:0);
|
|
dumpAttr_0(elem, 'dsy', this$static.digitalSymbol?1:0);
|
|
dumpAttr_0(elem, 'bd', this$static.bodyDiode?1:0);
|
|
dumpAttr_0(elem, 'bt', this$static.bodyTerminal?1:0);
|
|
dumpAttr_0(elem, 'sbd', this$static.showBodyDiodeSymbol?1:0);
|
|
$appendChild_0(build(getDocumentElement(doc.jsObject)), elem);
|
|
}
|
|
|
|
function $getDescription_0(this$static){
|
|
if (this$static.description == null || $equals_1(this$static.description, this$static.name_0))
|
|
return this$static.name_0;
|
|
return this$static.name_0 + ' (' + LS(this$static.description) + ')';
|
|
}
|
|
|
|
function $pickName_0(this$static){
|
|
var n, num;
|
|
this$static.name_0 = (this$static.flags & 1) != 0?'jfetmodel':'mosfetmodel';
|
|
if ($getStringValue(modelMap_1, this$static.name_0) != null) {
|
|
num = 2;
|
|
for (;; num++) {
|
|
n = this$static.name_0 + '-' + num;
|
|
if ($getStringValue(modelMap_1, n) == null) {
|
|
this$static.name_0 = n;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
function $setJfet(this$static){
|
|
this$static.flags |= 1;
|
|
return this$static;
|
|
}
|
|
|
|
function MosfetModel(){
|
|
this.threshold = 1.5;
|
|
this.beta_0 = $intern_36;
|
|
this.showBulk = true;
|
|
this.bodyDiode = true;
|
|
}
|
|
|
|
function MosfetModel_0(copy){
|
|
this.flags = copy.flags;
|
|
this.threshold = copy.threshold;
|
|
this.beta_0 = copy.beta_0;
|
|
this.lambda = copy.lambda;
|
|
this.capGS = copy.capGS;
|
|
this.capGD = copy.capGD;
|
|
this.showBulk = copy.showBulk;
|
|
this.digitalSymbol = copy.digitalSymbol;
|
|
this.bodyDiode = copy.bodyDiode;
|
|
this.bodyTerminal = copy.bodyTerminal;
|
|
this.showBodyDiodeSymbol = copy.showBodyDiodeSymbol;
|
|
}
|
|
|
|
function MosfetModel_1(d, vt, b){
|
|
this.description = d;
|
|
this.threshold = vt;
|
|
this.beta_0 = b;
|
|
this.showBulk = true;
|
|
this.bodyDiode = true;
|
|
}
|
|
|
|
function addDefaultModel_0(name_0, dm){
|
|
$putStringValue(modelMap_1, name_0, dm);
|
|
dm.readOnly = dm.builtIn = true;
|
|
dm.name_0 = name_0;
|
|
}
|
|
|
|
function clearDumpedFlags_2(){
|
|
var it, pair;
|
|
if (!modelMap_1)
|
|
return;
|
|
it = new AbstractHashMap$EntrySetIterator((new AbstractHashMap$EntrySet(modelMap_1)).this$01);
|
|
while (it.hasNext) {
|
|
pair = $next_2(it);
|
|
pair.getValue().dumped = false;
|
|
}
|
|
}
|
|
|
|
function createModelMap_0(){
|
|
var bodyTerminalDefault, digitalDefault, jfetDefault, noDiodeDefault;
|
|
if (modelMap_1)
|
|
return;
|
|
modelMap_1 = new HashMap;
|
|
addDefaultModel_0('default', new MosfetModel_1('default', 1.5, $intern_36));
|
|
noDiodeDefault = new MosfetModel_1('default-nodiode', 1.5, $intern_36);
|
|
noDiodeDefault.bodyDiode = false;
|
|
addDefaultModel_0('default-nodiode', noDiodeDefault);
|
|
bodyTerminalDefault = new MosfetModel_1('default-body', 1.5, $intern_36);
|
|
bodyTerminalDefault.bodyTerminal = true;
|
|
addDefaultModel_0('default-body', bodyTerminalDefault);
|
|
digitalDefault = new MosfetModel_1('default-digital', 1.5, $intern_36);
|
|
digitalDefault.showBulk = false;
|
|
digitalDefault.digitalSymbol = true;
|
|
digitalDefault.bodyDiode = false;
|
|
addDefaultModel_0('default-digital', digitalDefault);
|
|
jfetDefault = $setJfet(new MosfetModel_1('default-jfet', -4, 0.00125));
|
|
jfetDefault.showBulk = jfetDefault.bodyDiode = false;
|
|
addDefaultModel_0('default-jfet', jfetDefault);
|
|
}
|
|
|
|
function getModelList_1(jfet){
|
|
var it, mm, pair, vector;
|
|
createModelMap_0();
|
|
vector = new Vector;
|
|
it = new AbstractHashMap$EntrySetIterator((new AbstractHashMap$EntrySet(modelMap_1)).this$01);
|
|
while (it.hasNext) {
|
|
pair = $next_2(it);
|
|
mm = pair.getValue();
|
|
if (mm.internal || (mm.flags & 1) != 0 != jfet)
|
|
continue;
|
|
$indexOf_3(vector.arrayList, mm, 0) != -1 || $add_8(vector.arrayList, mm);
|
|
}
|
|
$clinit_Collections();
|
|
$sort(vector.arrayList, null);
|
|
return vector;
|
|
}
|
|
|
|
function getModelWithName_2(name_0){
|
|
var lm;
|
|
createModelMap_0();
|
|
lm = $getStringValue(modelMap_1, name_0);
|
|
if (lm)
|
|
return lm;
|
|
lm = new MosfetModel;
|
|
lm.name_0 = name_0;
|
|
$putStringValue(modelMap_1, name_0, lm);
|
|
return lm;
|
|
}
|
|
|
|
function getModelWithNameOrCopy_1(name_0, oldmodel, jfet){
|
|
var lm;
|
|
createModelMap_0();
|
|
lm = $getStringValue(modelMap_1, name_0);
|
|
if (lm)
|
|
return lm;
|
|
if (!oldmodel) {
|
|
console.log('model not found: ' + name_0);
|
|
return getModelWithName_2(jfet?'default-jfet':'default');
|
|
}
|
|
lm = new MosfetModel_0(oldmodel);
|
|
lm.name_0 = name_0;
|
|
$putStringValue(modelMap_1, name_0, lm);
|
|
return lm;
|
|
}
|
|
|
|
function getModelWithParameters_0(vt, beta_0, jfet, showBulk, bodyDiode, bodyTerminal, digitalSymbol, showBodyDiodeSymbol){
|
|
var baseName, it, mm, mm0, n, name_0, num, pair;
|
|
createModelMap_0();
|
|
it = new AbstractHashMap$EntrySetIterator((new AbstractHashMap$EntrySet(modelMap_1)).this$01);
|
|
while (it.hasNext) {
|
|
pair = $next_2(it);
|
|
mm0 = pair.getValue();
|
|
if ((mm0.flags & 1) != 0 == jfet && $wnd.Math.abs(mm0.threshold - vt) < $intern_114 && $wnd.Math.abs(mm0.beta_0 - beta_0) < $intern_114 && mm0.lambda == 0 && mm0.capGS == 0 && mm0.capGD == 0 && mm0.showBulk == showBulk && mm0.bodyDiode == bodyDiode && mm0.bodyTerminal == bodyTerminal && mm0.digitalSymbol == digitalSymbol && mm0.showBodyDiodeSymbol == showBodyDiodeSymbol)
|
|
return mm0;
|
|
}
|
|
baseName = 'old-' + (jfet?'jfet':'mosfet');
|
|
name_0 = baseName;
|
|
if ($getStringValue(modelMap_1, baseName) != null) {
|
|
num = 2;
|
|
for (;; num++) {
|
|
n = baseName + '-' + num;
|
|
if ($getStringValue(modelMap_1, n) == null) {
|
|
name_0 = n;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
mm = getModelWithName_2(name_0);
|
|
mm.threshold = vt;
|
|
mm.beta_0 = beta_0;
|
|
mm.showBulk = showBulk;
|
|
mm.bodyDiode = bodyDiode;
|
|
mm.bodyTerminal = bodyTerminal;
|
|
mm.digitalSymbol = digitalSymbol;
|
|
mm.showBodyDiodeSymbol = showBodyDiodeSymbol;
|
|
jfet && (mm.flags |= 1 , mm);
|
|
return mm;
|
|
}
|
|
|
|
defineClass(179, 1, {10:1, 179:1, 16:1}, MosfetModel, MosfetModel_0, MosfetModel_1);
|
|
_.compareTo = function compareTo_2(dm){
|
|
return $compareTo(this.name_0, dm.name_0);
|
|
}
|
|
;
|
|
_.getDialogTitle = function getDialogTitle_3(){
|
|
return 'Edit ' + ((this.flags & 1) != 0?'JFET':'MOSFET') + ' Model';
|
|
}
|
|
;
|
|
_.getEditInfo = function getEditInfo_49(n){
|
|
var ei, idx;
|
|
if (n == 0) {
|
|
ei = new EditInfo('Model Name', 0);
|
|
ei.text_0 = this.name_0 == null?'':this.name_0;
|
|
return ei;
|
|
}
|
|
if (n == 1)
|
|
return new EditInfo('Threshold Voltage (Vt)', this.threshold);
|
|
if (n == 2)
|
|
return new EditInfo('<a href="mosfet-beta.html" target="_blank">' + LS('Beta') + '<\/a>', this.beta_0);
|
|
idx = 3;
|
|
if ((this.flags & 1) == 0) {
|
|
if (n == idx++)
|
|
return createCheckbox('Show Bulk', this.showBulk);
|
|
if (n == idx++) {
|
|
if (!this.showBulk)
|
|
return createCheckbox('Digital Symbol', this.digitalSymbol);
|
|
return createCheckbox('Simulate Body Diode', this.bodyDiode);
|
|
}
|
|
if (this.showBulk && this.bodyDiode) {
|
|
if (n == idx++)
|
|
return createCheckbox('Body Terminal', this.bodyTerminal);
|
|
if (n == idx++)
|
|
return createCheckbox('Show Body Diode', this.showBodyDiodeSymbol);
|
|
}
|
|
}
|
|
if (n == idx++)
|
|
return $newColumn($setDimensionless(new EditInfo('Lambda', this.lambda)));
|
|
if (n == idx++)
|
|
return new EditInfo('Gate-Source Capacitance (Cgs)', this.capGS);
|
|
if (n == idx)
|
|
return new EditInfo('Gate-Drain Capacitance (Cgd)', this.capGD);
|
|
return null;
|
|
}
|
|
;
|
|
_.setEditValue = function setEditValue_49(n, ei){
|
|
var idx, newVal;
|
|
if (n == 0) {
|
|
this.name_0 = $getText(ei.textf);
|
|
this.name_0.length > 0 && $putStringValue(modelMap_1, this.name_0, this);
|
|
}
|
|
n == 1 && (this.threshold = ei.value_0);
|
|
n == 2 && ei.value_0 > 0 && (this.beta_0 = ei.value_0);
|
|
idx = 3;
|
|
if ((this.flags & 1) == 0) {
|
|
if (n == idx++) {
|
|
newVal = $getState(ei.checkbox);
|
|
newVal != this.showBulk && (ei.newDialog = true);
|
|
this.showBulk = newVal;
|
|
}
|
|
else if (n == idx++) {
|
|
newVal = $getState(ei.checkbox);
|
|
if (this.showBulk) {
|
|
newVal != this.bodyDiode && (ei.newDialog = true);
|
|
this.bodyDiode = newVal;
|
|
}
|
|
else {
|
|
newVal != this.digitalSymbol && (ei.newDialog = true);
|
|
this.digitalSymbol = newVal;
|
|
}
|
|
}
|
|
else
|
|
this.showBulk && this.bodyDiode && n == idx++?(this.bodyTerminal = $getState(ei.checkbox)):this.showBulk && this.bodyDiode && n == idx++ && (this.showBodyDiodeSymbol = $getState(ei.checkbox));
|
|
}
|
|
n == idx?(this.lambda = ei.value_0 >= 0?ei.value_0:this.lambda):n == idx + 1?(this.capGS = ei.value_0 >= 0?ei.value_0:this.capGS):n == idx + 2 && (this.capGD = ei.value_0 >= 0?ei.value_0:this.capGD);
|
|
$updateModels(theApp);
|
|
}
|
|
;
|
|
_.beta_0 = 0;
|
|
_.bodyDiode = false;
|
|
_.bodyTerminal = false;
|
|
_.builtIn = false;
|
|
_.capGD = 0;
|
|
_.capGS = 0;
|
|
_.digitalSymbol = false;
|
|
_.dumped = false;
|
|
_.flags = 0;
|
|
_.internal = false;
|
|
_.lambda = 0;
|
|
_.readOnly = false;
|
|
_.showBodyDiodeSymbol = false;
|
|
_.showBulk = false;
|
|
_.threshold = 0;
|
|
var modelMap_1;
|
|
var Lcom_lushprojects_circuitjs1_client_MosfetModel_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'MosfetModel', 179);
|
|
function $getTempColor_1(this$static, num){
|
|
var c, temp, val, x_0;
|
|
c = $getVoltageColor(this$static, this$static.volts[num * 2]);
|
|
temp = this$static.heats[num] / this$static.i2t;
|
|
if (temp < $intern_118) {
|
|
val = temp * 3;
|
|
x_0 = round_int(255 * val);
|
|
x_0 < 0 && (x_0 = 0);
|
|
return new Color(x_0 + ((255 - x_0) * c.r / 255 | 0), (255 - x_0) * c.g / 255 | 0, (255 - x_0) * c.b / 255 | 0);
|
|
}
|
|
if (temp < 0.6667) {
|
|
x_0 = round_int((temp - $intern_118) * 3 * 255);
|
|
x_0 < 0 && (x_0 = 0);
|
|
return new Color(255, x_0, 0);
|
|
}
|
|
if (temp < 1) {
|
|
x_0 = round_int((temp - $intern_119) * 3 * 255);
|
|
x_0 < 0 && (x_0 = 0);
|
|
return new Color(255, 255, x_0);
|
|
}
|
|
return $clinit_Color() , white;
|
|
}
|
|
|
|
function $setSwitchPositions(this$static){
|
|
var i, o, s2, switchPosition;
|
|
switchPosition = this$static.blown?0:1;
|
|
for (i = 0; i != sim_0.elmList.arrayList.array.length; i++) {
|
|
o = $elementAt(sim_0.elmList, i);
|
|
if (instanceOf(o, 225)) {
|
|
s2 = o;
|
|
$equals_1(s2.label_0, this$static.label_0) && (s2.i_position = (s2.flags & 2) != 0?1 - switchPosition:switchPosition , s2.type_0 = 0);
|
|
}
|
|
}
|
|
}
|
|
|
|
function MotorProtectionSwitchElm(xx, yy){
|
|
CircuitElm.call(this, xx, yy);
|
|
this.i2t = 6.73;
|
|
this.resistance = 0.0613;
|
|
this.heats = initUnidimensionalArray(D_classLit, $intern_76, 7, 3, 15, 1);
|
|
this.currents = initUnidimensionalArray(D_classLit, $intern_76, 7, 3, 15, 1);
|
|
this.curcounts = initUnidimensionalArray(D_classLit, $intern_76, 7, 3, 15, 1);
|
|
this.label_0 = '';
|
|
}
|
|
|
|
function MotorProtectionSwitchElm_0(xa, ya, xb, yb, f, st){
|
|
CircuitElm_0.call(this, xa, ya, xb, yb, f);
|
|
this.resistance = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.i2t = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.blown = $booleanValue(($clinit_Boolean() , $equalsIgnoreCase('true', $nextToken(st))));
|
|
this.label_0 = '';
|
|
try {
|
|
this.label_0 = unescape_0($nextToken(st));
|
|
}
|
|
catch ($e0) {
|
|
$e0 = toJava($e0);
|
|
if (!instanceOf($e0, 13))
|
|
throw toJs($e0);
|
|
}
|
|
this.heats = initUnidimensionalArray(D_classLit, $intern_76, 7, 3, 15, 1);
|
|
this.currents = initUnidimensionalArray(D_classLit, $intern_76, 7, 3, 15, 1);
|
|
this.curcounts = initUnidimensionalArray(D_classLit, $intern_76, 7, 3, 15, 1);
|
|
}
|
|
|
|
defineClass(384, 8, $intern_85, MotorProtectionSwitchElm, MotorProtectionSwitchElm_0);
|
|
_.calculateCurrent = function calculateCurrent_23(){
|
|
var i;
|
|
for (i = 0; i != 3; i++)
|
|
this.currents[i] = (this.volts[i * 2] - this.volts[i * 2 + 1]) / (this.blown?$intern_32:this.resistance);
|
|
}
|
|
;
|
|
_.canFlipX = function canFlipX_1(){
|
|
return false;
|
|
}
|
|
;
|
|
_.canFlipY = function canFlipY_2(){
|
|
return false;
|
|
}
|
|
;
|
|
_.doStep = function doStep_34(){
|
|
var i;
|
|
for (i = 0; i != 3; i++)
|
|
$stampResistor(this.nodes[i * 2], this.nodes[i * 2 + 1], this.blown?$intern_32:this.resistance);
|
|
}
|
|
;
|
|
_.draw = function draw_50(g){
|
|
var i, sw;
|
|
$setBbox_0(this, this.posts[0], this.posts[5], 6);
|
|
g.context.save();
|
|
$translate(g.context, this.x_0, this.y_0);
|
|
setLineDash(g.context, 4, 4);
|
|
$setColor_0(g, ($clinit_Color() , lightGray));
|
|
$drawLine(g, -32, 48, 96 - (this.blown?8:0), 48);
|
|
$drawLine(g, -48, 64, -48, 152);
|
|
$drawLine(g, -48, 152, -24, 152);
|
|
$drawLine(g, -48, 104, -24, 104);
|
|
setLineDash(g.context, 0, 0);
|
|
for (i = 0; i != 3; i++) {
|
|
$setVoltageColor(this, g, this.volts[i * 2]);
|
|
drawThickLine(g, i * 48, 0, i * 48, 32);
|
|
this.blown && drawThickLine(g, i * 48 - 4, 32, i * 48 + 4, 32);
|
|
sw = this.blown?16:0;
|
|
drawThickLine(g, i * 48 - sw, 32, i * 48, 64);
|
|
$setLineCap(g.context, ($clinit_Context2d$LineCap() , BUTT).value_0);
|
|
drawThickLine(g, i * 48, 64, i * 48, 80);
|
|
$drawLine(g, i * 48 - 4, 12, i * 48 + 4, 20);
|
|
$drawLine(g, i * 48 + 4, 12, i * 48 - 4, 20);
|
|
$setVoltageColor(this, g, this.volts[i * 2 + 1]);
|
|
drawThickLine(g, i * 48, 176, i * 48, 192);
|
|
$setLineCap(g.context, ROUND.value_0);
|
|
$setColor_0(g, $getTempColor_1(this, i));
|
|
$drawLine(g, i * 48, 80, i * 48, 96);
|
|
$drawLine(g, i * 48 - 12, 96, i * 48, 96);
|
|
$drawLine(g, i * 48 - 12, 96, i * 48 - 12, 112);
|
|
$drawLine(g, i * 48 - 12, 112, i * 48, 112);
|
|
$drawLine(g, i * 48, 112, i * 48, 128);
|
|
$setColor_0(g, lightGray);
|
|
g.context.font = 'italic 30px serif';
|
|
g.context.textBaseline = 'middle';
|
|
g.context.textAlign = 'center';
|
|
$fillText(g.context, 'I >', i * 48, 152);
|
|
}
|
|
$setColor_0(g, lightGray);
|
|
for (i = 0; i != 3; i++)
|
|
$drawLine(g, -24, 80 + 48 * i, 120, 80 + 48 * i);
|
|
for (i = 0; i != 4; i++)
|
|
$drawLine(g, i * 48 - 24, 80, i * 48 - 24, 176);
|
|
for (i = 0; i != 3; i++)
|
|
$drawLine(g, -60 + 12 * i, 36, -60 + 12 * i, 60);
|
|
for (i = 0; i != 3; i++)
|
|
$drawLine(g, -60, 36 + 12 * i, -36, 36 + 12 * i);
|
|
$drawLine(g, -84, 48, -60, 48);
|
|
$drawLine(g, -84, 36, -84, 60);
|
|
g.context.font = 'normal 12px sans-serif';
|
|
$setColor_0(g, white);
|
|
$drawString(g, this.label_0, 120, 48);
|
|
g.context.restore();
|
|
if (!this.blown) {
|
|
for (i = 0; i != 3; i++) {
|
|
this.curcounts[i] = $updateDotCount(this.currents[i], this.curcounts[i]);
|
|
$drawDots(g, this.posts[i * 2], this.leads[i * 2], this.curcounts[i]);
|
|
$drawDots(g, this.posts[i * 2 + 1], this.leads[i * 2 + 1], -this.curcounts[i]);
|
|
}
|
|
}
|
|
$setSwitchPositions(this);
|
|
$drawPosts(this, g);
|
|
}
|
|
;
|
|
_.dumpXml = function dumpXml_52(doc, elem){
|
|
dumpAttr_1(elem, 'x', this.x_0 + ' ' + this.y_0 + ' ' + this.x2 + ' ' + this.y2);
|
|
dumpAttr_0(elem, 'f', this.flags);
|
|
dumpAttr(elem, 're', this.resistance);
|
|
dumpAttr(elem, 'i2', this.i2t);
|
|
dumpAttr_2(elem, 'bl', this.blown);
|
|
dumpAttr_1(elem, 'la', this.label_0);
|
|
}
|
|
;
|
|
_.getConnection = function getConnection_25(n1, n2){
|
|
return (n1 / 2 | 0) == (n2 / 2 | 0);
|
|
}
|
|
;
|
|
_.getCurrentIntoNode = function getCurrentIntoNode_20(n){
|
|
if (n % 2 == 1)
|
|
return this.currents[n / 2 | 0];
|
|
return -this.currents[n / 2 | 0];
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_66(){
|
|
return 428;
|
|
}
|
|
;
|
|
_.getEditInfo = function getEditInfo_50(n){
|
|
if (n == 0)
|
|
return $setPositive(new EditInfo_0('I2t', this.i2t, 0, 0));
|
|
if (n == 1)
|
|
return $setPositive(new EditInfo_0('On Resistance', this.resistance, 0, 0));
|
|
if (n == 2)
|
|
return new EditInfo_1('Label (for linking)', this.label_0);
|
|
return null;
|
|
}
|
|
;
|
|
_.getInfo_0 = function getInfo_57(arr){
|
|
arr[0] = 'motor protection switch';
|
|
arr[1] = 'I = ' + getUnitText($wnd.Math.abs(this.current_0), 'A', false);
|
|
arr[2] = 'Vd = ' + getUnitText($wnd.Math.abs(this.volts[0] - this.volts[1]), 'V', false);
|
|
arr[3] = 'R = ' + getUnitText(this.resistance, ohmString, false);
|
|
arr[4] = 'I2t = ' + this.i2t;
|
|
}
|
|
;
|
|
_.getPost = function getPost_14(n){
|
|
return this.posts[n];
|
|
}
|
|
;
|
|
_.getPostCount_0 = function getPostCount_47(){
|
|
return 6;
|
|
}
|
|
;
|
|
_.nonLinear_0 = function nonLinear_15(){
|
|
return true;
|
|
}
|
|
;
|
|
_.reset_0 = function reset_29(){
|
|
$reset(this);
|
|
this.heats = initUnidimensionalArray(D_classLit, $intern_76, 7, 3, 15, 1);
|
|
this.currents = initUnidimensionalArray(D_classLit, $intern_76, 7, 3, 15, 1);
|
|
this.blown = false;
|
|
$setSwitchPositions(this);
|
|
}
|
|
;
|
|
_.setEditValue = function setEditValue_50(n, ei){
|
|
n == 0 && (this.i2t = ei.value_0);
|
|
n == 1 && (this.resistance = ei.value_0);
|
|
n == 2 && (this.label_0 = $getText(ei.textf));
|
|
}
|
|
;
|
|
_.setPoints = function setPoints_44(){
|
|
var i;
|
|
$setPoints(this);
|
|
this.posts = initUnidimensionalArray(Lcom_lushprojects_circuitjs1_client_Point_2_classLit, $intern_78, 14, 6, 0, 1);
|
|
this.leads = initUnidimensionalArray(Lcom_lushprojects_circuitjs1_client_Point_2_classLit, $intern_78, 14, 6, 0, 1);
|
|
for (i = 0; i != 3; i++) {
|
|
this.posts[i * 2] = new Point_2(this.x_0 + i * 48, this.y_0);
|
|
this.posts[i * 2 + 1] = new Point_2(this.x_0 + i * 48, this.y_0 + 192);
|
|
this.leads[i * 2] = new Point_2(this.x_0 + i * 48, this.y_0 + 80);
|
|
this.leads[i * 2 + 1] = new Point_2(this.x_0 + i * 48, this.y_0 + 176);
|
|
}
|
|
}
|
|
;
|
|
_.stamp = function stamp_45(){
|
|
var i;
|
|
for (i = 0; i != 6; i++)
|
|
;
|
|
}
|
|
;
|
|
_.startIteration = function startIteration_13(){
|
|
var heat, i, j, wasBlown;
|
|
wasBlown = this.blown;
|
|
for (j = 0; j != 3; j++) {
|
|
i = this.currents[j];
|
|
heat = this.heats[j];
|
|
heat += i * i * sim_0.timeStep;
|
|
heat -= sim_0.timeStep * this.i2t / 3;
|
|
heat < 0 && (heat = 0);
|
|
heat > this.i2t && (this.blown = true);
|
|
this.heats[j] = heat;
|
|
}
|
|
this.blown != wasBlown && $setSwitchPositions(this);
|
|
}
|
|
;
|
|
_.undumpXml = function undumpXml_55(xml){
|
|
this.flags = $parseIntAttr(xml, 'f', this.flags);
|
|
this.resistance = $parseDoubleAttr(xml, 're', this.resistance);
|
|
this.i2t = $parseDoubleAttr(xml, 'i2', this.i2t);
|
|
this.blown = $parseBooleanAttr(xml, 'bl', this.blown);
|
|
this.label_0 = $parseStringAttr(xml, 'la', this.label_0);
|
|
}
|
|
;
|
|
_.blown = false;
|
|
_.i2t = 0;
|
|
_.resistance = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_MotorProtectionSwitchElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'MotorProtectionSwitchElm', 384);
|
|
function $anySelectedButMouse(this$static){
|
|
var ce, ce$iterator;
|
|
for (ce$iterator = new ArrayList$1(this$static.ui.elmList.arrayList); ce$iterator.i < ce$iterator.this$01.array.length;) {
|
|
ce = $next_4(ce$iterator);
|
|
if (ce != this$static.mouseElm && ce.selected_0)
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
function $beginToolbarDrag(this$static, className, clientX, clientY){
|
|
if ($isReadOnly(this$static.ui) || $dialogIsShowing(this$static.sim.ui))
|
|
return;
|
|
this$static.toolbarDragClass = className;
|
|
this$static.toolbarDragStartX = clientX;
|
|
this$static.toolbarDragStartY = clientY;
|
|
this$static.toolbarDragActive = false;
|
|
this$static.toolbarDragVertical = false;
|
|
}
|
|
|
|
function $cancelToolbarDrag(this$static){
|
|
if (this$static.dragElm) {
|
|
this$static.dragElm.delete_0();
|
|
this$static.dragElm = null;
|
|
}
|
|
this$static.toolbarDragClass = null;
|
|
this$static.toolbarDragActive = false;
|
|
this$static.tempMouseMode = this$static.mouseMode;
|
|
}
|
|
|
|
function $clearMouseElm(this$static){
|
|
this$static.sim.scopeManager.scopeSelected = -1;
|
|
$setMouseElm_0(this$static, null);
|
|
$reset_13(this$static.scopePlotRoles);
|
|
}
|
|
|
|
function $clearSelection(this$static){
|
|
var ce, ce$iterator;
|
|
for (ce$iterator = new ArrayList$1(this$static.ui.elmList.arrayList); ce$iterator.i < ce$iterator.this$01.array.length;) {
|
|
ce = $next_4(ce$iterator);
|
|
ce.selected_0 = false;
|
|
}
|
|
$enableDisableMenuItems(this$static);
|
|
}
|
|
|
|
function $doFlip(this$static){
|
|
$flipPosts(this$static.menuElm);
|
|
$needAnalyze(this$static.sim);
|
|
}
|
|
|
|
function $doMainMenuChecks(this$static){
|
|
var c, i, s;
|
|
c = this$static.ui.mainMenuItems.arrayList.array.length;
|
|
for (i = 0; i < c; i++) {
|
|
s = $get_4(this$static.ui.mainMenuItemNames, i);
|
|
$setState_1($get_4(this$static.ui.mainMenuItems, i), s == this$static.ui.mouseModeStr);
|
|
}
|
|
$setEnabled_1(this$static.sim.menus.stackAllItem, this$static.sim.scopeManager.scopeCount > 1 && this$static.sim.scopeManager.scopes[this$static.sim.scopeManager.scopeCount - 1].position > 0);
|
|
$setEnabled_1(this$static.sim.menus.unstackAllItem, this$static.sim.scopeManager.scopeCount > 1 && this$static.sim.scopeManager.scopes[this$static.sim.scopeManager.scopeCount - 1].position != this$static.sim.scopeManager.scopeCount - 1);
|
|
$setEnabled_1(this$static.sim.menus.combineAllItem, this$static.sim.scopeManager.scopeCount > 1);
|
|
$setEnabled_1(this$static.sim.menus.separateAllItem, this$static.sim.scopeManager.scopeCount > 0);
|
|
lastSubcircuitMenuUpdate != sequenceNumber && $composeSubcircuitMenu(this$static.sim.ui);
|
|
}
|
|
|
|
function $doPopupMenu(this$static){
|
|
var canFlipX, canFlipXY, canFlipY, elm, elm$iterator, s;
|
|
if ($isReadOnly(this$static.ui) || $dialogIsShowing(this$static.sim.ui))
|
|
return;
|
|
this$static.menuElm = this$static.mouseElm;
|
|
this$static.sim.scopeManager.menuScope = -1;
|
|
this$static.sim.scopeManager.menuPlot = -1;
|
|
if (this$static.sim.scopeManager.scopeSelected != -1) {
|
|
if ($get_4(this$static.sim.scopeManager.scopes[this$static.sim.scopeManager.scopeSelected].plots, 0).elm) {
|
|
this$static.sim.scopeManager.menuScope = this$static.sim.scopeManager.scopeSelected;
|
|
this$static.sim.scopeManager.menuPlot = this$static.sim.scopeManager.scopes[this$static.sim.scopeManager.scopeSelected].selectedPlot;
|
|
$doScopePopupChecks(this$static.sim.scopeManager.scopePopupMenu, false, $canStackScope(this$static.sim.scopeManager, this$static.sim.scopeManager.scopeSelected), this$static.sim.scopeManager.scopeCount >= 2, $canUnstackScope(this$static.sim.scopeManager, this$static.sim.scopeManager.scopeSelected), this$static.sim.scopeManager.scopes[this$static.sim.scopeManager.scopeSelected]);
|
|
this$static.ui.contextPanel = new PopupPanel_0(true);
|
|
$add_1(this$static.ui.contextPanel, this$static.sim.scopeManager.scopePopupMenu.m_0);
|
|
$showContextPanel(this$static, this$static.menuClientX, this$static.menuClientY);
|
|
}
|
|
}
|
|
else if (this$static.mouseElm) {
|
|
if (instanceOf(this$static.mouseElm, 21)) {
|
|
s = this$static.mouseElm;
|
|
if ($get_4(s.elmScope.plots, 0).elm) {
|
|
this$static.sim.scopeManager.menuPlot = s.elmScope.selectedPlot;
|
|
$doScopePopupChecks(this$static.sim.scopeManager.scopePopupMenu, true, false, false, false, s.elmScope);
|
|
this$static.ui.contextPanel = new PopupPanel_0(true);
|
|
$add_1(this$static.ui.contextPanel, this$static.sim.scopeManager.scopePopupMenu.m_0);
|
|
$showContextPanel(this$static, this$static.menuClientX, this$static.menuClientY);
|
|
}
|
|
}
|
|
else {
|
|
$setEnabled_1(this$static.sim.menus.elmScopeMenuItem, this$static.mouseElm.canViewInScope());
|
|
$setEnabled_1(this$static.sim.menus.elmFloatScopeMenuItem, this$static.mouseElm.canViewInScope());
|
|
if (this$static.sim.scopeManager.scopeCount + $countScopeElms(this$static.sim.scopeManager) <= 1) {
|
|
$setCommand(this$static.sim.menus.elmAddScopeMenuItem, new MyCommand('elm', 'addToScope0'));
|
|
$setSubMenu(this$static.sim.menus.elmAddScopeMenuItem, null);
|
|
$setEnabled_1(this$static.sim.menus.elmAddScopeMenuItem, this$static.mouseElm.canViewInScope() && this$static.sim.scopeManager.scopeCount + $countScopeElms(this$static.sim.scopeManager) > 0);
|
|
}
|
|
else {
|
|
$composeSelectScopeMenu(this$static.sim.scopeManager, this$static.sim.scopeManager.selectScopeMenuBar);
|
|
this$static.sim.menus.elmAddScopeMenuItem.command = null;
|
|
$setSubMenu(this$static.sim.menus.elmAddScopeMenuItem, this$static.sim.scopeManager.selectScopeMenuBar);
|
|
$setEnabled_1(this$static.sim.menus.elmAddScopeMenuItem, this$static.mouseElm.canViewInScope());
|
|
}
|
|
$setEnabled_1(this$static.sim.menus.elmEditMenuItem, !!this$static.mouseElm.getEditInfo(0));
|
|
$setEnabled_1(this$static.sim.menus.elmSplitMenuItem, instanceOf(this$static.mouseElm, 106));
|
|
$setEnabled_1(this$static.sim.menus.elmSliderMenuItem, $sliderItemEnabled(this$static.mouseElm));
|
|
canFlipX = this$static.mouseElm.canFlipX();
|
|
canFlipY = this$static.mouseElm.canFlipY();
|
|
canFlipXY = this$static.mouseElm.canFlipXY();
|
|
for (elm$iterator = new ArrayList$1(this$static.ui.elmList.arrayList); elm$iterator.i < elm$iterator.this$01.array.length;) {
|
|
elm = $next_4(elm$iterator);
|
|
if (elm.selected_0) {
|
|
elm.canFlipX() || (canFlipX = false);
|
|
elm.canFlipY() || (canFlipY = false);
|
|
elm.canFlipXY() || (canFlipXY = false);
|
|
}
|
|
}
|
|
$setEnabled_1(this$static.sim.menus.elmRotateMenuItem, canFlipXY && canFlipY);
|
|
$setEnabled_1(this$static.sim.menus.elmMirrorMenuItem, canFlipX);
|
|
this$static.ui.contextPanel = new PopupPanel_0(true);
|
|
$add_1(this$static.ui.contextPanel, this$static.sim.menus.elmMenuBar);
|
|
$showContextPanel(this$static, this$static.menuClientX, this$static.menuClientY);
|
|
}
|
|
}
|
|
else {
|
|
$doMainMenuChecks(this$static);
|
|
this$static.ui.contextPanel = new PopupPanel_0(true);
|
|
$add_1(this$static.ui.contextPanel, this$static.sim.menus.mainMenuBar);
|
|
$showContextPanel(this$static, this$static.menuClientX, this$static.menuClientY);
|
|
}
|
|
}
|
|
|
|
function $doSelectAll(this$static){
|
|
var ce, ce$iterator;
|
|
for (ce$iterator = new ArrayList$1(this$static.ui.elmList.arrayList); ce$iterator.i < ce$iterator.this$01.array.length;) {
|
|
ce = $next_4(ce$iterator);
|
|
ce.selected_0 = true;
|
|
}
|
|
$enableDisableMenuItems(this$static);
|
|
}
|
|
|
|
function $doSplit(this$static, ce){
|
|
var px, py;
|
|
if (!instanceOf(ce, 106))
|
|
return;
|
|
px = $snapGrid_1(this$static, $inverseTransformX(this$static, this$static.menuX));
|
|
py = $snapGrid_1(this$static, $inverseTransformY(this$static, this$static.menuY));
|
|
$splitWireAt(this$static, px, py) && $needAnalyze(this$static.sim);
|
|
}
|
|
|
|
function $doSwitch(this$static, x_0, y_0){
|
|
var se;
|
|
if (!this$static.mouseElm || !instanceOf(this$static.mouseElm, 61))
|
|
return false;
|
|
se = this$static.mouseElm;
|
|
if (!$contains(se.getSwitchRect(), x_0, y_0))
|
|
return false;
|
|
se.toggle();
|
|
se.momentary && (this$static.heldSwitchElm = se);
|
|
instanceOf(se, 186) || $needAnalyze(this$static.sim);
|
|
return true;
|
|
}
|
|
|
|
function $dragAll(this$static, x_0, y_0){
|
|
var dx, dy;
|
|
dx = x_0 - this$static.dragScreenX;
|
|
dy = y_0 - this$static.dragScreenY;
|
|
if (dx == 0 && dy == 0)
|
|
return;
|
|
this$static.sim.transform_0[4] += dx;
|
|
this$static.sim.transform_0[5] += dy;
|
|
this$static.dragScreenX = x_0;
|
|
this$static.dragScreenY = y_0;
|
|
}
|
|
|
|
function $dragColumn(this$static, x_0){
|
|
var dx, i;
|
|
dx = x_0 - this$static.dragGridX;
|
|
if (dx == 0)
|
|
return;
|
|
for (i = 0; i < this$static.dragRowColElms.array.length; i++)
|
|
$movePoint($get_2(this$static.dragRowColElms, i), $get_2(this$static.dragRowColPosts, i).value_0, dx, 0);
|
|
$removeZeroLengthElements(this$static);
|
|
}
|
|
|
|
function $dragPost(this$static, x_0, y_0, all){
|
|
var conn, conn$iterator, conns, dx, dy, e, i, p;
|
|
this$static.draggingPost == -1 && (this$static.draggingPost = distanceSq(this$static.mouseElm.x_0, this$static.mouseElm.y_0, x_0, y_0) > distanceSq(this$static.mouseElm.x2, this$static.mouseElm.y2, x_0, y_0)?1:0);
|
|
dx = x_0 - this$static.dragGridX;
|
|
dy = y_0 - this$static.dragGridY;
|
|
if (dx == 0 && dy == 0)
|
|
return;
|
|
if (all) {
|
|
for (i = 0; i != this$static.ui.elmList.arrayList.array.length; i++) {
|
|
e = $get_4(this$static.ui.elmList, i);
|
|
if (e.x_0 == this$static.dragGridX && e.y_0 == this$static.dragGridY)
|
|
p = 0;
|
|
else if (e.x2 == this$static.dragGridX && e.y2 == this$static.dragGridY)
|
|
p = 1;
|
|
else
|
|
continue;
|
|
$movePoint(e, p, dx, dy);
|
|
}
|
|
}
|
|
else {
|
|
$movePoint(this$static.mouseElm, this$static.draggingPost, dx, dy);
|
|
if (this$static.sim.sim.routedWireMap) {
|
|
conns = $get_1(this$static.sim.sim.routedWireMap, this$static.mouseElm);
|
|
if (conns) {
|
|
for (conn$iterator = new ArrayList$1(conns); conn$iterator.i < conn$iterator.this$01.array.length;) {
|
|
conn = $next_4(conn$iterator);
|
|
conn.elmPost == this$static.draggingPost && $getPost_3(conn.wire, conn.wirePost).z_0 == 0 && $movePoint(conn.wire, conn.wirePost, dx, dy);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
$needAnalyze(this$static.sim);
|
|
}
|
|
|
|
function $dragRow(this$static, y_0){
|
|
var dy, i;
|
|
dy = y_0 - this$static.dragGridY;
|
|
if (dy == 0)
|
|
return;
|
|
for (i = 0; i < this$static.dragRowColElms.array.length; i++)
|
|
$movePoint($get_2(this$static.dragRowColElms, i), $get_2(this$static.dragRowColPosts, i).value_0, 0, dy);
|
|
$removeZeroLengthElements(this$static);
|
|
}
|
|
|
|
function $dragSelected(this$static, x_0, y_0){
|
|
var allowed, ce, ce$iterator, ce$iterator0, ce$iterator1, conn, conn$iterator, conns, dx, dy, me;
|
|
me = false;
|
|
!!this$static.mouseElm && !this$static.mouseElm.selected_0 && $setSelected(this$static.mouseElm, me = true);
|
|
if (!$onlyGraphicsElmsSelected(this$static)) {
|
|
x_0 = x_0 + this$static.sim.gridRound & this$static.sim.gridMask;
|
|
y_0 = y_0 + this$static.sim.gridRound & this$static.sim.gridMask;
|
|
}
|
|
dx = x_0 - this$static.dragGridX;
|
|
dy = y_0 - this$static.dragGridY;
|
|
if (dx == 0 && dy == 0) {
|
|
me && (this$static.mouseElm.selected_0 = false , undefined);
|
|
return false;
|
|
}
|
|
allowed = true;
|
|
for (ce$iterator0 = new ArrayList$1(this$static.ui.elmList.arrayList); ce$iterator0.i < ce$iterator0.this$01.array.length;) {
|
|
ce = $next_4(ce$iterator0);
|
|
ce.selected_0 && !$allowMove(ce, dx, dy) && (allowed = false);
|
|
if (!allowed)
|
|
break;
|
|
}
|
|
if (allowed) {
|
|
for (ce$iterator1 = new ArrayList$1(this$static.ui.elmList.arrayList); ce$iterator1.i < ce$iterator1.this$01.array.length;) {
|
|
ce = $next_4(ce$iterator1);
|
|
ce.selected_0 && ce.move(dx, dy);
|
|
}
|
|
if (this$static.sim.sim.routedWireMap) {
|
|
for (ce$iterator = new ArrayList$1(this$static.ui.elmList.arrayList); ce$iterator.i < ce$iterator.this$01.array.length;) {
|
|
ce = $next_4(ce$iterator);
|
|
if (!ce.selected_0)
|
|
continue;
|
|
conns = $get_1(this$static.sim.sim.routedWireMap, ce);
|
|
if (!conns)
|
|
continue;
|
|
for (conn$iterator = new ArrayList$1(conns); conn$iterator.i < conn$iterator.this$01.array.length;) {
|
|
conn = $next_4(conn$iterator);
|
|
!conn.wire.selected_0 && $getPost_3(conn.wire, conn.wirePost).z_0 == 0 && $movePoint(conn.wire, conn.wirePost, dx, dy);
|
|
}
|
|
}
|
|
}
|
|
$needAnalyze(this$static.sim);
|
|
}
|
|
me && (this$static.mouseElm.selected_0 = false , undefined);
|
|
return allowed;
|
|
}
|
|
|
|
function $dragSplitter(this$static, y_0){
|
|
var h;
|
|
h = this$static.ui.canvasHeight;
|
|
h < 1 && (h = 1);
|
|
this$static.sim.scopeManager.scopeHeightFraction = 1 - y_0 / h;
|
|
this$static.sim.scopeManager.scopeHeightFraction < 0.1 && (this$static.sim.scopeManager.scopeHeightFraction = 0.1);
|
|
this$static.sim.scopeManager.scopeHeightFraction > 0.9 && (this$static.sim.scopeManager.scopeHeightFraction = 0.9);
|
|
$setCircuitArea(this$static.ui);
|
|
$repaint(this$static.sim.ui);
|
|
}
|
|
|
|
function $enableDisableMenuItems(this$static){
|
|
var canFlipX, canFlipXY, canFlipY, elm, elm$iterator, selCount;
|
|
canFlipX = true;
|
|
canFlipY = true;
|
|
canFlipXY = true;
|
|
selCount = $countSelected(this$static.sim.commands);
|
|
for (elm$iterator = new ArrayList$1(this$static.ui.elmList.arrayList); elm$iterator.i < elm$iterator.this$01.array.length;) {
|
|
elm = $next_4(elm$iterator);
|
|
if (elm.selected_0 || selCount == 0) {
|
|
elm.canFlipX() || (canFlipX = false);
|
|
elm.canFlipY() || (canFlipY = false);
|
|
elm.canFlipXY() || (canFlipXY = false);
|
|
}
|
|
}
|
|
$setEnabled_1(this$static.sim.menus.cutItem, selCount > 0);
|
|
$setEnabled_1(this$static.sim.menus.copyItem, selCount > 0);
|
|
$setEnabled_1(this$static.sim.menus.rotateItem, canFlipXY && canFlipY);
|
|
$setEnabled_1(this$static.sim.menus.mirrorItem, canFlipX);
|
|
}
|
|
|
|
function $endDrag(this$static){
|
|
var circuitChanged, p;
|
|
this$static.mouseDragging = false;
|
|
$clinit_Scope();
|
|
dragStartTime = -1;
|
|
!!draggingPlotYScope && (draggingPlotYScope.draggingPlotY = false);
|
|
draggingPlotYScope = null;
|
|
this$static.tempMouseMode = this$static.mouseMode;
|
|
this$static.selectedArea = null;
|
|
circuitChanged = false;
|
|
if (this$static.draggingPost >= 0 && !!this$static.mouseElm) {
|
|
p = this$static.mouseElm.getPost(this$static.draggingPost);
|
|
$splitAt(this$static, p.x_0, p.y_0) && (circuitChanged = true);
|
|
}
|
|
if (this$static.heldSwitchElm) {
|
|
$mouseUp(this$static.heldSwitchElm);
|
|
this$static.heldSwitchElm = null;
|
|
circuitChanged = true;
|
|
}
|
|
if (this$static.dragElm) {
|
|
if (this$static.dragElm.creationFailed()) {
|
|
this$static.dragElm.delete_0();
|
|
(this$static.mouseMode == 6 || this$static.mouseMode == 4) && $clearSelection(this$static);
|
|
$setModeLabel(this$static.ui.toolbar_0, LS('Press and hold mouse to create circuit element'));
|
|
this$static.dragElm = null;
|
|
}
|
|
else {
|
|
$splitAt(this$static, this$static.dragElm.x_0, this$static.dragElm.y_0);
|
|
$splitAt(this$static, this$static.dragElm.x2, this$static.dragElm.y2);
|
|
$addElement(this$static.ui.elmList, this$static.dragElm);
|
|
this$static.dragElm.draggingDone();
|
|
circuitChanged = true;
|
|
$writeRecoveryToStorage(this$static.sim.undoManager);
|
|
this$static.sim.unsavedChanges = true;
|
|
this$static.dragElm = null;
|
|
$updateToolbar(this$static.sim.ui);
|
|
}
|
|
}
|
|
if (circuitChanged) {
|
|
$needAnalyze(this$static.sim);
|
|
$pushUndo(this$static.sim.undoManager);
|
|
}
|
|
!!this$static.dragElm && this$static.dragElm.delete_0();
|
|
this$static.dragElm = null;
|
|
$repaint(this$static.sim.ui);
|
|
}
|
|
|
|
function $inverseTransformX(this$static, x_0){
|
|
return round_int((x_0 - this$static.sim.transform_0[4]) / this$static.sim.transform_0[0]);
|
|
}
|
|
|
|
function $inverseTransformY(this$static, y_0){
|
|
return round_int((y_0 - this$static.sim.transform_0[5]) / this$static.sim.transform_0[3]);
|
|
}
|
|
|
|
function $mouseDragged(this$static, e){
|
|
var changed, gx, gy, success;
|
|
if ($clinit_Scope() , draggingPlotYScope) {
|
|
$dragPlotY(draggingPlotYScope, $getY(e));
|
|
$repaint(this$static.sim.ui);
|
|
return;
|
|
}
|
|
if ($eventGetButton(e.nativeEvent) == 2) {
|
|
if (!(!!e.nativeEvent.metaKey || !!e.nativeEvent.shiftKey || !!e.nativeEvent.ctrlKey || !!e.nativeEvent.altKey))
|
|
return;
|
|
}
|
|
if (this$static.tempMouseMode == 7) {
|
|
$dragSplitter(this$static, ($getX(e) , $getY(e)));
|
|
return;
|
|
}
|
|
gx = $inverseTransformX(this$static, $getX(e));
|
|
gy = $inverseTransformY(this$static, $getY(e));
|
|
if (!$contains(this$static.sim.circuitArea, $getX(e), $getY(e))) {
|
|
$repaint(this$static.sim.ui);
|
|
return;
|
|
}
|
|
changed = false;
|
|
if (this$static.dragElm) {
|
|
this$static.dragElm.drag(gx, gy);
|
|
$setMouseElm_0(this$static, null);
|
|
}
|
|
success = true;
|
|
switch (this$static.tempMouseMode) {
|
|
case 1:
|
|
$dragAll(this$static, $getX(e), $getY(e));
|
|
break;
|
|
case 2:
|
|
$dragRow(this$static, gy + this$static.sim.gridRound & this$static.sim.gridMask);
|
|
changed = true;
|
|
break;
|
|
case 3:
|
|
$dragColumn(this$static, gx + this$static.sim.gridRound & this$static.sim.gridMask);
|
|
changed = true;
|
|
break;
|
|
case 5:
|
|
if (this$static.mouseElm) {
|
|
$dragPost(this$static, gx + this$static.sim.gridRound & this$static.sim.gridMask, gy + this$static.sim.gridRound & this$static.sim.gridMask, !!e.nativeEvent.shiftKey);
|
|
changed = true;
|
|
}
|
|
|
|
break;
|
|
case 6:
|
|
if (!this$static.mouseElm)
|
|
$selectArea(this$static, gx, gy, !!e.nativeEvent.shiftKey);
|
|
else if (!$isReadOnly(this$static.ui)) {
|
|
$clinit_System();
|
|
if (lt(sub_1(fromDouble_0(Date.now()), this$static.mouseDownTime), 150))
|
|
return;
|
|
if (instanceOf(this$static.mouseElm, 137)) {
|
|
this$static.tempMouseMode = 8;
|
|
$rerouteVia(this$static.mouseElm, gx + this$static.sim.gridRound & this$static.sim.gridMask, gy + this$static.sim.gridRound & this$static.sim.gridMask);
|
|
changed = true;
|
|
}
|
|
else {
|
|
this$static.tempMouseMode = 4;
|
|
changed = success = $dragSelected(this$static, gx, gy);
|
|
}
|
|
}
|
|
|
|
break;
|
|
case 4:
|
|
changed = success = $dragSelected(this$static, gx, gy);
|
|
break;
|
|
case 8:
|
|
if (instanceOf(this$static.mouseElm, 137)) {
|
|
$rerouteVia(this$static.mouseElm, gx + this$static.sim.gridRound & this$static.sim.gridMask, gy + this$static.sim.gridRound & this$static.sim.gridMask);
|
|
changed = true;
|
|
}
|
|
|
|
}
|
|
if (success) {
|
|
this$static.dragScreenX = $getX(e);
|
|
this$static.dragScreenY = $getY(e);
|
|
this$static.dragGridX = $inverseTransformX(this$static, this$static.dragScreenX);
|
|
this$static.dragGridY = $inverseTransformY(this$static, this$static.dragScreenY);
|
|
if (!(this$static.tempMouseMode == 4 && $onlyGraphicsElmsSelected(this$static))) {
|
|
this$static.dragGridX = $snapGrid_1(this$static, this$static.dragGridX);
|
|
this$static.dragGridY = $snapGrid_1(this$static, this$static.dragGridY);
|
|
}
|
|
}
|
|
changed && $writeRecoveryToStorage(this$static.sim.undoManager);
|
|
$repaint(this$static.sim.ui);
|
|
}
|
|
|
|
function $mouseIsOverSplitter(this$static, x_0, y_0){
|
|
var isOverSplitter;
|
|
if (this$static.sim.scopeManager.scopeCount == 0)
|
|
return false;
|
|
isOverSplitter = x_0 >= 0 && x_0 < this$static.sim.circuitArea.width_0 && y_0 >= this$static.sim.circuitArea.height_0 - 5 && y_0 < this$static.sim.circuitArea.height_0;
|
|
isOverSplitter != this$static.mouseWasOverSplitter && (isOverSplitter?$setCursorStyle(this$static.sim.ui, 'cursorSplitter'):$setMouseMode(this$static.sim, this$static.mouseMode));
|
|
this$static.mouseWasOverSplitter = isOverSplitter;
|
|
return isOverSplitter;
|
|
}
|
|
|
|
function $mouseSelect(this$static, e){
|
|
var bestDist, ce, ce$iterator, dist, gx, gy, i, j, jn, newMouseElm, pt, s, sx, sy;
|
|
newMouseElm = null;
|
|
this$static.mouseCursorX = $getX(e);
|
|
this$static.mouseCursorY = $getY(e);
|
|
sx = $getX(e);
|
|
sy = $getY(e);
|
|
gx = round_int((sx - this$static.sim.transform_0[4]) / this$static.sim.transform_0[0]);
|
|
gy = round_int((sy - this$static.sim.transform_0[5]) / this$static.sim.transform_0[3]);
|
|
this$static.dragGridX = gx + this$static.sim.gridRound & this$static.sim.gridMask;
|
|
this$static.dragGridY = gy + this$static.sim.gridRound & this$static.sim.gridMask;
|
|
this$static.dragScreenX = sx;
|
|
this$static.dragScreenY = sy;
|
|
this$static.draggingPost = -1;
|
|
this$static.mousePost = -1;
|
|
$reset_13(this$static.scopePlotRoles);
|
|
if ($mouseIsOverSplitter(this$static, sx, sy)) {
|
|
$setMouseElm_0(this$static, null);
|
|
return;
|
|
}
|
|
if ($contains(this$static.sim.circuitArea, sx, sy)) {
|
|
if (!!this$static.mouseElm && $getHandleGrabbedClose(this$static.mouseElm, gx, gy, 256) >= 0) {
|
|
newMouseElm = this$static.mouseElm;
|
|
}
|
|
else {
|
|
bestDist = $intern_97;
|
|
for (ce$iterator = new ArrayList$1(this$static.ui.elmList.arrayList); ce$iterator.i < ce$iterator.this$01.array.length;) {
|
|
ce = $next_4(ce$iterator);
|
|
if ($contains(ce.boundingBox, gx, gy)) {
|
|
dist = ce.getMouseDistance(gx, gy);
|
|
if (dist >= 0 && dist < bestDist) {
|
|
bestDist = dist;
|
|
newMouseElm = ce;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
this$static.sim.scopeManager.scopeSelected = -1;
|
|
if (!newMouseElm) {
|
|
for (i = 0; i != this$static.sim.scopeManager.scopeCount; i++) {
|
|
s = this$static.sim.scopeManager.scopes[i];
|
|
if ($contains(s.rect_0, sx, sy)) {
|
|
newMouseElm = $getElm_0(s);
|
|
$addScopePlotRoles(s, this$static.scopePlotRoles);
|
|
this$static.sim.scopeManager.scopeSelected = i;
|
|
}
|
|
}
|
|
for (ce$iterator = new ArrayList$1(this$static.ui.elmList.arrayList); ce$iterator.i < ce$iterator.this$01.array.length;) {
|
|
ce = $next_4(ce$iterator);
|
|
if (this$static.mouseMode == 5) {
|
|
if ($getHandleGrabbedClose(ce, gx, gy, 0) > 0) {
|
|
newMouseElm = ce;
|
|
break;
|
|
}
|
|
}
|
|
jn = ce.getPostCount_0();
|
|
for (j = 0; j != jn; j++) {
|
|
pt = ce.getPost(j);
|
|
if (distanceSq(pt.x_0, pt.y_0, gx, gy) < 26) {
|
|
newMouseElm = ce;
|
|
this$static.mousePost = j;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else {
|
|
this$static.mousePost = -1;
|
|
for (i = 0; i != newMouseElm.getPostCount_0(); i++) {
|
|
pt = newMouseElm.getPost(i);
|
|
distanceSq(pt.x_0, pt.y_0, gx, gy) < 26 && (this$static.mousePost = i);
|
|
}
|
|
}
|
|
$repaint(this$static.sim.ui);
|
|
this$static.netHighlightKeyHeld = !!e.nativeEvent.shiftKey;
|
|
$setMouseElm_0(this$static, newMouseElm);
|
|
}
|
|
|
|
function $onContextMenu(this$static, e){
|
|
!!e.nativeEvent && (e.nativeEvent.preventDefault() , undefined);
|
|
if (!$dialogIsShowing(this$static.sim.ui)) {
|
|
this$static.menuClientX = (e.nativeEvent.clientX || 0) | 0;
|
|
this$static.menuClientY = (e.nativeEvent.clientY || 0) | 0;
|
|
$doPopupMenu(this$static);
|
|
}
|
|
}
|
|
|
|
function $onlyGraphicsElmsSelected(this$static){
|
|
var ce, ce$iterator;
|
|
if (!!this$static.mouseElm && !instanceOf(this$static.mouseElm, 133))
|
|
return false;
|
|
for (ce$iterator = new ArrayList$1(this$static.ui.elmList.arrayList); ce$iterator.i < ce$iterator.this$01.array.length;) {
|
|
ce = $next_4(ce$iterator);
|
|
if (ce.selected_0 && !instanceOf(ce, 133))
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
function $register_0(this$static, cv){
|
|
$addDomHandler(cv, this$static, ($clinit_MouseDownEvent() , $clinit_MouseDownEvent() , TYPE_7));
|
|
$addDomHandler(cv, this$static, ($clinit_MouseMoveEvent() , $clinit_MouseMoveEvent() , TYPE_8));
|
|
$addDomHandler(cv, this$static, ($clinit_MouseOutEvent() , $clinit_MouseOutEvent() , TYPE_9));
|
|
$addDomHandler(cv, this$static, ($clinit_MouseUpEvent() , $clinit_MouseUpEvent() , TYPE_11));
|
|
$addDomHandler(cv, this$static, ($clinit_ClickEvent() , $clinit_ClickEvent() , TYPE_1));
|
|
$addDomHandler(cv, this$static, ($clinit_DoubleClickEvent() , $clinit_DoubleClickEvent() , TYPE_3));
|
|
doTouchHandlers(this$static, ($clinit_DOM() , cv.element));
|
|
$addDomHandler(cv, this$static, ($clinit_ContextMenuEvent() , $clinit_ContextMenuEvent() , TYPE_2));
|
|
$addDomHandler(cv, this$static, ($clinit_MouseWheelEvent() , $clinit_MouseWheelEvent() , TYPE_12));
|
|
}
|
|
|
|
function $removeZeroLengthElements(this$static){
|
|
var ce, i;
|
|
for (i = this$static.ui.elmList.arrayList.array.length - 1; i >= 0; i--) {
|
|
ce = $get_4(this$static.ui.elmList, i);
|
|
if (ce.x_0 == ce.x2 && ce.y_0 == ce.y2) {
|
|
$removeElementAt(this$static.ui.elmList, i);
|
|
ce.delete_0();
|
|
}
|
|
}
|
|
$needAnalyze(this$static.sim);
|
|
}
|
|
|
|
function $scrollValues(this$static, x_0, y_0, deltay){
|
|
!!this$static.mouseElm && !$dialogIsShowing(this$static.sim.ui) && this$static.sim.scopeManager.scopeSelected == -1 && (instanceOf(this$static.mouseElm, 184) || instanceOf(this$static.mouseElm, 143) || instanceOf(this$static.mouseElm, 194)) && (scrollValuePopup = new ScrollValuePopup(x_0, y_0, deltay, this$static.mouseElm, this$static.sim));
|
|
}
|
|
|
|
function $selectArea(this$static, x_0, y_0, add_0){
|
|
var ce, ce$iterator, x1, x2, y1, y2;
|
|
x1 = $wnd.Math.min(x_0, this$static.initDragGridX);
|
|
x2 = $wnd.Math.max(x_0, this$static.initDragGridX);
|
|
y1 = $wnd.Math.min(y_0, this$static.initDragGridY);
|
|
y2 = $wnd.Math.max(y_0, this$static.initDragGridY);
|
|
this$static.selectedArea = new Rectangle_0(x1, y1, x2 - x1, y2 - y1);
|
|
for (ce$iterator = new ArrayList$1(this$static.ui.elmList.arrayList); ce$iterator.i < ce$iterator.this$01.array.length;) {
|
|
ce = $next_4(ce$iterator);
|
|
ce.selectRect(this$static.selectedArea, add_0);
|
|
}
|
|
$enableDisableMenuItems(this$static);
|
|
}
|
|
|
|
function $setCircuitScale(this$static, newScale, menu){
|
|
var constX, constY, cx, cy;
|
|
constX = menu?this$static.sim.circuitArea.width_0 / 2 | 0:this$static.mouseCursorX;
|
|
constY = menu?this$static.sim.circuitArea.height_0 / 2 | 0:this$static.mouseCursorY;
|
|
cx = round_int((constX - this$static.sim.transform_0[4]) / this$static.sim.transform_0[0]);
|
|
cy = round_int((constY - this$static.sim.transform_0[5]) / this$static.sim.transform_0[3]);
|
|
this$static.sim.transform_0[0] = this$static.sim.transform_0[3] = newScale;
|
|
this$static.sim.transform_0[4] = constX - cx * newScale;
|
|
this$static.sim.transform_0[5] = constY - cy * newScale;
|
|
}
|
|
|
|
function $setMouseElm_0(this$static, ce){
|
|
var i;
|
|
if (ce != this$static.mouseElm) {
|
|
!!this$static.mouseElm && this$static.mouseElm.setMouseElm(false);
|
|
!!ce && ce.setMouseElm(true);
|
|
this$static.mouseElm = ce;
|
|
for (i = 0; i < this$static.sim.adjustables.arrayList.array.length; i++)
|
|
$setMouseElm($get_4(this$static.sim.adjustables, i));
|
|
}
|
|
!!ce && ce.isRemovableWire() && !!this$static.sim.sim.nodeList && this$static.netHighlightKeyHeld?(this$static.highlightedNode = ce.nodes[0]):(this$static.highlightedNode = null);
|
|
}
|
|
|
|
function $showContextPanel(this$static, x_0, y_0){
|
|
var clampedX, clampedY, h, w;
|
|
$watchSubmenus(true);
|
|
$addHandler(this$static.ui.contextPanel, new MouseManager$1, TYPE_18?TYPE_18:(TYPE_18 = new GwtEvent$Type));
|
|
$setPopupPosition(this$static.ui.contextPanel, x_0, y_0);
|
|
$show(this$static.ui.contextPanel);
|
|
w = $getPropertyInt($getElement(this$static.ui.contextPanel), 'offsetWidth');
|
|
h = $getPropertyInt($getElement(this$static.ui.contextPanel), 'offsetHeight');
|
|
clampedX = $wnd.Math.max(0, $wnd.Math.min(x_0, this$static.ui.canvasWidth - w));
|
|
clampedY = $wnd.Math.max(0, $wnd.Math.min(y_0, this$static.ui.canvasHeight - h));
|
|
(clampedX != x_0 || clampedY != y_0) && $setPopupPosition(this$static.ui.contextPanel, clampedX, clampedY);
|
|
}
|
|
|
|
function $sliderItemEnabled(elm){
|
|
var ei, i;
|
|
if (instanceOf(elm, 273) || instanceOf(elm, 203))
|
|
return false;
|
|
for (i = 0;; i++) {
|
|
ei = elm.getEditInfo(i);
|
|
if (!ei)
|
|
return false;
|
|
if (!ei.choice && !ei.checkbox && !ei.button_0 && !ei.textArea && !ei.widget && !ei.noSliders)
|
|
return true;
|
|
}
|
|
}
|
|
|
|
function $snapGrid_1(this$static, x_0){
|
|
return x_0 + this$static.sim.gridRound & this$static.sim.gridMask;
|
|
}
|
|
|
|
function $splitAt(this$static, px, py){
|
|
var a, b;
|
|
a = $splitWireAt(this$static, px, py);
|
|
b = $splitLeadsAt(this$static, px, py);
|
|
return a || b;
|
|
}
|
|
|
|
function $splitLeadsAt(this$static, px, py){
|
|
var ce, i, ox, oy, post, split_0, w;
|
|
split_0 = false;
|
|
for (i = this$static.ui.elmList.arrayList.array.length - 1; i >= 0; i--) {
|
|
ce = $get_4(this$static.ui.elmList, i);
|
|
if (instanceOf(ce, 106))
|
|
continue;
|
|
post = $getLeadPost(ce, px, py);
|
|
if (post < 0)
|
|
continue;
|
|
ox = post == 0?ce.x_0:ce.x2;
|
|
oy = post == 0?ce.y_0:ce.y2;
|
|
$movePoint(ce, post, px - ox, py - oy);
|
|
w = new WireElm(px, py);
|
|
$drag(w, ox, oy);
|
|
$addElement(this$static.ui.elmList, w);
|
|
split_0 = true;
|
|
}
|
|
return split_0;
|
|
}
|
|
|
|
function $splitWireAt(this$static, px, py){
|
|
var ce, i, newWire, split_0, we;
|
|
split_0 = false;
|
|
for (i = this$static.ui.elmList.arrayList.array.length - 1; i >= 0; i--) {
|
|
ce = $get_4(this$static.ui.elmList, i);
|
|
if (!instanceOf(ce, 106))
|
|
continue;
|
|
we = ce;
|
|
if (!we.pointOnWireInterior(px, py))
|
|
continue;
|
|
newWire = we.split_0(px, py);
|
|
if (newWire) {
|
|
$addElement(this$static.ui.elmList, newWire);
|
|
split_0 = true;
|
|
}
|
|
}
|
|
return split_0;
|
|
}
|
|
|
|
function $toolbarDragEnd(this$static){
|
|
var wasActive;
|
|
if (this$static.toolbarDragClass == null)
|
|
return;
|
|
wasActive = this$static.toolbarDragActive;
|
|
this$static.toolbarDragClass = null;
|
|
this$static.toolbarDragActive = false;
|
|
if (!wasActive)
|
|
return;
|
|
if (this$static.dragElm) {
|
|
if (this$static.dragElm.creationFailed()) {
|
|
this$static.dragElm.delete_0();
|
|
}
|
|
else {
|
|
$splitAt(this$static, this$static.dragElm.x_0, this$static.dragElm.y_0);
|
|
$splitAt(this$static, this$static.dragElm.x2, this$static.dragElm.y2);
|
|
$addElement(this$static.ui.elmList, this$static.dragElm);
|
|
this$static.dragElm.draggingDone();
|
|
$writeRecoveryToStorage(this$static.sim.undoManager);
|
|
this$static.sim.unsavedChanges = true;
|
|
$needAnalyze(this$static.sim);
|
|
$pushUndo(this$static.sim.undoManager);
|
|
}
|
|
this$static.dragElm = null;
|
|
}
|
|
this$static.tempMouseMode = this$static.mouseMode;
|
|
$updateToolbar(this$static.sim.ui);
|
|
$repaint(this$static.sim.ui);
|
|
}
|
|
|
|
function $toolbarDragMove(this$static, clientX, clientY, vertical){
|
|
var cx, cy, dx, dy;
|
|
if (this$static.toolbarDragClass == null)
|
|
return;
|
|
if (!this$static.toolbarDragActive) {
|
|
dx = clientX - this$static.toolbarDragStartX;
|
|
dy = clientY - this$static.toolbarDragStartY;
|
|
if (dx * dx + dy * dy < 36)
|
|
return;
|
|
this$static.toolbarDragActive = true;
|
|
$pushUndo(this$static.sim.undoManager);
|
|
}
|
|
cx = clientX - $getAbsoluteLeft(this$static.ui.cv);
|
|
cy = clientY - $getAbsoluteTop(this$static.ui.cv);
|
|
if (!$contains(this$static.sim.circuitArea, cx, cy)) {
|
|
!!this$static.dragElm && $repaint(this$static.sim.ui);
|
|
return;
|
|
}
|
|
this$static.toolbarDragAnchorX = $snapGrid_1(this$static, round_int((cx - this$static.sim.transform_0[4]) / this$static.sim.transform_0[0]));
|
|
this$static.toolbarDragAnchorY = $snapGrid_1(this$static, round_int((cy - this$static.sim.transform_0[5]) / this$static.sim.transform_0[3]));
|
|
this$static.toolbarDragVertical = vertical;
|
|
if (!this$static.dragElm) {
|
|
try {
|
|
this$static.dragElm = constructElement(this$static.toolbarDragClass, this$static.toolbarDragAnchorX, this$static.toolbarDragAnchorY);
|
|
}
|
|
catch ($e0) {
|
|
$e0 = toJava($e0);
|
|
if (instanceOf($e0, 13)) {
|
|
debugger_0();
|
|
}
|
|
else
|
|
throw toJs($e0);
|
|
}
|
|
this$static.tempMouseMode = 0;
|
|
}
|
|
!!this$static.dragElm && this$static.dragElm.dragPlace(this$static.toolbarDragAnchorX, this$static.toolbarDragAnchorY, this$static.toolbarDragVertical);
|
|
$repaint(this$static.sim.ui);
|
|
}
|
|
|
|
function $toolbarDragOrientationChanged(this$static, vertical){
|
|
if (this$static.toolbarDragClass == null || !this$static.dragElm)
|
|
return;
|
|
this$static.toolbarDragVertical = vertical;
|
|
this$static.dragElm.dragPlace(this$static.toolbarDragAnchorX, this$static.toolbarDragAnchorY, this$static.toolbarDragVertical);
|
|
$repaint(this$static.sim.ui);
|
|
}
|
|
|
|
function $transformX(this$static, x_0){
|
|
return round_int(x_0 * this$static.sim.transform_0[0] + this$static.sim.transform_0[4]);
|
|
}
|
|
|
|
function $transformY(this$static, y_0){
|
|
return round_int(y_0 * this$static.sim.transform_0[3] + this$static.sim.transform_0[5]);
|
|
}
|
|
|
|
function $updateNetHighlight(this$static){
|
|
var ce;
|
|
ce = this$static.mouseElm;
|
|
if (!!ce && ce.isRemovableWire() && this$static.netHighlightKeyHeld) {
|
|
if (this$static.sim.sim.needsStamp) {
|
|
try {
|
|
$preStampAndStampCircuit(this$static.sim.sim);
|
|
}
|
|
catch ($e0) {
|
|
$e0 = toJava($e0);
|
|
if (instanceOf($e0, 13)) {
|
|
$stop(this$static.sim.sim, 'Exception in stampCircuit()', null);
|
|
}
|
|
else
|
|
throw toJs($e0);
|
|
}
|
|
}
|
|
!!this$static.sim.sim.nodeList && (this$static.highlightedNode = ce.nodes[0]);
|
|
}
|
|
else {
|
|
this$static.highlightedNode = null;
|
|
}
|
|
}
|
|
|
|
function $watchSubmenus(watch_0){
|
|
if (watch_0) {
|
|
var vh = $wnd.innerHeight;
|
|
var clamp = function(el){
|
|
var rect = el.getBoundingClientRect();
|
|
if (rect.bottom > vh) {
|
|
var newTop = Math.max(0, vh - rect.height);
|
|
el.style.top = newTop + 'px';
|
|
}
|
|
}
|
|
;
|
|
$wnd.__circuitSubmenuObserver = new MutationObserver(function(mutations){
|
|
var popups = $doc.querySelectorAll('.gwt-MenuBarPopup');
|
|
for (var i = 0; i < popups.length; i++)
|
|
clamp(popups[i]);
|
|
}
|
|
);
|
|
$wnd.__circuitSubmenuObserver.observe($doc.body, {childList:true, subtree:true, attributes:true, attributeFilter:['style']});
|
|
}
|
|
else {
|
|
if ($wnd.__circuitSubmenuObserver) {
|
|
$wnd.__circuitSubmenuObserver.disconnect();
|
|
$wnd.__circuitSubmenuObserver = null;
|
|
}
|
|
}
|
|
}
|
|
|
|
function $zoomCircuit(this$static, dy, menu){
|
|
var newScale, oldScale, val;
|
|
oldScale = this$static.sim.transform_0[0];
|
|
val = dy * $intern_34;
|
|
newScale = $wnd.Math.max(oldScale + val, 0.2);
|
|
newScale = $wnd.Math.min(newScale, 2.5);
|
|
if (newScale == oldScale)
|
|
return;
|
|
$setCircuitScale(this$static, newScale, menu);
|
|
}
|
|
|
|
function MouseManager(sim, ui){
|
|
this.scopePlotRoles = new HashMap;
|
|
this.sim = sim;
|
|
this.ui = ui;
|
|
}
|
|
|
|
function doTouchHandlers(mm, cv){
|
|
var lastTap;
|
|
var tmout;
|
|
var lastScale;
|
|
cv.addEventListener('touchstart', function(e){
|
|
mousePos = getTouchPos(cv, e);
|
|
var touch = e.touches[0];
|
|
var etype = 'mousedown';
|
|
lastScale = 1;
|
|
clearTimeout(tmout);
|
|
e.preventDefault();
|
|
e.timeStamp - lastTap < 300?(etype = 'dblclick'):(tmout = setTimeout(function(){
|
|
mm.longPress();
|
|
}
|
|
, 500));
|
|
lastTap = e.timeStamp;
|
|
var touch1 = e.touches[0];
|
|
var touch2 = e.touches[e.touches.length - 1];
|
|
lastScale = Math.hypot(touch1.clientX - touch2.clientX, touch1.clientY - touch2.clientY);
|
|
var mouseEvent = new MouseEvent(etype, {clientX:0.5 * (touch1.clientX + touch2.clientX), clientY:0.5 * (touch1.clientY + touch2.clientY)});
|
|
cv.dispatchEvent(mouseEvent);
|
|
e.touches.length > 1 && mm.twoFingerTouch(mouseEvent.clientX, mouseEvent.clientY - cv.getBoundingClientRect().y);
|
|
}
|
|
, false);
|
|
cv.addEventListener('touchend', function(e){
|
|
var mouseEvent = new MouseEvent('mouseup', {});
|
|
e.preventDefault();
|
|
clearTimeout(tmout);
|
|
cv.dispatchEvent(mouseEvent);
|
|
}
|
|
, false);
|
|
cv.addEventListener('touchmove', function(e){
|
|
e.preventDefault();
|
|
clearTimeout(tmout);
|
|
var touch1 = e.touches[0];
|
|
var touch2 = e.touches[e.touches.length - 1];
|
|
if (e.touches.length > 1) {
|
|
var newScale = Math.hypot(touch1.clientX - touch2.clientX, touch1.clientY - touch2.clientY);
|
|
mm.zoomCircuit(40 * (Math.log(newScale) - Math.log(lastScale)));
|
|
lastScale = newScale;
|
|
}
|
|
var mouseEvent = new MouseEvent('mousemove', {clientX:0.5 * (touch1.clientX + touch2.clientX), clientY:0.5 * (touch1.clientY + touch2.clientY)});
|
|
cv.dispatchEvent(mouseEvent);
|
|
}
|
|
, false);
|
|
function getTouchPos(canvasDom, touchEvent){
|
|
var rect = canvasDom.getBoundingClientRect();
|
|
return {x:touchEvent.touches[0].clientX - rect.left, y:touchEvent.touches[0].clientY - rect.top};
|
|
}
|
|
|
|
}
|
|
|
|
defineClass(678, 1, {37:1, 1009:1, 1001:1, 208:1, 457:1, 173:1, 316:1, 131:1, 11:1}, MouseManager);
|
|
_.longPress = function longPress(){
|
|
$doPopupMenu(this);
|
|
}
|
|
;
|
|
_.onClick = function onClick_29(e){
|
|
!!e.nativeEvent && (e.nativeEvent.preventDefault() , undefined);
|
|
$eventGetButton(e.nativeEvent) == 4 && $scrollValues(this, (e.nativeEvent.clientX || 0) | 0, (e.nativeEvent.clientY || 0) | 0, 0);
|
|
}
|
|
;
|
|
_.onDoubleClick = function onDoubleClick(e){
|
|
!!e.nativeEvent && (e.nativeEvent.preventDefault() , undefined);
|
|
if (!this.mouseElm)
|
|
return;
|
|
if (instanceOf(this.mouseElm, 200)) {
|
|
$onDoubleClick(this.mouseElm);
|
|
return;
|
|
}
|
|
!instanceOf(this.mouseElm, 61) && !$isReadOnly(this.ui) && $doEdit(this.sim.commands, this.mouseElm);
|
|
}
|
|
;
|
|
_.onMouseDown = function onMouseDown_2(e){
|
|
var ce, ce$iterator, gx, gy, i, s, sgx, sgy, x0, y0;
|
|
!!e.nativeEvent && (e.nativeEvent.preventDefault() , undefined);
|
|
$setFocus(this.ui.cv);
|
|
this.sim.stopElm = null;
|
|
this.menuX = this.menuClientX = $getX(e);
|
|
this.menuY = this.menuClientY = $getY(e);
|
|
this.mouseDownTime = ($clinit_System() , fromDouble_0(Date.now()));
|
|
$enablePaste(this.sim.commands);
|
|
if ($eventGetButton(e.nativeEvent) != 1 && $eventGetButton(e.nativeEvent) != 4)
|
|
return;
|
|
$mouseSelect(this, e);
|
|
this.mouseDragging = true;
|
|
if (this.mouseWasOverSplitter) {
|
|
this.tempMouseMode = 7;
|
|
return;
|
|
}
|
|
if ($eventGetButton(e.nativeEvent) == 1) {
|
|
this.tempMouseMode = this.mouseMode;
|
|
!!e.nativeEvent.altKey && !!e.nativeEvent.metaKey?(this.tempMouseMode = 3):!!e.nativeEvent.altKey && !!e.nativeEvent.shiftKey?(this.tempMouseMode = 2):e.nativeEvent.shiftKey?(this.tempMouseMode = 6):e.nativeEvent.altKey?(this.tempMouseMode = 1):(!!e.nativeEvent.ctrlKey || !!e.nativeEvent.metaKey) && (this.tempMouseMode = 5);
|
|
}
|
|
else
|
|
this.tempMouseMode = 1;
|
|
$isReadOnly(this.ui) && this.tempMouseMode != 1 && (this.tempMouseMode = 6);
|
|
if (!$dialogIsShowing(this.sim.ui) && (this.sim.scopeManager.scopeSelected != -1 && $cursorInSettingsWheel(this.sim.scopeManager.scopes[this.sim.scopeManager.scopeSelected]) || this.sim.scopeManager.scopeSelected == -1 && instanceOf(this.mouseElm, 21) && $cursorInSettingsWheel(this.mouseElm.elmScope))) {
|
|
if ($isReadOnly(this.ui))
|
|
return;
|
|
this.sim.scopeManager.scopeSelected != -1?(s = this.sim.scopeManager.scopes[this.sim.scopeManager.scopeSelected]):(s = this.mouseElm.elmScope);
|
|
s.properties = new ScopePropertiesDialog(s.app, s);
|
|
dialogShowing = s.properties;
|
|
$clearSelection(this);
|
|
this.mouseDragging = false;
|
|
return;
|
|
}
|
|
if (!$dialogIsShowing(this.sim.ui)) {
|
|
for (i = 0; i != this.sim.scopeManager.scopeCount; i++)
|
|
$mousePressed(this.sim.scopeManager.scopes[i], $getX(e), $getY(e));
|
|
if (this.sim.scopeElmArr != null)
|
|
for (i = 0; i != this.sim.scopeElmArr.length; i++)
|
|
$mousePressed(this.sim.scopeElmArr[i].elmScope, $getX(e), $getY(e));
|
|
}
|
|
if (!$dialogIsShowing(this.sim.ui) && !!($clinit_Scope() , cursorScope) && ($eventGetButton(e.nativeEvent) == 4 || $eventGetButton(e.nativeEvent) == 1 && !!e.nativeEvent.altKey) && $startDragPlotY(($clinit_Scope() , cursorScope), $getX(e), $getY(e)))
|
|
return;
|
|
gx = $inverseTransformX(this, $getX(e));
|
|
gy = $inverseTransformY(this, $getY(e));
|
|
if ($doSwitch(this, gx, gy)) {
|
|
return;
|
|
}
|
|
this.tempMouseMode == 6 && !!this.mouseElm && !$isReadOnly(this.ui) && $getHandleGrabbedClose(this.mouseElm, gx, gy, 256) >= 0 && !$anySelectedButMouse(this) && (this.tempMouseMode = 5);
|
|
this.tempMouseMode != 6 && this.tempMouseMode != 4 && $clearSelection(this);
|
|
$pushUndo(this.sim.undoManager);
|
|
this.initDragGridX = gx;
|
|
this.initDragGridY = gy;
|
|
if (this.tempMouseMode == 2 || this.tempMouseMode == 3) {
|
|
this.dragRowColElms = new ArrayList;
|
|
this.dragRowColPosts = new ArrayList;
|
|
sgx = gx + this.sim.gridRound & this.sim.gridMask;
|
|
sgy = gy + this.sim.gridRound & this.sim.gridMask;
|
|
for (ce$iterator = new ArrayList$1(this.ui.elmList.arrayList); ce$iterator.i < ce$iterator.this$01.array.length;) {
|
|
ce = $next_4(ce$iterator);
|
|
if (this.tempMouseMode == 2) {
|
|
if (ce.y_0 == sgy) {
|
|
$add_8(this.dragRowColElms, ce);
|
|
$add_8(this.dragRowColPosts, valueOf_0(0));
|
|
}
|
|
if (ce.y2 == sgy) {
|
|
$add_8(this.dragRowColElms, ce);
|
|
$add_8(this.dragRowColPosts, valueOf_0(1));
|
|
}
|
|
}
|
|
else {
|
|
if (ce.x_0 == sgx) {
|
|
$add_8(this.dragRowColElms, ce);
|
|
$add_8(this.dragRowColPosts, valueOf_0(0));
|
|
}
|
|
if (ce.x2 == sgx) {
|
|
$add_8(this.dragRowColElms, ce);
|
|
$add_8(this.dragRowColPosts, valueOf_0(1));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (this.tempMouseMode != 0)
|
|
return;
|
|
x0 = gx + this.sim.gridRound & this.sim.gridMask;
|
|
y0 = gy + this.sim.gridRound & this.sim.gridMask;
|
|
if (!$contains(this.sim.circuitArea, $getX(e), $getY(e)))
|
|
return;
|
|
try {
|
|
this.dragElm = constructElement(this.ui.mouseModeStr, x0, y0);
|
|
}
|
|
catch ($e0) {
|
|
$e0 = toJava($e0);
|
|
if (instanceOf($e0, 13)) {
|
|
debugger_0();
|
|
}
|
|
else
|
|
throw toJs($e0);
|
|
}
|
|
$updateToolbar(this.sim.ui);
|
|
}
|
|
;
|
|
_.onMouseMove = function onMouseMove_1(e){
|
|
!!e.nativeEvent && (e.nativeEvent.preventDefault() , undefined);
|
|
this.mouseCursorX = $getX(e);
|
|
this.mouseCursorY = $getY(e);
|
|
if (this.mouseDragging) {
|
|
$mouseDragged(this, e);
|
|
return;
|
|
}
|
|
$mouseSelect(this, e);
|
|
this.sim.scopeManager.scopeMenuSelected = -1;
|
|
}
|
|
;
|
|
_.onMouseOut = function onMouseOut_2(e){
|
|
this.mouseCursorX = -1;
|
|
this.mouseDragging && $endDrag(this);
|
|
}
|
|
;
|
|
_.onMouseUp = function onMouseUp_2(e){
|
|
!!e.nativeEvent && (e.nativeEvent.preventDefault() , undefined);
|
|
this.tempMouseMode == 6 && !this.selectedArea && $eventGetButton(e.nativeEvent) == 1 && $clearSelection(this);
|
|
this.tempMouseMode == 5 && this.draggingPost == -1 && $doSplit(this, this.mouseElm);
|
|
$endDrag(this);
|
|
}
|
|
;
|
|
_.onMouseWheel = function onMouseWheel_1(e){
|
|
var zoomOnly;
|
|
!!e.nativeEvent && (e.nativeEvent.preventDefault() , undefined);
|
|
zoomOnly = ($clinit_System() , lt(fromDouble_0(Date.now()), add_2(this.zoomTime, $intern_22)));
|
|
($isReadOnly(this.ui) || !this.sim.menus.mouseWheelEditCheckItem.on) && (zoomOnly = true);
|
|
zoomOnly || $scrollValues(this, (e.nativeEvent.clientX || 0) | 0, (e.nativeEvent.clientY || 0) | 0, $eventGetMouseWheelVelocityY(e.nativeEvent));
|
|
if (this.sim.scopeManager.scopeSelected != -1)
|
|
$onMouseWheel(this.sim.scopeManager.scopes[this.sim.scopeManager.scopeSelected], e);
|
|
else if (instanceOf(this.mouseElm, 131) && !zoomOnly)
|
|
this.mouseElm.onMouseWheel(e);
|
|
else if (!$dialogIsShowing(this.sim.ui)) {
|
|
this.mouseCursorX = $getX(e);
|
|
this.mouseCursorY = $getY(e);
|
|
$zoomCircuit(this, -$eventGetMouseWheelVelocityY(e.nativeEvent) * this.wheelSensitivity, false);
|
|
this.zoomTime = fromDouble_0(Date.now());
|
|
}
|
|
$repaint(this.sim.ui);
|
|
}
|
|
;
|
|
_.twoFingerTouch = function twoFingerTouch(x_0, y_0){
|
|
this.tempMouseMode = 1;
|
|
this.dragScreenX = x_0;
|
|
this.dragScreenY = y_0;
|
|
}
|
|
;
|
|
_.zoomCircuit = function zoomCircuit(dy){
|
|
$zoomCircuit(this, dy, false);
|
|
}
|
|
;
|
|
_.dragGridX = 0;
|
|
_.dragGridY = 0;
|
|
_.dragScreenX = 0;
|
|
_.dragScreenY = 0;
|
|
_.draggingPost = 0;
|
|
_.highlightedNode = null;
|
|
_.initDragGridX = 0;
|
|
_.initDragGridY = 0;
|
|
_.menuClientX = 0;
|
|
_.menuClientY = 0;
|
|
_.menuX = 0;
|
|
_.menuY = 0;
|
|
_.mouseCursorX = -1;
|
|
_.mouseCursorY = -1;
|
|
_.mouseDownTime = 0;
|
|
_.mouseDragging = false;
|
|
_.mouseElm = null;
|
|
_.mouseMode = 6;
|
|
_.mousePost = -1;
|
|
_.mouseWasOverSplitter = false;
|
|
_.netHighlightKeyHeld = false;
|
|
_.tempMouseMode = 6;
|
|
_.toolbarDragActive = false;
|
|
_.toolbarDragAnchorX = 0;
|
|
_.toolbarDragAnchorY = 0;
|
|
_.toolbarDragStartX = 0;
|
|
_.toolbarDragStartY = 0;
|
|
_.toolbarDragVertical = false;
|
|
_.wheelSensitivity = 1;
|
|
_.zoomTime = 0;
|
|
var lastSubcircuitMenuUpdate = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_MouseManager_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'MouseManager', 678);
|
|
function MouseManager$1(){
|
|
}
|
|
|
|
defineClass(679, 1, $intern_65, MouseManager$1);
|
|
_.onClose = function onClose_1(event_0){
|
|
$watchSubmenus(false);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_MouseManager$1_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'MouseManager/1', 679);
|
|
function $readSelectValue_0(this$static){
|
|
var i, sel;
|
|
sel = 0;
|
|
for (i = 0; i < this$static.selectBitCount; i++)
|
|
this$static.pins[this$static.selectPin + i].value_0 && (sel |= 1 << i);
|
|
return sel;
|
|
}
|
|
|
|
function $setupPins_16(this$static){
|
|
var g, i, inputPinCount, invertedCount, n, outputPinCount, strobeCount;
|
|
this$static.outputCount = 1 << this$static.selectBitCount;
|
|
if (this$static.inputMode == 2) {
|
|
inputPinCount = this$static.outputCount * this$static.dataBusWidth;
|
|
outputPinCount = this$static.dataBusWidth;
|
|
invertedCount = (this$static.flags & 2) != 0?this$static.dataBusWidth:0;
|
|
strobeCount = (this$static.flags & 4) != 0?1:0;
|
|
this$static.sizeX = this$static.selectBitCount + 1;
|
|
this$static.sizeY = this$static.outputCount + 1;
|
|
this$static.pins = initUnidimensionalArray(Lcom_lushprojects_circuitjs1_client_ChipElm$Pin_2_classLit, $intern_3, 9, inputPinCount + this$static.selectBitCount + outputPinCount + invertedCount + strobeCount, 0, 1);
|
|
for (g = 0; g < this$static.outputCount; g++) {
|
|
for (i = 0; i < this$static.dataBusWidth; i++) {
|
|
n = g * this$static.dataBusWidth + i;
|
|
this$static.pins[n] = new ChipElm$Pin(this$static, g, 2, 'I' + g);
|
|
this$static.pins[n].busWidth = this$static.dataBusWidth;
|
|
this$static.pins[n].busZ = i;
|
|
}
|
|
}
|
|
this$static.selectPin = inputPinCount;
|
|
for (i = 0; i < this$static.selectBitCount; i++) {
|
|
n = this$static.selectPin + i;
|
|
if ((this$static.flags & 8) != 0) {
|
|
this$static.pins[n] = new ChipElm$Pin(this$static, 0, 1, 'S');
|
|
this$static.pins[n].busWidth = this$static.selectBitCount;
|
|
this$static.pins[n].busZ = i;
|
|
}
|
|
else {
|
|
this$static.pins[n] = new ChipElm$Pin(this$static, i + 1, 1, 'S' + i);
|
|
}
|
|
}
|
|
this$static.outputPin = this$static.selectPin + this$static.selectBitCount;
|
|
for (i = 0; i < this$static.dataBusWidth; i++) {
|
|
n = this$static.outputPin + i;
|
|
this$static.pins[n] = new ChipElm$Pin(this$static, 0, 3, 'Q');
|
|
this$static.pins[n].output = true;
|
|
this$static.pins[n].busWidth = this$static.dataBusWidth;
|
|
this$static.pins[n].busZ = i;
|
|
}
|
|
if ((this$static.flags & 2) != 0) {
|
|
for (i = 0; i < this$static.dataBusWidth; i++) {
|
|
n = this$static.outputPin + this$static.dataBusWidth + i;
|
|
this$static.pins[n] = new ChipElm$Pin(this$static, 1, 3, 'Q');
|
|
this$static.pins[n].lineOver = true;
|
|
this$static.pins[n].output = true;
|
|
this$static.pins[n].bubble = i == 0;
|
|
this$static.pins[n].busWidth = this$static.dataBusWidth;
|
|
this$static.pins[n].busZ = i;
|
|
}
|
|
}
|
|
if ((this$static.flags & 4) != 0) {
|
|
n = this$static.outputPin + this$static.dataBusWidth + invertedCount;
|
|
this$static.pins[n] = new ChipElm$Pin(this$static, 0, 1, 'STR');
|
|
this$static.strobe = n;
|
|
}
|
|
else
|
|
this$static.strobe = -1;
|
|
}
|
|
else if (this$static.inputMode == 1) {
|
|
this$static.sizeX = this$static.selectBitCount + 1;
|
|
this$static.sizeY = 3;
|
|
strobeCount = (this$static.flags & 4) != 0?1:0;
|
|
invertedCount = (this$static.flags & 2) != 0?1:0;
|
|
this$static.pins = initUnidimensionalArray(Lcom_lushprojects_circuitjs1_client_ChipElm$Pin_2_classLit, $intern_3, 9, this$static.outputCount + this$static.selectBitCount + 1 + invertedCount + strobeCount, 0, 1);
|
|
for (i = 0; i < this$static.outputCount; i++) {
|
|
this$static.pins[i] = new ChipElm$Pin(this$static, 0, 2, 'I');
|
|
this$static.pins[i].busWidth = this$static.outputCount;
|
|
this$static.pins[i].busZ = i;
|
|
}
|
|
this$static.selectPin = this$static.outputCount;
|
|
for (i = 0; i < this$static.selectBitCount; i++) {
|
|
n = this$static.selectPin + i;
|
|
if ((this$static.flags & 8) != 0) {
|
|
this$static.pins[n] = new ChipElm$Pin(this$static, 0, 1, 'S');
|
|
this$static.pins[n].busWidth = this$static.selectBitCount;
|
|
this$static.pins[n].busZ = i;
|
|
}
|
|
else {
|
|
this$static.pins[n] = new ChipElm$Pin(this$static, i + 1, 1, 'S' + i);
|
|
}
|
|
}
|
|
n = this$static.selectPin + this$static.selectBitCount;
|
|
this$static.pins[n] = new ChipElm$Pin(this$static, 0, 3, 'Q');
|
|
this$static.pins[n].output = true;
|
|
this$static.outputPin = n;
|
|
if ((this$static.flags & 2) != 0) {
|
|
++n;
|
|
this$static.pins[n] = new ChipElm$Pin(this$static, 1, 3, 'Q');
|
|
this$static.pins[n].lineOver = true;
|
|
this$static.pins[n].output = true;
|
|
this$static.pins[n].bubble = true;
|
|
}
|
|
if ((this$static.flags & 4) != 0) {
|
|
++n;
|
|
this$static.pins[n] = new ChipElm$Pin(this$static, 0, 1, 'STR');
|
|
this$static.strobe = n;
|
|
}
|
|
else
|
|
this$static.strobe = -1;
|
|
}
|
|
else {
|
|
this$static.sizeX = this$static.selectBitCount + 1;
|
|
this$static.sizeY = this$static.outputCount + 1;
|
|
strobeCount = (this$static.flags & 4) != 0?1:0;
|
|
invertedCount = (this$static.flags & 2) != 0?1:0;
|
|
this$static.pins = initUnidimensionalArray(Lcom_lushprojects_circuitjs1_client_ChipElm$Pin_2_classLit, $intern_3, 9, this$static.outputCount + this$static.selectBitCount + 1 + invertedCount + strobeCount, 0, 1);
|
|
for (i = 0; i < this$static.outputCount; i++)
|
|
this$static.pins[i] = new ChipElm$Pin(this$static, i, 2, 'I' + i);
|
|
this$static.selectPin = this$static.outputCount;
|
|
for (i = 0; i < this$static.selectBitCount; i++) {
|
|
n = this$static.selectPin + i;
|
|
if ((this$static.flags & 8) != 0) {
|
|
this$static.pins[n] = new ChipElm$Pin(this$static, 0, 1, 'S');
|
|
this$static.pins[n].busWidth = this$static.selectBitCount;
|
|
this$static.pins[n].busZ = i;
|
|
}
|
|
else {
|
|
this$static.pins[n] = new ChipElm$Pin(this$static, i + 1, 1, 'S' + i);
|
|
}
|
|
}
|
|
n = this$static.selectPin + this$static.selectBitCount;
|
|
this$static.pins[n] = new ChipElm$Pin(this$static, 0, 3, 'Q');
|
|
this$static.pins[n].output = true;
|
|
this$static.outputPin = n;
|
|
if ((this$static.flags & 2) != 0) {
|
|
++n;
|
|
this$static.pins[n] = new ChipElm$Pin(this$static, 1, 3, 'Q');
|
|
this$static.pins[n].lineOver = true;
|
|
this$static.pins[n].output = true;
|
|
this$static.pins[n].bubble = true;
|
|
}
|
|
if ((this$static.flags & 4) != 0) {
|
|
++n;
|
|
this$static.pins[n] = new ChipElm$Pin(this$static, 0, 1, 'STR');
|
|
this$static.strobe = n;
|
|
}
|
|
else
|
|
this$static.strobe = -1;
|
|
}
|
|
$allocNodes(this$static);
|
|
}
|
|
|
|
function MultiplexerElm(xx, yy){
|
|
$clinit_ChipElm();
|
|
ChipElm.call(this, xx, yy);
|
|
this.dataBusWidth = 4;
|
|
this.selectBitCount = 2;
|
|
$setupPins_16(this);
|
|
}
|
|
|
|
function MultiplexerElm_0(xa, ya, xb, yb, f, st){
|
|
$clinit_ChipElm();
|
|
ChipElm_0.call(this, xa, ya, xb, yb, f, st);
|
|
this.dataBusWidth = 4;
|
|
this.selectBitCount = 2;
|
|
try {
|
|
this.selectBitCount = __parseAndValidateInt($nextToken(st), 10);
|
|
}
|
|
catch ($e0) {
|
|
$e0 = toJava($e0);
|
|
if (!instanceOf($e0, 13))
|
|
throw toJs($e0);
|
|
}
|
|
$setupPins_16(this);
|
|
}
|
|
|
|
defineClass(378, 32, $intern_85, MultiplexerElm, MultiplexerElm_0);
|
|
_.dumpXml = function dumpXml_53(doc, elem){
|
|
$dumpXml_0(this, elem);
|
|
dumpAttr_0(elem, 'se', this.selectBitCount);
|
|
this.inputMode != 0 && dumpAttr_0(elem, 'im', this.inputMode);
|
|
this.dataBusWidth != 4 && dumpAttr_0(elem, 'dw', this.dataBusWidth);
|
|
}
|
|
;
|
|
_.execute_3 = function execute_36(){
|
|
var i, i0, selectedValue, strobed, val;
|
|
selectedValue = $readSelectValue_0(this);
|
|
if (this.inputMode == 2) {
|
|
strobed = this.strobe != -1 && this.pins[this.strobe].value_0;
|
|
for (i0 = 0; i0 < this.dataBusWidth; i0++) {
|
|
val = !strobed && this.pins[selectedValue * this.dataBusWidth + i0].value_0;
|
|
this.pins[this.outputPin + i0].value_0 = val;
|
|
}
|
|
if ((this.flags & 2) != 0) {
|
|
for (i = 0; i < this.dataBusWidth; i++)
|
|
this.pins[this.outputPin + this.dataBusWidth + i].value_0 = !this.pins[this.outputPin + i].value_0;
|
|
}
|
|
}
|
|
else {
|
|
val = this.pins[selectedValue].value_0;
|
|
this.strobe != -1 && this.pins[this.strobe].value_0 && (val = false);
|
|
this.pins[this.outputPin].value_0 = val;
|
|
(this.flags & 2) != 0 && (this.pins[this.outputPin + 1].value_0 = !val);
|
|
}
|
|
}
|
|
;
|
|
_.getChipEditInfo = function getChipEditInfo_17(n){
|
|
var ei;
|
|
if (n == 0)
|
|
return $setDimensionless(new EditInfo_0('# of Select Bits', this.selectBitCount, 1, 8));
|
|
if (n == 1)
|
|
return createCheckbox('Inverted Output', (this.flags & 2) != 0);
|
|
if (n == 2)
|
|
return createCheckbox('Strobe Pin', (this.flags & 4) != 0);
|
|
if (n == 3) {
|
|
ei = new EditInfo_0('Input Mode', 0, -1, -1);
|
|
ei.choice = new Choice;
|
|
$addItem(ei.choice, LS('Individual Inputs'));
|
|
$addItem(ei.choice, LS('Bus Input (Bit Select)'));
|
|
$addItem(ei.choice, LS('Bus Input/Output'));
|
|
$select(ei.choice, this.inputMode);
|
|
return ei;
|
|
}
|
|
if (n == 4)
|
|
return createCheckbox('Bus Select', (this.flags & 8) != 0);
|
|
if (n == 5 && this.inputMode == 2)
|
|
return $setDimensionless(new EditInfo_0('Data Bus Width', this.dataBusWidth, 2, 32));
|
|
return null;
|
|
}
|
|
;
|
|
_.getChipName = function getChipName_20(){
|
|
return 'Multiplexer';
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_67(){
|
|
return 184;
|
|
}
|
|
;
|
|
_.getPostCount_0 = function getPostCount_48(){
|
|
var invertedCount, strobeCount;
|
|
if (this.inputMode == 2) {
|
|
invertedCount = (this.flags & 2) != 0?this.dataBusWidth:0;
|
|
strobeCount = (this.flags & 4) != 0?1:0;
|
|
return this.outputCount * this.dataBusWidth + this.selectBitCount + this.dataBusWidth + invertedCount + strobeCount;
|
|
}
|
|
invertedCount = (this.flags & 2) != 0?1:0;
|
|
strobeCount = (this.flags & 4) != 0?1:0;
|
|
return this.outputCount + this.selectBitCount + 1 + invertedCount + strobeCount;
|
|
}
|
|
;
|
|
_.getVoltageSourceCount = function getVoltageSourceCount_39(){
|
|
var count;
|
|
if (this.inputMode == 2) {
|
|
count = this.dataBusWidth;
|
|
(this.flags & 2) != 0 && (count += this.dataBusWidth);
|
|
return count;
|
|
}
|
|
return (this.flags & 2) != 0?2:1;
|
|
}
|
|
;
|
|
_.getXmlDumpType = function getXmlDumpType_18(){
|
|
return 'mux';
|
|
}
|
|
;
|
|
_.setChipEditValue = function setChipEditValue_18(n, ei){
|
|
if (n == 0) {
|
|
if (ei.value_0 >= 1 && ei.value_0 <= 6) {
|
|
this.selectBitCount = round_int(ei.value_0);
|
|
$setupPins_16(this);
|
|
$setPoints_0(this);
|
|
}
|
|
else
|
|
ei.error = 'must be between 1 and 6';
|
|
return;
|
|
}
|
|
if (n == 1) {
|
|
this.flags = $changeFlag(ei, this.flags, 2);
|
|
$setupPins_16(this);
|
|
$setPoints_0(this);
|
|
return;
|
|
}
|
|
if (n == 2) {
|
|
this.flags = $changeFlag(ei, this.flags, 4);
|
|
$setupPins_16(this);
|
|
$setPoints_0(this);
|
|
return;
|
|
}
|
|
if (n == 3) {
|
|
this.inputMode = $getElement(ei.choice).selectedIndex;
|
|
$setupPins_16(this);
|
|
$setPoints_0(this);
|
|
return;
|
|
}
|
|
if (n == 4) {
|
|
this.flags = $changeFlag(ei, this.flags, 8);
|
|
$setupPins_16(this);
|
|
$setPoints_0(this);
|
|
return;
|
|
}
|
|
if (n == 5) {
|
|
if (ei.value_0 >= 2) {
|
|
this.dataBusWidth = round_int(ei.value_0);
|
|
$setupPins_16(this);
|
|
$setPoints_0(this);
|
|
}
|
|
else
|
|
ei.error = 'must be >= 2';
|
|
return;
|
|
}
|
|
}
|
|
;
|
|
_.setupPins = function setupPins_21(){
|
|
$setupPins_16(this);
|
|
}
|
|
;
|
|
_.undumpXml = function undumpXml_56(xml){
|
|
$undumpXml_0(this, xml);
|
|
this.selectBitCount = $parseIntAttr(xml, 'se', this.selectBitCount);
|
|
this.inputMode = $parseIntAttr(xml, 'im', 0);
|
|
this.dataBusWidth = $parseIntAttr(xml, 'dw', 4);
|
|
$setupPins_16(this);
|
|
}
|
|
;
|
|
_.dataBusWidth = 0;
|
|
_.inputMode = 0;
|
|
_.outputCount = 0;
|
|
_.outputPin = 0;
|
|
_.selectBitCount = 0;
|
|
_.selectPin = 0;
|
|
_.strobe = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_MultiplexerElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'MultiplexerElm', 378);
|
|
function $execute_0(this$static){
|
|
$menuPerformed(theApp.commands, this$static.menuName, this$static.itemName);
|
|
}
|
|
|
|
function $setItemName(this$static, x_0){
|
|
this$static.itemName = x_0;
|
|
}
|
|
|
|
function MyCommand(name_0, item_0){
|
|
this.menuName = name_0;
|
|
this.itemName = item_0;
|
|
}
|
|
|
|
defineClass(20, 1, {}, MyCommand);
|
|
_.execute_1 = function execute_37(){
|
|
$execute_0(this);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_MyCommand_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'MyCommand', 20);
|
|
function NDarlingtonElm(xx, yy){
|
|
$clinit_DarlingtonElm();
|
|
DarlingtonElm_0.call(this, xx, yy, false);
|
|
}
|
|
|
|
defineClass(367, 303, $intern_85, NDarlingtonElm);
|
|
_.getDumpClass = function getDumpClass_5(){
|
|
return Lcom_lushprojects_circuitjs1_client_DarlingtonElm_2_classLit;
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_NDarlingtonElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'NDarlingtonElm', 367);
|
|
function NJfetElm(xx, yy){
|
|
JfetElm_0.call(this, xx, yy, false);
|
|
}
|
|
|
|
defineClass(366, 185, $intern_123, NJfetElm);
|
|
_.getDumpClass = function getDumpClass_6(){
|
|
return Lcom_lushprojects_circuitjs1_client_JfetElm_2_classLit;
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_NJfetElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'NJfetElm', 366);
|
|
function NMosfetElm(xx, yy){
|
|
MosfetElm_0.call(this, xx, yy, false);
|
|
}
|
|
|
|
defineClass(365, 129, $intern_121, NMosfetElm);
|
|
_.getDumpClass = function getDumpClass_7(){
|
|
return Lcom_lushprojects_circuitjs1_client_MosfetElm_2_classLit;
|
|
}
|
|
;
|
|
_.getShortcut = function getShortcut_25(){
|
|
return 78;
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_NMosfetElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'NMosfetElm', 365);
|
|
function $draw_1(this$static, g){
|
|
var ds;
|
|
(this$static.flags & 2) != globalFlags && $setPoints_16(this$static);
|
|
$setBbox_0(this$static, this$static.point1, this$static.point2, 16);
|
|
if ((globalFlags & 2) != 0) {
|
|
$setColor_0(g, ($clinit_Color() , gray));
|
|
drawThickCircle(g, this$static.circleCenter.x_0, this$static.circleCenter.y_0, 20);
|
|
}
|
|
$setPowerColor_0(this$static, g);
|
|
$setVoltageColor(this$static, g, this$static.volts[1]);
|
|
drawThickLine_0(g, this$static.coll[0], this$static.coll[1], 3);
|
|
$setVoltageColor(this$static, g, this$static.volts[2]);
|
|
drawThickLine_0(g, this$static.emit[0], this$static.emit[1], 3);
|
|
$setColor_0(g, lightGrayColor);
|
|
$fillPolygon(g, this$static.arrowPoly);
|
|
$setVoltageColor(this$static, g, this$static.volts[0]);
|
|
app_0.menus.powerCheckItem.on && $setColor_0(g, ($clinit_Color() , gray));
|
|
drawThickLine_0(g, this$static.point1, this$static.base, 3);
|
|
this$static.curcount_b = $updateDotCount(-this$static.ib, this$static.curcount_b);
|
|
$drawDots(g, this$static.base, this$static.point1, this$static.curcount_b);
|
|
this$static.curcount_c = $updateDotCount(-this$static.ic, this$static.curcount_c);
|
|
$drawDots(g, this$static.coll[1], this$static.coll[0], this$static.curcount_c);
|
|
this$static.curcount_e = $updateDotCount(-this$static.ie, this$static.curcount_e);
|
|
$drawDots(g, this$static.emit[1], this$static.emit[0], this$static.curcount_e);
|
|
$setVoltageColor(this$static, g, this$static.volts[0]);
|
|
$setPowerColor_0(this$static, g);
|
|
$fillPolygon(g, this$static.rectPoly);
|
|
if ((mouseElmRef == this$static || this$static.selected_0 || $containsKey(app_0.mouse.scopePlotRoles, this$static) || instanceOf(mouseElmRef, 21) && $getElm_0(mouseElmRef.elmScope) == this$static || $isOnHighlightedNet(this$static) || app_0.mouse.dragElm == this$static) && this$static.dy == 0) {
|
|
$setColor_0(g, whiteColor);
|
|
ds = sign_0(this$static.dx);
|
|
$drawString(g, 'B', this$static.base.x_0 - 10 * ds, this$static.base.y_0 - 5);
|
|
$drawString(g, 'C', this$static.coll[0].x_0 - 3 + 9 * ds, this$static.coll[0].y_0 + 4);
|
|
$drawString(g, 'E', this$static.emit[0].x_0 - 3 + 9 * ds, this$static.emit[0].y_0 + 4);
|
|
}
|
|
$drawPosts(this$static, g);
|
|
}
|
|
|
|
function $getPost_2(this$static, n){
|
|
return n == 0?this$static.point1:n == 1?this$static.coll[0]:this$static.emit[0];
|
|
}
|
|
|
|
function $limitStep_0(this$static, vnew, vold){
|
|
var arg;
|
|
if (vnew > this$static.vcrit && $wnd.Math.abs(vnew - vold) > 0.05173) {
|
|
if (vold > 0) {
|
|
arg = 1 + (vnew - vold) / $intern_109;
|
|
arg > 0?(vnew = vold + $intern_109 * $wnd.Math.log(arg)):(vnew = this$static.vcrit);
|
|
}
|
|
else {
|
|
vnew = $intern_109 * $wnd.Math.log(vnew / $intern_109);
|
|
}
|
|
sim_0.converged = false;
|
|
}
|
|
return vnew;
|
|
}
|
|
|
|
function $newModelCreated_1(this$static, tm){
|
|
this$static.model = tm;
|
|
this$static.modelName = this$static.model.name_0;
|
|
$setup_5(this$static);
|
|
}
|
|
|
|
function $setBeta(this$static, b){
|
|
this$static.beta_0 = b;
|
|
$setup_5(this$static);
|
|
}
|
|
|
|
function $setFlipped(this$static, flip){
|
|
(this$static.flags & 1) != 0 != flip && (this$static.flags ^= 1);
|
|
}
|
|
|
|
function $setPoints_16(this$static){
|
|
var hs2, pt;
|
|
this$static.flags &= -3;
|
|
this$static.flags |= globalFlags;
|
|
$setPoints(this$static);
|
|
(this$static.flags & 1) != 0 && (this$static.dsign = -this$static.dsign);
|
|
hs2 = 16 * this$static.dsign * this$static.pnp;
|
|
this$static.coll = $newPointArray(2);
|
|
this$static.emit = $newPointArray(2);
|
|
$interpPoint2(this$static.point1, this$static.point2, this$static.coll[0], this$static.emit[0], 1, hs2);
|
|
this$static.rect_0 = $newPointArray(4);
|
|
$interpPoint2(this$static.point1, this$static.point2, this$static.rect_0[0], this$static.rect_0[1], 1 - 16 / this$static.dn, 16);
|
|
$interpPoint2(this$static.point1, this$static.point2, this$static.rect_0[2], this$static.rect_0[3], 1 - 13 / this$static.dn, 16);
|
|
$interpPoint2(this$static.point1, this$static.point2, this$static.coll[1], this$static.emit[1], 1 - 13 / this$static.dn, 6 * this$static.dsign * this$static.pnp);
|
|
this$static.base = new Point_1;
|
|
$interpPoint_1(this$static.point1, this$static.point2, this$static.base, 1 - 16 / this$static.dn);
|
|
this$static.rectPoly = $createPolygon_0(this$static.rect_0[0], this$static.rect_0[2], this$static.rect_0[3], this$static.rect_0[1]);
|
|
if (this$static.pnp == 1)
|
|
this$static.arrowPoly = $calcArrow(this$static.emit[1], this$static.emit[0], 8, 4);
|
|
else {
|
|
pt = $interpPoint_0(this$static.point1, this$static.point2, 1 - 11 / this$static.dn, -5 * this$static.dsign * this$static.pnp);
|
|
this$static.arrowPoly = $calcArrow(this$static.emit[0], pt, 8, 4);
|
|
}
|
|
this$static.circleCenter = $interpPoint(this$static.base, this$static.point2, 0.5);
|
|
}
|
|
|
|
function $setup_5(this$static){
|
|
this$static.model = getModelWithNameOrCopy_3(this$static.modelName, this$static.model);
|
|
this$static.modelName = this$static.model.name_0;
|
|
this$static.vcrit = $intern_109 * $wnd.Math.log($intern_109 / ($wnd.Math.sqrt(2) * this$static.model.satCur));
|
|
this$static.noDiagonal = true;
|
|
}
|
|
|
|
function TransistorElm(xa, ya, xb, yb, f, st){
|
|
CircuitElm_0.call(this, xa, ya, xb, yb, f);
|
|
this.pnp = (new Integer_0($nextToken(st))).value_0;
|
|
this.beta_0 = 100;
|
|
try {
|
|
this.lastvbe = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.lastvbc = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.volts[0] = 0;
|
|
this.volts[1] = -this.lastvbe;
|
|
this.volts[2] = -this.lastvbc;
|
|
this.beta_0 = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.modelName = unescape_0($nextToken(st));
|
|
}
|
|
catch ($e0) {
|
|
$e0 = toJava($e0);
|
|
if (instanceOf($e0, 13)) {
|
|
this.modelName = 'default';
|
|
}
|
|
else
|
|
throw toJs($e0);
|
|
}
|
|
globalFlags = this.flags & 2;
|
|
$setup_5(this);
|
|
}
|
|
|
|
function TransistorElm_0(xx, yy, pnpflag){
|
|
CircuitElm.call(this, xx, yy);
|
|
this.pnp = pnpflag?-1:1;
|
|
this.beta_0 = 100;
|
|
this.modelName = lastModelName_3;
|
|
$setup_5(this);
|
|
}
|
|
|
|
function calcJunctionCap(vj, cj0, vj0, mj){
|
|
if (cj0 <= 0)
|
|
return 0;
|
|
return vj < 0.5 * vj0?cj0 / $wnd.Math.pow(1 - vj / vj0, mj):cj0 / $wnd.Math.pow(0.5, 1 + mj) * (1 - 0.5 * (1 + mj) + mj * vj / vj0);
|
|
}
|
|
|
|
defineClass(153, 8, $intern_126, TransistorElm);
|
|
_.addRoutingObstacle = function addRoutingObstacle_15(router){
|
|
$addObstacle_0(router, stampJavaTypeInfo(getClassLiteralForArray(Lcom_lushprojects_circuitjs1_client_Point_2_classLit, 1), $intern_78, 14, 0, [this.rect_0[0], this.rect_0[1], this.rect_0[2], this.rect_0[3], this.coll[0], this.emit[0]]));
|
|
$addWire(router, this.point1.x_0, this.point1.y_0, this.base.x_0, this.base.y_0);
|
|
}
|
|
;
|
|
_.canViewInScope = function canViewInScope_3(){
|
|
return true;
|
|
}
|
|
;
|
|
_.doStep = function doStep_35(){
|
|
var arg, c2, c4, cb, cbc, cbcn, cbe, cben, cc, ceqbc, ceqbe, csat, dqbdvc, dqbdve, evbc, evbcn, evbe, evben, gbc, gbcn, gbe, gben, gm, gmu, go, gpi, notConverged, oik, oikr, q1, q2, qb, sqarg, vbc, vbe, vtc, vte, vtn;
|
|
vbc = this.pnp * (this.volts[0] - this.volts[1]);
|
|
vbe = this.pnp * (this.volts[0] - this.volts[2]);
|
|
notConverged = $wnd.Math.abs(vbc - this.lastvbc) > $intern_34 || $wnd.Math.abs(vbe - this.lastvbe) > $intern_34;
|
|
notConverged && (sim_0.converged = false);
|
|
notConverged?++this.localSubIters:(this.localSubIters = 0);
|
|
this.gmin = $intern_102;
|
|
if (this.localSubIters > 100 && this.badIters < 5) {
|
|
this.gmin = $wnd.Math.exp(-9 * $wnd.Math.log(10) * (1 - this.localSubIters / 300));
|
|
this.gmin > 0.1 && (this.gmin = 0.1);
|
|
}
|
|
vbc = $limitStep_0(this, vbc, this.lastvbc);
|
|
vbe = $limitStep_0(this, vbe, this.lastvbe);
|
|
this.lastvbc = vbc;
|
|
this.lastvbe = vbe;
|
|
csat = this.model.satCur;
|
|
oik = this.model.invRollOffF;
|
|
c2 = this.model.BEleakCur;
|
|
vte = this.model.leakBEemissionCoeff * $intern_109;
|
|
oikr = this.model.invRollOffR;
|
|
c4 = this.model.BCleakCur;
|
|
vtc = this.model.leakBCemissionCoeff * $intern_109;
|
|
vtn = $intern_109 * this.model.emissionCoeffF;
|
|
if (vbe > -5 * vtn) {
|
|
evbe = $wnd.Math.exp(vbe / vtn);
|
|
cbe = csat * (evbe - 1) + this.gmin * vbe;
|
|
gbe = csat * evbe / vtn + this.gmin;
|
|
if (c2 == 0) {
|
|
cben = 0;
|
|
gben = 0;
|
|
}
|
|
else {
|
|
evben = $wnd.Math.exp(vbe / vte);
|
|
cben = c2 * (evben - 1);
|
|
gben = c2 * evben / vte;
|
|
}
|
|
}
|
|
else {
|
|
gbe = -csat / vbe + this.gmin;
|
|
cbe = gbe * vbe;
|
|
gben = -c2 / vbe;
|
|
cben = gben * vbe;
|
|
}
|
|
vtn = $intern_109 * this.model.emissionCoeffR;
|
|
if (vbc > -5 * vtn) {
|
|
evbc = $wnd.Math.exp(vbc / vtn);
|
|
cbc = csat * (evbc - 1) + this.gmin * vbc;
|
|
gbc = csat * evbc / vtn + this.gmin;
|
|
if (c4 == 0) {
|
|
cbcn = 0;
|
|
gbcn = 0;
|
|
}
|
|
else {
|
|
evbcn = $wnd.Math.exp(vbc / vtc);
|
|
cbcn = c4 * (evbcn - 1);
|
|
gbcn = c4 * evbcn / vtc;
|
|
}
|
|
}
|
|
else {
|
|
gbc = -csat / vbc + this.gmin;
|
|
cbc = gbc * vbc;
|
|
gbcn = -c4 / vbc;
|
|
cbcn = gbcn * vbc;
|
|
}
|
|
q1 = 1 / (1 - this.model.invEarlyVoltF * vbc - this.model.invEarlyVoltR * vbe);
|
|
if (oik == 0 && oikr == 0) {
|
|
qb = q1;
|
|
dqbdve = q1 * q1 * this.model.invEarlyVoltR;
|
|
dqbdvc = q1 * q1 * this.model.invEarlyVoltF;
|
|
}
|
|
else {
|
|
q2 = oik * cbe + oikr * cbc;
|
|
arg = $wnd.Math.max(0, 1 + 4 * q2);
|
|
sqarg = 1;
|
|
arg != 0 && (sqarg = $wnd.Math.sqrt(arg));
|
|
qb = q1 * (1 + sqarg) / 2;
|
|
dqbdve = q1 * (qb * this.model.invEarlyVoltR + oik * gbe / sqarg);
|
|
dqbdvc = q1 * (qb * this.model.invEarlyVoltF + oikr * gbc / sqarg);
|
|
}
|
|
cc = 0;
|
|
cc = cc + (cbe - cbc) / qb - cbc / this.model.betaR - cbcn;
|
|
cb = cbe / this.beta_0 + cben + cbc / this.model.betaR + cbcn;
|
|
this.ic = this.pnp * cc;
|
|
this.ib = this.pnp * cb;
|
|
this.ie = this.pnp * (-cc - cb);
|
|
gpi = gbe / this.beta_0 + gben;
|
|
gmu = gbc / this.model.betaR + gbcn;
|
|
go = (gbc + (cbe - cbc) * dqbdvc / qb) / qb;
|
|
gm = (gbe - (cbe - cbc) * dqbdve / qb) / qb - go;
|
|
ceqbe = this.pnp * (cc + cb - vbe * (gm + go + gpi) + vbc * go);
|
|
ceqbc = this.pnp * (-cc + vbe * (gm + go) - vbc * (gmu + go));
|
|
(isInfinite(this.ib) || isNaN(this.ic)) && $stop(sim_0, 'infinite transistor current', this);
|
|
$stampMatrix(this.nodes[1], this.nodes[1], gmu + go);
|
|
$stampMatrix(this.nodes[1], this.nodes[0], -gmu + gm);
|
|
$stampMatrix(this.nodes[1], this.nodes[2], -gm - go);
|
|
$stampMatrix(this.nodes[0], this.nodes[0], gpi + gmu);
|
|
$stampMatrix(this.nodes[0], this.nodes[2], -gpi);
|
|
$stampMatrix(this.nodes[0], this.nodes[1], -gmu);
|
|
$stampMatrix(this.nodes[2], this.nodes[0], -gpi - gm);
|
|
$stampMatrix(this.nodes[2], this.nodes[1], -go);
|
|
$stampMatrix(this.nodes[2], this.nodes[2], gpi + gm + go);
|
|
$stampRightSide(this.nodes[0], -ceqbe - ceqbc);
|
|
$stampRightSide(this.nodes[1], ceqbc);
|
|
$stampRightSide(this.nodes[2], ceqbe);
|
|
if (this.geqBE > 0) {
|
|
$stampMatrix(this.nodes[0], this.nodes[0], this.geqBE);
|
|
$stampMatrix(this.nodes[2], this.nodes[2], this.geqBE);
|
|
$stampMatrix(this.nodes[0], this.nodes[2], -this.geqBE);
|
|
$stampMatrix(this.nodes[2], this.nodes[0], -this.geqBE);
|
|
$stampRightSide(this.nodes[0], -this.ceqBE);
|
|
$stampRightSide(this.nodes[2], this.ceqBE);
|
|
}
|
|
if (this.geqBC > 0) {
|
|
$stampMatrix(this.nodes[0], this.nodes[0], this.geqBC);
|
|
$stampMatrix(this.nodes[1], this.nodes[1], this.geqBC);
|
|
$stampMatrix(this.nodes[0], this.nodes[1], -this.geqBC);
|
|
$stampMatrix(this.nodes[1], this.nodes[0], -this.geqBC);
|
|
$stampRightSide(this.nodes[0], -this.ceqBC);
|
|
$stampRightSide(this.nodes[1], this.ceqBC);
|
|
}
|
|
}
|
|
;
|
|
_.draw = function draw_51(g){
|
|
$draw_1(this, g);
|
|
}
|
|
;
|
|
_.dumpXml = function dumpXml_54(doc, elem){
|
|
this.model.builtIn || this.model.dumped || $dumpXml_13(this.model, doc);
|
|
dumpAttr_1(elem, 'x', this.x_0 + ' ' + this.y_0 + ' ' + this.x2 + ' ' + this.y2);
|
|
dumpAttr_0(elem, 'f', this.flags);
|
|
dumpAttr_0(elem, 'pn', this.pnp);
|
|
dumpAttr(elem, 'be', this.beta_0);
|
|
dumpAttr_1(elem, 'mo', this.modelName);
|
|
}
|
|
;
|
|
_.dumpXmlModel = function dumpXmlModel_3(doc){
|
|
this.model.builtIn || this.model.dumped || $dumpXml_13(this.model, doc);
|
|
}
|
|
;
|
|
_.dumpXmlState = function dumpXmlState_8(doc, elem){
|
|
dumpAttr(elem, 'vbe', this.volts[0] - this.volts[1]);
|
|
dumpAttr(elem, 'vbc', this.volts[0] - this.volts[2]);
|
|
}
|
|
;
|
|
_.flipX = function flipX_9(c2, count){
|
|
this.x_0 == this.x2 && (this.flags ^= 1);
|
|
$flipX(this, c2);
|
|
}
|
|
;
|
|
_.flipXY = function flipXY_7(xmy, count){
|
|
this.flags ^= 1;
|
|
$flipXY(this, xmy);
|
|
}
|
|
;
|
|
_.flipY = function flipY_9(c2, count){
|
|
this.y_0 == this.y2 && (this.flags ^= 1);
|
|
$flipY(this, c2);
|
|
}
|
|
;
|
|
_.getCurrentIntoNode = function getCurrentIntoNode_21(n){
|
|
if (n == 0)
|
|
return -this.ib;
|
|
if (n == 1)
|
|
return -this.ic;
|
|
return -this.ie;
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_68(){
|
|
return 116;
|
|
}
|
|
;
|
|
_.getEditInfo = function getEditInfo_51(n){
|
|
var dm, ei, i;
|
|
if (n == 0)
|
|
return $setDimensionless(new EditInfo_0('Beta/hFE', this.beta_0, 10, $intern_22));
|
|
if (n == 1) {
|
|
ei = new EditInfo_0('', 0, -1, -1);
|
|
ei.checkbox = new Checkbox_0('Swap E/C', (this.flags & 1) != 0);
|
|
return ei;
|
|
}
|
|
if (n == 2) {
|
|
ei = createCheckbox('Draw Circle', (globalFlags & 2) != 0);
|
|
return ei;
|
|
}
|
|
if (n == 3) {
|
|
ei = new EditInfo_0('Model', 0, -1, -1);
|
|
this.models = getModelList_3();
|
|
ei.choice = new Choice;
|
|
for (i = 0; i != this.models.arrayList.array.length; i++) {
|
|
dm = $get_4(this.models, i);
|
|
$addItem(ei.choice, LS($getDescription_1(dm)));
|
|
dm == this.model && $select(ei.choice, i);
|
|
}
|
|
return ei;
|
|
}
|
|
if (n == 4) {
|
|
ei = new EditInfo_0('', 0, -1, -1);
|
|
ei.button_0 = new Button_1(LS('Create New Model'));
|
|
return ei;
|
|
}
|
|
if (n == 5) {
|
|
if (this.model.readOnly)
|
|
return null;
|
|
ei = new EditInfo_0('', 0, -1, -1);
|
|
ei.button_0 = new Button_1(LS('Edit Model'));
|
|
return ei;
|
|
}
|
|
return null;
|
|
}
|
|
;
|
|
_.getElmType = function getElmType_16(){
|
|
return 'transistor';
|
|
}
|
|
;
|
|
_.getInfo_0 = function getInfo_58(arr){
|
|
var vbc, vbe, vce;
|
|
arr[0] = LS('transistor') + (this.pnp == -1?' (PNP)':' (NPN)');
|
|
arr[1] = this.model.name_0 + ', \u03B2=' + $format_0(showFormat, this.beta_0);
|
|
vbc = this.volts[0] - this.volts[1];
|
|
vbe = this.volts[0] - this.volts[2];
|
|
vce = this.volts[1] - this.volts[2];
|
|
vbc * this.pnp > 0.2?(arr[2] = vbe * this.pnp > 0.2?'saturation':'reverse active'):(arr[2] = vbe * this.pnp > 0.2?'fwd active':'cutoff');
|
|
arr[2] = LS(arr[2]);
|
|
arr[3] = 'Ic = ' + getUnitText(this.ic, 'A', false);
|
|
arr[4] = 'Ib = ' + getUnitText(this.ib, 'A', false);
|
|
arr[5] = 'Vbe = ' + getUnitText(vbe, 'V', false);
|
|
arr[6] = 'Vbc = ' + getUnitText(vbc, 'V', false);
|
|
arr[7] = 'Vce = ' + getUnitText(vce, 'V', false);
|
|
arr[8] = 'P = ' + getUnitText((this.volts[0] - this.volts[2]) * this.ib + (this.volts[1] - this.volts[2]) * this.ic, 'W', false);
|
|
}
|
|
;
|
|
_.getPost = function getPost_15(n){
|
|
return $getPost_2(this, n);
|
|
}
|
|
;
|
|
_.getPostCount_0 = function getPostCount_49(){
|
|
return 3;
|
|
}
|
|
;
|
|
_.getPower = function getPower_8(){
|
|
return (this.volts[0] - this.volts[2]) * this.ib + (this.volts[1] - this.volts[2]) * this.ic;
|
|
}
|
|
;
|
|
_.getScopeText = function getScopeText_5(x_0){
|
|
var t;
|
|
t = '';
|
|
switch (x_0) {
|
|
case 1:
|
|
t = 'Ib';
|
|
break;
|
|
case 2:
|
|
t = 'Ic';
|
|
break;
|
|
case 3:
|
|
t = 'Ie';
|
|
break;
|
|
case 4:
|
|
t = 'Vbe';
|
|
break;
|
|
case 5:
|
|
t = 'Vbc';
|
|
break;
|
|
case 6:
|
|
t = 'Vce';
|
|
break;
|
|
case 7:
|
|
t = 'P';
|
|
}
|
|
return LS('transistor') + ', ' + t;
|
|
}
|
|
;
|
|
_.getScopeUnits = function getScopeUnits_3(x_0){
|
|
switch (x_0) {
|
|
case 1:
|
|
case 2:
|
|
case 3:
|
|
return 1;
|
|
case 7:
|
|
return 2;
|
|
default:return 0;
|
|
}
|
|
}
|
|
;
|
|
_.getScopeValue = function getScopeValue_3(x_0){
|
|
switch (x_0) {
|
|
case 1:
|
|
return this.ib;
|
|
case 2:
|
|
return this.ic;
|
|
case 3:
|
|
return this.ie;
|
|
case 4:
|
|
return this.volts[0] - this.volts[2];
|
|
case 5:
|
|
return this.volts[0] - this.volts[1];
|
|
case 6:
|
|
return this.volts[1] - this.volts[2];
|
|
case 7:
|
|
return (this.volts[0] - this.volts[2]) * this.ib + (this.volts[1] - this.volts[2]) * this.ic;
|
|
}
|
|
return 0;
|
|
}
|
|
;
|
|
_.nonLinear_0 = function nonLinear_16(){
|
|
return true;
|
|
}
|
|
;
|
|
_.onMouseWheel = function onMouseWheel_2(e){
|
|
if (!!typeScrollPopup && typeScrollPopup.showing) {
|
|
$doDeltaY_0(typeScrollPopup, $eventGetMouseWheelVelocityY(e.nativeEvent));
|
|
return;
|
|
}
|
|
typeScrollPopup = new TypeScrollPopup((e.nativeEvent.clientX || 0) | 0, (e.nativeEvent.clientY || 0) | 0, $eventGetMouseWheelVelocityY(e.nativeEvent), this, app_0);
|
|
}
|
|
;
|
|
_.reset_0 = function reset_30(){
|
|
this.volts[0] = this.volts[1] = this.volts[2] = 0;
|
|
this.lastvbc = this.lastvbe = this.curcount_c = this.curcount_e = this.curcount_b = 0;
|
|
this.capVoltBE = this.capVoltBC = this.capCurBE = this.capCurBC = 0;
|
|
this.geqBE = this.geqBC = this.ceqBE = this.ceqBC = 0;
|
|
this.badIters = 0;
|
|
this.localSubIters = 0;
|
|
}
|
|
;
|
|
_.setEditValue = function setEditValue_51(n, ei){
|
|
var editDialog, newModel;
|
|
if (n == 0) {
|
|
this.beta_0 = ei.value_0;
|
|
$setup_5(this);
|
|
}
|
|
if (n == 1) {
|
|
$getState(ei.checkbox)?(this.flags |= 1):(this.flags &= -2);
|
|
$setPoints_16(this);
|
|
}
|
|
if (n == 2) {
|
|
globalFlags = $changeFlag(ei, globalFlags, 2);
|
|
return;
|
|
}
|
|
if (n == 3) {
|
|
this.model = $get_4(this.models, $getElement(ei.choice).selectedIndex);
|
|
this.modelName = this.model.name_0;
|
|
$setup_5(this);
|
|
ei.newDialog = true;
|
|
return;
|
|
}
|
|
if (n == 4) {
|
|
newModel = new TransistorModel_0(this.model);
|
|
editDialog = new EditTransistorModelDialog(newModel, app_0, this);
|
|
diodeModelEditDialog = editDialog;
|
|
!editDialog.resizeHandlerRegistration && (editDialog.resizeHandlerRegistration = addResizeHandler(new DialogBox$1(editDialog)));
|
|
$show(editDialog);
|
|
return;
|
|
}
|
|
if (n == 5) {
|
|
if (this.model.readOnly) {
|
|
alert_0(LS('This model cannot be modified. Change the model name to allow customization.'));
|
|
return;
|
|
}
|
|
editDialog = new EditTransistorModelDialog(this.model, app_0, null);
|
|
diodeModelEditDialog = editDialog;
|
|
!editDialog.resizeHandlerRegistration && (editDialog.resizeHandlerRegistration = addResizeHandler(new DialogBox$1(editDialog)));
|
|
$show(editDialog);
|
|
return;
|
|
}
|
|
}
|
|
;
|
|
_.setPoints = function setPoints_45(){
|
|
$setPoints_16(this);
|
|
}
|
|
;
|
|
_.stamp = function stamp_46(){
|
|
}
|
|
;
|
|
_.startIteration = function startIteration_14(){
|
|
var cjc, cje, hasBCcap, hasBEcap, vjBC, vjBE, vtn;
|
|
hasBEcap = this.model.junctionCapBE > 0 || this.model.transitTimeF > 0;
|
|
hasBCcap = this.model.junctionCapBC > 0 || this.model.transitTimeR > 0;
|
|
if (hasBEcap && sim_0.timeStep > 0) {
|
|
vjBE = this.pnp * this.capVoltBE;
|
|
cje = calcJunctionCap(vjBE, this.model.junctionCapBE, this.model.junctionPotBE, this.model.junctionExpBE);
|
|
if (this.model.transitTimeF > 0 && vjBE > 0) {
|
|
vtn = $intern_109 * this.model.emissionCoeffF;
|
|
cje += this.model.transitTimeF * this.model.satCur * $wnd.Math.exp(vjBE / vtn) / vtn;
|
|
}
|
|
this.geqBE = 2 * cje / sim_0.timeStep;
|
|
this.geqBE < 1.0E-20?(this.geqBE = this.ceqBE = this.capCurBE = 0):(this.ceqBE = -this.geqBE * this.capVoltBE - this.capCurBE);
|
|
}
|
|
if (hasBCcap && sim_0.timeStep > 0) {
|
|
vjBC = this.pnp * this.capVoltBC;
|
|
cjc = calcJunctionCap(vjBC, this.model.junctionCapBC, this.model.junctionPotBC, this.model.junctionExpBC);
|
|
this.model.transitTimeR > 0 && vjBC > 0 && (cjc += this.model.transitTimeR * this.model.satCur * $wnd.Math.exp(vjBC / ($intern_109 * this.model.emissionCoeffR)) / ($intern_109 * this.model.emissionCoeffR));
|
|
this.geqBC = 2 * cjc / sim_0.timeStep;
|
|
this.geqBC < 1.0E-20?(this.geqBC = this.ceqBC = this.capCurBC = 0):(this.ceqBC = -this.geqBC * this.capVoltBC - this.capCurBC);
|
|
}
|
|
}
|
|
;
|
|
_.stepFinished = function stepFinished_16(){
|
|
var icapBC, icapBE;
|
|
($wnd.Math.abs(this.ic) > $intern_81 || $wnd.Math.abs(this.ib) > $intern_81) && $stop(sim_0, 'max current exceeded', this);
|
|
this.localSubIters > 100?++this.badIters:(this.badIters = 0);
|
|
if (this.geqBE > 0) {
|
|
this.capVoltBE = this.volts[0] - this.volts[2];
|
|
this.capCurBE = this.geqBE * this.capVoltBE + this.ceqBE;
|
|
}
|
|
if (this.geqBC > 0) {
|
|
this.capVoltBC = this.volts[0] - this.volts[1];
|
|
this.capCurBC = this.geqBC * this.capVoltBC + this.ceqBC;
|
|
}
|
|
if (this.geqBE > 0) {
|
|
icapBE = this.geqBE * (this.volts[0] - this.volts[2]) + this.ceqBE;
|
|
this.ib += icapBE;
|
|
this.ie -= icapBE;
|
|
}
|
|
if (this.geqBC > 0) {
|
|
icapBC = this.geqBC * (this.volts[0] - this.volts[1]) + this.ceqBC;
|
|
this.ib += icapBC;
|
|
this.ic -= icapBC;
|
|
}
|
|
this.localSubIters = 0;
|
|
}
|
|
;
|
|
_.undumpXml = function undumpXml_57(xml){
|
|
this.flags = $parseIntAttr(xml, 'f', this.flags);
|
|
this.pnp = $parseIntAttr(xml, 'pn', this.pnp);
|
|
this.beta_0 = $parseDoubleAttr(xml, 'be', this.beta_0);
|
|
this.modelName = $parseStringAttr(xml, 'mo', this.modelName);
|
|
this.lastvbe = $parseDoubleAttr(xml, 'vbe', 0);
|
|
this.lastvbc = $parseDoubleAttr(xml, 'vbc', 0);
|
|
this.volts[0] = 0;
|
|
this.volts[1] = -this.lastvbe;
|
|
this.volts[2] = -this.lastvbc;
|
|
globalFlags = this.flags & 2;
|
|
$setup_5(this);
|
|
}
|
|
;
|
|
_.updateModels_0 = function updateModels_4(){
|
|
$setup_5(this);
|
|
}
|
|
;
|
|
_.updateModels = function(){
|
|
this.updateModels_0();
|
|
}
|
|
;
|
|
_.badIters = 0;
|
|
_.beta_0 = 0;
|
|
_.capCurBC = 0;
|
|
_.capCurBE = 0;
|
|
_.capVoltBC = 0;
|
|
_.capVoltBE = 0;
|
|
_.ceqBC = 0;
|
|
_.ceqBE = 0;
|
|
_.curcount_b = 0;
|
|
_.curcount_c = 0;
|
|
_.curcount_e = 0;
|
|
_.geqBC = 0;
|
|
_.geqBE = 0;
|
|
_.gmin = 0;
|
|
_.ib = 0;
|
|
_.ic = 0;
|
|
_.ie = 0;
|
|
_.lastvbc = 0;
|
|
_.lastvbe = 0;
|
|
_.localSubIters = 0;
|
|
_.pnp = 0;
|
|
_.vcrit = 0;
|
|
var globalFlags = 0, lastModelName_3 = 'default';
|
|
var Lcom_lushprojects_circuitjs1_client_TransistorElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'TransistorElm', 153);
|
|
function NTransistorElm(xx, yy){
|
|
TransistorElm_0.call(this, xx, yy, false);
|
|
}
|
|
|
|
defineClass(364, 153, $intern_126, NTransistorElm);
|
|
_.getDumpClass = function getDumpClass_8(){
|
|
return Lcom_lushprojects_circuitjs1_client_TransistorElm_2_classLit;
|
|
}
|
|
;
|
|
_.getShortcut = function getShortcut_26(){
|
|
return 110;
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_NTransistorElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'NTransistorElm', 364);
|
|
function NandGateElm(xx, yy){
|
|
AndGateElm.call(this, xx, yy);
|
|
}
|
|
|
|
function NandGateElm_0(xa, ya, xb, yb, f, st){
|
|
AndGateElm_0.call(this, xa, ya, xb, yb, f, st);
|
|
}
|
|
|
|
defineClass(416, 270, $intern_85, NandGateElm, NandGateElm_0);
|
|
_.getDumpType = function getDumpType_69(){
|
|
return 151;
|
|
}
|
|
;
|
|
_.getGateName = function getGateName_0(){
|
|
return 'NAND gate';
|
|
}
|
|
;
|
|
_.getShortcut = function getShortcut_27(){
|
|
return 64;
|
|
}
|
|
;
|
|
_.isInverting = function isInverting_0(){
|
|
return true;
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_NandGateElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'NandGateElm', 416);
|
|
function NoiseElm(xx, yy){
|
|
RailElm_0.call(this, xx, yy, 6);
|
|
}
|
|
|
|
function NoiseElm_0(xa, ya, xb, yb, f, st){
|
|
RailElm_1.call(this, xa, ya, xb, yb, f, st);
|
|
this.waveform = 6;
|
|
}
|
|
|
|
defineClass(298, 47, $intern_92, NoiseElm, NoiseElm_0);
|
|
_.getDumpClass = function getDumpClass_9(){
|
|
return Lcom_lushprojects_circuitjs1_client_RailElm_2_classLit;
|
|
}
|
|
;
|
|
_.getShortcut = function getShortcut_28(){
|
|
return 0;
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_NoiseElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'NoiseElm', 298);
|
|
function OrGateElm(xx, yy){
|
|
GateElm.call(this, xx, yy);
|
|
}
|
|
|
|
function OrGateElm_0(xa, ya, xb, yb, f, st){
|
|
GateElm_0.call(this, xa, ya, xb, yb, f, st);
|
|
}
|
|
|
|
defineClass(224, 269, $intern_85, OrGateElm, OrGateElm_0);
|
|
_.calcFunction = function calcFunction_0(){
|
|
var f, i;
|
|
f = false;
|
|
for (i = 0; i != this.inputCount; i++)
|
|
f = f | $getInput(this, i);
|
|
return f;
|
|
}
|
|
;
|
|
_.drawGatePolygon = function drawGatePolygon_1(g){
|
|
g.context.lineWidth = 3;
|
|
g.context.beginPath();
|
|
$moveTo(g.context, this.gatePoly.xpoints[0], this.gatePoly.ypoints[0]);
|
|
$lineTo(g.context, this.gatePoly.xpoints[1], this.gatePoly.ypoints[1]);
|
|
$bezierCurveTo(g.context, this.gatePoly.xpoints[2], this.gatePoly.ypoints[2], this.gatePoly.xpoints[2], this.gatePoly.ypoints[2], this.gatePoly.xpoints[3], this.gatePoly.ypoints[3]);
|
|
$bezierCurveTo(g.context, this.gatePoly.xpoints[4], this.gatePoly.ypoints[4], this.gatePoly.xpoints[4], this.gatePoly.ypoints[4], this.gatePoly.xpoints[5], this.gatePoly.ypoints[5]);
|
|
$lineTo(g.context, this.gatePoly.xpoints[6], this.gatePoly.ypoints[6]);
|
|
$bezierCurveTo(g.context, this.gatePoly.xpoints[7], this.gatePoly.ypoints[7], this.gatePoly.xpoints[7], this.gatePoly.ypoints[7], this.gatePoly.xpoints[0], this.gatePoly.ypoints[0]);
|
|
g.context.closePath();
|
|
if (instanceOf(this, 195)) {
|
|
$moveTo(g.context, this.gatePoly.xpoints[8], this.gatePoly.ypoints[8]);
|
|
$bezierCurveTo(g.context, this.gatePoly.xpoints[10], this.gatePoly.ypoints[10], this.gatePoly.xpoints[10], this.gatePoly.ypoints[10], this.gatePoly.xpoints[9], this.gatePoly.ypoints[9]);
|
|
}
|
|
g.context.stroke();
|
|
g.context.lineWidth = 1;
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_70(){
|
|
return 152;
|
|
}
|
|
;
|
|
_.getGateName = function getGateName_1(){
|
|
return 'OR gate';
|
|
}
|
|
;
|
|
_.getGateText = function getGateText_1(){
|
|
return '\u22651';
|
|
}
|
|
;
|
|
_.getLeadAdjustment = function getLeadAdjustment_0(ix){
|
|
if (app_0.menus.euroGatesCheckItem.on)
|
|
return 0;
|
|
if (this.inputCount > 3 && (ix == 0 || ix == this.inputCount - 1))
|
|
return -0.05;
|
|
if (this.inputCount > 7 && (ix == 1 || ix == this.inputCount - 2))
|
|
return -0.05;
|
|
if (this.inputCount >= 12 && (ix == 2 || ix == this.inputCount - 3))
|
|
return -0.05;
|
|
return 0;
|
|
}
|
|
;
|
|
_.getShortcut = function getShortcut_29(){
|
|
return 51;
|
|
}
|
|
;
|
|
_.setPoints = function setPoints_46(){
|
|
var triPoints, ww2;
|
|
$setPoints_2(this);
|
|
if (app_0.menus.euroGatesCheckItem.on) {
|
|
$createEuroGatePolygon(this);
|
|
}
|
|
else {
|
|
triPoints = $newPointArray(11);
|
|
$interpPoint2(this.lead1, this.lead2, triPoints[0], triPoints[6], -0.05, this.hs2);
|
|
$interpPoint2(this.lead1, this.lead2, triPoints[1], triPoints[5], 0.3, this.hs2);
|
|
triPoints[3] = this.lead2;
|
|
$interpPoint2(this.lead1, this.lead2, triPoints[2], triPoints[4], 0.7, this.hs2 * 0.81);
|
|
$interpPoint_1(this.lead1, this.lead2, triPoints[7], 0.08);
|
|
if (instanceOf(this, 195)) {
|
|
ww2 = this.ww == 0?this.dn * 2:this.ww * 2;
|
|
$interpPoint2(this.lead1, this.lead2, triPoints[8], triPoints[9], -0.05 - 5 / ww2, this.hs2);
|
|
$interpPoint_1(this.lead1, this.lead2, triPoints[10], 0.08 - 5 / ww2);
|
|
}
|
|
this.gatePoly = $createPolygon_1(triPoints);
|
|
}
|
|
if (this.isInverting()) {
|
|
this.pcircle = $interpPoint(this.point1, this.point2, 0.5 + (this.ww + 4) / this.dn);
|
|
this.lead2 = $interpPoint(this.point1, this.point2, 0.5 + (this.ww + 8) / this.dn);
|
|
}
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_OrGateElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'OrGateElm', 224);
|
|
function NorGateElm(xx, yy){
|
|
OrGateElm.call(this, xx, yy);
|
|
}
|
|
|
|
function NorGateElm_0(xa, ya, xb, yb, f, st){
|
|
OrGateElm_0.call(this, xa, ya, xb, yb, f, st);
|
|
}
|
|
|
|
defineClass(418, 224, $intern_85, NorGateElm, NorGateElm_0);
|
|
_.getDumpType = function getDumpType_71(){
|
|
return 153;
|
|
}
|
|
;
|
|
_.getGateName = function getGateName_2(){
|
|
return 'NOR gate';
|
|
}
|
|
;
|
|
_.getShortcut = function getShortcut_30(){
|
|
return 35;
|
|
}
|
|
;
|
|
_.isInverting = function isInverting_1(){
|
|
return true;
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_NorGateElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'NorGateElm', 418);
|
|
function $clinit_NortonAmpElm(){
|
|
$clinit_NortonAmpElm = emptyMethod;
|
|
modelExternalNodes_2 = stampJavaTypeInfo(getClassLiteralForArray(I_classLit, 1), $intern_25, 7, 15, [3, 1, 4]);
|
|
}
|
|
|
|
function $setSize_3(this$static, s){
|
|
this$static.opsize = s;
|
|
this$static.opheight = 8 * s;
|
|
this$static.opwidth = 13 * s;
|
|
this$static.flags = this$static.flags & -3 | (s == 1?2:0);
|
|
}
|
|
|
|
function NortonAmpElm(xx, yy){
|
|
$clinit_NortonAmpElm();
|
|
CompositeElm.call(this, xx, yy);
|
|
!modelElements && initModel();
|
|
$loadCompositeXml(this, modelElements, modelExternalNodes_2);
|
|
$buildCompNodeList(this);
|
|
$allocNodes(this);
|
|
this.noDiagonal = true;
|
|
$setSize_3(this, app_0.menus.smallGridCheckItem.on?1:2);
|
|
}
|
|
|
|
function initModel(){
|
|
var children, i, node;
|
|
modelDoc = ($clinit_XMLParser() , $parse_2(impl_1, '<elms><d nn="1 0" f="2" mo="default"/><d nn="2 0" f="2" mo="default"/><CCCS nn="3 2 1 0" f="0" ic="2" ex="-a"/><a nn="1 0 4" f="8" ma="12" mi="0" ga="100000"/><\/elms>'));
|
|
modelElements = new Vector;
|
|
children = new NodeListImpl(getChildNodes(build(getDocumentElement(modelDoc.jsObject)).jsObject));
|
|
for (i = 0; i < getLength_1(children.jsObject); i++) {
|
|
node = build(item_3(children.jsObject, i));
|
|
getNodeType(node.jsObject) == 1 && $add_11(modelElements, node);
|
|
}
|
|
}
|
|
|
|
defineClass(922, 110, $intern_85, NortonAmpElm);
|
|
_.addRoutingObstacle = function addRoutingObstacle_16(router){
|
|
$addRoutingObstacleWithLeads(this, router, this.opwidth);
|
|
}
|
|
;
|
|
_.draw = function draw_52(g){
|
|
$setBbox_0(this, this.point1, this.point2, this.opheight * 2);
|
|
$setVoltageColor(this, g, this.volts[0]);
|
|
drawThickLine_0(g, this.in1p[0], this.in1p[1], 3);
|
|
$setVoltageColor(this, g, this.volts[1]);
|
|
drawThickLine_0(g, this.in2p[0], this.in2p[1], 3);
|
|
$setVoltageColor(this, g, this.volts[2]);
|
|
drawThickLine_0(g, this.lead2, this.point2, 3);
|
|
$setColor_0(g, mouseElmRef == this || this.selected_0 || $containsKey(app_0.mouse.scopePlotRoles, this) || instanceOf(mouseElmRef, 21) && $getElm_0(mouseElmRef.elmScope) == this || $isOnHighlightedNet(this)?selectColor_0:lightGrayColor);
|
|
$setPowerColor_0(this, g);
|
|
drawThickPolygon(g, this.triangle);
|
|
$setFont_0(g, this.plusFont);
|
|
$drawCenteredText(this, g, '+', this.textp[0].x_0, this.textp[0].y_0 - 2, true);
|
|
$drawCenteredText(this, g, '-', this.textp[1].x_0, this.textp[1].y_0, true);
|
|
drawThickCircle(g, this.nortonCenter.x_0, this.nortonCenter.y_0, this.nortonRadius);
|
|
$setColor_0(g, mouseElmRef == this || this.selected_0 || $containsKey(app_0.mouse.scopePlotRoles, this) || instanceOf(mouseElmRef, 21) && $getElm_0(mouseElmRef.elmScope) == this || $isOnHighlightedNet(this)?selectColor_0:lightGrayColor);
|
|
$fillPolygon(g, this.nortonTriangle);
|
|
this.curcount0 = $updateDotCount(-$getCurrentIntoNode(this, 0), this.curcount0);
|
|
$drawDots(g, this.in1p[0], this.in1p[1], this.curcount0);
|
|
this.curcount1 = $updateDotCount(-$getCurrentIntoNode(this, 1), this.curcount1);
|
|
$drawDots(g, this.in2p[0], this.in2p[1], this.curcount1);
|
|
this.curcount_0 = $updateDotCount(-$getCurrentIntoNode(this, 2), this.curcount_0);
|
|
$drawDots(g, this.point2, this.lead2, this.curcount_0);
|
|
$drawPosts(this, g);
|
|
}
|
|
;
|
|
_.dumpXml = function dumpXml_55(doc, elem){
|
|
dumpAttr_1(elem, 'x', this.x_0 + ' ' + this.y_0 + ' ' + this.x2 + ' ' + this.y2);
|
|
dumpAttr_0(elem, 'f', this.flags);
|
|
}
|
|
;
|
|
_.flipX = function flipX_10(c2, count){
|
|
this.dx == 0 && (this.flags ^= 1);
|
|
$flipX(this, c2);
|
|
}
|
|
;
|
|
_.flipXY = function flipXY_8(xmy, count){
|
|
this.flags ^= 1;
|
|
$flipXY(this, xmy);
|
|
}
|
|
;
|
|
_.flipY = function flipY_10(c2, count){
|
|
this.dy == 0 && (this.flags ^= 1);
|
|
$flipY(this, c2);
|
|
}
|
|
;
|
|
_.getInfo_0 = function getInfo_59(arr){
|
|
arr[0] = 'norton amp';
|
|
arr[1] = 'V+ = ' + getUnitText(this.volts[0], 'V', false);
|
|
arr[2] = 'V- = ' + getUnitText(this.volts[1], 'V', false);
|
|
arr[3] = 'Vout = ' + getUnitText(this.volts[2], 'V', false);
|
|
arr[4] = 'Iout = ' + getUnitText(-$getCurrentIntoNode(this, 2), 'A', false);
|
|
}
|
|
;
|
|
_.getXmlDumpType = function getXmlDumpType_19(){
|
|
return 'nor';
|
|
}
|
|
;
|
|
_.reset_1 = function reset_31(){
|
|
$reset_2(this);
|
|
this.curcount0 = this.curcount1 = 0;
|
|
}
|
|
;
|
|
_.setPoints = function setPoints_47(){
|
|
var hs, innerBase, innerTip, tris, ww;
|
|
$setPoints(this);
|
|
this.dn > 150 && app_0.mouse.dragElm == this && $setSize_3(this, 2);
|
|
ww = this.opwidth;
|
|
ww > this.dn / 2 && (ww = round_int(this.dn / 2));
|
|
$calcLeads(this, ww * 2);
|
|
hs = this.opheight * this.dsign;
|
|
(this.flags & 1) != 0 && (hs = -hs);
|
|
this.in1p = $newPointArray(2);
|
|
this.in2p = $newPointArray(2);
|
|
this.textp = $newPointArray(2);
|
|
$interpPoint2(this.point1, this.point2, this.in1p[0], this.in2p[0], 0, hs);
|
|
$interpPoint2(this.lead1, this.lead2, this.in1p[1], this.in2p[1], 0, hs);
|
|
$interpPoint2(this.lead1, this.lead2, this.textp[0], this.textp[1], 0.2, hs);
|
|
tris = $newPointArray(2);
|
|
$interpPoint2(this.lead1, this.lead2, tris[0], tris[1], 0, hs * 2);
|
|
this.triangle = $createPolygon(tris[0], tris[1], this.lead2);
|
|
this.plusFont = new Font('SansSerif', 0, this.opsize == 2?14:10);
|
|
this.nortonCenter = new Point_2(this.lead1.x_0, this.lead1.y_0);
|
|
this.nortonRadius = round_int(this.opheight * 0.5);
|
|
innerTip = new Point_1;
|
|
innerBase = $newPointArray(2);
|
|
$interpPoint_1(this.in1p[1], this.in2p[1], innerTip, 0.39999999999999997);
|
|
$interpPoint2(this.in1p[1], this.in2p[1], innerBase[0], innerBase[1], 0.6, this.opheight * 0.3);
|
|
this.nortonTriangle = $createPolygon(innerTip, innerBase[0], innerBase[1]);
|
|
$setPost(this, 0, this.in1p[0]);
|
|
$setPost(this, 1, this.in2p[0]);
|
|
$setPost(this, 2, this.point2);
|
|
}
|
|
;
|
|
_.undumpXml = function undumpXml_58(xml){
|
|
$undumpXml_3(this, xml);
|
|
$setSize_3(this, (this.flags & 2) != 0?1:2);
|
|
}
|
|
;
|
|
_.curcount0 = 0;
|
|
_.curcount1 = 0;
|
|
_.nortonRadius = 0;
|
|
_.opheight = 0;
|
|
_.opsize = 0;
|
|
_.opwidth = 0;
|
|
var modelDoc, modelElements, modelExternalNodes_2;
|
|
var Lcom_lushprojects_circuitjs1_client_NortonAmpElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'NortonAmpElm', 922);
|
|
function $clinit_OTAElm(){
|
|
$clinit_OTAElm = emptyMethod;
|
|
modelExternalNodes_3 = stampJavaTypeInfo(getClassLiteralForArray(I_classLit, 1), $intern_25, 7, 15, [7, 5, 15, 1, 13]);
|
|
}
|
|
|
|
function $$init_13(this$static){
|
|
this$static.curCount0 = 0;
|
|
this$static.curCount1 = 0;
|
|
this$static.curCount2 = 0;
|
|
this$static.curCount3 = 0;
|
|
this$static.posVolt = 9;
|
|
this$static.negVolt = -9;
|
|
}
|
|
|
|
function OTAElm(xx, yy){
|
|
$clinit_OTAElm();
|
|
CompositeElm_2.call(this, xx, yy, modelString_2, modelExternalNodes_3);
|
|
$$init_13(this);
|
|
this.noDiagonal = true;
|
|
$get_4(this.compElmList, 0).maxVoltage_0 = this.negVolt;
|
|
$get_4(this.compElmList, 1).maxVoltage_0 = this.posVolt;
|
|
}
|
|
|
|
function OTAElm_0(xa, ya, xb, yb, f, st){
|
|
$clinit_OTAElm();
|
|
CompositeElm_1.call(this, xa, ya, xb, yb, f, st, modelString_2, modelExternalNodes_3);
|
|
$$init_13(this);
|
|
this.noDiagonal = true;
|
|
this.negVolt = $get_4(this.compElmList, 0).maxVoltage_0;
|
|
this.posVolt = $get_4(this.compElmList, 1).maxVoltage_0;
|
|
}
|
|
|
|
defineClass(388, 110, $intern_85, OTAElm, OTAElm_0);
|
|
_.canFlipX = function canFlipX_2(){
|
|
return false;
|
|
}
|
|
;
|
|
_.canFlipY = function canFlipY_3(){
|
|
return false;
|
|
}
|
|
;
|
|
_.draw = function draw_53(g){
|
|
$setBbox_0(this, this.point1, this.point2, 48);
|
|
$setVoltageColor(this, g, this.volts[0]);
|
|
drawThickLine_0(g, this.in1p[0], this.in1p[1], 3);
|
|
$setVoltageColor(this, g, this.volts[1]);
|
|
drawThickLine_0(g, this.in2p[0], this.in2p[1], 3);
|
|
$setVoltageColor(this, g, this.volts[2]);
|
|
drawThickLine_0(g, this.in3p[0], this.in3p[1], 3);
|
|
$setVoltageColor(this, g, this.volts[3]);
|
|
drawThickLine_0(g, this.in4p[0], this.in4p[1], 3);
|
|
$setColor_0(g, mouseElmRef == this || this.selected_0 || $containsKey(app_0.mouse.scopePlotRoles, this) || instanceOf(mouseElmRef, 21) && $getElm_0(mouseElmRef.elmScope) == this || $isOnHighlightedNet(this)?selectColor_0:lightGrayColor);
|
|
$setPowerColor_0(this, g);
|
|
drawThickPolygon(g, this.triangle);
|
|
$fillPolygon(g, this.arrowPoly1);
|
|
$fillPolygon(g, this.arrowPoly2);
|
|
drawThickLine_0(g, this.bar1[0], this.bar1[1], 3);
|
|
drawThickLine_0(g, this.bar2[0], this.bar2[1], 3);
|
|
drawThickCircle(g, this.circCent[0].x_0, this.circCent[0].y_0, 9);
|
|
drawThickCircle(g, this.circCent[1].x_0, this.circCent[1].y_0, 9);
|
|
$setFont_0(g, this.plusFont);
|
|
$drawCenteredText(this, g, '+', this.textp[0].x_0, this.textp[0].y_0 - 2, true);
|
|
$drawCenteredText(this, g, '-', this.textp[1].x_0, this.textp[1].y_0, true);
|
|
this.curCount0 = $updateDotCount(-$getCurrentIntoNode(this, 0), this.curCount0);
|
|
$drawDots(g, this.in1p[0], this.in1p[1], this.curCount0);
|
|
this.curCount1 = $updateDotCount(-$getCurrentIntoNode(this, 1), this.curCount1);
|
|
$drawDots(g, this.in2p[0], this.in2p[1], this.curCount0);
|
|
this.curCount2 = $updateDotCount(-$getCurrentIntoNode(this, 2), this.curCount2);
|
|
$drawDots(g, this.in3p[0], this.in3p[1], this.curCount2);
|
|
this.curCount3 = $updateDotCount(-$getCurrentIntoNode(this, 3), this.curCount3);
|
|
$drawDots(g, this.in4p[0], this.in4p[1], this.curCount3);
|
|
$drawPosts(this, g);
|
|
}
|
|
;
|
|
_.dumpXml = function dumpXml_56(doc, elem){
|
|
dumpAttr_1(elem, 'x', this.x_0 + ' ' + this.y_0 + ' ' + this.x2 + ' ' + this.y2);
|
|
dumpAttr_0(elem, 'f', this.flags);
|
|
dumpAttr(elem, 'pv', this.posVolt);
|
|
dumpAttr(elem, 'nv', this.negVolt);
|
|
}
|
|
;
|
|
_.getConnection_0 = function getConnection_26(n1, n2){
|
|
return false;
|
|
}
|
|
;
|
|
_.getDumpType_0 = function getDumpType_72(){
|
|
return 402;
|
|
}
|
|
;
|
|
_.getDumpType = function(){
|
|
return this.getDumpType_0();
|
|
}
|
|
;
|
|
_.getEditInfo = function getEditInfo_52(n){
|
|
if (n == 0)
|
|
return $setUnitStep(new EditInfo_0('Positive Supply Voltage (5-20V)', this.posVolt, 5, 20));
|
|
if (n == 1)
|
|
return $setUnitStep(new EditInfo_0('Negative Supply Voltage (V)', this.negVolt, -20, -5));
|
|
return null;
|
|
}
|
|
;
|
|
_.getInfo_0 = function getInfo_60(arr){
|
|
arr[0] = 'OTA (LM13700 style)';
|
|
arr[1] = 'Iabc = ' + getUnitText(-$getCurrentIntoNode(this, 3), 'A', false);
|
|
arr[2] = 'V+ - V- = ' + getUnitText(this.volts[0] - this.volts[1], 'V', false);
|
|
}
|
|
;
|
|
_.reset_1 = function reset_32(){
|
|
$reset_2(this);
|
|
this.curCount0 = this.curCount1 = this.curCount2 = this.curCount3 = 0;
|
|
}
|
|
;
|
|
_.setEditValue = function setEditValue_52(n, ei){
|
|
n == 0 && (this.posVolt = ei.value_0);
|
|
n == 1 && (this.negVolt = ei.value_0);
|
|
$get_4(this.compElmList, 0).maxVoltage_0 = this.negVolt;
|
|
$get_4(this.compElmList, 1).maxVoltage_0 = this.posVolt;
|
|
}
|
|
;
|
|
_.setPoints = function setPoints_48(){
|
|
var d1, d2, hs, tris;
|
|
$setPoints(this);
|
|
if (this.dn > 94) {
|
|
this.lead1 = $interpPoint_0(this.point1, this.point2, 1 - 94 / this.dn, 0);
|
|
this.lead2 = this.point2;
|
|
this.point2bis = this.point2;
|
|
}
|
|
else {
|
|
this.lead1 = this.point1;
|
|
this.lead2 = $interpPoint_0(this.point1, this.point2, 94 / this.dn, 0);
|
|
this.point2bis = this.lead2;
|
|
}
|
|
hs = 32 * this.dsign;
|
|
this.in1p = $newPointArray(2);
|
|
this.in2p = $newPointArray(2);
|
|
this.in3p = $newPointArray(2);
|
|
this.in4p = $newPointArray(2);
|
|
this.textp = $newPointArray(2);
|
|
this.bar1 = $newPointArray(2);
|
|
this.bar2 = $newPointArray(2);
|
|
this.circCent = $newPointArray(2);
|
|
$interpPoint2(this.point1, this.point2bis, this.in1p[0], this.in2p[0], 0, hs);
|
|
$interpPoint2(this.lead1, this.lead2, this.in1p[1], this.in2p[1], 0, hs);
|
|
$interpPoint2(this.lead1, this.lead2, this.textp[0], this.textp[1], 0.1, hs);
|
|
this.in3p[0] = this.point1;
|
|
this.in3p[1] = this.lead1;
|
|
this.in4p[0] = $interpPoint_0(this.lead1, this.lead2, $intern_127, 32);
|
|
this.in4p[1] = $interpPoint_0(this.lead1, this.lead2, $intern_127, 8);
|
|
tris = $newPointArray(3);
|
|
$interpPoint2(this.lead1, this.lead2, tris[0], tris[1], 0, 3 * hs / 2 | 0);
|
|
tris[2] = $interpPoint(this.lead1, this.lead2, 0.6808510638297872);
|
|
this.triangle = $createPolygon(tris[0], tris[1], tris[2]);
|
|
this.circCent[0] = $interpPoint_0(this.lead1, this.lead2, 0.898936170212766, 0);
|
|
this.circCent[1] = $interpPoint_0(this.lead1, this.lead2, 0.7819148936170213, 0);
|
|
d1 = $interpPoint(this.in3p[1], this.in1p[1], $intern_118);
|
|
d2 = $interpPoint(this.in3p[1], this.in1p[1], $intern_119);
|
|
this.arrowPoly1 = $calcArrow(d1, d2, 8, 4);
|
|
$interpPoint2(d1, d2, this.bar1[0], this.bar1[1], 1, 4);
|
|
d1 = $interpPoint(this.in3p[1], this.in2p[1], $intern_118);
|
|
d2 = $interpPoint(this.in3p[1], this.in2p[1], $intern_119);
|
|
this.arrowPoly2 = $calcArrow(d1, d2, 8, 4);
|
|
$interpPoint2(d1, d2, this.bar2[0], this.bar2[1], 1, 4);
|
|
this.plusFont = new Font('SansSerif', 0, 14);
|
|
$setPost(this, 0, this.in1p[0]);
|
|
$setPost(this, 1, this.in2p[0]);
|
|
$setPost(this, 2, this.in3p[0]);
|
|
$setPost(this, 3, this.in4p[0]);
|
|
$setPost(this, 4, this.point2bis);
|
|
}
|
|
;
|
|
_.undumpXml = function undumpXml_59(xml){
|
|
$undumpXml_3(this, xml);
|
|
this.posVolt = $parseDoubleAttr(xml, 'pv', this.posVolt);
|
|
this.negVolt = $parseDoubleAttr(xml, 'nv', this.negVolt);
|
|
$get_4(this.compElmList, 0).maxVoltage_0 = this.negVolt;
|
|
$get_4(this.compElmList, 1).maxVoltage_0 = this.posVolt;
|
|
}
|
|
;
|
|
_.curCount0 = 0;
|
|
_.curCount1 = 0;
|
|
_.curCount2 = 0;
|
|
_.curCount3 = 0;
|
|
_.negVolt = 0;
|
|
_.posVolt = 0;
|
|
var modelExternalNodes_3, modelString_2 = 'RailElm 4\rRailElm 10\rNTransistorElm 1 2 3\rNTransistorElm 3 1 4\rNTransistorElm 3 3 4\rNTransistorElm 5 6 2\rNTransistorElm 7 8 2\rPTransistorElm 9 6 10\rPTransistorElm 9 9 10\rPTransistorElm 6 12 9\rPTransistorElm 11 8 10\rPTransistorElm 11 11 10\rPTransistorElm 8 13 11\rNTransistorElm 14 14 4\rNTransistorElm 14 12 4\rNTransistorElm 12 13 14\rNTransistorElm 15 15 5\rNTransistorElm 15 15 7';
|
|
var Lcom_lushprojects_circuitjs1_client_OTAElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'OTAElm', 388);
|
|
function OhmMeterElm(xx, yy){
|
|
CurrentElm.call(this, xx, yy);
|
|
}
|
|
|
|
function OhmMeterElm_0(xa, ya, xb, yb, f, st){
|
|
CurrentElm_0.call(this, xa, ya, xb, yb, f, st);
|
|
}
|
|
|
|
defineClass(399, 202, $intern_105, OhmMeterElm, OhmMeterElm_0);
|
|
_.canShowValueInScope = function canShowValueInScope_2(x_0){
|
|
return x_0 == 2;
|
|
}
|
|
;
|
|
_.draw = function draw_54(g){
|
|
var s;
|
|
$draw2Leads(this, g);
|
|
$setVoltageColor(this, g, (this.volts[0] + this.volts[1]) / 2);
|
|
$setPowerColor_0(this, g);
|
|
drawThickCircle(g, this.center.x_0, this.center.y_0, 12);
|
|
$drawCenteredText(this, g, ohmString, this.center.x_0, this.center.y_0, true);
|
|
$setBbox_0(this, this.point1, this.point2, 12);
|
|
this.curcount_0 = $updateDotCount(this.current_0, this.curcount_0);
|
|
app_0.mouse.dragElm == this || $drawDots(g, this.point1, this.point2, this.curcount_0);
|
|
if (app_0.menus.showValuesCheckItem.on && this.current_0 != 0) {
|
|
s = getUnitText((this.volts[1] - this.volts[0]) / this.current_0, ohmString, true);
|
|
(this.dx == 0 || this.dy == 0) && $drawValues(this, g, s, 12);
|
|
}
|
|
$drawPosts(this, g);
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_73(){
|
|
return 216;
|
|
}
|
|
;
|
|
_.getInfo_0 = function getInfo_61(arr){
|
|
arr[0] = 'ohmmeter';
|
|
this.current_0 == 0?(arr[1] = 'R = \u221E'):(arr[1] = 'R = ' + getUnitText((this.volts[1] - this.volts[0]) / this.current_0, ohmString, false));
|
|
}
|
|
;
|
|
_.getScopeUnits = function getScopeUnits_4(x_0){
|
|
return x_0 == 2?3:x_0 == 3?1:x_0 == 7?2:0;
|
|
}
|
|
;
|
|
_.getScopeValue = function getScopeValue_4(x_0){
|
|
return x_0 == 2?(this.volts[1] - this.volts[0]) / this.current_0:x_0 == 3?this.current_0:x_0 == 7?-(this.volts[1] - this.volts[0]) * this.current_0:this.volts[1] - this.volts[0];
|
|
}
|
|
;
|
|
_.setPoints = function setPoints_49(){
|
|
$setPoints_6(this);
|
|
$calcLeads(this, 26);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_OhmMeterElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'OhmMeterElm', 399);
|
|
function $setGain(this$static){
|
|
if ((this$static.flags & 8) != 0)
|
|
return;
|
|
this$static.gain = (this$static.flags & 4) != 0?$intern_22:$intern_120;
|
|
}
|
|
|
|
function $setSize_4(this$static, s){
|
|
this$static.opsize = s;
|
|
this$static.opheight = 8 * s;
|
|
this$static.opwidth = 13 * s;
|
|
this$static.flags = this$static.flags & -3 | (s == 1?2:0);
|
|
}
|
|
|
|
function OpAmpElm(xx, yy){
|
|
CircuitElm.call(this, xx, yy);
|
|
this.noDiagonal = true;
|
|
this.maxOut = 15;
|
|
this.minOut = -15;
|
|
this.flags = 8;
|
|
this.gain = $intern_120;
|
|
$setSize_4(this, app_0.menus.smallGridCheckItem.on?1:2);
|
|
}
|
|
|
|
function OpAmpElm_0(xa, ya, xb, yb, f, st){
|
|
CircuitElm_0.call(this, xa, ya, xb, yb, f);
|
|
this.maxOut = 15;
|
|
this.minOut = -15;
|
|
try {
|
|
this.maxOut = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.minOut = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
$doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.volts[0] = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.volts[1] = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.gain = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
}
|
|
catch ($e0) {
|
|
$e0 = toJava($e0);
|
|
if (!instanceOf($e0, 13))
|
|
throw toJs($e0);
|
|
}
|
|
this.noDiagonal = true;
|
|
$setSize_4(this, (f & 2) != 0?1:2);
|
|
$setGain(this);
|
|
}
|
|
|
|
defineClass(306, 8, $intern_85, OpAmpElm, OpAmpElm_0);
|
|
_.addRoutingObstacle = function addRoutingObstacle_17(router){
|
|
$addRoutingObstacleWithLeads(this, router, this.opwidth);
|
|
}
|
|
;
|
|
_.doStep = function doStep_36(){
|
|
var dx, maxAdj, midpoint, minAdj, vd, x_0;
|
|
vd = this.volts[1] - this.volts[0];
|
|
midpoint = (this.maxOut + this.minOut) * 0.5;
|
|
$wnd.Math.abs(this.lastvd - vd) > 0.1?(sim_0.converged = false):(this.volts[2] > this.maxOut + 0.1 || this.volts[2] < this.minOut - 0.1) && (sim_0.converged = false);
|
|
maxAdj = this.maxOut - midpoint;
|
|
minAdj = this.minOut - midpoint;
|
|
if (vd >= maxAdj / this.gain && (this.lastvd >= 0 || $getrand(app_0, 4) == 1)) {
|
|
dx = $intern_87;
|
|
x_0 = this.maxOut - $intern_87 * maxAdj / this.gain;
|
|
}
|
|
else if (vd <= minAdj / this.gain && (this.lastvd <= 0 || $getrand(app_0, 4) == 1)) {
|
|
dx = $intern_87;
|
|
x_0 = this.minOut - $intern_87 * minAdj / this.gain;
|
|
}
|
|
else {
|
|
dx = this.gain;
|
|
x_0 = midpoint;
|
|
}
|
|
$stampMatrix_1(this.voltSource, this.nodes[0], dx);
|
|
$stampMatrix_1(this.voltSource, this.nodes[1], -dx);
|
|
$stampMatrix_1(this.voltSource, this.nodes[2], 1);
|
|
$stampRightSide_0(this.voltSource, x_0);
|
|
this.lastvd = vd;
|
|
}
|
|
;
|
|
_.draw = function draw_55(g){
|
|
$setBbox_0(this, this.point1, this.point2, this.opheight * 2);
|
|
$setVoltageColor(this, g, this.volts[0]);
|
|
drawThickLine_0(g, this.in1p[0], this.in1p[1], 3);
|
|
$setVoltageColor(this, g, this.volts[1]);
|
|
drawThickLine_0(g, this.in2p[0], this.in2p[1], 3);
|
|
$setVoltageColor(this, g, this.volts[2]);
|
|
drawThickLine_0(g, this.lead2, this.point2, 3);
|
|
$setColor_0(g, mouseElmRef == this || this.selected_0 || $containsKey(app_0.mouse.scopePlotRoles, this) || instanceOf(mouseElmRef, 21) && $getElm_0(mouseElmRef.elmScope) == this || $isOnHighlightedNet(this)?selectColor_0:lightGrayColor);
|
|
$setPowerColor_0(this, g);
|
|
drawThickPolygon(g, this.triangle);
|
|
$setFont_0(g, this.plusFont);
|
|
$drawCenteredText(this, g, '-', this.textp[0].x_0, this.textp[0].y_0 - 2, true);
|
|
$drawCenteredText(this, g, '+', this.textp[1].x_0, this.textp[1].y_0, true);
|
|
this.curcount_0 = $updateDotCount(this.current_0, this.curcount_0);
|
|
$drawDots(g, this.point2, this.lead2, this.curcount_0);
|
|
$drawPosts(this, g);
|
|
}
|
|
;
|
|
_.dumpXml = function dumpXml_57(doc, elem){
|
|
dumpAttr_1(elem, 'x', this.x_0 + ' ' + this.y_0 + ' ' + this.x2 + ' ' + this.y2);
|
|
dumpAttr_0(elem, 'f', this.flags);
|
|
dumpAttr(elem, 'ma', this.maxOut);
|
|
dumpAttr(elem, 'mi', this.minOut);
|
|
dumpAttr(elem, 'ga', this.gain);
|
|
}
|
|
;
|
|
_.flipX = function flipX_11(c2, count){
|
|
this.dx == 0 && (this.flags ^= 1);
|
|
$flipX(this, c2);
|
|
}
|
|
;
|
|
_.flipXY = function flipXY_9(xmy, count){
|
|
this.flags ^= 1;
|
|
$flipXY(this, xmy);
|
|
}
|
|
;
|
|
_.flipY = function flipY_11(c2, count){
|
|
this.dy == 0 && (this.flags ^= 1);
|
|
$flipY(this, c2);
|
|
}
|
|
;
|
|
_.getConnection = function getConnection_27(n1, n2){
|
|
return false;
|
|
}
|
|
;
|
|
_.getCurrentIntoNode = function getCurrentIntoNode_22(n){
|
|
if (n == 2)
|
|
return -this.current_0;
|
|
return 0;
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_74(){
|
|
return 97;
|
|
}
|
|
;
|
|
_.getEditInfo = function getEditInfo_53(n){
|
|
if (n == 0)
|
|
return new EditInfo_0('Max Output (V)', this.maxOut, 1, 20);
|
|
if (n == 1)
|
|
return new EditInfo_0('Min Output (V)', this.minOut, -20, 0);
|
|
if (n == 2)
|
|
return $setPositive(new EditInfo_0('Gain', this.gain, 10, $intern_84));
|
|
return null;
|
|
}
|
|
;
|
|
_.getInfo_0 = function getInfo_62(arr){
|
|
var vo;
|
|
arr[0] = 'op-amp';
|
|
arr[1] = 'V+ = ' + getUnitText(this.volts[1], 'V', false);
|
|
arr[2] = 'V- = ' + getUnitText(this.volts[0], 'V', false);
|
|
vo = $wnd.Math.max($wnd.Math.min(this.volts[2], this.maxOut), this.minOut);
|
|
arr[3] = 'Vout = ' + getUnitText(vo, 'V', false);
|
|
arr[4] = 'Iout = ' + getUnitText(-this.current_0, 'A', false);
|
|
arr[5] = 'range = ' + getUnitText(this.minOut, 'V', false) + ' to ' + getUnitText(this.maxOut, 'V', false);
|
|
}
|
|
;
|
|
_.getMatrixConnection = function getMatrixConnection_8(n1, n2){
|
|
return true;
|
|
}
|
|
;
|
|
_.getPost = function getPost_16(n){
|
|
return n == 0?this.in1p[0]:n == 1?this.in2p[0]:this.point2;
|
|
}
|
|
;
|
|
_.getPostCount_0 = function getPostCount_50(){
|
|
return 3;
|
|
}
|
|
;
|
|
_.getPower = function getPower_9(){
|
|
return this.volts[2] * this.current_0;
|
|
}
|
|
;
|
|
_.getShortcut = function getShortcut_31(){
|
|
return 97;
|
|
}
|
|
;
|
|
_.getVoltageDiff_0 = function getVoltageDiff_18(){
|
|
return this.volts[2] - this.volts[1];
|
|
}
|
|
;
|
|
_.getVoltageSourceCount = function getVoltageSourceCount_40(){
|
|
return 1;
|
|
}
|
|
;
|
|
_.hasGroundConnection = function hasGroundConnection_17(n1){
|
|
return n1 == 2;
|
|
}
|
|
;
|
|
_.nonLinear_0 = function nonLinear_17(){
|
|
return true;
|
|
}
|
|
;
|
|
_.setEditValue = function setEditValue_53(n, ei){
|
|
n == 0 && (this.maxOut = ei.value_0);
|
|
n == 1 && (this.minOut = ei.value_0);
|
|
n == 2 && (this.gain = ei.value_0);
|
|
}
|
|
;
|
|
_.setPoints = function setPoints_50(){
|
|
var hs, tris, ww;
|
|
$setPoints(this);
|
|
this.dn > 150 && app_0.mouse.dragElm == this && $setSize_4(this, 2);
|
|
ww = this.opwidth;
|
|
ww > this.dn / 2 && (ww = round_int(this.dn / 2));
|
|
$calcLeads(this, ww * 2);
|
|
hs = this.opheight * this.dsign;
|
|
(this.flags & 1) != 0 && (hs = -hs);
|
|
this.in1p = $newPointArray(2);
|
|
this.in2p = $newPointArray(2);
|
|
this.textp = $newPointArray(2);
|
|
$interpPoint2(this.point1, this.point2, this.in1p[0], this.in2p[0], 0, hs);
|
|
$interpPoint2(this.lead1, this.lead2, this.in1p[1], this.in2p[1], 0, hs);
|
|
$interpPoint2(this.lead1, this.lead2, this.textp[0], this.textp[1], 0.2, hs);
|
|
tris = $newPointArray(2);
|
|
$interpPoint2(this.lead1, this.lead2, tris[0], tris[1], 0, hs * 2);
|
|
this.triangle = $createPolygon(tris[0], tris[1], this.lead2);
|
|
this.plusFont = new Font('SansSerif', 0, this.opsize == 2?14:10);
|
|
}
|
|
;
|
|
_.stamp = function stamp_47(){
|
|
$stampMatrix_0(this.nodes[2], this.voltSource, 1);
|
|
}
|
|
;
|
|
_.undumpXml = function undumpXml_60(xml){
|
|
this.flags = 0;
|
|
this.flags = $parseIntAttr(xml, 'f', this.flags);
|
|
this.maxOut = $parseDoubleAttr(xml, 'ma', this.maxOut);
|
|
this.minOut = $parseDoubleAttr(xml, 'mi', this.minOut);
|
|
this.gain = $parseDoubleAttr(xml, 'ga', this.gain);
|
|
$setSize_4(this, (this.flags & 2) != 0?1:2);
|
|
}
|
|
;
|
|
_.validate = function validate_15(){
|
|
return $validateRailNode(this, 2);
|
|
}
|
|
;
|
|
_.gain = 0;
|
|
_.lastvd = 0;
|
|
_.maxOut = 0;
|
|
_.minOut = 0;
|
|
_.opheight = 0;
|
|
_.opsize = 0;
|
|
_.opwidth = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_OpAmpElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'OpAmpElm', 306);
|
|
function $clinit_OpAmpRealElm(){
|
|
$clinit_OpAmpRealElm = emptyMethod;
|
|
model741ExternalNodes = stampJavaTypeInfo(getClassLiteralForArray(I_classLit, 1), $intern_25, 7, 15, [2, 3, 6, 7, 4]);
|
|
lm324ExternalNodes = stampJavaTypeInfo(getClassLiteralForArray(I_classLit, 1), $intern_25, 7, 15, [1, 13, 12, 4, 5]);
|
|
lm324v2ExternalNodes = stampJavaTypeInfo(getClassLiteralForArray(I_classLit, 1), $intern_25, 7, 15, [2, 1, 5, 3, 4]);
|
|
model741resistances = stampJavaTypeInfo(getClassLiteralForArray(D_classLit, 1), $intern_76, 7, 15, [50, 25, $intern_22, 50000, $intern_22, 5000, 50000, 50, 39000, 7500, 4500]);
|
|
}
|
|
|
|
function $getCapacitor(this$static){
|
|
if (this$static.modelType == 2)
|
|
return null;
|
|
return $get_4(this$static.compElmList, this$static.modelType == 0?20:4);
|
|
}
|
|
|
|
function $init741(this$static){
|
|
var currentMult, i;
|
|
$loadComposite(this$static, null, model741String, model741ExternalNodes);
|
|
$getCapacitor(this$static).capacitance = 3.0E-11 / (this$static.slewRate / 0.6);
|
|
$getCapacitor(this$static).voltdiff = this$static.capValue;
|
|
for (i = 0; i != 11; i++)
|
|
$get_4(this$static.compElmList, 21 + i).resistance = model741resistances[i];
|
|
currentMult = this$static.currentLimit / $intern_128;
|
|
$get_4(this$static.compElmList, 21).resistance /= currentMult;
|
|
$get_4(this$static.compElmList, 22).resistance /= currentMult;
|
|
$setBeta($get_4(this$static.compElmList, 13), currentMult * 100);
|
|
$setBeta($get_4(this$static.compElmList, 18), currentMult * 100);
|
|
}
|
|
|
|
function $initModel(this$static){
|
|
var st, st_0, currentMult;
|
|
this$static.flags |= 1;
|
|
switch (this$static.modelType) {
|
|
case 0:
|
|
$init741(this$static);
|
|
break;
|
|
case 1:
|
|
st_0 = new StringTokenizer_0(lm324ModelDump, '/');
|
|
$loadComposite(this$static, st_0, lm324ModelString, lm324ExternalNodes);
|
|
$getCapacitor(this$static).capacitance = 1.0E-11 / (this$static.slewRate / 0.55);
|
|
$getCapacitor(this$static).voltdiff = this$static.capValue;
|
|
currentMult = this$static.currentLimit / $intern_128;
|
|
$get_4(this$static.compElmList, 11).resistance /= currentMult;
|
|
$setBeta($get_4(this$static.compElmList, 9), currentMult * 100);
|
|
$setBeta($get_4(this$static.compElmList, 10), currentMult * 100);
|
|
$setBeta($get_4(this$static.compElmList, 12), currentMult * 100);
|
|
$setBeta($get_4(this$static.compElmList, 16), currentMult * 100);
|
|
break;
|
|
case 2:
|
|
st = new StringTokenizer_0(lm324v2ModelDump, '/');
|
|
$loadComposite(this$static, st, lm324v2ModelString, lm324v2ExternalNodes);
|
|
}
|
|
this$static.curCounts = initUnidimensionalArray(D_classLit, $intern_76, 7, 5, 15, 1);
|
|
$setPoints_17(this$static);
|
|
}
|
|
|
|
function $setPoints_17(this$static){
|
|
var hs, hsswap, railPos, tris, ww;
|
|
$setPoints(this$static);
|
|
ww = 32;
|
|
32 > this$static.dn / 2 && (ww = round_int(this$static.dn / 2));
|
|
$calcLeads(this$static, ww * 2);
|
|
hs = 16 * this$static.dsign;
|
|
hsswap = hs;
|
|
(this$static.flags & 2) != 0 && (hsswap = -hs);
|
|
this$static.in1p = $newPointArray(2);
|
|
this$static.in2p = $newPointArray(2);
|
|
this$static.textp = $newPointArray(2);
|
|
this$static.rail1p = $newPointArray(2);
|
|
this$static.rail2p = $newPointArray(2);
|
|
$interpPoint2(this$static.point1, this$static.point2, this$static.in1p[0], this$static.in2p[0], 0, hsswap);
|
|
$interpPoint2(this$static.lead1, this$static.lead2, this$static.in1p[1], this$static.in2p[1], 0, hsswap);
|
|
$interpPoint2(this$static.lead1, this$static.lead2, this$static.textp[0], this$static.textp[1], 0.2, hsswap);
|
|
railPos = 0.5 - this$static.dn / 2 % app_0.gridSize / (ww * 2);
|
|
$interpPoint2(this$static.lead1, this$static.lead2, this$static.rail1p[1], this$static.rail2p[1], railPos, hs * 2 * (1 - railPos));
|
|
$interpPoint2(this$static.lead1, this$static.lead2, this$static.rail1p[0], this$static.rail2p[0], railPos, hs * 2);
|
|
tris = $newPointArray(2);
|
|
$interpPoint2(this$static.lead1, this$static.lead2, tris[0], tris[1], 0, hs * 2);
|
|
this$static.triangle = $createPolygon(tris[0], tris[1], this$static.lead2);
|
|
this$static.plusFont = new Font('SansSerif', 0, 14);
|
|
$setPost(this$static, 0, this$static.in1p[0]);
|
|
$setPost(this$static, 1, this$static.in2p[0]);
|
|
$setPost(this$static, 2, this$static.point2);
|
|
$setPost(this$static, 3, this$static.rail1p[0]);
|
|
$setPost(this$static, 4, this$static.rail2p[0]);
|
|
}
|
|
|
|
function OpAmpRealElm(xx, yy){
|
|
$clinit_OpAmpRealElm();
|
|
CompositeElm.call(this, xx, yy);
|
|
this.noDiagonal = true;
|
|
this.slewRate = 0.6;
|
|
this.currentLimit = $intern_128;
|
|
this.modelType = 0;
|
|
$initModel(this);
|
|
}
|
|
|
|
function OpAmpRealElm_0(xa, ya, xb, yb, f, st){
|
|
$clinit_OpAmpRealElm();
|
|
CompositeElm_0.call(this, xa, ya, xb, yb, f);
|
|
this.noDiagonal = true;
|
|
this.slewRate = __parseAndValidateDouble($nextToken(st));
|
|
this.capValue = __parseAndValidateDouble($nextToken(st));
|
|
this.currentLimit = $intern_128;
|
|
this.modelType = 0;
|
|
try {
|
|
this.currentLimit = __parseAndValidateDouble($nextToken(st));
|
|
this.modelType = __parseAndValidateInt($nextToken(st), 10);
|
|
}
|
|
catch ($e0) {
|
|
$e0 = toJava($e0);
|
|
if (!instanceOf($e0, 13))
|
|
throw toJs($e0);
|
|
}
|
|
$initModel(this);
|
|
}
|
|
|
|
defineClass(394, 110, $intern_85, OpAmpRealElm, OpAmpRealElm_0);
|
|
_.canFlipX = function canFlipX_3(){
|
|
return this.dy == 0;
|
|
}
|
|
;
|
|
_.canFlipY = function canFlipY_4(){
|
|
return this.dx == 0;
|
|
}
|
|
;
|
|
_.draw = function draw_56(g){
|
|
var i;
|
|
$setBbox_0(this, this.point1, this.point2, 32);
|
|
$setVoltageColor(this, g, this.volts[0]);
|
|
drawThickLine_0(g, this.in1p[0], this.in1p[1], 3);
|
|
$setVoltageColor(this, g, this.volts[1]);
|
|
drawThickLine_0(g, this.in2p[0], this.in2p[1], 3);
|
|
$setVoltageColor(this, g, this.volts[2]);
|
|
drawThickLine_0(g, this.lead2, this.point2, 3);
|
|
$setVoltageColor(this, g, this.volts[3]);
|
|
drawThickLine_0(g, this.rail1p[0], this.rail1p[1], 3);
|
|
$setVoltageColor(this, g, this.volts[4]);
|
|
drawThickLine_0(g, this.rail2p[0], this.rail2p[1], 3);
|
|
$setColor_0(g, mouseElmRef == this || this.selected_0 || $containsKey(app_0.mouse.scopePlotRoles, this) || instanceOf(mouseElmRef, 21) && $getElm_0(mouseElmRef.elmScope) == this || $isOnHighlightedNet(this)?selectColor_0:lightGrayColor);
|
|
$setPowerColor_0(this, g);
|
|
drawThickPolygon(g, this.triangle);
|
|
$setFont_0(g, this.plusFont);
|
|
$drawCenteredText(this, g, '-', this.textp[0].x_0, this.textp[0].y_0 - 2, true);
|
|
$drawCenteredText(this, g, '+', this.textp[1].x_0, this.textp[1].y_0, true);
|
|
for (i = 0; i != 5; i++)
|
|
this.curCounts[i] = $updateDotCount($getCurrentIntoNode(this, i), this.curCounts[i]);
|
|
$drawDots(g, this.in1p[1], this.in1p[0], this.curCounts[0]);
|
|
$drawDots(g, this.in2p[1], this.in2p[0], this.curCounts[1]);
|
|
$drawDots(g, this.lead2, this.point2, this.curCounts[2]);
|
|
$drawDots(g, this.rail1p[0], this.rail1p[1], -this.curCounts[3]);
|
|
$drawDots(g, this.rail2p[0], this.rail2p[1], -this.curCounts[4]);
|
|
$drawPosts(this, g);
|
|
}
|
|
;
|
|
_.dumpXml = function dumpXml_58(doc, elem){
|
|
dumpAttr_1(elem, 'x', this.x_0 + ' ' + this.y_0 + ' ' + this.x2 + ' ' + this.y2);
|
|
dumpAttr_0(elem, 'f', this.flags);
|
|
dumpAttr(elem, 'slr', this.slewRate);
|
|
dumpAttr(elem, 'cl', this.currentLimit);
|
|
dumpAttr_0(elem, 'mt', this.modelType);
|
|
}
|
|
;
|
|
_.dumpXmlState = function dumpXmlState_9(doc, elem){
|
|
var elm, voltdiff;
|
|
elm = $getCapacitor(this);
|
|
voltdiff = !elm?0:elm.voltdiff;
|
|
checkAttr(elem, 'vd');
|
|
$setAttribute_0(elem, 'vd', '' + voltdiff);
|
|
}
|
|
;
|
|
_.getConnection_0 = function getConnection_28(n1, n2){
|
|
return true;
|
|
}
|
|
;
|
|
_.getDumpType_0 = function getDumpType_75(){
|
|
return 409;
|
|
}
|
|
;
|
|
_.getDumpType = function(){
|
|
return this.getDumpType_0();
|
|
}
|
|
;
|
|
_.getEditInfo = function getEditInfo_54(n){
|
|
var ei;
|
|
if (n == 0) {
|
|
ei = new EditInfo('<a href="opampreal.html" target="_blank">' + LS('Model') + '<\/a>', this.modelType);
|
|
ei.choice = new Choice;
|
|
$addItem(ei.choice, LS('LM741'));
|
|
if (this.modelType == 1) {
|
|
$addItem(ei.choice, LS('LM324, old'));
|
|
$addItem(ei.choice, LS('LM324, fixed'));
|
|
$select(ei.choice, this.modelType);
|
|
}
|
|
else {
|
|
$addItem(ei.choice, LS('LM324'));
|
|
$select(ei.choice, this.modelType == 0?0:1);
|
|
}
|
|
return ei;
|
|
}
|
|
if (n == 1) {
|
|
ei = new EditInfo_0('', 0, -1, -1);
|
|
ei.checkbox = new Checkbox_0('Swap Inputs', (this.flags & 2) != 0);
|
|
return ei;
|
|
}
|
|
if (this.modelType == 2)
|
|
return null;
|
|
if (n == 2)
|
|
return new EditInfo('Slew Rate (V/usec)', this.slewRate);
|
|
if (n == 3)
|
|
return new EditInfo('Output Current Limit (A)', this.currentLimit);
|
|
return null;
|
|
}
|
|
;
|
|
_.getElmType = function getElmType_17(){
|
|
return 'op-amp';
|
|
}
|
|
;
|
|
_.getInfo_0 = function getInfo_63(arr){
|
|
var type_0;
|
|
type_0 = this.modelType == 0?'LM741':'LM324';
|
|
arr[0] = 'op-amp (' + type_0 + ')';
|
|
arr[1] = 'V+ = ' + getUnitText(this.volts[1], 'V', false);
|
|
arr[2] = 'V- = ' + getUnitText(this.volts[0], 'V', false);
|
|
arr[3] = 'Vout = ' + getUnitText(this.volts[2], 'V', false);
|
|
arr[4] = 'Iout = ' + getUnitText($getCurrentIntoNode(this, 2), 'A', false);
|
|
}
|
|
;
|
|
_.reset_1 = function reset_33(){
|
|
$reset_2(this);
|
|
this.curCounts = initUnidimensionalArray(D_classLit, $intern_76, 7, 5, 15, 1);
|
|
}
|
|
;
|
|
_.setEditValue = function setEditValue_54(n, ei){
|
|
if (n == 0) {
|
|
this.modelType = $getElement(ei.choice).selectedIndex;
|
|
$getElement(ei.choice).options.length == 2 && this.modelType == 1 && (this.modelType = 2);
|
|
this.capValue = 0;
|
|
$initModel(this);
|
|
ei.newDialog = true;
|
|
}
|
|
if (n == 1) {
|
|
this.flags = $changeFlag(ei, this.flags, 2);
|
|
$setPoints_17(this);
|
|
}
|
|
if (n == 2) {
|
|
this.slewRate = ei.value_0;
|
|
$initModel(this);
|
|
}
|
|
if (n == 3) {
|
|
this.currentLimit = ei.value_0;
|
|
$initModel(this);
|
|
}
|
|
}
|
|
;
|
|
_.setPoints = function setPoints_51(){
|
|
$setPoints_17(this);
|
|
}
|
|
;
|
|
_.undumpXml = function undumpXml_61(xml){
|
|
var cap, voltdiff;
|
|
$undumpXml_3(this, xml);
|
|
this.slewRate = $parseDoubleAttr(xml, 'slr', this.slewRate);
|
|
this.currentLimit = $parseDoubleAttr(xml, 'cl', this.currentLimit);
|
|
this.modelType = $parseIntAttr(xml, 'mt', this.modelType);
|
|
voltdiff = $parseDoubleAttr(xml, 'vd', 0);
|
|
$initModel(this);
|
|
cap = $getCapacitor(this);
|
|
!!cap && (cap.voltdiff = voltdiff);
|
|
}
|
|
;
|
|
_.capValue = 0;
|
|
_.currentLimit = 0;
|
|
_.modelType = 0;
|
|
_.slewRate = 0;
|
|
var lm324ExternalNodes, lm324ModelDump = '0 -1 -0 0 10000/0 0.000006/0 1 0 0 100/0 1 0 0 100/0 1e-11 0/0 0.000004/0 0.0001/0 1 0 0 100/0 1 0 0 100/0 1 0 0 100/0 1 0 0 100/0 25/0 -1 0 0 100/0 0.00005/0 -1 0 0 100/0 10000/0 1 0 0 100/0 -1 0 0 10000', lm324ModelString = 'TransistorElm 1 2 3\rCurrentElm 4 3\rTransistorElm 2 2 5\rTransistorElm 2 6 5\rCapacitorElm 6 7\rCurrentElm 4 8\rCurrentElm 4 7\rTransistorElm 8 4 9\rTransistorElm 7 4 10\rTransistorElm 10 4 11\rTransistorElm 11 7 12\rResistorElm 11 12\rTransistorElm 7 5 12\rCurrentElm 12 5\rTransistorElm 6 5 8\rResistorElm 9 5\rTransistorElm 9 7 5\rTransistorElm 13 6 3', lm324v2ExternalNodes, lm324v2ModelDump = '0 40000/0 5e-7/0 380/0 1700/0 5/0 -1 0 0 306 xlm324v2-qpi/0 380/0 1700/0 5/0 -1 0 0 300 xlm324v2-qpa/0 380/0 1700/0 5/0 -1 0 0 306 xlm324v2-qpi/0 380/0 1700/0 5/0 -1 0 0 306 xlm324v2-qpi/0 25/0 1 0 0 100 xlm324v2-qnq/0 25/0 1 0 0 100 xlm324v2-qnq/0 300/0 -1 0 0 100 xlm324v2-qpq/0 25/0 1 0 0 100 xlm324v2-qnq/0 25/0 1 0 0 100 xlm324v2-qnq/0 25/0 1 0 0 100 xlm324v2-qnq/0 25/0 1 0 0 100 xlm324v2-qnq/0 40000/0 18/0 300/0 -1 0 0 100 xlm324v2-qpq/0 25/0 1 0 0 100 xlm324v2-qnq/0 1.2e-7/0 6e-8/0 0.000001/0 300/0 -1 0 0 100 xlm324v2-qpq/0 300/0 -1 0 0 100 xlm324v2-qpq/0 25/0 1 0 0 100 xlm324v2-qnq/0 300/0 -1 0 0 100 xlm324v2-qpq/2 4.8e-12 0 0/0 3/0 3000000000/0 2 -0.00001*(a-b)/0 0 0 -0.00156/0 0.000005/0 450000/0 300/0 -1 0 0 100 xlm324v2-qpq/0 300/0 -1 0 0 100 xlm324v2-qpq/2 8e-12 0 0/2 1e-12 0 0/2 1e-13 0 0/0 300000/2 2.3e-13 0 0/2 7.9e-13 0 0/2 7.9e-13 0 0/0 2 2*(a-b)/2 5e-14 0 0/0 25/0 1 0 0 100 xlm324v2-qnq/0 2 0.0003*(a-b)/0 0.001/0 0 0 -0.25/0 1000000/0 2 1*(a-b)/0 1000000/0 0 0 -0.55/0 1000000', lm324v2ModelString = 'ResistorElm 4 6\rCurrentElm 4 7\rResistorElm 4 29\rResistorElm 8 30\rResistorElm 9 31\rTransistorElm 30 29 31 \rResistorElm 4 32\rResistorElm 2 33\rResistorElm 10 34\rTransistorElm 33 32 34 \rResistorElm 9 35\rResistorElm 9 36\rResistorElm 11 37\rTransistorElm 36 35 37 \rResistorElm 10 38\rResistorElm 10 39\rResistorElm 11 40\rTransistorElm 39 38 40 \rResistorElm 12 41\rTransistorElm 13 41 4 \rResistorElm 13 42\rTransistorElm 13 42 4 \rResistorElm 4 43\rTransistorElm 12 43 14 \rResistorElm 3 44\rTransistorElm 14 44 6 \rResistorElm 15 45\rTransistorElm 6 45 4 \rResistorElm 3 46\rTransistorElm 15 46 16 \rResistorElm 3 47\rTransistorElm 16 47 17 \rResistorElm 17 16\rResistorElm 5 17\rResistorElm 4 48\rTransistorElm 15 48 5 \rResistorElm 15 49\rTransistorElm 17 49 5 \rCurrentElm 18 3\rCurrentElm 19 3\rCurrentElm 20 3\rResistorElm 11 50\rTransistorElm 18 50 3 \rResistorElm 14 51\rTransistorElm 19 51 3 \rResistorElm 5 52\rTransistorElm 7 52 4 \rResistorElm 15 53\rTransistorElm 20 53 3 \rCapacitorElm 21 22\rResistorElm 12 21\rResistorElm 12 15\rVCVSElm 3 0 23 8\rVoltageElm 23 1\rCurrentElm 3 4\rResistorElm 4 3\rResistorElm 12 54\rTransistorElm 9 54 11 \rResistorElm 13 55\rTransistorElm 10 55 11 \rCapacitorElm 12 13\rCapacitorElm 6 15\rCapacitorElm 3 24\rResistorElm 11 24\rCapacitorElm 1 2\rCapacitorElm 2 0\rCapacitorElm 1 0\rVCVSElm 15 0 22 0\rCapacitorElm 5 0\rResistorElm 25 56\rTransistorElm 25 56 0 \rVCCSElm 27 0 4 3\rCurrentElm 0 25\rVoltageElm 25 26\rResistorElm 0 26\rVCVSElm 28 26 27 0\rResistorElm 0 27\rVoltageElm 28 0\rResistorElm 0 28', model741ExternalNodes, model741String = 'NTransistorElm 3 8 9\rNTransistorElm 2 8 10\rPTransistorElm 11 12 9\rPTransistorElm 11 13 10\rNTransistorElm 14 12 1\rNTransistorElm 14 13 5\rNTransistorElm 12 7 14\rPTransistorElm 8 8 7\rPTransistorElm 8 11 7\rNTransistorElm 17 11 16\rNTransistorElm 17 17 4\rPTransistorElm 18 18 7\rPTransistorElm 18 20 7\rNTransistorElm 20 7 25\rNTransistorElm 13 22 24\rNTransistorElm 21 20 22\rNTransistorElm 25 20 6\rNTransistorElm 24 22 23\rPTransistorElm 22 4 15\rNTransistorElm 23 13 4\rCapacitorElm 13 20\rResistorElm 15 6\rResistorElm 6 25\rResistorElm 4 1\rResistorElm 4 14\rResistorElm 4 5\rResistorElm 4 16\rResistorElm 4 24\rResistorElm 4 23\rResistorElm 17 18\rResistorElm 22 21\rResistorElm 21 20\r', model741resistances;
|
|
var Lcom_lushprojects_circuitjs1_client_OpAmpRealElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'OpAmpRealElm', 394);
|
|
function OpAmpSwapElm(xx, yy){
|
|
OpAmpElm.call(this, xx, yy);
|
|
this.flags |= 1;
|
|
}
|
|
|
|
defineClass(930, 306, $intern_85, OpAmpSwapElm);
|
|
_.getDumpClass = function getDumpClass_10(){
|
|
return Lcom_lushprojects_circuitjs1_client_OpAmpElm_2_classLit;
|
|
}
|
|
;
|
|
_.getShortcut = function getShortcut_32(){
|
|
return 65;
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_OpAmpSwapElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'OpAmpSwapElm', 930);
|
|
function $clinit_OptocouplerElm(){
|
|
$clinit_OptocouplerElm = emptyMethod;
|
|
modelExternalNodes_4 = stampJavaTypeInfo(getClassLiteralForArray(I_classLit, 1), $intern_25, 7, 15, [6, 2, 4, 5]);
|
|
}
|
|
|
|
function $$init_14(this$static){
|
|
this$static.ctr = 1;
|
|
}
|
|
|
|
function $initOptocoupler(this$static){
|
|
var cccs;
|
|
this$static.cspc = 16;
|
|
this$static.cspc2 = this$static.cspc * 2;
|
|
this$static.diode = $get_4(this$static.compElmList, 0);
|
|
cccs = $get_4(this$static.compElmList, 1);
|
|
$setExpr(cccs, this$static.ctr + '*max(0,min(.0001, select(i-.003, (-80000000000*(i)^5+800000000*(i)^4-3000000*(i)^3+5177.2*(i)^2+.2453*(i)-.00005)*1.04/700, (9000000*(i)^5-998113*(i)^4+42174*(i)^3-861.32*(i)^2+9.0836*(i)-.0078)*.945/700)))');
|
|
this$static.transistor = $get_4(this$static.compElmList, 2);
|
|
$setBeta(this$static.transistor, 700);
|
|
this$static.curCounts = initUnidimensionalArray(D_classLit, $intern_76, 7, 4, 15, 1);
|
|
}
|
|
|
|
function $setPin_0(this$static, n, px, py, dx, dy, dax, day, sx, sy){
|
|
var pos, xa, ya;
|
|
pos = n % 2;
|
|
if ((this$static.flags & $intern_24) != 0) {
|
|
dx = -dx;
|
|
dax = -dax;
|
|
px += this$static.cspc2;
|
|
sx = -sx;
|
|
}
|
|
if ((this$static.flags & $intern_43) != 0) {
|
|
dy = -dy;
|
|
day = -day;
|
|
py += this$static.cspc2;
|
|
sy = -sy;
|
|
}
|
|
xa = px + this$static.cspc2 * dx * pos + sx;
|
|
ya = py + this$static.cspc2 * dy * pos + sy;
|
|
$setPost(this$static, n, new Point_2(xa + dax * this$static.cspc2, ya + day * this$static.cspc2));
|
|
this$static.stubs[n] = new Point_2(xa + dax * this$static.cspc, ya + day * this$static.cspc);
|
|
}
|
|
|
|
function $setPoints_18(this$static){
|
|
var dx, midp, x0, xr, xs, y0, yr, ys;
|
|
$setPoints(this$static);
|
|
x0 = this$static.x_0 + this$static.cspc2;
|
|
y0 = this$static.y_0;
|
|
xr = x0 - this$static.cspc;
|
|
yr = y0 - (this$static.cspc / 2 | 0);
|
|
xs = 2 * this$static.cspc2;
|
|
ys = 2 * this$static.cspc2 - this$static.cspc;
|
|
this$static.rectPointsX = stampJavaTypeInfo(getClassLiteralForArray(I_classLit, 1), $intern_25, 7, 15, [xr, xr + xs, xr + xs, xr]);
|
|
this$static.rectPointsY = stampJavaTypeInfo(getClassLiteralForArray(I_classLit, 1), $intern_25, 7, 15, [yr, yr, yr + ys, yr + ys]);
|
|
$setBbox(this$static, xr, yr, this$static.rectPointsX[2], this$static.rectPointsY[2]);
|
|
this$static.stubs = initUnidimensionalArray(Lcom_lushprojects_circuitjs1_client_Point_2_classLit, $intern_78, 14, 4, 0, 1);
|
|
$setPin_0(this$static, 0, x0, y0, 0, 1, -1, 0, 0, 0);
|
|
$setPin_0(this$static, 1, x0, y0, 0, 1, -1, 0, 0, 0);
|
|
$setPin_0(this$static, 2, x0, y0, 0, 1, 1, 0, xs - this$static.cspc2, 0);
|
|
$setPin_0(this$static, 3, x0, y0, 0, 1, 1, 0, xs - this$static.cspc2, 0);
|
|
dx = (this$static.flags & $intern_24) != 0?-1:1;
|
|
$setPosition_0(this$static.diode, this$static.posts[0].x_0 + 32 * dx, this$static.posts[0].y_0, this$static.posts[1].x_0 + 32 * dx, this$static.posts[1].y_0);
|
|
this$static.stubs[0] = $getPost(this$static.diode, 0);
|
|
this$static.stubs[1] = $getPost(this$static.diode, 1);
|
|
midp = (this$static.posts[2].y_0 + this$static.posts[3].y_0) / 2 | 0;
|
|
$setFlipped(this$static.transistor, (this$static.flags & $intern_43) != 0);
|
|
$setPosition_0(this$static.transistor, this$static.posts[2].x_0 - 40 * dx, midp, this$static.posts[2].x_0 - 24 * dx, midp);
|
|
this$static.stubs[2] = $getPost_2(this$static.transistor, 1);
|
|
this$static.stubs[3] = $getPost_2(this$static.transistor, 2);
|
|
}
|
|
|
|
function OptocouplerElm(xx, yy){
|
|
$clinit_OptocouplerElm();
|
|
CompositeElm_2.call(this, xx, yy, modelString_3, modelExternalNodes_4);
|
|
$$init_14(this);
|
|
this.noDiagonal = true;
|
|
$initOptocoupler(this);
|
|
this.diode.modelName = 'default-optocoupler-led';
|
|
$setup_0(this.diode);
|
|
}
|
|
|
|
function OptocouplerElm_0(xa, ya, xb, yb, f){
|
|
$clinit_OptocouplerElm();
|
|
CompositeElm_1.call(this, xa, ya, xb, yb, f, null, modelString_3, modelExternalNodes_4);
|
|
$$init_14(this);
|
|
this.noDiagonal = true;
|
|
$initOptocoupler(this);
|
|
}
|
|
|
|
defineClass(395, 110, $intern_85, OptocouplerElm, OptocouplerElm_0);
|
|
_.canFlipXY = function canFlipXY_2(){
|
|
return false;
|
|
}
|
|
;
|
|
_.draw = function draw_57(g){
|
|
var a, b, dx, i, p, p1, p2, sx, sy, y_0;
|
|
$setColor_0(g, mouseElmRef == this || this.selected_0 || $containsKey(app_0.mouse.scopePlotRoles, this) || instanceOf(mouseElmRef, 21) && $getElm_0(mouseElmRef.elmScope) == this || $isOnHighlightedNet(this)?selectColor_0:lightGrayColor);
|
|
drawThickPolygon_0(g, this.rectPointsX, this.rectPointsY, 4);
|
|
for (i = 0; i != 4; i++) {
|
|
$setVoltageColor(this, g, this.volts[i]);
|
|
a = this.posts[i];
|
|
b = this.stubs[i];
|
|
drawThickLine_0(g, a, b, 3);
|
|
this.curCounts[i] = $updateDotCount(-$getCurrentIntoNode(this, i), this.curCounts[i]);
|
|
$drawDots(g, a, b, this.curCounts[i]);
|
|
}
|
|
this.diode.draw(g);
|
|
$draw_1(this.transistor, g);
|
|
$drawPosts(this, g);
|
|
$setColor_0(g, lightGrayColor);
|
|
dx = (this.flags & $intern_24) != 0?-1:1;
|
|
sx = this.stubs[0].x_0 + 2 * dx;
|
|
sy = (this.stubs[0].y_0 + this.stubs[1].y_0) / 2 | 0;
|
|
for (i = 0; i != 2; i++) {
|
|
y_0 = sy + i * 10 - 5;
|
|
p1 = new Point_2(sx, y_0);
|
|
p2 = new Point_2(sx + 20 * dx, y_0);
|
|
p = $calcArrow(p1, p2, 5, 2);
|
|
$fillPolygon(g, p);
|
|
$drawLine(g, sx + 10 * dx, y_0, sx + 15 * dx, y_0);
|
|
}
|
|
}
|
|
;
|
|
_.dumpXml = function dumpXml_59(doc, elem){
|
|
var model;
|
|
model = this.diode.model;
|
|
model.builtIn || model.dumped || $dumpXml_7(model, doc);
|
|
dumpAttr_1(elem, 'x', this.x_0 + ' ' + this.y_0 + ' ' + this.x2 + ' ' + this.y2);
|
|
dumpAttr_0(elem, 'f', this.flags);
|
|
dumpAttr(elem, 'ctr', this.ctr);
|
|
dumpAttr_1(elem, 'dmo', this.diode.modelName);
|
|
}
|
|
;
|
|
_.dumpXmlModel = function dumpXmlModel_4(doc){
|
|
var model;
|
|
model = this.diode.model;
|
|
model.builtIn || model.dumped || $dumpXml_7(model, doc);
|
|
}
|
|
;
|
|
_.flipX = function flipX_12(center2, count){
|
|
var xs;
|
|
this.flags ^= $intern_24;
|
|
if (count != 1) {
|
|
xs = 3 * this.cspc2;
|
|
this.x_0 = center2 - this.x_0 - xs;
|
|
this.x2 = center2 - this.x2;
|
|
}
|
|
$setPoints_18(this);
|
|
}
|
|
;
|
|
_.flipY = function flipY_12(center2, count){
|
|
var ys;
|
|
this.flags ^= $intern_43;
|
|
if (count != 1) {
|
|
ys = this.cspc2;
|
|
this.y_0 = center2 - this.y_0 - ys;
|
|
this.y2 = center2 - this.y2;
|
|
}
|
|
$setPoints_18(this);
|
|
}
|
|
;
|
|
_.getConnection_0 = function getConnection_29(n1, n2){
|
|
return (n1 / 2 | 0) == (n2 / 2 | 0);
|
|
}
|
|
;
|
|
_.getDumpType_0 = function getDumpType_76(){
|
|
return 407;
|
|
}
|
|
;
|
|
_.getDumpType = function(){
|
|
return this.getDumpType_0();
|
|
}
|
|
;
|
|
_.getEditInfo = function getEditInfo_55(n){
|
|
var dm, ei, i;
|
|
if (n == 0)
|
|
return $setDimensionless(new EditInfo_0('CTR Scale', this.ctr, 0, 0));
|
|
if (n == 1) {
|
|
ei = new EditInfo_0('LED Model', 0, -1, -1);
|
|
this.models = getModelList_0(false);
|
|
ei.choice = new Choice;
|
|
for (i = 0; i != this.models.arrayList.array.length; i++) {
|
|
dm = $get_4(this.models, i);
|
|
$addItem(ei.choice, LS($getDescription(dm)));
|
|
dm == this.diode.model && $select(ei.choice, i);
|
|
}
|
|
return ei;
|
|
}
|
|
return null;
|
|
}
|
|
;
|
|
_.getInfo_0 = function getInfo_64(arr){
|
|
arr[0] = 'optocoupler';
|
|
arr[1] = 'CTR Scale = ' + $format_0(showFormat, this.ctr);
|
|
arr[2] = 'Iin = ' + getUnitText($getCurrentIntoNode(this, 0), 'A', false);
|
|
arr[3] = 'Iout = ' + getUnitText($getCurrentIntoNode(this, 2), 'A', false);
|
|
}
|
|
;
|
|
_.reset_1 = function reset_34(){
|
|
$reset_2(this);
|
|
this.curCounts = initUnidimensionalArray(D_classLit, $intern_76, 7, 4, 15, 1);
|
|
}
|
|
;
|
|
_.setEditValue = function setEditValue_55(n, ei){
|
|
if (n == 0 && ei.value_0 > 0) {
|
|
this.ctr = ei.value_0;
|
|
$initOptocoupler(this);
|
|
}
|
|
if (n == 1) {
|
|
this.diode.model = $get_4(this.models, $getElement(ei.choice).selectedIndex);
|
|
this.diode.modelName = this.diode.model.name_0;
|
|
$setup_0(this.diode);
|
|
}
|
|
}
|
|
;
|
|
_.setPoints = function setPoints_52(){
|
|
$setPoints_18(this);
|
|
}
|
|
;
|
|
_.undumpXml = function undumpXml_62(xml){
|
|
var defaultDmo;
|
|
$undumpXml_3(this, xml);
|
|
this.ctr = $parseDoubleAttr(xml, 'ctr', this.ctr);
|
|
defaultDmo = $parseStringAttr(xml, 'ix', null) != null?this.diode.modelName:'default';
|
|
this.diode.modelName = $parseStringAttr(xml, 'dmo', defaultDmo);
|
|
$initOptocoupler(this);
|
|
$setup_0(this.diode);
|
|
}
|
|
;
|
|
_.updateModels_0 = function updateModels_5(){
|
|
$setup_0(this.diode);
|
|
}
|
|
;
|
|
_.updateModels = function(){
|
|
this.updateModels_0();
|
|
}
|
|
;
|
|
_.cspc = 0;
|
|
_.cspc2 = 0;
|
|
_.ctr = 0;
|
|
var modelExternalNodes_4, modelString_3 = 'DiodeElm 6 1\rCCCSElm 1 2 3 4\rNTransistorElm 3 4 5';
|
|
var Lcom_lushprojects_circuitjs1_client_OptocouplerElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'OptocouplerElm', 395);
|
|
function OutputElm(xx, yy){
|
|
CircuitElm.call(this, xx, yy);
|
|
this.scale_0 = 0;
|
|
}
|
|
|
|
function OutputElm_0(xa, ya, xb, yb, f, st){
|
|
CircuitElm_0.call(this, xa, ya, xb, yb, f);
|
|
this.scale_0 = 0;
|
|
try {
|
|
this.scale_0 = __parseAndValidateInt($nextToken(st), 10);
|
|
}
|
|
catch ($e0) {
|
|
$e0 = toJava($e0);
|
|
if (!instanceOf($e0, 13))
|
|
throw toJs($e0);
|
|
}
|
|
}
|
|
|
|
defineClass(241, 8, {8:1, 10:1, 241:1}, OutputElm, OutputElm_0);
|
|
_.addRoutingObstacle = function addRoutingObstacle_18(router){
|
|
$addWire(router, this.point1.x_0, this.point1.y_0, this.x2, this.y2);
|
|
$addObstacle(router, this.x2 - 10, this.y2 - 10, this.x2 + 10, this.y2 + 10);
|
|
}
|
|
;
|
|
_.draw = function draw_58(g){
|
|
var f, role, s, selected;
|
|
g.context.save();
|
|
g.savedFontSize = g.currentFontSize;
|
|
selected = mouseElmRef == this || this.selected_0 || $containsKey(app_0.mouse.scopePlotRoles, this) || instanceOf(mouseElmRef, 21) && $getElm_0(mouseElmRef.elmScope) == this || $isOnHighlightedNet(this);
|
|
f = new Font('SansSerif', selected?1:0, 14);
|
|
$setFont_0(g, f);
|
|
$setColor_0(g, selected?selectColor_0:lightGrayColor);
|
|
s = (this.flags & 1) != 0?getUnitTextWithScale(this.volts[0], 'V', this.scale_0, (this.flags & 2) != 0):LS('out');
|
|
role = $get_1(app_0.mouse.scopePlotRoles, this);
|
|
role != null && role.length != 0 && (s = role);
|
|
$interpPoint_1(this.point1, this.point2, this.lead1, 1 - ((round_int($measureText(g.context, s).width) / 2 | 0) + 8) / this.dn);
|
|
$setBbox_0(this, this.point1, this.lead1, 0);
|
|
$drawCenteredText(this, g, s, this.x2, this.y2, true);
|
|
$setVoltageColor(this, g, this.volts[0]);
|
|
selected && $setColor_0(g, selectColor_0);
|
|
drawThickLine_0(g, this.point1, this.lead1, 3);
|
|
$drawPosts(this, g);
|
|
g.context.restore();
|
|
g.currentFontSize = g.savedFontSize;
|
|
}
|
|
;
|
|
_.dumpXml = function dumpXml_60(doc, elem){
|
|
dumpAttr_1(elem, 'x', this.x_0 + ' ' + this.y_0 + ' ' + this.x2 + ' ' + this.y2);
|
|
dumpAttr_0(elem, 'f', this.flags);
|
|
dumpAttr_0(elem, 'sc', this.scale_0);
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_77(){
|
|
return 79;
|
|
}
|
|
;
|
|
_.getEditInfo = function getEditInfo_56(n){
|
|
var ei;
|
|
if (n == 0)
|
|
return createCheckbox('Show Voltage', (this.flags & 1) != 0);
|
|
if ((this.flags & 1) == 0)
|
|
return null;
|
|
if (n == 1) {
|
|
ei = new EditInfo('Scale', 0);
|
|
ei.choice = new Choice;
|
|
$addItem(ei.choice, LS('Auto'));
|
|
$addItem(ei.choice, LS('V'));
|
|
$addItem(ei.choice, LS('mV'));
|
|
$addItem(ei.choice, LS(muString + 'V'));
|
|
$select(ei.choice, this.scale_0);
|
|
return ei;
|
|
}
|
|
if (this.scale_0 == 0)
|
|
return null;
|
|
if (n == 2)
|
|
return createCheckbox('Fixed Precision', (this.flags & 2) != 0);
|
|
return null;
|
|
}
|
|
;
|
|
_.getInfo_0 = function getInfo_65(arr){
|
|
arr[0] = 'output';
|
|
arr[1] = 'V = ' + getUnitText(this.volts[0], 'V', false);
|
|
}
|
|
;
|
|
_.getPostCount_0 = function getPostCount_51(){
|
|
return 1;
|
|
}
|
|
;
|
|
_.getVoltageDiff_0 = function getVoltageDiff_19(){
|
|
return this.volts[0];
|
|
}
|
|
;
|
|
_.setEditValue = function setEditValue_56(n, ei){
|
|
if (n == 0) {
|
|
this.flags = $changeFlag(ei, this.flags, 1);
|
|
ei.newDialog = true;
|
|
}
|
|
if (n == 1) {
|
|
this.scale_0 = $getElement(ei.choice).selectedIndex;
|
|
ei.newDialog = true;
|
|
}
|
|
n == 2 && (this.flags = $changeFlag(ei, this.flags, 2));
|
|
}
|
|
;
|
|
_.setPoints = function setPoints_53(){
|
|
$setPoints(this);
|
|
this.lead1 = new Point_1;
|
|
}
|
|
;
|
|
_.undumpXml = function undumpXml_63(xml){
|
|
this.flags = $parseIntAttr(xml, 'f', this.flags);
|
|
this.scale_0 = $parseIntAttr(xml, 'sc', this.scale_0);
|
|
}
|
|
;
|
|
_.scale_0 = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_OutputElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'OutputElm', 241);
|
|
function PDarlingtonElm(xx, yy){
|
|
$clinit_DarlingtonElm();
|
|
DarlingtonElm_0.call(this, xx, yy, true);
|
|
}
|
|
|
|
defineClass(932, 303, $intern_85, PDarlingtonElm);
|
|
_.getDumpClass = function getDumpClass_11(){
|
|
return Lcom_lushprojects_circuitjs1_client_DarlingtonElm_2_classLit;
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_PDarlingtonElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'PDarlingtonElm', 932);
|
|
function PJfetElm(xx, yy){
|
|
JfetElm_0.call(this, xx, yy, true);
|
|
}
|
|
|
|
defineClass(894, 185, $intern_123, PJfetElm);
|
|
_.getDumpClass = function getDumpClass_12(){
|
|
return Lcom_lushprojects_circuitjs1_client_JfetElm_2_classLit;
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_PJfetElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'PJfetElm', 894);
|
|
function PMosfetElm(xx, yy){
|
|
MosfetElm_0.call(this, xx, yy, true);
|
|
}
|
|
|
|
defineClass(931, 129, $intern_121, PMosfetElm);
|
|
_.getDumpClass = function getDumpClass_13(){
|
|
return Lcom_lushprojects_circuitjs1_client_MosfetElm_2_classLit;
|
|
}
|
|
;
|
|
_.getShortcut = function getShortcut_33(){
|
|
return 80;
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_PMosfetElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'PMosfetElm', 931);
|
|
function PTransistorElm(xx, yy){
|
|
TransistorElm_0.call(this, xx, yy, true);
|
|
}
|
|
|
|
defineClass(920, 153, $intern_126, PTransistorElm);
|
|
_.getDumpClass = function getDumpClass_14(){
|
|
return Lcom_lushprojects_circuitjs1_client_TransistorElm_2_classLit;
|
|
}
|
|
;
|
|
_.getShortcut = function getShortcut_34(){
|
|
return 112;
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_PTransistorElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'PTransistorElm', 920);
|
|
function PhaseCompElm(xx, yy){
|
|
$clinit_ChipElm();
|
|
ChipElm.call(this, xx, yy);
|
|
}
|
|
|
|
function PhaseCompElm_0(xa, ya, xb, yb, f, st){
|
|
$clinit_ChipElm();
|
|
ChipElm_0.call(this, xa, ya, xb, yb, f, st);
|
|
}
|
|
|
|
defineClass(390, 32, $intern_85, PhaseCompElm, PhaseCompElm_0);
|
|
_.doStep = function doStep_37(){
|
|
var out;
|
|
out = this.ff1?this.highVoltage:this.ff2?0:-1;
|
|
out != -1?$stampVoltageSource_0(ground, this.nodes[2], this.pins[2].voltSource, out):$stampMatrix_2(this.pins[2].voltSource, this.pins[2].voltSource, 1);
|
|
}
|
|
;
|
|
_.getChipName = function getChipName_21(){
|
|
return 'phase comparator';
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_78(){
|
|
return 161;
|
|
}
|
|
;
|
|
_.getMatrixConnection = function getMatrixConnection_9(n1, n2){
|
|
return true;
|
|
}
|
|
;
|
|
_.getPostCount_0 = function getPostCount_52(){
|
|
return 3;
|
|
}
|
|
;
|
|
_.getVoltageSourceCount = function getVoltageSourceCount_41(){
|
|
return 1;
|
|
}
|
|
;
|
|
_.nonLinear_0 = function nonLinear_18(){
|
|
return true;
|
|
}
|
|
;
|
|
_.setupPins = function setupPins_22(){
|
|
this.sizeX = 2;
|
|
this.sizeY = 2;
|
|
this.pins = initUnidimensionalArray(Lcom_lushprojects_circuitjs1_client_ChipElm$Pin_2_classLit, $intern_3, 9, 3, 0, 1);
|
|
this.pins[0] = new ChipElm$Pin(this, 0, 2, 'I1');
|
|
this.pins[1] = new ChipElm$Pin(this, 1, 2, 'I2');
|
|
this.pins[2] = new ChipElm$Pin(this, 0, 3, 'O');
|
|
this.pins[2].output = true;
|
|
}
|
|
;
|
|
_.stamp = function stamp_48(){
|
|
}
|
|
;
|
|
_.startIteration = function startIteration_15(){
|
|
var v1, v2;
|
|
v1 = this.volts[0] > this.highVoltage / 2;
|
|
v2 = this.volts[1] > this.highVoltage / 2;
|
|
v1 && !this.pins[0].value_0 && (this.ff1 = true);
|
|
v2 && !this.pins[1].value_0 && (this.ff2 = true);
|
|
this.ff1 && this.ff2 && (this.ff1 = this.ff2 = false);
|
|
this.pins[0].value_0 = v1;
|
|
this.pins[1].value_0 = v2;
|
|
}
|
|
;
|
|
_.ff1 = false;
|
|
_.ff2 = false;
|
|
var Lcom_lushprojects_circuitjs1_client_PhaseCompElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'PhaseCompElm', 390);
|
|
function $$init_15(this$static){
|
|
this$static.data_0 = initUnidimensionalArray(Z_classLit, $intern_95, 7, 0, 16, 1);
|
|
this$static.dataIndex = 0;
|
|
this$static.clockState = false;
|
|
this$static.loadState = false;
|
|
}
|
|
|
|
function $setupPins_17(this$static){
|
|
var i;
|
|
this$static.sizeX = this$static.bits + 2;
|
|
this$static.sizeY = 3;
|
|
this$static.pins = initUnidimensionalArray(Lcom_lushprojects_circuitjs1_client_ChipElm$Pin_2_classLit, $intern_3, 9, ((this$static.flags & 2) != 0?4:3) + this$static.bits, 0, 1);
|
|
this$static.pins[0] = new ChipElm$Pin(this$static, 1, 2, 'LD');
|
|
this$static.pins[1] = new ChipElm$Pin(this$static, 2, 2, '');
|
|
this$static.pins[1].clock = true;
|
|
this$static.pins[2] = new ChipElm$Pin(this$static, 1, 3, 'Q' + ((this$static.flags & 2) != 0?this$static.bits - 1:this$static.bits));
|
|
this$static.pins[2].output = true;
|
|
if ((this$static.flags & 2) != 0) {
|
|
this$static.pins[3] = new ChipElm$Pin(this$static, 0, 2, 'SER');
|
|
this$static.data_0 != null && this$static.data_0.length > 0 && (this$static.pins[2].value_0 = this$static.data_0[0]);
|
|
this$static.dataPinIndex = 4;
|
|
}
|
|
else {
|
|
this$static.dataPinIndex = 3;
|
|
}
|
|
for (i = 0; i < this$static.bits; i++)
|
|
this$static.pins[this$static.dataPinIndex + i] = new ChipElm$Pin(this$static, this$static.bits - i, 0, 'D' + (this$static.bits - (i + 1)));
|
|
$allocNodes(this$static);
|
|
}
|
|
|
|
function PisoShiftElm(xx, yy){
|
|
$clinit_ChipElm();
|
|
ChipElm.call(this, xx, yy);
|
|
$$init_15(this);
|
|
this.data_0 = initUnidimensionalArray(Z_classLit, $intern_95, 7, this.bits, 16, 1);
|
|
this.flags |= 2;
|
|
$setupPins_17(this);
|
|
}
|
|
|
|
function PisoShiftElm_0(xa, ya, xb, yb, f, st){
|
|
$clinit_ChipElm();
|
|
ChipElm_0.call(this, xa, ya, xb, yb, f, st);
|
|
$$init_15(this);
|
|
this.data_0 = initUnidimensionalArray(Z_classLit, $intern_95, 7, this.bits, 16, 1);
|
|
readBits(st, this.data_0);
|
|
$setupPins_17(this);
|
|
}
|
|
|
|
defineClass(429, 32, $intern_85, PisoShiftElm, PisoShiftElm_0);
|
|
_.defaultBitCount = function defaultBitCount_1(){
|
|
return 8;
|
|
}
|
|
;
|
|
_.dumpXml = function dumpXml_61(doc, elem){
|
|
$dumpXml_0(this, elem);
|
|
}
|
|
;
|
|
_.dumpXmlState = function dumpXmlState_10(doc, elem){
|
|
var i, newData;
|
|
$dumpXmlState(this, elem);
|
|
newData = initUnidimensionalArray(Z_classLit, $intern_95, 7, this.data_0.length, 16, 1);
|
|
for (i = 0; i < this.data_0.length; i++)
|
|
newData[i] = this.data_0[(i + this.dataIndex) % this.data_0.length];
|
|
dumpAttr_1(elem, 'dt', writeBitsToString(newData));
|
|
}
|
|
;
|
|
_.execute_3 = function execute_38(){
|
|
var i;
|
|
if (this.pins[0].value_0 != this.loadState) {
|
|
this.loadState = this.pins[0].value_0;
|
|
if (this.loadState && this.data_0.length > 0) {
|
|
if ((this.flags & 2) != 0) {
|
|
this.pins[2].value_0 = this.pins[this.dataPinIndex].value_0;
|
|
this.dataIndex = 0;
|
|
}
|
|
else {
|
|
this.dataIndex = -1;
|
|
}
|
|
for (i = 0; i < this.data_0.length; i++)
|
|
this.data_0[i] = this.pins[this.dataPinIndex + i].value_0;
|
|
}
|
|
}
|
|
if (this.pins[1].value_0 != this.clockState) {
|
|
this.clockState = this.pins[1].value_0;
|
|
if (this.clockState) {
|
|
this.dataIndex >= 0 && (this.data_0[this.dataIndex] = (this.flags & 2) != 0 && this.pins[3].value_0);
|
|
++this.dataIndex;
|
|
this.dataIndex >= this.data_0.length && (this.dataIndex = 0);
|
|
this.pins[2].value_0 = this.data_0[this.dataIndex];
|
|
}
|
|
}
|
|
}
|
|
;
|
|
_.getChipEditInfo = function getChipEditInfo_18(n){
|
|
if (n == 0)
|
|
return $setDimensionless(new EditInfo_0('# of Bits', this.bits, 1, 1));
|
|
return null;
|
|
}
|
|
;
|
|
_.getChipName = function getChipName_22(){
|
|
return 'PISO shift register';
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_79(){
|
|
return 186;
|
|
}
|
|
;
|
|
_.getPostCount_0 = function getPostCount_53(){
|
|
return ((this.flags & 2) != 0?4:3) + this.bits;
|
|
}
|
|
;
|
|
_.getVoltageSourceCount = function getVoltageSourceCount_42(){
|
|
return 1;
|
|
}
|
|
;
|
|
_.needsBits = function needsBits_8(){
|
|
return true;
|
|
}
|
|
;
|
|
_.reset_0 = function reset_35(){
|
|
$reset_0(this);
|
|
this.data_0 = initUnidimensionalArray(Z_classLit, $intern_95, 7, this.bits, 16, 1);
|
|
}
|
|
;
|
|
_.setChipEditValue = function setChipEditValue_19(n, ei){
|
|
if (n == 0) {
|
|
if (ei.value_0 != this.bits && ei.value_0 >= 1) {
|
|
this.bits = round_int(ei.value_0);
|
|
this.data_0 = initUnidimensionalArray(Z_classLit, $intern_95, 7, this.bits, 16, 1);
|
|
$setupPins_17(this);
|
|
$setPoints_0(this);
|
|
}
|
|
return;
|
|
}
|
|
}
|
|
;
|
|
_.setupPins = function setupPins_23(){
|
|
$setupPins_17(this);
|
|
}
|
|
;
|
|
_.undumpXml = function undumpXml_64(xml){
|
|
var dt;
|
|
$undumpXml_0(this, xml);
|
|
this.data_0 = initUnidimensionalArray(Z_classLit, $intern_95, 7, this.bits, 16, 1);
|
|
this.dataIndex = 0;
|
|
dt = $parseStringAttr(xml, 'dt', null);
|
|
dt != null && readBitsFromString(dt, this.data_0);
|
|
}
|
|
;
|
|
_.clockState = false;
|
|
_.dataIndex = 0;
|
|
_.dataPinIndex = 0;
|
|
_.loadState = false;
|
|
var Lcom_lushprojects_circuitjs1_client_PisoShiftElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'PisoShiftElm', 429);
|
|
function $equals(this$static, other){
|
|
var result, that;
|
|
result = false;
|
|
if (instanceOf(other, 14)) {
|
|
that = other;
|
|
result = this$static.x_0 == that.x_0 && this$static.y_0 == that.y_0 && this$static.z_0 == that.z_0;
|
|
}
|
|
return result;
|
|
}
|
|
|
|
function $move_0(this$static, dx, dy){
|
|
this$static.x_0 += dx;
|
|
this$static.y_0 += dy;
|
|
}
|
|
|
|
function Point_1(){
|
|
this.x_0 = 0;
|
|
this.y_0 = 0;
|
|
}
|
|
|
|
function Point_2(i, j){
|
|
this.x_0 = i;
|
|
this.y_0 = j;
|
|
}
|
|
|
|
function Point_3(i, j, k){
|
|
this.x_0 = i;
|
|
this.y_0 = j;
|
|
this.z_0 = k;
|
|
}
|
|
|
|
defineClass(14, 1, {14:1}, Point_1, Point_2, Point_3);
|
|
_.equals_0 = function equals_9(other){
|
|
return $equals(this, other);
|
|
}
|
|
;
|
|
_.hashCode_0 = function hashCode_9(){
|
|
return 41 * (41 * (41 + this.x_0) + this.y_0) + this.z_0;
|
|
}
|
|
;
|
|
_.toString_0 = function toString_21(){
|
|
if (this.z_0 != 0)
|
|
return 'Point(' + this.x_0 + ',' + this.y_0 + ',' + this.z_0 + ')';
|
|
return 'Point(' + this.x_0 + ',' + this.y_0 + ')';
|
|
}
|
|
;
|
|
_.x_0 = 0;
|
|
_.y_0 = 0;
|
|
_.z_0 = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_Point_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'Point', 14);
|
|
function PolarCapacitorElm(xx, yy){
|
|
CapacitorElm.call(this, xx, yy);
|
|
this.maxNegativeVoltage = 1;
|
|
}
|
|
|
|
function PolarCapacitorElm_0(xa, ya, xb, yb, f, st){
|
|
CapacitorElm_0.call(this, xa, ya, xb, yb, f, st);
|
|
this.maxNegativeVoltage = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
}
|
|
|
|
defineClass(370, 143, $intern_103, PolarCapacitorElm, PolarCapacitorElm_0);
|
|
_.draw = function draw_59(g){
|
|
var w;
|
|
$draw(this, g);
|
|
$setColor_0(g, whiteColor);
|
|
$setFont_0(g, unitsFont);
|
|
w = round_int(g.context.measureText('+').width);
|
|
$drawString(g, '+', this.plusPoint.x_0 - (w / 2 | 0), this.plusPoint.y_0);
|
|
}
|
|
;
|
|
_.dumpXml = function dumpXml_62(doc, elem){
|
|
$dumpXml_3(this, elem);
|
|
dumpAttr(elem, 'mv', this.maxNegativeVoltage);
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_80(){
|
|
return 209;
|
|
}
|
|
;
|
|
_.getEditInfo = function getEditInfo_57(n){
|
|
if (n == 4)
|
|
return new EditInfo_0('Max Reverse Voltage', this.maxNegativeVoltage, 0, 0);
|
|
return $getEditInfo_2(this, n);
|
|
}
|
|
;
|
|
_.getInfo_0 = function getInfo_66(arr){
|
|
$getInfo_2(this, arr);
|
|
arr[0] = 'capacitor (polarized)';
|
|
}
|
|
;
|
|
_.getShortcut = function getShortcut_35(){
|
|
return 67;
|
|
}
|
|
;
|
|
_.getXmlDumpType = function getXmlDumpType_20(){
|
|
return 'pc';
|
|
}
|
|
;
|
|
_.setEditValue = function setEditValue_57(n, ei){
|
|
n == 4 && (ei.value_0 >= 0?(this.maxNegativeVoltage = ei.value_0):(ei.error = 'must be >= 0'));
|
|
$setEditValue_3(this, n, ei);
|
|
}
|
|
;
|
|
_.setPoints = function setPoints_54(){
|
|
var f, i, maxI, midI, q;
|
|
$setPoints_4(this);
|
|
f = (this.dn / 2 - 4) / this.dn;
|
|
this.platePoints = $newPointArray(14);
|
|
maxI = this.platePoints.length - 1;
|
|
midI = maxI / 2;
|
|
for (i = 0; i <= maxI; i++) {
|
|
q = (i - midI) * 0.9 / midI;
|
|
this.platePoints[i] = $interpPoint_0(this.plate2[0], this.plate2[1], i / maxI, 5 * (1 - $wnd.Math.sqrt(1 - q * q)));
|
|
}
|
|
this.plusPoint = $interpPoint_0(this.point1, this.point2, f - 8 / this.dn, -10 * this.dsign);
|
|
this.y2 > this.y_0 && (this.plusPoint.y_0 += 4);
|
|
this.y_0 > this.y2 && (this.plusPoint.y_0 += 3);
|
|
}
|
|
;
|
|
_.stepFinished = function stepFinished_17(){
|
|
this.volts[0] - this.volts[1] < 0 && this.volts[0] - this.volts[1] < -this.maxNegativeVoltage && $stop(sim_0, 'capacitor exceeded max reverse voltage', this);
|
|
this.voltdiff = this.volts[0] - this.volts[this.capNode2];
|
|
$calculateCurrent(this);
|
|
}
|
|
;
|
|
_.undumpXml = function undumpXml_65(xml){
|
|
$undumpXml_2(this, xml);
|
|
this.maxNegativeVoltage = $parseDoubleAttr(xml, 'mv', this.maxNegativeVoltage);
|
|
}
|
|
;
|
|
_.maxNegativeVoltage = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_PolarCapacitorElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'PolarCapacitorElm', 370);
|
|
function $addPoint(this$static, x_0, y_0){
|
|
var newLength;
|
|
if (this$static.npoints >= this$static.xpoints.length || this$static.npoints >= this$static.ypoints.length) {
|
|
newLength = this$static.npoints * 2;
|
|
newLength < 4?(newLength = 4):(newLength & newLength - 1) != 0 && (newLength = highestOneBit(newLength));
|
|
this$static.xpoints = $expand(this$static.xpoints, newLength);
|
|
this$static.ypoints = $expand(this$static.ypoints, newLength);
|
|
}
|
|
this$static.xpoints[this$static.npoints] = x_0;
|
|
this$static.ypoints[this$static.npoints] = y_0;
|
|
++this$static.npoints;
|
|
}
|
|
|
|
function $expand(in_0, newlen){
|
|
var i, out;
|
|
out = initUnidimensionalArray(I_classLit, $intern_25, 7, newlen, 15, 1);
|
|
for (i = 0; i < in_0.length; i++)
|
|
out[i] = in_0[i];
|
|
return out;
|
|
}
|
|
|
|
function Polygon(){
|
|
this.xpoints = initUnidimensionalArray(I_classLit, $intern_25, 7, 4, 15, 1);
|
|
this.ypoints = initUnidimensionalArray(I_classLit, $intern_25, 7, 4, 15, 1);
|
|
}
|
|
|
|
defineClass(201, 1, {201:1}, Polygon);
|
|
_.npoints = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_Polygon_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'Polygon', 201);
|
|
function $createSlider_2(this$static){
|
|
var ce, ce$iterator, pe, value_0, value0;
|
|
if (this$static.link_0 != 0) {
|
|
for (ce$iterator = new ArrayList$1(app_0.elmList.arrayList); ce$iterator.i < ce$iterator.this$01.array.length;) {
|
|
ce = $next_4(ce$iterator);
|
|
if (instanceOf(ce, 203) && ce != this$static) {
|
|
pe = ce;
|
|
if (pe.link_0 == this$static.link_0 && !!pe.slider) {
|
|
this$static.slider = pe.slider;
|
|
this$static.label_0 = pe.label_0;
|
|
this$static.sliderOwner = false;
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
$addWidgetToVerticalPanel(app_0, this$static.label_0 = new Label_1(this$static.sliderText));
|
|
$addStyleName(this$static.label_0, 'topSpace');
|
|
value0 = (value_0 = toInt_0(fromDouble_0($wnd.Math.round((this$static.position - $intern_129) / $intern_124))) , value_0);
|
|
$addWidgetToVerticalPanel(app_0, this$static.slider = new Scrollbar_1(value0, this$static, this$static));
|
|
this$static.sliderOwner = true;
|
|
}
|
|
|
|
function $detachSlider(this$static){
|
|
var ce, ce$iterator, pe, transferred;
|
|
if (!this$static.sliderOwner)
|
|
return;
|
|
transferred = false;
|
|
if (this$static.link_0 != 0) {
|
|
for (ce$iterator = new ArrayList$1(app_0.elmList.arrayList); ce$iterator.i < ce$iterator.this$01.array.length;) {
|
|
ce = $next_4(ce$iterator);
|
|
if (instanceOf(ce, 203) && ce != this$static) {
|
|
pe = ce;
|
|
if (pe.link_0 == this$static.link_0 && !pe.deleted) {
|
|
pe.sliderOwner = true;
|
|
this$static.slider.command = pe;
|
|
this$static.slider.attachedElm = pe;
|
|
transferred = true;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (!transferred) {
|
|
$removeWidgetFromVerticalPanel(app_0, this$static.label_0);
|
|
$removeWidgetFromVerticalPanel(app_0, this$static.slider);
|
|
}
|
|
this$static.slider = null;
|
|
this$static.label_0 = null;
|
|
this$static.sliderOwner = false;
|
|
}
|
|
|
|
function $setLink(this$static, newLink){
|
|
if (newLink == this$static.link_0)
|
|
return;
|
|
$detachSlider(this$static);
|
|
this$static.link_0 = newLink;
|
|
$createSlider_2(this$static);
|
|
}
|
|
|
|
function $setPoints_19(this$static){
|
|
var clen, myLen, offset, soff;
|
|
$setPoints(this$static);
|
|
offset = 0;
|
|
if (abs_0(this$static.dx) > abs_0(this$static.dy) != ((this$static.flags & 2) != 0)) {
|
|
myLen = 2 * app_0.gridSize * signum(this$static.dx) * (($wnd.Math.abs(this$static.dx) + 2 * app_0.gridSize - 1) / (2 * app_0.gridSize) | 0);
|
|
this$static.point2.x_0 = this$static.point1.x_0 + myLen;
|
|
offset = this$static.dx < 0?this$static.dy:-this$static.dy;
|
|
this$static.point2.y_0 = this$static.point1.y_0;
|
|
}
|
|
else {
|
|
myLen = 2 * app_0.gridSize * signum(this$static.dy) * (($wnd.Math.abs(this$static.dy) + 2 * app_0.gridSize - 1) / (2 * app_0.gridSize) | 0);
|
|
if (this$static.dy != 0) {
|
|
this$static.point2.y_0 = this$static.point1.y_0 + myLen;
|
|
offset = this$static.dy > 0?this$static.dx:-this$static.dx;
|
|
this$static.point2.x_0 = this$static.point1.x_0;
|
|
}
|
|
}
|
|
offset == 0 && (offset = (this$static.flags & 4) != 0?-app_0.gridSize:app_0.gridSize);
|
|
this$static.dn = distance(this$static.point1, this$static.point2);
|
|
$calcLeads(this$static, 32);
|
|
this$static.position = this$static.slider.val_0 * $intern_124 + $intern_129;
|
|
soff = round_int((this$static.position - 0.5) * 32);
|
|
this$static.post3 = $interpPoint_0(this$static.point1, this$static.point2, 0.5, offset);
|
|
this$static.corner2 = $interpPoint_0(this$static.point1, this$static.point2, soff / this$static.dn + 0.5, offset);
|
|
this$static.arrowPoint = $interpPoint_0(this$static.point1, this$static.point2, soff / this$static.dn + 0.5, 8 * (offset < 0?-1:offset == 0?0:1));
|
|
this$static.midpoint = $interpPoint(this$static.point1, this$static.point2, soff / this$static.dn + 0.5);
|
|
this$static.arrow1 = new Point_1;
|
|
this$static.arrow2 = new Point_1;
|
|
clen = (offset < 0?-offset:offset) - 8;
|
|
$interpPoint2(this$static.corner2, this$static.arrowPoint, this$static.arrow1, this$static.arrow2, (clen - 8) / clen, 8);
|
|
this$static.ps3 = new Point_1;
|
|
this$static.ps4 = new Point_1;
|
|
}
|
|
|
|
function PotElm(xx, yy){
|
|
CircuitElm.call(this, xx, yy);
|
|
this.maxResistance = $intern_22;
|
|
this.position = 0.5;
|
|
this.sliderText = 'Resistance';
|
|
this.flags = 1;
|
|
$createSlider_2(this);
|
|
}
|
|
|
|
function PotElm_0(xa, ya, xb, yb, f, st){
|
|
CircuitElm_0.call(this, xa, ya, xb, yb, f);
|
|
this.maxResistance = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.position = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.sliderText = $nextToken(st);
|
|
while ($hasMoreTokens(st))
|
|
this.sliderText += ' ' + $nextToken(st);
|
|
$createSlider_2(this);
|
|
}
|
|
|
|
defineClass(203, 8, {131:1, 11:1, 8:1, 10:1, 203:1}, PotElm, PotElm_0);
|
|
_.calculateCurrent = function calculateCurrent_24(){
|
|
if (this.resistance1 == 0)
|
|
return;
|
|
this.current1 = (this.volts[0] - this.volts[2]) / this.resistance1;
|
|
this.current2 = (this.volts[1] - this.volts[2]) / this.resistance2;
|
|
this.current3 = -this.current1 - this.current2;
|
|
}
|
|
;
|
|
_.delete_0 = function delete_4(){
|
|
this.deleted = true;
|
|
$detachSlider(this);
|
|
mouseElmRef == this && (mouseElmRef = null);
|
|
$deleteSliders(app_0, this);
|
|
}
|
|
;
|
|
_.draw = function draw_60(g){
|
|
var divide, hs, i, nx, ox, rev_0, reverseX, reverseY, s1, s2, v, v1, v2, v3, w, ya;
|
|
ox = 0;
|
|
hs = app_0.menus.euroResistorCheckItem.on?6:8;
|
|
v1 = this.volts[0];
|
|
v2 = this.volts[1];
|
|
v3 = this.volts[2];
|
|
$setBbox_0(this, this.point1, this.point2, hs);
|
|
$adjustBbox_0(this, this.post3, this.post3);
|
|
$draw2Leads(this, g);
|
|
$setPowerColor_0(this, g);
|
|
divide = round_int(16 * this.position);
|
|
if (app_0.menus.euroResistorCheckItem.on) {
|
|
$setColor_0(g, $getVoltageColor(this, v1));
|
|
$interpPoint2(this.lead1, this.lead2, ps1, ps2, 0, hs);
|
|
drawThickLine_0(g, ps1, ps2, 3);
|
|
for (i = 0; i != 16; i++) {
|
|
v = v1 + (v3 - v1) * i / divide;
|
|
i >= divide && (v = v3 + (v2 - v3) * (i - divide) / (16 - divide));
|
|
$setColor_0(g, $getVoltageColor(this, v));
|
|
$interpPoint2(this.lead1, this.lead2, ps1, ps2, i * $intern_130, hs);
|
|
$interpPoint2(this.lead1, this.lead2, this.ps3, this.ps4, (i + 1) * $intern_130, hs);
|
|
drawThickLine_0(g, ps1, this.ps3, 3);
|
|
drawThickLine_0(g, ps2, this.ps4, 3);
|
|
}
|
|
$interpPoint2(this.lead1, this.lead2, ps1, ps2, 1, hs);
|
|
drawThickLine_0(g, ps1, ps2, 3);
|
|
}
|
|
else {
|
|
for (i = 0; i != 16; i++) {
|
|
switch (i & 3) {
|
|
case 0:
|
|
nx = 1;
|
|
break;
|
|
case 2:
|
|
nx = -1;
|
|
break;
|
|
default:nx = 0;
|
|
}
|
|
v = v1 + (v3 - v1) * i / divide;
|
|
i >= divide && (v = v3 + (v2 - v3) * (i - divide) / (16 - divide));
|
|
$setColor_0(g, $getVoltageColor(this, v));
|
|
$interpPoint_2(this.lead1, this.lead2, ps1, i * $intern_130, hs * ox);
|
|
$interpPoint_2(this.lead1, this.lead2, ps2, (i + 1) * $intern_130, hs * nx);
|
|
drawThickLine_0(g, ps1, ps2, 3);
|
|
ox = nx;
|
|
}
|
|
}
|
|
$setColor_0(g, $getVoltageColor(this, v3));
|
|
drawThickLine_0(g, this.post3, this.corner2, 3);
|
|
drawThickLine_0(g, this.corner2, this.arrowPoint, 3);
|
|
drawThickLine_0(g, this.arrow1, this.arrowPoint, 3);
|
|
drawThickLine_0(g, this.arrow2, this.arrowPoint, 3);
|
|
this.curcount1 = $updateDotCount(this.current1, this.curcount1);
|
|
this.curcount2 = $updateDotCount(this.current2, this.curcount2);
|
|
this.curcount3 = $updateDotCount(this.current3, this.curcount3);
|
|
if (app_0.mouse.dragElm != this) {
|
|
$drawDots(g, this.point1, this.midpoint, this.curcount1);
|
|
$drawDots(g, this.point2, this.midpoint, this.curcount2);
|
|
$drawDots(g, this.post3, this.corner2, this.curcount3);
|
|
$drawDots(g, this.corner2, this.midpoint, $addCurCount(this.curcount3, distance(this.post3, this.corner2)));
|
|
}
|
|
$drawPosts(this, g);
|
|
if (app_0.menus.showValuesCheckItem.on && this.resistance1 > 0 && (this.flags & 1) != 0) {
|
|
reverseY = this.post3.x_0 < this.lead1.x_0 && this.lead1.x_0 == this.lead2.x_0;
|
|
reverseX = this.post3.y_0 < this.lead1.y_0 && this.lead1.x_0 != this.lead2.x_0;
|
|
rev_0 = this.lead1.x_0 == this.lead2.x_0 && this.lead1.y_0 < this.lead2.y_0 || this.lead1.y_0 == this.lead2.y_0 && this.lead1.x_0 > this.lead2.x_0;
|
|
s1 = getUnitText(rev_0?this.resistance2:this.resistance1, '', true);
|
|
s2 = getUnitText(rev_0?this.resistance1:this.resistance2, '', true);
|
|
g.context.save();
|
|
g.savedFontSize = g.currentFontSize;
|
|
$setFont_0(g, valueFont);
|
|
$setColor_0(g, whiteColor);
|
|
ya = g.currentFontSize / 2 | 0;
|
|
w = round_int($measureText(g.context, s1).width);
|
|
this.lead1.x_0 == this.lead2.x_0?$drawString(g, s1, reverseY?this.arrowPoint.x_0 - 2 - w:this.arrowPoint.x_0 + 2, $wnd.Math.max(this.arrow1.y_0, this.arrow2.y_0) + 5 + ya):$drawString(g, s1, $wnd.Math.min(this.arrow1.x_0, this.arrow2.x_0) - 2 - w, reverseX?this.arrowPoint.y_0 - 4:this.arrowPoint.y_0 + 4 + ya);
|
|
w = round_int($measureText(g.context, s2).width);
|
|
this.lead1.x_0 == this.lead2.x_0?$drawString(g, s2, reverseY?this.arrowPoint.x_0 - 2 - w:this.arrowPoint.x_0 + 2, $wnd.Math.min(this.arrow1.y_0, this.arrow2.y_0) - 3):$drawString(g, s2, $wnd.Math.max(this.arrow1.x_0, this.arrow2.x_0) + 2, reverseX?this.arrowPoint.y_0 - 4:this.arrowPoint.y_0 + 4 + ya);
|
|
g.context.restore();
|
|
g.currentFontSize = g.savedFontSize;
|
|
}
|
|
}
|
|
;
|
|
_.dumpXml = function dumpXml_63(doc, elem){
|
|
dumpAttr_1(elem, 'x', this.x_0 + ' ' + this.y_0 + ' ' + this.x2 + ' ' + this.y2);
|
|
dumpAttr_0(elem, 'f', this.flags);
|
|
dumpAttr(elem, 'ma', this.maxResistance);
|
|
dumpAttr(elem, 'po', this.position);
|
|
dumpAttr_1(elem, 'sl', this.sliderText);
|
|
this.link_0 != 0 && dumpAttr_0(elem, 'li', this.link_0);
|
|
}
|
|
;
|
|
_.execute_1 = function execute_39(){
|
|
var ce, ce$iterator, pe;
|
|
app_0.analyzeFlag = true;
|
|
$setPoints_19(this);
|
|
if (this.link_0 != 0) {
|
|
for (ce$iterator = new ArrayList$1(app_0.elmList.arrayList); ce$iterator.i < ce$iterator.this$01.array.length;) {
|
|
ce = $next_4(ce$iterator);
|
|
if (instanceOf(ce, 203) && ce != this) {
|
|
pe = ce;
|
|
pe.link_0 == this.link_0 && $setPoints_19(pe);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
;
|
|
_.flipX = function flipX_13(c2, count){
|
|
this.flags ^= 4;
|
|
$flipX(this, c2);
|
|
}
|
|
;
|
|
_.flipXY = function flipXY_10(xmy, count){
|
|
abs_0(this.dx) == abs_0(this.dy) && (this.flags ^= 2);
|
|
this.flags ^= 4;
|
|
$flipXY(this, xmy);
|
|
}
|
|
;
|
|
_.flipY = function flipY_13(c2, count){
|
|
this.flags ^= 4;
|
|
$flipY(this, c2);
|
|
}
|
|
;
|
|
_.getCurrentIntoNode = function getCurrentIntoNode_23(n){
|
|
if (n == 0)
|
|
return -this.current1;
|
|
if (n == 1)
|
|
return -this.current2;
|
|
return -this.current3;
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_81(){
|
|
return 174;
|
|
}
|
|
;
|
|
_.getEditInfo = function getEditInfo_58(n){
|
|
var ei;
|
|
if (n == 0)
|
|
return new EditInfo_0('Resistance (ohms)', this.maxResistance, 0, 0);
|
|
if (n == 1) {
|
|
ei = new EditInfo_0('Slider Text', 0, -1, -1);
|
|
ei.text_0 = this.sliderText;
|
|
return ei;
|
|
}
|
|
if (n == 2) {
|
|
ei = new EditInfo_0('', 0, -1, -1);
|
|
ei.checkbox = new Checkbox_0('Show Values', (this.flags & 1) != 0);
|
|
return ei;
|
|
}
|
|
if (n == 3)
|
|
return new EditInfo_0('Group Number (for linking)', this.link_0, -1, -1);
|
|
return null;
|
|
}
|
|
;
|
|
_.getInfo_0 = function getInfo_67(arr){
|
|
arr[0] = 'potentiometer';
|
|
arr[1] = 'Vd = ' + getUnitText($wnd.Math.abs(this.volts[0] - this.volts[1]), 'V', false);
|
|
arr[2] = 'R1 = ' + getUnitText(this.resistance1, ohmString, false);
|
|
arr[3] = 'R2 = ' + getUnitText(this.resistance2, ohmString, false);
|
|
arr[4] = 'I1 = ' + getUnitText($wnd.Math.abs(this.current1), 'A', false);
|
|
arr[5] = 'I2 = ' + getUnitText($wnd.Math.abs(this.current2), 'A', false);
|
|
}
|
|
;
|
|
_.getPost = function getPost_17(n){
|
|
return n == 0?this.point1:n == 1?this.point2:this.post3;
|
|
}
|
|
;
|
|
_.getPostCount_0 = function getPostCount_54(){
|
|
return 3;
|
|
}
|
|
;
|
|
_.getXmlDumpType = function getXmlDumpType_21(){
|
|
return 'pt';
|
|
}
|
|
;
|
|
_.onMouseWheel = function onMouseWheel_3(e){
|
|
!!this.slider && $onMouseWheel_0(this.slider, e);
|
|
}
|
|
;
|
|
_.reset_0 = function reset_36(){
|
|
this.curcount1 = this.curcount2 = this.curcount3 = 0;
|
|
$reset(this);
|
|
}
|
|
;
|
|
_.setEditValue = function setEditValue_58(n, ei){
|
|
var value_0;
|
|
n == 0 && (this.maxResistance = ei.value_0);
|
|
if (n == 1) {
|
|
this.sliderText = $getText(ei.textf);
|
|
$setText_0(this.label_0, this.sliderText);
|
|
$setiFrameHeight(app_0.ui);
|
|
}
|
|
n == 2 && (this.flags = $changeFlag(ei, this.flags, 1));
|
|
if (n == 3) {
|
|
$setLink(this, round_int(ei.value_0));
|
|
$setValue_2(this.slider, (value_0 = toInt_0(fromDouble_0($wnd.Math.round((this.position - $intern_129) / $intern_124))) , value_0));
|
|
}
|
|
}
|
|
;
|
|
_.setMouseElm = function setMouseElm_1(v){
|
|
v?(mouseElmRef = this):mouseElmRef == this && (mouseElmRef = null);
|
|
!!this.slider && $draw_6(this.slider);
|
|
}
|
|
;
|
|
_.setPoints = function setPoints_55(){
|
|
$setPoints_19(this);
|
|
}
|
|
;
|
|
_.stamp = function stamp_49(){
|
|
this.resistance1 = this.maxResistance * this.position;
|
|
this.resistance2 = this.maxResistance * (1 - this.position);
|
|
$stampResistor(this.nodes[0], this.nodes[2], this.resistance1);
|
|
$stampResistor(this.nodes[2], this.nodes[1], this.resistance2);
|
|
}
|
|
;
|
|
_.undumpXml = function undumpXml_66(xml){
|
|
var value_0, value0;
|
|
this.flags = $parseIntAttr(xml, 'f', this.flags);
|
|
this.maxResistance = $parseDoubleAttr(xml, 'ma', this.maxResistance);
|
|
this.position = $parseDoubleAttr(xml, 'po', this.position);
|
|
this.sliderText = $parseStringAttr(xml, 'sl', this.sliderText);
|
|
$setLink(this, $parseIntAttr(xml, 'li', 0));
|
|
value0 = (value_0 = toInt_0(fromDouble_0($wnd.Math.round((this.position - $intern_129) / $intern_124))) , value_0);
|
|
$setValue_2(this.slider, value0);
|
|
$setText_0(this.label_0, this.sliderText);
|
|
}
|
|
;
|
|
_.curcount1 = 0;
|
|
_.curcount2 = 0;
|
|
_.curcount3 = 0;
|
|
_.current1 = 0;
|
|
_.current2 = 0;
|
|
_.current3 = 0;
|
|
_.deleted = false;
|
|
_.link_0 = 0;
|
|
_.maxResistance = 0;
|
|
_.position = 0;
|
|
_.resistance1 = 0;
|
|
_.resistance2 = 0;
|
|
_.sliderOwner = false;
|
|
var Lcom_lushprojects_circuitjs1_client_PotElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'PotElm', 203);
|
|
function $$init_16(this$static){
|
|
this$static.rmsV = 0;
|
|
this$static.avgV = 0;
|
|
this$static.binaryLevel = 0;
|
|
this$static.zerocount = 0;
|
|
this$static.maxV = 0;
|
|
this$static.minV = 0;
|
|
this$static.frequency = 0;
|
|
this$static.period = 0;
|
|
this$static.pulseWidth = 0;
|
|
this$static.dutyCycle = 0;
|
|
this$static.selectedValue = 0;
|
|
this$static.increasingV = true;
|
|
this$static.decreasingV = true;
|
|
this$static.started = false;
|
|
}
|
|
|
|
function $getMeterLine(this$static, m){
|
|
switch (m) {
|
|
case 0:
|
|
return 'Vd = ' + getUnitText(this$static.volts[0] - this$static.volts[1], 'V', false);
|
|
case 1:
|
|
return 'V(rms) = ' + getUnitText(this$static.rmsV, 'V', false);
|
|
case 10:
|
|
return 'V(avg) = ' + getUnitText(this$static.avgV, 'V', false);
|
|
case 2:
|
|
return 'Vmax = ' + getUnitText(this$static.lastMaxV, 'V', false);
|
|
case 3:
|
|
return 'Vmin = ' + getUnitText(this$static.lastMinV, 'V', false);
|
|
case 4:
|
|
return 'Vp2p = ' + getUnitText(this$static.lastMaxV - this$static.lastMinV, 'V', false);
|
|
case 5:
|
|
return 'Binary = ' + this$static.binaryLevel;
|
|
case 6:
|
|
return 'Freq = ' + getUnitText(this$static.frequency, 'Hz', false);
|
|
case 7:
|
|
return 'Period = ' + getUnitText(this$static.period, 's', false);
|
|
case 8:
|
|
return 'Pulse width = ' + getUnitText(this$static.pulseWidth, 's', false);
|
|
case 9:
|
|
return 'Duty cycle = ' + $format_0(showFormat, this$static.dutyCycle);
|
|
}
|
|
return '';
|
|
}
|
|
|
|
function $meterChoiceIndex(m){
|
|
var choices, i;
|
|
choices = stampJavaTypeInfo(getClassLiteralForArray(I_classLit, 1), $intern_25, 7, 15, [0, 1, 10, 2, 3, 4, 5]);
|
|
for (i = 0; i != choices.length; i++)
|
|
if (choices[i] == m)
|
|
return i;
|
|
return 0;
|
|
}
|
|
|
|
function ProbeElm(xx, yy){
|
|
CircuitElm.call(this, xx, yy);
|
|
$$init_16(this);
|
|
this.meter = 0;
|
|
this.flags = 3;
|
|
this.scale_0 = 0;
|
|
this.resistance = 10000000;
|
|
}
|
|
|
|
function ProbeElm_0(xa, ya, xb, yb, f, st){
|
|
CircuitElm_0.call(this, xa, ya, xb, yb, f);
|
|
$$init_16(this);
|
|
this.meter = 0;
|
|
this.scale_0 = 0;
|
|
this.resistance = 0;
|
|
try {
|
|
this.meter = __parseAndValidateInt($nextToken(st), 10);
|
|
this.scale_0 = __parseAndValidateInt($nextToken(st), 10);
|
|
this.resistance = __parseAndValidateDouble($nextToken(st));
|
|
}
|
|
catch ($e0) {
|
|
$e0 = toJava($e0);
|
|
if (!instanceOf($e0, 13))
|
|
throw toJs($e0);
|
|
}
|
|
}
|
|
|
|
defineClass(242, 8, {8:1, 10:1, 242:1}, ProbeElm, ProbeElm_0);
|
|
_.calculateCurrent = function calculateCurrent_25(){
|
|
this.current_0 = this.resistance == 0?0:(this.volts[0] - this.volts[1]) / this.resistance;
|
|
}
|
|
;
|
|
_.draw = function draw_61(g){
|
|
var f, hs, len, plusPoint, role, s, selected, showCircle, w;
|
|
g.context.save();
|
|
g.savedFontSize = g.currentFontSize;
|
|
role = $get_1(app_0.mouse.scopePlotRoles, this);
|
|
showCircle = (this.flags & 2) != 0 && (role == null || role.length == 0);
|
|
hs = showCircle?12:8;
|
|
$setBbox_0(this, this.point1, this.point2, hs);
|
|
selected = mouseElmRef == this || this.selected_0 || $containsKey(app_0.mouse.scopePlotRoles, this) || instanceOf(mouseElmRef, 21) && $getElm_0(mouseElmRef.elmScope) == this || $isOnHighlightedNet(this);
|
|
len = selected || app_0.mouse.dragElm == this || (this.flags & 1) != 0?16:this.dn - 32;
|
|
showCircle && (len = 24);
|
|
$calcLeads(this, round_int(len));
|
|
$setVoltageColor(this, g, this.volts[0]);
|
|
selected && $setColor_0(g, selectColor_0);
|
|
drawThickLine_0(g, this.point1, this.lead1, 3);
|
|
$setVoltageColor(this, g, this.volts[1]);
|
|
selected && $setColor_0(g, selectColor_0);
|
|
drawThickLine_0(g, this.lead2, this.point2, 3);
|
|
f = new Font('SansSerif', 1, 14);
|
|
$setFont_0(g, f);
|
|
role != null && role.length != 0 && $drawCenteredText(this, g, role, this.center.x_0, this.center.y_0, true);
|
|
if ((this.flags & 1) != 0) {
|
|
s = '';
|
|
switch (this.meter) {
|
|
case 0:
|
|
s = getUnitTextWithScale(this.volts[0] - this.volts[1], 'V', this.scale_0, false);
|
|
break;
|
|
case 1:
|
|
s = getUnitTextWithScale(this.rmsV, 'V(rms)', this.scale_0, false);
|
|
break;
|
|
case 10:
|
|
s = getUnitTextWithScale(this.avgV, 'V(avg)', this.scale_0, false);
|
|
break;
|
|
case 2:
|
|
s = getUnitTextWithScale(this.lastMaxV, 'Vpk', this.scale_0, false);
|
|
break;
|
|
case 3:
|
|
s = getUnitTextWithScale(this.lastMinV, 'Vmin', this.scale_0, false);
|
|
break;
|
|
case 4:
|
|
s = getUnitTextWithScale(this.lastMaxV - this.lastMinV, 'Vp2p', this.scale_0, false);
|
|
break;
|
|
case 5:
|
|
s = this.binaryLevel + '';
|
|
break;
|
|
case 6:
|
|
s = getUnitText(this.frequency, 'Hz', false);
|
|
break;
|
|
case 8:
|
|
s = getUnitText(this.pulseWidth, 's', false);
|
|
break;
|
|
case 9:
|
|
s = $format_0(showFormat, this.dutyCycle);
|
|
}
|
|
$drawValues(this, g, s, showCircle?15:4);
|
|
}
|
|
$setColor_0(g, whiteColor);
|
|
$setFont_0(g, unitsFont);
|
|
plusPoint = $interpPoint_0(this.point1, this.point2, (this.dn / 2 - len / 2 - 4) / this.dn, -10 * this.dsign);
|
|
this.y2 > this.y_0 && (plusPoint.y_0 += 4);
|
|
this.y_0 > this.y2 && (plusPoint.y_0 += 3);
|
|
w = round_int(g.context.measureText('+').width);
|
|
$drawString(g, '+', plusPoint.x_0 - (w / 2 | 0), plusPoint.y_0);
|
|
if (showCircle) {
|
|
$setColor_0(g, lightGrayColor);
|
|
drawThickCircle(g, this.center.x_0, this.center.y_0, 12);
|
|
$drawCenteredText(this, g, 'V', this.center.x_0, this.center.y_0, true);
|
|
}
|
|
$drawPosts(this, g);
|
|
g.context.restore();
|
|
g.currentFontSize = g.savedFontSize;
|
|
}
|
|
;
|
|
_.dumpXml = function dumpXml_64(doc, elem){
|
|
dumpAttr_1(elem, 'x', this.x_0 + ' ' + this.y_0 + ' ' + this.x2 + ' ' + this.y2);
|
|
dumpAttr_0(elem, 'f', this.flags);
|
|
dumpAttr_0(elem, 'me', this.meter);
|
|
dumpAttr_0(elem, 'sc', this.scale_0);
|
|
dumpAttr(elem, 're', this.resistance);
|
|
}
|
|
;
|
|
_.getConnection = function getConnection_30(n1, n2){
|
|
return this.resistance != 0;
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_82(){
|
|
return 112;
|
|
}
|
|
;
|
|
_.getEditInfo = function getEditInfo_59(n){
|
|
var ei;
|
|
if (n == 0) {
|
|
ei = new EditInfo_0('', 0, -1, -1);
|
|
ei.checkbox = new Checkbox_0('Show Value', (this.flags & 1) != 0);
|
|
return ei;
|
|
}
|
|
if (n == 1) {
|
|
ei = new EditInfo_0('Value', this.selectedValue, -1, -1);
|
|
ei.choice = new Choice;
|
|
$addItem(ei.choice, LS('Voltage'));
|
|
$addItem(ei.choice, LS('RMS Voltage'));
|
|
$addItem(ei.choice, LS('Average Voltage'));
|
|
$addItem(ei.choice, LS('Max Voltage'));
|
|
$addItem(ei.choice, LS('Min Voltage'));
|
|
$addItem(ei.choice, LS('P2P Voltage'));
|
|
$addItem(ei.choice, LS('Binary Value'));
|
|
$select(ei.choice, $meterChoiceIndex(this.meter));
|
|
return ei;
|
|
}
|
|
if (n == 2) {
|
|
ei = new EditInfo('Scale', 0);
|
|
ei.choice = new Choice;
|
|
$addItem(ei.choice, LS('Auto'));
|
|
$addItem(ei.choice, LS('V'));
|
|
$addItem(ei.choice, LS('mV'));
|
|
$addItem(ei.choice, LS(muString + 'V'));
|
|
$select(ei.choice, this.scale_0);
|
|
return ei;
|
|
}
|
|
if (n == 3) {
|
|
ei = createCheckbox('Use Circle Symbol', (this.flags & 2) != 0);
|
|
return ei;
|
|
}
|
|
if (n == 4)
|
|
return new EditInfo('Series Resistance (0 = infinite)', this.resistance);
|
|
return null;
|
|
}
|
|
;
|
|
_.getInfo_0 = function getInfo_68(arr){
|
|
var i;
|
|
arr[0] = 'voltmeter';
|
|
i = 1;
|
|
arr[i++] = $getMeterLine(this, this.meter);
|
|
this.meter != 0 && (arr[i++] = $getMeterLine(this, 0));
|
|
this.meter != 2 && (arr[i++] = $getMeterLine(this, 2));
|
|
this.meter != 3 && (arr[i++] = $getMeterLine(this, 3));
|
|
this.meter != 1 && (arr[i++] = $getMeterLine(this, 1));
|
|
this.meter != 10 && (arr[i++] = $getMeterLine(this, 10));
|
|
this.meter != 4 && (arr[i++] = $getMeterLine(this, 4));
|
|
this.meter != 7 && (arr[i++] = $getMeterLine(this, 7));
|
|
this.meter != 8 && (arr[i++] = $getMeterLine(this, 8));
|
|
this.meter != 9 && (arr[i++] = $getMeterLine(this, 9));
|
|
}
|
|
;
|
|
_.reset_0 = function reset_37(){
|
|
$reset(this);
|
|
this.zerocount = 0;
|
|
this.rmsV = this.total = this.count = 0;
|
|
this.avgV = this.totalV = 0;
|
|
this.maxV = this.lastMaxV = 0;
|
|
this.minV = this.lastMinV = 0;
|
|
this.binaryLevel = 0;
|
|
this.period = this.pulseWidth = this.dutyCycle = 0;
|
|
this.selectedValue = 0;
|
|
this.periodStart = this.periodLength = this.pulseStart = 0;
|
|
this.increasingV = true;
|
|
this.decreasingV = true;
|
|
this.started = false;
|
|
this.lastStepCount = 0;
|
|
}
|
|
;
|
|
_.setEditValue = function setEditValue_59(n, ei){
|
|
n == 0 && ($getState(ei.checkbox)?(this.flags = 1):(this.flags &= -2));
|
|
n == 1 && (this.meter = stampJavaTypeInfo(getClassLiteralForArray(I_classLit, 1), $intern_25, 7, 15, [0, 1, 10, 2, 3, 4, 5])[$getElement(ei.choice).selectedIndex]);
|
|
n == 2 && (this.scale_0 = $getElement(ei.choice).selectedIndex);
|
|
n == 3 && (this.flags = $changeFlag(ei, this.flags, 2));
|
|
n == 4 && (this.resistance = ei.value_0);
|
|
}
|
|
;
|
|
_.setPoints = function setPoints_56(){
|
|
$setPoints(this);
|
|
this.center = $interpPoint(this.point1, this.point2, 0.5);
|
|
}
|
|
;
|
|
_.stamp = function stamp_50(){
|
|
this.resistance != 0 && $stampResistor(this.nodes[0], this.nodes[1], this.resistance);
|
|
}
|
|
;
|
|
_.stepFinished = function stepFinished_18(){
|
|
var v;
|
|
if (sim_0.timeStepCount == this.lastStepCount)
|
|
return;
|
|
this.lastStepCount = sim_0.timeStepCount;
|
|
++this.count;
|
|
v = this.volts[0] - this.volts[1];
|
|
this.total += v * v;
|
|
this.totalV += v;
|
|
v < 2.5?(this.binaryLevel = 0):(this.binaryLevel = 1);
|
|
if (!this.started) {
|
|
this.started = true;
|
|
this.maxV = this.minV = v;
|
|
this.increasingV = true;
|
|
this.decreasingV = false;
|
|
this.periodStart = this.pulseStart = sim_0.t;
|
|
}
|
|
if (v > this.maxV && this.increasingV) {
|
|
this.maxV = v;
|
|
this.increasingV = true;
|
|
this.decreasingV = false;
|
|
}
|
|
if (v < this.maxV && this.increasingV) {
|
|
this.lastMaxV = this.maxV;
|
|
this.periodLength = sim_0.t - this.periodStart;
|
|
this.periodStart = sim_0.t;
|
|
this.period = this.periodLength;
|
|
this.pulseWidth = sim_0.t - this.pulseStart;
|
|
this.dutyCycle = this.pulseWidth / this.periodLength;
|
|
this.minV = v;
|
|
this.increasingV = false;
|
|
this.decreasingV = true;
|
|
this.total = this.total / this.count;
|
|
this.rmsV = $wnd.Math.sqrt(this.total);
|
|
isNaN(this.rmsV) && (this.rmsV = 0);
|
|
this.avgV = this.totalV / this.count;
|
|
isNaN(this.avgV) && (this.avgV = 0);
|
|
this.count = 0;
|
|
this.total = 0;
|
|
this.totalV = 0;
|
|
}
|
|
if (v < this.minV && this.decreasingV) {
|
|
this.minV = v;
|
|
this.increasingV = false;
|
|
this.decreasingV = true;
|
|
}
|
|
if (v > this.minV && this.decreasingV) {
|
|
this.lastMinV = this.minV;
|
|
this.pulseStart = sim_0.t;
|
|
this.maxV = v;
|
|
this.increasingV = true;
|
|
this.decreasingV = false;
|
|
this.total = this.total / this.count;
|
|
this.rmsV = $wnd.Math.sqrt(this.total);
|
|
isNaN(this.rmsV) && (this.rmsV = 0);
|
|
this.avgV = this.totalV / this.count;
|
|
isNaN(this.avgV) && (this.avgV = 0);
|
|
this.count = 0;
|
|
this.total = 0;
|
|
this.totalV = 0;
|
|
}
|
|
if (v == 0) {
|
|
++this.zerocount;
|
|
if (this.zerocount > 5) {
|
|
this.total = 0;
|
|
this.rmsV = 0;
|
|
this.avgV = 0;
|
|
this.maxV = 0;
|
|
this.minV = 0;
|
|
}
|
|
}
|
|
else {
|
|
this.zerocount = 0;
|
|
}
|
|
}
|
|
;
|
|
_.undumpXml = function undumpXml_67(xml){
|
|
this.flags = 0;
|
|
this.flags = $parseIntAttr(xml, 'f', this.flags);
|
|
this.meter = $parseIntAttr(xml, 'me', this.meter);
|
|
this.scale_0 = $parseIntAttr(xml, 'sc', this.scale_0);
|
|
this.resistance = $parseDoubleAttr(xml, 're', 0);
|
|
}
|
|
;
|
|
_.avgV = 0;
|
|
_.binaryLevel = 0;
|
|
_.count = 0;
|
|
_.decreasingV = false;
|
|
_.dutyCycle = 0;
|
|
_.frequency = 0;
|
|
_.increasingV = false;
|
|
_.lastMaxV = 0;
|
|
_.lastMinV = 0;
|
|
_.lastStepCount = 0;
|
|
_.maxV = 0;
|
|
_.meter = 0;
|
|
_.minV = 0;
|
|
_.period = 0;
|
|
_.periodLength = 0;
|
|
_.periodStart = 0;
|
|
_.pulseStart = 0;
|
|
_.pulseWidth = 0;
|
|
_.resistance = 0;
|
|
_.rmsV = 0;
|
|
_.scale_0 = 0;
|
|
_.selectedValue = 0;
|
|
_.started = false;
|
|
_.total = 0;
|
|
_.totalV = 0;
|
|
_.zerocount = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_ProbeElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ProbeElm', 242);
|
|
function PushSwitchElm(xx, yy){
|
|
SwitchElm_1.call(this, xx, yy, true);
|
|
}
|
|
|
|
defineClass(927, 61, $intern_100, PushSwitchElm);
|
|
_.getDumpClass = function getDumpClass_15(){
|
|
return Lcom_lushprojects_circuitjs1_client_SwitchElm_2_classLit;
|
|
}
|
|
;
|
|
_.getShortcut = function getShortcut_36(){
|
|
return 0;
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_PushSwitchElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'PushSwitchElm', 927);
|
|
function $getBooleanValue(this$static, key, def){
|
|
var val;
|
|
val = $getStringValue(this$static.map_0, key);
|
|
return val == null?def:val == '1' || $equalsIgnoreCase(val, 'true');
|
|
}
|
|
|
|
function QueryParameters(){
|
|
var i, nameValues, pair, search;
|
|
this.map_0 = new HashMap;
|
|
search = $wnd.location.search;
|
|
if (search != null && search.length > 0) {
|
|
nameValues = $split_1(search.substr(1), '&', 0);
|
|
for (i = 0; i < nameValues.length; i++) {
|
|
pair = $split_1(nameValues[i], '=', 0);
|
|
$putStringValue(this.map_0, pair[0], (throwIfNull('encodedURL', pair[1]) , decodeURI(pair[1])));
|
|
}
|
|
}
|
|
}
|
|
|
|
defineClass(280, 1, {}, QueryParameters);
|
|
var Lcom_lushprojects_circuitjs1_client_QueryParameters_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'QueryParameters', 280);
|
|
function $contentsToString(this$static){
|
|
var ct, hex, i, maxI, s, val, number;
|
|
hex = (this$static.flags & 4) != 0;
|
|
s = '';
|
|
maxI = 1 << this$static.addressBits;
|
|
for (i = 0; i < maxI; i++) {
|
|
val = $get_1(this$static.map_0, valueOf_0(i));
|
|
if (!val || val.value_0 == 0)
|
|
continue;
|
|
s += (hex?(number = i >>> 0 , number.toString(16)).toUpperCase():'' + i) + ': ' + (hex?$toHex(this$static, val.value_0):'' + val);
|
|
ct = 1;
|
|
while (true) {
|
|
val = $get_1(this$static.map_0, valueOf_0(++i));
|
|
if (!val || val.value_0 == 0)
|
|
break;
|
|
s += ' ' + (hex?$toHex(this$static, val.value_0):'' + val);
|
|
if (++ct == 8)
|
|
break;
|
|
}
|
|
s += '\n';
|
|
}
|
|
return s;
|
|
}
|
|
|
|
function $parseContentsString(this$static, s){
|
|
var addr, args, i, j, line, lines, val, vals;
|
|
$reset_13(this$static.map_0);
|
|
lines = $split_1(s, '\n', 0);
|
|
for (i = 0; i != lines.length; i++) {
|
|
try {
|
|
line = lines[i];
|
|
args = $split_1(line, ': *', 0);
|
|
addr = $parseNumber_1(this$static, args[0]);
|
|
vals = $split_1(args[1], ' +', 0);
|
|
for (j = 0; j != vals.length; j++) {
|
|
val = $parseNumber_1(this$static, vals[j]);
|
|
$put_0(this$static.map_0, valueOf_0(addr++), valueOf_0(val));
|
|
}
|
|
}
|
|
catch ($e0) {
|
|
$e0 = toJava($e0);
|
|
if (!instanceOf($e0, 13))
|
|
throw toJs($e0);
|
|
}
|
|
}
|
|
}
|
|
|
|
function $parseNumber_1(this$static, str){
|
|
if ($equals_1(str.substr(0, 2), '0x'))
|
|
return __parseAndValidateInt(str.substr(2), 16);
|
|
if ((this$static.flags & 4) != 0)
|
|
return __parseAndValidateInt(str, 16);
|
|
if ($equals_1(str.substr(0, 2), '0b'))
|
|
return __parseAndValidateInt(str.substr(2), 2);
|
|
return __parseAndValidateInt(str, 10);
|
|
}
|
|
|
|
function $toHex(this$static, val){
|
|
var h, mask, number;
|
|
mask = (1 << this$static.dataBits) - 1;
|
|
h = (number = (val & mask) >>> 0 , number.toString(16)).toUpperCase();
|
|
return h.length < 2?'0' + h:h;
|
|
}
|
|
|
|
function SRAMElm(xx, yy){
|
|
$clinit_ChipElm();
|
|
ChipElm.call(this, xx, yy);
|
|
this.addressBits = this.dataBits = 4;
|
|
this.map_0 = new HashMap;
|
|
this.setupPins();
|
|
}
|
|
|
|
function SRAMElm_0(xa, ya, xb, yb, f, st){
|
|
$clinit_ChipElm();
|
|
var a, v;
|
|
ChipElm_0.call(this, xa, ya, xb, yb, f, st);
|
|
this.map_0 = new HashMap;
|
|
this.addressBits = __parseAndValidateInt($nextToken(st), 10);
|
|
this.dataBits = __parseAndValidateInt($nextToken(st), 10);
|
|
this.setupPins();
|
|
try {
|
|
while (true) {
|
|
a = __parseAndValidateInt($nextToken(st), 10);
|
|
if (a < 0)
|
|
break;
|
|
v = __parseAndValidateInt($nextToken(st), 10);
|
|
$put_0(this.map_0, valueOf_0(a), valueOf_0(v));
|
|
while (true) {
|
|
v = __parseAndValidateInt($nextToken(st), 10);
|
|
if (v < 0)
|
|
break;
|
|
$put_0(this.map_0, valueOf_0(++a), valueOf_0(v));
|
|
}
|
|
}
|
|
}
|
|
catch ($e0) {
|
|
$e0 = toJava($e0);
|
|
if (!instanceOf($e0, 13))
|
|
throw toJs($e0);
|
|
}
|
|
(this.flags & 2) != 0 && (this.initialMap = new HashMap_1(this.map_0));
|
|
}
|
|
|
|
defineClass(267, 32, $intern_85, SRAMElm, SRAMElm_0);
|
|
_.allowBus = function allowBus_8(){
|
|
return true;
|
|
}
|
|
;
|
|
_.doStep = function doStep_38(){
|
|
var data_0, dataObj, i, outputEnabled, p, writeEnabled;
|
|
writeEnabled = this.volts[0] < this.highVoltage / 2;
|
|
outputEnabled = this.volts[1] < this.highVoltage / 2 && !writeEnabled;
|
|
this.address = 0;
|
|
for (i = 0; i != this.addressBits; i++) {
|
|
this.address |= this.volts[this.addressNodes + i] > this.highVoltage / 2?1 << this.addressBits - 1 - i:0;
|
|
}
|
|
dataObj = $get_1(this.map_0, valueOf_0(this.address));
|
|
data_0 = !dataObj?0:dataObj.value_0;
|
|
for (i = 0; i != this.dataBits; i++) {
|
|
p = this.pins[i + this.dataNodes];
|
|
$updateVoltageSource(p.voltSource, (data_0 & 1 << this.dataBits - 1 - i) == 0?0:this.highVoltage);
|
|
outputEnabled?$stampResistor(this.nodes[this.internalNodes + i], this.nodes[this.dataNodes + i], 1):$stampResistor(this.nodes[this.dataNodes + i], ground, $intern_97);
|
|
}
|
|
}
|
|
;
|
|
_.dumpXml = function dumpXml_65(doc, elem){
|
|
$dumpXml_0(this, elem);
|
|
dumpAttr_0(elem, 'ab', this.addressBits);
|
|
dumpAttr_0(elem, 'db', this.dataBits);
|
|
}
|
|
;
|
|
_.dumpXmlState = function dumpXmlState_11(doc, elem){
|
|
$dumpXmlState(this, elem);
|
|
$size(this.map_0) == 0 || $appendChild_0(elem, $createTextNode(doc, $contentsToString(this)));
|
|
}
|
|
;
|
|
_.getChipEditInfo = function getChipEditInfo_19(n){
|
|
var ei, reloadIdx, s;
|
|
if (n == 0)
|
|
return $setDimensionless(new EditInfo_0('# of Address Bits', this.addressBits, 1, 1));
|
|
if (n == 1)
|
|
return $setDimensionless(new EditInfo_0('# of Data Bits', this.dataBits, 1, 1));
|
|
if (n == 2) {
|
|
ei = new EditInfo('Contents', 0);
|
|
ei.textArea = new TextArea_0;
|
|
this.editTextArea = ei.textArea;
|
|
$setVisibleLines(ei.textArea, 5);
|
|
s = contentsOverride != null?contentsOverride:$contentsToString(this);
|
|
contentsOverride = null;
|
|
fileNameOverride != null && (this.loadedFileName = fileNameOverride);
|
|
fileNameOverride = null;
|
|
$setText_2(ei.textArea, s);
|
|
return ei;
|
|
}
|
|
if (n == 3) {
|
|
ei = new EditInfo_0('', 0, -1, -1);
|
|
ei.checkbox = new Checkbox_0('Hex Display', (this.flags & 4) != 0);
|
|
return ei;
|
|
}
|
|
if (n == 4 && isSupported_1()) {
|
|
ei = new EditInfo_0(this.loadedFileName != null?'Loaded: ' + this.loadedFileName:'', 0, -1, -1);
|
|
ei.loadFile = new SRAMLoadFile;
|
|
ei.button_0 = new Button_1('Load Contents From File');
|
|
ei.newDialog = true;
|
|
return ei;
|
|
}
|
|
reloadIdx = isSupported_1()?5:4;
|
|
if (n == reloadIdx) {
|
|
ei = new EditInfo_0('', 0, -1, -1);
|
|
ei.checkbox = new Checkbox_0('Restore Contents on Reset', (this.flags & 2) != 0);
|
|
return ei;
|
|
}
|
|
return null;
|
|
}
|
|
;
|
|
_.getChipName = function getChipName_23(){
|
|
return 'Static RAM';
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_83(){
|
|
return 413;
|
|
}
|
|
;
|
|
_.getInternalNodeCount = function getInternalNodeCount_10(){
|
|
return this.dataBits;
|
|
}
|
|
;
|
|
_.getMatrixConnection = function getMatrixConnection_10(n1, n2){
|
|
var i;
|
|
for (i = 0; i != this.dataBits; i++)
|
|
if ($comparePair(n1, n2, this.internalNodes + i, this.dataNodes + i))
|
|
return true;
|
|
return false;
|
|
}
|
|
;
|
|
_.getPostCount_0 = function getPostCount_55(){
|
|
return 2 + this.addressBits + this.dataBits;
|
|
}
|
|
;
|
|
_.getVoltageSourceCount = function getVoltageSourceCount_43(){
|
|
return this.dataBits;
|
|
}
|
|
;
|
|
_.nonLinear_0 = function nonLinear_19(){
|
|
return true;
|
|
}
|
|
;
|
|
_.reset_0 = function reset_38(){
|
|
$reset_0(this);
|
|
(this.flags & 2) != 0 && !!this.initialMap && (this.map_0 = new HashMap_1(this.initialMap));
|
|
}
|
|
;
|
|
_.setChipEditValue = function setChipEditValue_20(n, ei){
|
|
var oldFlags, reloadIdx;
|
|
if (n == 0) {
|
|
if (ei.value_0 >= 2 && ei.value_0 <= 16) {
|
|
this.addressBits = round_int(ei.value_0);
|
|
this.setupPins();
|
|
$setPoints_0(this);
|
|
}
|
|
else
|
|
ei.error = 'must be between 2 and 16';
|
|
}
|
|
if (n == 1) {
|
|
if (ei.value_0 >= 2 && ei.value_0 <= 16) {
|
|
this.dataBits = round_int(ei.value_0);
|
|
this.setupPins();
|
|
$setPoints_0(this);
|
|
}
|
|
else
|
|
ei.error = 'must be between 2 and 16';
|
|
}
|
|
if (n == 2) {
|
|
$parseContentsString(this, $getText(ei.textArea));
|
|
(this.flags & 2) != 0 && (this.initialMap = new HashMap_1(this.map_0));
|
|
}
|
|
if (n == 3) {
|
|
oldFlags = this.flags;
|
|
!!this.editTextArea && $parseContentsString(this, $getText(this.editTextArea));
|
|
this.flags = $changeFlag(ei, this.flags, 4);
|
|
if (this.flags != oldFlags) {
|
|
contentsOverride = $contentsToString(this);
|
|
ei.newDialog = true;
|
|
}
|
|
}
|
|
reloadIdx = isSupported_1()?5:4;
|
|
if (n == reloadIdx) {
|
|
this.flags = $changeFlag(ei, this.flags, 2);
|
|
(this.flags & 2) != 0?(this.initialMap = new HashMap_1(this.map_0)):(this.initialMap = null);
|
|
}
|
|
}
|
|
;
|
|
_.setVoltageSource = function setVoltageSource_14(j, vs){
|
|
$setVoltageSource(this, j, vs);
|
|
$setNodes(vs, ground, this.nodes[this.internalNodes + j]);
|
|
}
|
|
;
|
|
_.setupPins = function setupPins_24(){
|
|
var addrY, dataY;
|
|
this.sizeX = 2;
|
|
addrY = this.bitOrder == 2?1:this.addressBits;
|
|
dataY = this.bitOrder == 2?1:this.dataBits;
|
|
this.sizeY = (addrY > dataY?addrY:dataY) + 1;
|
|
this.bits = this.addressBits;
|
|
this.pins = initUnidimensionalArray(Lcom_lushprojects_circuitjs1_client_ChipElm$Pin_2_classLit, $intern_3, 9, this.getPostCount_0(), 0, 1);
|
|
this.pins[0] = new ChipElm$Pin(this, 0, 2, 'WE');
|
|
this.pins[0].lineOver = true;
|
|
this.pins[1] = new ChipElm$Pin(this, 0, 3, 'OE');
|
|
this.pins[1].lineOver = true;
|
|
this.addressNodes = 2;
|
|
this.dataNodes = 2 + this.addressBits;
|
|
this.internalNodes = 2 + this.addressBits + this.dataBits;
|
|
$makeBitPins(this, this.addressBits, this.sizeY - addrY, 2, this.addressNodes, 'A', false, false, true);
|
|
$makeBitPins(this, this.dataBits, this.sizeY - dataY, 3, this.dataNodes, 'D', true, false, true);
|
|
$allocNodes(this);
|
|
}
|
|
;
|
|
_.stamp = function stamp_51(){
|
|
var i, p;
|
|
for (i = 0; i != this.dataBits; i++) {
|
|
p = this.pins[i + this.dataNodes];
|
|
$stampVoltageSource(ground, this.nodes[this.internalNodes + i], p.voltSource);
|
|
}
|
|
}
|
|
;
|
|
_.stepFinished = function stepFinished_19(){
|
|
var data_0, i, writeEnabled;
|
|
data_0 = 0;
|
|
writeEnabled = this.volts[0] < this.highVoltage / 2;
|
|
if (!writeEnabled)
|
|
return;
|
|
for (i = 0; i != this.dataBits; i++) {
|
|
data_0 |= this.volts[this.dataNodes + i] > this.highVoltage / 2?1 << this.dataBits - 1 - i:0;
|
|
}
|
|
$put_0(this.map_0, valueOf_0(this.address), valueOf_0(data_0));
|
|
}
|
|
;
|
|
_.undumpXml = function undumpXml_68(xml){
|
|
$undumpXml_0(this, xml);
|
|
this.addressBits = $parseIntAttr(xml, 'ab', this.addressBits);
|
|
this.dataBits = $parseIntAttr(xml, 'db', this.dataBits);
|
|
this.map_0 = new HashMap;
|
|
try {
|
|
$parseContentsString(this, $parseContents(xml));
|
|
}
|
|
catch ($e0) {
|
|
$e0 = toJava($e0);
|
|
if (!instanceOf($e0, 13))
|
|
throw toJs($e0);
|
|
}
|
|
this.setupPins();
|
|
}
|
|
;
|
|
_.address = 0;
|
|
_.addressBits = 0;
|
|
_.addressNodes = 0;
|
|
_.dataBits = 0;
|
|
_.dataNodes = 0;
|
|
_.internalNodes = 0;
|
|
var contentsOverride = null, fileNameOverride = null;
|
|
var Lcom_lushprojects_circuitjs1_client_SRAMElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'SRAMElm', 267);
|
|
function ROMElm(xx, yy){
|
|
$clinit_ChipElm();
|
|
SRAMElm.call(this, xx, yy);
|
|
}
|
|
|
|
function ROMElm_0(xa, ya, xb, yb, f, st){
|
|
$clinit_ChipElm();
|
|
SRAMElm_0.call(this, xa, ya, xb, yb, f, st);
|
|
}
|
|
|
|
defineClass(375, 267, $intern_85, ROMElm, ROMElm_0);
|
|
_.doStep = function doStep_39(){
|
|
var data_0, dataObj, i, outputEnabled, p;
|
|
outputEnabled = this.volts[0] < this.highVoltage / 2;
|
|
this.address = 0;
|
|
for (i = 0; i != this.addressBits; i++)
|
|
this.address |= this.volts[this.addressNodes + i] > this.highVoltage / 2?1 << this.addressBits - 1 - i:0;
|
|
dataObj = $get_1(this.map_0, valueOf_0(this.address));
|
|
data_0 = !dataObj?0:dataObj.value_0;
|
|
for (i = 0; i != this.dataBits; i++) {
|
|
p = this.pins[i + this.dataNodes];
|
|
$updateVoltageSource(p.voltSource, (data_0 & 1 << this.dataBits - 1 - i) == 0?0:this.highVoltage);
|
|
outputEnabled?$stampResistor(this.nodes[this.internalNodes + i], this.nodes[this.dataNodes + i], 1):$stampResistor(this.nodes[this.dataNodes + i], ground, $intern_97);
|
|
}
|
|
}
|
|
;
|
|
_.getChipName = function getChipName_24(){
|
|
return 'ROM';
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_84(){
|
|
return 436;
|
|
}
|
|
;
|
|
_.getPostCount_0 = function getPostCount_56(){
|
|
return 1 + this.addressBits + this.dataBits;
|
|
}
|
|
;
|
|
_.setupPins = function setupPins_25(){
|
|
var addrY, dataY;
|
|
this.addressBits == 0 && (this.addressBits = this.dataBits = 4);
|
|
this.sizeX = 2;
|
|
addrY = this.bitOrder == 2?1:this.addressBits;
|
|
dataY = this.bitOrder == 2?1:this.dataBits;
|
|
this.sizeY = (addrY > dataY?addrY:dataY) + 1;
|
|
this.bits = this.addressBits;
|
|
this.pins = initUnidimensionalArray(Lcom_lushprojects_circuitjs1_client_ChipElm$Pin_2_classLit, $intern_3, 9, 1 + this.addressBits + this.dataBits, 0, 1);
|
|
this.pins[0] = new ChipElm$Pin(this, 0, 2, 'OE');
|
|
this.pins[0].lineOver = true;
|
|
this.addressNodes = 1;
|
|
this.dataNodes = 1 + this.addressBits;
|
|
this.internalNodes = 1 + this.addressBits + this.dataBits;
|
|
$makeBitPins(this, this.addressBits, this.sizeY - addrY, 2, this.addressNodes, 'A', false, false, true);
|
|
$makeBitPins(this, this.dataBits, this.sizeY - dataY, 3, this.dataNodes, 'D', true, false, true);
|
|
$allocNodes(this);
|
|
}
|
|
;
|
|
_.stepFinished = function stepFinished_20(){
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_ROMElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ROMElm', 375);
|
|
function $contains(this$static, X, Y){
|
|
var h, w, x_0, y_0;
|
|
w = this$static.width_0;
|
|
h = this$static.height_0;
|
|
if ((w | h) < 0) {
|
|
return false;
|
|
}
|
|
x_0 = this$static.x_0;
|
|
y_0 = this$static.y_0;
|
|
if (X < x_0 || Y < y_0) {
|
|
return false;
|
|
}
|
|
w += x_0;
|
|
h += y_0;
|
|
return (w < x_0 || w > X) && (h < y_0 || h > Y);
|
|
}
|
|
|
|
function $contains_0(this$static, r){
|
|
return $contains(this$static, r.x_0, r.y_0) && $contains(this$static, r.x_0 + r.width_0, r.y_0 + r.height_0);
|
|
}
|
|
|
|
function $equals_0(this$static, obj){
|
|
var r;
|
|
if (instanceOf(obj, 55)) {
|
|
r = obj;
|
|
return this$static.x_0 == r.x_0 && this$static.y_0 == r.y_0 && this$static.width_0 == r.width_0 && this$static.height_0 == r.height_0;
|
|
}
|
|
return this$static === obj;
|
|
}
|
|
|
|
function $intersects(this$static, r){
|
|
var rh, rw, rx, ry, th, tw, tx, ty;
|
|
tw = this$static.width_0;
|
|
th = this$static.height_0;
|
|
rw = r.width_0;
|
|
rh = r.height_0;
|
|
if (rw <= 0 || rh <= 0 || tw <= 0 || th <= 0) {
|
|
return false;
|
|
}
|
|
tx = this$static.x_0;
|
|
ty = this$static.y_0;
|
|
rx = r.x_0;
|
|
ry = r.y_0;
|
|
rw += rx;
|
|
rh += ry;
|
|
tw += tx;
|
|
th += ty;
|
|
return (rw < rx || rw > tx) && (rh < ry || rh > ty) && (tw < tx || tw > rx) && (th < ty || th > ry);
|
|
}
|
|
|
|
function $setBounds(this$static, x_0, y_0, width_0, height){
|
|
this$static.x_0 = x_0;
|
|
this$static.y_0 = y_0;
|
|
this$static.width_0 = width_0;
|
|
this$static.height_0 = height;
|
|
}
|
|
|
|
function $translate_0(this$static, dx, dy){
|
|
this$static.x_0 += dx;
|
|
this$static.y_0 += dy;
|
|
}
|
|
|
|
function $union(this$static, r){
|
|
var rx1, rx2, ry1, ry2, tx1, tx2, ty1, ty2;
|
|
tx2 = this$static.width_0;
|
|
ty2 = this$static.height_0;
|
|
if (lt(or_0(tx2, ty2), 0)) {
|
|
return new Rectangle_2(r);
|
|
}
|
|
rx2 = r.width_0;
|
|
ry2 = r.height_0;
|
|
if (lt(or_0(rx2, ry2), 0)) {
|
|
return new Rectangle_2(this$static);
|
|
}
|
|
tx1 = this$static.x_0;
|
|
ty1 = this$static.y_0;
|
|
tx2 = add_2(tx2, tx1);
|
|
ty2 = add_2(ty2, ty1);
|
|
rx1 = r.x_0;
|
|
ry1 = r.y_0;
|
|
rx2 = add_2(rx2, rx1);
|
|
ry2 = add_2(ry2, ry1);
|
|
tx1 > rx1 && (tx1 = rx1);
|
|
ty1 > ry1 && (ty1 = ry1);
|
|
compare_0(tx2, rx2) < 0 && (tx2 = rx2);
|
|
compare_0(ty2, ry2) < 0 && (ty2 = ry2);
|
|
tx2 = sub_1(tx2, tx1);
|
|
ty2 = sub_1(ty2, ty1);
|
|
compare_0(tx2, $intern_0) > 0 && (tx2 = $intern_0);
|
|
compare_0(ty2, $intern_0) > 0 && (ty2 = $intern_0);
|
|
return new Rectangle_0(tx1, ty1, toInt_0(tx2), toInt_0(ty2));
|
|
}
|
|
|
|
function Rectangle(){
|
|
this.x_0 = 0;
|
|
this.y_0 = 0;
|
|
this.width_0 = 0;
|
|
this.height_0 = 0;
|
|
}
|
|
|
|
function Rectangle_0(x_0, y_0, width_0, height){
|
|
this.x_0 = x_0;
|
|
this.y_0 = y_0;
|
|
this.width_0 = width_0;
|
|
this.height_0 = height;
|
|
}
|
|
|
|
function Rectangle_1(pt){
|
|
this.x_0 = pt.x_0;
|
|
this.y_0 = pt.y_0;
|
|
this.width_0 = 0;
|
|
this.height_0 = 0;
|
|
}
|
|
|
|
function Rectangle_2(r){
|
|
Rectangle_0.call(this, r.x_0, r.y_0, r.width_0, r.height_0);
|
|
}
|
|
|
|
defineClass(55, 1, {55:1}, Rectangle, Rectangle_0, Rectangle_1, Rectangle_2);
|
|
_.equals_0 = function equals_10(obj){
|
|
return $equals_0(this, obj);
|
|
}
|
|
;
|
|
_.toString_0 = function toString_22(){
|
|
return 'Rect(' + this.x_0 + ',' + this.y_0 + ',' + this.width_0 + ',' + this.height_0 + ')';
|
|
}
|
|
;
|
|
_.height_0 = 0;
|
|
_.width_0 = 0;
|
|
_.x_0 = 0;
|
|
_.y_0 = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_Rectangle_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'Rectangle', 55);
|
|
function $$init_17(this$static){
|
|
this$static.outline = $newPointArray(4);
|
|
}
|
|
|
|
function $setPoints_20(this$static){
|
|
var boxWScale;
|
|
$setPoints(this$static);
|
|
$setupPoles(this$static);
|
|
$allocNodes(this$static);
|
|
this$static.coilPosts = $newPointArray(2);
|
|
this$static.coilLeads = $newPointArray(2);
|
|
this$static.coilPosts[0] = this$static.point1;
|
|
this$static.coilPosts[1] = this$static.point2;
|
|
boxWScale = $wnd.Math.min(0.4, 12 / this$static.dn);
|
|
$interpPoint_1(this$static.point1, this$static.point2, this$static.coilLeads[0], 0.5 - boxWScale);
|
|
$interpPoint_1(this$static.point1, this$static.point2, this$static.coilLeads[1], 0.5 + boxWScale);
|
|
$interpPoint_2(this$static.point1, this$static.point2, this$static.outline[0], 0.5 - boxWScale, -32 * this$static.dsign);
|
|
$interpPoint_2(this$static.point1, this$static.point2, this$static.outline[1], 0.5 + boxWScale, -32 * this$static.dsign);
|
|
$interpPoint_2(this$static.point1, this$static.point2, this$static.outline[3], 0.5 - boxWScale, 32 * this$static.dsign);
|
|
$interpPoint_2(this$static.point1, this$static.point2, this$static.outline[2], 0.5 + boxWScale, 32 * this$static.dsign);
|
|
this$static.currentOffset1 = distance(this$static.coilPosts[0], this$static.coilLeads[0]);
|
|
this$static.currentOffset2 = this$static.currentOffset1 + distance(this$static.coilLeads[0], this$static.coilLeads[1]);
|
|
this$static.extraPoints = $newPointArray(4);
|
|
if (isLatchingType(this$static.type_0)) {
|
|
$interpPoint_2(this$static.coilLeads[0], this$static.coilLeads[1], this$static.extraPoints[0], 0.3, 8);
|
|
$interpPoint_2(this$static.coilLeads[0], this$static.coilLeads[1], this$static.extraPoints[1], 0.3, 0);
|
|
$interpPoint_2(this$static.coilLeads[0], this$static.coilLeads[1], this$static.extraPoints[2], 0.7, 0);
|
|
$interpPoint_2(this$static.coilLeads[0], this$static.coilLeads[1], this$static.extraPoints[3], 0.7, -8);
|
|
}
|
|
else {
|
|
this$static.extraPoints[0] = this$static.outline[0];
|
|
this$static.extraPoints[3] = this$static.outline[1];
|
|
$interpPoint_2(this$static.coilLeads[0], this$static.coilLeads[1], this$static.extraPoints[1], 0, -20);
|
|
$interpPoint_2(this$static.coilLeads[0], this$static.coilLeads[1], this$static.extraPoints[2], 1, -20);
|
|
}
|
|
}
|
|
|
|
function $setSwitchPositions_0(this$static, position){
|
|
var i, o, s2;
|
|
for (i = 0; i != this$static.elmList.arrayList.array.length; i++) {
|
|
o = $elementAt(this$static.elmList, i);
|
|
if (instanceOf(o, 225)) {
|
|
s2 = o;
|
|
$equals_1(s2.label_0, this$static.label_0) && $setPosition_1(s2, position, this$static.type_0);
|
|
}
|
|
}
|
|
}
|
|
|
|
function $setupPoles(this$static){
|
|
this$static.nCoil1 = 0;
|
|
this$static.nCoil2 = this$static.nCoil1 + 1;
|
|
this$static.nCoil3 = this$static.nCoil1 + 2;
|
|
}
|
|
|
|
function $toggleSwitchPositions(this$static){
|
|
var i, o, s2;
|
|
for (i = 0; i != this$static.elmList.arrayList.array.length; i++) {
|
|
o = $elementAt(this$static.elmList, i);
|
|
if (instanceOf(o, 225)) {
|
|
s2 = o;
|
|
$equals_1(s2.label_0, this$static.label_0) && $setPosition_1(s2, 1 - this$static.switchPosition, this$static.type_0);
|
|
}
|
|
}
|
|
}
|
|
|
|
function RelayCoilElm(xx, yy){
|
|
CircuitElm.call(this, xx, yy);
|
|
$$init_17(this);
|
|
this.ind = new Inductor(sim_0);
|
|
this.inductance = 0.2;
|
|
$setup_1(this.ind, this.inductance, 0, 2);
|
|
this.noDiagonal = true;
|
|
this.onCurrent = $intern_36;
|
|
this.offCurrent = 0.015;
|
|
this.state = 0;
|
|
this.label_0 = 'label';
|
|
this.coilR = 20;
|
|
this.switchingTime = $intern_129;
|
|
this.coilCurrent = this.coilCurCount = 0;
|
|
$setupPoles(this);
|
|
}
|
|
|
|
function RelayCoilElm_0(xa, ya, xb, yb, f, st){
|
|
CircuitElm_0.call(this, xa, ya, xb, yb, f);
|
|
$$init_17(this);
|
|
this.label_0 = unescape_0($nextToken(st));
|
|
this.inductance = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.coilCurrent = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.onCurrent = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.coilR = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.offCurrent = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.switchingTime = __parseAndValidateDouble($nextToken(st));
|
|
this.type_0 = __parseAndValidateInt($nextToken(st), 10);
|
|
this.state = __parseAndValidateInt($nextToken(st), 10);
|
|
this.switchPosition = __parseAndValidateInt($nextToken(st), 10);
|
|
this.noDiagonal = true;
|
|
this.ind = new Inductor(sim_0);
|
|
$setup_1(this.ind, this.inductance, this.coilCurrent, 2);
|
|
$setupPoles(this);
|
|
$allocNodes(this);
|
|
}
|
|
|
|
function isLatchingType(t){
|
|
return t == 3 || t == 4 || t == 5;
|
|
}
|
|
|
|
defineClass(398, 8, $intern_85, RelayCoilElm, RelayCoilElm_0);
|
|
_.calculateCurrent = function calculateCurrent_26(){
|
|
var voltdiff;
|
|
voltdiff = this.volts[this.nCoil1] - this.volts[this.nCoil3];
|
|
this.coilCurrent = $calculateCurrent_1(this.ind, voltdiff);
|
|
}
|
|
;
|
|
_.doStep = function doStep_40(){
|
|
$doStep_1(this.ind);
|
|
}
|
|
;
|
|
_.draw = function draw_62(g){
|
|
var i;
|
|
for (i = 0; i != 2; i++) {
|
|
$setVoltageColor(this, g, this.volts[this.nCoil1 + i]);
|
|
drawThickLine_0(g, this.coilLeads[i], this.coilPosts[i], 3);
|
|
}
|
|
$setPowerColor(this, g, this.coilCurrent * (this.volts[this.nCoil1] - this.volts[this.nCoil2]));
|
|
$setColor_0(g, mouseElmRef == this || this.selected_0 || $containsKey(app_0.mouse.scopePlotRoles, this) || instanceOf(mouseElmRef, 21) && $getElm_0(mouseElmRef.elmScope) == this || $isOnHighlightedNet(this)?selectColor_0:lightGrayColor);
|
|
drawThickLine_0(g, this.outline[0], this.outline[1], 3);
|
|
drawThickLine_0(g, this.outline[1], this.outline[2], 3);
|
|
drawThickLine_0(g, this.outline[2], this.outline[3], 3);
|
|
drawThickLine_0(g, this.outline[3], this.outline[0], 3);
|
|
if (isLatchingType(this.type_0)) {
|
|
for (i = 0; i != 3; i++)
|
|
drawThickLine_0(g, this.extraPoints[i], this.extraPoints[i + 1], 3);
|
|
if (this.type_0 == 4 || this.type_0 == 5) {
|
|
$setColor_0(g, mouseElmRef == this || this.selected_0 || $containsKey(app_0.mouse.scopePlotRoles, this) || instanceOf(mouseElmRef, 21) && $getElm_0(mouseElmRef.elmScope) == this || $isOnHighlightedNet(this)?selectColor_0:whiteColor);
|
|
$drawString(g, this.type_0 == 4?'S':'R', this.extraPoints[0].x_0 + 3, this.extraPoints[0].y_0 + 9);
|
|
}
|
|
}
|
|
else if (this.type_0 == 1) {
|
|
drawThickLine_0(g, this.extraPoints[1], this.extraPoints[2], 3);
|
|
drawThickLine_0(g, this.extraPoints[0], this.extraPoints[2], 3);
|
|
drawThickLine_0(g, this.extraPoints[1], this.extraPoints[3], 3);
|
|
}
|
|
else
|
|
this.type_0 == 2 && $fillRect_0(g, this.extraPoints[0].x_0, this.extraPoints[0].y_0, this.extraPoints[2].x_0 - this.extraPoints[0].x_0, this.extraPoints[2].y_0 - this.extraPoints[0].y_0);
|
|
$setColor_0(g, mouseElmRef == this || this.selected_0 || $containsKey(app_0.mouse.scopePlotRoles, this) || instanceOf(mouseElmRef, 21) && $getElm_0(mouseElmRef.elmScope) == this || $isOnHighlightedNet(this)?selectColor_0:whiteColor);
|
|
if (this.x_0 == this.x2)
|
|
$drawString(g, this.label_0, this.outline[2].x_0 + 10, ((this.y_0 + this.y2) / 2 | 0) + 4);
|
|
else {
|
|
g.context.save();
|
|
g.savedFontSize = g.currentFontSize;
|
|
g.context.textAlign = 'center';
|
|
$drawString(g, this.label_0, (this.x_0 + this.x2) / 2 | 0, this.outline[1].y_0 + 15);
|
|
g.context.restore();
|
|
g.currentFontSize = g.savedFontSize;
|
|
}
|
|
this.coilCurCount = $updateDotCount(this.coilCurrent, this.coilCurCount);
|
|
if (this.coilCurCount != 0) {
|
|
$drawDots(g, this.coilPosts[0], this.coilLeads[0], this.coilCurCount);
|
|
$drawDots(g, this.coilLeads[1], this.coilPosts[1], $addCurCount(this.coilCurCount, this.currentOffset2));
|
|
}
|
|
$drawPosts(this, g);
|
|
$setBbox_0(this, this.outline[0], this.outline[2], 0);
|
|
$adjustBbox_0(this, this.coilPosts[0], this.coilPosts[1]);
|
|
}
|
|
;
|
|
_.dumpXml = function dumpXml_66(doc, elem){
|
|
dumpAttr_1(elem, 'x', this.x_0 + ' ' + this.y_0 + ' ' + this.x2 + ' ' + this.y2);
|
|
dumpAttr_0(elem, 'f', this.flags);
|
|
dumpAttr_1(elem, 'lb', this.label_0);
|
|
dumpAttr(elem, 'in', this.inductance);
|
|
dumpAttr(elem, 'oc', this.onCurrent);
|
|
dumpAttr(elem, 'cr', this.coilR);
|
|
dumpAttr(elem, 'ofc', this.offCurrent);
|
|
dumpAttr(elem, 'swt', this.switchingTime);
|
|
dumpAttr_0(elem, 'tp', this.type_0);
|
|
}
|
|
;
|
|
_.dumpXmlState = function dumpXmlState_12(doc, elem){
|
|
dumpAttr(elem, 'ci', this.coilCurrent);
|
|
dumpAttr_0(elem, 'st', this.state);
|
|
dumpAttr_0(elem, 'sp', this.switchPosition);
|
|
}
|
|
;
|
|
_.getConnection = function getConnection_31(n1, n2){
|
|
return true;
|
|
}
|
|
;
|
|
_.getCurrentIntoNode = function getCurrentIntoNode_24(n){
|
|
if (n == 0)
|
|
return -this.coilCurrent;
|
|
return this.coilCurrent;
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_85(){
|
|
return 425;
|
|
}
|
|
;
|
|
_.getEditInfo = function getEditInfo_60(n){
|
|
var ei;
|
|
if (n == 0) {
|
|
ei = new EditInfo('Type', 0);
|
|
ei.choice = new Choice;
|
|
$addItem(ei.choice, LS('Normal'));
|
|
$addItem(ei.choice, LS('On Delay'));
|
|
$addItem(ei.choice, LS('Off Delay'));
|
|
$addItem(ei.choice, LS('Latching'));
|
|
$addItem(ei.choice, LS('Latching (Set Coil)'));
|
|
$addItem(ei.choice, LS('Latching (Reset Coil)'));
|
|
$select(ei.choice, this.type_0);
|
|
return ei;
|
|
}
|
|
if (n == 1)
|
|
return $setPositive(new EditInfo_0('Inductance (H)', this.inductance, 0, 0));
|
|
if (n == 2)
|
|
return $setPositive(new EditInfo_0('On Current (A)', this.onCurrent, 0, 0));
|
|
if (n == 3)
|
|
return $setPositive(new EditInfo_0('Off Current (A)', this.offCurrent, 0, 0));
|
|
if (n == 4)
|
|
return $setPositive(new EditInfo_0('Coil Resistance (ohms)', this.coilR, 0, 0));
|
|
if (n == 5)
|
|
return $setPositive(new EditInfo_0('Switching Time (s)', this.switchingTime, 0, 0));
|
|
if (n == 6)
|
|
return new EditInfo_1('Label (for linking)', this.label_0);
|
|
return null;
|
|
}
|
|
;
|
|
_.getElmType = function getElmType_18(){
|
|
return 'relay';
|
|
}
|
|
;
|
|
_.getInfo_0 = function getInfo_69(arr){
|
|
var ln;
|
|
arr[0] = LS('relay');
|
|
this.i_position == 0?(arr[0] += ' (' + LS('off') + ')'):this.i_position == 1 && (arr[0] += ' (' + LS('on') + ')');
|
|
ln = 1;
|
|
arr[ln++] = LS('coil I') + ' = ' + getUnitText($wnd.Math.abs(this.coilCurrent), 'A', false);
|
|
arr[ln++] = LS('coil Vd') + ' = ' + getUnitText($wnd.Math.abs(this.volts[this.nCoil1] - this.volts[this.nCoil2]), 'V', false);
|
|
}
|
|
;
|
|
_.getInternalNodeCount = function getInternalNodeCount_11(){
|
|
return 1;
|
|
}
|
|
;
|
|
_.getPost = function getPost_18(n){
|
|
return this.coilPosts[n];
|
|
}
|
|
;
|
|
_.getPostCount_0 = function getPostCount_57(){
|
|
return 2;
|
|
}
|
|
;
|
|
_.reset_0 = function reset_39(){
|
|
$reset(this);
|
|
$reset_5(this.ind);
|
|
this.coilCurrent = this.coilCurCount = 0;
|
|
this.i_position = 0;
|
|
this.avgCurrent = 0;
|
|
}
|
|
;
|
|
_.setEditValue = function setEditValue_60(n, ei){
|
|
if (n == 0) {
|
|
this.type_0 = $getElement(ei.choice).selectedIndex;
|
|
$setPoints_20(this);
|
|
}
|
|
if (n == 1 && ei.value_0 > 0) {
|
|
this.inductance = ei.value_0;
|
|
$setup_1(this.ind, this.inductance, this.coilCurrent, 2);
|
|
}
|
|
n == 2 && ei.value_0 > 0 && (this.onCurrent = ei.value_0);
|
|
n == 3 && ei.value_0 > 0 && (this.offCurrent = ei.value_0);
|
|
n == 4 && ei.value_0 > 0 && (this.coilR = ei.value_0);
|
|
n == 5 && ei.value_0 > 0 && (this.switchingTime = ei.value_0);
|
|
n == 6 && (this.label_0 = $getText(ei.textf));
|
|
}
|
|
;
|
|
_.setParentList = function setParentList_2(list){
|
|
this.elmList = list;
|
|
}
|
|
;
|
|
_.setPoints = function setPoints_57(){
|
|
$setPoints_20(this);
|
|
}
|
|
;
|
|
_.stamp = function stamp_52(){
|
|
$stamp_2(this.ind, this.nodes[this.nCoil1], this.nodes[this.nCoil3]);
|
|
$stampResistor(this.nodes[this.nCoil3], this.nodes[this.nCoil2], this.coilR);
|
|
if (this.type_0 == 1) {
|
|
this.switchingTimeOn = this.switchingTime;
|
|
this.switchingTimeOff = 0;
|
|
}
|
|
else if (this.type_0 == 2) {
|
|
this.switchingTimeOff = this.switchingTime;
|
|
this.switchingTimeOn = 0;
|
|
}
|
|
else {
|
|
this.switchingTimeOff = this.switchingTimeOn = this.switchingTime;
|
|
}
|
|
this.type_0 != 4 && this.type_0 != 5 && $toggleSwitchPositions(this);
|
|
}
|
|
;
|
|
_.startIteration = function startIteration_16(){
|
|
var a, absCurrent, oldSwitchPosition;
|
|
$startIteration_0(this.ind, this.volts[this.nCoil1] - this.volts[this.nCoil3]);
|
|
absCurrent = $wnd.Math.abs(this.coilCurrent);
|
|
a = $wnd.Math.exp(-sim_0.timeStep * $intern_22);
|
|
this.avgCurrent = a * this.avgCurrent + (1 - a) * absCurrent;
|
|
oldSwitchPosition = this.switchPosition;
|
|
if (this.state == 0) {
|
|
if (this.avgCurrent > this.onCurrent) {
|
|
this.lastTransition = sim_0.t;
|
|
this.state = 1;
|
|
}
|
|
}
|
|
else if (this.state == 1) {
|
|
if (this.avgCurrent < this.offCurrent)
|
|
this.state = 0;
|
|
else if (sim_0.t - this.lastTransition > this.switchingTimeOn) {
|
|
this.state = 2;
|
|
if (this.type_0 == 3) {
|
|
this.switchPosition = 1 - this.switchPosition;
|
|
}
|
|
else if (this.type_0 == 4) {
|
|
this.switchPosition = 1;
|
|
$setSwitchPositions_0(this, 0);
|
|
}
|
|
else if (this.type_0 == 5) {
|
|
this.switchPosition = 0;
|
|
$setSwitchPositions_0(this, 1);
|
|
}
|
|
else {
|
|
this.switchPosition = 1;
|
|
}
|
|
}
|
|
}
|
|
else if (this.state == 2) {
|
|
if (this.avgCurrent < this.offCurrent) {
|
|
this.lastTransition = sim_0.t;
|
|
this.state = 3;
|
|
}
|
|
}
|
|
else if (this.state == 3) {
|
|
if (this.avgCurrent > this.onCurrent)
|
|
this.state = 2;
|
|
else if (sim_0.t - this.lastTransition > this.switchingTimeOff) {
|
|
this.state = 0;
|
|
isLatchingType(this.type_0) || (this.switchPosition = 0);
|
|
}
|
|
}
|
|
this.type_0 != 4 && this.type_0 != 5 && oldSwitchPosition != this.switchPosition && $toggleSwitchPositions(this);
|
|
}
|
|
;
|
|
_.undumpXml = function undumpXml_69(xml){
|
|
this.flags = $parseIntAttr(xml, 'f', this.flags);
|
|
this.label_0 = $parseStringAttr(xml, 'lb', this.label_0);
|
|
this.inductance = $parseDoubleAttr(xml, 'in', this.inductance);
|
|
this.onCurrent = $parseDoubleAttr(xml, 'oc', this.onCurrent);
|
|
this.coilR = $parseDoubleAttr(xml, 'cr', this.coilR);
|
|
this.offCurrent = $parseDoubleAttr(xml, 'ofc', this.offCurrent);
|
|
this.switchingTime = $parseDoubleAttr(xml, 'swt', this.switchingTime);
|
|
this.type_0 = $parseIntAttr(xml, 'tp', this.type_0);
|
|
this.coilCurrent = $parseDoubleAttr(xml, 'ci', this.coilCurrent);
|
|
this.state = $parseIntAttr(xml, 'st', this.state);
|
|
this.switchPosition = $parseIntAttr(xml, 'sp', this.switchPosition);
|
|
this.noDiagonal = true;
|
|
this.ind = new Inductor(sim_0);
|
|
$setup_1(this.ind, this.inductance, this.coilCurrent, 2);
|
|
$setupPoles(this);
|
|
$allocNodes(this);
|
|
}
|
|
;
|
|
_.avgCurrent = 0;
|
|
_.coilCurCount = 0;
|
|
_.coilCurrent = 0;
|
|
_.coilR = 0;
|
|
_.currentOffset1 = 0;
|
|
_.currentOffset2 = 0;
|
|
_.i_position = 0;
|
|
_.inductance = 0;
|
|
_.lastTransition = 0;
|
|
_.nCoil1 = 0;
|
|
_.nCoil2 = 0;
|
|
_.nCoil3 = 0;
|
|
_.offCurrent = 0;
|
|
_.onCurrent = 0;
|
|
_.state = 0;
|
|
_.switchPosition = 0;
|
|
_.switchingTime = 0;
|
|
_.switchingTimeOff = 0;
|
|
_.switchingTimeOn = 0;
|
|
_.type_0 = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_RelayCoilElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'RelayCoilElm', 398);
|
|
function $setPoints_21(this$static){
|
|
var ds, j;
|
|
$setPoints(this$static);
|
|
$allocNodes(this$static);
|
|
this$static.openhs = this$static.dsign * 16;
|
|
$calcLeads(this$static, 32);
|
|
this$static.swposts = initUnidimensionalArray(Lcom_lushprojects_circuitjs1_client_Point_2_classLit, $intern_78, 14, 3, 0, 1);
|
|
this$static.swpoles = initUnidimensionalArray(Lcom_lushprojects_circuitjs1_client_Point_2_classLit, $intern_78, 14, 3, 0, 1);
|
|
for (j = 0; j != 3; j++) {
|
|
this$static.swposts[j] = new Point_1;
|
|
this$static.swpoles[j] = new Point_1;
|
|
}
|
|
$interpPoint_2(this$static.lead1, this$static.lead2, this$static.swpoles[0], 0, 0);
|
|
$interpPoint_2(this$static.lead1, this$static.lead2, this$static.swpoles[1], 1, 0);
|
|
$interpPoint_2(this$static.lead1, this$static.lead2, this$static.swpoles[2], 1, this$static.openhs);
|
|
$interpPoint_2(this$static.point1, this$static.point2, this$static.swposts[0], 0, 0);
|
|
$interpPoint_2(this$static.point1, this$static.point2, this$static.swposts[1], 1, 0);
|
|
$interpPoint_2(this$static.point1, this$static.point2, this$static.swposts[2], 1, this$static.openhs);
|
|
this$static.ptSwitch = new Point_1;
|
|
if ((this$static.flags & 4) != 0) {
|
|
this$static.extraPoints = $newPointArray(5);
|
|
ds = 22 * this$static.dsign;
|
|
$interpPoint_2(this$static.lead1, this$static.lead2, this$static.extraPoints[2], 0.4375, ds);
|
|
$interpPoint_2(this$static.lead1, this$static.lead2, this$static.extraPoints[3], 0.5625, ds);
|
|
}
|
|
}
|
|
|
|
function $setPosition_1(this$static, i_position_, type_){
|
|
this$static.i_position = (this$static.flags & 2) != 0?1 - i_position_:i_position_;
|
|
this$static.type_0 = type_;
|
|
}
|
|
|
|
function RelayContactElm(xx, yy){
|
|
CircuitElm.call(this, xx, yy);
|
|
this.noDiagonal = true;
|
|
this.r_on = 0.05;
|
|
this.r_off = $intern_84;
|
|
this.label_0 = 'label';
|
|
this.flags |= 4;
|
|
}
|
|
|
|
function RelayContactElm_0(xa, ya, xb, yb, f, st){
|
|
CircuitElm_0.call(this, xa, ya, xb, yb, f);
|
|
this.label_0 = unescape_0($nextToken(st));
|
|
this.r_on = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.r_off = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
try {
|
|
this.i_position = __parseAndValidateInt($nextToken(st), 10);
|
|
}
|
|
catch ($e0) {
|
|
$e0 = toJava($e0);
|
|
if (!instanceOf($e0, 13))
|
|
throw toJs($e0);
|
|
}
|
|
this.noDiagonal = true;
|
|
$allocNodes(this);
|
|
}
|
|
|
|
defineClass(225, 8, {8:1, 10:1, 225:1}, RelayContactElm, RelayContactElm_0);
|
|
_.calculateCurrent = function calculateCurrent_27(){
|
|
this.i_position == 1?(this.switchCurrent = 0):(this.switchCurrent = (this.volts[0] - this.volts[1 + this.i_position]) / this.r_on);
|
|
}
|
|
;
|
|
_.doStep = function doStep_41(){
|
|
$stampResistor(this.nodes[0], this.nodes[1], this.i_position == 0?this.r_on:this.r_off);
|
|
}
|
|
;
|
|
_.draw = function draw_63(g){
|
|
var ang, ds, i;
|
|
for (i = 0; i != 2; i++) {
|
|
$setVoltageColor(this, g, this.volts[i]);
|
|
drawThickLine_0(g, this.swposts[i], this.swpoles[i], 3);
|
|
}
|
|
$interpPoint_1(this.swpoles[1], this.swpoles[2], this.ptSwitch, this.i_position);
|
|
$setColor_0(g, ($clinit_Color() , lightGray));
|
|
drawThickLine_0(g, this.swpoles[0], this.ptSwitch, 3);
|
|
$setColor_0(g, mouseElmRef == this || this.selected_0 || $containsKey(app_0.mouse.scopePlotRoles, this) || instanceOf(mouseElmRef, 21) && $getElm_0(mouseElmRef.elmScope) == this || $isOnHighlightedNet(this)?selectColor_0:whiteColor);
|
|
if (this.x_0 == this.x2)
|
|
$drawString(g, this.label_0, this.x_0 + 10, this.swpoles[this.y_0 < this.y2?0:1].y_0 - 5);
|
|
else {
|
|
g.context.save();
|
|
g.savedFontSize = g.currentFontSize;
|
|
g.context.textAlign = 'center';
|
|
$drawString(g, this.label_0, (this.x_0 + this.x2) / 2 | 0, this.y_0 + 15);
|
|
g.context.restore();
|
|
g.currentFontSize = g.savedFontSize;
|
|
}
|
|
if ((this.flags & 4) != 0 && (this.type_0 == 1 || this.type_0 == 2)) {
|
|
$setColor_0(g, lightGray);
|
|
$interpPoint_2(this.lead1, this.lead2, this.extraPoints[0], 0.4375, this.i_position == 1?this.openhs / 2 | 0:0);
|
|
$interpPoint_2(this.lead1, this.lead2, this.extraPoints[1], 0.5625, this.i_position == 1?this.openhs / 2 | 0:0);
|
|
$drawLine_0(g, this.extraPoints[0], this.extraPoints[2]);
|
|
$drawLine_0(g, this.extraPoints[1], this.extraPoints[3]);
|
|
g.context.beginPath();
|
|
ang = -$wnd.Math.atan2(-this.dy * this.dsign, this.dx * this.dsign);
|
|
ds = 22 * this.dsign;
|
|
if (this.type_0 == 2) {
|
|
ang += $intern_1;
|
|
$interpPoint_2(this.lead1, this.lead2, this.extraPoints[4], 0.5, ds + 6 * this.dsign);
|
|
}
|
|
else {
|
|
$interpPoint_2(this.lead1, this.lead2, this.extraPoints[4], 0.5, ds - 5 * this.dsign);
|
|
}
|
|
$arc_0(g.context, this.extraPoints[4].x_0, this.extraPoints[4].y_0, 6, -0.39269908169872414 + ang, 3.5342917352885173 + ang, true);
|
|
g.context.stroke();
|
|
}
|
|
this.switchCurCount = $updateDotCount(this.switchCurrent, this.switchCurCount);
|
|
$drawDots(g, this.swposts[0], this.swpoles[0], this.switchCurCount);
|
|
this.i_position == 0 && $drawDots(g, this.swpoles[this.i_position + 1], this.swposts[this.i_position + 1], this.switchCurCount);
|
|
$drawPosts(this, g);
|
|
$setBbox_0(this, this.point1, this.point2, this.openhs);
|
|
}
|
|
;
|
|
_.dumpXml = function dumpXml_67(doc, elem){
|
|
dumpAttr_1(elem, 'x', this.x_0 + ' ' + this.y_0 + ' ' + this.x2 + ' ' + this.y2);
|
|
dumpAttr_0(elem, 'f', this.flags);
|
|
dumpAttr_1(elem, 'lb', this.label_0);
|
|
dumpAttr(elem, 'ron', this.r_on);
|
|
dumpAttr(elem, 'roff', this.r_off);
|
|
dumpAttr_0(elem, 'ip', this.i_position);
|
|
}
|
|
;
|
|
_.getConnection = function getConnection_32(n1, n2){
|
|
return true;
|
|
}
|
|
;
|
|
_.getCurrentIntoNode = function getCurrentIntoNode_25(n){
|
|
if (n == 0)
|
|
return -this.switchCurrent;
|
|
if (n == 1 + this.i_position)
|
|
return this.switchCurrent;
|
|
return 0;
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_86(){
|
|
return 426;
|
|
}
|
|
;
|
|
_.getEditInfo = function getEditInfo_61(n){
|
|
if (n == 0)
|
|
return $setPositive(new EditInfo_0('On Resistance (ohms)', this.r_on, 0, 0));
|
|
if (n == 1)
|
|
return $setPositive(new EditInfo_0('Off Resistance (ohms)', this.r_off, 0, 0));
|
|
if (n == 2)
|
|
return new EditInfo_1('Label (for linking)', this.label_0);
|
|
if (n == 3)
|
|
return createCheckbox('Normally Closed', (this.flags & 2) != 0);
|
|
if (n == 4)
|
|
return createCheckbox('IEC Symbol', (this.flags & 4) != 0);
|
|
return null;
|
|
}
|
|
;
|
|
_.getElmType = function getElmType_19(){
|
|
return 'relay';
|
|
}
|
|
;
|
|
_.getInfo_0 = function getInfo_70(arr){
|
|
var ln;
|
|
arr[0] = LS('relay');
|
|
this.i_position == 0?(arr[0] += ' (' + LS('off') + ')'):this.i_position == 1 && (arr[0] += ' (' + LS('on') + ')');
|
|
ln = 1;
|
|
arr[ln++] = 'I = ' + getUnitText($wnd.Math.abs(this.switchCurrent), 'A', false);
|
|
}
|
|
;
|
|
_.getPost = function getPost_19(n){
|
|
return this.swposts[n];
|
|
}
|
|
;
|
|
_.getPostCount_0 = function getPostCount_58(){
|
|
return 2;
|
|
}
|
|
;
|
|
_.nonLinear_0 = function nonLinear_20(){
|
|
return true;
|
|
}
|
|
;
|
|
_.reset_0 = function reset_40(){
|
|
$reset(this);
|
|
this.switchCurrent = this.switchCurCount = 0;
|
|
this.i_position = 0;
|
|
}
|
|
;
|
|
_.setEditValue = function setEditValue_61(n, ei){
|
|
n == 0 && ei.value_0 > 0 && (this.r_on = ei.value_0);
|
|
n == 1 && ei.value_0 > 0 && (this.r_off = ei.value_0);
|
|
n == 2 && (this.label_0 = $getText(ei.textf));
|
|
n == 3 && (this.flags = $changeFlag(ei, this.flags, 2));
|
|
if (n == 4) {
|
|
this.flags = $changeFlag(ei, this.flags, 4);
|
|
$setPoints_21(this);
|
|
}
|
|
}
|
|
;
|
|
_.setPoints = function setPoints_58(){
|
|
$setPoints_21(this);
|
|
}
|
|
;
|
|
_.stamp = function stamp_53(){
|
|
}
|
|
;
|
|
_.undumpXml = function undumpXml_70(xml){
|
|
this.flags = $parseIntAttr(xml, 'f', this.flags);
|
|
this.label_0 = $parseStringAttr(xml, 'lb', this.label_0);
|
|
this.r_on = $parseDoubleAttr(xml, 'ron', this.r_on);
|
|
this.r_off = $parseDoubleAttr(xml, 'roff', this.r_off);
|
|
this.i_position = $parseIntAttr(xml, 'ip', this.i_position);
|
|
this.noDiagonal = true;
|
|
$allocNodes(this);
|
|
}
|
|
;
|
|
_.i_position = 0;
|
|
_.openhs = 0;
|
|
_.r_off = 0;
|
|
_.r_on = 0;
|
|
_.switchCurCount = 0;
|
|
_.switchCurrent = 0;
|
|
_.type_0 = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_RelayContactElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'RelayContactElm', 225);
|
|
function $$init_18(this$static){
|
|
this$static.outline = $newPointArray(4);
|
|
}
|
|
|
|
function $coilStyleFromFlags(f){
|
|
if ((f & 1) != 0)
|
|
return 2;
|
|
if ((f & 4) != 0)
|
|
return 0;
|
|
return 1;
|
|
}
|
|
|
|
function $newModelCreated_2(this$static, rm){
|
|
this$static.model = rm;
|
|
this$static.modelName = this$static.model.name_0;
|
|
lastModelName_4 = this$static.modelName;
|
|
$setup_1(this$static.ind, this$static.model.inductance, this$static.coilCurrent, 2);
|
|
$setPoints_22(this$static);
|
|
}
|
|
|
|
function $postUndump(this$static){
|
|
this$static.i_position == 1 && (this$static.onState = true);
|
|
this$static.i_position == 2 && (this$static.d_position = 0.5);
|
|
this$static.noDiagonal = true;
|
|
this$static.ind = new Inductor(sim_0);
|
|
$setup_1(this$static.ind, this$static.model.inductance, this$static.coilCurrent, 2);
|
|
$setupPoles_0(this$static);
|
|
$allocNodes(this$static);
|
|
}
|
|
|
|
function $setPoints_22(this$static){
|
|
var boxSize, boxWScale, i, j, x_0;
|
|
$setPoints(this$static);
|
|
$setupPoles_0(this$static);
|
|
$allocNodes(this$static);
|
|
this$static.dflip = (this$static.flags & 8) != 0?-this$static.dsign:this$static.dsign;
|
|
this$static.openhs = -this$static.dflip * 16;
|
|
$calcLeads(this$static, 32);
|
|
this$static.swposts = initMultidimensionalArray(Lcom_lushprojects_circuitjs1_client_Point_2_classLit, [$intern_3, $intern_78], [80, 14], 0, [!this$static.model?1:this$static.model.poleCount, 3], 2);
|
|
this$static.swpoles = initMultidimensionalArray(Lcom_lushprojects_circuitjs1_client_Point_2_classLit, [$intern_3, $intern_78], [80, 14], 0, [!this$static.model?1:this$static.model.poleCount, 3], 2);
|
|
for (i = 0; i != (!this$static.model?1:this$static.model.poleCount); i++) {
|
|
for (j = 0; j != 3; j++) {
|
|
this$static.swposts[i][j] = new Point_1;
|
|
this$static.swpoles[i][j] = new Point_1;
|
|
}
|
|
$interpPoint_2(this$static.lead1, this$static.lead2, this$static.swpoles[i][0], 0, -this$static.openhs * 3 * i);
|
|
$interpPoint_2(this$static.lead1, this$static.lead2, this$static.swpoles[i][1], 1, -this$static.openhs * 3 * i - this$static.openhs);
|
|
$interpPoint_2(this$static.lead1, this$static.lead2, this$static.swpoles[i][2], 1, -this$static.openhs * 3 * i + this$static.openhs);
|
|
$interpPoint_2(this$static.point1, this$static.point2, this$static.swposts[i][0], 0, -this$static.openhs * 3 * i);
|
|
$interpPoint_2(this$static.point1, this$static.point2, this$static.swposts[i][1], 1, -this$static.openhs * 3 * i - this$static.openhs);
|
|
$interpPoint_2(this$static.point1, this$static.point2, this$static.swposts[i][2], 1, -this$static.openhs * 3 * i + this$static.openhs);
|
|
}
|
|
this$static.coilPosts = $newPointArray(2);
|
|
this$static.coilLeads = $newPointArray(2);
|
|
this$static.ptSwitch = $newPointArray(!this$static.model?1:this$static.model.poleCount);
|
|
x_0 = this$static.model.coilStyle == 2?1:0;
|
|
if (this$static.model.coilStyle != 0) {
|
|
$interpPoint_2(this$static.point1, this$static.point2, this$static.coilPosts[0], x_0, this$static.openhs * 2);
|
|
$interpPoint_2(this$static.point1, this$static.point2, this$static.coilPosts[1], x_0, this$static.openhs * 3);
|
|
$interpPoint_2(this$static.point1, this$static.point2, this$static.coilLeads[0], 0.5, this$static.openhs * 2);
|
|
$interpPoint_2(this$static.point1, this$static.point2, this$static.coilLeads[1], 0.5, this$static.openhs * 3);
|
|
boxSize = 56;
|
|
}
|
|
else {
|
|
$interpPoint_2(this$static.point1, this$static.point2, this$static.coilPosts[0], 0, this$static.openhs * 2);
|
|
$interpPoint_2(this$static.point1, this$static.point2, this$static.coilPosts[1], 1, this$static.openhs * 2);
|
|
$interpPoint_2(this$static.point1, this$static.point2, this$static.coilLeads[0], 0.5 - 16 / this$static.dn, this$static.openhs * 2);
|
|
$interpPoint_2(this$static.point1, this$static.point2, this$static.coilLeads[1], 0.5 + 16 / this$static.dn, this$static.openhs * 2);
|
|
boxSize = 40;
|
|
}
|
|
this$static.lines = $newPointArray((!this$static.model?1:this$static.model.poleCount) * 2);
|
|
boxWScale = $wnd.Math.min(0.4, 25 / this$static.dn);
|
|
$interpPoint_2(this$static.point1, this$static.point2, this$static.outline[0], 0.5 - boxWScale, -boxSize * this$static.dflip);
|
|
$interpPoint_2(this$static.point1, this$static.point2, this$static.outline[1], 0.5 + boxWScale, -boxSize * this$static.dflip);
|
|
$interpPoint_2(this$static.point1, this$static.point2, this$static.outline[2], 0.5 + boxWScale, -(this$static.openhs * 3 * (!this$static.model?1:this$static.model.poleCount)) - 24 * this$static.dflip);
|
|
$interpPoint_2(this$static.point1, this$static.point2, this$static.outline[3], 0.5 - boxWScale, -(this$static.openhs * 3 * (!this$static.model?1:this$static.model.poleCount)) - 24 * this$static.dflip);
|
|
this$static.currentOffset1 = distance(this$static.coilPosts[0], this$static.coilLeads[0]);
|
|
this$static.currentOffset2 = this$static.currentOffset1 + distance(this$static.coilLeads[0], this$static.coilLeads[1]);
|
|
}
|
|
|
|
function $setupPoles_0(this$static){
|
|
this$static.nCoil1 = 3 * (!this$static.model?1:this$static.model.poleCount);
|
|
this$static.nCoil2 = this$static.nCoil1 + 1;
|
|
this$static.nCoil3 = this$static.nCoil1 + 2;
|
|
if (this$static.switchCurrent == null || this$static.switchCurrent.length != (!this$static.model?1:this$static.model.poleCount)) {
|
|
this$static.switchCurrent = initUnidimensionalArray(D_classLit, $intern_76, 7, !this$static.model?1:this$static.model.poleCount, 15, 1);
|
|
this$static.switchCurCount = initUnidimensionalArray(D_classLit, $intern_76, 7, !this$static.model?1:this$static.model.poleCount, 15, 1);
|
|
}
|
|
}
|
|
|
|
function RelayElm(xx, yy){
|
|
CircuitElm.call(this, xx, yy);
|
|
$$init_18(this);
|
|
this.modelName = lastModelName_4;
|
|
this.model = getModelWithName_3(this.modelName);
|
|
this.ind = new Inductor(sim_0);
|
|
$setup_1(this.ind, this.model.inductance, 0, 2);
|
|
this.noDiagonal = true;
|
|
this.coilCurrent = this.coilCurCount = 0;
|
|
$setupPoles_0(this);
|
|
}
|
|
|
|
function RelayElm_0(xa, ya, xb, yb, f, st){
|
|
var coilR, inductance, offCurrent, onCurrent, poleCount, r_off, r_on, switchingTime;
|
|
CircuitElm_0.call(this, xa, ya, xb, yb, f);
|
|
$$init_18(this);
|
|
poleCount = (new Integer_0($nextToken(st))).value_0;
|
|
inductance = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.coilCurrent = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
r_on = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
r_off = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
onCurrent = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
coilR = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
offCurrent = onCurrent;
|
|
switchingTime = 0;
|
|
try {
|
|
offCurrent = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
switchingTime = __parseAndValidateDouble($nextToken(st));
|
|
this.d_position = this.i_position = __parseAndValidateInt($nextToken(st), 10);
|
|
}
|
|
catch ($e0) {
|
|
$e0 = toJava($e0);
|
|
if (!instanceOf($e0, 13))
|
|
throw toJs($e0);
|
|
}
|
|
this.model = getModelWithParameters_1(inductance, r_on, r_off, onCurrent, offCurrent, coilR, switchingTime, $coilStyleFromFlags(f), (f & 2) != 0, (f & 16) != 0, poleCount);
|
|
this.modelName = this.model.name_0;
|
|
$postUndump(this);
|
|
}
|
|
|
|
defineClass(377, 8, $intern_85, RelayElm, RelayElm_0);
|
|
_.calculateCurrent = function calculateCurrent_28(){
|
|
var p, voltdiff;
|
|
voltdiff = this.volts[this.nCoil1] - this.volts[this.nCoil3];
|
|
this.coilCurrent = $calculateCurrent_1(this.ind, voltdiff);
|
|
for (p = 0; p != (!this.model?1:this.model.poleCount); p++) {
|
|
this.i_position == 2?(this.switchCurrent[p] = 0):(this.switchCurrent[p] = (this.volts[p * 3] - this.volts[1 + p * 3 + this.i_position]) / this.model.r_on);
|
|
}
|
|
}
|
|
;
|
|
_.doStep = function doStep_42(){
|
|
var p;
|
|
$doStep_1(this.ind);
|
|
for (p = 0; p != (!this.model?1:this.model.poleCount) * 3; p += 3) {
|
|
if (this.i_position == 0) {
|
|
$stampResistor(this.nodes[p], this.nodes[1 + p], this.model.r_on);
|
|
!!this.model && this.model.pulldown || $stampResistor(this.nodes[p], this.nodes[2 + p], this.model.r_off);
|
|
}
|
|
else if (this.i_position == 1) {
|
|
$stampResistor(this.nodes[p], this.nodes[2 + p], this.model.r_on);
|
|
!!this.model && this.model.pulldown || $stampResistor(this.nodes[p], this.nodes[1 + p], this.model.r_off);
|
|
}
|
|
else {
|
|
$stampResistor(this.nodes[p], this.nodes[1 + p], this.model.r_off);
|
|
$stampResistor(this.nodes[p], this.nodes[2 + p], this.model.r_off);
|
|
}
|
|
}
|
|
}
|
|
;
|
|
_.draw = function draw_64(g){
|
|
var i, off, p, po, x_0;
|
|
for (i = 0; i != 2; i++) {
|
|
$setVoltageColor(this, g, this.volts[this.nCoil1 + i]);
|
|
drawThickLine_0(g, this.coilLeads[i], this.coilPosts[i], 3);
|
|
}
|
|
x_0 = this.model.coilStyle == 2?1:0;
|
|
$setPowerColor(this, g, this.coilCurrent * (this.volts[this.nCoil1] - this.volts[this.nCoil2]));
|
|
$drawCoil(this, g, this.dflip * 6, this.coilLeads[x_0], this.coilLeads[1 - x_0], this.volts[this.nCoil1 + x_0], this.volts[this.nCoil2 - x_0]);
|
|
if (this.model.showBox) {
|
|
$setColor_0(g, mouseElmRef == this || this.selected_0 || $containsKey(app_0.mouse.scopePlotRoles, this) || instanceOf(mouseElmRef, 21) && $getElm_0(mouseElmRef.elmScope) == this || $isOnHighlightedNet(this)?selectColor_0:lightGrayColor);
|
|
drawThickLine_0(g, this.outline[0], this.outline[1], 3);
|
|
drawThickLine_0(g, this.outline[1], this.outline[2], 3);
|
|
drawThickLine_0(g, this.outline[2], this.outline[3], 3);
|
|
drawThickLine_0(g, this.outline[3], this.outline[0], 3);
|
|
}
|
|
$setColor_0(g, ($clinit_Color() , darkGray));
|
|
for (i = 0; i != (!this.model?1:this.model.poleCount); i++) {
|
|
if (i == 0) {
|
|
off = this.model.coilStyle == 0?4:0;
|
|
$interpPoint_2(this.point1, this.point2, this.lines[0], 0.5, this.openhs * 2 + 5 * this.dflip + off);
|
|
}
|
|
else
|
|
$interpPoint_2(this.point1, this.point2, this.lines[i * 2], 0.5, round_int(this.openhs * (-i * 3 + 3 - 0.5 + this.d_position)) + 5 * this.dflip);
|
|
$interpPoint_2(this.point1, this.point2, this.lines[i * 2 + 1], 0.5, round_int(this.openhs * (-i * 3 - 0.5 + this.d_position)) - 5 * this.dflip);
|
|
setLineDash(g.context, 4, 4);
|
|
$drawLine(g, this.lines[i * 2].x_0, this.lines[i * 2].y_0, this.lines[i * 2 + 1].x_0, this.lines[i * 2 + 1].y_0);
|
|
setLineDash(g.context, 0, 0);
|
|
}
|
|
for (p = 0; p != (!this.model?1:this.model.poleCount); p++) {
|
|
po = p * 3;
|
|
for (i = 0; i != 3; i++) {
|
|
$setVoltageColor(this, g, this.volts[po + i]);
|
|
drawThickLine_0(g, this.swposts[p][i], this.swpoles[p][i], 3);
|
|
}
|
|
$interpPoint_1(this.swpoles[p][1], this.swpoles[p][2], this.ptSwitch[p], this.d_position);
|
|
$setColor_0(g, lightGray);
|
|
drawThickLine_0(g, this.swpoles[p][0], this.ptSwitch[p], 3);
|
|
this.switchCurCount[p] = $updateDotCount(this.switchCurrent[p], this.switchCurCount[p]);
|
|
$drawDots(g, this.swposts[p][0], this.swpoles[p][0], this.switchCurCount[p]);
|
|
this.i_position != 2 && $drawDots(g, this.swpoles[p][this.i_position + 1], this.swposts[p][this.i_position + 1], this.switchCurCount[p]);
|
|
}
|
|
this.coilCurCount = $updateDotCount(this.coilCurrent, this.coilCurCount);
|
|
if (this.coilCurCount != 0) {
|
|
$drawDots(g, this.coilPosts[0], this.coilLeads[0], this.coilCurCount);
|
|
$drawDots(g, this.coilLeads[0], this.coilLeads[1], $addCurCount(this.coilCurCount, this.currentOffset1));
|
|
$drawDots(g, this.coilLeads[1], this.coilPosts[1], $addCurCount(this.coilCurCount, this.currentOffset2));
|
|
}
|
|
$drawPosts(this, g);
|
|
$setBbox_0(this, this.outline[0], this.outline[2], 0);
|
|
$adjustBbox_0(this, this.coilPosts[0], this.coilPosts[1]);
|
|
$adjustBbox_0(this, this.swposts[0][0], this.swposts[0][1]);
|
|
}
|
|
;
|
|
_.dumpXml = function dumpXml_68(doc, elem){
|
|
this.model.builtIn || this.model.dumped || $dumpXml_9(this.model, doc);
|
|
dumpAttr_1(elem, 'x', this.x_0 + ' ' + this.y_0 + ' ' + this.x2 + ' ' + this.y2);
|
|
dumpAttr_0(elem, 'f', this.flags);
|
|
dumpAttr_1(elem, 'mo', this.modelName);
|
|
}
|
|
;
|
|
_.dumpXmlModel = function dumpXmlModel_5(doc){
|
|
this.model.builtIn || this.model.dumped || $dumpXml_9(this.model, doc);
|
|
}
|
|
;
|
|
_.dumpXmlState = function dumpXmlState_13(doc, elem){
|
|
dumpAttr(elem, 'i', this.coilCurrent);
|
|
dumpAttr_0(elem, 'ip', this.i_position);
|
|
}
|
|
;
|
|
_.flipX = function flipX_14(c2, count){
|
|
this.dx == 0 && (this.flags ^= 8);
|
|
$flipX(this, c2);
|
|
}
|
|
;
|
|
_.flipXY = function flipXY_11(xmy, count){
|
|
this.flags ^= 8;
|
|
$flipXY(this, xmy);
|
|
}
|
|
;
|
|
_.flipY = function flipY_14(c2, count){
|
|
this.dy == 0 && (this.flags ^= 8);
|
|
$flipY(this, c2);
|
|
}
|
|
;
|
|
_.getConnection = function getConnection_33(n1, n2){
|
|
if ((n1 / 3 | 0) != (n2 / 3 | 0))
|
|
return false;
|
|
return true;
|
|
}
|
|
;
|
|
_.getCurrentIntoNode = function getCurrentIntoNode_26(n){
|
|
var k, p;
|
|
if (n < 3 * (!this.model?1:this.model.poleCount)) {
|
|
p = n / 3 | 0;
|
|
k = n % 3;
|
|
if (k == 0)
|
|
return -this.switchCurrent[p];
|
|
if (k == 1 + this.i_position)
|
|
return this.switchCurrent[p];
|
|
return 0;
|
|
}
|
|
if (n == 3 * (!this.model?1:this.model.poleCount))
|
|
return -this.coilCurrent;
|
|
return this.coilCurrent;
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_87(){
|
|
return 178;
|
|
}
|
|
;
|
|
_.getEditInfo = function getEditInfo_62(n){
|
|
var ei, i, rm;
|
|
if (n == 0) {
|
|
ei = new EditInfo_0('Model', 0, -1, -1);
|
|
this.models = getModelList_2();
|
|
ei.choice = new Choice;
|
|
for (i = 0; i != this.models.arrayList.array.length; i++) {
|
|
rm = $get_4(this.models, i);
|
|
$addItem(ei.choice, LS(rm.name_0));
|
|
rm == this.model && $select(ei.choice, i);
|
|
}
|
|
return ei;
|
|
}
|
|
if (n == 1) {
|
|
ei = new EditInfo_0('', 0, -1, -1);
|
|
ei.button_0 = new Button_1(LS('Create New Model'));
|
|
return ei;
|
|
}
|
|
if (n == 2) {
|
|
if (this.model.readOnly)
|
|
return null;
|
|
ei = new EditInfo_0('', 0, -1, -1);
|
|
ei.button_0 = new Button_1(LS('Edit Model'));
|
|
return ei;
|
|
}
|
|
return null;
|
|
}
|
|
;
|
|
_.getElmType = function getElmType_20(){
|
|
return 'relay';
|
|
}
|
|
;
|
|
_.getInfo_0 = function getInfo_71(arr){
|
|
var i, ln;
|
|
arr[0] = LS('relay');
|
|
arr[0] += ' (' + (this.model.switchingTime == 0?'old model':this.modelName) + ')';
|
|
arr[1] = this.i_position == 0?LS('off'):LS('on');
|
|
ln = 2;
|
|
for (i = 0; i != (!this.model?1:this.model.poleCount); i++)
|
|
arr[ln++] = 'I' + (i + 1) + ' = ' + getUnitText($wnd.Math.abs(this.switchCurrent[i]), 'A', false);
|
|
arr[ln++] = LS('coil I') + ' = ' + getUnitText($wnd.Math.abs(this.coilCurrent), 'A', false);
|
|
arr[ln++] = LS('coil Vd') + ' = ' + getUnitText($wnd.Math.abs(this.volts[this.nCoil1] - this.volts[this.nCoil2]), 'V', false);
|
|
}
|
|
;
|
|
_.getInternalNodeCount = function getInternalNodeCount_12(){
|
|
return 1;
|
|
}
|
|
;
|
|
_.getPost = function getPost_20(n){
|
|
if (n < 3 * (!this.model?1:this.model.poleCount))
|
|
return this.swposts[n / 3 | 0][n % 3];
|
|
return this.coilPosts[n - 3 * (!this.model?1:this.model.poleCount)];
|
|
}
|
|
;
|
|
_.getPostCount_0 = function getPostCount_59(){
|
|
return 2 + (!this.model?1:this.model.poleCount) * 3;
|
|
}
|
|
;
|
|
_.getShortcut = function getShortcut_37(){
|
|
return 82;
|
|
}
|
|
;
|
|
_.getXmlDumpType = function getXmlDumpType_22(){
|
|
return 'rl';
|
|
}
|
|
;
|
|
_.hasGroundConnection = function hasGroundConnection_18(n){
|
|
return !!this.model && this.model.pulldown && n < this.nCoil1;
|
|
}
|
|
;
|
|
_.nonLinear_0 = function nonLinear_21(){
|
|
return true;
|
|
}
|
|
;
|
|
_.reset_0 = function reset_41(){
|
|
var i;
|
|
$reset(this);
|
|
$resetTo(this.ind, 0);
|
|
this.coilCurrent = this.coilCurCount = 0;
|
|
for (i = 0; i != (!this.model?1:this.model.poleCount); i++)
|
|
this.switchCurrent[i] = this.switchCurCount[i] = 0;
|
|
this.d_position = this.i_position = 0;
|
|
}
|
|
;
|
|
_.setEditValue = function setEditValue_62(n, ei){
|
|
var editDialog, newModel;
|
|
if (n == 0) {
|
|
this.model = $get_4(this.models, $getElement(ei.choice).selectedIndex);
|
|
this.modelName = this.model.name_0;
|
|
lastModelName_4 = this.modelName;
|
|
$setup_1(this.ind, this.model.inductance, this.coilCurrent, 2);
|
|
$setPoints_22(this);
|
|
ei.newDialog = true;
|
|
return;
|
|
}
|
|
if (n == 1) {
|
|
newModel = new RelayModel_0(this.model);
|
|
editDialog = new EditRelayModelDialog(newModel, app_0, this);
|
|
!editDialog.resizeHandlerRegistration && (editDialog.resizeHandlerRegistration = addResizeHandler(new DialogBox$1(editDialog)));
|
|
$show(editDialog);
|
|
return;
|
|
}
|
|
if (n == 2) {
|
|
if (!this.model.readOnly) {
|
|
editDialog = new EditRelayModelDialog(this.model, app_0, null);
|
|
!editDialog.resizeHandlerRegistration && (editDialog.resizeHandlerRegistration = addResizeHandler(new DialogBox$1(editDialog)));
|
|
$show(editDialog);
|
|
}
|
|
return;
|
|
}
|
|
}
|
|
;
|
|
_.setPoints = function setPoints_59(){
|
|
$setPoints_22(this);
|
|
}
|
|
;
|
|
_.stamp = function stamp_54(){
|
|
var i;
|
|
$stamp_2(this.ind, this.nodes[this.nCoil1], this.nodes[this.nCoil3]);
|
|
$stampResistor(this.nodes[this.nCoil3], this.nodes[this.nCoil2], this.model.coilR);
|
|
for (i = 0; i != (!this.model?1:this.model.poleCount) * 3; i++)
|
|
;
|
|
if (!!this.model && this.model.pulldown) {
|
|
for (i = 0; i < (!this.model?1:this.model.poleCount); i++) {
|
|
$stampResistor(this.nodes[1 + i * 3], ground, this.model.r_off);
|
|
$stampResistor(this.nodes[2 + i * 3], ground, this.model.r_off);
|
|
}
|
|
}
|
|
}
|
|
;
|
|
_.startIteration = function startIteration_17(){
|
|
var absCurrent, pmult, c, p;
|
|
if (this.model.switchingTime == 0) {
|
|
$startIteration_0(this.ind, this.volts[this.nCoil1] - this.volts[this.nCoil3]);
|
|
pmult = $wnd.Math.sqrt(2.3);
|
|
c = this.model.onCurrent;
|
|
p = this.coilCurrent * pmult / c;
|
|
this.d_position = $wnd.Math.abs(p * p) - 1.3;
|
|
this.d_position < 0 && (this.d_position = 0);
|
|
this.d_position > 1 && (this.d_position = 1);
|
|
this.d_position < 0.1?(this.i_position = 0):this.d_position > 0.9?(this.i_position = 1):(this.i_position = 2);
|
|
return;
|
|
}
|
|
$startIteration_0(this.ind, this.volts[this.nCoil1] - this.volts[this.nCoil3]);
|
|
absCurrent = $wnd.Math.abs(this.coilCurrent);
|
|
if (this.onState) {
|
|
if (absCurrent < this.model.offCurrent) {
|
|
this.onState = false;
|
|
this.i_position = 2;
|
|
}
|
|
else {
|
|
this.d_position += sim_0.timeStep / this.model.switchingTime;
|
|
this.d_position >= 1 && (this.d_position = this.i_position = 1);
|
|
}
|
|
}
|
|
else {
|
|
if (absCurrent > this.model.onCurrent) {
|
|
this.onState = true;
|
|
this.i_position = 2;
|
|
}
|
|
else {
|
|
this.d_position -= sim_0.timeStep / this.model.switchingTime;
|
|
this.d_position <= 0 && (this.d_position = this.i_position = 0);
|
|
}
|
|
}
|
|
}
|
|
;
|
|
_.undumpXml = function undumpXml_71(xml){
|
|
var coilR, coilStyle, defaults, inductance, mo, offCurrent, onCurrent, poleCount, pulldown, r_off, r_on, showBox, switchingTime;
|
|
this.flags = $parseIntAttr(xml, 'f', this.flags);
|
|
mo = $parseStringAttr(xml, 'mo', null);
|
|
if (mo != null) {
|
|
this.modelName = mo;
|
|
this.model = getModelWithNameOrCopy_2(this.modelName, this.model);
|
|
this.modelName = this.model.name_0;
|
|
}
|
|
else if ($parseStringAttr(xml, 'ix', null) == null) {
|
|
poleCount = $parseIntAttr(xml, 'po', 1);
|
|
defaults = new RelayModel;
|
|
inductance = $parseDoubleAttr(xml, 'in', defaults.inductance);
|
|
r_on = $parseDoubleAttr(xml, 'ron', defaults.r_on);
|
|
r_off = $parseDoubleAttr(xml, 'roff', defaults.r_off);
|
|
onCurrent = $parseDoubleAttr(xml, 'on', defaults.onCurrent);
|
|
coilR = $parseDoubleAttr(xml, 'coR', defaults.coilR);
|
|
offCurrent = $parseDoubleAttr(xml, 'of', defaults.offCurrent);
|
|
switchingTime = $parseDoubleAttr(xml, 'sw', defaults.switchingTime);
|
|
coilStyle = $coilStyleFromFlags(this.flags);
|
|
showBox = (this.flags & 2) != 0;
|
|
pulldown = (this.flags & 16) != 0;
|
|
this.model = getModelWithParameters_1(inductance, r_on, r_off, onCurrent, offCurrent, coilR, switchingTime, coilStyle, showBox, pulldown, poleCount);
|
|
this.modelName = this.model.name_0;
|
|
}
|
|
this.coilCurrent = $parseDoubleAttr(xml, 'i', this.coilCurrent);
|
|
this.d_position = this.i_position = $parseIntAttr(xml, 'ip', this.i_position);
|
|
$postUndump(this);
|
|
}
|
|
;
|
|
_.updateModels = function updateModels_6(){
|
|
this.model = getModelWithNameOrCopy_2(this.modelName, this.model);
|
|
this.modelName = this.model.name_0;
|
|
$setup_1(this.ind, this.model.inductance, this.coilCurrent, 2);
|
|
$setPoints_22(this);
|
|
}
|
|
;
|
|
_.coilCurCount = 0;
|
|
_.coilCurrent = 0;
|
|
_.currentOffset1 = 0;
|
|
_.currentOffset2 = 0;
|
|
_.d_position = 0;
|
|
_.dflip = 0;
|
|
_.i_position = 0;
|
|
_.nCoil1 = 0;
|
|
_.nCoil2 = 0;
|
|
_.nCoil3 = 0;
|
|
_.onState = false;
|
|
_.openhs = 0;
|
|
var lastModelName_4 = 'default';
|
|
var Lcom_lushprojects_circuitjs1_client_RelayElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'RelayElm', 377);
|
|
function $$init_19(this$static){
|
|
}
|
|
|
|
function $dumpXml_9(this$static, doc){
|
|
var elem;
|
|
this$static.dumped = true;
|
|
elem = $createElement(doc, 'rlm');
|
|
dumpAttr_1(elem, 'nm', this$static.name_0);
|
|
dumpAttr_0(elem, 'f', this$static.flags);
|
|
dumpAttr(elem, 'in', this$static.inductance);
|
|
dumpAttr(elem, 'ron', this$static.r_on);
|
|
dumpAttr(elem, 'rof', this$static.r_off);
|
|
dumpAttr(elem, 'on', this$static.onCurrent);
|
|
dumpAttr(elem, 'of', this$static.offCurrent);
|
|
dumpAttr(elem, 'coR', this$static.coilR);
|
|
dumpAttr(elem, 'sw', this$static.switchingTime);
|
|
dumpAttr_0(elem, 'cs', this$static.coilStyle);
|
|
this$static.poleCount != 1 && dumpAttr_0(elem, 'po', this$static.poleCount);
|
|
this$static.showBox && (checkAttr(elem, 'sb') , $setAttribute_0(elem, 'sb', '1'));
|
|
this$static.pulldown && (checkAttr(elem, 'pd') , $setAttribute_0(elem, 'pd', '1'));
|
|
$appendChild_0(build(getDocumentElement(doc.jsObject)), elem);
|
|
}
|
|
|
|
function $pickName_1(this$static){
|
|
var n, num;
|
|
this$static.name_0 = 'relaymodel';
|
|
if ($getStringValue(modelMap_2, this$static.name_0) != null) {
|
|
num = 2;
|
|
for (;; num++) {
|
|
n = this$static.name_0 + '-' + num;
|
|
if ($getStringValue(modelMap_2, n) == null) {
|
|
this$static.name_0 = n;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
$putStringValue(modelMap_2, this$static.name_0, this$static);
|
|
}
|
|
|
|
function RelayModel(){
|
|
$$init_19(this);
|
|
this.inductance = 0.2;
|
|
this.r_on = 0.05;
|
|
this.r_off = $intern_84;
|
|
this.onCurrent = $intern_36;
|
|
this.offCurrent = 0.015;
|
|
this.coilR = 20;
|
|
this.switchingTime = $intern_129;
|
|
this.coilStyle = 0;
|
|
this.showBox = true;
|
|
this.pulldown = true;
|
|
}
|
|
|
|
function RelayModel_0(copy){
|
|
$$init_19(this);
|
|
this.flags = copy.flags;
|
|
this.inductance = copy.inductance;
|
|
this.r_on = copy.r_on;
|
|
this.r_off = copy.r_off;
|
|
this.onCurrent = copy.onCurrent;
|
|
this.offCurrent = copy.offCurrent;
|
|
this.coilR = copy.coilR;
|
|
this.switchingTime = copy.switchingTime;
|
|
this.coilStyle = copy.coilStyle;
|
|
this.poleCount = copy.poleCount;
|
|
this.showBox = copy.showBox;
|
|
this.pulldown = copy.pulldown;
|
|
}
|
|
|
|
function addDefaultModel_1(name_0, rm){
|
|
$putStringValue(modelMap_2, name_0, rm);
|
|
rm.readOnly = rm.builtIn = true;
|
|
rm.name_0 = name_0;
|
|
}
|
|
|
|
function clearDumpedFlags_3(){
|
|
var it, pair;
|
|
if (!modelMap_2)
|
|
return;
|
|
it = new AbstractHashMap$EntrySetIterator((new AbstractHashMap$EntrySet(modelMap_2)).this$01);
|
|
while (it.hasNext) {
|
|
pair = $next_2(it);
|
|
pair.getValue().dumped = false;
|
|
}
|
|
}
|
|
|
|
function createModelMap_1(){
|
|
var m2, m3;
|
|
if (modelMap_2)
|
|
return;
|
|
modelMap_2 = new HashMap;
|
|
addDefaultModel_1('default', new RelayModel);
|
|
m2 = new RelayModel;
|
|
m2.poleCount = 2;
|
|
addDefaultModel_1('default-2-poles', m2);
|
|
m3 = new RelayModel;
|
|
m3.poleCount = 3;
|
|
addDefaultModel_1('default-3-poles', m3);
|
|
}
|
|
|
|
function getModelList_2(){
|
|
var it, pair, rm, vector;
|
|
vector = new Vector;
|
|
it = new AbstractHashMap$EntrySetIterator((new AbstractHashMap$EntrySet(modelMap_2)).this$01);
|
|
while (it.hasNext) {
|
|
pair = $next_2(it);
|
|
rm = pair.getValue();
|
|
$indexOf_3(vector.arrayList, rm, 0) != -1 || $add_8(vector.arrayList, rm);
|
|
}
|
|
$clinit_Collections();
|
|
$sort(vector.arrayList, null);
|
|
return vector;
|
|
}
|
|
|
|
function getModelWithName_3(name_0){
|
|
var lm;
|
|
createModelMap_1();
|
|
lm = $getStringValue(modelMap_2, name_0);
|
|
if (lm)
|
|
return lm;
|
|
lm = new RelayModel;
|
|
lm.name_0 = name_0;
|
|
$putStringValue(modelMap_2, name_0, lm);
|
|
return lm;
|
|
}
|
|
|
|
function getModelWithNameOrCopy_2(name_0, oldmodel){
|
|
var lm;
|
|
createModelMap_1();
|
|
lm = $getStringValue(modelMap_2, name_0);
|
|
if (lm)
|
|
return lm;
|
|
if (!oldmodel) {
|
|
console.log('relay model not found: ' + name_0);
|
|
return getModelWithName_3('default');
|
|
}
|
|
lm = new RelayModel_0(oldmodel);
|
|
lm.name_0 = name_0;
|
|
$putStringValue(modelMap_2, name_0, lm);
|
|
return lm;
|
|
}
|
|
|
|
function getModelWithParameters_1(inductance, r_on, r_off, onCurrent, offCurrent, coilR, switchingTime, coilStyle, showBox, pulldown, poleCount){
|
|
var it, n, name_0, num, pair, rm, rm0;
|
|
createModelMap_1();
|
|
it = new AbstractHashMap$EntrySetIterator((new AbstractHashMap$EntrySet(modelMap_2)).this$01);
|
|
while (it.hasNext) {
|
|
pair = $next_2(it);
|
|
rm0 = pair.getValue();
|
|
if ($wnd.Math.abs(rm0.inductance - inductance) < $intern_114 && $wnd.Math.abs(rm0.r_on - r_on) < $intern_114 && $wnd.Math.abs(rm0.r_off - r_off) < $intern_114 && $wnd.Math.abs(rm0.onCurrent - onCurrent) < $intern_114 && $wnd.Math.abs(rm0.offCurrent - offCurrent) < $intern_114 && $wnd.Math.abs(rm0.coilR - coilR) < $intern_114 && $wnd.Math.abs(rm0.switchingTime - switchingTime) < $intern_114 && rm0.coilStyle == coilStyle && rm0.showBox == showBox && rm0.pulldown == pulldown && rm0.poleCount == poleCount)
|
|
return rm0;
|
|
}
|
|
name_0 = 'old-relay';
|
|
if ($getStringValue(modelMap_2, 'old-relay') != null) {
|
|
num = 2;
|
|
for (;; num++) {
|
|
n = 'old-relay-' + num;
|
|
if ($getStringValue(modelMap_2, n) == null) {
|
|
name_0 = n;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
rm = getModelWithName_3(name_0);
|
|
rm.inductance = inductance;
|
|
rm.r_on = r_on;
|
|
rm.r_off = r_off;
|
|
rm.onCurrent = onCurrent;
|
|
rm.offCurrent = offCurrent;
|
|
rm.coilR = coilR;
|
|
rm.switchingTime = switchingTime;
|
|
rm.coilStyle = coilStyle;
|
|
rm.showBox = showBox;
|
|
rm.pulldown = pulldown;
|
|
rm.poleCount = poleCount;
|
|
return rm;
|
|
}
|
|
|
|
function undumpModelXml_2(xml){
|
|
var name_0, rm;
|
|
name_0 = $parseStringAttr(xml, 'nm', null);
|
|
rm = getModelWithName_3(name_0);
|
|
rm.flags = $parseIntAttr(xml, 'f', rm.flags);
|
|
rm.inductance = $parseDoubleAttr(xml, 'in', rm.inductance);
|
|
rm.r_on = $parseDoubleAttr(xml, 'ron', rm.r_on);
|
|
rm.r_off = $parseDoubleAttr(xml, 'rof', rm.r_off);
|
|
rm.onCurrent = $parseDoubleAttr(xml, 'on', rm.onCurrent);
|
|
rm.offCurrent = $parseDoubleAttr(xml, 'of', rm.offCurrent);
|
|
rm.coilR = $parseDoubleAttr(xml, 'coR', rm.coilR);
|
|
rm.switchingTime = $parseDoubleAttr(xml, 'sw', rm.switchingTime);
|
|
rm.coilStyle = $parseIntAttr(xml, 'cs', rm.coilStyle);
|
|
rm.poleCount = $parseIntAttr(xml, 'po', rm.poleCount);
|
|
rm.showBox = $parseIntAttr(xml, 'sb', rm.showBox?1:0) != 0;
|
|
rm.pulldown = $parseIntAttr(xml, 'pd', rm.pulldown?1:0) != 0;
|
|
return rm;
|
|
}
|
|
|
|
defineClass(192, 1, {10:1, 192:1, 16:1}, RelayModel, RelayModel_0);
|
|
_.compareTo = function compareTo_3(rm){
|
|
return $compareTo(this.name_0, rm.name_0);
|
|
}
|
|
;
|
|
_.getDialogTitle = function getDialogTitle_4(){
|
|
return 'Edit Relay Model';
|
|
}
|
|
;
|
|
_.getEditInfo = function getEditInfo_63(n){
|
|
var ei;
|
|
if (n == 0) {
|
|
ei = new EditInfo('Model Name', 0);
|
|
ei.text_0 = this.name_0 == null?'':this.name_0;
|
|
return ei;
|
|
}
|
|
if (n == 1)
|
|
return $setPositive(new EditInfo_0('Inductance (H)', this.inductance, 0, 0));
|
|
if (n == 2)
|
|
return $setPositive(new EditInfo_0('On Resistance (ohms)', this.r_on, 0, 0));
|
|
if (n == 3)
|
|
return $setPositive(new EditInfo_0('Off Resistance (ohms)', this.r_off, 0, 0));
|
|
if (n == 4)
|
|
return $setPositive(new EditInfo_0('On Current (A)', this.onCurrent, 0, 0));
|
|
if (n == 5)
|
|
return $setPositive(new EditInfo_0('Off Current (A)', this.offCurrent, 0, 0));
|
|
if (n == 6)
|
|
return $setDimensionless(new EditInfo_0('Number of Poles', this.poleCount, 1, 4));
|
|
if (n == 7)
|
|
return $setPositive(new EditInfo_0('Coil Resistance (ohms)', this.coilR, 0, 0));
|
|
if (n == 8)
|
|
return $setPositive(new EditInfo_0('Switching Time (s)', this.switchingTime, 0, 0));
|
|
if (n == 9) {
|
|
ei = new EditInfo_0('Coil Style', this.coilStyle, -1, -1);
|
|
ei.choice = new Choice;
|
|
$addItem(ei.choice, LS('Both Sides'));
|
|
$addItem(ei.choice, LS('Side 1'));
|
|
$addItem(ei.choice, LS('Side 2'));
|
|
$select(ei.choice, this.coilStyle);
|
|
return ei;
|
|
}
|
|
if (n == 10)
|
|
return createCheckbox('Show Box', this.showBox);
|
|
if (n == 11)
|
|
return createCheckbox('Pulldown Resistor', this.pulldown);
|
|
return null;
|
|
}
|
|
;
|
|
_.setEditValue = function setEditValue_63(n, ei){
|
|
if (n == 0) {
|
|
this.name_0 = $getText(ei.textf);
|
|
this.name_0.length > 0 && $putStringValue(modelMap_2, this.name_0, this);
|
|
}
|
|
n == 1 && ei.value_0 > 0 && (this.inductance = ei.value_0);
|
|
n == 2 && ei.value_0 > 0 && (this.r_on = ei.value_0);
|
|
n == 3 && ei.value_0 > 0 && (this.r_off = ei.value_0);
|
|
n == 4 && ei.value_0 > 0 && (this.onCurrent = ei.value_0);
|
|
n == 5 && ei.value_0 > 0 && (this.offCurrent = ei.value_0);
|
|
n == 6 && ei.value_0 >= 1 && (this.poleCount = round_int(ei.value_0));
|
|
n == 7 && ei.value_0 > 0 && (this.coilR = ei.value_0);
|
|
n == 8 && ei.value_0 > 0 && (this.switchingTime = ei.value_0);
|
|
n == 9 && (this.coilStyle = $getElement(ei.choice).selectedIndex);
|
|
n == 10 && (this.showBox = $getState(ei.checkbox));
|
|
n == 11 && (this.pulldown = $getState(ei.checkbox));
|
|
$updateModels(theApp);
|
|
}
|
|
;
|
|
_.builtIn = false;
|
|
_.coilR = 0;
|
|
_.coilStyle = 0;
|
|
_.dumped = false;
|
|
_.flags = 0;
|
|
_.inductance = 0;
|
|
_.offCurrent = 0;
|
|
_.onCurrent = 0;
|
|
_.poleCount = 1;
|
|
_.pulldown = false;
|
|
_.r_off = 0;
|
|
_.r_on = 0;
|
|
_.readOnly = false;
|
|
_.showBox = false;
|
|
_.switchingTime = 0;
|
|
var modelMap_2;
|
|
var Lcom_lushprojects_circuitjs1_client_RelayModel_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'RelayModel', 192);
|
|
function $setResistance(this$static, r){
|
|
this$static.resistance = r;
|
|
}
|
|
|
|
function ResistorElm(xx, yy){
|
|
CircuitElm.call(this, xx, yy);
|
|
this.resistance = $intern_22;
|
|
}
|
|
|
|
function ResistorElm_0(xa, ya, xb, yb, f, st){
|
|
CircuitElm_0.call(this, xa, ya, xb, yb, f);
|
|
this.resistance = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
}
|
|
|
|
defineClass(184, 8, {8:1, 10:1, 184:1}, ResistorElm, ResistorElm_0);
|
|
_.addRoutingObstacle = function addRoutingObstacle_19(wr){
|
|
$addRoutingObstacleWithLeads(this, wr, 6);
|
|
}
|
|
;
|
|
_.calculateCurrent = function calculateCurrent_29(){
|
|
this.current_0 = (this.volts[0] - this.volts[1]) / this.resistance;
|
|
}
|
|
;
|
|
_.draw = function draw_65(g){
|
|
var grad, hs, i, len, s, v1, v2;
|
|
hs = 6;
|
|
v1 = this.volts[0];
|
|
v2 = this.volts[1];
|
|
$setBbox_0(this, this.point1, this.point2, 6);
|
|
$draw2Leads(this, g);
|
|
len = distance(this.lead1, this.lead2);
|
|
g.context.save();
|
|
g.context.lineWidth = 3;
|
|
$transform(g.context, (this.lead2.x_0 - this.lead1.x_0) / len, (this.lead2.y_0 - this.lead1.y_0) / len, -(this.lead2.y_0 - this.lead1.y_0) / len, (this.lead2.x_0 - this.lead1.x_0) / len, this.lead1.x_0, this.lead1.y_0);
|
|
if (app_0.menus.voltsCheckItem.on) {
|
|
grad = $createLinearGradient(g.context, 0, 0, len, 0);
|
|
$addColorStop(grad, 0, $getHexValue($getVoltageColor(this, v1)));
|
|
$addColorStop(grad, 1, $getHexValue($getVoltageColor(this, v2)));
|
|
$setStrokeStyleWeb(g.context, grad);
|
|
}
|
|
else
|
|
$setPowerColor_0(this, g);
|
|
this.dn < 30 && (hs = 2);
|
|
if (app_0.menus.euroResistorCheckItem.on) {
|
|
$strokeRect(g.context, 0, -hs, len, 2 * hs);
|
|
}
|
|
else {
|
|
g.context.beginPath();
|
|
g.context.moveTo(0, 0);
|
|
for (i = 0; i < 4; i++) {
|
|
$lineTo(g.context, (1 + 4 * i) * len / 16, hs);
|
|
$lineTo(g.context, (3 + 4 * i) * len / 16, -hs);
|
|
}
|
|
$lineTo(g.context, len, 0);
|
|
g.context.stroke();
|
|
}
|
|
g.context.restore();
|
|
if (app_0.menus.showValuesCheckItem.on) {
|
|
s = getUnitText(this.resistance, '', true);
|
|
$drawValues(this, g, s, hs + 2);
|
|
}
|
|
this.curcount_0 = $updateDotCount(this.current_0, this.curcount_0);
|
|
app_0.mouse.dragElm == this || $drawDots(g, this.point1, this.point2, this.curcount_0);
|
|
$drawPosts(this, g);
|
|
}
|
|
;
|
|
_.dumpXml = function dumpXml_69(doc, elem){
|
|
dumpAttr_1(elem, 'x', this.x_0 + ' ' + this.y_0 + ' ' + this.x2 + ' ' + this.y2);
|
|
dumpAttr_0(elem, 'f', this.flags);
|
|
dumpAttr(elem, 'r', this.resistance);
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_88(){
|
|
return 114;
|
|
}
|
|
;
|
|
_.getEditInfo = function getEditInfo_64(n){
|
|
if (n == 0)
|
|
return new EditInfo_0('Resistance (ohms)', this.resistance, 0, 0);
|
|
return null;
|
|
}
|
|
;
|
|
_.getInfo_0 = function getInfo_72(arr){
|
|
arr[0] = 'resistor';
|
|
arr[1] = 'I = ' + getUnitText($wnd.Math.abs(this.current_0), 'A', false);
|
|
arr[2] = 'Vd = ' + getUnitText($wnd.Math.abs(this.volts[0] - this.volts[1]), 'V', false);
|
|
arr[3] = 'R = ' + getUnitText(this.resistance, ohmString, false);
|
|
arr[4] = 'P = ' + getUnitText((this.volts[0] - this.volts[1]) * this.current_0, 'W', false);
|
|
}
|
|
;
|
|
_.getScopeText = function getScopeText_6(v){
|
|
return LS('resistor') + ', ' + getUnitText(this.resistance, ohmString, false);
|
|
}
|
|
;
|
|
_.getShortcut = function getShortcut_38(){
|
|
return 114;
|
|
}
|
|
;
|
|
_.setEditValue = function setEditValue_64(n, ei){
|
|
this.resistance = ei.value_0 <= 0?$intern_80:ei.value_0;
|
|
}
|
|
;
|
|
_.setPoints = function setPoints_60(){
|
|
$setPoints(this);
|
|
$calcLeads(this, 32);
|
|
new Point_1;
|
|
new Point_1;
|
|
}
|
|
;
|
|
_.stamp = function stamp_55(){
|
|
$stampResistor(this.nodes[0], this.nodes[1], this.resistance);
|
|
}
|
|
;
|
|
_.undumpXml = function undumpXml_72(xml){
|
|
this.flags = $parseIntAttr(xml, 'f', this.flags);
|
|
this.resistance = $parseDoubleAttr(xml, 'r', this.resistance);
|
|
}
|
|
;
|
|
_.resistance = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_ResistorElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ResistorElm', 184);
|
|
function $setupPins_18(this$static){
|
|
var i, ii;
|
|
this$static.sizeX = this$static.bits > 2?this$static.bits:2;
|
|
this$static.sizeY = 2;
|
|
this$static.pins = initUnidimensionalArray(Lcom_lushprojects_circuitjs1_client_ChipElm$Pin_2_classLit, $intern_3, 9, (this$static.flags & 2) != 0 && this$static.bits >= 3?this$static.bits + 3:this$static.bits + 2, 0, 1);
|
|
this$static.pins[0] = new ChipElm$Pin(this$static, 1, 2, '');
|
|
this$static.pins[0].clock = true;
|
|
this$static.pins[1] = new ChipElm$Pin(this$static, this$static.sizeX - 1, 1, 'R');
|
|
this$static.pins[1].lineOver = (this$static.flags & 4) == 0;
|
|
for (i = 0; i != this$static.bits; i++) {
|
|
ii = i + 2;
|
|
this$static.pins[ii] = new ChipElm$Pin(this$static, i, 0, 'Q' + i);
|
|
this$static.pins[ii].output = this$static.pins[ii].state = true;
|
|
}
|
|
if ((this$static.flags & 2) != 0 && this$static.bits >= 3) {
|
|
this$static.clockInhibit = this$static.pins.length - 1;
|
|
this$static.pins[this$static.clockInhibit] = new ChipElm$Pin(this$static, 1, 1, 'CE');
|
|
this$static.pins[this$static.clockInhibit].lineOver = true;
|
|
}
|
|
else
|
|
this$static.clockInhibit = -1;
|
|
$allocNodes(this$static);
|
|
}
|
|
|
|
function RingCounterElm(xx, yy){
|
|
$clinit_ChipElm();
|
|
ChipElm.call(this, xx, yy);
|
|
this.flags |= 2;
|
|
$setupPins_18(this);
|
|
}
|
|
|
|
function RingCounterElm_0(xa, ya, xb, yb, f, st){
|
|
$clinit_ChipElm();
|
|
ChipElm_0.call(this, xa, ya, xb, yb, f, st);
|
|
this.justLoaded = true;
|
|
}
|
|
|
|
defineClass(304, 32, $intern_85, RingCounterElm, RingCounterElm_0);
|
|
_.defaultBitCount = function defaultBitCount_2(){
|
|
return 10;
|
|
}
|
|
;
|
|
_.execute_3 = function execute_40(){
|
|
var i, running;
|
|
if (this.justLoaded) {
|
|
this.justLoaded = false;
|
|
return;
|
|
}
|
|
running = true;
|
|
(this.flags & 2) != 0 && this.bits >= 3 && this.pins[this.clockInhibit].value_0 && (running = false);
|
|
for (i = 0; i != this.bits; i++)
|
|
if (this.pins[i + 2].value_0)
|
|
break;
|
|
if (this.pins[0].value_0 && !this.lastClock && running) {
|
|
i < this.bits && (this.pins[i++ + 2].value_0 = false);
|
|
i %= this.bits;
|
|
this.pins[i + 2].value_0 = true;
|
|
}
|
|
if (this.pins[1].value_0 != ((this.flags & 4) == 0) || i == this.bits) {
|
|
for (i = 1; i != this.bits; i++)
|
|
this.pins[i + 2].value_0 = false;
|
|
this.pins[2].value_0 = true;
|
|
}
|
|
this.lastClock = this.pins[0].value_0;
|
|
}
|
|
;
|
|
_.getChipEditInfo = function getChipEditInfo_20(n){
|
|
var ei;
|
|
if (n == 0) {
|
|
ei = new EditInfo_0('', 0, -1, -1);
|
|
ei.checkbox = new Checkbox_0('Invert reset pin', (this.flags & 4) == 0);
|
|
return ei;
|
|
}
|
|
if (n == 1)
|
|
return $setDimensionless(new EditInfo_0('# of Bits', this.bits, 1, 1));
|
|
return null;
|
|
}
|
|
;
|
|
_.getChipName = function getChipName_25(){
|
|
return 'ring counter';
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_89(){
|
|
return 163;
|
|
}
|
|
;
|
|
_.getPostCount_0 = function getPostCount_60(){
|
|
return (this.flags & 2) != 0 && this.bits >= 3?this.bits + 3:this.bits + 2;
|
|
}
|
|
;
|
|
_.getVoltageSourceCount = function getVoltageSourceCount_44(){
|
|
return this.bits;
|
|
}
|
|
;
|
|
_.needsBits = function needsBits_9(){
|
|
return true;
|
|
}
|
|
;
|
|
_.setChipEditValue = function setChipEditValue_21(n, ei){
|
|
if (n == 0) {
|
|
$getState(ei.checkbox)?(this.flags &= -5):(this.flags |= 4);
|
|
$setupPins_18(this);
|
|
$setPoints_0(this);
|
|
return;
|
|
}
|
|
if (n == 1) {
|
|
if (ei.value_0 >= 2) {
|
|
this.bits = round_int(ei.value_0);
|
|
$setupPins_18(this);
|
|
$setPoints_0(this);
|
|
}
|
|
else
|
|
ei.error = 'must be >= 2';
|
|
}
|
|
}
|
|
;
|
|
_.setupPins = function setupPins_26(){
|
|
$setupPins_18(this);
|
|
}
|
|
;
|
|
_.clockInhibit = 0;
|
|
_.justLoaded = false;
|
|
var Lcom_lushprojects_circuitjs1_client_RingCounterElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'RingCounterElm', 304);
|
|
function $$init_20(this$static){
|
|
this$static.busWidth = 1;
|
|
}
|
|
|
|
function $getBusValue_0(this$static){
|
|
var i, value_0;
|
|
value_0 = 0;
|
|
for (i = 0; i < this$static.busWidth; i++)
|
|
this$static.volts[i] > 2.5 && (value_0 |= 1 << i);
|
|
return value_0;
|
|
}
|
|
|
|
function $getInfo_4(this$static, arr){
|
|
var i, label_0, value_0, number;
|
|
arr[0] = this$static.busWidth > 1?'bus wire (' + this$static.busWidth + ')':'wire';
|
|
if (this$static.busWidth > 1) {
|
|
value_0 = $getBusValue_0(this$static);
|
|
arr[1] = 'value = ' + value_0;
|
|
arr[2] = 'hex = 0x' + (number = value_0 >>> 0 , number.toString(16)).toUpperCase();
|
|
label_0 = getLabelForNode(this$static.nodes[0]);
|
|
if (label_0 != null) {
|
|
for (i = 1; i < this$static.busWidth; i++) {
|
|
if (!$equals_1(label_0, getLabelForNode(this$static.nodes[i]))) {
|
|
label_0 = null;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
label_0 != null && (arr[3] = label_0);
|
|
}
|
|
else {
|
|
arr[1] = 'I = ' + getUnitText($wnd.Math.abs(this$static.current_0), 'A', false);
|
|
arr[2] = 'V = ' + getUnitText(this$static.volts[0], 'V', false);
|
|
label_0 = getLabelForNode(this$static.nodes[0]);
|
|
label_0 != null && (arr[3] = label_0);
|
|
}
|
|
}
|
|
|
|
function $getPost_3(this$static, n){
|
|
if (this$static.busWidth == 1)
|
|
return n == 0?this$static.point1:this$static.point2;
|
|
if (n < this$static.busWidth)
|
|
return new Point_3(this$static.point1.x_0, this$static.point1.y_0, n);
|
|
return new Point_3(this$static.point2.x_0, this$static.point2.y_0, n - this$static.busWidth);
|
|
}
|
|
|
|
function $hasDirectConnection(this$static, ax, ay, bx, by){
|
|
var ce, ce$iterator, p0, p1;
|
|
for (ce$iterator = new ArrayList$1(theUI.elmList.arrayList); ce$iterator.i < ce$iterator.this$01.array.length;) {
|
|
ce = $next_4(ce$iterator);
|
|
if (ce == this$static || ce.getPostCount_0() != 2)
|
|
continue;
|
|
p0 = ce.getPost(0);
|
|
p1 = ce.getPost(1);
|
|
if (p0.x_0 == ax && p0.y_0 == ay && p1.x_0 == bx && p1.y_0 == by || p0.x_0 == bx && p0.y_0 == by && p1.x_0 == ax && p1.y_0 == ay)
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
function WireElm(xx, yy){
|
|
CircuitElm.call(this, xx, yy);
|
|
$$init_20(this);
|
|
}
|
|
|
|
function WireElm_0(xa, ya, xb, yb, f){
|
|
CircuitElm_0.call(this, xa, ya, xb, yb, f);
|
|
$$init_20(this);
|
|
}
|
|
|
|
function pointOnWireInteriorForPoints(px, py, pts){
|
|
var a, b, i, i0, p;
|
|
for (i0 = 0; i0 < pts.array.length - 1; i0++) {
|
|
a = (checkCriticalElementIndex(i0, pts.array.length) , pts.array[i0]);
|
|
b = (checkCriticalElementIndex(i0 + 1, pts.array.length) , pts.array[i0 + 1]);
|
|
if (pointOnSegmentInterior(a.x_0, a.y_0, b.x_0, b.y_0, px, py))
|
|
return true;
|
|
}
|
|
for (i = 1; i < pts.array.length - 1; i++) {
|
|
p = (checkCriticalElementIndex(i, pts.array.length) , pts.array[i]);
|
|
if (p.x_0 == px && p.y_0 == py)
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
defineClass(106, 8, {8:1, 10:1, 106:1}, WireElm, WireElm_0);
|
|
_.draggingDone = function draggingDone_1(){
|
|
var a, b, first, i, last, last0, p, p$iterator, p$iterator0, pts, seg, splitPoints, x0, y0;
|
|
splitPoints = new ArrayList;
|
|
for (p$iterator0 = new ArrayList$1(theApp.postDrawList.arrayList); p$iterator0.i < p$iterator0.this$01.array.length;) {
|
|
p = $next_4(p$iterator0);
|
|
pointOnSegmentInterior(this.x_0, this.y_0, this.x2, this.y2, p.x_0, p.y_0) && (splitPoints.array[splitPoints.array.length] = p , true);
|
|
}
|
|
if (splitPoints.array.length == 0)
|
|
return;
|
|
x0 = this.x_0;
|
|
y0 = this.y_0;
|
|
$clinit_Collections();
|
|
$sort(splitPoints, new WireElm$1(x0, y0));
|
|
pts = new ArrayList;
|
|
$add_8(pts, new Point_2(this.x_0, this.y_0));
|
|
for (p$iterator = new ArrayList$1(splitPoints); p$iterator.i < p$iterator.this$01.array.length;) {
|
|
p = $next_4(p$iterator);
|
|
last0 = $get_2(pts, pts.array.length - 1);
|
|
(p.x_0 != last0.x_0 || p.y_0 != last0.y_0) && (pts.array[pts.array.length] = p , true);
|
|
}
|
|
last = $get_2(pts, pts.array.length - 1);
|
|
(last.x_0 != this.x2 || last.y_0 != this.y2) && $add_8(pts, new Point_2(this.x2, this.y2));
|
|
first = true;
|
|
for (i = 0; i < pts.array.length - 1; i++) {
|
|
a = (checkCriticalElementIndex(i, pts.array.length) , pts.array[i]);
|
|
b = (checkCriticalElementIndex(i + 1, pts.array.length) , pts.array[i + 1]);
|
|
if ($hasDirectConnection(this, a.x_0, a.y_0, b.x_0, b.y_0))
|
|
continue;
|
|
if (first) {
|
|
this.x_0 = a.x_0;
|
|
this.y_0 = a.y_0;
|
|
$drag(this, b.x_0, b.y_0);
|
|
first = false;
|
|
}
|
|
else {
|
|
seg = new WireElm(a.x_0, a.y_0);
|
|
$drag(seg, b.x_0, b.y_0);
|
|
$addElement(theUI.elmList, seg);
|
|
}
|
|
}
|
|
first && $advanceToFind(theUI.elmList, this, true);
|
|
}
|
|
;
|
|
_.draw = function draw_66(g){
|
|
var i, s, value_0, number;
|
|
if (this.currents != null) {
|
|
this.current_0 = 0;
|
|
for (i = 0; i < this.currents.length; i++)
|
|
this.current_0 += this.currents[i];
|
|
}
|
|
$setVoltageColor(this, g, this.volts[0]);
|
|
drawThickLine_0(g, this.point1, this.point2, this.busWidth > 1?5:3);
|
|
this.doDots(g);
|
|
$setBbox_0(this, this.point1, this.point2, 3);
|
|
s = '';
|
|
if (this.busWidth > 1 && ((this.flags & 4) != 0 || (this.flags & 8) != 0)) {
|
|
value_0 = $getBusValue_0(this);
|
|
(this.flags & 4) != 0 && (s = '' + value_0);
|
|
(this.flags & 8) != 0 && (s = (s.length > 0?s + ' ':'') + '0x' + (number = value_0 >>> 0 , number.toString(16)).toUpperCase());
|
|
}
|
|
else if (this.busWidth == 1) {
|
|
(this.flags & 1) != 0 && (s = getUnitText($wnd.Math.abs(this.current_0), 'A', true));
|
|
(this.flags & 2) != 0 && (s = (s.length > 0?s + ' ':'') + getUnitText(this.volts[0], 'V', true));
|
|
}
|
|
$drawValues(this, g, s, 4);
|
|
$drawPosts(this, g);
|
|
}
|
|
;
|
|
_.getBusWidth = function getBusWidth_2(){
|
|
return this.busWidth;
|
|
}
|
|
;
|
|
_.getConnectedPost = function getConnectedPost_5(){
|
|
return this.point2;
|
|
}
|
|
;
|
|
_.getConnectedPost_0 = function getConnectedPost_6(n){
|
|
if (this.busWidth == 1)
|
|
return n == 0?this.point2:this.point1;
|
|
if (n < this.busWidth)
|
|
return new Point_3(this.point2.x_0, this.point2.y_0, n);
|
|
return new Point_3(this.point1.x_0, this.point1.y_0, n - this.busWidth);
|
|
}
|
|
;
|
|
_.getConnection = function getConnection_34(n1, n2){
|
|
if (this.busWidth == 1)
|
|
return true;
|
|
return $wnd.Math.abs(n1 - n2) == this.busWidth;
|
|
}
|
|
;
|
|
_.getCurrentIntoNode = function getCurrentIntoNode_27(n){
|
|
if (this.currents != null) {
|
|
if (n < this.busWidth)
|
|
return -this.currents[n];
|
|
return this.currents[n - this.busWidth];
|
|
}
|
|
if (n == 0)
|
|
return -this.current_0;
|
|
return this.current_0;
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_90(){
|
|
return 119;
|
|
}
|
|
;
|
|
_.getEditInfo = function getEditInfo_65(n){
|
|
var ei;
|
|
if (n == 0) {
|
|
ei = new EditInfo_0('', 0, -1, -1);
|
|
ei.checkbox = new Checkbox_0('Show Current', (this.flags & 1) != 0);
|
|
return ei;
|
|
}
|
|
if (n == 1) {
|
|
ei = new EditInfo_0('', 0, -1, -1);
|
|
ei.checkbox = new Checkbox_0('Show Voltage', (this.flags & 2) != 0);
|
|
return ei;
|
|
}
|
|
if (n == 2) {
|
|
ei = new EditInfo_0('', 0, -1, -1);
|
|
ei.checkbox = new Checkbox_0('Show Bus Value', (this.flags & 4) != 0);
|
|
return ei;
|
|
}
|
|
if (n == 3) {
|
|
ei = new EditInfo_0('', 0, -1, -1);
|
|
ei.checkbox = new Checkbox_0('Show Bus Value (Hex)', (this.flags & 8) != 0);
|
|
return ei;
|
|
}
|
|
return null;
|
|
}
|
|
;
|
|
_.getInfo_0 = function getInfo_73(arr){
|
|
$getInfo_4(this, arr);
|
|
}
|
|
;
|
|
_.getMouseDistance = function getMouseDistance_2(gx, gy){
|
|
var d2;
|
|
d2 = $lineDistanceSq(this.x_0, this.y_0, this.x2, this.y2, gx, gy);
|
|
if (d2 <= 100)
|
|
return d2;
|
|
return -1;
|
|
}
|
|
;
|
|
_.getPost = function getPost_21(n){
|
|
return $getPost_3(this, n);
|
|
}
|
|
;
|
|
_.getPostCount_0 = function getPostCount_61(){
|
|
return this.busWidth * 2;
|
|
}
|
|
;
|
|
_.getPostWidth = function getPostWidth_5(n){
|
|
return this.busWidth;
|
|
}
|
|
;
|
|
_.getPower = function getPower_10(){
|
|
return 0;
|
|
}
|
|
;
|
|
_.getShortcut = function getShortcut_39(){
|
|
return 119;
|
|
}
|
|
;
|
|
_.getVoltageDiff_0 = function getVoltageDiff_20(){
|
|
return this.volts[0];
|
|
}
|
|
;
|
|
_.isRemovableWire = function isRemovableWire_9(){
|
|
return true;
|
|
}
|
|
;
|
|
_.isWireEquivalent = function isWireEquivalent_10(){
|
|
return true;
|
|
}
|
|
;
|
|
_.pointOnWireInterior = function pointOnWireInterior(px, py){
|
|
var pts;
|
|
pts = new ArrayList;
|
|
$add_8(pts, new Point_2(this.x_0, this.y_0));
|
|
$add_8(pts, new Point_2(this.x2, this.y2));
|
|
return pointOnWireInteriorForPoints(px, py, pts);
|
|
}
|
|
;
|
|
_.setEditValue = function setEditValue_65(n, ei){
|
|
n == 0 && ($getState(ei.checkbox)?(this.flags |= 1):(this.flags &= -2));
|
|
n == 1 && ($getState(ei.checkbox)?(this.flags |= 2):(this.flags &= -3));
|
|
n == 2 && (this.flags = $changeFlag(ei, this.flags, 4));
|
|
n == 3 && (this.flags = $changeFlag(ei, this.flags, 8));
|
|
}
|
|
;
|
|
_.setWireCurrent = function setWireCurrent_2(bit, c){
|
|
this.currents != null?(this.currents[bit] = c):(this.current_0 = c);
|
|
}
|
|
;
|
|
_.split_0 = function split_1(px, py){
|
|
var newWire;
|
|
newWire = new WireElm(px, py);
|
|
$drag(newWire, this.x2, this.y2);
|
|
$drag(this, px, py);
|
|
return newWire;
|
|
}
|
|
;
|
|
_.stamp = function stamp_56(){
|
|
}
|
|
;
|
|
_.busWidth = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_WireElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'WireElm', 106);
|
|
function $doDots(this$static, g){
|
|
var a, b, cc, dx, dy, i, segLen;
|
|
this$static.curcount_0 = $updateDotCount(this$static.current_0, this$static.curcount_0);
|
|
if (app_0.mouse.dragElm == this$static || this$static.curcount_0 == 0)
|
|
return;
|
|
cc = this$static.curcount_0;
|
|
for (i = 0; i < this$static.routePoints.array.length - 1; i++) {
|
|
a = $get_2(this$static.routePoints, i);
|
|
b = $get_2(this$static.routePoints, i + 1);
|
|
$drawDots(g, a, b, cc);
|
|
dx = b.x_0 - a.x_0;
|
|
dy = b.y_0 - a.y_0;
|
|
segLen = $wnd.Math.sqrt(dx * dx + dy * dy);
|
|
cc = $addCurCount(cc, segLen);
|
|
}
|
|
}
|
|
|
|
function $drawValuesOnLongestSegment(this$static, g, s){
|
|
var a, a0, b, b0, bestLen, bestSeg, dx, dy, i, len, mx, my, w, ya;
|
|
bestLen = 0;
|
|
bestSeg = 0;
|
|
for (i = 0; i < this$static.routePoints.array.length - 1; i++) {
|
|
a0 = $get_2(this$static.routePoints, i);
|
|
b0 = $get_2(this$static.routePoints, i + 1);
|
|
dx = b0.x_0 - a0.x_0;
|
|
dy = b0.y_0 - a0.y_0;
|
|
len = dx * dx + dy * dy;
|
|
if (len > bestLen) {
|
|
bestLen = len;
|
|
bestSeg = i;
|
|
}
|
|
}
|
|
a = $get_2(this$static.routePoints, bestSeg);
|
|
b = $get_2(this$static.routePoints, bestSeg + 1);
|
|
mx = (a.x_0 + b.x_0) / 2 | 0;
|
|
my = (a.y_0 + b.y_0) / 2 | 0;
|
|
$setFont_0(g, unitsFont);
|
|
w = round_int($measureText(g.context, s).width);
|
|
ya = g.currentFontSize / 2 | 0;
|
|
$setColor_0(g, whiteColor);
|
|
a.y_0 == b.y_0?$fillText(g.context, s, mx - (w / 2 | 0), my - 6):$fillText(g.context, s, mx + 4, my + ya);
|
|
}
|
|
|
|
function $getSnapPointOnWire(this$static, mx, my){
|
|
var a, a0, b, b0, bestDist, bestSeg, d, i, sx, sy;
|
|
if (!this$static.routePoints || this$static.routePoints.array.length < 2)
|
|
return null;
|
|
bestSeg = -1;
|
|
bestDist = $intern_0;
|
|
for (i = 0; i < this$static.routePoints.array.length - 1; i++) {
|
|
a0 = $get_2(this$static.routePoints, i);
|
|
b0 = $get_2(this$static.routePoints, i + 1);
|
|
d = $lineDistanceSq(a0.x_0, a0.y_0, b0.x_0, b0.y_0, mx, my);
|
|
if (d < bestDist) {
|
|
bestDist = d;
|
|
bestSeg = i;
|
|
}
|
|
}
|
|
a = $get_2(this$static.routePoints, bestSeg);
|
|
b = $get_2(this$static.routePoints, bestSeg + 1);
|
|
if (a.x_0 == b.x_0) {
|
|
sx = a.x_0;
|
|
sy = $snapGrid_0(app_0, my);
|
|
}
|
|
else {
|
|
sy = a.y_0;
|
|
sx = $snapGrid_0(app_0, mx);
|
|
}
|
|
return new Point_2(sx, sy);
|
|
}
|
|
|
|
function $pointOnPath(this$static, p){
|
|
var a, b, hi, i, lo;
|
|
if (!this$static.routePoints || this$static.routePoints.array.length < 2)
|
|
return false;
|
|
if ($equals(p, this$static.point1) || $equals(p, this$static.point2))
|
|
return false;
|
|
for (i = 0; i < this$static.routePoints.array.length - 1; i++) {
|
|
a = $get_2(this$static.routePoints, i);
|
|
b = $get_2(this$static.routePoints, i + 1);
|
|
if (a.x_0 == b.x_0 && p.x_0 == a.x_0) {
|
|
lo = $wnd.Math.min(a.y_0, b.y_0);
|
|
hi = $wnd.Math.max(a.y_0, b.y_0);
|
|
if (p.y_0 >= lo && p.y_0 <= hi)
|
|
return true;
|
|
}
|
|
else if (a.y_0 == b.y_0 && p.y_0 == a.y_0) {
|
|
lo = $wnd.Math.min(a.x_0, b.x_0);
|
|
hi = $wnd.Math.max(a.x_0, b.x_0);
|
|
if (p.x_0 >= lo && p.x_0 <= hi)
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
function $rerouteVia(this$static, vx, vy){
|
|
var a, b, combined, i, i0, router, rp1, rp2;
|
|
router = new WireRouter;
|
|
$initGrid(router, this$static);
|
|
rp1 = $routeWire(router, this$static.x_0, this$static.y_0, vx, vy);
|
|
if (rp1.array.length < 2)
|
|
return;
|
|
for (i0 = 0; i0 < rp1.array.length - 1; i0++) {
|
|
a = (checkCriticalElementIndex(i0, rp1.array.length) , rp1.array[i0]);
|
|
b = (checkCriticalElementIndex(i0 + 1, rp1.array.length) , rp1.array[i0 + 1]);
|
|
$addWire(router, a.x_0, a.y_0, b.x_0, b.y_0);
|
|
}
|
|
rp2 = $routeWire(router, vx, vy, this$static.x2, this$static.y2);
|
|
if (rp2.array.length < 2)
|
|
return;
|
|
combined = new ArrayList_1(rp1);
|
|
for (i = 1; i < rp2.array.length; i++)
|
|
$add_8(combined, (checkCriticalElementIndex(i, rp2.array.length) , rp2.array[i]));
|
|
this$static.routePoints = combined;
|
|
}
|
|
|
|
function $setPoints_23(this$static, points){
|
|
var first, last;
|
|
first = (checkCriticalElementIndex(0, points.array.length) , points.array[0]);
|
|
last = $get_2(points, points.array.length - 1);
|
|
this$static.x_0 = first.x_0;
|
|
this$static.y_0 = first.y_0;
|
|
this$static.x2 = last.x_0;
|
|
this$static.y2 = last.y_0;
|
|
$setPoints_24(this$static, false);
|
|
this$static.routePoints = points;
|
|
}
|
|
|
|
function $setPoints_24(this$static, routing){
|
|
var first, last, router;
|
|
$setPoints(this$static);
|
|
if (!!this$static.routePoints && this$static.routePoints.array.length >= 2) {
|
|
first = $get_2(this$static.routePoints, 0);
|
|
last = $get_2(this$static.routePoints, this$static.routePoints.array.length - 1);
|
|
if (first.x_0 == this$static.x_0 && first.y_0 == this$static.y_0 && last.x_0 == this$static.x2 && last.y_0 == this$static.y2)
|
|
return;
|
|
}
|
|
if (!routing) {
|
|
this$static.routePoints = new ArrayList;
|
|
$add_8(this$static.routePoints, this$static.point1);
|
|
$add_8(this$static.routePoints, this$static.point2);
|
|
return;
|
|
}
|
|
router = new WireRouter;
|
|
$initGrid(router, this$static);
|
|
this$static.routePoints = $routeWire(router, this$static.x_0, this$static.y_0, this$static.x2, this$static.y2);
|
|
if (this$static.routePoints.array.length < 2) {
|
|
console.log('routing failed');
|
|
this$static.routePoints = new ArrayList;
|
|
$add_8(this$static.routePoints, this$static.point1);
|
|
$add_8(this$static.routePoints, new Point_2(this$static.x2, this$static.y_0));
|
|
$add_8(this$static.routePoints, this$static.point2);
|
|
return;
|
|
}
|
|
console.log('route success');
|
|
}
|
|
|
|
function $split(this$static, mx, my){
|
|
var a, a0, atA, atB, b, b0, bestDist, bestSeg, d, i, i0, i1, rp1, rp2, sx, sy;
|
|
if (!this$static.routePoints || this$static.routePoints.array.length < 2)
|
|
return null;
|
|
bestSeg = -1;
|
|
bestDist = $intern_0;
|
|
for (i0 = 0; i0 < this$static.routePoints.array.length - 1; i0++) {
|
|
a0 = $get_2(this$static.routePoints, i0);
|
|
b0 = $get_2(this$static.routePoints, i0 + 1);
|
|
d = $lineDistanceSq(a0.x_0, a0.y_0, b0.x_0, b0.y_0, mx, my);
|
|
if (d < bestDist) {
|
|
bestDist = d;
|
|
bestSeg = i0;
|
|
}
|
|
}
|
|
a = $get_2(this$static.routePoints, bestSeg);
|
|
b = $get_2(this$static.routePoints, bestSeg + 1);
|
|
if (a.x_0 == b.x_0) {
|
|
sx = a.x_0;
|
|
sy = $snapGrid_0(app_0, my);
|
|
sy = $wnd.Math.max($wnd.Math.min(a.y_0, b.y_0), $wnd.Math.min(sy, $wnd.Math.max(a.y_0, b.y_0)));
|
|
}
|
|
else {
|
|
sy = a.y_0;
|
|
sx = $snapGrid_0(app_0, mx);
|
|
sx = $wnd.Math.max($wnd.Math.min(a.x_0, b.x_0), $wnd.Math.min(sx, $wnd.Math.max(a.x_0, b.x_0)));
|
|
}
|
|
if (sx == this$static.x_0 && sy == this$static.y_0 || sx == this$static.x2 && sy == this$static.y2)
|
|
return null;
|
|
atA = sx == a.x_0 && sy == a.y_0;
|
|
atB = sx == b.x_0 && sy == b.y_0;
|
|
rp1 = new ArrayList;
|
|
for (i1 = 0; i1 <= bestSeg; i1++)
|
|
$add_8(rp1, $get_2(this$static.routePoints, i1));
|
|
atA || $add_8(rp1, new Point_2(sx, sy));
|
|
rp2 = new ArrayList;
|
|
$add_8(rp2, new Point_2(sx, sy));
|
|
for (i = bestSeg + 1; i < this$static.routePoints.array.length; i++) {
|
|
if (i == bestSeg + 1 && atB)
|
|
continue;
|
|
$add_8(rp2, $get_2(this$static.routePoints, i));
|
|
}
|
|
$setPoints_23(this$static, rp1);
|
|
return new RoutedWireElm_0(rp2);
|
|
}
|
|
|
|
function RoutedWireElm(xx, yy){
|
|
WireElm.call(this, xx, yy);
|
|
}
|
|
|
|
function RoutedWireElm_0(points){
|
|
WireElm.call(this, (checkCriticalElementIndex(0, points.array.length) , points.array[0]).x_0, (checkCriticalElementIndex(0, points.array.length) , points.array[0]).y_0);
|
|
$setPoints_23(this, points);
|
|
}
|
|
|
|
function segmentDistanceSq(ax, ay, bx, by, gx, gy){
|
|
var dx, dy, ex, ey, lenSq, px, py, t;
|
|
dx = bx - ax;
|
|
dy = by - ay;
|
|
lenSq = dx * dx + dy * dy;
|
|
if (lenSq == 0)
|
|
return (gx - ax) * (gx - ax) + (gy - ay) * (gy - ay);
|
|
t = ((gx - ax) * dx + (gy - ay) * dy) / lenSq;
|
|
t < 0?(t = 0):t > 1 && (t = 1);
|
|
px = ax + t * dx;
|
|
py = ay + t * dy;
|
|
ex = gx - px;
|
|
ey = gy - py;
|
|
return round_int(ex * ex + ey * ey);
|
|
}
|
|
|
|
function segmentIntersectsRect(a, b, r){
|
|
var hi, lo, rx1, rx2, ry1, ry2;
|
|
rx1 = r.x_0;
|
|
ry1 = r.y_0;
|
|
rx2 = r.x_0 + r.width_0;
|
|
ry2 = r.y_0 + r.height_0;
|
|
if (a.y_0 == b.y_0) {
|
|
if (a.y_0 < ry1 || a.y_0 > ry2)
|
|
return false;
|
|
lo = $wnd.Math.min(a.x_0, b.x_0);
|
|
hi = $wnd.Math.max(a.x_0, b.x_0);
|
|
return hi >= rx1 && lo <= rx2;
|
|
}
|
|
else {
|
|
if (a.x_0 < rx1 || a.x_0 > rx2)
|
|
return false;
|
|
lo = $wnd.Math.min(a.y_0, b.y_0);
|
|
hi = $wnd.Math.max(a.y_0, b.y_0);
|
|
return hi >= ry1 && lo <= ry2;
|
|
}
|
|
}
|
|
|
|
defineClass(137, 106, {8:1, 10:1, 137:1, 106:1}, RoutedWireElm, RoutedWireElm_0);
|
|
_.split_0 = function split_2(mx, my){
|
|
return $split(this, mx, my);
|
|
}
|
|
;
|
|
_.addRoutingObstacle = function addRoutingObstacle_20(router){
|
|
var a, b, i;
|
|
if (!this.routePoints)
|
|
return;
|
|
for (i = 0; i < this.routePoints.array.length - 1; i++) {
|
|
a = $get_2(this.routePoints, i);
|
|
b = $get_2(this.routePoints, i + 1);
|
|
$addWire(router, a.x_0, a.y_0, b.x_0, b.y_0);
|
|
}
|
|
}
|
|
;
|
|
_.doDots = function doDots_0(g){
|
|
$doDots(this, g);
|
|
}
|
|
;
|
|
_.draggingDone = function draggingDone_2(){
|
|
}
|
|
;
|
|
_.draw = function draw_67(g){
|
|
var i, i0, i1, maxX, maxY, minX, minY, p, s, value_0, number;
|
|
$setVoltageColor(this, g, this.volts[0]);
|
|
for (i0 = 0; i0 < this.routePoints.array.length - 1; i0++)
|
|
drawThickLine_0(g, $get_2(this.routePoints, i0), $get_2(this.routePoints, i0 + 1), this.busWidth > 1?5:3);
|
|
if (this.currents != null) {
|
|
this.current_0 = 0;
|
|
for (i1 = 0; i1 < this.currents.length; i1++)
|
|
this.current_0 += this.currents[i1];
|
|
}
|
|
$doDots(this, g);
|
|
minX = this.point1.x_0;
|
|
minY = this.point1.y_0;
|
|
maxX = this.point1.x_0;
|
|
maxY = this.point1.y_0;
|
|
for (i = 1; i < this.routePoints.array.length; i++) {
|
|
p = $get_2(this.routePoints, i);
|
|
minX = min_1(minX, p.x_0);
|
|
minY = min_1(minY, p.y_0);
|
|
maxX = max_1(maxX, p.x_0);
|
|
maxY = max_1(maxY, p.y_0);
|
|
}
|
|
$setBbox(this, minX - 5, minY - 5, maxX + 5, maxY + 5);
|
|
s = '';
|
|
if (this.busWidth > 1 && ((this.flags & 4) != 0 || (this.flags & 8) != 0)) {
|
|
value_0 = $getBusValue_0(this);
|
|
(this.flags & 4) != 0 && (s = '' + value_0);
|
|
(this.flags & 8) != 0 && (s = (s.length > 0?s + ' ':'') + '0x' + (number = value_0 >>> 0 , number.toString(16)).toUpperCase());
|
|
}
|
|
else if (this.busWidth == 1) {
|
|
(this.flags & 1) != 0 && (s = getUnitText($wnd.Math.abs(this.current_0), 'A', true));
|
|
(this.flags & 2) != 0 && (s = (s.length > 0?s + ' ':'') + getUnitText(this.volts[0], 'V', true));
|
|
}
|
|
s.length > 0 && $drawValuesOnLongestSegment(this, g, s);
|
|
$drawPosts(this, g);
|
|
}
|
|
;
|
|
_.dumpXml = function dumpXml_70(doc, elem){
|
|
var i, p, sb;
|
|
dumpAttr_1(elem, 'x', this.x_0 + ' ' + this.y_0 + ' ' + this.x2 + ' ' + this.y2);
|
|
dumpAttr_0(elem, 'f', this.flags);
|
|
if (!!this.routePoints && this.routePoints.array.length > 0) {
|
|
sb = new StringBuilder;
|
|
for (i = 0; i < this.routePoints.array.length; i++) {
|
|
i > 0 && (sb.string += ';' , sb);
|
|
p = $get_2(this.routePoints, i);
|
|
$append_2($append_0($append_2(sb, p.x_0), 44), p.y_0);
|
|
}
|
|
$appendChild_0(elem, $createTextNode(doc, sb.string));
|
|
}
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_91(){
|
|
return 0;
|
|
}
|
|
;
|
|
_.getInfo_0 = function getInfo_74(arr){
|
|
$getInfo_4(this, arr);
|
|
arr[0] = this.busWidth > 1?'routed bus wire (' + this.busWidth + ')':'routed wire';
|
|
}
|
|
;
|
|
_.getMouseDistance = function getMouseDistance_3(gx, gy){
|
|
var a, b, best, d, i;
|
|
best = $intern_0;
|
|
for (i = 0; i < this.routePoints.array.length - 1; i++) {
|
|
a = $get_2(this.routePoints, i);
|
|
b = $get_2(this.routePoints, i + 1);
|
|
d = segmentDistanceSq(a.x_0, a.y_0, b.x_0, b.y_0, gx, gy);
|
|
d < best && (best = d);
|
|
}
|
|
if (best <= 100)
|
|
return best;
|
|
return -1;
|
|
}
|
|
;
|
|
_.getShortcut = function getShortcut_40(){
|
|
return 87;
|
|
}
|
|
;
|
|
_.getXmlDumpType = function getXmlDumpType_23(){
|
|
return 'rw';
|
|
}
|
|
;
|
|
_.move = function move_0(dx, dy){
|
|
var p, p$iterator;
|
|
if (this.routePoints) {
|
|
for (p$iterator = new ArrayList$1(this.routePoints); p$iterator.i < p$iterator.this$01.array.length;) {
|
|
p = $next_4(p$iterator);
|
|
p.x_0 += dx;
|
|
p.y_0 += dy;
|
|
}
|
|
}
|
|
$move(this, dx, dy);
|
|
}
|
|
;
|
|
_.pointOnWireInterior = function pointOnWireInterior_0(px, py){
|
|
if (!this.routePoints || this.routePoints.array.length < 2)
|
|
return false;
|
|
return pointOnWireInteriorForPoints(px, py, this.routePoints);
|
|
}
|
|
;
|
|
_.selectRect = function selectRect_1(r, add_0){
|
|
var a, b, hit, i;
|
|
if (!this.routePoints || this.routePoints.array.length < 2) {
|
|
$intersects(r, this.boundingBox)?(this.selected_0 = true):add_0 || (this.selected_0 = false);
|
|
return;
|
|
}
|
|
hit = false;
|
|
for (i = 0; i < this.routePoints.array.length - 1 && !hit; i++) {
|
|
a = $get_2(this.routePoints, i);
|
|
b = $get_2(this.routePoints, i + 1);
|
|
segmentIntersectsRect(a, b, r) && (hit = true);
|
|
}
|
|
hit?(this.selected_0 = true):add_0 || (this.selected_0 = false);
|
|
}
|
|
;
|
|
_.setPoints = function setPoints_61(){
|
|
$setPoints_24(this, true);
|
|
}
|
|
;
|
|
_.undumpXml = function undumpXml_73(xml){
|
|
var contents, pair, pair$index, pair$max, pairs, points, xy;
|
|
this.flags = $parseIntAttr(xml, 'f', this.flags);
|
|
try {
|
|
contents = $parseContents(xml);
|
|
if (contents != null && contents.length > 0) {
|
|
points = new ArrayList;
|
|
pairs = $split_1(contents, ';', 0);
|
|
for (pair$index = 0 , pair$max = pairs.length; pair$index < pair$max; ++pair$index) {
|
|
pair = pairs[pair$index];
|
|
xy = $split_1(pair, ',', 0);
|
|
$add_8(points, new Point_2(__parseAndValidateInt(xy[0], 10), __parseAndValidateInt(xy[1], 10)));
|
|
}
|
|
points.array.length >= 2 && (this.routePoints = points);
|
|
}
|
|
}
|
|
catch ($e0) {
|
|
$e0 = toJava($e0);
|
|
if (!instanceOf($e0, 13))
|
|
throw toJs($e0);
|
|
}
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_RoutedWireElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'RoutedWireElm', 137);
|
|
function $fixEnds(this$static){
|
|
var pt;
|
|
pt = new Point_1;
|
|
$interpPoint_2(this$static.point1, this$static.point2, pt, 1, app_0.gridSize * this$static.dir_0);
|
|
this$static.x2 = pt.x_0;
|
|
this$static.y2 = pt.y_0;
|
|
}
|
|
|
|
function $setDefaults(this$static){
|
|
this$static.gresistance = 50;
|
|
this$static.holdingI = 0.0082;
|
|
this$static.triggerI = $intern_34;
|
|
}
|
|
|
|
function $setup_6(this$static){
|
|
this$static.diode = new Diode(sim_0);
|
|
$setup(this$static.diode, getModelWithName_1('default'));
|
|
this$static.aresistance = 1;
|
|
}
|
|
|
|
function SCRElm(xx, yy){
|
|
CircuitElm.call(this, xx, yy);
|
|
$setDefaults(this);
|
|
this.flags |= 1;
|
|
$setup_6(this);
|
|
}
|
|
|
|
function SCRElm_0(xa, ya, xb, yb, f, st){
|
|
CircuitElm_0.call(this, xa, ya, xb, yb, f);
|
|
$setDefaults(this);
|
|
try {
|
|
this.lastvac = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.lastvag = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.volts[0] = 0;
|
|
this.volts[1] = -this.lastvac;
|
|
this.volts[2] = -this.lastvag;
|
|
this.triggerI = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.holdingI = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.gresistance = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
}
|
|
catch ($e0) {
|
|
$e0 = toJava($e0);
|
|
if (!instanceOf($e0, 13))
|
|
throw toJs($e0);
|
|
}
|
|
$setup_6(this);
|
|
}
|
|
|
|
defineClass(385, 8, $intern_85, SCRElm, SCRElm_0);
|
|
_.calculateCurrent = function calculateCurrent_30(){
|
|
this.ig = (this.volts[2] - this.volts[1]) / this.gresistance;
|
|
this.ia = (this.volts[0] - this.volts[3]) / this.aresistance;
|
|
this.ic = -this.ig - this.ia;
|
|
}
|
|
;
|
|
_.doStep = function doStep_43(){
|
|
var iamult, icmult, vac, vag;
|
|
vac = this.volts[0] - this.volts[1];
|
|
vag = this.volts[0] - this.volts[2];
|
|
($wnd.Math.abs(vac - this.lastvac) > $intern_34 || $wnd.Math.abs(vag - this.lastvag) > $intern_34) && (sim_0.converged = false);
|
|
this.lastvac = vac;
|
|
this.lastvag = vag;
|
|
$doStep_0(this.diode, this.volts[3] - this.volts[1]);
|
|
icmult = 1 / this.triggerI;
|
|
iamult = 1 / this.holdingI - icmult;
|
|
this.aresistance = -icmult * this.ic + this.ia * iamult > 1?0.0105:$intern_84;
|
|
$stampResistor(this.nodes[0], this.nodes[3], this.aresistance);
|
|
}
|
|
;
|
|
_.draw = function draw_68(g){
|
|
var ds, v1, v2;
|
|
$setBbox_0(this, this.point1, this.point2, 8);
|
|
$adjustBbox_0(this, this.gate[0], this.gate[1]);
|
|
v1 = this.volts[0];
|
|
v2 = this.volts[1];
|
|
$draw2Leads(this, g);
|
|
$setColor_0(g, $getVoltageColor(this, v1));
|
|
$setPowerColor_0(this, g);
|
|
$fillPolygon(g, this.poly);
|
|
$setVoltageColor(this, g, this.volts[2]);
|
|
drawThickLine_0(g, this.lead2, this.gate[0], 3);
|
|
drawThickLine_0(g, this.gate[0], this.gate[1], 3);
|
|
$setColor_0(g, $getVoltageColor(this, v2));
|
|
$setPowerColor_0(this, g);
|
|
drawThickLine_0(g, this.cathode[0], this.cathode[1], 3);
|
|
this.curcount_a = $updateDotCount(this.ia, this.curcount_a);
|
|
this.curcount_c = $updateDotCount(this.ic, this.curcount_c);
|
|
this.curcount_g = $updateDotCount(this.ig, this.curcount_g);
|
|
if (app_0.mouse.dragElm != this) {
|
|
$drawDots(g, this.point1, this.lead2, this.curcount_a);
|
|
$drawDots(g, this.point2, this.lead2, this.curcount_c);
|
|
$drawDots(g, this.gate[1], this.gate[0], this.curcount_g);
|
|
$drawDots(g, this.gate[0], this.lead2, this.curcount_g + distance(this.gate[1], this.gate[0]));
|
|
}
|
|
if ((mouseElmRef == this || this.selected_0 || $containsKey(app_0.mouse.scopePlotRoles, this) || instanceOf(mouseElmRef, 21) && $getElm_0(mouseElmRef.elmScope) == this || $isOnHighlightedNet(this) || app_0.mouse.dragElm == this) && this.point1.x_0 == this.point2.x_0 && this.point2.y_0 > this.point1.y_0) {
|
|
$setColor_0(g, whiteColor);
|
|
ds = sign_0(this.dx);
|
|
$drawString(g, 'C', this.lead2.x_0 + (ds < 0?5:-15), this.lead2.y_0 + 12);
|
|
$drawString(g, 'A', this.lead1.x_0 + 5, this.lead1.y_0 - 4);
|
|
$drawString(g, 'G', this.gate[0].x_0, this.gate[0].y_0 + 12);
|
|
}
|
|
$drawPosts(this, g);
|
|
}
|
|
;
|
|
_.dumpXml = function dumpXml_71(doc, elem){
|
|
dumpAttr_1(elem, 'x', this.x_0 + ' ' + this.y_0 + ' ' + this.x2 + ' ' + this.y2);
|
|
dumpAttr_0(elem, 'f', this.flags);
|
|
dumpAttr(elem, 'tr', this.triggerI);
|
|
dumpAttr(elem, 'ho', this.holdingI);
|
|
dumpAttr(elem, 'gr', this.gresistance);
|
|
}
|
|
;
|
|
_.flipX = function flipX_15(c2, count){
|
|
$fixEnds(this);
|
|
$flipX(this, c2);
|
|
}
|
|
;
|
|
_.flipXY = function flipXY_12(c2, count){
|
|
$fixEnds(this);
|
|
$flipXY(this, c2);
|
|
}
|
|
;
|
|
_.flipY = function flipY_15(c2, count){
|
|
$fixEnds(this);
|
|
$flipY(this, c2);
|
|
}
|
|
;
|
|
_.getCurrentIntoNode = function getCurrentIntoNode_28(n){
|
|
if (n == 0)
|
|
return -this.ia;
|
|
if (n == 1)
|
|
return -this.ic;
|
|
return -this.ig;
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_92(){
|
|
return 177;
|
|
}
|
|
;
|
|
_.getEditInfo = function getEditInfo_66(n){
|
|
if (n == 0)
|
|
return $setPositive(new EditInfo_0('Trigger Current (A)', this.triggerI, 0, 0));
|
|
if (n == 1)
|
|
return $setPositive(new EditInfo_0('Holding Current (A)', this.holdingI, 0, 0));
|
|
if (n == 2)
|
|
return $setPositive(new EditInfo_0('Gate Resistance (ohms)', this.gresistance, 0, 0));
|
|
return null;
|
|
}
|
|
;
|
|
_.getInfo_0 = function getInfo_75(arr){
|
|
var vac, vag, vgc;
|
|
arr[0] = 'SCR';
|
|
vac = this.volts[0] - this.volts[1];
|
|
vag = this.volts[0] - this.volts[2];
|
|
vgc = this.volts[2] - this.volts[1];
|
|
arr[1] = 'Ia = ' + getUnitText(this.ia, 'A', false);
|
|
arr[2] = 'Ig = ' + getUnitText(this.ig, 'A', false);
|
|
arr[3] = 'Vac = ' + getUnitText(vac, 'V', false);
|
|
arr[4] = 'Vag = ' + getUnitText(vag, 'V', false);
|
|
arr[5] = 'Vgc = ' + getUnitText(vgc, 'V', false);
|
|
arr[6] = 'P = ' + getUnitText((this.volts[0] - this.volts[2]) * this.ia + (this.volts[1] - this.volts[2]) * this.ic, 'W', false);
|
|
}
|
|
;
|
|
_.getInternalNodeCount = function getInternalNodeCount_13(){
|
|
return 1;
|
|
}
|
|
;
|
|
_.getPost = function getPost_22(n){
|
|
return n == 0?this.point1:n == 1?this.point2:this.gate[1];
|
|
}
|
|
;
|
|
_.getPostCount_0 = function getPostCount_62(){
|
|
return 3;
|
|
}
|
|
;
|
|
_.getPower = function getPower_11(){
|
|
return (this.volts[0] - this.volts[2]) * this.ia + (this.volts[1] - this.volts[2]) * this.ic;
|
|
}
|
|
;
|
|
_.nonLinear_0 = function nonLinear_22(){
|
|
return true;
|
|
}
|
|
;
|
|
_.reset_0 = function reset_42(){
|
|
this.volts[0] = this.volts[1] = this.volts[2] = 0;
|
|
this.diode.lastvoltdiff = 0;
|
|
this.lastvag = this.lastvac = this.curcount_a = this.curcount_c = this.curcount_g = 0;
|
|
}
|
|
;
|
|
_.setEditValue = function setEditValue_66(n, ei){
|
|
n == 0 && (this.triggerI = ei.value_0);
|
|
n == 1 && (this.holdingI = ei.value_0);
|
|
n == 2 && (this.gresistance = ei.value_0);
|
|
}
|
|
;
|
|
_.setPoints = function setPoints_62(){
|
|
var gatelen, leadlen, pa;
|
|
$setPoints(this);
|
|
this.dir_0 = 0;
|
|
if (abs_0(this.dx) > abs_0(this.dy)) {
|
|
this.dir_0 = -sign_0(this.dx) * sign_0(this.dy);
|
|
(this.flags & 1) != 0 && (this.dn = abs_0(this.dx));
|
|
this.point2.y_0 = this.point1.y_0;
|
|
}
|
|
else {
|
|
this.dir_0 = sign_0(this.dy) * sign_0(this.dx);
|
|
(this.flags & 1) != 0 && (this.dn = abs_0(this.dy));
|
|
this.point2.x_0 = this.point1.x_0;
|
|
}
|
|
this.dir_0 == 0 && (this.dir_0 = 1);
|
|
$calcLeads(this, 16);
|
|
this.cathode = $newPointArray(2);
|
|
pa = $newPointArray(2);
|
|
$interpPoint2(this.lead1, this.lead2, pa[0], pa[1], 0, 8);
|
|
$interpPoint2(this.lead1, this.lead2, this.cathode[0], this.cathode[1], 1, 8);
|
|
this.poly = $createPolygon(pa[0], pa[1], this.lead2);
|
|
this.gate = $newPointArray(2);
|
|
leadlen = (this.dn - 16) / 2;
|
|
gatelen = app_0.gridSize;
|
|
gatelen = round_int(gatelen + leadlen % app_0.gridSize);
|
|
if (leadlen < gatelen) {
|
|
this.x2 = this.x_0;
|
|
this.y2 = this.y_0;
|
|
return;
|
|
}
|
|
$interpPoint_2(this.lead2, this.point2, this.gate[0], gatelen / leadlen, gatelen * this.dir_0);
|
|
$interpPoint_2(this.lead2, this.point2, this.gate[1], gatelen / leadlen, app_0.gridSize * 2 * this.dir_0);
|
|
this.gate[1].x_0 = $snapGrid(this.gate[1].x_0);
|
|
this.gate[1].y_0 = $snapGrid(this.gate[1].y_0);
|
|
}
|
|
;
|
|
_.stamp = function stamp_57(){
|
|
$stampResistor(this.nodes[2], this.nodes[1], this.gresistance);
|
|
$stamp_0(this.diode, this.nodes[3], this.nodes[1]);
|
|
}
|
|
;
|
|
_.undumpXml = function undumpXml_74(xml){
|
|
this.flags = $parseIntAttr(xml, 'f', this.flags);
|
|
this.triggerI = $parseDoubleAttr(xml, 'tr', this.triggerI);
|
|
this.holdingI = $parseDoubleAttr(xml, 'ho', this.holdingI);
|
|
this.gresistance = $parseDoubleAttr(xml, 'gr', this.gresistance);
|
|
$setup_6(this);
|
|
}
|
|
;
|
|
_.aresistance = 0;
|
|
_.curcount_a = 0;
|
|
_.curcount_c = 0;
|
|
_.curcount_g = 0;
|
|
_.dir_0 = 0;
|
|
_.gresistance = 0;
|
|
_.holdingI = 0;
|
|
_.ia = 0;
|
|
_.ic = 0;
|
|
_.ig = 0;
|
|
_.lastvac = 0;
|
|
_.lastvag = 0;
|
|
_.triggerI = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_SCRElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'SCRElm', 385);
|
|
function $handle(){
|
|
var oFiles = $doc.getElementById('EditDialogLoadFileElement').files, nFiles = oFiles.length;
|
|
if (nFiles >= 1) {
|
|
if (oFiles[0].size >= 128000) {
|
|
alert_0(LS('Cannot load: That file is too large!'));
|
|
return;
|
|
}
|
|
var fileName = oFiles[0].name;
|
|
var reader = new FileReader;
|
|
reader.onload = function(e){
|
|
var arr = new Uint8Array(reader.result);
|
|
var str = '0x0:';
|
|
for (var i = 0; i < arr.length; i++)
|
|
str += ' 0x' + ('0' + arr[i].toString(16)).slice(-2).toUpperCase();
|
|
doLoadCallback_1(str, fileName);
|
|
}
|
|
;
|
|
reader.readAsArrayBuffer(oFiles[0]);
|
|
}
|
|
}
|
|
|
|
function SRAMLoadFile(){
|
|
FileUpload.call(this);
|
|
$setName_0(this, LS('Load File'));
|
|
($clinit_DOM() , this.element).id = 'EditDialogLoadFileElement';
|
|
$addDomHandler(this, this, ($clinit_ChangeEvent() , $clinit_ChangeEvent() , TYPE_0));
|
|
setStyleName(this.element, 'offScreen', true);
|
|
this.element.style['width'] = '0px';
|
|
this.element.style['height'] = '0px';
|
|
}
|
|
|
|
function doLoadCallback_1(data_0, fileName){
|
|
$clinit_ChipElm();
|
|
contentsOverride = data_0;
|
|
fileNameOverride = fileName;
|
|
$resetDialog(editDialog_0);
|
|
contentsOverride = null;
|
|
fileNameOverride = null;
|
|
}
|
|
|
|
defineClass(939, 938, $intern_117, SRAMLoadFile);
|
|
var Lcom_lushprojects_circuitjs1_client_SRAMLoadFile_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'SRAMLoadFile', 939);
|
|
function SchmittElm(xx, yy){
|
|
InvertingSchmittElm.call(this, xx, yy);
|
|
}
|
|
|
|
function SchmittElm_0(xa, ya, xb, yb, f, st){
|
|
InvertingSchmittElm_0.call(this, xa, ya, xb, yb, f, st);
|
|
}
|
|
|
|
defineClass(400, 271, $intern_85, SchmittElm, SchmittElm_0);
|
|
_.doStep = function doStep_44(){
|
|
var maxStep, out;
|
|
if (this.state) {
|
|
if (this.volts[0] > this.upperTrigger) {
|
|
this.state = false;
|
|
out = this.logicOnLevel;
|
|
}
|
|
else {
|
|
out = this.logicOffLevel;
|
|
}
|
|
}
|
|
else {
|
|
if (this.volts[0] < this.lowerTrigger) {
|
|
this.state = true;
|
|
out = this.logicOffLevel;
|
|
}
|
|
else {
|
|
out = this.logicOnLevel;
|
|
}
|
|
}
|
|
maxStep = this.slewRate * sim_0.timeStep * $intern_32;
|
|
out = $wnd.Math.max($wnd.Math.min(this.lastOutputVoltage + maxStep, out), this.lastOutputVoltage - maxStep);
|
|
$updateVoltageSource(this.voltSource, out);
|
|
}
|
|
;
|
|
_.draw = function draw_69(g){
|
|
$drawPosts(this, g);
|
|
$draw2Leads(this, g);
|
|
$setColor_0(g, mouseElmRef == this || this.selected_0 || $containsKey(app_0.mouse.scopePlotRoles, this) || instanceOf(mouseElmRef, 21) && $getElm_0(mouseElmRef.elmScope) == this || $isOnHighlightedNet(this)?selectColor_0:lightGrayColor);
|
|
drawThickPolygon(g, this.gatePoly);
|
|
g.context.lineWidth = 2;
|
|
drawPolygon(g, this.symbolPoly);
|
|
g.context.lineWidth = 1;
|
|
this.curcount_0 = $updateDotCount(this.current_0, this.curcount_0);
|
|
$drawDots(g, this.lead2, this.point2, this.curcount_0);
|
|
}
|
|
;
|
|
_.getCurrentIntoNode = function getCurrentIntoNode_29(n){
|
|
if (n == 1)
|
|
return this.current_0;
|
|
return 0;
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_93(){
|
|
return 182;
|
|
}
|
|
;
|
|
_.getInfo_0 = function getInfo_76(arr){
|
|
arr[0] = 'Schmitt Trigger~';
|
|
}
|
|
;
|
|
_.setPoints = function setPoints_63(){
|
|
var triPoints, ww;
|
|
$setPoints_13(this);
|
|
ww = 16;
|
|
16 > this.dn / 2 && (ww = round_int(this.dn / 2));
|
|
this.lead1 = $interpPoint(this.point1, this.point2, 0.5 - ww / this.dn);
|
|
this.lead2 = $interpPoint(this.point1, this.point2, 0.5 + (ww - 3) / this.dn);
|
|
triPoints = $newPointArray(3);
|
|
$interpPoint2(this.lead1, this.lead2, triPoints[0], triPoints[1], 0, 16);
|
|
triPoints[2] = $interpPoint(this.point1, this.point2, 0.5 + (ww - 5) / this.dn);
|
|
this.gatePoly = $createPolygon_1(triPoints);
|
|
}
|
|
;
|
|
_.startIteration = function startIteration_18(){
|
|
this.lastOutputVoltage = this.volts[1];
|
|
}
|
|
;
|
|
_.lastOutputVoltage = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_SchmittElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'SchmittElm', 400);
|
|
function $clinit_Scope(){
|
|
$clinit_Scope = emptyMethod;
|
|
multa = stampJavaTypeInfo(getClassLiteralForArray(D_classLit, 1), $intern_76, 7, 15, [2, 2.5, 2]);
|
|
}
|
|
|
|
function $addElm(this$static, ce){
|
|
instanceOf(ce, 153)?$addValue(this$static, 6, ce):$addValue(this$static, 0, ce);
|
|
}
|
|
|
|
function $addElmRole(roles, elm, role){
|
|
var existing;
|
|
if (!elm)
|
|
return;
|
|
existing = getEntryValueOrNull($getEntry(roles.hashCodeMap, elm));
|
|
$put_1(roles.hashCodeMap, elm, existing == null?role:existing + '/' + role);
|
|
}
|
|
|
|
function $addPlotRole(this$static, roles, idx, role){
|
|
if (idx < 0 || idx >= this$static.plots.arrayList.array.length)
|
|
return;
|
|
$addElmRole(roles, $get_4(this$static.plots, idx).elm, role);
|
|
}
|
|
|
|
function $addScopePlotRoles(this$static, roles){
|
|
var p, p$iterator;
|
|
if (this$static.plot2d.plotXY) {
|
|
$addPlotRole(this$static, roles, this$static.plot2d.plotX, 'X');
|
|
$addPlotRole(this$static, roles, this$static.plot2d.plotY, 'Y');
|
|
$addPlotRole(this$static, roles, this$static.plot2d.plotBrightness, 'Br');
|
|
$addPlotRole(this$static, roles, this$static.plot2d.plotColorR, 'R');
|
|
$addPlotRole(this$static, roles, this$static.plot2d.plotColorG, 'G');
|
|
$addPlotRole(this$static, roles, this$static.plot2d.plotColorB, 'B');
|
|
}
|
|
else {
|
|
for (p$iterator = new ArrayList$1(this$static.visiblePlots.arrayList); p$iterator.i < p$iterator.this$01.array.length;) {
|
|
p = $next_4(p$iterator);
|
|
!!p.elm && $addElmRole(roles, p.elm, '');
|
|
}
|
|
}
|
|
}
|
|
|
|
function $addValue(this$static, val, ce){
|
|
var u;
|
|
if (val == 0) {
|
|
$add_11(this$static.plots, new ScopePlot_0(ce, 0, 0, $getManScaleFromMaxScale(this$static, 0, false)));
|
|
!!ce && this$static.app.menus.dotsCheckItem.on && !(instanceOf(ce, 241) || instanceOf(ce, 264) || instanceOf(ce, 245) || instanceOf(ce, 265) || instanceOf(ce, 242)) && $add_11(this$static.plots, new ScopePlot_0(ce, 1, 3, $getManScaleFromMaxScale(this$static, 1, false)));
|
|
}
|
|
else {
|
|
u = ce.getScopeUnits(val);
|
|
$add_11(this$static.plots, new ScopePlot_0(ce, u, val, $getManScaleFromMaxScale(this$static, u, false)));
|
|
u == 0 && (this$static.showV = true);
|
|
u == 1 && (this$static.showI = true);
|
|
}
|
|
$calcVisiblePlots(this$static);
|
|
$resetGraph(this$static, false);
|
|
}
|
|
|
|
function $calcGridParams(this$static, plot, allPlotsSameUnits){
|
|
var gridMax, gridMid, maxy, mn, multptr, mx, positionOffset;
|
|
maxy = (this$static.rect_0.height_0 - 1) / 2 | 0;
|
|
if (this$static.manualScale) {
|
|
gridMid = 0;
|
|
gridMax = (this$static.manDivisions / 2 + 0.05) * plot.manScale;
|
|
positionOffset = gridMax * 2 * plot.manVPosition / 200;
|
|
this$static.gridStepY = plot.manScale;
|
|
}
|
|
else {
|
|
gridMax = this$static.scale_0[plot.units];
|
|
gridMid = 0;
|
|
positionOffset = 0;
|
|
if (allPlotsSameUnits) {
|
|
mx = gridMax;
|
|
mn = 0;
|
|
if (this$static.maxScale) {
|
|
mx = this$static.maxValue;
|
|
mn = this$static.minValue;
|
|
}
|
|
else if (this$static.showNegative || this$static.minValue < (gridMax + mn) * 0.5 - (gridMax - mn) * 0.55) {
|
|
mn = -gridMax;
|
|
this$static.showNegative = true;
|
|
}
|
|
gridMid = (mx + mn) * 0.5;
|
|
gridMax = (mx - mn) * 0.55;
|
|
}
|
|
this$static.gridStepY = $intern_112;
|
|
multptr = 0;
|
|
while (this$static.gridStepY < 20 * gridMax / maxy)
|
|
this$static.gridStepY *= multa[multptr++ % 3];
|
|
}
|
|
plot.plotOffset = -gridMid + positionOffset;
|
|
plot.gridMult = maxy / gridMax;
|
|
return gridMid;
|
|
}
|
|
|
|
function $calcGridStepX(this$static){
|
|
var gsx, multptr, ts;
|
|
multptr = 0;
|
|
gsx = $intern_114;
|
|
ts = this$static.sim.maxTimeStep * this$static.speed;
|
|
while (gsx < ts * 20) {
|
|
gsx *= multa[multptr++ % 3];
|
|
}
|
|
return gsx;
|
|
}
|
|
|
|
function $calcMaxAndMin(this$static, units){
|
|
var i$iterator, plot, plot$iterator, sdi;
|
|
this$static.maxValue = -100000000;
|
|
this$static.minValue = $intern_97;
|
|
for (plot$iterator = new ArrayList$1(this$static.visiblePlots.arrayList); plot$iterator.i < plot$iterator.this$01.array.length;) {
|
|
plot = $next_4(plot$iterator);
|
|
if (plot.units != units)
|
|
continue;
|
|
sdi = new ScopeDataIterator(this$static, plot);
|
|
for (i$iterator = new ScopeDataIterator$1(sdi); i$iterator.i < i$iterator.this$01.validCount;) {
|
|
i$iterator.this$01.currentIp = i$iterator.i + i$iterator.this$01.ipa & i$iterator.this$01.scopePointCount - 1;
|
|
valueOf_0(i$iterator.i++);
|
|
sdi.plot.maxValues[sdi.currentIp] > this$static.maxValue && (this$static.maxValue = sdi.plot.maxValues[sdi.currentIp]);
|
|
sdi.plot.minValues[sdi.currentIp] < this$static.minValue && (this$static.minValue = sdi.plot.minValues[sdi.currentIp]);
|
|
}
|
|
}
|
|
}
|
|
|
|
function $calcPlotScale(this$static, plot){
|
|
var gridMax, i$iterator, max_0, sdi;
|
|
if (this$static.manualScale)
|
|
return;
|
|
max_0 = 0;
|
|
gridMax = this$static.scale_0[plot.units];
|
|
sdi = new ScopeDataIterator(this$static, plot);
|
|
for (i$iterator = new ScopeDataIterator$1(sdi); i$iterator.i < i$iterator.this$01.validCount;) {
|
|
i$iterator.this$01.currentIp = i$iterator.i + i$iterator.this$01.ipa & i$iterator.this$01.scopePointCount - 1;
|
|
valueOf_0(i$iterator.i++);
|
|
sdi.plot.maxValues[sdi.currentIp] > max_0 && (max_0 = sdi.plot.maxValues[sdi.currentIp]);
|
|
sdi.plot.minValues[sdi.currentIp] < -max_0 && (max_0 = -sdi.plot.minValues[sdi.currentIp]);
|
|
}
|
|
if (this$static.maxScale)
|
|
gridMax = $wnd.Math.max(max_0, gridMax);
|
|
else
|
|
while (max_0 > gridMax)
|
|
gridMax *= 2;
|
|
this$static.scale_0[plot.units] = gridMax;
|
|
}
|
|
|
|
function $calcVisiblePlots(this$static){
|
|
var ac, i, oc, plot, vc;
|
|
this$static.visiblePlots = new Vector;
|
|
vc = 0;
|
|
ac = 0;
|
|
oc = 0;
|
|
if (this$static.plot2d.enabled) {
|
|
for (i = 0; i < this$static.plots.arrayList.array.length; i++)
|
|
$add_11(this$static.visiblePlots, $get_4(this$static.plots, i));
|
|
}
|
|
else {
|
|
for (i = 0; i != this$static.plots.arrayList.array.length; i++) {
|
|
plot = $get_4(this$static.plots, i);
|
|
if (plot.value_0 == 0) {
|
|
if (this$static.showV) {
|
|
$add_11(this$static.visiblePlots, plot);
|
|
$assignColor(plot, vc++);
|
|
}
|
|
}
|
|
else if (plot.value_0 == 3) {
|
|
if (this$static.showI) {
|
|
$add_11(this$static.visiblePlots, plot);
|
|
$assignColor(plot, ac++);
|
|
}
|
|
}
|
|
else {
|
|
$add_11(this$static.visiblePlots, plot);
|
|
$assignColor(plot, oc++);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
function $canShowRMS(this$static){
|
|
var plot;
|
|
if (this$static.visiblePlots.arrayList.array.length == 0)
|
|
return false;
|
|
plot = $firstElement(this$static.visiblePlots);
|
|
return plot.units == 0 || plot.units == 1;
|
|
}
|
|
|
|
function $checkForSelection(this$static, mouseX, mouseY){
|
|
var best, bestdist, dist, i, ip, ipa, maxvy, maxy, plot;
|
|
if ($dialogIsShowing(this$static.app.ui))
|
|
return;
|
|
if (this$static.draggingPlotY)
|
|
return;
|
|
if (!$contains(this$static.rect_0, mouseX, mouseY)) {
|
|
this$static.selectedPlot = -1;
|
|
return;
|
|
}
|
|
if (this$static.plots.arrayList.array.length == 0) {
|
|
this$static.selectedPlot = -1;
|
|
return;
|
|
}
|
|
ipa = $displayStartIndex(this$static, $get_4(this$static.plots, 0), this$static.rect_0.width_0);
|
|
ip = mouseX - this$static.rect_0.x_0 + ipa & this$static.scopePointCount - 1;
|
|
maxy = (this$static.rect_0.height_0 - 1) / 2 | 0;
|
|
bestdist = $intern_88;
|
|
best = -1;
|
|
for (i = 0; i != this$static.visiblePlots.arrayList.array.length; i++) {
|
|
plot = $get_4(this$static.visiblePlots, i);
|
|
maxvy = round_int(plot.gridMult * (plot.maxValues[ip] + plot.plotOffset));
|
|
dist = $wnd.Math.abs(mouseY - (this$static.rect_0.y_0 + maxy - maxvy));
|
|
if (dist < bestdist) {
|
|
bestdist = dist;
|
|
best = i;
|
|
}
|
|
}
|
|
this$static.selectedPlot = best;
|
|
this$static.selectedPlot >= 0 && (cursorUnits = $get_4(this$static.visiblePlots, this$static.selectedPlot).units);
|
|
}
|
|
|
|
function $checkForSelectionElsewhere(this$static){
|
|
var i, p;
|
|
if (cursorScope == this$static)
|
|
return;
|
|
if (this$static.draggingPlotY)
|
|
return;
|
|
if (!cursorScope || this$static.visiblePlots.arrayList.array.length == 0) {
|
|
this$static.selectedPlot = -1;
|
|
return;
|
|
}
|
|
for (i = 0; i != this$static.visiblePlots.arrayList.array.length; i++) {
|
|
p = $get_4(this$static.visiblePlots, i);
|
|
if (p.units == cursorUnits) {
|
|
this$static.selectedPlot = i;
|
|
return;
|
|
}
|
|
}
|
|
this$static.selectedPlot = 0;
|
|
}
|
|
|
|
function $combine(this$static, s){
|
|
this$static.plots = this$static.visiblePlots;
|
|
$addAll_1(this$static.plots, s.visiblePlots);
|
|
s.plots.arrayList.array = initUnidimensionalArray(Ljava_lang_Object_2_classLit, $intern_3, 1, 0, 5, 1);
|
|
$calcVisiblePlots(this$static);
|
|
}
|
|
|
|
function $cursorInSettingsWheel(this$static){
|
|
return this$static.rect_0.height_0 > 100 && this$static.rect_0.width_0 > 100 && this$static.app.mouse.mouseCursorX >= this$static.rect_0.x_0 && this$static.app.mouse.mouseCursorX <= this$static.rect_0.x_0 + 36 && this$static.app.mouse.mouseCursorY >= this$static.rect_0.y_0 + this$static.rect_0.height_0 - 36 && this$static.app.mouse.mouseCursorY <= this$static.rect_0.y_0 + this$static.rect_0.height_0;
|
|
}
|
|
|
|
function $displayStartIndex(this$static, plot, w){
|
|
return $displayStartIndex_0(this$static.trigger, plot, w, this$static.scopePointCount);
|
|
}
|
|
|
|
function $dragPlotY(this$static, mouseY){
|
|
var dy, maxy, newPos;
|
|
if (this$static.selectedPlot < 0 || this$static.selectedPlot >= this$static.visiblePlots.arrayList.array.length)
|
|
return;
|
|
maxy = $wnd.Math.max(1, (this$static.rect_0.height_0 - 1) / 2 | 0);
|
|
dy = mouseY - this$static.dragPlotYMouseStart;
|
|
newPos = this$static.dragPlotYInitialPosition - toInt_0(fromDouble_0($wnd.Math.round(dy * 200 / (2 * maxy))));
|
|
newPos = $wnd.Math.max(-200, $wnd.Math.min(200, newPos));
|
|
$get_4(this$static.visiblePlots, this$static.selectedPlot).manVPosition = newPos;
|
|
}
|
|
|
|
function $draw_2(this$static, g){
|
|
var allPlotsSameUnits, i, plot, sel, si, somethingSelectedHere;
|
|
if (this$static.plots.arrayList.array.length == 0)
|
|
return;
|
|
if (this$static.scopeTimeStep != this$static.sim.maxTimeStep) {
|
|
this$static.scopeTimeStep = this$static.sim.maxTimeStep;
|
|
$resetGraph(this$static, false);
|
|
}
|
|
if (this$static.plot2d.enabled) {
|
|
$draw_5(this$static.plot2d, g);
|
|
return;
|
|
}
|
|
$drawSettingsWheel(this$static, g);
|
|
g.context.save();
|
|
$setColor_0(g, ($clinit_Color() , red));
|
|
$translate(g.context, this$static.rect_0.x_0, this$static.rect_0.y_0);
|
|
$clipRect(g, this$static.rect_0.width_0, this$static.rect_0.height_0);
|
|
if (this$static.fftPlot.enabled) {
|
|
$drawVerticalGridLines(this$static.fftPlot, g);
|
|
$draw_3(this$static.fftPlot, g);
|
|
}
|
|
for (i = 0; i != 5; i++) {
|
|
this$static.reduceRange[i] = false;
|
|
this$static.maxScale && !this$static.manualScale && (this$static.scale_0[i] = $intern_87);
|
|
}
|
|
this$static.somethingSelected = false;
|
|
for (si = 0; si != this$static.visiblePlots.arrayList.array.length; si++) {
|
|
plot = $get_4(this$static.visiblePlots, si);
|
|
$calcPlotScale(this$static, plot);
|
|
this$static.app.scopeManager.scopeSelected == -1 && !!plot.elm && $isMouseElm(plot.elm) && (this$static.somethingSelected = true);
|
|
this$static.reduceRange[plot.units] = true;
|
|
}
|
|
sel = $scopeMenuIsSelected(this$static.app.scopeManager, this$static);
|
|
somethingSelectedHere = this$static.somethingSelected;
|
|
$checkForSelectionElsewhere(this$static);
|
|
this$static.selectedPlot >= 0 && (this$static.somethingSelected = true);
|
|
if (somethingSelectedHere || sel) {
|
|
g.context.save();
|
|
g.context.globalAlpha = 0.15;
|
|
$setColor_0(g, selectColor_0);
|
|
$fillRect_0(g, 0, 0, this$static.rect_0.width_0, this$static.rect_0.height_0);
|
|
g.context.restore();
|
|
}
|
|
!!$getSingleElm(this$static) && (this$static.somethingSelected = false);
|
|
this$static.drawGridLines = true;
|
|
allPlotsSameUnits = true;
|
|
for (i = 1; i < this$static.visiblePlots.arrayList.array.length; i++) {
|
|
$get_4(this$static.visiblePlots, i).units != $get_4(this$static.visiblePlots, 0).units && (allPlotsSameUnits = false);
|
|
}
|
|
(allPlotsSameUnits || this$static.showMax || this$static.showMin || this$static.showP2P) && this$static.visiblePlots.arrayList.array.length > 0 && $calcMaxAndMin(this$static, $firstElement(this$static.visiblePlots).units);
|
|
for (i = 0; i != this$static.visiblePlots.arrayList.array.length; i++) {
|
|
$get_4(this$static.visiblePlots, i).units > 1 && i != this$static.selectedPlot && $drawPlot(this$static, g, $get_4(this$static.visiblePlots, i), allPlotsSameUnits, false, sel);
|
|
}
|
|
for (i = 0; i != this$static.visiblePlots.arrayList.array.length; i++) {
|
|
$get_4(this$static.visiblePlots, i).units == 1 && i != this$static.selectedPlot && $drawPlot(this$static, g, $get_4(this$static.visiblePlots, i), allPlotsSameUnits, false, sel);
|
|
}
|
|
for (i = 0; i != this$static.visiblePlots.arrayList.array.length; i++) {
|
|
$get_4(this$static.visiblePlots, i).units == 0 && i != this$static.selectedPlot && $drawPlot(this$static, g, $get_4(this$static.visiblePlots, i), allPlotsSameUnits, false, sel);
|
|
}
|
|
this$static.selectedPlot >= 0 && this$static.selectedPlot < this$static.visiblePlots.arrayList.array.length && $drawPlot(this$static, g, $get_4(this$static.visiblePlots, this$static.selectedPlot), allPlotsSameUnits, true, sel);
|
|
$drawIndicator(this$static.trigger, g, this$static.visiblePlots, this$static.rect_0);
|
|
$draw_4(this$static.overlays, g);
|
|
g.context.restore();
|
|
g.currentFontSize = g.savedFontSize;
|
|
$drawCursor(this$static, g);
|
|
if ($get_4(this$static.plots, 0).ptr > 5 && !this$static.manualScale) {
|
|
for (i = 0; i != 5; i++)
|
|
this$static.scale_0[i] > $intern_87 && this$static.reduceRange[i] && (this$static.scale_0[i] /= 2);
|
|
}
|
|
!!this$static.properties && this$static.properties.showing && $refreshDraw(this$static.properties);
|
|
}
|
|
|
|
function $drawCursor(this$static, g){
|
|
var ct, cursorValue, cursorX, deltaT, dragX, info, plot, startValue;
|
|
if ($dialogIsShowing(this$static.app.ui))
|
|
return;
|
|
if (!cursorScope)
|
|
return;
|
|
info = initUnidimensionalArray(Ljava_lang_String_2_classLit, $intern_23, 2, 7, 6, 1);
|
|
cursorX = -1;
|
|
ct = 0;
|
|
cursorValue = NaN;
|
|
plot = this$static.visiblePlots.arrayList.array.length > 0?$get_4(this$static.visiblePlots, this$static.selectedPlot >= 0?this$static.selectedPlot:0):null;
|
|
if (cursorTime >= 0) {
|
|
cursorX = $timeToX(this$static, cursorTime);
|
|
if (plot) {
|
|
cursorValue = $drawPlotDot(this$static, g, plot, cursorX);
|
|
dragStartTime < 0 && !isNaN(cursorValue) && (info[ct++] = $getUnitText(plot, cursorValue));
|
|
}
|
|
}
|
|
if (this$static.fftPlot.enabled && cursorScope == this$static) {
|
|
cursorX < 0 && (cursorX = this$static.app.mouse.mouseCursorX);
|
|
ct = $addCursorInfo(this$static.fftPlot, info, ct, this$static.app.mouse.mouseCursorX);
|
|
}
|
|
else if (cursorX < this$static.rect_0.x_0)
|
|
return;
|
|
if (dragStartTime >= 0 && cursorScope == this$static && !!plot && !this$static.plot2d.enabled && !this$static.fftPlot.enabled) {
|
|
dragX = $timeToX(this$static, dragStartTime);
|
|
if (dragX >= this$static.rect_0.x_0 && dragX < this$static.rect_0.x_0 + this$static.rect_0.width_0) {
|
|
$setColor_0(g, lightGrayColor);
|
|
$drawLine(g, dragX, this$static.rect_0.y_0, dragX, this$static.rect_0.y_0 + this$static.rect_0.height_0);
|
|
startValue = $drawPlotDot(this$static, g, plot, dragX);
|
|
deltaT = cursorTime - dragStartTime;
|
|
info[ct++] = '\u0394t=' + getTimeText($wnd.Math.abs(deltaT));
|
|
if (!isNaN(cursorValue) && !isNaN(startValue)) {
|
|
info[ct++] = '\u0394=' + $getUnitText(plot, cursorValue - startValue);
|
|
info[ct++] = $getUnitText(plot, cursorValue);
|
|
}
|
|
}
|
|
}
|
|
this$static.visiblePlots.arrayList.array.length > 0 && (info[ct++] = getTimeText(cursorTime));
|
|
if (cursorScope != this$static) {
|
|
if (this$static.rect_0.height_0 < 40 || this$static.position >= 0 && cursorScope.position == this$static.position) {
|
|
$drawCursorInfo(this$static, g, null, 0, cursorX, ($clinit_Boolean() , false));
|
|
return;
|
|
}
|
|
}
|
|
$drawCursorInfo(this$static, g, info, ct, cursorX, ($clinit_Boolean() , false));
|
|
}
|
|
|
|
function $drawCursorInfo(this$static, g, info, ct, x_0, drawY){
|
|
var bx, i, szh, szw, w;
|
|
szw = 0;
|
|
szh = 15 * ct;
|
|
for (i = 0; i != ct; i++) {
|
|
w = round_int($measureText(g.context, info[i]).width);
|
|
w > szw && (szw = w);
|
|
}
|
|
$setColor_0(g, whiteColor);
|
|
$drawLine(g, x_0, this$static.rect_0.y_0, x_0, this$static.rect_0.y_0 + this$static.rect_0.height_0);
|
|
(checkCriticalNotNull(drawY) , drawY) && $drawLine(g, this$static.rect_0.x_0, this$static.app.mouse.mouseCursorY, this$static.rect_0.x_0 + this$static.rect_0.width_0, this$static.app.mouse.mouseCursorY);
|
|
$setColor_0(g, this$static.app.menus.printableCheckItem.on?($clinit_Color() , white):($clinit_Color() , black));
|
|
bx = x_0;
|
|
x_0 < (szw / 2 | 0) && (bx = szw / 2 | 0);
|
|
$fillRect_0(g, bx - (szw / 2 | 0), this$static.rect_0.y_0 - szh, szw, szh);
|
|
$setColor_0(g, whiteColor);
|
|
for (i = 0; i != ct; i++) {
|
|
w = round_int($measureText(g.context, info[i]).width);
|
|
$drawString(g, info[i], bx - (w / 2 | 0), this$static.rect_0.y_0 - 2 - (ct - 1 - i) * 15);
|
|
}
|
|
}
|
|
|
|
function $drawHVGridLines(this$static, g, plot, gridMid, allPlotsSameUnits, allSelected){
|
|
var gx, highlightCenter, ll, ll0, majorDiv, maxy, minorDiv, showHGridLines, tRight, tl, ts, tstart, tx, yl;
|
|
maxy = (this$static.rect_0.height_0 - 1) / 2 | 0;
|
|
minorDiv = '#404040';
|
|
majorDiv = '#A0A0A0';
|
|
if (this$static.app.menus.printableCheckItem.on) {
|
|
minorDiv = '#D0D0D0';
|
|
majorDiv = '#808080';
|
|
}
|
|
allSelected && (majorDiv = $getHexValue(selectColor_0));
|
|
highlightCenter = !this$static.manualScale;
|
|
showHGridLines = this$static.gridStepY != 0 && (this$static.manualScale || allPlotsSameUnits);
|
|
for (ll0 = -100; ll0 <= 100; ll0++) {
|
|
if (ll0 != 0 && !showHGridLines)
|
|
continue;
|
|
yl = maxy - round_int((ll0 * this$static.gridStepY - gridMid) * plot.gridMult);
|
|
if (yl < 0 || yl >= this$static.rect_0.height_0 - 1)
|
|
continue;
|
|
$setStrokeStyleWeb(g.context, ll0 == 0 && highlightCenter?majorDiv:minorDiv);
|
|
$setFillStyleWeb(g.context, ll0 == 0 && highlightCenter?majorDiv:minorDiv);
|
|
$drawLine(g, 0, yl, this$static.rect_0.width_0 - 1, yl);
|
|
}
|
|
ts = this$static.sim.maxTimeStep * this$static.speed;
|
|
tRight = $isTriggered(this$static.trigger)?this$static.trigger.time + ts * this$static.rect_0.width_0 / 2:this$static.sim.t;
|
|
tstart = tRight - ts * this$static.rect_0.width_0;
|
|
tx = tRight - tRight % this$static.gridStepX;
|
|
for (ll = 0;; ll++) {
|
|
tl = tx - this$static.gridStepX * ll;
|
|
gx = round_int((tl - tstart) / ts);
|
|
if (gx < 0)
|
|
break;
|
|
if (gx >= this$static.rect_0.width_0 || tl < 0)
|
|
continue;
|
|
$setColor_1(g, (tl + this$static.gridStepX / 4) % (this$static.gridStepX * 10) < this$static.gridStepX?majorDiv:minorDiv);
|
|
$drawLine(g, gx, 0, gx, this$static.rect_0.height_0 - 1);
|
|
}
|
|
}
|
|
|
|
function $drawInfoText(this$static, g, text_0){
|
|
$drawInfoText_0(this$static.overlays, g, text_0);
|
|
}
|
|
|
|
function $drawPlot(this$static, g, plot, allPlotsSameUnits, selected, allSelected){
|
|
var color_0, drawWidth, gridMid, i, ip, ipa, maxV, maxvy, maxy, minRangeHi, minRangeLo, minV, minvy, ox, oy, y0;
|
|
if (!plot.elm)
|
|
return;
|
|
maxy = (this$static.rect_0.height_0 - 1) / 2 | 0;
|
|
color_0 = this$static.somethingSelected?'#A0A0A0':plot.color_0;
|
|
allSelected || this$static.app.scopeManager.scopeSelected == -1 && !$getSingleElm(this$static) && $isMouseElm(plot.elm)?(color_0 = $getHexValue(selectColor_0)):selected && (color_0 = plot.color_0);
|
|
ipa = $displayStartIndex(this$static, plot, this$static.rect_0.width_0);
|
|
maxV = plot.maxValues;
|
|
minV = plot.minValues;
|
|
gridMid = $calcGridParams(this$static, plot, allPlotsSameUnits);
|
|
minRangeLo = -10 - round_int(gridMid * plot.gridMult);
|
|
minRangeHi = 10 - round_int(gridMid * plot.gridMult);
|
|
this$static.gridStepX = $calcGridStepX(this$static);
|
|
this$static.drawGridLines && $drawHVGridLines(this$static, g, plot, gridMid, allPlotsSameUnits, allSelected);
|
|
this$static.drawGridLines = false;
|
|
$setStrokeStyleWeb(g.context, color_0);
|
|
$setFillStyleWeb(g.context, color_0);
|
|
if (this$static.manualScale) {
|
|
y0 = maxy - round_int(plot.gridMult * plot.plotOffset);
|
|
$drawLine(g, 0, y0, 8, y0);
|
|
$fillText(g.context, '0', 0, y0 - 2);
|
|
}
|
|
drawWidth = $validDataCount(this$static, plot, ipa, this$static.rect_0.width_0);
|
|
ox = -1;
|
|
oy = -1;
|
|
for (i = 0; i != drawWidth; i++) {
|
|
ip = i + ipa & this$static.scopePointCount - 1;
|
|
minvy = toInt_0(fromDouble_0($wnd.Math.round(plot.gridMult * (minV[ip] + plot.plotOffset))));
|
|
maxvy = toInt_0(fromDouble_0($wnd.Math.round(plot.gridMult * (maxV[ip] + plot.plotOffset))));
|
|
if (minvy <= maxy) {
|
|
if (minvy < minRangeLo || maxvy > minRangeHi) {
|
|
this$static.reduceRange[plot.units] = false;
|
|
minRangeLo = -1000;
|
|
minRangeHi = $intern_22;
|
|
}
|
|
if (ox != -1) {
|
|
if (minvy == oy && maxvy == oy)
|
|
continue;
|
|
$drawLine(g, ox, maxy - oy, i, maxy - oy);
|
|
ox = oy = -1;
|
|
}
|
|
if (minvy == maxvy) {
|
|
ox = i;
|
|
oy = minvy;
|
|
continue;
|
|
}
|
|
$drawLine(g, i, maxy - minvy, i, maxy - maxvy);
|
|
}
|
|
}
|
|
ox != -1 && $drawLine(g, ox, maxy - oy, i - 1, maxy - oy);
|
|
}
|
|
|
|
function $drawPlotDot(this$static, g, plot, x_0){
|
|
var dotY, ip, ipa, value_0, vy;
|
|
if (x_0 < this$static.rect_0.x_0 || x_0 >= this$static.rect_0.x_0 + this$static.rect_0.width_0)
|
|
return NaN;
|
|
ipa = $displayStartIndex(this$static, $get_4(this$static.plots, 0), this$static.rect_0.width_0);
|
|
ip = x_0 - this$static.rect_0.x_0 + ipa & this$static.scopePointCount - 1;
|
|
value_0 = plot.maxValues[ip];
|
|
vy = round_int(plot.gridMult * (value_0 + plot.plotOffset));
|
|
dotY = this$static.rect_0.y_0 + ((this$static.rect_0.height_0 - 1) / 2 | 0) - vy;
|
|
$setColor_1(g, plot.color_0);
|
|
dotY >= this$static.rect_0.y_0 && dotY < this$static.rect_0.y_0 + this$static.rect_0.height_0 && $fillOval(g, x_0 - 2, dotY - 2, 5);
|
|
return value_0;
|
|
}
|
|
|
|
function $drawSettingsWheel(this$static, g){
|
|
if (this$static.rect_0.height_0 > 100 && this$static.rect_0.width_0 > 100) {
|
|
g.context.save();
|
|
this$static.rect_0.height_0 > 100 && this$static.rect_0.width_0 > 100 && this$static.app.mouse.mouseCursorX >= this$static.rect_0.x_0 && this$static.app.mouse.mouseCursorX <= this$static.rect_0.x_0 + 36 && this$static.app.mouse.mouseCursorY >= this$static.rect_0.y_0 + this$static.rect_0.height_0 - 36 && this$static.app.mouse.mouseCursorY <= this$static.rect_0.y_0 + this$static.rect_0.height_0?$setColor_0(g, selectColor_0):$setColor_0(g, ($clinit_Color() , dark_gray));
|
|
$translate(g.context, this$static.rect_0.x_0 + 18, this$static.rect_0.y_0 + this$static.rect_0.height_0 - 18);
|
|
drawThickCircle(g, 0, 0, 5);
|
|
drawThickLine(g, -8, 0, -5, 0);
|
|
drawThickLine(g, 8, 0, 5, 0);
|
|
drawThickLine(g, 0, -8, 0, -5);
|
|
drawThickLine(g, 0, 8, 0, 5);
|
|
drawThickLine(g, -6, -6, -4, -4);
|
|
drawThickLine(g, 6, -6, 4, -4);
|
|
drawThickLine(g, -6, 6, -4, 4);
|
|
drawThickLine(g, 6, 6, 4, 4);
|
|
g.context.restore();
|
|
}
|
|
}
|
|
|
|
function $dumpXml_10(this$static, doc, root){
|
|
$dumpXml_11(this$static.serializer, doc, root);
|
|
}
|
|
|
|
function $exportCSV(this$static){
|
|
var i, ip, j, name_0, plot, sb, t, tStart, ts, unit, w;
|
|
if (this$static.visiblePlots.arrayList.array.length == 0)
|
|
return;
|
|
sb = new StringBuilder;
|
|
sb.string += 'time';
|
|
for (i = 0; i != this$static.visiblePlots.arrayList.array.length; i++) {
|
|
plot = $get_4(this$static.visiblePlots, i);
|
|
name_0 = $replace_0($getSimpleName(plot.elm.___clazz), 'Elm', '');
|
|
unit = getScaleUnitsText(plot.units);
|
|
sb.string += ',"' + name_0 + ' ' + unit + ' min"';
|
|
sb.string += ',"' + name_0 + ' ' + unit + ' max"';
|
|
}
|
|
sb.string += '\n';
|
|
$get_4(this$static.visiblePlots, 0);
|
|
w = this$static.rect_0.width_0;
|
|
ts = this$static.sim.maxTimeStep * this$static.speed;
|
|
tStart = this$static.sim.t - ts * w;
|
|
for (i = 0; i != w; i++) {
|
|
t = tStart + ts * i;
|
|
if (t < 0)
|
|
continue;
|
|
sb.string += t;
|
|
for (j = 0; j != this$static.visiblePlots.arrayList.array.length; j++) {
|
|
plot = $get_4(this$static.visiblePlots, j);
|
|
ip = i + (plot.ptr + plot.scopePointCount - w) & plot.scopePointCount - 1;
|
|
$append_4(sb, ',' + plot.minValues[ip]);
|
|
$append_4(sb, ',' + plot.maxValues[ip]);
|
|
}
|
|
sb.string += '\n';
|
|
}
|
|
downloadCSV(sb.string, 'scope-data.csv');
|
|
}
|
|
|
|
function $getElm_0(this$static){
|
|
if (this$static.selectedPlot >= 0 && this$static.visiblePlots.arrayList.array.length > this$static.selectedPlot)
|
|
return $get_4(this$static.visiblePlots, this$static.selectedPlot).elm;
|
|
return this$static.visiblePlots.arrayList.array.length > 0?$get_4(this$static.visiblePlots, 0).elm:$get_4(this$static.plots, 0).elm;
|
|
}
|
|
|
|
function $getManScaleFromMaxScale(this$static, units, roundUp){
|
|
var s;
|
|
s = this$static.scale_0[units];
|
|
units > 1 && (s = 0.5 * s);
|
|
return roundUp?nextHighestScale(2 * s / this$static.manDivisions):2 * s / this$static.manDivisions;
|
|
}
|
|
|
|
function $getScaleUnitsText(this$static){
|
|
var p;
|
|
if (this$static.visiblePlots.arrayList.array.length == 0)
|
|
return 'V';
|
|
p = $get_4(this$static.visiblePlots, 0);
|
|
return getScaleUnitsText(p.units);
|
|
}
|
|
|
|
function $getScaleValue(this$static){
|
|
var p;
|
|
if (this$static.visiblePlots.arrayList.array.length == 0)
|
|
return 0;
|
|
p = $get_4(this$static.visiblePlots, 0);
|
|
return this$static.scale_0[p.units];
|
|
}
|
|
|
|
function $getScopeLabelOrText(this$static, forInfo){
|
|
var t;
|
|
t = this$static.text_0;
|
|
if (t == null) {
|
|
if (forInfo && this$static.showElmInfo)
|
|
return null;
|
|
t = $getScopeText(this$static);
|
|
if (t == null)
|
|
return '';
|
|
return LS(t);
|
|
}
|
|
else
|
|
return t;
|
|
}
|
|
|
|
function $getScopeText(this$static){
|
|
var plot;
|
|
if (this$static.stackCount != 1)
|
|
return null;
|
|
if (this$static.selectedPlot < 0 && !$getSingleElm(this$static))
|
|
return null;
|
|
if (this$static.visiblePlots.arrayList.array.length == 0)
|
|
return null;
|
|
plot = $firstElement(this$static.visiblePlots);
|
|
this$static.selectedPlot >= 0 && this$static.visiblePlots.arrayList.array.length > this$static.selectedPlot && (plot = $get_4(this$static.visiblePlots, this$static.selectedPlot));
|
|
return !plot.elm?'':plot.elm.getScopeText(plot.value_0);
|
|
}
|
|
|
|
function $getSingleElm(this$static){
|
|
var elm, i;
|
|
elm = $get_4(this$static.plots, 0).elm;
|
|
for (i = 1; i < this$static.plots.arrayList.array.length; i++) {
|
|
if ($get_4(this$static.plots, i).elm != elm)
|
|
return null;
|
|
}
|
|
return elm;
|
|
}
|
|
|
|
function $handleMenu(this$static, mi, state){
|
|
mi == 'maxscale' && $maxScale(this$static);
|
|
mi == 'showvoltage' && $showVoltage(this$static, state);
|
|
mi == 'showcurrent' && $showCurrent(this$static, state);
|
|
mi == 'showscale' && (this$static.showScale = state);
|
|
mi == 'showpeak' && (this$static.showMax = state);
|
|
mi == 'shownegpeak' && (this$static.showMin = state);
|
|
mi == 'showp2p' && (this$static.showP2P = state);
|
|
mi == 'showfreq' && (this$static.showFreq = state);
|
|
mi == 'showfft' && $show_1(this$static.fftPlot, state);
|
|
mi == 'logspectrum' && (this$static.fftPlot.logSpectrum = state);
|
|
mi == 'showrms' && (this$static.showRMS = state);
|
|
mi == 'showaverage' && (this$static.showAverage = state);
|
|
mi == 'showduty' && (this$static.showDutyCycle = state);
|
|
mi == 'showphaseangle' && (this$static.fftPlot.showPhaseAngle = state);
|
|
mi == 'showelminfo' && (this$static.showElmInfo = state);
|
|
mi == 'showpower' && $showPlotValue(this$static, 7, state);
|
|
mi == 'showib' && $showPlotValue(this$static, 1, state);
|
|
mi == 'showic' && $showPlotValue(this$static, 2, state);
|
|
mi == 'showie' && $showPlotValue(this$static, 3, state);
|
|
mi == 'showvbe' && $showPlotValue(this$static, 4, state);
|
|
mi == 'showvbc' && $showPlotValue(this$static, 5, state);
|
|
mi == 'showvce' && $showPlotValue(this$static, 6, state);
|
|
if (mi == 'showvcevsic') {
|
|
this$static.plot2d.enabled = true;
|
|
this$static.plot2d.plotXY = false;
|
|
$setValues(this$static, 6, 2, $getElm_0(this$static), null);
|
|
$resetGraph(this$static, false);
|
|
}
|
|
if (mi == 'showvvsi') {
|
|
this$static.plot2d.enabled = state;
|
|
this$static.plot2d.plotXY = false;
|
|
$resetGraph(this$static, false);
|
|
}
|
|
mi == 'manualscale' && $setManualScale(this$static, state, true);
|
|
if (mi == 'plotxy') {
|
|
this$static.plot2d.plotXY = this$static.plot2d.enabled = state;
|
|
if (this$static.plot2d.enabled) {
|
|
this$static.plots = this$static.visiblePlots;
|
|
this$static.plot2d.plotX = 0;
|
|
this$static.plot2d.plotY = $wnd.Math.min(1, this$static.plots.arrayList.array.length - 1);
|
|
this$static.plot2d.plotBrightness = this$static.plot2d.plotColorR = this$static.plot2d.plotColorG = this$static.plot2d.plotColorB = -1;
|
|
}
|
|
this$static.plot2d.enabled && this$static.plots.arrayList.array.length == 1 && $selectY(this$static);
|
|
$resetGraph(this$static, false);
|
|
}
|
|
mi == 'showresistance' && $showPlotValue(this$static, 2, state);
|
|
mi == 'showcharge' && $showPlotValue(this$static, 8, state);
|
|
}
|
|
|
|
function $hasPlotValue(this$static, v){
|
|
var i;
|
|
for (i = 0; i != this$static.plots.arrayList.array.length; i++) {
|
|
if ($get_4(this$static.plots, i).value_0 == v)
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
function $initialize(this$static){
|
|
var i, plot;
|
|
$resetGraph(this$static, false);
|
|
this$static.scale_0[2] = this$static.scale_0[3] = this$static.scale_0[0] = this$static.scale_0[4] = 5;
|
|
this$static.scale_0[1] = 0.1;
|
|
this$static.plot2d.scaleX = 5;
|
|
this$static.plot2d.scaleY = 0.1;
|
|
this$static.plot2d.enabled = false;
|
|
this$static.speed = 64;
|
|
this$static.showMax = true;
|
|
this$static.showV = this$static.showI = false;
|
|
this$static.showScale = this$static.showFreq = this$static.manualScale = this$static.showMin = this$static.showP2P = this$static.showElmInfo = false;
|
|
this$static.fftPlot.enabled = false;
|
|
if (!$loadDefaults(this$static.serializer)) {
|
|
for (i = 0; i != this$static.plots.arrayList.array.length; i++) {
|
|
plot = $get_4(this$static.plots, i);
|
|
plot.units == 0 && (this$static.showV = true);
|
|
plot.units == 1 && (this$static.showI = true);
|
|
}
|
|
}
|
|
}
|
|
|
|
function $isShowingVceAndIc(this$static){
|
|
return this$static.plot2d.enabled && this$static.plots.arrayList.array.length == 2 && $get_4(this$static.plots, 0).value_0 == 6 && $get_4(this$static.plots, 1).value_0 == 2;
|
|
}
|
|
|
|
function $maxScale(this$static){
|
|
if (this$static.plot2d.enabled) {
|
|
$maxScale_0(this$static.plot2d);
|
|
return;
|
|
}
|
|
this$static.maxScale = !this$static.maxScale;
|
|
this$static.showNegative = false;
|
|
}
|
|
|
|
function $mousePressed(this$static, mouseX, mouseY){
|
|
if (!$contains(this$static.rect_0, mouseX, mouseY))
|
|
return;
|
|
if (this$static.plot2d.enabled || this$static.fftPlot.enabled || this$static.visiblePlots.arrayList.array.length == 0)
|
|
return;
|
|
dragStartTime = $isTriggered(this$static.trigger)?this$static.trigger.time + this$static.sim.maxTimeStep * this$static.speed * (mouseX - this$static.rect_0.x_0 - (this$static.rect_0.width_0 / 2 | 0)):this$static.sim.t - this$static.sim.maxTimeStep * this$static.speed * (this$static.rect_0.x_0 + this$static.rect_0.width_0 - mouseX);
|
|
}
|
|
|
|
function $needToRemove(this$static){
|
|
var i, plot, removed, ret;
|
|
ret = true;
|
|
removed = false;
|
|
for (i = 0; i != this$static.plots.arrayList.array.length; i++) {
|
|
plot = $get_4(this$static.plots, i);
|
|
if ($locateElm(this$static.app, plot.elm) < 0) {
|
|
$remove_18(this$static.plots, i--);
|
|
removed = true;
|
|
}
|
|
else
|
|
ret = false;
|
|
}
|
|
removed && $calcVisiblePlots(this$static);
|
|
return ret;
|
|
}
|
|
|
|
function $onMouseWheel(this$static, e){
|
|
this$static.wheelDeltaY += $eventGetMouseWheelVelocityY(e.nativeEvent) * this$static.app.mouse.wheelSensitivity;
|
|
if (this$static.wheelDeltaY > 5) {
|
|
this$static.speed < $intern_24 && (this$static.speed *= 2);
|
|
$resetGraph(this$static, false);
|
|
this$static.wheelDeltaY = 0;
|
|
}
|
|
if (this$static.wheelDeltaY < -5) {
|
|
$speedUp(this$static);
|
|
this$static.wheelDeltaY = 0;
|
|
}
|
|
}
|
|
|
|
function $removePlot(this$static, plot){
|
|
var p;
|
|
if (plot < this$static.visiblePlots.arrayList.array.length) {
|
|
p = $get_4(this$static.visiblePlots, plot);
|
|
$advanceToFind(this$static.plots, p, true);
|
|
$calcVisiblePlots(this$static);
|
|
}
|
|
}
|
|
|
|
function $resetGraph(this$static, full){
|
|
var i;
|
|
this$static.scopePointCount = 1;
|
|
while (this$static.scopePointCount <= this$static.rect_0.width_0)
|
|
this$static.scopePointCount *= 2;
|
|
this$static.trigger.mode != 0 && (this$static.scopePointCount *= 2);
|
|
!this$static.plots && (this$static.plots = new Vector);
|
|
this$static.showNegative = false;
|
|
for (i = 0; i != this$static.plots.arrayList.array.length; i++)
|
|
$reset_9($get_4(this$static.plots, i), this$static.scopePointCount, this$static.speed, full);
|
|
$calcVisiblePlots(this$static);
|
|
this$static.scopeTimeStep = this$static.sim.maxTimeStep;
|
|
$allocImage(this$static.plot2d);
|
|
$reset_10(this$static.trigger, this$static.scopePointCount);
|
|
this$static.plot2d.lastTrailSimTime = -1;
|
|
}
|
|
|
|
function $rightEdge(this$static){
|
|
return this$static.rect_0.x_0 + this$static.rect_0.width_0;
|
|
}
|
|
|
|
function $selectScope(this$static, mouseX, mouseY){
|
|
if (!$contains(this$static.rect_0, mouseX, mouseY))
|
|
return;
|
|
this$static.plot2d.enabled || this$static.visiblePlots.arrayList.array.length == 0?(cursorTime = -1):(cursorTime = $isTriggered(this$static.trigger)?this$static.trigger.time + this$static.sim.maxTimeStep * this$static.speed * (mouseX - this$static.rect_0.x_0 - (this$static.rect_0.width_0 / 2 | 0)):this$static.sim.t - this$static.sim.maxTimeStep * this$static.speed * (this$static.rect_0.x_0 + this$static.rect_0.width_0 - mouseX));
|
|
$checkForSelection(this$static, mouseX, mouseY);
|
|
cursorScope = this$static;
|
|
}
|
|
|
|
function $selectY(this$static){
|
|
var ce, e, firstE, yElm;
|
|
yElm = this$static.plots.arrayList.array.length == 2?$get_4(this$static.plots, 1).elm:null;
|
|
e = !yElm?-1:$locateElm(this$static.app, yElm);
|
|
firstE = e;
|
|
while (true) {
|
|
for (++e; e < this$static.app.elmList.arrayList.array.length; e++) {
|
|
ce = $getElm(this$static.app, e);
|
|
if ((instanceOf(ce, 241) || instanceOf(ce, 242)) && ce != $get_4(this$static.plots, 0).elm) {
|
|
if (this$static.plots.arrayList.array.length == 1)
|
|
$add_11(this$static.plots, new ScopePlot(ce));
|
|
else {
|
|
$get_4(this$static.plots, 1).elm = ce;
|
|
$get_4(this$static.plots, 1).units = 0;
|
|
}
|
|
return;
|
|
}
|
|
}
|
|
if (firstE == -1)
|
|
return;
|
|
e = firstE = -1;
|
|
}
|
|
}
|
|
|
|
function $separate(this$static, arr, pos){
|
|
var i, lastPlot, s, sp;
|
|
lastPlot = null;
|
|
for (i = 0; i != this$static.visiblePlots.arrayList.array.length; i++) {
|
|
if (pos >= arr.length)
|
|
return pos;
|
|
s = new Scope(this$static.app, this$static.sim);
|
|
sp = $get_4(this$static.visiblePlots, i);
|
|
if (!!lastPlot && lastPlot.elm == sp.elm && lastPlot.value_0 == 0 && sp.value_0 == 3)
|
|
continue;
|
|
$setValue_1(s, sp.value_0, sp.elm);
|
|
s.position = pos;
|
|
arr[pos++] = s;
|
|
lastPlot = sp;
|
|
$setFlags(s.serializer, $getFlags(this$static.serializer));
|
|
$setSpeed(s, this$static.speed);
|
|
}
|
|
return pos;
|
|
}
|
|
|
|
function $setElm(this$static, ce){
|
|
this$static.plots = new Vector;
|
|
instanceOf(ce, 153)?(this$static.plots = new Vector , $addValue(this$static, 6, ce)):(this$static.plots = new Vector , $addValue(this$static, 0, ce));
|
|
$initialize(this$static);
|
|
}
|
|
|
|
function $setManDivisions(this$static, d){
|
|
this$static.manDivisions = lastManDivisions = d;
|
|
}
|
|
|
|
function $setManualScale(this$static, value_0, roundup){
|
|
var p, p$iterator;
|
|
value_0 != this$static.manualScale && $clearView(this$static.plot2d);
|
|
this$static.manualScale = value_0;
|
|
for (p$iterator = new ArrayList$1(this$static.plots.arrayList); p$iterator.i < p$iterator.this$01.array.length;) {
|
|
p = $next_4(p$iterator);
|
|
if (!p.manScaleSet) {
|
|
p.manScale = $getManScaleFromMaxScale(this$static, p.units, roundup);
|
|
p.manVPosition = 0;
|
|
p.manScaleSet = true;
|
|
}
|
|
}
|
|
}
|
|
|
|
function $setManualScaleValue(this$static, plotId, d){
|
|
if (plotId >= this$static.visiblePlots.arrayList.array.length)
|
|
return;
|
|
$clearView(this$static.plot2d);
|
|
$get_4(this$static.visiblePlots, plotId).manScale = d;
|
|
$get_4(this$static.visiblePlots, plotId).manScaleSet = true;
|
|
}
|
|
|
|
function $setMaxScale(this$static, s){
|
|
$maxScale(this$static);
|
|
this$static.maxScale = s;
|
|
}
|
|
|
|
function $setPlotPosition(this$static, plot, v){
|
|
$get_4(this$static.visiblePlots, plot).manVPosition = v;
|
|
}
|
|
|
|
function $setRect(this$static, r){
|
|
var h, w;
|
|
w = this$static.rect_0.width_0;
|
|
h = this$static.rect_0.height_0;
|
|
this$static.rect_0 = r;
|
|
(this$static.rect_0.width_0 != w || this$static.plot2d.plotXY && this$static.rect_0.height_0 != h) && $resetGraph(this$static, false);
|
|
}
|
|
|
|
function $setSpeed(this$static, sp){
|
|
sp < 1 && (sp = 1);
|
|
sp > $intern_24 && (sp = $intern_24);
|
|
this$static.speed = sp;
|
|
$resetGraph(this$static, false);
|
|
}
|
|
|
|
function $setText_3(this$static, s){
|
|
this$static.text_0 = s;
|
|
}
|
|
|
|
function $setTriggerMode(this$static, mode){
|
|
this$static.trigger.mode = mode;
|
|
$resetGraph(this$static, false);
|
|
}
|
|
|
|
function $setValue_0(this$static, val){
|
|
var ce;
|
|
if (this$static.plots.arrayList.array.length > 2 || this$static.plots.arrayList.array.length == 0)
|
|
return;
|
|
ce = $firstElement(this$static.plots).elm;
|
|
if (this$static.plots.arrayList.array.length == 2 && $get_4(this$static.plots, 1).elm != ce)
|
|
return;
|
|
this$static.plot2d.enabled = this$static.plot2d.plotXY = false;
|
|
this$static.plots = new Vector;
|
|
$addValue(this$static, val, ce);
|
|
}
|
|
|
|
function $setValue_1(this$static, val, ce){
|
|
this$static.plots = new Vector;
|
|
$addValue(this$static, val, ce);
|
|
}
|
|
|
|
function $setValues(this$static, val, ival, ce, yelm){
|
|
if (ival > 0) {
|
|
this$static.plots = new Vector;
|
|
$add_11(this$static.plots, new ScopePlot_0(ce, ce.getScopeUnits(val), val, $getManScaleFromMaxScale(this$static, ce.getScopeUnits(val), false)));
|
|
$add_11(this$static.plots, new ScopePlot_0(ce, ce.getScopeUnits(ival), ival, $getManScaleFromMaxScale(this$static, ce.getScopeUnits(ival), false)));
|
|
return;
|
|
}
|
|
if (yelm) {
|
|
this$static.plots = new Vector;
|
|
$add_11(this$static.plots, new ScopePlot_0(ce, ce.getScopeUnits(val), 0, $getManScaleFromMaxScale(this$static, ce.getScopeUnits(val), false)));
|
|
$add_11(this$static.plots, new ScopePlot_0(yelm, ce.getScopeUnits(ival), 0, $getManScaleFromMaxScale(this$static, ce.getScopeUnits(val), false)));
|
|
return;
|
|
}
|
|
$setValue_0(this$static, val);
|
|
}
|
|
|
|
function $showCurrent(this$static, b){
|
|
var ce;
|
|
this$static.showI = b;
|
|
if (b && !$hasPlotValue(this$static, 3)) {
|
|
ce = $getElm_0(this$static);
|
|
!!ce && $add_11(this$static.plots, new ScopePlot_0(ce, 1, 3, $getManScaleFromMaxScale(this$static, 1, false)));
|
|
}
|
|
$calcVisiblePlots(this$static);
|
|
$resetGraph(this$static, false);
|
|
}
|
|
|
|
function $showPlotValue(this$static, val, b){
|
|
var ce, i, u;
|
|
if (b) {
|
|
if (!$hasPlotValue(this$static, val)) {
|
|
ce = $getElm_0(this$static);
|
|
if (ce) {
|
|
u = ce.getScopeUnits(val);
|
|
$add_11(this$static.plots, new ScopePlot_0(ce, u, val, $getManScaleFromMaxScale(this$static, u, false)));
|
|
}
|
|
}
|
|
}
|
|
else {
|
|
for (i = this$static.plots.arrayList.array.length - 1; i >= 0; i--) {
|
|
$get_4(this$static.plots, i).value_0 == val && this$static.plots.arrayList.array.length > 1 && $remove_18(this$static.plots, i);
|
|
}
|
|
}
|
|
$calcVisiblePlots(this$static);
|
|
$resetGraph(this$static, false);
|
|
}
|
|
|
|
function $showVoltage(this$static, b){
|
|
var ce;
|
|
this$static.showV = b;
|
|
if (b && !$hasPlotValue(this$static, 0)) {
|
|
ce = $getElm_0(this$static);
|
|
!!ce && $add_11(this$static.plots, new ScopePlot_0(ce, 0, 0, $getManScaleFromMaxScale(this$static, 0, false)));
|
|
}
|
|
$calcVisiblePlots(this$static);
|
|
$resetGraph(this$static, false);
|
|
}
|
|
|
|
function $speedUp(this$static){
|
|
if (this$static.speed > 1) {
|
|
this$static.speed = this$static.speed / 2 | 0;
|
|
$resetGraph(this$static, false);
|
|
}
|
|
}
|
|
|
|
function $startDragPlotY(this$static, mouseX, mouseY){
|
|
if (!$contains(this$static.rect_0, mouseX, mouseY))
|
|
return false;
|
|
if (!this$static.manualScale || this$static.selectedPlot < 0 || this$static.selectedPlot >= this$static.visiblePlots.arrayList.array.length)
|
|
return false;
|
|
this$static.draggingPlotY = true;
|
|
this$static.dragPlotYMouseStart = mouseY;
|
|
this$static.dragPlotYInitialPosition = $get_4(this$static.visiblePlots, this$static.selectedPlot).manVPosition;
|
|
draggingPlotYScope = this$static;
|
|
return true;
|
|
}
|
|
|
|
function $timeStep(this$static){
|
|
var i;
|
|
for (i = 0; i != this$static.plots.arrayList.array.length; i++)
|
|
$timeStep_1($get_4(this$static.plots, i));
|
|
$check(this$static.trigger, this$static.visiblePlots, this$static.plot2d.enabled, this$static.sim, this$static.rect_0.width_0);
|
|
this$static.plot2d.enabled && $timeStep_2(this$static.plot2d);
|
|
}
|
|
|
|
function $timeToX(this$static, t){
|
|
return $isTriggered(this$static.trigger)?round_int(this$static.rect_0.x_0 + (this$static.rect_0.width_0 / 2 | 0) + (t - this$static.trigger.time) / (this$static.sim.maxTimeStep * this$static.speed)):-round_int((this$static.sim.t - t) / (this$static.sim.maxTimeStep * this$static.speed) - this$static.rect_0.x_0 - this$static.rect_0.width_0);
|
|
}
|
|
|
|
function $undump_1(this$static, st){
|
|
$undump_2(this$static.serializer, st);
|
|
}
|
|
|
|
function $undumpXml_5(this$static, xml){
|
|
$undumpXml_6(this$static.serializer, xml);
|
|
}
|
|
|
|
function $validDataCount(this$static, plot, ipa, w){
|
|
return $validDataCount_0(this$static.trigger, plot, ipa, w, this$static.scopePointCount);
|
|
}
|
|
|
|
function $viewingWire(this$static){
|
|
var i;
|
|
for (i = 0; i != this$static.plots.arrayList.array.length; i++)
|
|
if (instanceOf($get_4(this$static.plots, i).elm, 106))
|
|
return true;
|
|
return false;
|
|
}
|
|
|
|
function Scope(app_, sim_){
|
|
$clinit_Scope();
|
|
this.trigger = new ScopeTrigger;
|
|
this.sim = sim_;
|
|
this.app = app_;
|
|
this.position = -1;
|
|
this.scale_0 = initUnidimensionalArray(D_classLit, $intern_76, 7, 5, 15, 1);
|
|
this.reduceRange = initUnidimensionalArray(Z_classLit, $intern_95, 7, 5, 16, 1);
|
|
this.manDivisions = lastManDivisions;
|
|
this.rect_0 = new Rectangle_0(0, 0, 1, 1);
|
|
this.plot2d = new ScopePlot2d(this);
|
|
this.fftPlot = new ScopeFFT(this);
|
|
this.overlays = new ScopeOverlays(this);
|
|
this.serializer = new ScopeSerializer(this);
|
|
$initialize(this);
|
|
}
|
|
|
|
function downloadCSV(data_0, filename){
|
|
var blob = new Blob([data_0], {type:'text/csv'});
|
|
var url_0 = URL.createObjectURL(blob);
|
|
var a = $doc.createElement('a');
|
|
a.href = url_0;
|
|
a.download = filename;
|
|
$doc.body.appendChild(a);
|
|
a.click();
|
|
$doc.body.removeChild(a);
|
|
URL.revokeObjectURL(url_0);
|
|
}
|
|
|
|
function getScaleUnitsText(units){
|
|
$clinit_Scope();
|
|
switch (units) {
|
|
case 1:
|
|
return 'A';
|
|
case 3:
|
|
return ohmString;
|
|
case 2:
|
|
return 'W';
|
|
case 4:
|
|
return 'C';
|
|
default:return 'V';
|
|
}
|
|
}
|
|
|
|
defineClass(177, 1, {177:1}, Scope);
|
|
_.dragPlotYInitialPosition = 0;
|
|
_.dragPlotYMouseStart = 0;
|
|
_.draggingPlotY = false;
|
|
_.drawGridLines = false;
|
|
_.gridStepX = 0;
|
|
_.gridStepY = 0;
|
|
_.manDivisions = 0;
|
|
_.manualScale = false;
|
|
_.maxScale = false;
|
|
_.maxValue = 0;
|
|
_.minValue = 0;
|
|
_.position = 0;
|
|
_.scopePointCount = 128;
|
|
_.scopeTimeStep = 0;
|
|
_.selectedPlot = 0;
|
|
_.showAverage = false;
|
|
_.showDutyCycle = false;
|
|
_.showElmInfo = false;
|
|
_.showFreq = false;
|
|
_.showI = false;
|
|
_.showMax = false;
|
|
_.showMin = false;
|
|
_.showNegative = false;
|
|
_.showP2P = false;
|
|
_.showRMS = false;
|
|
_.showScale = false;
|
|
_.showV = false;
|
|
_.somethingSelected = false;
|
|
_.speed = 0;
|
|
_.stackCount = 0;
|
|
_.wheelDeltaY = 0;
|
|
var cursorScope, cursorTime = 0, cursorUnits = 0, dragStartTime = -1, draggingPlotYScope, lastManDivisions = 8, multa;
|
|
var Lcom_lushprojects_circuitjs1_client_Scope_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'Scope', 177);
|
|
function ScopeCheckBox(text_0, menu){
|
|
CheckBox_0.call(this, text_0);
|
|
this.menuCmd = menu;
|
|
}
|
|
|
|
defineClass(63, 166, {172:1, 71:1, 119:1, 94:1, 122:1, 85:1, 98:1, 121:1, 69:1, 70:1, 72:1, 73:1, 75:1, 74:1, 76:1, 77:1, 78:1, 120:1, 96:1, 97:1, 95:1, 124:1, 125:1, 123:1, 86:1, 90:1, 88:1, 89:1, 87:1, 91:1, 102:1, 101:1, 100:1, 99:1, 28:1, 210:1, 25:1, 134:1, 60:1, 27:1, 230:1, 190:1, 166:1, 82:1, 116:1, 248:1, 206:1, 105:1, 115:1, 59:1, 146:1, 50:1, 229:1, 23:1, 196:1, 29:1, 92:1, 117:1, 118:1, 93:1, 22:1, 24:1, 63:1}, ScopeCheckBox);
|
|
var Lcom_lushprojects_circuitjs1_client_ScopeCheckBox_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ScopeCheckBox', 63);
|
|
function $skipNonzeroValues(this$static){
|
|
var ip;
|
|
for (; this$static.startIndex < this$static.validCount; this$static.startIndex++) {
|
|
ip = this$static.startIndex + this$static.ipa & this$static.scopePointCount - 1;
|
|
if (this$static.plot.maxValues[ip] != 0)
|
|
return this$static.plot.maxValues[ip];
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
function ScopeDataIterator(scope_0, plot){
|
|
this.plot = plot;
|
|
this.scopePointCount = scope_0.scopePointCount;
|
|
this.ipa = $displayStartIndex(scope_0, plot, scope_0.rect_0.width_0);
|
|
this.validCount = $validDataCount(scope_0, plot, this.ipa, scope_0.rect_0.width_0);
|
|
}
|
|
|
|
defineClass(222, 1, $intern_73, ScopeDataIterator);
|
|
_.iterator = function iterator_5(){
|
|
return new ScopeDataIterator$1(this);
|
|
}
|
|
;
|
|
_.currentIp = 0;
|
|
_.ipa = 0;
|
|
_.scopePointCount = 0;
|
|
_.startIndex = 0;
|
|
_.validCount = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_ScopeDataIterator_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ScopeDataIterator', 222);
|
|
function ScopeDataIterator$1(this$0){
|
|
this.this$01 = this$0;
|
|
this.i = this.this$01.startIndex;
|
|
}
|
|
|
|
defineClass(223, 1, {}, ScopeDataIterator$1);
|
|
_.next_1 = function next_3(){
|
|
return this.this$01.currentIp = this.i + this.this$01.ipa & this.this$01.scopePointCount - 1 , valueOf_0(this.i++);
|
|
}
|
|
;
|
|
_.hasNext_0 = function hasNext_2(){
|
|
return this.i < this.this$01.validCount;
|
|
}
|
|
;
|
|
_.remove_1 = function remove_12(){
|
|
}
|
|
;
|
|
_.i = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_ScopeDataIterator$1_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ScopeDataIterator/1', 223);
|
|
function $selectScope_0(this$static, mx, my){
|
|
$selectScope(this$static.elmScope, mx, my);
|
|
}
|
|
|
|
function $setElmScope(this$static, s){
|
|
this$static.elmScope = s;
|
|
}
|
|
|
|
function $setScopeElm(this$static, e){
|
|
$setElm(this$static.elmScope, e);
|
|
$resetGraph(this$static.elmScope, false);
|
|
}
|
|
|
|
function $setScopeRect(this$static){
|
|
var i1, i2, j1, j2, r;
|
|
i1 = $transformX(app_0.mouse, min_1(this$static.x_0, this$static.x2));
|
|
i2 = $transformX(app_0.mouse, max_1(this$static.x_0, this$static.x2));
|
|
j1 = $transformY(app_0.mouse, min_1(this$static.y_0, this$static.y2));
|
|
j2 = $transformY(app_0.mouse, max_1(this$static.y_0, this$static.y2));
|
|
r = new Rectangle_0(i1, j1, i2 - i1, j2 - j1);
|
|
$equals_0(r, this$static.elmScope.rect_0) || $setRect(this$static.elmScope, r);
|
|
}
|
|
|
|
function ScopeElm(xx, yy){
|
|
CircuitElm.call(this, xx, yy);
|
|
this.noDiagonal = false;
|
|
this.x2 = this.x_0 + 128;
|
|
this.y2 = this.y_0 + 64;
|
|
this.elmScope = new Scope(app_0, sim_0);
|
|
$setPoints(this);
|
|
$setScopeRect(this);
|
|
}
|
|
|
|
function ScopeElm_0(xa, ya, xb, yb, f, st){
|
|
var sStr, sst;
|
|
CircuitElm_0.call(this, xa, ya, xb, yb, f);
|
|
this.noDiagonal = false;
|
|
sStr = $nextToken(st);
|
|
sst = new StringTokenizer_0(sStr, '_');
|
|
this.elmScope = new Scope(app_0, sim_0);
|
|
$undump_1(this.elmScope, sst);
|
|
$setPoints(this);
|
|
$setScopeRect(this);
|
|
$resetGraph(this.elmScope, false);
|
|
}
|
|
|
|
defineClass(21, 8, {8:1, 10:1, 21:1}, ScopeElm, ScopeElm_0);
|
|
_.canViewInScope = function canViewInScope_4(){
|
|
return false;
|
|
}
|
|
;
|
|
_.draw = function draw_70(g){
|
|
$setColor_0(g, mouseElmRef == this || this.selected_0 || $containsKey(app_0.mouse.scopePlotRoles, this) || instanceOf(mouseElmRef, 21) && $getElm_0(mouseElmRef.elmScope) == this || $isOnHighlightedNet(this)?selectColor_0:whiteColor);
|
|
g.context.save();
|
|
$scale(g.context, 1 / app_0.transform_0[0], 1 / app_0.transform_0[3]);
|
|
$translate(g.context, -app_0.transform_0[4], -app_0.transform_0[5]);
|
|
$setScopeRect(this);
|
|
this.elmScope.position = -1;
|
|
$draw_2(this.elmScope, g);
|
|
g.context.restore();
|
|
$setBbox_0(this, this.point1, this.point2, 0);
|
|
$drawPosts(this, g);
|
|
}
|
|
;
|
|
_.dumpXml = function dumpXml_72(doc, elem){
|
|
dumpAttr_1(elem, 'x', this.x_0 + ' ' + this.y_0 + ' ' + this.x2 + ' ' + this.y2);
|
|
dumpAttr_0(elem, 'f', this.flags);
|
|
$dumpXml_10(this.elmScope, doc, elem);
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_94(){
|
|
return 403;
|
|
}
|
|
;
|
|
_.getNumHandles = function getNumHandles_4(){
|
|
return 2;
|
|
}
|
|
;
|
|
_.getPostCount_0 = function getPostCount_63(){
|
|
return 0;
|
|
}
|
|
;
|
|
_.reset_1 = function reset_43(){
|
|
$reset(this);
|
|
$resetGraph(this.elmScope, true);
|
|
}
|
|
;
|
|
_.reset_0 = function(){
|
|
this.reset_1();
|
|
}
|
|
;
|
|
_.setPoints_0 = function setPoints_64(){
|
|
$setPoints(this);
|
|
$setScopeRect(this);
|
|
}
|
|
;
|
|
_.setPoints = function(){
|
|
this.setPoints_0();
|
|
}
|
|
;
|
|
_.undumpXml = function undumpXml_75(xml){
|
|
var child, child$iterator;
|
|
this.flags = $parseIntAttr(xml, 'f', this.flags);
|
|
for (child$iterator = new ArrayList$1($getChildElements(xml)); child$iterator.i < child$iterator.this$01.array.length;) {
|
|
child = $next_4(child$iterator);
|
|
if ($equals_1(getTagName(child.jsObject), 'o')) {
|
|
xml.currentXmlElement = child;
|
|
$undumpXml_5(this.elmScope, xml);
|
|
break;
|
|
}
|
|
}
|
|
$resetGraph(this.elmScope, false);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_ScopeElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ScopeElm', 21);
|
|
function $addCursorInfo(this$static, info, ct, mouseCursorX){
|
|
var db, fftIndex, mag, maxFrequency;
|
|
maxFrequency = 1 / (this$static.scope_0.sim.maxTimeStep * this$static.scope_0.speed * 2);
|
|
info[ct++] = getUnitText(maxFrequency * (mouseCursorX - this$static.scope_0.rect_0.x_0) / this$static.scope_0.rect_0.width_0, 'Hz', false);
|
|
if (!!this$static.fft && this$static.fftReal != null && this$static.fftMaxMagnitude > 0) {
|
|
fftIndex = (mouseCursorX - this$static.scope_0.rect_0.x_0) * this$static.scope_0.scopePointCount / (2 * this$static.scope_0.rect_0.width_0) | 0;
|
|
if (fftIndex >= 0 && fftIndex < (this$static.scope_0.scopePointCount / 2 | 0)) {
|
|
mag = $magnitude(this$static.fft, this$static.fftReal[fftIndex], this$static.fftImag[fftIndex]);
|
|
db = 20 * $wnd.Math.log(mag / this$static.fftMaxMagnitude) / $wnd.Math.log(10);
|
|
info[ct++] = toString_8(fromDouble_0($wnd.Math.round(db))) + ' dB';
|
|
}
|
|
}
|
|
return ct;
|
|
}
|
|
|
|
function $draw_3(this$static, g){
|
|
var db, db0, height, i, i0, i1, ii, imag, m, magnitude, maxM, maxV, minV, pixelsPerDb, plot, plotHeight, prevHeight, prevX, prevY, ptr, real, x_0, y_0;
|
|
(!this$static.fft || this$static.fft.size_0 != this$static.scope_0.scopePointCount) && (this$static.fft = new FFT(this$static.scope_0.scopePointCount));
|
|
real = initUnidimensionalArray(D_classLit, $intern_76, 7, this$static.scope_0.scopePointCount, 15, 1);
|
|
imag = initUnidimensionalArray(D_classLit, $intern_76, 7, this$static.scope_0.scopePointCount, 15, 1);
|
|
plot = this$static.scope_0.visiblePlots.arrayList.array.length == 0?$firstElement(this$static.scope_0.plots):$firstElement(this$static.scope_0.visiblePlots);
|
|
maxV = plot.maxValues;
|
|
minV = plot.minValues;
|
|
ptr = plot.ptr;
|
|
for (i0 = 0; i0 < this$static.scope_0.scopePointCount; i0++) {
|
|
ii = ptr - i0 + this$static.scope_0.scopePointCount & this$static.scope_0.scopePointCount - 1;
|
|
real[i0] = 0.5 * (maxV[ii] + minV[ii]);
|
|
imag[i0] = 0;
|
|
}
|
|
$fft(this$static.fft, real, imag);
|
|
maxM = $intern_112;
|
|
for (i1 = 0; i1 < (this$static.scope_0.scopePointCount / 2 | 0); i1++) {
|
|
m = $magnitude(this$static.fft, real[i1], imag[i1]);
|
|
m > maxM && (maxM = m);
|
|
}
|
|
this$static.fftMaxMagnitude = maxM;
|
|
this$static.fftReal = real;
|
|
this$static.fftImag = imag;
|
|
prevX = 0;
|
|
g.context.strokeStyle = '#FF0000';
|
|
g.context.fillStyle = '#FF0000';
|
|
if (this$static.logSpectrum) {
|
|
plotHeight = this$static.scope_0.rect_0.height_0 - 5 - 12;
|
|
pixelsPerDb = plotHeight / 80;
|
|
prevY = 0;
|
|
for (db0 = -20; db0 >= -80; db0 -= 20) {
|
|
y_0 = 5 + round_int(-db0 * pixelsPerDb);
|
|
if (y_0 < 0 || y_0 >= this$static.scope_0.rect_0.height_0)
|
|
continue;
|
|
g.context.strokeStyle = '#880000';
|
|
g.context.fillStyle = '#880000';
|
|
$drawLine(g, 0, y_0, this$static.scope_0.rect_0.width_0, y_0);
|
|
g.context.strokeStyle = '#FF0000';
|
|
g.context.fillStyle = '#FF0000';
|
|
$fillText(g.context, db0 + ' dB', 2, y_0 - 2);
|
|
}
|
|
g.context.strokeStyle = '#FF0000';
|
|
g.context.fillStyle = '#FF0000';
|
|
for (i = 0; i < (this$static.scope_0.scopePointCount / 2 | 0); i++) {
|
|
x_0 = 2 * i * this$static.scope_0.rect_0.width_0 / this$static.scope_0.scopePointCount | 0;
|
|
magnitude = $magnitude(this$static.fft, real[i], imag[i]);
|
|
db = 20 * $wnd.Math.log(magnitude / maxM) / $wnd.Math.log(10);
|
|
db < -80 && (db = -80);
|
|
y_0 = 5 + round_int(-db * pixelsPerDb);
|
|
x_0 != prevX && $drawLine(g, prevX, prevY, x_0, y_0);
|
|
prevY = y_0;
|
|
prevX = x_0;
|
|
}
|
|
}
|
|
else {
|
|
prevHeight = 0;
|
|
y_0 = this$static.scope_0.rect_0.height_0 - 1 - 12;
|
|
for (i = 0; i < (this$static.scope_0.scopePointCount / 2 | 0); i++) {
|
|
x_0 = 2 * i * this$static.scope_0.rect_0.width_0 / this$static.scope_0.scopePointCount | 0;
|
|
magnitude = $magnitude(this$static.fft, real[i], imag[i]);
|
|
height = round_int(magnitude * y_0 / maxM);
|
|
x_0 != prevX && $drawLine(g, prevX, y_0 - prevHeight, x_0, y_0 - height);
|
|
prevHeight = height;
|
|
prevX = x_0;
|
|
}
|
|
}
|
|
}
|
|
|
|
function $drawPhaseAngle(this$static, g){
|
|
var angle, angleI, angleV, fund, i, i0, iImag, iPlot, iReal, ip, ipa, m, maxM, p, p$iterator, vImag, vPlot, vReal, validCount;
|
|
vPlot = null;
|
|
iPlot = null;
|
|
for (p$iterator = new ArrayList$1(this$static.scope_0.visiblePlots.arrayList); p$iterator.i < p$iterator.this$01.array.length;) {
|
|
p = $next_4(p$iterator);
|
|
if (p.units == 0) {
|
|
if (vPlot)
|
|
return;
|
|
vPlot = p;
|
|
}
|
|
else if (p.units == 1) {
|
|
if (iPlot)
|
|
return;
|
|
iPlot = p;
|
|
}
|
|
else
|
|
return;
|
|
}
|
|
if (!vPlot || !iPlot)
|
|
return;
|
|
(!this$static.fft || this$static.fft.size_0 != this$static.scope_0.scopePointCount) && (this$static.fft = new FFT(this$static.scope_0.scopePointCount));
|
|
vReal = initUnidimensionalArray(D_classLit, $intern_76, 7, this$static.scope_0.scopePointCount, 15, 1);
|
|
vImag = initUnidimensionalArray(D_classLit, $intern_76, 7, this$static.scope_0.scopePointCount, 15, 1);
|
|
iReal = initUnidimensionalArray(D_classLit, $intern_76, 7, this$static.scope_0.scopePointCount, 15, 1);
|
|
iImag = initUnidimensionalArray(D_classLit, $intern_76, 7, this$static.scope_0.scopePointCount, 15, 1);
|
|
ipa = $displayStartIndex(this$static.scope_0, vPlot, this$static.scope_0.rect_0.width_0);
|
|
validCount = $validDataCount(this$static.scope_0, vPlot, ipa, this$static.scope_0.rect_0.width_0);
|
|
for (i0 = 0; i0 < validCount; i0++) {
|
|
ip = i0 + ipa & this$static.scope_0.scopePointCount - 1;
|
|
vReal[i0] = 0.5 * (vPlot.maxValues[ip] + vPlot.minValues[ip]);
|
|
iReal[i0] = 0.5 * (iPlot.maxValues[ip] + iPlot.minValues[ip]);
|
|
}
|
|
$fft(this$static.fft, vReal, vImag);
|
|
$fft(this$static.fft, iReal, iImag);
|
|
fund = 1;
|
|
maxM = 0;
|
|
for (i = 1; i < (this$static.scope_0.scopePointCount / 2 | 0); i++) {
|
|
m = $magnitude(this$static.fft, vReal[i], vImag[i]);
|
|
if (m > maxM) {
|
|
maxM = m;
|
|
fund = i;
|
|
}
|
|
}
|
|
if (maxM < $intern_112)
|
|
return;
|
|
angleV = $wnd.Math.atan2(vImag[fund], vReal[fund]);
|
|
angleI = $wnd.Math.atan2(iImag[fund], iReal[fund]);
|
|
angle = (angleV - angleI) * 180 / $intern_1;
|
|
while (angle > 180)
|
|
angle -= 360;
|
|
while (angle < -180)
|
|
angle += 360;
|
|
$drawInfoText(this$static.scope_0, g, LS('Phase angle: ') + ('' + $format_0(showFormat, angle)) + '\xB0');
|
|
}
|
|
|
|
function $drawVerticalGridLines(this$static, g){
|
|
var i, maxFrequency, prevEnd, s, sWidth, x_0;
|
|
prevEnd = 0;
|
|
maxFrequency = 1 / (this$static.scope_0.sim.maxTimeStep * this$static.scope_0.speed * 20 * 2);
|
|
for (i = 0; i < 20; i++) {
|
|
x_0 = this$static.scope_0.rect_0.width_0 * i / 20 | 0;
|
|
if (x_0 < prevEnd)
|
|
continue;
|
|
s = toInt_0(fromDouble_0($wnd.Math.round(i * maxFrequency))) + 'Hz';
|
|
sWidth = round_int($wnd.Math.ceil($measureText(g.context, s).width));
|
|
prevEnd = x_0 + sWidth + 4;
|
|
if (i > 0) {
|
|
g.context.strokeStyle = '#880000';
|
|
g.context.fillStyle = '#880000';
|
|
$drawLine(g, x_0, 0, x_0, this$static.scope_0.rect_0.height_0);
|
|
}
|
|
g.context.strokeStyle = '#FF0000';
|
|
g.context.fillStyle = '#FF0000';
|
|
$drawString(g, s, x_0 + 2, this$static.scope_0.rect_0.height_0);
|
|
}
|
|
}
|
|
|
|
function $show_1(this$static, b){
|
|
this$static.enabled = b;
|
|
this$static.enabled || (this$static.fft = null);
|
|
}
|
|
|
|
function ScopeFFT(scope_0){
|
|
this.scope_0 = scope_0;
|
|
}
|
|
|
|
defineClass(750, 1, {}, ScopeFFT);
|
|
_.enabled = false;
|
|
_.fftMaxMagnitude = 0;
|
|
_.logSpectrum = false;
|
|
_.showPhaseAngle = false;
|
|
var Lcom_lushprojects_circuitjs1_client_ScopeFFT_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ScopeFFT', 750);
|
|
function $addScope(this$static, sc){
|
|
sc.position < 0 && (sc.position = this$static.scopeCount);
|
|
this$static.scopes[this$static.scopeCount++] = sc;
|
|
}
|
|
|
|
function $canDelayWireProcessing(this$static){
|
|
var ce, ce$iterator, i;
|
|
for (i = 0; i != this$static.scopeCount; i++)
|
|
if ($viewingWire(this$static.scopes[i]))
|
|
return false;
|
|
for (ce$iterator = new ArrayList$1(this$static.sim.elmList.arrayList); ce$iterator.i < ce$iterator.this$01.array.length;) {
|
|
ce = $next_4(ce$iterator);
|
|
if (instanceOf(ce, 21) && $viewingWire(ce.elmScope))
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
function $canStackScope(this$static, s){
|
|
if (this$static.scopeCount < 2)
|
|
return false;
|
|
s == 0 && (s = 1);
|
|
if (this$static.scopes[s].position == this$static.scopes[s - 1].position)
|
|
return false;
|
|
return true;
|
|
}
|
|
|
|
function $canUnstackScope(this$static, s){
|
|
if (this$static.scopeCount < 2)
|
|
return false;
|
|
s == 0 && (s = 1);
|
|
if (this$static.scopes[s].position != this$static.scopes[s - 1].position) {
|
|
return s + 1 < this$static.scopeCount && this$static.scopes[s + 1].position == this$static.scopes[s].position;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
function $combineAll(this$static){
|
|
var i;
|
|
for (i = this$static.scopeCount - 2; i >= 0; i--) {
|
|
$combine(this$static.scopes[i], this$static.scopes[i + 1]);
|
|
$setElm(this$static.scopes[i + 1], null);
|
|
}
|
|
}
|
|
|
|
function $combineScope(this$static, s){
|
|
if (this$static.scopeCount < 2)
|
|
return;
|
|
s == 0 && (s = 1);
|
|
$combine(this$static.scopes[s - 1], this$static.scopes[s]);
|
|
$setElm(this$static.scopes[s], null);
|
|
}
|
|
|
|
function $composeSelectScopeMenu(this$static, sb){
|
|
var c, i, j, l_0, mi, mi$iterator, s;
|
|
$clearItems(sb);
|
|
this$static.selectScopeMenuItems = new Vector;
|
|
for (i = 0; i < this$static.scopeCount; i++) {
|
|
s = LS('Scope') + ' ' + ('' + (i + 1));
|
|
l_0 = $getScopeLabelOrText(this$static.scopes[i], false);
|
|
l_0 != '' && (s += ' (' + htmlEscape(l_0) + ')');
|
|
$add_11(this$static.selectScopeMenuItems, new MenuItem_1(s, new MyCommand('elm', 'addToScope' + ('' + i))));
|
|
}
|
|
c = $countScopeElms(this$static);
|
|
for (j = 0; j < c; j++) {
|
|
s = LS('Undocked Scope') + ' ' + ('' + (j + 1));
|
|
l_0 = $getScopeLabelOrText($getNthScopeElm(this$static, j).elmScope, false);
|
|
l_0 != '' && (s += ' (' + htmlEscape(l_0) + ')');
|
|
$add_11(this$static.selectScopeMenuItems, new MenuItem_1(s, new MyCommand('elm', 'addToScope' + ('' + (this$static.scopeCount + j)))));
|
|
}
|
|
for (mi$iterator = new ArrayList$1(this$static.selectScopeMenuItems.arrayList); mi$iterator.i < mi$iterator.this$01.array.length;) {
|
|
mi = $next_4(mi$iterator);
|
|
$insertItem_0(sb, mi, sb.allItems.array.length);
|
|
}
|
|
}
|
|
|
|
function $countScopeElms(this$static){
|
|
var c, i;
|
|
c = 0;
|
|
for (i = 0; i != this$static.sim.elmList.arrayList.array.length; i++) {
|
|
instanceOf($get_4(this$static.sim.elmList, i), 21) && ++c;
|
|
}
|
|
return c;
|
|
}
|
|
|
|
function $deleteUnusedScopeElms(this$static){
|
|
var ce, i;
|
|
for (i = this$static.sim.elmList.arrayList.array.length - 1; i >= 0; i--) {
|
|
ce = $get_4(this$static.sim.elmList, i);
|
|
if (instanceOf(ce, 21) && $needToRemove(ce.elmScope)) {
|
|
ce.delete_0();
|
|
$removeElementAt(this$static.sim.elmList, i);
|
|
$needAnalyze(this$static.sim);
|
|
}
|
|
}
|
|
}
|
|
|
|
function $getNthScopeElm(this$static, n){
|
|
var i;
|
|
for (i = 0; i != this$static.sim.elmList.arrayList.array.length; i++) {
|
|
if (instanceOf($get_4(this$static.sim.elmList, i), 21)) {
|
|
--n;
|
|
if (n < 0)
|
|
return $get_4(this$static.sim.elmList, i);
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
|
|
function $resetGraphs(this$static){
|
|
var i;
|
|
for (i = 0; i != this$static.scopeCount; i++)
|
|
$resetGraph(this$static.scopes[i], true);
|
|
}
|
|
|
|
function $scopeMenuIsSelected(this$static, s){
|
|
if (this$static.scopeMenuSelected < 0)
|
|
return false;
|
|
if (this$static.scopeMenuSelected < this$static.scopeCount)
|
|
return this$static.scopes[this$static.scopeMenuSelected] == s;
|
|
return $getNthScopeElm(this$static, this$static.scopeMenuSelected - this$static.scopeCount).elmScope == s;
|
|
}
|
|
|
|
function $separateAll(this$static){
|
|
var ct, i, newscopes;
|
|
newscopes = initUnidimensionalArray(Lcom_lushprojects_circuitjs1_client_Scope_2_classLit, $intern_3, 177, 20, 0, 1);
|
|
ct = 0;
|
|
for (i = 0; i < this$static.scopeCount; i++)
|
|
ct = $separate(this$static.scopes[i], newscopes, ct);
|
|
this$static.scopes = newscopes;
|
|
this$static.scopeCount = ct;
|
|
}
|
|
|
|
function $setupScopes(this$static){
|
|
var colct, colh, h, i, iw, j, pos, r, row, s, speed, ui, w;
|
|
pos = -1;
|
|
for (i = 0; i < this$static.scopeCount; i++) {
|
|
if ($needToRemove(this$static.scopes[i])) {
|
|
for (j = i; j != this$static.scopeCount; j++)
|
|
this$static.scopes[j] = this$static.scopes[j + 1];
|
|
--this$static.scopeCount;
|
|
--i;
|
|
continue;
|
|
}
|
|
this$static.scopes[i].position > pos + 1 && (this$static.scopes[i].position = pos + 1);
|
|
pos = this$static.scopes[i].position;
|
|
}
|
|
while (this$static.scopeCount > 0 && !$getElm_0(this$static.scopes[this$static.scopeCount - 1]))
|
|
--this$static.scopeCount;
|
|
ui = this$static.sim.ui;
|
|
h = ui.canvasHeight - this$static.sim.circuitArea.height_0;
|
|
pos = 0;
|
|
for (i = 0; i != this$static.scopeCount; i++)
|
|
this$static.scopeColCount[i] = 0;
|
|
for (i = 0; i != this$static.scopeCount; i++) {
|
|
pos = max_2(this$static.scopes[i].position, pos);
|
|
++this$static.scopeColCount[this$static.scopes[i].position];
|
|
}
|
|
colct = pos + 1;
|
|
iw = 160;
|
|
colct <= 2 && (iw = 240);
|
|
w = (ui.canvasWidth - iw) / colct | 0;
|
|
w < 20 && (w = 20);
|
|
pos = -1;
|
|
colh = 0;
|
|
row = 0;
|
|
speed = 0;
|
|
for (i = 0; i != this$static.scopeCount; i++) {
|
|
s = this$static.scopes[i];
|
|
if (s.position > pos) {
|
|
pos = s.position;
|
|
colh = h / this$static.scopeColCount[pos] | 0;
|
|
row = 0;
|
|
speed = s.speed;
|
|
}
|
|
s.stackCount = this$static.scopeColCount[pos];
|
|
if (s.speed != speed) {
|
|
s.speed = speed;
|
|
$resetGraph(s, false);
|
|
}
|
|
r = new Rectangle_0(pos * w, ui.canvasHeight - h + colh * row, w - 10, colh);
|
|
++row;
|
|
$equals_0(r, s.rect_0) || $setRect(s, r);
|
|
}
|
|
if (this$static.oldScopeCount != this$static.scopeCount) {
|
|
$setCircuitArea(ui);
|
|
this$static.oldScopeCount = this$static.scopeCount;
|
|
}
|
|
}
|
|
|
|
function $stackAll(this$static){
|
|
var i;
|
|
for (i = 0; i != this$static.scopeCount; i++) {
|
|
this$static.scopes[i].position = 0;
|
|
this$static.scopes[i].showMax = this$static.scopes[i].showMin = false;
|
|
}
|
|
}
|
|
|
|
function $stackScope(this$static, s){
|
|
if (!$canStackScope(this$static, s))
|
|
return;
|
|
s == 0 && (s = 1);
|
|
this$static.scopes[s].position = this$static.scopes[s - 1].position;
|
|
for (++s; s < this$static.scopeCount; s++)
|
|
--this$static.scopes[s].position;
|
|
}
|
|
|
|
function $timeStep_0(this$static){
|
|
var i;
|
|
for (i = 0; i != this$static.scopeCount; i++)
|
|
$timeStep(this$static.scopes[i]);
|
|
for (i = 0; i != this$static.sim.scopeElmArr.length; i++)
|
|
$timeStep(this$static.sim.scopeElmArr[i].elmScope);
|
|
}
|
|
|
|
function $unstackAll(this$static){
|
|
var i;
|
|
for (i = 0; i != this$static.scopeCount; i++) {
|
|
this$static.scopes[i].position = i;
|
|
this$static.scopes[i].showMax = true;
|
|
}
|
|
}
|
|
|
|
function $unstackScope(this$static, s){
|
|
if (!$canUnstackScope(this$static, s))
|
|
return;
|
|
s == 0 && (s = 1);
|
|
this$static.scopes[s].position != this$static.scopes[s - 1].position && ++s;
|
|
for (; s < this$static.scopeCount; s++)
|
|
++this$static.scopes[s].position;
|
|
}
|
|
|
|
function ScopeManager(sim){
|
|
this.sim = sim;
|
|
this.scopes = initUnidimensionalArray(Lcom_lushprojects_circuitjs1_client_Scope_2_classLit, $intern_3, 177, 20, 0, 1);
|
|
this.scopeColCount = initUnidimensionalArray(I_classLit, $intern_25, 7, 20, 15, 1);
|
|
this.scopeCount = 0;
|
|
this.selectScopeMenuBar = new ScopeManager$1(this);
|
|
this.scopePopupMenu = new ScopePopupMenu;
|
|
}
|
|
|
|
function max_2(a, b){
|
|
return a > b?a:b;
|
|
}
|
|
|
|
defineClass(545, 1, {}, ScopeManager);
|
|
_.menuPlot = -1;
|
|
_.menuScope = -1;
|
|
_.oldScopeCount = -1;
|
|
_.scopeCount = 0;
|
|
_.scopeHeightFraction = 0.2;
|
|
_.scopeMenuSelected = -1;
|
|
_.scopeSelected = -1;
|
|
var Lcom_lushprojects_circuitjs1_client_ScopeManager_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ScopeManager', 545);
|
|
function ScopeManager$1(this$0){
|
|
this.this$01 = this$0;
|
|
MenuBar_0.call(this, true);
|
|
}
|
|
|
|
defineClass(546, 58, $intern_66, ScopeManager$1);
|
|
_.onBrowserEvent = function onBrowserEvent_5(event_0){
|
|
var currentItem, i, item_0;
|
|
currentItem = -1;
|
|
for (i = 0; i != this.this$01.selectScopeMenuItems.arrayList.array.length; i++) {
|
|
item_0 = $get_4(this.this$01.selectScopeMenuItems, i);
|
|
$clinit_DOM();
|
|
isOrHasChildImpl(item_0.element, event_0.target) && (currentItem = i);
|
|
}
|
|
switch ($clinit_DOM() , $eventGetTypeInt(event_0.type)) {
|
|
case 16:
|
|
this.this$01.scopeMenuSelected = currentItem;
|
|
break;
|
|
case 32:
|
|
this.this$01.scopeMenuSelected = -1;
|
|
}
|
|
$onBrowserEvent_0(this, event_0);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_ScopeManager$1_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ScopeManager/1', 546);
|
|
function $draw_4(this$static, g){
|
|
var plot, t, ym, plot_0, mid, sdi, dutyLen, prevDuty, span_0;
|
|
$setColor_0(g, whiteColor);
|
|
this$static.textY = 10;
|
|
if (this$static.scope_0.visiblePlots.arrayList.array.length == 0) {
|
|
this$static.scope_0.showElmInfo && $drawElmInfo(this$static, g);
|
|
return;
|
|
}
|
|
plot = $firstElement(this$static.scope_0.visiblePlots);
|
|
this$static.scope_0.showScale && $drawScale(this$static, plot, g);
|
|
this$static.scope_0.showMax && $drawInfoText_0(this$static, g, 'Max=' + $getUnitText(plot, this$static.scope_0.maxValue));
|
|
if (this$static.scope_0.showMin) {
|
|
ym = this$static.scope_0.rect_0.height_0 - 5;
|
|
$drawString(g, 'Min=' + $getUnitText(plot, this$static.scope_0.minValue), 0, ym);
|
|
}
|
|
this$static.scope_0.showP2P && $drawInfoText_0(this$static, g, 'P-P=' + $getUnitText(plot, this$static.scope_0.maxValue - this$static.scope_0.minValue));
|
|
this$static.scope_0.showRMS && $drawRMS(this$static, g);
|
|
this$static.scope_0.showAverage && $drawAverage(this$static, g);
|
|
this$static.scope_0.showDutyCycle && (plot_0 = $firstElement(this$static.scope_0.visiblePlots) , mid = (this$static.scope_0.maxValue + this$static.scope_0.minValue) / 2 , sdi = new ScopeDataIterator(this$static.scope_0, plot_0) , dutyLen = stampJavaTypeInfo(getClassLiteralForArray(I_classLit, 1), $intern_25, 7, 15, [0]) , prevDuty = stampJavaTypeInfo(getClassLiteralForArray(I_classLit, 1), $intern_25, 7, 15, [0]) , span_0 = $iterateCycles(sdi, mid, new ScopeOverlays$lambda$6$Type(dutyLen), new ScopeOverlays$lambda$7$Type(sdi, mid, dutyLen), new ScopeOverlays$lambda$8$Type(prevDuty, dutyLen)) , span_0 > 0 && $drawInfoText_0(this$static, g, LS('Duty cycle ') + (100 * prevDuty[0] / span_0 | 0) + '%') , undefined);
|
|
t = $getScopeLabelOrText(this$static.scope_0, true);
|
|
t != null && t != '' && $drawInfoText_0(this$static, g, t);
|
|
this$static.scope_0.showFreq && $drawFrequency(this$static, g);
|
|
this$static.scope_0.showElmInfo && $drawElmInfo(this$static, g);
|
|
this$static.scope_0.fftPlot.showPhaseAngle && $drawPhaseAngle(this$static.scope_0.fftPlot, g);
|
|
}
|
|
|
|
function $drawAverage(this$static, g){
|
|
var avg, endAvg, mid, plot, sdi, span_0;
|
|
plot = $firstElement(this$static.scope_0.visiblePlots);
|
|
mid = (this$static.scope_0.maxValue + this$static.scope_0.minValue) / 2;
|
|
sdi = new ScopeDataIterator(this$static.scope_0, plot);
|
|
avg = stampJavaTypeInfo(getClassLiteralForArray(D_classLit, 1), $intern_76, 7, 15, [0]);
|
|
endAvg = stampJavaTypeInfo(getClassLiteralForArray(D_classLit, 1), $intern_76, 7, 15, [0]);
|
|
span_0 = $iterateCycles(sdi, mid, new ScopeOverlays$lambda$3$Type(avg), new ScopeOverlays$lambda$4$Type(avg, sdi), new ScopeOverlays$lambda$5$Type(endAvg, avg));
|
|
span_0 > 0 && $drawInfoText_0(this$static, g, $getUnitText(plot, endAvg[0] / span_0) + ('' + LS(' average')));
|
|
}
|
|
|
|
function $drawElmInfo(this$static, g){
|
|
var i, info;
|
|
info = initUnidimensionalArray(Ljava_lang_String_2_classLit, $intern_23, 2, 1, 6, 1);
|
|
$getElm_0(this$static.scope_0).getInfo_0(info);
|
|
for (i = 0; info[i] != null; i++)
|
|
$drawInfoText_0(this$static, g, info[i]);
|
|
}
|
|
|
|
function $drawFrequency(this$static, g){
|
|
var avg, avperiod, avperiod2, freq, i, i$iterator, i$iterator0, oi, os, pd, periodct, periodstd, plot, q, sdi, state, thresh;
|
|
avg = 0;
|
|
plot = $firstElement(this$static.scope_0.visiblePlots);
|
|
sdi = new ScopeDataIterator(this$static.scope_0, plot);
|
|
for (i$iterator0 = new ScopeDataIterator$1(sdi); i$iterator0.i < i$iterator0.this$01.validCount;) {
|
|
i$iterator0.this$01.currentIp = i$iterator0.i + i$iterator0.this$01.ipa & i$iterator0.this$01.scopePointCount - 1;
|
|
valueOf_0(i$iterator0.i++);
|
|
avg += sdi.plot.minValues[sdi.currentIp] + sdi.plot.maxValues[sdi.currentIp];
|
|
}
|
|
avg /= sdi.validCount * 2;
|
|
state = 0;
|
|
thresh = avg * 0.05;
|
|
oi = 0;
|
|
avperiod = 0;
|
|
periodct = -1;
|
|
avperiod2 = 0;
|
|
for (i$iterator = new ScopeDataIterator$1(sdi); i$iterator.i < i$iterator.this$01.validCount;) {
|
|
i = (i$iterator.this$01.currentIp = i$iterator.i + i$iterator.this$01.ipa & i$iterator.this$01.scopePointCount - 1 , valueOf_0(i$iterator.i++)).value_0;
|
|
q = sdi.plot.maxValues[sdi.currentIp] - avg;
|
|
os = state;
|
|
q < thresh?(state = 1):q > -thresh && (state = 2);
|
|
if (state == 2 && os == 1) {
|
|
pd = i - oi;
|
|
oi = i;
|
|
if (pd < 12)
|
|
continue;
|
|
if (periodct >= 0) {
|
|
avperiod += pd;
|
|
avperiod2 += pd * pd;
|
|
}
|
|
++periodct;
|
|
}
|
|
}
|
|
avperiod /= periodct;
|
|
avperiod2 /= periodct;
|
|
periodstd = $wnd.Math.sqrt(avperiod2 - avperiod * avperiod);
|
|
freq = 1 / (avperiod * this$static.scope_0.sim.maxTimeStep * this$static.scope_0.speed);
|
|
(periodct < 1 || periodstd > 2) && (freq = 0);
|
|
freq != 0 && $drawInfoText_0(this$static, g, getUnitText(freq, 'Hz', false));
|
|
}
|
|
|
|
function $drawInfoText_0(this$static, g, text_0){
|
|
if (this$static.scope_0.rect_0.y_0 + this$static.scope_0.rect_0.height_0 <= this$static.textY + 5)
|
|
return;
|
|
$drawString(g, text_0, 0, this$static.textY);
|
|
this$static.textY += 15;
|
|
}
|
|
|
|
function $drawRMS(this$static, g){
|
|
var avg, endAvg, mid, plot, sdi, span_0;
|
|
if (!$canShowRMS(this$static.scope_0)) {
|
|
this$static.scope_0.showRMS = false;
|
|
this$static.scope_0.showAverage = true;
|
|
$drawAverage(this$static, g);
|
|
return;
|
|
}
|
|
plot = $firstElement(this$static.scope_0.visiblePlots);
|
|
mid = (this$static.scope_0.maxValue + this$static.scope_0.minValue) / 2;
|
|
sdi = new ScopeDataIterator(this$static.scope_0, plot);
|
|
avg = stampJavaTypeInfo(getClassLiteralForArray(D_classLit, 1), $intern_76, 7, 15, [0]);
|
|
endAvg = stampJavaTypeInfo(getClassLiteralForArray(D_classLit, 1), $intern_76, 7, 15, [0]);
|
|
span_0 = $iterateCycles(sdi, mid, new ScopeOverlays$lambda$0$Type(avg), new ScopeOverlays$lambda$1$Type(sdi, avg), new ScopeOverlays$lambda$2$Type(endAvg, avg));
|
|
span_0 > 0 && $drawInfoText_0(this$static, g, $getUnitText(plot, $wnd.Math.sqrt(endAvg[0] / span_0)) + 'rms');
|
|
}
|
|
|
|
function $drawScale(this$static, plot, g){
|
|
var hs, i, p, s, vScaleText, vScaleWidth, x_0;
|
|
if (this$static.scope_0.manualScale) {
|
|
if (this$static.scope_0.rect_0.y_0 + this$static.scope_0.rect_0.height_0 <= this$static.textY + 5)
|
|
return;
|
|
x_0 = 0;
|
|
hs = 'H=' + getUnitText(this$static.scope_0.gridStepX, 's', false) + '/div';
|
|
$drawString(g, hs, 0, this$static.textY);
|
|
x_0 += $measureText(g.context, hs).width;
|
|
for (i = 0; i < this$static.scope_0.visiblePlots.arrayList.array.length; i++) {
|
|
p = $get_4(this$static.scope_0.visiblePlots, i);
|
|
s = $getUnitText(p, p.manScale);
|
|
if (p) {
|
|
vScaleText = '=' + s + '/div';
|
|
vScaleWidth = $measureText(g.context, vScaleText).width;
|
|
if (x_0 + 17 + vScaleWidth > this$static.scope_0.rect_0.width_0) {
|
|
x_0 = 0;
|
|
this$static.textY += 15;
|
|
if (this$static.scope_0.rect_0.y_0 + this$static.scope_0.rect_0.height_0 <= this$static.textY + 5)
|
|
return;
|
|
}
|
|
$setColor_1(g, p.color_0);
|
|
$fillOval(g, round_int(x_0) + 7, this$static.textY - 9, 8);
|
|
x_0 += 17;
|
|
$setColor_0(g, whiteColor);
|
|
$drawString(g, vScaleText, round_int(x_0), this$static.textY);
|
|
x_0 += vScaleWidth;
|
|
}
|
|
}
|
|
this$static.textY += 15;
|
|
}
|
|
else {
|
|
if (this$static.scope_0.gridStepY != 0 && !(this$static.scope_0.showV && this$static.scope_0.showI)) {
|
|
vScaleText = ' V=' + $getUnitText(plot, this$static.scope_0.gridStepY) + '/div';
|
|
$drawInfoText_0(this$static, g, 'H=' + getUnitText(this$static.scope_0.gridStepX, 's', false) + '/div' + vScaleText);
|
|
}
|
|
}
|
|
}
|
|
|
|
function $iterateCycles(sdi, mid, onCycleStart, onSample, onCycleEnd){
|
|
var end, fnz, i, i$iterator, start_0, state, sw, waveCount;
|
|
fnz = $skipNonzeroValues(sdi);
|
|
state = fnz > mid?1:-1;
|
|
waveCount = 0;
|
|
start_0 = 0;
|
|
end = 0;
|
|
for (i$iterator = new ScopeDataIterator$1(sdi); i$iterator.i < i$iterator.this$01.validCount;) {
|
|
i = (i$iterator.this$01.currentIp = i$iterator.i + i$iterator.this$01.ipa & i$iterator.this$01.scopePointCount - 1 , valueOf_0(i$iterator.i++)).value_0;
|
|
sw = false;
|
|
state == 1?sdi.plot.maxValues[sdi.currentIp] < mid && (sw = true):sdi.plot.minValues[sdi.currentIp] > mid && (sw = true);
|
|
if (sw) {
|
|
state = -state;
|
|
if (state == 1) {
|
|
if (waveCount == 0) {
|
|
start_0 = i;
|
|
onCycleStart.run();
|
|
}
|
|
else {
|
|
end = i;
|
|
onCycleEnd.run();
|
|
}
|
|
++waveCount;
|
|
}
|
|
}
|
|
waveCount > 0 && onSample.run();
|
|
}
|
|
return end - start_0;
|
|
}
|
|
|
|
function ScopeOverlays(scope_0){
|
|
this.scope_0 = scope_0;
|
|
}
|
|
|
|
function lambda$1(sdi_0, avg_1){
|
|
var m;
|
|
m = (sdi_0.plot.maxValues[sdi_0.currentIp] + sdi_0.plot.minValues[sdi_0.currentIp]) * 0.5;
|
|
avg_1[0] += m * m;
|
|
}
|
|
|
|
function lambda$4(avg_0, sdi_1){
|
|
return avg_0[0] += (sdi_1.plot.maxValues[sdi_1.currentIp] + sdi_1.plot.minValues[sdi_1.currentIp]) * 0.5;
|
|
}
|
|
|
|
function lambda$7(sdi_0, mid_1, dutyLen_3){
|
|
sdi_0.plot.maxValues[sdi_0.currentIp] > mid_1 && ++dutyLen_3[0];
|
|
}
|
|
|
|
defineClass(751, 1, {}, ScopeOverlays);
|
|
_.textY = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_ScopeOverlays_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ScopeOverlays', 751);
|
|
function ScopeOverlays$lambda$0$Type(avg_0){
|
|
this.avg_0 = avg_0;
|
|
}
|
|
|
|
defineClass(752, 1, {}, ScopeOverlays$lambda$0$Type);
|
|
_.run = function run_6(){
|
|
this.avg_0[0] = 0;
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_ScopeOverlays$lambda$0$Type_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ScopeOverlays/lambda$0$Type', 752);
|
|
function ScopeOverlays$lambda$1$Type(sdi_0, avg_1){
|
|
this.sdi_0 = sdi_0;
|
|
this.avg_1 = avg_1;
|
|
}
|
|
|
|
defineClass(753, 1, {}, ScopeOverlays$lambda$1$Type);
|
|
_.run = function run_7(){
|
|
lambda$1(this.sdi_0, this.avg_1);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_ScopeOverlays$lambda$1$Type_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ScopeOverlays/lambda$1$Type', 753);
|
|
function ScopeOverlays$lambda$2$Type(endAvg_0, avg_1){
|
|
this.endAvg_0 = endAvg_0;
|
|
this.avg_1 = avg_1;
|
|
}
|
|
|
|
defineClass(754, 1, {}, ScopeOverlays$lambda$2$Type);
|
|
_.run = function run_8(){
|
|
this.endAvg_0[0] = this.avg_1[0];
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_ScopeOverlays$lambda$2$Type_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ScopeOverlays/lambda$2$Type', 754);
|
|
function ScopeOverlays$lambda$3$Type(avg_0){
|
|
this.avg_0 = avg_0;
|
|
}
|
|
|
|
defineClass(755, 1, {}, ScopeOverlays$lambda$3$Type);
|
|
_.run = function run_9(){
|
|
this.avg_0[0] = 0;
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_ScopeOverlays$lambda$3$Type_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ScopeOverlays/lambda$3$Type', 755);
|
|
function ScopeOverlays$lambda$4$Type(avg_0, sdi_1){
|
|
this.avg_0 = avg_0;
|
|
this.sdi_1 = sdi_1;
|
|
}
|
|
|
|
defineClass(756, 1, {}, ScopeOverlays$lambda$4$Type);
|
|
_.run = function run_10(){
|
|
lambda$4(this.avg_0, this.sdi_1);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_ScopeOverlays$lambda$4$Type_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ScopeOverlays/lambda$4$Type', 756);
|
|
function ScopeOverlays$lambda$5$Type(endAvg_0, avg_1){
|
|
this.endAvg_0 = endAvg_0;
|
|
this.avg_1 = avg_1;
|
|
}
|
|
|
|
defineClass(757, 1, {}, ScopeOverlays$lambda$5$Type);
|
|
_.run = function run_11(){
|
|
this.endAvg_0[0] = this.avg_1[0];
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_ScopeOverlays$lambda$5$Type_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ScopeOverlays/lambda$5$Type', 757);
|
|
function ScopeOverlays$lambda$6$Type(dutyLen_0){
|
|
this.dutyLen_0 = dutyLen_0;
|
|
}
|
|
|
|
defineClass(758, 1, {}, ScopeOverlays$lambda$6$Type);
|
|
_.run = function run_12(){
|
|
this.dutyLen_0[0] = 0;
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_ScopeOverlays$lambda$6$Type_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ScopeOverlays/lambda$6$Type', 758);
|
|
function ScopeOverlays$lambda$7$Type(sdi_0, mid_1, dutyLen_3){
|
|
this.sdi_0 = sdi_0;
|
|
this.mid_1 = mid_1;
|
|
this.dutyLen_3 = dutyLen_3;
|
|
}
|
|
|
|
defineClass(759, 1, {}, ScopeOverlays$lambda$7$Type);
|
|
_.run = function run_13(){
|
|
lambda$7(this.sdi_0, this.mid_1, this.dutyLen_3);
|
|
}
|
|
;
|
|
_.mid_1 = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_ScopeOverlays$lambda$7$Type_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ScopeOverlays/lambda$7$Type', 759);
|
|
function ScopeOverlays$lambda$8$Type(prevDuty_0, dutyLen_1){
|
|
this.prevDuty_0 = prevDuty_0;
|
|
this.dutyLen_1 = dutyLen_1;
|
|
}
|
|
|
|
defineClass(760, 1, {}, ScopeOverlays$lambda$8$Type);
|
|
_.run = function run_14(){
|
|
this.prevDuty_0[0] = this.dutyLen_1[0];
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_ScopeOverlays$lambda$8$Type_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ScopeOverlays/lambda$8$Type', 760);
|
|
function $clinit_ScopePlot(){
|
|
$clinit_ScopePlot = emptyMethod;
|
|
colors = stampJavaTypeInfo(getClassLiteralForArray(Ljava_lang_String_2_classLit, 1), $intern_23, 2, 6, ['#FF0000', '#FF8000', '#FF00FF', '#7F00FF', '#0000FF', '#0080FF', '#FFFF00', '#00FFFF']);
|
|
}
|
|
|
|
function $$init_21(this$static){
|
|
}
|
|
|
|
function $assignColor(this$static, count){
|
|
if (count > 0) {
|
|
this$static.color_0 = colors[(count - 1) % 8];
|
|
return;
|
|
}
|
|
switch (this$static.units) {
|
|
case 0:
|
|
this$static.color_0 = $getHexValue(positiveColor_0);
|
|
break;
|
|
case 1:
|
|
this$static.color_0 = theApp.menus.printableCheckItem.on?'#A0A000':'#FFFF00';
|
|
break;
|
|
default:this$static.color_0 = theApp.menus.printableCheckItem.on?'#000000':'#FFFFFF';
|
|
}
|
|
}
|
|
|
|
function $getUnitText(this$static, v){
|
|
switch (this$static.units) {
|
|
case 0:
|
|
return getUnitText(v, 'V', false);
|
|
case 1:
|
|
return getUnitText(v, 'A', false);
|
|
case 3:
|
|
return getUnitText(v, ohmString, false);
|
|
case 2:
|
|
return getUnitText(v, 'W', false);
|
|
case 4:
|
|
return getUnitText(v, 'C', false);
|
|
}
|
|
return null;
|
|
}
|
|
|
|
function $reset_9(this$static, spc, sp, full){
|
|
var i, i1, i2, oldMax, oldMin, oldSpc;
|
|
oldSpc = this$static.scopePointCount;
|
|
this$static.scopePointCount = spc;
|
|
this$static.scopePlotSpeed != sp && (oldSpc = 0);
|
|
this$static.scopePlotSpeed = sp;
|
|
this$static.acAlpha = 1 - 1 / (1.15 * this$static.scopePlotSpeed * this$static.scopePointCount);
|
|
oldMin = this$static.minValues;
|
|
oldMax = this$static.maxValues;
|
|
this$static.minValues = initUnidimensionalArray(D_classLit, $intern_76, 7, this$static.scopePointCount, 15, 1);
|
|
this$static.maxValues = initUnidimensionalArray(D_classLit, $intern_76, 7, this$static.scopePointCount, 15, 1);
|
|
if (oldMin != null && !full) {
|
|
for (i = 0; i != this$static.scopePointCount && i != oldSpc; i++) {
|
|
i1 = -i & this$static.scopePointCount - 1;
|
|
i2 = this$static.ptr - i & oldSpc - 1;
|
|
this$static.minValues[i1] = oldMin[i2];
|
|
this$static.maxValues[i1] = oldMax[i2];
|
|
}
|
|
}
|
|
else
|
|
this$static.lastUpdateTime = theSim.t;
|
|
this$static.ptr = 0;
|
|
}
|
|
|
|
function $setAcCoupled(this$static, b){
|
|
this$static.units == 0?(this$static.acCoupled = b):(this$static.acCoupled = false);
|
|
}
|
|
|
|
function $timeStep_1(this$static){
|
|
var maxTimeStep, newAcOut, v;
|
|
if (!this$static.elm)
|
|
return;
|
|
v = this$static.elm.getScopeValue(this$static.value_0);
|
|
newAcOut = this$static.acAlpha * (this$static.acLastOut + v - this$static.lastValue);
|
|
this$static.lastValue = v;
|
|
this$static.acLastOut = newAcOut;
|
|
this$static.acCoupled && (v = newAcOut);
|
|
v < this$static.minValues[this$static.ptr] && (this$static.minValues[this$static.ptr] = v);
|
|
v > this$static.maxValues[this$static.ptr] && (this$static.maxValues[this$static.ptr] = v);
|
|
maxTimeStep = theSim.maxTimeStep;
|
|
if (theSim.t - this$static.lastUpdateTime >= maxTimeStep * this$static.scopePlotSpeed) {
|
|
this$static.ptr = this$static.ptr + 1 & this$static.scopePointCount - 1;
|
|
this$static.minValues[this$static.ptr] = this$static.maxValues[this$static.ptr] = v;
|
|
this$static.lastUpdateTime += maxTimeStep * this$static.scopePlotSpeed;
|
|
}
|
|
}
|
|
|
|
function ScopePlot(e){
|
|
$clinit_ScopePlot();
|
|
$$init_21(this);
|
|
this.elm = e;
|
|
this.units = 0;
|
|
}
|
|
|
|
function ScopePlot_0(e, u, v, manS){
|
|
$clinit_ScopePlot();
|
|
$$init_21(this);
|
|
this.elm = e;
|
|
this.units = u;
|
|
this.value_0 = v;
|
|
this.manScale = manS;
|
|
(this.units == 3 || this.units == 2 || this.units == 4) && (this.manVPosition = -100);
|
|
}
|
|
|
|
defineClass(138, 1, {138:1}, ScopePlot, ScopePlot_0);
|
|
_.acAlpha = 0.9999;
|
|
_.acCoupled = false;
|
|
_.acLastOut = 0;
|
|
_.gridMult = 0;
|
|
_.lastUpdateTime = 0;
|
|
_.lastValue = 0;
|
|
_.manScale = 1;
|
|
_.manScaleSet = false;
|
|
_.manVPosition = 0;
|
|
_.plotOffset = 0;
|
|
_.ptr = 0;
|
|
_.scopePlotSpeed = 0;
|
|
_.scopePointCount = 0;
|
|
_.units = 0;
|
|
_.value_0 = 0;
|
|
var colors;
|
|
var Lcom_lushprojects_circuitjs1_client_ScopePlot_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ScopePlot', 138);
|
|
function $allocImage(this$static){
|
|
if (!this$static.enabled)
|
|
return;
|
|
if (!this$static.imageCanvas) {
|
|
this$static.imageCanvas = createIfSupported();
|
|
this$static.imageContext = $getContext2d(this$static.imageCanvas);
|
|
}
|
|
$setWidth(this$static.imageCanvas, this$static.scope_0.rect_0.width_0 + 'PX');
|
|
$setHeight(this$static.imageCanvas, this$static.scope_0.rect_0.height_0 + 'PX');
|
|
$setCoordinateSpaceWidth(this$static.imageCanvas, this$static.scope_0.rect_0.width_0);
|
|
$setCoordinateSpaceHeight(this$static.imageCanvas, this$static.scope_0.rect_0.height_0);
|
|
$clearView(this$static);
|
|
}
|
|
|
|
function $calcGridPx(this$static, width_0, height){
|
|
var m;
|
|
m = width_0 < height?width_0:height;
|
|
return m / 2 / (this$static.scope_0.manDivisions / 2 + 0.05);
|
|
}
|
|
|
|
function $clearView(this$static){
|
|
if (this$static.imageContext) {
|
|
this$static.scope_0.app.menus.printableCheckItem.on?(this$static.imageContext.fillStyle = '#eee' , undefined):(this$static.imageContext.fillStyle = '#111' , undefined);
|
|
$fillRect(this$static.imageContext, 0, 0, this$static.scope_0.rect_0.width_0 - 1, this$static.scope_0.rect_0.height_0 - 1);
|
|
}
|
|
this$static.draw_ox = this$static.draw_oy = -1;
|
|
}
|
|
|
|
function $computeAlpha(this$static){
|
|
var bv;
|
|
if (this$static.plotBrightness < 0 || this$static.plotBrightness >= this$static.scope_0.plots.arrayList.array.length)
|
|
return 1;
|
|
bv = $wnd.Math.abs($get_4(this$static.scope_0.plots, this$static.plotBrightness).lastValue);
|
|
while (bv > this$static.scaleBrightness)
|
|
this$static.scaleBrightness *= 2;
|
|
return this$static.scaleBrightness > 0?bv / this$static.scaleBrightness:0;
|
|
}
|
|
|
|
function $computeColor(this$static){
|
|
var b, bv, g, gv, r, rv;
|
|
if (this$static.plotColorR < 0 && this$static.plotColorG < 0 && this$static.plotColorB < 0)
|
|
return this$static.scope_0.app.menus.printableCheckItem.on?'#000000':'#ffffff';
|
|
r = 0;
|
|
g = 0;
|
|
b = 0;
|
|
if (this$static.plotColorR >= 0 && this$static.plotColorR < this$static.scope_0.plots.arrayList.array.length) {
|
|
rv = $get_4(this$static.scope_0.plots, this$static.plotColorR).lastValue;
|
|
while (rv > this$static.scaleR)
|
|
this$static.scaleR *= 2;
|
|
r = round_int($wnd.Math.max(0, $wnd.Math.min(255, rv / this$static.scaleR * 255)));
|
|
}
|
|
if (this$static.plotColorG >= 0 && this$static.plotColorG < this$static.scope_0.plots.arrayList.array.length) {
|
|
gv = $get_4(this$static.scope_0.plots, this$static.plotColorG).lastValue;
|
|
while (gv > this$static.scaleG)
|
|
this$static.scaleG *= 2;
|
|
g = round_int($wnd.Math.max(0, $wnd.Math.min(255, gv / this$static.scaleG * 255)));
|
|
}
|
|
if (this$static.plotColorB >= 0 && this$static.plotColorB < this$static.scope_0.plots.arrayList.array.length) {
|
|
bv = $get_4(this$static.scope_0.plots, this$static.plotColorB).lastValue;
|
|
while (bv > this$static.scaleB)
|
|
this$static.scaleB *= 2;
|
|
b = round_int($wnd.Math.max(0, $wnd.Math.min(255, bv / this$static.scaleB * 255)));
|
|
}
|
|
return 'rgb(' + r + ',' + g + ',' + b + ')';
|
|
}
|
|
|
|
function $draw_5(this$static, g){
|
|
var elapsed, fadeAlpha, gridPx, i, info, px, py, spx, spy, timeConst, xValue, yValue;
|
|
if (!this$static.imageContext)
|
|
return;
|
|
g.context.save();
|
|
$translate(g.context, this$static.scope_0.rect_0.x_0, this$static.scope_0.rect_0.y_0);
|
|
$clipRect(g, this$static.scope_0.rect_0.width_0, this$static.scope_0.rect_0.height_0);
|
|
++this$static.alphaCounter;
|
|
if (this$static.alphaCounter > 2) {
|
|
this$static.alphaCounter = 0;
|
|
if (this$static.trailPersistence <= 0) {
|
|
fadeAlpha = $intern_34;
|
|
}
|
|
else {
|
|
(this$static.lastTrailSimTime < 0 || this$static.scope_0.sim.t < this$static.lastTrailSimTime) && (this$static.lastTrailSimTime = this$static.scope_0.sim.t);
|
|
elapsed = this$static.scope_0.sim.t - this$static.lastTrailSimTime;
|
|
timeConst = this$static.trailPersistence * this$static.scope_0.sim.maxTimeStep;
|
|
fadeAlpha = 1 - $wnd.Math.exp(-elapsed / timeConst);
|
|
fadeAlpha >= 0.011764705882352941?(this$static.lastTrailSimTime = this$static.scope_0.sim.t):(fadeAlpha = 0);
|
|
}
|
|
if (fadeAlpha > 0) {
|
|
$setGlobalAlpha(this$static.imageContext, fadeAlpha);
|
|
this$static.scope_0.app.menus.printableCheckItem.on?(this$static.imageContext.fillStyle = '#ffffff' , undefined):(this$static.imageContext.fillStyle = '#000000' , undefined);
|
|
$fillRect(this$static.imageContext, 0, 0, this$static.scope_0.rect_0.width_0, this$static.scope_0.rect_0.height_0);
|
|
this$static.imageContext.globalAlpha = 1;
|
|
}
|
|
}
|
|
$drawImage(g.context, this$static.imageContext.canvas, 0, 0);
|
|
$setColor_0(g, whiteColor);
|
|
$fillOval(g, this$static.draw_ox - 2, this$static.draw_oy - 2, 5);
|
|
$setColor_0(g, positiveColor_0);
|
|
$drawLine(g, 0, this$static.scope_0.rect_0.height_0 / 2 | 0, this$static.scope_0.rect_0.width_0 - 1, this$static.scope_0.rect_0.height_0 / 2 | 0);
|
|
this$static.plotXY || $setColor_0(g, ($clinit_Color() , yellow));
|
|
$drawLine(g, this$static.scope_0.rect_0.width_0 / 2 | 0, 0, this$static.scope_0.rect_0.width_0 / 2 | 0, this$static.scope_0.rect_0.height_0 - 1);
|
|
if (this$static.scope_0.manualScale) {
|
|
gridPx = $calcGridPx(this$static, this$static.scope_0.rect_0.width_0, this$static.scope_0.rect_0.height_0);
|
|
g.context.strokeStyle = '#404040';
|
|
g.context.fillStyle = '#404040';
|
|
for (i = -this$static.scope_0.manDivisions; i <= this$static.scope_0.manDivisions; i++) {
|
|
i != 0 && $drawLine(g, round_int(gridPx * i) + (this$static.scope_0.rect_0.width_0 / 2 | 0), 0, round_int(gridPx * i) + (this$static.scope_0.rect_0.width_0 / 2 | 0), this$static.scope_0.rect_0.height_0);
|
|
$drawLine(g, 0, round_int(gridPx * i) + (this$static.scope_0.rect_0.height_0 / 2 | 0), this$static.scope_0.rect_0.width_0, round_int(gridPx * i) + (this$static.scope_0.rect_0.height_0 / 2 | 0));
|
|
}
|
|
}
|
|
this$static.scope_0.overlays.textY = 10;
|
|
$setColor_0(g, whiteColor);
|
|
this$static.scope_0.text_0 != null && $drawInfoText(this$static.scope_0, g, this$static.scope_0.text_0);
|
|
px = $validPlotIndex(this$static, this$static.plotX, 0);
|
|
py = $validPlotIndex(this$static, this$static.plotY, $wnd.Math.min(1, this$static.scope_0.plots.arrayList.array.length - 1));
|
|
if (this$static.scope_0.showScale && this$static.scope_0.plots.arrayList.array.length >= 1 && this$static.scope_0.manualScale && px < this$static.scope_0.plots.arrayList.array.length && py < this$static.scope_0.plots.arrayList.array.length) {
|
|
spx = $get_4(this$static.scope_0.plots, px);
|
|
spy = $get_4(this$static.scope_0.plots, py);
|
|
$drawInfoText(this$static.scope_0, g, 'X=' + $getUnitText(spx, spx.manScale) + '/div, Y=' + $getUnitText(spy, spy.manScale) + '/div');
|
|
}
|
|
g.context.restore();
|
|
$drawSettingsWheel(this$static.scope_0, g);
|
|
if (!$dialogIsShowing(this$static.scope_0.app.ui) && $contains(this$static.scope_0.rect_0, this$static.scope_0.app.mouse.mouseCursorX, this$static.scope_0.app.mouse.mouseCursorY) && this$static.scope_0.plots.arrayList.array.length >= 1 && px < this$static.scope_0.plots.arrayList.array.length && py < this$static.scope_0.plots.arrayList.array.length) {
|
|
gridPx = $calcGridPx(this$static, this$static.scope_0.rect_0.width_0, this$static.scope_0.rect_0.height_0);
|
|
info = initUnidimensionalArray(Ljava_lang_String_2_classLit, $intern_23, 2, 2, 6, 1);
|
|
spx = $get_4(this$static.scope_0.plots, px);
|
|
spy = $get_4(this$static.scope_0.plots, py);
|
|
if (this$static.scope_0.manualScale) {
|
|
xValue = spx.manScale * ((this$static.scope_0.app.mouse.mouseCursorX - this$static.scope_0.rect_0.x_0 - (this$static.scope_0.rect_0.width_0 / 2 | 0)) / gridPx - this$static.scope_0.manDivisions * spx.manVPosition / 200);
|
|
yValue = spy.manScale * ((-this$static.scope_0.app.mouse.mouseCursorY + this$static.scope_0.rect_0.y_0 + (this$static.scope_0.rect_0.height_0 / 2 | 0)) / gridPx - this$static.scope_0.manDivisions * spy.manVPosition / 200);
|
|
}
|
|
else {
|
|
xValue = ((this$static.scope_0.app.mouse.mouseCursorX - this$static.scope_0.rect_0.x_0) / ($intern_131 * this$static.scope_0.rect_0.width_0) - 1) * this$static.scaleX;
|
|
yValue = -((this$static.scope_0.app.mouse.mouseCursorY - this$static.scope_0.rect_0.y_0) / ($intern_131 * this$static.scope_0.rect_0.height_0) - 1) * this$static.scaleY;
|
|
}
|
|
info[0] = $getUnitText(spx, xValue);
|
|
info[1] = $getUnitText(spy, yValue);
|
|
$drawCursorInfo(this$static.scope_0, g, info, 2, this$static.scope_0.app.mouse.mouseCursorX, ($clinit_Boolean() , true));
|
|
}
|
|
}
|
|
|
|
function $drawSegment(this$static, ox, oy, x2, y2, color_0, alpha_0){
|
|
alpha_0 != 1 && $setGlobalAlpha(this$static.imageContext, alpha_0);
|
|
$setStrokeStyleWeb(this$static.imageContext, color_0);
|
|
this$static.imageContext.beginPath();
|
|
$moveTo(this$static.imageContext, ox, oy);
|
|
$lineTo(this$static.imageContext, x2, y2);
|
|
this$static.imageContext.stroke();
|
|
alpha_0 != 1 && (this$static.imageContext.globalAlpha = 1 , undefined);
|
|
}
|
|
|
|
function $drawTo(this$static, x2, y2, color_0, alpha_0){
|
|
if (this$static.draw_ox == -1) {
|
|
this$static.draw_ox = x2;
|
|
this$static.draw_oy = y2;
|
|
return;
|
|
}
|
|
$drawSegment(this$static, this$static.draw_ox, this$static.draw_oy, x2, y2, color_0, alpha_0);
|
|
this$static.draw_ox = x2;
|
|
this$static.draw_oy = y2;
|
|
}
|
|
|
|
function $maxScale_0(this$static){
|
|
this$static.scope_0.scale_0[0] *= $intern_112;
|
|
this$static.scope_0.scale_0[1] *= $intern_112;
|
|
this$static.scope_0.scale_0[3] *= $intern_112;
|
|
this$static.scope_0.scale_0[2] *= $intern_112;
|
|
this$static.scope_0.scale_0[4] *= $intern_112;
|
|
this$static.scaleX *= $intern_112;
|
|
this$static.scaleY *= $intern_112;
|
|
this$static.scaleBrightness *= $intern_112;
|
|
this$static.scaleR *= $intern_112;
|
|
this$static.scaleG *= $intern_112;
|
|
this$static.scaleB *= $intern_112;
|
|
}
|
|
|
|
function $timeStep_2(this$static){
|
|
var alpha_0, color_0, gridPx, newscale, px, py, v, x_0, xa, y_0, ya, yval;
|
|
if (!this$static.imageContext || this$static.scope_0.plots.arrayList.array.length < 1)
|
|
return;
|
|
px = $validPlotIndex(this$static, this$static.plotX, 0);
|
|
py = $validPlotIndex(this$static, this$static.plotY, $wnd.Math.min(1, this$static.scope_0.plots.arrayList.array.length - 1));
|
|
v = $get_4(this$static.scope_0.plots, px).lastValue;
|
|
yval = $get_4(this$static.scope_0.plots, py).lastValue;
|
|
if (this$static.scope_0.manualScale) {
|
|
gridPx = $calcGridPx(this$static, this$static.scope_0.rect_0.width_0, this$static.scope_0.rect_0.height_0);
|
|
x_0 = round_int(this$static.scope_0.rect_0.width_0 * $intern_131 + v / $get_4(this$static.scope_0.plots, px).manScale * gridPx + gridPx * this$static.scope_0.manDivisions * $get_4(this$static.scope_0.plots, px).manVPosition / 200);
|
|
y_0 = round_int(this$static.scope_0.rect_0.height_0 * $intern_131 - yval / $get_4(this$static.scope_0.plots, py).manScale * gridPx - gridPx * this$static.scope_0.manDivisions * $get_4(this$static.scope_0.plots, py).manVPosition / 200);
|
|
}
|
|
else {
|
|
newscale = false;
|
|
while (v > this$static.scaleX || v < -this$static.scaleX) {
|
|
this$static.scaleX *= 2;
|
|
newscale = true;
|
|
}
|
|
while (yval > this$static.scaleY || yval < -this$static.scaleY) {
|
|
this$static.scaleY *= 2;
|
|
newscale = true;
|
|
}
|
|
newscale && $clearView(this$static);
|
|
xa = v / this$static.scaleX;
|
|
ya = yval / this$static.scaleY;
|
|
x_0 = round_int(this$static.scope_0.rect_0.width_0 * (1 + xa) * $intern_131);
|
|
y_0 = round_int(this$static.scope_0.rect_0.height_0 * (1 - ya) * $intern_131);
|
|
}
|
|
color_0 = $computeColor(this$static);
|
|
alpha_0 = $computeAlpha(this$static);
|
|
$drawTo(this$static, x_0, y_0, color_0, alpha_0);
|
|
}
|
|
|
|
function $validPlotIndex(this$static, idx, defaultIdx){
|
|
if (this$static.scope_0.plots.arrayList.array.length == 0)
|
|
return 0;
|
|
if (idx < 0 || idx >= this$static.scope_0.plots.arrayList.array.length)
|
|
return $wnd.Math.min(defaultIdx, this$static.scope_0.plots.arrayList.array.length - 1);
|
|
return idx;
|
|
}
|
|
|
|
function ScopePlot2d(scope_0){
|
|
this.scope_0 = scope_0;
|
|
this.scaleX = 5;
|
|
this.scaleY = 0.1;
|
|
}
|
|
|
|
defineClass(749, 1, {}, ScopePlot2d);
|
|
_.alphaCounter = 0;
|
|
_.draw_ox = 0;
|
|
_.draw_oy = 0;
|
|
_.enabled = false;
|
|
_.lastTrailSimTime = -1;
|
|
_.plotBrightness = -1;
|
|
_.plotColorB = -1;
|
|
_.plotColorG = -1;
|
|
_.plotColorR = -1;
|
|
_.plotX = 0;
|
|
_.plotXY = false;
|
|
_.plotY = 1;
|
|
_.scaleB = 5;
|
|
_.scaleBrightness = 5;
|
|
_.scaleG = 5;
|
|
_.scaleR = 5;
|
|
_.scaleX = 0;
|
|
_.scaleY = 0;
|
|
_.trailPersistence = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_ScopePlot2d_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ScopePlot2d', 749);
|
|
function $doScopePopupChecks(this$static, floating, canstack, cancombine, canunstack, s){
|
|
$setState_1(this$static.maxScaleItem, s.maxScale);
|
|
$setVisible(this$static.stackItem, !floating);
|
|
$setEnabled_1(this$static.stackItem, canstack);
|
|
$setVisible(this$static.unstackItem, !floating);
|
|
$setEnabled_1(this$static.unstackItem, canunstack);
|
|
$setVisible(this$static.combineItem, !floating);
|
|
$setEnabled_1(this$static.combineItem, cancombine);
|
|
$setVisible(this$static.dockItem, floating);
|
|
$setVisible(this$static.undockItem, !floating);
|
|
}
|
|
|
|
function ScopePopupMenu(){
|
|
this.m_0 = new MenuBar_0(true);
|
|
$addItem_0(this.m_0, new CheckboxAlignedMenuItem(LS('Remove Scope'), new MyCommand('scopepop', 'remove')));
|
|
$addItem_0(this.m_0, this.dockItem = new CheckboxAlignedMenuItem(LS('Dock Scope'), new MyCommand('scopepop', 'dock')));
|
|
$addItem_0(this.m_0, this.undockItem = new CheckboxAlignedMenuItem(LS('Undock Scope'), new MyCommand('scopepop', 'undock')));
|
|
$addItem_0(this.m_0, this.maxScaleItem = new CheckboxMenuItem_0(LS('Max Scale'), new MyCommand('scopepop', 'maxscale')));
|
|
$addItem_0(this.m_0, this.stackItem = new CheckboxAlignedMenuItem(LS('Stack'), new MyCommand('scopepop', 'stack')));
|
|
$addItem_0(this.m_0, this.unstackItem = new CheckboxAlignedMenuItem(LS('Unstack'), new MyCommand('scopepop', 'unstack')));
|
|
$addItem_0(this.m_0, this.combineItem = new CheckboxAlignedMenuItem(LS('Combine'), new MyCommand('scopepop', 'combine')));
|
|
$addItem_0(this.m_0, new CheckboxAlignedMenuItem(LS('Remove Plot'), new MyCommand('scopepop', 'removeplot')));
|
|
$addItem_0(this.m_0, new CheckboxAlignedMenuItem(LS('Reset'), new MyCommand('scopepop', 'reset')));
|
|
$addItem_0(this.m_0, new CheckboxAlignedMenuItem(LS('Export CSV...'), new MyCommand('scopepop', 'exportcsv')));
|
|
$addItem_0(this.m_0, new CheckboxAlignedMenuItem(LS('Properties...'), new MyCommand('scopepop', 'properties')));
|
|
}
|
|
|
|
defineClass(800, 1, {}, ScopePopupMenu);
|
|
var Lcom_lushprojects_circuitjs1_client_ScopePopupMenu_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ScopePopupMenu', 800);
|
|
function $addItemToGrid(this$static, g, scb){
|
|
$setWidget_2(g, this$static.ny, this$static.nx, scb);
|
|
if (++this$static.nx >= this$static.grid.numColumns) {
|
|
this$static.nx = 0;
|
|
++this$static.ny;
|
|
}
|
|
}
|
|
|
|
function $apply_2(this$static){
|
|
var d, label_0, n;
|
|
label_0 = $getText(this$static.labelTextBox);
|
|
label_0.length == 0 && (label_0 = null);
|
|
$setText_3(this$static.scope_0, label_0);
|
|
if (this$static.scope_0.manualScale) {
|
|
d = $getManualScaleValue(this$static);
|
|
d > 0 && $setManualScaleValue(this$static.scope_0, this$static.plotSelection, d);
|
|
n = $getDivisionsValue(this$static);
|
|
n > 0 && $setManDivisions(this$static.scope_0, n);
|
|
}
|
|
return true;
|
|
}
|
|
|
|
function $applyTriggerLevel(this$static){
|
|
var d;
|
|
try {
|
|
d = parseUnits($getText(this$static.triggerLevelTextBox));
|
|
this$static.scope_0.trigger.level = d;
|
|
$resetGraph(this$static.scope_0, false);
|
|
}
|
|
catch ($e0) {
|
|
$e0 = toJava($e0);
|
|
if (!instanceOf($e0, 13))
|
|
throw toJs($e0);
|
|
}
|
|
}
|
|
|
|
function $closeDialog_1(this$static){
|
|
$hide_0(this$static, false);
|
|
dialogShowing == this$static && (dialogShowing = null);
|
|
$apply_2(this$static);
|
|
}
|
|
|
|
function $getChannelButtonLabel(this$static, i){
|
|
var l_0, p;
|
|
p = $get_4(this$static.scope_0.visiblePlots, i);
|
|
l_0 = '<span style="color: ' + p.color_0 + ';">●<\/span> CH ' + ('' + (i + 1));
|
|
switch (p.units) {
|
|
case 0:
|
|
l_0 += ' (V)';
|
|
break;
|
|
case 1:
|
|
l_0 += ' (I)';
|
|
break;
|
|
case 3:
|
|
l_0 += ' (R)';
|
|
break;
|
|
case 2:
|
|
l_0 += ' (P)';
|
|
break;
|
|
case 4:
|
|
l_0 += ' (Q)';
|
|
}
|
|
return l_0;
|
|
}
|
|
|
|
function $getDivisionsValue(this$static){
|
|
var n;
|
|
try {
|
|
n = __parseAndValidateInt($getText(this$static.divisionsTextBox), 10);
|
|
return n;
|
|
}
|
|
catch ($e0) {
|
|
$e0 = toJava($e0);
|
|
if (instanceOf($e0, 13)) {
|
|
return 0;
|
|
}
|
|
else
|
|
throw toJs($e0);
|
|
}
|
|
}
|
|
|
|
function $getListBoxValue(lb){
|
|
var sel;
|
|
sel = ($clinit_DOM() , lb.element).selectedIndex;
|
|
if (sel < 0)
|
|
return -1;
|
|
try {
|
|
return __parseAndValidateInt(($checkIndex(lb, sel) , lb.element.options[sel].value), 10);
|
|
}
|
|
catch ($e0) {
|
|
$e0 = toJava($e0);
|
|
if (instanceOf($e0, 13)) {
|
|
return -1;
|
|
}
|
|
else
|
|
throw toJs($e0);
|
|
}
|
|
}
|
|
|
|
function $getManualScaleValue(this$static){
|
|
var d;
|
|
try {
|
|
d = parseUnits($getText(this$static.manualScaleTextBox));
|
|
d < $intern_80 && (d = $intern_80);
|
|
return d;
|
|
}
|
|
catch ($e0) {
|
|
$e0 = toJava($e0);
|
|
if (instanceOf($e0, 13)) {
|
|
return 0;
|
|
}
|
|
else
|
|
throw toJs($e0);
|
|
}
|
|
}
|
|
|
|
function $populatePlotListBox(this$static, lb, selectedIdx, includeNone){
|
|
var i, i0, name_0, p;
|
|
($clinit_DOM() , lb.element).options.length = 0;
|
|
includeNone && $insertItem(lb, LS('None'), '-1', -1);
|
|
for (i0 = 0; i0 < this$static.scope_0.plots.arrayList.array.length; i0++) {
|
|
p = $get_4(this$static.scope_0.plots, i0);
|
|
name_0 = p.elm?p.elm.getScopeText(p.value_0):'Plot ' + (i0 + 1);
|
|
$insertItem(lb, name_0 + ' (' + getScaleUnitsText(p.units) + ')', '' + i0, -1);
|
|
}
|
|
for (i = 0; i < lb.element.options.length; i++) {
|
|
if (__parseAndValidateInt(($checkIndex(lb, i) , lb.element.options[i].value), 10) == selectedIdx) {
|
|
$setSelectedIndex(lb.element, i);
|
|
return;
|
|
}
|
|
}
|
|
lb.element.selectedIndex = 0;
|
|
}
|
|
|
|
function $positionBarChanged(this$static){
|
|
var p;
|
|
if (!this$static.scope_0.manualScale || this$static.plotSelection > this$static.scope_0.visiblePlots.arrayList.array.length)
|
|
return;
|
|
p = this$static.positionBar.val_0;
|
|
$setPlotPosition(this$static.scope_0, this$static.plotSelection, p);
|
|
}
|
|
|
|
function $refreshDraw(this$static){
|
|
this$static.scope_0.manualScale || $updateManualScaleUi(this$static);
|
|
}
|
|
|
|
function $scrollbarChanged(this$static){
|
|
var newsp;
|
|
newsp = round_int($wnd.Math.pow(2, 10 - this$static.speedBar.val_0));
|
|
console_0('changed ' + this$static.scope_0.speed + ' ' + newsp + ' ' + this$static.speedBar.val_0);
|
|
this$static.scope_0.speed != newsp && $setSpeed(this$static.scope_0, newsp);
|
|
$setText_0(this$static.scopeSpeedLabel, getUnitText($calcGridStepX(this$static.scope_0), 's', false) + '/div');
|
|
}
|
|
|
|
function $setTrailLabel(this$static){
|
|
this$static.scope_0.plot2d.trailPersistence <= 0?$setText_0(this$static.trailLabel, LS('default')):$setText_0(this$static.trailLabel, getUnitText(this$static.scope_0.plot2d.trailPersistence * this$static.sim.sim.maxTimeStep, 's', false));
|
|
}
|
|
|
|
function $updateChannelButtons(this$static){
|
|
var b, b0, i, i0;
|
|
this$static.plotSelection >= this$static.scope_0.visiblePlots.arrayList.array.length && (this$static.plotSelection = 0);
|
|
for (i0 = this$static.chanButtons.arrayList.array.length - 1; i0 >= this$static.scope_0.visiblePlots.arrayList.array.length; i0--) {
|
|
$remove_0(this$static.channelButtonsp, $get_4(this$static.chanButtons, i0));
|
|
$remove_18(this$static.chanButtons, i0);
|
|
}
|
|
for (i = 0; i < this$static.scope_0.visiblePlots.arrayList.array.length; i++) {
|
|
if (i >= this$static.chanButtons.arrayList.array.length) {
|
|
b0 = new Button;
|
|
$add_11(this$static.chanButtons, b0);
|
|
$addDomHandler($get_4(this$static.chanButtons, i), new ScopePropertiesDialog$PlotClickHandler(this$static, i), ($clinit_ClickEvent() , $clinit_ClickEvent() , TYPE_1));
|
|
setStyleName(($clinit_DOM() , b0.element), 'chbut', true);
|
|
whiteColor == ($clinit_Color() , white)?setStyleName(b0.element, 'chbut-black', true):setStyleName(b0.element, 'chbut-white', true);
|
|
$add_2(this$static.channelButtonsp, b0);
|
|
}
|
|
b = $get_4(this$static.chanButtons, i);
|
|
$setHTML(b, $getChannelButtonLabel(this$static, i));
|
|
i == this$static.plotSelection?setStyleName(($clinit_DOM() , b.element), 'chsel', true):setStyleName(($clinit_DOM() , b.element), 'chsel', false);
|
|
}
|
|
}
|
|
|
|
function $updateManualScaleUi(this$static){
|
|
var p;
|
|
$updateChannelButtons(this$static);
|
|
$setVisible(this$static.channelSettingsp, this$static.scope_0.manualScale && $booleanValue(this$static.vScaleLabel.expanded));
|
|
$setVisible(this$static.vScaleGrid, $booleanValue(this$static.vScaleLabel.expanded));
|
|
if ($booleanValue(this$static.vScaleLabel.expanded)) {
|
|
$setVisible_1(this$static.vScaleGrid.rowFormatter, 0, this$static.scope_0.manualScale && this$static.plotSelection < this$static.scope_0.visiblePlots.arrayList.array.length);
|
|
$setVisible_1(this$static.vScaleGrid.rowFormatter, 1, this$static.scope_0.manualScale && this$static.plotSelection < this$static.scope_0.visiblePlots.arrayList.array.length);
|
|
$setVisible_1(this$static.vScaleGrid.rowFormatter, 2, !this$static.scope_0.manualScale || this$static.plotSelection < this$static.scope_0.visiblePlots.arrayList.array.length);
|
|
$setVisible_1(this$static.vScaleGrid.rowFormatter, 3, this$static.scope_0.manualScale);
|
|
}
|
|
$setVisible(this$static.scaleUpButton, this$static.scope_0.manualScale);
|
|
$setVisible(this$static.scaleDownButton, this$static.scope_0.manualScale);
|
|
if (this$static.scope_0.manualScale) {
|
|
if (this$static.plotSelection < this$static.scope_0.visiblePlots.arrayList.array.length) {
|
|
p = $get_4(this$static.scope_0.visiblePlots, this$static.plotSelection);
|
|
$setText_0(this$static.manualScaleId, 'CH ' + ('' + (this$static.plotSelection + 1)) + ' ' + LS('Scale'));
|
|
$setText_0(this$static.manualScaleLabel, getScaleUnitsText(p.units) + LS('/div'));
|
|
$setText_2(this$static.manualScaleTextBox, unitString(null, p.manScale));
|
|
$setEnabled(this$static.manualScaleTextBox, true);
|
|
$setText_2(this$static.divisionsTextBox, '' + this$static.scope_0.manDivisions);
|
|
$setEnabled(this$static.divisionsTextBox, true);
|
|
$setText_0(this$static.positionLabel, 'CH ' + ('' + (this$static.plotSelection + 1)) + ' ' + LS('Position'));
|
|
$setValue_2(this$static.positionBar, p.manVPosition);
|
|
$setEnabled_0(this$static.dcButton, true);
|
|
$enable(this$static.positionBar);
|
|
$setValue(this$static.dcButton, ($clinit_Boolean() , p.acCoupled?false:true));
|
|
$setEnabled_0(this$static.acButton, p.units == 0);
|
|
$setValue(this$static.acButton, p.acCoupled?true:false);
|
|
}
|
|
else {
|
|
$setText_0(this$static.manualScaleId, '');
|
|
$setText_0(this$static.manualScaleLabel, '');
|
|
$setText_2(this$static.manualScaleTextBox, '');
|
|
$setEnabled(this$static.manualScaleTextBox, false);
|
|
$setText_0(this$static.positionLabel, '');
|
|
$setEnabled_0(this$static.dcButton, false);
|
|
$setEnabled_0(this$static.acButton, false);
|
|
$disable(this$static.positionBar);
|
|
}
|
|
}
|
|
else {
|
|
$setText_0(this$static.manualScaleId, '');
|
|
$setText_0(this$static.manualScaleLabel, LS('Max Value') + ' (' + $getScaleUnitsText(this$static.scope_0) + ')');
|
|
$setText_2(this$static.manualScaleTextBox, unitString(null, $getScaleValue(this$static.scope_0)));
|
|
$setEnabled(this$static.manualScaleTextBox, false);
|
|
$setText_0(this$static.positionLabel, '');
|
|
}
|
|
$setText_0(this$static.scopeSpeedLabel, getUnitText($calcGridStepX(this$static.scope_0), 's', false) + '/div');
|
|
}
|
|
|
|
function $updateUi(this$static){
|
|
var elm, trigActive;
|
|
$setVisible(this$static.vModep, $booleanValue(this$static.vScaleLabel.expanded));
|
|
$updateRowVisibility(this$static.gridLabels);
|
|
$setVisible_1(this$static.hScaleGrid.rowFormatter, 1, $booleanValue(this$static.hScaleLabel.expanded));
|
|
$setValue_2(this$static.speedBar, 10 - toInt_0(fromDouble_0($wnd.Math.round($wnd.Math.log(this$static.scope_0.speed) / $wnd.Math.log(2)))));
|
|
if (this$static.voltageBox) {
|
|
$setValue(this$static.voltageBox, ($clinit_Boolean() , this$static.scope_0.showV && $hasPlotValue(this$static.scope_0, 0)?true:false));
|
|
$setValue(this$static.currentBox, this$static.scope_0.showI && $hasPlotValue(this$static.scope_0, 3)?true:false);
|
|
}
|
|
$setValue(this$static.powerBox, ($clinit_Boolean() , $hasPlotValue(this$static.scope_0, 7)?true:false));
|
|
$setValue(this$static.scaleBox, this$static.scope_0.showScale?true:false);
|
|
$setValue(this$static.peakBox, this$static.scope_0.showMax?true:false);
|
|
$setValue(this$static.negPeakBox, this$static.scope_0.showMin?true:false);
|
|
$setValue(this$static.p2pBox, this$static.scope_0.showP2P?true:false);
|
|
$setValue(this$static.freqBox, this$static.scope_0.showFreq?true:false);
|
|
$setValue(this$static.spectrumBox, this$static.scope_0.fftPlot.enabled?true:false);
|
|
$setValue(this$static.logSpectrumBox, this$static.scope_0.fftPlot.logSpectrum?true:false);
|
|
$setValue(this$static.rmsBox, this$static.scope_0.showRMS?true:false);
|
|
$setValue(this$static.averageBox, this$static.scope_0.showAverage?true:false);
|
|
$setValue(this$static.dutyBox, this$static.scope_0.showDutyCycle?true:false);
|
|
$setValue(this$static.phaseAngleBox, this$static.scope_0.fftPlot.showPhaseAngle?true:false);
|
|
$setValue(this$static.elmInfoBox, this$static.scope_0.showElmInfo?true:false);
|
|
$setEnabled_0(this$static.rmsBox, $canShowRMS(this$static.scope_0));
|
|
$setValue(this$static.viBox, this$static.scope_0.plot2d.enabled && !this$static.scope_0.plot2d.plotXY?true:false);
|
|
$setValue(this$static.xyBox, this$static.scope_0.plot2d.plotXY?true:false);
|
|
$setValue(this$static.resistanceBox, $hasPlotValue(this$static.scope_0, 2)?true:false);
|
|
$setEnabled_0(this$static.resistanceBox, (elm = $getSingleElm(this$static.scope_0) , !!elm && elm.canShowValueInScope(2)));
|
|
!!this$static.chargeBox && $setValue(this$static.chargeBox, $hasPlotValue(this$static.scope_0, 8)?true:false);
|
|
if (this$static.vbeBox) {
|
|
$setValue(this$static.ibBox, $hasPlotValue(this$static.scope_0, 1)?true:false);
|
|
$setValue(this$static.icBox, $hasPlotValue(this$static.scope_0, 2)?true:false);
|
|
$setValue(this$static.ieBox, $hasPlotValue(this$static.scope_0, 3)?true:false);
|
|
$setValue(this$static.vbeBox, $hasPlotValue(this$static.scope_0, 4)?true:false);
|
|
$setValue(this$static.vbcBox, $hasPlotValue(this$static.scope_0, 5)?true:false);
|
|
$setValue(this$static.vceBox, $hasPlotValue(this$static.scope_0, 6)?true:false);
|
|
$setValue(this$static.vceIcBox, $isShowingVceAndIc(this$static.scope_0)?true:false);
|
|
}
|
|
if (this$static.scope_0.manualScale) {
|
|
$setValue(this$static.manualButton, true);
|
|
$setValue(this$static.autoButton, false);
|
|
$setValue(this$static.maxButton, false);
|
|
$setVisible(this$static.applyButton, true);
|
|
}
|
|
else {
|
|
$setValue(this$static.manualButton, false);
|
|
$setValue(this$static.autoButton, this$static.scope_0.maxScale?false:true);
|
|
$setValue(this$static.maxButton, this$static.scope_0.maxScale?true:false);
|
|
$setVisible(this$static.applyButton, false);
|
|
}
|
|
$updateManualScaleUi(this$static);
|
|
$setValue(this$static.trigFreeRunButton, this$static.scope_0.trigger.mode == 0?true:false);
|
|
$setValue(this$static.trigNormalButton, this$static.scope_0.trigger.mode == 1?true:false);
|
|
$setValue(this$static.trigAutoButton, this$static.scope_0.trigger.mode == 2?true:false);
|
|
trigActive = this$static.scope_0.trigger.mode != 0;
|
|
$setValue(this$static.trigRisingButton, this$static.scope_0.trigger.edge == 0?true:false);
|
|
$setValue(this$static.trigFallingButton, this$static.scope_0.trigger.edge == 1?true:false);
|
|
$setEnabled_0(this$static.trigRisingButton, trigActive);
|
|
$setEnabled_0(this$static.trigFallingButton, trigActive);
|
|
$setText_2(this$static.triggerLevelTextBox, unitString(null, this$static.scope_0.trigger.level));
|
|
$setEnabled(this$static.triggerLevelTextBox, trigActive);
|
|
$setVisible(this$static.trigModep, $booleanValue(this$static.triggerLabel.expanded));
|
|
$setVisible(this$static.trigEdgep, $booleanValue(this$static.triggerLabel.expanded) && trigActive);
|
|
$setVisible_1(this$static.triggerGrid.rowFormatter, 1, $booleanValue(this$static.triggerLabel.expanded));
|
|
$setVisible_1(this$static.triggerGrid.rowFormatter, 2, $booleanValue(this$static.triggerLabel.expanded) && trigActive);
|
|
$setVisible_1(this$static.triggerGrid.rowFormatter, 3, $booleanValue(this$static.triggerLabel.expanded) && trigActive);
|
|
$updateXYSettingsUi(this$static);
|
|
}
|
|
|
|
function $updateXYSettingsUi(this$static){
|
|
var xyActive;
|
|
xyActive = this$static.scope_0.plot2d.plotXY;
|
|
this$static.xySettingsRow >= 0 && !!this$static.xyPlotsLabel && $setVisible_1(this$static.grid.rowFormatter, this$static.xySettingsRow, xyActive && $booleanValue(this$static.xyPlotsLabel.expanded));
|
|
if (!xyActive)
|
|
return;
|
|
$populatePlotListBox(this$static, this$static.xyPlotXBox, this$static.scope_0.plot2d.plotX, false);
|
|
$populatePlotListBox(this$static, this$static.xyPlotYBox, this$static.scope_0.plot2d.plotY, false);
|
|
$populatePlotListBox(this$static, this$static.xyBrightnessBox, this$static.scope_0.plot2d.plotBrightness, true);
|
|
$populatePlotListBox(this$static, this$static.xyRedBox, this$static.scope_0.plot2d.plotColorR, true);
|
|
$populatePlotListBox(this$static, this$static.xyGreenBox, this$static.scope_0.plot2d.plotColorG, true);
|
|
$populatePlotListBox(this$static, this$static.xyBlueBox, this$static.scope_0.plot2d.plotColorB, true);
|
|
}
|
|
|
|
function ScopePropertiesDialog(asim, s){
|
|
var allowedHeight, applyButton2, applyButtonDiv, capacitor, displayAll, displayScales, elm, labelText, okButton, resetPosButton, saveAsDefaultButton, scaleBoxGrid, trailGrid, transistor, trigApplyButton, trigLevelp, vSLG;
|
|
Dialog.call(this);
|
|
this.chanButtons = new Vector;
|
|
this.plotSelection = 0;
|
|
this.xySettingsRow = -1;
|
|
allowedHeight = $getClientHeight($doc) * 4 / 5 | 0;
|
|
displayAll = allowedHeight > 600;
|
|
displayScales = allowedHeight > 470;
|
|
this.sim = asim;
|
|
this.scope_0 = s;
|
|
this.fp = new FlowPanel;
|
|
$setWidget_1(this, this.fp);
|
|
$setText(this, LS('Scope Properties'));
|
|
vSLG = new Grid(1, 1);
|
|
this.vScaleLabel = new ScopePropertiesDialog$expandingLabel(this, LS('Vertical Scale'), ($clinit_Boolean() , displayScales?true:false));
|
|
$setWidget_2(vSLG, 0, 0, this.vScaleLabel.p);
|
|
$add_2(this.fp, vSLG);
|
|
this.vModep = new HorizontalPanel;
|
|
this.autoButton = new RadioButton('vMode', LS('Auto'));
|
|
$addValueChangeHandler_0(this.autoButton, new ScopePropertiesDialog$1(this));
|
|
this.maxButton = new RadioButton('vMode', LS('Auto (Max Scale)'));
|
|
$addValueChangeHandler_0(this.maxButton, new ScopePropertiesDialog$2(this));
|
|
this.manualButton = new RadioButton('vMode', LS('Manual'));
|
|
$addValueChangeHandler_0(this.manualButton, new ScopePropertiesDialog$3(this));
|
|
$add_3(this.vModep, this.autoButton);
|
|
$add_3(this.vModep, this.maxButton);
|
|
$add_3(this.vModep, this.manualButton);
|
|
$add_2(this.fp, this.vModep);
|
|
this.channelSettingsp = new VerticalPanel;
|
|
this.channelButtonsp = new FlowPanel;
|
|
$updateChannelButtons(this);
|
|
$add_5(this.channelSettingsp, this.channelButtonsp);
|
|
$add_2(this.fp, this.channelSettingsp);
|
|
this.vScaleGrid = new Grid(4, 5);
|
|
this.dcButton = new RadioButton('acdc', LS('DC Coupled'));
|
|
$addValueChangeHandler_0(this.dcButton, new ScopePropertiesDialog$4(this));
|
|
$setWidget_2(this.vScaleGrid, 0, 0, this.dcButton);
|
|
this.acButton = new RadioButton('acdc', LS('AC Coupled'));
|
|
$addValueChangeHandler_0(this.acButton, new ScopePropertiesDialog$5(this));
|
|
$setWidget_2(this.vScaleGrid, 0, 1, this.acButton);
|
|
this.positionLabel = new Label_1(LS('Position'));
|
|
$setWidget_2(this.vScaleGrid, 1, 0, this.positionLabel);
|
|
$setVerticalAlignment(this.vScaleGrid.cellFormatter, 0, 0, ($clinit_HasVerticalAlignment() , ALIGN_MIDDLE));
|
|
this.positionBar = new Scrollbar_0(0, -200, 200, new ScopePropertiesDialog$6(this));
|
|
$setWidget_2(this.vScaleGrid, 1, 1, this.positionBar);
|
|
resetPosButton = new Button_1(LS('Reset Position'));
|
|
$addDomHandler(resetPosButton, new ScopePropertiesDialog$7(this), ($clinit_ClickEvent() , $clinit_ClickEvent() , TYPE_1));
|
|
$setWidget_2(this.vScaleGrid, 1, 4, resetPosButton);
|
|
this.manualScaleId = new Label;
|
|
$setWidget_2(this.vScaleGrid, 2, 0, this.manualScaleId);
|
|
scaleBoxGrid = new Grid(1, 3);
|
|
this.scaleDownButton = new Button_1('▼');
|
|
$addDomHandler(this.scaleDownButton, new ScopePropertiesDialog$downClickHandler(this), (null , TYPE_1));
|
|
$setWidget_2(scaleBoxGrid, 0, 0, this.scaleDownButton);
|
|
this.manualScaleTextBox = new TextBox;
|
|
$addValueChangeHandler_1(this.manualScaleTextBox, new ScopePropertiesDialog$manualScaleTextHandler(this));
|
|
$addStyleName(this.manualScaleTextBox, 'scalebox');
|
|
$setWidget_2(scaleBoxGrid, 0, 1, this.manualScaleTextBox);
|
|
this.scaleUpButton = new Button_1('▲');
|
|
$addDomHandler(this.scaleUpButton, new ScopePropertiesDialog$upClickHandler(this), (null , TYPE_1));
|
|
$setWidget_2(scaleBoxGrid, 0, 2, this.scaleUpButton);
|
|
$setWidget_2(this.vScaleGrid, 2, 1, scaleBoxGrid);
|
|
this.manualScaleLabel = new Label_1('');
|
|
$setWidget_2(this.vScaleGrid, 2, 2, this.manualScaleLabel);
|
|
$setWidget_2(this.vScaleGrid, 2, 4, this.applyButton = new Button_1(LS('Apply')));
|
|
this.divisionsLabel = new Label_1(LS('# of Divisions'));
|
|
this.divisionsTextBox = new TextBox;
|
|
$addValueChangeHandler_1(this.divisionsTextBox, new ScopePropertiesDialog$manualScaleTextHandler(this));
|
|
$setWidget_2(this.vScaleGrid, 3, 0, this.divisionsLabel);
|
|
$setWidget_2(this.vScaleGrid, 3, 1, this.divisionsTextBox);
|
|
$addDomHandler(this.applyButton, new ScopePropertiesDialog$8(this), (null , TYPE_1));
|
|
$setWidget_2(this.vScaleGrid, 3, 4, applyButtonDiv = new Button_1(LS('Apply')));
|
|
$addDomHandler(applyButtonDiv, new ScopePropertiesDialog$9(this), (null , TYPE_1));
|
|
$setVerticalAlignment(this.vScaleGrid.cellFormatter, 1, 1, ALIGN_MIDDLE);
|
|
$add_2(this.fp, this.vScaleGrid);
|
|
this.hScaleGrid = new Grid(2, 4);
|
|
this.hScaleLabel = new ScopePropertiesDialog$expandingLabel(this, LS('Horizontal Scale'), displayScales?true:false);
|
|
$setWidget_2(this.hScaleGrid, 0, 0, this.hScaleLabel.p);
|
|
this.speedBar = new Scrollbar_0(2, 0, 11, new ScopePropertiesDialog$10(this));
|
|
$setWidget_2(this.hScaleGrid, 1, 0, this.speedBar);
|
|
this.scopeSpeedLabel = new Label_1('');
|
|
$setHorizontalAlignment(this.scopeSpeedLabel, ($clinit_HasHorizontalAlignment() , ALIGN_RIGHT));
|
|
$setWidget_2(this.hScaleGrid, 1, 1, this.scopeSpeedLabel);
|
|
$setVerticalAlignment(this.hScaleGrid.cellFormatter, 1, 1, ALIGN_MIDDLE);
|
|
$add_2(this.fp, this.hScaleGrid);
|
|
this.triggerGrid = new Grid(4, 4);
|
|
this.triggerLabel = new ScopePropertiesDialog$expandingLabel(this, LS('Trigger'), false);
|
|
$setWidget_2(this.triggerGrid, 0, 0, this.triggerLabel.p);
|
|
this.trigModep = new HorizontalPanel;
|
|
this.trigFreeRunButton = new RadioButton('trigMode', LS('Free Run'));
|
|
$addValueChangeHandler_0(this.trigFreeRunButton, new ScopePropertiesDialog$11(this));
|
|
this.trigNormalButton = new RadioButton('trigMode', LS('Normal'));
|
|
$addValueChangeHandler_0(this.trigNormalButton, new ScopePropertiesDialog$12(this));
|
|
this.trigAutoButton = new RadioButton('trigMode', LS('Auto'));
|
|
$addValueChangeHandler_0(this.trigAutoButton, new ScopePropertiesDialog$13(this));
|
|
$add_3(this.trigModep, this.trigFreeRunButton);
|
|
$add_3(this.trigModep, this.trigNormalButton);
|
|
$add_3(this.trigModep, this.trigAutoButton);
|
|
$setWidget_2(this.triggerGrid, 1, 0, this.trigModep);
|
|
this.trigEdgep = new HorizontalPanel;
|
|
this.trigRisingButton = new RadioButton('trigEdge', LS('Rising'));
|
|
$addValueChangeHandler_0(this.trigRisingButton, new ScopePropertiesDialog$14(this));
|
|
this.trigFallingButton = new RadioButton('trigEdge', LS('Falling'));
|
|
$addValueChangeHandler_0(this.trigFallingButton, new ScopePropertiesDialog$15(this));
|
|
$add_3(this.trigEdgep, new Label_1(LS('Edge') + ': '));
|
|
$add_3(this.trigEdgep, this.trigRisingButton);
|
|
$add_3(this.trigEdgep, this.trigFallingButton);
|
|
$setWidget_2(this.triggerGrid, 2, 0, this.trigEdgep);
|
|
trigLevelp = new HorizontalPanel;
|
|
$add_3(trigLevelp, new Label_1(LS('Level') + ': '));
|
|
this.triggerLevelTextBox = new TextBox;
|
|
$addStyleName(this.triggerLevelTextBox, 'scalebox');
|
|
$add_3(trigLevelp, this.triggerLevelTextBox);
|
|
trigApplyButton = new Button_1(LS('Apply'));
|
|
$addDomHandler(trigApplyButton, new ScopePropertiesDialog$16(this), (null , TYPE_1));
|
|
$add_3(trigLevelp, trigApplyButton);
|
|
$setWidget_2(this.triggerGrid, 3, 0, trigLevelp);
|
|
$add_2(this.fp, this.triggerGrid);
|
|
this.xySettingsGrid = new Grid(3, 4);
|
|
this.xyPlotXBox = new ListBox;
|
|
$addDomHandler(this.xyPlotXBox, new ScopePropertiesDialog$17(this), ($clinit_ChangeEvent() , $clinit_ChangeEvent() , TYPE_0));
|
|
this.xyPlotYBox = new ListBox;
|
|
$addDomHandler(this.xyPlotYBox, new ScopePropertiesDialog$18(this), (null , TYPE_0));
|
|
this.xyBrightnessBox = new ListBox;
|
|
$addDomHandler(this.xyBrightnessBox, new ScopePropertiesDialog$19(this), (null , TYPE_0));
|
|
this.xyRedBox = new ListBox;
|
|
$addDomHandler(this.xyRedBox, new ScopePropertiesDialog$20(this), (null , TYPE_0));
|
|
this.xyGreenBox = new ListBox;
|
|
$addDomHandler(this.xyGreenBox, new ScopePropertiesDialog$21(this), (null , TYPE_0));
|
|
this.xyBlueBox = new ListBox;
|
|
$addDomHandler(this.xyBlueBox, new ScopePropertiesDialog$22(this), (null , TYPE_0));
|
|
$setWidget_2(this.xySettingsGrid, 0, 0, new Label_1(LS('X Axis:')));
|
|
$setWidget_2(this.xySettingsGrid, 0, 1, this.xyPlotXBox);
|
|
$setWidget_2(this.xySettingsGrid, 0, 2, new Label_1(LS('Y Axis:')));
|
|
$setWidget_2(this.xySettingsGrid, 0, 3, this.xyPlotYBox);
|
|
$setWidget_2(this.xySettingsGrid, 1, 0, new Label_1(LS('Brightness:')));
|
|
$setWidget_2(this.xySettingsGrid, 1, 1, this.xyBrightnessBox);
|
|
$setWidget_2(this.xySettingsGrid, 1, 2, new Label_1(LS('Red:')));
|
|
$setWidget_2(this.xySettingsGrid, 1, 3, this.xyRedBox);
|
|
$setWidget_2(this.xySettingsGrid, 2, 0, new Label_1(LS('Green:')));
|
|
$setWidget_2(this.xySettingsGrid, 2, 1, this.xyGreenBox);
|
|
$setWidget_2(this.xySettingsGrid, 2, 2, new Label_1(LS('Blue:')));
|
|
$setWidget_2(this.xySettingsGrid, 2, 3, this.xyBlueBox);
|
|
elm = $getSingleElm(this.scope_0);
|
|
transistor = !!elm && instanceOf(elm, 153);
|
|
capacitor = !!elm && instanceOf(elm, 143);
|
|
if (transistor) {
|
|
this.grid = new Grid(15, 3);
|
|
this.gridLabels = new ScopePropertiesDialog$labelledGridManager(this, this.grid);
|
|
$addLabel(this.gridLabels, LS('Plots'), displayAll);
|
|
$addItemToGrid(this, this.grid, this.ibBox = new ScopeCheckBox(LS('Show Ib'), 'showib'));
|
|
$addValueChangeHandler_0(this.ibBox, this);
|
|
$addItemToGrid(this, this.grid, this.icBox = new ScopeCheckBox(LS('Show Ic'), 'showic'));
|
|
$addValueChangeHandler_0(this.icBox, this);
|
|
$addItemToGrid(this, this.grid, this.ieBox = new ScopeCheckBox(LS('Show Ie'), 'showie'));
|
|
$addValueChangeHandler_0(this.ieBox, this);
|
|
$addItemToGrid(this, this.grid, this.vbeBox = new ScopeCheckBox(LS('Show Vbe'), 'showvbe'));
|
|
$addValueChangeHandler_0(this.vbeBox, this);
|
|
$addItemToGrid(this, this.grid, this.vbcBox = new ScopeCheckBox(LS('Show Vbc'), 'showvbc'));
|
|
$addValueChangeHandler_0(this.vbcBox, this);
|
|
$addItemToGrid(this, this.grid, this.vceBox = new ScopeCheckBox(LS('Show Vce'), 'showvce'));
|
|
$addValueChangeHandler_0(this.vceBox, this);
|
|
}
|
|
else {
|
|
this.grid = new Grid(capacitor?14:13, 3);
|
|
this.gridLabels = new ScopePropertiesDialog$labelledGridManager(this, this.grid);
|
|
$addLabel(this.gridLabels, LS('Plots'), displayAll);
|
|
$addItemToGrid(this, this.grid, this.voltageBox = new ScopeCheckBox(LS('Show Voltage'), 'showvoltage'));
|
|
$addValueChangeHandler_0(this.voltageBox, this);
|
|
$addItemToGrid(this, this.grid, this.currentBox = new ScopeCheckBox(LS('Show Current'), 'showcurrent'));
|
|
$addValueChangeHandler_0(this.currentBox, this);
|
|
}
|
|
$addItemToGrid(this, this.grid, this.powerBox = new ScopeCheckBox(LS('Show Power Consumed'), 'showpower'));
|
|
$addValueChangeHandler_0(this.powerBox, this);
|
|
if (capacitor) {
|
|
$addItemToGrid(this, this.grid, this.chargeBox = new ScopeCheckBox(LS('Show Charge'), 'showcharge'));
|
|
$addValueChangeHandler_0(this.chargeBox, this);
|
|
}
|
|
$addItemToGrid(this, this.grid, this.resistanceBox = new ScopeCheckBox(LS('Show Resistance'), 'showresistance'));
|
|
$addValueChangeHandler_0(this.resistanceBox, this);
|
|
$addItemToGrid(this, this.grid, this.spectrumBox = new ScopeCheckBox(LS('Show Spectrum'), 'showfft'));
|
|
$addValueChangeHandler_0(this.spectrumBox, this);
|
|
$addItemToGrid(this, this.grid, this.logSpectrumBox = new ScopeCheckBox(LS('Log Spectrum'), 'logspectrum'));
|
|
$addValueChangeHandler_0(this.logSpectrumBox, this);
|
|
$addLabel(this.gridLabels, LS('X-Y Plots'), displayAll);
|
|
this.xyPlotsLabel = $lastElement(this.gridLabels.labels);
|
|
$addItemToGrid(this, this.grid, this.viBox = new ScopeCheckBox(LS('Show V vs I'), 'showvvsi'));
|
|
$addValueChangeHandler_0(this.viBox, this);
|
|
$addItemToGrid(this, this.grid, this.xyBox = new ScopeCheckBox(LS('Plot X/Y'), 'plotxy'));
|
|
$addValueChangeHandler_0(this.xyBox, this);
|
|
trailGrid = new Grid(1, 3);
|
|
$setWidget_2(trailGrid, 0, 0, new Label_1(LS('Trail Persistence (time steps)')));
|
|
this.trailBar = new Scrollbar_0(trailStepsToSlider(this.scope_0.plot2d.trailPersistence), 0, 61, new ScopePropertiesDialog$23(this));
|
|
$setWidget_2(trailGrid, 0, 1, this.trailBar);
|
|
this.trailLabel = new Label_1('');
|
|
$setWidget_2(trailGrid, 0, 2, this.trailLabel);
|
|
$add_2(this.fp, trailGrid);
|
|
this.scope_0.plot2d.trailPersistence <= 0?$setText_0(this.trailLabel, LS('default')):$setText_0(this.trailLabel, getUnitText(this.scope_0.plot2d.trailPersistence * this.sim.sim.maxTimeStep, 's', false));
|
|
if (transistor) {
|
|
$addItemToGrid(this, this.grid, this.vceIcBox = new ScopeCheckBox(LS('Show Vce vs Ic'), 'showvcevsic'));
|
|
$addValueChangeHandler_0(this.vceIcBox, this);
|
|
}
|
|
if (this.nx != 0) {
|
|
this.nx = 0;
|
|
++this.ny;
|
|
}
|
|
$setWidget_2(this.grid, this.ny, 0, this.xySettingsGrid);
|
|
this.xySettingsRow = this.ny;
|
|
++this.ny;
|
|
$addLabel(this.gridLabels, LS('Show Info'), displayAll);
|
|
$addItemToGrid(this, this.grid, this.scaleBox = new ScopeCheckBox(LS('Show Scale'), 'showscale'));
|
|
$addValueChangeHandler_0(this.scaleBox, this);
|
|
$addItemToGrid(this, this.grid, this.peakBox = new ScopeCheckBox(LS('Show Peak Value'), 'showpeak'));
|
|
$addValueChangeHandler_0(this.peakBox, this);
|
|
$addItemToGrid(this, this.grid, this.negPeakBox = new ScopeCheckBox(LS('Show Negative Peak Value'), 'shownegpeak'));
|
|
$addValueChangeHandler_0(this.negPeakBox, this);
|
|
$addItemToGrid(this, this.grid, this.p2pBox = new ScopeCheckBox(LS('Show Peak-to-Peak'), 'showp2p'));
|
|
$addValueChangeHandler_0(this.p2pBox, this);
|
|
$addItemToGrid(this, this.grid, this.freqBox = new ScopeCheckBox(LS('Show Frequency'), 'showfreq'));
|
|
$addValueChangeHandler_0(this.freqBox, this);
|
|
$addItemToGrid(this, this.grid, this.averageBox = new ScopeCheckBox(LS('Show Average'), 'showaverage'));
|
|
$addValueChangeHandler_0(this.averageBox, this);
|
|
$addItemToGrid(this, this.grid, this.rmsBox = new ScopeCheckBox(LS('Show RMS Average'), 'showrms'));
|
|
$addValueChangeHandler_0(this.rmsBox, this);
|
|
$addItemToGrid(this, this.grid, this.dutyBox = new ScopeCheckBox(LS('Show Duty Cycle'), 'showduty'));
|
|
$addValueChangeHandler_0(this.dutyBox, this);
|
|
$addItemToGrid(this, this.grid, this.phaseAngleBox = new ScopeCheckBox(LS('Show Phase Angle'), 'showphaseangle'));
|
|
$addValueChangeHandler_0(this.phaseAngleBox, this);
|
|
$addItemToGrid(this, this.grid, this.elmInfoBox = new ScopeCheckBox(LS('Show Extended Info'), 'showelminfo'));
|
|
$addValueChangeHandler_0(this.elmInfoBox, this);
|
|
$add_2(this.fp, this.grid);
|
|
$addLabel(this.gridLabels, LS('Custom Label'), displayAll);
|
|
this.labelTextBox = new TextBox;
|
|
$addItemToGrid(this, this.grid, this.labelTextBox);
|
|
labelText = this.scope_0.text_0;
|
|
labelText != null && $setText_2(this.labelTextBox, labelText);
|
|
$addItemToGrid(this, this.grid, applyButton2 = new Button_1(LS('Apply')));
|
|
$addDomHandler(applyButton2, new ScopePropertiesDialog$24(this), (null , TYPE_1));
|
|
$updateUi(this);
|
|
this.hp = new HorizontalPanel;
|
|
$setWidth(this.hp, '100%');
|
|
$setHorizontalAlignment_0(this.hp, ALIGN_LEFT);
|
|
$setStyleName(this.hp, 'topSpace');
|
|
$add_2(this.fp, this.hp);
|
|
$add_3(this.hp, okButton = new Button_1(LS('OK')));
|
|
$addDomHandler(okButton, new ScopePropertiesDialog$25(this), (null , TYPE_1));
|
|
$setHorizontalAlignment_0(this.hp, ALIGN_RIGHT);
|
|
$add_3(this.hp, saveAsDefaultButton = new Button_1(LS('Save as Default')));
|
|
$addDomHandler(saveAsDefaultButton, new ScopePropertiesDialog$26(this), (null , TYPE_1));
|
|
$center(this);
|
|
!this.resizeHandlerRegistration && (this.resizeHandlerRegistration = addResizeHandler(new DialogBox$1(this)));
|
|
$show(this);
|
|
}
|
|
|
|
function nextHighestScale(d){
|
|
var a, s;
|
|
d = d * 1.001;
|
|
s = $intern_80;
|
|
for (a = 0; s < d; a++) {
|
|
s *= ($clinit_Scope() , multa)[a % 3];
|
|
}
|
|
return s;
|
|
}
|
|
|
|
function trailSliderToSteps(v){
|
|
if (v <= 0)
|
|
return 0;
|
|
return toInt_0(fromDouble_0($wnd.Math.round($wnd.Math.pow(10, v / 10))));
|
|
}
|
|
|
|
function trailStepsToSlider(steps){
|
|
if (steps <= 0)
|
|
return 0;
|
|
return toInt_0(fromDouble_0($wnd.Math.round($wnd.Math.log(steps) * $wnd.Math.LOG10E * 10)));
|
|
}
|
|
|
|
defineClass(346, 140, {28:1, 64:1, 139:1, 11:1, 25:1, 60:1, 27:1, 67:1, 59:1, 50:1, 23:1, 44:1, 29:1, 48:1, 22:1, 24:1, 36:1, 107:1}, ScopePropertiesDialog);
|
|
_.apply_0 = function apply_9(){
|
|
return $apply_2(this);
|
|
}
|
|
;
|
|
_.closeDialog = function closeDialog_5(){
|
|
$closeDialog_1(this);
|
|
}
|
|
;
|
|
_.onValueChange = function onValueChange_2(event_0){
|
|
var cb;
|
|
cb = event_0.source;
|
|
$handleMenu(this.scope_0, cb.menuCmd, $booleanValue(cb.attached?($clinit_Boolean() , cb.inputElem.checked?true:false):($clinit_Boolean() , cb.inputElem.defaultChecked?true:false)));
|
|
$updateUi(this);
|
|
}
|
|
;
|
|
_.nx = 0;
|
|
_.ny = 0;
|
|
_.plotSelection = 0;
|
|
_.xySettingsRow = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_ScopePropertiesDialog_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ScopePropertiesDialog', 346);
|
|
function ScopePropertiesDialog$1(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(767, 1, $intern_68, ScopePropertiesDialog$1);
|
|
_.onValueChange = function onValueChange_3(e){
|
|
$setManualScale(this.this$01.scope_0, false, false);
|
|
$setMaxScale(this.this$01.scope_0, false);
|
|
$updateUi(this.this$01);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_ScopePropertiesDialog$1_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ScopePropertiesDialog/1', 767);
|
|
function ScopePropertiesDialog$10(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(776, 1, {}, ScopePropertiesDialog$10);
|
|
_.execute_1 = function execute_41(){
|
|
$scrollbarChanged(this.this$01);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_ScopePropertiesDialog$10_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ScopePropertiesDialog/10', 776);
|
|
function ScopePropertiesDialog$11(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(777, 1, $intern_68, ScopePropertiesDialog$11);
|
|
_.onValueChange = function onValueChange_4(e){
|
|
if ($booleanValue(e.value_0)) {
|
|
$setTriggerMode(this.this$01.scope_0, 0);
|
|
$updateUi(this.this$01);
|
|
}
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_ScopePropertiesDialog$11_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ScopePropertiesDialog/11', 777);
|
|
function ScopePropertiesDialog$12(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(778, 1, $intern_68, ScopePropertiesDialog$12);
|
|
_.onValueChange = function onValueChange_5(e){
|
|
if ($booleanValue(e.value_0)) {
|
|
$setTriggerMode(this.this$01.scope_0, 1);
|
|
$updateUi(this.this$01);
|
|
}
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_ScopePropertiesDialog$12_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ScopePropertiesDialog/12', 778);
|
|
function ScopePropertiesDialog$13(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(779, 1, $intern_68, ScopePropertiesDialog$13);
|
|
_.onValueChange = function onValueChange_6(e){
|
|
if ($booleanValue(e.value_0)) {
|
|
$setTriggerMode(this.this$01.scope_0, 2);
|
|
$updateUi(this.this$01);
|
|
}
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_ScopePropertiesDialog$13_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ScopePropertiesDialog/13', 779);
|
|
function ScopePropertiesDialog$14(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(780, 1, $intern_68, ScopePropertiesDialog$14);
|
|
_.onValueChange = function onValueChange_7(e){
|
|
if ($booleanValue(e.value_0)) {
|
|
this.this$01.scope_0.trigger.edge = 0;
|
|
$resetGraph(this.this$01.scope_0, false);
|
|
}
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_ScopePropertiesDialog$14_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ScopePropertiesDialog/14', 780);
|
|
function ScopePropertiesDialog$15(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(781, 1, $intern_68, ScopePropertiesDialog$15);
|
|
_.onValueChange = function onValueChange_8(e){
|
|
if ($booleanValue(e.value_0)) {
|
|
this.this$01.scope_0.trigger.edge = 1;
|
|
$resetGraph(this.this$01.scope_0, false);
|
|
}
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_ScopePropertiesDialog$15_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ScopePropertiesDialog/15', 781);
|
|
function ScopePropertiesDialog$16(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(782, 1, $intern_56, ScopePropertiesDialog$16);
|
|
_.onClick = function onClick_30(event_0){
|
|
$applyTriggerLevel(this.this$01);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_ScopePropertiesDialog$16_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ScopePropertiesDialog/16', 782);
|
|
function ScopePropertiesDialog$17(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(783, 1, $intern_71, ScopePropertiesDialog$17);
|
|
_.onChange = function onChange_5(e){
|
|
var idx;
|
|
idx = $getListBoxValue(this.this$01.xyPlotXBox);
|
|
idx >= 0 && (this.this$01.scope_0.plot2d.plotX = idx);
|
|
$resetGraph(this.this$01.scope_0, false);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_ScopePropertiesDialog$17_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ScopePropertiesDialog/17', 783);
|
|
function ScopePropertiesDialog$18(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(784, 1, $intern_71, ScopePropertiesDialog$18);
|
|
_.onChange = function onChange_6(e){
|
|
var idx;
|
|
idx = $getListBoxValue(this.this$01.xyPlotYBox);
|
|
idx >= 0 && (this.this$01.scope_0.plot2d.plotY = idx);
|
|
$resetGraph(this.this$01.scope_0, false);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_ScopePropertiesDialog$18_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ScopePropertiesDialog/18', 784);
|
|
function ScopePropertiesDialog$19(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(785, 1, $intern_71, ScopePropertiesDialog$19);
|
|
_.onChange = function onChange_7(e){
|
|
this.this$01.scope_0.plot2d.plotBrightness = $getListBoxValue(this.this$01.xyBrightnessBox);
|
|
$resetGraph(this.this$01.scope_0, false);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_ScopePropertiesDialog$19_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ScopePropertiesDialog/19', 785);
|
|
function ScopePropertiesDialog$2(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(768, 1, $intern_68, ScopePropertiesDialog$2);
|
|
_.onValueChange = function onValueChange_9(e){
|
|
$setManualScale(this.this$01.scope_0, false, false);
|
|
$setMaxScale(this.this$01.scope_0, true);
|
|
$updateUi(this.this$01);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_ScopePropertiesDialog$2_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ScopePropertiesDialog/2', 768);
|
|
function ScopePropertiesDialog$20(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(786, 1, $intern_71, ScopePropertiesDialog$20);
|
|
_.onChange = function onChange_8(e){
|
|
this.this$01.scope_0.plot2d.plotColorR = $getListBoxValue(this.this$01.xyRedBox);
|
|
$resetGraph(this.this$01.scope_0, false);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_ScopePropertiesDialog$20_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ScopePropertiesDialog/20', 786);
|
|
function ScopePropertiesDialog$21(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(787, 1, $intern_71, ScopePropertiesDialog$21);
|
|
_.onChange = function onChange_9(e){
|
|
this.this$01.scope_0.plot2d.plotColorG = $getListBoxValue(this.this$01.xyGreenBox);
|
|
$resetGraph(this.this$01.scope_0, false);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_ScopePropertiesDialog$21_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ScopePropertiesDialog/21', 787);
|
|
function ScopePropertiesDialog$22(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(788, 1, $intern_71, ScopePropertiesDialog$22);
|
|
_.onChange = function onChange_10(e){
|
|
this.this$01.scope_0.plot2d.plotColorB = $getListBoxValue(this.this$01.xyBlueBox);
|
|
$resetGraph(this.this$01.scope_0, false);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_ScopePropertiesDialog$22_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ScopePropertiesDialog/22', 788);
|
|
function ScopePropertiesDialog$23(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(789, 1, {}, ScopePropertiesDialog$23);
|
|
_.execute_1 = function execute_42(){
|
|
this.this$01.scope_0.plot2d.trailPersistence = trailSliderToSteps(this.this$01.trailBar.val_0);
|
|
$setTrailLabel(this.this$01);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_ScopePropertiesDialog$23_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ScopePropertiesDialog/23', 789);
|
|
function ScopePropertiesDialog$24(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(790, 1, $intern_56, ScopePropertiesDialog$24);
|
|
_.onClick = function onClick_31(event_0){
|
|
$apply_2(this.this$01);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_ScopePropertiesDialog$24_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ScopePropertiesDialog/24', 790);
|
|
function ScopePropertiesDialog$25(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(791, 1, $intern_56, ScopePropertiesDialog$25);
|
|
_.onClick = function onClick_32(event_0){
|
|
$closeDialog_1(this.this$01);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_ScopePropertiesDialog$25_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ScopePropertiesDialog/25', 791);
|
|
function ScopePropertiesDialog$26(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(792, 1, $intern_56, ScopePropertiesDialog$26);
|
|
_.onClick = function onClick_33(event_0){
|
|
$saveAsDefault(this.this$01.scope_0.serializer);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_ScopePropertiesDialog$26_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ScopePropertiesDialog/26', 792);
|
|
function ScopePropertiesDialog$3(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(769, 1, $intern_68, ScopePropertiesDialog$3);
|
|
_.onValueChange = function onValueChange_10(e){
|
|
$setManualScale(this.this$01.scope_0, true, true);
|
|
$updateUi(this.this$01);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_ScopePropertiesDialog$3_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ScopePropertiesDialog/3', 769);
|
|
function ScopePropertiesDialog$4(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(770, 1, $intern_68, ScopePropertiesDialog$4);
|
|
_.onValueChange = function onValueChange_11(e){
|
|
this.this$01.plotSelection < this.this$01.scope_0.visiblePlots.arrayList.array.length && $setAcCoupled($get_4(this.this$01.scope_0.visiblePlots, this.this$01.plotSelection), false);
|
|
$updateUi(this.this$01);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_ScopePropertiesDialog$4_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ScopePropertiesDialog/4', 770);
|
|
function ScopePropertiesDialog$5(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(771, 1, $intern_68, ScopePropertiesDialog$5);
|
|
_.onValueChange = function onValueChange_12(e){
|
|
this.this$01.plotSelection < this.this$01.scope_0.visiblePlots.arrayList.array.length && $setAcCoupled($get_4(this.this$01.scope_0.visiblePlots, this.this$01.plotSelection), true);
|
|
$updateUi(this.this$01);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_ScopePropertiesDialog$5_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ScopePropertiesDialog/5', 771);
|
|
function ScopePropertiesDialog$6(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(772, 1, {}, ScopePropertiesDialog$6);
|
|
_.execute_1 = function execute_43(){
|
|
$positionBarChanged(this.this$01);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_ScopePropertiesDialog$6_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ScopePropertiesDialog/6', 772);
|
|
function ScopePropertiesDialog$7(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(773, 1, $intern_56, ScopePropertiesDialog$7);
|
|
_.onClick = function onClick_34(event_0){
|
|
$setValue_2(this.this$01.positionBar, 0);
|
|
$positionBarChanged(this.this$01);
|
|
$updateUi(this.this$01);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_ScopePropertiesDialog$7_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ScopePropertiesDialog/7', 773);
|
|
function ScopePropertiesDialog$8(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(774, 1, $intern_56, ScopePropertiesDialog$8);
|
|
_.onClick = function onClick_35(event_0){
|
|
$apply_2(this.this$01);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_ScopePropertiesDialog$8_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ScopePropertiesDialog/8', 774);
|
|
function ScopePropertiesDialog$9(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(775, 1, $intern_56, ScopePropertiesDialog$9);
|
|
_.onClick = function onClick_36(event_0){
|
|
$apply_2(this.this$01);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_ScopePropertiesDialog$9_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ScopePropertiesDialog/9', 775);
|
|
function ScopePropertiesDialog$PlotClickHandler(this$0, n){
|
|
this.this$01 = this$0;
|
|
this.num = n;
|
|
}
|
|
|
|
defineClass(763, 1, $intern_56, ScopePropertiesDialog$PlotClickHandler);
|
|
_.onClick = function onClick_37(event_0){
|
|
var i;
|
|
this.this$01.plotSelection = this.num;
|
|
for (i = 0; i < this.this$01.chanButtons.arrayList.array.length; i++) {
|
|
i == this.num?$addStyleName($get_4(this.this$01.chanButtons, i), 'chsel'):$removeStyleName($get_4(this.this$01.chanButtons, i), 'chsel');
|
|
}
|
|
$updateUi(this.this$01);
|
|
}
|
|
;
|
|
_.num = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_ScopePropertiesDialog$PlotClickHandler_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ScopePropertiesDialog/PlotClickHandler', 763);
|
|
function ScopePropertiesDialog$downClickHandler(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(764, 1, $intern_56, ScopePropertiesDialog$downClickHandler);
|
|
_.onClick = function onClick_38(event_0){
|
|
var a, d, lasts, s;
|
|
if (!this.this$01.scope_0.manualScale || this.this$01.plotSelection > this.this$01.scope_0.visiblePlots.arrayList.array.length)
|
|
return;
|
|
d = $getManualScaleValue(this.this$01);
|
|
if (d == 0)
|
|
return;
|
|
d = d * 0.999;
|
|
s = $intern_80;
|
|
lasts = $intern_80;
|
|
for (a = 0; s < d; a++) {
|
|
lasts = s;
|
|
s *= ($clinit_Scope() , multa)[a % 3];
|
|
}
|
|
$setManualScaleValue(this.this$01.scope_0, this.this$01.plotSelection, lasts);
|
|
$updateUi(this.this$01);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_ScopePropertiesDialog$downClickHandler_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ScopePropertiesDialog/downClickHandler', 764);
|
|
function ScopePropertiesDialog$expandingLabel(this$0, s, ex){
|
|
this.this$01 = this$0;
|
|
this.expanded = ex;
|
|
this.p = new HorizontalPanel;
|
|
this.b = new Button_1((checkCriticalNotNull(ex) , ex)?'-':'+');
|
|
$addDomHandler(this.b, new ScopePropertiesDialog$expandingLabel$1(this), ($clinit_ClickEvent() , $clinit_ClickEvent() , TYPE_1));
|
|
$addStyleName(this.b, 'expand-but');
|
|
$add_3(this.p, this.b);
|
|
this.l_0 = new Label_1(s);
|
|
$getElement(this.l_0).style['fontWeight'] = ($clinit_Style$FontWeight() , 'bold');
|
|
$add_3(this.p, this.l_0);
|
|
$setCellVerticalAlignment_1(this.p, this.l_0, ($clinit_HasVerticalAlignment() , ALIGN_BOTTOM));
|
|
}
|
|
|
|
defineClass(243, 1, {243:1}, ScopePropertiesDialog$expandingLabel);
|
|
var Lcom_lushprojects_circuitjs1_client_ScopePropertiesDialog$expandingLabel_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ScopePropertiesDialog/expandingLabel', 243);
|
|
function ScopePropertiesDialog$expandingLabel$1(this$1){
|
|
this.this$11 = this$1;
|
|
}
|
|
|
|
defineClass(766, 1, $intern_56, ScopePropertiesDialog$expandingLabel$1);
|
|
_.onClick = function onClick_39(event_0){
|
|
this.this$11.expanded = ($clinit_Boolean() , $booleanValue(this.this$11.expanded)?false:true);
|
|
$setHTML(this.this$11.b, $booleanValue(this.this$11.expanded)?'-':'+');
|
|
$updateUi(this.this$11.this$01);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_ScopePropertiesDialog$expandingLabel$1_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ScopePropertiesDialog/expandingLabel/1', 766);
|
|
function $addLabel(this$static, s, e){
|
|
var l_0;
|
|
this$static.this$01.nx != 0 && ++this$static.this$01.ny;
|
|
this$static.this$01.nx = 0;
|
|
l_0 = new ScopePropertiesDialog$expandingLabel(this$static.this$01, LS(s), ($clinit_Boolean() , e?true:false));
|
|
$setWidget_2(this$static.g, this$static.this$01.ny, this$static.this$01.nx, l_0.p);
|
|
$add_11(this$static.labels, l_0);
|
|
$add_11(this$static.labelRows, valueOf_0(this$static.this$01.ny));
|
|
++this$static.this$01.ny;
|
|
}
|
|
|
|
function $updateRowVisibility(this$static){
|
|
var end, i, j, start_0;
|
|
for (i = 0; i < this$static.labels.arrayList.array.length; i++) {
|
|
start_0 = $get_4(this$static.labelRows, i).value_0;
|
|
i < this$static.labels.arrayList.array.length - 1?(end = $get_4(this$static.labelRows, i + 1).value_0):(end = this$static.g.numRows);
|
|
for (j = start_0 + 1; j < end; j++)
|
|
$setVisible_1(this$static.g.rowFormatter, j, $booleanValue($get_4(this$static.labels, i).expanded));
|
|
}
|
|
}
|
|
|
|
function ScopePropertiesDialog$labelledGridManager(this$0, gIn){
|
|
this.this$01 = this$0;
|
|
this.g = gIn;
|
|
this.labels = new Vector;
|
|
this.labelRows = new Vector;
|
|
}
|
|
|
|
defineClass(348, 1, {}, ScopePropertiesDialog$labelledGridManager);
|
|
var Lcom_lushprojects_circuitjs1_client_ScopePropertiesDialog$labelledGridManager_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ScopePropertiesDialog/labelledGridManager', 348);
|
|
function ScopePropertiesDialog$manualScaleTextHandler(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(347, 1, $intern_68, ScopePropertiesDialog$manualScaleTextHandler);
|
|
_.onValueChange = function onValueChange_13(event_0){
|
|
$apply_2(this.this$01);
|
|
$updateUi(this.this$01);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_ScopePropertiesDialog$manualScaleTextHandler_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ScopePropertiesDialog/manualScaleTextHandler', 347);
|
|
function ScopePropertiesDialog$upClickHandler(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(765, 1, $intern_56, ScopePropertiesDialog$upClickHandler);
|
|
_.onClick = function onClick_40(event_0){
|
|
var d, s;
|
|
if (!this.this$01.scope_0.manualScale || this.this$01.plotSelection > this.this$01.scope_0.visiblePlots.arrayList.array.length)
|
|
return;
|
|
d = $getManualScaleValue(this.this$01);
|
|
if (d == 0)
|
|
return;
|
|
s = nextHighestScale(d);
|
|
$setManualScaleValue(this.this$01.scope_0, this.this$01.plotSelection, s);
|
|
$updateUi(this.this$01);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_ScopePropertiesDialog$upClickHandler_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ScopePropertiesDialog/upClickHandler', 765);
|
|
function $dumpXml_11(this$static, doc, root){
|
|
var elm, eno, f, flags, i, p, pelm, px, py, vPlot, xmlElm, number, number_0;
|
|
vPlot = $get_4(this$static.scope_0.plots, 0);
|
|
elm = vPlot.elm;
|
|
if (!elm)
|
|
return;
|
|
if (this$static.scope_0.plot2d.enabled && this$static.scope_0.plots.arrayList.array.length >= 2) {
|
|
px = $validPlotIndex(this$static.scope_0.plot2d, this$static.scope_0.plot2d.plotX, 0);
|
|
py = $validPlotIndex(this$static.scope_0.plot2d, this$static.scope_0.plot2d.plotY, 1);
|
|
this$static.scope_0.scale_0[$get_4(this$static.scope_0.plots, px).units] = this$static.scope_0.plot2d.scaleX;
|
|
this$static.scope_0.scale_0[$get_4(this$static.scope_0.plots, py).units] = this$static.scope_0.plot2d.scaleY;
|
|
}
|
|
flags = $getFlags(this$static);
|
|
eno = $locateElm(this$static.scope_0.app, elm);
|
|
if (eno < 0)
|
|
return;
|
|
xmlElm = $createElement(doc, 'o');
|
|
checkAttr(xmlElm, 'en');
|
|
$setAttribute_0(xmlElm, 'en', '' + eno);
|
|
dumpAttr_0(xmlElm, 'sp', vPlot.scopePlotSpeed);
|
|
f = flags & -17567745;
|
|
dumpAttr_1(xmlElm, 'f', f >= 0?'x' + (number = f >>> 0 , number.toString(16)):'' + f);
|
|
dumpAttr_0(xmlElm, 'p', this$static.scope_0.position);
|
|
this$static.scope_0.manDivisions != 8 && dumpAttr_0(xmlElm, 'md', this$static.scope_0.manDivisions);
|
|
$dumpXml_12(this$static.scope_0.trigger, xmlElm);
|
|
if (this$static.scope_0.plot2d.plotXY) {
|
|
this$static.scope_0.plot2d.plotX != 0 && dumpAttr_0(xmlElm, 'xy2x', this$static.scope_0.plot2d.plotX);
|
|
this$static.scope_0.plot2d.plotY != 1 && dumpAttr_0(xmlElm, 'xy2y', this$static.scope_0.plot2d.plotY);
|
|
this$static.scope_0.plot2d.plotBrightness >= 0 && dumpAttr_0(xmlElm, 'xy2br', this$static.scope_0.plot2d.plotBrightness);
|
|
this$static.scope_0.plot2d.plotColorR >= 0 && dumpAttr_0(xmlElm, 'xy2r', this$static.scope_0.plot2d.plotColorR);
|
|
this$static.scope_0.plot2d.plotColorG >= 0 && dumpAttr_0(xmlElm, 'xy2g', this$static.scope_0.plot2d.plotColorG);
|
|
this$static.scope_0.plot2d.plotColorB >= 0 && dumpAttr_0(xmlElm, 'xy2b', this$static.scope_0.plot2d.plotColorB);
|
|
}
|
|
$appendChild_0(root, xmlElm);
|
|
for (i = 0; i < this$static.scope_0.plots.arrayList.array.length; i++) {
|
|
p = $get_4(this$static.scope_0.plots, i);
|
|
pelm = $createElement(doc, 'p');
|
|
(p.acCoupled?1:0) > 0 && dumpAttr_1(pelm, 'f', (number_0 = (p.acCoupled?1:0) >>> 0 , number_0.toString(16)));
|
|
p.elm != elm && dumpAttr_0(pelm, 'e', $locateElm(this$static.scope_0.app, p.elm));
|
|
dumpAttr_0(pelm, 'v', p.value_0);
|
|
dumpAttr(pelm, 'sc', this$static.scope_0.scale_0[p.units]);
|
|
if (this$static.scope_0.manualScale) {
|
|
dumpAttr(pelm, 'ms', p.manScale);
|
|
dumpAttr_0(pelm, 'mp', p.manVPosition);
|
|
}
|
|
$appendChild_0(xmlElm, pelm);
|
|
}
|
|
this$static.scope_0.text_0 != null && $setAttribute_0(xmlElm, 'x', this$static.scope_0.text_0);
|
|
this$static.scope_0.plot2d.trailPersistence != 0 && dumpAttr_0(xmlElm, 'tp', this$static.scope_0.plot2d.trailPersistence);
|
|
}
|
|
|
|
function $getFlags(this$static){
|
|
var allPlotFlags, flags, p, p$iterator;
|
|
flags = (this$static.scope_0.showI?1:0) | (this$static.scope_0.showV?2:0) | (this$static.scope_0.showMax?0:4) | (this$static.scope_0.showFreq?8:0) | (this$static.scope_0.manualScale?524304:0) | (this$static.scope_0.plot2d.enabled?64:0) | (this$static.scope_0.plot2d.plotXY?128:0) | (this$static.scope_0.showMin?256:0) | (this$static.scope_0.showScale?512:0) | (this$static.scope_0.fftPlot.enabled?$intern_24:0) | (this$static.scope_0.maxScale?8192:0) | (this$static.scope_0.showRMS?$intern_44:0) | (this$static.scope_0.showDutyCycle?32768:0) | (this$static.scope_0.fftPlot.logSpectrum?$intern_45:0) | (this$static.scope_0.showAverage?$intern_46:0) | (this$static.scope_0.showElmInfo?$intern_48:0) | (this$static.scope_0.showP2P?$intern_30:0) | (this$static.scope_0.fftPlot.showPhaseAngle?$intern_50:0);
|
|
flags |= $intern_42;
|
|
allPlotFlags = 0;
|
|
for (p$iterator = new ArrayList$1(this$static.scope_0.plots.arrayList); p$iterator.i < p$iterator.this$01.array.length;) {
|
|
p = $next_4(p$iterator);
|
|
allPlotFlags |= p.acCoupled?1:0;
|
|
}
|
|
flags |= allPlotFlags != 0?$intern_47:0;
|
|
this$static.scope_0.manualScale && (flags |= $intern_49);
|
|
this$static.scope_0.trigger.mode != 0 && (flags |= $intern_51);
|
|
return flags;
|
|
}
|
|
|
|
function $loadDefaults(this$static){
|
|
var arr, flags, stor, str;
|
|
stor = (!localStorage_0 && ($clinit_Storage$StorageSupportDetector() , localStorageSupported) && (localStorage_0 = new Storage_0('localStorage')) , localStorage_0);
|
|
if (!stor)
|
|
return false;
|
|
str = $getItem_0(stor.storage, 'scopeDefaults');
|
|
if (str == null)
|
|
return false;
|
|
arr = $split_1(str, ' ', 0);
|
|
flags = __parseAndValidateInt(arr[1], 10);
|
|
$setFlags(this$static, flags);
|
|
this$static.scope_0.speed = __parseAndValidateInt(arr[2], 10);
|
|
arr.length > 3 && (flags & $intern_51) != 0 && (this$static.scope_0.trigger.level = __parseAndValidateDouble(arr[3]));
|
|
return true;
|
|
}
|
|
|
|
function $saveAsDefault(this$static){
|
|
var flags, s, stor, vPlot;
|
|
stor = (!localStorage_0 && ($clinit_Storage$StorageSupportDetector() , localStorageSupported) && (localStorage_0 = new Storage_0('localStorage')) , localStorage_0);
|
|
if (!stor)
|
|
return;
|
|
vPlot = $get_4(this$static.scope_0.plots, 0);
|
|
flags = $getFlags(this$static);
|
|
s = '1 ' + flags + ' ' + vPlot.scopePlotSpeed;
|
|
(flags & $intern_51) != 0 && (s += ' ' + this$static.scope_0.trigger.level);
|
|
$setItem_0(stor.storage, 'scopeDefaults', s);
|
|
console.log('saved defaults ' + flags);
|
|
}
|
|
|
|
function $setFlags(this$static, flags){
|
|
this$static.scope_0.showI = (flags & 1) != 0;
|
|
this$static.scope_0.showV = (flags & 2) != 0;
|
|
this$static.scope_0.showMax = (flags & 4) == 0;
|
|
this$static.scope_0.showFreq = (flags & 8) != 0;
|
|
this$static.scope_0.manualScale = (flags & 16) != 0;
|
|
this$static.scope_0.plot2d.enabled = (flags & 64) != 0;
|
|
this$static.scope_0.plot2d.plotXY = (flags & 128) != 0;
|
|
this$static.scope_0.showMin = (flags & 256) != 0;
|
|
this$static.scope_0.showScale = (flags & 512) != 0;
|
|
$show_1(this$static.scope_0.fftPlot, (flags & $intern_24) != 0);
|
|
this$static.scope_0.maxScale = (flags & 8192) != 0;
|
|
this$static.scope_0.showRMS = (flags & $intern_44) != 0;
|
|
this$static.scope_0.showDutyCycle = (flags & 32768) != 0;
|
|
this$static.scope_0.fftPlot.logSpectrum = (flags & $intern_45) != 0;
|
|
this$static.scope_0.showAverage = (flags & $intern_46) != 0;
|
|
this$static.scope_0.showElmInfo = (flags & $intern_48) != 0;
|
|
this$static.scope_0.showP2P = (flags & $intern_30) != 0;
|
|
this$static.scope_0.fftPlot.showPhaseAngle = (flags & $intern_50) != 0;
|
|
}
|
|
|
|
function $undump_2(this$static, st){
|
|
var ce, e, elm, flags, hasPlotFlags, i, ivalue, ne, p, plot2dFlag, plotFlags, sz, u, val, value_0, yElm, ye;
|
|
$initialize(this$static.scope_0);
|
|
e = (new Integer_0($nextToken(st))).value_0;
|
|
if (e == -1)
|
|
return;
|
|
ce = $getElm(this$static.scope_0.app, e);
|
|
$setElm(this$static.scope_0, ce);
|
|
this$static.scope_0.speed = (new Integer_0($nextToken(st))).value_0;
|
|
value_0 = (new Integer_0($nextToken(st))).value_0;
|
|
!instanceOf(ce, 153) && value_0 == 1 && (value_0 = 7);
|
|
flags = importDecOrHex($nextToken(st));
|
|
this$static.scope_0.scale_0[0] = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this$static.scope_0.scale_0[1] = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this$static.scope_0.scale_0[0] == 0 && (this$static.scope_0.scale_0[0] = 0.5);
|
|
this$static.scope_0.scale_0[1] == 0 && (this$static.scope_0.scale_0[1] = 1);
|
|
this$static.scope_0.plot2d.scaleX = this$static.scope_0.scale_0[0];
|
|
this$static.scope_0.plot2d.scaleY = this$static.scope_0.scale_0[1];
|
|
this$static.scope_0.scale_0[3] = this$static.scope_0.scale_0[2] = this$static.scope_0.scale_0[4] = this$static.scope_0.scale_0[0];
|
|
this$static.scope_0.text_0 = null;
|
|
plot2dFlag = (flags & 64) != 0;
|
|
hasPlotFlags = (flags & $intern_47) != 0;
|
|
if ((flags & $intern_42) != 0) {
|
|
try {
|
|
this$static.scope_0.position = __parseAndValidateInt($nextToken(st), 10);
|
|
sz = __parseAndValidateInt($nextToken(st), 10);
|
|
this$static.scope_0.manDivisions = 8;
|
|
(flags & $intern_49) != 0 && (this$static.scope_0.manDivisions = ($clinit_Scope() , lastManDivisions = __parseAndValidateInt($nextToken(st), 10)));
|
|
u = ce.getScopeUnits(value_0);
|
|
u > 1 && (this$static.scope_0.scale_0[u] = __parseAndValidateDouble($nextToken(st)));
|
|
$setValue_0(this$static.scope_0, value_0);
|
|
while (this$static.scope_0.plots.arrayList.array.length > 1)
|
|
$removeElementAt(this$static.scope_0.plots, 1);
|
|
plotFlags = 0;
|
|
for (i = 0; i != sz; i++) {
|
|
hasPlotFlags && (plotFlags = __parseAndValidateInt($nextToken(st), 16));
|
|
if (i != 0) {
|
|
ne = __parseAndValidateInt($nextToken(st), 10);
|
|
val = __parseAndValidateInt($nextToken(st), 10);
|
|
elm = $getElm(this$static.scope_0.app, ne);
|
|
u = elm.getScopeUnits(val);
|
|
u > 1 && (this$static.scope_0.scale_0[u] = __parseAndValidateDouble($nextToken(st)));
|
|
$add_11(this$static.scope_0.plots, new ScopePlot_0(elm, u, val, $getManScaleFromMaxScale(this$static.scope_0, u, false)));
|
|
}
|
|
p = $get_4(this$static.scope_0.plots, i);
|
|
p.acCoupled = (plotFlags & 1) != 0;
|
|
if ((flags & $intern_29) != 0) {
|
|
p.manScaleSet = true;
|
|
p.manScale = __parseAndValidateDouble($nextToken(st));
|
|
p.manVPosition = __parseAndValidateInt($nextToken(st), 10);
|
|
}
|
|
}
|
|
while ($hasMoreTokens(st)) {
|
|
this$static.scope_0.text_0 == null?(this$static.scope_0.text_0 = $nextToken(st)):(this$static.scope_0.text_0 += ' ' + $nextToken(st));
|
|
}
|
|
}
|
|
catch ($e0) {
|
|
$e0 = toJava($e0);
|
|
if (!instanceOf($e0, 13))
|
|
throw toJs($e0);
|
|
}
|
|
}
|
|
else {
|
|
yElm = null;
|
|
ivalue = 0;
|
|
this$static.scope_0.manDivisions = 8;
|
|
try {
|
|
this$static.scope_0.position = (new Integer_0($nextToken(st))).value_0;
|
|
if ((flags & 32) != 0) {
|
|
ye = (new Integer_0($nextToken(st))).value_0;
|
|
ye != -1 && (yElm = $getElm(this$static.scope_0.app, ye));
|
|
plot2dFlag || (yElm = null);
|
|
}
|
|
(flags & $intern_43) != 0 && (ivalue = (new Integer_0($nextToken(st))).value_0);
|
|
while ($hasMoreTokens(st)) {
|
|
this$static.scope_0.text_0 == null?(this$static.scope_0.text_0 = $nextToken(st)):(this$static.scope_0.text_0 += ' ' + $nextToken(st));
|
|
}
|
|
}
|
|
catch ($e1) {
|
|
$e1 = toJava($e1);
|
|
if (!instanceOf($e1, 13))
|
|
throw toJs($e1);
|
|
}
|
|
$setValues(this$static.scope_0, value_0, ivalue, $getElm(this$static.scope_0.app, e), yElm);
|
|
}
|
|
this$static.scope_0.text_0 != null && (this$static.scope_0.text_0 = unescape_0(this$static.scope_0.text_0));
|
|
this$static.scope_0.plot2d.enabled = plot2dFlag;
|
|
$setFlags(this$static, flags);
|
|
}
|
|
|
|
function $undumpXml_6(this$static, xml){
|
|
var ce, e, elem, elem$iterator, flags, fs, ms, p, plotElm, plotFlags, px, py, sc, u, val, xy2b, xy2br, xy2g, xy2r, xy2x, xy2y;
|
|
e = $parseIntAttr(xml, 'en', -1);
|
|
if (e == -1)
|
|
return;
|
|
ce = $getElm(this$static.scope_0.app, e);
|
|
$setElm(this$static.scope_0, ce);
|
|
this$static.scope_0.plots = new Vector;
|
|
this$static.scope_0.speed = $parseIntAttr(xml, 'sp', 64);
|
|
fs = $parseStringAttr(xml, 'f', '0');
|
|
flags = (checkCriticalStringElementIndex(0, fs.length) , fs.charCodeAt(0) == 120?__parseAndValidateInt(fs.substr(1), 16):__parseAndValidateInt(fs, 10));
|
|
this$static.scope_0.position = $parseIntAttr(xml, 'p', 0);
|
|
this$static.scope_0.manDivisions = $parseIntAttr(xml, 'md', 8);
|
|
this$static.scope_0.text_0 = $parseStringAttr(xml, 'x', null);
|
|
this$static.scope_0.plot2d.trailPersistence = $parseIntAttr(xml, 'tp', 0);
|
|
$undumpXml_7(this$static.scope_0.trigger, xml);
|
|
xy2x = $parseIntAttr(xml, 'xy2x', 0);
|
|
xy2y = $parseIntAttr(xml, 'xy2y', 1);
|
|
xy2br = $parseIntAttr(xml, 'xy2br', -1);
|
|
xy2r = $parseIntAttr(xml, 'xy2r', -1);
|
|
xy2g = $parseIntAttr(xml, 'xy2g', -1);
|
|
xy2b = $parseIntAttr(xml, 'xy2b', -1);
|
|
for (elem$iterator = new ArrayList$1($getChildElements(xml)); elem$iterator.i < elem$iterator.this$01.array.length;) {
|
|
elem = $next_4(elem$iterator);
|
|
xml.currentXmlElement = elem;
|
|
plotFlags = __parseAndValidateInt($parseStringAttr(xml, 'f', '0'), 16);
|
|
plotElm = $getElm(this$static.scope_0.app, $parseIntAttr(xml, 'e', e));
|
|
val = $parseIntAttr(xml, 'v', -1);
|
|
u = plotElm.getScopeUnits(val);
|
|
sc = $parseDoubleAttr(xml, 'sc', -1);
|
|
sc >= 0 && (this$static.scope_0.scale_0[u] = sc);
|
|
p = new ScopePlot_0(plotElm, u, val, $getManScaleFromMaxScale(this$static.scope_0, u, false));
|
|
$add_11(this$static.scope_0.plots, p);
|
|
p.acCoupled = (plotFlags & 1) != 0;
|
|
ms = $parseDoubleAttr(xml, 'ms', -1);
|
|
if (ms >= 0) {
|
|
p.manScaleSet = true;
|
|
p.manScale = ms;
|
|
p.manVPosition = $parseIntAttr(xml, 'mp', 0);
|
|
}
|
|
}
|
|
$setFlags(this$static, flags);
|
|
if (this$static.scope_0.plot2d.plotXY) {
|
|
this$static.scope_0.plot2d.plotX = xy2x;
|
|
this$static.scope_0.plot2d.plotY = xy2y;
|
|
this$static.scope_0.plot2d.plotBrightness = xy2br;
|
|
this$static.scope_0.plot2d.plotColorR = xy2r;
|
|
this$static.scope_0.plot2d.plotColorG = xy2g;
|
|
this$static.scope_0.plot2d.plotColorB = xy2b;
|
|
}
|
|
if (this$static.scope_0.plot2d.enabled && this$static.scope_0.plots.arrayList.array.length >= 1) {
|
|
px = $validPlotIndex(this$static.scope_0.plot2d, this$static.scope_0.plot2d.plotX, 0);
|
|
py = $validPlotIndex(this$static.scope_0.plot2d, this$static.scope_0.plot2d.plotY, $wnd.Math.min(1, this$static.scope_0.plots.arrayList.array.length - 1));
|
|
this$static.scope_0.plot2d.scaleX = this$static.scope_0.scale_0[$get_4(this$static.scope_0.plots, px).units];
|
|
this$static.scope_0.plot2d.scaleY = this$static.scope_0.scale_0[$get_4(this$static.scope_0.plots, py).units];
|
|
}
|
|
}
|
|
|
|
function ScopeSerializer(scope_0){
|
|
this.scope_0 = scope_0;
|
|
}
|
|
|
|
function importDecOrHex(s){
|
|
return checkCriticalStringElementIndex(0, s.length) , s.charCodeAt(0) == 120?__parseAndValidateInt(s.substr(1), 16):__parseAndValidateInt(s, 10);
|
|
}
|
|
|
|
defineClass(761, 1, {}, ScopeSerializer);
|
|
var Lcom_lushprojects_circuitjs1_client_ScopeSerializer_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ScopeSerializer', 761);
|
|
function $check(this$static, visiblePlots, plot2d, sim, rectWidth){
|
|
var currentPtr, edgeCrossing, plot, val;
|
|
if (this$static.mode == 0 || visiblePlots.arrayList.array.length == 0 || plot2d)
|
|
return;
|
|
plot = (checkCriticalElement(visiblePlots.arrayList.array.length != 0) , checkArrayElementIndex(0, visiblePlots.arrayList.array.length) , $get_2(visiblePlots.arrayList, 0));
|
|
currentPtr = plot.ptr;
|
|
if (currentPtr == this$static.lastCheckPtr)
|
|
return;
|
|
this$static.lastCheckPtr = currentPtr;
|
|
val = (plot.maxValues[currentPtr] + plot.minValues[currentPtr]) * 0.5;
|
|
this$static.edge == 0?(edgeCrossing = this$static.prevValue < this$static.level && val >= this$static.level):(edgeCrossing = this$static.prevValue > this$static.level && val <= this$static.level);
|
|
switch (this$static.state) {
|
|
case 0:
|
|
if (edgeCrossing) {
|
|
this$static.state = 1;
|
|
this$static.ptr = currentPtr;
|
|
this$static.time = sim.t;
|
|
this$static.holdoff = 0;
|
|
this$static.waiting = false;
|
|
this$static.fired = true;
|
|
}
|
|
else {
|
|
this$static.waiting = true;
|
|
if (this$static.mode == 2) {
|
|
++this$static.holdoff;
|
|
if (this$static.holdoff >= this$static.autoTimeout) {
|
|
this$static.state = 2;
|
|
this$static.waiting = false;
|
|
}
|
|
}
|
|
}
|
|
|
|
break;
|
|
case 1:
|
|
++this$static.holdoff;
|
|
if (this$static.holdoff >= rectWidth) {
|
|
this$static.state = 0;
|
|
this$static.holdoff = 0;
|
|
}
|
|
|
|
break;
|
|
case 2:
|
|
if (edgeCrossing) {
|
|
this$static.state = 1;
|
|
this$static.ptr = currentPtr;
|
|
this$static.time = sim.t;
|
|
this$static.holdoff = 0;
|
|
this$static.fired = true;
|
|
}
|
|
|
|
}
|
|
this$static.prevValue = val;
|
|
}
|
|
|
|
function $displayStartIndex_0(this$static, plot, w, scopePointCount){
|
|
if (this$static.mode == 0 || !this$static.fired || this$static.state == 2)
|
|
return plot.ptr + plot.scopePointCount - w;
|
|
return this$static.ptr + scopePointCount - (w / 2 | 0);
|
|
}
|
|
|
|
function $drawIndicator(this$static, g, visiblePlots, rect){
|
|
var edgeText, maxy, plot, statusText, sw, trigY, x_0, x2;
|
|
if (this$static.mode == 0 || visiblePlots.arrayList.array.length == 0)
|
|
return;
|
|
plot = (checkCriticalElement(visiblePlots.arrayList.array.length != 0) , checkArrayElementIndex(0, visiblePlots.arrayList.array.length) , $get_2(visiblePlots.arrayList, 0));
|
|
maxy = (rect.height_0 - 1) / 2 | 0;
|
|
trigY = maxy - round_int((this$static.level + plot.plotOffset) * plot.gridMult);
|
|
if (trigY >= 0 && trigY < rect.height_0) {
|
|
g.context.strokeStyle = '#FF8000';
|
|
g.context.fillStyle = '#FF8000';
|
|
for (x_0 = 0; x_0 < rect.width_0; x_0 += 8) {
|
|
x2 = $wnd.Math.min(x_0 + 4, rect.width_0 - 1);
|
|
$drawLine(g, x_0, trigY, x2, trigY);
|
|
}
|
|
edgeText = this$static.edge == 0?'T\u2191':'T\u2193';
|
|
$drawString(g, edgeText, rect.width_0 - 25, trigY - 3);
|
|
}
|
|
switch (this$static.state) {
|
|
case 0:
|
|
statusText = this$static.waiting?'WAIT':'ARMED';
|
|
break;
|
|
case 1:
|
|
statusText = 'TRIG';
|
|
break;
|
|
case 2:
|
|
statusText = 'AUTO';
|
|
break;
|
|
default:statusText = '';
|
|
}
|
|
g.context.strokeStyle = '#FF8000';
|
|
g.context.fillStyle = '#FF8000';
|
|
sw = round_int($measureText(g.context, statusText).width);
|
|
$drawString(g, statusText, rect.width_0 - sw - 5, rect.height_0 - 5);
|
|
}
|
|
|
|
function $dumpXml_12(this$static, xmlElm){
|
|
if (this$static.mode == 0)
|
|
return;
|
|
dumpAttr_0(xmlElm, 'triggerMode', this$static.mode);
|
|
dumpAttr_0(xmlElm, 'triggerEdge', this$static.edge);
|
|
dumpAttr(xmlElm, 'triggerLevel', this$static.level);
|
|
}
|
|
|
|
function $isTriggered(this$static){
|
|
return this$static.mode != 0 && this$static.fired && this$static.state != 2;
|
|
}
|
|
|
|
function $reset_10(this$static, scopePointCount){
|
|
this$static.state = 0;
|
|
this$static.holdoff = 0;
|
|
this$static.waiting = false;
|
|
this$static.fired = false;
|
|
this$static.lastCheckPtr = -1;
|
|
this$static.autoTimeout = 2 * scopePointCount;
|
|
}
|
|
|
|
function $undumpXml_7(this$static, xml){
|
|
this$static.mode = $parseIntAttr(xml, 'triggerMode', 0);
|
|
this$static.edge = $parseIntAttr(xml, 'triggerEdge', 0);
|
|
this$static.level = $parseDoubleAttr(xml, 'triggerLevel', 0);
|
|
}
|
|
|
|
function $validDataCount_0(this$static, plot, ipa, w, scopePointCount){
|
|
var count;
|
|
if (!(this$static.mode != 0 && this$static.fired && this$static.state != 2))
|
|
return w;
|
|
count = (plot.ptr - ipa & scopePointCount - 1) + 1;
|
|
return $wnd.Math.min(count, w);
|
|
}
|
|
|
|
function ScopeTrigger(){
|
|
}
|
|
|
|
defineClass(762, 1, {}, ScopeTrigger);
|
|
_.autoTimeout = 0;
|
|
_.edge = 0;
|
|
_.fired = false;
|
|
_.holdoff = 0;
|
|
_.lastCheckPtr = -1;
|
|
_.level = 0;
|
|
_.mode = 0;
|
|
_.prevValue = 0;
|
|
_.ptr = 0;
|
|
_.state = 0;
|
|
_.time = 0;
|
|
_.waiting = false;
|
|
var Lcom_lushprojects_circuitjs1_client_ScopeTrigger_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ScopeTrigger', 762);
|
|
function $clinit_ScrollValuePopup(){
|
|
$clinit_ScrollValuePopup = emptyMethod;
|
|
e12_0 = stampJavaTypeInfo(getClassLiteralForArray(D_classLit, 1), $intern_76, 7, 15, [1, 1.2, 1.5, 1.8, 2.2, 2.7, 3.3, 3.9, 4.7, 5.6, 6.8, 8.2]);
|
|
}
|
|
|
|
function $close_0(this$static, keepChanges){
|
|
var idx;
|
|
keepChanges?(idx = $getSelIdx(this$static) , $setElmValue(this$static, idx)):$setElmValue(this$static, this$static.currentidx);
|
|
$hide(this$static, false);
|
|
}
|
|
|
|
function $doDeltaY(this$static, dy){
|
|
var idx;
|
|
this$static.deltaY += dy / (window.devicePixelRatio || 1);
|
|
idx = $getSelIdx(this$static);
|
|
$setElmValue(this$static, idx);
|
|
$setupLabels(this$static);
|
|
}
|
|
|
|
function $getSelIdx(this$static){
|
|
var r;
|
|
r = this$static.currentidx + toInt_0(fromDouble_0($wnd.Math.round(this$static.sim.mouse.wheelSensitivity * this$static.deltaY / 6)));
|
|
r < 0 && (r = 0);
|
|
r >= this$static.nvalues && (r = this$static.nvalues - 1);
|
|
return r;
|
|
}
|
|
|
|
function $setElmValue(this$static, i){
|
|
if (i != this$static.lastidx) {
|
|
this$static.lastidx = i;
|
|
this$static.inf.value_0 = this$static.values[i];
|
|
this$static.myElm.setEditValue(0, this$static.inf);
|
|
$needAnalyze(this$static.sim);
|
|
}
|
|
}
|
|
|
|
function $setupLabels(this$static){
|
|
var i, thissel;
|
|
thissel = $getSelIdx(this$static);
|
|
for (i = 0; i < 5; i++) {
|
|
$removeStyleDependentName(this$static.labels[i]);
|
|
if (thissel + i - 2 < 0 || thissel + i - 2 >= this$static.nvalues)
|
|
$setText_0(this$static.labels[i], '---');
|
|
else {
|
|
$setText_0(this$static.labels[i], getUnitText(this$static.values[thissel + i - 2], '', true));
|
|
thissel + i - 2 == this$static.currentidx && $addStyleDependentName(this$static.labels[i], 'current');
|
|
}
|
|
}
|
|
}
|
|
|
|
function $setupValues(this$static){
|
|
var currentvalue, i, i0, j, ptr;
|
|
if (instanceOf(this$static.myElm, 184)) {
|
|
this$static.minpow = -1;
|
|
this$static.maxpow = 7;
|
|
}
|
|
if (instanceOf(this$static.myElm, 143)) {
|
|
this$static.minpow = -11;
|
|
this$static.maxpow = -3;
|
|
}
|
|
if (instanceOf(this$static.myElm, 194)) {
|
|
this$static.minpow = -6;
|
|
this$static.maxpow = 0;
|
|
}
|
|
this$static.values = initUnidimensionalArray(D_classLit, $intern_76, 7, 2 + (this$static.maxpow - this$static.minpow) * 12, 15, 1);
|
|
ptr = 0;
|
|
for (i0 = this$static.minpow; i0 <= this$static.maxpow; i0++) {
|
|
for (j = 0; j < (i0 != this$static.maxpow?12:1); ++j , ptr++) {
|
|
this$static.values[ptr] = $wnd.Math.pow(10, i0) * e12_0[j];
|
|
}
|
|
}
|
|
this$static.nvalues = ptr;
|
|
this$static.values[this$static.nvalues] = 1.0E99;
|
|
this$static.inf = this$static.myElm.getEditInfo(0);
|
|
currentvalue = this$static.inf.value_0;
|
|
for (i = 0; i < this$static.nvalues + 1; i++) {
|
|
if (getUnitText(currentvalue, '', true) == getUnitText(this$static.values[i], '', true)) {
|
|
this$static.values[i] = currentvalue;
|
|
this$static.currentidx = i;
|
|
break;
|
|
}
|
|
if (currentvalue < this$static.values[i]) {
|
|
this$static.currentidx = i;
|
|
for (j = this$static.nvalues - 1; j >= i; j--)
|
|
this$static.values[j + 1] = this$static.values[j];
|
|
this$static.values[i] = currentvalue;
|
|
++this$static.nvalues;
|
|
break;
|
|
}
|
|
}
|
|
this$static.name_0 = this$static.inf.name_0;
|
|
this$static.lastidx = this$static.currentidx;
|
|
}
|
|
|
|
function ScrollValuePopup(x_0, y_0, dy, e, s){
|
|
$clinit_ScrollValuePopup();
|
|
var i;
|
|
PopupPanel.call(this);
|
|
this.minpow = 0;
|
|
this.maxpow = 1;
|
|
this.myElm = e;
|
|
this.deltaY = 0;
|
|
this.sim = s;
|
|
$pushUndo(this.sim.undoManager);
|
|
this.vp = new VerticalPanel;
|
|
$setWidget_0(this, this.vp);
|
|
$setupValues(this);
|
|
$add_5(this.vp, new Label_1(this.name_0));
|
|
this.labels = initUnidimensionalArray(Lcom_google_gwt_user_client_ui_Label_2_classLit, $intern_3, 33, 5, 0, 1);
|
|
for (i = 0; i < 5; i++) {
|
|
this.labels[i] = new Label_1('---');
|
|
$setHorizontalAlignment(this.labels[i], ($clinit_HasHorizontalAlignment() , ALIGN_CENTER));
|
|
i == 2?$addStyleDependentName(this.labels[2], 'selected'):i == 1 || i == 3?$addStyleDependentName(this.labels[i], '1off'):$addStyleDependentName(this.labels[i], '2off');
|
|
$add_5(this.vp, this.labels[i]);
|
|
}
|
|
$doDeltaY(this, dy);
|
|
$addDomHandler(this, this, ($clinit_MouseOutEvent() , $clinit_MouseOutEvent() , TYPE_9));
|
|
$addDomHandler(this, this, ($clinit_MouseWheelEvent() , $clinit_MouseWheelEvent() , TYPE_12));
|
|
$addDomHandler(this, this, ($clinit_MouseDownEvent() , $clinit_MouseDownEvent() , TYPE_7));
|
|
$setPopupPositionAndShow(this, new ScrollValuePopup$1(this, x_0, y_0));
|
|
}
|
|
|
|
defineClass(915, 48, $intern_132, ScrollValuePopup);
|
|
_.onMouseDown = function onMouseDown_3(e){
|
|
var idx;
|
|
$eventGetButton(e.nativeEvent) == 1 || $eventGetButton(e.nativeEvent) == 4?(idx = $getSelIdx(this) , $setElmValue(this, idx) , $hide(this, false)):($setElmValue(this, this.currentidx) , $hide(this, false));
|
|
}
|
|
;
|
|
_.onMouseOut = function onMouseOut_3(e){
|
|
var idx;
|
|
idx = $getSelIdx(this);
|
|
$setElmValue(this, idx);
|
|
$hide(this, false);
|
|
}
|
|
;
|
|
_.onMouseWheel = function onMouseWheel_4(e){
|
|
!!e.nativeEvent && (e.nativeEvent.preventDefault() , undefined);
|
|
$doDeltaY(this, $eventGetMouseWheelVelocityY(e.nativeEvent));
|
|
}
|
|
;
|
|
_.currentidx = 0;
|
|
_.deltaY = 0;
|
|
_.lastidx = 0;
|
|
_.maxpow = 0;
|
|
_.minpow = 0;
|
|
_.nvalues = 0;
|
|
var e12_0;
|
|
var Lcom_lushprojects_circuitjs1_client_ScrollValuePopup_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ScrollValuePopup', 915);
|
|
function ScrollValuePopup$1(this$0, val$x, val$y){
|
|
this.this$01 = this$0;
|
|
this.val$x2 = val$x;
|
|
this.val$y3 = val$y;
|
|
}
|
|
|
|
defineClass(916, 1, {}, ScrollValuePopup$1);
|
|
_.setPosition = function setPosition_0(offsetWidth, offsetHeight){
|
|
var left, top_0;
|
|
left = $wnd.Math.max(0, this.val$x2 - (offsetWidth / 4 | 0));
|
|
top_0 = $wnd.Math.max(0, this.val$y3 - (7 * offsetHeight / 12 | 0));
|
|
$setPopupPosition(this.this$01, left, top_0);
|
|
}
|
|
;
|
|
_.val$x2 = 0;
|
|
_.val$y3 = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_ScrollValuePopup$1_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ScrollValuePopup/1', 916);
|
|
function $calcValueFromPos(this$static, x_0){
|
|
var v;
|
|
v = this$static.min_0 + ((this$static.max_0 - this$static.min_0) * (x_0 - HMARGIN - SCROLLHEIGHT - BARMARGIN) / (this$static.VERTICALPANELWIDTH - 2 * (HMARGIN + SCROLLHEIGHT + BARMARGIN)) | 0);
|
|
v < this$static.min_0 && (v = this$static.min_0);
|
|
v > this$static.max_0 && (v = this$static.max_0);
|
|
return $snapToStep(this$static, v);
|
|
}
|
|
|
|
function $disable(this$static){
|
|
this$static.enabled = false;
|
|
this$static.dragging = false;
|
|
$draw_6(this$static);
|
|
}
|
|
|
|
function $doMouseDown(this$static, x_0, mouse){
|
|
var step;
|
|
if (this$static.enabled) {
|
|
step = this$static.stepSize > 0?$wnd.Math.max(1, toInt_0(fromDouble_0($wnd.Math.round(this$static.stepSize)))):1;
|
|
if (x_0 < HMARGIN + SCROLLHEIGHT) {
|
|
this$static.val_0 = $snapToStep(this$static, $wnd.Math.max(this$static.min_0, this$static.val_0 - step));
|
|
}
|
|
else {
|
|
if (x_0 > this$static.VERTICALPANELWIDTH - HMARGIN - SCROLLHEIGHT) {
|
|
this$static.val_0 = $snapToStep(this$static, $wnd.Math.min(this$static.max_0, this$static.val_0 + step));
|
|
}
|
|
else {
|
|
this$static.val_0 = $calcValueFromPos(this$static, x_0);
|
|
this$static.dragging = true;
|
|
mouse && setCapture_0($getElement(this$static.can));
|
|
}
|
|
}
|
|
$draw_6(this$static);
|
|
!!this$static.command && this$static.command.execute_1();
|
|
}
|
|
}
|
|
|
|
function $doMouseMove(this$static, x_0){
|
|
if (this$static.enabled) {
|
|
if (this$static.dragging) {
|
|
this$static.val_0 = $calcValueFromPos(this$static, x_0);
|
|
$draw_6(this$static);
|
|
!!this$static.command && this$static.command.execute_1();
|
|
}
|
|
}
|
|
}
|
|
|
|
function $draw_6(this$static){
|
|
var p;
|
|
this$static.enabled?(this$static.g.strokeStyle = '#000000' , undefined):(this$static.g.strokeStyle = 'lightgrey' , undefined);
|
|
this$static.g.lineWidth = 1;
|
|
$fillRect(this$static.g, 0, 0, this$static.VERTICALPANELWIDTH, SCROLLHEIGHT);
|
|
this$static.g.beginPath();
|
|
$moveTo(this$static.g, HMARGIN + SCROLLHEIGHT - 3, 0);
|
|
$lineTo(this$static.g, HMARGIN, SCROLLHEIGHT / 2 | 0);
|
|
$lineTo(this$static.g, HMARGIN + SCROLLHEIGHT - 3, SCROLLHEIGHT);
|
|
$moveTo(this$static.g, this$static.VERTICALPANELWIDTH - HMARGIN - SCROLLHEIGHT + 3, 0);
|
|
$lineTo(this$static.g, this$static.VERTICALPANELWIDTH - HMARGIN, SCROLLHEIGHT / 2 | 0);
|
|
$lineTo(this$static.g, this$static.VERTICALPANELWIDTH - HMARGIN - SCROLLHEIGHT + 3, SCROLLHEIGHT);
|
|
this$static.g.stroke();
|
|
this$static.enabled && (this$static.g.strokeStyle = 'grey' , undefined);
|
|
this$static.g.beginPath();
|
|
this$static.g.lineWidth = 5;
|
|
$moveTo(this$static.g, HMARGIN + SCROLLHEIGHT + BARMARGIN, SCROLLHEIGHT / 2 | 0);
|
|
$lineTo(this$static.g, this$static.VERTICALPANELWIDTH - HMARGIN - SCROLLHEIGHT - BARMARGIN, SCROLLHEIGHT / 2 | 0);
|
|
this$static.g.stroke();
|
|
p = HMARGIN + SCROLLHEIGHT + BARMARGIN + (this$static.VERTICALPANELWIDTH - 2 * (HMARGIN + SCROLLHEIGHT + BARMARGIN)) * (this$static.val_0 - this$static.min_0) / (this$static.max_0 - this$static.min_0);
|
|
if (this$static.enabled) {
|
|
!!this$static.attachedElm && $needsHighlight(this$static.attachedElm)?$setStrokeStyleWeb(this$static.g, $getHexValue(selectColor_0)):(this$static.g.strokeStyle = 'red' , undefined);
|
|
this$static.g.beginPath();
|
|
$moveTo(this$static.g, HMARGIN + SCROLLHEIGHT + BARMARGIN, SCROLLHEIGHT / 2 | 0);
|
|
$lineTo(this$static.g, p, SCROLLHEIGHT / 2 | 0);
|
|
this$static.g.stroke();
|
|
this$static.g.strokeStyle = '#000000';
|
|
this$static.g.lineWidth = 2;
|
|
$fillRect(this$static.g, p - 2, 2, 5, SCROLLHEIGHT - 4);
|
|
$strokeRect(this$static.g, p - 2, 2, 5, SCROLLHEIGHT - 4);
|
|
}
|
|
}
|
|
|
|
function $enable(this$static){
|
|
this$static.enabled = true;
|
|
$draw_6(this$static);
|
|
}
|
|
|
|
function $onMouseWheel_0(this$static, e){
|
|
!!e.nativeEvent && (e.nativeEvent.preventDefault() , undefined);
|
|
this$static.enabled && $setValue_2(this$static, this$static.val_0 + ($eventGetMouseWheelVelocityY(e.nativeEvent) / 3 | 0));
|
|
}
|
|
|
|
function $setStepSize(this$static, step){
|
|
this$static.stepSize = step;
|
|
}
|
|
|
|
function $setValue_2(this$static, i){
|
|
i < this$static.min_0?(i = this$static.min_0):i > this$static.max_0 && (i = this$static.max_0);
|
|
this$static.val_0 = i;
|
|
$draw_6(this$static);
|
|
!!this$static.command && this$static.command.execute_1();
|
|
}
|
|
|
|
function $snapToStep(this$static, v){
|
|
if (this$static.stepSize > 0) {
|
|
v = round_int(toDouble_0(fromDouble_0($wnd.Math.round((v - this$static.min_0) / this$static.stepSize))) * this$static.stepSize) + this$static.min_0;
|
|
v < this$static.min_0 && (v = this$static.min_0);
|
|
v > this$static.max_0 && (v = this$static.max_0);
|
|
}
|
|
return v;
|
|
}
|
|
|
|
function Scrollbar(value_0, minimum, maximum){
|
|
this.VERTICALPANELWIDTH = VERTICALPANELWIDTH;
|
|
this.min_0 = minimum;
|
|
this.max_0 = maximum - 1;
|
|
this.val_0 = value_0;
|
|
this.pan = new VerticalPanel;
|
|
this.can = createIfSupported();
|
|
$setWidth(this.can, this.VERTICALPANELWIDTH + ' px');
|
|
$setHeight(this.can, '40 px');
|
|
$setCoordinateSpaceWidth(this.can, this.VERTICALPANELWIDTH);
|
|
$setCoordinateSpaceHeight(this.can, SCROLLHEIGHT);
|
|
$add_5(this.pan, this.can);
|
|
this.g = $getContext2d(this.can);
|
|
this.g.fillStyle = '#ffffff';
|
|
$addDomHandler(this.can, this, ($clinit_ClickEvent() , $clinit_ClickEvent() , TYPE_1));
|
|
$addDomHandler(this.can, this, ($clinit_MouseDownEvent() , $clinit_MouseDownEvent() , TYPE_7));
|
|
$addDomHandler(this.can, this, ($clinit_MouseUpEvent() , $clinit_MouseUpEvent() , TYPE_11));
|
|
$addDomHandler(this.can, this, ($clinit_MouseMoveEvent() , $clinit_MouseMoveEvent() , TYPE_8));
|
|
$addDomHandler(this.can, this, ($clinit_MouseOutEvent() , $clinit_MouseOutEvent() , TYPE_9));
|
|
$addDomHandler(this.can, this, ($clinit_MouseOverEvent() , $clinit_MouseOverEvent() , TYPE_10));
|
|
$addDomHandler(this.can, this, ($clinit_MouseWheelEvent() , $clinit_MouseWheelEvent() , TYPE_12));
|
|
$addDomHandler(this.can, this, ($clinit_TouchStartEvent() , $clinit_TouchStartEvent() , TYPE_16));
|
|
$addDomHandler(this.can, this, ($clinit_TouchMoveEvent() , $clinit_TouchMoveEvent() , TYPE_15));
|
|
$addDomHandler(this.can, this, ($clinit_TouchEndEvent() , $clinit_TouchEndEvent() , TYPE_14));
|
|
$addDomHandler(this.can, this, ($clinit_TouchCancelEvent() , $clinit_TouchCancelEvent() , TYPE_13));
|
|
$draw_6(this);
|
|
$initWidget(this, this.pan);
|
|
}
|
|
|
|
function Scrollbar_0(value_0, minimum, maximum, cmd){
|
|
Scrollbar.call(this, value_0, minimum, maximum);
|
|
this.command = cmd;
|
|
}
|
|
|
|
function Scrollbar_1(value_0, cmd, e){
|
|
Scrollbar.call(this, value_0, 0, 101);
|
|
this.command = cmd;
|
|
this.attachedElm = e;
|
|
}
|
|
|
|
defineClass(141, 983, {37:1, 208:1, 457:1, 173:1, 228:1, 316:1, 131:1, 958:1, 957:1, 1000:1, 956:1, 28:1, 11:1, 25:1, 27:1, 23:1, 29:1, 22:1, 24:1}, Scrollbar, Scrollbar_0, Scrollbar_1);
|
|
_.onClick = function onClick_41(e){
|
|
!!e.nativeEvent && (e.nativeEvent.preventDefault() , undefined);
|
|
}
|
|
;
|
|
_.onMouseDown = function onMouseDown_4(e){
|
|
this.dragging = false;
|
|
!!e.nativeEvent && (e.nativeEvent.preventDefault() , undefined);
|
|
$doMouseDown(this, $getX(e), true);
|
|
}
|
|
;
|
|
_.onMouseMove = function onMouseMove_2(e){
|
|
!!e.nativeEvent && (e.nativeEvent.preventDefault() , undefined);
|
|
if (this.dragging && e.nativeEvent.buttons == 0) {
|
|
releaseCapture_0($getElement(this.can));
|
|
this.dragging = false;
|
|
return;
|
|
}
|
|
$doMouseMove(this, $getX(e));
|
|
}
|
|
;
|
|
_.onMouseOut = function onMouseOut_4(e){
|
|
if (this.dragging)
|
|
return;
|
|
this.enabled && !!this.attachedElm && $isMouseElm(this.attachedElm) && $setMouseElm_0(theApp.mouse, null);
|
|
}
|
|
;
|
|
_.onMouseOver = function onMouseOver_1(e){
|
|
this.enabled && !!this.attachedElm && $setMouseElm_0(theApp.mouse, this.attachedElm);
|
|
}
|
|
;
|
|
_.onMouseUp = function onMouseUp_3(e){
|
|
!!e.nativeEvent && (e.nativeEvent.preventDefault() , undefined);
|
|
releaseCapture_0($getElement(this.can));
|
|
if (this.enabled && this.dragging) {
|
|
this.val_0 = $calcValueFromPos(this, $getX(e));
|
|
this.dragging = false;
|
|
$draw_6(this);
|
|
!!this.command && this.command.execute_1();
|
|
}
|
|
}
|
|
;
|
|
_.onMouseWheel = function onMouseWheel_5(e){
|
|
$onMouseWheel_0(this, e);
|
|
}
|
|
;
|
|
_.onTouchCancel = function onTouchCancel_1(event_0){
|
|
!!event_0.nativeEvent && (event_0.nativeEvent.preventDefault() , undefined);
|
|
this.dragging = false;
|
|
}
|
|
;
|
|
_.onTouchEnd = function onTouchEnd_1(event_0){
|
|
!!event_0.nativeEvent && (event_0.nativeEvent.preventDefault() , undefined);
|
|
if (this.enabled && this.dragging) {
|
|
this.dragging = false;
|
|
$draw_6(this);
|
|
!!this.command && this.command.execute_1();
|
|
}
|
|
}
|
|
;
|
|
_.onTouchMove = function onTouchMove_0(e){
|
|
var t;
|
|
!!e.nativeEvent && (e.nativeEvent.preventDefault() , undefined);
|
|
t = e.nativeEvent.touches[0];
|
|
$doMouseMove(this, $getRelativeX(t, ($clinit_DOM() , this.element)));
|
|
}
|
|
;
|
|
_.onTouchStart = function onTouchStart_1(event_0){
|
|
var t;
|
|
!!event_0.nativeEvent && (event_0.nativeEvent.preventDefault() , undefined);
|
|
this.dragging = false;
|
|
t = event_0.nativeEvent.touches[0];
|
|
$doMouseDown(this, $getRelativeX(t, ($clinit_DOM() , this.element)), false);
|
|
}
|
|
;
|
|
_.VERTICALPANELWIDTH = 0;
|
|
_.attachedElm = null;
|
|
_.command = null;
|
|
_.dragging = false;
|
|
_.enabled = true;
|
|
_.max_0 = 0;
|
|
_.min_0 = 0;
|
|
_.stepSize = 0;
|
|
_.val_0 = 0;
|
|
var BARMARGIN = 3, HMARGIN = 2, SCROLLHEIGHT = 14;
|
|
var Lcom_lushprojects_circuitjs1_client_Scrollbar_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'Scrollbar', 141);
|
|
function $apply_3(this$static){
|
|
var i, item_0, s;
|
|
s = $getSelectedItemText(this$static.listBox);
|
|
for (i = 0; i != this$static.ui.mainMenuItems.arrayList.array.length; i++) {
|
|
item_0 = $get_4(this$static.ui.mainMenuItems, i);
|
|
if ($equals_1(item_0.name_0, s)) {
|
|
item_0.command.execute_1();
|
|
break;
|
|
}
|
|
}
|
|
$hide_0(this$static, false);
|
|
dialogShowing == this$static && (dialogShowing = null);
|
|
return true;
|
|
}
|
|
|
|
function $search(this$static){
|
|
var i, item_0, items, str;
|
|
str = $getText(this$static.textBox).toLowerCase();
|
|
$getElement(this$static.listBox).options.length = 0;
|
|
items = new Vector;
|
|
for (i = 0; i != this$static.ui.mainMenuItems.arrayList.array.length; i++) {
|
|
item_0 = $get_4(this$static.ui.mainMenuItems, i);
|
|
$indexOf_1(item_0.name_0.toLowerCase(), (checkCriticalNotNull(str) , str)) != -1 && ($contains_5(items, item_0.name_0) || $add_11(items, item_0.name_0));
|
|
}
|
|
$clinit_Collections();
|
|
$sort_0(items, new SearchDialog$5);
|
|
for (i = 0; i != items.arrayList.array.length; i++)
|
|
$addItem(this$static.listBox, (checkArrayElementIndex(i, items.arrayList.array.length) , $get_2(items.arrayList, i)));
|
|
items.arrayList.array.length > 0 && $setItemSelected(this$static.listBox);
|
|
}
|
|
|
|
function SearchDialog(asim){
|
|
var cancelButton, hp, i, item_0;
|
|
Dialog.call(this);
|
|
this.sim = asim;
|
|
this.ui = this.sim.ui;
|
|
this.vp = new VerticalPanel;
|
|
$setWidget_1(this, this.vp);
|
|
this.textBox = new TextBox;
|
|
$setMaxLength(this.textBox);
|
|
$add_5(this.vp, this.textBox);
|
|
$addDomHandler(this.textBox, new SearchDialog$1(this), ($clinit_KeyUpEvent() , $clinit_KeyUpEvent() , TYPE_6));
|
|
$setText(this, LS('Find Component'));
|
|
this.listBox = new ListBox;
|
|
$setWidth(this.listBox, '100%');
|
|
$addDomHandler(this.listBox, new SearchDialog$2(this), ($clinit_DoubleClickEvent() , $clinit_DoubleClickEvent() , TYPE_3));
|
|
$setVisibleItemCount(this.listBox, 10);
|
|
$add_5(this.vp, this.listBox);
|
|
for (i = 0; i != this.ui.mainMenuItems.arrayList.array.length; i++) {
|
|
item_0 = $get_4(this.ui.mainMenuItems, i);
|
|
if (item_0.shortcut.length > 1)
|
|
break;
|
|
$addItem(this.listBox, item_0.name_0);
|
|
}
|
|
hp = new HorizontalPanel;
|
|
($clinit_DOM() , hp.element).style['width'] = '100%';
|
|
$setHorizontalAlignment_0(hp, ($clinit_HasHorizontalAlignment() , ALIGN_LEFT));
|
|
hp.element.className = 'topSpace';
|
|
$add_5(this.vp, hp);
|
|
$add_3(hp, this.okButton = new Button_1(LS('OK')));
|
|
$setHorizontalAlignment_0(hp, ALIGN_RIGHT);
|
|
$add_3(hp, cancelButton = new Button_1(LS('Cancel')));
|
|
$addDomHandler(this.okButton, new SearchDialog$3(this), ($clinit_ClickEvent() , $clinit_ClickEvent() , TYPE_1));
|
|
$addDomHandler(cancelButton, new SearchDialog$4(this), (null , TYPE_1));
|
|
$center(this);
|
|
$setFocus(this.textBox);
|
|
}
|
|
|
|
defineClass(699, 140, $intern_58, SearchDialog);
|
|
_.apply_0 = function apply_10(){
|
|
return $apply_3(this);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_SearchDialog_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'SearchDialog', 699);
|
|
function SearchDialog$1(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(700, 1, {1012:1, 11:1}, SearchDialog$1);
|
|
_.onKeyUp = function onKeyUp(ev){
|
|
$search(this.this$01);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_SearchDialog$1_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'SearchDialog/1', 700);
|
|
function SearchDialog$2(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(701, 1, {1001:1, 11:1}, SearchDialog$2);
|
|
_.onDoubleClick = function onDoubleClick_0(ev){
|
|
$apply_3(this.this$01);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_SearchDialog$2_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'SearchDialog/2', 701);
|
|
function SearchDialog$3(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(702, 1, $intern_56, SearchDialog$3);
|
|
_.onClick = function onClick_42(event_0){
|
|
$apply_3(this.this$01);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_SearchDialog$3_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'SearchDialog/3', 702);
|
|
function SearchDialog$4(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(703, 1, $intern_56, SearchDialog$4);
|
|
_.onClick = function onClick_43(event_0){
|
|
$closeDialog(this.this$01);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_SearchDialog$4_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'SearchDialog/4', 703);
|
|
function SearchDialog$5(){
|
|
}
|
|
|
|
defineClass(704, 1, {}, SearchDialog$5);
|
|
_.compare = function compare_3(a, b){
|
|
return $compareTo(a, b);
|
|
}
|
|
;
|
|
_.equals_0 = function equals_11(other){
|
|
return this === other;
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_SearchDialog$5_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'SearchDialog/5', 704);
|
|
function $$init_22(this$static){
|
|
this$static.bitPosition = 0;
|
|
this$static.bitCount = 0;
|
|
this$static.clockstate = false;
|
|
}
|
|
|
|
function $nextBit(this$static){
|
|
if (this$static.data_0.length > 0 && this$static.bitCount > 0) {
|
|
if (this$static.bitPosition >= this$static.bitCount) {
|
|
if ((this$static.flags & 4) != 0) {
|
|
this$static.pins[1].value_0 = false;
|
|
return;
|
|
}
|
|
this$static.bitPosition = 0;
|
|
}
|
|
this$static.pins[1].value_0 = (this$static.data_0[this$static.bitPosition / 32 | 0] & 1 << this$static.bitPosition % 32) != 0;
|
|
++this$static.bitPosition;
|
|
}
|
|
else {
|
|
this$static.pins[1].value_0 = false;
|
|
}
|
|
}
|
|
|
|
function $setupPins_19(this$static){
|
|
this$static.sizeX = 2;
|
|
this$static.sizeY = 2;
|
|
this$static.pins = initUnidimensionalArray(Lcom_lushprojects_circuitjs1_client_ChipElm$Pin_2_classLit, $intern_3, 9, (this$static.flags & 8) != 0?3:2, 0, 1);
|
|
this$static.pins[0] = new ChipElm$Pin(this$static, 0, 2, '');
|
|
this$static.pins[0].clock = true;
|
|
this$static.pins[1] = new ChipElm$Pin(this$static, 1, 3, 'Q');
|
|
this$static.pins[1].output = true;
|
|
(this$static.flags & 8) != 0 && (this$static.pins[2] = new ChipElm$Pin(this$static, 1, 2, 'R'));
|
|
}
|
|
|
|
function SeqGenElm(xx, yy){
|
|
$clinit_ChipElm();
|
|
ChipElm.call(this, xx, yy);
|
|
$$init_22(this);
|
|
this.bitCount = 8;
|
|
this.data_0 = stampJavaTypeInfo(getClassLiteralForArray(I_classLit, 1), $intern_25, 7, 15, [0]);
|
|
this.flags |= 2;
|
|
this.flags |= 8;
|
|
$setupPins_19(this);
|
|
$allocNodes(this);
|
|
}
|
|
|
|
function SeqGenElm_0(xa, ya, xb, yb, f, st){
|
|
$clinit_ChipElm();
|
|
var i, newData, oldData;
|
|
ChipElm_0.call(this, xa, ya, xb, yb, f, st);
|
|
$$init_22(this);
|
|
try {
|
|
if ((this.flags & 2) == 0) {
|
|
this.flags |= 2;
|
|
oldData = __parseAndValidateInt($nextToken(st), 10) << 24 >> 24;
|
|
newData = 0;
|
|
for (i = 0; i < 32; i++)
|
|
newData = (newData | oldData & (-2147483647 >> i != 0?1 << i:0)) << 24 >> 24;
|
|
this.bitCount = 8;
|
|
this.data_0 = stampJavaTypeInfo(getClassLiteralForArray(I_classLit, 1), $intern_25, 7, 15, [newData]);
|
|
}
|
|
else {
|
|
this.bitCount = __parseAndValidateInt($nextToken(st), 10);
|
|
this.data_0 = initUnidimensionalArray(I_classLit, $intern_25, 7, (this.bitCount / 32 | 0) + (this.bitCount % 32 != 0?1:0), 15, 1);
|
|
for (i = 0; i < this.data_0.length; i++)
|
|
this.data_0[i] = __parseAndValidateInt($nextToken(st), 10);
|
|
}
|
|
}
|
|
catch ($e0) {
|
|
$e0 = toJava($e0);
|
|
if (!instanceOf($e0, 165))
|
|
throw toJs($e0);
|
|
}
|
|
this.bitCount > this.data_0.length * 32 && (this.bitCount = this.data_0.length * 32);
|
|
}
|
|
|
|
defineClass(425, 32, $intern_85, SeqGenElm, SeqGenElm_0);
|
|
_.dumpXml = function dumpXml_73(doc, elem){
|
|
var i, s;
|
|
$dumpXml_0(this, elem);
|
|
dumpAttr_0(elem, 'bc', this.bitCount);
|
|
s = '';
|
|
for (i = 0; i < this.data_0.length; i++) {
|
|
i > 0 && (s += ' ');
|
|
s += this.data_0[i];
|
|
}
|
|
dumpAttr_1(elem, 'dt', s);
|
|
}
|
|
;
|
|
_.execute_3 = function execute_44(){
|
|
if ((this.flags & 8) != 0 && this.pins[2].value_0) {
|
|
this.bitPosition = 0;
|
|
this.clockstate = this.pins[0].value_0;
|
|
$nextBit(this);
|
|
}
|
|
else {
|
|
if (this.pins[0].value_0 != this.clockstate) {
|
|
this.clockstate = this.pins[0].value_0;
|
|
this.clockstate && $nextBit(this);
|
|
}
|
|
}
|
|
}
|
|
;
|
|
_.getChipEditInfo = function getChipEditInfo_21(n){
|
|
var ei, i, sb;
|
|
if (n == 0) {
|
|
ei = new EditInfo_0('', 0, -1, -1);
|
|
ei.checkbox = new Checkbox_0('Play Once', (this.flags & 4) != 0);
|
|
return ei;
|
|
}
|
|
if (n == 1) {
|
|
ei = new EditInfo_0('Sequence', 0, -1, -1);
|
|
ei.textArea = new TextArea_0;
|
|
$setVisibleLines(ei.textArea, 5);
|
|
sb = new StringBuilder_0;
|
|
for (i = 0; i < this.bitCount; i++)
|
|
$append_0(sb, (this.data_0[i / 32 | 0] & 1 << i % 32) != 0?49:48);
|
|
$setText_2(ei.textArea, sb.string);
|
|
return ei;
|
|
}
|
|
return null;
|
|
}
|
|
;
|
|
_.getChipName = function getChipName_26(){
|
|
return 'sequence generator';
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_95(){
|
|
return 188;
|
|
}
|
|
;
|
|
_.getPostCount_0 = function getPostCount_64(){
|
|
return (this.flags & 8) != 0?3:2;
|
|
}
|
|
;
|
|
_.getVoltageDiff_0 = function getVoltageDiff_21(){
|
|
return this.volts[1];
|
|
}
|
|
;
|
|
_.getVoltageSourceCount = function getVoltageSourceCount_45(){
|
|
return 1;
|
|
}
|
|
;
|
|
_.reset_0 = function reset_44(){
|
|
$reset_0(this);
|
|
this.bitPosition = 0;
|
|
}
|
|
;
|
|
_.setChipEditValue = function setChipEditValue_22(n, ei){
|
|
var c, i, i0, s;
|
|
if (n == 0) {
|
|
this.flags = $changeFlag(ei, this.flags, 4);
|
|
return;
|
|
}
|
|
if (n == 1) {
|
|
s = $getText(ei.textArea);
|
|
this.bitCount = 0;
|
|
for (i0 = 0; i0 < s.length; i0++) {
|
|
c = (checkCriticalStringElementIndex(i0, s.length) , s.charCodeAt(i0));
|
|
(c == 48 || c == 49) && ++this.bitCount;
|
|
}
|
|
this.data_0 = initUnidimensionalArray(I_classLit, $intern_25, 7, this.bitCount / 32 | 0, 15, 1);
|
|
this.bitCount = 0;
|
|
for (i = 0; i < s.length; i++) {
|
|
c = (checkCriticalStringElementIndex(i, s.length) , s.charCodeAt(i));
|
|
if (c == 48 || c == 49) {
|
|
c == 49 && (this.data_0[this.bitCount / 32 | 0] |= 1 << this.bitCount % 32);
|
|
++this.bitCount;
|
|
}
|
|
}
|
|
return;
|
|
}
|
|
}
|
|
;
|
|
_.setupPins = function setupPins_27(){
|
|
$setupPins_19(this);
|
|
}
|
|
;
|
|
_.undumpXml = function undumpXml_76(xml){
|
|
var dt, i, st;
|
|
$undumpXml_0(this, xml);
|
|
this.bitCount = $parseIntAttr(xml, 'bc', this.bitCount);
|
|
dt = $parseStringAttr(xml, 'dt', null);
|
|
if (dt != null) {
|
|
st = new StringTokenizer_0(dt, ' ');
|
|
this.data_0 = initUnidimensionalArray(I_classLit, $intern_25, 7, $countTokens(st), 15, 1);
|
|
for (i = 0; i < this.data_0.length; i++)
|
|
this.data_0[i] = __parseAndValidateInt($nextToken(st), 10);
|
|
}
|
|
this.bitCount > this.data_0.length * 32 && (this.bitCount = this.data_0.length * 32);
|
|
}
|
|
;
|
|
_.bitCount = 0;
|
|
_.bitPosition = 0;
|
|
_.clockstate = false;
|
|
var Lcom_lushprojects_circuitjs1_client_SeqGenElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'SeqGenElm', 425);
|
|
function $clinit_SevenSegDecoderElm(){
|
|
$clinit_SevenSegDecoderElm = emptyMethod;
|
|
$clinit_ChipElm();
|
|
symbols = stampJavaTypeInfo(getClassLiteralForArray(Z_classLit, 2), $intern_3, 26, 0, [stampJavaTypeInfo(getClassLiteralForArray(Z_classLit, 1), $intern_95, 7, 16, [true, true, true, true, true, true, false]), stampJavaTypeInfo(getClassLiteralForArray(Z_classLit, 1), $intern_95, 7, 16, [false, true, true, false, false, false, false]), stampJavaTypeInfo(getClassLiteralForArray(Z_classLit, 1), $intern_95, 7, 16, [true, true, false, true, true, false, true]), stampJavaTypeInfo(getClassLiteralForArray(Z_classLit, 1), $intern_95, 7, 16, [true, true, true, true, false, false, true]), stampJavaTypeInfo(getClassLiteralForArray(Z_classLit, 1), $intern_95, 7, 16, [false, true, true, false, false, true, true]), stampJavaTypeInfo(getClassLiteralForArray(Z_classLit, 1), $intern_95, 7, 16, [true, false, true, true, false, true, true]), stampJavaTypeInfo(getClassLiteralForArray(Z_classLit, 1), $intern_95, 7, 16, [true, false, true, true, true, true, true]), stampJavaTypeInfo(getClassLiteralForArray(Z_classLit, 1), $intern_95, 7, 16, [true, true, true, false, false, false, false]), stampJavaTypeInfo(getClassLiteralForArray(Z_classLit, 1), $intern_95, 7, 16, [true, true, true, true, true, true, true]), stampJavaTypeInfo(getClassLiteralForArray(Z_classLit, 1), $intern_95, 7, 16, [true, true, true, false, false, true, true]), stampJavaTypeInfo(getClassLiteralForArray(Z_classLit, 1), $intern_95, 7, 16, [true, true, true, false, true, true, true]), stampJavaTypeInfo(getClassLiteralForArray(Z_classLit, 1), $intern_95, 7, 16, [false, false, true, true, true, true, true]), stampJavaTypeInfo(getClassLiteralForArray(Z_classLit, 1), $intern_95, 7, 16, [true, false, false, true, true, true, false]), stampJavaTypeInfo(getClassLiteralForArray(Z_classLit, 1), $intern_95, 7, 16, [false, true, true, true, true, false, true]), stampJavaTypeInfo(getClassLiteralForArray(Z_classLit, 1), $intern_95, 7, 16, [true, false, false, true, true, true, true]), stampJavaTypeInfo(getClassLiteralForArray(Z_classLit, 1), $intern_95, 7, 16, [true, false, false, false, true, true, true])]);
|
|
symbols14 = stampJavaTypeInfo(getClassLiteralForArray(Z_classLit, 2), $intern_3, 26, 0, [stampJavaTypeInfo(getClassLiteralForArray(Z_classLit, 1), $intern_95, 7, 16, [true, true, true, true, true, true, false, false, true, false, false, false, true, false]), stampJavaTypeInfo(getClassLiteralForArray(Z_classLit, 1), $intern_95, 7, 16, [false, true, true, false, false, false, false, false, true, false, false, false, false, false]), stampJavaTypeInfo(getClassLiteralForArray(Z_classLit, 1), $intern_95, 7, 16, [true, true, false, true, true, false, false, false, false, true, false, false, false, true]), stampJavaTypeInfo(getClassLiteralForArray(Z_classLit, 1), $intern_95, 7, 16, [true, true, true, true, false, false, false, false, false, true, false, false, false, true]), stampJavaTypeInfo(getClassLiteralForArray(Z_classLit, 1), $intern_95, 7, 16, [false, true, true, false, false, true, false, false, false, true, false, false, false, true]), stampJavaTypeInfo(getClassLiteralForArray(Z_classLit, 1), $intern_95, 7, 16, [true, false, true, true, false, true, false, false, false, true, false, false, false, true]), stampJavaTypeInfo(getClassLiteralForArray(Z_classLit, 1), $intern_95, 7, 16, [true, false, true, true, true, true, false, false, false, true, false, false, false, true]), stampJavaTypeInfo(getClassLiteralForArray(Z_classLit, 1), $intern_95, 7, 16, [true, false, false, false, false, false, false, false, true, false, false, true, false, false]), stampJavaTypeInfo(getClassLiteralForArray(Z_classLit, 1), $intern_95, 7, 16, [true, true, true, true, true, true, false, false, false, true, false, false, false, true]), stampJavaTypeInfo(getClassLiteralForArray(Z_classLit, 1), $intern_95, 7, 16, [true, true, true, true, false, true, false, false, false, true, false, false, false, true]), stampJavaTypeInfo(getClassLiteralForArray(Z_classLit, 1), $intern_95, 7, 16, [true, true, true, false, true, true, false, false, false, true, false, false, false, true]), stampJavaTypeInfo(getClassLiteralForArray(Z_classLit, 1), $intern_95, 7, 16, [true, true, true, true, false, false, false, true, false, true, false, true, false, false]), stampJavaTypeInfo(getClassLiteralForArray(Z_classLit, 1), $intern_95, 7, 16, [true, false, false, true, true, true, false, false, false, false, false, false, false, false]), stampJavaTypeInfo(getClassLiteralForArray(Z_classLit, 1), $intern_95, 7, 16, [true, true, true, true, false, false, false, true, false, false, false, true, false, false]), stampJavaTypeInfo(getClassLiteralForArray(Z_classLit, 1), $intern_95, 7, 16, [true, false, false, true, true, true, false, false, false, true, false, false, false, true]), stampJavaTypeInfo(getClassLiteralForArray(Z_classLit, 1), $intern_95, 7, 16, [true, false, false, false, true, true, false, false, false, true, false, false, false, true])]);
|
|
symbols16 = stampJavaTypeInfo(getClassLiteralForArray(Z_classLit, 2), $intern_3, 26, 0, [stampJavaTypeInfo(getClassLiteralForArray(Z_classLit, 1), $intern_95, 7, 16, [true, true, true, true, true, true, true, true, false, false, true, false, false, false, true, false]), stampJavaTypeInfo(getClassLiteralForArray(Z_classLit, 1), $intern_95, 7, 16, [false, false, true, true, false, false, false, false, false, false, true, false, false, false, false, false]), stampJavaTypeInfo(getClassLiteralForArray(Z_classLit, 1), $intern_95, 7, 16, [true, true, true, false, true, true, true, false, false, false, false, true, false, false, false, true]), stampJavaTypeInfo(getClassLiteralForArray(Z_classLit, 1), $intern_95, 7, 16, [true, true, true, true, true, true, false, false, false, false, false, true, false, false, false, true]), stampJavaTypeInfo(getClassLiteralForArray(Z_classLit, 1), $intern_95, 7, 16, [false, false, true, true, false, false, false, true, false, false, false, true, false, false, false, true]), stampJavaTypeInfo(getClassLiteralForArray(Z_classLit, 1), $intern_95, 7, 16, [true, true, false, true, true, true, false, true, false, false, false, true, false, false, false, true]), stampJavaTypeInfo(getClassLiteralForArray(Z_classLit, 1), $intern_95, 7, 16, [true, true, false, true, true, true, true, true, false, false, false, true, false, false, false, true]), stampJavaTypeInfo(getClassLiteralForArray(Z_classLit, 1), $intern_95, 7, 16, [true, true, false, false, false, false, false, false, false, false, true, false, false, true, false, false]), stampJavaTypeInfo(getClassLiteralForArray(Z_classLit, 1), $intern_95, 7, 16, [true, true, true, true, true, true, true, true, false, false, false, true, false, false, false, true]), stampJavaTypeInfo(getClassLiteralForArray(Z_classLit, 1), $intern_95, 7, 16, [true, true, true, true, true, true, false, true, false, false, false, true, false, false, false, true]), stampJavaTypeInfo(getClassLiteralForArray(Z_classLit, 1), $intern_95, 7, 16, [true, true, true, true, false, false, true, true, false, false, false, true, false, false, false, true]), stampJavaTypeInfo(getClassLiteralForArray(Z_classLit, 1), $intern_95, 7, 16, [true, true, true, true, true, true, false, false, false, true, false, true, false, true, false, false]), stampJavaTypeInfo(getClassLiteralForArray(Z_classLit, 1), $intern_95, 7, 16, [true, true, false, false, true, true, true, true, false, false, false, false, false, false, false, false]), stampJavaTypeInfo(getClassLiteralForArray(Z_classLit, 1), $intern_95, 7, 16, [true, true, true, true, true, true, false, false, false, true, false, false, false, true, false, false]), stampJavaTypeInfo(getClassLiteralForArray(Z_classLit, 1), $intern_95, 7, 16, [true, true, false, false, true, true, true, true, false, false, false, true, false, false, false, true]), stampJavaTypeInfo(getClassLiteralForArray(Z_classLit, 1), $intern_95, 7, 16, [true, true, false, false, false, false, true, true, false, false, false, true, false, false, false, true])]);
|
|
}
|
|
|
|
function $getSegmentCount(this$static){
|
|
if (this$static.segmentType == 1)
|
|
return 14;
|
|
if (this$static.segmentType == 2)
|
|
return 16;
|
|
return 7;
|
|
}
|
|
|
|
function $setupPins_20(this$static){
|
|
var i, inputPinsY, outputPinsY, segCount, segCount0;
|
|
segCount0 = $getSegmentCount(this$static);
|
|
this$static.bits = 4;
|
|
this$static.sizeX = 3;
|
|
inputPinsY = this$static.bitOrder == 2?1:4;
|
|
outputPinsY = this$static.bitOrder == 2?1:segCount0;
|
|
this$static.sizeY = $wnd.Math.max(outputPinsY, inputPinsY + ((this$static.flags & 2) != 0?1:0));
|
|
this$static.pins = initUnidimensionalArray(Lcom_lushprojects_circuitjs1_client_ChipElm$Pin_2_classLit, $intern_3, 9, (segCount = $getSegmentCount(this$static) , segCount + 4 + ((this$static.flags & 2) != 0?1:0)), 0, 1);
|
|
$makeBitPins(this$static, 4, 0, 2, segCount0, 'I', false, false, true);
|
|
if (this$static.bitOrder == 2) {
|
|
$makeBitPins(this$static, segCount0, 0, 3, 0, 'seg', true, false, false);
|
|
}
|
|
else {
|
|
for (i = 0; i < segCount0; i++) {
|
|
this$static.pins[i] = new ChipElm$Pin(this$static, i, 3, String.fromCharCode(97 + i & $intern_8));
|
|
this$static.pins[i].output = true;
|
|
}
|
|
}
|
|
if ((this$static.flags & 2) != 0) {
|
|
this$static.pins[segCount0 + 4] = new ChipElm$Pin(this$static, inputPinsY, 2, 'BI');
|
|
this$static.pins[segCount0 + 4].bubble = true;
|
|
}
|
|
$allocNodes(this$static);
|
|
}
|
|
|
|
function SevenSegDecoderElm(xx, yy){
|
|
$clinit_SevenSegDecoderElm();
|
|
ChipElm.call(this, xx, yy);
|
|
}
|
|
|
|
function SevenSegDecoderElm_0(xa, ya, xb, yb, f, st){
|
|
$clinit_SevenSegDecoderElm();
|
|
ChipElm_0.call(this, xa, ya, xb, yb, f, st);
|
|
try {
|
|
this.segmentType = __parseAndValidateInt($nextToken(st), 10);
|
|
$setupPins_20(this);
|
|
$setPoints_0(this);
|
|
}
|
|
catch ($e0) {
|
|
$e0 = toJava($e0);
|
|
if (!instanceOf($e0, 13))
|
|
throw toJs($e0);
|
|
}
|
|
}
|
|
|
|
defineClass(430, 32, $intern_85, SevenSegDecoderElm, SevenSegDecoderElm_0);
|
|
_.allowBus = function allowBus_9(){
|
|
return true;
|
|
}
|
|
;
|
|
_.dumpXml = function dumpXml_74(doc, elem){
|
|
$dumpXml_0(this, elem);
|
|
dumpAttr_0(elem, 'sgt', this.segmentType);
|
|
}
|
|
;
|
|
_.execute_3 = function execute_45(){
|
|
var en, i, input_0, segCount, sym;
|
|
segCount = $getSegmentCount(this);
|
|
input_0 = 0;
|
|
this.pins[segCount].value_0 && (input_0 += 8);
|
|
this.pins[segCount + 1].value_0 && (input_0 += 4);
|
|
this.pins[segCount + 2].value_0 && (input_0 += 2);
|
|
this.pins[segCount + 3].value_0 && (input_0 += 1);
|
|
en = true;
|
|
(this.flags & 2) != 0 && !this.pins[segCount + 4].value_0 && (en = false);
|
|
if (!en || input_0 == 15 && (this.flags & 4) != 0) {
|
|
for (i = 0; i != segCount; i++) {
|
|
this.pins[i].output || (console.log('pin ' + i + ' is not an output!') , undefined);
|
|
this.pins[i].value_0 = false;
|
|
}
|
|
}
|
|
else {
|
|
sym = segCount == 14?symbols14:segCount == 16?symbols16:symbols;
|
|
for (i = 0; i < segCount; i++)
|
|
$writeOutput(this, i, sym[input_0][i]);
|
|
}
|
|
}
|
|
;
|
|
_.getChipEditInfo = function getChipEditInfo_22(n){
|
|
var ei;
|
|
if (n == 0) {
|
|
ei = new EditInfo_0('Segments', 0, -1, -1);
|
|
ei.choice = new Choice;
|
|
$addItem(ei.choice, LS('7 Segment'));
|
|
$addItem(ei.choice, LS('14 Segment'));
|
|
$addItem(ei.choice, LS('16 Segment'));
|
|
$select(ei.choice, this.segmentType);
|
|
return ei;
|
|
}
|
|
if (n == 1) {
|
|
ei = new EditInfo_0('', 0, -1, -1);
|
|
ei.checkbox = new Checkbox_0('Blank Pin', (this.flags & 2) != 0);
|
|
return ei;
|
|
}
|
|
if (n == 2) {
|
|
ei = new EditInfo_0('', 0, -1, -1);
|
|
ei.checkbox = new Checkbox_0('Blank on 1111', (this.flags & 4) != 0);
|
|
return ei;
|
|
}
|
|
return null;
|
|
}
|
|
;
|
|
_.getChipName = function getChipName_27(){
|
|
if ($getSegmentCount(this) == 7)
|
|
return '7-Segment Decoder';
|
|
if ($getSegmentCount(this) == 14)
|
|
return '14-Segment Decoder';
|
|
return '16-Segment Decoder';
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_96(){
|
|
return 197;
|
|
}
|
|
;
|
|
_.getPostCount_0 = function getPostCount_65(){
|
|
var segCount;
|
|
return segCount = $getSegmentCount(this) , segCount + 4 + ((this.flags & 2) != 0?1:0);
|
|
}
|
|
;
|
|
_.getVoltageSourceCount = function getVoltageSourceCount_46(){
|
|
return $getSegmentCount(this);
|
|
}
|
|
;
|
|
_.needsBits = function needsBits_10(){
|
|
return false;
|
|
}
|
|
;
|
|
_.setChipEditValue = function setChipEditValue_23(n, ei){
|
|
if (n == 0) {
|
|
this.segmentType = $getElement(ei.choice).selectedIndex;
|
|
$setupPins_20(this);
|
|
$setPoints_0(this);
|
|
return;
|
|
}
|
|
if (n == 1) {
|
|
this.flags = $changeFlag(ei, this.flags, 2);
|
|
$setupPins_20(this);
|
|
$setPoints_0(this);
|
|
return;
|
|
}
|
|
n == 2 && (this.flags = $changeFlag(ei, this.flags, 4));
|
|
}
|
|
;
|
|
_.setupPins = function setupPins_28(){
|
|
$setupPins_20(this);
|
|
}
|
|
;
|
|
_.undumpXml = function undumpXml_77(xml){
|
|
$undumpXml_0(this, xml);
|
|
this.segmentType = $parseIntAttr(xml, 'sgt', this.segmentType);
|
|
$setupPins_20(this);
|
|
}
|
|
;
|
|
_.segmentType = 0;
|
|
var symbols, symbols14, symbols16;
|
|
var Lcom_lushprojects_circuitjs1_client_SevenSegDecoderElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'SevenSegDecoderElm', 430);
|
|
function $clinit_SevenSegElm(){
|
|
$clinit_SevenSegElm = emptyMethod;
|
|
$clinit_ChipElm();
|
|
display7 = stampJavaTypeInfo(getClassLiteralForArray(I_classLit, 1), $intern_25, 7, 15, [0, 0, 2, 0, 2, 0, 2, 1, 2, 1, 2, 2, 0, 2, 2, 2, 0, 1, 0, 2, 0, 0, 0, 1, 0, 1, 2, 1]);
|
|
display16 = stampJavaTypeInfo(getClassLiteralForArray(I_classLit, 1), $intern_25, 7, 15, [0, 0, 1, 0, 1, 0, 2, 0, 2, 0, 2, 1, 2, 1, 2, 2, 2, 2, 1, 2, 1, 2, 0, 2, 0, 2, 0, 1, 0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 2, 0, 1, 1, 1, 1, 2, 1, 1, 1, 2, 2, 1, 1, 1, 2, 1, 1, 0, 2, 0, 1, 1, 1]);
|
|
display14 = stampJavaTypeInfo(getClassLiteralForArray(I_classLit, 1), $intern_25, 7, 15, [0, 0, 2, 0, 2, 0, 2, 1, 2, 1, 2, 2, 2, 2, 0, 2, 0, 2, 0, 1, 0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 2, 0, 1, 1, 1, 1, 2, 1, 1, 1, 2, 2, 1, 1, 1, 2, 1, 1, 0, 2, 0, 1, 1, 1]);
|
|
}
|
|
|
|
function $drawDecimal(g, x_0, y_0, sp){
|
|
g.context.beginPath();
|
|
$moveTo(g.context, x_0, y_0 - sp);
|
|
$lineTo(g.context, x_0 - sp, y_0);
|
|
$lineTo(g.context, x_0, y_0 + sp);
|
|
$lineTo(g.context, x_0 + sp, y_0);
|
|
$lineTo(g.context, x_0, y_0 - sp);
|
|
g.context.fill();
|
|
}
|
|
|
|
function $drawSegment_0(g, p1, p2, thick){
|
|
var dn, p3, p4, p5, p6;
|
|
g.context.beginPath();
|
|
p3 = new Point_1;
|
|
p4 = new Point_1;
|
|
p5 = new Point_1;
|
|
p6 = new Point_1;
|
|
dn = hypot(p1.x_0 - p2.x_0, p1.y_0 - p2.y_0);
|
|
$interpPoint2(p1, p2, p3, p4, thick / dn, thick);
|
|
$interpPoint2(p1, p2, p5, p6, 1 - thick / dn, thick);
|
|
$moveTo(g.context, p1.x_0, p1.y_0);
|
|
$lineTo(g.context, p3.x_0, p3.y_0);
|
|
$lineTo(g.context, p5.x_0, p5.y_0);
|
|
$lineTo(g.context, p2.x_0, p2.y_0);
|
|
$lineTo(g.context, p6.x_0, p6.y_0);
|
|
$lineTo(g.context, p4.x_0, p4.y_0);
|
|
$lineTo(g.context, p1.x_0, p1.y_0);
|
|
g.context.fill();
|
|
}
|
|
|
|
function $setColor_3(this$static, g, p){
|
|
var cc, minw, w, whiteBkg, wi;
|
|
whiteBkg = app_0.menus.printableCheckItem.on;
|
|
if (this$static.diodeDirection == 0) {
|
|
$setColor_0(g, this$static.pins[p].value_0?($clinit_Color() , red):whiteBkg?this$static.lightgray:this$static.darkred);
|
|
return;
|
|
}
|
|
w = -this$static.diodeDirection * this$static.pins[p].current / $intern_34;
|
|
w > 0 && (w = 255 * (1 + 0.2 * $wnd.Math.log(w)));
|
|
w > 255 && (w = 255);
|
|
minw = whiteBkg?5:30;
|
|
w < minw && (w = minw);
|
|
wi = round_int(w);
|
|
cc = whiteBkg?new Color(255, 255 - wi, 255 - wi):new Color(wi, 0, 0);
|
|
$setColor_0(g, cc);
|
|
}
|
|
|
|
function $setPinCount(this$static){
|
|
this$static.segmentCount = this$static.baseSegmentCount;
|
|
this$static.extraSegment > 0 && ++this$static.segmentCount;
|
|
if (this$static.diodeDirection == 0) {
|
|
this$static.pinCount = this$static.segmentCount;
|
|
this$static.commonPin = -1;
|
|
}
|
|
else {
|
|
this$static.pinCount = this$static.segmentCount + 1;
|
|
this$static.commonPin = this$static.pinCount - 1;
|
|
}
|
|
$allocNodes(this$static);
|
|
$setupPins_21(this$static);
|
|
$setPoints_0(this$static);
|
|
}
|
|
|
|
function $setupPins_21(this$static){
|
|
var backwardCompatibility, i, s, segmentPinsOnLeftSide, side;
|
|
if (this$static.pinCount == 0)
|
|
return;
|
|
this$static.darkred = new Color(30, 0, 0);
|
|
this$static.lightgray = new Color(245, 245, 245);
|
|
this$static.bits = this$static.segmentCount;
|
|
if (this$static.bitOrder == 2) {
|
|
this$static.sizeX = this$static.baseSegmentCount == 7?4:5;
|
|
this$static.sizeY = this$static.baseSegmentCount == 7?4:6;
|
|
this$static.pins = initUnidimensionalArray(Lcom_lushprojects_circuitjs1_client_ChipElm$Pin_2_classLit, $intern_3, 9, this$static.pinCount, 0, 1);
|
|
$makeBitPins(this$static, this$static.segmentCount, 0, 2, 0, 'I', false, false, false);
|
|
this$static.commonPin > 0 && (this$static.pins[this$static.commonPin] = new ChipElm$Pin(this$static, 1, 2, this$static.diodeDirection == 1?'gnd':'Vcc'));
|
|
}
|
|
else {
|
|
segmentPinsOnLeftSide = (this$static.baseSegmentCount + 1) / 2 | 0;
|
|
this$static.sizeY = segmentPinsOnLeftSide;
|
|
if (this$static.baseSegmentCount == 7) {
|
|
this$static.sizeX = 4;
|
|
this$static.pinCount > 7 && (this$static.sizeX = 5);
|
|
}
|
|
else
|
|
this$static.sizeX = 5;
|
|
this$static.pinCount > this$static.sizeY * 2 && ++this$static.sizeY;
|
|
this$static.pins = initUnidimensionalArray(Lcom_lushprojects_circuitjs1_client_ChipElm$Pin_2_classLit, $intern_3, 9, this$static.pinCount, 0, 1);
|
|
for (i = 0; i != segmentPinsOnLeftSide; i++)
|
|
this$static.pins[i] = new ChipElm$Pin(this$static, i, 2, String.fromCharCode(97 + i & $intern_8));
|
|
backwardCompatibility = this$static.segmentCount == 7 && this$static.diodeDirection == 0 && this$static.extraSegment == 0;
|
|
s = backwardCompatibility?1:0;
|
|
for (; i != this$static.segmentCount; i++)
|
|
this$static.pins[i] = new ChipElm$Pin(this$static, s++, backwardCompatibility?1:3, String.fromCharCode(97 + i & $intern_8));
|
|
this$static.extraSegment == 1 && (this$static.pins[this$static.segmentCount - 1].text_0 = 'dp');
|
|
if (this$static.commonPin > 0) {
|
|
side = 3;
|
|
if (this$static.segmentCount != 7) {
|
|
side = 2;
|
|
s = segmentPinsOnLeftSide;
|
|
}
|
|
this$static.pins[this$static.commonPin] = new ChipElm$Pin(this$static, s++, side, this$static.diodeDirection == 1?'gnd':'Vcc');
|
|
}
|
|
}
|
|
}
|
|
|
|
function SevenSegElm(xx, yy){
|
|
$clinit_SevenSegElm();
|
|
ChipElm.call(this, xx, yy);
|
|
this.baseSegmentCount = this.segmentCount = 7;
|
|
this.diodeDirection = 0;
|
|
$setPinCount(this);
|
|
}
|
|
|
|
function SevenSegElm_0(xa, ya, xb, yb, f, st){
|
|
$clinit_SevenSegElm();
|
|
ChipElm_0.call(this, xa, ya, xb, yb, f, st);
|
|
this.baseSegmentCount = this.segmentCount = 7;
|
|
this.diodeDirection = 0;
|
|
try {
|
|
this.baseSegmentCount = __parseAndValidateInt($nextToken(st), 10);
|
|
this.extraSegment = __parseAndValidateInt($nextToken(st), 10);
|
|
this.diodeDirection = __parseAndValidateInt($nextToken(st), 10);
|
|
}
|
|
catch ($e0) {
|
|
$e0 = toJava($e0);
|
|
if (!instanceOf($e0, 13))
|
|
throw toJs($e0);
|
|
}
|
|
$setPinCount(this);
|
|
}
|
|
|
|
defineClass(444, 32, $intern_85, SevenSegElm, SevenSegElm_0);
|
|
_.allowBus = function allowBus_10(){
|
|
return this.diodeDirection == 0;
|
|
}
|
|
;
|
|
_.calculateCurrent = function calculateCurrent_31(){
|
|
var i, i0;
|
|
if (this.diodeDirection == 0 || this.diodes == null) {
|
|
for (i0 = 0; i0 != this.pinCount; i0++)
|
|
this.pins[i0].current = 0;
|
|
return;
|
|
}
|
|
this.pins[this.commonPin].current = 0;
|
|
for (i = 0; i != this.segmentCount; i++) {
|
|
this.pins[i].current = -this.diodeDirection * $calculateCurrent_0(this.diodes[i], this.diodeDirection * (this.volts[i] - this.volts[this.commonPin]));
|
|
this.pins[this.commonPin].current -= this.pins[i].current;
|
|
}
|
|
}
|
|
;
|
|
_.doStep = function doStep_45(){
|
|
var i;
|
|
$doStep(this);
|
|
if (this.diodeDirection == 0)
|
|
return;
|
|
for (i = 0; i != this.segmentCount; i++)
|
|
$doStep_0(this.diodes[i], this.diodeDirection * (this.volts[i] - this.volts[this.commonPin]));
|
|
}
|
|
;
|
|
_.draw = function draw_71(g){
|
|
var diag, disp, dist, dpsize, i, i4, spx, spy, step, thick, xl, yl;
|
|
$drawChip(this, g);
|
|
$setColor_0(g, ($clinit_Color() , red));
|
|
spx = this.cspc * 2;
|
|
this.extraSegment != 0 && (spx = round_int(spx * 0.9));
|
|
(this.sizeY <= 4 || (this.flags & $intern_42) != 0) && (spx = spx / 2 | 0);
|
|
spy = spx * 2;
|
|
xl = this.x_0 + this.cspc + this.flippedSizeX * this.cspc - spx;
|
|
yl = this.y_0 - this.cspc + this.flippedSizeY * this.cspc - spy;
|
|
this.sizeY <= 4 && (this.flags & 6144) != 0 && (yl += 10);
|
|
disp = this.baseSegmentCount == 7?display7:this.baseSegmentCount == 14?display14:display16;
|
|
thick = this.sizeY <= 4?5:spx / 6 | 0;
|
|
dpsize = this.sizeY <= 4?7:(this.flags & $intern_42) != 0?3:7;
|
|
for (step = 0; step != 2; step++)
|
|
for (i = 0; i != this.segmentCount; i++) {
|
|
i4 = i * 4;
|
|
diag = disp[i4] !== disp[i4 + 2] && disp[i4 + 1] !== disp[i4 + 3];
|
|
if (diag != (step == 0))
|
|
continue;
|
|
$setColor_3(this, g, i);
|
|
$drawSegment_0(g, new Point_2(xl + disp[i4] * spx, yl + disp[i4 + 1] * spy), new Point_2(xl + disp[i4 + 2] * spx, yl + disp[i4 + 3] * spy), thick);
|
|
}
|
|
if (this.extraSegment == 1) {
|
|
$setColor_3(this, g, this.baseSegmentCount);
|
|
dist = round_int($wnd.Math.max(spx * 1.5, spx + 12));
|
|
$drawDecimal(g, xl + spx + dist, yl + spy * 2, dpsize);
|
|
}
|
|
if (this.extraSegment == 2) {
|
|
$setColor_3(this, g, this.baseSegmentCount);
|
|
dist = round_int($wnd.Math.max(spx * 1.5, spx + 14));
|
|
$drawDecimal(g, xl + spx + dist, yl + round_int(spy * 0.5), dpsize);
|
|
$drawDecimal(g, xl + spx + dist, yl + round_int(spy * 1.5), dpsize);
|
|
}
|
|
}
|
|
;
|
|
_.dumpXml = function dumpXml_75(doc, elem){
|
|
$dumpXml_0(this, elem);
|
|
dumpAttr_0(elem, 'ba', this.baseSegmentCount);
|
|
dumpAttr_0(elem, 'ex', this.extraSegment);
|
|
dumpAttr_0(elem, 'di', this.diodeDirection);
|
|
}
|
|
;
|
|
_.getChipEditInfo = function getChipEditInfo_23(n){
|
|
var ei;
|
|
if (n == 0) {
|
|
ei = new EditInfo_0('Segments', 0, -1, -1);
|
|
ei.choice = new Choice;
|
|
$addItem(ei.choice, LS('7 Segment'));
|
|
$addItem(ei.choice, LS('14 Segment'));
|
|
$addItem(ei.choice, LS('16 Segment'));
|
|
$select(ei.choice, this.baseSegmentCount == 7?0:this.baseSegmentCount == 14?1:2);
|
|
return ei;
|
|
}
|
|
if (n == 1) {
|
|
ei = new EditInfo_0('Extra Segment', 0, -1, -1);
|
|
ei.choice = new Choice;
|
|
$addItem(ei.choice, LS('None'));
|
|
$addItem(ei.choice, LS('Decimal Point'));
|
|
$addItem(ei.choice, LS('Colon'));
|
|
$select(ei.choice, this.extraSegment);
|
|
return ei;
|
|
}
|
|
if (n == 2) {
|
|
ei = new EditInfo_0('Diodes', 0, -1, -1);
|
|
ei.choice = new Choice;
|
|
$addItem(ei.choice, LS('Common Cathode'));
|
|
$addItem(ei.choice, LS('Common Anode'));
|
|
$addItem(ei.choice, LS('None (logic inputs)'));
|
|
$select(ei.choice, this.diodeDirection == 1?0:this.diodeDirection == -1?1:2);
|
|
return ei;
|
|
}
|
|
return null;
|
|
}
|
|
;
|
|
_.getChipName = function getChipName_28(){
|
|
return this.segmentCount + '-segment display';
|
|
}
|
|
;
|
|
_.getConnection = function getConnection_35(n1, n2){
|
|
return this.diodeDirection != 0;
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_97(){
|
|
return 157;
|
|
}
|
|
;
|
|
_.getPostCount_0 = function getPostCount_66(){
|
|
return this.pinCount;
|
|
}
|
|
;
|
|
_.getVoltageSourceCount = function getVoltageSourceCount_47(){
|
|
return 0;
|
|
}
|
|
;
|
|
_.getXmlDumpType = function getXmlDumpType_24(){
|
|
return 'ssd';
|
|
}
|
|
;
|
|
_.isDigitalChip = function isDigitalChip_5(){
|
|
return false;
|
|
}
|
|
;
|
|
_.nonLinear_0 = function nonLinear_23(){
|
|
return this.diodeDirection != 0;
|
|
}
|
|
;
|
|
_.setChipEditValue = function setChipEditValue_24(n, ei){
|
|
var ix;
|
|
if (n == 0) {
|
|
ix = $getElement(ei.choice).selectedIndex;
|
|
this.baseSegmentCount = ix == 0?7:ix == 1?14:16;
|
|
$setPinCount(this);
|
|
return;
|
|
}
|
|
if (n == 1) {
|
|
this.extraSegment = $getElement(ei.choice).selectedIndex;
|
|
$setPinCount(this);
|
|
return;
|
|
}
|
|
if (n == 2) {
|
|
ix = $getElement(ei.choice).selectedIndex;
|
|
this.diodeDirection = ix == 0?1:ix == 1?-1:0;
|
|
$setPinCount(this);
|
|
return;
|
|
}
|
|
}
|
|
;
|
|
_.setupPins = function setupPins_29(){
|
|
$setupPins_21(this);
|
|
}
|
|
;
|
|
_.stamp = function stamp_58(){
|
|
var i, model;
|
|
$stamp(this);
|
|
if (this.diodeDirection == 0)
|
|
return;
|
|
this.diodes = initUnidimensionalArray(Lcom_lushprojects_circuitjs1_client_Diode_2_classLit, $intern_3, 130, this.segmentCount, 0, 1);
|
|
model = getModelWithName_1('default-led');
|
|
for (i = 0; i != this.segmentCount; i++) {
|
|
this.diodes[i] = new Diode(sim_0);
|
|
$setup(this.diodes[i], model);
|
|
this.diodeDirection == 1?$stamp_0(this.diodes[i], this.nodes[i], this.nodes[this.commonPin]):$stamp_0(this.diodes[i], this.nodes[this.commonPin], this.nodes[i]);
|
|
}
|
|
}
|
|
;
|
|
_.stepFinished = function stepFinished_21(){
|
|
this.commonPin > 0 && $wnd.Math.abs(this.pins[this.commonPin].current) > $intern_81 && $stop(sim_0, 'max current exceeded', this);
|
|
}
|
|
;
|
|
_.undumpXml = function undumpXml_78(xml){
|
|
$undumpXml_0(this, xml);
|
|
this.baseSegmentCount = $parseIntAttr(xml, 'ba', this.baseSegmentCount);
|
|
this.extraSegment = $parseIntAttr(xml, 'ex', this.extraSegment);
|
|
this.diodeDirection = $parseIntAttr(xml, 'di', this.diodeDirection);
|
|
$setPinCount(this);
|
|
}
|
|
;
|
|
_.baseSegmentCount = 0;
|
|
_.commonPin = 0;
|
|
_.diodeDirection = 0;
|
|
_.extraSegment = 0;
|
|
_.pinCount = 0;
|
|
_.segmentCount = 0;
|
|
var display14, display16, display7;
|
|
var Lcom_lushprojects_circuitjs1_client_SevenSegElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'SevenSegElm', 444);
|
|
function $checkForDuplicates(this$static){
|
|
var box, boxForShortcut, c, i, other, result, str;
|
|
boxForShortcut = new HashMap;
|
|
result = false;
|
|
for (i = 0; i != this$static.textBoxes.arrayList.array.length; i++) {
|
|
box = $get_4(this$static.textBoxes, i);
|
|
str = $get_4(this$static.shortcuts, i);
|
|
if (str.length == 0) {
|
|
($clinit_DOM() , box.element).style['color'] = 'black';
|
|
continue;
|
|
}
|
|
c = valueOf((checkCriticalStringElementIndex(0, str.length) , str.charCodeAt(0)));
|
|
other = getEntryValueOrNull($getEntry(boxForShortcut.hashCodeMap, c));
|
|
if (other) {
|
|
($clinit_DOM() , box.element).style['color'] = 'red';
|
|
other.element.style['color'] = 'red';
|
|
result = true;
|
|
}
|
|
else {
|
|
($clinit_DOM() , box.element).style['color'] = 'black';
|
|
}
|
|
$put_1(boxForShortcut.hashCodeMap, c, box);
|
|
}
|
|
$setEnabled(this$static.okButton, !result);
|
|
return result;
|
|
}
|
|
|
|
function $enterPressed_0(this$static){
|
|
var i, item_0, menuItemIndex, str;
|
|
if ($checkForDuplicates(this$static))
|
|
return;
|
|
$reset_13(this$static.sim.shortcuts);
|
|
for (i = 0; i != this$static.shortcuts.arrayList.array.length; i++) {
|
|
str = $get_4(this$static.shortcuts, i);
|
|
menuItemIndex = $get_4(this$static.rowMenuItemIndex, i).value_0;
|
|
if (menuItemIndex >= 0) {
|
|
item_0 = $get_4(this$static.ui.mainMenuItems, menuItemIndex);
|
|
item_0.shortcut = str;
|
|
str.length > 0 && $put_0(this$static.sim.shortcuts, valueOf_0((checkCriticalStringElementIndex(0, str.length) , str.charCodeAt(0))), $get_4(this$static.ui.mainMenuItemNames, menuItemIndex));
|
|
}
|
|
else
|
|
str.length > 0 && $put_0(this$static.sim.shortcuts, valueOf_0((checkCriticalStringElementIndex(0, str.length) , str.charCodeAt(0))), 'cmd:key:runstop');
|
|
}
|
|
$saveShortcuts(this$static.sim.ui);
|
|
$hide_0(this$static, false);
|
|
dialogShowing == this$static && (dialogShowing = null);
|
|
}
|
|
|
|
function $setRowShortcut(this$static, row, text_0, shortcut){
|
|
$set_2(this$static.shortcuts, row, shortcut);
|
|
$setText_2(text_0, displayText(shortcut));
|
|
$checkForDuplicates(this$static);
|
|
}
|
|
|
|
function ShortcutsDialog(asim){
|
|
var cancelButton, clearButton, entry, entry$iterator, hp, i, item_0, rowInitialShortcuts, rowNames, runStopShortcut, sp, table, text_0;
|
|
Dialog.call(this);
|
|
this.sim = asim;
|
|
this.ui = this.sim.ui;
|
|
this.vp = new VerticalPanel;
|
|
$setWidget_1(this, this.vp);
|
|
sp = new ScrollPanel;
|
|
$add_5(this.vp, sp);
|
|
($clinit_DOM() , sp.element).style['height'] = '400px';
|
|
sp.scrollableElem.style['overflow'] = ($clinit_Style$Overflow() , 'scroll');
|
|
$setText(this, LS('Edit Shortcuts'));
|
|
this.textBoxes = new Vector;
|
|
this.shortcuts = new Vector;
|
|
this.rowMenuItemIndex = new Vector;
|
|
rowNames = new Vector;
|
|
rowInitialShortcuts = new Vector;
|
|
for (i = 0; i != this.ui.mainMenuItems.arrayList.array.length; i++) {
|
|
item_0 = $get_4(this.ui.mainMenuItems, i);
|
|
if (item_0.shortcut.length > 1)
|
|
break;
|
|
$add_11(rowNames, item_0.name_0);
|
|
$add_11(rowInitialShortcuts, item_0.shortcut);
|
|
$add_11(this.rowMenuItemIndex, valueOf_0(i));
|
|
}
|
|
runStopShortcut = '';
|
|
for (entry$iterator = new AbstractHashMap$EntrySetIterator((new AbstractHashMap$EntrySet(this.sim.shortcuts)).this$01); entry$iterator.hasNext;) {
|
|
entry = $next_2(entry$iterator);
|
|
if ($equals_1(entry.getValue(), 'cmd:key:runstop')) {
|
|
runStopShortcut = String.fromCharCode(entry.getKey().value_0 & $intern_8);
|
|
break;
|
|
}
|
|
}
|
|
$add_11(rowNames, LS('Start/Stop Simulation'));
|
|
$add_8(rowInitialShortcuts.arrayList, runStopShortcut);
|
|
$add_11(this.rowMenuItemIndex, valueOf_0(-1));
|
|
table = new FlexTable;
|
|
$add_1(sp, table);
|
|
for (i = 0; i != rowNames.arrayList.array.length; i++) {
|
|
$setText_1(table, i, (checkArrayElementIndex(i, rowNames.arrayList.array.length) , $get_2(rowNames.arrayList, i)));
|
|
text_0 = new TextBox;
|
|
text_0.element['readOnly'] = true;
|
|
$setStyleName_0(text_0, getStylePrimaryName(text_0.element) + '-' + 'readonly', true);
|
|
$setText_2(text_0, displayText((checkArrayElementIndex(i, rowInitialShortcuts.arrayList.array.length) , $get_2(rowInitialShortcuts.arrayList, i))));
|
|
$add_11(this.shortcuts, (checkArrayElementIndex(i, rowInitialShortcuts.arrayList.array.length) , $get_2(rowInitialShortcuts.arrayList, i)));
|
|
$addDomHandler(text_0, new ShortcutsDialog$1(this, i, text_0), ($clinit_KeyDownEvent() , $clinit_KeyDownEvent() , TYPE_4));
|
|
$addDomHandler(text_0, new ShortcutsDialog$2(this, i, text_0), ($clinit_KeyPressEvent() , $clinit_KeyPressEvent() , TYPE_5));
|
|
$setWidget_2(table, i, 1, text_0);
|
|
$add_11(this.textBoxes, text_0);
|
|
clearButton = new Button_1(LS('Clear'));
|
|
$addDomHandler(clearButton, new ShortcutsDialog$3(this, i, text_0), ($clinit_ClickEvent() , $clinit_ClickEvent() , TYPE_1));
|
|
$setWidget_2(table, i, 2, clearButton);
|
|
}
|
|
hp = new HorizontalPanel;
|
|
hp.element.style['width'] = '100%';
|
|
$setHorizontalAlignment_0(hp, ($clinit_HasHorizontalAlignment() , ALIGN_LEFT));
|
|
hp.element.className = 'topSpace';
|
|
$add_5(this.vp, hp);
|
|
$add_3(hp, this.okButton = new Button_1(LS('OK')));
|
|
$setHorizontalAlignment_0(hp, ALIGN_RIGHT);
|
|
$add_3(hp, cancelButton = new Button_1(LS('Cancel')));
|
|
$addDomHandler(this.okButton, new ShortcutsDialog$4(this), ($clinit_ClickEvent() , $clinit_ClickEvent() , TYPE_1));
|
|
$addDomHandler(cancelButton, new ShortcutsDialog$5(this), (null , TYPE_1));
|
|
$center(this);
|
|
}
|
|
|
|
defineClass(689, 140, $intern_58, ShortcutsDialog);
|
|
_.enterPressed = function enterPressed_1(){
|
|
$enterPressed_0(this);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_ShortcutsDialog_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ShortcutsDialog', 689);
|
|
function $onKeyDown(this$static, ev){
|
|
var keyCode, placeholder;
|
|
keyCode = ev.nativeEvent.keyCode | 0;
|
|
placeholder = keyCodeToPlaceholder(keyCode, !!ev.nativeEvent.shiftKey, !!ev.nativeEvent.ctrlKey, !!ev.nativeEvent.altKey, !!ev.nativeEvent.metaKey);
|
|
if (placeholder >= 0) {
|
|
!!ev.nativeEvent && (ev.nativeEvent.preventDefault() , undefined);
|
|
$setRowShortcut(this$static.this$01, this$static.val$row2, this$static.val$text3, String.fromCharCode(placeholder & $intern_8));
|
|
}
|
|
else if (keyCode == 8 || keyCode == 46) {
|
|
!!ev.nativeEvent && (ev.nativeEvent.preventDefault() , undefined);
|
|
$setRowShortcut(this$static.this$01, this$static.val$row2, this$static.val$text3, '');
|
|
}
|
|
}
|
|
|
|
function ShortcutsDialog$1(this$0, val$row, val$text){
|
|
this.this$01 = this$0;
|
|
this.val$row2 = val$row;
|
|
this.val$text3 = val$text;
|
|
}
|
|
|
|
defineClass(690, 1, {1010:1, 11:1}, ShortcutsDialog$1);
|
|
_.val$row2 = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_ShortcutsDialog$1_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ShortcutsDialog/1', 690);
|
|
function ShortcutsDialog$2(this$0, val$row, val$text){
|
|
this.this$01 = this$0;
|
|
this.val$row2 = val$row;
|
|
this.val$text3 = val$text;
|
|
}
|
|
|
|
defineClass(691, 1, {1011:1, 11:1}, ShortcutsDialog$2);
|
|
_.val$row2 = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_ShortcutsDialog$2_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ShortcutsDialog/2', 691);
|
|
function ShortcutsDialog$3(this$0, val$row, val$text){
|
|
this.this$01 = this$0;
|
|
this.val$row2 = val$row;
|
|
this.val$text3 = val$text;
|
|
}
|
|
|
|
defineClass(692, 1, $intern_56, ShortcutsDialog$3);
|
|
_.onClick = function onClick_44(ev){
|
|
$setRowShortcut(this.this$01, this.val$row2, this.val$text3, '');
|
|
}
|
|
;
|
|
_.val$row2 = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_ShortcutsDialog$3_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ShortcutsDialog/3', 692);
|
|
function ShortcutsDialog$4(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(693, 1, $intern_56, ShortcutsDialog$4);
|
|
_.onClick = function onClick_45(event_0){
|
|
$enterPressed_0(this.this$01);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_ShortcutsDialog$4_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ShortcutsDialog/4', 693);
|
|
function ShortcutsDialog$5(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(694, 1, $intern_56, ShortcutsDialog$5);
|
|
_.onClick = function onClick_46(event_0){
|
|
$closeDialog(this.this$01);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_ShortcutsDialog$5_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ShortcutsDialog/5', 694);
|
|
function $addChildElms(this$static, list){
|
|
var ce, ce$iterator, childList, cn, cnl, i, nodeCount;
|
|
for (ce$iterator = new ArrayList$1(list.arrayList); ce$iterator.i < ce$iterator.this$01.array.length;) {
|
|
ce = $next_4(ce$iterator);
|
|
childList = ce.getChildElmList();
|
|
if (childList) {
|
|
$addChildElms(this$static, childList);
|
|
continue;
|
|
}
|
|
$add_11(this$static.elmList, ce);
|
|
nodeCount = ce.getPostCount_0() + ce.getInternalNodeCount();
|
|
for (i = 0; i != nodeCount; i++) {
|
|
cn = ce.nodes[i];
|
|
cnl = new CircuitNodeLink;
|
|
cnl.num = i;
|
|
cnl.elm = ce;
|
|
$addElement(cn.links_0, cnl);
|
|
cn.internal = false;
|
|
cn.index_0 == 0 && ce.setNodeVoltage(i, 0);
|
|
}
|
|
}
|
|
}
|
|
|
|
function $analyzeCircuit(this$static){
|
|
$setStopElm(this$static.app, null, null);
|
|
this$static.elmList = this$static.app.elmList;
|
|
if (this$static.elmList.arrayList.array.length == 0) {
|
|
this$static.app.postDrawList = new Vector;
|
|
this$static.app.badConnectionList = new Vector;
|
|
return;
|
|
}
|
|
$detectBusWidths(this$static, this$static.elmList);
|
|
this$static.app.ui.elmList != this$static.app.elmList && $detectBusWidths(this$static, this$static.app.ui.elmList);
|
|
$makePostDrawList(this$static);
|
|
this$static.needsStamp = true;
|
|
}
|
|
|
|
function $applySolvedRightSide(this$static, m){
|
|
var j, res, vs;
|
|
for (j = 0; j != m.size_0; j++) {
|
|
res = m.rightSide[j];
|
|
if (isNaN(res)) {
|
|
this$static.converged = false;
|
|
break;
|
|
}
|
|
j < m.nodeCount && (m.nodeVoltages[j] = res);
|
|
}
|
|
for (j = 0; j != m.voltageSourceList.arrayList.array.length; j++) {
|
|
vs = $get_4(m.voltageSourceList, j);
|
|
res = m.rightSide[vs.row - 1];
|
|
isNaN(res) || vs.elm.setCurrent(vs, res);
|
|
}
|
|
$setNodeVoltages(m, m.nodeVoltages);
|
|
}
|
|
|
|
function $assignUiWireNodes(this$static){
|
|
var ce, cn, cnl, i, i0, j, nme, pt, uiList;
|
|
uiList = this$static.app.ui.elmList;
|
|
for (i0 = 0; i0 != uiList.arrayList.array.length; i0++) {
|
|
ce = (checkArrayElementIndex(i0, uiList.arrayList.array.length) , $get_2(uiList.arrayList, i0));
|
|
if (ce.isRemovableWire())
|
|
continue;
|
|
for (j = 0; j != ce.getPostCount_0(); j++) {
|
|
pt = ce.getPost(j);
|
|
nme = $get_1(this$static.uiNodeMap, pt);
|
|
cn = ce.nodes[j];
|
|
!!nme && !nme.node && !!cn && (nme.node = cn);
|
|
if (cn) {
|
|
cnl = new CircuitNodeLink;
|
|
cnl.num = j;
|
|
cnl.elm = ce;
|
|
$addElement(cn.links_0, cnl);
|
|
}
|
|
}
|
|
}
|
|
for (i = 0; i != uiList.arrayList.array.length; i++) {
|
|
ce = (checkArrayElementIndex(i, uiList.arrayList.array.length) , $get_2(uiList.arrayList, i));
|
|
if (!ce.isRemovableWire())
|
|
continue;
|
|
for (j = 0; j != ce.getPostCount_0(); j++) {
|
|
pt = ce.getPost(j);
|
|
nme = $get_1(this$static.uiNodeMap, pt);
|
|
if (!!nme && !!nme.node) {
|
|
cn = nme.node;
|
|
ce.setNode(j, cn);
|
|
cnl = new CircuitNodeLink;
|
|
cnl.num = j;
|
|
cnl.elm = ce;
|
|
$addElement(cn.links_0, cnl);
|
|
}
|
|
else
|
|
instanceOf(ce, 193) || (console.log('missing node for ' + pt) , undefined);
|
|
}
|
|
}
|
|
}
|
|
|
|
function $calcWireCurrents(this$static){
|
|
var ce, cur, i, j, p, ws;
|
|
for (i = 0; i != this$static.wireInfoList.arrayList.array.length; i++) {
|
|
ws = $get_4(this$static.wireInfoList, i);
|
|
cur = 0;
|
|
if (ws.post == 0) {
|
|
p = ws.wire.getPost(ws.bit);
|
|
for (j = 0; j != ws.neighbors.arrayList.array.length; j++) {
|
|
ce = $get_4(ws.neighbors, j);
|
|
cur += ce.getCurrentIntoNode($getNodeAtPoint(ce, p));
|
|
}
|
|
}
|
|
else {
|
|
if (ws.endpoint1 != null && $startsWith(ws.endpoint1, 'label:')) {
|
|
if (ws.labelNeighbors)
|
|
for (j = 0; j != ws.labelNeighbors.arrayList.array.length; j++)
|
|
cur += $get_4(ws.labelNeighbors, j).current;
|
|
}
|
|
else {
|
|
p = ws.wire.getConnectedPost_0(ws.bit);
|
|
for (j = 0; j != ws.neighbors.arrayList.array.length; j++) {
|
|
ce = $get_4(ws.neighbors, j);
|
|
cur += ce.getCurrentIntoNode($getNodeAtPoint(ce, p));
|
|
}
|
|
}
|
|
}
|
|
ws.post != 0 && (cur = -cur);
|
|
ws.wire.setWireCurrent(ws.bit, cur);
|
|
ws.current = cur;
|
|
}
|
|
}
|
|
|
|
function $calcWireInfo(this$static){
|
|
var bits, ce, cn1, cnl, i, isReady0, isReady1, j, k, labelMap, labelNeighbors, list, moved, neighborBit, neighbors0, neighbors1, notReady, other, peers, pt, ptKey, wire, wk, ws;
|
|
moved = 0;
|
|
this$static.wireInfoResolved = new HashMap;
|
|
labelMap = new HashMap;
|
|
for (i = 0; i != this$static.wireInfoList.arrayList.array.length; i++) {
|
|
ws = $get_4(this$static.wireInfoList, i);
|
|
if (ws.endpoint1 != null && $startsWith(ws.endpoint1, 'label:')) {
|
|
list = $getStringValue(labelMap, ws.endpoint1);
|
|
if (!list) {
|
|
list = new Vector;
|
|
$putStringValue(labelMap, ws.endpoint1, list);
|
|
}
|
|
$add_8(list.arrayList, ws);
|
|
}
|
|
}
|
|
for (i = 0; i != this$static.wireInfoList.arrayList.array.length; i++) {
|
|
ws = $get_4(this$static.wireInfoList, i);
|
|
wire = ws.wire;
|
|
cn1 = $getNode(wire, ws.bit);
|
|
if (!cn1) {
|
|
ws.neighbors = new Vector;
|
|
ws.labelNeighbors = new Vector;
|
|
$setWireInfoResolved(this$static, wire, ws.bit);
|
|
continue;
|
|
}
|
|
neighbors0 = new Vector;
|
|
neighbors1 = new Vector;
|
|
labelNeighbors = new Vector;
|
|
isReady0 = true;
|
|
isReady1 = !instanceOf(wire, 160);
|
|
for (j = 0; j != cn1.links_0.arrayList.array.length; j++) {
|
|
cnl = $get_4(cn1.links_0, j);
|
|
ce = cnl.elm;
|
|
if (ce == wire)
|
|
continue;
|
|
if (!$contains_3(this$static.wireInfoElmSet, ce))
|
|
continue;
|
|
if (cnl.num >= ce.getPostCount_0())
|
|
continue;
|
|
pt = ce.getPost(cnl.num);
|
|
if (!pt)
|
|
continue;
|
|
ptKey = pt.x_0 + ',' + pt.y_0 + ',' + pt.z_0;
|
|
neighborBit = cnl.num % ce.getBusWidth();
|
|
notReady = ce.isRemovableWire() && (bits = $get_1(this$static.wireInfoResolved, ce) , !(!!bits && $contains_3(bits, valueOf_0(neighborBit))));
|
|
if (ws.endpoint0 != null && $equals_1(ws.endpoint0, ptKey)) {
|
|
$add_8(neighbors0.arrayList, ce);
|
|
notReady && (isReady0 = false);
|
|
}
|
|
else if (ws.endpoint1 != null && !$startsWith(ws.endpoint1, 'label:') && $equals_1(ws.endpoint1, ptKey)) {
|
|
$add_8(neighbors1.arrayList, ce);
|
|
notReady && (isReady1 = false);
|
|
}
|
|
}
|
|
if (ws.endpoint1 != null && $startsWith(ws.endpoint1, 'label:')) {
|
|
peers = $getStringValue(labelMap, ws.endpoint1);
|
|
if (peers) {
|
|
for (j = 0; j != peers.arrayList.array.length; j++) {
|
|
other = (checkArrayElementIndex(j, peers.arrayList.array.length) , $get_2(peers.arrayList, j));
|
|
if (other == ws)
|
|
continue;
|
|
notReady = !$isWireInfoResolved(this$static, other.wire, other.bit);
|
|
$add_8(labelNeighbors.arrayList, other);
|
|
notReady && (isReady1 = false);
|
|
}
|
|
}
|
|
}
|
|
if (isReady0) {
|
|
ws.neighbors = neighbors0;
|
|
ws.post = 0;
|
|
$setWireInfoResolved(this$static, wire, ws.bit);
|
|
moved = 0;
|
|
}
|
|
else if (isReady1 && (ws.endpoint1 != null || !instanceOf(wire, 160))) {
|
|
ws.neighbors = neighbors1;
|
|
ws.labelNeighbors = labelNeighbors;
|
|
ws.post = 1;
|
|
$setWireInfoResolved(this$static, wire, ws.bit);
|
|
moved = 0;
|
|
}
|
|
else {
|
|
$add_11(this$static.wireInfoList, $remove_18(this$static.wireInfoList, i--));
|
|
++moved;
|
|
if (moved > this$static.wireInfoList.arrayList.array.length * 2) {
|
|
console_1('wire loop detected, ' + this$static.wireInfoList.arrayList.array.length + ' wires total, unresolved:');
|
|
for (k = i; k < this$static.wireInfoList.arrayList.array.length; k++) {
|
|
if (k < 0)
|
|
continue;
|
|
wk = $get_4(this$static.wireInfoList, k);
|
|
console_1(' unresolved: ' + $getSimpleName(wk.wire.___clazz) + ' bit=' + wk.bit + ' ep0=' + wk.endpoint0 + ' ep1=' + wk.endpoint1 + ' resolved=' + $get_1(this$static.wireInfoResolved, wk.wire));
|
|
}
|
|
$stop(this$static, 'wire loop detected', wire);
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
|
|
function $calculateClosures(this$static){
|
|
var ce, ci, ci0, closureCount, closureIndex, cn, cnl, i, j, k, kn, m, n, nodeStr, post1, stack_0, totalNodes;
|
|
totalNodes = this$static.nodeList.arrayList.array.length;
|
|
closureIndex = initUnidimensionalArray(I_classLit, $intern_25, 7, totalNodes, 15, 1);
|
|
for (i = 1; i != totalNodes; i++)
|
|
closureIndex[i] = -1;
|
|
closureCount = 0;
|
|
for (i = 1; i != totalNodes; i++) {
|
|
if (closureIndex[i] >= 0)
|
|
continue;
|
|
stack_0 = new Vector;
|
|
$add_11(stack_0, valueOf_0(i));
|
|
closureIndex[i] = closureCount;
|
|
while (stack_0.arrayList.array.length != 0) {
|
|
n = $remove_18(stack_0, stack_0.arrayList.array.length - 1).value_0;
|
|
cn = $getCircuitNode(this$static, n);
|
|
for (j = 0; j != cn.links_0.arrayList.array.length; j++) {
|
|
cnl = $get_4(cn.links_0, j);
|
|
ce = cnl.elm;
|
|
post1 = cnl.num;
|
|
for (k = 0; k != ce.getPostCount_0() + ce.getInternalNodeCount(); k++) {
|
|
if (k == post1)
|
|
continue;
|
|
if (!ce.getMatrixConnection(post1, k))
|
|
continue;
|
|
kn = ce.nodes[k].index_0;
|
|
if (kn == 0)
|
|
continue;
|
|
if (closureIndex[kn] < 0) {
|
|
closureIndex[kn] = closureCount;
|
|
$add_11(stack_0, valueOf_0(kn));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
++closureCount;
|
|
}
|
|
closureCount == 0 && (closureCount = 1);
|
|
this$static.matrices = initUnidimensionalArray(Lcom_lushprojects_circuitjs1_client_CircuitMatrix_2_classLit, $intern_3, 285, closureCount, 0, 1);
|
|
for (i = 0; i != closureCount; i++)
|
|
this$static.matrices[i] = new CircuitMatrix;
|
|
for (i = 1; i != totalNodes; i++) {
|
|
ci0 = closureIndex[i];
|
|
if (ci0 < 0)
|
|
continue;
|
|
cn = $getCircuitNode(this$static, i);
|
|
m = this$static.matrices[ci0];
|
|
++m.nodeCount;
|
|
cn.row = m.nodeCount;
|
|
cn.matrix = m;
|
|
$add_11(m.nodeList, cn);
|
|
}
|
|
ground.row = 0;
|
|
ground.matrix = null;
|
|
for (ci = 0; ci != closureCount; ci++) {
|
|
nodeStr = '';
|
|
for (i = 1; i != totalNodes; i++) {
|
|
if (closureIndex[i] == ci) {
|
|
nodeStr.length > 0 && (nodeStr += ', ');
|
|
nodeStr += i;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
function $calculateWireClosureForList(this$static, list, uiList){
|
|
var bw, ce, cn, cn2, entry, entry$iterator, i, j, nm, p0, p1;
|
|
nm = new HashMap;
|
|
this$static.wireInfoList = new Vector;
|
|
this$static.wireInfoElmSet = new HashSet_0(list);
|
|
for (i = 0; i != list.arrayList.array.length; i++) {
|
|
ce = (checkArrayElementIndex(i, list.arrayList.array.length) , $get_2(list.arrayList, i));
|
|
if (!ce.isRemovableWire())
|
|
continue;
|
|
ce.getWireSegments(this$static.wireInfoList);
|
|
bw = ce.getBusWidth();
|
|
for (j = 0; j < bw; j++) {
|
|
p0 = ce.getPost(j);
|
|
cn = getEntryValueOrNull($getEntry(nm.hashCodeMap, p0));
|
|
p1 = uiList && instanceOf(ce, 193)?null:ce.getConnectedPost_0(j);
|
|
if (!p1) {
|
|
if (!cn) {
|
|
cn = new SimulationManager$NodeMapEntry;
|
|
$put_1(nm.hashCodeMap, p0, cn);
|
|
}
|
|
continue;
|
|
}
|
|
cn2 = getEntryValueOrNull($getEntry(nm.hashCodeMap, p1));
|
|
if (!!cn && !!cn2) {
|
|
for (entry$iterator = new AbstractHashMap$EntrySetIterator((new AbstractHashMap$EntrySet(nm)).this$01); entry$iterator.hasNext;) {
|
|
entry = $next_2(entry$iterator);
|
|
maskUndefined(entry.getValue()) === maskUndefined(cn2) && entry.setValue(cn);
|
|
}
|
|
}
|
|
else if (cn) {
|
|
$put_1(nm.hashCodeMap, p1, cn);
|
|
}
|
|
else if (cn2) {
|
|
$put_1(nm.hashCodeMap, p0, cn2);
|
|
}
|
|
else {
|
|
cn = new SimulationManager$NodeMapEntry;
|
|
$put_1(nm.hashCodeMap, p0, cn);
|
|
$put_1(nm.hashCodeMap, p1, cn);
|
|
}
|
|
}
|
|
}
|
|
uiList?(this$static.uiNodeMap = nm):(this$static.nodeMap = nm);
|
|
}
|
|
|
|
function $connectUnconnectedNodes(this$static){
|
|
var i, n;
|
|
for (i = 0; i != this$static.unconnectedNodes.arrayList.array.length; i++) {
|
|
n = $get_4(this$static.unconnectedNodes, i).value_0;
|
|
$stampResistor(ground, $get_4(this$static.nodeList, n), $intern_97);
|
|
}
|
|
}
|
|
|
|
function $detectBusWidths(this$static, list){
|
|
var bs, bw, ce, changed, existing, i, i0, i1, j, key, labelWidthMap, ln, lw, p, propagated, pt, w, w1, w2, widthMap, wire;
|
|
this$static.busMismatchList = new Vector;
|
|
widthMap = new HashMap;
|
|
for (i0 = 0; i0 < list.arrayList.array.length; i0++) {
|
|
ce = (checkArrayElementIndex(i0, list.arrayList.array.length) , $get_2(list.arrayList, i0));
|
|
if (ce.isRemovableWire())
|
|
continue;
|
|
for (j = 0; j < ce.getPostCount_0(); j++) {
|
|
w = ce.getPostWidth(j);
|
|
if (w > 1) {
|
|
pt = ce.getPost(j);
|
|
key = new Point_2(pt.x_0, pt.y_0);
|
|
existing = getEntryValueOrNull($getEntry(widthMap.hashCodeMap, key));
|
|
!!existing && existing.value_0 != w && $add_11(this$static.busMismatchList, key);
|
|
(!existing || w > existing.value_0) && $put_0(widthMap, key, valueOf_0(w));
|
|
}
|
|
}
|
|
}
|
|
labelWidthMap = new HashMap;
|
|
changed = true;
|
|
while (changed) {
|
|
changed = false;
|
|
for (i1 = 0; i1 < list.arrayList.array.length; i1++) {
|
|
ce = (checkArrayElementIndex(i1, list.arrayList.array.length) , $get_2(list.arrayList, i1));
|
|
if (instanceOf(ce, 106)) {
|
|
wire = ce;
|
|
w1 = $get_1(widthMap, wire.point1);
|
|
w2 = $get_1(widthMap, wire.point2);
|
|
w = 1;
|
|
!!w1 && (w = w1.value_0);
|
|
!!w2 && w2.value_0 > w && (w = w2.value_0);
|
|
if (w != wire.busWidth) {
|
|
wire.busWidth = w;
|
|
wire.currents = w > 1?initUnidimensionalArray(D_classLit, $intern_76, 7, w, 15, 1):null;
|
|
$allocNodes(wire);
|
|
changed = true;
|
|
}
|
|
if (w > 1) {
|
|
if (!w1 || w1.value_0 < w) {
|
|
$put_0(widthMap, wire.point1, valueOf_0(w));
|
|
changed = true;
|
|
}
|
|
if (!w2 || w2.value_0 < w) {
|
|
$put_0(widthMap, wire.point2, valueOf_0(w));
|
|
changed = true;
|
|
}
|
|
}
|
|
}
|
|
else if (instanceOf(ce, 193)) {
|
|
ln = ce;
|
|
w = $get_1(widthMap, ln.point1);
|
|
lw = $getStringValue(labelWidthMap, ln.text_0);
|
|
bw = 1;
|
|
!!w && (bw = w.value_0);
|
|
!!lw && lw.value_0 > bw && (bw = lw.value_0);
|
|
if (bw != ln.busWidth) {
|
|
ln.busWidth = bw;
|
|
ln.currents = bw > 1?initUnidimensionalArray(D_classLit, $intern_76, 7, bw, 15, 1):null;
|
|
$allocNodes(ln);
|
|
changed = true;
|
|
}
|
|
if (bw > 1) {
|
|
if (!w || w.value_0 < bw) {
|
|
$put_0(widthMap, ln.point1, valueOf_0(bw));
|
|
changed = true;
|
|
}
|
|
if (!lw || lw.value_0 < bw) {
|
|
$putStringValue(labelWidthMap, ln.text_0, valueOf_0(bw));
|
|
changed = true;
|
|
}
|
|
}
|
|
}
|
|
else if (instanceOf(ce, 266)) {
|
|
bs = ce;
|
|
p = new Point_2(bs.pins[0].post.x_0, bs.pins[0].post.y_0);
|
|
bw = bs.bits;
|
|
w = getEntryValueOrNull($getEntry(widthMap.hashCodeMap, p));
|
|
!!w && w.value_0 != bw && $add_11(this$static.busMismatchList, p);
|
|
if (!w || w.value_0 < bw) {
|
|
$put_0(widthMap, p, valueOf_0(bw));
|
|
changed = true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
for (i = 0; i < list.arrayList.array.length; i++) {
|
|
ce = (checkArrayElementIndex(i, list.arrayList.array.length) , $get_2(list.arrayList, i));
|
|
if (ce.isRemovableWire())
|
|
continue;
|
|
for (j = 0; j < ce.getPostCount_0(); j++) {
|
|
w = ce.getPostWidth(j);
|
|
if (w > 1) {
|
|
pt = ce.getPost(j);
|
|
key = new Point_2(pt.x_0, pt.y_0);
|
|
propagated = getEntryValueOrNull($getEntry(widthMap.hashCodeMap, key));
|
|
!!propagated && propagated.value_0 != w && $add_11(this$static.busMismatchList, key);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
function $findUnconnectedNodes(this$static){
|
|
var ce, closure, cn, cnl, found, hasGround, i, j, k, kn, n, post1, qHead, queue, s, scanFrom, totalNodes;
|
|
totalNodes = this$static.nodeList.arrayList.array.length;
|
|
closure = initUnidimensionalArray(Z_classLit, $intern_95, 7, totalNodes, 16, 1);
|
|
this$static.unconnectedNodes = new Vector;
|
|
this$static.nodesWithGroundConnection = new Vector;
|
|
closure[0] = true;
|
|
for (i = 0; i != this$static.elmList.arrayList.array.length; i++) {
|
|
ce = $getElm_1(this$static, i);
|
|
hasGround = false;
|
|
for (j = 0; j < ce.getPostCount_0(); j++) {
|
|
if (ce.hasGroundConnection(j)) {
|
|
hasGround = true;
|
|
closure[ce.nodes[j].index_0] = true;
|
|
}
|
|
}
|
|
hasGround && $add_11(this$static.nodesWithGroundConnection, ce);
|
|
}
|
|
queue = new Vector;
|
|
for (i = 0; i < totalNodes; i++)
|
|
closure[i] && $add_11(queue, valueOf_0(i));
|
|
qHead = 0;
|
|
scanFrom = 1;
|
|
for (;;) {
|
|
if (qHead < queue.arrayList.array.length) {
|
|
n = $get_4(queue, qHead++).value_0;
|
|
cn = $getCircuitNode(this$static, n);
|
|
for (j = 0; j != cn.links_0.arrayList.array.length; j++) {
|
|
cnl = $get_4(cn.links_0, j);
|
|
ce = cnl.elm;
|
|
post1 = cnl.num;
|
|
for (k = 0; k != ce.getPostCount_0(); k++) {
|
|
if (k == post1)
|
|
continue;
|
|
kn = ce.nodes[k].index_0;
|
|
if (!closure[kn] && ce.getConnection(post1, k)) {
|
|
closure[kn] = true;
|
|
$add_11(queue, valueOf_0(kn));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else {
|
|
found = false;
|
|
for (; scanFrom < totalNodes; scanFrom++) {
|
|
if (!closure[scanFrom] && !$getCircuitNode(this$static, scanFrom).internal) {
|
|
$add_11(this$static.unconnectedNodes, valueOf_0(scanFrom));
|
|
closure[scanFrom] = true;
|
|
$add_11(queue, valueOf_0(scanFrom++));
|
|
found = true;
|
|
break;
|
|
}
|
|
}
|
|
if (!found)
|
|
break;
|
|
}
|
|
}
|
|
if (this$static.unconnectedNodes.arrayList.array.length != 0) {
|
|
s = 'unconnected nodes:';
|
|
for (i = 0; i != this$static.unconnectedNodes.arrayList.array.length; i++)
|
|
s += ' ' + $get_4(this$static.unconnectedNodes, i);
|
|
console.log(s);
|
|
}
|
|
}
|
|
|
|
function $getCircuitAsComposite(this$static){
|
|
var ccm, ce, child, closedSwitches, cn, dumpList, elmDoc, elmRoot, ent, extList, extnodes, extraList, i, j, lne, n, next, nn, pos, se, se$iterator, se$iterator0, sel, side, side0, sideLabels, used;
|
|
elmDoc = ($clinit_XMLParser() , build($createDocumentImpl()));
|
|
elmRoot = $createElement(elmDoc, 'elms');
|
|
$appendChild_0(elmDoc, elmRoot);
|
|
clearDumpedFlags_0();
|
|
clearDumpedFlags_1();
|
|
clearDumpedFlags_4();
|
|
clearDumpedFlags_2();
|
|
clearDumpedFlags_3();
|
|
sideLabels = stampJavaTypeInfo(getClassLiteralForArray(Ljava_util_Vector_2_classLit, 1), $intern_3, 18, 0, [new Vector, new Vector, new Vector, new Vector]);
|
|
extList = new Vector;
|
|
sel = $isSelection(this$static.app.ui);
|
|
closedSwitches = new Vector;
|
|
for (i = 0; i != this$static.app.elmList.arrayList.array.length; i++) {
|
|
ce = $get_4(this$static.app.elmList, i);
|
|
if (instanceOf(ce, 61) && ce.position == 0) {
|
|
$add_8(closedSwitches.arrayList, ce);
|
|
ce.position = 1;
|
|
}
|
|
}
|
|
if (!$preStampCircuit(this$static, true)) {
|
|
for (se$iterator0 = new ArrayList$1(closedSwitches.arrayList); se$iterator0.i < se$iterator0.this$01.array.length;) {
|
|
se = $next_4(se$iterator0);
|
|
se.position = 0;
|
|
}
|
|
return null;
|
|
}
|
|
for (se$iterator = new ArrayList$1(closedSwitches.arrayList); se$iterator.i < se$iterator.this$01.array.length;) {
|
|
se = $next_4(se$iterator);
|
|
se.position = 0;
|
|
}
|
|
used = initUnidimensionalArray(Z_classLit, $intern_95, 7, this$static.nodeList.arrayList.array.length, 16, 1);
|
|
extnodes = initUnidimensionalArray(Z_classLit, $intern_95, 7, this$static.nodeList.arrayList.array.length, 16, 1);
|
|
for (i = 0; i != this$static.elmList.arrayList.array.length; i++) {
|
|
ce = $getElm_1(this$static, i);
|
|
if (sel && !ce.selected_0)
|
|
continue;
|
|
if (instanceOf(ce, 193)) {
|
|
lne = ce;
|
|
if ((lne.flags & 1) != 0)
|
|
continue;
|
|
if (extnodes[ce.nodes[0].index_0])
|
|
continue;
|
|
side0 = 2;
|
|
$wnd.Math.abs(ce.dx) >= $wnd.Math.abs(ce.dy) && ce.dx > 0 && (side0 = 3);
|
|
$wnd.Math.abs(ce.dx) <= $wnd.Math.abs(ce.dy) && ce.dy < 0 && (side0 = 0);
|
|
$wnd.Math.abs(ce.dx) <= $wnd.Math.abs(ce.dy) && ce.dy > 0 && (side0 = 1);
|
|
$add_8(sideLabels[side0].arrayList, lne);
|
|
for (j = 0; j < lne.busWidth; j++) {
|
|
extnodes[ce.nodes[j].index_0] = true;
|
|
if (ce.nodes[j].index_0 == 0) {
|
|
alert_0('Node "' + lne.text_0 + '" can\'t be connected to ground');
|
|
return null;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
$clinit_Collections();
|
|
$sort_0(sideLabels[2], new SimulationManager$lambda$0$Type);
|
|
$sort_0(sideLabels[3], new SimulationManager$lambda$1$Type);
|
|
$sort_0(sideLabels[0], new SimulationManager$lambda$2$Type);
|
|
$sort_0(sideLabels[1], new SimulationManager$lambda$3$Type);
|
|
for (side = 0; side < sideLabels.length; side++) {
|
|
for (pos = 0; pos < sideLabels[side].arrayList.array.length; pos++) {
|
|
lne = $get_4(sideLabels[side], pos);
|
|
for (j = 0; j < lne.busWidth; j++) {
|
|
ent = new ExtListEntry_0(lne.text_0, lne.nodes[j].index_0, pos, side);
|
|
ent.busWidth = lne.busWidth;
|
|
ent.busZ = j;
|
|
$add_8(extList.arrayList, ent);
|
|
}
|
|
}
|
|
}
|
|
dumpList = new Vector;
|
|
extraList = new Vector;
|
|
for (i = 0; i != this$static.app.elmList.arrayList.array.length; i++) {
|
|
ce = $get_4(this$static.app.elmList, i);
|
|
if (sel && !ce.selected_0)
|
|
continue;
|
|
instanceOf(ce, 106) || instanceOf(ce, 137) || instanceOf(ce, 193) || instanceOf(ce, 21) || instanceOf(ce, 133) || instanceOf(ce, 160)?$add_8(extraList.arrayList, ce):$add_8(dumpList.arrayList, ce);
|
|
}
|
|
$addAll_0(dumpList.arrayList, extraList);
|
|
for (i = 0; i != dumpList.arrayList.array.length; i++) {
|
|
ce = (checkArrayElementIndex(i, dumpList.arrayList.array.length) , $get_2(dumpList.arrayList, i));
|
|
nn = '';
|
|
for (j = 0; j != ce.getPostCount_0(); j++) {
|
|
n = ce.nodes[j].index_0;
|
|
used[n] = true;
|
|
nn.length > 0 && (nn += ' ');
|
|
nn += n;
|
|
}
|
|
child = $createElement(elmDoc, ce.getXmlDumpType());
|
|
dumpAttr_1(child, 'nn', nn);
|
|
ce.dumpXml(elmDoc, child);
|
|
for (cn = $item(new NodeListImpl(getChildNodes(child.jsObject)), 0); cn;) {
|
|
next = build(getNextSibling(cn.jsObject));
|
|
getNodeType(cn.jsObject) == 1 && $removeChild_2(child, cn);
|
|
cn = next;
|
|
}
|
|
$appendChild_0(elmRoot, child);
|
|
}
|
|
for (i = 0; i != extList.arrayList.array.length; i++) {
|
|
ent = (checkArrayElementIndex(i, extList.arrayList.array.length) , $get_2(extList.arrayList, i));
|
|
if (!used[ent.node]) {
|
|
alert_0('Node "' + ent.name_0 + '" is not used!');
|
|
return null;
|
|
}
|
|
}
|
|
ccm = new CustomCompositeModel;
|
|
ccm.elmDoc = elmDoc;
|
|
ccm.extList = extList;
|
|
console_1('created model ' + prettyPrint(build(getDocumentElement(elmDoc.jsObject)), 0));
|
|
return ccm;
|
|
}
|
|
|
|
function $getCircuitNode(this$static, n){
|
|
if (n >= this$static.nodeList.arrayList.array.length)
|
|
return null;
|
|
return $get_4(this$static.nodeList, n);
|
|
}
|
|
|
|
function $getElm_1(this$static, n){
|
|
if (n >= this$static.elmList.arrayList.array.length)
|
|
return null;
|
|
return $get_4(this$static.elmList, n);
|
|
}
|
|
|
|
function $getLabeledNodeVoltage(name_0){
|
|
var cn;
|
|
cn = getByName(name_0);
|
|
if (!cn || cn.index_0 == 0)
|
|
return 0;
|
|
if (!cn.matrix)
|
|
return 0;
|
|
return cn.matrix.nodeVoltages[cn.row - 1];
|
|
}
|
|
|
|
function $isWireInfoResolved(this$static, ce, bit){
|
|
var bits;
|
|
bits = $get_1(this$static.wireInfoResolved, ce);
|
|
return !!bits && $contains_3(bits, valueOf_0(bit));
|
|
}
|
|
|
|
function $makeNodeList(this$static){
|
|
var ce, cln, cn, cnl, i, inodes, ivs, j, posts, pt, vscount;
|
|
vscount = 0;
|
|
for (i = 0; i != this$static.elmList.arrayList.array.length; i++)
|
|
$getElm_1(this$static, i).preStamp();
|
|
for (i = 0; i != this$static.elmList.arrayList.array.length; i++) {
|
|
ce = $getElm_1(this$static, i);
|
|
inodes = ce.getInternalNodeCount();
|
|
ivs = ce.getVoltageSourceCount();
|
|
posts = ce.getPostCount_0();
|
|
for (j = 0; j != posts; j++) {
|
|
pt = ce.getPost(j);
|
|
cln = $get_1(this$static.nodeMap, pt);
|
|
if (!cln || !cln.node) {
|
|
cn = new CircuitNode;
|
|
cn.index_0 = this$static.nodeList.arrayList.array.length;
|
|
cnl = new CircuitNodeLink;
|
|
cnl.num = j;
|
|
cnl.elm = ce;
|
|
$addElement(cn.links_0, cnl);
|
|
ce.setNode(j, cn);
|
|
cln?(cln.node = cn):$put_0(this$static.nodeMap, pt, new SimulationManager$NodeMapEntry_0(cn));
|
|
$addElement(this$static.nodeList, cn);
|
|
}
|
|
else {
|
|
cn = cln.node;
|
|
cnl = new CircuitNodeLink;
|
|
cnl.num = j;
|
|
cnl.elm = ce;
|
|
$addElement(cn.links_0, cnl);
|
|
ce.setNode(j, cn);
|
|
cn == ground && ce.setNodeVoltage(j, 0);
|
|
}
|
|
}
|
|
for (j = 0; j != inodes; j++) {
|
|
cn = new CircuitNode;
|
|
cn.index_0 = this$static.nodeList.arrayList.array.length;
|
|
cn.internal = true;
|
|
cnl = new CircuitNodeLink;
|
|
cnl.num = j + posts;
|
|
cnl.elm = ce;
|
|
$addElement(cn.links_0, cnl);
|
|
ce.setNode(cnl.num, cn);
|
|
$addElement(this$static.nodeList, cn);
|
|
}
|
|
vscount += ivs;
|
|
}
|
|
this$static.voltageSources = initUnidimensionalArray(Lcom_lushprojects_circuitjs1_client_VoltageSource_2_classLit, $intern_3, 136, vscount, 0, 1);
|
|
}
|
|
|
|
function $makePostDrawList(this$static){
|
|
var bad, badConnectionList, ce, cn, drawList, entry, entry$iterator, g, i, j, k, list, op, other, otherPosts, pc, postCountMap, postDrawList, posts, pt, rp, rw, rwPosts, rwPt;
|
|
postCountMap = new HashMap;
|
|
drawList = this$static.app.ui.elmList;
|
|
for (i = 0; i != drawList.arrayList.array.length; i++) {
|
|
ce = (checkArrayElementIndex(i, drawList.arrayList.array.length) , $get_2(drawList.arrayList, i));
|
|
posts = ce.getPostCount_0();
|
|
for (j = 0; j != posts; j++) {
|
|
pt = ce.getPost(j);
|
|
g = getEntryValueOrNull($getEntry(postCountMap.hashCodeMap, pt));
|
|
$put_0(postCountMap, pt, valueOf_0(!g?1:g.value_0 + 1));
|
|
}
|
|
}
|
|
postDrawList = this$static.app.postDrawList = new Vector;
|
|
badConnectionList = this$static.app.badConnectionList = new Vector;
|
|
for (entry$iterator = new AbstractHashMap$EntrySetIterator((new AbstractHashMap$EntrySet(postCountMap)).this$01); entry$iterator.hasNext;) {
|
|
entry = $next_2(entry$iterator);
|
|
entry.getValue().value_0 != 2 && $add_11(postDrawList, entry.getKey());
|
|
if (entry.getValue().value_0 == 1) {
|
|
bad = false;
|
|
cn = entry.getKey();
|
|
for (j = 0; j != drawList.arrayList.array.length && !bad; j++) {
|
|
ce = (checkArrayElementIndex(j, drawList.arrayList.array.length) , $get_2(drawList.arrayList, j));
|
|
if (instanceOf(ce, 133))
|
|
continue;
|
|
if (instanceOf(ce, 137)) {
|
|
$pointOnPath(ce, cn) && (bad = true);
|
|
continue;
|
|
}
|
|
if (!$contains(ce.boundingBox, cn.x_0, cn.y_0))
|
|
continue;
|
|
pc = ce.getPostCount_0();
|
|
for (k = 0; k != pc; k++)
|
|
if ($equals(ce.getPost(k), cn))
|
|
break;
|
|
k == pc && (bad = true);
|
|
}
|
|
bad && $add_8(badConnectionList.arrayList, cn);
|
|
}
|
|
}
|
|
$addAll_1(badConnectionList, this$static.busMismatchList);
|
|
this$static.routedWireMap = new HashMap;
|
|
for (i = 0; i != drawList.arrayList.array.length; i++) {
|
|
ce = (checkArrayElementIndex(i, drawList.arrayList.array.length) , $get_2(drawList.arrayList, i));
|
|
if (!instanceOf(ce, 137))
|
|
continue;
|
|
rw = ce;
|
|
rwPosts = rw.busWidth * 2;
|
|
for (rp = 0; rp < rwPosts; rp++) {
|
|
rwPt = $getPost_3(rw, rp);
|
|
for (j = 0; j != drawList.arrayList.array.length; j++) {
|
|
other = (checkArrayElementIndex(j, drawList.arrayList.array.length) , $get_2(drawList.arrayList, j));
|
|
if (other == rw || instanceOf(other, 137))
|
|
continue;
|
|
otherPosts = other.getPostCount_0();
|
|
for (op = 0; op < otherPosts; op++) {
|
|
if ($equals(other.getPost(op), rwPt)) {
|
|
list = $get_1(this$static.routedWireMap, other);
|
|
if (!list) {
|
|
list = new ArrayList;
|
|
$put_0(this$static.routedWireMap, other, list);
|
|
}
|
|
$add_8(list, new SimulationManager$RoutedWireConnection(rw, rp, op));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
function $preStampAndStampCircuit(this$static){
|
|
var i;
|
|
for (i = 0; i != 10; i++)
|
|
if ($preStampCircuit(this$static, false) || this$static.app.stopMessage != null)
|
|
break;
|
|
if (this$static.app.stopMessage != null)
|
|
return;
|
|
if (i == 10) {
|
|
$stop(this$static, 'failed to stamp circuit', null);
|
|
return;
|
|
}
|
|
$stampCircuit(this$static);
|
|
}
|
|
|
|
function $preStampCircuit(this$static, subcircuit){
|
|
var ce, elm, elm$iterator, gotVoltageSource, i, ivs, j, list, m, mi, vs, vsPerMatrix, vscount, hook;
|
|
this$static.nodeList = new Vector;
|
|
this$static.elmList = this$static.app.elmList;
|
|
labelList = new HashMap;
|
|
firstGround = null;
|
|
$calculateWireClosureForList(this$static, this$static.elmList, false);
|
|
$setGroundNode(this$static, subcircuit);
|
|
$makeNodeList(this$static);
|
|
if (this$static.app.ui.elmList != this$static.app.elmList) {
|
|
$detectBusWidths(this$static, this$static.app.ui.elmList);
|
|
$calculateWireClosureForList(this$static, this$static.app.ui.elmList, true);
|
|
$assignUiWireNodes(this$static);
|
|
}
|
|
if (!$calcWireInfo(this$static))
|
|
return false;
|
|
this$static.nodeMap = null;
|
|
this$static.uiNodeMap = null;
|
|
this$static.elmList = new Vector_0(this$static.app.elmList);
|
|
for (elm$iterator = new ArrayList$1(this$static.elmList.arrayList); elm$iterator.i < elm$iterator.this$01.array.length;) {
|
|
elm = $next_4(elm$iterator);
|
|
list = elm.getChildElmList();
|
|
!!list && $addChildElms(this$static, list);
|
|
}
|
|
vscount = 0;
|
|
this$static.circuitNonLinear = false;
|
|
for (i = 0; i != this$static.elmList.arrayList.array.length; i++) {
|
|
ce = $getElm_1(this$static, i);
|
|
ce.nonLinear_0() && (this$static.circuitNonLinear = true);
|
|
ivs = ce.getVoltageSourceCount();
|
|
for (j = 0; j != ivs; j++) {
|
|
vs = new VoltageSource;
|
|
vs.elm = ce;
|
|
this$static.voltageSources[vscount] = vs;
|
|
ce.setVoltageSource(j, vs);
|
|
++vscount;
|
|
}
|
|
}
|
|
this$static.voltageSourceCount = vscount;
|
|
gotVoltageSource = false;
|
|
this$static.app.showResistanceInVoltageSources = true;
|
|
for (i = 0; i != this$static.elmList.arrayList.array.length; i++) {
|
|
ce = $getElm_1(this$static, i);
|
|
instanceOf(ce, 56) && (gotVoltageSource?(this$static.app.showResistanceInVoltageSources = false):(gotVoltageSource = true));
|
|
}
|
|
$findUnconnectedNodes(this$static);
|
|
$calculateClosures(this$static);
|
|
if (!$validateCircuit(this$static))
|
|
return false;
|
|
vsPerMatrix = initUnidimensionalArray(I_classLit, $intern_25, 7, this$static.matrices.length, 15, 1);
|
|
for (i = 0; i != this$static.voltageSourceCount; i++) {
|
|
vs = this$static.voltageSources[i];
|
|
!!vs.n1 && vs.n1 != ground && !!vs.n1.matrix?(vs.matrix = vs.n1.matrix):!!vs.n2 && vs.n2 != ground && !!vs.n2.matrix?(vs.matrix = vs.n2.matrix):(vs.matrix = $getNode(vs.elm, vs.elm.getPostCount_0() - 1).matrix);
|
|
!vs.matrix && console_0('null matrix! ' + vs.elm + ' n1=' + (!vs.n1?'null':vs.n1.index_0 + ' m=' + vs.n1.matrix) + ' n2=' + (!vs.n2?'null':vs.n2.index_0 + ' m=' + vs.n2.matrix) + ' fallback=' + $getNode(vs.elm, vs.elm.getPostCount_0() - 1).index_0);
|
|
}
|
|
for (i = 0; i != this$static.voltageSourceCount; i++) {
|
|
vs = this$static.voltageSources[i];
|
|
m = vs.matrix;
|
|
mi = 0;
|
|
for (j = 0; j != this$static.matrices.length; j++)
|
|
if (this$static.matrices[j] == m) {
|
|
mi = j;
|
|
break;
|
|
}
|
|
++vsPerMatrix[mi];
|
|
vs.row = m.nodeCount + vsPerMatrix[mi];
|
|
$add_11(m.voltageSourceList, vs);
|
|
}
|
|
for (i = 0; i != this$static.matrices.length; i++) {
|
|
this$static.matrices[i].size_0 = this$static.matrices[i].nodeCount + vsPerMatrix[i];
|
|
}
|
|
this$static.nodesWithGroundConnection = null;
|
|
this$static.timeStep = this$static.maxTimeStep;
|
|
this$static.needsStamp = true;
|
|
hook = $wnd.CircuitJS1.onanalyze;
|
|
hook && hook($wnd.CircuitJS1);
|
|
return true;
|
|
}
|
|
|
|
function $resetTime(this$static){
|
|
this$static.t = this$static.timeStepAccum = 0;
|
|
this$static.timeStepCount = 0;
|
|
}
|
|
|
|
function $runCircuit(this$static, didAnalyze){
|
|
var debugprint, delayWireProcessing, frameTimeLimit, goodIterations, i, iter, j, lit, m, mi, mi0, mi1, printit, steprate, subiter, subiterCount, timeStepCountAtFrameStart, tm, x_0, hook;
|
|
if (this$static.matrices == null || this$static.elmList.arrayList.array.length == 0) {
|
|
this$static.matrices = null;
|
|
return;
|
|
}
|
|
debugprint = this$static.app.dumpMatrix;
|
|
this$static.app.dumpMatrix = false;
|
|
steprate = fromDouble_0(160 * $getIterCount(this$static.app));
|
|
tm = ($clinit_System() , fromDouble_0(Date.now()));
|
|
lit = this$static.lastIterTime;
|
|
if (compare_0(lit, 0) == 0) {
|
|
this$static.lastIterTime = tm;
|
|
return;
|
|
}
|
|
if (gte_0($intern_22, mul_0(steprate, sub_1(tm, this$static.lastIterTime))) && !didAnalyze)
|
|
return;
|
|
delayWireProcessing = $canDelayWireProcessing(this$static.app.scopeManager);
|
|
timeStepCountAtFrameStart = this$static.timeStepCount;
|
|
goodIterations = 100;
|
|
frameTimeLimit = round_int($intern_22 / this$static.app.minFrameRate);
|
|
for (iter = 1;; iter++) {
|
|
if (goodIterations >= 3 && this$static.timeStep < this$static.maxTimeStep) {
|
|
this$static.timeStep = $wnd.Math.min(this$static.timeStep * 2, this$static.maxTimeStep);
|
|
console_1('timestep up = ' + this$static.timeStep + ' at ' + this$static.t);
|
|
$stampCircuit(this$static);
|
|
goodIterations = 0;
|
|
}
|
|
for (i = 0; i != this$static.elmArr.length; i++)
|
|
this$static.elmArr[i].startIteration();
|
|
++this$static.app.ui.steps;
|
|
subiterCount = this$static.adjustTimeStep && this$static.timeStep / 2 > this$static.minTimeStep?100:5000;
|
|
for (subiter = 0; subiter != subiterCount; subiter++) {
|
|
this$static.converged = true;
|
|
this$static.subIterations = subiter;
|
|
for (mi0 = 0; mi0 != this$static.matrices.length; mi0++) {
|
|
m = this$static.matrices[mi0];
|
|
for (i = 0; i != m.size_0; i++)
|
|
m.rightSide[i] = m.origRightSide[i];
|
|
if (m.nonLinear) {
|
|
for (i = 0; i != m.size_0; i++)
|
|
for (j = 0; j != m.size_0; j++)
|
|
m.matrix[i][j] = m.origMatrix[i][j];
|
|
}
|
|
}
|
|
for (i = 0; i != this$static.elmArr.length; i++)
|
|
this$static.elmArr[i].doStep();
|
|
if (this$static.app.stopMessage != null)
|
|
return;
|
|
printit = debugprint;
|
|
debugprint = false;
|
|
for (mi1 = 0; mi1 != this$static.matrices.length; mi1++) {
|
|
m = this$static.matrices[mi1];
|
|
if (m.size_0 < 8) {
|
|
for (j = 0; j != m.size_0; j++) {
|
|
for (i = 0; i != m.size_0; i++) {
|
|
x_0 = m.matrix[i][j];
|
|
if (isNaN(x_0) || !isNaN(x_0) && !isFinite(x_0)) {
|
|
$stop(this$static, 'nan/infinite matrix!', null);
|
|
console.log('matrix ' + mi1 + ' [' + i + '][' + j + '] is ' + x_0);
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (printit) {
|
|
console.log('matrix ' + mi1 + ':');
|
|
for (j = 0; j != m.size_0; j++) {
|
|
x_0 = '';
|
|
for (i = 0; i != m.size_0; i++)
|
|
x_0 += m.matrix[j][i] + ',';
|
|
x_0 += '\n';
|
|
console.log(x_0);
|
|
}
|
|
}
|
|
if (m.nonLinear) {
|
|
if (this$static.converged && subiter > 0)
|
|
continue;
|
|
if (!lu_factor(m.matrix, m.size_0, m.permute, m)) {
|
|
$stop(this$static, 'Singular matrix!', null);
|
|
return;
|
|
}
|
|
}
|
|
lu_solve(m.matrix, m.size_0, m.permute, m.rightSide, m);
|
|
$applySolvedRightSide(this$static, m);
|
|
}
|
|
printit && (console.log('done') , undefined);
|
|
if (!this$static.circuitNonLinear)
|
|
break;
|
|
if (this$static.converged && subiter > 0)
|
|
break;
|
|
}
|
|
if (subiter == subiterCount) {
|
|
goodIterations = 0;
|
|
if (this$static.adjustTimeStep) {
|
|
this$static.timeStep /= 2;
|
|
console_1('timestep down to ' + this$static.timeStep + ' at ' + this$static.t);
|
|
}
|
|
if (this$static.timeStep < this$static.minTimeStep || !this$static.adjustTimeStep) {
|
|
console.log('convergence failed after ' + subiter + ' iterations');
|
|
$stop(this$static, 'Convergence failed!', null);
|
|
break;
|
|
}
|
|
for (mi0 = 0; mi0 != this$static.matrices.length; mi0++)
|
|
$setNodeVoltages(this$static.matrices[mi0], this$static.matrices[mi0].lastNodeVoltages);
|
|
$stampCircuit(this$static);
|
|
continue;
|
|
}
|
|
(subiter > 5 || this$static.timeStep < this$static.maxTimeStep) && console_1('converged after ' + subiter + ' iterations, timeStep = ' + this$static.timeStep);
|
|
subiter < 3?++goodIterations:(goodIterations = 0);
|
|
this$static.t += this$static.timeStep;
|
|
this$static.timeStepAccum += this$static.timeStep;
|
|
if (this$static.timeStepAccum >= this$static.maxTimeStep) {
|
|
this$static.timeStepAccum -= this$static.maxTimeStep;
|
|
++this$static.timeStepCount;
|
|
}
|
|
for (i = 0; i != this$static.elmArr.length; i++)
|
|
this$static.elmArr[i].stepFinished();
|
|
delayWireProcessing || $calcWireCurrents(this$static);
|
|
$timeStep_0(this$static.app.scopeManager);
|
|
hook = $wnd.CircuitJS1.ontimestep;
|
|
hook && hook($wnd.CircuitJS1);
|
|
for (mi = 0; mi != this$static.matrices.length; mi++) {
|
|
m = this$static.matrices[mi];
|
|
for (i = 0; i != m.nodeCount; i++)
|
|
m.lastNodeVoltages[i] = m.nodeVoltages[i];
|
|
}
|
|
tm = fromDouble_0(Date.now());
|
|
lit = tm;
|
|
if (gte_0((this$static.timeStepCount - timeStepCountAtFrameStart) * $intern_22, mul_0(steprate, sub_1(tm, this$static.lastIterTime))) || gt(sub_1(tm, this$static.app.ui.lastFrameTime), frameTimeLimit))
|
|
break;
|
|
if (!this$static.app.simRunning)
|
|
break;
|
|
}
|
|
this$static.lastIterTime = lit;
|
|
delayWireProcessing && $calcWireCurrents(this$static);
|
|
}
|
|
|
|
function $setGroundNode(this$static, subcircuit){
|
|
var battery, ce, cln, cn, gotGround, gotRail, i, nme, pt, volt;
|
|
gotGround = false;
|
|
gotRail = false;
|
|
volt = null;
|
|
battery = null;
|
|
cn = new CircuitNode;
|
|
cn.index_0 = 0;
|
|
$addElement(this$static.nodeList, cn);
|
|
ground = cn;
|
|
for (i = 0; i != this$static.elmList.arrayList.array.length; i++) {
|
|
ce = $getElm_1(this$static, i);
|
|
if (instanceOf(ce, 160)) {
|
|
gotGround = true;
|
|
nme = $get_1(this$static.nodeMap, ce.getPost(0));
|
|
nme.node = ground;
|
|
break;
|
|
}
|
|
instanceOf(ce, 47) && (gotRail = true);
|
|
!volt && instanceOf(ce, 56) && (volt = ce);
|
|
!battery && instanceOf(ce, 300) && (battery = ce);
|
|
}
|
|
if (!subcircuit && !gotGround && (!!volt || !!battery) && !gotRail) {
|
|
pt = (volt?volt:battery).getPost(0);
|
|
cln = $get_1(this$static.nodeMap, pt);
|
|
cln?(cln.node = ground):$put_0(this$static.nodeMap, pt, new SimulationManager$NodeMapEntry_0(ground));
|
|
}
|
|
}
|
|
|
|
function $setNodeVoltages(m, nv){
|
|
var cn, cnl, j, k, res;
|
|
for (j = 0; j != m.nodeList.arrayList.array.length; j++) {
|
|
cn = $get_4(m.nodeList, j);
|
|
res = nv[cn.row - 1];
|
|
for (k = 0; k != cn.links_0.arrayList.array.length; k++) {
|
|
cnl = $get_4(cn.links_0, k);
|
|
cnl.elm.setNodeVoltage(cnl.num, res);
|
|
}
|
|
}
|
|
}
|
|
|
|
function $setWireInfoResolved(this$static, ce, bit){
|
|
var bits;
|
|
bits = $get_1(this$static.wireInfoResolved, ce);
|
|
if (!bits) {
|
|
bits = new HashSet;
|
|
$put_0(this$static.wireInfoResolved, ce, bits);
|
|
}
|
|
$add_9(bits, valueOf_0(bit));
|
|
}
|
|
|
|
function $stampCCCS(n1, n2, vs, gain){
|
|
$stampMatrix_0(n1, vs, gain);
|
|
$stampMatrix_0(n2, vs, -gain);
|
|
}
|
|
|
|
function $stampCircuit(this$static){
|
|
var ce, i, j, j0, m, maxMatrixSize, mi, mi0, scopeElmArr, scopeElmCount, sz;
|
|
for (i = 0; i != this$static.matrices.length; i++) {
|
|
m = this$static.matrices[i];
|
|
sz = m.size_0;
|
|
m.matrix = initMultidimensionalArray(D_classLit, [$intern_3, $intern_76], [12, 7], 15, [sz, sz], 2);
|
|
m.rightSide = initUnidimensionalArray(D_classLit, $intern_76, 7, sz, 15, 1);
|
|
m.origMatrix = initMultidimensionalArray(D_classLit, [$intern_3, $intern_76], [12, 7], 15, [sz, sz], 2);
|
|
m.origRightSide = initUnidimensionalArray(D_classLit, $intern_76, 7, sz, 15, 1);
|
|
m.permute = initUnidimensionalArray(I_classLit, $intern_25, 7, sz, 15, 1);
|
|
m.nodeVoltages = initUnidimensionalArray(D_classLit, $intern_76, 7, m.nodeCount, 15, 1);
|
|
(m.lastNodeVoltages == null || m.lastNodeVoltages.length != m.nodeCount) && (m.lastNodeVoltages = initUnidimensionalArray(D_classLit, $intern_76, 7, m.nodeCount, 15, 1));
|
|
m.nonLinear = false;
|
|
}
|
|
if (this$static.circuitNonLinear) {
|
|
for (i = 0; i != this$static.matrices.length; i++)
|
|
this$static.matrices[i].nonLinear = true;
|
|
}
|
|
$connectUnconnectedNodes(this$static);
|
|
for (i = 0; i != this$static.elmList.arrayList.array.length; i++) {
|
|
ce = $getElm_1(this$static, i);
|
|
ce.setParentList(this$static.elmList);
|
|
ce.stamp();
|
|
}
|
|
if (this$static.matrices == null)
|
|
return;
|
|
maxMatrixSize = 0;
|
|
for (mi0 = 0; mi0 != this$static.matrices.length; mi0++) {
|
|
m = this$static.matrices[mi0];
|
|
sz = m.size_0;
|
|
sz > maxMatrixSize && (maxMatrixSize = sz);
|
|
for (i = 0; i != sz; i++)
|
|
m.origRightSide[i] = m.rightSide[i];
|
|
for (i = 0; i != sz; i++)
|
|
for (j0 = 0; j0 != sz; j0++)
|
|
m.origMatrix[i][j0] = m.matrix[i][j0];
|
|
}
|
|
this$static.solverType == 2?(this$static.usingSparse = true):this$static.solverType == 1?(this$static.usingSparse = false):(this$static.usingSparse = maxMatrixSize >= 150);
|
|
for (mi = 0; mi != this$static.matrices.length; mi++) {
|
|
m = this$static.matrices[mi];
|
|
if (!m.nonLinear) {
|
|
if (!lu_factor(m.matrix, m.size_0, m.permute, m)) {
|
|
$stop(this$static, 'Singular matrix!', null);
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
this$static.elmArr = initUnidimensionalArray(Lcom_lushprojects_circuitjs1_client_CircuitElm_2_classLit, $intern_3, 8, this$static.elmList.arrayList.array.length, 0, 1);
|
|
scopeElmCount = 0;
|
|
for (i = 0; i != this$static.elmList.arrayList.array.length; i++) {
|
|
this$static.elmArr[i] = $get_4(this$static.elmList, i);
|
|
instanceOf(this$static.elmArr[i], 21) && ++scopeElmCount;
|
|
}
|
|
scopeElmArr = initUnidimensionalArray(Lcom_lushprojects_circuitjs1_client_ScopeElm_2_classLit, $intern_3, 21, scopeElmCount, 0, 1);
|
|
j = 0;
|
|
for (i = 0; i != this$static.elmList.arrayList.array.length; i++) {
|
|
instanceOf(this$static.elmArr[i], 21) && (scopeElmArr[j++] = this$static.elmArr[i]);
|
|
}
|
|
this$static.app.scopeElmArr = scopeElmArr;
|
|
this$static.needsStamp = false;
|
|
}
|
|
|
|
function $stampConductance(n1, n2, r0){
|
|
$stampMatrix(n1, n1, r0);
|
|
$stampMatrix(n2, n2, r0);
|
|
$stampMatrix(n1, n2, -r0);
|
|
$stampMatrix(n2, n1, -r0);
|
|
}
|
|
|
|
function $stampCurrentSource(n1, n2, i){
|
|
n1.row > 0 && (n1.matrix.rightSide[n1.row - 1] += -i);
|
|
n2.row > 0 && (n2.matrix.rightSide[n2.row - 1] += i);
|
|
}
|
|
|
|
function $stampMatrix(i, j, x_0){
|
|
var m;
|
|
!isNaN(x_0) && !isFinite(x_0) && debugger_1();
|
|
if (i.row > 0 && j.row > 0) {
|
|
i.matrix != j.matrix && console_1('stampMatrix cross-matrix! node ' + i.index_0 + ' (matrix row ' + i.row + ') vs node ' + j.index_0 + ' (matrix row ' + j.row + ')');
|
|
m = i != ground?i.matrix:j.matrix;
|
|
m.matrix[i.row - 1][j.row - 1] += x_0;
|
|
}
|
|
}
|
|
|
|
function $stampMatrix_0(i, j, x_0){
|
|
!isNaN(x_0) && !isFinite(x_0) && debugger_1();
|
|
if (i.row > 0) {
|
|
i.matrix != j.matrix && console_1('stampMatrix cross-matrix! node ' + i.index_0 + ' (row ' + i.row + ') vs vs row ' + j.row);
|
|
j.matrix.matrix[i.row - 1][j.row - 1] += x_0;
|
|
}
|
|
}
|
|
|
|
function $stampMatrix_1(i, j, x_0){
|
|
!isNaN(x_0) && !isFinite(x_0) && debugger_1();
|
|
if (j.row > 0) {
|
|
i.matrix != j.matrix && console_1('stampMatrix cross-matrix! vs row ' + i.row + ' vs node ' + j.index_0 + ' (row ' + j.row + ')');
|
|
i.matrix.matrix[i.row - 1][j.row - 1] += x_0;
|
|
}
|
|
}
|
|
|
|
function $stampMatrix_2(i, j, x_0){
|
|
!isNaN(x_0) && !isFinite(x_0) && debugger_1();
|
|
i.matrix != j.matrix && console_1('stampMatrix cross-matrix! vs row ' + i.row + ' vs vs row ' + j.row);
|
|
i.matrix.matrix[i.row - 1][j.row - 1] += x_0;
|
|
}
|
|
|
|
function $stampResistor(n1, n2, r){
|
|
var a, r0;
|
|
r0 = 1 / r;
|
|
if (isNaN(r0) || !isNaN(r0) && !isFinite(r0)) {
|
|
$clinit_System();
|
|
a = 0;
|
|
a = a / 0 | 0;
|
|
}
|
|
$stampMatrix(n1, n1, r0);
|
|
$stampMatrix(n2, n2, r0);
|
|
$stampMatrix(n1, n2, -r0);
|
|
$stampMatrix(n2, n1, -r0);
|
|
}
|
|
|
|
function $stampRightSide(n, x_0){
|
|
n.row > 0 && (n.matrix.rightSide[n.row - 1] += x_0);
|
|
}
|
|
|
|
function $stampRightSide_0(vs, x_0){
|
|
vs.matrix.rightSide[vs.row - 1] += x_0;
|
|
}
|
|
|
|
function $stampVCCurrentSource(cn1, cn2, vn1, vn2, g){
|
|
$stampMatrix(cn1, vn1, g);
|
|
$stampMatrix(cn2, vn2, g);
|
|
$stampMatrix(cn1, vn2, -g);
|
|
$stampMatrix(cn2, vn1, -g);
|
|
}
|
|
|
|
function $stampVCVS(n1, n2, coef, vs){
|
|
$stampMatrix_1(vs, n1, coef);
|
|
$stampMatrix_1(vs, n2, -coef);
|
|
}
|
|
|
|
function $stampVoltageSource(n1, n2, vs){
|
|
$stampMatrix_1(vs, n1, -1);
|
|
$stampMatrix_1(vs, n2, 1);
|
|
$stampMatrix_0(n1, vs, 1);
|
|
$stampMatrix_0(n2, vs, -1);
|
|
}
|
|
|
|
function $stampVoltageSource_0(n1, n2, vs, v){
|
|
$stampMatrix_1(vs, n1, -1);
|
|
$stampMatrix_1(vs, n2, 1);
|
|
vs.matrix.rightSide[vs.row - 1] += v;
|
|
$stampMatrix_0(n1, vs, 1);
|
|
$stampMatrix_0(n2, vs, -1);
|
|
}
|
|
|
|
function $stampVoltageSource_1(vs){
|
|
$stampVoltageSource_0(vs.n1, vs.n2, vs, 0);
|
|
}
|
|
|
|
function $stop(this$static, s, ce){
|
|
$setStopElm(this$static.app, ce, LS(s));
|
|
this$static.matrices = null;
|
|
$setSimRunning(this$static.app, false);
|
|
this$static.app.analyzeFlag = false;
|
|
}
|
|
|
|
function $updateVoltageSource(vs, v){
|
|
vs.matrix.rightSide[vs.row - 1] += v;
|
|
}
|
|
|
|
function $validateCircuit(this$static){
|
|
var ce, i;
|
|
for (i = 0; i != this$static.elmList.arrayList.array.length; i++) {
|
|
ce = $getElm_1(this$static, i);
|
|
if (!ce.validate())
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
function SimulationManager(app_){
|
|
theSim = this;
|
|
this.app = app_;
|
|
}
|
|
|
|
function console_1(text_0){
|
|
console.log(text_0);
|
|
}
|
|
|
|
function debugger_1(){
|
|
debugger;
|
|
}
|
|
|
|
function invertMatrix(a, n){
|
|
var b, i, inva, ipvt, j;
|
|
ipvt = initUnidimensionalArray(I_classLit, $intern_25, 7, n, 15, 1);
|
|
lu_factor_dense(a, n, ipvt);
|
|
b = initUnidimensionalArray(D_classLit, $intern_76, 7, n, 15, 1);
|
|
inva = initMultidimensionalArray(D_classLit, [$intern_3, $intern_76], [12, 7], 15, [n, n], 2);
|
|
for (i = 0; i != n; i++) {
|
|
for (j = 0; j != n; j++)
|
|
b[j] = 0;
|
|
b[i] = 1;
|
|
lu_solve_dense(a, n, ipvt, b);
|
|
for (j = 0; j != n; j++)
|
|
inva[j][i] = b[j];
|
|
}
|
|
for (i = 0; i != n; i++)
|
|
for (j = 0; j != n; j++)
|
|
a[i][j] = inva[i][j];
|
|
}
|
|
|
|
function lu_factor(a, n, ipvt, cm){
|
|
var csc, sm;
|
|
sm = theSim;
|
|
if (!!sm && sm.usingSparse) {
|
|
csc = convert(a, ($clinit_DMatrixSparseCSC() , EPS));
|
|
!cm.sparseLU && (cm.sparseLU = new SparseLU);
|
|
return $setA(cm.sparseLU, csc);
|
|
}
|
|
return lu_factor_dense(a, n, ipvt);
|
|
}
|
|
|
|
function lu_factor_dense(a, n, ipvt){
|
|
var i, j, k, largest, largestRow, mult, q, row_all_zeros, x_0;
|
|
for (i = 0; i != n; i++) {
|
|
row_all_zeros = true;
|
|
for (j = 0; j != n; j++) {
|
|
if (a[i][j] != 0) {
|
|
row_all_zeros = false;
|
|
break;
|
|
}
|
|
}
|
|
if (row_all_zeros)
|
|
return false;
|
|
}
|
|
for (j = 0; j != n; j++) {
|
|
for (i = 0; i != j; i++) {
|
|
q = a[i][j];
|
|
for (k = 0; k != i; k++)
|
|
q -= a[i][k] * a[k][j];
|
|
a[i][j] = q;
|
|
}
|
|
largest = 0;
|
|
largestRow = -1;
|
|
for (i = j; i != n; i++) {
|
|
q = a[i][j];
|
|
for (k = 0; k != j; k++)
|
|
q -= a[i][k] * a[k][j];
|
|
a[i][j] = q;
|
|
x_0 = $wnd.Math.abs(q);
|
|
if (x_0 >= largest) {
|
|
largest = x_0;
|
|
largestRow = i;
|
|
}
|
|
}
|
|
if (j != largestRow) {
|
|
if (largestRow == -1) {
|
|
console.log('largestRow == -1');
|
|
return false;
|
|
}
|
|
for (k = 0; k != n; k++) {
|
|
x_0 = a[largestRow][k];
|
|
a[largestRow][k] = a[j][k];
|
|
a[j][k] = x_0;
|
|
}
|
|
}
|
|
ipvt[j] = largestRow;
|
|
if (a[j][j] == 0) {
|
|
console.log("didn't avoid zero");
|
|
return false;
|
|
}
|
|
if (j != n - 1) {
|
|
mult = 1 / a[j][j];
|
|
for (i = j + 1; i != n; i++)
|
|
a[i][j] *= mult;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
|
|
function lu_solve(a, n, ipvt, b, cm){
|
|
var sm;
|
|
sm = theSim;
|
|
if (!!sm && sm.usingSparse) {
|
|
$solve(cm.sparseLU, b, b);
|
|
return;
|
|
}
|
|
lu_solve_dense(a, n, ipvt, b);
|
|
}
|
|
|
|
function lu_solve_dense(a, n, ipvt, b){
|
|
var bi, i, j, row, swap, tot;
|
|
for (i = 0; i != n; i++) {
|
|
row = ipvt[i];
|
|
swap = b[row];
|
|
b[row] = b[i];
|
|
b[i] = swap;
|
|
if (swap != 0)
|
|
break;
|
|
}
|
|
bi = i++;
|
|
for (; i < n; i++) {
|
|
row = ipvt[i];
|
|
tot = b[row];
|
|
b[row] = b[i];
|
|
for (j = bi; j < i; j++)
|
|
tot -= a[i][j] * b[j];
|
|
b[i] = tot;
|
|
}
|
|
for (i = n - 1; i >= 0; i--) {
|
|
tot = b[i];
|
|
for (j = i + 1; j != n; j++)
|
|
tot -= a[i][j] * b[j];
|
|
b[i] = tot / a[i][i];
|
|
}
|
|
}
|
|
|
|
function pointKey(p){
|
|
return p.x_0 + ',' + p.y_0 + ',' + p.z_0;
|
|
}
|
|
|
|
defineClass(496, 1, {}, SimulationManager);
|
|
_.adjustTimeStep = false;
|
|
_.circuitNonLinear = false;
|
|
_.converged = false;
|
|
_.lastIterTime = 0;
|
|
_.maxTimeStep = 0;
|
|
_.minTimeStep = 0;
|
|
_.needsStamp = false;
|
|
_.solverType = 0;
|
|
_.subIterations = 0;
|
|
_.t = 0;
|
|
_.timeStep = 0;
|
|
_.timeStepAccum = 0;
|
|
_.timeStepCount = 0;
|
|
_.usingSparse = false;
|
|
_.voltageSourceCount = 0;
|
|
var theSim;
|
|
var Lcom_lushprojects_circuitjs1_client_SimulationManager_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'SimulationManager', 496);
|
|
function SimulationManager$NodeMapEntry(){
|
|
this.node = null;
|
|
}
|
|
|
|
function SimulationManager$NodeMapEntry_0(n){
|
|
this.node = n;
|
|
}
|
|
|
|
defineClass(235, 1, {235:1}, SimulationManager$NodeMapEntry, SimulationManager$NodeMapEntry_0);
|
|
var Lcom_lushprojects_circuitjs1_client_SimulationManager$NodeMapEntry_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'SimulationManager/NodeMapEntry', 235);
|
|
function SimulationManager$RoutedWireConnection(wire, wirePost, elmPost){
|
|
this.wire = wire;
|
|
this.wirePost = wirePost;
|
|
this.elmPost = elmPost;
|
|
}
|
|
|
|
defineClass(328, 1, {328:1}, SimulationManager$RoutedWireConnection);
|
|
_.elmPost = 0;
|
|
_.wirePost = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_SimulationManager$RoutedWireConnection_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'SimulationManager/RoutedWireConnection', 328);
|
|
function SimulationManager$WireSegment(w, b, ep0, ep1){
|
|
this.wire = w;
|
|
this.bit = b;
|
|
this.endpoint0 = ep0;
|
|
this.endpoint1 = ep1;
|
|
}
|
|
|
|
defineClass(286, 1, {286:1}, SimulationManager$WireSegment);
|
|
_.bit = 0;
|
|
_.current = 0;
|
|
_.post = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_SimulationManager$WireSegment_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'SimulationManager/WireSegment', 286);
|
|
function SimulationManager$lambda$0$Type(){
|
|
}
|
|
|
|
defineClass(497, 1, {}, SimulationManager$lambda$0$Type);
|
|
_.equals_0 = function equals_12(other){
|
|
return this === other;
|
|
}
|
|
;
|
|
_.compare = function compare_4(arg0, arg1){
|
|
return signum(arg0.y_0 - arg1.y_0);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_SimulationManager$lambda$0$Type_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'SimulationManager/lambda$0$Type', 497);
|
|
function SimulationManager$lambda$1$Type(){
|
|
}
|
|
|
|
defineClass(498, 1, {}, SimulationManager$lambda$1$Type);
|
|
_.equals_0 = function equals_13(other){
|
|
return this === other;
|
|
}
|
|
;
|
|
_.compare = function compare_5(arg0, arg1){
|
|
return signum(arg0.y_0 - arg1.y_0);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_SimulationManager$lambda$1$Type_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'SimulationManager/lambda$1$Type', 498);
|
|
function SimulationManager$lambda$2$Type(){
|
|
}
|
|
|
|
defineClass(499, 1, {}, SimulationManager$lambda$2$Type);
|
|
_.equals_0 = function equals_14(other){
|
|
return this === other;
|
|
}
|
|
;
|
|
_.compare = function compare_6(arg0, arg1){
|
|
return signum(arg0.x_0 - arg1.x_0);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_SimulationManager$lambda$2$Type_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'SimulationManager/lambda$2$Type', 499);
|
|
function SimulationManager$lambda$3$Type(){
|
|
}
|
|
|
|
defineClass(500, 1, {}, SimulationManager$lambda$3$Type);
|
|
_.equals_0 = function equals_15(other){
|
|
return this === other;
|
|
}
|
|
;
|
|
_.compare = function compare_7(arg0, arg1){
|
|
return signum(arg0.x_0 - arg1.x_0);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_SimulationManager$lambda$3$Type_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'SimulationManager/lambda$3$Type', 500);
|
|
function $setupPins_22(this$static){
|
|
var i, pin, value_0;
|
|
this$static.sizeX = this$static.bits + 1;
|
|
this$static.sizeY = 3;
|
|
this$static.pins = initUnidimensionalArray(Lcom_lushprojects_circuitjs1_client_ChipElm$Pin_2_classLit, $intern_3, 9, 2 + this$static.bits, 0, 1);
|
|
this$static.pins[0] = new ChipElm$Pin(this$static, 1, 2, 'D');
|
|
this$static.pins[1] = new ChipElm$Pin(this$static, 2, 2, '');
|
|
this$static.pins[1].clock = true;
|
|
for (i = 0; i < this$static.bits; i++) {
|
|
value_0 = !!this$static.pins[2 + i] && this$static.pins[2 + i].value_0;
|
|
pin = this$static.pins[2 + i] = new ChipElm$Pin(this$static, i + 1, 0, 'Q' + i);
|
|
pin.value_0 = value_0;
|
|
pin.output = true;
|
|
}
|
|
$allocNodes(this$static);
|
|
}
|
|
|
|
function SipoShiftElm(xx, yy){
|
|
$clinit_ChipElm();
|
|
ChipElm.call(this, xx, yy);
|
|
this.clockstate = false;
|
|
}
|
|
|
|
function SipoShiftElm_0(xa, ya, xb, yb, f, st){
|
|
$clinit_ChipElm();
|
|
var data_0, i;
|
|
ChipElm_0.call(this, xa, ya, xb, yb, f, st);
|
|
this.clockstate = false;
|
|
data_0 = initUnidimensionalArray(Z_classLit, $intern_95, 7, this.bits, 16, 1);
|
|
readBits(st, data_0);
|
|
for (i = 0; i < this.bits; i++)
|
|
this.pins[2 + i].value_0 = data_0[i];
|
|
}
|
|
|
|
defineClass(386, 32, $intern_85, SipoShiftElm, SipoShiftElm_0);
|
|
_.defaultBitCount = function defaultBitCount_3(){
|
|
return 8;
|
|
}
|
|
;
|
|
_.dumpXml = function dumpXml_76(doc, elem){
|
|
$dumpXml_0(this, elem);
|
|
}
|
|
;
|
|
_.dumpXmlState = function dumpXmlState_14(doc, elem){
|
|
var data_0, i;
|
|
$dumpXmlState(this, elem);
|
|
data_0 = initUnidimensionalArray(Z_classLit, $intern_95, 7, this.bits, 16, 1);
|
|
for (i = 0; i < this.bits; i++)
|
|
data_0[i] = this.pins[2 + i].value_0;
|
|
dumpAttr_1(elem, 'dt', writeBitsToString(data_0));
|
|
}
|
|
;
|
|
_.execute_3 = function execute_46(){
|
|
var i;
|
|
if (this.pins[1].value_0 != this.clockstate) {
|
|
this.clockstate = this.pins[1].value_0;
|
|
if (this.clockstate && this.bits > 0) {
|
|
for (i = this.bits - 2; i >= 0; i--)
|
|
this.pins[2 + i + 1].value_0 = this.pins[2 + i].value_0;
|
|
this.pins[2].value_0 = this.pins[0].value_0;
|
|
}
|
|
}
|
|
}
|
|
;
|
|
_.getChipEditInfo = function getChipEditInfo_24(n){
|
|
if (n == 0)
|
|
return $setDimensionless(new EditInfo_0('# of Bits', this.bits, 1, 1));
|
|
return null;
|
|
}
|
|
;
|
|
_.getChipName = function getChipName_29(){
|
|
return 'SIPO shift register';
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_98(){
|
|
return 189;
|
|
}
|
|
;
|
|
_.getPostCount_0 = function getPostCount_67(){
|
|
return 2 + this.bits;
|
|
}
|
|
;
|
|
_.getVoltageSourceCount = function getVoltageSourceCount_48(){
|
|
return this.bits;
|
|
}
|
|
;
|
|
_.needsBits = function needsBits_11(){
|
|
return true;
|
|
}
|
|
;
|
|
_.setChipEditValue = function setChipEditValue_25(n, ei){
|
|
if (n == 0) {
|
|
if (ei.value_0 != this.bits && ei.value_0 >= 1) {
|
|
this.bits = round_int(ei.value_0);
|
|
$setupPins_22(this);
|
|
$setPoints_0(this);
|
|
}
|
|
return;
|
|
}
|
|
}
|
|
;
|
|
_.setupPins = function setupPins_30(){
|
|
$setupPins_22(this);
|
|
}
|
|
;
|
|
_.undumpXml = function undumpXml_79(xml){
|
|
var data_0, dt, i;
|
|
$undumpXml_0(this, xml);
|
|
dt = $parseStringAttr(xml, 'dt', null);
|
|
if (dt != null) {
|
|
data_0 = initUnidimensionalArray(Z_classLit, $intern_95, 7, this.bits, 16, 1);
|
|
readBitsFromString(dt, data_0);
|
|
for (i = 0; i < this.bits; i++)
|
|
this.pins[2 + i].value_0 = data_0[i];
|
|
}
|
|
}
|
|
;
|
|
_.clockstate = false;
|
|
var Lcom_lushprojects_circuitjs1_client_SipoShiftElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'SipoShiftElm', 386);
|
|
function $apply_4(this$static){
|
|
var adj, d, e, ei, i;
|
|
for (i = 0; i != this$static.einfocount; i++) {
|
|
adj = $findAdjustable(this$static.sim, this$static.elm, i);
|
|
if (!adj)
|
|
continue;
|
|
ei = this$static.einfos[i];
|
|
try {
|
|
adj.sliderText = !ei.labelBox?'':$getText(ei.labelBox);
|
|
console_0('slidertext ' + adj.sliderText + ' ' + ei.labelBox);
|
|
!!adj.label_0 && $setText_0(adj.label_0, adj.sliderText);
|
|
d = parseUnits($getText(ei.minBox));
|
|
adj.minValue = d;
|
|
d = parseUnits($getText(ei.maxBox));
|
|
adj.maxValue = d;
|
|
d = parseUnits($getText(ei.stepBox));
|
|
adj.sliderStep = d;
|
|
!!adj.slider && adj.maxValue != adj.minValue && $setStepSize(adj.slider, d * 100 / (adj.maxValue - adj.minValue));
|
|
!!this$static.logCheckboxes[i] && (adj.logarithmic = $getState(this$static.logCheckboxes[i]));
|
|
adj.logarithmic && adj.minValue <= 0 && (adj.logarithmic = false);
|
|
$setSliderValue(adj, ei.value_0);
|
|
}
|
|
catch ($e0) {
|
|
$e0 = toJava($e0);
|
|
if (instanceOf($e0, 13)) {
|
|
e = $e0;
|
|
console_0($toString(e, e.getMessage()));
|
|
}
|
|
else
|
|
throw toJs($e0);
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
|
|
function $buildDialog_0(this$static){
|
|
var adj, adji, ch_0, ei, i, idx, j, name_0;
|
|
for (i = 0;; i++) {
|
|
this$static.einfos[i] = this$static.elm.getEditInfo(i);
|
|
if (!this$static.einfos[i])
|
|
break;
|
|
ei = this$static.einfos[i];
|
|
if (!(!ei.choice && !ei.checkbox && !ei.button_0 && !ei.textArea && !ei.widget && !ei.noSliders))
|
|
continue;
|
|
adj = $findAdjustable(this$static.sim, this$static.elm, i);
|
|
name_0 = LS(ei.name_0);
|
|
idx = $getWidgetIndex(this$static.vp, this$static.hp);
|
|
name_0 = $replaceAll(name_0, '<[^>]*>', '');
|
|
ei.checkbox = new Checkbox_0(name_0, !!adj);
|
|
$insert_2(this$static.vp, ei.checkbox, idx++);
|
|
$addValueChangeHandler_0(ei.checkbox, new SliderDialog$4(this$static));
|
|
if (adj) {
|
|
if (!$sliderBeingShared(adj)) {
|
|
ch_0 = ei.choice = new Choice;
|
|
$addDomHandler(ei.choice, new SliderDialog$5(this$static), ($clinit_ChangeEvent() , $clinit_ChangeEvent() , TYPE_0));
|
|
$addItem(ch_0, LS('New Slider'));
|
|
for (j = 0; j != this$static.sim.adjustables.arrayList.array.length; j++) {
|
|
adji = $get_4(this$static.sim.adjustables, j);
|
|
if (adji.sharedSlider)
|
|
break;
|
|
if (adji == adj)
|
|
continue;
|
|
$addItem(ch_0, LS('Share Slider: ' + adji.sliderText));
|
|
adji == adj.sharedSlider && $setSelectedIndex_0(ch_0, ($clinit_DOM() , ch_0.element).options.length - 1);
|
|
}
|
|
$insert_2(this$static.vp, ch_0, idx++);
|
|
}
|
|
$insert_2(this$static.vp, new Label_1(LS('Min Value')), idx++);
|
|
ei.minBox = new TextBox;
|
|
$insert_2(this$static.vp, ei.minBox, idx++);
|
|
$insert_2(this$static.vp, new Label_1(LS('Max Value')), idx++);
|
|
ei.maxBox = new TextBox;
|
|
$insert_2(this$static.vp, ei.maxBox, idx++);
|
|
$insert_2(this$static.vp, new Label_1(LS('Step (0=continuous)')), idx++);
|
|
ei.stepBox = new TextBox;
|
|
$insert_2(this$static.vp, ei.stepBox, idx++);
|
|
this$static.logCheckboxes[i] = new Checkbox_0(LS('Logarithmic'), adj.logarithmic);
|
|
$insert_2(this$static.vp, this$static.logCheckboxes[i], idx++);
|
|
if (!adj.sharedSlider) {
|
|
$insert_2(this$static.vp, new Label_1(LS('Label')), idx++);
|
|
ei.labelBox = new TextBox;
|
|
$setText_2(ei.labelBox, adj.sliderText);
|
|
$insert_2(this$static.vp, ei.labelBox, idx++);
|
|
}
|
|
$setText_2(ei.minBox, unitString(ei, adj.minValue));
|
|
$setText_2(ei.maxBox, unitString(ei, adj.maxValue));
|
|
$setText_2(ei.stepBox, unitString(ei, adj.sliderStep));
|
|
}
|
|
}
|
|
this$static.einfocount = i;
|
|
}
|
|
|
|
function $clearDialog_0(this$static){
|
|
var j;
|
|
while ($getWidget(this$static.vp, 0) != this$static.hp)
|
|
$remove(this$static.vp, 0);
|
|
for (j = 0; j < this$static.logCheckboxes.length; j++)
|
|
this$static.logCheckboxes[j] = null;
|
|
}
|
|
|
|
function $itemStateChanged_0(this$static, e){
|
|
var adj, adji, changed, ct, ei, i, j, src_0;
|
|
src_0 = e.source;
|
|
changed = false;
|
|
for (i = 0; i != this$static.einfocount; i++) {
|
|
ei = this$static.einfos[i];
|
|
if (maskUndefined(ei.checkbox) === maskUndefined(src_0)) {
|
|
$apply_4(this$static);
|
|
if ($getState(ei.checkbox)) {
|
|
adj = new Adjustable(this$static.elm, i);
|
|
adj.sliderText = $replaceAll(ei.name_0, ' \\(.*\\)$', '');
|
|
$createSlider_0(adj, this$static.sim, ei.value_0);
|
|
$add_11(this$static.sim.adjustables, adj);
|
|
}
|
|
else {
|
|
adj = $findAdjustable(this$static.sim, this$static.elm, i);
|
|
$deleteSlider(adj, this$static.sim);
|
|
$advanceToFind(this$static.sim.adjustables, adj, true);
|
|
}
|
|
changed = true;
|
|
}
|
|
if (maskUndefined(ei.choice) === maskUndefined(src_0)) {
|
|
$apply_4(this$static);
|
|
adj = $findAdjustable(this$static.sim, this$static.elm, i);
|
|
if ($getElement(ei.choice).selectedIndex == 0) {
|
|
adj.sharedSlider = null;
|
|
(adj.sliderText == null || adj.sliderText.length == 0) && (adj.sliderText = $replaceAll(ei.name_0, ' \\(.*\\)$', ''));
|
|
$createSlider_0(adj, this$static.sim, ei.value_0);
|
|
}
|
|
else {
|
|
ct = 0;
|
|
for (j = 0; j != this$static.sim.adjustables.arrayList.array.length; j++) {
|
|
adji = $get_4(this$static.sim.adjustables, j);
|
|
if (adji.sharedSlider)
|
|
break;
|
|
if (adji == adj)
|
|
continue;
|
|
if (++ct == $getElement(ei.choice).selectedIndex) {
|
|
adj.sharedSlider = adji;
|
|
$deleteSlider(adj, this$static.sim);
|
|
}
|
|
}
|
|
}
|
|
changed = true;
|
|
}
|
|
}
|
|
if (changed) {
|
|
reorderAdjustables();
|
|
$clearDialog_0(this$static);
|
|
$buildDialog_0(this$static);
|
|
}
|
|
}
|
|
|
|
function SliderDialog(ce, f){
|
|
Dialog.call(this);
|
|
$setText(this, LS('Add Sliders'));
|
|
this.sim = f;
|
|
this.elm = ce;
|
|
this.vp = new VerticalPanel;
|
|
$setWidget_1(this, this.vp);
|
|
this.einfos = initUnidimensionalArray(Lcom_lushprojects_circuitjs1_client_EditInfo_2_classLit, $intern_3, 5, 10, 0, 1);
|
|
this.logCheckboxes = initUnidimensionalArray(Lcom_lushprojects_circuitjs1_client_Checkbox_2_classLit, $intern_3, 34, 10, 0, 1);
|
|
$clinit_NumberFormat();
|
|
new NumberFormat_0('####.##########', $getDefaultNative());
|
|
this.hp = new HorizontalPanel;
|
|
$setWidth(this.hp, '100%');
|
|
$setHorizontalAlignment_0(this.hp, ($clinit_HasHorizontalAlignment() , ALIGN_LEFT));
|
|
$setStyleName(this.hp, 'topSpace');
|
|
$add_5(this.vp, this.hp);
|
|
$add_3(this.hp, this.applyButton = new Button_1(LS('Apply')));
|
|
$addDomHandler(this.applyButton, new SliderDialog$1(this), ($clinit_ClickEvent() , $clinit_ClickEvent() , TYPE_1));
|
|
$add_3(this.hp, this.okButton = new Button_1(LS('OK')));
|
|
$addDomHandler(this.okButton, new SliderDialog$2(this), (null , TYPE_1));
|
|
$setHorizontalAlignment_0(this.hp, ALIGN_RIGHT);
|
|
$add_3(this.hp, this.cancelButton = new Button_1(LS('Cancel')));
|
|
$addDomHandler(this.cancelButton, new SliderDialog$3(this), (null , TYPE_1));
|
|
$buildDialog_0(this);
|
|
$center(this);
|
|
}
|
|
|
|
defineClass(743, 140, $intern_58, SliderDialog);
|
|
_.apply_0 = function apply_11(){
|
|
return $apply_4(this);
|
|
}
|
|
;
|
|
_.einfocount = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_SliderDialog_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'SliderDialog', 743);
|
|
function SliderDialog$1(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(744, 1, $intern_56, SliderDialog$1);
|
|
_.onClick = function onClick_47(event_0){
|
|
$apply_4(this.this$01);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_SliderDialog$1_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'SliderDialog/1', 744);
|
|
function SliderDialog$2(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(745, 1, $intern_56, SliderDialog$2);
|
|
_.onClick = function onClick_48(event_0){
|
|
$apply_4(this.this$01);
|
|
$closeDialog(this.this$01);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_SliderDialog$2_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'SliderDialog/2', 745);
|
|
function SliderDialog$3(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(746, 1, $intern_56, SliderDialog$3);
|
|
_.onClick = function onClick_49(event_0){
|
|
$closeDialog(this.this$01);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_SliderDialog$3_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'SliderDialog/3', 746);
|
|
function SliderDialog$4(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(747, 1, $intern_68, SliderDialog$4);
|
|
_.onValueChange = function onValueChange_14(e){
|
|
$itemStateChanged_0(this.this$01, e);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_SliderDialog$4_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'SliderDialog/4', 747);
|
|
function SliderDialog$5(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(748, 1, $intern_71, SliderDialog$5);
|
|
_.onChange = function onChange_11(e){
|
|
$itemStateChanged_0(this.this$01, e);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_SliderDialog$5_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'SliderDialog/5', 748);
|
|
function SparkGapElm(xx, yy){
|
|
CircuitElm.call(this, xx, yy);
|
|
this.offresistance = $intern_32;
|
|
this.onresistance = $intern_22;
|
|
this.breakdown = $intern_22;
|
|
this.holdcurrent = $intern_83;
|
|
this.state = false;
|
|
}
|
|
|
|
function SparkGapElm_0(xa, ya, xb, yb, f, st){
|
|
CircuitElm_0.call(this, xa, ya, xb, yb, f);
|
|
this.onresistance = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.offresistance = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.breakdown = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.holdcurrent = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
}
|
|
|
|
defineClass(387, 8, $intern_85, SparkGapElm, SparkGapElm_0);
|
|
_.calculateCurrent = function calculateCurrent_32(){
|
|
var vd;
|
|
vd = this.volts[0] - this.volts[1];
|
|
this.current_0 = vd / this.resistance;
|
|
}
|
|
;
|
|
_.doStep = function doStep_46(){
|
|
this.resistance = this.state?this.onresistance:this.offresistance;
|
|
$stampResistor(this.nodes[0], this.nodes[1], this.resistance);
|
|
}
|
|
;
|
|
_.draw = function draw_72(g){
|
|
$setBbox_0(this, this.point1, this.point2, 8);
|
|
$draw2Leads(this, g);
|
|
$setVoltageColor(this, g, this.volts[0]);
|
|
$setPowerColor_0(this, g);
|
|
$fillPolygon(g, this.arrow1);
|
|
$setVoltageColor(this, g, this.volts[1]);
|
|
$setPowerColor_0(this, g);
|
|
$fillPolygon(g, this.arrow2);
|
|
this.state && (this.curcount_0 = $updateDotCount(this.current_0, this.curcount_0) , app_0.mouse.dragElm == this || $drawDots(g, this.point1, this.point2, this.curcount_0));
|
|
$drawPosts(this, g);
|
|
}
|
|
;
|
|
_.dumpXml = function dumpXml_77(doc, elem){
|
|
dumpAttr_1(elem, 'x', this.x_0 + ' ' + this.y_0 + ' ' + this.x2 + ' ' + this.y2);
|
|
dumpAttr_0(elem, 'f', this.flags);
|
|
dumpAttr(elem, 'on', this.onresistance);
|
|
dumpAttr(elem, 'of', this.offresistance);
|
|
dumpAttr(elem, 'br', this.breakdown);
|
|
dumpAttr(elem, 'ho', this.holdcurrent);
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_99(){
|
|
return 187;
|
|
}
|
|
;
|
|
_.getEditInfo = function getEditInfo_67(n){
|
|
if (n == 0)
|
|
return new EditInfo_0('On resistance (ohms)', this.onresistance, 0, 0);
|
|
if (n == 1)
|
|
return new EditInfo_0('Off resistance (ohms)', this.offresistance, 0, 0);
|
|
if (n == 2)
|
|
return new EditInfo_0('Breakdown voltage', this.breakdown, 0, 0);
|
|
if (n == 3)
|
|
return new EditInfo_0('Holding current (A)', this.holdcurrent, 0, 0);
|
|
return null;
|
|
}
|
|
;
|
|
_.getInfo_0 = function getInfo_77(arr){
|
|
arr[0] = 'spark gap';
|
|
arr[1] = 'I = ' + getUnitText($wnd.Math.abs(this.current_0), 'A', false);
|
|
arr[2] = 'Vd = ' + getUnitText($wnd.Math.abs(this.volts[0] - this.volts[1]), 'V', false);
|
|
arr[3] = this.state?'on':'off';
|
|
arr[4] = 'Ron = ' + getUnitText(this.onresistance, ohmString, false);
|
|
arr[5] = 'Roff = ' + getUnitText(this.offresistance, ohmString, false);
|
|
arr[6] = 'Vbreakdown = ' + getUnitText(this.breakdown, 'V', false);
|
|
}
|
|
;
|
|
_.nonLinear_0 = function nonLinear_24(){
|
|
return true;
|
|
}
|
|
;
|
|
_.reset_0 = function reset_45(){
|
|
$reset(this);
|
|
this.state = false;
|
|
}
|
|
;
|
|
_.setEditValue = function setEditValue_67(n, ei){
|
|
ei.value_0 > 0 && n == 0 && (this.onresistance = ei.value_0);
|
|
ei.value_0 > 0 && n == 1 && (this.offresistance = ei.value_0);
|
|
ei.value_0 > 0 && n == 2 && (this.breakdown = ei.value_0);
|
|
ei.value_0 > 0 && n == 3 && (this.holdcurrent = ei.value_0);
|
|
}
|
|
;
|
|
_.setPoints = function setPoints_65(){
|
|
var p1;
|
|
$setPoints(this);
|
|
$calcLeads(this, 24);
|
|
p1 = $interpPoint(this.point1, this.point2, (this.dn - 8) / (2 * this.dn));
|
|
this.arrow1 = $calcArrow(this.point1, p1, 8, 8);
|
|
p1 = $interpPoint(this.point1, this.point2, (this.dn + 8) / (2 * this.dn));
|
|
this.arrow2 = $calcArrow(this.point2, p1, 8, 8);
|
|
}
|
|
;
|
|
_.stamp = function stamp_59(){
|
|
}
|
|
;
|
|
_.startIteration = function startIteration_19(){
|
|
var vd;
|
|
$wnd.Math.abs(this.current_0) < this.holdcurrent && (this.state = false);
|
|
vd = this.volts[0] - this.volts[1];
|
|
$wnd.Math.abs(vd) > this.breakdown && (this.state = true);
|
|
}
|
|
;
|
|
_.undumpXml = function undumpXml_80(xml){
|
|
this.flags = $parseIntAttr(xml, 'f', this.flags);
|
|
this.onresistance = $parseDoubleAttr(xml, 'on', this.onresistance);
|
|
this.offresistance = $parseDoubleAttr(xml, 'of', this.offresistance);
|
|
this.breakdown = $parseDoubleAttr(xml, 'br', this.breakdown);
|
|
this.holdcurrent = $parseDoubleAttr(xml, 'ho', this.holdcurrent);
|
|
}
|
|
;
|
|
_.breakdown = 0;
|
|
_.holdcurrent = 0;
|
|
_.offresistance = 0;
|
|
_.onresistance = 0;
|
|
_.resistance = 0;
|
|
_.state = false;
|
|
var Lcom_lushprojects_circuitjs1_client_SparkGapElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'SparkGapElm', 387);
|
|
function SquareRailElm(xx, yy){
|
|
RailElm_0.call(this, xx, yy, 2);
|
|
}
|
|
|
|
defineClass(921, 47, $intern_92, SquareRailElm);
|
|
_.getDumpClass = function getDumpClass_16(){
|
|
return Lcom_lushprojects_circuitjs1_client_RailElm_2_classLit;
|
|
}
|
|
;
|
|
_.getShortcut = function getShortcut_41(){
|
|
return 0;
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_SquareRailElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'SquareRailElm', 921);
|
|
function StopTriggerElm(xx, yy){
|
|
CircuitElm.call(this, xx, yy);
|
|
this.triggerVoltage = 1;
|
|
this.count = 1;
|
|
}
|
|
|
|
function StopTriggerElm_0(xa, ya, xb, yb, f, st){
|
|
CircuitElm_0.call(this, xa, ya, xb, yb, f);
|
|
this.triggerVoltage = __parseAndValidateDouble($nextToken(st));
|
|
this.type_0 = __parseAndValidateInt($nextToken(st), 10);
|
|
this.delay = __parseAndValidateDouble($nextToken(st));
|
|
this.count = 1;
|
|
}
|
|
|
|
defineClass(420, 8, $intern_85, StopTriggerElm, StopTriggerElm_0);
|
|
_.draw = function draw_73(g){
|
|
var f, s, selected;
|
|
g.context.save();
|
|
g.savedFontSize = g.currentFontSize;
|
|
selected = mouseElmRef == this || this.selected_0 || $containsKey(app_0.mouse.scopePlotRoles, this) || instanceOf(mouseElmRef, 21) && $getElm_0(mouseElmRef.elmScope) == this || $isOnHighlightedNet(this) || this.stopped;
|
|
f = new Font('SansSerif', selected?1:0, 14);
|
|
$setFont_0(g, f);
|
|
$setColor_0(g, selected?selectColor_0:whiteColor);
|
|
$setBbox_0(this, this.point1, this.lead1, 0);
|
|
s = LS('trigger');
|
|
$drawLabeledNode(this, g, s, this.point1, this.lead1);
|
|
$setVoltageColor(this, g, this.volts[0]);
|
|
selected && $setColor_0(g, selectColor_0);
|
|
drawThickLine_0(g, this.point1, this.lead1, 3);
|
|
$drawPosts(this, g);
|
|
g.context.restore();
|
|
g.currentFontSize = g.savedFontSize;
|
|
}
|
|
;
|
|
_.dumpXml = function dumpXml_78(doc, elem){
|
|
dumpAttr_1(elem, 'x', this.x_0 + ' ' + this.y_0 + ' ' + this.x2 + ' ' + this.y2);
|
|
dumpAttr_0(elem, 'f', this.flags);
|
|
dumpAttr(elem, 'tv', this.triggerVoltage);
|
|
dumpAttr_0(elem, 'tp', this.type_0);
|
|
dumpAttr(elem, 'dl', this.delay);
|
|
dumpAttr_0(elem, 'ct', this.count);
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_100(){
|
|
return 408;
|
|
}
|
|
;
|
|
_.getEditInfo = function getEditInfo_68(n){
|
|
var ei;
|
|
if (n == 0) {
|
|
ei = new EditInfo('Voltage', this.triggerVoltage);
|
|
return ei.unitStep = true , ei;
|
|
}
|
|
if (n == 1) {
|
|
ei = new EditInfo_0('Trigger Type', this.type_0, -1, -1);
|
|
ei.choice = new Choice;
|
|
$addItem(ei.choice, LS('>='));
|
|
$addItem(ei.choice, LS('<='));
|
|
$select(ei.choice, this.type_0);
|
|
return ei;
|
|
}
|
|
if (n == 2) {
|
|
ei = new EditInfo('Delay (s)', this.delay);
|
|
return ei;
|
|
}
|
|
if (n == 3) {
|
|
ei = new EditInfo_0('Required Count', this.count, -1, -1);
|
|
return $setPositive((ei.dimensionless = true , ei));
|
|
}
|
|
return null;
|
|
}
|
|
;
|
|
_.getInfo_0 = function getInfo_78(arr){
|
|
arr[0] = 'stop trigger';
|
|
arr[1] = 'V = ' + getUnitText(this.volts[0], 'V', false);
|
|
arr[2] = 'Vtrigger = ' + getUnitText(this.triggerVoltage, 'V', false);
|
|
arr[3] = this.triggered?'stopping in ' + getUnitText(this.triggerTime + this.delay - sim_0.t, 's', false):this.stopped?'stopped':'waiting';
|
|
!this.stopped && this.count > 1 && (arr[3] += ' (' + $wnd.Math.min(this.triggerCount, this.count) + '/' + this.count + ')');
|
|
}
|
|
;
|
|
_.getPostCount_0 = function getPostCount_68(){
|
|
return 1;
|
|
}
|
|
;
|
|
_.getVoltageDiff_0 = function getVoltageDiff_22(){
|
|
return this.volts[0];
|
|
}
|
|
;
|
|
_.reset_0 = function reset_46(){
|
|
this.triggered = false;
|
|
this.conditionActive = false;
|
|
this.triggerCount = 0;
|
|
}
|
|
;
|
|
_.setEditValue = function setEditValue_68(n, ei){
|
|
n == 0 && (this.triggerVoltage = ei.value_0);
|
|
n == 1 && (this.type_0 = $getElement(ei.choice).selectedIndex);
|
|
n == 2 && (this.delay = ei.value_0);
|
|
if (n == 3) {
|
|
this.count = round_int(ei.value_0);
|
|
this.count < 1 && (this.count = 1);
|
|
}
|
|
}
|
|
;
|
|
_.setPoints = function setPoints_66(){
|
|
$setPoints(this);
|
|
this.lead1 = $interpPoint(this.point1, this.point2, 1 - 8 / this.dn);
|
|
}
|
|
;
|
|
_.stepFinished = function stepFinished_22(){
|
|
var condition;
|
|
this.stopped = false;
|
|
condition = this.type_0 == 0 && this.volts[0] >= this.triggerVoltage || this.type_0 == 1 && this.volts[0] <= this.triggerVoltage;
|
|
if (!this.conditionActive && condition) {
|
|
this.conditionActive = true;
|
|
++this.triggerCount;
|
|
if (!this.triggered && this.triggerCount >= this.count) {
|
|
this.triggered = true;
|
|
this.triggerTime = sim_0.t;
|
|
}
|
|
}
|
|
this.conditionActive && !condition && (this.conditionActive = false);
|
|
if (this.triggered && sim_0.t >= this.triggerTime + this.delay) {
|
|
this.triggered = false;
|
|
this.triggerCount = 0;
|
|
this.stopped = true;
|
|
$setSimRunning(app_0, false);
|
|
}
|
|
}
|
|
;
|
|
_.undumpXml = function undumpXml_81(xml){
|
|
this.flags = $parseIntAttr(xml, 'f', this.flags);
|
|
this.triggerVoltage = $parseDoubleAttr(xml, 'tv', this.triggerVoltage);
|
|
this.type_0 = $parseIntAttr(xml, 'tp', this.type_0);
|
|
this.delay = $parseDoubleAttr(xml, 'dl', this.delay);
|
|
this.count = $parseIntAttr(xml, 'ct', 1);
|
|
this.count < 1 && (this.count = 1);
|
|
}
|
|
;
|
|
_.conditionActive = false;
|
|
_.count = 0;
|
|
_.delay = 0;
|
|
_.stopped = false;
|
|
_.triggerCount = 0;
|
|
_.triggerTime = 0;
|
|
_.triggerVoltage = 0;
|
|
_.triggered = false;
|
|
_.type_0 = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_StopTriggerElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'StopTriggerElm', 420);
|
|
function $countTokens(this$static){
|
|
var count, delimiterCount, tmpPos, tokenFound;
|
|
count = 0;
|
|
delimiterCount = 0;
|
|
tokenFound = false;
|
|
tmpPos = this$static.pos;
|
|
while (tmpPos < this$static.len) {
|
|
if ($indexOf_1(this$static.delim, fromCodePoint($charAt_0(this$static.str, tmpPos++))) >= 0) {
|
|
if (tokenFound) {
|
|
++count;
|
|
tokenFound = false;
|
|
}
|
|
++delimiterCount;
|
|
}
|
|
else {
|
|
tokenFound = true;
|
|
while (tmpPos < this$static.len && $indexOf_1(this$static.delim, fromCodePoint($charAt_0(this$static.str, tmpPos))) < 0)
|
|
++tmpPos;
|
|
}
|
|
}
|
|
tokenFound && ++count;
|
|
return this$static.retDelims?count + delimiterCount:count;
|
|
}
|
|
|
|
function $hasMoreTokens(this$static){
|
|
if (!this$static.retDelims) {
|
|
while (this$static.pos < this$static.len && $indexOf_1(this$static.delim, fromCodePoint($charAt_0(this$static.str, this$static.pos))) >= 0)
|
|
++this$static.pos;
|
|
}
|
|
return this$static.pos < this$static.len;
|
|
}
|
|
|
|
function $nextToken(this$static){
|
|
var start_0;
|
|
if (this$static.pos < this$static.len && $indexOf_1(this$static.delim, fromCodePoint($charAt_0(this$static.str, this$static.pos))) >= 0) {
|
|
if (this$static.retDelims)
|
|
return $substring_0(this$static.str, this$static.pos, ++this$static.pos);
|
|
while (++this$static.pos < this$static.len && $indexOf_1(this$static.delim, fromCodePoint($charAt_0(this$static.str, this$static.pos))) >= 0)
|
|
;
|
|
}
|
|
if (this$static.pos < this$static.len) {
|
|
start_0 = this$static.pos;
|
|
while (++this$static.pos < this$static.len && $indexOf_1(this$static.delim, fromCodePoint($charAt_0(this$static.str, this$static.pos))) < 0)
|
|
;
|
|
return $substring_0(this$static.str, start_0, this$static.pos);
|
|
}
|
|
throw toJs(new NoSuchElementException);
|
|
}
|
|
|
|
function StringTokenizer(str){
|
|
StringTokenizer_1.call(this, str, ' \t\n\r\f', false);
|
|
}
|
|
|
|
function StringTokenizer_0(str, delim){
|
|
StringTokenizer_1.call(this, str, delim, false);
|
|
}
|
|
|
|
function StringTokenizer_1(str, delim, returnDelims){
|
|
this.len = str.length;
|
|
this.str = str;
|
|
this.delim = delim;
|
|
this.retDelims = returnDelims;
|
|
this.pos = 0;
|
|
}
|
|
|
|
defineClass(79, 1, {}, StringTokenizer, StringTokenizer_0, StringTokenizer_1);
|
|
_.len = 0;
|
|
_.pos = 0;
|
|
_.retDelims = false;
|
|
var Lcom_lushprojects_circuitjs1_client_StringTokenizer_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'StringTokenizer', 79);
|
|
function $createButton_0(text_0, handler){
|
|
var btn, s;
|
|
btn = new Button_1(LS(text_0));
|
|
$addDomHandler(btn, handler, ($clinit_ClickEvent() , $clinit_ClickEvent() , TYPE_1));
|
|
s = ($clinit_DOM() , btn.element).style;
|
|
s['marginLeft'] = ($clinit_Style$Unit() , '5.0px');
|
|
s['marginRight'] = '5.0px';
|
|
return btn;
|
|
}
|
|
|
|
function $setContextInfo(this$static, modelName){
|
|
this$static.hasContext = modelName != null;
|
|
$setVisible(this$static.contextLabel, this$static.hasContext);
|
|
$setVisible(this$static.contextSaveButton, this$static.hasContext);
|
|
$setVisible(this$static.contextSaveCopyButton, this$static.hasContext);
|
|
this$static.hasContext && $setText_0(this$static.contextLabel, LS('Editing: ') + ('' + modelName));
|
|
$updateVisibility(this$static);
|
|
}
|
|
|
|
function $setSubcircuitPath(this$static, path){
|
|
this$static.hasSubcircuit = path != null;
|
|
$setVisible(this$static.subcircuitLabel, this$static.hasSubcircuit);
|
|
this$static.hasSubcircuit && $setText_0(this$static.subcircuitLabel, path);
|
|
$updateVisibility(this$static);
|
|
}
|
|
|
|
function $styleLabel(label_0){
|
|
var style;
|
|
style = ($clinit_DOM() , label_0.element).style;
|
|
style['fontSize'] = ($clinit_Style$Unit() , '14.0px');
|
|
style['color'] = '#333';
|
|
style['paddingRight'] = '10.0px';
|
|
}
|
|
|
|
function $updatePosition(this$static, top_0, width_0){
|
|
var style;
|
|
style = ($clinit_DOM() , this$static.element).style;
|
|
style['left'] = ($clinit_Style$Unit() , '0.0px');
|
|
style['top'] = top_0 + 'px';
|
|
style['width'] = width_0 + 'px';
|
|
}
|
|
|
|
function $updateVisibility(this$static){
|
|
var show;
|
|
show = this$static.hasSubcircuit || this$static.hasContext;
|
|
($clinit_DOM() , this$static.element).style['display'] = (show?($clinit_Style$Display() , BLOCK):($clinit_Style$Display() , NONE_0)).getCssName();
|
|
$setVisible(this$static.backButton, show);
|
|
}
|
|
|
|
function SubcircuitBar(){
|
|
var style;
|
|
FlowPanel.call(this);
|
|
style = ($clinit_DOM() , this.element).style;
|
|
style['background'] = 'rgba(248,248,248,0.85)';
|
|
style['position'] = ($clinit_Style$Position() , 'absolute');
|
|
style['padding'] = ($clinit_Style$Unit() , '4.0px');
|
|
style['paddingLeft'] = '8.0px';
|
|
style['paddingRight'] = '8.0px';
|
|
style['borderBottom'] = '1px solid #ccc';
|
|
style['pointerEvents'] = 'auto';
|
|
style['boxSizing'] = 'border-box';
|
|
style['whiteSpace'] = 'nowrap';
|
|
style['display'] = ($clinit_Style$Display() , 'none');
|
|
this.subcircuitLabel = new InlineLabel;
|
|
$styleLabel(this.subcircuitLabel);
|
|
$setVisible(this.subcircuitLabel, false);
|
|
$add_2(this, this.subcircuitLabel);
|
|
this.contextLabel = new InlineLabel;
|
|
$styleLabel(this.contextLabel);
|
|
$setVisible(this.contextLabel, false);
|
|
$add_2(this, this.contextLabel);
|
|
this.backButton = $createButton_0('\u25C0 Back', new SubcircuitBar$lambda$0$Type);
|
|
$setVisible(this.backButton, false);
|
|
$add_2(this, this.backButton);
|
|
this.contextSaveButton = $createButton_0('Save', new SubcircuitBar$lambda$1$Type);
|
|
$setVisible(this.contextSaveButton, false);
|
|
$add_2(this, this.contextSaveButton);
|
|
this.contextSaveCopyButton = $createButton_0('Save Copy', new SubcircuitBar$lambda$2$Type);
|
|
$setVisible(this.contextSaveCopyButton, false);
|
|
$add_2(this, this.contextSaveCopyButton);
|
|
}
|
|
|
|
function lambda$1_0(){
|
|
var app, dlg, existingModel, modelName;
|
|
app = theApp;
|
|
modelName = $getEditingModelName(app);
|
|
dlg = new EditCompositeModelDialog;
|
|
if (!$createModel(dlg))
|
|
return;
|
|
existingModel = getModelWithName(modelName);
|
|
$setName_1(dlg.model, modelName);
|
|
!!existingModel && preservePinLayout(dlg.model, existingModel);
|
|
dlg.popContext = true;
|
|
$createDialog(dlg);
|
|
dialogShowing = dlg;
|
|
!dlg.resizeHandlerRegistration && (dlg.resizeHandlerRegistration = addResizeHandler(new DialogBox$1(dlg)));
|
|
$show(dlg);
|
|
$drawChip_0(dlg);
|
|
}
|
|
|
|
function lambda$2(){
|
|
var app, dlg, existingModel, modelName;
|
|
app = theApp;
|
|
modelName = $getEditingModelName(app);
|
|
dlg = new EditCompositeModelDialog;
|
|
if (!$createModel(dlg))
|
|
return;
|
|
existingModel = getModelWithName(modelName);
|
|
!!existingModel && preservePinLayout(dlg.model, existingModel);
|
|
dlg.popContext = true;
|
|
$createDialog(dlg);
|
|
dialogShowing = dlg;
|
|
!dlg.resizeHandlerRegistration && (dlg.resizeHandlerRegistration = addResizeHandler(new DialogBox$1(dlg)));
|
|
$show(dlg);
|
|
$drawChip_0(dlg);
|
|
}
|
|
|
|
defineClass(674, 219, $intern_54, SubcircuitBar);
|
|
_.hasContext = false;
|
|
_.hasSubcircuit = false;
|
|
var Lcom_lushprojects_circuitjs1_client_SubcircuitBar_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'SubcircuitBar', 674);
|
|
function SubcircuitBar$lambda$0$Type(){
|
|
}
|
|
|
|
defineClass(675, 1, $intern_56, SubcircuitBar$lambda$0$Type);
|
|
_.onClick = function onClick_50(arg0){
|
|
var app;
|
|
app = theApp;
|
|
app.ui.subcircuitStack.arrayList.array.length == 0?$popContextAndGetChangedModels(app):$popSubcircuit(app.ui);
|
|
$repaint(app.ui);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_SubcircuitBar$lambda$0$Type_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'SubcircuitBar/lambda$0$Type', 675);
|
|
function SubcircuitBar$lambda$1$Type(){
|
|
}
|
|
|
|
defineClass(676, 1, $intern_56, SubcircuitBar$lambda$1$Type);
|
|
_.onClick = function onClick_51(arg0){
|
|
lambda$1_0();
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_SubcircuitBar$lambda$1$Type_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'SubcircuitBar/lambda$1$Type', 676);
|
|
function SubcircuitBar$lambda$2$Type(){
|
|
}
|
|
|
|
defineClass(677, 1, $intern_56, SubcircuitBar$lambda$2$Type);
|
|
_.onClick = function onClick_52(arg0){
|
|
lambda$2();
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_SubcircuitBar$lambda$2$Type_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'SubcircuitBar/lambda$2$Type', 677);
|
|
function $handleDelete(this$static){
|
|
var confirm_0, model, selectedIndex, selectedSubcircuit, confirm_1;
|
|
selectedIndex = $getElement(this$static.subcircuitListBox).selectedIndex;
|
|
if (selectedIndex == -1) {
|
|
$wnd.alert('Please select a subcircuit to delete.');
|
|
return;
|
|
}
|
|
selectedSubcircuit = $getItemText(this$static.subcircuitListBox, selectedIndex);
|
|
confirm_0 = $wnd.confirm('Are you sure you want to delete ' + selectedSubcircuit + '?');
|
|
if (confirm_0) {
|
|
model = $get_4(this$static.subcircuits, selectedIndex);
|
|
$advanceToFind(this$static.subcircuits, model, true);
|
|
$setSaved(model, false);
|
|
$removeStringValue(localModelMap, model.name_0);
|
|
$removeStringValue(globalModelMap, model.name_0);
|
|
++sequenceNumber;
|
|
$removeItem_1(this$static.subcircuitListBox, selectedIndex);
|
|
}
|
|
}
|
|
|
|
function SubcircuitDialog(){
|
|
var i, name_0;
|
|
Dialog.call(this);
|
|
$setText_0(this.caption, 'Subcircuit Manager');
|
|
$setGlassEnabled(this);
|
|
this.mainPanel = new VerticalPanel;
|
|
this.mainPanel.table['cellSpacing'] = 10;
|
|
$setWidth(this.mainPanel, '400px');
|
|
this.subcircuitListBox = new ListBox;
|
|
$setVisibleItemCount(this.subcircuitListBox, 5);
|
|
$setWidth(this.subcircuitListBox, '100%');
|
|
this.subcircuits = getModelList();
|
|
$removeIf_0(this.subcircuits, new SubcircuitDialog$0methodref$isBuiltin$Type);
|
|
for (i = 0; i != this.subcircuits.arrayList.array.length; i++) {
|
|
name_0 = $get_4(this.subcircuits, i).name_0;
|
|
$addItem(this.subcircuitListBox, name_0);
|
|
}
|
|
$add_5(this.mainPanel, this.subcircuitListBox);
|
|
this.deleteButton = new Button_1('Delete');
|
|
$addDomHandler(this.deleteButton, new SubcircuitDialog$1(this), ($clinit_ClickEvent() , $clinit_ClickEvent() , TYPE_1));
|
|
$add_5(this.mainPanel, this.deleteButton);
|
|
this.doneButton = new Button_1('Done');
|
|
$addDomHandler(this.doneButton, new SubcircuitDialog$2(this), (null , TYPE_1));
|
|
$add_5(this.mainPanel, this.doneButton);
|
|
$setWidget_1(this, this.mainPanel);
|
|
$center(this);
|
|
}
|
|
|
|
defineClass(695, 140, $intern_58, SubcircuitDialog);
|
|
var Lcom_lushprojects_circuitjs1_client_SubcircuitDialog_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'SubcircuitDialog', 695);
|
|
function SubcircuitDialog$0methodref$isBuiltin$Type(){
|
|
}
|
|
|
|
defineClass(696, 1, {}, SubcircuitDialog$0methodref$isBuiltin$Type);
|
|
var Lcom_lushprojects_circuitjs1_client_SubcircuitDialog$0methodref$isBuiltin$Type_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'SubcircuitDialog/0methodref$isBuiltin$Type', 696);
|
|
function SubcircuitDialog$1(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(697, 1, $intern_56, SubcircuitDialog$1);
|
|
_.onClick = function onClick_53(event_0){
|
|
$handleDelete(this.this$01);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_SubcircuitDialog$1_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'SubcircuitDialog/1', 697);
|
|
function SubcircuitDialog$2(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(698, 1, $intern_56, SubcircuitDialog$2);
|
|
_.onClick = function onClick_54(event_0){
|
|
$hide_0(this.this$01, false);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_SubcircuitDialog$2_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'SubcircuitDialog/2', 698);
|
|
function $reset_11(this$static){
|
|
this$static.frequency = this$static.minF;
|
|
this$static.freqTime = 0;
|
|
this$static.dir_0 = 1;
|
|
$setParams(this$static);
|
|
}
|
|
|
|
function $setParams(this$static){
|
|
if (this$static.frequency < this$static.minF || this$static.frequency > this$static.maxF) {
|
|
this$static.frequency = this$static.minF;
|
|
this$static.freqTime = 0;
|
|
this$static.dir_0 = 1;
|
|
}
|
|
if ((this$static.flags & 1) == 0) {
|
|
this$static.fadd = this$static.dir_0 * sim_0.timeStep * (this$static.maxF - this$static.minF) / this$static.sweepTime;
|
|
this$static.fmul = 1;
|
|
}
|
|
else {
|
|
this$static.fadd = 0;
|
|
this$static.fmul = $wnd.Math.pow(this$static.maxF / this$static.minF, this$static.dir_0 * sim_0.timeStep / this$static.sweepTime);
|
|
}
|
|
this$static.savedTimeStep = sim_0.timeStep;
|
|
}
|
|
|
|
function SweepElm(xx, yy){
|
|
CircuitElm.call(this, xx, yy);
|
|
this.dir_0 = 1;
|
|
this.minF = 20;
|
|
this.maxF = 4000;
|
|
this.maxV = 5;
|
|
this.sweepTime = 0.1;
|
|
this.flags = 2;
|
|
$reset_11(this);
|
|
}
|
|
|
|
function SweepElm_0(xa, ya, xb, yb, f, st){
|
|
CircuitElm_0.call(this, xa, ya, xb, yb, f);
|
|
this.dir_0 = 1;
|
|
this.minF = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.maxF = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.maxV = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.sweepTime = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
$reset_11(this);
|
|
}
|
|
|
|
defineClass(272, 8, {8:1, 10:1, 272:1}, SweepElm, SweepElm_0);
|
|
_.addRoutingObstacle = function addRoutingObstacle_21(router){
|
|
$addWire(router, this.point1.x_0, this.point1.y_0, this.lead1.x_0, this.lead1.y_0);
|
|
$addObstacle(router, this.point2.x_0 - 17, this.point2.y_0 - 17, this.point2.x_0 + 17, this.point2.y_0 + 17);
|
|
}
|
|
;
|
|
_.doStep = function doStep_47(){
|
|
$updateVoltageSource(this.voltSource, this.v);
|
|
}
|
|
;
|
|
_.draw = function draw_74(g){
|
|
var i, s, tm, w, xc, yc, yy;
|
|
$setBbox_0(this, this.point1, this.point2, 17);
|
|
$setVoltageColor(this, g, this.volts[0]);
|
|
drawThickLine_0(g, this.point1, this.lead1, 3);
|
|
$setColor_0(g, mouseElmRef == this || this.selected_0 || $containsKey(app_0.mouse.scopePlotRoles, this) || instanceOf(mouseElmRef, 21) && $getElm_0(mouseElmRef.elmScope) == this || $isOnHighlightedNet(this)?selectColor_0:($clinit_Color() , gray));
|
|
$setPowerColor_0(this, g);
|
|
xc = this.point2.x_0;
|
|
yc = this.point2.y_0;
|
|
drawThickCircle(g, xc, yc, 17);
|
|
$adjustBbox(this, xc - 17, yc - 17, xc + 17, yc + 17);
|
|
tm = ($clinit_System() , fromDouble_0(Date.now()));
|
|
tm = mod(tm, 2000);
|
|
compare_0(tm, $intern_22) > 0 && (tm = sub_1(2000, tm));
|
|
w = 1 + toDouble_0(tm) * 0.002;
|
|
app_0.ui.app.simRunning && (w = 1 + 2 * (this.frequency - this.minF) / (this.maxF - this.minF));
|
|
g.context.beginPath();
|
|
g.context.lineWidth = 3;
|
|
for (i = -10; i <= 10; i++) {
|
|
yy = yc + round_int(0.95 * $wnd.Math.sin(i * $intern_1 * w / 10) * 8);
|
|
i == -10?$moveTo(g.context, xc + -10, yy):$lineTo(g.context, xc + i, yy);
|
|
}
|
|
g.context.stroke();
|
|
g.context.lineWidth = 1;
|
|
if (app_0.menus.showValuesCheckItem.on) {
|
|
s = getUnitText(this.frequency, 'Hz', true);
|
|
(this.dx == 0 || this.dy == 0) && $drawValues(this, g, s, 17);
|
|
}
|
|
$drawPosts(this, g);
|
|
this.curcount_0 = $updateDotCount(-this.current_0, this.curcount_0);
|
|
app_0.mouse.dragElm == this || $drawDots(g, this.point1, this.lead1, this.curcount_0);
|
|
}
|
|
;
|
|
_.dumpXml = function dumpXml_79(doc, elem){
|
|
dumpAttr_1(elem, 'x', this.x_0 + ' ' + this.y_0 + ' ' + this.x2 + ' ' + this.y2);
|
|
dumpAttr_0(elem, 'f', this.flags);
|
|
dumpAttr(elem, 'mi', this.minF);
|
|
dumpAttr(elem, 'ma', this.maxF);
|
|
dumpAttr(elem, 'mv', this.maxV);
|
|
dumpAttr(elem, 'sw', this.sweepTime);
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_101(){
|
|
return 170;
|
|
}
|
|
;
|
|
_.getEditInfo = function getEditInfo_69(n){
|
|
var ei;
|
|
if (n == 0)
|
|
return new EditInfo_0('Min Frequency (Hz)', this.minF, 0, 0);
|
|
if (n == 1)
|
|
return new EditInfo_0('Max Frequency (Hz)', this.maxF, 0, 0);
|
|
if (n == 2)
|
|
return new EditInfo_0('Sweep Time (s)', this.sweepTime, 0, 0);
|
|
if (n == 3) {
|
|
ei = new EditInfo_0('', 0, -1, -1);
|
|
ei.checkbox = new Checkbox_0('Logarithmic', (this.flags & 1) != 0);
|
|
return ei;
|
|
}
|
|
if (n == 4)
|
|
return $setUnitStep(new EditInfo_0('Max Voltage', this.maxV, 0, 0));
|
|
if (n == 5) {
|
|
ei = new EditInfo_0('', 0, -1, -1);
|
|
ei.checkbox = new Checkbox_0('Bidirectional', (this.flags & 2) != 0);
|
|
return ei;
|
|
}
|
|
return null;
|
|
}
|
|
;
|
|
_.getElmType = function getElmType_21(){
|
|
return 'sweep';
|
|
}
|
|
;
|
|
_.getInfo_0 = function getInfo_79(arr){
|
|
arr[0] = 'sweep ' + ((this.flags & 1) == 0?'(linear)':'(log)');
|
|
arr[1] = 'I = ' + getUnitText($wnd.Math.abs(this.current_0), 'A', false);
|
|
arr[2] = 'V = ' + getUnitText(this.volts[0], 'V', false);
|
|
arr[3] = 'f = ' + getUnitText(this.frequency, 'Hz', false);
|
|
arr[4] = 'range = ' + getUnitText(this.minF, 'Hz', false) + ' .. ' + getUnitText(this.maxF, 'Hz', false);
|
|
arr[5] = 'time = ' + getUnitText(this.sweepTime, 's', false);
|
|
}
|
|
;
|
|
_.getPostCount_0 = function getPostCount_69(){
|
|
return 1;
|
|
}
|
|
;
|
|
_.getPower = function getPower_12(){
|
|
return -this.volts[0] * this.current_0;
|
|
}
|
|
;
|
|
_.getVoltageDiff_0 = function getVoltageDiff_23(){
|
|
return this.volts[0];
|
|
}
|
|
;
|
|
_.getVoltageSourceCount = function getVoltageSourceCount_49(){
|
|
return 1;
|
|
}
|
|
;
|
|
_.getXmlDumpType = function getXmlDumpType_25(){
|
|
return 'sw';
|
|
}
|
|
;
|
|
_.hasGroundConnection = function hasGroundConnection_19(n1){
|
|
return true;
|
|
}
|
|
;
|
|
_.reset_0 = function reset_47(){
|
|
$reset_11(this);
|
|
}
|
|
;
|
|
_.setEditValue = function setEditValue_69(n, ei){
|
|
var maxfreq;
|
|
maxfreq = 1 / (8 * sim_0.timeStep);
|
|
if (n == 0) {
|
|
this.minF = ei.value_0;
|
|
this.minF > maxfreq && (this.minF = maxfreq);
|
|
}
|
|
if (n == 1) {
|
|
this.maxF = ei.value_0;
|
|
this.maxF > maxfreq && (this.maxF = maxfreq);
|
|
}
|
|
n == 2 && (this.sweepTime = ei.value_0);
|
|
if (n == 3) {
|
|
this.flags &= -2;
|
|
$getState(ei.checkbox) && (this.flags |= 1);
|
|
}
|
|
n == 4 && (this.maxV = ei.value_0);
|
|
if (n == 5) {
|
|
this.flags &= -3;
|
|
$getState(ei.checkbox) && (this.flags |= 2);
|
|
}
|
|
$setParams(this);
|
|
}
|
|
;
|
|
_.setPoints = function setPoints_67(){
|
|
$setPoints(this);
|
|
this.lead1 = $interpPoint(this.point1, this.point2, 1 - 17 / this.dn);
|
|
}
|
|
;
|
|
_.stamp = function stamp_60(){
|
|
$stampVoltageSource(ground, this.nodes[0], this.voltSource);
|
|
}
|
|
;
|
|
_.startIteration = function startIteration_20(){
|
|
sim_0.timeStep != this.savedTimeStep && $setParams(this);
|
|
this.v = $wnd.Math.sin(this.freqTime) * this.maxV;
|
|
this.freqTime += this.frequency * 2 * $intern_1 * sim_0.timeStep;
|
|
this.frequency = this.frequency * this.fmul + this.fadd;
|
|
if (this.frequency >= this.maxF && this.dir_0 == 1) {
|
|
if ((this.flags & 2) != 0) {
|
|
this.fadd = -this.fadd;
|
|
this.fmul = 1 / this.fmul;
|
|
this.dir_0 = -1;
|
|
}
|
|
else
|
|
this.frequency = this.minF;
|
|
}
|
|
if (this.frequency <= this.minF && this.dir_0 == -1) {
|
|
this.fadd = -this.fadd;
|
|
this.fmul = 1 / this.fmul;
|
|
this.dir_0 = 1;
|
|
}
|
|
}
|
|
;
|
|
_.undumpXml = function undumpXml_82(xml){
|
|
this.flags = $parseIntAttr(xml, 'f', this.flags);
|
|
this.minF = $parseDoubleAttr(xml, 'mi', this.minF);
|
|
this.maxF = $parseDoubleAttr(xml, 'ma', this.maxF);
|
|
this.maxV = $parseDoubleAttr(xml, 'mv', this.maxV);
|
|
this.sweepTime = $parseDoubleAttr(xml, 'sw', this.sweepTime);
|
|
$reset_11(this);
|
|
}
|
|
;
|
|
_.validate = function validate_16(){
|
|
return $validateRailNode(this, 0);
|
|
}
|
|
;
|
|
_.dir_0 = 0;
|
|
_.fadd = 0;
|
|
_.fmul = 0;
|
|
_.freqTime = 0;
|
|
_.frequency = 0;
|
|
_.maxF = 0;
|
|
_.maxV = 0;
|
|
_.minF = 0;
|
|
_.savedTimeStep = 0;
|
|
_.sweepTime = 0;
|
|
_.v = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_SweepElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'SweepElm', 272);
|
|
function $setPoints_25(this$static){
|
|
var hs, i;
|
|
$setPoints_3(this$static);
|
|
$calcLeads(this$static, 32);
|
|
this$static.swposts = $newPointArray(this$static.throwCount);
|
|
this$static.swpoles = $newPointArray(2 + this$static.throwCount);
|
|
for (i = 0; i != this$static.throwCount; i++) {
|
|
hs = -16 * (i - ((this$static.throwCount - 1) / 2 | 0));
|
|
this$static.throwCount == 2 && i == 0 && (hs = 16);
|
|
$interpPoint_2(this$static.lead1, this$static.lead2, this$static.swpoles[i], 1, hs);
|
|
$interpPoint_2(this$static.point1, this$static.point2, this$static.swposts[i], 1, hs);
|
|
}
|
|
this$static.swpoles[i] = this$static.lead2;
|
|
this$static.posCount = (this$static.flags & 1) != 0 && this$static.throwCount == 2?3:this$static.throwCount;
|
|
}
|
|
|
|
function Switch2Elm(xx, yy){
|
|
SwitchElm_1.call(this, xx, yy, false);
|
|
this.noDiagonal = true;
|
|
this.throwCount = 2;
|
|
}
|
|
|
|
function Switch2Elm_0(xa, ya, xb, yb, f, st){
|
|
SwitchElm_0.call(this, xa, ya, xb, yb, f, st);
|
|
this.link_0 = (new Integer_0($nextToken(st))).value_0;
|
|
this.throwCount = 2;
|
|
try {
|
|
this.throwCount = (new Integer_0($nextToken(st))).value_0;
|
|
}
|
|
catch ($e0) {
|
|
$e0 = toJava($e0);
|
|
if (!instanceOf($e0, 13))
|
|
throw toJs($e0);
|
|
}
|
|
this.noDiagonal = true;
|
|
}
|
|
|
|
defineClass(274, 61, {8:1, 10:1, 274:1, 61:1}, Switch2Elm, Switch2Elm_0);
|
|
_.addRoutingObstacle = function addRoutingObstacle_22(router){
|
|
var i, i0, pts;
|
|
$addWire(router, this.point1.x_0, this.point1.y_0, this.lead1.x_0, this.lead1.y_0);
|
|
for (i0 = 0; i0 != this.throwCount; i0++)
|
|
$addWire(router, this.swposts[i0].x_0, this.swposts[i0].y_0, this.swpoles[i0].x_0, this.swpoles[i0].y_0);
|
|
pts = initUnidimensionalArray(Lcom_lushprojects_circuitjs1_client_Point_2_classLit, $intern_78, 14, this.throwCount + 1, 0, 1);
|
|
pts[0] = this.lead1;
|
|
for (i = 0; i != this.throwCount; i++)
|
|
pts[i + 1] = this.swpoles[i];
|
|
$addObstacle_0(router, pts);
|
|
}
|
|
;
|
|
_.calculateCurrent = function calculateCurrent_33(){
|
|
this.position == 2 && (this.flags & 1) != 0 && this.throwCount == 2?(this.current_0 = 0):this.resistance > 0 && (this.current_0 = (this.volts[0] - this.volts[this.position + 1]) / this.resistance);
|
|
}
|
|
;
|
|
_.draw = function draw_75(g){
|
|
var i;
|
|
$setBbox_0(this, this.point1, this.point2, 16);
|
|
$adjustBbox_0(this, this.swposts[0], this.swposts[this.throwCount - 1]);
|
|
$setVoltageColor(this, g, this.volts[0]);
|
|
drawThickLine_0(g, this.point1, this.lead1, 3);
|
|
for (i = 0; i != this.throwCount; i++) {
|
|
$setVoltageColor(this, g, this.volts[i + 1]);
|
|
drawThickLine_0(g, this.swpoles[i], this.swposts[i], 3);
|
|
}
|
|
mouseElmRef == this || this.selected_0 || $containsKey(app_0.mouse.scopePlotRoles, this) || instanceOf(mouseElmRef, 21) && $getElm_0(mouseElmRef.elmScope) == this || $isOnHighlightedNet(this) || $setColor_0(g, whiteColor);
|
|
drawThickLine_0(g, this.lead1, this.swpoles[this.position], 3);
|
|
this.curcount_0 = $updateDotCount(this.current_0, this.curcount_0);
|
|
$drawDots(g, this.point1, this.lead1, this.curcount_0);
|
|
this.position == 2 && (this.flags & 1) != 0 && this.throwCount == 2 || $drawDots(g, this.swpoles[this.position], this.swposts[this.position], this.curcount_0);
|
|
$drawPosts(this, g);
|
|
}
|
|
;
|
|
_.dumpXml = function dumpXml_80(doc, elem){
|
|
$dumpXml_2(this, elem);
|
|
dumpAttr_0(elem, 'li', this.link_0);
|
|
dumpAttr_0(elem, 'th', this.throwCount);
|
|
}
|
|
;
|
|
_.flipX = function flipX_16(c2, count){
|
|
$flipX(this, c2);
|
|
this.position = this.posCount - 1 - this.position;
|
|
this.positionFlipped = !this.positionFlipped;
|
|
}
|
|
;
|
|
_.flipXY = function flipXY_13(c2, count){
|
|
$flipXY(this, c2);
|
|
this.position = this.posCount - 1 - this.position;
|
|
this.positionFlipped = !this.positionFlipped;
|
|
}
|
|
;
|
|
_.flipY = function flipY_16(c2, count){
|
|
$flipY(this, c2);
|
|
this.position = this.posCount - 1 - this.position;
|
|
this.positionFlipped = !this.positionFlipped;
|
|
}
|
|
;
|
|
_.getConnection = function getConnection_36(n1, n2){
|
|
if (this.position == 2 && (this.flags & 1) != 0 && this.throwCount == 2)
|
|
return false;
|
|
return $comparePair(n1, n2, 0, 1 + this.position);
|
|
}
|
|
;
|
|
_.getCurrentIntoNode = function getCurrentIntoNode_30(n){
|
|
if (n == 0)
|
|
return -this.current_0;
|
|
if (n == this.position + 1)
|
|
return this.current_0;
|
|
return 0;
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_102(){
|
|
return 83;
|
|
}
|
|
;
|
|
_.getEditInfo = function getEditInfo_70(n){
|
|
if (n == 1)
|
|
return $disallowSliders($setDimensionless(new EditInfo_0('Group Number (for linking)', this.link_0, 0, 100)));
|
|
if (n == 2)
|
|
return $disallowSliders($setDimensionless(new EditInfo_0('# of Throws', this.throwCount, 2, 10)));
|
|
return $getEditInfo_1(this, n);
|
|
}
|
|
;
|
|
_.getElmType = function getElmType_22(){
|
|
return 'switch (SPDT)';
|
|
}
|
|
;
|
|
_.getInfo_0 = function getInfo_80(arr){
|
|
arr[0] = 'switch (' + (this.link_0 == 0?'S':'D') + 'P' + (this.throwCount > 2?this.throwCount + 'T)':'DT)');
|
|
arr[1] = 'I = ' + getUnitText($wnd.Math.abs(this.current_0), 'A', false);
|
|
}
|
|
;
|
|
_.getPost = function getPost_23(n){
|
|
return n == 0?this.point1:this.swposts[n - 1];
|
|
}
|
|
;
|
|
_.getPostCount_0 = function getPostCount_70(){
|
|
return 1 + this.throwCount;
|
|
}
|
|
;
|
|
_.getShortcut = function getShortcut_42(){
|
|
return 83;
|
|
}
|
|
;
|
|
_.getSwitchRect = function getSwitchRect_5(){
|
|
return $union($union(new Rectangle_1(this.lead1), new Rectangle_1(this.swpoles[0])), new Rectangle_1(this.swpoles[this.throwCount - 1]));
|
|
}
|
|
;
|
|
_.getVoltageSourceCount = function getVoltageSourceCount_50(){
|
|
if (this.position == 2 && (this.flags & 1) != 0 && this.throwCount == 2)
|
|
return 0;
|
|
return this.resistance > 0?0:1;
|
|
}
|
|
;
|
|
_.isRemovableWire = function isRemovableWire_10(){
|
|
return false;
|
|
}
|
|
;
|
|
_.isWireEquivalent = function isWireEquivalent_11(){
|
|
return this.resistance == 0;
|
|
}
|
|
;
|
|
_.setEditValue = function setEditValue_70(n, ei){
|
|
if (n == 1) {
|
|
this.link_0 = round_int(ei.value_0);
|
|
}
|
|
else if (n == 2) {
|
|
ei.value_0 >= 2 && (this.throwCount = round_int(ei.value_0));
|
|
this.throwCount > 2 && (this.momentary = false);
|
|
$allocNodes(this);
|
|
$setPoints_25(this);
|
|
}
|
|
else
|
|
$setEditValue_2(this, n, ei);
|
|
}
|
|
;
|
|
_.setPoints = function setPoints_68(){
|
|
$setPoints_25(this);
|
|
}
|
|
;
|
|
_.setVoltageSource = function setVoltageSource_15(n, v){
|
|
this.voltSource = v;
|
|
$setNodes(v, this.nodes[0], this.nodes[this.position + 1]);
|
|
}
|
|
;
|
|
_.stamp = function stamp_61(){
|
|
if (this.position == 2 && (this.flags & 1) != 0 && this.throwCount == 2)
|
|
return;
|
|
this.resistance > 0?$stampResistor(this.nodes[0], this.nodes[this.position + 1], this.resistance):$stampVoltageSource_0(this.nodes[0], this.nodes[this.position + 1], this.voltSource, 0);
|
|
}
|
|
;
|
|
_.toggle = function toggle_2(){
|
|
var i, o, pos, s2;
|
|
$toggle(this);
|
|
if (this.link_0 != 0) {
|
|
for (i = 0; i != sim_0.elmList.arrayList.array.length; i++) {
|
|
o = $elementAt(sim_0.elmList, i);
|
|
if (instanceOf(o, 274)) {
|
|
s2 = o;
|
|
if (s2.link_0 == this.link_0) {
|
|
pos = this.position;
|
|
s2.positionFlipped != this.positionFlipped && (pos = this.posCount - 1 - pos);
|
|
pos < s2.posCount && (s2.position = pos);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
;
|
|
_.undumpXml = function undumpXml_83(xml){
|
|
$undumpXml_1(this, xml);
|
|
this.link_0 = $parseIntAttr(xml, 'li', this.link_0);
|
|
this.throwCount = $parseIntAttr(xml, 'th', this.throwCount);
|
|
}
|
|
;
|
|
_.validate = function validate_17(){
|
|
var fpi;
|
|
if (this.position == 2 && (this.flags & 1) != 0 && this.throwCount == 2)
|
|
return true;
|
|
if (this.resistance > 0)
|
|
return true;
|
|
fpi = new FindPathInfo(2, this, this.nodes[0], sim_0);
|
|
if ($findPath(fpi, $getNode(this, 1 + this.position))) {
|
|
this.resistance = $intern_83;
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
;
|
|
_.link_0 = 0;
|
|
_.positionFlipped = false;
|
|
_.throwCount = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_Switch2Elm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'Switch2Elm', 274);
|
|
function $setupPins_23(this$static){
|
|
this$static.sizeX = 2;
|
|
this$static.sizeY = 3;
|
|
this$static.pins = initUnidimensionalArray(Lcom_lushprojects_circuitjs1_client_ChipElm$Pin_2_classLit, $intern_3, 9, 4 + ((this$static.flags & 2) != 0 || (this$static.flags & 4) != 0?1:0) + ((this$static.flags & 4) != 0?1:0), 0, 1);
|
|
this$static.pins[0] = new ChipElm$Pin(this$static, 0, 2, 'T');
|
|
this$static.pins[1] = new ChipElm$Pin(this$static, 0, 3, 'Q');
|
|
this$static.pins[1].output = this$static.pins[1].state = true;
|
|
this$static.pins[2] = new ChipElm$Pin(this$static, (this$static.flags & 4) != 0?1:2, 3, 'Q');
|
|
this$static.pins[2].output = true;
|
|
this$static.pins[2].lineOver = true;
|
|
this$static.pins[3] = new ChipElm$Pin(this$static, 1, 2, '');
|
|
this$static.pins[3].clock = true;
|
|
if ((this$static.flags & 4) != 0) {
|
|
this$static.pins[5] = new ChipElm$Pin(this$static, 2, 2, 'S');
|
|
this$static.pins[4] = new ChipElm$Pin(this$static, 2, 3, 'R');
|
|
}
|
|
else {
|
|
((this$static.flags & 2) != 0 || (this$static.flags & 4) != 0) && (this$static.pins[4] = new ChipElm$Pin(this$static, 2, 2, 'R'));
|
|
}
|
|
}
|
|
|
|
function TFlipFlopElm(xx, yy){
|
|
$clinit_ChipElm();
|
|
ChipElm.call(this, xx, yy);
|
|
}
|
|
|
|
function TFlipFlopElm_0(xa, ya, xb, yb, f, st){
|
|
$clinit_ChipElm();
|
|
ChipElm_0.call(this, xa, ya, xb, yb, f, st);
|
|
this.pins[2].value_0 = !this.pins[1].value_0;
|
|
}
|
|
|
|
defineClass(376, 32, $intern_85, TFlipFlopElm, TFlipFlopElm_0);
|
|
_.execute_3 = function execute_47(){
|
|
this.pins[3].value_0 && !this.lastClock && this.pins[0].value_0 && (this.pins[1].value_0 = !this.pins[1].value_0);
|
|
(this.flags & 4) != 0 && this.pins[5].value_0 && (this.pins[1].value_0 = true);
|
|
((this.flags & 2) != 0 || (this.flags & 4) != 0) && this.pins[4].value_0 && (this.pins[1].value_0 = false);
|
|
this.pins[2].value_0 = !this.pins[1].value_0;
|
|
this.lastClock = this.pins[3].value_0;
|
|
}
|
|
;
|
|
_.getChipEditInfo = function getChipEditInfo_25(n){
|
|
var ei;
|
|
if (n == 0) {
|
|
ei = new EditInfo_0('', 0, -1, -1);
|
|
ei.checkbox = new Checkbox_0('Reset Pin', (this.flags & 2) != 0 || (this.flags & 4) != 0);
|
|
return ei;
|
|
}
|
|
if (n == 1) {
|
|
ei = new EditInfo_0('', 0, -1, -1);
|
|
ei.checkbox = new Checkbox_0('Set Pin', (this.flags & 4) != 0);
|
|
return ei;
|
|
}
|
|
return null;
|
|
}
|
|
;
|
|
_.getChipName = function getChipName_30(){
|
|
return 'T flip-flop';
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_103(){
|
|
return 193;
|
|
}
|
|
;
|
|
_.getPostCount_0 = function getPostCount_71(){
|
|
return 4 + ((this.flags & 2) != 0 || (this.flags & 4) != 0?1:0) + ((this.flags & 4) != 0?1:0);
|
|
}
|
|
;
|
|
_.getVoltageSourceCount = function getVoltageSourceCount_51(){
|
|
return 2;
|
|
}
|
|
;
|
|
_.reset_0 = function reset_48(){
|
|
$reset_0(this);
|
|
this.volts[2] = this.highVoltage;
|
|
this.pins[2].value_0 = true;
|
|
}
|
|
;
|
|
_.setChipEditValue = function setChipEditValue_26(n, ei){
|
|
if (n == 0) {
|
|
$getState(ei.checkbox)?(this.flags |= 2):(this.flags &= -3);
|
|
$setupPins_23(this);
|
|
$allocNodes(this);
|
|
$setPoints_0(this);
|
|
}
|
|
if (n == 1) {
|
|
$getState(ei.checkbox)?(this.flags |= 4):(this.flags &= -5);
|
|
$setupPins_23(this);
|
|
$allocNodes(this);
|
|
$setPoints_0(this);
|
|
}
|
|
}
|
|
;
|
|
_.setupPins = function setupPins_31(){
|
|
$setupPins_23(this);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_TFlipFlopElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'TFlipFlopElm', 376);
|
|
function TappedTransformerElm(xx, yy){
|
|
CircuitElm.call(this, xx, yy);
|
|
this.inductance = 4;
|
|
this.ratio = 1;
|
|
this.noDiagonal = true;
|
|
this.couplingCoef = 0.99;
|
|
this.current = initUnidimensionalArray(D_classLit, $intern_76, 7, 4, 15, 1);
|
|
this.curcount = initUnidimensionalArray(D_classLit, $intern_76, 7, 4, 15, 1);
|
|
this.voltdiff = initUnidimensionalArray(D_classLit, $intern_76, 7, 3, 15, 1);
|
|
this.curSourceValue = initUnidimensionalArray(D_classLit, $intern_76, 7, 3, 15, 1);
|
|
this.a = initUnidimensionalArray(D_classLit, $intern_76, 7, 9, 15, 1);
|
|
}
|
|
|
|
function TappedTransformerElm_0(xa, ya, xb, yb, f, st){
|
|
CircuitElm_0.call(this, xa, ya, xb, yb, f);
|
|
this.inductance = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.ratio = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.current = initUnidimensionalArray(D_classLit, $intern_76, 7, 4, 15, 1);
|
|
this.curcount = initUnidimensionalArray(D_classLit, $intern_76, 7, 4, 15, 1);
|
|
this.current[0] = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.current[1] = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
try {
|
|
this.current[2] = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
}
|
|
catch ($e0) {
|
|
$e0 = toJava($e0);
|
|
if (!instanceOf($e0, 13))
|
|
throw toJs($e0);
|
|
}
|
|
this.couplingCoef = 0.99;
|
|
try {
|
|
this.couplingCoef = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
}
|
|
catch ($e1) {
|
|
$e1 = toJava($e1);
|
|
if (!instanceOf($e1, 13))
|
|
throw toJs($e1);
|
|
}
|
|
this.voltdiff = initUnidimensionalArray(D_classLit, $intern_76, 7, 3, 15, 1);
|
|
this.curSourceValue = initUnidimensionalArray(D_classLit, $intern_76, 7, 3, 15, 1);
|
|
this.noDiagonal = true;
|
|
this.a = initUnidimensionalArray(D_classLit, $intern_76, 7, 9, 15, 1);
|
|
}
|
|
|
|
defineClass(402, 8, $intern_85, TappedTransformerElm, TappedTransformerElm_0);
|
|
_.calculateCurrent = function calculateCurrent_34(){
|
|
var i, j;
|
|
this.voltdiff[0] = this.volts[0] - this.volts[1];
|
|
this.voltdiff[1] = this.volts[2] - this.volts[3];
|
|
this.voltdiff[2] = this.volts[3] - this.volts[4];
|
|
for (i = 0; i != 3; i++) {
|
|
this.current[i] = this.curSourceValue[i];
|
|
for (j = 0; j != 3; j++)
|
|
this.current[i] += this.a[i * 3 + j] * this.voltdiff[j];
|
|
}
|
|
this.current[3] = this.current[1] - this.current[2];
|
|
}
|
|
;
|
|
_.doStep = function doStep_48(){
|
|
$stampCurrentSource(this.nodes[0], this.nodes[1], this.curSourceValue[0]);
|
|
$stampCurrentSource(this.nodes[2], this.nodes[3], this.curSourceValue[1]);
|
|
$stampCurrentSource(this.nodes[3], this.nodes[4], this.curSourceValue[2]);
|
|
}
|
|
;
|
|
_.draw = function draw_76(g){
|
|
var i;
|
|
for (i = 0; i != 5; i++) {
|
|
$setVoltageColor(this, g, this.volts[i]);
|
|
drawThickLine_0(g, this.ptEnds[i], this.ptCoil[i], 3);
|
|
}
|
|
for (i = 0; i != 4; i++) {
|
|
if (i == 1)
|
|
continue;
|
|
$setPowerColor(this, g, this.current[i] * (this.volts[i] - this.volts[i + 1]));
|
|
$drawCoil(this, g, i > 1?-6 * this.flip:6 * this.flip, this.ptCoil[i], this.ptCoil[i + 1], this.volts[i], this.volts[i + 1]);
|
|
}
|
|
$setColor_0(g, mouseElmRef == this || this.selected_0 || $containsKey(app_0.mouse.scopePlotRoles, this) || instanceOf(mouseElmRef, 21) && $getElm_0(mouseElmRef.elmScope) == this || $isOnHighlightedNet(this)?selectColor_0:lightGrayColor);
|
|
for (i = 0; i != 4; i += 2) {
|
|
drawThickLine_0(g, this.ptCore[i], this.ptCore[i + 1], 3);
|
|
}
|
|
for (i = 0; i != 4; i++)
|
|
this.curcount[i] = $updateDotCount(this.current[i], this.curcount[i]);
|
|
$drawDots(g, this.ptEnds[0], this.ptCoil[0], this.curcount[0]);
|
|
$drawDots(g, this.ptCoil[0], this.ptCoil[1], this.curcount[0]);
|
|
$drawDots(g, this.ptCoil[1], this.ptEnds[1], this.curcount[0]);
|
|
$drawDots(g, this.ptEnds[2], this.ptCoil[2], this.curcount[1]);
|
|
$drawDots(g, this.ptCoil[2], this.ptCoil[3], this.curcount[1]);
|
|
$drawDots(g, this.ptCoil[3], this.ptEnds[3], this.curcount[3]);
|
|
$drawDots(g, this.ptCoil[3], this.ptCoil[4], this.curcount[2]);
|
|
$drawDots(g, this.ptCoil[4], this.ptEnds[4], this.curcount[2]);
|
|
$drawPosts(this, g);
|
|
$setBbox_0(this, this.ptEnds[0], this.ptEnds[4], 0);
|
|
}
|
|
;
|
|
_.dumpXml = function dumpXml_81(doc, elem){
|
|
dumpAttr_1(elem, 'x', this.x_0 + ' ' + this.y_0 + ' ' + this.x2 + ' ' + this.y2);
|
|
dumpAttr_0(elem, 'f', this.flags);
|
|
dumpAttr(elem, 'in', this.inductance);
|
|
dumpAttr(elem, 'ra', this.ratio);
|
|
dumpAttr(elem, 'co', this.couplingCoef);
|
|
}
|
|
;
|
|
_.dumpXmlState = function dumpXmlState_15(doc, elem){
|
|
dumpAttr(elem, 'c0', this.current[0]);
|
|
dumpAttr(elem, 'c1', this.current[1]);
|
|
dumpAttr(elem, 'c2', this.current[2]);
|
|
}
|
|
;
|
|
_.flipX = function flipX_17(c2, count){
|
|
this.flags ^= 1;
|
|
$flipX(this, c2);
|
|
}
|
|
;
|
|
_.flipXY = function flipXY_14(c2, count){
|
|
this.flags ^= 1;
|
|
$flipXY(this, c2);
|
|
}
|
|
;
|
|
_.flipY = function flipY_17(c2, count){
|
|
this.flags ^= 1;
|
|
$flipY(this, c2);
|
|
}
|
|
;
|
|
_.getConnection = function getConnection_37(n1, n2){
|
|
if (n1 == 0 && n2 == 1 || n1 == 1 && n2 == 0)
|
|
return true;
|
|
if (n1 == 2 && n2 == 3 || n1 == 3 && n2 == 2)
|
|
return true;
|
|
if (n1 == 3 && n2 == 4 || n1 == 4 && n2 == 3)
|
|
return true;
|
|
if (n1 == 2 && n2 == 4 || n1 == 4 && n2 == 2)
|
|
return true;
|
|
return false;
|
|
}
|
|
;
|
|
_.getCurrentIntoNode = function getCurrentIntoNode_31(n){
|
|
if (n == 0)
|
|
return -this.current[0];
|
|
if (n == 1)
|
|
return this.current[0];
|
|
if (n == 2)
|
|
return -this.current[1];
|
|
if (n == 3)
|
|
return this.current[3];
|
|
return this.current[2];
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_104(){
|
|
return 169;
|
|
}
|
|
;
|
|
_.getEditInfo = function getEditInfo_71(n){
|
|
var ei;
|
|
if (n == 0)
|
|
return $setPositive(new EditInfo_0('Primary Inductance (H)', this.inductance, $intern_34, 5));
|
|
if (n == 1)
|
|
return $setPositive($setDimensionless(new EditInfo_0('Ratio (N1/N2)', 1 / this.ratio, 1, 10)));
|
|
if (n == 2)
|
|
return $setPositive($setDimensionless(new EditInfo_0('Coupling Coefficient', this.couplingCoef, 0, 1)));
|
|
if (n == 3) {
|
|
ei = new EditInfo_0('', 0, -1, -1);
|
|
ei.checkbox = new Checkbox_0('Trapezoidal Approximation', (this.flags & 2) == 0);
|
|
return ei;
|
|
}
|
|
return null;
|
|
}
|
|
;
|
|
_.getInfo_0 = function getInfo_81(arr){
|
|
arr[0] = 'transformer';
|
|
arr[1] = 'L = ' + getUnitText(this.inductance, 'H', false);
|
|
arr[2] = 'Ratio = 1:' + this.ratio;
|
|
arr[3] = 'Vd1 = ' + getUnitText(this.volts[0] - this.volts[2], 'V', false);
|
|
arr[4] = 'Vd2 = ' + getUnitText(this.volts[1] - this.volts[3], 'V', false);
|
|
}
|
|
;
|
|
_.getMatrixConnection = function getMatrixConnection_11(n1, n2){
|
|
return true;
|
|
}
|
|
;
|
|
_.getPost = function getPost_24(n){
|
|
return this.ptEnds[n];
|
|
}
|
|
;
|
|
_.getPostCount_0 = function getPostCount_72(){
|
|
return 5;
|
|
}
|
|
;
|
|
_.getXmlDumpType = function getXmlDumpType_26(){
|
|
return 'tt';
|
|
}
|
|
;
|
|
_.reset_0 = function reset_49(){
|
|
this.current[0] = this.current[1] = this.current[2] = this.current[3] = this.volts[0] = this.volts[1] = this.volts[2] = this.volts[3] = this.volts[4] = this.curcount[0] = this.curcount[1] = this.curcount[2] = 0;
|
|
this.curSourceValue[0] = this.curSourceValue[1] = this.curSourceValue[2] = 0;
|
|
}
|
|
;
|
|
_.setEditValue = function setEditValue_71(n, ei){
|
|
n == 0 && ei.value_0 > 0 && (this.inductance = ei.value_0);
|
|
n == 1 && this.ratio > 0 && (this.ratio = 1 / ei.value_0);
|
|
n == 2 && (ei.value_0 > 0 && ei.value_0 < 1?(this.couplingCoef = ei.value_0):(ei.error = 'must be > 0 and < 1'));
|
|
n == 3 && ($getState(ei.checkbox)?(this.flags &= -3):(this.flags |= 2));
|
|
}
|
|
;
|
|
_.setPoints = function setPoints_69(){
|
|
var b, cd, ce, hs, i;
|
|
$setPoints(this);
|
|
this.flip = (this.flags & 1) != 0?-1:1;
|
|
hs = 32 * this.flip;
|
|
this.ptEnds = $newPointArray(5);
|
|
this.ptCoil = $newPointArray(5);
|
|
this.ptCore = $newPointArray(4);
|
|
this.ptEnds[0] = this.point1;
|
|
this.ptEnds[2] = this.point2;
|
|
$interpPoint_2(this.point1, this.point2, this.ptEnds[1], 0, -hs * 2);
|
|
$interpPoint_2(this.point1, this.point2, this.ptEnds[3], 1, -hs);
|
|
$interpPoint_2(this.point1, this.point2, this.ptEnds[4], 1, -hs * 2);
|
|
ce = 0.5 - 12 / this.dn;
|
|
cd = 0.5 - 2 / this.dn;
|
|
$interpPoint_1(this.ptEnds[0], this.ptEnds[2], this.ptCoil[0], ce);
|
|
$interpPoint_2(this.ptEnds[0], this.ptEnds[2], this.ptCoil[1], ce, -hs * 2);
|
|
$interpPoint_1(this.ptEnds[0], this.ptEnds[2], this.ptCoil[2], 1 - ce);
|
|
$interpPoint_2(this.ptEnds[0], this.ptEnds[2], this.ptCoil[3], 1 - ce, -hs);
|
|
$interpPoint_2(this.ptEnds[0], this.ptEnds[2], this.ptCoil[4], 1 - ce, -hs * 2);
|
|
for (i = 0; i != 2; i++) {
|
|
b = -hs * i * 2;
|
|
$interpPoint_2(this.ptEnds[0], this.ptEnds[2], this.ptCore[i], cd, b);
|
|
$interpPoint_2(this.ptEnds[0], this.ptEnds[2], this.ptCore[i + 2], 1 - cd, b);
|
|
}
|
|
}
|
|
;
|
|
_.stamp = function stamp_62(){
|
|
var det, i, l1, l2, m1, m2;
|
|
l1 = this.inductance;
|
|
l2 = this.inductance * this.ratio * this.ratio / 4;
|
|
m1 = this.couplingCoef * $wnd.Math.sqrt(l1 * l2);
|
|
m2 = this.couplingCoef * l2;
|
|
this.a[0] = l2 + m2;
|
|
this.a[1] = this.a[2] = this.a[3] = this.a[6] = -m1;
|
|
this.a[4] = this.a[8] = (l1 * l2 - m1 * m1) / (l2 - m2);
|
|
this.a[5] = this.a[7] = (m1 * m1 - l1 * m2) / (l2 - m2);
|
|
det = l1 * (l2 + m2) - 2 * m1 * m1;
|
|
for (i = 0; i != 9; i++)
|
|
this.a[i] *= ((this.flags & 2) == 0?sim_0.timeStep / 2:sim_0.timeStep) / det;
|
|
$stampConductance(this.nodes[0], this.nodes[1], this.a[0]);
|
|
$stampVCCurrentSource(this.nodes[0], this.nodes[1], this.nodes[2], this.nodes[3], this.a[1]);
|
|
$stampVCCurrentSource(this.nodes[0], this.nodes[1], this.nodes[3], this.nodes[4], this.a[2]);
|
|
$stampVCCurrentSource(this.nodes[2], this.nodes[3], this.nodes[0], this.nodes[1], this.a[3]);
|
|
$stampConductance(this.nodes[2], this.nodes[3], this.a[4]);
|
|
$stampVCCurrentSource(this.nodes[2], this.nodes[3], this.nodes[3], this.nodes[4], this.a[5]);
|
|
$stampVCCurrentSource(this.nodes[3], this.nodes[4], this.nodes[0], this.nodes[1], this.a[6]);
|
|
$stampVCCurrentSource(this.nodes[3], this.nodes[4], this.nodes[2], this.nodes[3], this.a[7]);
|
|
$stampConductance(this.nodes[3], this.nodes[4], this.a[8]);
|
|
for (i = 0; i != 5; i++)
|
|
;
|
|
}
|
|
;
|
|
_.startIteration = function startIteration_21(){
|
|
var i, j;
|
|
this.voltdiff[0] = this.volts[0] - this.volts[1];
|
|
this.voltdiff[1] = this.volts[2] - this.volts[3];
|
|
this.voltdiff[2] = this.volts[3] - this.volts[4];
|
|
for (i = 0; i != 3; i++) {
|
|
this.curSourceValue[i] = this.current[i];
|
|
if ((this.flags & 2) == 0)
|
|
for (j = 0; j != 3; j++)
|
|
this.curSourceValue[i] += this.a[i * 3 + j] * this.voltdiff[j];
|
|
}
|
|
}
|
|
;
|
|
_.undumpXml = function undumpXml_84(xml){
|
|
this.flags = $parseIntAttr(xml, 'f', this.flags);
|
|
this.inductance = $parseDoubleAttr(xml, 'in', this.inductance);
|
|
this.ratio = $parseDoubleAttr(xml, 'ra', this.ratio);
|
|
this.couplingCoef = $parseDoubleAttr(xml, 'co', this.couplingCoef);
|
|
this.current[0] = $parseDoubleAttr(xml, 'c0', 0);
|
|
this.current[1] = $parseDoubleAttr(xml, 'c1', 0);
|
|
this.current[2] = $parseDoubleAttr(xml, 'c2', 0);
|
|
}
|
|
;
|
|
_.couplingCoef = 0;
|
|
_.flip = 0;
|
|
_.inductance = 0;
|
|
_.ratio = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_TappedTransformerElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'TappedTransformerElm', 402);
|
|
var loadingTestCircuit = false;
|
|
function $$init_23(this$static){
|
|
this$static.zerocount = 0;
|
|
this$static.rmsV = 0;
|
|
this$static.avgV = 0;
|
|
this$static.maxV = 0;
|
|
this$static.minV = 0;
|
|
this$static.frequency = 0;
|
|
this$static.period = 0;
|
|
this$static.binaryLevel = 0;
|
|
this$static.pulseWidth = 0;
|
|
this$static.dutyCycle = 0;
|
|
this$static.selectedValue = 0;
|
|
this$static.increasingV = true;
|
|
this$static.decreasingV = true;
|
|
this$static.started = false;
|
|
}
|
|
|
|
function $drawText(this$static, g, str, str2, pt1, pt2){
|
|
var h, w1, w2, wmax, x_0, y_0;
|
|
w1 = round_int($measureText(g.context, str).width);
|
|
w2 = round_int($measureText(g.context, str2).width);
|
|
wmax = w1 > w2?w1:w2;
|
|
h = g.currentFontSize;
|
|
g.context.save();
|
|
g.savedFontSize = g.currentFontSize;
|
|
g.context.textBaseline = 'middle';
|
|
x_0 = pt2.x_0;
|
|
y_0 = pt2.y_0;
|
|
if (pt1.y_0 != pt2.y_0) {
|
|
x_0 -= wmax / 2 | 0;
|
|
y_0 += sign_0(pt2.y_0 - pt1.y_0) * h;
|
|
pt2.y_0 < pt1.y_0 && (y_0 -= 10);
|
|
}
|
|
else {
|
|
pt2.x_0 > pt1.x_0?(x_0 += 4):(x_0 -= 4 + wmax);
|
|
}
|
|
$fillText(g.context, str, x_0 + ((wmax - w1) / 2 | 0), y_0);
|
|
$fillText(g.context, str2, x_0 + ((wmax - w2) / 2 | 0), y_0 + 14);
|
|
$adjustBbox(this$static, x_0, y_0 - (h / 2 | 0), x_0 + wmax, y_0 + 14 + (h / 2 | 0));
|
|
g.context.restore();
|
|
g.currentFontSize = g.savedFontSize;
|
|
}
|
|
|
|
function $getMeterLine_0(this$static, m){
|
|
switch (m) {
|
|
case 0:
|
|
return 'V = ' + getUnitText(this$static.volts[0], 'V', false);
|
|
case 1:
|
|
return 'V(rms) = ' + getUnitText(this$static.rmsV, 'V', false);
|
|
case 10:
|
|
return 'V(avg) = ' + getUnitText(this$static.avgV, 'V', false);
|
|
case 2:
|
|
return 'Vmax = ' + getUnitText(this$static.lastMaxV, 'Vpk', false);
|
|
case 3:
|
|
return 'Vmin = ' + getUnitText(this$static.lastMinV, 'Vmin', false);
|
|
case 4:
|
|
return 'Vp2p = ' + getUnitText(this$static.lastMaxV - this$static.lastMinV, 'Vp2p', false);
|
|
case 5:
|
|
return 'Binary:' + this$static.binaryLevel;
|
|
case 6:
|
|
return 'Freq = ' + getUnitText(this$static.frequency, 'Hz', false);
|
|
case 7:
|
|
return 'Period = ' + getUnitText(this$static.period, 's', false);
|
|
case 8:
|
|
return 'Pulse width = ' + getUnitText(this$static.pulseWidth, 's', false);
|
|
case 9:
|
|
return 'Duty cycle = ' + $format_0(showFormat, this$static.dutyCycle);
|
|
}
|
|
return '';
|
|
}
|
|
|
|
function $meterChoiceIndex_0(m){
|
|
var choices, i;
|
|
choices = stampJavaTypeInfo(getClassLiteralForArray(I_classLit, 1), $intern_25, 7, 15, [0, 1, 10, 2, 3, 4, 5]);
|
|
for (i = 0; i != choices.length; i++)
|
|
if (choices[i] == m)
|
|
return i;
|
|
return 0;
|
|
}
|
|
|
|
function TestPointElm(xx, yy){
|
|
CircuitElm.call(this, xx, yy);
|
|
$$init_23(this);
|
|
this.meter = 0;
|
|
this.label_0 = 'TP';
|
|
}
|
|
|
|
function TestPointElm_0(xa, ya, xb, yb, f, st){
|
|
CircuitElm_0.call(this, xa, ya, xb, yb, f);
|
|
$$init_23(this);
|
|
this.meter = (new Integer_0($nextToken(st))).value_0;
|
|
(this.flags & 1) != 0?(this.label_0 = unescape_0($nextToken(st))):(this.label_0 = 'TP');
|
|
}
|
|
|
|
defineClass(265, 8, {8:1, 10:1, 265:1}, TestPointElm, TestPointElm_0);
|
|
_.draw = function draw_77(g){
|
|
var f, s, selected;
|
|
g.context.save();
|
|
g.savedFontSize = g.currentFontSize;
|
|
selected = mouseElmRef == this || this.selected_0 || $containsKey(app_0.mouse.scopePlotRoles, this) || instanceOf(mouseElmRef, 21) && $getElm_0(mouseElmRef.elmScope) == this || $isOnHighlightedNet(this);
|
|
f = new Font('SansSerif', selected?1:0, 14);
|
|
$setFont_0(g, f);
|
|
$setColor_0(g, selected?selectColor_0:whiteColor);
|
|
s = this.label_0;
|
|
$interpPoint_1(this.point1, this.point2, this.lead1, 1 - ((round_int(g.context.measureText('TP').width) / 2 | 0) + 8) / this.dn);
|
|
$setBbox_0(this, this.point1, this.lead1, 0);
|
|
switch (this.meter) {
|
|
case 0:
|
|
s = getUnitText(this.volts[0], 'V', false);
|
|
break;
|
|
case 1:
|
|
s = getUnitText(this.rmsV, 'V(rms)', false);
|
|
break;
|
|
case 10:
|
|
s = getUnitText(this.avgV, 'V(avg)', false);
|
|
break;
|
|
case 2:
|
|
s = getUnitText(this.lastMaxV, 'Vpk', false);
|
|
break;
|
|
case 3:
|
|
s = getUnitText(this.lastMinV, 'Vmin', false);
|
|
break;
|
|
case 4:
|
|
s = getUnitText(this.lastMaxV - this.lastMinV, 'Vp2p', false);
|
|
break;
|
|
case 5:
|
|
s = this.binaryLevel + '';
|
|
break;
|
|
case 6:
|
|
s = getUnitText(this.frequency, 'Hz', false);
|
|
break;
|
|
case 8:
|
|
s = getUnitText(this.pulseWidth, 's', false);
|
|
break;
|
|
case 9:
|
|
s = $format_0(showFormat, this.dutyCycle);
|
|
}
|
|
$drawText(this, g, this.label_0, s, this.point1, this.lead1);
|
|
$setVoltageColor(this, g, this.volts[0]);
|
|
selected && $setColor_0(g, selectColor_0);
|
|
drawThickLine_0(g, this.point1, this.lead1, 3);
|
|
$drawPosts(this, g);
|
|
g.context.restore();
|
|
g.currentFontSize = g.savedFontSize;
|
|
}
|
|
;
|
|
_.dumpXml = function dumpXml_82(doc, elem){
|
|
dumpAttr_1(elem, 'x', this.x_0 + ' ' + this.y_0 + ' ' + this.x2 + ' ' + this.y2);
|
|
dumpAttr_0(elem, 'f', this.flags);
|
|
dumpAttr_0(elem, 'me', this.meter);
|
|
$equals_1(this.label_0, 'TP') || dumpAttr_1(elem, 'lb', this.label_0);
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_105(){
|
|
return 368;
|
|
}
|
|
;
|
|
_.getEditInfo = function getEditInfo_72(n){
|
|
var ei;
|
|
if (n == 0) {
|
|
ei = new EditInfo_0('Value', this.selectedValue, -1, -1);
|
|
ei.choice = new Choice;
|
|
$addItem(ei.choice, LS('Voltage'));
|
|
$addItem(ei.choice, LS('RMS Voltage'));
|
|
$addItem(ei.choice, LS('Average Voltage'));
|
|
$addItem(ei.choice, LS('Max Voltage'));
|
|
$addItem(ei.choice, LS('Min Voltage'));
|
|
$addItem(ei.choice, LS('P2P Voltage'));
|
|
$addItem(ei.choice, LS('Binary Value'));
|
|
$select(ei.choice, $meterChoiceIndex_0(this.meter));
|
|
return ei;
|
|
}
|
|
if (n == 1) {
|
|
ei = new EditInfo_0('Label', 0, -1, -1);
|
|
ei.text_0 = this.label_0;
|
|
return ei;
|
|
}
|
|
return null;
|
|
}
|
|
;
|
|
_.getInfo_0 = function getInfo_82(arr){
|
|
var i;
|
|
arr[0] = 'Test Point';
|
|
i = 1;
|
|
arr[i++] = $getMeterLine_0(this, this.meter);
|
|
this.meter != 0 && (arr[i++] = $getMeterLine_0(this, 0));
|
|
this.meter != 2 && (arr[i++] = $getMeterLine_0(this, 2));
|
|
this.meter != 3 && (arr[i++] = $getMeterLine_0(this, 3));
|
|
this.meter != 1 && (arr[i++] = $getMeterLine_0(this, 1));
|
|
this.meter != 10 && (arr[i++] = $getMeterLine_0(this, 10));
|
|
this.meter != 4 && (arr[i++] = $getMeterLine_0(this, 4));
|
|
this.meter != 7 && (arr[i++] = $getMeterLine_0(this, 7));
|
|
this.meter != 8 && (arr[i++] = $getMeterLine_0(this, 8));
|
|
this.meter != 9 && (arr[i++] = $getMeterLine_0(this, 9));
|
|
}
|
|
;
|
|
_.getPostCount_0 = function getPostCount_73(){
|
|
return 1;
|
|
}
|
|
;
|
|
_.getScopeValue = function getScopeValue_5(x_0){
|
|
return this.selectedValue;
|
|
}
|
|
;
|
|
_.getVoltageDiff_0 = function getVoltageDiff_24(){
|
|
return this.volts[0];
|
|
}
|
|
;
|
|
_.reset_0 = function reset_50(){
|
|
$reset(this);
|
|
this.zerocount = 0;
|
|
this.rmsV = this.total = this.count = 0;
|
|
this.avgV = this.totalV = 0;
|
|
this.maxV = this.lastMaxV = 0;
|
|
this.minV = this.lastMinV = 0;
|
|
this.binaryLevel = 0;
|
|
this.period = this.pulseWidth = this.dutyCycle = 0;
|
|
this.selectedValue = 0;
|
|
this.periodStart = this.periodLength = this.pulseStart = 0;
|
|
this.increasingV = true;
|
|
this.decreasingV = true;
|
|
this.started = false;
|
|
this.lastStepCount = 0;
|
|
}
|
|
;
|
|
_.setEditValue = function setEditValue_72(n, ei){
|
|
n == 0 && (this.meter = stampJavaTypeInfo(getClassLiteralForArray(I_classLit, 1), $intern_25, 7, 15, [0, 1, 10, 2, 3, 4, 5])[$getElement(ei.choice).selectedIndex]);
|
|
n == 1 && (this.label_0 = $getText(ei.textf));
|
|
}
|
|
;
|
|
_.setPoints = function setPoints_70(){
|
|
$setPoints(this);
|
|
this.lead1 = new Point_1;
|
|
}
|
|
;
|
|
_.stepFinished = function stepFinished_23(){
|
|
if (sim_0.timeStepCount == this.lastStepCount)
|
|
return;
|
|
this.lastStepCount = sim_0.timeStepCount;
|
|
++this.count;
|
|
this.total += this.volts[0] * this.volts[0];
|
|
this.totalV += this.volts[0];
|
|
this.volts[0] < 2.5?(this.binaryLevel = 0):(this.binaryLevel = 1);
|
|
if (!this.started) {
|
|
this.started = true;
|
|
this.maxV = this.minV = this.volts[0];
|
|
this.increasingV = true;
|
|
this.decreasingV = false;
|
|
this.periodStart = this.pulseStart = sim_0.t;
|
|
}
|
|
if (this.volts[0] > this.maxV && this.increasingV) {
|
|
this.maxV = this.volts[0];
|
|
this.increasingV = true;
|
|
this.decreasingV = false;
|
|
}
|
|
if (this.volts[0] < this.maxV && this.increasingV) {
|
|
this.lastMaxV = this.maxV;
|
|
this.periodLength = sim_0.t - this.periodStart;
|
|
this.periodStart = sim_0.t;
|
|
this.period = this.periodLength;
|
|
this.pulseWidth = sim_0.t - this.pulseStart;
|
|
this.dutyCycle = this.pulseWidth / this.periodLength;
|
|
this.minV = this.volts[0];
|
|
this.increasingV = false;
|
|
this.decreasingV = true;
|
|
this.total = this.total / this.count;
|
|
this.rmsV = $wnd.Math.sqrt(this.total);
|
|
isNaN(this.rmsV) && (this.rmsV = 0);
|
|
this.avgV = this.totalV / this.count;
|
|
isNaN(this.avgV) && (this.avgV = 0);
|
|
this.count = 0;
|
|
this.total = 0;
|
|
this.totalV = 0;
|
|
}
|
|
if (this.volts[0] < this.minV && this.decreasingV) {
|
|
this.minV = this.volts[0];
|
|
this.increasingV = false;
|
|
this.decreasingV = true;
|
|
}
|
|
if (this.volts[0] > this.minV && this.decreasingV) {
|
|
this.lastMinV = this.minV;
|
|
this.pulseStart = sim_0.t;
|
|
this.maxV = this.volts[0];
|
|
this.increasingV = true;
|
|
this.decreasingV = false;
|
|
this.total = this.total / this.count;
|
|
this.rmsV = $wnd.Math.sqrt(this.total);
|
|
isNaN(this.rmsV) && (this.rmsV = 0);
|
|
this.avgV = this.totalV / this.count;
|
|
isNaN(this.avgV) && (this.avgV = 0);
|
|
this.count = 0;
|
|
this.total = 0;
|
|
this.totalV = 0;
|
|
}
|
|
if (this.volts[0] == 0) {
|
|
++this.zerocount;
|
|
if (this.zerocount > 5) {
|
|
this.total = 0;
|
|
this.rmsV = 0;
|
|
this.avgV = 0;
|
|
this.maxV = 0;
|
|
this.minV = 0;
|
|
}
|
|
}
|
|
else {
|
|
this.zerocount = 0;
|
|
}
|
|
switch (this.meter) {
|
|
case 0:
|
|
this.selectedValue = this.volts[0];
|
|
break;
|
|
case 1:
|
|
this.selectedValue = this.rmsV;
|
|
break;
|
|
case 10:
|
|
this.selectedValue = this.avgV;
|
|
break;
|
|
case 2:
|
|
this.selectedValue = this.lastMaxV;
|
|
break;
|
|
case 3:
|
|
this.selectedValue = this.lastMinV;
|
|
break;
|
|
case 4:
|
|
this.selectedValue = this.lastMaxV - this.lastMinV;
|
|
break;
|
|
case 5:
|
|
this.selectedValue = this.binaryLevel;
|
|
break;
|
|
case 6:
|
|
this.selectedValue = this.frequency;
|
|
break;
|
|
case 7:
|
|
this.selectedValue = this.period;
|
|
break;
|
|
case 8:
|
|
this.selectedValue = this.pulseWidth;
|
|
break;
|
|
case 9:
|
|
this.selectedValue = this.dutyCycle;
|
|
}
|
|
}
|
|
;
|
|
_.undumpXml = function undumpXml_85(xml){
|
|
this.flags = $parseIntAttr(xml, 'f', this.flags);
|
|
this.meter = $parseIntAttr(xml, 'me', this.meter);
|
|
this.label_0 = $parseStringAttr(xml, 'lb', 'TP');
|
|
}
|
|
;
|
|
_.avgV = 0;
|
|
_.binaryLevel = 0;
|
|
_.count = 0;
|
|
_.decreasingV = false;
|
|
_.dutyCycle = 0;
|
|
_.frequency = 0;
|
|
_.increasingV = false;
|
|
_.lastMaxV = 0;
|
|
_.lastMinV = 0;
|
|
_.lastStepCount = 0;
|
|
_.maxV = 0;
|
|
_.meter = 0;
|
|
_.minV = 0;
|
|
_.period = 0;
|
|
_.periodLength = 0;
|
|
_.periodStart = 0;
|
|
_.pulseStart = 0;
|
|
_.pulseWidth = 0;
|
|
_.rmsV = 0;
|
|
_.selectedValue = 0;
|
|
_.started = false;
|
|
_.total = 0;
|
|
_.totalV = 0;
|
|
_.zerocount = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_TestPointElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'TestPointElm', 265);
|
|
function $split_0(this$static){
|
|
var c, i, sb;
|
|
this$static.lines = new Vector;
|
|
sb = new StringBuffer(this$static.text_0);
|
|
for (i = 0; i < sb.string.length; i++) {
|
|
c = $charAt_0(sb.string, i);
|
|
if (c == 92) {
|
|
sb.string = $substring_0(sb.string, 0, i) + '' + $substring(sb.string, i + 1);
|
|
c = $charAt_0(sb.string, i);
|
|
if (c == 110) {
|
|
$add_11(this$static.lines, $substring_0(sb.string, 0, i));
|
|
sb.string = sb.string.substr(0, 0) + '' + $substring(sb.string, i + 1);
|
|
i = -1;
|
|
continue;
|
|
}
|
|
}
|
|
}
|
|
$add_11(this$static.lines, sb.string);
|
|
}
|
|
|
|
function TextElm(xx, yy){
|
|
GraphicElm.call(this, xx, yy);
|
|
this.text_0 = 'hello';
|
|
this.lines = new Vector;
|
|
$add_11(this.lines, this.text_0);
|
|
this.size_0 = 24;
|
|
}
|
|
|
|
function TextElm_0(xa, ya, xb, yb, f, st){
|
|
GraphicElm_0.call(this, xa, ya, xb, yb, f);
|
|
this.size_0 = (new Integer_0($nextToken(st))).value_0;
|
|
this.text_0 = $nextToken(st);
|
|
if ((this.flags & 4) == 0) {
|
|
while ($hasMoreTokens(st))
|
|
this.text_0 += ' ' + $nextToken(st);
|
|
this.text_0 = $replaceAll(this.text_0, '%2[bB]', '+');
|
|
}
|
|
else {
|
|
this.text_0 = unescape_0(this.text_0);
|
|
}
|
|
$split_0(this);
|
|
}
|
|
|
|
defineClass(421, 133, $intern_99, TextElm, TextElm_0);
|
|
_.canViewInScope = function canViewInScope_5(){
|
|
return false;
|
|
}
|
|
;
|
|
_.drag = function drag_5(xx, yy){
|
|
this.x_0 = xx;
|
|
this.y_0 = yy;
|
|
this.x2 = xx + 16;
|
|
this.y2 = yy;
|
|
}
|
|
;
|
|
_.draw = function draw_78(g){
|
|
var by, cury, f, i, maxw, s, sw, w;
|
|
g.context.save();
|
|
g.savedFontSize = g.currentFontSize;
|
|
$setColor_0(g, mouseElmRef == this || this.selected_0 || $containsKey(app_0.mouse.scopePlotRoles, this) || instanceOf(mouseElmRef, 21) && $getElm_0(mouseElmRef.elmScope) == this || $isOnHighlightedNet(this)?selectColor_0:this.color_0 != null?new Color_1(this.color_0):lightGrayColor);
|
|
f = new Font('SansSerif', 0, this.size_0);
|
|
$setFont_0(g, f);
|
|
maxw = -1;
|
|
for (i = 0; i != this.lines.arrayList.array.length; i++) {
|
|
w = round_int($measureText(g.context, $elementAt(this.lines, i)).width);
|
|
w > maxw && (maxw = w);
|
|
}
|
|
cury = this.y_0;
|
|
$setBbox(this, this.x_0, this.y_0, this.x_0, this.y_0);
|
|
for (i = 0; i != this.lines.arrayList.array.length; i++) {
|
|
s = $elementAt(this.lines, i);
|
|
s = LS(s);
|
|
sw = round_int($measureText(g.context, s).width);
|
|
$drawString(g, s, this.x_0, cury);
|
|
if ((this.flags & 2) != 0) {
|
|
by = cury - g.currentFontSize;
|
|
$drawLine(g, this.x_0, by, this.x_0 + sw - 1, by);
|
|
}
|
|
$adjustBbox(this, this.x_0, cury - g.currentFontSize, this.x_0 + sw, cury + 3);
|
|
cury += g.currentFontSize + 3;
|
|
}
|
|
this.x2 = this.boundingBox.x_0 + this.boundingBox.width_0;
|
|
this.y2 = this.boundingBox.y_0 + this.boundingBox.height_0;
|
|
g.context.restore();
|
|
g.currentFontSize = g.savedFontSize;
|
|
}
|
|
;
|
|
_.dumpXml = function dumpXml_83(doc, elem){
|
|
dumpAttr_1(elem, 'x', this.x_0 + ' ' + this.y_0 + ' ' + this.x2 + ' ' + this.y2);
|
|
dumpAttr_0(elem, 'f', this.flags);
|
|
dumpAttr_0(elem, 'si', this.size_0);
|
|
dumpAttr_1(elem, 'te', this.text_0);
|
|
this.color_0 != null && dumpAttr_1(elem, 'co', this.color_0);
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_106(){
|
|
return 120;
|
|
}
|
|
;
|
|
_.getEditInfo = function getEditInfo_73(n){
|
|
var ei;
|
|
if (n == 0) {
|
|
ei = new EditInfo_0('Text', 0, -1, -1);
|
|
ei.textArea = new TextArea_0;
|
|
this.editTextArea = ei.textArea;
|
|
$setVisibleLines(ei.textArea, 5);
|
|
$setText_2(ei.textArea, $replace_0(this.text_0, '\\n', '\n'));
|
|
return ei;
|
|
}
|
|
if (n == 1)
|
|
return new EditInfo_0('Size', this.size_0, 5, 100);
|
|
if (n == 2) {
|
|
ei = new EditInfo_0('', 0, -1, -1);
|
|
ei.checkbox = new Checkbox_0('Draw Bar On Top', (this.flags & 2) != 0);
|
|
return ei;
|
|
}
|
|
if (n == 3)
|
|
return $setIsColor(new EditInfo_1('Color', this.color_0 != null?this.color_0:$getHexValue(lightGrayColor)));
|
|
return null;
|
|
}
|
|
;
|
|
_.getElmType = function getElmType_23(){
|
|
return 'text';
|
|
}
|
|
;
|
|
_.getInfo_0 = function getInfo_83(arr){
|
|
arr[0] = this.text_0;
|
|
}
|
|
;
|
|
_.getShortcut = function getShortcut_43(){
|
|
return 116;
|
|
}
|
|
;
|
|
_.setEditValue = function setEditValue_73(n, ei){
|
|
var c;
|
|
if (n == 0) {
|
|
this.text_0 = $replace_0($getText(this.editTextArea), '\n', '\\n');
|
|
$split_0(this);
|
|
}
|
|
n == 1 && (this.size_0 = round_int(ei.value_0));
|
|
n == 2 && ($getState(ei.checkbox)?(this.flags |= 2):(this.flags &= -3));
|
|
if (n == 3) {
|
|
c = $getText(ei.textf);
|
|
this.color_0 = $equals_1(c, $getHexValue(lightGrayColor))?null:c;
|
|
}
|
|
}
|
|
;
|
|
_.undumpXml = function undumpXml_86(xml){
|
|
this.flags = $parseIntAttr(xml, 'f', this.flags);
|
|
this.size_0 = $parseIntAttr(xml, 'si', this.size_0);
|
|
this.text_0 = $parseStringAttr(xml, 'te', this.text_0);
|
|
this.color_0 = $parseStringAttr(xml, 'co', this.color_0);
|
|
$split_0(this);
|
|
}
|
|
;
|
|
_.size_0 = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_TextElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'TextElm', 421);
|
|
function $$init_24(this$static){
|
|
this$static.t0 = 273.15;
|
|
this$static.t25 = this$static.t0 + 25;
|
|
}
|
|
|
|
function $calcB25100(this$static){
|
|
var kelvin1, kelvin2;
|
|
kelvin1 = this$static.t0 + 25;
|
|
kelvin2 = this$static.t0 + 50;
|
|
return ($wnd.Math.log(this$static.r25) - $wnd.Math.log(this$static.r50)) / (1 / kelvin1 - 1 / kelvin2);
|
|
}
|
|
|
|
function $calcResistance_0(this$static, tempr){
|
|
return toDouble_0(fromDouble_0($wnd.Math.round(this$static.r25 * $wnd.Math.exp(this$static.b25100 * (1 / (tempr + this$static.t0) - 1 / this$static.t25)))));
|
|
}
|
|
|
|
function $createSlider_3(this$static){
|
|
var value_0;
|
|
$addWidgetToVerticalPanel(app_0, this$static.label_0 = new Label_1(this$static.sliderText));
|
|
$addStyleName(this$static.label_0, 'topSpace');
|
|
value_0 = round_int(this$static.position * 100);
|
|
$addWidgetToVerticalPanel(app_0, this$static.slider = new Scrollbar_1(value_0, this$static, this$static));
|
|
}
|
|
|
|
function $setPoints_26(this$static){
|
|
$setPoints(this$static);
|
|
$calcLeads(this$static, 32);
|
|
this$static.position = this$static.slider.val_0 * $intern_124 + $intern_129;
|
|
this$static.temperature = toDouble_0(fromDouble_0($wnd.Math.round(this$static.position * (this$static.maxTempr - this$static.minTempr) + this$static.minTempr)));
|
|
this$static.resistance = $calcResistance_0(this$static, this$static.temperature);
|
|
new Point_1;
|
|
new Point_1;
|
|
}
|
|
|
|
function ThermistorNTCElm(xx, yy){
|
|
CircuitElm.call(this, xx, yy);
|
|
$$init_24(this);
|
|
this.minTempr = -40;
|
|
this.maxTempr = 150;
|
|
this.r25 = $intern_88;
|
|
this.r50 = 3605;
|
|
this.position = 0.34;
|
|
$calcResistance_0(this, this.minTempr);
|
|
this.b25100 = $calcB25100(this);
|
|
this.temperature = toDouble_0(fromDouble_0($wnd.Math.round(this.position * (this.maxTempr - this.minTempr) + this.minTempr)));
|
|
this.resistance = $calcResistance_0(this, this.temperature);
|
|
this.sliderText = 'Temperature';
|
|
$createSlider_3(this);
|
|
}
|
|
|
|
function ThermistorNTCElm_0(xa, ya, xb, yb, f, st){
|
|
CircuitElm_0.call(this, xa, ya, xb, yb, f);
|
|
$$init_24(this);
|
|
this.r25 = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.r50 = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.minTempr = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.maxTempr = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.position = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
$calcResistance_0(this, this.minTempr);
|
|
this.b25100 = $calcB25100(this);
|
|
this.temperature = toDouble_0(fromDouble_0($wnd.Math.round(this.position * (this.maxTempr - this.minTempr) + this.minTempr)));
|
|
this.resistance = $calcResistance_0(this, this.temperature);
|
|
this.sliderText = unescape_0($nextToken(st));
|
|
$createSlider_3(this);
|
|
}
|
|
|
|
defineClass(417, 8, $intern_125, ThermistorNTCElm, ThermistorNTCElm_0);
|
|
_.calculateCurrent = function calculateCurrent_35(){
|
|
this.current_0 = (this.volts[0] - this.volts[1]) / this.resistance;
|
|
}
|
|
;
|
|
_.delete_0 = function delete_5(){
|
|
$removeWidgetFromVerticalPanel(app_0, this.label_0);
|
|
$removeWidgetFromVerticalPanel(app_0, this.slider);
|
|
}
|
|
;
|
|
_.draw = function draw_79(g){
|
|
var grad, i, len, s, t, v1, v2;
|
|
v1 = this.volts[0];
|
|
v2 = this.volts[1];
|
|
$setBbox_0(this, this.point1, this.point2, 6);
|
|
$draw2Leads(this, g);
|
|
$setPowerColor_0(this, g);
|
|
len = distance(this.lead1, this.lead2);
|
|
g.context.save();
|
|
g.context.lineWidth = 3;
|
|
$transform(g.context, (this.lead2.x_0 - this.lead1.x_0) / len, (this.lead2.y_0 - this.lead1.y_0) / len, -(this.lead2.y_0 - this.lead1.y_0) / len, (this.lead2.x_0 - this.lead1.x_0) / len, this.lead1.x_0, this.lead1.y_0);
|
|
grad = $createLinearGradient(g.context, 0, 0, len, 0);
|
|
$addColorStop(grad, 0, $getHexValue($getVoltageColor(this, v1)));
|
|
$addColorStop(grad, 1, $getHexValue($getVoltageColor(this, v2)));
|
|
$setStrokeStyleWeb(g.context, grad);
|
|
if (app_0.menus.euroResistorCheckItem.on) {
|
|
$strokeRect(g.context, 0, -6, len, 12);
|
|
}
|
|
else {
|
|
g.context.beginPath();
|
|
g.context.moveTo(0, 0);
|
|
for (i = 0; i < 4; i++) {
|
|
$lineTo(g.context, (1 + 4 * i) * len / 16, 6);
|
|
$lineTo(g.context, (3 + 4 * i) * len / 16, -6);
|
|
}
|
|
$lineTo(g.context, len, 0);
|
|
g.context.stroke();
|
|
}
|
|
g.context.beginPath();
|
|
g.context.moveTo(-6, 12);
|
|
g.context.lineTo(6, 12);
|
|
$lineTo(g.context, len, -12);
|
|
g.context.stroke();
|
|
g.context.restore();
|
|
if (app_0.menus.showValuesCheckItem.on) {
|
|
this.temperature = toDouble_0(fromDouble_0($wnd.Math.round(this.position * (this.maxTempr - this.minTempr) + this.minTempr)));
|
|
this.resistance = $calcResistance_0(this, this.temperature);
|
|
s = getUnitText(this.resistance, '', true);
|
|
t = String.fromCharCode(176);
|
|
$drawValues(this, g, this.temperature + t + 'C=' + s + '\u03A9', 6);
|
|
}
|
|
this.curcount_0 = $updateDotCount(this.current_0, this.curcount_0);
|
|
app_0.mouse.dragElm == this || $drawDots(g, this.point1, this.point2, this.curcount_0);
|
|
$drawPosts(this, g);
|
|
}
|
|
;
|
|
_.dumpXml = function dumpXml_84(doc, elem){
|
|
dumpAttr_1(elem, 'x', this.x_0 + ' ' + this.y_0 + ' ' + this.x2 + ' ' + this.y2);
|
|
dumpAttr_0(elem, 'f', this.flags);
|
|
dumpAttr(elem, 'r25', this.r25);
|
|
dumpAttr(elem, 'r50', this.r50);
|
|
dumpAttr(elem, 'mnt', this.minTempr);
|
|
dumpAttr(elem, 'mxt', this.maxTempr);
|
|
dumpAttr(elem, 'ps', this.position);
|
|
dumpAttr_1(elem, 'st', this.sliderText);
|
|
}
|
|
;
|
|
_.execute_1 = function execute_48(){
|
|
app_0.analyzeFlag = true;
|
|
$setPoints_26(this);
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_107(){
|
|
return 350;
|
|
}
|
|
;
|
|
_.getEditInfo = function getEditInfo_74(n){
|
|
var ei;
|
|
if (n == 0)
|
|
return new EditInfo_0('R at 25\xB0C', this.r25, this.r50 + 100, $intern_120);
|
|
if (n == 1)
|
|
return new EditInfo_0('R at 50\xB0C', this.r50, 100, this.r25 - 100);
|
|
if (n == 2)
|
|
return new EditInfo_0('Slider min temp (\xB0C)', this.minTempr, -40, this.maxTempr);
|
|
if (n == 3)
|
|
return new EditInfo_0('Slider max temp (\xB0C)', this.maxTempr, this.minTempr, 150);
|
|
if (n == 4) {
|
|
ei = new EditInfo_0('Slider Text', 0, -1, -1);
|
|
ei.text_0 = this.sliderText;
|
|
return ei;
|
|
}
|
|
return null;
|
|
}
|
|
;
|
|
_.getInfo_0 = function getInfo_84(arr){
|
|
arr[0] = 'thermistor';
|
|
arr[1] = 'I = ' + getUnitText($wnd.Math.abs(this.current_0), 'A', false);
|
|
arr[2] = 'Vd = ' + getUnitText($wnd.Math.abs(this.volts[0] - this.volts[1]), 'V', false);
|
|
arr[3] = 'R = ' + getUnitText(this.resistance, ohmString, false);
|
|
arr[4] = 'P = ' + getUnitText((this.volts[0] - this.volts[1]) * this.current_0, 'W', false);
|
|
arr[5] = 'T = ' + getUnitText(this.temperature, '\xB0C', false);
|
|
}
|
|
;
|
|
_.getPostCount_0 = function getPostCount_74(){
|
|
return 2;
|
|
}
|
|
;
|
|
_.onMouseWheel = function onMouseWheel_6(e){
|
|
!!this.slider && $onMouseWheel_0(this.slider, e);
|
|
}
|
|
;
|
|
_.setEditValue = function setEditValue_74(n, ei){
|
|
n == 0 && (this.r25 = ei.value_0);
|
|
n == 1 && (this.r50 = ei.value_0);
|
|
n == 2 && (this.minTempr = ei.value_0);
|
|
n == 3 && (this.maxTempr = ei.value_0);
|
|
if (n == 4) {
|
|
this.sliderText = $getText(ei.textf);
|
|
$setText_0(this.label_0, this.sliderText);
|
|
$setiFrameHeight(app_0.ui);
|
|
}
|
|
$calcResistance_0(this, this.minTempr);
|
|
this.b25100 = $calcB25100(this);
|
|
this.temperature = toDouble_0(fromDouble_0($wnd.Math.round(this.position * (this.maxTempr - this.minTempr) + this.minTempr)));
|
|
this.resistance = $calcResistance_0(this, this.temperature);
|
|
}
|
|
;
|
|
_.setMouseElm = function setMouseElm_2(v){
|
|
v?(mouseElmRef = this):mouseElmRef == this && (mouseElmRef = null);
|
|
!!this.slider && $draw_6(this.slider);
|
|
}
|
|
;
|
|
_.setPoints = function setPoints_71(){
|
|
$setPoints_26(this);
|
|
}
|
|
;
|
|
_.stamp = function stamp_63(){
|
|
this.temperature = toDouble_0(fromDouble_0($wnd.Math.round(this.position * (this.maxTempr - this.minTempr) + this.minTempr)));
|
|
this.resistance = $calcResistance_0(this, this.temperature);
|
|
$stampResistor(this.nodes[0], this.nodes[1], this.resistance);
|
|
}
|
|
;
|
|
_.undumpXml = function undumpXml_87(xml){
|
|
this.flags = $parseIntAttr(xml, 'f', this.flags);
|
|
this.r25 = $parseDoubleAttr(xml, 'r25', this.r25);
|
|
this.r50 = $parseDoubleAttr(xml, 'r50', this.r50);
|
|
this.minTempr = $parseDoubleAttr(xml, 'mnt', this.minTempr);
|
|
this.maxTempr = $parseDoubleAttr(xml, 'mxt', this.maxTempr);
|
|
this.position = $parseDoubleAttr(xml, 'ps', this.position);
|
|
this.sliderText = $parseStringAttr(xml, 'st', this.sliderText);
|
|
$calcResistance_0(this, this.minTempr);
|
|
this.b25100 = $calcB25100(this);
|
|
this.temperature = toDouble_0(fromDouble_0($wnd.Math.round(this.position * (this.maxTempr - this.minTempr) + this.minTempr)));
|
|
this.resistance = $calcResistance_0(this, this.temperature);
|
|
$createSlider_3(this);
|
|
}
|
|
;
|
|
_.b25100 = 0;
|
|
_.maxTempr = 0;
|
|
_.minTempr = 0;
|
|
_.position = 0;
|
|
_.r25 = 0;
|
|
_.r50 = 0;
|
|
_.resistance = 0;
|
|
_.t0 = 0;
|
|
_.t25 = 0;
|
|
_.temperature = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_ThermistorNTCElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ThermistorNTCElm', 417);
|
|
function $$init_25(this$static){
|
|
this$static.coilNodes = stampJavaTypeInfo(getClassLiteralForArray(I_classLit, 1), $intern_25, 7, 15, [6, 1, 8, 3, 10, 5, 7, 9, 11, 12]);
|
|
this$static.cr = 37;
|
|
}
|
|
|
|
function $interpPointFix_0(a, b, c, f, g){
|
|
var gx, gy;
|
|
gx = b.y_0 - a.y_0;
|
|
gy = a.x_0 - b.x_0;
|
|
c.x_0 = toInt_0(fromDouble_0($wnd.Math.round(a.x_0 * (1 - f) + b.x_0 * f + g * gx)));
|
|
c.y_0 = toInt_0(fromDouble_0($wnd.Math.round(a.y_0 * (1 - f) + b.y_0 * f + g * gy)));
|
|
}
|
|
|
|
function ThreePhaseMotorElm(xx, yy){
|
|
CircuitElm.call(this, xx, yy);
|
|
$$init_25(this);
|
|
this.Rs = 0.435;
|
|
this.Rr = 0.816;
|
|
this.Ls = 0.0294;
|
|
this.Lr = 0.0297;
|
|
this.Lm = 0.0287;
|
|
this.J = 1;
|
|
this.angle = $intern_89;
|
|
this.speed = this.filteredSpeed = 0;
|
|
this.b = 0.05;
|
|
this.voltSources = initUnidimensionalArray(Lcom_lushprojects_circuitjs1_client_VoltageSource_2_classLit, $intern_3, 136, 2, 0, 1);
|
|
this.curcounts = initUnidimensionalArray(D_classLit, $intern_76, 7, 3, 15, 1);
|
|
this.coilCurrents = initUnidimensionalArray(D_classLit, $intern_76, 7, 5, 15, 1);
|
|
}
|
|
|
|
function ThreePhaseMotorElm_0(xa, ya, xb, yb, f, st){
|
|
CircuitElm_0.call(this, xa, ya, xb, yb, f);
|
|
$$init_25(this);
|
|
this.angle = $intern_89;
|
|
this.filteredSpeed = this.speed = 0;
|
|
this.Rs = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.Rr = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.Ls = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.Lr = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.Lm = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.b = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
try {
|
|
this.J = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
}
|
|
catch ($e0) {
|
|
$e0 = toJava($e0);
|
|
if (instanceOf($e0, 13)) {
|
|
this.J = 1;
|
|
}
|
|
else
|
|
throw toJs($e0);
|
|
}
|
|
this.voltSources = initUnidimensionalArray(Lcom_lushprojects_circuitjs1_client_VoltageSource_2_classLit, $intern_3, 136, 2, 0, 1);
|
|
this.curcounts = initUnidimensionalArray(D_classLit, $intern_76, 7, 3, 15, 1);
|
|
this.coilCurrents = initUnidimensionalArray(D_classLit, $intern_76, 7, 5, 15, 1);
|
|
}
|
|
|
|
function drawThickerLine_0(g, pa, pb){
|
|
g.context.lineWidth = 6;
|
|
$drawLine(g, pa.x_0, pa.y_0, pb.x_0, pb.y_0);
|
|
g.context.lineWidth = 1;
|
|
}
|
|
|
|
function getUnitTextRPM(v, u){
|
|
var nf, va;
|
|
nf = ($clinit_NumberFormat() , new NumberFormat_0('####.##', $getDefaultNative()));
|
|
va = $wnd.Math.abs(v);
|
|
if (va < $intern_79)
|
|
return '0 ' + u;
|
|
if (va < $intern_80)
|
|
return $format_0(nf, v * $intern_81) + ' ' + 'p' + u;
|
|
if (va < $intern_82)
|
|
return $format_0(nf, v * $intern_32) + ' ' + 'n' + u;
|
|
if (va < $intern_83)
|
|
return $format_0(nf, v * $intern_84) + ' ' + muString + u;
|
|
if (va < 1)
|
|
return $format_0(nf, v * $intern_22) + ' ' + 'm' + u;
|
|
if (va < $intern_22)
|
|
return $format_0(nf, v) + ' ' + u;
|
|
if (va < $intern_84)
|
|
return $format_0(nf, v * $intern_83) + ' ' + 'k' + u;
|
|
if (va < $intern_32)
|
|
return $format_0(nf, v * $intern_82) + ' ' + 'M' + u;
|
|
if (va < $intern_81)
|
|
return $format_0(nf, v * $intern_80) + ' ' + 'G' + u;
|
|
return $format_0(new NumberFormat_0('#.##E000', $getDefaultNative()), v) + ' ' + u;
|
|
}
|
|
|
|
defineClass(441, 8, $intern_85, ThreePhaseMotorElm, ThreePhaseMotorElm_0);
|
|
_.calculateCurrent = function calculateCurrent_36(){
|
|
var i, j, n1, n2, ni, val, voltdiff;
|
|
if (this.nodeCurrents == null)
|
|
return;
|
|
for (i = 0; i != 13; i++)
|
|
this.nodeCurrents[i] = 0;
|
|
for (i = 0; i != 5; i++) {
|
|
val = this.coilCurSourceValues[i];
|
|
if (this.xformMatrix != null) {
|
|
for (j = 0; j != 5; j++) {
|
|
n1 = this.coilNodes[j * 2];
|
|
n2 = this.coilNodes[j * 2 + 1];
|
|
voltdiff = this.volts[n1] - this.volts[n2];
|
|
val += voltdiff * this.xformMatrix[i][j];
|
|
}
|
|
}
|
|
this.coilCurrents[i] = val;
|
|
ni = this.coilNodes[i];
|
|
this.nodeCurrents[ni] += val;
|
|
this.nodeCurrents[ni + 1] -= val;
|
|
}
|
|
}
|
|
;
|
|
_.canFlipX = function canFlipX_4(){
|
|
return false;
|
|
}
|
|
;
|
|
_.canFlipY = function canFlipY_5(){
|
|
return false;
|
|
}
|
|
;
|
|
_.doStep = function doStep_49(){
|
|
var i, n1, n2;
|
|
for (i = 0; i != 5; i++) {
|
|
n1 = this.coilNodes[i * 2];
|
|
n2 = this.coilNodes[i * 2 + 1];
|
|
$stampCurrentSource(this.nodes[n1], this.nodes[n2], this.coilCurSourceValues[i]);
|
|
}
|
|
$updateVoltageSource(this.voltSources[0], -this.vs1value);
|
|
$updateVoltageSource(this.voltSources[1], -this.vs2value);
|
|
}
|
|
;
|
|
_.draw = function draw_80(g){
|
|
var angleAux, cc, i, q;
|
|
$setBbox_0(this, this.point1, this.point2, this.cr);
|
|
for (i = 0; i != 6; i++) {
|
|
$setVoltageColor(this, g, this.volts[i]);
|
|
drawThickLine_0(g, this.posts[i], this.leads[i], 3);
|
|
}
|
|
for (i = 0; i != 3; i++) {
|
|
this.curcounts[i] = $updateDotCount(this.coilCurrents[i], this.curcounts[i]);
|
|
$drawDots(g, this.posts[i * 2], this.leads[i * 2], this.curcounts[i]);
|
|
$drawDots(g, this.leads[i * 2 + 1], this.posts[i * 2 + 1], this.curcounts[i]);
|
|
}
|
|
$setPowerColor_0(this, g);
|
|
cc = new Color(165, 165, 165);
|
|
$setColor_0(g, cc);
|
|
$fillOval(g, this.motorCenter.x_0 - this.cr, this.motorCenter.y_0 - this.cr, this.cr * 2);
|
|
cc = new Color(10, 10, 10);
|
|
$setColor_0(g, cc);
|
|
angleAux = toDouble_0(fromDouble_0($wnd.Math.round(this.angle * 300))) / 300;
|
|
$fillOval(g, this.motorCenter.x_0 - round_int(this.cr / 2.2), this.motorCenter.y_0 - round_int(this.cr / 2.2), round_int(2 * this.cr / 2.2));
|
|
$setColor_0(g, cc);
|
|
q = 17.136000000000003 / this.dn * 37 / 27;
|
|
$interpPointFix_0(this.point1, this.point2, ps1, 0.5 + q * $wnd.Math.cos(angleAux), q * $wnd.Math.sin(angleAux));
|
|
$interpPointFix_0(this.point1, this.point2, ps2, 0.5 - q * $wnd.Math.cos(angleAux), -q * $wnd.Math.sin(angleAux));
|
|
drawThickerLine_0(g, ps1, ps2);
|
|
$interpPointFix_0(this.point1, this.point2, ps1, 0.5 + q * $wnd.Math.cos(angleAux + $intern_106), q * $wnd.Math.sin(angleAux + $intern_106));
|
|
$interpPointFix_0(this.point1, this.point2, ps2, 0.5 - q * $wnd.Math.cos(angleAux + $intern_106), -q * $wnd.Math.sin(angleAux + $intern_106));
|
|
drawThickerLine_0(g, ps1, ps2);
|
|
$interpPointFix_0(this.point1, this.point2, ps1, 0.5 + q * $wnd.Math.cos(angleAux + $intern_107), q * $wnd.Math.sin(angleAux + $intern_107));
|
|
$interpPointFix_0(this.point1, this.point2, ps2, 0.5 - q * $wnd.Math.cos(angleAux + $intern_107), -q * $wnd.Math.sin(angleAux + $intern_107));
|
|
drawThickerLine_0(g, ps1, ps2);
|
|
$drawPosts(this, g);
|
|
$setColor_0(g, mouseElmRef == this || this.selected_0 || $containsKey(app_0.mouse.scopePlotRoles, this) || instanceOf(mouseElmRef, 21) && $getElm_0(mouseElmRef.elmScope) == this || $isOnHighlightedNet(this)?selectColor_0:whiteColor);
|
|
g.context.save();
|
|
g.savedFontSize = g.currentFontSize;
|
|
if ($wnd.Math.abs(this.dy) > $wnd.Math.abs(this.dx)) {
|
|
for (i = 0; i != 3; i++) {
|
|
$drawString(g, 'UVW'.substr(i, i + 1 - i) + '1', this.posts[i * 2].x_0 + 5, this.posts[i * 2].y_0 + 8);
|
|
$drawString(g, 'UVW'.substr(i, i + 1 - i) + '2', this.posts[i * 2 + 1].x_0 + 5, this.posts[i * 2 + 1].y_0 - 2);
|
|
}
|
|
}
|
|
else {
|
|
g.context.textAlign = 'center';
|
|
for (i = 0; i != 3; i++) {
|
|
$drawString(g, 'UVW'.substr(i, i + 1 - i) + '1', this.posts[i * 2].x_0 + 11, this.posts[i * 2].y_0 - 7);
|
|
$drawString(g, 'UVW'.substr(i, i + 1 - i) + '2', this.posts[i * 2 + 1].x_0 - 11, this.posts[i * 2 + 1].y_0 - 7);
|
|
}
|
|
}
|
|
g.context.restore();
|
|
g.currentFontSize = g.savedFontSize;
|
|
this.filteredSpeed = this.filteredSpeed * 0.98 + this.speed * $intern_36;
|
|
}
|
|
;
|
|
_.dumpXml = function dumpXml_85(doc, elem){
|
|
dumpAttr_1(elem, 'x', this.x_0 + ' ' + this.y_0 + ' ' + this.x2 + ' ' + this.y2);
|
|
dumpAttr_0(elem, 'f', this.flags);
|
|
dumpAttr(elem, 'rs', this.Rs);
|
|
dumpAttr(elem, 'rr', this.Rr);
|
|
dumpAttr(elem, 'ls', this.Ls);
|
|
dumpAttr(elem, 'lr', this.Lr);
|
|
dumpAttr(elem, 'lm', this.Lm);
|
|
dumpAttr(elem, 'b', this.b);
|
|
dumpAttr(elem, 'j', this.J);
|
|
}
|
|
;
|
|
_.getConnection = function getConnection_38(n1, n2){
|
|
return true;
|
|
}
|
|
;
|
|
_.getCurrentIntoNode = function getCurrentIntoNode_32(n){
|
|
if (n % 2 == 1)
|
|
return this.coilCurrents[n / 2 | 0];
|
|
return -this.coilCurrents[n / 2 | 0];
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_108(){
|
|
return 427;
|
|
}
|
|
;
|
|
_.getEditInfo = function getEditInfo_75(n){
|
|
if (n == 0)
|
|
return new EditInfo_0('Stator Inductance (H)', this.Ls, 0, 0);
|
|
if (n == 1)
|
|
return new EditInfo_0('Rotor Inductance (H)', this.Lr, 0, 0);
|
|
if (n == 2)
|
|
return $setDimensionless(new EditInfo_0('Coupling Coefficient', this.Lm / $wnd.Math.sqrt(this.Ls * this.Lr), 0, 0));
|
|
if (n == 3)
|
|
return new EditInfo_0('Stator Resistance (ohms)', this.Rs, 0, 0);
|
|
if (n == 4)
|
|
return new EditInfo_0('Rotor Resistance (ohms)', this.Rr, 0, 0);
|
|
if (n == 5)
|
|
return new EditInfo_0('Friction coefficient (Nms/rad)', this.b, 0, 0);
|
|
if (n == 6)
|
|
return new EditInfo_0('Moment of inertia (Kg.m^2)', this.J, 0, 0);
|
|
return null;
|
|
}
|
|
;
|
|
_.getInfo_0 = function getInfo_85(arr){
|
|
arr[0] = '3-Phase Motor';
|
|
arr[1] = 'I = ' + getUnitText($wnd.Math.abs(this.current_0), 'A', false);
|
|
arr[2] = 'Vd = ' + getUnitText($wnd.Math.abs(this.volts[0] - this.volts[1]), 'V', false);
|
|
arr[3] = LS('speed') + ' = ' + getUnitTextRPM(60 * $wnd.Math.abs(this.filteredSpeed) / $intern_2, LS('RPM'));
|
|
}
|
|
;
|
|
_.getInternalNodeCount = function getInternalNodeCount_14(){
|
|
return 7;
|
|
}
|
|
;
|
|
_.getPost = function getPost_25(n){
|
|
return this.posts[n];
|
|
}
|
|
;
|
|
_.getPostCount_0 = function getPostCount_75(){
|
|
return 6;
|
|
}
|
|
;
|
|
_.getVoltageSourceCount = function getVoltageSourceCount_52(){
|
|
return 2;
|
|
}
|
|
;
|
|
_.hasGroundConnection = function hasGroundConnection_20(n1){
|
|
return false;
|
|
}
|
|
;
|
|
_.reset_0 = function reset_51(){
|
|
$reset(this);
|
|
this.filteredSpeed = this.speed = 0;
|
|
this.coilCurSourceValues = initUnidimensionalArray(D_classLit, $intern_76, 7, 5, 15, 1);
|
|
this.coilCurrents = initUnidimensionalArray(D_classLit, $intern_76, 7, 5, 15, 1);
|
|
}
|
|
;
|
|
_.setEditValue = function setEditValue_75(n, ei){
|
|
ei.value_0 > 0 && n == 0 && (this.Ls = ei.value_0);
|
|
ei.value_0 > 0 && n == 1 && (this.Lr = ei.value_0);
|
|
ei.value_0 > 0 && ei.value_0 < 1 && n == 2 && (this.Lm = ei.value_0 * $wnd.Math.sqrt(this.Ls * this.Lr));
|
|
ei.value_0 > 0 && n == 3 && (this.Rs = ei.value_0);
|
|
ei.value_0 > 0 && n == 4 && (this.Rr = ei.value_0);
|
|
n == 5 && (this.b = ei.value_0);
|
|
ei.value_0 > 0 && n == 6 && (this.J = ei.value_0);
|
|
}
|
|
;
|
|
_.setPoints = function setPoints_72(){
|
|
var i, q;
|
|
$setPoints(this);
|
|
this.posts = $newPointArray(6);
|
|
this.leads = $newPointArray(6);
|
|
q = $wnd.Math.abs(this.dy) > $wnd.Math.abs(this.dx)?-1:1;
|
|
for (i = 0; i != 3; i++) {
|
|
$interpPoint_2(this.point1, this.point2, this.posts[i * 2], 0, -q * 32 * (i - 1));
|
|
$interpPoint_2(this.point1, this.point2, this.leads[i * 2], 0.45, -q * 32 * (i - 1));
|
|
$interpPoint_2(this.point1, this.point2, this.posts[i * 2 + 1], 1, q * 32 * (i - 1));
|
|
$interpPoint_2(this.point1, this.point2, this.leads[i * 2 + 1], 0.55, q * 32 * (i - 1));
|
|
}
|
|
this.motorCenter = $interpPoint(this.point1, this.point2, 0.5);
|
|
$allocNodes(this);
|
|
}
|
|
;
|
|
_.setVoltageSource = function setVoltageSource_16(n, v){
|
|
this.voltSources[n] = v;
|
|
n == 0?$setNodes(v, this.nodes[7], ground):$setNodes(v, this.nodes[11], ground);
|
|
}
|
|
;
|
|
_.stamp = function stamp_64(){
|
|
var Lr2, coilInductances, couplingCoefs, i, j, k0, n001, n002, n003, n004, n005, n006, n007, ni1_ind, ni2_ind, nj1_ind, nj2_ind, ts;
|
|
n001 = this.nodes[6];
|
|
n002 = this.nodes[7];
|
|
n003 = this.nodes[8];
|
|
n004 = this.nodes[9];
|
|
n005 = this.nodes[10];
|
|
n006 = this.nodes[11];
|
|
n007 = this.nodes[12];
|
|
$stampResistor(this.nodes[0], n001, this.Rs);
|
|
$stampResistor(this.nodes[2], n003, this.Rs);
|
|
$stampResistor(this.nodes[4], n005, this.Rs);
|
|
$stampResistor(n004, ground, 1.5 * this.Rr);
|
|
$stampResistor(n007, ground, 1.5 * this.Rr);
|
|
Lr2 = this.Lr * 1.5;
|
|
coilInductances = stampJavaTypeInfo(getClassLiteralForArray(D_classLit, 1), $intern_76, 7, 15, [this.Ls, this.Ls, this.Ls, Lr2, Lr2]);
|
|
couplingCoefs = initMultidimensionalArray(D_classLit, [$intern_3, $intern_76], [12, 7], 15, [5, 5], 2);
|
|
this.xformMatrix = initMultidimensionalArray(D_classLit, [$intern_3, $intern_76], [12, 7], 15, [5, 5], 2);
|
|
for (i = 0; i != 5; i++)
|
|
this.xformMatrix[i][i] = coilInductances[i];
|
|
k0 = this.Lm / $wnd.Math.sqrt(this.Ls * Lr2);
|
|
couplingCoefs[0][3] = couplingCoefs[3][0] = k0;
|
|
couplingCoefs[1][3] = couplingCoefs[3][1] = -k0 / 2;
|
|
couplingCoefs[1][4] = couplingCoefs[4][1] = k0 * $wnd.Math.sqrt(3) / 2;
|
|
couplingCoefs[2][3] = couplingCoefs[3][2] = -k0 / 2;
|
|
couplingCoefs[2][4] = couplingCoefs[4][2] = -k0 * $wnd.Math.sqrt(3) / 2;
|
|
for (i = 0; i != 5; i++)
|
|
for (j = 0; j != i; j++)
|
|
this.xformMatrix[i][j] = this.xformMatrix[j][i] = couplingCoefs[i][j] * $wnd.Math.sqrt(coilInductances[i] * coilInductances[j]);
|
|
invertMatrix(this.xformMatrix, 5);
|
|
ts = sim_0.timeStep;
|
|
for (i = 0; i != 5; i++)
|
|
for (j = 0; j != 5; j++) {
|
|
this.xformMatrix[i][j] *= ts;
|
|
ni1_ind = this.coilNodes[i * 2];
|
|
nj1_ind = this.coilNodes[j * 2];
|
|
ni2_ind = this.coilNodes[i * 2 + 1];
|
|
nj2_ind = this.coilNodes[j * 2 + 1];
|
|
i == j?$stampConductance(this.nodes[ni1_ind], this.nodes[ni2_ind], this.xformMatrix[i][i]):$stampVCCurrentSource(this.nodes[ni1_ind], this.nodes[ni2_ind], this.nodes[nj1_ind], this.nodes[nj2_ind], this.xformMatrix[i][j]);
|
|
}
|
|
for (i = 0; i != 10; i++)
|
|
;
|
|
$stampVoltageSource(n002, ground, this.voltSources[0]);
|
|
$stampVoltageSource(n006, ground, this.voltSources[1]);
|
|
(this.coilCurSourceValues == null || this.coilCurSourceValues.length != 5) && (this.coilCurSourceValues = initUnidimensionalArray(D_classLit, $intern_76, 7, 5, 15, 1));
|
|
(this.coilCurrents == null || this.coilCurrents.length != 5) && (this.coilCurrents = initUnidimensionalArray(D_classLit, $intern_76, 7, 5, 15, 1));
|
|
(this.nodeCurrents == null || this.nodeCurrents.length != 13) && (this.nodeCurrents = initUnidimensionalArray(D_classLit, $intern_76, 7, 13, 15, 1));
|
|
}
|
|
;
|
|
_.startIteration = function startIteration_22(){
|
|
var i, torque, val;
|
|
for (i = 0; i != 5; i++) {
|
|
val = this.coilCurrents[i];
|
|
this.coilCurSourceValues[i] = val;
|
|
}
|
|
torque = 2 * $wnd.Math.sqrt(3) / 2 * this.Lm * ((this.coilCurrents[1] - this.coilCurrents[2]) * this.coilCurrents[3] - $wnd.Math.sqrt(3) * this.coilCurrents[0] * this.coilCurrents[4]);
|
|
this.speed += sim_0.timeStep * (torque - this.b * this.speed) / this.J;
|
|
this.angle = this.angle + this.speed * sim_0.timeStep;
|
|
this.vs1value = -2 * this.speed * (this.Lm * $wnd.Math.sqrt(3) / 2 * (this.coilCurrents[1] - this.coilCurrents[2]) + 1.5 * this.Lr * this.coilCurrents[4]);
|
|
this.vs2value = 2 * this.speed * (1.5 * this.Lm * this.coilCurrents[0] + 1.5 * this.Lr * this.coilCurrents[3]);
|
|
}
|
|
;
|
|
_.undumpXml = function undumpXml_88(xml){
|
|
this.flags = $parseIntAttr(xml, 'f', this.flags);
|
|
this.Rs = $parseDoubleAttr(xml, 'rs', this.Rs);
|
|
this.Rr = $parseDoubleAttr(xml, 'rr', this.Rr);
|
|
this.Ls = $parseDoubleAttr(xml, 'ls', this.Ls);
|
|
this.Lr = $parseDoubleAttr(xml, 'lr', this.Lr);
|
|
this.Lm = $parseDoubleAttr(xml, 'lm', this.Lm);
|
|
this.b = $parseDoubleAttr(xml, 'b', this.b);
|
|
this.J = $parseDoubleAttr(xml, 'j', this.J);
|
|
}
|
|
;
|
|
_.J = 0;
|
|
_.Lm = 0;
|
|
_.Lr = 0;
|
|
_.Ls = 0;
|
|
_.Rr = 0;
|
|
_.Rs = 0;
|
|
_.angle = 0;
|
|
_.b = 0;
|
|
_.cr = 0;
|
|
_.filteredSpeed = 0;
|
|
_.speed = 0;
|
|
_.vs1value = 0;
|
|
_.vs2value = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_ThreePhaseMotorElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ThreePhaseMotorElm', 441);
|
|
function TimeDelayRelayElm(xx, yy){
|
|
$clinit_ChipElm();
|
|
ChipElm.call(this, xx, yy);
|
|
this.onDelay = 1;
|
|
this.offDelay = 0;
|
|
this.onResistance = 1;
|
|
this.offResistance = this.resistance = 10000000;
|
|
}
|
|
|
|
function TimeDelayRelayElm_0(xa, ya, xb, yb, f, st){
|
|
$clinit_ChipElm();
|
|
ChipElm_0.call(this, xa, ya, xb, yb, f, st);
|
|
this.onDelay = __parseAndValidateDouble($nextToken(st));
|
|
this.offDelay = __parseAndValidateDouble($nextToken(st));
|
|
this.onResistance = __parseAndValidateDouble($nextToken(st));
|
|
this.offResistance = this.resistance = __parseAndValidateDouble($nextToken(st));
|
|
}
|
|
|
|
defineClass(383, 32, $intern_85, TimeDelayRelayElm, TimeDelayRelayElm_0);
|
|
_.doStep = function doStep_50(){
|
|
this.resistance = this.onState?this.onResistance:this.offResistance;
|
|
$stampResistor(this.nodes[2], this.nodes[3], this.resistance);
|
|
}
|
|
;
|
|
_.draw = function draw_81(g){
|
|
this.pins[0].current = -(this.volts[0] - this.volts[1]) / $intern_88;
|
|
this.pins[2].current = -(this.volts[2] - this.volts[3]) / this.resistance;
|
|
this.pins[1].current = -this.pins[0].current;
|
|
this.pins[3].current = -this.pins[2].current;
|
|
$drawChip(this, g);
|
|
}
|
|
;
|
|
_.dumpXml = function dumpXml_86(doc, elem){
|
|
$dumpXml_0(this, elem);
|
|
dumpAttr(elem, 'ond', this.onDelay);
|
|
dumpAttr(elem, 'ofd', this.offDelay);
|
|
dumpAttr(elem, 'onr', this.onResistance);
|
|
dumpAttr(elem, 'ofr', this.offResistance);
|
|
}
|
|
;
|
|
_.getChipEditInfo = function getChipEditInfo_26(n){
|
|
if (n == 0)
|
|
return new EditInfo_0('On Delay (s)', this.onDelay, 0, 0);
|
|
if (n == 1)
|
|
return new EditInfo_0('Off Delay (s)', this.offDelay, 0, 0);
|
|
if (n == 2)
|
|
return $setPositive(new EditInfo_0('On Resistance (ohms)', this.onResistance, 0, 0));
|
|
if (n == 3)
|
|
return $setPositive(new EditInfo_0('Off Resistance (ohms)', this.offResistance, 0, 0));
|
|
return null;
|
|
}
|
|
;
|
|
_.getChipName = function getChipName_31(){
|
|
return 'time delay relay';
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_109(){
|
|
return 414;
|
|
}
|
|
;
|
|
_.getPostCount_0 = function getPostCount_76(){
|
|
return 4;
|
|
}
|
|
;
|
|
_.getVoltageSourceCount = function getVoltageSourceCount_53(){
|
|
return 0;
|
|
}
|
|
;
|
|
_.isDigitalChip = function isDigitalChip_6(){
|
|
return false;
|
|
}
|
|
;
|
|
_.nonLinear_0 = function nonLinear_25(){
|
|
return true;
|
|
}
|
|
;
|
|
_.reset_0 = function reset_52(){
|
|
this.lastTransition = 0;
|
|
this.poweredState = this.onState = false;
|
|
}
|
|
;
|
|
_.setChipEditValue = function setChipEditValue_27(n, ei){
|
|
n == 0 && (this.onDelay = ei.value_0);
|
|
n == 1 && (this.offDelay = ei.value_0);
|
|
n == 2 && (this.onResistance = ei.value_0);
|
|
n == 3 && (this.offResistance = ei.value_0);
|
|
}
|
|
;
|
|
_.setupPins = function setupPins_32(){
|
|
this.sizeX = 2;
|
|
this.sizeY = 2;
|
|
this.pins = initUnidimensionalArray(Lcom_lushprojects_circuitjs1_client_ChipElm$Pin_2_classLit, $intern_3, 9, 4, 0, 1);
|
|
this.pins[0] = new ChipElm$Pin(this, 1, 2, 'Vin');
|
|
this.pins[1] = new ChipElm$Pin(this, 1, 3, 'gnd');
|
|
this.pins[2] = new ChipElm$Pin(this, 0, 2, 'in');
|
|
this.pins[3] = new ChipElm$Pin(this, 0, 3, 'out');
|
|
}
|
|
;
|
|
_.stamp = function stamp_65(){
|
|
this.resistance = this.onState?this.onResistance:this.offResistance;
|
|
$stampResistor(this.nodes[0], this.nodes[1], $intern_88);
|
|
}
|
|
;
|
|
_.stepFinished = function stepFinished_24(){
|
|
var oldState;
|
|
oldState = this.poweredState;
|
|
this.poweredState = this.volts[0] - this.volts[1] > 2.5;
|
|
oldState != this.poweredState && (this.lastTransition = sim_0.t);
|
|
sim_0.t > this.lastTransition + (this.poweredState?this.onDelay:this.offDelay) && (this.onState = this.poweredState);
|
|
}
|
|
;
|
|
_.undumpXml = function undumpXml_89(xml){
|
|
$undumpXml_0(this, xml);
|
|
this.onDelay = $parseDoubleAttr(xml, 'ond', this.onDelay);
|
|
this.offDelay = $parseDoubleAttr(xml, 'ofd', this.offDelay);
|
|
this.onResistance = $parseDoubleAttr(xml, 'onr', this.onResistance);
|
|
this.offResistance = $parseDoubleAttr(xml, 'ofr', this.offResistance);
|
|
this.resistance = this.offResistance;
|
|
}
|
|
;
|
|
_.lastTransition = 0;
|
|
_.offDelay = 0;
|
|
_.offResistance = 0;
|
|
_.onDelay = 0;
|
|
_.onResistance = 0;
|
|
_.onState = false;
|
|
_.poweredState = false;
|
|
_.resistance = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_TimeDelayRelayElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'TimeDelayRelayElm', 383);
|
|
function $setupPins_24(this$static){
|
|
this$static.sizeX = 3;
|
|
this$static.sizeY = 5;
|
|
this$static.pins = initUnidimensionalArray(Lcom_lushprojects_circuitjs1_client_ChipElm$Pin_2_classLit, $intern_3, 9, 8, 0, 1);
|
|
this$static.pins[0] = new ChipElm$Pin(this$static, 1, 2, (this$static.flags & 8) == 0?'dis':'7');
|
|
this$static.pins[1] = new ChipElm$Pin(this$static, 3, 2, (this$static.flags & 8) == 0?'tr':'2');
|
|
(this$static.flags & 8) == 0 && (this$static.pins[1].lineOver = true);
|
|
this$static.pins[2] = new ChipElm$Pin(this$static, 4, 2, (this$static.flags & 8) == 0?'th':'6');
|
|
this$static.pins[3] = new ChipElm$Pin(this$static, 1, 0, (this$static.flags & 8) == 0?'Vcc':'8');
|
|
this$static.pins[4] = new ChipElm$Pin(this$static, 1, 1, (this$static.flags & 8) == 0?'ctl':'5');
|
|
this$static.pins[5] = new ChipElm$Pin(this$static, 2, 3, (this$static.flags & 8) == 0?'out':'3');
|
|
this$static.pins[5].state = true;
|
|
this$static.pins[6] = new ChipElm$Pin(this$static, 1, 3, (this$static.flags & 8) == 0?'rst':'4');
|
|
(this$static.flags & 8) == 0 && (this$static.pins[6].lineOver = true);
|
|
this$static.pins[7] = new ChipElm$Pin(this$static, 2, 1, (this$static.flags & 8) == 0?'gnd':'1');
|
|
}
|
|
|
|
function TimerElm(xx, yy){
|
|
$clinit_ChipElm();
|
|
ChipElm.call(this, xx, yy);
|
|
}
|
|
|
|
function TimerElm_0(xa, ya, xb, yb, f, st){
|
|
$clinit_ChipElm();
|
|
ChipElm_0.call(this, xa, ya, xb, yb, f, st);
|
|
}
|
|
|
|
defineClass(415, 32, $intern_85, TimerElm, TimerElm_0);
|
|
_.calculateCurrent = function calculateCurrent_37(){
|
|
var groundVolts;
|
|
this.pins[3].current = (this.volts[4] - this.volts[3]) / 5000;
|
|
groundVolts = (this.flags & 4) != 0?this.volts[7]:0;
|
|
this.pins[4].current = -(this.volts[4] - groundVolts) / $intern_88 - this.pins[3].current;
|
|
this.pins[0].current = this.out?0:-(this.volts[0] - groundVolts) / 10;
|
|
this.pins[5].current = -(this.volts[5] - (this.out?this.volts[3]:groundVolts));
|
|
this.out && (this.pins[3].current -= this.pins[5].current);
|
|
if ((this.flags & 4) != 0) {
|
|
this.pins[7].current = (this.volts[4] - groundVolts) / $intern_88;
|
|
this.out || (this.pins[7].current += (this.volts[0] - groundVolts) / 10 + (this.volts[5] - groundVolts));
|
|
}
|
|
}
|
|
;
|
|
_.doStep = function doStep_51(){
|
|
this.out || $stampResistor(this.nodes[0], this.ground, 10);
|
|
$stampResistor(this.out?this.nodes[3]:this.ground, this.nodes[5], 1);
|
|
}
|
|
;
|
|
_.getChipEditInfo = function getChipEditInfo_27(n){
|
|
var ei;
|
|
if (n == 0) {
|
|
ei = new EditInfo_0('', 0, 0, 0);
|
|
ei.checkbox = new Checkbox_0('Ground Pin', (this.flags & 4) != 0);
|
|
return ei;
|
|
}
|
|
if (n == 1) {
|
|
ei = createCheckbox('Show Pin Numbers', (this.flags & 8) != 0);
|
|
return ei;
|
|
}
|
|
return null;
|
|
}
|
|
;
|
|
_.getChipName = function getChipName_32(){
|
|
return '555 Timer';
|
|
}
|
|
;
|
|
_.getDefaultFlags = function getDefaultFlags_0(){
|
|
return 6;
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_110(){
|
|
return 165;
|
|
}
|
|
;
|
|
_.getMatrixConnection = function getMatrixConnection_12(n1, n2){
|
|
return true;
|
|
}
|
|
;
|
|
_.getPostCount_0 = function getPostCount_77(){
|
|
return (this.flags & 4) != 0?8:(this.flags & 2) != 0 || (this.flags & 4) != 0?7:6;
|
|
}
|
|
;
|
|
_.getVoltageSourceCount = function getVoltageSourceCount_54(){
|
|
return 0;
|
|
}
|
|
;
|
|
_.isDigitalChip = function isDigitalChip_7(){
|
|
return false;
|
|
}
|
|
;
|
|
_.nonLinear_0 = function nonLinear_26(){
|
|
return true;
|
|
}
|
|
;
|
|
_.setChipEditValue = function setChipEditValue_28(n, ei){
|
|
if (n == 0) {
|
|
this.flags = $changeFlag(ei, this.flags, 4);
|
|
$allocNodes(this);
|
|
$setPoints_0(this);
|
|
return;
|
|
}
|
|
if (n == 1) {
|
|
this.flags = $changeFlag(ei, this.flags, 8);
|
|
$setupPins_24(this);
|
|
$setPoints_0(this);
|
|
return;
|
|
}
|
|
}
|
|
;
|
|
_.setupPins = function setupPins_33(){
|
|
$setupPins_24(this);
|
|
}
|
|
;
|
|
_.stamp = function stamp_66(){
|
|
this.ground = (this.flags & 4) != 0?this.nodes[7]:ground;
|
|
$stampResistor(this.nodes[3], this.nodes[4], 5000);
|
|
$stampResistor(this.nodes[4], this.ground, $intern_88);
|
|
}
|
|
;
|
|
_.startIteration = function startIteration_23(){
|
|
var groundVolts, triggered;
|
|
groundVolts = (this.flags & 4) != 0?this.volts[7]:0;
|
|
this.out = this.volts[5] > (this.volts[3] + groundVolts) / 2;
|
|
this.volts[2] > this.volts[4] && (this.out = false);
|
|
triggered = (this.volts[4] + groundVolts) / 2 > this.volts[1];
|
|
(triggered || this.triggerSuppressed) && (this.out = true);
|
|
if (((this.flags & 2) != 0 || (this.flags & 4) != 0) && this.volts[6] < 0.7 + groundVolts) {
|
|
this.out = false;
|
|
this.triggerSuppressed = triggered;
|
|
}
|
|
else
|
|
this.triggerSuppressed = false;
|
|
}
|
|
;
|
|
_.out = false;
|
|
_.triggerSuppressed = false;
|
|
var Lcom_lushprojects_circuitjs1_client_TimerElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'TimerElm', 415);
|
|
function $addTouchDragSupport(el){
|
|
var startX, startY, moved;
|
|
var TAP_THRESHOLD = 6;
|
|
el.addEventListener('touchstart', function(e){
|
|
if (e.touches.length != 1)
|
|
return;
|
|
var t = e.touches[0];
|
|
startX = t.clientX;
|
|
startY = t.clientY;
|
|
moved = false;
|
|
var me = new MouseEvent('mousedown', {clientX:t.clientX, clientY:t.clientY, bubbles:true, cancelable:true, button:0});
|
|
el.dispatchEvent(me);
|
|
}
|
|
, {passive:true});
|
|
el.addEventListener('touchmove', function(e){
|
|
if (e.touches.length != 1)
|
|
return;
|
|
e.preventDefault();
|
|
var t = e.touches[0];
|
|
var dx = t.clientX - startX, dy = t.clientY - startY;
|
|
dx * dx + dy * dy > TAP_THRESHOLD * TAP_THRESHOLD && (moved = true);
|
|
var me = new MouseEvent('mousemove', {clientX:t.clientX, clientY:t.clientY, bubbles:true, cancelable:true});
|
|
$doc.dispatchEvent(me);
|
|
}
|
|
, {passive:false});
|
|
el.addEventListener('touchend', function(e){
|
|
e.preventDefault();
|
|
var t = e.changedTouches[0];
|
|
var me = new MouseEvent('mouseup', {clientX:t.clientX, clientY:t.clientY, bubbles:true, cancelable:true});
|
|
$doc.dispatchEvent(me);
|
|
if (!moved) {
|
|
var click_0 = new MouseEvent('click', {clientX:t.clientX, clientY:t.clientY, bubbles:true, cancelable:true});
|
|
el.dispatchEvent(click_0);
|
|
}
|
|
}
|
|
, {passive:false});
|
|
el.addEventListener('touchcancel', function(e){
|
|
var t = e.changedTouches[0];
|
|
var me = new MouseEvent('mouseup', {clientX:t.clientX, clientY:t.clientY, bubbles:true, cancelable:true});
|
|
$doc.dispatchEvent(me);
|
|
}
|
|
, {passive:true});
|
|
}
|
|
|
|
function $createButtonSet(this$static, info){
|
|
var app, command, i, iconLabel, mainCommand, paletteContainer, paletteStyle, selectVariant, smallSvg, variantButton, variantStyle;
|
|
mainCommand = new MyCommand('main', info[1]);
|
|
app = theApp;
|
|
iconLabel = $createIconButton(this$static, info[0], $getLabelTextForClass_0(app.ui, info[1]), mainCommand);
|
|
paletteContainer = new FlowPanel;
|
|
setVisible(($clinit_DOM() , paletteContainer.element), false);
|
|
paletteContainer.element.className = 'palette-container';
|
|
paletteStyle = paletteContainer.element.style;
|
|
paletteStyle['position'] = ($clinit_Style$Position() , 'absolute');
|
|
paletteStyle['zIndex'] = '1000';
|
|
paletteStyle['backgroundColor'] = '#ffffff';
|
|
paletteStyle['borderWidth'] = ($clinit_Style$Unit() , '1.0px');
|
|
paletteStyle['borderColor'] = '#ccc';
|
|
paletteStyle['borderStyle'] = ($clinit_Style$BorderStyle() , 'solid');
|
|
paletteStyle['padding'] = '5.0px';
|
|
for (i = 0; i < info.length; i += 2) {
|
|
variantButton = new Label;
|
|
$setTextOrHtml(variantButton.directionalTextHelper, '', false);
|
|
$updateHorizontalAlignment(variantButton);
|
|
$setInnerHTML(variantButton.element, $makeSvg(info[i], 40));
|
|
$setTitle(variantButton, $getLabelTextForClass_0(app.ui, info[i + 1]));
|
|
variantStyle = variantButton.element.style;
|
|
variantStyle['color'] = '#333';
|
|
variantStyle['cursor'] = ($clinit_Style$Cursor() , 'pointer');
|
|
variantStyle['touchAction'] = 'none';
|
|
command = new MyCommand('main', info[i + 1]);
|
|
smallSvg = $makeSvg(info[i], 24);
|
|
selectVariant = new Toolbar$lambda$5$Type(this$static, iconLabel, smallSvg, mainCommand, command, paletteContainer);
|
|
$addDomHandler(variantButton, new Toolbar$lambda$6$Type(selectVariant, command), ($clinit_ClickEvent() , $clinit_ClickEvent() , TYPE_1));
|
|
$addDomHandler(variantButton, new Toolbar$lambda$7$Type(selectVariant, command), ($clinit_MouseDownEvent() , $clinit_MouseDownEvent() , TYPE_7));
|
|
$addTouchDragSupport(variantButton.element);
|
|
$addDomHandler(variantButton, new Toolbar$lambda$8$Type(this$static, app, command), ($clinit_MouseOverEvent() , $clinit_MouseOverEvent() , TYPE_10));
|
|
$addDomHandler(variantButton, new Toolbar$lambda$9$Type, ($clinit_MouseOutEvent() , $clinit_MouseOutEvent() , TYPE_9));
|
|
$add(paletteContainer, variantButton, paletteContainer.element);
|
|
}
|
|
$add_0(($clinit_RootPanel() , get_1()), paletteContainer);
|
|
$addDomHandler(iconLabel, new Toolbar$lambda$10$Type(paletteContainer, iconLabel), ($clinit_MouseOverEvent() , $clinit_MouseOverEvent() , TYPE_10));
|
|
$addDomHandler(iconLabel, new Toolbar$lambda$11$Type(paletteContainer), ($clinit_MouseOutEvent() , $clinit_MouseOutEvent() , TYPE_9));
|
|
$addDomHandler(paletteContainer, new Toolbar$lambda$12$Type(paletteContainer), (null , TYPE_10));
|
|
$addDomHandler(paletteContainer, new Toolbar$lambda$13$Type(paletteContainer), (null , TYPE_9));
|
|
return iconLabel;
|
|
}
|
|
|
|
function $createIconButton(this$static, iconClass, tooltip, command){
|
|
var iconLabel, style;
|
|
iconLabel = new Label;
|
|
$setTextOrHtml(iconLabel.directionalTextHelper, '', false);
|
|
$updateHorizontalAlignment(iconLabel);
|
|
$equals_1(iconClass.substr(0, 4), '<svg')?$setInnerHTML(($clinit_DOM() , iconLabel.element), "<svg xmlns='http://www.w3.org/2000/svg' width='24' height='24'><g transform='scale(1.0)'>" + $substring_0(iconClass, 5, iconClass.length - 5) + '<g><\/svg>'):$addClassName(($clinit_DOM() , iconLabel.element), 'cirjsicon-' + iconClass);
|
|
$setTitle(iconLabel, LS(tooltip));
|
|
style = ($clinit_DOM() , iconLabel.element).style;
|
|
style['fontSize'] = ($clinit_Style$Unit() , '24.0px');
|
|
style['color'] = '#333';
|
|
style['padding'] = '1.0px';
|
|
style['marginRight'] = '5.0px';
|
|
style['cursor'] = ($clinit_Style$Cursor() , 'pointer');
|
|
$equals_1(iconClass.substr(0, 4), '<svg') && (style['paddingTop'] = '5.0px' , undefined);
|
|
style['touchAction'] = 'none';
|
|
$addDomHandler(iconLabel, new Toolbar$lambda$0$Type(iconLabel), ($clinit_MouseOverEvent() , $clinit_MouseOverEvent() , TYPE_10));
|
|
$addDomHandler(iconLabel, new Toolbar$lambda$1$Type(iconLabel), ($clinit_MouseOutEvent() , $clinit_MouseOutEvent() , TYPE_9));
|
|
$addDomHandler(iconLabel, new Toolbar$1(this$static, iconLabel, command), ($clinit_ClickEvent() , $clinit_ClickEvent() , TYPE_1));
|
|
if ($equals_1(command.menuName, 'main')) {
|
|
$putStringValue(this$static.highlightableButtons, command.itemName, iconLabel);
|
|
$addDomHandler(iconLabel, new Toolbar$lambda$2$Type(command), ($clinit_MouseDownEvent() , $clinit_MouseDownEvent() , TYPE_7));
|
|
$addTouchDragSupport(iconLabel.element);
|
|
$addDomHandler(iconLabel, new Toolbar$lambda$3$Type(this$static, command), (null , TYPE_10));
|
|
$addDomHandler(iconLabel, new Toolbar$lambda$4$Type, (null , TYPE_9));
|
|
}
|
|
return iconLabel;
|
|
}
|
|
|
|
function $highlightButton(this$static, key){
|
|
var newActiveButton;
|
|
if (this$static.activeButton) {
|
|
$getElement(this$static.activeButton).style['color'] = '#333';
|
|
$getElement(this$static.activeButton).style['backgroundColor'] = null;
|
|
}
|
|
newActiveButton = $getStringValue(this$static.highlightableButtons, key);
|
|
if (newActiveButton) {
|
|
($clinit_DOM() , newActiveButton.element).style['color'] = '#007bff';
|
|
newActiveButton.element.style['backgroundColor'] = '#e6f7ff';
|
|
this$static.activeButton = newActiveButton;
|
|
}
|
|
}
|
|
|
|
function $lambda$3(this$static, command_1){
|
|
var label_0;
|
|
label_0 = $getLabelTextForClass(theApp, command_1.itemName);
|
|
label_0 != null && $setModeLabel(this$static, label_0 + ('' + LS(': Drag And Drop To Create')));
|
|
}
|
|
|
|
function $lambda$5(this$static, iconLabel_1, smallSvg_2, mainCommand_3, command_4, paletteContainer_5){
|
|
$setInnerHTML(($clinit_DOM() , iconLabel_1.element), smallSvg_2);
|
|
$removeStringValue(this$static.highlightableButtons, mainCommand_3.itemName);
|
|
$putStringValue(this$static.highlightableButtons, command_4.itemName, iconLabel_1);
|
|
setVisible(paletteContainer_5.element, false);
|
|
$setItemName(mainCommand_3, command_4.itemName);
|
|
}
|
|
|
|
function $lambda$8(this$static, app_1, command_2){
|
|
var label_0;
|
|
label_0 = $getLabelTextForClass(app_1, command_2.itemName);
|
|
label_0 != null && $setModeLabel(this$static, label_0 + ('' + LS(': Drag And Drop To Create')));
|
|
}
|
|
|
|
function $makeSvg(s, size_0){
|
|
var scale;
|
|
scale = size_0 / 24;
|
|
return "<svg xmlns='http://www.w3.org/2000/svg' width='" + size_0 + "' height='" + size_0 + "'><g transform='scale(" + scale + ")'>" + $substring_0(s, 5, s.length - 5) + '<g><\/svg>';
|
|
}
|
|
|
|
function $setEuroResistors(this$static, euro){
|
|
$setInnerHTML($getElement(this$static.resistorButton), "<svg xmlns='http://www.w3.org/2000/svg' width='24' height='24'><g transform='scale(1.0)'>" + $substring_0(euro?"<svg><g transform='translate(97.71,-28.71) scale(0.428571)'><path fill='none' stroke='currentColor' d=' M -224 96 L -216 96' stroke-linecap='round' stroke-width='3' /><path fill='none' stroke='currentColor' d=' M -184 96 L -176 96' stroke-linecap='round' stroke-width='3' /><g transform='matrix(1,0,0,1,-216,96)'><rect fill='none' stroke='currentColor' x='0' y='-6' width='32' height='12' stroke-linecap='round' stroke-width='3' /><\/g><path fill='currentColor' stroke='currentColor' d=' M -221 96 A 3 3 0 1 1 -221.00026077471009 95.96044522459944 Z' /><path fill='currentColor' stroke='currentColor' d=' M -173 96 A 3 3 0 1 1 -173.00026077471009 95.96044522459944 Z' /><\/g><\/svg>":"<svg> <g transform='scale(.5,.5) translate(-544,-297)'><path stroke='#000000' d=' M 544 320 L 552 320' stroke-width='3'/><path stroke='#000000' d=' M 584 320 L 592 320' stroke-width='3'/><g transform='matrix(1,0,0,1,552,320)'><path fill='none' stroke='currentColor' d=' M 0 0 L 2 6 L 6 -6 L 10 6 L 14 -6 L 18 6 L 22 -6 L 26 6 L 30 -6 L 32 0' stroke-width='2'/> <\/g> <\/g> <\/svg>", 5, (euro?"<svg><g transform='translate(97.71,-28.71) scale(0.428571)'><path fill='none' stroke='currentColor' d=' M -224 96 L -216 96' stroke-linecap='round' stroke-width='3' /><path fill='none' stroke='currentColor' d=' M -184 96 L -176 96' stroke-linecap='round' stroke-width='3' /><g transform='matrix(1,0,0,1,-216,96)'><rect fill='none' stroke='currentColor' x='0' y='-6' width='32' height='12' stroke-linecap='round' stroke-width='3' /><\/g><path fill='currentColor' stroke='currentColor' d=' M -221 96 A 3 3 0 1 1 -221.00026077471009 95.96044522459944 Z' /><path fill='currentColor' stroke='currentColor' d=' M -173 96 A 3 3 0 1 1 -173.00026077471009 95.96044522459944 Z' /><\/g><\/svg>":"<svg> <g transform='scale(.5,.5) translate(-544,-297)'><path stroke='#000000' d=' M 544 320 L 552 320' stroke-width='3'/><path stroke='#000000' d=' M 584 320 L 592 320' stroke-width='3'/><g transform='matrix(1,0,0,1,552,320)'><path fill='none' stroke='currentColor' d=' M 0 0 L 2 6 L 6 -6 L 10 6 L 14 -6 L 18 6 L 22 -6 L 26 6 L 30 -6 L 32 0' stroke-width='2'/> <\/g> <\/g> <\/svg>").length - 5) + '<g><\/svg>');
|
|
}
|
|
|
|
function $setModeLabel(this$static, text_0){
|
|
$setText_0(this$static.modeLabel, text_0);
|
|
}
|
|
|
|
function $styleModeLabel(label_0){
|
|
var style;
|
|
style = ($clinit_DOM() , label_0.element).style;
|
|
style['fontSize'] = ($clinit_Style$Unit() , '16.0px');
|
|
style['color'] = '#333';
|
|
style['paddingRight'] = '10.0px';
|
|
style['whiteSpace'] = 'nowrap';
|
|
}
|
|
|
|
function Toolbar(){
|
|
var app, app0, app1, app2, app3, app4, app5, app6, fetInfo, gateInfo, opAmpInfo, srcInfo, style, switchInfo, transistorInfo;
|
|
FlowPanel.call(this);
|
|
this.highlightableButtons = new HashMap;
|
|
style = ($clinit_DOM() , this.element).style;
|
|
style['padding'] = ($clinit_Style$Unit() , '2.0px');
|
|
style['backgroundColor'] = '#f8f8f8';
|
|
style['borderWidth'] = '1.0px';
|
|
style['borderStyle'] = ($clinit_Style$BorderStyle() , 'solid');
|
|
style['borderColor'] = '#ccc';
|
|
style['display'] = ($clinit_Style$Display() , 'flex');
|
|
style['alignItems'] = 'center';
|
|
$add_2(this, $createIconButton(this, 'ccw', 'Undo', new MyCommand('edit', 'undo')));
|
|
$add_2(this, $createIconButton(this, 'cw', 'Redo', new MyCommand('edit', 'redo')));
|
|
$add_2(this, $createIconButton(this, 'scissors', 'Cut', new MyCommand('edit', 'cut')));
|
|
$add_2(this, $createIconButton(this, 'copy', 'Copy', new MyCommand('edit', 'copy')));
|
|
$add_2(this, $createIconButton(this, 'paste', 'Paste', new MyCommand('edit', 'paste')));
|
|
$add_2(this, $createIconButton(this, 'clone', 'Duplicate', new MyCommand('edit', 'duplicate')));
|
|
$add_2(this, $createIconButton(this, 'search', 'Find Component...', new MyCommand('edit', 'search')));
|
|
$add_2(this, $createIconButton(this, 'zoom-11', 'Zoom 100%', new MyCommand('zoom', 'zoom100')));
|
|
$add_2(this, $createIconButton(this, 'zoom-in', 'Zoom In', new MyCommand('zoom', 'zoomin')));
|
|
$add_2(this, $createIconButton(this, 'zoom-out', 'Zoom Out', new MyCommand('zoom', 'zoomout')));
|
|
$add_2(this, (app0 = theApp , $createIconButton(this, "<svg><g transform='scale(0.208) translate(7.5, 32)'><line x1='5' y1='45' x2='95' y2='5' stroke='currentColor' stroke-width='8' /> <circle cx='5' cy='45' r='10' fill='currentColor' /><circle cx='95' cy='5' r='10' fill='currentColor' /> <\/g><\/svg>", $getLabelTextForClass_0(app0.ui, 'WireElm'), new MyCommand('main', 'WireElm'))));
|
|
$add_2(this, this.resistorButton = (app1 = theApp , $createIconButton(this, "<svg> <g transform='scale(.5,.5) translate(-544,-297)'><path stroke='#000000' d=' M 544 320 L 552 320' stroke-width='3'/><path stroke='#000000' d=' M 584 320 L 592 320' stroke-width='3'/><g transform='matrix(1,0,0,1,552,320)'><path fill='none' stroke='currentColor' d=' M 0 0 L 2 6 L 6 -6 L 10 6 L 14 -6 L 18 6 L 22 -6 L 26 6 L 30 -6 L 32 0' stroke-width='2'/> <\/g> <\/g> <\/svg>", $getLabelTextForClass_0(app1.ui, 'ResistorElm'), new MyCommand('main', 'ResistorElm'))));
|
|
$add_2(this, (app2 = theApp , $createIconButton(this, "<svg><defs /><g transform='scale(.6) translate(-826.46,-231.31) scale(1.230769)'><path fill='none' stroke='currentColor' d=' M 688 192 L 688 208' stroke-linecap='round' stroke-width='3' /> <path fill='none' stroke='currentColor' d=' M 698 208 L 678 208' stroke-linecap='round' stroke-width='3' /><path fill='none' stroke='currentColor' d=' M 694 213 L 682 213' stroke-linecap='round' stroke-width='3' /><path fill='none' stroke='currentColor' d=' M 690 218 L 686 218' stroke-linecap='round' stroke-width='3' /><path fill='currentColor' stroke='currentColor' d=' M 691 192 A 3 3 0 1 1 690.9997392252899 191.96044522459943 Z' /> <\/g><\/svg>", $getLabelTextForClass_0(app2.ui, 'GroundElm'), new MyCommand('main', 'GroundElm'))));
|
|
$add_2(this, (app3 = theApp , $createIconButton(this, "<svg><defs /><g transform='translate(-323.76,-71.18) scale(0.470588)'><path fill='none' stroke='currentColor' d=' M 688 176 L 708 176' stroke-linecap='round' stroke-width='3' /><path fill='none' stroke='currentColor' d=' M 708 164 L 708 188' stroke-linecap='round' stroke-width='3' /><path fill='none' stroke='currentColor' d=' M 736 176 L 716 176' stroke-linecap='round' stroke-width='3' /><path fill='none' stroke='currentColor' d=' M 716 164 L 716 188' stroke-linecap='round' stroke-width='3' /><path fill='currentColor' stroke='currentColor' d=' M 691 176 A 3 3 0 1 1 690.9997392252899 175.96044522459943 Z' /><path fill='currentColor' stroke='currentColor' d=' M 739 176 A 3 3 0 1 1 738.9997392252899 175.96044522459943 Z' /><\/g><\/svg>", $getLabelTextForClass_0(app3.ui, 'CapacitorElm'), new MyCommand('main', 'CapacitorElm'))));
|
|
$add_2(this, (app4 = theApp , $createIconButton(this, "<svg><g transform='translate(-101.59,-58.18) scale(0.405680)'><path fill='none' stroke='currentColor' d=' M 256 176 L 264 176' stroke-linecap='round' stroke-width='3' /><path fill='none' stroke='currentColor' d=' M 296 176 L 304 176' stroke-linecap='round' stroke-width='3' /><g transform='matrix(1,0,0,1,264,176) scale(1,1)'><path fill='none' stroke='currentColor' d=' M 0 0 L 0 6.53144959545255e-16 A 5.333333333333333 5.333333333333333 0 0 1 10.666666666666666 0 L 10.666666666666666 0' stroke-linecap='round' stroke-width='3' /><path fill='none' stroke='currentColor' d=' M 10.666666666666666 0 L 10.666666666666668 6.53144959545255e-16 A 5.333333333333333 5.333333333333333 0 0 1 21.333333333333332 0 L 21.333333333333332 0' stroke-linecap='round' stroke-width='3' /><path fill='none' stroke='currentColor' d=' M 21.333333333333332 0 L 21.333333333333336 6.53144959545255e-16 A 5.333333333333333 5.333333333333333 0 0 1 32 0 L 32 0' stroke-linecap='round' stroke-width='3' /><\/g><path fill='currentColor' stroke='currentColor' d=' M 259 176 A 3 3 0 1 1 258.99973922528994 175.96044522459943 Z' /><path fill='currentColor' stroke='currentColor' d=' M 307 176 A 3 3 0 1 1 306.99973922528994 175.96044522459943 Z' /><\/g><\/svg>", $getLabelTextForClass_0(app4.ui, 'InductorElm'), new MyCommand('main', 'InductorElm'))));
|
|
$add_2(this, (app5 = theApp , $createIconButton(this, "<svg><defs /><g transform='translate(-323.76,-72.06) scale(0.470588)'><path fill='none' stroke='currentColor' d=' M 688 176 L 704 176' stroke-linecap='round' stroke-width='3' /><path fill='none' stroke='currentColor' d=' M 720 176 L 736 176' stroke-linecap='round' stroke-width='3' /><path fill='currentColor' stroke='currentColor' d=' M 704 168 L 704 184 L 720 176 Z' /><path fill='none' stroke='currentColor' d=' M 720 168 L 720 184' stroke-linecap='round' stroke-width='3' /><path fill='currentColor' stroke='currentColor' d=' M 691 176 A 3 3 0 1 1 690.9997392252899 175.96044522459943 Z' /><path fill='currentColor' stroke='currentColor' d=' M 739 176 A 3 3 0 1 1 738.9997392252899 175.96044522459943 Z' /><\/g><\/svg>", $getLabelTextForClass_0(app5.ui, 'DiodeElm'), new MyCommand('main', 'DiodeElm'))));
|
|
srcInfo = stampJavaTypeInfo(getClassLiteralForArray(Ljava_lang_String_2_classLit, 1), $intern_23, 2, 6, ["<svg><defs /><g transform='scale(.8) translate(-122.00,-53.00) scale(0.500000)'><path fill='none' stroke='currentColor' d=' M 272 160 L 272 140' stroke-linecap='round' stroke-width='3' /><path fill='none' stroke='currentColor' d=' M 272 132 L 272 112' stroke-linecap='round' stroke-width='3' /><path fill='none' stroke='currentColor' d=' M 262 140 L 282 140' stroke-linecap='round' stroke-width='3' /><path fill='none' stroke='currentColor' d=' M 256 132 L 288 132' stroke-linecap='round' stroke-width='3' /><path fill='currentColor' stroke='currentColor' d=' M 275 160 A 3 3 0 1 1 274.99973922528994 159.96044522459943 Z' /><path fill='currentColor' stroke='currentColor' d=' M 275 112 A 3 3 0 1 1 274.99973922528994 111.96044522459944 Z' /><\/g><\/svg>", 'DCVoltageElm', "<svg><g transform='translate(-104.09,-66.93) scale(0.266667)'><path fill='none' stroke='currentColor' d=' M 432 336 L 432 313' stroke-linecap='round' stroke-width='3' /><path fill='none' stroke='currentColor' d=' M 432 279 L 432 256' stroke-linecap='round' stroke-width='3' /><path fill='none' stroke='currentColor' d=' M 448.66 296 A 16.66 16.66 0 1 1 448.6599916700007 295.98334000277663' stroke-linecap='round' stroke-width='3' /><path fill='none' stroke='currentColor' d=' M 422 296 L 423 294 L 424 292 L 425 290 L 426 289 L 427 289 L 428 289 L 429 290 L 430 292 L 431 294 L 432 296 L 433 298 L 434 300 L 435 302 L 436 303 L 437 303 L 438 303 L 439 302 L 440 300 L 441 298 L 442 296' stroke-linecap='round' stroke-width='3' /><\/g><\/svg>", 'ACVoltageElm']);
|
|
$add_2(this, $createButtonSet(this, srcInfo));
|
|
$add_2(this, (app6 = theApp , $createIconButton(this, "<svg><g><text style='user-select: none;' fill='currentColor' stroke='none' font-family='sans-serif' font-size='10px' font-style='normal' font-weight='normal' text-decoration='normal' x='2' y='11' text-anchor='start' dominant-baseline='central'>+5V<\/text><\/g><\/svg>", $getLabelTextForClass_0(app6.ui, 'RailElm'), new MyCommand('main', 'RailElm'))));
|
|
switchInfo = stampJavaTypeInfo(getClassLiteralForArray(Ljava_lang_String_2_classLit, 1), $intern_23, 2, 6, ["<svg><defs /><g transform='translate(55.79,-100.42) scale(0.421053)'><path fill='none' stroke='currentColor' d=' M -128 272 L -120 272' stroke-linecap='round' stroke-width='3' /><path fill='none' stroke='currentColor' d=' M -88 272 L -80 272' stroke-linecap='round' stroke-width='3' /><path fill='none' stroke='currentColor' d=' M -120 272 L -88 256' stroke-linecap='round' stroke-width='3' /><\/g><\/svg>", 'SwitchElm', "<svg><g transform='translate(-242.27,-143.68) scale(0.324324)'><path fill='none' stroke='currentColor' d=' M 752 480 L 768 480' stroke-linecap='round' stroke-width='3' /><path fill='none' stroke='currentColor' d=' M 800 464 L 816 464' stroke-linecap='round' stroke-width='3' /><path fill='none' stroke='currentColor' d=' M 800 496 L 816 496' stroke-linecap='round' stroke-width='3' /><path fill='none' stroke='currentColor' d=' M 768 480 L 800 464' stroke-linecap='round' stroke-width='3' /><\/g><\/svg>", 'Switch2Elm', "<svg><g transform='translate(-242.27,-122.92) scale(0.324324)'><path fill='none' stroke='currentColor' d=' M 752 416 L 768 416' stroke-linecap='round' stroke-width='3' /><path fill='none' stroke='currentColor' d=' M 800 416 L 816 416' stroke-linecap='round' stroke-width='3' /><path fill='none' stroke='currentColor' d=' M 768 416 L 800 400' stroke-linecap='round' stroke-width='3' /><path fill='none' stroke='currentColor' d=' M 784 432 L 784 424' stroke-linecap='round' stroke-width='3' /><\/g><\/svg>", 'AnalogSwitchElm', "<svg><g transform='translate(-237.08,-146.27) scale(0.324324)'><path fill='none' stroke='currentColor' d=' M 736 480 L 752 480' stroke-linecap='round' stroke-width='3' /><path fill='none' stroke='currentColor' d=' M 784 496 L 800 496' stroke-linecap='round' stroke-width='3' /><path fill='none' stroke='currentColor' d=' M 784 464 L 800 464' stroke-linecap='round' stroke-width='3' /><path fill='none' stroke='currentColor' d=' M 752 480 L 784 464' stroke-linecap='round' stroke-width='3' /><path fill='none' stroke='currentColor' d=' M 768 496 L 768 512' stroke-linecap='round' stroke-width='3' /><\/g><\/svg>", 'AnalogSwitch2Elm']);
|
|
$add_2(this, $createButtonSet(this, switchInfo));
|
|
opAmpInfo = stampJavaTypeInfo(getClassLiteralForArray(Ljava_lang_String_2_classLit, 1), $intern_23, 2, 6, ["<svg><g transform='translate(-169.33,-86.13) scale(0.266667)'><path fill='none' stroke='currentColor' d=' M 640 352 L 654 352' stroke-linecap='round' stroke-width='3' /><path fill='none' stroke='currentColor' d=' M 640 384 L 654 384' stroke-linecap='round' stroke-width='3' /><path fill='none' stroke='currentColor' d=' M 706 368 L 720 368' stroke-linecap='round' stroke-width='3' /><path fill='none' stroke='currentColor' d=' M 654 336 L 654 400 L 706 368 Z' stroke-linecap='round' stroke-width='3' /><g><text fill='currentColor' stroke='currentColor' font-family='sans-serif' font-size='14px' font-style='normal' font-weight='normal' text-decoration='normal' x='664' y='350' text-anchor='middle' dominant-baseline='central'>-<\/text><\/g><g><text fill='currentColor' stroke='currentColor' font-family='sans-serif' font-size='14px' font-style='normal' font-weight='normal' text-decoration='normal' x='664' y='384' text-anchor='middle' dominant-baseline='central'>+<\/text><\/g><\/g><\/svg>", 'OpAmpElm', "<svg><g transform='translate(-169.33,-86.13) scale(0.266667)'><path fill='none' stroke='currentColor' d=' M 640 384 L 654 384' stroke-linecap='round' stroke-width='3' /><path fill='none' stroke='currentColor' d=' M 640 352 L 654 352' stroke-linecap='round' stroke-width='3' /><path fill='none' stroke='currentColor' d=' M 706 368 L 720 368' stroke-linecap='round' stroke-width='3' /><path fill='none' stroke='currentColor' d=' M 654 400 L 654 336 L 706 368 Z' stroke-linecap='round' stroke-width='3' /><g><text fill='currentColor' stroke='currentColor' font-family='sans-serif' font-size='14px' font-style='normal' font-weight='normal' text-decoration='normal' x='664' y='382' text-anchor='middle' dominant-baseline='central'>-<\/text><\/g><g><text fill='currentColor' stroke='currentColor' font-family='sans-serif' font-size='14px' font-style='normal' font-weight='normal' text-decoration='normal' x='664' y='352' text-anchor='middle' dominant-baseline='central'>+<\/text><\/g><\/g><\/svg>", 'OpAmpSwapElm']);
|
|
$add_2(this, $createButtonSet(this, opAmpInfo));
|
|
transistorInfo = stampJavaTypeInfo(getClassLiteralForArray(Ljava_lang_String_2_classLit, 1), $intern_23, 2, 6, ["<svg><defs /><g transform='translate(-107.73,-90.40) scale(0.533333)'><path fill='none' stroke='currentColor' d=' M 240 176 L 227 186' stroke-linecap='round' stroke-width='3' /><path fill='none' stroke='currentColor' d=' M 240 208 L 227 198' stroke-linecap='round' stroke-width='3' /><path fill='currentColor' stroke='currentColor' d=' M 240 208 L 236 200 L 231 206 Z' /><path fill='none' stroke='currentColor' d=' M 208 192 L 224 192' stroke-linecap='round' stroke-width='3' /><path fill='currentColor' stroke='currentColor' d=' M 224 176 L 227 176 L 227 208 L 224 208 Z' /><path fill='currentColor' stroke='currentColor' d=' M 211 192 A 3 3 0 1 1 210.99973922528991 191.96044522459943 Z' /><path fill='currentColor' stroke='currentColor' d=' M 243 176 A 3 3 0 1 1 242.99973922528991 175.96044522459943 Z' /><path fill='currentColor' stroke='currentColor' d=' M 243 208 A 3 3 0 1 1 242.99973922528991 207.96044522459943 Z' /><\/g><\/svg>", 'NTransistorElm', "<svg><defs /><g transform='translate(-116.27,-90.40) scale(0.533333)'><path fill='none' stroke='currentColor' d=' M 256 208 L 243 198' stroke-linecap='round' stroke-width='3' /><path fill='none' stroke='currentColor' d=' M 256 176 L 243 186' stroke-linecap='round' stroke-width='3' /><path fill='currentColor' stroke='currentColor' d=' M 245 187 L 253 184 L 248 178 Z' /><path fill='none' stroke='currentColor' d=' M 224 192 L 240 192' stroke-linecap='round' stroke-width='3' /><path fill='currentColor' stroke='currentColor' d=' M 240 176 L 243 176 L 243 208 L 240 208 Z' /><path fill='currentColor' stroke='currentColor' d=' M 227 192 A 3 3 0 1 1 226.99973922528991 191.96044522459943 Z' /><path fill='currentColor' stroke='currentColor' d=' M 259 208 A 3 3 0 1 1 258.99973922528994 207.96044522459943 Z' /><path fill='currentColor' stroke='currentColor' d=' M 259 176 A 3 3 0 1 1 258.99973922528994 175.96044522459943 Z' /><\/g><\/svg>", 'PTransistorElm']);
|
|
$add_2(this, $createButtonSet(this, transistorInfo));
|
|
fetInfo = stampJavaTypeInfo(getClassLiteralForArray(Ljava_lang_String_2_classLit, 1), $intern_23, 2, 6, ["<svg><defs /><g transform='translate(-68.92,-50.27) scale(0.324324)'><path fill='none' stroke='currentColor' d=' M 272 208 L 250 208' stroke-linecap='round' stroke-width='3' /><path fill='none' stroke='currentColor' d=' M 272 176 L 250 176' stroke-linecap='round' stroke-width='3' /><path fill='none' stroke='currentColor' d=' M 250 208 L 250 203' stroke-linecap='round' stroke-width='3' /><path fill='none' stroke='currentColor' d=' M 250 197 L 250 192' stroke-linecap='round' stroke-width='3' /><path fill='none' stroke='currentColor' d=' M 250 192 L 250 187' stroke-linecap='round' stroke-width='3' /><path fill='none' stroke='currentColor' d=' M 250 181 L 250 176' stroke-linecap='round' stroke-width='3' /><path fill='none' stroke='currentColor' d=' M 250 208 L 250 213' stroke-linecap='round' stroke-width='3' /><path fill='none' stroke='currentColor' d=' M 250 176 L 250 171' stroke-linecap='round' stroke-width='3' /><path fill='none' stroke='currentColor' d=' M 272 208 L 272 192' stroke-linecap='round' stroke-width='3' /><path fill='none' stroke='currentColor' d=' M 272 192 L 250 192' stroke-linecap='round' stroke-width='3' /><path fill='currentColor' stroke='currentColor' d=' M 250 192 L 262 197 L 262 187 Z' /><path fill='none' stroke='currentColor' d=' M 224 192 L 244 192' stroke-linecap='round' stroke-width='3' /><path fill='none' stroke='currentColor' d=' M 244 184 L 244 200' stroke-linecap='round' stroke-width='3' /><path fill='none' stroke='currentColor' d=' M 272 176 L 272 160' stroke-linecap='round' stroke-width='3' /><path fill='none' stroke='currentColor' d=' M 272 208 L 272 224' stroke-linecap='round' stroke-width='3' /><path fill='currentColor' stroke='currentColor' d=' M 227 192 A 3 3 0 1 1 226.99973922528991 191.96044522459943 Z' /><path fill='currentColor' stroke='currentColor' d=' M 275 160 A 3 3 0 1 1 274.99973922528994 159.96044522459943 Z' /><path fill='currentColor' stroke='currentColor' d=' M 275 224 A 3 3 0 1 1 274.99973922528994 223.96044522459943 Z' /><\/g><\/svg>", 'NMosfetElm', "<svg><defs /><g transform='translate(-68.92,-50.27) scale(0.324324)'><path fill='none' stroke='currentColor' d=' M 272 176 L 272 160' stroke-linecap='round' stroke-width='3' /><path fill='none' stroke='currentColor' d=' M 272 208 L 272 224' stroke-linecap='round' stroke-width='3' /><path fill='none' stroke='currentColor' d=' M 272 208 L 250 208' stroke-linecap='round' stroke-width='3' /><path fill='none' stroke='currentColor' d=' M 272 176 L 250 176' stroke-linecap='round' stroke-width='3' /><path fill='none' stroke='currentColor' d=' M 250 208 L 250 203' stroke-linecap='round' stroke-width='3' /><path fill='none' stroke='currentColor' d=' M 250 197 L 250 192' stroke-linecap='round' stroke-width='3' /><path fill='none' stroke='currentColor' d=' M 250 192 L 250 187' stroke-linecap='round' stroke-width='3' /><path fill='none' stroke='currentColor' d=' M 250 181 L 250 176' stroke-linecap='round' stroke-width='3' /><path fill='none' stroke='currentColor' d=' M 250 208 L 250 213' stroke-linecap='round' stroke-width='3' /><path fill='none' stroke='currentColor' d=' M 250 176 L 250 171' stroke-linecap='round' stroke-width='3' /><path fill='none' stroke='currentColor' d=' M 272 176 L 272 192' stroke-linecap='round' stroke-width='3' /><path fill='none' stroke='currentColor' d=' M 272 192 L 250 192' stroke-linecap='round' stroke-width='3' /><path fill='currentColor' stroke='currentColor' d=' M 272 192 L 260 187 L 260 197 Z' /><path fill='none' stroke='currentColor' d=' M 224 192 L 244 192' stroke-linecap='round' stroke-width='3' /><path fill='none' stroke='currentColor' d=' M 244 184 L 244 200' stroke-linecap='round' stroke-width='3' /><path fill='currentColor' stroke='currentColor' d=' M 275 160 A 3 3 0 1 1 274.99973922528994 159.96044522459943 Z' /><path fill='currentColor' stroke='currentColor' d=' M 275 224 A 3 3 0 1 1 274.99973922528994 223.96044522459943 Z' /><path fill='currentColor' stroke='currentColor' d=' M 227 192 A 3 3 0 1 1 226.99973922528991 191.96044522459943 Z' /><\/g><\/svg>", 'PMosfetElm']);
|
|
$add_2(this, $createButtonSet(this, fetInfo));
|
|
$add_2(this, (app = theApp , $createIconButton(this, "<svg><g transform='translate(-288.41,-166.76) scale(0.413793)'><path fill='none' stroke='currentColor' d=' M 704 432 L 712 432' stroke-linecap='round' stroke-width='3' /><path fill='none' stroke='currentColor' d=' M 746 432 L 752 432' stroke-linecap='round' stroke-width='3' /><path fill='none' stroke='currentColor' d=' M 712 416 L 712 448 L 739 432 Z' stroke-linecap='round' stroke-width='3' /><path fill='none' stroke='currentColor' d=' M 744.94 432 A 2.94 2.94 0 1 1 744.9399985300001 431.99706000049' stroke-linecap='round' stroke-width='3' /><\/g><\/svg>", $getLabelTextForClass_0(app.ui, 'InverterElm'), new MyCommand('main', 'InverterElm'))));
|
|
gateInfo = stampJavaTypeInfo(getClassLiteralForArray(Ljava_lang_String_2_classLit, 1), $intern_23, 2, 6, ["<svg><g transform='translate(-143.64,-130.55) scale(0.363636)'><path fill='none' stroke='currentColor' d=' M 400 400 L 414 400' stroke-linecap='round' stroke-width='3' /><path fill='none' stroke='currentColor' d=' M 400 384 L 414 384' stroke-linecap='round' stroke-width='3' /><path fill='none' stroke='currentColor' d=' M 442 392 L 456 392' stroke-linecap='round' stroke-width='3' /><path fill='none' stroke='currentColor' d=' M 414 378 L 428 378 A 14 14 0 0 1 428 406 L 414 406 Z' stroke-linecap='round' stroke-width='3' /><\/g><\/svg>", 'AndGateElm', "<svg><g transform='translate(-143.64,-142.18) scale(0.363636)'><path fill='none' stroke='currentColor' d=' M 400 432 L 414 432' stroke-linecap='round' stroke-width='3' /><path fill='none' stroke='currentColor' d=' M 400 416 L 414 416' stroke-linecap='round' stroke-width='3' /><path fill='none' stroke='currentColor' d=' M 450 424 L 456 424' stroke-linecap='round' stroke-width='3' /><path fill='none' stroke='currentColor' d=' M 414 410 L 428 410 A 14 14 0 0 1 428 438 L 414 438 Z' stroke-linecap='round' stroke-width='3' /><path fill='none' stroke='currentColor' d=' M 448.94 424 A 2.94 2.94 0 1 1 448.93999853000014 423.99706000049' stroke-linecap='round' stroke-width='3' /><\/g><\/svg>", 'NandGateElm', "<svg><g transform='translate(-143.64,-153.82) scale(0.363636)'><path fill='none' stroke='currentColor' d=' M 400 464 L 414 464' stroke-linecap='round' stroke-width='3' /><path fill='none' stroke='currentColor' d=' M 400 448 L 414 448' stroke-linecap='round' stroke-width='3' /><path fill='none' stroke='currentColor' d=' M 442 456 L 456 456' stroke-linecap='round' stroke-width='3' /><path fill='none' stroke='currentColor' d=' M 413 442 L 422 442 C 434 445 434 445 442 456 C 434 467 434 467 422 470 L 413 470 C 416 456 416 456 413 442 Z' stroke-linecap='round' stroke-width='3' /><\/g><\/svg>", 'OrGateElm', "<svg><g transform='translate(-143.64,-165.45) scale(0.363636)'><path fill='none' stroke='currentColor' d=' M 400 496 L 414 496' stroke-linecap='round' stroke-width='3' /><path fill='none' stroke='currentColor' d=' M 400 480 L 414 480' stroke-linecap='round' stroke-width='3' /><path fill='none' stroke='currentColor' d=' M 450 488 L 456 488' stroke-linecap='round' stroke-width='3' /><path fill='none' stroke='currentColor' d=' M 413 474 L 422 474 C 434 477 434 477 442 488 C 434 499 434 499 422 502 L 413 502 C 416 488 416 488 413 474 Z' stroke-linecap='round' stroke-width='3' /><path fill='none' stroke='currentColor' d=' M 448.94 488 A 2.94 2.94 0 1 1 448.93999853000014 487.99706000049' stroke-linecap='round' stroke-width='3' /><\/g><\/svg>", 'NorGateElm', "<svg><g transform='translate(-143.64,-180.00) scale(0.363636)'><path fill='none' stroke='currentColor' d=' M 400 536 L 414 536' stroke-linecap='round' stroke-width='3' /><path fill='none' stroke='currentColor' d=' M 400 520 L 414 520' stroke-linecap='round' stroke-width='3' /><path fill='none' stroke='currentColor' d=' M 442 528 L 456 528' stroke-linecap='round' stroke-width='3' /><path fill='none' stroke='currentColor' d=' M 413 514 L 422 514 C 434 517 434 517 442 528 C 434 539 434 539 422 542 L 413 542 C 416 528 416 528 413 514 Z M 408 514 C 411 528 411 528 408 542' stroke-linecap='round' stroke-width='3' /><\/g><\/svg>", 'XorGateElm']);
|
|
$add_2(this, $createButtonSet(this, gateInfo));
|
|
this.modeLabel = new Label_1('');
|
|
$styleModeLabel(this.modeLabel);
|
|
$add_2(this, this.modeLabel);
|
|
}
|
|
|
|
function lambda$0(iconLabel_0){
|
|
($clinit_DOM() , iconLabel_0.element).style['color'] = '#007bff';
|
|
}
|
|
|
|
function lambda$1_1(iconLabel_0){
|
|
($clinit_DOM() , iconLabel_0.element).style['color'] = '#333';
|
|
}
|
|
|
|
function lambda$10(paletteContainer_0, iconLabel_1){
|
|
var leftOffset, topOffset;
|
|
setVisible(($clinit_DOM() , paletteContainer_0.element), true);
|
|
leftOffset = $getAbsoluteLeft_0(iconLabel_1.element) - 12;
|
|
topOffset = ($getBoundingClientRectTop(iconLabel_1.element) + $wnd.pageYOffset | 0) + $getPropertyInt(iconLabel_1.element, 'offsetHeight') - 2;
|
|
paletteContainer_0.element.style['left'] = leftOffset + ($clinit_Style$Unit() , 'px');
|
|
paletteContainer_0.element.style['top'] = topOffset + 'px';
|
|
}
|
|
|
|
function lambda$2_0(command_0, mde_1){
|
|
$eventGetButton(mde_1.nativeEvent) == 1 && $beginToolbarDrag(theUI.mouse, command_0.itemName, (mde_1.nativeEvent.clientX || 0) | 0, (mde_1.nativeEvent.clientY || 0) | 0);
|
|
}
|
|
|
|
function lambda$6(selectVariant_0, command_1){
|
|
$lambda$5(selectVariant_0.$$outer_0, selectVariant_0.iconLabel_1, selectVariant_0.smallSvg_2, selectVariant_0.mainCommand_3, selectVariant_0.command_4, selectVariant_0.paletteContainer_5);
|
|
$menuPerformed(theApp.commands, command_1.menuName, command_1.itemName);
|
|
}
|
|
|
|
function lambda$7_0(selectVariant_0, command_1, mde_2){
|
|
if ($eventGetButton(mde_2.nativeEvent) == 1) {
|
|
$lambda$5(selectVariant_0.$$outer_0, selectVariant_0.iconLabel_1, selectVariant_0.smallSvg_2, selectVariant_0.mainCommand_3, selectVariant_0.command_4, selectVariant_0.paletteContainer_5);
|
|
$beginToolbarDrag(theUI.mouse, command_1.itemName, (mde_2.nativeEvent.clientX || 0) | 0, (mde_2.nativeEvent.clientY || 0) | 0);
|
|
}
|
|
}
|
|
|
|
defineClass(652, 219, $intern_54, Toolbar);
|
|
var Lcom_lushprojects_circuitjs1_client_Toolbar_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'Toolbar', 652);
|
|
function Toolbar$1(this$0, val$iconLabel, val$command){
|
|
this.this$01 = this$0;
|
|
this.val$iconLabel2 = val$iconLabel;
|
|
this.val$command3 = val$command;
|
|
}
|
|
|
|
defineClass(655, 1, $intern_56, Toolbar$1);
|
|
_.onClick = function onClick_55(event_0){
|
|
$getElement(this.val$iconLabel2).style['color'] = '#333';
|
|
if (this.val$iconLabel2 == this.this$01.activeButton) {
|
|
$execute_0(new MyCommand('main', 'Select'));
|
|
this.this$01.activeButton = null;
|
|
}
|
|
else
|
|
$execute_0(this.val$command3);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_Toolbar$1_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'Toolbar/1', 655);
|
|
function Toolbar$lambda$0$Type(iconLabel_0){
|
|
this.iconLabel_0 = iconLabel_0;
|
|
}
|
|
|
|
defineClass(653, 1, $intern_133, Toolbar$lambda$0$Type);
|
|
_.onMouseOver = function onMouseOver_2(arg0){
|
|
lambda$0(this.iconLabel_0);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_Toolbar$lambda$0$Type_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'Toolbar/lambda$0$Type', 653);
|
|
function Toolbar$lambda$1$Type(iconLabel_0){
|
|
this.iconLabel_0 = iconLabel_0;
|
|
}
|
|
|
|
defineClass(654, 1, $intern_116, Toolbar$lambda$1$Type);
|
|
_.onMouseOut = function onMouseOut_5(arg0){
|
|
lambda$1_1(this.iconLabel_0);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_Toolbar$lambda$1$Type_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'Toolbar/lambda$1$Type', 654);
|
|
function Toolbar$lambda$10$Type(paletteContainer_0, iconLabel_1){
|
|
this.paletteContainer_0 = paletteContainer_0;
|
|
this.iconLabel_1 = iconLabel_1;
|
|
}
|
|
|
|
defineClass(664, 1, $intern_133, Toolbar$lambda$10$Type);
|
|
_.onMouseOver = function onMouseOver_3(arg0){
|
|
lambda$10(this.paletteContainer_0, this.iconLabel_1);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_Toolbar$lambda$10$Type_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'Toolbar/lambda$10$Type', 664);
|
|
function Toolbar$lambda$11$Type(paletteContainer_0){
|
|
this.paletteContainer_0 = paletteContainer_0;
|
|
}
|
|
|
|
defineClass(665, 1, $intern_116, Toolbar$lambda$11$Type);
|
|
_.onMouseOut = function onMouseOut_6(arg0){
|
|
$setVisible(this.paletteContainer_0, false);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_Toolbar$lambda$11$Type_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'Toolbar/lambda$11$Type', 665);
|
|
function Toolbar$lambda$12$Type(paletteContainer_0){
|
|
this.paletteContainer_0 = paletteContainer_0;
|
|
}
|
|
|
|
defineClass(666, 1, $intern_133, Toolbar$lambda$12$Type);
|
|
_.onMouseOver = function onMouseOver_4(arg0){
|
|
$setVisible(this.paletteContainer_0, true);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_Toolbar$lambda$12$Type_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'Toolbar/lambda$12$Type', 666);
|
|
function Toolbar$lambda$13$Type(paletteContainer_0){
|
|
this.paletteContainer_0 = paletteContainer_0;
|
|
}
|
|
|
|
defineClass(667, 1, $intern_116, Toolbar$lambda$13$Type);
|
|
_.onMouseOut = function onMouseOut_7(arg0){
|
|
$setVisible(this.paletteContainer_0, false);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_Toolbar$lambda$13$Type_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'Toolbar/lambda$13$Type', 667);
|
|
function Toolbar$lambda$2$Type(command_0){
|
|
this.command_0 = command_0;
|
|
}
|
|
|
|
defineClass(656, 1, $intern_115, Toolbar$lambda$2$Type);
|
|
_.onMouseDown = function onMouseDown_5(arg0){
|
|
lambda$2_0(this.command_0, arg0);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_Toolbar$lambda$2$Type_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'Toolbar/lambda$2$Type', 656);
|
|
function Toolbar$lambda$3$Type($$outer_0, command_1){
|
|
this.$$outer_0 = $$outer_0;
|
|
this.command_1 = command_1;
|
|
}
|
|
|
|
defineClass(657, 1, $intern_133, Toolbar$lambda$3$Type);
|
|
_.onMouseOver = function onMouseOver_5(arg0){
|
|
$lambda$3(this.$$outer_0, this.command_1);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_Toolbar$lambda$3$Type_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'Toolbar/lambda$3$Type', 657);
|
|
function Toolbar$lambda$4$Type(){
|
|
}
|
|
|
|
defineClass(658, 1, $intern_116, Toolbar$lambda$4$Type);
|
|
_.onMouseOut = function onMouseOut_8(arg0){
|
|
$updateToolbar(theUI);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_Toolbar$lambda$4$Type_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'Toolbar/lambda$4$Type', 658);
|
|
function Toolbar$lambda$5$Type($$outer_0, iconLabel_1, smallSvg_2, mainCommand_3, command_4, paletteContainer_5){
|
|
this.$$outer_0 = $$outer_0;
|
|
this.iconLabel_1 = iconLabel_1;
|
|
this.smallSvg_2 = smallSvg_2;
|
|
this.mainCommand_3 = mainCommand_3;
|
|
this.command_4 = command_4;
|
|
this.paletteContainer_5 = paletteContainer_5;
|
|
}
|
|
|
|
defineClass(659, 1, {}, Toolbar$lambda$5$Type);
|
|
_.run = function run_15(){
|
|
$lambda$5(this.$$outer_0, this.iconLabel_1, this.smallSvg_2, this.mainCommand_3, this.command_4, this.paletteContainer_5);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_Toolbar$lambda$5$Type_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'Toolbar/lambda$5$Type', 659);
|
|
function Toolbar$lambda$6$Type(selectVariant_0, command_1){
|
|
this.selectVariant_0 = selectVariant_0;
|
|
this.command_1 = command_1;
|
|
}
|
|
|
|
defineClass(660, 1, $intern_56, Toolbar$lambda$6$Type);
|
|
_.onClick = function onClick_56(arg0){
|
|
lambda$6(this.selectVariant_0, this.command_1);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_Toolbar$lambda$6$Type_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'Toolbar/lambda$6$Type', 660);
|
|
function Toolbar$lambda$7$Type(selectVariant_0, command_1){
|
|
this.selectVariant_0 = selectVariant_0;
|
|
this.command_1 = command_1;
|
|
}
|
|
|
|
defineClass(661, 1, $intern_115, Toolbar$lambda$7$Type);
|
|
_.onMouseDown = function onMouseDown_6(arg0){
|
|
lambda$7_0(this.selectVariant_0, this.command_1, arg0);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_Toolbar$lambda$7$Type_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'Toolbar/lambda$7$Type', 661);
|
|
function Toolbar$lambda$8$Type($$outer_0, app_1, command_2){
|
|
this.$$outer_0 = $$outer_0;
|
|
this.app_1 = app_1;
|
|
this.command_2 = command_2;
|
|
}
|
|
|
|
defineClass(662, 1, $intern_133, Toolbar$lambda$8$Type);
|
|
_.onMouseOver = function onMouseOver_6(arg0){
|
|
$lambda$8(this.$$outer_0, this.app_1, this.command_2);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_Toolbar$lambda$8$Type_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'Toolbar/lambda$8$Type', 662);
|
|
function Toolbar$lambda$9$Type(){
|
|
}
|
|
|
|
defineClass(663, 1, $intern_116, Toolbar$lambda$9$Type);
|
|
_.onMouseOut = function onMouseOut_9(arg0){
|
|
$updateToolbar(theUI);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_Toolbar$lambda$9$Type_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'Toolbar/lambda$9$Type', 663);
|
|
function $reset_12(this$static){
|
|
if (sim_0.maxTimeStep == 0)
|
|
return;
|
|
this$static.lenSteps = round_int(this$static.delay / sim_0.maxTimeStep);
|
|
$clinit_System();
|
|
if (this$static.lenSteps > $intern_120)
|
|
this$static.voltageL = this$static.voltageR = null;
|
|
else {
|
|
this$static.voltageL = initUnidimensionalArray(D_classLit, $intern_76, 7, this$static.lenSteps, 15, 1);
|
|
this$static.voltageR = initUnidimensionalArray(D_classLit, $intern_76, 7, this$static.lenSteps, 15, 1);
|
|
}
|
|
this$static.ptr = 0;
|
|
$reset(this$static);
|
|
this$static.lastStepCount = 0;
|
|
}
|
|
|
|
function $setPoints_27(this$static){
|
|
var ds, p3, p4, p5, p6, p7, p8, sep;
|
|
$setPoints(this$static);
|
|
ds = this$static.dy == 0?sign_0(this$static.dx):-sign_0(this$static.dy);
|
|
p3 = $interpPoint_0(this$static.point1, this$static.point2, 0, -this$static.width_0 * ds);
|
|
p4 = $interpPoint_0(this$static.point1, this$static.point2, 1, -this$static.width_0 * ds);
|
|
sep = app_0.gridSize / 2 | 0;
|
|
p5 = $interpPoint_0(this$static.point1, this$static.point2, 0, -((this$static.width_0 / 2 | 0) - sep) * ds);
|
|
p6 = $interpPoint_0(this$static.point1, this$static.point2, 1, -((this$static.width_0 / 2 | 0) - sep) * ds);
|
|
p7 = $interpPoint_0(this$static.point1, this$static.point2, 0, -((this$static.width_0 / 2 | 0) + sep) * ds);
|
|
p8 = $interpPoint_0(this$static.point1, this$static.point2, 1, -((this$static.width_0 / 2 | 0) + sep) * ds);
|
|
this$static.posts = stampJavaTypeInfo(getClassLiteralForArray(Lcom_lushprojects_circuitjs1_client_Point_2_classLit, 1), $intern_78, 14, 0, [p3, p4, this$static.point1, this$static.point2]);
|
|
this$static.inner = stampJavaTypeInfo(getClassLiteralForArray(Lcom_lushprojects_circuitjs1_client_Point_2_classLit, 1), $intern_78, 14, 0, [p7, p8, p5, p6]);
|
|
}
|
|
|
|
function TransLineElm(xx, yy){
|
|
CircuitElm.call(this, xx, yy);
|
|
this.delay = $intern_22 * sim_0.maxTimeStep;
|
|
this.imped = 75;
|
|
this.noDiagonal = true;
|
|
$reset_12(this);
|
|
}
|
|
|
|
function TransLineElm_0(xa, ya, xb, yb, f, st){
|
|
CircuitElm_0.call(this, xa, ya, xb, yb, f);
|
|
this.delay = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.imped = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.width_0 = (new Integer_0($nextToken(st))).value_0;
|
|
$nextToken(st);
|
|
this.noDiagonal = true;
|
|
$reset_12(this);
|
|
}
|
|
|
|
defineClass(405, 8, $intern_85, TransLineElm, TransLineElm_0);
|
|
_.canFlipX = function canFlipX_5(){
|
|
return this.dy == 0;
|
|
}
|
|
;
|
|
_.canFlipY = function canFlipY_6(){
|
|
return this.dx == 0;
|
|
}
|
|
;
|
|
_.doStep = function doStep_52(){
|
|
var nextPtr;
|
|
if (this.voltageL == null) {
|
|
$stop(sim_0, 'Transmission line delay too large!', this);
|
|
return;
|
|
}
|
|
nextPtr = (this.ptr + 1) % this.lenSteps;
|
|
$updateVoltageSource(this.voltSource1, -this.voltageR[nextPtr]);
|
|
$updateVoltageSource(this.voltSource2, -this.voltageL[nextPtr]);
|
|
if ($wnd.Math.abs(this.volts[0]) > 1.0E-5 || $wnd.Math.abs(this.volts[1]) > 1.0E-5) {
|
|
$stop(sim_0, 'Need to ground transmission line!', this);
|
|
return;
|
|
}
|
|
}
|
|
;
|
|
_.drag = function drag_6(xx, yy){
|
|
var w1, w2;
|
|
xx = $snapGrid_0(app_0, xx);
|
|
yy = $snapGrid_0(app_0, yy);
|
|
w1 = max_1(app_0.gridSize, abs_0(yy - this.y_0));
|
|
w2 = max_1(app_0.gridSize, abs_0(xx - this.x_0));
|
|
if (w1 > w2) {
|
|
xx = this.x_0;
|
|
this.width_0 = w2;
|
|
}
|
|
else {
|
|
yy = this.y_0;
|
|
this.width_0 = w1;
|
|
}
|
|
this.x2 = xx;
|
|
this.y2 = yy;
|
|
$setPoints_27(this);
|
|
}
|
|
;
|
|
_.draw = function draw_82(g){
|
|
var i, ix0, ix1, ix2, segf, segments, v;
|
|
$setBbox_0(this, this.posts[0], this.posts[3], 0);
|
|
segments = round_int(this.dn / 2);
|
|
ix0 = this.ptr - 1 + this.lenSteps;
|
|
segf = 1 / segments;
|
|
$setColor_0(g, ($clinit_Color() , darkGray));
|
|
$fillRect_0(g, this.inner[2].x_0, this.inner[2].y_0, this.inner[1].x_0 - this.inner[2].x_0 + 2, this.inner[1].y_0 - this.inner[2].y_0 + 2);
|
|
for (i = 0; i != 4; i++) {
|
|
$setVoltageColor(this, g, this.volts[i]);
|
|
drawThickLine_0(g, this.posts[i], this.inner[i], 3);
|
|
}
|
|
if (this.voltageL != null) {
|
|
for (i = 0; i != segments; i++) {
|
|
ix1 = (ix0 - (this.lenSteps * i / segments | 0)) % this.lenSteps;
|
|
ix2 = (ix0 - (this.lenSteps * (segments - 1 - i) / segments | 0)) % this.lenSteps;
|
|
v = (this.voltageL[ix1] + this.voltageR[ix2]) / 2;
|
|
$setColor_0(g, $getVoltageColor(this, v));
|
|
$interpPoint_1(this.inner[0], this.inner[1], ps1, i * segf);
|
|
$interpPoint_1(this.inner[2], this.inner[3], ps2, i * segf);
|
|
$drawLine(g, ps1.x_0, ps1.y_0, ps2.x_0, ps2.y_0);
|
|
$interpPoint_1(this.inner[2], this.inner[3], ps1, (i + 1) * segf);
|
|
drawThickLine_0(g, ps1, ps2, 3);
|
|
}
|
|
}
|
|
$setVoltageColor(this, g, this.volts[0]);
|
|
drawThickLine_0(g, this.inner[0], this.inner[1], 3);
|
|
$drawPosts(this, g);
|
|
this.curCount1 = $updateDotCount(-this.current1, this.curCount1);
|
|
this.curCount2 = $updateDotCount(this.current2, this.curCount2);
|
|
if (app_0.mouse.dragElm != this) {
|
|
$drawDots(g, this.posts[0], this.inner[0], this.curCount1);
|
|
$drawDots(g, this.posts[2], this.inner[2], -this.curCount1);
|
|
$drawDots(g, this.posts[1], this.inner[1], -this.curCount2);
|
|
$drawDots(g, this.posts[3], this.inner[3], this.curCount2);
|
|
}
|
|
}
|
|
;
|
|
_.dumpXml = function dumpXml_87(doc, elem){
|
|
dumpAttr_1(elem, 'x', this.x_0 + ' ' + this.y_0 + ' ' + this.x2 + ' ' + this.y2);
|
|
dumpAttr_0(elem, 'f', this.flags);
|
|
dumpAttr(elem, 'de', this.delay);
|
|
dumpAttr(elem, 'im', this.imped);
|
|
dumpAttr_0(elem, 'wi', this.width_0);
|
|
}
|
|
;
|
|
_.getConnection = function getConnection_39(n1, n2){
|
|
return false;
|
|
}
|
|
;
|
|
_.getCurrentIntoNode = function getCurrentIntoNode_33(n){
|
|
if (n == 0)
|
|
return this.current1;
|
|
if (n == 2)
|
|
return -this.current1;
|
|
if (n == 3)
|
|
return -this.current2;
|
|
return this.current2;
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_111(){
|
|
return 171;
|
|
}
|
|
;
|
|
_.getEditInfo = function getEditInfo_76(n){
|
|
if (n == 0)
|
|
return $setPositive(new EditInfo_0('Delay (s)', this.delay, 0, 0));
|
|
if (n == 1)
|
|
return $setPositive(new EditInfo_0('Impedance (ohms)', this.imped, 0, 0));
|
|
return null;
|
|
}
|
|
;
|
|
_.getInfo_0 = function getInfo_86(arr){
|
|
arr[0] = 'transmission line';
|
|
arr[1] = getUnitText(this.imped, ohmString, false);
|
|
arr[2] = 'length = ' + getUnitText(194863500 * this.delay, 'm', false);
|
|
arr[3] = 'delay = ' + getUnitText(this.delay, 's', false);
|
|
}
|
|
;
|
|
_.getInternalNodeCount = function getInternalNodeCount_15(){
|
|
return 2;
|
|
}
|
|
;
|
|
_.getMatrixConnection = function getMatrixConnection_13(n1, n2){
|
|
return n1 % 2 == n2 % 2;
|
|
}
|
|
;
|
|
_.getPost = function getPost_26(n){
|
|
return this.posts[n];
|
|
}
|
|
;
|
|
_.getPostCount_0 = function getPostCount_78(){
|
|
return 4;
|
|
}
|
|
;
|
|
_.getVoltageSourceCount = function getVoltageSourceCount_55(){
|
|
return 2;
|
|
}
|
|
;
|
|
_.getXmlDumpType = function getXmlDumpType_27(){
|
|
return 'tl';
|
|
}
|
|
;
|
|
_.hasGroundConnection = function hasGroundConnection_21(n1){
|
|
return false;
|
|
}
|
|
;
|
|
_.reset_0 = function reset_53(){
|
|
$reset_12(this);
|
|
}
|
|
;
|
|
_.setCurrent = function setCurrent_11(vs, c){
|
|
vs == this.voltSource1?(this.current1 = c):(this.current2 = c);
|
|
}
|
|
;
|
|
_.setEditValue = function setEditValue_76(n, ei){
|
|
if (n == 0 && ei.value_0 > 0) {
|
|
this.delay = ei.value_0;
|
|
$reset_12(this);
|
|
}
|
|
if (n == 1 && ei.value_0 > 0) {
|
|
this.imped = ei.value_0;
|
|
$reset_12(this);
|
|
}
|
|
}
|
|
;
|
|
_.setPoints = function setPoints_73(){
|
|
$setPoints_27(this);
|
|
}
|
|
;
|
|
_.setVoltageSource = function setVoltageSource_17(n, v){
|
|
if (n == 0) {
|
|
this.voltSource1 = v;
|
|
$setNodes(v, this.nodes[4], this.nodes[0]);
|
|
}
|
|
else {
|
|
this.voltSource2 = v;
|
|
$setNodes(v, this.nodes[5], this.nodes[1]);
|
|
}
|
|
}
|
|
;
|
|
_.stamp = function stamp_67(){
|
|
$stampVoltageSource(this.nodes[4], this.nodes[0], this.voltSource1);
|
|
$stampVoltageSource(this.nodes[5], this.nodes[1], this.voltSource2);
|
|
$stampResistor(this.nodes[2], this.nodes[4], this.imped);
|
|
$stampResistor(this.nodes[3], this.nodes[5], this.imped);
|
|
}
|
|
;
|
|
_.startIteration = function startIteration_24(){
|
|
if (this.voltageL == null) {
|
|
$stop(sim_0, 'Transmission line delay too large!', this);
|
|
return;
|
|
}
|
|
this.voltageL[this.ptr] = this.volts[2] - this.volts[0] + this.volts[2] - this.volts[4];
|
|
this.voltageR[this.ptr] = this.volts[3] - this.volts[1] + this.volts[3] - this.volts[5];
|
|
}
|
|
;
|
|
_.stepFinished = function stepFinished_25(){
|
|
if (sim_0.timeStepCount == this.lastStepCount)
|
|
return;
|
|
this.lastStepCount = sim_0.timeStepCount;
|
|
this.ptr = (this.ptr + 1) % this.lenSteps;
|
|
}
|
|
;
|
|
_.undumpXml = function undumpXml_90(xml){
|
|
this.flags = $parseIntAttr(xml, 'f', this.flags);
|
|
this.delay = $parseDoubleAttr(xml, 'de', this.delay);
|
|
this.imped = $parseDoubleAttr(xml, 'im', this.imped);
|
|
this.width_0 = $parseIntAttr(xml, 'wi', this.width_0);
|
|
$reset_12(this);
|
|
}
|
|
;
|
|
_.curCount1 = 0;
|
|
_.curCount2 = 0;
|
|
_.current1 = 0;
|
|
_.current2 = 0;
|
|
_.delay = 0;
|
|
_.imped = 0;
|
|
_.lastStepCount = 0;
|
|
_.lenSteps = 0;
|
|
_.ptr = 0;
|
|
_.width_0 = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_TransLineElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'TransLineElm', 405);
|
|
function $calcEffectiveInductance_0(l0, i, isat){
|
|
var ratio;
|
|
if (isat <= 0)
|
|
return l0;
|
|
ratio = i / isat;
|
|
return l0 / (1 + ratio * ratio);
|
|
}
|
|
|
|
function $computeCoefficients(this$static, l1, l2, m){
|
|
var deti, ts;
|
|
deti = 1 / (l1 * l2 - m * m);
|
|
ts = (this$static.flags & 2) == 0?sim_0.timeStep / 2:sim_0.timeStep;
|
|
this$static.a1 = l2 * deti * ts;
|
|
this$static.a2 = -m * deti * ts;
|
|
this$static.a3 = -m * deti * ts;
|
|
this$static.a4 = l1 * deti * ts;
|
|
}
|
|
|
|
function $setPoints_28(this$static){
|
|
var cd, ce, dotp, i, vsign, x_0;
|
|
$setPoints(this$static);
|
|
(this$static.flags & 8) != 0?(this$static.point2.x_0 = this$static.point1.x_0):(this$static.point2.y_0 = this$static.point1.y_0);
|
|
this$static.ptEnds = $newPointArray(4);
|
|
this$static.ptCoil = $newPointArray(4);
|
|
this$static.ptCore = $newPointArray(4);
|
|
this$static.ptEnds[0] = this$static.point1;
|
|
this$static.ptEnds[1] = this$static.point2;
|
|
this$static.flip = (this$static.flags & 16) != 0?-1:1;
|
|
$interpPoint_2(this$static.point1, this$static.point2, this$static.ptEnds[2], 0, -this$static.dsign * this$static.width_0 * this$static.flip);
|
|
$interpPoint_2(this$static.point1, this$static.point2, this$static.ptEnds[3], 1, -this$static.dsign * this$static.width_0 * this$static.flip);
|
|
ce = 0.5 - 12 / this$static.dn;
|
|
cd = 0.5 - 2 / this$static.dn;
|
|
for (i = 0; i != 4; i += 2) {
|
|
$interpPoint_1(this$static.ptEnds[i], this$static.ptEnds[i + 1], this$static.ptCoil[i], ce);
|
|
$interpPoint_1(this$static.ptEnds[i], this$static.ptEnds[i + 1], this$static.ptCoil[i + 1], 1 - ce);
|
|
$interpPoint_1(this$static.ptEnds[i], this$static.ptEnds[i + 1], this$static.ptCore[i], cd);
|
|
$interpPoint_1(this$static.ptEnds[i], this$static.ptEnds[i + 1], this$static.ptCore[i + 1], 1 - cd);
|
|
}
|
|
if (this$static.polarity == -1) {
|
|
vsign = (this$static.flags & 8) != 0?-1:1;
|
|
this$static.dots = initUnidimensionalArray(Lcom_lushprojects_circuitjs1_client_Point_2_classLit, $intern_78, 14, 2, 0, 1);
|
|
dotp = $wnd.Math.abs(7 / this$static.width_0);
|
|
this$static.dots[0] = $interpPoint_0(this$static.ptCoil[0], this$static.ptCoil[2], dotp, -7 * this$static.dsign * vsign * this$static.flip);
|
|
this$static.dots[1] = $interpPoint_0(this$static.ptCoil[3], this$static.ptCoil[1], dotp, -7 * this$static.dsign * vsign * this$static.flip);
|
|
x_0 = this$static.ptEnds[1];
|
|
this$static.ptEnds[1] = this$static.ptEnds[3];
|
|
this$static.ptEnds[3] = x_0;
|
|
x_0 = this$static.ptCoil[1];
|
|
this$static.ptCoil[1] = this$static.ptCoil[3];
|
|
this$static.ptCoil[3] = x_0;
|
|
}
|
|
else
|
|
this$static.dots = null;
|
|
}
|
|
|
|
function TransformerElm(xx, yy){
|
|
CircuitElm.call(this, xx, yy);
|
|
this.inductance = 4;
|
|
this.ratio = this.polarity = 1;
|
|
this.width_0 = 32;
|
|
this.noDiagonal = true;
|
|
this.couplingCoef = 0.999;
|
|
this.current = initUnidimensionalArray(D_classLit, $intern_76, 7, 2, 15, 1);
|
|
this.curcount = initUnidimensionalArray(D_classLit, $intern_76, 7, 2, 15, 1);
|
|
}
|
|
|
|
function TransformerElm_0(xa, ya, xb, yb, f, st){
|
|
CircuitElm_0.call(this, xa, ya, xb, yb, f);
|
|
(this.flags & 8) != 0?(this.width_0 = -(32 > (xb - xa < 0?-(xb - xa):xb - xa)?32:xb - xa < 0?-(xb - xa):xb - xa)):(this.width_0 = 32 > (yb - ya < 0?-(yb - ya):yb - ya)?32:yb - ya < 0?-(yb - ya):yb - ya);
|
|
this.inductance = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.ratio = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.current = initUnidimensionalArray(D_classLit, $intern_76, 7, 2, 15, 1);
|
|
this.curcount = initUnidimensionalArray(D_classLit, $intern_76, 7, 2, 15, 1);
|
|
this.current[0] = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.current[1] = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.couplingCoef = 0.999;
|
|
try {
|
|
this.couplingCoef = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.saturationCurrent = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
}
|
|
catch ($e0) {
|
|
$e0 = toJava($e0);
|
|
if (!instanceOf($e0, 13))
|
|
throw toJs($e0);
|
|
}
|
|
this.noDiagonal = true;
|
|
this.polarity = (this.flags & 4) != 0?-1:1;
|
|
}
|
|
|
|
defineClass(393, 8, $intern_85, TransformerElm, TransformerElm_0);
|
|
_.calculateCurrent = function calculateCurrent_38(){
|
|
var voltdiff1, voltdiff2;
|
|
voltdiff1 = this.volts[0] - this.volts[2];
|
|
voltdiff2 = this.volts[1] - this.volts[3];
|
|
this.current[0] = voltdiff1 * this.a1 + voltdiff2 * this.a2 + this.curSourceValue1;
|
|
this.current[1] = voltdiff1 * this.a3 + voltdiff2 * this.a4 + this.curSourceValue2;
|
|
}
|
|
;
|
|
_.doStep = function doStep_53(){
|
|
if (this.saturationCurrent > 0) {
|
|
$stampConductance(this.nodes[0], this.nodes[2], this.a1);
|
|
$stampVCCurrentSource(this.nodes[0], this.nodes[2], this.nodes[1], this.nodes[3], this.a2);
|
|
$stampVCCurrentSource(this.nodes[1], this.nodes[3], this.nodes[0], this.nodes[2], this.a3);
|
|
$stampConductance(this.nodes[1], this.nodes[3], this.a4);
|
|
}
|
|
$stampCurrentSource(this.nodes[0], this.nodes[2], this.curSourceValue1);
|
|
$stampCurrentSource(this.nodes[1], this.nodes[3], this.curSourceValue2);
|
|
}
|
|
;
|
|
_.drag = function drag_7(xx, yy){
|
|
xx = $snapGrid_0(app_0, xx);
|
|
yy = $snapGrid_0(app_0, yy);
|
|
abs_0(xx - this.x_0) > abs_0(yy - this.y_0)?(this.flags &= -9):(this.flags |= 8);
|
|
(this.flags & 8) != 0?(this.width_0 = -max_1(32, abs_0(xx - this.x_0))):(this.width_0 = max_1(32, abs_0(yy - this.y_0)));
|
|
xx == this.x_0 && (yy = this.y_0);
|
|
this.x2 = xx;
|
|
this.y2 = yy;
|
|
$setPoints_28(this);
|
|
}
|
|
;
|
|
_.draw = function draw_83(g){
|
|
var csign, i;
|
|
for (i = 0; i != 4; i++) {
|
|
$setVoltageColor(this, g, this.volts[i]);
|
|
drawThickLine_0(g, this.ptEnds[i], this.ptCoil[i], 3);
|
|
}
|
|
for (i = 0; i != 2; i++) {
|
|
$setPowerColor(this, g, this.current[i] * (this.volts[i] - this.volts[i + 2]));
|
|
csign = this.dsign * (i == 1?-6 * this.polarity:6) * this.flip;
|
|
(this.flags & 8) != 0 && (csign *= -1);
|
|
$drawCoil(this, g, csign, this.ptCoil[i], this.ptCoil[i + 2], this.volts[i], this.volts[i + 2]);
|
|
}
|
|
$setColor_0(g, mouseElmRef == this || this.selected_0 || $containsKey(app_0.mouse.scopePlotRoles, this) || instanceOf(mouseElmRef, 21) && $getElm_0(mouseElmRef.elmScope) == this || $isOnHighlightedNet(this)?selectColor_0:lightGrayColor);
|
|
for (i = 0; i != 2; i++) {
|
|
drawThickLine_0(g, this.ptCore[i], this.ptCore[i + 2], 3);
|
|
this.dots != null && $fillOval(g, this.dots[i].x_0 - 2, this.dots[i].y_0 - 2, 5);
|
|
this.curcount[i] = $updateDotCount(this.current[i], this.curcount[i]);
|
|
}
|
|
for (i = 0; i != 2; i++) {
|
|
$drawDots(g, this.ptEnds[i], this.ptCoil[i], this.curcount[i]);
|
|
$drawDots(g, this.ptCoil[i], this.ptCoil[i + 2], this.curcount[i]);
|
|
$drawDots(g, this.ptEnds[i + 2], this.ptCoil[i + 2], -this.curcount[i]);
|
|
}
|
|
$drawPosts(this, g);
|
|
$setBbox_0(this, this.ptEnds[0], this.ptEnds[this.polarity == 1?3:1], 0);
|
|
}
|
|
;
|
|
_.dumpXml = function dumpXml_88(doc, elem){
|
|
dumpAttr_1(elem, 'x', this.x_0 + ' ' + this.y_0 + ' ' + this.x2 + ' ' + this.y2);
|
|
dumpAttr_0(elem, 'f', this.flags);
|
|
dumpAttr(elem, 'in', this.inductance);
|
|
dumpAttr(elem, 'ra', this.ratio);
|
|
dumpAttr(elem, 'co', this.couplingCoef);
|
|
dumpAttr_0(elem, 'wi', this.width_0);
|
|
this.saturationCurrent != 0 && dumpAttr(elem, 'isat', this.saturationCurrent);
|
|
}
|
|
;
|
|
_.dumpXmlState = function dumpXmlState_16(doc, elem){
|
|
dumpAttr(elem, 'c0', this.current[0]);
|
|
dumpAttr(elem, 'c1', this.current[1]);
|
|
}
|
|
;
|
|
_.flipX = function flipX_18(c2, count){
|
|
(this.flags & 8) != 0 && (this.flags ^= 16);
|
|
$flipX(this, c2);
|
|
}
|
|
;
|
|
_.flipXY = function flipXY_15(xmy, count){
|
|
this.flags ^= 8;
|
|
this.width_0 *= -1;
|
|
$flipXY(this, xmy);
|
|
}
|
|
;
|
|
_.flipY = function flipY_18(c2, count){
|
|
(this.flags & 8) != 0 || (this.flags ^= 16);
|
|
$flipY(this, c2);
|
|
}
|
|
;
|
|
_.getConnection = function getConnection_40(n1, n2){
|
|
if (n1 == 0 && n2 == 2 || n1 == 2 && n2 == 0)
|
|
return true;
|
|
if (n1 == 1 && n2 == 3 || n1 == 3 && n2 == 1)
|
|
return true;
|
|
return false;
|
|
}
|
|
;
|
|
_.getCurrentIntoNode = function getCurrentIntoNode_34(n){
|
|
if (n < 2)
|
|
return -this.current[n];
|
|
return this.current[n - 2];
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_112(){
|
|
return 84;
|
|
}
|
|
;
|
|
_.getEditInfo = function getEditInfo_77(n){
|
|
var ei;
|
|
if (n == 0)
|
|
return $setPositive(new EditInfo_0('Primary Inductance (H)', this.inductance, $intern_34, 5));
|
|
if (n == 1)
|
|
return $setPositive($setDimensionless(new EditInfo_0('Ratio (N1/N2)', 1 / this.ratio, 1, 10)));
|
|
if (n == 2)
|
|
return $setPositive($setDimensionless(new EditInfo_0('Coupling Coefficient', this.couplingCoef, 0, 1)));
|
|
if (n == 3) {
|
|
ei = new EditInfo_0('', 0, -1, -1);
|
|
ei.checkbox = new Checkbox_0('Trapezoidal Approximation', (this.flags & 2) == 0);
|
|
return ei;
|
|
}
|
|
if (n == 4) {
|
|
ei = new EditInfo_0('', 0, -1, -1);
|
|
ei.checkbox = new Checkbox_0('Swap Secondary Polarity', this.polarity == -1);
|
|
return ei;
|
|
}
|
|
if (n == 5)
|
|
return new EditInfo('Saturation Current (A) (0=none)', this.saturationCurrent);
|
|
return null;
|
|
}
|
|
;
|
|
_.getInfo_0 = function getInfo_87(arr){
|
|
var l1Eff;
|
|
arr[0] = this.saturationCurrent > 0?'transformer (sat)':'transformer';
|
|
arr[1] = 'L = ' + getUnitText(this.inductance, 'H', false);
|
|
arr[2] = 'Ratio = 1:' + this.ratio;
|
|
arr[3] = 'Vd1 = ' + getUnitText(this.volts[0] - this.volts[2], 'V', false);
|
|
arr[4] = 'Vd2 = ' + getUnitText(this.volts[1] - this.volts[3], 'V', false);
|
|
arr[5] = 'I1 = ' + getUnitText(this.current[0], 'A', false);
|
|
arr[6] = 'I2 = ' + getUnitText(this.current[1], 'A', false);
|
|
if (this.saturationCurrent > 0) {
|
|
l1Eff = $calcEffectiveInductance_0(this.inductance, this.current[0], this.saturationCurrent);
|
|
arr[7] = 'L1eff = ' + getUnitText(l1Eff, 'H', false);
|
|
}
|
|
}
|
|
;
|
|
_.getMatrixConnection = function getMatrixConnection_14(n1, n2){
|
|
return true;
|
|
}
|
|
;
|
|
_.getPost = function getPost_27(n){
|
|
return this.ptEnds[n];
|
|
}
|
|
;
|
|
_.getPostCount_0 = function getPostCount_79(){
|
|
return 4;
|
|
}
|
|
;
|
|
_.getShortcut = function getShortcut_44(){
|
|
return 84;
|
|
}
|
|
;
|
|
_.nonLinear_0 = function nonLinear_27(){
|
|
return this.saturationCurrent > 0;
|
|
}
|
|
;
|
|
_.reset_0 = function reset_54(){
|
|
this.current[0] = this.current[1] = this.volts[0] = this.volts[1] = this.volts[2] = this.volts[3] = this.curcount[0] = this.curcount[1] = this.curSourceValue1 = this.curSourceValue2 = 0;
|
|
}
|
|
;
|
|
_.setEditValue = function setEditValue_77(n, ei){
|
|
n == 0 && ei.value_0 > 0 && (this.inductance = ei.value_0);
|
|
n == 1 && ei.value_0 > 0 && (this.ratio = 1 / ei.value_0);
|
|
n == 2 && (ei.value_0 > 0 && ei.value_0 < 1?(this.couplingCoef = ei.value_0):(ei.error = 'must be > 0 and < 1'));
|
|
n == 3 && ($getState(ei.checkbox)?(this.flags &= -3):(this.flags |= 2));
|
|
if (n == 4) {
|
|
this.polarity = $getState(ei.checkbox)?-1:1;
|
|
$getState(ei.checkbox)?(this.flags |= 4):(this.flags &= -5);
|
|
$setPoints_28(this);
|
|
}
|
|
n == 5 && (ei.value_0 >= 0?(this.saturationCurrent = ei.value_0):(ei.error = 'must be >= 0'));
|
|
}
|
|
;
|
|
_.setPoints = function setPoints_74(){
|
|
$setPoints_28(this);
|
|
}
|
|
;
|
|
_.stamp = function stamp_68(){
|
|
var l1, l2, m;
|
|
l1 = this.inductance;
|
|
l2 = this.inductance * this.ratio * this.ratio;
|
|
m = this.couplingCoef * $wnd.Math.sqrt(l1 * l2);
|
|
$computeCoefficients(this, l1, l2, m);
|
|
if (this.saturationCurrent > 0)
|
|
;
|
|
else {
|
|
$stampConductance(this.nodes[0], this.nodes[2], this.a1);
|
|
$stampVCCurrentSource(this.nodes[0], this.nodes[2], this.nodes[1], this.nodes[3], this.a2);
|
|
$stampVCCurrentSource(this.nodes[1], this.nodes[3], this.nodes[0], this.nodes[2], this.a3);
|
|
$stampConductance(this.nodes[1], this.nodes[3], this.a4);
|
|
}
|
|
}
|
|
;
|
|
_.startIteration = function startIteration_25(){
|
|
var l1, l2, m, voltdiff1, voltdiff2;
|
|
if (this.saturationCurrent > 0) {
|
|
l1 = $calcEffectiveInductance_0(this.inductance, this.current[0], this.saturationCurrent);
|
|
l2 = $calcEffectiveInductance_0(this.inductance * this.ratio * this.ratio, this.current[1], this.saturationCurrent * this.ratio);
|
|
m = this.couplingCoef * $wnd.Math.sqrt(l1 * l2);
|
|
$computeCoefficients(this, l1, l2, m);
|
|
}
|
|
voltdiff1 = this.volts[0] - this.volts[2];
|
|
voltdiff2 = this.volts[1] - this.volts[3];
|
|
if ((this.flags & 2) == 0) {
|
|
this.curSourceValue1 = voltdiff1 * this.a1 + voltdiff2 * this.a2 + this.current[0];
|
|
this.curSourceValue2 = voltdiff1 * this.a3 + voltdiff2 * this.a4 + this.current[1];
|
|
}
|
|
else {
|
|
this.curSourceValue1 = this.current[0];
|
|
this.curSourceValue2 = this.current[1];
|
|
}
|
|
}
|
|
;
|
|
_.undumpXml = function undumpXml_91(xml){
|
|
this.flags = $parseIntAttr(xml, 'f', this.flags);
|
|
(this.flags & 8) != 0?(this.width_0 = -max_1(32, abs_0(this.x2 - this.x_0))):(this.width_0 = max_1(32, abs_0(this.y2 - this.y_0)));
|
|
this.inductance = $parseDoubleAttr(xml, 'in', this.inductance);
|
|
this.ratio = $parseDoubleAttr(xml, 'ra', this.ratio);
|
|
this.couplingCoef = $parseDoubleAttr(xml, 'co', this.couplingCoef);
|
|
this.width_0 = $parseIntAttr(xml, 'wi', this.width_0);
|
|
this.saturationCurrent = $parseDoubleAttr(xml, 'isat', this.saturationCurrent);
|
|
this.current[0] = $parseDoubleAttr(xml, 'c0', 0);
|
|
this.current[1] = $parseDoubleAttr(xml, 'c1', 0);
|
|
this.polarity = (this.flags & 4) != 0?-1:1;
|
|
}
|
|
;
|
|
_.a1 = 0;
|
|
_.a2 = 0;
|
|
_.a3 = 0;
|
|
_.a4 = 0;
|
|
_.couplingCoef = 0;
|
|
_.curSourceValue1 = 0;
|
|
_.curSourceValue2 = 0;
|
|
_.flip = 0;
|
|
_.inductance = 0;
|
|
_.polarity = 0;
|
|
_.ratio = 0;
|
|
_.saturationCurrent = 0;
|
|
_.width_0 = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_TransformerElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'TransformerElm', 393);
|
|
function $$init_26(this$static){
|
|
}
|
|
|
|
function $dumpXml_13(this$static, doc){
|
|
var elem;
|
|
this$static.dumped = true;
|
|
elem = $createElement(doc, 'tm');
|
|
dumpAttr_1(elem, 'nm', this$static.name_0);
|
|
dumpAttr_0(elem, 'f', this$static.flags);
|
|
dumpAttr(elem, 'is', this$static.satCur);
|
|
dumpAttr(elem, 'ikf', this$static.invRollOffF);
|
|
dumpAttr(elem, 'ise', this$static.BEleakCur);
|
|
dumpAttr(elem, 'ne', this$static.leakBEemissionCoeff);
|
|
dumpAttr(elem, 'ikr', this$static.invRollOffR);
|
|
dumpAttr(elem, 'isc', this$static.BCleakCur);
|
|
dumpAttr(elem, 'nc', this$static.leakBCemissionCoeff);
|
|
dumpAttr(elem, 'nf', this$static.emissionCoeffF);
|
|
dumpAttr(elem, 'nr', this$static.emissionCoeffR);
|
|
dumpAttr(elem, 'vaf', this$static.invEarlyVoltF);
|
|
dumpAttr(elem, 'var', this$static.invEarlyVoltR);
|
|
dumpAttr(elem, 'br', this$static.betaR);
|
|
if (this$static.junctionCapBE != 0) {
|
|
dumpAttr(elem, 'cje', this$static.junctionCapBE);
|
|
dumpAttr(elem, 'vje', this$static.junctionPotBE);
|
|
dumpAttr(elem, 'mje', this$static.junctionExpBE);
|
|
}
|
|
if (this$static.junctionCapBC != 0) {
|
|
dumpAttr(elem, 'cjc', this$static.junctionCapBC);
|
|
dumpAttr(elem, 'vjc', this$static.junctionPotBC);
|
|
dumpAttr(elem, 'mjc', this$static.junctionExpBC);
|
|
}
|
|
this$static.transitTimeF != 0 && dumpAttr(elem, 'tf', this$static.transitTimeF);
|
|
this$static.transitTimeR != 0 && dumpAttr(elem, 'tr', this$static.transitTimeR);
|
|
$appendChild_0(build(getDocumentElement(doc.jsObject)), elem);
|
|
}
|
|
|
|
function $getDescription_1(this$static){
|
|
if (this$static.description == null || $equals_1(this$static.description, this$static.name_0))
|
|
return this$static.name_0;
|
|
return this$static.name_0 + ' (' + LS(this$static.description) + ')';
|
|
}
|
|
|
|
function $pickName_2(this$static){
|
|
var n, num;
|
|
this$static.name_0 = 'transistormodel';
|
|
if ($getStringValue(modelMap_3, this$static.name_0) != null) {
|
|
num = 2;
|
|
for (;; num++) {
|
|
n = this$static.name_0 + '-' + num;
|
|
if ($getStringValue(modelMap_3, n) == null) {
|
|
this$static.name_0 = n;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
$putStringValue(modelMap_3, this$static.name_0, this$static);
|
|
}
|
|
|
|
function $undump_3(this$static, st){
|
|
this$static.flags = (new Integer_0($nextToken(st))).value_0;
|
|
this$static.satCur = __parseAndValidateDouble($nextToken(st));
|
|
this$static.invRollOffF = __parseAndValidateDouble($nextToken(st));
|
|
this$static.BEleakCur = __parseAndValidateDouble($nextToken(st));
|
|
this$static.leakBEemissionCoeff = __parseAndValidateDouble($nextToken(st));
|
|
this$static.invRollOffR = __parseAndValidateDouble($nextToken(st));
|
|
this$static.BCleakCur = __parseAndValidateDouble($nextToken(st));
|
|
this$static.leakBCemissionCoeff = __parseAndValidateDouble($nextToken(st));
|
|
this$static.emissionCoeffF = __parseAndValidateDouble($nextToken(st));
|
|
this$static.emissionCoeffR = __parseAndValidateDouble($nextToken(st));
|
|
this$static.invEarlyVoltF = __parseAndValidateDouble($nextToken(st));
|
|
this$static.invEarlyVoltR = __parseAndValidateDouble($nextToken(st));
|
|
this$static.betaR = __parseAndValidateDouble($nextToken(st));
|
|
try {
|
|
this$static.junctionCapBE = __parseAndValidateDouble($nextToken(st));
|
|
this$static.junctionPotBE = __parseAndValidateDouble($nextToken(st));
|
|
this$static.junctionExpBE = __parseAndValidateDouble($nextToken(st));
|
|
this$static.junctionCapBC = __parseAndValidateDouble($nextToken(st));
|
|
this$static.junctionPotBC = __parseAndValidateDouble($nextToken(st));
|
|
this$static.junctionExpBC = __parseAndValidateDouble($nextToken(st));
|
|
}
|
|
catch ($e0) {
|
|
$e0 = toJava($e0);
|
|
if (!instanceOf($e0, 13))
|
|
throw toJs($e0);
|
|
}
|
|
try {
|
|
this$static.transitTimeF = __parseAndValidateDouble($nextToken(st));
|
|
this$static.transitTimeR = __parseAndValidateDouble($nextToken(st));
|
|
}
|
|
catch ($e1) {
|
|
$e1 = toJava($e1);
|
|
if (!instanceOf($e1, 13))
|
|
throw toJs($e1);
|
|
}
|
|
}
|
|
|
|
function TransistorModel(){
|
|
$$init_26(this);
|
|
}
|
|
|
|
function TransistorModel_0(copy){
|
|
$$init_26(this);
|
|
this.flags = copy.flags;
|
|
this.satCur = copy.satCur;
|
|
this.invRollOffF = copy.invRollOffF;
|
|
this.BEleakCur = copy.BEleakCur;
|
|
this.leakBEemissionCoeff = copy.leakBEemissionCoeff;
|
|
this.invRollOffR = copy.invRollOffR;
|
|
this.BCleakCur = copy.BCleakCur;
|
|
this.leakBCemissionCoeff = copy.leakBCemissionCoeff;
|
|
this.emissionCoeffF = copy.emissionCoeffF;
|
|
this.emissionCoeffR = copy.emissionCoeffR;
|
|
this.invEarlyVoltF = copy.invEarlyVoltF;
|
|
this.invEarlyVoltR = copy.invEarlyVoltR;
|
|
this.betaR = copy.betaR;
|
|
this.junctionCapBE = copy.junctionCapBE;
|
|
this.junctionPotBE = copy.junctionPotBE;
|
|
this.junctionExpBE = copy.junctionExpBE;
|
|
this.junctionCapBC = copy.junctionCapBC;
|
|
this.junctionPotBC = copy.junctionPotBC;
|
|
this.junctionExpBC = copy.junctionExpBC;
|
|
this.transitTimeF = copy.transitTimeF;
|
|
this.transitTimeR = copy.transitTimeR;
|
|
}
|
|
|
|
function TransistorModel_1(d, sc){
|
|
$$init_26(this);
|
|
this.description = d;
|
|
this.satCur = sc;
|
|
this.emissionCoeffF = this.emissionCoeffR = 1;
|
|
this.leakBEemissionCoeff = 1.5;
|
|
this.leakBCemissionCoeff = 2;
|
|
this.betaR = 1;
|
|
this.junctionCapBE = 0;
|
|
this.junctionCapBC = 0;
|
|
this.junctionPotBE = 0.75;
|
|
this.junctionPotBC = 0.75;
|
|
this.junctionExpBE = 0.33;
|
|
this.junctionExpBC = 0.33;
|
|
this.transitTimeF = 0;
|
|
this.transitTimeR = 0;
|
|
}
|
|
|
|
function addDefaultModel_2(name_0, dm){
|
|
$putStringValue(modelMap_3, name_0, dm);
|
|
dm.readOnly = dm.builtIn = true;
|
|
dm.name_0 = name_0;
|
|
}
|
|
|
|
function clearDumpedFlags_4(){
|
|
var it, pair;
|
|
if (!modelMap_3)
|
|
return;
|
|
it = new AbstractHashMap$EntrySetIterator((new AbstractHashMap$EntrySet(modelMap_3)).this$01);
|
|
while (it.hasNext) {
|
|
pair = $next_2(it);
|
|
pair.getValue().dumped = false;
|
|
}
|
|
}
|
|
|
|
function createModelMap_2(){
|
|
if (modelMap_3)
|
|
return;
|
|
modelMap_3 = new HashMap;
|
|
addDefaultModel_2('default', new TransistorModel_1('default', 1.0E-13));
|
|
addDefaultModel_2('spice-default', new TransistorModel_1('spice-default', 1.0E-16));
|
|
loadInternalModel_0('xlm324v2-qpi 0 1.01e-16 333.3333333333333 0 1.5 0 0 2 1 1 0.0034482758620689655 0 1');
|
|
loadInternalModel_0('xlm324v2-qpi 0 1.01e-16 333.3333333333333 0 1.5 0 0 2 1 1 0.0034482758620689655 0 1');
|
|
loadInternalModel_0('xlm324v2-qpa 0 1.01e-16 333.3333333333333 0 1.5 0 0 2 1 1 0.004081632653061225 0 1');
|
|
loadInternalModel_0('xlm324v2-qnq 0 1e-16 200 0 1.5 0 0 2 1 1 0 0 1');
|
|
loadInternalModel_0('xlm324v2-qpq 0 1e-16 333.3333333333333 0 1.5 0 0 2 1 1 0 0 1');
|
|
loadInternalModel_0('~tl431ed-qn_ed 0 1e-16 0 0 1.5 0 0 2 1 1 0.0125 0.02 1');
|
|
loadInternalModel_0('~tl431ed-qn_ed-A1.2 0 1.2e-16 0 0 1.5 0 0 2 1 1 0.0125 0.02 1');
|
|
loadInternalModel_0('~tl431ed-qn_ed-A2.2 0 2.2000000000000002e-16 0 0 1.5 0 0 2 1 1 0.0125 0.02 1');
|
|
loadInternalModel_0('~tl431ed-qn_ed-A0.5 0 5e-17 0 0 1.5 0 0 2 1 1 0.0125 0.02 1');
|
|
loadInternalModel_0('~tl431ed-qp_ed 0 1e-16 0 0 1.5 0 0 2 1 1 0.014285714285714285 0.025 1');
|
|
loadInternalModel_0('~tl431ed-qn_ed-A5 0 5e-16 0 0 1.5 0 0 2 1 1 0.0125 0.02 1');
|
|
loadInternalModel_0('~lm317-qpl-A0.1 0 1e-17 0 0 1.5 0 0 2 1 1 0.02 0 1');
|
|
loadInternalModel_0('~lm317-qnl-A0.2 0 2e-17 0 0 1.5 0 0 2 1 1 0.01 0 1');
|
|
loadInternalModel_0('~lm317-qpl-A0.2 0 2e-17 0 0 1.5 0 0 2 1 1 0.02 0 1');
|
|
loadInternalModel_0('~lm317-qnl-A2 0 2e-16 0 0 1.5 0 0 2 1 1 0.01 0 1');
|
|
loadInternalModel_0('~lm317-qpl-A2 0 2e-16 0 0 1.5 0 0 2 1 1 0.02 0 1');
|
|
loadInternalModel_0('~lm317-qnl-A5 0 5e-16 0 0 1.5 0 0 2 1 1 0.01 0 1');
|
|
loadInternalModel_0('~lm317-qnl-A50 0 5e-15 0 0 1.5 0 0 2 1 1 0.01 0 1');
|
|
}
|
|
|
|
function getModelList_3(){
|
|
var it, pair, tm, vector;
|
|
vector = new Vector;
|
|
it = new AbstractHashMap$EntrySetIterator((new AbstractHashMap$EntrySet(modelMap_3)).this$01);
|
|
while (it.hasNext) {
|
|
pair = $next_2(it);
|
|
tm = pair.getValue();
|
|
if (tm.internal)
|
|
continue;
|
|
$indexOf_3(vector.arrayList, tm, 0) != -1 || $add_8(vector.arrayList, tm);
|
|
}
|
|
$clinit_Collections();
|
|
$sort(vector.arrayList, null);
|
|
return vector;
|
|
}
|
|
|
|
function getModelWithName_4(name_0){
|
|
var lm;
|
|
createModelMap_2();
|
|
lm = $getStringValue(modelMap_3, name_0);
|
|
if (lm)
|
|
return lm;
|
|
lm = new TransistorModel;
|
|
lm.name_0 = name_0;
|
|
$putStringValue(modelMap_3, name_0, lm);
|
|
return lm;
|
|
}
|
|
|
|
function getModelWithNameOrCopy_3(name_0, oldmodel){
|
|
var lm;
|
|
createModelMap_2();
|
|
lm = $getStringValue(modelMap_3, name_0);
|
|
if (lm)
|
|
return lm;
|
|
if (!oldmodel) {
|
|
console.log('model not found: ' + name_0);
|
|
return getModelWithName_4('default');
|
|
}
|
|
lm = new TransistorModel_0(oldmodel);
|
|
lm.name_0 = name_0;
|
|
$putStringValue(modelMap_3, name_0, lm);
|
|
return lm;
|
|
}
|
|
|
|
function loadInternalModel_0(s){
|
|
var st, tm;
|
|
st = new StringTokenizer(s);
|
|
tm = undumpModel_1(st);
|
|
tm.builtIn = tm.internal = true;
|
|
}
|
|
|
|
function undumpModel_1(st){
|
|
var dm, name_0;
|
|
name_0 = unescape_0($nextToken(st));
|
|
dm = getModelWithName_4(name_0);
|
|
$undump_3(dm, st);
|
|
return dm;
|
|
}
|
|
|
|
function undumpModelXml_3(xml){
|
|
var name_0, tm;
|
|
name_0 = $parseStringAttr(xml, 'nm', null);
|
|
tm = getModelWithName_4(name_0);
|
|
tm.flags = $parseIntAttr(xml, 'f', tm.flags);
|
|
tm.satCur = $parseDoubleAttr(xml, 'is', tm.satCur);
|
|
tm.invRollOffF = $parseDoubleAttr(xml, 'ikf', tm.invRollOffF);
|
|
tm.BEleakCur = $parseDoubleAttr(xml, 'ise', tm.BEleakCur);
|
|
tm.leakBEemissionCoeff = $parseDoubleAttr(xml, 'ne', tm.leakBEemissionCoeff);
|
|
tm.invRollOffR = $parseDoubleAttr(xml, 'ikr', tm.invRollOffR);
|
|
tm.BCleakCur = $parseDoubleAttr(xml, 'isc', tm.BCleakCur);
|
|
tm.leakBCemissionCoeff = $parseDoubleAttr(xml, 'nc', tm.leakBCemissionCoeff);
|
|
tm.emissionCoeffF = $parseDoubleAttr(xml, 'nf', tm.emissionCoeffF);
|
|
tm.emissionCoeffR = $parseDoubleAttr(xml, 'nr', tm.emissionCoeffR);
|
|
tm.invEarlyVoltF = $parseDoubleAttr(xml, 'vaf', tm.invEarlyVoltF);
|
|
tm.invEarlyVoltR = $parseDoubleAttr(xml, 'var', tm.invEarlyVoltR);
|
|
tm.betaR = $parseDoubleAttr(xml, 'br', tm.betaR);
|
|
tm.junctionCapBE = $parseDoubleAttr(xml, 'cje', tm.junctionCapBE);
|
|
tm.junctionPotBE = $parseDoubleAttr(xml, 'vje', tm.junctionPotBE);
|
|
tm.junctionExpBE = $parseDoubleAttr(xml, 'mje', tm.junctionExpBE);
|
|
tm.junctionCapBC = $parseDoubleAttr(xml, 'cjc', tm.junctionCapBC);
|
|
tm.junctionPotBC = $parseDoubleAttr(xml, 'vjc', tm.junctionPotBC);
|
|
tm.junctionExpBC = $parseDoubleAttr(xml, 'mjc', tm.junctionExpBC);
|
|
tm.transitTimeF = $parseDoubleAttr(xml, 'tf', tm.transitTimeF);
|
|
tm.transitTimeR = $parseDoubleAttr(xml, 'tr', tm.transitTimeR);
|
|
return tm;
|
|
}
|
|
|
|
defineClass(221, 1, {10:1, 221:1, 16:1}, TransistorModel, TransistorModel_0, TransistorModel_1);
|
|
_.compareTo = function compareTo_4(dm){
|
|
return $compareTo(this.name_0, dm.name_0);
|
|
}
|
|
;
|
|
_.getDialogTitle = function getDialogTitle_5(){
|
|
return 'Edit Transistor Model';
|
|
}
|
|
;
|
|
_.getEditInfo = function getEditInfo_78(n){
|
|
var ei;
|
|
if (n == 0) {
|
|
ei = new EditInfo('Model Name', 0);
|
|
ei.text_0 = this.name_0 == null?'':this.name_0;
|
|
return ei;
|
|
}
|
|
if (n == 1)
|
|
return new EditInfo('Transport Saturation Current (IS)', this.satCur);
|
|
if (n == 2)
|
|
return new EditInfo('Reverse Beta (BR)', this.betaR);
|
|
if (n == 3)
|
|
return new EditInfo('Forward Early Voltage (VAF)', 1 / this.invEarlyVoltF);
|
|
if (n == 4)
|
|
return new EditInfo('Reverse Early Voltage (VAR)', 1 / this.invEarlyVoltR);
|
|
if (n == 5)
|
|
return new EditInfo('Corner For Forward Beta High Current Roll-Off (IKF)', 1 / this.invRollOffF);
|
|
if (n == 6)
|
|
return new EditInfo('Corner For Reverse Beta High Current Roll-Off (IKR)', 1 / this.invRollOffR);
|
|
if (n == 7)
|
|
return new EditInfo('Forward Current Emission Coefficient (NF)', this.emissionCoeffF);
|
|
if (n == 8)
|
|
return new EditInfo('Reverse Current Emission Coefficient (NR)', this.emissionCoeffR);
|
|
if (n == 9)
|
|
return new EditInfo('B-E Leakage Saturation Current (ISE)', this.BEleakCur);
|
|
if (n == 10)
|
|
return new EditInfo('B-E Leakage Emission Coefficient (NE)', this.leakBEemissionCoeff);
|
|
if (n == 11)
|
|
return new EditInfo('B-C Leakage Saturation Current (ISC)', this.BCleakCur);
|
|
if (n == 12)
|
|
return new EditInfo('B-C Leakage Emission Coefficient (NC)', this.leakBCemissionCoeff);
|
|
if (n == 13)
|
|
return new EditInfo('B-E Zero-Bias Junction Capacitance (CJE)', this.junctionCapBE);
|
|
if (n == 14)
|
|
return $setPositive(new EditInfo('B-E Junction Potential (VJE)', this.junctionPotBE));
|
|
if (n == 15)
|
|
return $setPositive(new EditInfo('B-E Junction Grading Coefficient (MJE)', this.junctionExpBE));
|
|
if (n == 16)
|
|
return new EditInfo('B-C Zero-Bias Junction Capacitance (CJC)', this.junctionCapBC);
|
|
if (n == 17)
|
|
return $setPositive(new EditInfo('B-C Junction Potential (VJC)', this.junctionPotBC));
|
|
if (n == 18)
|
|
return $setPositive(new EditInfo('B-C Junction Grading Coefficient (MJC)', this.junctionExpBC));
|
|
if (n == 19)
|
|
return new EditInfo('Forward Transit Time TF (s)', this.transitTimeF);
|
|
if (n == 20)
|
|
return new EditInfo('Reverse Transit Time TR (s)', this.transitTimeR);
|
|
return null;
|
|
}
|
|
;
|
|
_.setEditValue = function setEditValue_78(n, ei){
|
|
if (n == 0) {
|
|
this.name_0 = $getText(ei.textf);
|
|
this.name_0.length > 0 && $putStringValue(modelMap_3, this.name_0, this);
|
|
}
|
|
n == 1 && (this.satCur = ei.value_0);
|
|
n == 2 && (this.betaR = ei.value_0);
|
|
n == 3 && (this.invEarlyVoltF = 1 / ei.value_0);
|
|
n == 4 && (this.invEarlyVoltR = 1 / ei.value_0);
|
|
n == 5 && (this.invRollOffF = 1 / ei.value_0);
|
|
n == 6 && (this.invRollOffR = 1 / ei.value_0);
|
|
n == 7 && (this.emissionCoeffF = ei.value_0);
|
|
n == 8 && (this.emissionCoeffR = ei.value_0);
|
|
n == 9 && (this.BEleakCur = ei.value_0);
|
|
n == 10 && (this.leakBEemissionCoeff = ei.value_0);
|
|
n == 11 && (this.BCleakCur = ei.value_0);
|
|
n == 12 && (this.leakBCemissionCoeff = ei.value_0);
|
|
n == 13 && (this.junctionCapBE = ei.value_0);
|
|
n == 14 && (this.junctionPotBE = ei.value_0);
|
|
n == 15 && (this.junctionExpBE = ei.value_0);
|
|
n == 16 && (this.junctionCapBC = ei.value_0);
|
|
n == 17 && (this.junctionPotBC = ei.value_0);
|
|
n == 18 && (this.junctionExpBC = ei.value_0);
|
|
n == 19 && (ei.value_0 >= 0?(this.transitTimeF = ei.value_0):(ei.error = 'must be >= 0'));
|
|
n == 20 && (ei.value_0 >= 0?(this.transitTimeR = ei.value_0):(ei.error = 'must be >= 0'));
|
|
$updateModels(theApp);
|
|
}
|
|
;
|
|
_.BCleakCur = 0;
|
|
_.BEleakCur = 0;
|
|
_.betaR = 0;
|
|
_.builtIn = false;
|
|
_.dumped = false;
|
|
_.emissionCoeffF = 0;
|
|
_.emissionCoeffR = 0;
|
|
_.flags = 0;
|
|
_.internal = false;
|
|
_.invEarlyVoltF = 0;
|
|
_.invEarlyVoltR = 0;
|
|
_.invRollOffF = 0;
|
|
_.invRollOffR = 0;
|
|
_.junctionCapBC = 0;
|
|
_.junctionCapBE = 0;
|
|
_.junctionExpBC = 0.33;
|
|
_.junctionExpBE = 0.33;
|
|
_.junctionPotBC = 0.75;
|
|
_.junctionPotBE = 0.75;
|
|
_.leakBCemissionCoeff = 0;
|
|
_.leakBEemissionCoeff = 0;
|
|
_.readOnly = false;
|
|
_.satCur = 0;
|
|
_.transitTimeF = 0;
|
|
_.transitTimeR = 0;
|
|
var modelMap_3;
|
|
var Lcom_lushprojects_circuitjs1_client_TransistorModel_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'TransistorModel', 221);
|
|
function TriStateElm(xx, yy){
|
|
CircuitElm.call(this, xx, yy);
|
|
this.busWidth = 1;
|
|
this.r_on = 0.1;
|
|
this.r_off = $intern_94;
|
|
this.r_off_ground = $intern_97;
|
|
this.noDiagonal = true;
|
|
this.highVoltage = lastHighVoltage;
|
|
}
|
|
|
|
function TriStateElm_0(xa, ya, xb, yb, f, st){
|
|
CircuitElm_0.call(this, xa, ya, xb, yb, f);
|
|
this.busWidth = 1;
|
|
this.r_on = 0.1;
|
|
this.r_off = $intern_94;
|
|
this.r_off_ground = 0;
|
|
this.noDiagonal = true;
|
|
this.highVoltage = 5;
|
|
try {
|
|
this.r_on = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.r_off = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.r_off_ground = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.highVoltage = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
}
|
|
catch ($e0) {
|
|
$e0 = toJava($e0);
|
|
if (!instanceOf($e0, 13))
|
|
throw toJs($e0);
|
|
}
|
|
}
|
|
|
|
defineClass(389, 8, $intern_85, TriStateElm, TriStateElm_0);
|
|
_.calculateCurrent = function calculateCurrent_39(){
|
|
var current10, current31, i, intNode, outNode;
|
|
this.current_0 = 0;
|
|
for (i = 0; i < this.busWidth; i++) {
|
|
intNode = 2 * this.busWidth + 1 + i;
|
|
outNode = this.busWidth + i;
|
|
current31 = (this.volts[intNode] - this.volts[outNode]) / this.resistance;
|
|
current10 = this.r_off_ground == 0?0:this.volts[outNode] / this.r_off_ground;
|
|
this.current_0 += current31 - current10;
|
|
}
|
|
}
|
|
;
|
|
_.doStep = function doStep_54(){
|
|
var i, intNode, outNode;
|
|
this.open_0 = this.volts[2 * this.busWidth] < this.highVoltage * 0.5;
|
|
this.resistance = this.open_0?this.r_off:this.r_on;
|
|
for (i = 0; i < this.busWidth; i++) {
|
|
intNode = 2 * this.busWidth + 1 + i;
|
|
outNode = this.busWidth + i;
|
|
$stampResistor(this.nodes[intNode], this.nodes[outNode], this.resistance);
|
|
this.r_off_ground > 0 && $stampResistor(this.nodes[outNode], ground, this.r_off_ground);
|
|
$updateVoltageSource(this.voltageSources[i], this.volts[i] > this.highVoltage * 0.5?this.highVoltage:0);
|
|
}
|
|
}
|
|
;
|
|
_.drag = function drag_8(xx, yy){
|
|
var flip;
|
|
flip = xx < this.x_0 == yy < this.y_0;
|
|
xx = $snapGrid_0(app_0, xx);
|
|
yy = $snapGrid_0(app_0, yy);
|
|
if (abs_0(this.x_0 - xx) < abs_0(this.y_0 - yy))
|
|
xx = this.x_0;
|
|
else {
|
|
flip = !flip;
|
|
yy = this.y_0;
|
|
}
|
|
this.flags = flip?this.flags | 1:this.flags & -2;
|
|
$drag(this, xx, yy);
|
|
}
|
|
;
|
|
_.draw = function draw_84(g){
|
|
$setBbox_0(this, this.point1, this.point2, 16);
|
|
$setVoltageColor(this, g, this.volts[2 * this.busWidth]);
|
|
drawThickLine_0(g, this.point3, this.lead3, 3);
|
|
if (this.busWidth > 1) {
|
|
$setVoltageColor(this, g, this.volts[0]);
|
|
drawThickLine_0(g, this.point1, this.busLead1, 5);
|
|
$setVoltageColor(this, g, this.volts[this.busWidth]);
|
|
drawThickLine_0(g, this.lead2, this.point2, 5);
|
|
}
|
|
else {
|
|
$draw2Leads(this, g);
|
|
}
|
|
$setColor_0(g, lightGrayColor);
|
|
drawThickPolygon(g, this.gatePoly);
|
|
this.curcount_0 = $updateDotCount(this.current_0, this.curcount_0);
|
|
$drawDots(g, this.lead2, this.point2, this.curcount_0);
|
|
$drawPosts(this, g);
|
|
}
|
|
;
|
|
_.dumpXml = function dumpXml_89(doc, elem){
|
|
dumpAttr_1(elem, 'x', this.x_0 + ' ' + this.y_0 + ' ' + this.x2 + ' ' + this.y2);
|
|
dumpAttr_0(elem, 'f', this.flags);
|
|
dumpAttr(elem, 'ron', this.r_on);
|
|
dumpAttr(elem, 'roff', this.r_off);
|
|
dumpAttr(elem, 'rog', this.r_off_ground);
|
|
dumpAttr(elem, 'hi', this.highVoltage);
|
|
this.busWidth != 1 && dumpAttr_0(elem, 'bw', this.busWidth);
|
|
}
|
|
;
|
|
_.flipX = function flipX_19(c2, count){
|
|
this.flags ^= 3;
|
|
$flipX(this, c2);
|
|
}
|
|
;
|
|
_.flipXY = function flipXY_16(c2, count){
|
|
this.flags ^= 1;
|
|
$flipXY(this, c2);
|
|
}
|
|
;
|
|
_.flipY = function flipY_19(c2, count){
|
|
this.flags ^= 5;
|
|
$flipY(this, c2);
|
|
}
|
|
;
|
|
_.getConnection = function getConnection_41(n1, n2){
|
|
return false;
|
|
}
|
|
;
|
|
_.getCurrentIntoNode = function getCurrentIntoNode_35(n){
|
|
if (n >= this.busWidth && n < 2 * this.busWidth)
|
|
return this.current_0 / this.busWidth;
|
|
return 0;
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_113(){
|
|
return 180;
|
|
}
|
|
;
|
|
_.getEditInfo = function getEditInfo_79(n){
|
|
if (n == 0)
|
|
return $setPositive(new EditInfo_0('On Resistance (ohms)', this.r_on, 0, 0));
|
|
if (n == 1)
|
|
return $setPositive(new EditInfo_0('Off Resistance (ohms)', this.r_off, 0, 0));
|
|
if (n == 2)
|
|
return $setPositive(new EditInfo_0('Output Pulldown Resistance (ohms)', this.r_off_ground, 0, 0));
|
|
if (n == 3)
|
|
return $setUnitStep(new EditInfo_0('High Logic Voltage', this.highVoltage, 1, 10));
|
|
if (n == 4)
|
|
return $setDimensionless(new EditInfo_0('Bus Width', this.busWidth, 1, 32));
|
|
return null;
|
|
}
|
|
;
|
|
_.getInfo_0 = function getInfo_88(arr){
|
|
arr[0] = 'tri-state buffer';
|
|
this.busWidth > 1 && (arr[0] += ' (' + this.busWidth + ')');
|
|
arr[1] = this.open_0?'open':'closed';
|
|
arr[2] = 'Vd = ' + getUnitText($wnd.Math.abs(this.volts[0] - this.volts[1]), 'V', false);
|
|
arr[3] = 'I = ' + getUnitText($wnd.Math.abs(this.current_0), 'A', false);
|
|
arr[4] = 'Vc = ' + getUnitText(this.volts[2 * this.busWidth], 'V', false);
|
|
}
|
|
;
|
|
_.getInternalNodeCount = function getInternalNodeCount_16(){
|
|
return this.busWidth;
|
|
}
|
|
;
|
|
_.getMatrixConnection = function getMatrixConnection_15(n1, n2){
|
|
var i;
|
|
for (i = 0; i < this.busWidth; i++)
|
|
if ($comparePair(n1, n2, this.busWidth + i, 2 * this.busWidth + 1 + i))
|
|
return true;
|
|
return false;
|
|
}
|
|
;
|
|
_.getPost = function getPost_28(n){
|
|
if (n < this.busWidth)
|
|
return this.busWidth > 1?new Point_3(this.point1.x_0, this.point1.y_0, n):this.point1;
|
|
if (n < 2 * this.busWidth)
|
|
return this.busWidth > 1?new Point_3(this.point2.x_0, this.point2.y_0, n - this.busWidth):this.point2;
|
|
return this.point3;
|
|
}
|
|
;
|
|
_.getPostCount_0 = function getPostCount_80(){
|
|
return 2 * this.busWidth + 1;
|
|
}
|
|
;
|
|
_.getPostWidth = function getPostWidth_6(n){
|
|
if (n < 2 * this.busWidth)
|
|
return this.busWidth;
|
|
return 1;
|
|
}
|
|
;
|
|
_.getVoltageSourceCount = function getVoltageSourceCount_56(){
|
|
return this.busWidth;
|
|
}
|
|
;
|
|
_.getXmlDumpType = function getXmlDumpType_28(){
|
|
return 'ts';
|
|
}
|
|
;
|
|
_.hasGroundConnection = function hasGroundConnection_22(n1){
|
|
return n1 >= this.busWidth && n1 < 2 * this.busWidth;
|
|
}
|
|
;
|
|
_.nonLinear_0 = function nonLinear_28(){
|
|
return true;
|
|
}
|
|
;
|
|
_.setEditValue = function setEditValue_79(n, ei){
|
|
n == 0 && ei.value_0 > 0 && (this.r_on = ei.value_0);
|
|
n == 1 && ei.value_0 > 0 && (this.r_off = ei.value_0);
|
|
n == 2 && ei.value_0 > 0 && (this.r_off_ground = ei.value_0);
|
|
n == 3 && (this.highVoltage = lastHighVoltage = ei.value_0);
|
|
if (n == 4) {
|
|
if (ei.value_0 >= 1) {
|
|
this.busWidth = round_int(ei.value_0);
|
|
$allocNodes(this);
|
|
}
|
|
else
|
|
ei.error = 'must be >= 1';
|
|
}
|
|
}
|
|
;
|
|
_.setHighVoltage = function setHighVoltage_5(hv){
|
|
this.highVoltage = hv;
|
|
}
|
|
;
|
|
_.setPoints = function setPoints_75(){
|
|
var sign, triPoints, ww;
|
|
$setPoints(this);
|
|
$calcLeads(this, 32);
|
|
$adjustLeadsToGrid(this, (this.flags & 2) != 0, (this.flags & 4) != 0);
|
|
new Point_1;
|
|
ww = 16;
|
|
16 > this.dn / 2 && (ww = round_int(this.dn / 2));
|
|
triPoints = $newPointArray(3);
|
|
$interpPoint2(this.lead1, this.lead2, triPoints[0], triPoints[1], 0, 18);
|
|
triPoints[2] = $interpPoint(this.lead1, this.lead2, 0.5 + (ww - 2) / 32);
|
|
this.gatePoly = $createPolygon_1(triPoints);
|
|
this.busLead1 = $interpPoint(this.point1, this.lead1, 1 - 2 / this.dn);
|
|
sign = (this.flags & 1) == 0?-1:1;
|
|
this.point3 = $interpPoint_0(this.lead1, this.lead2, 0.5, sign * 16);
|
|
this.lead3 = $interpPoint_0(this.lead1, this.lead2, 0.5, sign * 10);
|
|
}
|
|
;
|
|
_.setVoltageSource = function setVoltageSource_18(n, v){
|
|
(this.voltageSources == null || this.voltageSources.length != this.busWidth) && (this.voltageSources = initUnidimensionalArray(Lcom_lushprojects_circuitjs1_client_VoltageSource_2_classLit, $intern_3, 136, this.busWidth, 0, 1));
|
|
this.voltageSources[n] = v;
|
|
$setNodes(v, ground, this.nodes[2 * this.busWidth + 1 + n]);
|
|
}
|
|
;
|
|
_.stamp = function stamp_69(){
|
|
var i;
|
|
for (i = 0; i < this.busWidth; i++) {
|
|
$stampVoltageSource(ground, this.nodes[2 * this.busWidth + 1 + i], this.voltageSources[i]);
|
|
}
|
|
}
|
|
;
|
|
_.undumpXml = function undumpXml_92(xml){
|
|
this.flags = $parseIntAttr(xml, 'f', this.flags);
|
|
this.r_on = $parseDoubleAttr(xml, 'ron', this.r_on);
|
|
this.r_off = $parseDoubleAttr(xml, 'roff', this.r_off);
|
|
this.r_off_ground = $parseDoubleAttr(xml, 'rog', this.r_off_ground);
|
|
this.highVoltage = $parseDoubleAttr(xml, 'hi', this.highVoltage);
|
|
this.busWidth = $parseIntAttr(xml, 'bw', 1);
|
|
}
|
|
;
|
|
_.busWidth = 0;
|
|
_.highVoltage = 0;
|
|
_.open_0 = false;
|
|
_.r_off = 0;
|
|
_.r_off_ground = 0;
|
|
_.r_on = 0;
|
|
_.resistance = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_TriStateElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'TriStateElm', 389);
|
|
function $setDefaults_0(this$static){
|
|
this$static.holdingI = 0.0082;
|
|
this$static.triggerI = $intern_34;
|
|
this$static.cresistance = 100;
|
|
}
|
|
|
|
function $setup_7(this$static){
|
|
this$static.diode03 = new Diode(sim_0);
|
|
$setup(this$static.diode03, getModelWithName_1('default'));
|
|
this$static.diode30 = new Diode(sim_0);
|
|
$setup(this$static.diode30, getModelWithName_1('default'));
|
|
}
|
|
|
|
function TriacElm(xx, yy){
|
|
CircuitElm.call(this, xx, yy);
|
|
$setDefaults_0(this);
|
|
$setup_7(this);
|
|
}
|
|
|
|
function TriacElm_0(xa, ya, xb, yb, f, st){
|
|
CircuitElm_0.call(this, xa, ya, xb, yb, f);
|
|
$setDefaults_0(this);
|
|
this.triggerI = __parseAndValidateDouble($nextToken(st));
|
|
this.holdingI = __parseAndValidateDouble($nextToken(st));
|
|
this.cresistance = __parseAndValidateDouble($nextToken(st));
|
|
this.state = ($clinit_Boolean() , $equalsIgnoreCase('true', $nextToken(st)));
|
|
$setup_7(this);
|
|
}
|
|
|
|
defineClass(423, 8, $intern_85, TriacElm, TriacElm_0);
|
|
_.calculateCurrent = function calculateCurrent_40(){
|
|
this.aresistance == 0?(this.i2 = 0):(this.i2 = (this.volts[3] - this.volts[1]) / this.aresistance);
|
|
this.ig = -(this.volts[1] - this.volts[2]) / this.cresistance;
|
|
this.i1 = -this.i2 - this.ig;
|
|
}
|
|
;
|
|
_.canViewInScope = function canViewInScope_6(){
|
|
return true;
|
|
}
|
|
;
|
|
_.doStep = function doStep_55(){
|
|
$doStep_0(this.diode03, this.volts[0] - this.volts[3]);
|
|
$doStep_0(this.diode30, this.volts[3] - this.volts[0]);
|
|
$stampResistor(this.nodes[3], this.nodes[1], this.aresistance);
|
|
}
|
|
;
|
|
_.draw = function draw_85(g){
|
|
var ds, v1, v2;
|
|
v1 = this.volts[0];
|
|
v2 = this.volts[1];
|
|
$setBbox_0(this, this.point1, this.point2, 6);
|
|
$adjustBbox_0(this, this.gate[0], this.gate[1]);
|
|
$draw2Leads(this, g);
|
|
$setColor_0(g, $getVoltageColor(this, v1));
|
|
$setPowerColor_0(this, g);
|
|
drawThickLine_0(g, this.plate1[0], this.plate1[1], 3);
|
|
$setColor_0(g, $getVoltageColor(this, v2));
|
|
$setPowerColor_0(this, g);
|
|
drawThickLine_0(g, this.plate2[0], this.plate2[1], 3);
|
|
$fillPolygon(g, this.arrows[0]);
|
|
$setColor_0(g, $getVoltageColor(this, v1));
|
|
$setPowerColor_0(this, g);
|
|
$fillPolygon(g, this.arrows[1]);
|
|
$setVoltageColor(this, g, this.volts[2]);
|
|
drawThickLine_0(g, this.lead2, this.gate[0], 3);
|
|
drawThickLine_0(g, this.gate[0], this.gate[1], 3);
|
|
this.curcount_1 = $updateDotCount(this.i1, this.curcount_1);
|
|
this.curcount_2 = $updateDotCount(this.i2, this.curcount_2);
|
|
this.curcount_g = $updateDotCount(this.ig, this.curcount_g);
|
|
if (app_0.mouse.dragElm != this) {
|
|
$drawDots(g, this.point1, this.lead2, this.curcount_2);
|
|
$drawDots(g, this.point2, this.lead2, this.curcount_1);
|
|
$drawDots(g, this.gate[1], this.gate[0], this.curcount_g);
|
|
$drawDots(g, this.gate[0], this.lead2, this.curcount_g + distance(this.gate[1], this.gate[0]));
|
|
}
|
|
if ((mouseElmRef == this || this.selected_0 || $containsKey(app_0.mouse.scopePlotRoles, this) || instanceOf(mouseElmRef, 21) && $getElm_0(mouseElmRef.elmScope) == this || $isOnHighlightedNet(this) || app_0.mouse.dragElm == this) && this.point1.x_0 == this.point2.x_0 && this.point2.y_0 > this.point1.y_0) {
|
|
$setColor_0(g, whiteColor);
|
|
ds = sign_0(this.dx);
|
|
$drawString(g, 'MT1', this.lead2.x_0 + (ds < 0?5:-30), this.lead2.y_0 + 12);
|
|
$drawString(g, 'MT2', this.lead1.x_0 + 5, this.lead1.y_0 - 4);
|
|
$drawString(g, 'G', this.gate[0].x_0, this.gate[0].y_0 + 12);
|
|
}
|
|
$drawPosts(this, g);
|
|
}
|
|
;
|
|
_.dumpXml = function dumpXml_90(doc, elem){
|
|
dumpAttr_1(elem, 'x', this.x_0 + ' ' + this.y_0 + ' ' + this.x2 + ' ' + this.y2);
|
|
dumpAttr_0(elem, 'f', this.flags);
|
|
dumpAttr(elem, 'ti', this.triggerI);
|
|
dumpAttr(elem, 'hi', this.holdingI);
|
|
dumpAttr(elem, 'cr', this.cresistance);
|
|
}
|
|
;
|
|
_.dumpXmlState = function dumpXmlState_17(doc, elem){
|
|
dumpAttr_2(elem, 'st', this.state);
|
|
}
|
|
;
|
|
_.getCurrent_0 = function getCurrent_2(){
|
|
return this.i2;
|
|
}
|
|
;
|
|
_.getCurrentIntoNode = function getCurrentIntoNode_36(n){
|
|
if (n == 0)
|
|
return -this.i2;
|
|
if (n == 1)
|
|
return -this.i1;
|
|
return -this.ig;
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_114(){
|
|
return 206;
|
|
}
|
|
;
|
|
_.getEditInfo = function getEditInfo_80(n){
|
|
if (n == 0)
|
|
return $setPositive(new EditInfo_0('Trigger Current (A)', this.triggerI, 0, 0));
|
|
if (n == 1)
|
|
return $setPositive(new EditInfo_0('Holding Current (A)', this.holdingI, 0, 0));
|
|
if (n == 2)
|
|
return $setPositive(new EditInfo_0('Gate-MT1 Resistance (ohms)', this.cresistance, 0, 0));
|
|
return null;
|
|
}
|
|
;
|
|
_.getInfo_0 = function getInfo_89(arr){
|
|
arr[0] = 'TRIAC';
|
|
arr[1] = this.state?'on':'off';
|
|
arr[2] = 'Vmt2mt1 = ' + getUnitText(this.volts[0] - this.volts[1], 'V', false);
|
|
arr[3] = 'Imt1 = ' + getUnitText(this.i1, 'A', false);
|
|
arr[4] = 'Imt2 = ' + getUnitText(this.i2, 'A', false);
|
|
arr[5] = 'Ig = ' + getUnitText(this.ig, 'A', false);
|
|
arr[6] = 'P = ' + getUnitText((this.volts[0] - this.volts[1]) * this.i2 + (this.volts[2] - this.volts[1]) * this.ig, 'W', false);
|
|
}
|
|
;
|
|
_.getInternalNodeCount = function getInternalNodeCount_17(){
|
|
return 1;
|
|
}
|
|
;
|
|
_.getPost = function getPost_29(n){
|
|
return n == 0?this.point1:n == 1?this.point2:this.gate[1];
|
|
}
|
|
;
|
|
_.getPostCount_0 = function getPostCount_81(){
|
|
return 3;
|
|
}
|
|
;
|
|
_.getPower = function getPower_13(){
|
|
return (this.volts[0] - this.volts[1]) * this.i2 + (this.volts[2] - this.volts[1]) * this.ig;
|
|
}
|
|
;
|
|
_.getVoltageDiff_0 = function getVoltageDiff_25(){
|
|
return this.volts[0] - this.volts[1];
|
|
}
|
|
;
|
|
_.nonLinear_0 = function nonLinear_29(){
|
|
return true;
|
|
}
|
|
;
|
|
_.reset_0 = function reset_55(){
|
|
this.volts[1] = this.volts[0] = this.volts[2] = 0;
|
|
this.diode03.lastvoltdiff = 0;
|
|
this.diode30.lastvoltdiff = 0;
|
|
this.curcount_1 = this.curcount_2 = this.curcount_g = 0;
|
|
}
|
|
;
|
|
_.setEditValue = function setEditValue_80(n, ei){
|
|
n == 0 && (this.triggerI = ei.value_0);
|
|
n == 1 && (this.holdingI = ei.value_0);
|
|
n == 2 && (this.cresistance = ei.value_0);
|
|
}
|
|
;
|
|
_.setPoints = function setPoints_76(){
|
|
var dir_0, gatelen, i, leadlen, p1, p2, p3, sgn;
|
|
$setPoints(this);
|
|
if (abs_0(this.dx) > abs_0(this.dy)) {
|
|
dir_0 = -sign_0(this.dx) * sign_0(this.dy);
|
|
this.dn = abs_0(this.dx);
|
|
this.point2.y_0 = this.point1.y_0;
|
|
}
|
|
else {
|
|
dir_0 = sign_0(this.dy) * sign_0(this.dx);
|
|
this.dn = abs_0(this.dy);
|
|
this.point2.x_0 = this.point1.x_0;
|
|
}
|
|
dir_0 == 0 && (dir_0 = 1);
|
|
$calcLeads(this, 16);
|
|
this.plate1 = $newPointArray(2);
|
|
this.plate2 = $newPointArray(2);
|
|
this.gate = $newPointArray(2);
|
|
$interpPoint2(this.lead1, this.lead2, this.plate1[0], this.plate1[1], 0, 16);
|
|
$interpPoint2(this.lead1, this.lead2, this.plate2[0], this.plate2[1], 1, 16);
|
|
this.arrows = initUnidimensionalArray(Lcom_lushprojects_circuitjs1_client_Polygon_2_classLit, $intern_3, 201, 2, 0, 1);
|
|
for (i = 0; i != 2; i++) {
|
|
sgn = -1 + i * 2;
|
|
p1 = $interpPoint_0(this.lead1, this.lead2, i, 8 * sgn);
|
|
p2 = $interpPoint_0(this.lead1, this.lead2, 1 - i, 16 * sgn);
|
|
p3 = $interpPoint_0(this.lead1, this.lead2, 1 - i, 0);
|
|
this.arrows[i] = $createPolygon(p1, p2, p3);
|
|
}
|
|
gatelen = app_0.gridSize;
|
|
leadlen = (this.dn - 16) / 2;
|
|
gatelen = round_int(gatelen + leadlen % app_0.gridSize);
|
|
if (leadlen < gatelen) {
|
|
this.x2 = this.x_0;
|
|
this.y2 = this.y_0;
|
|
return;
|
|
}
|
|
$interpPoint_2(this.lead2, this.point2, this.gate[0], gatelen / leadlen, gatelen * dir_0);
|
|
$interpPoint_2(this.lead2, this.point2, this.gate[1], gatelen / leadlen, app_0.gridSize * 2 * dir_0);
|
|
}
|
|
;
|
|
_.stamp = function stamp_70(){
|
|
$stampResistor(this.nodes[2], this.nodes[1], this.cresistance);
|
|
$stamp_0(this.diode03, this.nodes[0], this.nodes[3]);
|
|
$stamp_0(this.diode30, this.nodes[3], this.nodes[0]);
|
|
}
|
|
;
|
|
_.startIteration = function startIteration_26(){
|
|
$wnd.Math.abs(this.i2) < this.holdingI && (this.state = false);
|
|
$wnd.Math.abs(this.ig) > this.triggerI && (this.state = true);
|
|
this.aresistance = this.state?$intern_34:$intern_84;
|
|
}
|
|
;
|
|
_.undumpXml = function undumpXml_93(xml){
|
|
this.flags = $parseIntAttr(xml, 'f', this.flags);
|
|
this.triggerI = $parseDoubleAttr(xml, 'ti', this.triggerI);
|
|
this.holdingI = $parseDoubleAttr(xml, 'hi', this.holdingI);
|
|
this.cresistance = $parseDoubleAttr(xml, 'cr', this.cresistance);
|
|
this.state = $parseBooleanAttr(xml, 'st', this.state);
|
|
$setup_7(this);
|
|
}
|
|
;
|
|
_.aresistance = 0;
|
|
_.cresistance = 0;
|
|
_.curcount_1 = 0;
|
|
_.curcount_2 = 0;
|
|
_.curcount_g = 0;
|
|
_.holdingI = 0;
|
|
_.i1 = 0;
|
|
_.i2 = 0;
|
|
_.ig = 0;
|
|
_.state = false;
|
|
_.triggerI = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_TriacElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'TriacElm', 423);
|
|
function TriodeElm(xx, yy){
|
|
CircuitElm.call(this, xx, yy);
|
|
this.mu = 93;
|
|
this.kg1 = 680;
|
|
this.flags |= 2;
|
|
this.noDiagonal = true;
|
|
}
|
|
|
|
function TriodeElm_0(xa, ya, xb, yb, f, st){
|
|
CircuitElm_0.call(this, xa, ya, xb, yb, f);
|
|
this.mu = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.kg1 = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.noDiagonal = true;
|
|
}
|
|
|
|
defineClass(445, 8, $intern_85, TriodeElm, TriodeElm_0);
|
|
_.canViewInScope = function canViewInScope_7(){
|
|
return true;
|
|
}
|
|
;
|
|
_.doStep = function doStep_56(){
|
|
var Gds, gm, ids, ival, q, rs, vgk, vpk, vs;
|
|
vs = initUnidimensionalArray(D_classLit, $intern_76, 7, 3, 15, 1);
|
|
vs[0] = this.volts[0];
|
|
vs[1] = this.volts[1];
|
|
vs[2] = this.volts[2];
|
|
vs[1] > this.lastv1 + 0.5 && (vs[1] = this.lastv1 + 0.5);
|
|
vs[1] < this.lastv1 - 0.5 && (vs[1] = this.lastv1 - 0.5);
|
|
vs[2] > this.lastv2 + 0.5 && (vs[2] = this.lastv2 + 0.5);
|
|
vs[2] < this.lastv2 - 0.5 && (vs[2] = this.lastv2 - 0.5);
|
|
vgk = vs[1] - vs[2];
|
|
vpk = vs[0] - vs[2];
|
|
($wnd.Math.abs(this.lastv0 - vs[0]) > $intern_34 || $wnd.Math.abs(this.lastv1 - vs[1]) > $intern_34 || $wnd.Math.abs(this.lastv2 - vs[2]) > $intern_34) && (sim_0.converged = false);
|
|
this.lastv0 = vs[0];
|
|
this.lastv1 = vs[1];
|
|
this.lastv2 = vs[2];
|
|
gm = 0;
|
|
ival = vgk + vpk / this.mu;
|
|
this.currentg = 0;
|
|
if (vgk > $intern_34) {
|
|
$stampResistor(this.nodes[1], this.nodes[2], 6000);
|
|
this.currentg = vgk / 6000;
|
|
}
|
|
else
|
|
$stampResistor(this.nodes[1], this.nodes[2], $intern_97);
|
|
if (ival < 0) {
|
|
Gds = $intern_112;
|
|
ids = vpk * $intern_112;
|
|
}
|
|
else {
|
|
ids = $wnd.Math.pow(ival, 1.5) / this.kg1;
|
|
q = 1.5 * $wnd.Math.sqrt(ival) / this.kg1;
|
|
Gds = q;
|
|
gm = q / this.mu;
|
|
}
|
|
this.currentp = ids;
|
|
this.currentc = ids + this.currentg;
|
|
rs = -ids + Gds * vpk + gm * vgk;
|
|
$stampMatrix(this.nodes[0], this.nodes[0], Gds);
|
|
$stampMatrix(this.nodes[0], this.nodes[2], -Gds - gm);
|
|
$stampMatrix(this.nodes[0], this.nodes[1], gm);
|
|
$stampMatrix(this.nodes[2], this.nodes[0], -Gds);
|
|
$stampMatrix(this.nodes[2], this.nodes[2], Gds + gm);
|
|
$stampMatrix(this.nodes[2], this.nodes[1], -gm);
|
|
$stampRightSide(this.nodes[0], rs);
|
|
$stampRightSide(this.nodes[2], -rs);
|
|
}
|
|
;
|
|
_.draw = function draw_86(g){
|
|
var i;
|
|
$setColor_0(g, ($clinit_Color() , gray));
|
|
drawThickCircle(g, this.point2.x_0, this.point2.y_0, this.circler);
|
|
$setBbox_0(this, this.point1, this.plate[0], 16);
|
|
$adjustBbox(this, this.cath[0].x_0, this.cath[1].y_0, this.point2.x_0 + this.circler, this.point2.y_0 + this.circler);
|
|
$setVoltageColor(this, g, this.volts[0]);
|
|
$setPowerColor(this, g, this.currentp * (this.volts[0] - this.volts[2]));
|
|
drawThickLine_0(g, this.plate[0], this.plate[1], 3);
|
|
drawThickLine_0(g, this.plate[2], this.plate[3], 3);
|
|
$setVoltageColor(this, g, this.volts[1]);
|
|
$setPowerColor(this, g, this.currentg * (this.volts[1] - this.volts[2]));
|
|
for (i = 0; i != 8; i += 2)
|
|
drawThickLine_0(g, this.grid[i], this.grid[i + 1], 3);
|
|
$setVoltageColor(this, g, this.volts[2]);
|
|
$setPowerColor(this, g, 0);
|
|
for (i = 0; i != 3; i++)
|
|
drawThickLine_0(g, this.cath[i], this.cath[i + 1], 3);
|
|
this.curcountp = $updateDotCount(this.currentp, this.curcountp);
|
|
this.curcountc = $updateDotCount(this.currentc, this.curcountc);
|
|
this.curcountg = $updateDotCount(this.currentg, this.curcountg);
|
|
if (app_0.mouse.dragElm != this) {
|
|
$drawDots(g, this.plate[0], this.midgrid, this.curcountp);
|
|
$drawDots(g, this.midgrid, this.midcath, this.curcountc);
|
|
$drawDots(g, this.midcath, this.cath[1], $addCurCount(this.curcountc, 8));
|
|
$drawDots(g, this.cath[1], this.cath[0], $addCurCount(this.curcountc, 8));
|
|
$drawDots(g, this.point1, this.midgrid, this.curcountg);
|
|
}
|
|
$drawPosts(this, g);
|
|
}
|
|
;
|
|
_.dumpXml = function dumpXml_91(doc, elem){
|
|
dumpAttr_1(elem, 'x', this.x_0 + ' ' + this.y_0 + ' ' + this.x2 + ' ' + this.y2);
|
|
dumpAttr_0(elem, 'f', this.flags);
|
|
dumpAttr(elem, 'mu', this.mu);
|
|
dumpAttr(elem, 'kg', this.kg1);
|
|
}
|
|
;
|
|
_.flipX = function flipX_20(c2, count){
|
|
this.x_0 == this.x2 && (this.flags ^= 1);
|
|
(this.flags & 2) == 0 && this.x_0 != this.x2 && (this.flags ^= 1);
|
|
$flipX(this, c2);
|
|
}
|
|
;
|
|
_.flipXY = function flipXY_17(xmy, count){
|
|
this.flags ^= 1;
|
|
$flipXY(this, xmy);
|
|
}
|
|
;
|
|
_.flipY = function flipY_20(c2, count){
|
|
this.y_0 == this.y2 && (this.flags ^= 1);
|
|
(this.flags & 2) == 0 && this.y_0 != this.y2 && (this.flags ^= 1);
|
|
$flipY(this, c2);
|
|
}
|
|
;
|
|
_.getConnection = function getConnection_42(n1, n2){
|
|
return !(n1 == 1 || n2 == 1);
|
|
}
|
|
;
|
|
_.getCurrent_0 = function getCurrent_3(){
|
|
return this.currentc;
|
|
}
|
|
;
|
|
_.getCurrentIntoNode = function getCurrentIntoNode_37(n){
|
|
if (n == 2)
|
|
return this.currentc;
|
|
if (n == 0)
|
|
return -this.currentp;
|
|
return -this.currentg;
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_115(){
|
|
return 173;
|
|
}
|
|
;
|
|
_.getEditInfo = function getEditInfo_81(n){
|
|
if (n == 0)
|
|
return $setPositive($setDimensionless(new EditInfo_0('mu', this.mu, 0, 0)));
|
|
if (n == 1)
|
|
return $setPositive($setDimensionless(new EditInfo_0('kg1', this.kg1, 0, 0)));
|
|
return null;
|
|
}
|
|
;
|
|
_.getInfo_0 = function getInfo_90(arr){
|
|
var vac, vag, vgc;
|
|
arr[0] = 'triode';
|
|
vac = this.volts[0] - this.volts[2];
|
|
vgc = this.volts[1] - this.volts[2];
|
|
vag = this.volts[0] - this.volts[1];
|
|
arr[1] = 'Vac = ' + getUnitText(vac, 'V', false);
|
|
arr[2] = 'Vgc = ' + getUnitText(vgc, 'V', false);
|
|
arr[3] = 'Vag = ' + getUnitText(vag, 'V', false);
|
|
arr[4] = 'Ic = ' + getUnitText(this.currentc, 'A', false);
|
|
arr[5] = 'Ig = ' + getUnitText(this.currentg, 'A', false);
|
|
}
|
|
;
|
|
_.getMatrixConnection = function getMatrixConnection_16(n1, n2){
|
|
return true;
|
|
}
|
|
;
|
|
_.getPost = function getPost_30(n){
|
|
return n == 0?this.plate[0]:n == 1?this.grid[0]:this.cath[0];
|
|
}
|
|
;
|
|
_.getPostCount_0 = function getPostCount_82(){
|
|
return 3;
|
|
}
|
|
;
|
|
_.getPower = function getPower_14(){
|
|
return (this.volts[0] - this.volts[2]) * this.currentc + (this.volts[1] - this.volts[2]) * this.currentg;
|
|
}
|
|
;
|
|
_.getVoltageDiff_0 = function getVoltageDiff_26(){
|
|
return this.volts[0] - this.volts[2];
|
|
}
|
|
;
|
|
_.nonLinear_0 = function nonLinear_30(){
|
|
return true;
|
|
}
|
|
;
|
|
_.reset_0 = function reset_56(){
|
|
this.volts[0] = this.volts[1] = this.volts[2] = 0;
|
|
this.curcount_0 = 0;
|
|
}
|
|
;
|
|
_.setEditValue = function setEditValue_81(n, ei){
|
|
n == 0 && (this.mu = ei.value_0);
|
|
n == 1 && (this.kg1 = ei.value_0);
|
|
}
|
|
;
|
|
_.setPoints = function setPoints_77(){
|
|
var cathw, farw, i, nearw, s;
|
|
$setPoints(this);
|
|
s = (this.flags & 2) != 0?this.dsign:1;
|
|
(this.flags & 1) != 0 && (s = -s);
|
|
this.plate = $newPointArray(4);
|
|
this.grid = $newPointArray(8);
|
|
this.cath = $newPointArray(4);
|
|
this.grid[0] = this.point1;
|
|
nearw = 8 * s;
|
|
$interpPoint_2(this.point1, this.point2, this.plate[1], 1, nearw);
|
|
farw = 32 * s;
|
|
$interpPoint_2(this.point1, this.point2, this.plate[0], 1, farw);
|
|
$interpPoint2(this.point2, this.plate[1], this.plate[2], this.plate[3], 1, 18);
|
|
this.circler = 24;
|
|
$interpPoint_2(this.point1, this.point2, this.grid[1], (this.dn - this.circler) / this.dn, 0);
|
|
for (i = 0; i != 3; i++) {
|
|
$interpPoint_2(this.grid[1], this.point2, this.grid[2 + i * 2], (i * 3 + 1) / 4.5, 0);
|
|
$interpPoint_2(this.grid[1], this.point2, this.grid[3 + i * 2], (i * 3 + 2) / 4.5, 0);
|
|
}
|
|
this.midgrid = this.point2;
|
|
cathw = 16 * s;
|
|
this.midcath = $interpPoint_0(this.point1, this.point2, 1, -nearw);
|
|
$interpPoint2(this.point2, this.plate[1], this.cath[1], this.cath[2], -1, cathw);
|
|
$interpPoint_2(this.point2, this.plate[1], this.cath[3], -1.2, -cathw);
|
|
$interpPoint_2(this.point2, this.plate[1], this.cath[0], -farw / nearw, cathw);
|
|
}
|
|
;
|
|
_.stamp = function stamp_71(){
|
|
}
|
|
;
|
|
_.undumpXml = function undumpXml_94(xml){
|
|
this.flags = $parseIntAttr(xml, 'f', this.flags);
|
|
this.mu = $parseDoubleAttr(xml, 'mu', this.mu);
|
|
this.kg1 = $parseDoubleAttr(xml, 'kg', this.kg1);
|
|
}
|
|
;
|
|
_.circler = 0;
|
|
_.curcountc = 0;
|
|
_.curcountg = 0;
|
|
_.curcountp = 0;
|
|
_.currentc = 0;
|
|
_.currentg = 0;
|
|
_.currentp = 0;
|
|
_.kg1 = 0;
|
|
_.lastv0 = 0;
|
|
_.lastv1 = 0;
|
|
_.lastv2 = 0;
|
|
_.mu = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_TriodeElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'TriodeElm', 445);
|
|
function $limitStep_1(vnew, vold){
|
|
if (vnew > vold + 1)
|
|
return vold + 1;
|
|
if (vnew < vold - 1)
|
|
return vold - 1;
|
|
return vnew;
|
|
}
|
|
|
|
function TunnelDiodeElm(xx, yy){
|
|
CircuitElm.call(this, xx, yy);
|
|
}
|
|
|
|
function TunnelDiodeElm_0(xa, ya, xb, yb, f){
|
|
CircuitElm_0.call(this, xa, ya, xb, yb, f);
|
|
}
|
|
|
|
defineClass(431, 8, $intern_85, TunnelDiodeElm, TunnelDiodeElm_0);
|
|
_.calculateCurrent = function calculateCurrent_41(){
|
|
var i0, voltdiff;
|
|
voltdiff = this.volts[0] - this.volts[1];
|
|
i0 = $intern_134 * $wnd.Math.exp(-0.37);
|
|
this.current_0 = $intern_135 * $wnd.Math.exp($intern_136) * ($wnd.Math.exp(voltdiff / 0.026) - 1) + $intern_135 * (voltdiff / 0.1) * $wnd.Math.exp(1 - voltdiff / 0.1) + $intern_134 * $wnd.Math.exp(voltdiff - 0.37) - i0;
|
|
}
|
|
;
|
|
_.doStep = function doStep_57(){
|
|
var geq, i, i0, nc, voltdiff;
|
|
voltdiff = this.volts[0] - this.volts[1];
|
|
$wnd.Math.abs(voltdiff - this.lastvoltdiff) > $intern_34 && (sim_0.converged = false);
|
|
voltdiff = $limitStep_1(voltdiff, this.lastvoltdiff);
|
|
this.lastvoltdiff = voltdiff;
|
|
i0 = $intern_134 * $wnd.Math.exp(-0.37);
|
|
i = $intern_135 * $wnd.Math.exp($intern_136) * ($wnd.Math.exp(voltdiff / 0.026) - 1) + $intern_135 * (voltdiff / 0.1) * $wnd.Math.exp(1 - voltdiff / 0.1) + $intern_134 * $wnd.Math.exp(voltdiff - 0.37) - i0;
|
|
geq = $intern_135 * $wnd.Math.exp($intern_136) * $wnd.Math.exp(voltdiff / 0.026) / 0.026 + $intern_135 * $wnd.Math.exp(1 - voltdiff / 0.1) / 0.1 - $wnd.Math.exp(1 - voltdiff / 0.1) * $intern_135 * voltdiff / 0.010000000000000002 + $wnd.Math.exp(voltdiff - 0.37) * $intern_134;
|
|
nc = i - geq * voltdiff;
|
|
$stampConductance(this.nodes[0], this.nodes[1], geq);
|
|
$stampCurrentSource(this.nodes[0], this.nodes[1], nc);
|
|
}
|
|
;
|
|
_.draw = function draw_87(g){
|
|
var v1, v2;
|
|
$setBbox_0(this, this.point1, this.point2, 8);
|
|
v1 = this.volts[0];
|
|
v2 = this.volts[1];
|
|
$draw2Leads(this, g);
|
|
$setPowerColor_0(this, g);
|
|
$setColor_0(g, $getVoltageColor(this, v1));
|
|
$fillPolygon(g, this.poly);
|
|
$setColor_0(g, $getVoltageColor(this, v2));
|
|
drawThickLine_0(g, this.cathode[0], this.cathode[1], 3);
|
|
drawThickLine_0(g, this.cathode[2], this.cathode[0], 3);
|
|
drawThickLine_0(g, this.cathode[3], this.cathode[1], 3);
|
|
this.curcount_0 = $updateDotCount(this.current_0, this.curcount_0);
|
|
app_0.mouse.dragElm == this || $drawDots(g, this.point1, this.point2, this.curcount_0);
|
|
$drawPosts(this, g);
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_116(){
|
|
return 175;
|
|
}
|
|
;
|
|
_.getInfo_0 = function getInfo_91(arr){
|
|
arr[0] = 'tunnel diode';
|
|
arr[1] = 'I = ' + getUnitText(this.current_0, 'A', false);
|
|
arr[2] = 'Vd = ' + getUnitText(this.volts[0] - this.volts[1], 'V', false);
|
|
arr[3] = 'P = ' + getUnitText((this.volts[0] - this.volts[1]) * this.current_0, 'W', false);
|
|
}
|
|
;
|
|
_.nonLinear_0 = function nonLinear_31(){
|
|
return true;
|
|
}
|
|
;
|
|
_.reset_0 = function reset_57(){
|
|
this.lastvoltdiff = this.volts[0] = this.volts[1] = this.curcount_0 = 0;
|
|
}
|
|
;
|
|
_.setPoints = function setPoints_78(){
|
|
var pa;
|
|
$setPoints(this);
|
|
$calcLeads(this, 16);
|
|
this.cathode = $newPointArray(4);
|
|
pa = $newPointArray(2);
|
|
$interpPoint2(this.lead1, this.lead2, pa[0], pa[1], 0, 8);
|
|
$interpPoint2(this.lead1, this.lead2, this.cathode[0], this.cathode[1], 1, 8);
|
|
$interpPoint2(this.lead1, this.lead2, this.cathode[2], this.cathode[3], 0.8, 8);
|
|
this.poly = $createPolygon(pa[0], pa[1], this.lead2);
|
|
}
|
|
;
|
|
_.stamp = function stamp_72(){
|
|
}
|
|
;
|
|
_.lastvoltdiff = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_TunnelDiodeElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'TunnelDiodeElm', 431);
|
|
function $close_1(this$static, keepChanges){
|
|
if (!keepChanges) {
|
|
while (this$static.currentPnp != this$static.originalPnp)
|
|
$toggle_0(this$static);
|
|
}
|
|
$hide(this$static, false);
|
|
typeScrollPopup = null;
|
|
}
|
|
|
|
function $doDeltaY_0(this$static, dy){
|
|
this$static.deltaY += dy;
|
|
while (this$static.deltaY >= 30) {
|
|
this$static.deltaY -= 30;
|
|
$toggle_0(this$static);
|
|
}
|
|
while (this$static.deltaY <= -30) {
|
|
this$static.deltaY += 30;
|
|
$toggle_0(this$static);
|
|
}
|
|
}
|
|
|
|
function $getHeaderText(this$static){
|
|
if (instanceOf(this$static.myElm, 129)) {
|
|
if (instanceOf(this$static.myElm, 185))
|
|
return LS('JFET Type');
|
|
return LS('MOSFET Type');
|
|
}
|
|
return LS('Transistor Type');
|
|
}
|
|
|
|
function $toggle_0(this$static){
|
|
var m, t, text_0;
|
|
if (instanceOf(this$static.myElm, 129)) {
|
|
m = this$static.myElm;
|
|
m.pnp = -m.pnp;
|
|
m.flags ^= m.FLAG_PNP;
|
|
m.setPoints();
|
|
this$static.currentPnp = m.pnp;
|
|
}
|
|
else if (instanceOf(this$static.myElm, 153)) {
|
|
t = this$static.myElm;
|
|
t.pnp = -t.pnp;
|
|
$setPoints_16(t);
|
|
this$static.currentPnp = t.pnp;
|
|
}
|
|
$needAnalyze(this$static.sim);
|
|
instanceOf(this$static.myElm, 129)?instanceOf(this$static.myElm, 185)?(text_0 = this$static.currentPnp == -1?LS('P-Channel JFET'):LS('N-Channel JFET')):(text_0 = this$static.currentPnp == -1?LS('P-Channel'):LS('N-Channel')):(text_0 = this$static.currentPnp == -1?'PNP':'NPN');
|
|
$setText_0(this$static.typeLabel, text_0);
|
|
}
|
|
|
|
function TypeScrollPopup(x_0, y_0, dy, e, s){
|
|
var header, text_0;
|
|
PopupPanel.call(this);
|
|
this.myElm = e;
|
|
this.sim = s;
|
|
this.deltaY = 0;
|
|
$pushUndo(this.sim.undoManager);
|
|
instanceOf(e, 129)?(this.originalPnp = e.pnp):instanceOf(e, 153) && (this.originalPnp = e.pnp);
|
|
this.currentPnp = this.originalPnp;
|
|
this.vp = new VerticalPanel;
|
|
$setWidget_0(this, this.vp);
|
|
header = new Label_1($getHeaderText(this));
|
|
$setStyleName_0(header, getStylePrimaryName(($clinit_DOM() , header.element)) + '-' + '2off', true);
|
|
$add_5(this.vp, header);
|
|
this.typeLabel = new Label;
|
|
$setHorizontalAlignment(this.typeLabel, ($clinit_HasHorizontalAlignment() , ALIGN_CENTER));
|
|
$addStyleDependentName(this.typeLabel, 'selected');
|
|
$add_5(this.vp, this.typeLabel);
|
|
instanceOf(this.myElm, 129)?instanceOf(this.myElm, 185)?(text_0 = this.currentPnp == -1?LS('P-Channel JFET'):LS('N-Channel JFET')):(text_0 = this.currentPnp == -1?LS('P-Channel'):LS('N-Channel')):(text_0 = this.currentPnp == -1?'PNP':'NPN');
|
|
$setText_0(this.typeLabel, text_0);
|
|
$doDeltaY_0(this, dy);
|
|
$addDomHandler(this, this, ($clinit_MouseOutEvent() , $clinit_MouseOutEvent() , TYPE_9));
|
|
$addDomHandler(this, this, ($clinit_MouseWheelEvent() , $clinit_MouseWheelEvent() , TYPE_12));
|
|
$addDomHandler(this, this, ($clinit_MouseDownEvent() , $clinit_MouseDownEvent() , TYPE_7));
|
|
$setPopupPositionAndShow(this, new TypeScrollPopup$1(this, x_0, y_0));
|
|
}
|
|
|
|
defineClass(448, 48, $intern_132, TypeScrollPopup);
|
|
_.onMouseDown = function onMouseDown_7(e){
|
|
$eventGetButton(e.nativeEvent) == 1 || $eventGetButton(e.nativeEvent) == 4?$close_1(this, true):$close_1(this, false);
|
|
}
|
|
;
|
|
_.onMouseOut = function onMouseOut_10(e){
|
|
$close_1(this, true);
|
|
}
|
|
;
|
|
_.onMouseWheel = function onMouseWheel_7(e){
|
|
!!e.nativeEvent && (e.nativeEvent.preventDefault() , undefined);
|
|
$doDeltaY_0(this, $eventGetMouseWheelVelocityY(e.nativeEvent));
|
|
}
|
|
;
|
|
_.currentPnp = 0;
|
|
_.deltaY = 0;
|
|
_.originalPnp = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_TypeScrollPopup_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'TypeScrollPopup', 448);
|
|
function TypeScrollPopup$1(this$0, val$x, val$y){
|
|
this.this$01 = this$0;
|
|
this.val$x2 = val$x;
|
|
this.val$y3 = val$y;
|
|
}
|
|
|
|
defineClass(917, 1, {}, TypeScrollPopup$1);
|
|
_.setPosition = function setPosition_1(offsetWidth, offsetHeight){
|
|
var left, top_0;
|
|
left = $wnd.Math.max(0, this.val$x2 - (offsetWidth / 4 | 0));
|
|
top_0 = $wnd.Math.max(0, this.val$y3 - (offsetHeight / 2 | 0));
|
|
$setPopupPosition(this.this$01, left, top_0);
|
|
}
|
|
;
|
|
_.val$x2 = 0;
|
|
_.val$y3 = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_TypeScrollPopup$1_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'TypeScrollPopup/1', 917);
|
|
function $addWidgetToVerticalPanel_0(this$static, w){
|
|
var i;
|
|
if (!this$static.verticalPanel)
|
|
return;
|
|
if (this$static.iFrame) {
|
|
i = $getWidgetIndex(this$static.verticalPanel, this$static.iFrame);
|
|
$insert_2(this$static.verticalPanel, w, i);
|
|
$setiFrameHeight(this$static);
|
|
}
|
|
else
|
|
$add_5(this$static.verticalPanel, w);
|
|
}
|
|
|
|
function $allowSave(this$static, b){
|
|
!!this$static.menus.saveFileItem && $setEnabled_1(this$static.menus.saveFileItem, b);
|
|
}
|
|
|
|
function $centerCircuit(this$static){
|
|
var bounds, cheight, h, scale;
|
|
if (!this$static.elmList)
|
|
return;
|
|
bounds = $getCircuitBounds(this$static);
|
|
$setCircuitArea(this$static);
|
|
scale = 1;
|
|
cheight = this$static.app.circuitArea.height_0;
|
|
if (this$static.app.scopeManager.scopeCount == 0 && this$static.app.circuitArea.width_0 < 800) {
|
|
h = round_int(cheight * this$static.app.scopeManager.scopeHeightFraction);
|
|
cheight -= h;
|
|
}
|
|
!!bounds && (scale = $wnd.Math.min(this$static.app.circuitArea.width_0 / (bounds.width_0 + 140), cheight / (bounds.height_0 + 100)));
|
|
scale = $wnd.Math.min(scale, 1.5);
|
|
this$static.app.transform_0[0] = this$static.app.transform_0[3] = scale;
|
|
this$static.app.transform_0[1] = this$static.app.transform_0[2] = this$static.app.transform_0[4] = this$static.app.transform_0[5] = 0;
|
|
if (bounds) {
|
|
this$static.app.transform_0[4] = (this$static.app.circuitArea.width_0 - bounds.width_0 * scale) / 2 - bounds.x_0 * scale;
|
|
this$static.app.transform_0[5] = (cheight - bounds.height_0 * scale) / 2 - bounds.y_0 * scale;
|
|
}
|
|
}
|
|
|
|
function $composeSubcircuitMenu(this$static){
|
|
var i, list, menu, mi, name_0;
|
|
if (this$static.menus.subcircuitMenuBar == null)
|
|
return;
|
|
for (mi = 0; mi != 2; mi++) {
|
|
menu = this$static.menus.subcircuitMenuBar[mi];
|
|
$clearItems(menu);
|
|
list = getModelList();
|
|
for (i = 0; i != list.arrayList.array.length; i++) {
|
|
name_0 = (checkArrayElementIndex(i, list.arrayList.array.length) , $get_2(list.arrayList, i)).name_0;
|
|
$addItem_0(menu, $getClassCheckItem_0(this$static, LS('Add ') + ('' + name_0), 'CustomCompositeElm:' + name_0));
|
|
}
|
|
}
|
|
lastSubcircuitMenuUpdate = sequenceNumber;
|
|
}
|
|
|
|
function $createNewLoadFile(this$static){
|
|
var idx, newlf;
|
|
idx = $getWidgetIndex(this$static.verticalPanel, this$static.loadFileInput);
|
|
newlf = new LoadFile(this$static.app);
|
|
$insert_2(this$static.verticalPanel, newlf, idx);
|
|
$remove(this$static.verticalPanel, idx + 1);
|
|
this$static.loadFileInput = newlf;
|
|
}
|
|
|
|
function $dialogIsShowing(this$static){
|
|
if (!!editDialog_0 && editDialog_0.showing)
|
|
return true;
|
|
if (!!customLogicEditDialog && customLogicEditDialog.showing)
|
|
return true;
|
|
if (!!diodeModelEditDialog && diodeModelEditDialog.showing)
|
|
return true;
|
|
if (!!dialogShowing && dialogShowing.showing)
|
|
return true;
|
|
if (!!this$static.contextPanel && this$static.contextPanel.showing)
|
|
return true;
|
|
if (!!scrollValuePopup && scrollValuePopup.showing)
|
|
return true;
|
|
if (!!typeScrollPopup && typeScrollPopup.showing)
|
|
return true;
|
|
if (!!aboutBox && aboutBox.showing)
|
|
return true;
|
|
return false;
|
|
}
|
|
|
|
function $drawBottomArea(this$static, g){
|
|
var badnodes, ct, h, h0, i, info, leftX, ni, nn, nodeStr, s, timerate, x_0, ybase;
|
|
leftX = 0;
|
|
h = 0;
|
|
if (this$static.app.stopMessage == null && this$static.app.scopeManager.scopeCount == 0) {
|
|
leftX = max_3(this$static.canvasWidth - 160, 0);
|
|
h0 = round_int(this$static.canvasHeight * this$static.app.scopeManager.scopeHeightFraction);
|
|
h = !this$static.mouse.mouseElm?70:h0;
|
|
this$static.hideInfoBox && (h = 0);
|
|
}
|
|
this$static.app.stopMessage != null && this$static.app.circuitArea.height_0 > this$static.canvasHeight - 30 && (h = 30);
|
|
$setColor_1(g, this$static.menus.printableCheckItem.on?'#eee':'#111');
|
|
$fillRect_0(g, leftX, this$static.app.circuitArea.height_0 - h, this$static.app.circuitArea.width_0, this$static.canvasHeight - this$static.app.circuitArea.height_0 + h);
|
|
$setFont_0(g, unitsFont);
|
|
ct = this$static.app.scopeManager.scopeCount;
|
|
this$static.app.stopMessage != null && (ct = 0);
|
|
$clinit_Scope();
|
|
cursorScope = null;
|
|
cursorTime = -1;
|
|
for (i = 0; i != ct; i++)
|
|
$selectScope(this$static.app.scopeManager.scopes[i], this$static.mouse.mouseCursorX, this$static.mouse.mouseCursorY);
|
|
if (this$static.app.scopeElmArr != null)
|
|
for (i = 0; i != this$static.app.scopeElmArr.length; i++)
|
|
$selectScope_0(this$static.app.scopeElmArr[i], this$static.mouse.mouseCursorX, this$static.mouse.mouseCursorY);
|
|
for (i = 0; i != ct; i++)
|
|
$draw_2(this$static.app.scopeManager.scopes[i], g);
|
|
if (this$static.mouse.mouseWasOverSplitter) {
|
|
$setColor_0(g, selectColor_0);
|
|
g.context.lineWidth = 4;
|
|
$drawLine(g, 0, this$static.app.circuitArea.height_0 - 2, this$static.app.circuitArea.width_0, this$static.app.circuitArea.height_0 - 2);
|
|
g.context.lineWidth = 1;
|
|
}
|
|
$setColor_0(g, whiteColor);
|
|
if (this$static.app.stopMessage != null) {
|
|
$drawString(g, this$static.app.stopMessage, 10, this$static.canvasHeight - 10);
|
|
}
|
|
else if (!this$static.hideInfoBox) {
|
|
info = initUnidimensionalArray(Ljava_lang_String_2_classLit, $intern_23, 2, 10, 6, 1);
|
|
if (this$static.mouse.mouseElm) {
|
|
if (this$static.mouse.mousePost == -1) {
|
|
this$static.mouse.mouseElm.getInfo_0(info);
|
|
info[0] = LS(info[0]);
|
|
info[1] != null && (info[1] = LS(info[1]));
|
|
if (this$static.app.developerMode) {
|
|
for (ni = 0; info[ni] != null && ni < info.length - 1; ni++)
|
|
;
|
|
try {
|
|
nodeStr = 'nodes:';
|
|
for (nn = 0; nn < $getNodeCount(this$static.mouse.mouseElm); nn++)
|
|
nodeStr += ' ' + $getNode(this$static.mouse.mouseElm, nn).index_0;
|
|
info[ni] = nodeStr;
|
|
}
|
|
catch ($e0) {
|
|
$e0 = toJava($e0);
|
|
if (!instanceOf($e0, 13))
|
|
throw toJs($e0);
|
|
}
|
|
}
|
|
}
|
|
else
|
|
info[0] = 'V = ' + getUnitText($getPostVoltage(this$static.mouse.mouseElm, this$static.mouse.mousePost), 'V', false);
|
|
}
|
|
else {
|
|
info[0] = 't = ' + getTimeText(this$static.app.sim.t);
|
|
timerate = 160 * $getIterCount(this$static.app) * this$static.app.sim.timeStep;
|
|
timerate >= 0.1 && (info[0] += ' (' + $format_0(showFormat, timerate) + 'x)');
|
|
info[1] = LS('time step = ') + getTimeText(this$static.app.sim.timeStep);
|
|
}
|
|
if (this$static.app.hintType != -1) {
|
|
for (i = 0; info[i] != null; i++)
|
|
;
|
|
s = $getHint(this$static.app);
|
|
s == null?(this$static.app.hintType = -1):(info[i] = s);
|
|
}
|
|
x_0 = leftX + 5;
|
|
ct != 0 && (x_0 = $rightEdge(this$static.app.scopeManager.scopes[ct - 1]) + 20);
|
|
for (i = 0; info[i] != null; i++)
|
|
;
|
|
badnodes = this$static.app.badConnectionList.arrayList.array.length;
|
|
badnodes > 0 && (info[i++] = badnodes + (badnodes == 1?LS(' bad connection'):LS(' bad connections')));
|
|
this$static.app.savedFlag && (info[i++] = '(saved)');
|
|
ybase = this$static.app.circuitArea.height_0 - h;
|
|
for (i = 0; info[i] != null; i++) {
|
|
$fillText(g.context, info[i], x_0, ybase + 15 * (i + 1));
|
|
}
|
|
}
|
|
}
|
|
|
|
function $drawExceptionIndicator(this$static){
|
|
var g, scale, x_0;
|
|
scale = window.devicePixelRatio;
|
|
$setTransform(this$static.cvcontext, scale, 0, 0, scale, 0, 0);
|
|
g = new Graphics(this$static.cvcontext);
|
|
x_0 = max_3(this$static.canvasWidth - 160, 0) + 5;
|
|
$setFont_0(g, unitsFont);
|
|
$setColor_0(g, ($clinit_Color() , yellow));
|
|
$drawString(g, 'exception, see console!', x_0, this$static.canvasHeight - 10);
|
|
}
|
|
|
|
function $getBackgroundColor(this$static){
|
|
if (this$static.menus.printableCheckItem.on)
|
|
return $clinit_Color() , white;
|
|
return $clinit_Color() , black;
|
|
}
|
|
|
|
function $getCircuitBounds(this$static){
|
|
var bb, ce, ce$iterator, maxx, maxy, minx, miny;
|
|
minx = 30000;
|
|
maxx = $intern_104;
|
|
miny = 30000;
|
|
maxy = $intern_104;
|
|
for (ce$iterator = new ArrayList$1(this$static.elmList.arrayList); ce$iterator.i < ce$iterator.this$01.array.length;) {
|
|
ce = $next_4(ce$iterator);
|
|
minx = min_2(ce.x_0, min_2(ce.x2, minx));
|
|
maxx = max_3(ce.x_0, max_3(ce.x2, maxx));
|
|
miny = min_2(ce.y_0, min_2(ce.y2, miny));
|
|
maxy = max_3(ce.y_0, max_3(ce.y2, maxy));
|
|
bb = ce.boundingBox;
|
|
if (bb) {
|
|
minx = min_2(bb.x_0, minx);
|
|
maxx = max_3(bb.x_0 + bb.width_0, maxx);
|
|
miny = min_2(bb.y_0, miny);
|
|
maxy = max_3(bb.y_0 + bb.height_0, maxy);
|
|
}
|
|
}
|
|
if (minx > maxx)
|
|
return null;
|
|
return new Rectangle_0(minx, miny, maxx - minx, maxy - miny);
|
|
}
|
|
|
|
function $getClassCheckItem_0(this$static, s, t){
|
|
var e, elm, mi, shortcut;
|
|
!this$static.app.classToLabelMap && (this$static.app.classToLabelMap = new HashMap);
|
|
$putStringValue(this$static.app.classToLabelMap, t, s);
|
|
shortcut = '';
|
|
elm = null;
|
|
try {
|
|
elm = constructElement(t, 0, 0);
|
|
}
|
|
catch ($e0) {
|
|
$e0 = toJava($e0);
|
|
if (instanceOf($e0, 13)) {
|
|
e = $e0;
|
|
console.log('exception: ' + e);
|
|
}
|
|
else
|
|
throw toJs($e0);
|
|
}
|
|
$register(elm);
|
|
!elm && t.indexOf('Elm') >= 0 && (console.log("can't create class: " + t) , undefined);
|
|
if (elm) {
|
|
if (elm.getShortcut() > 0) {
|
|
shortcut += charToString(elm.getShortcut() & $intern_8);
|
|
$get_1(this$static.app.shortcuts, valueOf_0(elm.getShortcut())) != null && !$equals_1($get_1(this$static.app.shortcuts, valueOf_0(elm.getShortcut())), t) && console_0('already have shortcut for ' + charToString(elm.getShortcut() & $intern_8) + ' ' + elm);
|
|
$put_0(this$static.app.shortcuts, valueOf_0(elm.getShortcut()), t);
|
|
}
|
|
elm.delete_0();
|
|
}
|
|
shortcut == ''?(mi = new CheckboxMenuItem(s)):(mi = new CheckboxMenuItem_1(s, shortcut));
|
|
$setScheduledCommand(mi, new MyCommand('main', t));
|
|
$add_11(this$static.mainMenuItems, mi);
|
|
$add_11(this$static.mainMenuItemNames, t);
|
|
return mi;
|
|
}
|
|
|
|
function $getLabelTextForClass_0(this$static, cls){
|
|
return $getStringValue(this$static.app.classToLabelMap, cls);
|
|
}
|
|
|
|
function $getOptionFromStorage(key, val){
|
|
var s, stor;
|
|
stor = (!localStorage_0 && ($clinit_Storage$StorageSupportDetector() , localStorageSupported) && (localStorage_0 = new Storage_0('localStorage')) , localStorage_0);
|
|
if (!stor)
|
|
return val;
|
|
s = $getItem_0(stor.storage, key);
|
|
if (s == null)
|
|
return val;
|
|
return s == 'true';
|
|
}
|
|
|
|
function $init_3(this$static){
|
|
var convention, e, euroGates, euroRes, euroSetting, height, hideSidebar, l_0, menuBar, mouseWheelEdit, noEditing, printable, qp, sidePanelCheckbox, topPanelCheckbox, topPanelCheckboxLabel, usRes, val, val0, val1, val2, val3, val4, val5, width_0;
|
|
printable = false;
|
|
convention = true;
|
|
euroRes = false;
|
|
usRes = false;
|
|
hideSidebar = false;
|
|
noEditing = false;
|
|
mouseWheelEdit = false;
|
|
this$static.hideMenu = false;
|
|
qp = new QueryParameters;
|
|
euroGates = false;
|
|
this$static.elmList = this$static.app.elmList;
|
|
try {
|
|
euroRes = (val0 = $getStringValue(qp.map_0, 'euroResistors') , val0 != null && (val0 == '1' || $equalsIgnoreCase(val0, 'true')));
|
|
euroGates = $getBooleanValue(qp, 'IECGates', $getOptionFromStorage('euroGates', weAreInGermany()));
|
|
usRes = (val1 = $getStringValue(qp.map_0, 'usResistors') , val1 != null && (val1 == '1' || $equalsIgnoreCase(val1, 'true')));
|
|
val2 = $getStringValue(qp.map_0, 'running');
|
|
val2 == null || val2 == '1' || $equalsIgnoreCase(val2, 'true');
|
|
hideSidebar = (val3 = $getStringValue(qp.map_0, 'hideSidebar') , val3 != null && (val3 == '1' || $equalsIgnoreCase(val3, 'true')));
|
|
this$static.hideMenu = (val4 = $getStringValue(qp.map_0, 'hideMenu') , val4 != null && (val4 == '1' || $equalsIgnoreCase(val4, 'true')));
|
|
printable = $getBooleanValue(qp, 'whiteBackground', $getOptionFromStorage('whiteBackground', false));
|
|
convention = $getBooleanValue(qp, 'conventionalCurrent', $getOptionFromStorage('conventionalCurrent', true));
|
|
noEditing = (val5 = $getStringValue(qp.map_0, 'editable') , !(val5 == null || val5 == '1' || $equalsIgnoreCase(val5, 'true')));
|
|
mouseWheelEdit = $getBooleanValue(qp, 'mouseWheelEdit', $getOptionFromStorage('mouseWheelEdit', true));
|
|
$getStringValue(qp.map_0, 'positiveColor');
|
|
$getStringValue(qp.map_0, 'negativeColor');
|
|
$getStringValue(qp.map_0, 'neutralColor');
|
|
$getStringValue(qp.map_0, 'selectColor');
|
|
$getStringValue(qp.map_0, 'currentColor');
|
|
$getStringValue(qp.map_0, 'mouseMode');
|
|
this$static.hideInfoBox = (val = $getStringValue(qp.map_0, 'hideInfoBox') , val != null && (val == '1' || $equalsIgnoreCase(val, 'true')));
|
|
}
|
|
catch ($e0) {
|
|
$e0 = toJava($e0);
|
|
if (instanceOf($e0, 13)) {
|
|
e = $e0;
|
|
console.log('Exception: ' + e);
|
|
}
|
|
else
|
|
throw toJs($e0);
|
|
}
|
|
euroRes?(euroSetting = true):usRes?(euroSetting = false):(euroSetting = $getOptionFromStorage('euroResistors', !weAreInUS(true)));
|
|
this$static.layoutPanel = new DockLayoutPanel(($clinit_Style$Unit() , PX));
|
|
this$static.app.menus = this$static.menus = new Menus(this$static.app);
|
|
$init_2(this$static.menus);
|
|
$put_0(dumpTypeMap, valueOf_0(403), 'ScopeElm');
|
|
$putStringValue(xmlDumpTypeMap, 'Scope', 'ScopeElm');
|
|
$setEnabled_1(this$static.menus.recoverItem, this$static.app.recovery != null);
|
|
width_0 = $getOffsetWidth(get_0());
|
|
height = $getOffsetHeight(get_0());
|
|
VERTICALPANELWIDTH = width_0 / 5 | 0;
|
|
VERTICALPANELWIDTH > 166 && (VERTICALPANELWIDTH = 166);
|
|
VERTICALPANELWIDTH < 128 && (VERTICALPANELWIDTH = 128);
|
|
this$static.verticalPanel = new VerticalPanel;
|
|
$addClassName($getElement(this$static.verticalPanel), 'verticalPanel');
|
|
$getElement(this$static.verticalPanel).id = 'painel';
|
|
sidePanelCheckbox = ($clinit_DOM() , $createCheckInputElement($doc));
|
|
this$static.sidePanelCheckboxLabel = $doc.createElement('label');
|
|
$addClassName(this$static.sidePanelCheckboxLabel, 'triggerLabel');
|
|
sidePanelCheckbox.id = 'trigger';
|
|
this$static.sidePanelCheckboxLabel.setAttribute('for', 'trigger');
|
|
$addClassName(sidePanelCheckbox, 'trigger');
|
|
topPanelCheckbox = $createCheckInputElement($doc);
|
|
topPanelCheckboxLabel = $doc.createElement('label');
|
|
topPanelCheckbox.id = 'toptrigger';
|
|
$addClassName(topPanelCheckbox, 'toptrigger');
|
|
$addClassName(topPanelCheckboxLabel, 'toptriggerlabel');
|
|
topPanelCheckboxLabel.setAttribute('for', 'toptrigger');
|
|
this$static.buttonPanel = VERTICALPANELWIDTH == 166?new HorizontalPanel:new VerticalPanel;
|
|
$setEnabled_1(this$static.menus.pasteItem, false);
|
|
$setState_1(this$static.menus.dotsCheckItem, true);
|
|
$setState_1(this$static.menus.voltsCheckItem, true);
|
|
$setState_1(this$static.menus.showValuesCheckItem, true);
|
|
$setState_1(this$static.menus.toolbarCheckItem, !this$static.hideMenu && !noEditing && !hideSidebar && height > 700);
|
|
$setState_1(this$static.menus.crossHairCheckItem, $getOptionFromStorage('crossHair', false));
|
|
$setState_1(this$static.menus.euroResistorCheckItem, euroSetting);
|
|
$setCommand_0(this$static.menus.euroResistorCheckItem, new UIManager$1(this$static));
|
|
$setCommand_0(this$static.menus.euroGatesCheckItem, new UIManager$2(this$static));
|
|
$setState_1(this$static.menus.euroGatesCheckItem, euroGates);
|
|
$setCommand_0(this$static.menus.printableCheckItem, new UIManager$3(this$static));
|
|
$setState_1(this$static.menus.printableCheckItem, printable);
|
|
$setCommand_0(this$static.menus.conventionCheckItem, new UIManager$4(this$static));
|
|
$setState_1(this$static.menus.conventionCheckItem, convention);
|
|
$setState_1(this$static.menus.noEditCheckItem, noEditing);
|
|
$setState_1(this$static.menus.mouseWheelEditCheckItem, mouseWheelEdit);
|
|
$loadShortcuts(this$static);
|
|
$appendChild($getElement(this$static.layoutPanel), resolve(topPanelCheckbox));
|
|
$appendChild($getElement(this$static.layoutPanel), resolve(topPanelCheckboxLabel));
|
|
this$static.toolbar_0 = new Toolbar;
|
|
$setEuroResistors(this$static.toolbar_0, euroSetting);
|
|
menuBar = this$static.menus.menuBar;
|
|
this$static.hideMenu || $addNorth(this$static.layoutPanel, menuBar, 30);
|
|
if (hideSidebar)
|
|
VERTICALPANELWIDTH = 0;
|
|
else {
|
|
$appendChild($getElement(this$static.layoutPanel), resolve(sidePanelCheckbox));
|
|
$appendChild($getElement(this$static.layoutPanel), resolve(this$static.sidePanelCheckboxLabel));
|
|
$addEast(this$static.layoutPanel, this$static.verticalPanel, VERTICALPANELWIDTH);
|
|
}
|
|
$addNorth(this$static.layoutPanel, this$static.toolbar_0, 40);
|
|
$insertFirst(menuBar.element, menuBar.element.childNodes[1]);
|
|
$getFirstChildElement(menuBar.element).setAttribute('onclick', "document.getElementsByClassName('toptrigger')[0].checked = false");
|
|
$add_4(get_0(), this$static.layoutPanel);
|
|
this$static.cv = createIfSupported();
|
|
if (!this$static.cv) {
|
|
$add_0(($clinit_RootPanel() , get_1()), new Label_1('Not working. You need a browser that supports the CANVAS element.'));
|
|
return;
|
|
}
|
|
addResizeHandler(new UIManager$5(this$static));
|
|
this$static.cvcontext = $getContext2d(this$static.cv);
|
|
this$static.app.scopeManager = this$static.scopeManager = new ScopeManager(this$static.app);
|
|
this$static.subcircuitBar = new SubcircuitBar;
|
|
$add_0(($clinit_RootPanel() , get_1()), this$static.subcircuitBar);
|
|
$setWidgetHidden(this$static.layoutPanel, this$static.toolbar_0, !this$static.menus.toolbarCheckItem.on);
|
|
$setCanvasSize(this$static);
|
|
$insert_0(this$static.layoutPanel, this$static.cv, ($clinit_DockLayoutPanel$Direction() , CENTER_0), 0);
|
|
$add_5(this$static.verticalPanel, this$static.buttonPanel);
|
|
this$static.buttonPanel.add_0(this$static.resetButton = new Button_1(LS('Reset')));
|
|
$addDomHandler(this$static.resetButton, new UIManager$6(this$static), ($clinit_ClickEvent() , $clinit_ClickEvent() , TYPE_1));
|
|
$setStylePrimaryName(this$static.resetButton, 'topButton');
|
|
this$static.buttonPanel.add_0(this$static.runStopButton = new Button_0(($clinit_SafeHtmlUtils() , new SafeHtmlString(LS('<Strong>RUN<\/Strong> / Stop')))));
|
|
$addDomHandler(this$static.runStopButton, new UIManager$7(this$static), (null , TYPE_1));
|
|
isSupported_1() && $add_5(this$static.verticalPanel, this$static.loadFileInput = new LoadFile(this$static.app));
|
|
$add_5(this$static.verticalPanel, l_0 = new Label_1(LS('Simulation Speed')));
|
|
setStyleName(l_0.element, 'topSpace', true);
|
|
$add_5(this$static.verticalPanel, this$static.speedBar = new Scrollbar(3, 0, 260));
|
|
$add_5(this$static.verticalPanel, l_0 = new Label_1(LS('Current Speed')));
|
|
setStyleName(l_0.element, 'topSpace', true);
|
|
this$static.currentBar = new Scrollbar(50, 1, 100);
|
|
$add_5(this$static.verticalPanel, this$static.currentBar);
|
|
$add_5(this$static.verticalPanel, this$static.powerLabel = new Label_1(LS('Power Brightness')));
|
|
$addStyleName(this$static.powerLabel, 'topSpace');
|
|
$add_5(this$static.verticalPanel, this$static.powerBar = new Scrollbar(50, 1, 100));
|
|
$setPowerBarEnable(this$static);
|
|
l_0 = new Label_1(LS('Current Circuit:'));
|
|
setStyleName(l_0.element, 'topSpace', true);
|
|
this$static.titleLabel = new Label_1('Label');
|
|
$add_5(this$static.verticalPanel, l_0);
|
|
$add_5(this$static.verticalPanel, this$static.titleLabel);
|
|
$add_5(this$static.verticalPanel, this$static.iFrame = new Frame_0);
|
|
$setWidth(this$static.iFrame, VERTICALPANELWIDTH + 'px');
|
|
$setHeight(this$static.iFrame, '100 px');
|
|
$getElement(this$static.iFrame).setAttribute('scrolling', 'no');
|
|
$setGrid(this$static);
|
|
this$static.app.mouse = this$static.mouse = new MouseManager(this$static.app, this$static);
|
|
$register_0(this$static.mouse, this$static.cv);
|
|
$enableDisableMenuItems(this$static.mouse);
|
|
$setiFrameHeight(this$static);
|
|
$addDomHandler(menuBar, new UIManager$8(this$static), (null , TYPE_1));
|
|
addNativePreviewHandler(this$static.app);
|
|
addWindowClosingHandler(new UIManager$9(this$static));
|
|
}
|
|
|
|
function $isReadOnly(this$static){
|
|
return this$static.menus.noEditCheckItem.on || this$static.subcircuitStack.arrayList.array.length != 0;
|
|
}
|
|
|
|
function $isSelection(this$static){
|
|
var ce, ce$iterator;
|
|
for (ce$iterator = new ArrayList$1(this$static.elmList.arrayList); ce$iterator.i < ce$iterator.this$01.array.length;) {
|
|
ce = $next_4(ce$iterator);
|
|
if (ce.selected_0)
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
function $loadShortcuts(this$static){
|
|
var arr, c, className, i, item_0, j, keys_0, stor, str;
|
|
stor = (!localStorage_0 && ($clinit_Storage$StorageSupportDetector() , localStorageSupported) && (localStorage_0 = new Storage_0('localStorage')) , localStorage_0);
|
|
if (!stor)
|
|
return;
|
|
str = $getItem_0(stor.storage, 'shortcuts');
|
|
if (str == null)
|
|
return;
|
|
keys_0 = $split_1(str, ';', 0);
|
|
$reset_13(this$static.app.shortcuts);
|
|
for (i = 0; i != this$static.mainMenuItems.arrayList.array.length; i++) {
|
|
item_0 = $get_4(this$static.mainMenuItems, i);
|
|
if (item_0.shortcut.length > 1)
|
|
break;
|
|
item_0.shortcut = '';
|
|
}
|
|
for (i = 1; i < keys_0.length; i++) {
|
|
arr = $split_1(keys_0[i], '=', 0);
|
|
if (arr.length != 2)
|
|
continue;
|
|
c = __parseAndValidateInt(arr[0], 10);
|
|
className = arr[1];
|
|
$put_0(this$static.app.shortcuts, valueOf_0(c), className);
|
|
for (j = 0; j != this$static.mainMenuItems.arrayList.array.length; j++) {
|
|
if (maskUndefined($get_4(this$static.mainMenuItemNames, j)) === maskUndefined(className)) {
|
|
item_0 = $get_4(this$static.mainMenuItems, j);
|
|
$setShortcut(item_0, String.fromCharCode(c & $intern_8));
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
function $onPreviewNativeEvent(this$static, e){
|
|
var c, cc, ce, cmd, code_0, customShortcutHandled, dlg, dx, dy, hasSel, i, i0, keyStr, lastArg, parts, placeholder, released, se, t, toggled;
|
|
cc = e.nativeEvent.charCode || 0;
|
|
t = $getTypeInt(e.nativeEvent);
|
|
code_0 = e.nativeEvent.keyCode | 0;
|
|
if (this$static.mouse.toolbarDragClass != null) {
|
|
if (t == 64) {
|
|
e.nativeEvent.preventDefault();
|
|
$toolbarDragMove(this$static.mouse, (e.nativeEvent.clientX || 0) | 0, (e.nativeEvent.clientY || 0) | 0, !!e.nativeEvent.shiftKey);
|
|
}
|
|
else
|
|
t == 8?$toolbarDragEnd((lastArg = this$static.mouse , (e.nativeEvent.clientX || 0) | 0 , (e.nativeEvent.clientY || 0) | 0 , lastArg)):t == 128 && code_0 == 27 && $cancelToolbarDrag(this$static.mouse);
|
|
}
|
|
if (code_0 == 16) {
|
|
if ((t & 128) != 0) {
|
|
this$static.mouse.netHighlightKeyHeld = true;
|
|
$updateNetHighlight(this$static.mouse);
|
|
$repaint(this$static.app.ui);
|
|
$toolbarDragOrientationChanged(this$static.mouse, true);
|
|
}
|
|
if ((t & 512) != 0) {
|
|
this$static.mouse.netHighlightKeyHeld = false;
|
|
$updateNetHighlight(this$static.mouse);
|
|
$repaint(this$static.app.ui);
|
|
$toolbarDragOrientationChanged(this$static.mouse, false);
|
|
}
|
|
}
|
|
if ($dialogIsShowing(this$static)) {
|
|
if (!!scrollValuePopup && scrollValuePopup.showing && (t & 128) != 0) {
|
|
(code_0 == 27 || code_0 == 32) && $close_0(scrollValuePopup, false);
|
|
code_0 == 13 && $close_0(scrollValuePopup, true);
|
|
}
|
|
if (!!typeScrollPopup && typeScrollPopup.showing && (t & 128) != 0) {
|
|
(code_0 == 27 || code_0 == 32) && $close_1(typeScrollPopup, false);
|
|
code_0 == 13 && $close_1(typeScrollPopup, true);
|
|
}
|
|
dlg = editDialog_0;
|
|
!!diodeModelEditDialog && (dlg = diodeModelEditDialog);
|
|
!!customLogicEditDialog && (dlg = customLogicEditDialog);
|
|
!!dialogShowing && (dlg = dialogShowing);
|
|
if (!!dlg && dlg.showing && (t & 128) != 0) {
|
|
code_0 == 27 && dlg.closeDialog();
|
|
code_0 == 13 && dlg.enterPressed();
|
|
}
|
|
return;
|
|
}
|
|
if ((t & 256) != 0) {
|
|
if (cc == 45) {
|
|
$menuPerformed(this$static.app.commands, 'key', 'zoomout');
|
|
e.isCanceled = true;
|
|
}
|
|
if (cc == 43 || cc == 61) {
|
|
$menuPerformed(this$static.app.commands, 'key', 'zoomin');
|
|
e.isCanceled = true;
|
|
}
|
|
if (cc == 48) {
|
|
$menuPerformed(this$static.app.commands, 'key', 'zoom100');
|
|
e.isCanceled = true;
|
|
}
|
|
if (cc == 47 && $get_1(this$static.app.shortcuts, valueOf_0(47)) == null) {
|
|
$menuPerformed(this$static.app.commands, 'key', 'search');
|
|
e.isCanceled = true;
|
|
}
|
|
}
|
|
if (this$static.menus.noEditCheckItem.on || this$static.subcircuitStack.arrayList.array.length != 0)
|
|
return;
|
|
if ((t & 512) != 0) {
|
|
keyStr = String.fromCharCode(code_0 & $intern_8).toLowerCase();
|
|
released = false;
|
|
for (i = 0; i != this$static.elmList.arrayList.array.length; i++) {
|
|
ce = $get_4(this$static.elmList, i);
|
|
if (instanceOf(ce, 61)) {
|
|
se = ce;
|
|
if (se.momentary && se.keyShortcut != null && $equals_1(se.keyShortcut, keyStr)) {
|
|
se.momentary && se.toggle();
|
|
released = true;
|
|
}
|
|
}
|
|
}
|
|
if (released) {
|
|
this$static.mouse.heldSwitchElm = null;
|
|
$needAnalyze(this$static.app);
|
|
$repaint(this$static.app.ui);
|
|
}
|
|
}
|
|
if ((t & 128) != 0) {
|
|
if (code_0 == 8 || code_0 == 46) {
|
|
if (this$static.app.scopeManager.scopeSelected != -1) {
|
|
$setElm(this$static.app.scopeManager.scopes[this$static.app.scopeManager.scopeSelected], null);
|
|
this$static.app.scopeManager.scopeSelected = -1;
|
|
}
|
|
else {
|
|
this$static.mouse.menuElm = null;
|
|
$pushUndo(this$static.app.undoManager);
|
|
$doDelete(this$static.app.commands, true);
|
|
e.isCanceled = true;
|
|
}
|
|
}
|
|
if (code_0 == 27) {
|
|
this$static.mouse.mouseMode = 6;
|
|
$setCursorStyle(this$static, 'cursorPointer');
|
|
this$static.mouseModeStr = 'Select';
|
|
this$static.mouse.dragElm?$setModeLabel(this$static.toolbar_0, LS('Drag Mouse')):$setModeLabel(this$static.toolbar_0, LS('Mode: ') + ('' + $getStringValue(this$static.app.classToLabelMap, this$static.mouseModeStr)));
|
|
$highlightButton(this$static.toolbar_0, this$static.mouseModeStr);
|
|
this$static.mouse.tempMouseMode = this$static.mouse.mouseMode;
|
|
e.isCanceled = true;
|
|
}
|
|
if (code_0 == 37 || code_0 == 39 || code_0 == 38 || code_0 == 40) {
|
|
dx = 0;
|
|
dy = 0;
|
|
code_0 == 37 && (dx = -this$static.app.gridSize);
|
|
code_0 == 39 && (dx = this$static.app.gridSize);
|
|
code_0 == 38 && (dy = -this$static.app.gridSize);
|
|
code_0 == 40 && (dy = this$static.app.gridSize);
|
|
hasSel = false;
|
|
for (i0 = 0; i0 != this$static.elmList.arrayList.array.length; i0++)
|
|
if ($get_4(this$static.elmList, i0).selected_0) {
|
|
hasSel = true;
|
|
break;
|
|
}
|
|
if (hasSel) {
|
|
$pushUndo(this$static.app.undoManager);
|
|
for (i = 0; i != this$static.elmList.arrayList.array.length; i++) {
|
|
ce = $get_4(this$static.elmList, i);
|
|
ce.selected_0 && ce.move(dx, dy);
|
|
}
|
|
$needAnalyze(this$static.app);
|
|
e.isCanceled = true;
|
|
}
|
|
}
|
|
customShortcutHandled = false;
|
|
placeholder = keyCodeToPlaceholder(code_0, !!e.nativeEvent.shiftKey, !!e.nativeEvent.ctrlKey, !!e.nativeEvent.altKey, !!e.nativeEvent.metaKey);
|
|
if (placeholder >= 0 && !e.nativeEvent.repeat) {
|
|
c = $get_1(this$static.app.shortcuts, valueOf_0(placeholder));
|
|
if (c != null) {
|
|
if ($equals_1(c.substr(0, 4), 'cmd:')) {
|
|
parts = $split_1(c, ':', 0);
|
|
$menuPerformed(this$static.app.commands, parts[1], parts[2]);
|
|
}
|
|
else {
|
|
this$static.mouse.mouseMode = 0;
|
|
$setCursorStyle(this$static, 'cursorCross');
|
|
this$static.mouseModeStr = c;
|
|
this$static.mouse.dragElm?$setModeLabel(this$static.toolbar_0, LS('Drag Mouse')):$setModeLabel(this$static.toolbar_0, LS('Mode: ') + ('' + $getStringValue(this$static.app.classToLabelMap, this$static.mouseModeStr)));
|
|
$highlightButton(this$static.toolbar_0, this$static.mouseModeStr);
|
|
this$static.mouse.tempMouseMode = this$static.mouse.mouseMode;
|
|
}
|
|
e.isCanceled = true;
|
|
customShortcutHandled = true;
|
|
}
|
|
}
|
|
if (!customShortcutHandled && (!!e.nativeEvent.ctrlKey || !!e.nativeEvent.metaKey)) {
|
|
if (code_0 == 67) {
|
|
$menuPerformed(this$static.app.commands, 'key', 'copy');
|
|
e.isCanceled = true;
|
|
}
|
|
if (code_0 == 88) {
|
|
$menuPerformed(this$static.app.commands, 'key', 'cut');
|
|
e.isCanceled = true;
|
|
}
|
|
if (code_0 == 86) {
|
|
$menuPerformed(this$static.app.commands, 'key', 'paste');
|
|
e.isCanceled = true;
|
|
}
|
|
if (code_0 == 90) {
|
|
$menuPerformed(this$static.app.commands, 'key', 'undo');
|
|
e.isCanceled = true;
|
|
}
|
|
if (code_0 == 89) {
|
|
$menuPerformed(this$static.app.commands, 'key', 'redo');
|
|
e.isCanceled = true;
|
|
}
|
|
if (code_0 == 68) {
|
|
$menuPerformed(this$static.app.commands, 'key', 'duplicate');
|
|
e.isCanceled = true;
|
|
}
|
|
if (code_0 == 65) {
|
|
$menuPerformed(this$static.app.commands, 'key', 'selectAll');
|
|
e.isCanceled = true;
|
|
}
|
|
if (code_0 == 80) {
|
|
$menuPerformed(this$static.app.commands, 'key', 'print');
|
|
e.isCanceled = true;
|
|
}
|
|
if (code_0 == 78 && $wnd.openFile != undefined) {
|
|
$menuPerformed(this$static.app.commands, 'key', 'newwindow');
|
|
e.isCanceled = true;
|
|
}
|
|
if (code_0 == 83) {
|
|
cmd = 'exportaslocalfile';
|
|
$wnd.openFile != undefined && (cmd = this$static.menus.saveFileItem.enabled?'save':'saveas');
|
|
$menuPerformed(this$static.app.commands, 'key', cmd);
|
|
e.isCanceled = true;
|
|
}
|
|
if (code_0 == 79) {
|
|
$menuPerformed(this$static.app.commands, 'key', 'importfromlocalfile');
|
|
e.isCanceled = true;
|
|
}
|
|
}
|
|
}
|
|
if ((t & 256) != 0) {
|
|
if (cc >= 32 && cc < 127) {
|
|
keyStr = String.fromCharCode(cc & $intern_8).toLowerCase();
|
|
toggled = false;
|
|
if (!e.nativeEvent.repeat) {
|
|
for (i = 0; i != this$static.elmList.arrayList.array.length; i++) {
|
|
ce = $get_4(this$static.elmList, i);
|
|
if (instanceOf(ce, 61)) {
|
|
se = ce;
|
|
if (se.keyShortcut != null && $equals_1(se.keyShortcut, keyStr)) {
|
|
se.toggle();
|
|
instanceOf(se, 186) || $needAnalyze(this$static.app);
|
|
toggled = true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (toggled) {
|
|
e.isCanceled = true;
|
|
$repaint(this$static.app.ui);
|
|
}
|
|
else {
|
|
c = $get_1(this$static.app.shortcuts, valueOf_0(cc));
|
|
if (c != null) {
|
|
e.isCanceled = true;
|
|
if ($equals_1(c.substr(0, 4), 'cmd:')) {
|
|
parts = $split_1(c, ':', 0);
|
|
$menuPerformed(this$static.app.commands, parts[1], parts[2]);
|
|
return;
|
|
}
|
|
this$static.mouse.mouseMode = 0;
|
|
$setCursorStyle(this$static, 'cursorCross');
|
|
this$static.mouseModeStr = c;
|
|
this$static.mouse.dragElm?$setModeLabel(this$static.toolbar_0, LS('Drag Mouse')):$setModeLabel(this$static.toolbar_0, LS('Mode: ') + ('' + $getStringValue(this$static.app.classToLabelMap, this$static.mouseModeStr)));
|
|
$highlightButton(this$static.toolbar_0, this$static.mouseModeStr);
|
|
this$static.mouse.tempMouseMode = this$static.mouse.mouseMode;
|
|
}
|
|
else if (cc == 32) {
|
|
this$static.mouse.mouseMode = 6;
|
|
$setCursorStyle(this$static, 'cursorPointer');
|
|
this$static.mouseModeStr = 'Select';
|
|
this$static.mouse.dragElm?$setModeLabel(this$static.toolbar_0, LS('Drag Mouse')):$setModeLabel(this$static.toolbar_0, LS('Mode: ') + ('' + $getStringValue(this$static.app.classToLabelMap, this$static.mouseModeStr)));
|
|
$highlightButton(this$static.toolbar_0, this$static.mouseModeStr);
|
|
this$static.mouse.tempMouseMode = this$static.mouse.mouseMode;
|
|
e.isCanceled = true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
function $popSubcircuit(this$static){
|
|
var cce;
|
|
if (this$static.subcircuitStack.arrayList.array.length == 0)
|
|
return;
|
|
$remove_18(this$static.subcircuitStack, this$static.subcircuitStack.arrayList.array.length - 1);
|
|
if (this$static.subcircuitStack.arrayList.array.length == 0)
|
|
this$static.elmList = this$static.app.elmList;
|
|
else {
|
|
cce = $lastElement(this$static.subcircuitStack);
|
|
this$static.elmList = $buildDisplayElmList(cce);
|
|
}
|
|
$updateSubcircuitPath(this$static);
|
|
$analyzeCircuit(this$static.app.sim);
|
|
$centerCircuit(this$static);
|
|
}
|
|
|
|
function $pushSubcircuit(this$static, cce, allElms){
|
|
$add_11(this$static.subcircuitStack, cce);
|
|
this$static.elmList = allElms;
|
|
$updateSubcircuitPath(this$static);
|
|
$analyzeCircuit(this$static.app.sim);
|
|
$centerCircuit(this$static);
|
|
}
|
|
|
|
function $removeWidgetFromVerticalPanel_0(this$static, w){
|
|
if (!this$static.verticalPanel)
|
|
return;
|
|
$remove_4(this$static.verticalPanel, w);
|
|
!!this$static.iFrame && $setiFrameHeight(this$static);
|
|
}
|
|
|
|
function $repaint(this$static){
|
|
if (!this$static.needsRepaint) {
|
|
this$static.needsRepaint = true;
|
|
scheduleFixedDelayImpl(($clinit_SchedulerImpl() , new UIManager$10(this$static)), 16);
|
|
}
|
|
}
|
|
|
|
function $resetAction(this$static){
|
|
var ce, ce$iterator;
|
|
this$static.app.consoleExceptionOccurred = false;
|
|
this$static.app.analyzeFlag = true;
|
|
this$static.app.autoDCOnReset && (this$static.app.dcAnalysisFlag = true);
|
|
this$static.app.sim.t == 0 && $setSimRunning_0(this$static, true);
|
|
$resetTime(this$static.app.sim);
|
|
for (ce$iterator = new ArrayList$1(this$static.elmList.arrayList); ce$iterator.i < ce$iterator.this$01.array.length;) {
|
|
ce = $next_4(ce$iterator);
|
|
ce.reset_0();
|
|
}
|
|
$resetGraphs(this$static.app.scopeManager);
|
|
$repaint(this$static);
|
|
}
|
|
|
|
function $saveShortcuts(this$static){
|
|
var entry, entry$iterator, stor, str;
|
|
stor = (!localStorage_0 && ($clinit_Storage$StorageSupportDetector() , localStorageSupported) && (localStorage_0 = new Storage_0('localStorage')) , localStorage_0);
|
|
if (!stor)
|
|
return;
|
|
str = '1';
|
|
for (entry$iterator = new AbstractHashMap$EntrySetIterator((new AbstractHashMap$EntrySet(this$static.app.shortcuts)).this$01); entry$iterator.hasNext;) {
|
|
entry = $next_2(entry$iterator);
|
|
str += ';' + entry.getKey() + '=' + entry.getValue();
|
|
}
|
|
$setItem_0(stor.storage, 'shortcuts', str);
|
|
}
|
|
|
|
function $setCanvasSize(this$static){
|
|
var barTop, height, scale, width_0;
|
|
width_0 = $getOffsetWidth(get_0());
|
|
height = $getOffsetHeight(get_0());
|
|
height = height - (this$static.hideMenu?0:30);
|
|
$isMobile(this$static.sidePanelCheckboxLabel) || (width_0 = width_0 - VERTICALPANELWIDTH);
|
|
this$static.menus.toolbarCheckItem.on && (height -= 40);
|
|
width_0 = $wnd.Math.max(width_0, 0);
|
|
height = $wnd.Math.max(height, 0);
|
|
if (this$static.cv) {
|
|
$setWidth(this$static.cv, width_0 + 'PX');
|
|
$setHeight(this$static.cv, height + 'PX');
|
|
this$static.canvasWidth = width_0;
|
|
this$static.canvasHeight = height;
|
|
scale = window.devicePixelRatio;
|
|
$setCoordinateSpaceWidth(this$static.cv, round_int(width_0 * scale));
|
|
$setCoordinateSpaceHeight(this$static.cv, round_int(height * scale));
|
|
}
|
|
$setCircuitArea(this$static);
|
|
if (this$static.subcircuitBar) {
|
|
barTop = this$static.hideMenu?0:30;
|
|
this$static.menus.toolbarCheckItem.on && (barTop += 40);
|
|
$updatePosition(this$static.subcircuitBar, barTop, width_0);
|
|
}
|
|
(this$static.app.transform_0[0] == 0 || ($clinit_System() , lt(sub_1(fromDouble_0(Date.now()), this$static.lastResizeTime), $intern_22))) && $centerCircuit(this$static);
|
|
}
|
|
|
|
function $setCircuitArea(this$static){
|
|
var h, height, width_0;
|
|
height = this$static.canvasHeight;
|
|
width_0 = this$static.canvasWidth;
|
|
!this$static.app.scopeManager || this$static.app.scopeManager.scopeCount == 0?(h = 0):(h = round_int(height * this$static.app.scopeManager.scopeHeightFraction));
|
|
this$static.app.circuitArea = new Rectangle_0(0, 0, width_0, height - h);
|
|
}
|
|
|
|
function $setCircuitTitle_0(this$static, s){
|
|
$setText_0(this$static.titleLabel, s == null?null:$replace_0(s, '_', '_\u200B'));
|
|
s != null && s.length > 0?$setTitle_0($doc, s + ' - ' + 'Circuit Simulator'):($doc.title = 'Circuit Simulator' , undefined);
|
|
}
|
|
|
|
function $setColors(this$static, positiveColor, negativeColor, neutralColor, selectColor, currentColor){
|
|
var stor;
|
|
stor = (!localStorage_0 && ($clinit_Storage$StorageSupportDetector() , localStorageSupported) && (localStorage_0 = new Storage_0('localStorage')) , localStorage_0);
|
|
if (stor) {
|
|
positiveColor == null && (positiveColor = $getItem_0(stor.storage, 'positiveColor'));
|
|
negativeColor == null && (negativeColor = $getItem_0(stor.storage, 'negativeColor'));
|
|
neutralColor == null && (neutralColor = $getItem_0(stor.storage, 'neutralColor'));
|
|
selectColor == null && (selectColor = $getItem_0(stor.storage, 'selectColor'));
|
|
currentColor == null && (currentColor = $getItem_0(stor.storage, 'currentColor'));
|
|
}
|
|
positiveColor != null?(positiveColor_0 = new Color_1((throwIfNull('encodedURLComponent', positiveColor) , decodeQueryStringImpl(positiveColor)))):$getOptionFromStorage('alternativeColor', false)?(positiveColor_0 = ($clinit_Color() , blue)):(positiveColor_0 = ($clinit_Color() , green));
|
|
negativeColor != null?(negativeColor_0 = new Color_1((throwIfNull('encodedURLComponent', negativeColor) , decodeQueryStringImpl(negativeColor)))):(negativeColor_0 = ($clinit_Color() , red));
|
|
neutralColor != null?(neutralColor_0 = new Color_1((throwIfNull('encodedURLComponent', neutralColor) , decodeQueryStringImpl(neutralColor)))):(neutralColor_0 = ($clinit_Color() , gray));
|
|
selectColor != null?(selectColor_0 = new Color_1((throwIfNull('encodedURLComponent', selectColor) , decodeQueryStringImpl(selectColor)))):(selectColor_0 = ($clinit_Color() , cyan));
|
|
currentColor != null?(currentColor_0 = new Color_1((throwIfNull('encodedURLComponent', currentColor) , decodeQueryStringImpl(currentColor)))):(currentColor_0 = this$static.menus.conventionCheckItem.on?($clinit_Color() , yellow):($clinit_Color() , cyan));
|
|
setColorScale();
|
|
}
|
|
|
|
function $setCursorStyle(this$static, s){
|
|
this$static.lastCursorStyle != null && $removeStyleName(this$static.cv, this$static.lastCursorStyle);
|
|
$addStyleName(this$static.cv, s);
|
|
this$static.lastCursorStyle = s;
|
|
}
|
|
|
|
function $setGrid(this$static){
|
|
this$static.app.gridSize = this$static.menus.smallGridCheckItem.on?8:16;
|
|
this$static.app.gridMask = ~(this$static.app.gridSize - 1);
|
|
this$static.app.gridRound = (this$static.app.gridSize / 2 | 0) - 1;
|
|
}
|
|
|
|
function $setMouseMode_0(this$static, mode){
|
|
this$static.mouse.mouseMode = mode;
|
|
mode == 0?$setCursorStyle(this$static, 'cursorCross'):$setCursorStyle(this$static, 'cursorPointer');
|
|
}
|
|
|
|
function $setOptionInStorage(key, val){
|
|
var stor;
|
|
stor = (!localStorage_0 && ($clinit_Storage$StorageSupportDetector() , localStorageSupported) && (localStorage_0 = new Storage_0('localStorage')) , localStorage_0);
|
|
if (!stor)
|
|
return;
|
|
$setItem_0(stor.storage, key, val?'true':'false');
|
|
}
|
|
|
|
function $setPowerBarEnable(this$static){
|
|
if (this$static.menus.powerCheckItem.on) {
|
|
$setStyleName_0(this$static.powerLabel, 'disabled', false);
|
|
$enable(this$static.powerBar);
|
|
}
|
|
else {
|
|
$setStyleName_0(this$static.powerLabel, 'disabled', true);
|
|
$disable(this$static.powerBar);
|
|
}
|
|
}
|
|
|
|
function $setSimRunning_0(this$static, s){
|
|
if (s) {
|
|
if (this$static.app.stopMessage != null)
|
|
return;
|
|
this$static.app.simRunning = true;
|
|
$setHTML(this$static.runStopButton, ($clinit_SafeHtmlUtils() , (new SafeHtmlString(LS('<strong>RUN<\/strong> / Stop'))).html));
|
|
$setStylePrimaryName(this$static.runStopButton, 'topButton');
|
|
$scheduleRepeating(this$static.app.timer, 16);
|
|
}
|
|
else {
|
|
this$static.app.simRunning = false;
|
|
$setHTML(this$static.runStopButton, ($clinit_SafeHtmlUtils() , (new SafeHtmlString(LS('Run / <strong>STOP<\/strong>'))).html));
|
|
$setStylePrimaryName(this$static.runStopButton, 'topButton-red');
|
|
$cancel_0(this$static.app.timer);
|
|
$repaint(this$static);
|
|
}
|
|
}
|
|
|
|
function $setToolbar(this$static){
|
|
$setWidgetHidden(this$static.layoutPanel, this$static.toolbar_0, !this$static.menus.toolbarCheckItem.on);
|
|
$setCanvasSize(this$static);
|
|
}
|
|
|
|
function $setWheelSensitivity(this$static){
|
|
var stor;
|
|
this$static.mouse.wheelSensitivity = 1;
|
|
try {
|
|
stor = (!localStorage_0 && ($clinit_Storage$StorageSupportDetector() , localStorageSupported) && (localStorage_0 = new Storage_0('localStorage')) , localStorage_0);
|
|
this$static.mouse.wheelSensitivity = __parseAndValidateDouble($getItem_0(stor.storage, 'wheelSensitivity'));
|
|
}
|
|
catch ($e0) {
|
|
$e0 = toJava($e0);
|
|
if (!instanceOf($e0, 13))
|
|
throw toJs($e0);
|
|
}
|
|
}
|
|
|
|
function $setiFrameHeight(this$static){
|
|
var cumheight, i, ih;
|
|
if (!this$static.iFrame)
|
|
return;
|
|
cumheight = 0;
|
|
for (i = 0; i < $getWidgetIndex(this$static.verticalPanel, this$static.iFrame); i++) {
|
|
if ($getWidget(this$static.verticalPanel, i) != this$static.loadFileInput) {
|
|
cumheight = cumheight + $getWidget(this$static.verticalPanel, i).getOffsetHeight();
|
|
($getWidget(this$static.verticalPanel, i).getStyleElement().className || '').indexOf('topSpace') != -1 && (cumheight += 12);
|
|
}
|
|
}
|
|
ih = $getOffsetHeight(get_0()) - (this$static.hideMenu?0:30) - cumheight;
|
|
ih < 0 && (ih = 0);
|
|
$setHeight(this$static.iFrame, ih + 'px');
|
|
}
|
|
|
|
function $updateCircuit(this$static){
|
|
var c, ce, ce$iterator, cn, cx, cy, didAnalyze, e, g, gx, gy, height, i, i0, inc, perfmon, perfmonResult, rw, scale, sp, splits, sysTime, x_0, y_0, sb, hook;
|
|
perfmon = new PerfMonitor;
|
|
$startContext(perfmon, 'updateCircuit()');
|
|
$getCoordinateSpaceWidth(this$static.cv) != round_int(this$static.canvasWidth * window.devicePixelRatio) && $setCanvasSize(this$static);
|
|
didAnalyze = this$static.app.analyzeFlag;
|
|
if (this$static.app.analyzeFlag || this$static.app.dcAnalysisFlag) {
|
|
$startContext(perfmon, 'analyzeCircuit()');
|
|
$analyzeCircuit(this$static.app.sim);
|
|
this$static.app.analyzeFlag = false;
|
|
$stopContext(perfmon);
|
|
}
|
|
if (this$static.app.sim.needsStamp && this$static.app.simRunning) {
|
|
$startContext(perfmon, 'stampCircuit()');
|
|
try {
|
|
$preStampAndStampCircuit(this$static.app.sim);
|
|
}
|
|
catch ($e0) {
|
|
$e0 = toJava($e0);
|
|
if (instanceOf($e0, 13)) {
|
|
$stop(this$static.app.sim, 'Exception in stampCircuit()', null);
|
|
}
|
|
else
|
|
throw toJs($e0);
|
|
}
|
|
$stopContext(perfmon);
|
|
}
|
|
!!this$static.app.stopElm && this$static.app.stopElm != this$static.mouse.mouseElm && this$static.app.stopElm.setMouseElm(true);
|
|
$setupScopes(this$static.app.scopeManager);
|
|
g = new Graphics(this$static.cvcontext);
|
|
if (this$static.menus.printableCheckItem.on) {
|
|
whiteColor = ($clinit_Color() , black);
|
|
lightGrayColor = black;
|
|
$setColor_0(g, white);
|
|
$getElement(this$static.cv).style['backgroundColor'] = '#fff';
|
|
}
|
|
else {
|
|
whiteColor = ($clinit_Color() , white);
|
|
lightGrayColor = lightGray;
|
|
$setColor_0(g, black);
|
|
$getElement(this$static.cv).style['backgroundColor'] = '#000';
|
|
}
|
|
$fillRect_0(g, 0, 0, this$static.canvasWidth, this$static.canvasHeight);
|
|
if (this$static.app.simRunning) {
|
|
this$static.app.sim.needsStamp && (console.log('needsStamp while simRunning?') , undefined);
|
|
$startContext(perfmon, 'runCircuit()');
|
|
try {
|
|
$runCircuit(this$static.app.sim, didAnalyze);
|
|
}
|
|
catch ($e1) {
|
|
$e1 = toJava($e1);
|
|
if (instanceOf($e1, 13)) {
|
|
e = $e1;
|
|
debugger_0();
|
|
console.log('exception in runCircuit ' + e);
|
|
$printStackTraceImpl(e, ($clinit_System() , err_0), '');
|
|
this$static.app.consoleExceptionOccurred = true;
|
|
}
|
|
else
|
|
throw toJs($e1);
|
|
}
|
|
$stopContext(perfmon);
|
|
}
|
|
sysTime = ($clinit_System() , fromDouble_0(Date.now()));
|
|
if (this$static.app.simRunning) {
|
|
if (neq(this$static.lastTime, 0)) {
|
|
inc = toInt_0(sub_1(sysTime, this$static.lastTime));
|
|
c = this$static.currentBar.val_0;
|
|
c = $wnd.Math.exp(c / 3.5 - 14.2);
|
|
currentMult_0 = 1.7 * inc * c;
|
|
this$static.menus.conventionCheckItem.on || (currentMult_0 = -currentMult_0);
|
|
}
|
|
this$static.lastTime = sysTime;
|
|
}
|
|
else {
|
|
this$static.lastTime = 0;
|
|
}
|
|
if (gte_0(sub_1(sysTime, this$static.secTime), $intern_22)) {
|
|
this$static.framerate = this$static.frames_0;
|
|
this$static.steprate = this$static.steps;
|
|
this$static.frames_0 = 0;
|
|
this$static.steps = 0;
|
|
this$static.secTime = sysTime;
|
|
}
|
|
powerMult = $wnd.Math.exp(this$static.powerBar.val_0 / 4.762 - 7);
|
|
$startContext(perfmon, 'graphics');
|
|
$setFont_0(g, unitsFont);
|
|
$setLineCap(g.context, ($clinit_Context2d$LineCap() , ROUND).value_0);
|
|
this$static.menus.noEditCheckItem.on && (g.context.save() , $setColor_0(g, new Color(209, 75, 75)) , g.context.lineWidth = 3 , g.context.fillRect(20, 30, 30, 20) , g.context.beginPath() , g.context.moveTo(25, 30) , g.context.lineTo(25, 26) , g.context.arc(35, 26, 10, -3.1415, 0, false) , g.context.lineTo(45, 30) , g.context.stroke() , g.context.restore() , undefined);
|
|
$setColor_0(g, ($clinit_Color() , white));
|
|
scale = window.devicePixelRatio;
|
|
$setTransform(this$static.cvcontext, this$static.app.transform_0[0] * scale, 0, 0, this$static.app.transform_0[3] * scale, this$static.app.transform_0[4] * scale, this$static.app.transform_0[5] * scale);
|
|
$startContext(perfmon, 'elm.draw()');
|
|
try {
|
|
for (ce$iterator = new ArrayList$1(this$static.elmList.arrayList); ce$iterator.i < ce$iterator.this$01.array.length;) {
|
|
ce = $next_4(ce$iterator);
|
|
this$static.menus.powerCheckItem.on && $setColor_0(g, gray);
|
|
ce.draw(g);
|
|
}
|
|
}
|
|
catch ($e2) {
|
|
$e2 = toJava($e2);
|
|
if (instanceOf($e2, 13)) {
|
|
e = $e2;
|
|
debugger_0();
|
|
console.log('exception in elm.draw() ' + e);
|
|
$printStackTraceImpl(e, err_0, '');
|
|
this$static.app.consoleExceptionOccurred = true;
|
|
}
|
|
else
|
|
throw toJs($e2);
|
|
}
|
|
if (this$static.app.stopElm) {
|
|
this$static.menus.powerCheckItem.on && $setColor_0(g, gray);
|
|
this$static.app.stopElm.draw(g);
|
|
}
|
|
$stopContext(perfmon);
|
|
if (this$static.mouse.mouseMode != 2 && this$static.mouse.mouseMode != 3) {
|
|
for (i0 = 0; i0 != this$static.app.postDrawList.arrayList.array.length; i0++)
|
|
drawPost(g, $get_4(this$static.app.postDrawList, i0));
|
|
}
|
|
if (this$static.mouse.tempMouseMode == 2 || this$static.mouse.tempMouseMode == 3 || this$static.mouse.tempMouseMode == 5 || this$static.mouse.tempMouseMode == 4) {
|
|
for (ce$iterator = new ArrayList$1(this$static.elmList.arrayList); ce$iterator.i < ce$iterator.this$01.array.length;) {
|
|
ce = $next_4(ce$iterator);
|
|
if (ce != this$static.mouse.mouseElm || this$static.mouse.tempMouseMode != 5) {
|
|
$setColor_0(g, gray);
|
|
$fillOval(g, ce.x_0 - 3, ce.y_0 - 3, 7);
|
|
$fillOval(g, ce.x2 - 3, ce.y2 - 3, 7);
|
|
}
|
|
else {
|
|
$drawHandles(ce, g, selectColor_0);
|
|
}
|
|
}
|
|
}
|
|
if (this$static.mouse.tempMouseMode == 6 && !!this$static.mouse.mouseElm) {
|
|
$drawHandles(this$static.mouse.mouseElm, g, selectColor_0);
|
|
if (instanceOf(this$static.mouse.mouseElm, 137) && this$static.mouse.mouseCursorX >= 0) {
|
|
rw = this$static.mouse.mouseElm;
|
|
gx = $inverseTransformX(this$static.mouse, this$static.mouse.mouseCursorX);
|
|
gy = $inverseTransformY(this$static.mouse, this$static.mouse.mouseCursorY);
|
|
sp = $getSnapPointOnWire(rw, gx, gy);
|
|
if (sp) {
|
|
$setColor_0(g, selectColor_0);
|
|
$fillOval(g, sp.x_0 - 4, sp.y_0 - 4, 9);
|
|
}
|
|
}
|
|
}
|
|
if (!!this$static.mouse.dragElm && (this$static.mouse.dragElm.x_0 != this$static.mouse.dragElm.x2 || this$static.mouse.dragElm.y_0 != this$static.mouse.dragElm.y2)) {
|
|
this$static.mouse.dragElm.draw(g);
|
|
$drawHandles(this$static.mouse.dragElm, g, selectColor_0);
|
|
}
|
|
for (i = 0; i != this$static.app.badConnectionList.arrayList.array.length; i++) {
|
|
cn = $get_4(this$static.app.badConnectionList, i);
|
|
$setColor_0(g, red);
|
|
$fillOval(g, cn.x_0 - 3, cn.y_0 - 3, 7);
|
|
}
|
|
if (this$static.mouse.selectedArea) {
|
|
$setColor_0(g, selectColor_0);
|
|
$drawRect(g, this$static.mouse.selectedArea.x_0, this$static.mouse.selectedArea.y_0, this$static.mouse.selectedArea.width_0, this$static.mouse.selectedArea.height_0);
|
|
}
|
|
if (this$static.menus.crossHairCheckItem.on && this$static.mouse.mouseCursorX >= 0 && this$static.mouse.mouseCursorX <= this$static.app.circuitArea.width_0 && this$static.mouse.mouseCursorY <= this$static.app.circuitArea.height_0) {
|
|
$setColor_0(g, gray);
|
|
x_0 = $snapGrid_0(this$static.app, $inverseTransformX(this$static.mouse, this$static.mouse.mouseCursorX));
|
|
y_0 = $snapGrid_0(this$static.app, $inverseTransformY(this$static.mouse, this$static.mouse.mouseCursorY));
|
|
$drawLine(g, x_0, $inverseTransformY(this$static.mouse, 0), x_0, $inverseTransformY(this$static.mouse, this$static.app.circuitArea.height_0));
|
|
$drawLine(g, $inverseTransformX(this$static.mouse, 0), y_0, $inverseTransformX(this$static.mouse, this$static.app.circuitArea.width_0), y_0);
|
|
}
|
|
$setTransform(this$static.cvcontext, scale, 0, 0, scale, 0, 0);
|
|
$startContext(perfmon, 'drawBottomArea()');
|
|
$drawBottomArea(this$static, g);
|
|
$stopContext(perfmon);
|
|
$setColor_0(g, white);
|
|
$stopContext(perfmon);
|
|
!!this$static.app.stopElm && this$static.app.stopElm != this$static.mouse.mouseElm && this$static.app.stopElm.setMouseElm(false);
|
|
++this$static.frames_0;
|
|
if (this$static.app.dcAnalysisFlag) {
|
|
this$static.app.dcAnalysisFlag = false;
|
|
this$static.app.analyzeFlag = true;
|
|
}
|
|
this$static.lastFrameTime = this$static.lastTime;
|
|
$stopContext(perfmon);
|
|
if (this$static.app.developerMode) {
|
|
height = 15;
|
|
$drawString(g, 'Framerate: ' + $format_0(showFormat, this$static.framerate), 10, 15);
|
|
$drawString(g, 'Steprate: ' + $format_0(showFormat, this$static.steprate), 10, height += 15);
|
|
$drawString(g, 'Steprate/iter: ' + $format_0(showFormat, this$static.steprate / $getIterCount(this$static.app)), 10, height += 15);
|
|
$drawString(g, 'iterc: ' + $format_0(showFormat, $getIterCount(this$static.app)), 10, height += 15);
|
|
$drawString(g, 'Frames: ' + this$static.frames_0, 10, height += 15);
|
|
if (this$static.mouse.mouseCursorX >= 0) {
|
|
cx = $inverseTransformX(this$static.mouse, this$static.mouse.mouseCursorX);
|
|
cy = $inverseTransformY(this$static.mouse, this$static.mouse.mouseCursorY);
|
|
$drawString(g, 'Mouse: (' + cx + ', ' + cy + ')', 10, height += 15);
|
|
}
|
|
height += 30;
|
|
perfmonResult = (sb = new StringBuilder , buildStringInternal(sb, perfmon.rootCtxName, perfmon.rootCtx, 0) , sb).string;
|
|
splits = $split_1(perfmonResult, '\n', 0);
|
|
for (x_0 = 0; x_0 < splits.length; x_0++) {
|
|
$fillText(g.context, splits[x_0], 10, height + 15 * x_0);
|
|
}
|
|
}
|
|
try {
|
|
hook = $wnd.CircuitJS1.onupdate;
|
|
hook && hook($wnd.CircuitJS1);
|
|
}
|
|
catch ($e3) {
|
|
$e3 = toJava($e3);
|
|
if (!instanceOf($e3, 13))
|
|
throw toJs($e3);
|
|
}
|
|
}
|
|
|
|
function $updateContextButtons(this$static){
|
|
$setContextInfo(this$static.subcircuitBar, $getEditingModelName(this$static.app));
|
|
}
|
|
|
|
function $updateSubcircuitPath(this$static){
|
|
var i, sb;
|
|
if (this$static.subcircuitStack.arrayList.array.length == 0) {
|
|
$setSubcircuitPath(this$static.subcircuitBar, null);
|
|
}
|
|
else {
|
|
sb = new StringBuilder_1(LS('Viewing: '));
|
|
for (i = 0; i < this$static.subcircuitStack.arrayList.array.length; i++) {
|
|
i > 0 && (sb.string += ' > ' , sb);
|
|
$append_4(sb, $get_4(this$static.subcircuitStack, i).modelName);
|
|
}
|
|
$setSubcircuitPath(this$static.subcircuitBar, sb.string);
|
|
}
|
|
}
|
|
|
|
function $updateToolbar(this$static){
|
|
this$static.mouse.dragElm?$setModeLabel(this$static.toolbar_0, LS('Drag Mouse')):$setModeLabel(this$static.toolbar_0, LS('Mode: ') + ('' + $getStringValue(this$static.app.classToLabelMap, this$static.mouseModeStr)));
|
|
$highlightButton(this$static.toolbar_0, this$static.mouseModeStr);
|
|
}
|
|
|
|
function UIManager(app){
|
|
this.mainMenuItems = new Vector;
|
|
this.mainMenuItemNames = new Vector;
|
|
this.subcircuitStack = new Vector;
|
|
this.app = app;
|
|
theUI = this;
|
|
}
|
|
|
|
function max_3(a, b){
|
|
return a > b?a:b;
|
|
}
|
|
|
|
function min_2(a, b){
|
|
return a < b?a:b;
|
|
}
|
|
|
|
defineClass(526, 1, {}, UIManager);
|
|
_.canvasHeight = 0;
|
|
_.canvasWidth = 0;
|
|
_.contextPanel = null;
|
|
_.framerate = 0;
|
|
_.frames_0 = 0;
|
|
_.hideInfoBox = false;
|
|
_.hideMenu = false;
|
|
_.lastFrameTime = 0;
|
|
_.lastResizeTime = 0;
|
|
_.lastTime = 0;
|
|
_.mouseModeStr = 'Select';
|
|
_.needsRepaint = false;
|
|
_.secTime = 0;
|
|
_.steprate = 0;
|
|
_.steps = 0;
|
|
var VERTICALPANELWIDTH = 166, theUI;
|
|
var Lcom_lushprojects_circuitjs1_client_UIManager_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'UIManager', 526);
|
|
function UIManager$1(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(527, 1, {}, UIManager$1);
|
|
_.execute_1 = function execute_49(){
|
|
$setOptionInStorage('euroResistors', this.this$01.menus.euroResistorCheckItem.on);
|
|
$setEuroResistors(this.this$01.toolbar_0, this.this$01.menus.euroResistorCheckItem.on);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_UIManager$1_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'UIManager/1', 527);
|
|
function UIManager$10(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(536, 1, {}, UIManager$10);
|
|
_.execute_0 = function execute_50(){
|
|
$updateCircuit(this.this$01);
|
|
this.this$01.needsRepaint = false;
|
|
return false;
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_UIManager$10_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'UIManager/10', 536);
|
|
function UIManager$2(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(528, 1, {}, UIManager$2);
|
|
_.execute_1 = function execute_51(){
|
|
var ce, ce$iterator;
|
|
$setOptionInStorage('euroGates', this.this$01.menus.euroGatesCheckItem.on);
|
|
for (ce$iterator = new ArrayList$1(this.this$01.elmList.arrayList); ce$iterator.i < ce$iterator.this$01.array.length;) {
|
|
ce = $next_4(ce$iterator);
|
|
ce.setPoints();
|
|
}
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_UIManager$2_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'UIManager/2', 528);
|
|
function UIManager$3(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(529, 1, {}, UIManager$3);
|
|
_.execute_1 = function execute_52(){
|
|
var i;
|
|
for (i = 0; i < this.this$01.scopeManager.scopeCount; i++)
|
|
$setRect(this.this$01.scopeManager.scopes[i], this.this$01.scopeManager.scopes[i].rect_0);
|
|
$setOptionInStorage('whiteBackground', this.this$01.menus.printableCheckItem.on);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_UIManager$3_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'UIManager/3', 529);
|
|
function UIManager$4(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(530, 1, {}, UIManager$4);
|
|
_.execute_1 = function execute_53(){
|
|
var cc;
|
|
$setOptionInStorage('conventionalCurrent', this.this$01.menus.conventionCheckItem.on);
|
|
cc = $getHexValue(currentColor_0);
|
|
($equals_1(cc, '#ffff00') || $equals_1(cc, '#00ffff')) && (currentColor_0 = this.this$01.menus.conventionCheckItem.on?($clinit_Color() , yellow):($clinit_Color() , cyan));
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_UIManager$4_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'UIManager/4', 530);
|
|
function UIManager$5(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(531, 1, $intern_41, UIManager$5);
|
|
_.onResize = function onResize_7(event_0){
|
|
this.this$01.lastResizeTime = ($clinit_System() , fromDouble_0(Date.now()));
|
|
$repaint(this.this$01);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_UIManager$5_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'UIManager/5', 531);
|
|
function UIManager$6(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(532, 1, $intern_56, UIManager$6);
|
|
_.onClick = function onClick_57(event_0){
|
|
$resetAction(this.this$01);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_UIManager$6_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'UIManager/6', 532);
|
|
function UIManager$7(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(533, 1, $intern_56, UIManager$7);
|
|
_.onClick = function onClick_58(event_0){
|
|
$setSimRunning_0(this.this$01, !this.this$01.app.simRunning);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_UIManager$7_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'UIManager/7', 533);
|
|
function UIManager$8(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(534, 1, $intern_56, UIManager$8);
|
|
_.onClick = function onClick_59(event_0){
|
|
$doMainMenuChecks(this.this$01.mouse);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_UIManager$8_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'UIManager/8', 534);
|
|
function UIManager$9(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(535, 1, {11:1, 1007:1}, UIManager$9);
|
|
var Lcom_lushprojects_circuitjs1_client_UIManager$9_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'UIManager/9', 535);
|
|
function $doRecover(this$static){
|
|
$pushUndo(this$static);
|
|
$readCircuit_0(this$static.sim.loader, this$static.sim.recovery, 0);
|
|
$allowSave(this$static.sim.ui, false);
|
|
$setEnabled_1(this$static.sim.menus.recoverItem, false);
|
|
}
|
|
|
|
function $doRedo(this$static){
|
|
var ui;
|
|
if (this$static.redoStack.arrayList.array.length == 0)
|
|
return;
|
|
$add_11(this$static.undoStack, new UndoManager$UndoItem(this$static, $dumpCircuit(this$static.sim)));
|
|
ui = $remove_18(this$static.redoStack, this$static.redoStack.arrayList.array.length - 1);
|
|
$loadUndoItem(this$static, ui);
|
|
$setEnabled_1(this$static.sim.menus.redoItem, this$static.redoStack.arrayList.array.length > 0);
|
|
$setEnabled_1(this$static.sim.menus.undoItem, this$static.undoStack.arrayList.array.length > 0);
|
|
}
|
|
|
|
function $doUndo(this$static){
|
|
var ui;
|
|
if (this$static.undoStack.arrayList.array.length == 0)
|
|
return;
|
|
$add_11(this$static.redoStack, new UndoManager$UndoItem(this$static, $dumpCircuit(this$static.sim)));
|
|
ui = $remove_18(this$static.undoStack, this$static.undoStack.arrayList.array.length - 1);
|
|
$loadUndoItem(this$static, ui);
|
|
$setEnabled_1(this$static.sim.menus.redoItem, this$static.redoStack.arrayList.array.length > 0);
|
|
$setEnabled_1(this$static.sim.menus.undoItem, this$static.undoStack.arrayList.array.length > 0);
|
|
}
|
|
|
|
function $enableUndoRedo(this$static){
|
|
$setEnabled_1(this$static.sim.menus.redoItem, this$static.redoStack.arrayList.array.length > 0);
|
|
$setEnabled_1(this$static.sim.menus.undoItem, this$static.undoStack.arrayList.array.length > 0);
|
|
}
|
|
|
|
function $loadUndoItem(this$static, ui){
|
|
$readCircuit_0(this$static.sim.loader, ui.dump_0, 2);
|
|
this$static.sim.transform_0[0] = this$static.sim.transform_0[3] = ui.scale_0;
|
|
this$static.sim.transform_0[4] = ui.transform4;
|
|
this$static.sim.transform_0[5] = ui.transform5;
|
|
}
|
|
|
|
function $pushUndo(this$static){
|
|
var s;
|
|
this$static.redoStack.arrayList.array = initUnidimensionalArray(Ljava_lang_Object_2_classLit, $intern_3, 1, 0, 5, 1);
|
|
s = $dumpCircuit(this$static.sim);
|
|
if (this$static.undoStack.arrayList.array.length > 0 && $compareTo(s, $lastElement(this$static.undoStack).dump_0) == 0)
|
|
return;
|
|
$add_11(this$static.undoStack, new UndoManager$UndoItem(this$static, s));
|
|
$setEnabled_1(this$static.sim.menus.redoItem, this$static.redoStack.arrayList.array.length > 0);
|
|
$setEnabled_1(this$static.sim.menus.undoItem, this$static.undoStack.arrayList.array.length > 0);
|
|
this$static.sim.savedFlag = false;
|
|
}
|
|
|
|
function $readRecovery(this$static){
|
|
var stor;
|
|
stor = (!localStorage_0 && ($clinit_Storage$StorageSupportDetector() , localStorageSupported) && (localStorage_0 = new Storage_0('localStorage')) , localStorage_0);
|
|
if (!stor)
|
|
return;
|
|
this$static.sim.recovery = $getItem_0(stor.storage, 'circuitRecovery');
|
|
}
|
|
|
|
function $writeRecoveryToStorage(this$static){
|
|
var s, stor;
|
|
console.log('write recovery');
|
|
stor = (!localStorage_0 && ($clinit_Storage$StorageSupportDetector() , localStorageSupported) && (localStorage_0 = new Storage_0('localStorage')) , localStorage_0);
|
|
if (!stor)
|
|
return;
|
|
s = $dumpCircuit(this$static.sim);
|
|
$setItem_0(stor.storage, 'circuitRecovery', s);
|
|
}
|
|
|
|
function UndoManager(sim){
|
|
this.sim = sim;
|
|
this.undoStack = new Vector;
|
|
this.redoStack = new Vector;
|
|
}
|
|
|
|
defineClass(537, 1, {}, UndoManager);
|
|
var Lcom_lushprojects_circuitjs1_client_UndoManager_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'UndoManager', 537);
|
|
function UndoManager$UndoItem(this$0, d){
|
|
this.dump_0 = d;
|
|
this.scale_0 = this$0.sim.transform_0[0];
|
|
this.transform4 = this$0.sim.transform_0[4];
|
|
this.transform5 = this$0.sim.transform_0[5];
|
|
}
|
|
|
|
defineClass(259, 1, {259:1}, UndoManager$UndoItem);
|
|
_.scale_0 = 0;
|
|
_.transform4 = 0;
|
|
_.transform5 = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_UndoManager$UndoItem_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'UndoManager/UndoItem', 259);
|
|
function $clinit_UnijunctionElm(){
|
|
$clinit_UnijunctionElm = emptyMethod;
|
|
ujtExternalNodes = stampJavaTypeInfo(getClassLiteralForArray(I_classLit, 1), $intern_25, 7, 15, [1, 2, 3]);
|
|
}
|
|
|
|
function $setup_8(this$static){
|
|
var st;
|
|
this$static.noDiagonal = true;
|
|
this$static.flags |= 1;
|
|
st = new StringTokenizer_0(ujtModelDump, '/');
|
|
$loadComposite(this$static, st, ujtModelString, ujtExternalNodes);
|
|
sim_0.adjustTimeStep = true;
|
|
}
|
|
|
|
function UnijunctionElm(xx, yy){
|
|
$clinit_UnijunctionElm();
|
|
CompositeElm.call(this, xx, yy);
|
|
$setup_8(this);
|
|
}
|
|
|
|
function UnijunctionElm_0(xa, ya, xb, yb, f){
|
|
$clinit_UnijunctionElm();
|
|
CompositeElm_0.call(this, xa, ya, xb, yb, f);
|
|
$setup_8(this);
|
|
}
|
|
|
|
defineClass(406, 110, $intern_85, UnijunctionElm, UnijunctionElm_0);
|
|
_.draw = function draw_88(g){
|
|
var ib1, ib2;
|
|
$setBbox_0(this, this.point1, this.b1[0], 0);
|
|
$setVoltageColor(this, g, this.volts[1]);
|
|
drawThickLine_0(g, this.b1[0], this.b1[1], 3);
|
|
drawThickLine_0(g, this.b1[1], this.b1[2], 3);
|
|
$setVoltageColor(this, g, this.volts[2]);
|
|
drawThickLine_0(g, this.b2[0], this.b2[1], 3);
|
|
drawThickLine_0(g, this.b2[1], this.b2[2], 3);
|
|
$setVoltageColor(this, g, this.volts[0]);
|
|
drawThickLine_0(g, this.emitter[0], this.emitter[1], 3);
|
|
drawThickLine_0(g, this.emitter[1], this.emitter[2], 3);
|
|
$fillPolygon(g, this.arrowPoly);
|
|
$setPowerColor_0(this, g);
|
|
$fillPolygon(g, this.emitterPoly);
|
|
ib2 = -$getCurrentIntoNode(this, 2);
|
|
ib1 = -$getCurrentIntoNode(this, 1);
|
|
this.curcountb2 = $updateDotCount(ib2, this.curcountb2);
|
|
this.curcountb1 = $updateDotCount(ib1, this.curcountb1);
|
|
this.curcounte = $updateDotCount(-ib1 - ib2, this.curcounte);
|
|
if (this.curcountb1 != 0 || this.curcountb2 != 0) {
|
|
$drawDots(g, this.b1[0], this.b1[1], this.curcountb1);
|
|
$drawDots(g, this.b1[1], this.b1[2], $addCurCount(this.curcountb1, 8));
|
|
$drawDots(g, this.b2[0], this.b2[1], this.curcountb2);
|
|
$drawDots(g, this.b2[1], this.b2[2], $addCurCount(this.curcountb2, 8));
|
|
$drawDots(g, this.emitter[0], this.emitter[1], this.curcounte);
|
|
$drawDots(g, this.emitter[1], this.emitter[2], this.curcounte);
|
|
}
|
|
$drawPosts(this, g);
|
|
}
|
|
;
|
|
_.flipX = function flipX_21(c2, count){
|
|
this.dx == 0 && (this.flags ^= 2);
|
|
$flipX(this, c2);
|
|
}
|
|
;
|
|
_.flipXY = function flipXY_18(xmy, count){
|
|
this.flags ^= 2;
|
|
$flipXY(this, xmy);
|
|
}
|
|
;
|
|
_.flipY = function flipY_21(c2, count){
|
|
this.dy == 0 && (this.flags ^= 2);
|
|
$flipY(this, c2);
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_117(){
|
|
return 417;
|
|
}
|
|
;
|
|
_.getInfo_0 = function getInfo_92(arr){
|
|
arr[0] = 'unijunction transistor';
|
|
arr[1] = 'Ie = ' + getUnitText(-$getCurrentIntoNode(this, 0), 'A', false);
|
|
arr[2] = 'Ib2 = ' + getUnitText(-$getCurrentIntoNode(this, 2), 'A', false);
|
|
arr[3] = 'Veb1 = ' + getUnitText(this.volts[0] - this.volts[1], 'V', false);
|
|
arr[4] = 'Vb2b1 = ' + getUnitText(this.volts[2] - this.volts[1], 'V', false);
|
|
arr[5] = 'P = ' + getUnitText($getPower(this), 'W', false);
|
|
}
|
|
;
|
|
_.getPost = function getPost_31(n){
|
|
return n == 0?this.emitter[0]:n == 1?this.b1[0]:this.b2[0];
|
|
}
|
|
;
|
|
_.getPostCount_0 = function getPostCount_83(){
|
|
return 3;
|
|
}
|
|
;
|
|
_.reset_1 = function reset_58(){
|
|
$reset_2(this);
|
|
this.curcountb1 = this.curcountb2 = this.curcounte = 0;
|
|
}
|
|
;
|
|
_.setPoints = function setPoints_79(){
|
|
var flip, hs2, p1, p2, ra;
|
|
$setPoints(this);
|
|
flip = (this.flags & 2) != 0?-1:1;
|
|
hs2 = 16 * this.dsign * flip;
|
|
this.b1 = $newPointArray(3);
|
|
this.b2 = $newPointArray(3);
|
|
this.emitter = $newPointArray(3);
|
|
p1 = $interpPoint_0(this.point1, this.point2, 0, -hs2);
|
|
p2 = $interpPoint_0(this.point1, this.point2, 1, -hs2);
|
|
$interpPoint2(p1, p2, this.b1[0], this.b2[0], 1, -hs2);
|
|
$interpPoint2(p1, p2, this.b1[1], this.b2[1], 1, -hs2 / 2 | 0);
|
|
$interpPoint2(p1, p2, this.b1[2], this.b2[2], 1 - 10 / this.dn, -hs2 / 2 | 0);
|
|
$interpPoint_2(p1, p2, this.emitter[0], 0, hs2);
|
|
$interpPoint_2(p1, p2, this.emitter[1], 1 - 28 / this.dn, hs2);
|
|
this.emitter[2] = $interpPoint(p1, p2, 1 - 14 / this.dn);
|
|
ra = $newPointArray(4);
|
|
$interpPoint2(p1, p2, ra[0], ra[1], 1 - 13 / this.dn, 16);
|
|
$interpPoint2(p1, p2, ra[2], ra[3], 1 - 10 / this.dn, 16);
|
|
this.emitterPoly = $createPolygon_0(ra[0], ra[1], ra[3], ra[2]);
|
|
this.arrowPoly = $calcArrow(this.emitter[1], this.emitter[2], 8, 3);
|
|
}
|
|
;
|
|
_.curcountb1 = 0;
|
|
_.curcountb2 = 0;
|
|
_.curcounte = 0;
|
|
var ujtExternalNodes, ujtModelDump = '2 x2n2646-emitter/0 0 0 0 0 0 0/2 2 1000*a/0 1000000/0 5 0.00028*(a-b)\\p0.00575*(c-d)*e/2 3.5e-11 0 0/0 38.15/0 2518', ujtModelString = 'DiodeElm 1 4\rVoltageElm 4 5\rCCVSElm 4 5 6 0\rResistorElm 0 6\rVCCSElm 5 7 5 7 6 7 5\rCapacitorElm 5 7\rResistorElm 7 2\rResistorElm 3 5';
|
|
var Lcom_lushprojects_circuitjs1_client_UnijunctionElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'UnijunctionElm', 406);
|
|
function VCOElm(xx, yy){
|
|
$clinit_ChipElm();
|
|
ChipElm.call(this, xx, yy);
|
|
}
|
|
|
|
function VCOElm_0(xa, ya, xb, yb, f, st){
|
|
$clinit_ChipElm();
|
|
ChipElm_0.call(this, xa, ya, xb, yb, f, st);
|
|
}
|
|
|
|
defineClass(426, 32, $intern_85, VCOElm, VCOElm_0);
|
|
_.doStep = function doStep_58(){
|
|
var dir_0, vc, vo;
|
|
vc = this.volts[3] - this.volts[2];
|
|
vo = this.volts[1];
|
|
dir_0 = vo < 2.5?1:-1;
|
|
if (vo < 2.5 && vc > 4.5) {
|
|
vo = 5;
|
|
dir_0 = -1;
|
|
}
|
|
if (vo > 2.5 && vc < 0.5) {
|
|
vo = 0;
|
|
dir_0 = 1;
|
|
}
|
|
$updateVoltageSource(this.pins[1].voltSource, vo);
|
|
$stampMatrix_0(this.nodes[2], this.pins[4].voltSource, dir_0);
|
|
$stampMatrix_0(this.nodes[2], this.pins[5].voltSource, dir_0);
|
|
$stampMatrix_0(this.nodes[3], this.pins[4].voltSource, -dir_0);
|
|
$stampMatrix_0(this.nodes[3], this.pins[5].voltSource, -dir_0);
|
|
this.cDir = dir_0;
|
|
}
|
|
;
|
|
_.draw = function draw_89(g){
|
|
var c;
|
|
c = this.cDir * (this.pins[4].current + this.pins[5].current) + (this.volts[3] - this.volts[2]) / $intern_84;
|
|
this.pins[2].current = -c;
|
|
this.pins[3].current = c;
|
|
this.pins[0].current = -this.pins[4].current;
|
|
$drawChip(this, g);
|
|
}
|
|
;
|
|
_.getChipName = function getChipName_33(){
|
|
return 'VCO';
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_118(){
|
|
return 158;
|
|
}
|
|
;
|
|
_.getMatrixConnection = function getMatrixConnection_17(n1, n2){
|
|
return true;
|
|
}
|
|
;
|
|
_.getPostCount_0 = function getPostCount_84(){
|
|
return 6;
|
|
}
|
|
;
|
|
_.getVoltageSourceCount = function getVoltageSourceCount_57(){
|
|
return 3;
|
|
}
|
|
;
|
|
_.isDigitalChip = function isDigitalChip_8(){
|
|
return false;
|
|
}
|
|
;
|
|
_.nonLinear_0 = function nonLinear_32(){
|
|
return true;
|
|
}
|
|
;
|
|
_.setupPins = function setupPins_34(){
|
|
this.sizeX = 2;
|
|
this.sizeY = 4;
|
|
this.pins = initUnidimensionalArray(Lcom_lushprojects_circuitjs1_client_ChipElm$Pin_2_classLit, $intern_3, 9, 6, 0, 1);
|
|
this.pins[0] = new ChipElm$Pin(this, 0, 2, 'Vi');
|
|
this.pins[1] = new ChipElm$Pin(this, 3, 2, 'Vo');
|
|
this.pins[1].output = true;
|
|
this.pins[2] = new ChipElm$Pin(this, 0, 3, 'C');
|
|
this.pins[3] = new ChipElm$Pin(this, 1, 3, 'C');
|
|
this.pins[4] = new ChipElm$Pin(this, 2, 3, 'R1');
|
|
this.pins[4].output = true;
|
|
this.pins[5] = new ChipElm$Pin(this, 3, 3, 'R2');
|
|
this.pins[5].output = true;
|
|
}
|
|
;
|
|
_.stamp = function stamp_73(){
|
|
$stampVoltageSource(ground, this.nodes[1], this.pins[1].voltSource);
|
|
$stampVoltageSource_0(this.nodes[0], this.nodes[4], this.pins[4].voltSource, 0);
|
|
$stampVoltageSource_0(ground, this.nodes[5], this.pins[5].voltSource, 5);
|
|
$stampResistor(this.nodes[2], this.nodes[3], $intern_84);
|
|
}
|
|
;
|
|
_.cDir = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_VCOElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'VCOElm', 426);
|
|
function VCVSElm(xx, yy){
|
|
$clinit_ChipElm();
|
|
VCCSElm.call(this, xx, yy);
|
|
}
|
|
|
|
function VCVSElm_0(xa, ya, xb, yb, f, st){
|
|
$clinit_ChipElm();
|
|
VCCSElm_0.call(this, xa, ya, xb, yb, f, st);
|
|
}
|
|
|
|
defineClass(408, 181, $intern_85, VCVSElm, VCVSElm_0);
|
|
_.doStep = function doStep_59(){
|
|
var convergeLimit, dv, dx, i, rs, v, v0, v2, vn;
|
|
convergeLimit = $getConvergeLimit();
|
|
for (i = 0; i != this.inputCount; i++) {
|
|
$wnd.Math.abs(this.volts[i] - this.lastVolts[i]) > convergeLimit && (sim_0.converged = false);
|
|
}
|
|
vn = this.pins[this.inputCount].voltSource;
|
|
if (this.expr) {
|
|
for (i = 0; i != this.inputCount; i++)
|
|
this.exprState.values[i] = this.volts[i];
|
|
this.exprState.t = sim_0.t;
|
|
v0 = $eval(this.expr, this.exprState);
|
|
$wnd.Math.abs(this.volts[this.inputCount] - this.volts[this.inputCount + 1] - v0) > $wnd.Math.abs(v0) * $intern_34 && sim_0.subIterations < 100 && (sim_0.converged = false);
|
|
rs = v0;
|
|
for (i = 0; i != this.inputCount; i++) {
|
|
dv = this.volts[i] - this.lastVolts[i];
|
|
$wnd.Math.abs(dv) < $intern_82 && (dv = $intern_82);
|
|
this.exprState.values[i] = this.volts[i];
|
|
v = $eval(this.expr, this.exprState);
|
|
this.exprState.values[i] = this.volts[i] - dv;
|
|
v2 = $eval(this.expr, this.exprState);
|
|
dx = (v - v2) / dv;
|
|
$wnd.Math.abs(dx) < $intern_82 && (dx = dx > 0?$intern_82:$intern_101);
|
|
$stampMatrix_1(vn, this.nodes[i], -dx);
|
|
rs -= dx * this.volts[i];
|
|
this.exprState.values[i] = this.volts[i];
|
|
}
|
|
vn.matrix.rightSide[vn.row - 1] += rs;
|
|
}
|
|
for (i = 0; i != this.inputCount; i++)
|
|
this.lastVolts[i] = this.volts[i];
|
|
}
|
|
;
|
|
_.getChipName = function getChipName_34(){
|
|
return 'VCVS';
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_119(){
|
|
return 212;
|
|
}
|
|
;
|
|
_.getPostCount_0 = function getPostCount_85(){
|
|
return this.inputCount + 2;
|
|
}
|
|
;
|
|
_.getVoltageSourceCount = function getVoltageSourceCount_58(){
|
|
return 1;
|
|
}
|
|
;
|
|
_.hasCurrentOutput = function hasCurrentOutput_2(){
|
|
return false;
|
|
}
|
|
;
|
|
_.setCurrent = function setCurrent_12(vs, c){
|
|
if (this.pins[this.inputCount].voltSource == vs) {
|
|
this.pins[this.inputCount].current = c;
|
|
this.pins[this.inputCount + 1].current = -c;
|
|
}
|
|
}
|
|
;
|
|
_.setVoltageSource = function setVoltageSource_19(j, vs){
|
|
$setVoltageSource(this, j, vs);
|
|
$setNodes(vs, this.nodes[this.inputCount + 1], this.nodes[this.inputCount]);
|
|
}
|
|
;
|
|
_.setupPins = function setupPins_35(){
|
|
var i;
|
|
this.sizeX = 2;
|
|
this.sizeY = this.inputCount > 2?this.inputCount:2;
|
|
this.pins = initUnidimensionalArray(Lcom_lushprojects_circuitjs1_client_ChipElm$Pin_2_classLit, $intern_3, 9, this.inputCount + 2, 0, 1);
|
|
for (i = 0; i != this.inputCount; i++)
|
|
this.pins[i] = new ChipElm$Pin(this, i, 2, String.fromCharCode(65 + i & $intern_8));
|
|
this.pins[this.inputCount] = new ChipElm$Pin(this, 0, 3, 'V+');
|
|
this.pins[this.inputCount].output = true;
|
|
this.pins[this.inputCount + 1] = new ChipElm$Pin(this, 1, 3, 'V-');
|
|
this.lastVolts = initUnidimensionalArray(D_classLit, $intern_76, 7, this.inputCount, 15, 1);
|
|
this.exprState = new ExprState;
|
|
$allocNodes(this);
|
|
}
|
|
;
|
|
_.stamp = function stamp_74(){
|
|
$stampVoltageSource(this.nodes[this.inputCount + 1], this.nodes[this.inputCount], this.pins[this.inputCount].voltSource);
|
|
}
|
|
;
|
|
_.stepFinished = function stepFinished_26(){
|
|
$updateLastValues(this.exprState, this.volts[this.inputCount] - this.volts[this.inputCount + 1]);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_VCVSElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'VCVSElm', 408);
|
|
function $createSlider_4(this$static){
|
|
var value_0;
|
|
this$static.waveform = 7;
|
|
$addWidgetToVerticalPanel(app_0, this$static.label_0 = new Label_1(LS(this$static.sliderText)));
|
|
$addStyleName(this$static.label_0, 'topSpace');
|
|
value_0 = round_int((this$static.frequency - this$static.bias) * 100 / (this$static.maxVoltage_0 - this$static.bias));
|
|
$addWidgetToVerticalPanel(app_0, this$static.slider = new Scrollbar_1(value_0, null, this$static));
|
|
}
|
|
|
|
function VarRailElm(xx, yy){
|
|
RailElm_0.call(this, xx, yy, 7);
|
|
this.sliderText = 'Voltage';
|
|
this.frequency = this.maxVoltage_0;
|
|
$createSlider_4(this);
|
|
}
|
|
|
|
function VarRailElm_0(xa, ya, xb, yb, f, st){
|
|
RailElm_1.call(this, xa, ya, xb, yb, f, st);
|
|
this.sliderText = $nextToken(st);
|
|
while ($hasMoreTokens(st))
|
|
this.sliderText += ' ' + $nextToken(st);
|
|
this.sliderText = $replaceAll(this.sliderText, '%2[bB]', '+');
|
|
$createSlider_4(this);
|
|
}
|
|
|
|
defineClass(273, 47, {131:1, 11:1, 8:1, 10:1, 47:1, 273:1, 56:1}, VarRailElm, VarRailElm_0);
|
|
_.delete_0 = function delete_6(){
|
|
$removeWidgetFromVerticalPanel(app_0, this.label_0);
|
|
$removeWidgetFromVerticalPanel(app_0, this.slider);
|
|
mouseElmRef == this && (mouseElmRef = null);
|
|
$deleteSliders(app_0, this);
|
|
}
|
|
;
|
|
_.dumpXml = function dumpXml_92(doc, elem){
|
|
$dumpXml(this, elem);
|
|
dumpAttr_1(elem, 'st', this.sliderText);
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_120(){
|
|
return 172;
|
|
}
|
|
;
|
|
_.getEditInfo = function getEditInfo_82(n){
|
|
var ei;
|
|
if (n == 0)
|
|
return $setUnitStep(new EditInfo_0('Min Voltage', this.bias, -20, 20));
|
|
if (n == 1)
|
|
return $setUnitStep(new EditInfo_0('Max Voltage', this.maxVoltage_0, -20, 20));
|
|
if (n == 2) {
|
|
ei = new EditInfo_0('Slider Text', 0, -1, -1);
|
|
ei.text_0 = this.sliderText;
|
|
return ei;
|
|
}
|
|
return null;
|
|
}
|
|
;
|
|
_.getShortcut = function getShortcut_45(){
|
|
return 0;
|
|
}
|
|
;
|
|
_.getVoltage_0 = function getVoltage_4(){
|
|
this.frequency = this.slider.val_0 * (this.maxVoltage_0 - this.bias) / 100 + this.bias;
|
|
return this.frequency;
|
|
}
|
|
;
|
|
_.onMouseWheel = function onMouseWheel_8(e){
|
|
!!this.slider && $onMouseWheel_0(this.slider, e);
|
|
}
|
|
;
|
|
_.setEditValue = function setEditValue_82(n, ei){
|
|
n == 0 && (this.bias = ei.value_0);
|
|
n == 1 && (this.maxVoltage_0 = ei.value_0);
|
|
if (n == 2) {
|
|
this.sliderText = $getText(ei.textf);
|
|
$setText_0(this.label_0, LS(this.sliderText));
|
|
$setiFrameHeight(app_0.ui);
|
|
}
|
|
}
|
|
;
|
|
_.setMouseElm = function setMouseElm_3(v){
|
|
v?(mouseElmRef = this):mouseElmRef == this && (mouseElmRef = null);
|
|
!!this.slider && $draw_6(this.slider);
|
|
}
|
|
;
|
|
_.undumpXml = function undumpXml_95(xml){
|
|
var value_0;
|
|
$undumpXml(this, xml);
|
|
this.sliderText = $parseStringAttr(xml, 'st', this.sliderText);
|
|
$setText_0(this.label_0, LS(this.sliderText));
|
|
value_0 = round_int((this.frequency - this.bias) * 100 / (this.maxVoltage_0 - this.bias));
|
|
$setValue_2(this.slider, value_0);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_VarRailElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'VarRailElm', 273);
|
|
function VaractorElm(xx, yy){
|
|
DiodeElm.call(this, xx, yy);
|
|
this.baseCapacitance = 4.0E-12;
|
|
}
|
|
|
|
function VaractorElm_0(xa, ya, xb, yb, f, st){
|
|
DiodeElm_0.call(this, xa, ya, xb, yb, f, st);
|
|
this.capvoltdiff = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.baseCapacitance = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
}
|
|
|
|
defineClass(438, 154, $intern_110, VaractorElm, VaractorElm_0);
|
|
_.calculateCurrent = function calculateCurrent_42(){
|
|
this.current_0 = $calculateCurrent_0(this.diode, this.volts[0] - this.volts[this.diodeEndNode]);
|
|
this.current_0 += this.capCurrent;
|
|
}
|
|
;
|
|
_.doStep = function doStep_60(){
|
|
$doStep_0(this.diode, this.volts[0] - this.volts[this.diodeEndNode]);
|
|
$stampResistor(this.nodes[2], this.nodes[1], this.compResistance);
|
|
$updateVoltageSource(this.voltSource, this.voltSourceValue);
|
|
}
|
|
;
|
|
_.draw = function draw_90(g){
|
|
$drawDiode(this, g);
|
|
$setVoltageColor(this, g, this.volts[0]);
|
|
$setPowerColor_0(this, g);
|
|
drawThickLine_0(g, this.plate1[0], this.plate1[1], 3);
|
|
app_0.menus.powerCheckItem.on && $setColor_0(g, ($clinit_Color() , gray));
|
|
$setVoltageColor(this, g, this.volts[1]);
|
|
$setPowerColor_0(this, g);
|
|
drawThickLine_0(g, this.plate2[0], this.plate2[1], 3);
|
|
this.curcount_0 = $updateDotCount(this.current_0, this.curcount_0);
|
|
app_0.mouse.dragElm == this || $drawDots(g, this.point1, this.point2, this.curcount_0);
|
|
$drawPosts(this, g);
|
|
}
|
|
;
|
|
_.dumpXml = function dumpXml_93(doc, elem){
|
|
$dumpXml_6(this, doc, elem);
|
|
dumpAttr(elem, 'ca', this.capvoltdiff);
|
|
dumpAttr(elem, 'ba', this.baseCapacitance);
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_121(){
|
|
return 176;
|
|
}
|
|
;
|
|
_.getEditInfo = function getEditInfo_83(n){
|
|
if (n == 1)
|
|
return new EditInfo_0('Capacitance @ 0V (F)', this.baseCapacitance, 10, $intern_22);
|
|
return $getEditInfo_3(this, n);
|
|
}
|
|
;
|
|
_.getElmType = function getElmType_24(){
|
|
return 'varactor';
|
|
}
|
|
;
|
|
_.getInfo_0 = function getInfo_93(arr){
|
|
$getInfo_3(this, arr);
|
|
arr[0] = 'varactor';
|
|
arr[5] = 'C = ' + getUnitText(this.capacitance, 'F', false);
|
|
}
|
|
;
|
|
_.getInternalNodeCount = function getInternalNodeCount_18(){
|
|
return 1;
|
|
}
|
|
;
|
|
_.getShortcut = function getShortcut_46(){
|
|
return 0;
|
|
}
|
|
;
|
|
_.getVoltageSourceCount = function getVoltageSourceCount_59(){
|
|
return 1;
|
|
}
|
|
;
|
|
_.reset_0 = function reset_59(){
|
|
$reset_3(this);
|
|
this.capvoltdiff = 0;
|
|
}
|
|
;
|
|
_.setCurrent = function setCurrent_13(vs, c){
|
|
this.capCurrent = c;
|
|
}
|
|
;
|
|
_.setEditValue = function setEditValue_83(n, ei){
|
|
if (n == 1) {
|
|
this.baseCapacitance = ei.value_0;
|
|
return;
|
|
}
|
|
$setEditValue_4(this, n, ei);
|
|
}
|
|
;
|
|
_.setPoints = function setPoints_80(){
|
|
var arrowPoint, pa;
|
|
$setPoints_10(this);
|
|
pa = $newPointArray(2);
|
|
$interpPoint2(this.lead1, this.lead2, pa[0], pa[1], 0, 8);
|
|
$interpPoint2(this.lead1, this.lead2, this.cathode_0[0], this.cathode_0[1], 0.6, 8);
|
|
arrowPoint = $interpPoint(this.lead1, this.lead2, 0.6);
|
|
this.poly_0 = $createPolygon(pa[0], pa[1], arrowPoint);
|
|
this.plate1 = $newPointArray(2);
|
|
this.plate2 = $newPointArray(2);
|
|
$interpPoint2(this.lead1, this.lead2, this.plate1[0], this.plate1[1], 0.6, 8);
|
|
$interpPoint2(this.lead1, this.lead2, this.plate2[0], this.plate2[1], 1, 8);
|
|
}
|
|
;
|
|
_.setVoltageSource = function setVoltageSource_20(n, v){
|
|
this.voltSource = v;
|
|
$setNodes(v, this.nodes[0], this.nodes[2]);
|
|
}
|
|
;
|
|
_.stamp = function stamp_75(){
|
|
$stamp_1(this);
|
|
$stampVoltageSource(this.nodes[0], this.nodes[2], this.voltSource);
|
|
}
|
|
;
|
|
_.startIteration = function startIteration_27(){
|
|
var c0;
|
|
c0 = this.baseCapacitance;
|
|
this.capvoltdiff > 0?(this.capacitance = c0):(this.capacitance = c0 / $wnd.Math.pow(1 - this.capvoltdiff / this.model.fwdrop, 0.5));
|
|
this.compResistance = sim_0.timeStep / (2 * this.capacitance);
|
|
this.voltSourceValue = -this.capvoltdiff - this.capCurrent * this.compResistance;
|
|
}
|
|
;
|
|
_.stepFinished = function stepFinished_27(){
|
|
this.capvoltdiff = this.volts[0] - this.volts[1];
|
|
}
|
|
;
|
|
_.undumpXml = function undumpXml_96(xml){
|
|
$undumpXml_4(this, xml);
|
|
this.capvoltdiff = $parseDoubleAttr(xml, 'ca', this.capvoltdiff);
|
|
this.baseCapacitance = $parseDoubleAttr(xml, 'ba', this.baseCapacitance);
|
|
}
|
|
;
|
|
_.baseCapacitance = 0;
|
|
_.capCurrent = 0;
|
|
_.capacitance = 0;
|
|
_.capvoltdiff = 0;
|
|
_.compResistance = 0;
|
|
_.voltSourceValue = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_VaractorElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'VaractorElm', 438);
|
|
function $setNodes(this$static, n1, n2){
|
|
this$static.n1 = n1;
|
|
this$static.n2 = n2;
|
|
}
|
|
|
|
function VoltageSource(){
|
|
}
|
|
|
|
defineClass(136, 1, {136:1}, VoltageSource);
|
|
_.row = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_VoltageSource_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'VoltageSource', 136);
|
|
function $setPoints_29(this$static){
|
|
var ds, p3, p4, p5, p6, p7, p8, r1, r2, r3, r4, sep;
|
|
$setPoints(this$static);
|
|
ds = this$static.dy == 0?sign_0(this$static.dx):-sign_0(this$static.dy);
|
|
p3 = $interpPoint_0(this$static.point1, this$static.point2, 0, -this$static.width_0 * ds);
|
|
p4 = $interpPoint_0(this$static.point1, this$static.point2, 1, -this$static.width_0 * ds);
|
|
sep = app_0.gridSize;
|
|
p5 = $interpPoint(this$static.point1, this$static.point2, sep / this$static.dn);
|
|
p6 = $interpPoint(this$static.point1, this$static.point2, 1 - sep / this$static.dn);
|
|
p7 = $interpPoint(p3, p4, sep / this$static.dn);
|
|
p8 = $interpPoint(p3, p4, 1 - sep / this$static.dn);
|
|
this$static.posts = stampJavaTypeInfo(getClassLiteralForArray(Lcom_lushprojects_circuitjs1_client_Point_2_classLit, 1), $intern_78, 14, 0, [p3, p4, this$static.point1, this$static.point2]);
|
|
this$static.inner = stampJavaTypeInfo(getClassLiteralForArray(Lcom_lushprojects_circuitjs1_client_Point_2_classLit, 1), $intern_78, 14, 0, [p7, p8, p5, p6]);
|
|
r1 = $interpPoint_0(this$static.point1, this$static.point2, sep / this$static.dn, ds * sep);
|
|
r2 = $interpPoint_0(this$static.point1, this$static.point2, 1 - sep / this$static.dn, ds * sep);
|
|
r3 = $interpPoint_0(this$static.point1, this$static.point2, sep / this$static.dn, -ds * (sep + this$static.width_0));
|
|
r4 = $interpPoint_0(this$static.point1, this$static.point2, 1 - sep / this$static.dn, -ds * (sep + this$static.width_0));
|
|
this$static.rectPointsX = stampJavaTypeInfo(getClassLiteralForArray(I_classLit, 1), $intern_25, 7, 15, [r1.x_0, r2.x_0, r4.x_0, r3.x_0]);
|
|
this$static.rectPointsY = stampJavaTypeInfo(getClassLiteralForArray(I_classLit, 1), $intern_25, 7, 15, [r1.y_0, r2.y_0, r4.y_0, r3.y_0]);
|
|
this$static.center = $interpPoint(r1, r4, 0.5);
|
|
this$static.maxTextLen = max_1(abs_0(r1.x_0 - r4.x_0) - 5, 5);
|
|
}
|
|
|
|
function $setup_9(this$static){
|
|
this$static.voltSources = initUnidimensionalArray(Lcom_lushprojects_circuitjs1_client_VoltageSource_2_classLit, $intern_3, 136, 2, 0, 1);
|
|
this$static.currents = initUnidimensionalArray(D_classLit, $intern_76, 7, 2, 15, 1);
|
|
this$static.curcounts = initUnidimensionalArray(D_classLit, $intern_76, 7, 2, 15, 1);
|
|
}
|
|
|
|
function WattmeterElm(xx, yy){
|
|
CircuitElm.call(this, xx, yy);
|
|
$setup_9(this);
|
|
}
|
|
|
|
function WattmeterElm_0(xa, ya, xb, yb, f, st){
|
|
CircuitElm_0.call(this, xa, ya, xb, yb, f);
|
|
this.width_0 = __parseAndValidateInt($nextToken(st), 10);
|
|
try {
|
|
this.meter = __parseAndValidateInt($nextToken(st), 10);
|
|
}
|
|
catch ($e0) {
|
|
$e0 = toJava($e0);
|
|
if (!instanceOf($e0, 13))
|
|
throw toJs($e0);
|
|
}
|
|
$setup_9(this);
|
|
}
|
|
|
|
defineClass(409, 8, $intern_85, WattmeterElm, WattmeterElm_0);
|
|
_.canFlipX = function canFlipX_6(){
|
|
return false;
|
|
}
|
|
;
|
|
_.canFlipY = function canFlipY_7(){
|
|
return false;
|
|
}
|
|
;
|
|
_.canViewInScope = function canViewInScope_8(){
|
|
return true;
|
|
}
|
|
;
|
|
_.drag = function drag_9(xx, yy){
|
|
var w1, w2;
|
|
xx = $snapGrid_0(app_0, xx);
|
|
yy = $snapGrid_0(app_0, yy);
|
|
w1 = max_1(app_0.gridSize, abs_0(yy - this.y_0));
|
|
w2 = max_1(app_0.gridSize, abs_0(xx - this.x_0));
|
|
if (w1 > w2) {
|
|
xx = this.x_0;
|
|
this.width_0 = w2;
|
|
}
|
|
else {
|
|
yy = this.y_0;
|
|
this.width_0 = w1;
|
|
}
|
|
this.x2 = xx;
|
|
this.y2 = yy;
|
|
$setPoints_29(this);
|
|
}
|
|
;
|
|
_.draw = function draw_91(g){
|
|
var flip, fsize, i, str, w;
|
|
for (i = 0; i != 2; i++)
|
|
this.curcounts[i] = $updateDotCount(this.currents[i], this.curcounts[i]);
|
|
flip = 1;
|
|
for (i = 0; i != 4; i++) {
|
|
$setVoltageColor(this, g, this.volts[i]);
|
|
drawThickLine_0(g, this.posts[i], this.inner[i], 3);
|
|
$drawDots(g, this.posts[i], this.inner[i], this.curcounts[i / 2 | 0] * flip);
|
|
flip *= -1;
|
|
}
|
|
$setColor_0(g, mouseElmRef == this || this.selected_0 || $containsKey(app_0.mouse.scopePlotRoles, this) || instanceOf(mouseElmRef, 21) && $getElm_0(mouseElmRef.elmScope) == this || $isOnHighlightedNet(this)?selectColor_0:lightGrayColor);
|
|
drawThickPolygon_0(g, this.rectPointsX, this.rectPointsY, 4);
|
|
$setBbox(this, this.posts[0].x_0, this.posts[0].y_0, this.posts[3].x_0, this.posts[3].y_0);
|
|
$drawPosts(this, g);
|
|
switch (this.meter) {
|
|
case 1:
|
|
str = getUnitText(this.avgPower, 'W(avg)', false);
|
|
break;
|
|
default:str = getUnitText((this.volts[2] - this.volts[0]) * this.currents[1], 'W', false);
|
|
}
|
|
g.context.save();
|
|
g.savedFontSize = g.currentFontSize;
|
|
fsize = 15;
|
|
while (true) {
|
|
$setFont_0(g, new Font('SansSerif', 0, fsize));
|
|
w = round_int($measureText(g.context, str).width);
|
|
if (w < this.maxTextLen)
|
|
break;
|
|
--fsize;
|
|
}
|
|
$setColor_0(g, whiteColor);
|
|
g.context.textBaseline = 'middle';
|
|
$drawString(g, str, this.center.x_0 - (w / 2 | 0), this.center.y_0);
|
|
g.context.restore();
|
|
g.currentFontSize = g.savedFontSize;
|
|
}
|
|
;
|
|
_.dumpXml = function dumpXml_94(doc, elem){
|
|
dumpAttr_1(elem, 'x', this.x_0 + ' ' + this.y_0 + ' ' + this.x2 + ' ' + this.y2);
|
|
dumpAttr_0(elem, 'f', this.flags);
|
|
dumpAttr_0(elem, 'w', this.width_0);
|
|
dumpAttr_0(elem, 'meter', this.meter);
|
|
}
|
|
;
|
|
_.getConnection = function getConnection_43(n1, n2){
|
|
return (n1 / 2 | 0) == (n2 / 2 | 0);
|
|
}
|
|
;
|
|
_.getCurrent_0 = function getCurrent_4(){
|
|
return this.currents[1];
|
|
}
|
|
;
|
|
_.getCurrentIntoNode = function getCurrentIntoNode_38(n){
|
|
return n % 2 == 0?-this.currents[n / 2 | 0]:this.currents[n / 2 | 0];
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_122(){
|
|
return 420;
|
|
}
|
|
;
|
|
_.getEditInfo = function getEditInfo_84(n){
|
|
var ei;
|
|
if (n == 0) {
|
|
ei = new EditInfo_0('Value', 0, -1, -1);
|
|
ei.choice = new Choice;
|
|
$addItem(ei.choice, LS('Instantaneous'));
|
|
$addItem(ei.choice, LS('Average'));
|
|
$select(ei.choice, this.meter);
|
|
return ei;
|
|
}
|
|
return null;
|
|
}
|
|
;
|
|
_.getInfo_0 = function getInfo_94(arr){
|
|
arr[0] = 'wattmeter';
|
|
$getBasicInfo(this, arr);
|
|
arr[3] = 'P = ' + getUnitText((this.volts[2] - this.volts[0]) * this.currents[1], 'W', false);
|
|
this.meter == 1 && (arr[4] = 'Pavg = ' + getUnitText(this.avgPower, 'W', false));
|
|
}
|
|
;
|
|
_.getPost = function getPost_32(n){
|
|
return this.posts[n];
|
|
}
|
|
;
|
|
_.getPostCount_0 = function getPostCount_86(){
|
|
return 4;
|
|
}
|
|
;
|
|
_.getPower = function getPower_15(){
|
|
return (this.volts[2] - this.volts[0]) * this.currents[1];
|
|
}
|
|
;
|
|
_.getVoltageDiff_0 = function getVoltageDiff_27(){
|
|
return this.volts[2] - this.volts[0];
|
|
}
|
|
;
|
|
_.getVoltageSourceCount = function getVoltageSourceCount_60(){
|
|
return 2;
|
|
}
|
|
;
|
|
_.hasGroundConnection = function hasGroundConnection_23(n1){
|
|
return false;
|
|
}
|
|
;
|
|
_.setCurrent = function setCurrent_14(vs, c){
|
|
this.currents[vs == this.voltSources[0]?0:1] = c;
|
|
}
|
|
;
|
|
_.setEditValue = function setEditValue_84(n, ei){
|
|
n == 0 && (this.meter = $getElement(ei.choice).selectedIndex);
|
|
}
|
|
;
|
|
_.setPoints = function setPoints_81(){
|
|
$setPoints_29(this);
|
|
}
|
|
;
|
|
_.setVoltageSource = function setVoltageSource_21(j, vs){
|
|
this.voltSources[j] = vs;
|
|
$setNodes(vs, this.nodes[j * 2], this.nodes[j * 2 + 1]);
|
|
}
|
|
;
|
|
_.stamp = function stamp_76(){
|
|
$stampVoltageSource_0(this.nodes[0], this.nodes[1], this.voltSources[0], 0);
|
|
$stampVoltageSource_0(this.nodes[2], this.nodes[3], this.voltSources[1], 0);
|
|
}
|
|
;
|
|
_.stepFinished = function stepFinished_28(){
|
|
var above, band, dt, mid, p;
|
|
p = (this.volts[2] - this.volts[0]) * this.currents[1];
|
|
dt = sim_0.timeStep;
|
|
this.cycleTime += dt;
|
|
this.totalEnergy += p * dt;
|
|
this.runTime += dt;
|
|
this.runEnergy += p * dt;
|
|
mid = this.runEnergy / this.runTime;
|
|
p > this.peak && (this.peak = p);
|
|
p < this.trough && (this.trough = p);
|
|
band = (this.peak - this.trough) * 0.05 + $wnd.Math.abs(this.peak) * $intern_80;
|
|
above = this.wasAboveMid?p > mid - band:p > mid + band;
|
|
if (above && !this.wasAboveMid) {
|
|
if (this.haveFullCycle) {
|
|
this.avgPower = this.totalEnergy / this.cycleTime;
|
|
isNaN(this.avgPower) && (this.avgPower = 0);
|
|
this.lastCycleTime = this.cycleTime;
|
|
}
|
|
else {
|
|
this.haveFullCycle = true;
|
|
}
|
|
this.totalEnergy = 0;
|
|
this.cycleTime = 0;
|
|
}
|
|
else if (this.lastCycleTime > 0 && this.cycleTime > this.lastCycleTime * 8) {
|
|
this.avgPower = this.totalEnergy / this.cycleTime;
|
|
isNaN(this.avgPower) && (this.avgPower = 0);
|
|
this.totalEnergy = 0;
|
|
this.cycleTime = 0;
|
|
}
|
|
this.wasAboveMid = above;
|
|
this.lastCycleTime == 0 && (this.avgPower = mid);
|
|
if (p == 0) {
|
|
this.zeroTime += dt;
|
|
if (this.lastCycleTime > 0 && this.zeroTime > this.lastCycleTime * 1.5) {
|
|
this.avgPower = 0;
|
|
this.totalEnergy = 0;
|
|
this.cycleTime = 0;
|
|
}
|
|
}
|
|
else {
|
|
this.zeroTime = 0;
|
|
}
|
|
}
|
|
;
|
|
_.undumpXml = function undumpXml_97(xml){
|
|
this.flags = $parseIntAttr(xml, 'f', this.flags);
|
|
this.width_0 = $parseIntAttr(xml, 'w', this.width_0);
|
|
this.meter = $parseIntAttr(xml, 'meter', this.meter);
|
|
$setup_9(this);
|
|
}
|
|
;
|
|
_.avgPower = 0;
|
|
_.cycleTime = 0;
|
|
_.haveFullCycle = false;
|
|
_.lastCycleTime = 0;
|
|
_.maxTextLen = 0;
|
|
_.meter = 0;
|
|
_.peak = 0;
|
|
_.runEnergy = 0;
|
|
_.runTime = 0;
|
|
_.totalEnergy = 0;
|
|
_.trough = 0;
|
|
_.wasAboveMid = false;
|
|
_.width_0 = 0;
|
|
_.zeroTime = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_WattmeterElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'WattmeterElm', 409);
|
|
function addToList(map_0, k, w){
|
|
var list;
|
|
list = $get_1(map_0, valueOf_1(k));
|
|
if (!list) {
|
|
list = new ArrayList;
|
|
$put_0(map_0, valueOf_1(k), list);
|
|
}
|
|
list.array[list.array.length] = w;
|
|
}
|
|
|
|
function buildChain(start_0, chain, visited, pointCount, pointToWires){
|
|
var k1, k2, neighbor, neighbor$iterator, stack_0, w, e;
|
|
stack_0 = new ArrayDeque;
|
|
$addFirst(stack_0, start_0);
|
|
while (stack_0.head_0 != stack_0.tail) {
|
|
w = (e = $pollFirst(stack_0) , checkCriticalElement(e != null) , e);
|
|
if ($containsKey(visited.map_0, w))
|
|
continue;
|
|
$put_0(visited.map_0, w, visited);
|
|
chain.array[chain.array.length] = w;
|
|
k1 = key_0(w.x_0, w.y_0);
|
|
k2 = key_0(w.x2, w.y2);
|
|
if ($get_1(pointCount, valueOf_1(k1)).value_0 == 2) {
|
|
for (neighbor$iterator = new ArrayList$1($get_1(pointToWires, valueOf_1(k1))); neighbor$iterator.i < neighbor$iterator.this$01.array.length;) {
|
|
neighbor = $next_4(neighbor$iterator);
|
|
$containsKey(visited.map_0, neighbor) || $addFirst(stack_0, neighbor);
|
|
}
|
|
}
|
|
if ($get_1(pointCount, valueOf_1(k2)).value_0 == 2) {
|
|
for (neighbor$iterator = new ArrayList$1($get_1(pointToWires, valueOf_1(k2))); neighbor$iterator.i < neighbor$iterator.this$01.array.length;) {
|
|
neighbor = $next_4(neighbor$iterator);
|
|
$containsKey(visited.map_0, neighbor) || $addFirst(stack_0, neighbor);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
function convertWires(sim){
|
|
var ce, ce$iterator, ce$iterator0, ce$iterator1, chain, chain$iterator, chains, elmList, hasSelection, i, k, orderedPoints, p, pointCount, pointToWires, pts, rw, rw0, v, v0, visited, w, w$iterator, w$iterator0, w$iterator1, w$iterator2, wires;
|
|
elmList = sim.ui.elmList;
|
|
hasSelection = false;
|
|
for (ce$iterator0 = new ArrayList$1(elmList.arrayList); ce$iterator0.i < ce$iterator0.this$01.array.length;) {
|
|
ce = $next_4(ce$iterator0);
|
|
if (instanceOf(ce, 106) && !instanceOf(ce, 137) && ce.selected_0) {
|
|
hasSelection = true;
|
|
break;
|
|
}
|
|
}
|
|
wires = new ArrayList;
|
|
for (ce$iterator1 = new ArrayList$1(elmList.arrayList); ce$iterator1.i < ce$iterator1.this$01.array.length;) {
|
|
ce = $next_4(ce$iterator1);
|
|
if (instanceOf(ce, 137))
|
|
continue;
|
|
instanceOf(ce, 106) && (!hasSelection || ce.selected_0) && $add_8(wires, ce);
|
|
}
|
|
if (wires.array.length == 0)
|
|
return;
|
|
pointCount = new HashMap;
|
|
for (w$iterator0 = new ArrayList$1(wires); w$iterator0.i < w$iterator0.this$01.array.length;) {
|
|
w = $next_4(w$iterator0);
|
|
inc_0(pointCount, key_0(w.x_0, w.y_0));
|
|
inc_0(pointCount, key_0(w.x2, w.y2));
|
|
}
|
|
for (ce$iterator = new ArrayList$1(elmList.arrayList); ce$iterator.i < ce$iterator.this$01.array.length;) {
|
|
ce = $next_4(ce$iterator);
|
|
if (instanceOf(ce, 106))
|
|
continue;
|
|
for (i = 0; i < ce.getPostCount_0(); i++) {
|
|
p = ce.getPost(i);
|
|
k = key_0(p.x_0, p.y_0);
|
|
if ($containsKey(pointCount, valueOf_1(k))) {
|
|
v0 = $get_1(pointCount, valueOf_1(k));
|
|
$put_0(pointCount, valueOf_1(k), valueOf_0(!v0?1:v0.value_0 + 1));
|
|
v = $get_1(pointCount, valueOf_1(k));
|
|
$put_0(pointCount, valueOf_1(k), valueOf_0(!v?1:v.value_0 + 1));
|
|
}
|
|
}
|
|
}
|
|
pointToWires = new HashMap;
|
|
for (w$iterator1 = new ArrayList$1(wires); w$iterator1.i < w$iterator1.this$01.array.length;) {
|
|
w = $next_4(w$iterator1);
|
|
addToList(pointToWires, key_0(w.x_0, w.y_0), w);
|
|
addToList(pointToWires, key_0(w.x2, w.y2), w);
|
|
}
|
|
visited = new HashSet;
|
|
chains = new ArrayList;
|
|
for (w$iterator2 = new ArrayList$1(wires); w$iterator2.i < w$iterator2.this$01.array.length;) {
|
|
w = $next_4(w$iterator2);
|
|
if ($containsKey(visited.map_0, w))
|
|
continue;
|
|
chain = new ArrayList;
|
|
buildChain(w, chain, visited, pointCount, pointToWires);
|
|
chains.array[chains.array.length] = chain;
|
|
}
|
|
for (chain$iterator = new ArrayList$1(chains); chain$iterator.i < chain$iterator.this$01.array.length;) {
|
|
chain = $next_4(chain$iterator);
|
|
if (chain.array.length == 1) {
|
|
w = (checkCriticalElementIndex(0, chain.array.length) , chain.array[0]);
|
|
pts = new ArrayList;
|
|
$add_8(pts, new Point_2(w.x_0, w.y_0));
|
|
$add_8(pts, new Point_2(w.x2, w.y2));
|
|
rw0 = new RoutedWireElm_0(pts);
|
|
$advanceToFind(elmList, w, true);
|
|
$add_8(elmList.arrayList, rw0);
|
|
continue;
|
|
}
|
|
orderedPoints = orderChain(chain, pointCount);
|
|
if (!orderedPoints || orderedPoints.array.length < 3)
|
|
continue;
|
|
rw = new RoutedWireElm_0(orderedPoints);
|
|
for (w$iterator = new ArrayList$1(chain); w$iterator.i < w$iterator.this$01.array.length;) {
|
|
w = $next_4(w$iterator);
|
|
$advanceToFind(elmList, w, true);
|
|
}
|
|
$add_8(elmList.arrayList, rw);
|
|
}
|
|
}
|
|
|
|
function inc_0(map_0, k){
|
|
var v;
|
|
v = $get_1(map_0, valueOf_1(k));
|
|
$put_0(map_0, valueOf_1(k), valueOf_0(!v?1:v.value_0 + 1));
|
|
}
|
|
|
|
function key_0(x_0, y_0){
|
|
return or_0(createLongEmul(shl(isSmallLong0(x_0)?toBigLong(x_0):x_0, 32)), createLongEmul(and(isSmallLong0(y_0)?toBigLong(y_0):y_0, isSmallLong0($intern_137)?toBigLong($intern_137):$intern_137)));
|
|
}
|
|
|
|
function orderChain(chain, pointCount){
|
|
var current, currentPt, k1, k2, local, neighbors, otherEnd, points, startKey, startWire, used, w, w$iterator, w$iterator0, w$iterator1;
|
|
local = new HashMap;
|
|
for (w$iterator0 = new ArrayList$1(chain); w$iterator0.i < w$iterator0.this$01.array.length;) {
|
|
w = $next_4(w$iterator0);
|
|
addToList(local, key_0(w.x_0, w.y_0), w);
|
|
addToList(local, key_0(w.x2, w.y2), w);
|
|
}
|
|
startWire = null;
|
|
startKey = 0;
|
|
for (w$iterator1 = new ArrayList$1(chain); w$iterator1.i < w$iterator1.this$01.array.length;) {
|
|
w = $next_4(w$iterator1);
|
|
k1 = key_0(w.x_0, w.y_0);
|
|
k2 = key_0(w.x2, w.y2);
|
|
if ($get_1(pointCount, valueOf_1(k1)).value_0 != 2) {
|
|
startWire = w;
|
|
startKey = k1;
|
|
break;
|
|
}
|
|
if ($get_1(pointCount, valueOf_1(k2)).value_0 != 2) {
|
|
startWire = w;
|
|
startKey = k2;
|
|
break;
|
|
}
|
|
}
|
|
if (!startWire)
|
|
return null;
|
|
points = new ArrayList;
|
|
$add_8(points, new Point_2(toInt_0(shr_0(startKey, 32)), toInt_0(startKey)));
|
|
used = new HashSet;
|
|
current = startWire;
|
|
currentPt = startKey;
|
|
while (current) {
|
|
$put_0(used.map_0, current, used);
|
|
k1 = key_0(current.x_0, current.y_0);
|
|
k2 = key_0(current.x2, current.y2);
|
|
otherEnd = compare_0(k1, currentPt) == 0?k2:k1;
|
|
$add_8(points, new Point_2(toInt_0(shr_0(otherEnd, 32)), toInt_0(otherEnd)));
|
|
current = null;
|
|
if ($get_1(pointCount, valueOf_1(otherEnd)).value_0 == 2) {
|
|
neighbors = $get_1(local, valueOf_1(otherEnd));
|
|
if (neighbors) {
|
|
for (w$iterator = new ArrayList$1(neighbors); w$iterator.i < w$iterator.this$01.array.length;) {
|
|
w = $next_4(w$iterator);
|
|
if (!$containsKey(used.map_0, w)) {
|
|
current = w;
|
|
currentPt = otherEnd;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return points;
|
|
}
|
|
|
|
function WireElm$1(val$x0, val$y0){
|
|
this.val$x02 = val$x0;
|
|
this.val$y03 = val$y0;
|
|
}
|
|
|
|
defineClass(707, 1, {}, WireElm$1);
|
|
_.compare = function compare_8(a, b){
|
|
var da, db;
|
|
return da = add_2(mul_0(a.x_0 - this.val$x02, a.x_0 - this.val$x02), mul_0(a.y_0 - this.val$y03, a.y_0 - this.val$y03)) , db = add_2(mul_0(b.x_0 - this.val$x02, b.x_0 - this.val$x02), mul_0(b.y_0 - this.val$y03, b.y_0 - this.val$y03)) , compare_0(da, db) < 0?-1:compare_0(da, db) > 0?1:0;
|
|
}
|
|
;
|
|
_.equals_0 = function equals_16(other){
|
|
return this === other;
|
|
}
|
|
;
|
|
_.val$x02 = 0;
|
|
_.val$y03 = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_WireElm$1_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'WireElm/1', 707);
|
|
function $addObstacle(this$static, px1, py1, px2, py2){
|
|
var c, c1, c2, maxC, maxR, minC, minR, r, r1, r2;
|
|
px1 += this$static.gridSize / 2 | 0;
|
|
px2 += this$static.gridSize / 2 | 0;
|
|
py1 += this$static.gridSize / 2 | 0;
|
|
py2 += this$static.gridSize / 2 | 0;
|
|
r1 = (py1 - this$static.originY) / this$static.gridSize | 0;
|
|
c1 = (px1 - this$static.originX) / this$static.gridSize | 0;
|
|
r2 = (py2 - this$static.originY) / this$static.gridSize | 0;
|
|
c2 = (px2 - this$static.originX) / this$static.gridSize | 0;
|
|
minR = $wnd.Math.min(r1, r2);
|
|
maxR = $wnd.Math.max(r1, r2);
|
|
minC = $wnd.Math.min(c1, c2);
|
|
maxC = $wnd.Math.max(c1, c2);
|
|
for (c = minC; c <= maxC; c++)
|
|
for (r = minR; r <= maxR; r++)
|
|
r >= 0 && r < this$static.rows_0 && c >= 0 && c < this$static.cols_0 && (this$static.grid[r][c] |= 1);
|
|
}
|
|
|
|
function $addObstacle_0(this$static, pts){
|
|
var i, maxX, maxY, minX, minY;
|
|
minX = pts[0].x_0;
|
|
minY = pts[0].y_0;
|
|
maxX = pts[0].x_0;
|
|
maxY = pts[0].y_0;
|
|
for (i = 1; i < pts.length; i++) {
|
|
pts[i].x_0 < minX && (minX = pts[i].x_0);
|
|
pts[i].y_0 < minY && (minY = pts[i].y_0);
|
|
pts[i].x_0 > maxX && (maxX = pts[i].x_0);
|
|
pts[i].y_0 > maxY && (maxY = pts[i].y_0);
|
|
}
|
|
$addObstacle(this$static, minX, minY, maxX, maxY);
|
|
}
|
|
|
|
function $addObstaclePoint(this$static, px, py){
|
|
var c, r;
|
|
r = (py - this$static.originY) / this$static.gridSize | 0;
|
|
c = (px - this$static.originX) / this$static.gridSize | 0;
|
|
r >= 0 && r < this$static.rows_0 && c >= 0 && c < this$static.cols_0 && (this$static.grid[r][c] |= 1);
|
|
}
|
|
|
|
function $addWire(this$static, px1, py1, px2, py2){
|
|
var c, c1, c2, maxC, maxR, minC, minR, r, r1, r2;
|
|
r1 = (py1 - this$static.originY) / this$static.gridSize | 0;
|
|
c1 = (px1 - this$static.originX) / this$static.gridSize | 0;
|
|
r2 = (py2 - this$static.originY) / this$static.gridSize | 0;
|
|
c2 = (px2 - this$static.originX) / this$static.gridSize | 0;
|
|
minR = $wnd.Math.min(r1, r2);
|
|
maxR = $wnd.Math.max(r1, r2);
|
|
minC = $wnd.Math.min(c1, c2);
|
|
maxC = $wnd.Math.max(c1, c2);
|
|
if (r1 == r2) {
|
|
for (c = minC; c <= maxC; c++)
|
|
r1 >= 0 && r1 < this$static.rows_0 && c >= 0 && c < this$static.cols_0 && (this$static.grid[r1][c] |= 2);
|
|
}
|
|
else {
|
|
for (r = minR; r <= maxR; r++)
|
|
r >= 0 && r < this$static.rows_0 && c1 >= 0 && c1 < this$static.cols_0 && (this$static.grid[r][c1] |= 4);
|
|
}
|
|
}
|
|
|
|
function $canMoveTo(this$static, r, c, moveDir){
|
|
var cell, flag;
|
|
if (!(r >= 0 && r < this$static.rows_0 && c >= 0 && c < this$static.cols_0))
|
|
return false;
|
|
cell = this$static.grid[r][c];
|
|
if ((cell & 1) != 0)
|
|
return false;
|
|
flag = moveDir == 3 || moveDir == 4?2:4;
|
|
if ((cell & flag) != 0)
|
|
return false;
|
|
return true;
|
|
}
|
|
|
|
function $compressPath(fullPath){
|
|
var a, b, c, collinear, dx1, dx2, dy1, dy2, i, last, minimal, prev;
|
|
if (fullPath.array.length <= 2)
|
|
return new ArrayList_1(fullPath);
|
|
minimal = new ArrayList;
|
|
$add_8(minimal, (checkCriticalElementIndex(0, fullPath.array.length) , fullPath.array[0]));
|
|
for (i = 1; i < fullPath.array.length - 1; i++) {
|
|
a = (checkCriticalElementIndex(i - 1, fullPath.array.length) , fullPath.array[i - 1]);
|
|
b = (checkCriticalElementIndex(i, fullPath.array.length) , fullPath.array[i]);
|
|
c = (checkCriticalElementIndex(i + 1, fullPath.array.length) , fullPath.array[i + 1]);
|
|
dx1 = b[1] - a[1];
|
|
dy1 = b[0] - a[0];
|
|
dx2 = c[1] - b[1];
|
|
dy2 = c[0] - b[0];
|
|
collinear = dx1 * dy2 - dy1 * dx2 == 0 && dx1 * dx2 + dy1 * dy2 > 0;
|
|
collinear || (minimal.array[minimal.array.length] = b , true);
|
|
}
|
|
last = $get_2(fullPath, fullPath.array.length - 1);
|
|
prev = $get_2(minimal, minimal.array.length - 1);
|
|
(prev[0] !== last[0] || prev[1] !== last[1]) && (minimal.array[minimal.array.length] = last , true);
|
|
return minimal;
|
|
}
|
|
|
|
function $dc(dir_0){
|
|
switch (dir_0) {
|
|
case 2:
|
|
default:case 1:
|
|
return 0;
|
|
case 3:
|
|
return -1;
|
|
case 4:
|
|
return 1;
|
|
}
|
|
}
|
|
|
|
function $dr(dir_0){
|
|
switch (dir_0) {
|
|
case 1:
|
|
return -1;
|
|
case 2:
|
|
return 1;
|
|
case 4:
|
|
default:case 3:
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
function $evaluatePath(this$static, corners, initialDir, startPrefs){
|
|
var c, cost, curr, dc, dr, i, moveDir, p, p$index, p$max, prev, prevDir, r, s, steps;
|
|
if (corners.array.length < 2)
|
|
return -1;
|
|
cost = 0;
|
|
prevDir = 0;
|
|
prev = (checkCriticalElementIndex(0, corners.array.length) , corners.array[0]);
|
|
for (i = 1; i < corners.array.length; i++) {
|
|
curr = (checkCriticalElementIndex(i, corners.array.length) , corners.array[i]);
|
|
dr = curr[0] - prev[0];
|
|
dc = curr[1] - prev[1];
|
|
steps = $wnd.Math.max($wnd.Math.abs(dr), $wnd.Math.abs(dc));
|
|
if (steps == 0)
|
|
continue;
|
|
if (dr == 0 && dc > 0)
|
|
moveDir = 4;
|
|
else if (dr == 0 && dc < 0)
|
|
moveDir = 3;
|
|
else if (dc == 0 && dr > 0)
|
|
moveDir = 2;
|
|
else if (dc == 0 && dr < 0)
|
|
moveDir = 1;
|
|
else
|
|
return -1;
|
|
r = prev[0];
|
|
c = prev[1];
|
|
for (s = 0; s < steps; s++) {
|
|
r += dr == 0?0:dr < 0?-1:1;
|
|
c += dc == 0?0:dc < 0?-1:1;
|
|
if (!(r >= 0 && r < this$static.rows_0 && c >= 0 && c < this$static.cols_0) || !$canMoveTo(this$static, r, c, moveDir))
|
|
return -1;
|
|
}
|
|
cost += steps;
|
|
prevDir != 0 && moveDir != prevDir && moveDir != $opposite(prevDir) && (cost += this$static.turnPenalty);
|
|
prevDir = moveDir;
|
|
prev = curr;
|
|
}
|
|
for (p$index = 0 , p$max = startPrefs.length; p$index < p$max; ++p$index) {
|
|
p = startPrefs[p$index];
|
|
if (p == initialDir) {
|
|
cost += -0.4;
|
|
break;
|
|
}
|
|
}
|
|
return cost;
|
|
}
|
|
|
|
function $getPreferredEscapeDirections(this$static, r, c){
|
|
var arr, i, prefs;
|
|
prefs = new ArrayList;
|
|
$canMoveTo(this$static, r - 1, c, 1) || $add_8(prefs, valueOf_0(2));
|
|
$canMoveTo(this$static, r + 1, c, 2) || $add_8(prefs, valueOf_0(1));
|
|
$canMoveTo(this$static, r, c - 1, 3) || $add_8(prefs, valueOf_0(4));
|
|
$canMoveTo(this$static, r, c + 1, 4) || $add_8(prefs, valueOf_0(3));
|
|
if (prefs.array.length == 0) {
|
|
return initUnidimensionalArray(I_classLit, $intern_25, 7, 0, 15, 1);
|
|
}
|
|
arr = initUnidimensionalArray(I_classLit, $intern_25, 7, prefs.array.length, 15, 1);
|
|
for (i = 0; i < prefs.array.length; i++)
|
|
arr[i] = (checkCriticalElementIndex(i, prefs.array.length) , prefs.array[i]).value_0;
|
|
return arr;
|
|
}
|
|
|
|
function $initGrid(this$static, wire){
|
|
var bounds, ce, ce$iterator, i, maxX, maxY, minX, minY, p;
|
|
this$static.gridSize = theApp.gridSize;
|
|
bounds = $getCircuitBounds(theUI);
|
|
minX = $wnd.Math.min(wire.x_0, wire.x2);
|
|
minY = $wnd.Math.min(wire.y_0, wire.y2);
|
|
maxX = $wnd.Math.max(wire.x_0, wire.x2);
|
|
maxY = $wnd.Math.max(wire.y_0, wire.y2);
|
|
if (bounds) {
|
|
minX = $wnd.Math.min(minX, bounds.x_0);
|
|
minY = $wnd.Math.min(minY, bounds.y_0);
|
|
maxX = $wnd.Math.max(maxX, bounds.x_0 + bounds.width_0);
|
|
maxY = $wnd.Math.max(maxY, bounds.y_0 + bounds.height_0);
|
|
}
|
|
this$static.originX = (minX / this$static.gridSize | 0) * this$static.gridSize - 2 * this$static.gridSize;
|
|
this$static.originY = (minY / this$static.gridSize | 0) * this$static.gridSize - 2 * this$static.gridSize;
|
|
this$static.rows_0 = ((maxY - this$static.originY) / this$static.gridSize | 0) + 1 + 4;
|
|
this$static.cols_0 = ((maxX - this$static.originX) / this$static.gridSize | 0) + 1 + 4;
|
|
this$static.grid = initMultidimensionalArray(I_classLit, [$intern_3, $intern_25], [17, 7], 15, [this$static.rows_0, this$static.cols_0], 2);
|
|
for (ce$iterator = new ArrayList$1(theUI.elmList.arrayList); ce$iterator.i < ce$iterator.this$01.array.length;) {
|
|
ce = $next_4(ce$iterator);
|
|
if (wire == ce)
|
|
continue;
|
|
ce.addRoutingObstacle(this$static);
|
|
for (i = 0; i < ce.getPostCount_0(); i++) {
|
|
p = ce.getPost(i);
|
|
$addObstaclePoint(this$static, p.x_0, p.y_0);
|
|
}
|
|
}
|
|
this$static.grid[(wire.y_0 - this$static.originY) / this$static.gridSize | 0][(wire.x_0 - this$static.originX) / this$static.gridSize | 0] = 0;
|
|
this$static.grid[(wire.y2 - this$static.originY) / this$static.gridSize | 0][(wire.x2 - this$static.originX) / this$static.gridSize | 0] = 0;
|
|
}
|
|
|
|
function $neighbors(this$static, r, c){
|
|
var list;
|
|
list = new ArrayList;
|
|
r > 0 && $add_8(list, stampJavaTypeInfo(getClassLiteralForArray(I_classLit, 1), $intern_25, 7, 15, [r - 1, c, 1]));
|
|
r < this$static.rows_0 - 1 && $add_8(list, stampJavaTypeInfo(getClassLiteralForArray(I_classLit, 1), $intern_25, 7, 15, [r + 1, c, 2]));
|
|
c > 0 && $add_8(list, stampJavaTypeInfo(getClassLiteralForArray(I_classLit, 1), $intern_25, 7, 15, [r, c - 1, 3]));
|
|
c < this$static.cols_0 - 1 && $add_8(list, stampJavaTypeInfo(getClassLiteralForArray(I_classLit, 1), $intern_25, 7, 15, [r, c + 1, 4]));
|
|
return list;
|
|
}
|
|
|
|
function $opposite(d){
|
|
switch (d) {
|
|
case 1:
|
|
return 2;
|
|
case 2:
|
|
return 1;
|
|
case 3:
|
|
return 4;
|
|
case 4:
|
|
return 3;
|
|
default:return 0;
|
|
}
|
|
}
|
|
|
|
function $pixelsFromGridPoints(this$static, gridPoints){
|
|
var g, g$iterator, px, py, result;
|
|
result = new ArrayList;
|
|
for (g$iterator = new ArrayList$1(gridPoints); g$iterator.i < g$iterator.this$01.array.length;) {
|
|
g = $next_4(g$iterator);
|
|
px = g[1] * this$static.gridSize + this$static.originX;
|
|
py = g[0] * this$static.gridSize + this$static.originY;
|
|
$add_8(result, new Point_2(px, py));
|
|
}
|
|
return result;
|
|
}
|
|
|
|
function $routeWire(this$static, px1, py1, px2, py2){
|
|
var bestGoalNode, bestKnownG, cameFrom, compressed, currKey, current, currentKey, d, d$array, d$index, d$max, f, fullPath, gScore, goalC, goalR, h, initG, isPreferred, key, moveCost, moveDir, nKey, nc, neigh, neigh$iterator, nr, openSet, parts, patternPath, pos, pref, pref$index, pref$max, pt, pt$iterator, result, startC, startNode, startPrefs, startR, tentG, value_0;
|
|
startR = (py1 - this$static.originY) / this$static.gridSize | 0;
|
|
startC = (px1 - this$static.originX) / this$static.gridSize | 0;
|
|
goalR = (py2 - this$static.originY) / this$static.gridSize | 0;
|
|
goalC = (px2 - this$static.originX) / this$static.gridSize | 0;
|
|
if (!(startR >= 0 && startR < this$static.rows_0 && startC >= 0 && startC < this$static.cols_0) || !(goalR >= 0 && goalR < this$static.rows_0 && goalC >= 0 && goalC < this$static.cols_0)) {
|
|
return new ArrayList;
|
|
}
|
|
if (!$canMoveTo(this$static, goalR, goalC, 1) && !$canMoveTo(this$static, goalR, goalC, 2) && !$canMoveTo(this$static, goalR, goalC, 3) && !$canMoveTo(this$static, goalR, goalC, 4)) {
|
|
return new ArrayList;
|
|
}
|
|
patternPath = $tryPatternRouting(this$static, startR, startC, goalR, goalC);
|
|
if (patternPath.array.length != 0) {
|
|
console.log('pattern');
|
|
return patternPath;
|
|
}
|
|
console.log('A*');
|
|
openSet = new PriorityQueue((checkCriticalNotNull(new WireRouter$lambda$0$Type) , new Comparator$lambda$2$Type));
|
|
gScore = new HashMap;
|
|
cameFrom = new HashMap;
|
|
startPrefs = $getPreferredEscapeDirections(this$static, startR, startC);
|
|
for (d$array = stampJavaTypeInfo(getClassLiteralForArray(I_classLit, 1), $intern_25, 7, 15, [1, 2, 3, 4]) , d$index = 0 , d$max = d$array.length; d$index < d$max; ++d$index) {
|
|
d = d$array[d$index];
|
|
if (!$canMoveTo(this$static, startR + $dr(d), startC + $dc(d), d))
|
|
continue;
|
|
key = startR + ',' + startC + ',' + d;
|
|
initG = 0;
|
|
isPreferred = false;
|
|
for (pref$index = 0 , pref$max = startPrefs.length; pref$index < pref$max; ++pref$index) {
|
|
pref = startPrefs[pref$index];
|
|
if (pref == d) {
|
|
isPreferred = true;
|
|
break;
|
|
}
|
|
}
|
|
isPreferred && (initG += -0.4);
|
|
h = $wnd.Math.abs(startR - goalR) + $wnd.Math.abs(startC - goalC);
|
|
startNode = new WireRouter$Node(startR, startC, d, initG, initG + h);
|
|
$offer(openSet, startNode);
|
|
$putStringValue(gScore, key, initG);
|
|
}
|
|
bestGoalNode = null;
|
|
while (openSet.heap.array.length != 0) {
|
|
current = (value_0 = openSet.heap.array.length == 0?null:$get_2(openSet.heap, 0) , value_0 != null && $removeAtIndex_0(openSet, 0) , value_0);
|
|
currKey = current.r + ',' + current.c + ',' + current.dir_0;
|
|
if (current.gScore > $doubleValue($getOrDefault(gScore, currKey, $intern_26))) {
|
|
continue;
|
|
}
|
|
current.r == goalR && current.c == goalC && (!bestGoalNode || current.gScore < bestGoalNode.gScore) && (bestGoalNode = current);
|
|
for (neigh$iterator = new ArrayList$1($neighbors(this$static, current.r, current.c)); neigh$iterator.i < neigh$iterator.this$01.array.length;) {
|
|
neigh = $next_4(neigh$iterator);
|
|
nr = neigh[0];
|
|
nc = neigh[1];
|
|
moveDir = neigh[2];
|
|
if (!$canMoveTo(this$static, nr, nc, moveDir))
|
|
continue;
|
|
moveCost = 1;
|
|
current.dir_0 != 0 && moveDir != current.dir_0 && moveDir != $opposite(current.dir_0) && (moveCost += this$static.turnPenalty);
|
|
nKey = nr + ',' + nc + ',' + moveDir;
|
|
tentG = current.gScore + moveCost;
|
|
bestKnownG = $doubleValue($getOrDefault(gScore, nKey, $intern_26));
|
|
if (tentG < bestKnownG) {
|
|
$put_2(cameFrom.stringMap, nKey, currKey);
|
|
$putStringValue(gScore, nKey, tentG);
|
|
h = $wnd.Math.abs(nr - goalR) + $wnd.Math.abs(nc - goalC);
|
|
f = tentG + h;
|
|
$offer(openSet, new WireRouter$Node(nr, nc, moveDir, tentG, f));
|
|
}
|
|
}
|
|
}
|
|
if (!bestGoalNode) {
|
|
return new ArrayList;
|
|
}
|
|
fullPath = new ArrayList;
|
|
currentKey = bestGoalNode.r + ',' + bestGoalNode.c + ',' + bestGoalNode.dir_0;
|
|
while (currentKey != null) {
|
|
pos = (parts = $split_1(currentKey, ',', 0) , stampJavaTypeInfo(getClassLiteralForArray(I_classLit, 1), $intern_25, 7, 15, [__parseAndValidateInt(parts[0], 10), __parseAndValidateInt(parts[1], 10), __parseAndValidateInt(parts[2], 10)]));
|
|
$add_7(fullPath, 0, stampJavaTypeInfo(getClassLiteralForArray(I_classLit, 1), $intern_25, 7, 15, [pos[0], pos[1]]));
|
|
currentKey = currentKey == null?getEntryValueOrNull($getEntry(cameFrom.hashCodeMap, null)):$get_3(cameFrom.stringMap, currentKey);
|
|
}
|
|
compressed = $compressPath(fullPath);
|
|
result = new ArrayList;
|
|
for (pt$iterator = new ArrayList$1(compressed); pt$iterator.i < pt$iterator.this$01.array.length;) {
|
|
pt = $next_4(pt$iterator);
|
|
$add_8(result, new Point_2(pt[1] * this$static.gridSize + this$static.originX, pt[0] * this$static.gridSize + this$static.originY));
|
|
}
|
|
return result;
|
|
}
|
|
|
|
function $tryPatternRouting(this$static, startR, startC, goalR, goalC){
|
|
var bestCorners, bestCost, cost, cost1, cost2, detourCol, detourRow, dir_0, dir1, dir2, margin, path, path1, path2, result, side, side$array, side$index, side$max, startPrefs, z_0;
|
|
if (startR == goalR && startC == goalC) {
|
|
result = new ArrayList;
|
|
$add_8(result, new Point_2(startC * this$static.gridSize + this$static.originX, startR * this$static.gridSize + this$static.originY));
|
|
return result;
|
|
}
|
|
startPrefs = $getPreferredEscapeDirections(this$static, startR, startC);
|
|
bestCost = $intern_26;
|
|
bestCorners = null;
|
|
if (startR != goalR && startC != goalC) {
|
|
path1 = new ArrayList;
|
|
$add_8(path1, stampJavaTypeInfo(getClassLiteralForArray(I_classLit, 1), $intern_25, 7, 15, [startR, startC]));
|
|
$add_8(path1, stampJavaTypeInfo(getClassLiteralForArray(I_classLit, 1), $intern_25, 7, 15, [startR, goalC]));
|
|
$add_8(path1, stampJavaTypeInfo(getClassLiteralForArray(I_classLit, 1), $intern_25, 7, 15, [goalR, goalC]));
|
|
dir1 = goalC > startC?4:3;
|
|
cost1 = $evaluatePath(this$static, path1, dir1, startPrefs);
|
|
if (cost1 >= 0 && cost1 < $intern_26) {
|
|
bestCost = cost1;
|
|
bestCorners = path1;
|
|
}
|
|
path2 = new ArrayList;
|
|
$add_8(path2, stampJavaTypeInfo(getClassLiteralForArray(I_classLit, 1), $intern_25, 7, 15, [startR, startC]));
|
|
$add_8(path2, stampJavaTypeInfo(getClassLiteralForArray(I_classLit, 1), $intern_25, 7, 15, [goalR, startC]));
|
|
$add_8(path2, stampJavaTypeInfo(getClassLiteralForArray(I_classLit, 1), $intern_25, 7, 15, [goalR, goalC]));
|
|
dir2 = goalR > startR?2:1;
|
|
cost2 = $evaluatePath(this$static, path2, dir2, startPrefs);
|
|
if (cost2 >= 0 && cost2 < bestCost) {
|
|
bestCost = cost2;
|
|
bestCorners = path2;
|
|
}
|
|
}
|
|
else if (startR == goalR) {
|
|
path = new ArrayList;
|
|
$add_8(path, stampJavaTypeInfo(getClassLiteralForArray(I_classLit, 1), $intern_25, 7, 15, [startR, startC]));
|
|
$add_8(path, stampJavaTypeInfo(getClassLiteralForArray(I_classLit, 1), $intern_25, 7, 15, [goalR, goalC]));
|
|
dir_0 = goalC > startC?4:3;
|
|
cost = $evaluatePath(this$static, path, dir_0, startPrefs);
|
|
if (cost >= 0 && cost < $intern_26) {
|
|
bestCost = cost;
|
|
bestCorners = path;
|
|
}
|
|
}
|
|
else {
|
|
path = new ArrayList;
|
|
$add_8(path, stampJavaTypeInfo(getClassLiteralForArray(I_classLit, 1), $intern_25, 7, 15, [startR, startC]));
|
|
$add_8(path, stampJavaTypeInfo(getClassLiteralForArray(I_classLit, 1), $intern_25, 7, 15, [goalR, goalC]));
|
|
dir_0 = goalR > startR?2:1;
|
|
cost = $evaluatePath(this$static, path, dir_0, startPrefs);
|
|
if (cost >= 0 && cost < $intern_26) {
|
|
bestCost = cost;
|
|
bestCorners = path;
|
|
}
|
|
}
|
|
if (startR != goalR) {
|
|
for (margin = 1; margin <= 5; margin++) {
|
|
for (side$array = stampJavaTypeInfo(getClassLiteralForArray(I_classLit, 1), $intern_25, 7, 15, [-1, 1]) , side$index = 0 , side$max = side$array.length; side$index < side$max; ++side$index) {
|
|
side = side$array[side$index];
|
|
detourCol = startC + side * margin;
|
|
if (0 < this$static.rows_0 && detourCol >= 0 && detourCol < this$static.cols_0) {
|
|
z_0 = new ArrayList;
|
|
$add_8(z_0, stampJavaTypeInfo(getClassLiteralForArray(I_classLit, 1), $intern_25, 7, 15, [startR, startC]));
|
|
startC != detourCol && $add_8(z_0, stampJavaTypeInfo(getClassLiteralForArray(I_classLit, 1), $intern_25, 7, 15, [startR, detourCol]));
|
|
startR != goalR && $add_8(z_0, stampJavaTypeInfo(getClassLiteralForArray(I_classLit, 1), $intern_25, 7, 15, [goalR, detourCol]));
|
|
detourCol != goalC && $add_8(z_0, stampJavaTypeInfo(getClassLiteralForArray(I_classLit, 1), $intern_25, 7, 15, [goalR, goalC]));
|
|
if (z_0.array.length >= 2) {
|
|
dir_0 = detourCol > startC?4:3;
|
|
cost = $evaluatePath(this$static, z_0, dir_0, startPrefs);
|
|
if (cost >= 0 && cost < bestCost) {
|
|
bestCost = cost;
|
|
bestCorners = z_0;
|
|
}
|
|
}
|
|
}
|
|
detourCol = goalC + side * margin;
|
|
if (0 < this$static.rows_0 && detourCol >= 0 && detourCol < this$static.cols_0) {
|
|
z_0 = new ArrayList;
|
|
$add_8(z_0, stampJavaTypeInfo(getClassLiteralForArray(I_classLit, 1), $intern_25, 7, 15, [startR, startC]));
|
|
startC != detourCol && $add_8(z_0, stampJavaTypeInfo(getClassLiteralForArray(I_classLit, 1), $intern_25, 7, 15, [startR, detourCol]));
|
|
startR != goalR && $add_8(z_0, stampJavaTypeInfo(getClassLiteralForArray(I_classLit, 1), $intern_25, 7, 15, [goalR, detourCol]));
|
|
detourCol != goalC && $add_8(z_0, stampJavaTypeInfo(getClassLiteralForArray(I_classLit, 1), $intern_25, 7, 15, [goalR, goalC]));
|
|
if (z_0.array.length >= 2) {
|
|
dir_0 = detourCol > startC?4:3;
|
|
cost = $evaluatePath(this$static, z_0, dir_0, startPrefs);
|
|
if (cost >= 0 && cost < bestCost) {
|
|
bestCost = cost;
|
|
bestCorners = z_0;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (startC != goalC) {
|
|
for (margin = 1; margin <= 5; margin++) {
|
|
for (side$array = stampJavaTypeInfo(getClassLiteralForArray(I_classLit, 1), $intern_25, 7, 15, [-1, 1]) , side$index = 0 , side$max = side$array.length; side$index < side$max; ++side$index) {
|
|
side = side$array[side$index];
|
|
detourRow = startR + side * margin;
|
|
if (detourRow >= 0 && detourRow < this$static.rows_0 && 0 < this$static.cols_0) {
|
|
z_0 = new ArrayList;
|
|
$add_8(z_0, stampJavaTypeInfo(getClassLiteralForArray(I_classLit, 1), $intern_25, 7, 15, [startR, startC]));
|
|
startR != detourRow && $add_8(z_0, stampJavaTypeInfo(getClassLiteralForArray(I_classLit, 1), $intern_25, 7, 15, [detourRow, startC]));
|
|
startC != goalC && $add_8(z_0, stampJavaTypeInfo(getClassLiteralForArray(I_classLit, 1), $intern_25, 7, 15, [detourRow, goalC]));
|
|
detourRow != goalR && $add_8(z_0, stampJavaTypeInfo(getClassLiteralForArray(I_classLit, 1), $intern_25, 7, 15, [goalR, goalC]));
|
|
if (z_0.array.length >= 2) {
|
|
dir_0 = detourRow > startR?2:1;
|
|
cost = $evaluatePath(this$static, z_0, dir_0, startPrefs);
|
|
if (cost >= 0 && cost < bestCost) {
|
|
bestCost = cost;
|
|
bestCorners = z_0;
|
|
}
|
|
}
|
|
}
|
|
detourRow = goalR + side * margin;
|
|
if (detourRow >= 0 && detourRow < this$static.rows_0 && 0 < this$static.cols_0) {
|
|
z_0 = new ArrayList;
|
|
$add_8(z_0, stampJavaTypeInfo(getClassLiteralForArray(I_classLit, 1), $intern_25, 7, 15, [startR, startC]));
|
|
startR != detourRow && $add_8(z_0, stampJavaTypeInfo(getClassLiteralForArray(I_classLit, 1), $intern_25, 7, 15, [detourRow, startC]));
|
|
startC != goalC && $add_8(z_0, stampJavaTypeInfo(getClassLiteralForArray(I_classLit, 1), $intern_25, 7, 15, [detourRow, goalC]));
|
|
detourRow != goalR && $add_8(z_0, stampJavaTypeInfo(getClassLiteralForArray(I_classLit, 1), $intern_25, 7, 15, [goalR, goalC]));
|
|
if (z_0.array.length >= 2) {
|
|
dir_0 = detourRow > startR?2:1;
|
|
cost = $evaluatePath(this$static, z_0, dir_0, startPrefs);
|
|
if (cost >= 0 && cost < bestCost) {
|
|
bestCost = cost;
|
|
bestCorners = z_0;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (!bestCorners) {
|
|
return new ArrayList;
|
|
}
|
|
return $pixelsFromGridPoints(this$static, bestCorners);
|
|
}
|
|
|
|
function WireRouter(){
|
|
}
|
|
|
|
defineClass(352, 1, {}, WireRouter);
|
|
_.cols_0 = 0;
|
|
_.gridSize = 0;
|
|
_.originX = 0;
|
|
_.originY = 0;
|
|
_.rows_0 = 0;
|
|
_.turnPenalty = 4;
|
|
var Lcom_lushprojects_circuitjs1_client_WireRouter_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'WireRouter', 352);
|
|
function WireRouter$Node(r, c, dir_0, g, f){
|
|
this.r = r;
|
|
this.c = c;
|
|
this.dir_0 = dir_0;
|
|
this.gScore = g;
|
|
this.fScore = f;
|
|
}
|
|
|
|
defineClass(294, 1, {294:1}, WireRouter$Node);
|
|
_.c = 0;
|
|
_.dir_0 = 0;
|
|
_.fScore = 0;
|
|
_.gScore = 0;
|
|
_.r = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_WireRouter$Node_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'WireRouter/Node', 294);
|
|
function WireRouter$lambda$0$Type(){
|
|
}
|
|
|
|
defineClass(813, 1, {}, WireRouter$lambda$0$Type);
|
|
var Lcom_lushprojects_circuitjs1_client_WireRouter$lambda$0$Type_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'WireRouter/lambda$0$Type', 813);
|
|
function $getChildElements(this$static){
|
|
var children, elements, i, node;
|
|
elements = new ArrayList;
|
|
children = new NodeListImpl(getChildNodes(this$static.currentXmlElement.jsObject));
|
|
for (i = 0; i < getLength_1(children.jsObject); i++) {
|
|
node = build(item_3(children.jsObject, i));
|
|
getNodeType(node.jsObject) == 1 && $add_8(elements, node);
|
|
}
|
|
return elements;
|
|
}
|
|
|
|
function $parseBooleanAttr(this$static, attr, def){
|
|
var v;
|
|
v = $getAttribute(this$static.currentXmlElement, attr);
|
|
if (v == null)
|
|
return def;
|
|
return $clinit_Boolean() , $equalsIgnoreCase('true', v);
|
|
}
|
|
|
|
function $parseContents(this$static){
|
|
try {
|
|
return getNodeValue($item(new NodeListImpl(getChildNodes(this$static.currentXmlElement.jsObject)), 0).jsObject);
|
|
}
|
|
catch ($e0) {
|
|
$e0 = toJava($e0);
|
|
if (instanceOf($e0, 13)) {
|
|
return null;
|
|
}
|
|
else
|
|
throw toJs($e0);
|
|
}
|
|
}
|
|
|
|
function $parseDoubleAttr(this$static, attr, def){
|
|
var v;
|
|
v = $getAttribute(this$static.currentXmlElement, attr);
|
|
if (v == null)
|
|
return def;
|
|
return __parseAndValidateDouble(v);
|
|
}
|
|
|
|
function $parseIntAttr(this$static, attr, def){
|
|
var v;
|
|
v = $getAttribute(this$static.currentXmlElement, attr);
|
|
if (v == null)
|
|
return def;
|
|
return __parseAndValidateInt(v, 10);
|
|
}
|
|
|
|
function $parseStringAttr(this$static, attr, def){
|
|
var s;
|
|
s = $getAttribute(this$static.currentXmlElement, attr);
|
|
if (s == null)
|
|
return def;
|
|
s = $replace_0($replace_0($replace_0($replace_0($replace_0(s, '"', '"'), ''', "'"), '<', '<'), '>', '>'), '&', '&');
|
|
return s;
|
|
}
|
|
|
|
function $readCircuit_2(this$static, doc){
|
|
$clearCircuit(this$static.app.loader);
|
|
$readElements(this$static, build(getDocumentElement(doc.jsObject)));
|
|
$finishReadCircuit(this$static.app.loader, 0);
|
|
}
|
|
|
|
function $readCircuit_3(this$static, text_0, readFlags){
|
|
var doc, flags, root, sim, sp, sp2, ui;
|
|
doc = ($clinit_XMLParser() , $parse_2(impl_1, text_0));
|
|
root = build(getDocumentElement(doc.jsObject));
|
|
(readFlags & 1) == 0 && $clearCircuit(this$static.app.loader);
|
|
this$static.currentXmlElement = root;
|
|
if ((readFlags & 1) == 0) {
|
|
flags = $parseIntAttr(this$static, 'f', 0);
|
|
$readCircuitFlags(this$static.app.loader, flags);
|
|
sim = this$static.app.sim;
|
|
sim.maxTimeStep = sim.timeStep = $parseDoubleAttr(this$static, 'ts', sim.maxTimeStep);
|
|
sp = $parseDoubleAttr(this$static, 'ic', $getIterCount(this$static.app));
|
|
sp2 = round_int($wnd.Math.log(10 * sp) * 24 + 61.5);
|
|
ui = this$static.app.ui;
|
|
$setValue_2(ui.speedBar, sp2);
|
|
$setValue_2(ui.currentBar, $parseIntAttr(this$static, 'cb', ui.currentBar.val_0));
|
|
voltageRange = $parseDoubleAttr(this$static, 'vr', voltageRange);
|
|
$setValue_2(ui.powerBar, $parseIntAttr(this$static, 'pb', ui.powerBar.val_0));
|
|
sim.minTimeStep = $parseDoubleAttr(this$static, 'mts', sim.minTimeStep);
|
|
sim.solverType = $parseIntAttr(this$static, 'st', sim.solverType);
|
|
$setGrid(this$static.app.ui);
|
|
}
|
|
$readElements(this$static, root);
|
|
$finishReadCircuit(this$static.app.loader, readFlags);
|
|
}
|
|
|
|
function $readElements(this$static, root){
|
|
var children, className, elem, elm, i, node, sc, tagName, x_0, name_0, dm;
|
|
children = new NodeListImpl(getChildNodes(root.jsObject));
|
|
for (i = 0; i < getLength_1(children.jsObject); i++) {
|
|
node = build(item_3(children.jsObject, i));
|
|
if (getNodeType(node.jsObject) != 1)
|
|
continue;
|
|
elem = node;
|
|
tagName = getTagName(elem.jsObject);
|
|
if ($equals_1(tagName, 'o')) {
|
|
sc = new Scope(this$static.app, this$static.app.sim);
|
|
this$static.currentXmlElement = elem;
|
|
$undumpXml_6(sc.serializer, this$static);
|
|
$addScope(this$static.app.scopeManager, sc);
|
|
continue;
|
|
}
|
|
if ($equals_1(tagName, 'dm')) {
|
|
this$static.currentXmlElement = elem;
|
|
undumpModelXml_1(this$static);
|
|
continue;
|
|
}
|
|
if ($equals_1(tagName, 'rlm')) {
|
|
this$static.currentXmlElement = elem;
|
|
undumpModelXml_2(this$static);
|
|
continue;
|
|
}
|
|
if ($equals_1(tagName, 'tm')) {
|
|
this$static.currentXmlElement = elem;
|
|
undumpModelXml_3(this$static);
|
|
continue;
|
|
}
|
|
if ($equals_1(tagName, 'mm')) {
|
|
this$static.currentXmlElement = elem;
|
|
name_0 = $parseStringAttr(this$static, 'nm', null);
|
|
dm = getModelWithName_2(name_0);
|
|
dm.flags = $parseIntAttr(this$static, 'f', dm.flags);
|
|
dm.threshold = $parseDoubleAttr(this$static, 'vt', dm.threshold);
|
|
dm.beta_0 = $parseDoubleAttr(this$static, 'be', dm.beta_0);
|
|
dm.lambda = $parseDoubleAttr(this$static, 'la', dm.lambda);
|
|
dm.capGS = $parseDoubleAttr(this$static, 'cgs', dm.capGS);
|
|
dm.capGD = $parseDoubleAttr(this$static, 'cgd', dm.capGD);
|
|
dm.showBulk = $parseIntAttr(this$static, 'sb', dm.showBulk?1:0) != 0;
|
|
dm.digitalSymbol = $parseIntAttr(this$static, 'dsy', dm.digitalSymbol?1:0) != 0;
|
|
dm.bodyDiode = $parseIntAttr(this$static, 'bd', dm.bodyDiode?1:0) != 0;
|
|
dm.bodyTerminal = $parseIntAttr(this$static, 'bt', dm.bodyTerminal?1:0) != 0;
|
|
dm.showBodyDiodeSymbol = $parseIntAttr(this$static, 'sbd', dm.showBodyDiodeSymbol?1:0) != 0;
|
|
continue;
|
|
}
|
|
if ($equals_1(tagName, 'clm')) {
|
|
this$static.currentXmlElement = elem;
|
|
undumpModelXml_0(this$static);
|
|
continue;
|
|
}
|
|
if ($equals_1(tagName, 'ccm')) {
|
|
this$static.currentXmlElement = elem;
|
|
undumpModelXml(this$static);
|
|
continue;
|
|
}
|
|
if ($equals_1(tagName, 'h')) {
|
|
this$static.currentXmlElement = elem;
|
|
this$static.app.hintType = $parseIntAttr(this$static, 't', -1);
|
|
this$static.app.hintItem1 = $parseIntAttr(this$static, 'i1', 0);
|
|
this$static.app.hintItem2 = $parseIntAttr(this$static, 'i2', 0);
|
|
continue;
|
|
}
|
|
if ($equals_1(tagName, 'adj')) {
|
|
this$static.currentXmlElement = elem;
|
|
undumpXml_3(this$static, this$static.app);
|
|
continue;
|
|
}
|
|
if ($equals_1(tagName, 'test')) {
|
|
continue;
|
|
}
|
|
if ($equals_1(tagName, 'switchevent')) {
|
|
continue;
|
|
}
|
|
if ($equals_1(tagName, 'scopedata')) {
|
|
continue;
|
|
}
|
|
x_0 = getAttribute(elem.jsObject, 'x');
|
|
if (x_0 == null)
|
|
continue;
|
|
className = $getStringValue(xmlDumpTypeMap, tagName);
|
|
if (className == null) {
|
|
console.log('unrecognized xml element: ' + tagName);
|
|
continue;
|
|
}
|
|
elm = constructElement(className, 0, 0);
|
|
this$static.currentXmlElement = elem;
|
|
elm.undumpXml(this$static);
|
|
$setPositionFromXml(elm, elem);
|
|
$add_11(this$static.app.elmList, elm);
|
|
}
|
|
}
|
|
|
|
function XMLDeserializer(app_){
|
|
this.app = app_;
|
|
}
|
|
|
|
defineClass(220, 1, {}, XMLDeserializer);
|
|
var Lcom_lushprojects_circuitjs1_client_XMLDeserializer_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'XMLDeserializer', 220);
|
|
function $dumpCircuit_0(this$static){
|
|
var ce, ce$iterator, doc, elem, f, h, i, i0, menus, root, sim, ui;
|
|
doc = ($clinit_XMLParser() , build($createDocumentImpl()));
|
|
root = $createElement(doc, 'cir');
|
|
$appendChild_0(doc, root);
|
|
menus = this$static.app.menus;
|
|
f = menus.dotsCheckItem.on?1:0;
|
|
f |= menus.smallGridCheckItem.on?2:0;
|
|
f |= menus.voltsCheckItem.on?0:4;
|
|
f |= menus.powerCheckItem.on?8:0;
|
|
f |= menus.showValuesCheckItem.on?0:16;
|
|
sim = this$static.app.sim;
|
|
f |= sim.adjustTimeStep?64:0;
|
|
f |= this$static.app.autoDCOnReset?128:0;
|
|
checkAttr(root, 'f');
|
|
$setAttribute_0(root, 'f', '' + f);
|
|
dumpAttr(root, 'ts', sim.maxTimeStep);
|
|
dumpAttr(root, 'ic', $getIterCount(this$static.app));
|
|
ui = this$static.app.ui;
|
|
dumpAttr_0(root, 'cb', ui.currentBar.val_0);
|
|
dumpAttr_0(root, 'pb', ui.powerBar.val_0);
|
|
dumpAttr(root, 'vr', voltageRange);
|
|
dumpAttr(root, 'mts', sim.minTimeStep);
|
|
sim.solverType != 0 && dumpAttr_0(root, 'st', sim.solverType);
|
|
for (ce$iterator = new ArrayList$1(this$static.app.elmList.arrayList); ce$iterator.i < ce$iterator.this$01.array.length;) {
|
|
ce = $next_4(ce$iterator);
|
|
elem = $createElement(doc, ce.getXmlDumpType());
|
|
ce.dumpXml(doc, elem);
|
|
ce.dumpXmlState(doc, elem);
|
|
$appendChild_0(root, elem);
|
|
}
|
|
for (i0 = 0; i0 != this$static.app.scopeManager.scopeCount; i0++)
|
|
$dumpXml_10(this$static.app.scopeManager.scopes[i0], doc, root);
|
|
for (i = 0; i != this$static.app.adjustables.arrayList.array.length; i++)
|
|
$dumpXml_1($get_4(this$static.app.adjustables, i), doc, root, this$static.app);
|
|
if (this$static.app.hintType != -1) {
|
|
h = $createElement(doc, 'h');
|
|
dumpAttr_0(h, 't', this$static.app.hintType);
|
|
dumpAttr_0(h, 'i1', this$static.app.hintItem1);
|
|
dumpAttr_0(h, 'i2', this$static.app.hintItem2);
|
|
$appendChild_0(root, h);
|
|
}
|
|
return prettyPrint(build(getDocumentElement(doc.jsObject)), 0);
|
|
}
|
|
|
|
function XMLSerializer_0(app_){
|
|
this.app = app_;
|
|
}
|
|
|
|
function checkAttr(elem, name_0){
|
|
if (getAttribute(elem.jsObject, name_0) != null)
|
|
throw toJs(new RuntimeException_0('naming conflict: ' + name_0));
|
|
}
|
|
|
|
function dumpAttr(elem, name_0, value_0){
|
|
checkAttr(elem, name_0);
|
|
$setAttribute_0(elem, name_0, '' + value_0);
|
|
}
|
|
|
|
function dumpAttr_0(elem, name_0, value_0){
|
|
checkAttr(elem, name_0);
|
|
$setAttribute_0(elem, name_0, '' + value_0);
|
|
}
|
|
|
|
function dumpAttr_1(elem, name_0, value_0){
|
|
checkAttr(elem, name_0);
|
|
value_0 = $replace_0($replace_0($replace_0($replace_0(value_0, '&', '&'), '"', '"'), "'", '''), '<', '<');
|
|
$setAttribute_0(elem, name_0, value_0);
|
|
}
|
|
|
|
function dumpAttr_2(elem, name_0, value_0){
|
|
checkAttr(elem, name_0);
|
|
$setAttribute_0(elem, name_0, '' + value_0);
|
|
}
|
|
|
|
function prettyPrint(node, indent){
|
|
var attr, attributes, child, children, hasElementChildren, i, i0, i1, indentStr, sb, text_0;
|
|
sb = new StringBuilder;
|
|
indentStr = '';
|
|
for (i0 = 0; i0 != indent; i0++)
|
|
indentStr += ' ';
|
|
$append_4($append_4((sb.string += indentStr , sb), '<'), getNodeName(node.jsObject));
|
|
attributes = new NamedNodeMapImpl(getAttributes(node.jsObject));
|
|
for (i1 = 0; i1 < getLength_1(attributes.jsObject); i1++) {
|
|
attr = build(item_3(attributes.jsObject, i1));
|
|
$append_4($append_4($append_4($append_4((sb.string += ' ' , sb), getNodeName(attr.jsObject)), '="'), $replace_0($replace_0($replace_0($replace_0(getNodeValue(attr.jsObject), '&', '&'), '<', '<'), '>', '>'), '"', '"')), '"');
|
|
}
|
|
children = new NodeListImpl(getChildNodes(node.jsObject));
|
|
if (getLength_1(children.jsObject) == 0) {
|
|
sb.string += '/>\n';
|
|
}
|
|
else {
|
|
sb.string += '>';
|
|
hasElementChildren = false;
|
|
for (i = 0; i < getLength_1(children.jsObject); i++) {
|
|
child = build(item_3(children.jsObject, i));
|
|
if (getNodeType(child.jsObject) == 1) {
|
|
hasElementChildren || (sb.string += '\n' , sb);
|
|
hasElementChildren = true;
|
|
$append_4(sb, prettyPrint(child, indent + 1));
|
|
}
|
|
else if (getNodeType(child.jsObject) == 3) {
|
|
text_0 = $trim(getNodeValue(child.jsObject));
|
|
text_0.length == 0 || $append_4(sb, $replace_0($replace_0($replace_0($replace_0(text_0, '&', '&'), '<', '<'), '>', '>'), '"', '"'));
|
|
}
|
|
}
|
|
hasElementChildren && (sb.string += indentStr , sb);
|
|
$append_4($append_4((sb.string += '<\/' , sb), getNodeName(node.jsObject)), '>\n');
|
|
}
|
|
return sb.string;
|
|
}
|
|
|
|
defineClass(709, 1, {}, XMLSerializer_0);
|
|
var Lcom_lushprojects_circuitjs1_client_XMLSerializer_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'XMLSerializer', 709);
|
|
function XorGateElm(xx, yy){
|
|
OrGateElm.call(this, xx, yy);
|
|
}
|
|
|
|
function XorGateElm_0(xa, ya, xb, yb, f, st){
|
|
OrGateElm_0.call(this, xa, ya, xb, yb, f, st);
|
|
}
|
|
|
|
defineClass(195, 224, $intern_138, XorGateElm, XorGateElm_0);
|
|
_.calcFunction = function calcFunction_1(){
|
|
var f, i;
|
|
f = false;
|
|
for (i = 0; i != this.inputCount; i++)
|
|
f = f ^ $getInput(this, i);
|
|
return f;
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_123(){
|
|
return 154;
|
|
}
|
|
;
|
|
_.getEditInfo = function getEditInfo_85(n){
|
|
if (n >= 3)
|
|
return $getEditInfo_0(this, n + 1);
|
|
return $getEditInfo_0(this, n);
|
|
}
|
|
;
|
|
_.getGateName = function getGateName_3(){
|
|
return 'XOR gate';
|
|
}
|
|
;
|
|
_.getGateText = function getGateText_2(){
|
|
return '=1';
|
|
}
|
|
;
|
|
_.getShortcut = function getShortcut_47(){
|
|
return 52;
|
|
}
|
|
;
|
|
_.setEditValue = function setEditValue_85(n, ei){
|
|
n >= 3?$setEditValue_1(this, n + 1, ei):$setEditValue_1(this, n, ei);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_XorGateElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'XorGateElm', 195);
|
|
function XnorGateElm(xx, yy){
|
|
XorGateElm.call(this, xx, yy);
|
|
}
|
|
|
|
function XnorGateElm_0(xa, ya, xb, yb, f, st){
|
|
XorGateElm_0.call(this, xa, ya, xb, yb, f, st);
|
|
}
|
|
|
|
defineClass(432, 195, $intern_138, XnorGateElm, XnorGateElm_0);
|
|
_.getDumpType = function getDumpType_124(){
|
|
return 431;
|
|
}
|
|
;
|
|
_.getGateName = function getGateName_4(){
|
|
return 'XNOR gate';
|
|
}
|
|
;
|
|
_.getShortcut = function getShortcut_48(){
|
|
return 36;
|
|
}
|
|
;
|
|
_.isInverting = function isInverting_2(){
|
|
return true;
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_XnorGateElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'XnorGateElm', 432);
|
|
function ZenerElm(xx, yy){
|
|
DiodeElm.call(this, xx, yy);
|
|
this.modelName = lastZenerModelName;
|
|
$setup_0(this);
|
|
}
|
|
|
|
function ZenerElm_0(xa, ya, xb, yb, f, st){
|
|
var zvoltage;
|
|
DiodeElm_0.call(this, xa, ya, xb, yb, f, st);
|
|
if ((f & 2) == 0) {
|
|
zvoltage = $doubleValue(__parseAndValidateDouble($nextToken(st)));
|
|
this.model = getModelWithParameters(this.model.fwdrop, zvoltage);
|
|
this.modelName = this.model.name_0;
|
|
console_0('model name wparams = ' + this.modelName);
|
|
}
|
|
$setup_0(this);
|
|
}
|
|
|
|
defineClass(276, 154, {8:1, 154:1, 10:1, 276:1}, ZenerElm, ZenerElm_0);
|
|
_.draw = function draw_92(g){
|
|
var v1, v2;
|
|
$setBbox_0(this, this.point1, this.point2, 8);
|
|
v1 = this.volts[0];
|
|
v2 = this.volts[1];
|
|
$draw2Leads(this, g);
|
|
$setPowerColor_0(this, g);
|
|
$setColor_0(g, $getVoltageColor(this, v1));
|
|
$fillPolygon(g, this.poly);
|
|
$setColor_0(g, $getVoltageColor(this, v2));
|
|
drawThickLine_0(g, this.cathode[0], this.cathode[1], 3);
|
|
drawThickLine_0(g, this.wing[0], this.cathode[0], 3);
|
|
drawThickLine_0(g, this.wing[1], this.cathode[1], 3);
|
|
this.curcount_0 = $updateDotCount(this.current_0, this.curcount_0);
|
|
app_0.mouse.dragElm == this || $drawDots(g, this.point1, this.point2, this.curcount_0);
|
|
$drawPosts(this, g);
|
|
}
|
|
;
|
|
_.getDumpType = function getDumpType_125(){
|
|
return 122;
|
|
}
|
|
;
|
|
_.getElmType = function getElmType_25(){
|
|
return 'Zener diode';
|
|
}
|
|
;
|
|
_.getInfo_0 = function getInfo_95(arr){
|
|
$getInfo_3(this, arr);
|
|
arr[0] = 'Zener diode';
|
|
arr[5] = 'Vz = ' + getUnitText(this.model.breakdownVoltage, 'V', false);
|
|
}
|
|
;
|
|
_.getShortcut = function getShortcut_49(){
|
|
return 122;
|
|
}
|
|
;
|
|
_.setPoints = function setPoints_82(){
|
|
var pa;
|
|
$setPoints_10(this);
|
|
$calcLeads(this, 16);
|
|
this.cathode = $newPointArray(2);
|
|
this.wing = $newPointArray(2);
|
|
pa = $newPointArray(2);
|
|
$interpPoint2(this.lead1, this.lead2, pa[0], pa[1], 0, 8);
|
|
$interpPoint2(this.lead1, this.lead2, this.cathode[0], this.cathode[1], 1, 8);
|
|
$interpPoint_2(this.cathode[0], this.cathode[1], this.wing[0], -0.2, -8);
|
|
$interpPoint_2(this.cathode[1], this.cathode[0], this.wing[1], -0.2, -8);
|
|
this.poly = $createPolygon(pa[0], pa[1], this.lead2);
|
|
}
|
|
;
|
|
var lastZenerModelName = 'default-zener';
|
|
var Lcom_lushprojects_circuitjs1_client_ZenerElm_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'ZenerElm', 276);
|
|
function $language(){
|
|
if (navigator.languages) {
|
|
if (navigator.languages.length > 0) {
|
|
return navigator.languages[0];
|
|
}
|
|
else {
|
|
return 'en-US';
|
|
}
|
|
}
|
|
else {
|
|
return navigator.language || navigator.userLanguage;
|
|
}
|
|
}
|
|
|
|
function $loadLocale(){
|
|
var lang_0, localizationMap, qp, requestBuilder, stor, url_0;
|
|
qp = new QueryParameters;
|
|
lang_0 = $getStringValue(qp.map_0, 'lang');
|
|
if (lang_0 == null) {
|
|
stor = (!localStorage_0 && ($clinit_Storage$StorageSupportDetector() , localStorageSupported) && (localStorage_0 = new Storage_0('localStorage')) , localStorage_0);
|
|
!!stor && (lang_0 = $getItem_0(stor.storage, 'language'));
|
|
lang_0 == null && (lang_0 = $language());
|
|
}
|
|
$equalsIgnoreCase(lang_0, 'zh-tw') || $equalsIgnoreCase(lang_0, 'zh-cht')?(lang_0 = 'zh-tw'):(lang_0 = $replaceFirst(lang_0, ''));
|
|
if ($equals_1(lang_0.substr(0, 2), 'en')) {
|
|
localizationMap = new HashMap;
|
|
$loadSimulator(localizationMap);
|
|
return;
|
|
}
|
|
url_0 = getModuleBaseURL() + 'locale_' + lang_0 + '.txt';
|
|
requestBuilder = new RequestBuilder(($clinit_RequestBuilder() , GET), url_0);
|
|
try {
|
|
$sendRequest(requestBuilder, new circuitjs1$1);
|
|
}
|
|
catch ($e0) {
|
|
$e0 = toJava($e0);
|
|
if (!instanceOf($e0, 156))
|
|
throw toJs($e0);
|
|
}
|
|
}
|
|
|
|
function $loadSimulator(localizationMap){
|
|
localizationMap_0 = localizationMap;
|
|
theApp_0 = new CirSim;
|
|
$init_1(theApp_0);
|
|
addResizeHandler(new circuitjs1$2);
|
|
$updateCircuit(theApp_0.ui);
|
|
}
|
|
|
|
function $processLocale(data_0){
|
|
var i, line, lines, localizationMap, q2, str1, str2;
|
|
localizationMap = new HashMap;
|
|
lines = $split_1(data_0, '\r?\n', 0);
|
|
for (i = 0; i != lines.length; i++) {
|
|
line = lines[i];
|
|
if (line.length == 0)
|
|
continue;
|
|
checkCriticalStringElementIndex(0, line.length);
|
|
if (line.charCodeAt(0) != 34) {
|
|
console.log('ignoring line in string catalog: ' + line);
|
|
continue;
|
|
}
|
|
line = convertUnicodeEscapes(line);
|
|
q2 = $indexOf_2(line, fromCodePoint(34), 1);
|
|
if (q2 < 0 || (checkCriticalStringElementIndex(q2 + 1, line.length) , line.charCodeAt(q2 + 1) != 61) || (checkCriticalStringElementIndex(q2 + 2, line.length) , line.charCodeAt(q2 + 2) != 34) || $charAt_0(line, line.length - 1) != 34) {
|
|
console.log('ignoring line in string catalog: ' + line);
|
|
continue;
|
|
}
|
|
str1 = line.substr(1, q2 - 1);
|
|
str2 = $substring_0(line, q2 + 3, line.length - 1);
|
|
str1 == null?$put_1(localizationMap.hashCodeMap, null, str2):$put_2(localizationMap.stringMap, str1, str2);
|
|
}
|
|
return localizationMap;
|
|
}
|
|
|
|
function convertUnicodeEscapes(input_0){
|
|
var codePoint, hexCode, i, length_0, result;
|
|
if (input_0.indexOf('\\u') < 0)
|
|
return input_0;
|
|
result = new StringBuilder;
|
|
length_0 = input_0.length;
|
|
i = 0;
|
|
while (i < length_0) {
|
|
if (i + 5 < length_0 && (checkCriticalStringElementIndex(i, input_0.length) , input_0.charCodeAt(i) == 92) && (checkCriticalStringElementIndex(i + 1, input_0.length) , input_0.charCodeAt(i + 1) == 117)) {
|
|
hexCode = input_0.substr(i + 2, i + 6 - (i + 2));
|
|
try {
|
|
codePoint = __parseAndValidateInt(hexCode, 16);
|
|
$append_0(result, codePoint & $intern_8);
|
|
i += 6;
|
|
}
|
|
catch ($e0) {
|
|
$e0 = toJava($e0);
|
|
if (instanceOf($e0, 147)) {
|
|
$append_4((result.string += '\\u' , result), hexCode);
|
|
i += 6;
|
|
}
|
|
else
|
|
throw toJs($e0);
|
|
}
|
|
}
|
|
else {
|
|
$append_0(result, (checkCriticalStringElementIndex(i, input_0.length) , input_0.charCodeAt(i)));
|
|
++i;
|
|
}
|
|
}
|
|
return result.string;
|
|
}
|
|
|
|
var theApp_0;
|
|
function circuitjs1$1(){
|
|
}
|
|
|
|
defineClass(461, 1, {}, circuitjs1$1);
|
|
_.onError = function onError_2(request, exception){
|
|
}
|
|
;
|
|
_.onResponseReceived = function onResponseReceived_2(request, response){
|
|
var localizationMap, text_0;
|
|
if (response.xmlHttpRequest.status == 200) {
|
|
text_0 = response.xmlHttpRequest.responseText;
|
|
localizationMap = $processLocale(text_0);
|
|
}
|
|
else {
|
|
localizationMap = new HashMap;
|
|
}
|
|
$loadSimulator(localizationMap);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_circuitjs1$1_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'circuitjs1/1', 461);
|
|
function circuitjs1$2(){
|
|
}
|
|
|
|
defineClass(463, 1, $intern_41, circuitjs1$2);
|
|
_.onResize = function onResize_8(event_0){
|
|
$setCanvasSize(theApp_0.ui);
|
|
$setiFrameHeight(theApp_0.ui);
|
|
}
|
|
;
|
|
var Lcom_lushprojects_circuitjs1_client_circuitjs1$2_2_classLit = createForClass('com.lushprojects.circuitjs1.client', 'circuitjs1/2', 463);
|
|
function DGrowArray(){
|
|
this.data_0 = initUnidimensionalArray(D_classLit, $intern_76, 7, 0, 15, 1);
|
|
}
|
|
|
|
defineClass(301, 1, {}, DGrowArray);
|
|
var Lcom_lushprojects_circuitjs1_client_matrix_DGrowArray_2_classLit = createForClass('com.lushprojects.circuitjs1.client.matrix', 'DGrowArray', 301);
|
|
function $clinit_DMatrixSparseCSC(){
|
|
$clinit_DMatrixSparseCSC = emptyMethod;
|
|
EPS = $wnd.Math.pow(2, -52);
|
|
}
|
|
|
|
function $growMaxLength(this$static, arrayLength, preserveValue){
|
|
var data_0, row_idx;
|
|
if (arrayLength < 0)
|
|
throw toJs(new IllegalArgumentException_0('Negative array length. Overflow?'));
|
|
if (arrayLength > this$static.nz_values.length) {
|
|
data_0 = initUnidimensionalArray(D_classLit, $intern_76, 7, arrayLength, 15, 1);
|
|
row_idx = initUnidimensionalArray(I_classLit, $intern_25, 7, arrayLength, 15, 1);
|
|
if (preserveValue) {
|
|
arraycopy(this$static.nz_values, data_0, this$static.nz_length);
|
|
arraycopy(this$static.nz_rows, row_idx, this$static.nz_length);
|
|
}
|
|
this$static.nz_values = data_0;
|
|
this$static.nz_rows = row_idx;
|
|
}
|
|
}
|
|
|
|
function $reshape(this$static, numRows, numCols, arrayLength){
|
|
if (numRows < 0 || numCols < 0 || arrayLength < 0)
|
|
throw toJs(new IllegalArgumentException_0('Rows, columns, and arrayLength must be not be negative'));
|
|
this$static.numRows = numRows;
|
|
this$static.numCols = numCols;
|
|
$growMaxLength(this$static, arrayLength, false);
|
|
this$static.nz_length = 0;
|
|
numCols + 1 > this$static.col_idx.length?(this$static.col_idx = initUnidimensionalArray(I_classLit, $intern_25, 7, numCols + 1, 15, 1)):fill(this$static.col_idx, numCols + 1);
|
|
}
|
|
|
|
function DMatrixSparseCSC(numRows, numCols, arrayLength){
|
|
$clinit_DMatrixSparseCSC();
|
|
this.nz_values = initUnidimensionalArray(D_classLit, $intern_76, 7, 0, 15, 1);
|
|
this.nz_rows = initUnidimensionalArray(I_classLit, $intern_25, 7, 0, 15, 1);
|
|
if (numRows < 0 || numCols < 0 || arrayLength < 0)
|
|
throw toJs(new IllegalArgumentException_0('Rows, columns, and arrayLength must be not be negative'));
|
|
this.numRows = numRows;
|
|
this.numCols = numCols;
|
|
this.nz_length = 0;
|
|
this.col_idx = initUnidimensionalArray(I_classLit, $intern_25, 7, numCols + 1, 15, 1);
|
|
$growMaxLength(this, arrayLength, false);
|
|
}
|
|
|
|
function convert(circuitMatrix, tol){
|
|
$clinit_DMatrixSparseCSC();
|
|
var dst, i, i0, j, j0, nonzero, value_0;
|
|
nonzero = 0;
|
|
for (i0 = 0; i0 != circuitMatrix.length; i0++)
|
|
for (j0 = 0; j0 != circuitMatrix.length; j0++) {
|
|
circuitMatrix[i0][j0] != 0 && ++nonzero;
|
|
}
|
|
dst = new DMatrixSparseCSC(circuitMatrix.length, circuitMatrix.length, nonzero);
|
|
dst.nz_length = 0;
|
|
dst.col_idx[0] = 0;
|
|
for (i = 0; i != circuitMatrix.length; i++) {
|
|
for (j = 0; j != circuitMatrix.length; j++) {
|
|
value_0 = circuitMatrix[j][i];
|
|
if (!($wnd.Math.abs(value_0) <= tol)) {
|
|
dst.nz_rows[dst.nz_length] = j;
|
|
dst.nz_values[dst.nz_length] = value_0;
|
|
++dst.nz_length;
|
|
}
|
|
}
|
|
dst.col_idx[i + 1] = dst.nz_length;
|
|
}
|
|
return dst;
|
|
}
|
|
|
|
defineClass(297, 1, {}, DMatrixSparseCSC);
|
|
_.numCols = 0;
|
|
_.numRows = 0;
|
|
_.nz_length = 0;
|
|
var EPS = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_matrix_DMatrixSparseCSC_2_classLit = createForClass('com.lushprojects.circuitjs1.client.matrix', 'DMatrixSparseCSC', 297);
|
|
function IGrowArray(){
|
|
this.data_0 = initUnidimensionalArray(I_classLit, $intern_25, 7, 0, 15, 1);
|
|
}
|
|
|
|
defineClass(309, 1, {}, IGrowArray);
|
|
var Lcom_lushprojects_circuitjs1_client_matrix_IGrowArray_2_classLit = createForClass('com.lushprojects.circuitjs1.client.matrix', 'IGrowArray', 309);
|
|
function $initialize_0(this$static, A){
|
|
var i, m, n, o;
|
|
m = A.numRows;
|
|
n = A.numCols;
|
|
o = $wnd.Math.min(m, n);
|
|
$reshape(this$static.L, m, m, 4 * A.nz_length + o);
|
|
this$static.L.nz_length = 0;
|
|
$reshape(this$static.U, m, n, 4 * A.nz_length + o);
|
|
this$static.U.nz_length = 0;
|
|
if (this$static.pinv.length != m) {
|
|
this$static.pinv = initUnidimensionalArray(I_classLit, $intern_25, 7, m, 15, 1);
|
|
this$static.x_0 = initUnidimensionalArray(D_classLit, $intern_76, 7, m, 15, 1);
|
|
}
|
|
for (i = 0; i < m; ++i) {
|
|
this$static.pinv[i] = -1;
|
|
this$static.L.col_idx[i] = 0;
|
|
}
|
|
}
|
|
|
|
function $performLU(this$static, A){
|
|
var a, i, ipiv, k, m, n, p, p0, pivot, t, top_0, w, xi;
|
|
m = A.numRows;
|
|
n = A.numCols;
|
|
w = adjust_0(this$static.gw, m * 2, m);
|
|
for (k = 0; k < n; ++k) {
|
|
this$static.L.col_idx[k] = this$static.L.nz_length;
|
|
this$static.U.col_idx[k] = this$static.U.nz_length;
|
|
this$static.L.nz_length + n > this$static.L.nz_values.length && $growMaxLength(this$static.L, 2 * this$static.L.nz_values.length + n, true);
|
|
this$static.U.nz_length + n > this$static.U.nz_values.length && $growMaxLength(this$static.U, 2 * this$static.U.nz_values.length + n, true);
|
|
top_0 = solveColB(this$static.L, A, k, this$static.x_0, this$static.pinv, this$static.gxi, w);
|
|
xi = this$static.gxi.data_0;
|
|
ipiv = -1;
|
|
a = -1.7976931348623157E308;
|
|
for (p0 = top_0; p0 < n; ++p0) {
|
|
i = xi[p0];
|
|
if (this$static.pinv[i] < 0) {
|
|
if ((t = $wnd.Math.abs(this$static.x_0[i])) > a) {
|
|
a = t;
|
|
ipiv = i;
|
|
}
|
|
}
|
|
else {
|
|
this$static.U.nz_rows[this$static.U.nz_length] = this$static.pinv[i];
|
|
this$static.U.nz_values[this$static.U.nz_length++] = this$static.x_0[i];
|
|
}
|
|
}
|
|
if (ipiv == -1 || a <= 0) {
|
|
return false;
|
|
}
|
|
pivot = this$static.x_0[ipiv];
|
|
this$static.U.nz_rows[this$static.U.nz_length] = k;
|
|
this$static.U.nz_values[this$static.U.nz_length++] = pivot;
|
|
this$static.pinv[ipiv] = k;
|
|
this$static.L.nz_rows[this$static.L.nz_length] = ipiv;
|
|
this$static.L.nz_values[this$static.L.nz_length++] = 1;
|
|
for (p = top_0; p < n; ++p) {
|
|
i = xi[p];
|
|
if (this$static.pinv[i] < 0) {
|
|
this$static.L.nz_rows[this$static.L.nz_length] = i;
|
|
this$static.L.nz_values[this$static.L.nz_length++] = this$static.x_0[i] / pivot;
|
|
}
|
|
this$static.x_0[i] = 0;
|
|
}
|
|
}
|
|
this$static.L.col_idx[n] = this$static.L.nz_length;
|
|
this$static.U.col_idx[n] = this$static.U.nz_length;
|
|
for (k = 0; k < this$static.L.nz_length; ++k) {
|
|
this$static.L.nz_rows[k] = this$static.pinv[this$static.L.nz_rows[k]];
|
|
}
|
|
return true;
|
|
}
|
|
|
|
function $setA(this$static, A){
|
|
this$static.AnumRows = A.numRows;
|
|
return $initialize_0(this$static, A) , $performLU(this$static, A);
|
|
}
|
|
|
|
function $solve(this$static, B, X){
|
|
var L, U, b, i, i0, var10002, x_0;
|
|
if (B.length != this$static.AnumRows) {
|
|
var10002 = B.length;
|
|
throw toJs(new IllegalArgumentException_0('Unexpected number of rows in B based on shape of A. Found=' + var10002 + ' Expected=' + this$static.AnumRows));
|
|
}
|
|
x_0 = adjust(this$static.gx, X.length);
|
|
b = adjust(this$static.gb, B.length);
|
|
L = this$static.L;
|
|
U = this$static.U;
|
|
for (i0 = 0; i0 < B.length; i0++) {
|
|
b[i0] = B[i0];
|
|
}
|
|
permuteInv(this$static.pinv, b, x_0, X.length);
|
|
solveL(L, x_0);
|
|
solveU(U, x_0);
|
|
for (i = 0; i < X.length; i++) {
|
|
X[i] = x_0[i];
|
|
}
|
|
}
|
|
|
|
function SparseLU(){
|
|
this.gw = new IGrowArray;
|
|
this.L = new DMatrixSparseCSC(0, 0, 0);
|
|
this.U = new DMatrixSparseCSC(0, 0, 0);
|
|
this.x_0 = initUnidimensionalArray(D_classLit, $intern_76, 7, 0, 15, 1);
|
|
this.gxi = new IGrowArray;
|
|
this.pinv = initUnidimensionalArray(I_classLit, $intern_25, 7, 0, 15, 1);
|
|
this.gx = new DGrowArray;
|
|
this.gb = new DGrowArray;
|
|
}
|
|
|
|
function adjust(gwork, desired){
|
|
gwork.data_0.length < desired && (gwork.data_0 = initUnidimensionalArray(D_classLit, $intern_76, 7, desired, 15, 1));
|
|
return gwork.data_0;
|
|
}
|
|
|
|
function adjust_0(gwork, desired, zeroToM){
|
|
var w;
|
|
w = (gwork.data_0.length < desired && (gwork.data_0 = initUnidimensionalArray(I_classLit, $intern_25, 7, desired, 15, 1)) , gwork.data_0);
|
|
checkCriticalArrayBounds(zeroToM, w.length);
|
|
fill0(w, zeroToM);
|
|
return w;
|
|
}
|
|
|
|
function permuteInv(perm, input_0, output, N){
|
|
var k;
|
|
for (k = 0; k < N; ++k) {
|
|
output[perm[k]] = input_0[k];
|
|
}
|
|
}
|
|
|
|
function searchNzRowsInX(G, B, colB, pinv, xi, w){
|
|
var X_rows, i, idx0, idx1, rowB, top_0;
|
|
X_rows = G.numCols;
|
|
if (xi.length < X_rows) {
|
|
throw toJs(new IllegalArgumentException_0('xi must be at least G.numCols=' + G.numCols));
|
|
}
|
|
else if (w.length < 2 * X_rows) {
|
|
throw toJs(new IllegalArgumentException_0('w must be at least 2*G.numCols in length (2*number of rows in X) and first N elements must be zero'));
|
|
}
|
|
else {
|
|
idx0 = B.col_idx[colB];
|
|
idx1 = B.col_idx[colB + 1];
|
|
top_0 = X_rows;
|
|
for (i = idx0; i < idx1; ++i) {
|
|
rowB = B.nz_rows[i];
|
|
rowB < X_rows && w[rowB] == 0 && (top_0 = searchNzRowsInX_DFS(rowB, G, top_0, pinv, xi, w));
|
|
}
|
|
for (i = top_0; i < X_rows; ++i) {
|
|
w[xi[i]] = 0;
|
|
}
|
|
return top_0;
|
|
}
|
|
}
|
|
|
|
function searchNzRowsInX_DFS(rowB, G, top_0, pinv, xi, w){
|
|
var G_col, G_col_new, N, done, head, idx0, idx1, j, jrow;
|
|
N = G.numCols;
|
|
head = 0;
|
|
xi[0] = rowB;
|
|
while (head >= 0) {
|
|
G_col = xi[head];
|
|
G_col_new = pinv[G_col];
|
|
if (w[G_col] == 0) {
|
|
w[G_col] = 1;
|
|
w[N + head] = G_col_new >= 0 && G_col_new < N?G.col_idx[G_col_new]:0;
|
|
}
|
|
done = true;
|
|
idx0 = w[N + head];
|
|
idx1 = G_col_new >= 0 && G_col_new < N?G.col_idx[G_col_new + 1]:0;
|
|
for (j = idx0; j < idx1; ++j) {
|
|
jrow = G.nz_rows[j];
|
|
if (jrow < N && w[jrow] == 0) {
|
|
w[N + head] = j + 1;
|
|
++head;
|
|
xi[head] = jrow;
|
|
done = false;
|
|
break;
|
|
}
|
|
}
|
|
if (done) {
|
|
--head;
|
|
--top_0;
|
|
xi[top_0] = G_col;
|
|
}
|
|
}
|
|
return top_0;
|
|
}
|
|
|
|
function solveColB(G, B, colB, x_0, pinv, g_xi, w){
|
|
var J, X_rows, idxB0, idxB1, j, p, px, q, top_0, var10001, xi;
|
|
X_rows = G.numCols;
|
|
xi = (g_xi.data_0.length < X_rows && (g_xi.data_0 = initUnidimensionalArray(I_classLit, $intern_25, 7, X_rows, 15, 1)) , g_xi.data_0);
|
|
top_0 = searchNzRowsInX(G, B, colB, pinv, xi, w);
|
|
for (idxB0 = top_0; idxB0 < X_rows; ++idxB0) {
|
|
x_0[xi[idxB0]] = 0;
|
|
}
|
|
idxB0 = B.col_idx[colB];
|
|
idxB1 = B.col_idx[colB + 1];
|
|
for (px = idxB0; px < idxB1; ++px) {
|
|
x_0[B.nz_rows[px]] = B.nz_values[px];
|
|
}
|
|
for (px = top_0; px < X_rows; ++px) {
|
|
j = xi[px];
|
|
J = pinv[j];
|
|
if (J >= 0) {
|
|
x_0[j] /= G.nz_values[G.col_idx[J]];
|
|
p = G.col_idx[J] + 1;
|
|
q = G.col_idx[J + 1];
|
|
while (p < q) {
|
|
var10001 = G.nz_rows[p];
|
|
x_0[var10001] -= G.nz_values[p] * x_0[j];
|
|
++p;
|
|
}
|
|
}
|
|
}
|
|
return top_0;
|
|
}
|
|
|
|
function solveL(L, x_0){
|
|
var N, col, i, idx0, idx1, row, x_j;
|
|
N = L.numCols;
|
|
idx0 = L.col_idx[0];
|
|
for (col = 0; col < N; ++col) {
|
|
idx1 = L.col_idx[col + 1];
|
|
x_j = x_0[col] /= L.nz_values[idx0];
|
|
for (i = idx0 + 1; i < idx1; ++i) {
|
|
row = L.nz_rows[i];
|
|
x_0[row] -= L.nz_values[i] * x_j;
|
|
}
|
|
idx0 = idx1;
|
|
}
|
|
}
|
|
|
|
function solveU(U, x_0){
|
|
var N, col, i, idx0, idx1, row, x_j;
|
|
N = U.numCols;
|
|
idx1 = U.col_idx[N];
|
|
for (col = N - 1; col >= 0; --col) {
|
|
idx0 = U.col_idx[col];
|
|
x_j = x_0[col] /= U.nz_values[idx1 - 1];
|
|
for (i = idx0; i < idx1 - 1; ++i) {
|
|
row = U.nz_rows[i];
|
|
x_0[row] -= U.nz_values[i] * x_j;
|
|
}
|
|
idx1 = idx0;
|
|
}
|
|
}
|
|
|
|
defineClass(824, 1, {}, SparseLU);
|
|
_.AnumRows = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_matrix_SparseLU_2_classLit = createForClass('com.lushprojects.circuitjs1.client.matrix', 'SparseLU', 824);
|
|
function LS(s){
|
|
var ix, sm;
|
|
if (s == null)
|
|
return null;
|
|
if (s.length == 0) {
|
|
return s;
|
|
}
|
|
sm = $getStringValue(localizationMap_0, s);
|
|
if (sm != null)
|
|
return sm;
|
|
ix = $indexOf_1(s, fromCodePoint(126));
|
|
if (ix != s.length - 1)
|
|
return s;
|
|
s = s.substr(0, ix);
|
|
sm = $getStringValue(localizationMap_0, s);
|
|
if (sm != null)
|
|
return sm;
|
|
return s;
|
|
}
|
|
|
|
function weAreInGermany(){
|
|
try {
|
|
l = navigator.languages?navigator.languages[0]:navigator.language || navigator.userLanguage;
|
|
return l.toUpperCase().startsWith('DE');
|
|
}
|
|
catch (e) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
function weAreInUS(orCanada){
|
|
try {
|
|
l = navigator.languages?navigator.languages[0]:navigator.language || navigator.userLanguage;
|
|
if (l.length > 2) {
|
|
l = l.slice(-2).toUpperCase();
|
|
return l == 'US' || l == 'CA' && orCanada;
|
|
}
|
|
else {
|
|
return 0;
|
|
}
|
|
}
|
|
catch (e) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
var localizationMap_0, muString = '\u03BC', ohmString = '\u03A9';
|
|
function $startContext(this$static, name_0){
|
|
var newEntry;
|
|
newEntry = $startNewEntry(this$static.ctx);
|
|
if (!this$static.ctx) {
|
|
this$static.ctx = newEntry;
|
|
if (!this$static.rootCtx) {
|
|
this$static.rootCtxName = name_0;
|
|
this$static.rootCtx = this$static.ctx;
|
|
}
|
|
}
|
|
else {
|
|
$AddChild(this$static.ctx, name_0, newEntry) && (this$static.ctx = newEntry);
|
|
}
|
|
}
|
|
|
|
function $startNewEntry(parent_0){
|
|
var newEntry;
|
|
newEntry = new PerfMonitor$PerfEntry(parent_0);
|
|
newEntry.startTime = getTime_0();
|
|
return newEntry;
|
|
}
|
|
|
|
function $stopContext(this$static){
|
|
if (this$static.ctx) {
|
|
this$static.ctx.endTime = getTime_0();
|
|
this$static.ctx.length_0 = this$static.ctx.endTime - this$static.ctx.startTime;
|
|
this$static.ctx = this$static.ctx.parent_0;
|
|
}
|
|
}
|
|
|
|
function PerfMonitor(){
|
|
}
|
|
|
|
function buildStringInternal(sb, name_0, entry0, depth){
|
|
var child, entry, key, key$iterator, keys_0, outerIter, x_0;
|
|
for (x_0 = 0; x_0 < depth; x_0++) {
|
|
sb.string += '-';
|
|
}
|
|
sb.string += '' + name_0;
|
|
sb.string += ': ';
|
|
$append_1(sb, entry0.length_0);
|
|
sb.string += '\n';
|
|
keys_0 = new AbstractMap$1(entry0.children);
|
|
for (key$iterator = (outerIter = new AbstractHashMap$EntrySetIterator((new AbstractHashMap$EntrySet(keys_0.this$01)).this$01) , new AbstractMap$1$1(outerIter)); key$iterator.val$outerIter2.hasNext;) {
|
|
key = (entry = $next_2(key$iterator.val$outerIter2) , entry.getKey());
|
|
child = $getStringValue(entry0.children, key);
|
|
buildStringInternal(sb, key, child, depth + 1);
|
|
}
|
|
}
|
|
|
|
function getTime_0(){
|
|
if (window.performance.now) {
|
|
return window.performance.now();
|
|
}
|
|
else {
|
|
if (window.performance.webkitNow) {
|
|
return window.performance.webkitNow();
|
|
}
|
|
else {
|
|
return (new Date).getTime();
|
|
}
|
|
}
|
|
}
|
|
|
|
defineClass(706, 1, {}, PerfMonitor);
|
|
var Lcom_lushprojects_circuitjs1_client_util_PerfMonitor_2_classLit = createForClass('com.lushprojects.circuitjs1.client.util', 'PerfMonitor', 706);
|
|
function $AddChild(this$static, name_0, entry){
|
|
if (!$hasStringValue(this$static.children, name_0)) {
|
|
$putStringValue(this$static.children, name_0, entry);
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
function PerfMonitor$PerfEntry(p){
|
|
this.parent_0 = p;
|
|
this.children = new HashMap;
|
|
}
|
|
|
|
defineClass(339, 1, {339:1}, PerfMonitor$PerfEntry);
|
|
_.endTime = 0;
|
|
_.length_0 = 0;
|
|
_.startTime = 0;
|
|
var Lcom_lushprojects_circuitjs1_client_util_PerfMonitor$PerfEntry_2_classLit = createForClass('com.lushprojects.circuitjs1.client.util', 'PerfMonitor/PerfEntry', 339);
|
|
defineClass(972, 1, {});
|
|
var Ljava_io_OutputStream_2_classLit = createForClass('java.io', 'OutputStream', 972);
|
|
defineClass(973, 972, {});
|
|
var Ljava_io_FilterOutputStream_2_classLit = createForClass('java.io', 'FilterOutputStream', 973);
|
|
function PrintStream(){
|
|
}
|
|
|
|
defineClass(471, 973, {}, PrintStream);
|
|
var Ljava_io_PrintStream_2_classLit = createForClass('java.io', 'PrintStream', 471);
|
|
function $charAt(this$static, index_0){
|
|
return $charAt_0(this$static.string, index_0);
|
|
}
|
|
|
|
function $replace0(this$static, start_0, end, toInsert){
|
|
this$static.string = $substring_0(this$static.string, 0, start_0) + ('' + toInsert) + $substring(this$static.string, end);
|
|
}
|
|
|
|
function $setCharAt(this$static, index_0, x_0){
|
|
$replace0(this$static, index_0, index_0 + 1, String.fromCharCode(x_0));
|
|
}
|
|
|
|
function AbstractStringBuilder(string){
|
|
this.string = string;
|
|
}
|
|
|
|
defineClass(252, 1, {317:1});
|
|
_.toString_0 = function toString_23(){
|
|
return this.string;
|
|
}
|
|
;
|
|
var Ljava_lang_AbstractStringBuilder_2_classLit = createForClass('java.lang', 'AbstractStringBuilder', 252);
|
|
function ArithmeticException(){
|
|
RuntimeException_0.call(this, 'divide by zero');
|
|
}
|
|
|
|
defineClass(472, 83, $intern_7, ArithmeticException);
|
|
var Ljava_lang_ArithmeticException_2_classLit = createForClass('java.lang', 'ArithmeticException', 472);
|
|
function IndexOutOfBoundsException(){
|
|
RuntimeException.call(this);
|
|
}
|
|
|
|
function IndexOutOfBoundsException_0(message){
|
|
RuntimeException_0.call(this, message);
|
|
}
|
|
|
|
defineClass(62, 83, $intern_7, IndexOutOfBoundsException, IndexOutOfBoundsException_0);
|
|
var Ljava_lang_IndexOutOfBoundsException_2_classLit = createForClass('java.lang', 'IndexOutOfBoundsException', 62);
|
|
function ArrayIndexOutOfBoundsException(){
|
|
IndexOutOfBoundsException.call(this);
|
|
}
|
|
|
|
function ArrayIndexOutOfBoundsException_0(msg){
|
|
IndexOutOfBoundsException_0.call(this, msg);
|
|
}
|
|
|
|
defineClass(350, 62, $intern_7, ArrayIndexOutOfBoundsException, ArrayIndexOutOfBoundsException_0);
|
|
var Ljava_lang_ArrayIndexOutOfBoundsException_2_classLit = createForClass('java.lang', 'ArrayIndexOutOfBoundsException', 350);
|
|
function $clinit_Boolean(){
|
|
$clinit_Boolean = emptyMethod;
|
|
FALSE = false;
|
|
}
|
|
|
|
function $booleanValue(this$static){
|
|
return checkCriticalNotNull(this$static) , this$static;
|
|
}
|
|
|
|
function compare_9(x_0, y_0){
|
|
$clinit_Boolean();
|
|
return x_0 == y_0?0:x_0?1:-1;
|
|
}
|
|
|
|
function compareTo_Ljava_lang_Object__I__devirtual$(this$static, other){
|
|
$clinit_Boolean();
|
|
return instanceOfString(this$static)?$compareTo(this$static, other):instanceOfDouble(this$static)?compare_10((checkCriticalNotNull(this$static) , this$static), (checkCriticalNotNull(other) , other)):instanceOfBoolean(this$static)?compare_9((checkCriticalNotNull(this$static) , this$static), (checkCriticalNotNull(other) , other)):this$static.compareTo(other);
|
|
}
|
|
|
|
booleanCastMap = {3:1, 281:1, 16:1};
|
|
var FALSE;
|
|
var Ljava_lang_Boolean_2_classLit = createForClass('java.lang', 'Boolean', 281);
|
|
function Character(value_0){
|
|
this.value_0 = value_0;
|
|
}
|
|
|
|
function codePointAt(cs, index_0, limit){
|
|
var hiSurrogate, loSurrogate;
|
|
hiSurrogate = $charAt_0(cs, index_0++);
|
|
if (hiSurrogate >= 55296 && hiSurrogate <= 56319 && index_0 < limit && isLowSurrogate(loSurrogate = (checkCriticalStringElementIndex(index_0, cs.length) , cs.charCodeAt(index_0)))) {
|
|
return $intern_45 + ((hiSurrogate & 1023) << 10) + (loSurrogate & 1023);
|
|
}
|
|
return hiSurrogate;
|
|
}
|
|
|
|
function digit_0(c, radix){
|
|
if (radix < 2 || radix > 36) {
|
|
return -1;
|
|
}
|
|
if (c >= 48 && c < 48 + $wnd.Math.min(radix, 10)) {
|
|
return c - 48;
|
|
}
|
|
if (c >= 97 && c < radix + 97 - 10) {
|
|
return c - 97 + 10;
|
|
}
|
|
if (c >= 65 && c < radix + 65 - 10) {
|
|
return c - 65 + 10;
|
|
}
|
|
return -1;
|
|
}
|
|
|
|
function isLowSurrogate(ch_0){
|
|
return ch_0 >= 56320 && ch_0 <= 57343;
|
|
}
|
|
|
|
function toChars(codePoint, dst, dstIndex){
|
|
checkCriticalArgument(codePoint >= 0 && codePoint <= 1114111);
|
|
if (codePoint >= $intern_45) {
|
|
dst[dstIndex++] = 55296 + (codePoint - $intern_45 >> 10 & 1023) & $intern_8;
|
|
dst[dstIndex] = 56320 + (codePoint - $intern_45 & 1023) & $intern_8;
|
|
return 2;
|
|
}
|
|
else {
|
|
dst[dstIndex] = codePoint & $intern_8;
|
|
return 1;
|
|
}
|
|
}
|
|
|
|
function valueOf(c){
|
|
var result;
|
|
if (c < 128) {
|
|
result = ($clinit_Character$BoxedValues() , boxedValues)[c];
|
|
!result && (result = boxedValues[c] = new Character(c));
|
|
return result;
|
|
}
|
|
return new Character(c);
|
|
}
|
|
|
|
defineClass(232, 1, {3:1, 232:1, 16:1}, Character);
|
|
_.compareTo = function compareTo_5(c){
|
|
return this.value_0 - c.value_0;
|
|
}
|
|
;
|
|
_.equals_0 = function equals_17(o){
|
|
return instanceOf(o, 232) && o.value_0 == this.value_0;
|
|
}
|
|
;
|
|
_.hashCode_0 = function hashCode_10(){
|
|
return this.value_0;
|
|
}
|
|
;
|
|
_.toString_0 = function toString_24(){
|
|
return String.fromCharCode(this.value_0);
|
|
}
|
|
;
|
|
_.value_0 = 0;
|
|
var Ljava_lang_Character_2_classLit = createForClass('java.lang', 'Character', 232);
|
|
function $clinit_Character$BoxedValues(){
|
|
$clinit_Character$BoxedValues = emptyMethod;
|
|
boxedValues = initUnidimensionalArray(Ljava_lang_Character_2_classLit, $intern_3, 232, 128, 0, 1);
|
|
}
|
|
|
|
var boxedValues;
|
|
function __parseAndValidateDouble(s){
|
|
floatRegex == null && (floatRegex = new RegExp('^\\s*[+-]?(NaN|Infinity|((\\d+\\.?\\d*)|(\\.\\d+))([eE][+-]?\\d+)?[dDfF]?)\\s*$'));
|
|
if (!floatRegex.test(s)) {
|
|
throw toJs(new NumberFormatException('For input string: "' + s + '"'));
|
|
}
|
|
return parseFloat(s);
|
|
}
|
|
|
|
function __parseAndValidateInt(s, radix){
|
|
var i, isTooLow, length_0, startIndex, toReturn;
|
|
if (s == null) {
|
|
throw toJs(new NumberFormatException('null'));
|
|
}
|
|
if (radix < 2 || radix > 36) {
|
|
throw toJs(new NumberFormatException('radix ' + radix + ' out of range'));
|
|
}
|
|
length_0 = s.length;
|
|
startIndex = length_0 > 0 && (checkCriticalStringElementIndex(0, s.length) , s.charCodeAt(0) == 45 || (checkCriticalStringElementIndex(0, s.length) , s.charCodeAt(0) == 43))?1:0;
|
|
for (i = startIndex; i < length_0; i++) {
|
|
if (digit_0((checkCriticalStringElementIndex(i, s.length) , s.charCodeAt(i)), radix) == -1) {
|
|
throw toJs(new NumberFormatException('For input string: "' + s + '"'));
|
|
}
|
|
}
|
|
toReturn = parseInt(s, radix);
|
|
isTooLow = toReturn < $intern_113;
|
|
if (isNaN(toReturn)) {
|
|
throw toJs(new NumberFormatException('For input string: "' + s + '"'));
|
|
}
|
|
else if (isTooLow || toReturn > $intern_0) {
|
|
throw toJs(new NumberFormatException('For input string: "' + s + '"'));
|
|
}
|
|
return toReturn;
|
|
}
|
|
|
|
defineClass(251, 1, {3:1, 251:1});
|
|
var floatRegex;
|
|
var Ljava_lang_Number_2_classLit = createForClass('java.lang', 'Number', 251);
|
|
function $doubleValue(this$static){
|
|
return checkCriticalNotNull(this$static) , this$static;
|
|
}
|
|
|
|
function compare_10(x_0, y_0){
|
|
if (x_0 < y_0) {
|
|
return -1;
|
|
}
|
|
if (x_0 > y_0) {
|
|
return 1;
|
|
}
|
|
if (x_0 == y_0) {
|
|
return 0;
|
|
}
|
|
return isNaN(x_0)?isNaN(y_0)?0:1:-1;
|
|
}
|
|
|
|
function isInfinite(x_0){
|
|
return !isNaN(x_0) && !isFinite(x_0);
|
|
}
|
|
|
|
doubleCastMap = {3:1, 16:1, 464:1, 251:1};
|
|
var Ljava_lang_Double_2_classLit = createForClass('java.lang', 'Double', 464);
|
|
function IllegalArgumentException(){
|
|
RuntimeException.call(this);
|
|
}
|
|
|
|
function IllegalArgumentException_0(message){
|
|
RuntimeException_0.call(this, message);
|
|
}
|
|
|
|
defineClass(53, 83, {3:1, 13:1, 53:1, 42:1}, IllegalArgumentException, IllegalArgumentException_0);
|
|
var Ljava_lang_IllegalArgumentException_2_classLit = createForClass('java.lang', 'IllegalArgumentException', 53);
|
|
function IllegalStateException(){
|
|
RuntimeException.call(this);
|
|
}
|
|
|
|
function IllegalStateException_0(s){
|
|
RuntimeException_0.call(this, s);
|
|
}
|
|
|
|
defineClass(148, 83, $intern_7, IllegalStateException, IllegalStateException_0);
|
|
var Ljava_lang_IllegalStateException_2_classLit = createForClass('java.lang', 'IllegalStateException', 148);
|
|
function Integer(value_0){
|
|
this.value_0 = value_0;
|
|
}
|
|
|
|
function Integer_0(s){
|
|
this.value_0 = __parseAndValidateInt(s, 10);
|
|
}
|
|
|
|
function compare_11(x_0, y_0){
|
|
return x_0 < y_0?-1:x_0 > y_0?1:0;
|
|
}
|
|
|
|
function highestOneBit(i){
|
|
var rtn;
|
|
if (i < 0) {
|
|
return $intern_113;
|
|
}
|
|
else if (i == 0) {
|
|
return 0;
|
|
}
|
|
else {
|
|
for (rtn = 1073741824; (rtn & i) == 0; rtn >>= 1)
|
|
;
|
|
return rtn;
|
|
}
|
|
}
|
|
|
|
function numberOfLeadingZeros_0(i){
|
|
var m, n, y_0;
|
|
if (i < 0) {
|
|
return 0;
|
|
}
|
|
else if (i == 0) {
|
|
return 32;
|
|
}
|
|
else {
|
|
y_0 = -(i >> 16);
|
|
m = y_0 >> 16 & 16;
|
|
n = 16 - m;
|
|
i = i >> m;
|
|
y_0 = i - 256;
|
|
m = y_0 >> 16 & 8;
|
|
n += m;
|
|
i <<= m;
|
|
y_0 = i - $intern_42;
|
|
m = y_0 >> 16 & 4;
|
|
n += m;
|
|
i <<= m;
|
|
y_0 = i - $intern_44;
|
|
m = y_0 >> 16 & 2;
|
|
n += m;
|
|
i <<= m;
|
|
y_0 = i >> 14;
|
|
m = y_0 & ~(y_0 >> 1);
|
|
return n + 2 - m;
|
|
}
|
|
}
|
|
|
|
function numberOfTrailingZeros(i){
|
|
var r, rtn;
|
|
if (i == 0) {
|
|
return 32;
|
|
}
|
|
else {
|
|
rtn = 0;
|
|
for (r = 1; (r & i) == 0; r <<= 1) {
|
|
++rtn;
|
|
}
|
|
return rtn;
|
|
}
|
|
}
|
|
|
|
function signum(i){
|
|
return i == 0?0:i < 0?-1:1;
|
|
}
|
|
|
|
function valueOf_0(i){
|
|
var rebase, result;
|
|
if (i > -129 && i < 128) {
|
|
rebase = i + 128;
|
|
result = ($clinit_Integer$BoxedValues() , boxedValues_0)[rebase];
|
|
!result && (result = boxedValues_0[rebase] = new Integer(i));
|
|
return result;
|
|
}
|
|
return new Integer(i);
|
|
}
|
|
|
|
defineClass(57, 251, {3:1, 16:1, 57:1, 251:1}, Integer, Integer_0);
|
|
_.compareTo = function compareTo_6(b){
|
|
return compare_11(this.value_0, b.value_0);
|
|
}
|
|
;
|
|
_.equals_0 = function equals_18(o){
|
|
return instanceOf(o, 57) && o.value_0 == this.value_0;
|
|
}
|
|
;
|
|
_.hashCode_0 = function hashCode_11(){
|
|
return this.value_0;
|
|
}
|
|
;
|
|
_.toString_0 = function toString_26(){
|
|
return '' + this.value_0;
|
|
}
|
|
;
|
|
_.value_0 = 0;
|
|
var Ljava_lang_Integer_2_classLit = createForClass('java.lang', 'Integer', 57);
|
|
function $clinit_Integer$BoxedValues(){
|
|
$clinit_Integer$BoxedValues = emptyMethod;
|
|
boxedValues_0 = initUnidimensionalArray(Ljava_lang_Integer_2_classLit, $intern_3, 57, 256, 0, 1);
|
|
}
|
|
|
|
var boxedValues_0;
|
|
function Long(value_0){
|
|
this.value_0 = value_0;
|
|
}
|
|
|
|
function compare_12(x_0, y_0){
|
|
return compare_0(x_0, y_0) < 0?-1:compare_0(x_0, y_0) > 0?1:0;
|
|
}
|
|
|
|
function valueOf_1(i){
|
|
var rebase, result;
|
|
if (compare_0(i, -129) > 0 && compare_0(i, 128) < 0) {
|
|
rebase = toInt_0(i) + 128;
|
|
result = ($clinit_Long$BoxedValues() , boxedValues_1)[rebase];
|
|
!result && (result = boxedValues_1[rebase] = new Long(i));
|
|
return result;
|
|
}
|
|
return new Long(i);
|
|
}
|
|
|
|
defineClass(233, 251, {3:1, 16:1, 233:1, 251:1}, Long);
|
|
_.compareTo = function compareTo_7(b){
|
|
return compare_12(this.value_0, b.value_0);
|
|
}
|
|
;
|
|
_.equals_0 = function equals_19(o){
|
|
return instanceOf(o, 233) && eq_0(o.value_0, this.value_0);
|
|
}
|
|
;
|
|
_.hashCode_0 = function hashCode_12(){
|
|
return toInt_0(this.value_0);
|
|
}
|
|
;
|
|
_.toString_0 = function toString_27(){
|
|
return '' + toString_8(this.value_0);
|
|
}
|
|
;
|
|
_.value_0 = 0;
|
|
var Ljava_lang_Long_2_classLit = createForClass('java.lang', 'Long', 233);
|
|
function $clinit_Long$BoxedValues(){
|
|
$clinit_Long$BoxedValues = emptyMethod;
|
|
boxedValues_1 = initUnidimensionalArray(Ljava_lang_Long_2_classLit, $intern_3, 233, 256, 0, 1);
|
|
}
|
|
|
|
var boxedValues_1;
|
|
function cosh(x_0){
|
|
return ($wnd.Math.exp(x_0) + $wnd.Math.exp(-x_0)) / 2;
|
|
}
|
|
|
|
function hypot(x_0, y_0){
|
|
return !isNaN(x_0) && !isFinite(x_0) || !isNaN(y_0) && !isFinite(y_0)?$intern_26:$wnd.Math.sqrt(x_0 * x_0 + y_0 * y_0);
|
|
}
|
|
|
|
function sinh(x_0){
|
|
return x_0 == 0?0:($wnd.Math.exp(x_0) - $wnd.Math.exp(-x_0)) / 2;
|
|
}
|
|
|
|
function tanh(x_0){
|
|
var e2x;
|
|
if (x_0 == 0) {
|
|
return x_0;
|
|
}
|
|
else if (!isNaN(x_0) && !isFinite(x_0)) {
|
|
return x_0 == 0 || isNaN(x_0)?x_0:x_0 < 0?-1:1;
|
|
}
|
|
else {
|
|
e2x = $wnd.Math.exp(2 * x_0);
|
|
return (e2x - 1) / (e2x + 1);
|
|
}
|
|
}
|
|
|
|
defineClass(1037, 1, {});
|
|
function NullPointerException(){
|
|
RuntimeException.call(this);
|
|
}
|
|
|
|
function NullPointerException_0(message){
|
|
RuntimeException_0.call(this, message);
|
|
}
|
|
|
|
defineClass(157, 282, $intern_7, NullPointerException, NullPointerException_0);
|
|
_.createError = function createError_0(msg){
|
|
return new TypeError(msg);
|
|
}
|
|
;
|
|
var Ljava_lang_NullPointerException_2_classLit = createForClass('java.lang', 'NullPointerException', 157);
|
|
function NumberFormatException(message){
|
|
IllegalArgumentException_0.call(this, message);
|
|
}
|
|
|
|
defineClass(147, 53, {3:1, 13:1, 53:1, 147:1, 42:1}, NumberFormatException);
|
|
var Ljava_lang_NumberFormatException_2_classLit = createForClass('java.lang', 'NumberFormatException', 147);
|
|
function StackTraceElement(methodName, fileName, lineNumber){
|
|
this.className_0 = 'Unknown';
|
|
this.methodName = methodName;
|
|
this.fileName = fileName;
|
|
this.lineNumber = lineNumber;
|
|
}
|
|
|
|
defineClass(187, 1, {3:1, 187:1}, StackTraceElement);
|
|
_.equals_0 = function equals_20(other){
|
|
var st;
|
|
if (instanceOf(other, 187)) {
|
|
st = other;
|
|
return this.lineNumber == st.lineNumber && this.methodName == st.methodName && this.className_0 == st.className_0 && this.fileName == st.fileName;
|
|
}
|
|
return false;
|
|
}
|
|
;
|
|
_.hashCode_0 = function hashCode_13(){
|
|
return hashCode_20(stampJavaTypeInfo(getClassLiteralForArray(Ljava_lang_Object_2_classLit, 1), $intern_3, 1, 5, [valueOf_0(this.lineNumber), this.className_0, this.methodName, this.fileName]));
|
|
}
|
|
;
|
|
_.toString_0 = function toString_28(){
|
|
return this.className_0 + '.' + this.methodName + '(' + (this.fileName != null?this.fileName:'Unknown Source') + (this.lineNumber >= 0?':' + this.lineNumber:'') + ')';
|
|
}
|
|
;
|
|
_.lineNumber = 0;
|
|
var Ljava_lang_StackTraceElement_2_classLit = createForClass('java.lang', 'StackTraceElement', 187);
|
|
function $charAt_0(this$static, index_0){
|
|
checkCriticalStringElementIndex(index_0, this$static.length);
|
|
return this$static.charCodeAt(index_0);
|
|
}
|
|
|
|
function $compareTo(this$static, other){
|
|
var a, b;
|
|
a = (checkCriticalNotNull(this$static) , this$static);
|
|
b = (checkCriticalNotNull(other) , other);
|
|
return a == b?0:a < b?-1:1;
|
|
}
|
|
|
|
function $compareToIgnoreCase(this$static, other){
|
|
return $compareTo(this$static.toLowerCase(), other.toLowerCase());
|
|
}
|
|
|
|
function $endsWith(this$static, suffix){
|
|
var suffixlength;
|
|
suffixlength = suffix.length;
|
|
return $equals_1(this$static.substr(this$static.length - suffixlength, suffixlength), suffix);
|
|
}
|
|
|
|
function $equals_1(this$static, other){
|
|
return checkCriticalNotNull(this$static) , this$static === other;
|
|
}
|
|
|
|
function $equalsIgnoreCase(this$static, other){
|
|
checkCriticalNotNull(this$static);
|
|
if (other == null) {
|
|
return false;
|
|
}
|
|
if ($equals_1(this$static, other)) {
|
|
return true;
|
|
}
|
|
return this$static.length == other.length && $equals_1(this$static.toLowerCase(), other.toLowerCase());
|
|
}
|
|
|
|
function $indexOf_0(this$static, codePoint, startIndex){
|
|
return $indexOf_2(this$static, fromCodePoint(codePoint), startIndex);
|
|
}
|
|
|
|
function $indexOf_1(this$static, str){
|
|
return this$static.indexOf(str);
|
|
}
|
|
|
|
function $indexOf_2(this$static, str, startIndex){
|
|
return this$static.indexOf(str, startIndex);
|
|
}
|
|
|
|
function $lastIndexOf(this$static, str){
|
|
return this$static.lastIndexOf(str);
|
|
}
|
|
|
|
function $lastIndexOf_0(this$static, str, start_0){
|
|
return this$static.lastIndexOf(str, start_0);
|
|
}
|
|
|
|
function $replace_0(this$static, from, to){
|
|
var regex, replacement;
|
|
regex = $replaceAll(from, '([/\\\\\\.\\*\\+\\?\\|\\(\\)\\[\\]\\{\\}$^])', '\\\\$1');
|
|
replacement = $replaceAll($replaceAll(to, '\\\\', '\\\\\\\\'), '\\$', '\\\\$');
|
|
return $replaceAll(this$static, regex, replacement);
|
|
}
|
|
|
|
function $replaceAll(this$static, regex, replace){
|
|
replace = translateReplaceString(replace);
|
|
return this$static.replace(new RegExp(regex, 'g'), replace);
|
|
}
|
|
|
|
function $replaceFirst(this$static, replace){
|
|
var jsRegEx;
|
|
replace = translateReplaceString(replace);
|
|
jsRegEx = new RegExp('-.*');
|
|
return this$static.replace(jsRegEx, replace);
|
|
}
|
|
|
|
function $split_1(this$static, regex, maxMatch){
|
|
var compiled, count, lastNonEmpty, lastTrail, matchIndex, matchObj, out, trail;
|
|
compiled = new RegExp(regex, 'g');
|
|
out = initUnidimensionalArray(Ljava_lang_String_2_classLit, $intern_23, 2, 0, 6, 1);
|
|
count = 0;
|
|
trail = this$static;
|
|
lastTrail = null;
|
|
while (true) {
|
|
matchObj = compiled.exec(trail);
|
|
if (matchObj == null || trail == '' || count == maxMatch - 1 && maxMatch > 0) {
|
|
out[count] = trail;
|
|
break;
|
|
}
|
|
else {
|
|
matchIndex = matchObj.index;
|
|
out[count] = trail.substr(0, matchIndex);
|
|
trail = $substring_0(trail, matchIndex + matchObj[0].length, trail.length);
|
|
compiled.lastIndex = 0;
|
|
if (lastTrail == trail) {
|
|
out[count] = trail.substr(0, 1);
|
|
trail = trail.substr(1);
|
|
}
|
|
lastTrail = trail;
|
|
++count;
|
|
}
|
|
}
|
|
if (maxMatch == 0 && this$static.length > 0) {
|
|
lastNonEmpty = out.length;
|
|
while (lastNonEmpty > 0 && out[lastNonEmpty - 1] == '') {
|
|
--lastNonEmpty;
|
|
}
|
|
lastNonEmpty < out.length && (out.length = lastNonEmpty);
|
|
}
|
|
return out;
|
|
}
|
|
|
|
function $startsWith(this$static, prefix){
|
|
return $equals_1(this$static.substr(0, prefix.length), prefix);
|
|
}
|
|
|
|
function $startsWith_0(this$static, prefix, toffset){
|
|
return toffset >= 0 && $equals_1(this$static.substr(toffset, prefix.length), prefix);
|
|
}
|
|
|
|
function $substring(this$static, beginIndex){
|
|
return this$static.substr(beginIndex);
|
|
}
|
|
|
|
function $substring_0(this$static, beginIndex, endIndex){
|
|
return this$static.substr(beginIndex, endIndex - beginIndex);
|
|
}
|
|
|
|
function $trim(this$static){
|
|
var end, length_0, start_0;
|
|
length_0 = this$static.length;
|
|
start_0 = 0;
|
|
while (start_0 < length_0 && (checkCriticalStringElementIndex(start_0, this$static.length) , this$static.charCodeAt(start_0) <= 32)) {
|
|
++start_0;
|
|
}
|
|
end = length_0;
|
|
while (end > start_0 && (checkCriticalStringElementIndex(end - 1, this$static.length) , this$static.charCodeAt(end - 1) <= 32)) {
|
|
--end;
|
|
}
|
|
return start_0 > 0 || end < length_0?this$static.substr(start_0, end - start_0):this$static;
|
|
}
|
|
|
|
function fromCharCode(array){
|
|
return String.fromCharCode.apply(null, array);
|
|
}
|
|
|
|
function fromCodePoint(codePoint){
|
|
var hiSurrogate, loSurrogate;
|
|
if (codePoint >= $intern_45) {
|
|
hiSurrogate = 55296 + (codePoint - $intern_45 >> 10 & 1023) & $intern_8;
|
|
loSurrogate = 56320 + (codePoint - $intern_45 & 1023) & $intern_8;
|
|
return String.fromCharCode(hiSurrogate) + ('' + String.fromCharCode(loSurrogate));
|
|
}
|
|
else {
|
|
return String.fromCharCode(codePoint & $intern_8);
|
|
}
|
|
}
|
|
|
|
function translateReplaceString(replaceStr){
|
|
var pos;
|
|
pos = 0;
|
|
while (0 <= (pos = replaceStr.indexOf('\\', pos))) {
|
|
checkCriticalStringElementIndex(pos + 1, replaceStr.length);
|
|
replaceStr.charCodeAt(pos + 1) == 36?(replaceStr = replaceStr.substr(0, pos) + '$' + $substring(replaceStr, ++pos)):(replaceStr = replaceStr.substr(0, pos) + ('' + $substring(replaceStr, ++pos)));
|
|
}
|
|
return replaceStr;
|
|
}
|
|
|
|
function valueOf_2(x_0){
|
|
return valueOf_3(x_0, x_0.length);
|
|
}
|
|
|
|
function valueOf_3(x_0, count){
|
|
var batchEnd, batchStart, s;
|
|
checkCriticalStringBounds(count, x_0.length);
|
|
s = '';
|
|
for (batchStart = 0; batchStart < count;) {
|
|
batchEnd = $wnd.Math.min(batchStart + $intern_88, count);
|
|
s += fromCharCode(x_0.slice(batchStart, batchEnd));
|
|
batchStart = batchEnd;
|
|
}
|
|
return s;
|
|
}
|
|
|
|
stringCastMap = {3:1, 317:1, 16:1, 2:1};
|
|
var Ljava_lang_String_2_classLit = createForClass('java.lang', 'String', 2);
|
|
function StringBuffer(s){
|
|
AbstractStringBuilder.call(this, (checkCriticalNotNull(s) , s));
|
|
}
|
|
|
|
defineClass(466, 252, {317:1}, StringBuffer);
|
|
var Ljava_lang_StringBuffer_2_classLit = createForClass('java.lang', 'StringBuffer', 466);
|
|
function $append_0(this$static, x_0){
|
|
this$static.string += String.fromCharCode(x_0);
|
|
return this$static;
|
|
}
|
|
|
|
function $append_1(this$static, x_0){
|
|
this$static.string += x_0;
|
|
return this$static;
|
|
}
|
|
|
|
function $append_2(this$static, x_0){
|
|
this$static.string += x_0;
|
|
return this$static;
|
|
}
|
|
|
|
function $append_3(this$static, x_0){
|
|
this$static.string += '' + x_0;
|
|
return this$static;
|
|
}
|
|
|
|
function $append_4(this$static, x_0){
|
|
this$static.string += '' + x_0;
|
|
return this$static;
|
|
}
|
|
|
|
function $delete(this$static, start_0, end){
|
|
this$static.string = $substring_0(this$static.string, 0, start_0) + '' + $substring(this$static.string, end);
|
|
return this$static;
|
|
}
|
|
|
|
function $insert_4(this$static, index_0, x_0){
|
|
this$static.string = $substring_0(this$static.string, 0, index_0) + ('' + x_0) + $substring(this$static.string, index_0);
|
|
return this$static;
|
|
}
|
|
|
|
function StringBuilder(){
|
|
AbstractStringBuilder.call(this, '');
|
|
}
|
|
|
|
function StringBuilder_0(){
|
|
AbstractStringBuilder.call(this, '');
|
|
}
|
|
|
|
function StringBuilder_1(s){
|
|
AbstractStringBuilder.call(this, (checkCriticalNotNull(s) , s));
|
|
}
|
|
|
|
defineClass(65, 252, {317:1}, StringBuilder, StringBuilder_0, StringBuilder_1);
|
|
var Ljava_lang_StringBuilder_2_classLit = createForClass('java.lang', 'StringBuilder', 65);
|
|
function StringIndexOutOfBoundsException(message){
|
|
IndexOutOfBoundsException_0.call(this, message);
|
|
}
|
|
|
|
defineClass(322, 62, $intern_7, StringIndexOutOfBoundsException);
|
|
var Ljava_lang_StringIndexOutOfBoundsException_2_classLit = createForClass('java.lang', 'StringIndexOutOfBoundsException', 322);
|
|
function $clinit_System(){
|
|
$clinit_System = emptyMethod;
|
|
err_0 = new PrintStream;
|
|
}
|
|
|
|
function arraycopy(src_0, dest, len){
|
|
$clinit_System();
|
|
var destlen, srclen;
|
|
checkCriticalNotNull_0(src_0, 'src');
|
|
checkCriticalNotNull_0(dest, 'dest');
|
|
getClass__Ljava_lang_Class___devirtual$(src_0);
|
|
getClass__Ljava_lang_Class___devirtual$(dest);
|
|
srclen = src_0.length;
|
|
destlen = dest.length;
|
|
if (len < 0 || len > srclen || len > destlen) {
|
|
throw toJs(new IndexOutOfBoundsException);
|
|
}
|
|
len > 0 && copy_0(src_0, 0, dest, 0, len, true);
|
|
}
|
|
|
|
defineClass(1041, 1, {});
|
|
var err_0;
|
|
function UnsupportedOperationException(){
|
|
RuntimeException.call(this);
|
|
}
|
|
|
|
function UnsupportedOperationException_0(message){
|
|
RuntimeException_0.call(this, message);
|
|
}
|
|
|
|
defineClass(211, 83, $intern_7, UnsupportedOperationException, UnsupportedOperationException_0);
|
|
var Ljava_lang_UnsupportedOperationException_2_classLit = createForClass('java.lang', 'UnsupportedOperationException', 211);
|
|
defineClass(212, 1, $intern_139);
|
|
_.compareTo = function compareTo_8(that){
|
|
return $compareToIgnoreCase(this.name_0, that.name_0);
|
|
}
|
|
;
|
|
_.equals_0 = function equals_21(o){
|
|
var that;
|
|
if (o === this) {
|
|
return true;
|
|
}
|
|
if (!instanceOf(o, 212)) {
|
|
return false;
|
|
}
|
|
that = o;
|
|
return $equals_1(this.name_0, that.name_0);
|
|
}
|
|
;
|
|
_.hashCode_0 = function hashCode_14(){
|
|
return getHashCode_0(this.name_0);
|
|
}
|
|
;
|
|
_.toString_0 = function toString_29(){
|
|
return this.name_0;
|
|
}
|
|
;
|
|
var Ljava_nio_charset_Charset_2_classLit = createForClass('java.nio.charset', 'Charset', 212);
|
|
function $addAll(this$static, c){
|
|
var changed, e, e$iterator, old;
|
|
checkCriticalNotNull(c);
|
|
changed = false;
|
|
for (e$iterator = new ArrayList$1(c.arrayList); e$iterator.i < e$iterator.this$01.array.length;) {
|
|
e = $next_4(e$iterator);
|
|
changed = changed | (old = $put_0(this$static.map_0, e, this$static) , old == null);
|
|
}
|
|
return changed;
|
|
}
|
|
|
|
function $advanceToFind(this$static, o, remove){
|
|
var e, iter;
|
|
for (iter = this$static.iterator(); iter.hasNext_0();) {
|
|
e = iter.next_1();
|
|
if (maskUndefined(o) === maskUndefined(e) || o != null && equals_Ljava_lang_Object__Z__devirtual$(o, e)) {
|
|
remove && iter.remove_1();
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
function $containsAll(this$static, c){
|
|
var e, e$iterator;
|
|
checkCriticalNotNull(c);
|
|
for (e$iterator = c.iterator(); e$iterator.hasNext_0();) {
|
|
e = e$iterator.next_1();
|
|
if (!this$static.contains_0(e)) {
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
|
|
function $toString_0(this$static){
|
|
var e, e$iterator, joiner;
|
|
joiner = new StringJoiner('[', ']');
|
|
for (e$iterator = this$static.iterator(); e$iterator.hasNext_0();) {
|
|
e = e$iterator.next_1();
|
|
$add_10(joiner, e === this$static?'(this Collection)':e == null?'null':toString_9(e));
|
|
}
|
|
return !joiner.builder?joiner.emptyValue:joiner.suffix.length == 0?joiner.builder.string:joiner.builder.string + ('' + joiner.suffix);
|
|
}
|
|
|
|
defineClass(149, 1, $intern_140);
|
|
_.add_1 = function add_11(o){
|
|
throw toJs(new UnsupportedOperationException_0('Add not supported on this collection'));
|
|
}
|
|
;
|
|
_.contains_0 = function contains(o){
|
|
return $advanceToFind(this, o, false);
|
|
}
|
|
;
|
|
_.isEmpty = function isEmpty(){
|
|
return this.size_1() == 0;
|
|
}
|
|
;
|
|
_.remove_2 = function remove_13(o){
|
|
return $advanceToFind(this, o, true);
|
|
}
|
|
;
|
|
_.toString_0 = function toString_30(){
|
|
return $toString_0(this);
|
|
}
|
|
;
|
|
var Ljava_util_AbstractCollection_2_classLit = createForClass('java.util', 'AbstractCollection', 149);
|
|
function $containsEntry(this$static, entry){
|
|
var key, ourValue, value_0;
|
|
key = entry.getKey();
|
|
value_0 = entry.getValue();
|
|
ourValue = instanceOfString(key)?$getStringValue(this$static, key):getEntryValueOrNull($getEntry(this$static.hashCodeMap, key));
|
|
if (!(maskUndefined(value_0) === maskUndefined(ourValue) || value_0 != null && equals_Ljava_lang_Object__Z__devirtual$(value_0, ourValue))) {
|
|
return false;
|
|
}
|
|
if (ourValue == null && !(instanceOfString(key)?$hasStringValue(this$static, key):!!$getEntry(this$static.hashCodeMap, key))) {
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
function $getOrDefault(this$static, key, defaultValue){
|
|
var currentValue;
|
|
return currentValue = $get_3(this$static.stringMap, key) , currentValue == null && !$contains_4(this$static.stringMap, key)?defaultValue:currentValue;
|
|
}
|
|
|
|
function $putAll(this$static, map_0){
|
|
var e, e$iterator;
|
|
checkCriticalNotNull(map_0);
|
|
for (e$iterator = new AbstractHashMap$EntrySetIterator((new AbstractHashMap$EntrySet(map_0)).this$01); e$iterator.hasNext;) {
|
|
e = $next_2(e$iterator);
|
|
$put_0(this$static, e.getKey(), e.getValue());
|
|
}
|
|
}
|
|
|
|
function $toString_1(this$static, o){
|
|
return o === this$static?'(this Map)':o == null?'null':toString_9(o);
|
|
}
|
|
|
|
function getEntryValueOrNull(entry){
|
|
return !entry?null:entry.getValue();
|
|
}
|
|
|
|
defineClass(974, 1, {953:1});
|
|
_.equals_0 = function equals_22(obj){
|
|
var entry, entry$iterator, otherMap;
|
|
if (obj === this) {
|
|
return true;
|
|
}
|
|
if (!instanceOf(obj, 39)) {
|
|
return false;
|
|
}
|
|
otherMap = obj;
|
|
if (this.hashCodeMap.size_0 + this.stringMap.size_0 != otherMap.hashCodeMap.size_0 + otherMap.stringMap.size_0) {
|
|
return false;
|
|
}
|
|
for (entry$iterator = new AbstractHashMap$EntrySetIterator((new AbstractHashMap$EntrySet(otherMap)).this$01); entry$iterator.hasNext;) {
|
|
entry = $next_2(entry$iterator);
|
|
if (!$containsEntry(this, entry)) {
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
;
|
|
_.hashCode_0 = function hashCode_15(){
|
|
return hashCode_21(new AbstractHashMap$EntrySet(this));
|
|
}
|
|
;
|
|
_.toString_0 = function toString_31(){
|
|
var entry, entry$iterator, joiner;
|
|
joiner = new StringJoiner('{', '}');
|
|
for (entry$iterator = new AbstractHashMap$EntrySetIterator((new AbstractHashMap$EntrySet(this)).this$01); entry$iterator.hasNext;) {
|
|
entry = $next_2(entry$iterator);
|
|
$add_10(joiner, $toString_1(this, entry.getKey()) + '=' + $toString_1(this, entry.getValue()));
|
|
}
|
|
return !joiner.builder?joiner.emptyValue:joiner.suffix.length == 0?joiner.builder.string:joiner.builder.string + ('' + joiner.suffix);
|
|
}
|
|
;
|
|
var Ljava_util_AbstractMap_2_classLit = createForClass('java.util', 'AbstractMap', 974);
|
|
function $containsKey(this$static, key){
|
|
return instanceOfString(key)?$hasStringValue(this$static, key):!!$getEntry(this$static.hashCodeMap, key);
|
|
}
|
|
|
|
function $get_1(this$static, key){
|
|
return instanceOfString(key)?$getStringValue(this$static, key):getEntryValueOrNull($getEntry(this$static.hashCodeMap, key));
|
|
}
|
|
|
|
function $getStringValue(this$static, key){
|
|
return key == null?getEntryValueOrNull($getEntry(this$static.hashCodeMap, null)):$get_3(this$static.stringMap, key);
|
|
}
|
|
|
|
function $hasStringValue(this$static, key){
|
|
return key == null?!!$getEntry(this$static.hashCodeMap, null):$contains_4(this$static.stringMap, key);
|
|
}
|
|
|
|
function $put_0(this$static, key, value_0){
|
|
return instanceOfString(key)?$putStringValue(this$static, key, value_0):$put_1(this$static.hashCodeMap, key, value_0);
|
|
}
|
|
|
|
function $putStringValue(this$static, key, value_0){
|
|
return key == null?$put_1(this$static.hashCodeMap, null, value_0):$put_2(this$static.stringMap, key, value_0);
|
|
}
|
|
|
|
function $remove_7(this$static, key){
|
|
return instanceOfString(key)?$removeStringValue(this$static, key):$remove_16(this$static.hashCodeMap, key);
|
|
}
|
|
|
|
function $removeStringValue(this$static, key){
|
|
return key == null?$remove_16(this$static.hashCodeMap, null):$remove_17(this$static.stringMap, key);
|
|
}
|
|
|
|
function $reset_13(this$static){
|
|
this$static.hashCodeMap = new InternalHashCodeMap(this$static);
|
|
this$static.stringMap = new InternalStringMap(this$static);
|
|
structureChanged(this$static);
|
|
}
|
|
|
|
function $size(this$static){
|
|
return this$static.hashCodeMap.size_0 + this$static.stringMap.size_0;
|
|
}
|
|
|
|
defineClass(253, 974, {953:1});
|
|
var Ljava_util_AbstractHashMap_2_classLit = createForClass('java.util', 'AbstractHashMap', 253);
|
|
defineClass(975, 149, $intern_141);
|
|
_.equals_0 = function equals_23(o){
|
|
var other;
|
|
if (o === this) {
|
|
return true;
|
|
}
|
|
if (!instanceOf(o, 313)) {
|
|
return false;
|
|
}
|
|
other = o;
|
|
if (other.size_1() != this.size_1()) {
|
|
return false;
|
|
}
|
|
return $containsAll(this, other);
|
|
}
|
|
;
|
|
_.hashCode_0 = function hashCode_16(){
|
|
return hashCode_21(this);
|
|
}
|
|
;
|
|
var Ljava_util_AbstractSet_2_classLit = createForClass('java.util', 'AbstractSet', 975);
|
|
function $contains_1(this$static, o){
|
|
if (instanceOf(o, 247)) {
|
|
return $containsEntry(this$static.this$01, o);
|
|
}
|
|
return false;
|
|
}
|
|
|
|
function AbstractHashMap$EntrySet(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(51, 975, $intern_141, AbstractHashMap$EntrySet);
|
|
_.contains_0 = function contains_0(o){
|
|
return $contains_1(this, o);
|
|
}
|
|
;
|
|
_.iterator = function iterator_6(){
|
|
return new AbstractHashMap$EntrySetIterator(this.this$01);
|
|
}
|
|
;
|
|
_.remove_2 = function remove_14(entry){
|
|
var key;
|
|
if ($contains_1(this, entry)) {
|
|
key = entry.getKey();
|
|
$remove_7(this.this$01, key);
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
;
|
|
_.size_1 = function size_1(){
|
|
return $size(this.this$01);
|
|
}
|
|
;
|
|
var Ljava_util_AbstractHashMap$EntrySet_2_classLit = createForClass('java.util', 'AbstractHashMap/EntrySet', 51);
|
|
function $computeHasNext(this$static){
|
|
if (this$static.current.hasNext_0()) {
|
|
return true;
|
|
}
|
|
if (this$static.current != this$static.stringMapEntries) {
|
|
return false;
|
|
}
|
|
this$static.current = new InternalHashCodeMap$1(this$static.this$01.hashCodeMap);
|
|
return this$static.current.hasNext_0();
|
|
}
|
|
|
|
function $next_2(this$static){
|
|
var rv;
|
|
checkStructuralChange(this$static.this$01, this$static);
|
|
checkCriticalElement(this$static.hasNext);
|
|
this$static.last = this$static.current;
|
|
rv = this$static.current.next_1();
|
|
this$static.hasNext = $computeHasNext(this$static);
|
|
return rv;
|
|
}
|
|
|
|
function $remove_8(this$static){
|
|
checkCriticalState(!!this$static.last);
|
|
checkStructuralChange(this$static.this$01, this$static);
|
|
this$static.last.remove_1();
|
|
this$static.last = null;
|
|
this$static.hasNext = $computeHasNext(this$static);
|
|
recordLastKnownStructure(this$static.this$01, this$static);
|
|
}
|
|
|
|
function AbstractHashMap$EntrySetIterator(this$0){
|
|
this.this$01 = this$0;
|
|
this.stringMapEntries = new InternalStringMap$1(this.this$01.stringMap);
|
|
this.current = this.stringMapEntries;
|
|
this.hasNext = $computeHasNext(this);
|
|
this.$modCount = this$0.$modCount;
|
|
}
|
|
|
|
defineClass(52, 1, {}, AbstractHashMap$EntrySetIterator);
|
|
_.next_1 = function next_4(){
|
|
return $next_2(this);
|
|
}
|
|
;
|
|
_.hasNext_0 = function hasNext_3(){
|
|
return this.hasNext;
|
|
}
|
|
;
|
|
_.remove_1 = function remove_15(){
|
|
$remove_8(this);
|
|
}
|
|
;
|
|
_.hasNext = false;
|
|
var Ljava_util_AbstractHashMap$EntrySetIterator_2_classLit = createForClass('java.util', 'AbstractHashMap/EntrySetIterator', 52);
|
|
function $equals_2(this$static, o){
|
|
var elem, elem$iterator, elemOther, iterOther, other;
|
|
if (o === this$static) {
|
|
return true;
|
|
}
|
|
if (!instanceOf(o, 314)) {
|
|
return false;
|
|
}
|
|
other = o;
|
|
if (this$static.size_1() != other.size_1()) {
|
|
return false;
|
|
}
|
|
iterOther = other.iterator();
|
|
for (elem$iterator = this$static.iterator(); elem$iterator.hasNext_0();) {
|
|
elem = elem$iterator.next_1();
|
|
elemOther = iterOther.next_1();
|
|
if (!(maskUndefined(elem) === maskUndefined(elemOther) || elem != null && equals_Ljava_lang_Object__Z__devirtual$(elem, elemOther))) {
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
|
|
defineClass(254, 149, {36:1, 149:1, 254:1, 171:1, 314:1});
|
|
_.add_2 = function add_12(index_0, element){
|
|
throw toJs(new UnsupportedOperationException_0('Add not supported on this list'));
|
|
}
|
|
;
|
|
_.add_1 = function add_13(obj){
|
|
this.add_2(this.size_1(), obj);
|
|
return true;
|
|
}
|
|
;
|
|
_.equals_0 = function equals_24(o){
|
|
return $equals_2(this, o);
|
|
}
|
|
;
|
|
_.hashCode_0 = function hashCode_17(){
|
|
return hashCode_22(this);
|
|
}
|
|
;
|
|
_.iterator = function iterator_7(){
|
|
return new AbstractList$IteratorImpl(this);
|
|
}
|
|
;
|
|
_.listIterator = function listIterator(){
|
|
return new AbstractList$ListIteratorImpl(this, 0);
|
|
}
|
|
;
|
|
_.listIterator_0 = function listIterator_0(from){
|
|
return new AbstractList$ListIteratorImpl(this, from);
|
|
}
|
|
;
|
|
_.remove_3 = function remove_16(index_0){
|
|
throw toJs(new UnsupportedOperationException_0('Remove not supported on this list'));
|
|
}
|
|
;
|
|
var Ljava_util_AbstractList_2_classLit = createForClass('java.util', 'AbstractList', 254);
|
|
function $remove_9(this$static){
|
|
checkCriticalState(this$static.last != -1);
|
|
this$static.this$01_0.remove_3(this$static.last);
|
|
this$static.i = this$static.last;
|
|
this$static.last = -1;
|
|
}
|
|
|
|
function AbstractList$IteratorImpl(this$0){
|
|
this.this$01_0 = this$0;
|
|
}
|
|
|
|
defineClass(325, 1, {}, AbstractList$IteratorImpl);
|
|
_.hasNext_0 = function hasNext_4(){
|
|
return this.i < this.this$01_0.size_1();
|
|
}
|
|
;
|
|
_.next_1 = function next_5(){
|
|
checkCriticalElement(this.i < this.this$01_0.size_1());
|
|
return this.this$01_0.get_0(this.last = this.i++);
|
|
}
|
|
;
|
|
_.remove_1 = function remove_17(){
|
|
$remove_9(this);
|
|
}
|
|
;
|
|
_.i = 0;
|
|
_.last = -1;
|
|
var Ljava_util_AbstractList$IteratorImpl_2_classLit = createForClass('java.util', 'AbstractList/IteratorImpl', 325);
|
|
function AbstractList$ListIteratorImpl(this$0, start_0){
|
|
this.this$01 = this$0;
|
|
AbstractList$IteratorImpl.call(this, this$0);
|
|
checkCriticalPositionIndex(start_0, this$0.size_1());
|
|
this.i = start_0;
|
|
}
|
|
|
|
defineClass(326, 325, {}, AbstractList$ListIteratorImpl);
|
|
_.remove_1 = function remove_18(){
|
|
$remove_9(this);
|
|
}
|
|
;
|
|
_.hasPrevious = function hasPrevious(){
|
|
return this.i > 0;
|
|
}
|
|
;
|
|
_.previous = function previous_0(){
|
|
return checkCriticalElement(this.i > 0) , this.this$01.get_0(this.last = --this.i);
|
|
}
|
|
;
|
|
var Ljava_util_AbstractList$ListIteratorImpl_2_classLit = createForClass('java.util', 'AbstractList/ListIteratorImpl', 326);
|
|
function AbstractMap$1(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(188, 975, $intern_141, AbstractMap$1);
|
|
_.contains_0 = function contains_1(key){
|
|
return $containsKey(this.this$01, key);
|
|
}
|
|
;
|
|
_.iterator = function iterator_8(){
|
|
var outerIter;
|
|
return outerIter = new AbstractHashMap$EntrySetIterator((new AbstractHashMap$EntrySet(this.this$01)).this$01) , new AbstractMap$1$1(outerIter);
|
|
}
|
|
;
|
|
_.remove_2 = function remove_19(key){
|
|
if ($containsKey(this.this$01, key)) {
|
|
$remove_7(this.this$01, key);
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
;
|
|
_.size_1 = function size_2(){
|
|
return $size(this.this$01);
|
|
}
|
|
;
|
|
var Ljava_util_AbstractMap$1_2_classLit = createForClass('java.util', 'AbstractMap/1', 188);
|
|
function AbstractMap$1$1(val$outerIter){
|
|
this.val$outerIter2 = val$outerIter;
|
|
}
|
|
|
|
defineClass(174, 1, {}, AbstractMap$1$1);
|
|
_.hasNext_0 = function hasNext_5(){
|
|
return this.val$outerIter2.hasNext;
|
|
}
|
|
;
|
|
_.next_1 = function next_6(){
|
|
var entry;
|
|
return entry = $next_2(this.val$outerIter2) , entry.getKey();
|
|
}
|
|
;
|
|
_.remove_1 = function remove_20(){
|
|
$remove_8(this.val$outerIter2);
|
|
}
|
|
;
|
|
var Ljava_util_AbstractMap$1$1_2_classLit = createForClass('java.util', 'AbstractMap/1/1', 174);
|
|
defineClass(473, 1, $intern_142);
|
|
_.equals_0 = function equals_25(other){
|
|
var entry;
|
|
if (!instanceOf(other, 247)) {
|
|
return false;
|
|
}
|
|
entry = other;
|
|
return equals_30(this.key_0, entry.getKey()) && equals_30(this.value_0, entry.getValue());
|
|
}
|
|
;
|
|
_.getKey = function getKey(){
|
|
return this.key_0;
|
|
}
|
|
;
|
|
_.getValue = function getValue(){
|
|
return this.value_0;
|
|
}
|
|
;
|
|
_.hashCode_0 = function hashCode_18(){
|
|
return hashCode_24(this.key_0) ^ hashCode_24(this.value_0);
|
|
}
|
|
;
|
|
_.setValue = function setValue(value_0){
|
|
var oldValue;
|
|
oldValue = this.value_0;
|
|
this.value_0 = value_0;
|
|
return oldValue;
|
|
}
|
|
;
|
|
_.toString_0 = function toString_32(){
|
|
return this.key_0 + '=' + this.value_0;
|
|
}
|
|
;
|
|
var Ljava_util_AbstractMap$AbstractEntry_2_classLit = createForClass('java.util', 'AbstractMap/AbstractEntry', 473);
|
|
function AbstractMap$SimpleEntry(key, value_0){
|
|
this.key_0 = key;
|
|
this.value_0 = value_0;
|
|
}
|
|
|
|
defineClass(474, 473, $intern_142, AbstractMap$SimpleEntry);
|
|
var Ljava_util_AbstractMap$SimpleEntry_2_classLit = createForClass('java.util', 'AbstractMap/SimpleEntry', 474);
|
|
defineClass(980, 1, $intern_142);
|
|
_.equals_0 = function equals_26(other){
|
|
var entry;
|
|
if (!instanceOf(other, 247)) {
|
|
return false;
|
|
}
|
|
entry = other;
|
|
return equals_30(this.val$entry2.value[0], entry.getKey()) && equals_30($getValue_0(this), entry.getValue());
|
|
}
|
|
;
|
|
_.hashCode_0 = function hashCode_19(){
|
|
return hashCode_24(this.val$entry2.value[0]) ^ hashCode_24($getValue_0(this));
|
|
}
|
|
;
|
|
_.toString_0 = function toString_33(){
|
|
return this.val$entry2.value[0] + '=' + $getValue_0(this);
|
|
}
|
|
;
|
|
var Ljava_util_AbstractMapEntry_2_classLit = createForClass('java.util', 'AbstractMapEntry', 980);
|
|
defineClass(996, 149, $intern_140);
|
|
_.add_1 = function add_14(o){
|
|
checkCriticalState_0($offer(this, o), 'Unable to add element to queue');
|
|
return true;
|
|
}
|
|
;
|
|
var Ljava_util_AbstractQueue_2_classLit = createForClass('java.util', 'AbstractQueue', 996);
|
|
function $addFirst(this$static, e){
|
|
checkCriticalNotNull(e);
|
|
this$static.head_0 = this$static.head_0 - 1 & this$static.array.length - 1;
|
|
this$static.array[this$static.head_0] = e;
|
|
$ensureCapacity(this$static);
|
|
}
|
|
|
|
function $contains_2(it, o){
|
|
if (o == null) {
|
|
return false;
|
|
}
|
|
while (it.currentIndex != it.fence) {
|
|
if (equals_Ljava_lang_Object__Z__devirtual$(o, $next_3(it))) {
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
function $copyElements(this$static, dest, count){
|
|
var dstIdx, i, mask;
|
|
mask = this$static.array.length - 1;
|
|
for (i = this$static.head_0 , dstIdx = 0; dstIdx < count; i = i + 1 & mask , ++dstIdx) {
|
|
dest[dstIdx] = this$static.array[i];
|
|
}
|
|
}
|
|
|
|
function $ensureCapacity(this$static){
|
|
var newArray, newLength, numElements;
|
|
if (this$static.head_0 != this$static.tail) {
|
|
return;
|
|
}
|
|
numElements = this$static.array.length;
|
|
newLength = highestOneBit($wnd.Math.max(8, numElements)) << 1;
|
|
if (this$static.head_0 != 0) {
|
|
newArray = createFrom(this$static.array, newLength);
|
|
$copyElements(this$static, newArray, numElements);
|
|
this$static.array = newArray;
|
|
this$static.head_0 = 0;
|
|
}
|
|
else {
|
|
setLength(this$static.array, newLength);
|
|
}
|
|
this$static.tail = numElements;
|
|
}
|
|
|
|
function $pollFirst(this$static){
|
|
var e;
|
|
e = this$static.array[this$static.head_0];
|
|
if (e == null) {
|
|
return null;
|
|
}
|
|
this$static.array[this$static.head_0] = null;
|
|
this$static.head_0 = this$static.head_0 + 1 & this$static.array.length - 1;
|
|
return e;
|
|
}
|
|
|
|
function $remove_10(it, o){
|
|
if ($contains_2(it, o)) {
|
|
$remove_11(it);
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
function $removeAtIndex(this$static, i){
|
|
var headDistance, mask, size_0, tailDistance;
|
|
mask = this$static.array.length - 1;
|
|
headDistance = i - this$static.head_0 & mask;
|
|
tailDistance = this$static.tail - i & mask;
|
|
size_0 = this$static.tail - this$static.head_0 & mask;
|
|
checkConcurrentModification(headDistance < size_0);
|
|
if (headDistance >= tailDistance) {
|
|
$shiftLeftAtIndex(this$static, i);
|
|
return -1;
|
|
}
|
|
else {
|
|
$shiftRightAtIndex(this$static, i);
|
|
return 1;
|
|
}
|
|
}
|
|
|
|
function $shiftLeftAtIndex(this$static, i){
|
|
var mask, nextOffset;
|
|
mask = this$static.array.length - 1;
|
|
this$static.tail = this$static.tail - 1 & mask;
|
|
while (i != this$static.tail) {
|
|
nextOffset = i + 1 & mask;
|
|
this$static.array[i] = this$static.array[nextOffset];
|
|
i = nextOffset;
|
|
}
|
|
this$static.array[this$static.tail] = null;
|
|
}
|
|
|
|
function $shiftRightAtIndex(this$static, i){
|
|
var mask, prevOffset;
|
|
mask = this$static.array.length - 1;
|
|
while (i != this$static.head_0) {
|
|
prevOffset = i - 1 & mask;
|
|
this$static.array[i] = this$static.array[prevOffset];
|
|
i = prevOffset;
|
|
}
|
|
this$static.array[this$static.head_0] = null;
|
|
this$static.head_0 = this$static.head_0 + 1 & mask;
|
|
}
|
|
|
|
function ArrayDeque(){
|
|
this.array = initUnidimensionalArray(Ljava_lang_Object_2_classLit, $intern_3, 1, 8, 5, 1);
|
|
}
|
|
|
|
function checkConcurrentModification(expression){
|
|
if (!expression) {
|
|
throw toJs(new ConcurrentModificationException);
|
|
}
|
|
}
|
|
|
|
defineClass(822, 149, {4:1, 36:1, 149:1, 171:1}, ArrayDeque);
|
|
_.add_1 = function add_15(e){
|
|
checkCriticalNotNull(e);
|
|
this.array[this.tail] = e;
|
|
this.tail = this.tail + 1 & this.array.length - 1;
|
|
$ensureCapacity(this);
|
|
return true;
|
|
}
|
|
;
|
|
_.contains_0 = function contains_2(o){
|
|
return $contains_2(new ArrayDeque$IteratorImpl(this), o);
|
|
}
|
|
;
|
|
_.isEmpty = function isEmpty_0(){
|
|
return this.head_0 == this.tail;
|
|
}
|
|
;
|
|
_.iterator = function iterator_9(){
|
|
return new ArrayDeque$IteratorImpl(this);
|
|
}
|
|
;
|
|
_.remove_2 = function remove_21(o){
|
|
return $remove_10(new ArrayDeque$IteratorImpl(this), o);
|
|
}
|
|
;
|
|
_.size_1 = function size_3(){
|
|
return this.tail - this.head_0 & this.array.length - 1;
|
|
}
|
|
;
|
|
_.head_0 = 0;
|
|
_.tail = 0;
|
|
var Ljava_util_ArrayDeque_2_classLit = createForClass('java.util', 'ArrayDeque', 822);
|
|
function $next_3(this$static){
|
|
var e;
|
|
checkCriticalElement(this$static.currentIndex != this$static.fence);
|
|
e = this$static.this$01.array[this$static.currentIndex];
|
|
checkConcurrentModification(this$static.fence == this$static.this$01.tail && e != null);
|
|
this$static.lastIndex = this$static.currentIndex;
|
|
this$static.currentIndex = this$static.currentIndex + 1 & this$static.this$01.array.length - 1;
|
|
return e;
|
|
}
|
|
|
|
function $remove_11(this$static){
|
|
checkCriticalState(this$static.lastIndex >= 0);
|
|
if ($removeAtIndex(this$static.this$01, this$static.lastIndex) < 0) {
|
|
this$static.currentIndex = this$static.currentIndex - 1 & this$static.this$01.array.length - 1;
|
|
this$static.fence = this$static.this$01.tail;
|
|
}
|
|
this$static.lastIndex = -1;
|
|
}
|
|
|
|
function ArrayDeque$IteratorImpl(this$0){
|
|
this.this$01 = this$0;
|
|
this.currentIndex = this.this$01.head_0;
|
|
this.fence = this.this$01.tail;
|
|
}
|
|
|
|
defineClass(296, 1, {}, ArrayDeque$IteratorImpl);
|
|
_.hasNext_0 = function hasNext_6(){
|
|
return this.currentIndex != this.fence;
|
|
}
|
|
;
|
|
_.next_1 = function next_7(){
|
|
return $next_3(this);
|
|
}
|
|
;
|
|
_.remove_1 = function remove_22(){
|
|
$remove_11(this);
|
|
}
|
|
;
|
|
_.currentIndex = 0;
|
|
_.fence = 0;
|
|
_.lastIndex = -1;
|
|
var Ljava_util_ArrayDeque$IteratorImpl_2_classLit = createForClass('java.util', 'ArrayDeque/IteratorImpl', 296);
|
|
function $$init_27(this$static){
|
|
this$static.array = initUnidimensionalArray(Ljava_lang_Object_2_classLit, $intern_3, 1, 0, 5, 1);
|
|
}
|
|
|
|
function $add_7(this$static, index_0, o){
|
|
checkCriticalPositionIndex(index_0, this$static.array.length);
|
|
insertTo(this$static.array, index_0, o);
|
|
}
|
|
|
|
function $add_8(this$static, o){
|
|
this$static.array[this$static.array.length] = o;
|
|
return true;
|
|
}
|
|
|
|
function $addAll_0(this$static, c){
|
|
var cArray, len;
|
|
cArray = $toArray(c.arrayList);
|
|
len = cArray.length;
|
|
if (len == 0) {
|
|
return false;
|
|
}
|
|
insertTo_0(this$static.array, this$static.array.length, cArray);
|
|
return true;
|
|
}
|
|
|
|
function $get_2(this$static, index_0){
|
|
checkCriticalElementIndex(index_0, this$static.array.length);
|
|
return this$static.array[index_0];
|
|
}
|
|
|
|
function $indexOf_3(this$static, o, index_0){
|
|
for (; index_0 < this$static.array.length; ++index_0) {
|
|
if (equals_30(o, this$static.array[index_0])) {
|
|
return index_0;
|
|
}
|
|
}
|
|
return -1;
|
|
}
|
|
|
|
function $remove_12(this$static, index_0){
|
|
var previous;
|
|
previous = (checkCriticalElementIndex(index_0, this$static.array.length) , this$static.array[index_0]);
|
|
removeFrom(this$static.array, index_0);
|
|
return previous;
|
|
}
|
|
|
|
function $remove_13(this$static, o){
|
|
var i;
|
|
i = $indexOf_3(this$static, o, 0);
|
|
if (i == -1) {
|
|
return false;
|
|
}
|
|
checkCriticalElementIndex(i, this$static.array.length);
|
|
removeFrom(this$static.array, i);
|
|
return true;
|
|
}
|
|
|
|
function $removeIf(this$static, filter){
|
|
var e, index_0, newArray, newIndex;
|
|
checkCriticalNotNull(filter);
|
|
newArray = null;
|
|
newIndex = 0;
|
|
for (index_0 = 0; index_0 < this$static.array.length; ++index_0) {
|
|
e = this$static.array[index_0];
|
|
if (e.builtin) {
|
|
if (newArray == null) {
|
|
newArray = clone(this$static.array, index_0);
|
|
newIndex = index_0;
|
|
}
|
|
}
|
|
else
|
|
newArray != null && (newArray[newIndex++] = e);
|
|
}
|
|
if (newArray == null) {
|
|
return false;
|
|
}
|
|
this$static.array = newArray;
|
|
return true;
|
|
}
|
|
|
|
function $set_1(this$static, index_0, o){
|
|
var previous;
|
|
previous = (checkCriticalElementIndex(index_0, this$static.array.length) , this$static.array[index_0]);
|
|
this$static.array[index_0] = o;
|
|
return previous;
|
|
}
|
|
|
|
function $sort(this$static, c){
|
|
sort_0(this$static.array, this$static.array.length, c);
|
|
}
|
|
|
|
function $toArray(this$static){
|
|
return clone(this$static.array, this$static.array.length);
|
|
}
|
|
|
|
function $toArray_0(this$static, out){
|
|
var i, size_0;
|
|
size_0 = this$static.array.length;
|
|
out.length < size_0 && (out = stampJavaTypeInfo_1(new Array(size_0), out));
|
|
for (i = 0; i < size_0; ++i) {
|
|
out[i] = this$static.array[i];
|
|
}
|
|
out.length > size_0 && (out[size_0] = null);
|
|
return out;
|
|
}
|
|
|
|
function ArrayList(){
|
|
$$init_27(this);
|
|
}
|
|
|
|
function ArrayList_0(){
|
|
$$init_27(this);
|
|
checkCriticalArgument_0(true, 'Initial capacity must not be negative');
|
|
}
|
|
|
|
function ArrayList_1(c){
|
|
$$init_27(this);
|
|
insertTo_0(this.array, 0, clone(c.array, c.array.length));
|
|
}
|
|
|
|
defineClass(38, 254, {3:1, 4:1, 36:1, 149:1, 254:1, 38:1, 171:1, 314:1, 955:1}, ArrayList, ArrayList_0, ArrayList_1);
|
|
_.add_2 = function add_16(index_0, o){
|
|
$add_7(this, index_0, o);
|
|
}
|
|
;
|
|
_.add_1 = function add_17(o){
|
|
return $add_8(this, o);
|
|
}
|
|
;
|
|
_.contains_0 = function contains_3(o){
|
|
return $indexOf_3(this, o, 0) != -1;
|
|
}
|
|
;
|
|
_.get_0 = function get_2(index_0){
|
|
return $get_2(this, index_0);
|
|
}
|
|
;
|
|
_.isEmpty = function isEmpty_1(){
|
|
return this.array.length == 0;
|
|
}
|
|
;
|
|
_.iterator = function iterator_10(){
|
|
return new ArrayList$1(this);
|
|
}
|
|
;
|
|
_.remove_3 = function remove_23(index_0){
|
|
return $remove_12(this, index_0);
|
|
}
|
|
;
|
|
_.remove_2 = function remove_24(o){
|
|
return $remove_13(this, o);
|
|
}
|
|
;
|
|
_.size_1 = function size_4(){
|
|
return this.array.length;
|
|
}
|
|
;
|
|
var Ljava_util_ArrayList_2_classLit = createForClass('java.util', 'ArrayList', 38);
|
|
function $next_4(this$static){
|
|
checkCriticalElement(this$static.i < this$static.this$01.array.length);
|
|
this$static.last = this$static.i++;
|
|
return this$static.this$01.array[this$static.last];
|
|
}
|
|
|
|
function $remove_14(this$static){
|
|
checkCriticalState(this$static.last != -1);
|
|
$remove_12(this$static.this$01, this$static.i = this$static.last);
|
|
this$static.last = -1;
|
|
}
|
|
|
|
function ArrayList$1(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(19, 1, {}, ArrayList$1);
|
|
_.hasNext_0 = function hasNext_7(){
|
|
return this.i < this.this$01.array.length;
|
|
}
|
|
;
|
|
_.next_1 = function next_8(){
|
|
return $next_4(this);
|
|
}
|
|
;
|
|
_.remove_1 = function remove_25(){
|
|
$remove_14(this);
|
|
}
|
|
;
|
|
_.i = 0;
|
|
_.last = -1;
|
|
var Ljava_util_ArrayList$1_2_classLit = createForClass('java.util', 'ArrayList/1', 19);
|
|
function copyPrimitiveArray(original, copy){
|
|
var copyLen, len;
|
|
len = original.length;
|
|
copyLen = $wnd.Math.min(6, len);
|
|
copy_0(original, 0, copy, 0, copyLen, true);
|
|
return copy;
|
|
}
|
|
|
|
function fill(a, toIndex){
|
|
checkCriticalArrayBounds(toIndex, a.length);
|
|
fill0(a, toIndex);
|
|
}
|
|
|
|
function fill0(a, toIndex){
|
|
var i;
|
|
for (i = 0; i < toIndex; ++i) {
|
|
a[i] = 0;
|
|
}
|
|
}
|
|
|
|
function hashCode_20(a){
|
|
var e, e$index, e$max, hashCode;
|
|
hashCode = 1;
|
|
for (e$index = 0 , e$max = a.length; e$index < e$max; ++e$index) {
|
|
e = a[e$index];
|
|
hashCode = 31 * hashCode + (e != null?hashCode__I__devirtual$(e):0);
|
|
hashCode = hashCode | 0;
|
|
}
|
|
return hashCode;
|
|
}
|
|
|
|
function insertionSort(array, low, high, comp){
|
|
var i, j, t;
|
|
for (i = low + 1; i < high; ++i) {
|
|
for (j = i; j > low && comp.compare(array[j - 1], array[j]) > 0; --j) {
|
|
t = array[j];
|
|
array[j] = array[j - 1];
|
|
array[j - 1] = t;
|
|
}
|
|
}
|
|
}
|
|
|
|
function merge(src_0, srcLow, srcMid, srcHigh, dest, destLow, destHigh, comp){
|
|
var topIdx;
|
|
topIdx = srcMid;
|
|
while (destLow < destHigh) {
|
|
topIdx >= srcHigh || srcLow < srcMid && comp.compare(src_0[srcLow], src_0[topIdx]) <= 0?(dest[destLow++] = src_0[srcLow++]):(dest[destLow++] = src_0[topIdx++]);
|
|
}
|
|
}
|
|
|
|
function mergeSort(x_0, fromIndex, toIndex, comp){
|
|
var temp;
|
|
comp = ($clinit_Comparators() , !comp?INTERNAL_NATURAL_ORDER:comp);
|
|
temp = x_0.slice(fromIndex, toIndex);
|
|
mergeSort_0(temp, x_0, fromIndex, toIndex, -fromIndex, comp);
|
|
}
|
|
|
|
function mergeSort_0(temp, array, low, high, ofs, comp){
|
|
var length_0, tempHigh, tempLow, tempMid;
|
|
length_0 = high - low;
|
|
if (length_0 < 7) {
|
|
insertionSort(array, low, high, comp);
|
|
return;
|
|
}
|
|
tempLow = low + ofs;
|
|
tempHigh = high + ofs;
|
|
tempMid = tempLow + (tempHigh - tempLow >> 1);
|
|
mergeSort_0(array, temp, tempLow, tempMid, -ofs, comp);
|
|
mergeSort_0(array, temp, tempMid, tempHigh, -ofs, comp);
|
|
if (comp.compare(temp[tempMid - 1], temp[tempMid]) <= 0) {
|
|
while (low < high) {
|
|
array[low++] = temp[tempLow++];
|
|
}
|
|
return;
|
|
}
|
|
merge(temp, tempLow, tempMid, tempHigh, array, low, high, comp);
|
|
}
|
|
|
|
function sort_0(x_0, toIndex, c){
|
|
checkCriticalArrayBounds(toIndex, x_0.length);
|
|
mergeSort(x_0, 0, toIndex, c);
|
|
}
|
|
|
|
function $clinit_Collections(){
|
|
$clinit_Collections = emptyMethod;
|
|
EMPTY_LIST = new Collections$EmptyList;
|
|
}
|
|
|
|
function hashCode_21(collection){
|
|
$clinit_Collections();
|
|
var e, e$iterator, hashCode;
|
|
hashCode = 0;
|
|
for (e$iterator = collection.iterator(); e$iterator.hasNext_0();) {
|
|
e = e$iterator.next_1();
|
|
hashCode = hashCode + (e != null?hashCode__I__devirtual$(e):0);
|
|
hashCode = hashCode | 0;
|
|
}
|
|
return hashCode;
|
|
}
|
|
|
|
function hashCode_22(list){
|
|
$clinit_Collections();
|
|
var e, e$iterator, hashCode;
|
|
hashCode = 1;
|
|
for (e$iterator = list.iterator(); e$iterator.hasNext_0();) {
|
|
e = e$iterator.next_1();
|
|
hashCode = 31 * hashCode + (e != null?hashCode__I__devirtual$(e):0);
|
|
hashCode = hashCode | 0;
|
|
}
|
|
return hashCode;
|
|
}
|
|
|
|
var EMPTY_LIST;
|
|
function Collections$EmptyList(){
|
|
}
|
|
|
|
defineClass(493, 254, {3:1, 36:1, 149:1, 254:1, 171:1, 314:1, 955:1}, Collections$EmptyList);
|
|
_.contains_0 = function contains_4(object){
|
|
return false;
|
|
}
|
|
;
|
|
_.get_0 = function get_3(location_0){
|
|
checkCriticalElementIndex(location_0, 0);
|
|
return null;
|
|
}
|
|
;
|
|
_.iterator = function iterator_11(){
|
|
return $clinit_Collections() , $clinit_Collections$EmptyListIterator() , INSTANCE_2;
|
|
}
|
|
;
|
|
_.listIterator = function listIterator_1(){
|
|
return $clinit_Collections() , $clinit_Collections$EmptyListIterator() , INSTANCE_2;
|
|
}
|
|
;
|
|
_.size_1 = function size_5(){
|
|
return 0;
|
|
}
|
|
;
|
|
var Ljava_util_Collections$EmptyList_2_classLit = createForClass('java.util', 'Collections/EmptyList', 493);
|
|
function $clinit_Collections$EmptyListIterator(){
|
|
$clinit_Collections$EmptyListIterator = emptyMethod;
|
|
INSTANCE_2 = new Collections$EmptyListIterator;
|
|
}
|
|
|
|
function Collections$EmptyListIterator(){
|
|
}
|
|
|
|
defineClass(494, 1, {}, Collections$EmptyListIterator);
|
|
_.hasNext_0 = function hasNext_8(){
|
|
return false;
|
|
}
|
|
;
|
|
_.hasPrevious = function hasPrevious_0(){
|
|
return false;
|
|
}
|
|
;
|
|
_.next_1 = function next_9(){
|
|
throw toJs(new NoSuchElementException);
|
|
}
|
|
;
|
|
_.previous = function previous_1(){
|
|
throw toJs(new NoSuchElementException);
|
|
}
|
|
;
|
|
_.remove_1 = function remove_26(){
|
|
throw toJs(new IllegalStateException);
|
|
}
|
|
;
|
|
var INSTANCE_2;
|
|
var Ljava_util_Collections$EmptyListIterator_2_classLit = createForClass('java.util', 'Collections/EmptyListIterator', 494);
|
|
function $compare(a, b){
|
|
return compare_10(a.fScore, b.fScore);
|
|
}
|
|
|
|
function Comparator$lambda$2$Type(){
|
|
}
|
|
|
|
defineClass(460, 1, {3:1}, Comparator$lambda$2$Type);
|
|
_.equals_0 = function equals_27(other){
|
|
return this === other;
|
|
}
|
|
;
|
|
_.compare = function compare_13(a, b){
|
|
return $compare(a, b);
|
|
}
|
|
;
|
|
var Ljava_util_Comparator$lambda$2$Type_2_classLit = createForClass('java.util', 'Comparator/lambda$2$Type', 460);
|
|
function $clinit_Comparators(){
|
|
$clinit_Comparators = emptyMethod;
|
|
INTERNAL_NATURAL_ORDER = new Comparators$NaturalOrderComparator;
|
|
}
|
|
|
|
var INTERNAL_NATURAL_ORDER;
|
|
function Comparators$NaturalOrderComparator(){
|
|
}
|
|
|
|
defineClass(944, 1, {3:1}, Comparators$NaturalOrderComparator);
|
|
_.compare = function compare_14(a, b){
|
|
return checkCriticalNotNull(a) , compareTo_Ljava_lang_Object__I__devirtual$(a, (checkCriticalNotNull(b) , b));
|
|
}
|
|
;
|
|
_.equals_0 = function equals_28(other){
|
|
return this === other;
|
|
}
|
|
;
|
|
var Ljava_util_Comparators$NaturalOrderComparator_2_classLit = createForClass('java.util', 'Comparators/NaturalOrderComparator', 944);
|
|
function checkStructuralChange(host, iterator){
|
|
if (iterator.$modCount != host.$modCount) {
|
|
throw toJs(new ConcurrentModificationException);
|
|
}
|
|
}
|
|
|
|
function recordLastKnownStructure(host, iterator){
|
|
iterator.$modCount = host.$modCount;
|
|
}
|
|
|
|
function structureChanged(host){
|
|
var modCount, modCountable;
|
|
modCountable = host;
|
|
modCount = modCountable.$modCount | 0;
|
|
modCountable.$modCount = modCount + 1;
|
|
}
|
|
|
|
function ConcurrentModificationException(){
|
|
RuntimeException.call(this);
|
|
}
|
|
|
|
defineClass(449, 83, $intern_7, ConcurrentModificationException);
|
|
var Ljava_util_ConcurrentModificationException_2_classLit = createForClass('java.util', 'ConcurrentModificationException', 449);
|
|
function Date_0(){
|
|
this.jsdate = new $wnd.Date;
|
|
}
|
|
|
|
function Date_1(date){
|
|
this.jsdate = new $wnd.Date(toDouble_0(date));
|
|
}
|
|
|
|
function padTwo(number){
|
|
return number < 10?'0' + number:'' + number;
|
|
}
|
|
|
|
defineClass(182, 1, {3:1, 4:1, 16:1, 182:1}, Date_0, Date_1);
|
|
_.compareTo = function compareTo_9(other){
|
|
return compare_12(fromDouble_0(this.jsdate.getTime()), fromDouble_0(other.jsdate.getTime()));
|
|
}
|
|
;
|
|
_.equals_0 = function equals_29(obj){
|
|
return instanceOf(obj, 182) && eq_0(fromDouble_0(this.jsdate.getTime()), fromDouble_0(obj.jsdate.getTime()));
|
|
}
|
|
;
|
|
_.hashCode_0 = function hashCode_23(){
|
|
var time;
|
|
time = fromDouble_0(this.jsdate.getTime());
|
|
return toInt_0(xor_0(time, createLongEmul(shru(isSmallLong0(time)?toBigLong(time):time, 32))));
|
|
}
|
|
;
|
|
_.toString_0 = function toString_34(){
|
|
var hourOffset, minuteOffset, offset;
|
|
offset = -this.jsdate.getTimezoneOffset();
|
|
hourOffset = (offset >= 0?'+':'') + (offset / 60 | 0);
|
|
minuteOffset = padTwo($wnd.Math.abs(offset) % 60);
|
|
return ($clinit_Date$StringData() , DAYS)[this.jsdate.getDay()] + ' ' + MONTHS[this.jsdate.getMonth()] + ' ' + padTwo(this.jsdate.getDate()) + ' ' + padTwo(this.jsdate.getHours()) + ':' + padTwo(this.jsdate.getMinutes()) + ':' + padTwo(this.jsdate.getSeconds()) + ' GMT' + hourOffset + minuteOffset + ' ' + this.jsdate.getFullYear();
|
|
}
|
|
;
|
|
var Ljava_util_Date_2_classLit = createForClass('java.util', 'Date', 182);
|
|
function $clinit_Date$StringData(){
|
|
$clinit_Date$StringData = emptyMethod;
|
|
DAYS = stampJavaTypeInfo(getClassLiteralForArray(Ljava_lang_String_2_classLit, 1), $intern_23, 2, 6, ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']);
|
|
MONTHS = stampJavaTypeInfo(getClassLiteralForArray(Ljava_lang_String_2_classLit, 1), $intern_23, 2, 6, ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']);
|
|
}
|
|
|
|
var DAYS, MONTHS;
|
|
function $equals_3(value1, value2){
|
|
return maskUndefined(value1) === maskUndefined(value2) || value1 != null && equals_Ljava_lang_Object__Z__devirtual$(value1, value2);
|
|
}
|
|
|
|
function HashMap(){
|
|
$reset_13(this);
|
|
}
|
|
|
|
function HashMap_0(ignored){
|
|
checkCriticalArgument_0(ignored >= 0, 'Negative initial capacity');
|
|
checkCriticalArgument_0(true, 'Non-positive load factor');
|
|
$reset_13(this);
|
|
}
|
|
|
|
function HashMap_1(toBeCopied){
|
|
$reset_13(this);
|
|
$putAll(this, toBeCopied);
|
|
}
|
|
|
|
defineClass(39, 253, {3:1, 4:1, 39:1, 953:1}, HashMap, HashMap_0, HashMap_1);
|
|
var Ljava_util_HashMap_2_classLit = createForClass('java.util', 'HashMap', 39);
|
|
function $add_9(this$static, o){
|
|
var old;
|
|
old = $put_0(this$static.map_0, o, this$static);
|
|
return old == null;
|
|
}
|
|
|
|
function $contains_3(this$static, o){
|
|
return $containsKey(this$static.map_0, o);
|
|
}
|
|
|
|
function $remove_15(this$static, o){
|
|
return $remove_7(this$static.map_0, o) != null;
|
|
}
|
|
|
|
function HashSet(){
|
|
this.map_0 = new HashMap;
|
|
}
|
|
|
|
function HashSet_0(c){
|
|
this.map_0 = new HashMap_0(c.arrayList.array.length);
|
|
$addAll(this, c);
|
|
}
|
|
|
|
defineClass(152, 975, {3:1, 4:1, 36:1, 149:1, 171:1, 152:1, 313:1}, HashSet, HashSet_0);
|
|
_.add_1 = function add_18(o){
|
|
return $add_9(this, o);
|
|
}
|
|
;
|
|
_.contains_0 = function contains_5(o){
|
|
return $contains_3(this, o);
|
|
}
|
|
;
|
|
_.isEmpty = function isEmpty_2(){
|
|
return $size(this.map_0) == 0;
|
|
}
|
|
;
|
|
_.iterator = function iterator_12(){
|
|
var outerIter;
|
|
return outerIter = new AbstractHashMap$EntrySetIterator((new AbstractHashMap$EntrySet((new AbstractMap$1(this.map_0)).this$01)).this$01) , new AbstractMap$1$1(outerIter);
|
|
}
|
|
;
|
|
_.remove_2 = function remove_27(o){
|
|
return $remove_15(this, o);
|
|
}
|
|
;
|
|
_.size_1 = function size_6(){
|
|
return $size(this.map_0);
|
|
}
|
|
;
|
|
var Ljava_util_HashSet_2_classLit = createForClass('java.util', 'HashSet', 152);
|
|
function $findEntryInChain(key, chain){
|
|
var entry, entry$index, entry$max;
|
|
for (entry$index = 0 , entry$max = chain.length; entry$index < entry$max; ++entry$index) {
|
|
entry = chain[entry$index];
|
|
if ($equals_3(key, entry.getKey())) {
|
|
return entry;
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
|
|
function $getChainOrEmpty(this$static, hashCode){
|
|
var chain;
|
|
chain = this$static.backingMap.get(hashCode);
|
|
return chain == null?new Array:chain;
|
|
}
|
|
|
|
function $getEntry(this$static, key){
|
|
var hashCode;
|
|
return $findEntryInChain(key, $getChainOrEmpty(this$static, key == null?0:(hashCode = hashCode__I__devirtual$(key) , hashCode | 0)));
|
|
}
|
|
|
|
function $put_1(this$static, key, value_0){
|
|
var chain, chain0, entry, hashCode, hashCode0;
|
|
hashCode0 = key == null?0:(hashCode = hashCode__I__devirtual$(key) , hashCode | 0);
|
|
chain0 = (chain = this$static.backingMap.get(hashCode0) , chain == null?new Array:chain);
|
|
if (chain0.length == 0) {
|
|
this$static.backingMap.set(hashCode0, chain0);
|
|
}
|
|
else {
|
|
entry = $findEntryInChain(key, chain0);
|
|
if (entry) {
|
|
return entry.setValue(value_0);
|
|
}
|
|
}
|
|
chain0[chain0.length] = new AbstractMap$SimpleEntry(key, value_0);
|
|
++this$static.size_0;
|
|
structureChanged(this$static.host);
|
|
return null;
|
|
}
|
|
|
|
function $remove_16(this$static, key){
|
|
var chain, chain0, entry, hashCode, hashCode0, i;
|
|
hashCode0 = key == null?0:(hashCode = hashCode__I__devirtual$(key) , hashCode | 0);
|
|
chain0 = (chain = this$static.backingMap.get(hashCode0) , chain == null?new Array:chain);
|
|
for (i = 0; i < chain0.length; i++) {
|
|
entry = chain0[i];
|
|
if ($equals_3(key, entry.getKey())) {
|
|
if (chain0.length == 1) {
|
|
chain0.length = 0;
|
|
$delete_0(this$static.backingMap, hashCode0);
|
|
}
|
|
else {
|
|
chain0.splice(i, 1);
|
|
}
|
|
--this$static.size_0;
|
|
structureChanged(this$static.host);
|
|
return entry.getValue();
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
|
|
function InternalHashCodeMap(host){
|
|
this.backingMap = newJsMap();
|
|
this.host = host;
|
|
}
|
|
|
|
defineClass(495, 1, $intern_73, InternalHashCodeMap);
|
|
_.iterator = function iterator_13(){
|
|
return new InternalHashCodeMap$1(this);
|
|
}
|
|
;
|
|
_.size_0 = 0;
|
|
var Ljava_util_InternalHashCodeMap_2_classLit = createForClass('java.util', 'InternalHashCodeMap', 495);
|
|
function InternalHashCodeMap$1(this$0){
|
|
this.this$01 = this$0;
|
|
this.chains = this.this$01.backingMap.entries();
|
|
this.chain = new Array;
|
|
}
|
|
|
|
defineClass(327, 1, {}, InternalHashCodeMap$1);
|
|
_.next_1 = function next_10(){
|
|
return this.lastEntry = this.chain[this.itemIndex++] , this.lastEntry;
|
|
}
|
|
;
|
|
_.hasNext_0 = function hasNext_9(){
|
|
var current;
|
|
if (this.itemIndex < this.chain.length) {
|
|
return true;
|
|
}
|
|
current = this.chains.next();
|
|
if (!current.done) {
|
|
this.chain = current.value[1];
|
|
this.itemIndex = 0;
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
;
|
|
_.remove_1 = function remove_28(){
|
|
$remove_16(this.this$01, this.lastEntry.getKey());
|
|
this.itemIndex != 0 && --this.itemIndex;
|
|
}
|
|
;
|
|
_.itemIndex = 0;
|
|
_.lastEntry = null;
|
|
var Ljava_util_InternalHashCodeMap$1_2_classLit = createForClass('java.util', 'InternalHashCodeMap/1', 327);
|
|
function $delete_0(this$static, key){
|
|
var fn;
|
|
fn = this$static['delete'];
|
|
fn.call(this$static, key);
|
|
}
|
|
|
|
function $delete_1(this$static, key){
|
|
var fn;
|
|
fn = this$static['delete'];
|
|
fn.call(this$static, key);
|
|
}
|
|
|
|
function $clinit_InternalJsMapFactory(){
|
|
$clinit_InternalJsMapFactory = emptyMethod;
|
|
jsMapCtor = getJsMapConstructor();
|
|
}
|
|
|
|
function canHandleObjectCreateAndProto(){
|
|
if (!Object.create || !Object.getOwnPropertyNames) {
|
|
return false;
|
|
}
|
|
var protoField = '__proto__';
|
|
var map_0 = Object.create(null);
|
|
if (map_0[protoField] !== undefined) {
|
|
return false;
|
|
}
|
|
var keys_0 = Object.getOwnPropertyNames(map_0);
|
|
if (keys_0.length != 0) {
|
|
return false;
|
|
}
|
|
map_0[protoField] = 42;
|
|
if (map_0[protoField] !== 42) {
|
|
return false;
|
|
}
|
|
if (Object.getOwnPropertyNames(map_0).length == 0) {
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
function getJsMapConstructor(){
|
|
function isCorrectIterationProtocol(){
|
|
try {
|
|
return (new Map).entries().next().done;
|
|
}
|
|
catch (e) {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
if (typeof Map === 'function' && Map.prototype.entries && isCorrectIterationProtocol()) {
|
|
return Map;
|
|
}
|
|
else {
|
|
return getJsMapPolyFill();
|
|
}
|
|
}
|
|
|
|
function getJsMapPolyFill(){
|
|
function Stringmap(){
|
|
this.obj = this.createObject();
|
|
}
|
|
|
|
;
|
|
Stringmap.prototype.createObject = function(key){
|
|
return Object.create(null);
|
|
}
|
|
;
|
|
Stringmap.prototype.get = function(key){
|
|
return this.obj[key];
|
|
}
|
|
;
|
|
Stringmap.prototype.set = function(key, value_0){
|
|
this.obj[key] = value_0;
|
|
}
|
|
;
|
|
Stringmap.prototype['delete'] = function(key){
|
|
delete this.obj[key];
|
|
}
|
|
;
|
|
Stringmap.prototype.keys = function(){
|
|
return Object.getOwnPropertyNames(this.obj);
|
|
}
|
|
;
|
|
Stringmap.prototype.entries = function(){
|
|
var keys_0 = this.keys();
|
|
var map_0 = this;
|
|
var nextIndex = 0;
|
|
return {next:function(){
|
|
if (nextIndex >= keys_0.length)
|
|
return {done:true};
|
|
var key = keys_0[nextIndex++];
|
|
return {value:[key, map_0.get(key)], done:false};
|
|
}
|
|
};
|
|
}
|
|
;
|
|
if (!canHandleObjectCreateAndProto()) {
|
|
Stringmap.prototype.createObject = function(){
|
|
return {};
|
|
}
|
|
;
|
|
Stringmap.prototype.get = function(key){
|
|
return this.obj[':' + key];
|
|
}
|
|
;
|
|
Stringmap.prototype.set = function(key, value_0){
|
|
this.obj[':' + key] = value_0;
|
|
}
|
|
;
|
|
Stringmap.prototype['delete'] = function(key){
|
|
delete this.obj[':' + key];
|
|
}
|
|
;
|
|
Stringmap.prototype.keys = function(){
|
|
var result = [];
|
|
for (var key in this.obj) {
|
|
key.charCodeAt(0) == 58 && result.push(key.substring(1));
|
|
}
|
|
return result;
|
|
}
|
|
;
|
|
}
|
|
return Stringmap;
|
|
}
|
|
|
|
function newJsMap(){
|
|
$clinit_InternalJsMapFactory();
|
|
return new jsMapCtor;
|
|
}
|
|
|
|
var jsMapCtor;
|
|
function $contains_4(this$static, key){
|
|
return !(this$static.backingMap.get(key) === undefined);
|
|
}
|
|
|
|
function $get_3(this$static, key){
|
|
return this$static.backingMap.get(key);
|
|
}
|
|
|
|
function $put_2(this$static, key, value_0){
|
|
var oldValue;
|
|
oldValue = this$static.backingMap.get(key);
|
|
this$static.backingMap.set(key, value_0 === undefined?null:value_0);
|
|
if (oldValue === undefined) {
|
|
++this$static.size_0;
|
|
structureChanged(this$static.host);
|
|
}
|
|
else {
|
|
++this$static.valueMod;
|
|
}
|
|
return oldValue;
|
|
}
|
|
|
|
function $remove_17(this$static, key){
|
|
var value_0;
|
|
value_0 = this$static.backingMap.get(key);
|
|
if (value_0 === undefined) {
|
|
++this$static.valueMod;
|
|
}
|
|
else {
|
|
$delete_1(this$static.backingMap, key);
|
|
--this$static.size_0;
|
|
structureChanged(this$static.host);
|
|
}
|
|
return value_0;
|
|
}
|
|
|
|
function InternalStringMap(host){
|
|
this.backingMap = newJsMap();
|
|
this.host = host;
|
|
}
|
|
|
|
defineClass(491, 1, $intern_73, InternalStringMap);
|
|
_.iterator = function iterator_14(){
|
|
return new InternalStringMap$1(this);
|
|
}
|
|
;
|
|
_.size_0 = 0;
|
|
_.valueMod = 0;
|
|
var Ljava_util_InternalStringMap_2_classLit = createForClass('java.util', 'InternalStringMap', 491);
|
|
function InternalStringMap$1(this$0){
|
|
this.this$01 = this$0;
|
|
this.entries_0 = this.this$01.backingMap.entries();
|
|
this.current = this.entries_0.next();
|
|
}
|
|
|
|
defineClass(324, 1, {}, InternalStringMap$1);
|
|
_.next_1 = function next_11(){
|
|
return this.last = this.current , this.current = this.entries_0.next() , new InternalStringMap$2(this.this$01, this.last, this.this$01.valueMod);
|
|
}
|
|
;
|
|
_.hasNext_0 = function hasNext_10(){
|
|
return !this.current.done;
|
|
}
|
|
;
|
|
_.remove_1 = function remove_29(){
|
|
$remove_17(this.this$01, this.last.value[0]);
|
|
}
|
|
;
|
|
var Ljava_util_InternalStringMap$1_2_classLit = createForClass('java.util', 'InternalStringMap/1', 324);
|
|
function $getValue_0(this$static){
|
|
if (this$static.this$01.valueMod != this$static.val$lastValueMod3) {
|
|
return $get_3(this$static.this$01, this$static.val$entry2.value[0]);
|
|
}
|
|
return this$static.val$entry2.value[1];
|
|
}
|
|
|
|
function InternalStringMap$2(this$0, val$entry, val$lastValueMod){
|
|
this.this$01 = this$0;
|
|
this.val$entry2 = val$entry;
|
|
this.val$lastValueMod3 = val$lastValueMod;
|
|
}
|
|
|
|
defineClass(492, 980, $intern_142, InternalStringMap$2);
|
|
_.getKey = function getKey_0(){
|
|
return this.val$entry2.value[0];
|
|
}
|
|
;
|
|
_.getValue = function getValue_0(){
|
|
return $getValue_0(this);
|
|
}
|
|
;
|
|
_.setValue = function setValue_0(object){
|
|
return $put_2(this.this$01, this.val$entry2.value[0], object);
|
|
}
|
|
;
|
|
_.val$lastValueMod3 = 0;
|
|
var Ljava_util_InternalStringMap$2_2_classLit = createForClass('java.util', 'InternalStringMap/2', 492);
|
|
function NoSuchElementException(){
|
|
RuntimeException.call(this);
|
|
}
|
|
|
|
defineClass(165, 83, {3:1, 13:1, 42:1, 165:1}, NoSuchElementException);
|
|
var Ljava_util_NoSuchElementException_2_classLit = createForClass('java.util', 'NoSuchElementException', 165);
|
|
function equals_30(a, b){
|
|
return maskUndefined(a) === maskUndefined(b) || a != null && equals_Ljava_lang_Object__Z__devirtual$(a, b);
|
|
}
|
|
|
|
function hashCode_24(o){
|
|
return o != null?hashCode__I__devirtual$(o):0;
|
|
}
|
|
|
|
function $mergeHeaps(this$static, node){
|
|
var heapSize, smallestChild, value_0, leftChild, rightChild, smallestChild_0;
|
|
heapSize = this$static.heap.array.length;
|
|
value_0 = $get_2(this$static.heap, node);
|
|
while (node * 2 + 1 < heapSize) {
|
|
smallestChild = (leftChild = 2 * node + 1 , rightChild = leftChild + 1 , smallestChild_0 = leftChild , rightChild < heapSize && $compare($get_2(this$static.heap, rightChild), $get_2(this$static.heap, leftChild)) < 0 && (smallestChild_0 = rightChild) , smallestChild_0);
|
|
if ($compare(value_0, $get_2(this$static.heap, smallestChild)) < 0) {
|
|
break;
|
|
}
|
|
$set_1(this$static.heap, node, $get_2(this$static.heap, smallestChild));
|
|
node = smallestChild;
|
|
}
|
|
$set_1(this$static.heap, node, value_0);
|
|
}
|
|
|
|
function $offer(this$static, e){
|
|
var childNode, node;
|
|
checkCriticalNotNull(e);
|
|
node = this$static.heap.array.length;
|
|
$add_8(this$static.heap, e);
|
|
while (node > 0) {
|
|
childNode = node;
|
|
node = (node - 1) / 2 | 0;
|
|
if ($compare($get_2(this$static.heap, node), e) <= 0) {
|
|
$set_1(this$static.heap, childNode, e);
|
|
return true;
|
|
}
|
|
$set_1(this$static.heap, childNode, $get_2(this$static.heap, node));
|
|
}
|
|
$set_1(this$static.heap, node, e);
|
|
return true;
|
|
}
|
|
|
|
function $removeAtIndex_0(this$static, index_0){
|
|
var lastValue;
|
|
lastValue = $remove_12(this$static.heap, this$static.heap.array.length - 1);
|
|
if (index_0 < this$static.heap.array.length) {
|
|
$set_1(this$static.heap, index_0, lastValue);
|
|
$mergeHeaps(this$static, index_0);
|
|
}
|
|
}
|
|
|
|
function PriorityQueue(comparator){
|
|
this.heap = new ArrayList_0;
|
|
this.cmp = ($clinit_Comparators() , comparator);
|
|
}
|
|
|
|
defineClass(451, 996, $intern_140, PriorityQueue);
|
|
_.contains_0 = function contains_6(o){
|
|
return (o == null?-1:$indexOf_3(this.heap, o, 0)) != -1;
|
|
}
|
|
;
|
|
_.iterator = function iterator_15(){
|
|
return new PriorityQueue$1(this);
|
|
}
|
|
;
|
|
_.remove_2 = function remove_30(o){
|
|
var index_0;
|
|
index_0 = !o?-1:$indexOf_3(this.heap, o, 0);
|
|
if (index_0 < 0) {
|
|
return false;
|
|
}
|
|
$removeAtIndex_0(this, index_0);
|
|
return true;
|
|
}
|
|
;
|
|
_.size_1 = function size_7(){
|
|
return this.heap.array.length;
|
|
}
|
|
;
|
|
var Ljava_util_PriorityQueue_2_classLit = createForClass('java.util', 'PriorityQueue', 451);
|
|
function PriorityQueue$1(this$0){
|
|
this.this$01 = this$0;
|
|
}
|
|
|
|
defineClass(935, 1, {}, PriorityQueue$1);
|
|
_.hasNext_0 = function hasNext_11(){
|
|
return this.i < this.this$01.heap.array.length;
|
|
}
|
|
;
|
|
_.next_1 = function next_12(){
|
|
checkCriticalElement(this.i < this.this$01.heap.array.length);
|
|
this.last = this.i++;
|
|
return $get_2(this.this$01.heap, this.last);
|
|
}
|
|
;
|
|
_.remove_1 = function remove_31(){
|
|
checkCriticalState(this.last != -1);
|
|
$removeAtIndex_0(this.this$01, this.i = this.last);
|
|
this.last = -1;
|
|
}
|
|
;
|
|
_.i = 0;
|
|
_.last = -1;
|
|
var Ljava_util_PriorityQueue$1_2_classLit = createForClass('java.util', 'PriorityQueue/1', 935);
|
|
function $clinit_Random(){
|
|
$clinit_Random = emptyMethod;
|
|
var i, i0, twoToTheXMinus24Tmp, twoToTheXMinus48Tmp;
|
|
twoToTheXMinus24 = initUnidimensionalArray(D_classLit, $intern_76, 7, 25, 15, 1);
|
|
twoToTheXMinus48 = initUnidimensionalArray(D_classLit, $intern_76, 7, 33, 15, 1);
|
|
twoToTheXMinus48Tmp = 1.52587890625E-5;
|
|
for (i0 = 32; i0 >= 0; i0--) {
|
|
twoToTheXMinus48[i0] = twoToTheXMinus48Tmp;
|
|
twoToTheXMinus48Tmp *= 0.5;
|
|
}
|
|
twoToTheXMinus24Tmp = 1;
|
|
for (i = 24; i >= 0; i--) {
|
|
twoToTheXMinus24[i] = twoToTheXMinus24Tmp;
|
|
twoToTheXMinus24Tmp *= 0.5;
|
|
}
|
|
}
|
|
|
|
function $nextDouble(this$static){
|
|
return $nextInternal(this$static, 26) * 1.4901161193847656E-8 + $nextInternal(this$static, 27) * 1.1102230246251565E-16;
|
|
}
|
|
|
|
function $nextInternal(this$static, bits){
|
|
var carry, dval, h, hi, l_0, lo;
|
|
hi = this$static.seedhi * $intern_143 + this$static.seedlo * 1502;
|
|
lo = this$static.seedlo * $intern_143 + 11;
|
|
carry = $wnd.Math.floor(lo * $intern_144);
|
|
hi += carry;
|
|
lo -= carry * $intern_51;
|
|
hi %= $intern_51;
|
|
this$static.seedhi = hi;
|
|
this$static.seedlo = lo;
|
|
if (bits <= 24) {
|
|
return $wnd.Math.floor(this$static.seedhi * twoToTheXMinus24[bits]);
|
|
}
|
|
else {
|
|
h = this$static.seedhi * (1 << bits - 24);
|
|
l_0 = $wnd.Math.floor(this$static.seedlo * twoToTheXMinus48[bits]);
|
|
dval = h + l_0;
|
|
dval >= 2147483648 && (dval -= 4294967296);
|
|
return dval;
|
|
}
|
|
}
|
|
|
|
function Random(){
|
|
$clinit_Random();
|
|
var hi, lo, seed;
|
|
seed = uniqueSeed++ + Date.now();
|
|
hi = round_int($wnd.Math.floor(seed * $intern_144)) & 16777215;
|
|
lo = round_int(seed - hi * $intern_51);
|
|
this.seedhi = hi ^ 1502;
|
|
this.seedlo = lo ^ $intern_143;
|
|
}
|
|
|
|
defineClass(542, 1, {}, Random);
|
|
_.seedhi = 0;
|
|
_.seedlo = 0;
|
|
var twoToTheXMinus24, twoToTheXMinus48, uniqueSeed = 0;
|
|
var Ljava_util_Random_2_classLit = createForClass('java.util', 'Random', 542);
|
|
function $add_10(this$static, newElement){
|
|
!this$static.builder?(this$static.builder = new StringBuilder_1(this$static.prefix)):$append_4(this$static.builder, this$static.delimiter);
|
|
$append_3(this$static.builder, newElement);
|
|
return this$static;
|
|
}
|
|
|
|
function StringJoiner(prefix, suffix){
|
|
this.delimiter = ', ';
|
|
this.prefix = prefix;
|
|
this.suffix = suffix;
|
|
this.emptyValue = this.prefix + ('' + this.suffix);
|
|
}
|
|
|
|
defineClass(319, 1, {}, StringJoiner);
|
|
_.toString_0 = function toString_35(){
|
|
return !this.builder?this.emptyValue:this.suffix.length == 0?this.builder.string:this.builder.string + ('' + this.suffix);
|
|
}
|
|
;
|
|
var Ljava_util_StringJoiner_2_classLit = createForClass('java.util', 'StringJoiner', 319);
|
|
function $add_11(this$static, o){
|
|
return $add_8(this$static.arrayList, o);
|
|
}
|
|
|
|
function $addAll_1(this$static, c){
|
|
return $addAll_0(this$static.arrayList, c);
|
|
}
|
|
|
|
function $addElement(this$static, o){
|
|
$add_8(this$static.arrayList, o);
|
|
}
|
|
|
|
function $contains_5(this$static, elem){
|
|
return $indexOf_3(this$static.arrayList, elem, 0) != -1;
|
|
}
|
|
|
|
function $elementAt(this$static, index_0){
|
|
return checkArrayElementIndex(index_0, this$static.arrayList.array.length) , $get_2(this$static.arrayList, index_0);
|
|
}
|
|
|
|
function $firstElement(this$static){
|
|
checkCriticalElement(this$static.arrayList.array.length != 0);
|
|
return checkArrayElementIndex(0, this$static.arrayList.array.length) , $get_2(this$static.arrayList, 0);
|
|
}
|
|
|
|
function $get_4(this$static, index_0){
|
|
checkArrayElementIndex(index_0, this$static.arrayList.array.length);
|
|
return $get_2(this$static.arrayList, index_0);
|
|
}
|
|
|
|
function $indexOf_4(this$static, elem){
|
|
return $indexOf_3(this$static.arrayList, elem, 0);
|
|
}
|
|
|
|
function $lastElement(this$static){
|
|
checkCriticalElement(this$static.arrayList.array.length != 0);
|
|
return $get_4(this$static, this$static.arrayList.array.length - 1);
|
|
}
|
|
|
|
function $remove_18(this$static, index_0){
|
|
checkArrayElementIndex(index_0, this$static.arrayList.array.length);
|
|
return $remove_12(this$static.arrayList, index_0);
|
|
}
|
|
|
|
function $removeElementAt(this$static, index_0){
|
|
checkArrayElementIndex(index_0, this$static.arrayList.array.length);
|
|
$remove_12(this$static.arrayList, index_0);
|
|
}
|
|
|
|
function $removeIf_0(this$static, filter){
|
|
return $removeIf(this$static.arrayList, filter);
|
|
}
|
|
|
|
function $set_2(this$static, index_0, elem){
|
|
checkArrayElementIndex(index_0, this$static.arrayList.array.length);
|
|
return $set_1(this$static.arrayList, index_0, elem);
|
|
}
|
|
|
|
function $sort_0(this$static, c){
|
|
$sort(this$static.arrayList, c);
|
|
}
|
|
|
|
function $toArray_1(this$static, a){
|
|
return $toArray_0(this$static.arrayList, a);
|
|
}
|
|
|
|
function Vector(){
|
|
this.arrayList = new ArrayList;
|
|
}
|
|
|
|
function Vector_0(c){
|
|
this.arrayList = new ArrayList;
|
|
$addAll_0(this.arrayList, c);
|
|
}
|
|
|
|
function checkArrayElementIndex(index_0, size_0){
|
|
if (index_0 < 0 || index_0 >= size_0) {
|
|
throw toJs(new ArrayIndexOutOfBoundsException);
|
|
}
|
|
}
|
|
|
|
defineClass(18, 254, {3:1, 4:1, 36:1, 149:1, 254:1, 171:1, 314:1, 955:1, 18:1}, Vector, Vector_0);
|
|
_.add_2 = function add_19(index_0, o){
|
|
checkArrayElementIndex(index_0, this.arrayList.array.length + 1);
|
|
$add_7(this.arrayList, index_0, o);
|
|
}
|
|
;
|
|
_.add_1 = function add_20(o){
|
|
return $add_11(this, o);
|
|
}
|
|
;
|
|
_.contains_0 = function contains_7(elem){
|
|
return $contains_5(this, elem);
|
|
}
|
|
;
|
|
_.get_0 = function get_4(index_0){
|
|
return $get_4(this, index_0);
|
|
}
|
|
;
|
|
_.isEmpty = function isEmpty_3(){
|
|
return this.arrayList.array.length == 0;
|
|
}
|
|
;
|
|
_.iterator = function iterator_16(){
|
|
return new ArrayList$1(this.arrayList);
|
|
}
|
|
;
|
|
_.remove_3 = function remove_32(index_0){
|
|
return $remove_18(this, index_0);
|
|
}
|
|
;
|
|
_.size_1 = function size_8(){
|
|
return this.arrayList.array.length;
|
|
}
|
|
;
|
|
_.toString_0 = function toString_36(){
|
|
return $toString_0(this.arrayList);
|
|
}
|
|
;
|
|
var Ljava_util_Vector_2_classLit = createForClass('java.util', 'Vector', 18);
|
|
function clone(array, toIndex){
|
|
var result;
|
|
result = array.slice(0, toIndex);
|
|
return stampJavaTypeInfo_0(result, array);
|
|
}
|
|
|
|
function copy_0(src_0, srcOfs, dest, destOfs, len, overwrite){
|
|
var batchEnd, batchStart, destArray, end, spliceArgs;
|
|
if (maskUndefined(src_0) === maskUndefined(dest)) {
|
|
src_0 = src_0.slice(srcOfs, srcOfs + len);
|
|
srcOfs = 0;
|
|
}
|
|
destArray = dest;
|
|
for (batchStart = srcOfs , end = srcOfs + len; batchStart < end;) {
|
|
batchEnd = $wnd.Math.min(batchStart + $intern_88, end);
|
|
len = batchEnd - batchStart;
|
|
spliceArgs = src_0.slice(batchStart, batchEnd);
|
|
spliceArgs.splice(0, 0, destOfs, overwrite?len:0);
|
|
Array.prototype.splice.apply(destArray, spliceArgs);
|
|
batchStart = batchEnd;
|
|
destOfs += len;
|
|
}
|
|
}
|
|
|
|
function createFrom(array, length_0){
|
|
return stampJavaTypeInfo_1(new Array(length_0), array);
|
|
}
|
|
|
|
function insertTo(array, index_0, value_0){
|
|
array.splice(index_0, 0, value_0);
|
|
}
|
|
|
|
function insertTo_0(array, index_0, values){
|
|
copy_0(values, 0, array, index_0, values.length, false);
|
|
}
|
|
|
|
function removeFrom(array, index_0){
|
|
array.splice(index_0, 1);
|
|
}
|
|
|
|
function setLength(array, length_0){
|
|
array.length = length_0;
|
|
}
|
|
|
|
defineClass(1039, 1, {});
|
|
function stampJavaTypeInfo_1(array, referenceType){
|
|
return stampJavaTypeInfo_0(array, referenceType);
|
|
}
|
|
|
|
function $clinit_EmulatedCharset(){
|
|
$clinit_EmulatedCharset = emptyMethod;
|
|
new EmulatedCharset$UtfCharset;
|
|
new EmulatedCharset$LatinCharset('ISO-LATIN-1');
|
|
new EmulatedCharset$LatinCharset('ISO-8859-1');
|
|
}
|
|
|
|
function EmulatedCharset(name_0){
|
|
this.name_0 = name_0;
|
|
}
|
|
|
|
defineClass(320, 212, $intern_139);
|
|
var Ljavaemul_internal_EmulatedCharset_2_classLit = createForClass('javaemul.internal', 'EmulatedCharset', 320);
|
|
function EmulatedCharset$LatinCharset(name_0){
|
|
EmulatedCharset.call(this, name_0);
|
|
}
|
|
|
|
defineClass(321, 320, $intern_139, EmulatedCharset$LatinCharset);
|
|
var Ljavaemul_internal_EmulatedCharset$LatinCharset_2_classLit = createForClass('javaemul.internal', 'EmulatedCharset/LatinCharset', 321);
|
|
function $decodeString(bytes, ofs, len){
|
|
var b, ch_0, charCount, chars, count, i, i0, outIdx, number;
|
|
charCount = 0;
|
|
for (i0 = 0; i0 < len;) {
|
|
++charCount;
|
|
ch_0 = bytes[ofs + i0];
|
|
if ((ch_0 & 192) == 128) {
|
|
throw toJs(new IllegalArgumentException_0('Invalid UTF8 sequence'));
|
|
}
|
|
else if ((ch_0 & 128) == 0) {
|
|
++i0;
|
|
}
|
|
else if ((ch_0 & 224) == 192) {
|
|
i0 += 2;
|
|
}
|
|
else if ((ch_0 & 240) == 224) {
|
|
i0 += 3;
|
|
}
|
|
else if ((ch_0 & 248) == 240) {
|
|
i0 += 4;
|
|
}
|
|
else {
|
|
throw toJs(new IllegalArgumentException_0('Invalid UTF8 sequence'));
|
|
}
|
|
if (i0 > len) {
|
|
throw toJs(new IndexOutOfBoundsException_0('Invalid UTF8 sequence'));
|
|
}
|
|
}
|
|
chars = initUnidimensionalArray(C_classLit, $intern_21, 7, charCount, 15, 1);
|
|
outIdx = 0;
|
|
count = 0;
|
|
for (i = 0; i < len;) {
|
|
ch_0 = bytes[ofs + i++];
|
|
if ((ch_0 & 128) == 0) {
|
|
count = 1;
|
|
ch_0 &= 127;
|
|
}
|
|
else if ((ch_0 & 224) == 192) {
|
|
count = 2;
|
|
ch_0 &= 31;
|
|
}
|
|
else if ((ch_0 & 240) == 224) {
|
|
count = 3;
|
|
ch_0 &= 15;
|
|
}
|
|
else if ((ch_0 & 248) == 240) {
|
|
count = 4;
|
|
ch_0 &= 7;
|
|
}
|
|
else if ((ch_0 & 252) == 248) {
|
|
count = 5;
|
|
ch_0 &= 3;
|
|
}
|
|
while (--count > 0) {
|
|
b = bytes[ofs + i++];
|
|
if ((b & 192) != 128) {
|
|
throw toJs(new IllegalArgumentException_0('Invalid UTF8 sequence at ' + (ofs + i - 1) + ', byte=' + (number = b >>> 0 , number.toString(16))));
|
|
}
|
|
ch_0 = ch_0 << 6 | b & 63;
|
|
}
|
|
outIdx += toChars(ch_0, chars, outIdx);
|
|
}
|
|
return chars;
|
|
}
|
|
|
|
function $encodeUtf8(bytes, ofs, codePoint){
|
|
if (codePoint < 128) {
|
|
bytes[ofs] = (codePoint & 127) << 24 >> 24;
|
|
return 1;
|
|
}
|
|
else if (codePoint < $intern_43) {
|
|
bytes[ofs++] = (codePoint >> 6 & 31 | 192) << 24 >> 24;
|
|
bytes[ofs] = (codePoint & 63 | 128) << 24 >> 24;
|
|
return 2;
|
|
}
|
|
else if (codePoint < $intern_45) {
|
|
bytes[ofs++] = (codePoint >> 12 & 15 | 224) << 24 >> 24;
|
|
bytes[ofs++] = (codePoint >> 6 & 63 | 128) << 24 >> 24;
|
|
bytes[ofs] = (codePoint & 63 | 128) << 24 >> 24;
|
|
return 3;
|
|
}
|
|
else if (codePoint < $intern_49) {
|
|
bytes[ofs++] = (codePoint >> 18 & 7 | 240) << 24 >> 24;
|
|
bytes[ofs++] = (codePoint >> 12 & 63 | 128) << 24 >> 24;
|
|
bytes[ofs++] = (codePoint >> 6 & 63 | 128) << 24 >> 24;
|
|
bytes[ofs] = (codePoint & 63 | 128) << 24 >> 24;
|
|
return 4;
|
|
}
|
|
else if (codePoint < $intern_53) {
|
|
bytes[ofs++] = (codePoint >> 24 & 3 | 248) << 24 >> 24;
|
|
bytes[ofs++] = (codePoint >> 18 & 63 | 128) << 24 >> 24;
|
|
bytes[ofs++] = (codePoint >> 12 & 63 | 128) << 24 >> 24;
|
|
bytes[ofs++] = (codePoint >> 6 & 63 | 128) << 24 >> 24;
|
|
bytes[ofs] = (codePoint & 63 | 128) << 24 >> 24;
|
|
return 5;
|
|
}
|
|
throw toJs(new IllegalArgumentException_0('Character out of range: ' + codePoint));
|
|
}
|
|
|
|
function $getBytes(str){
|
|
var byteCount, bytes, ch_0, i, i0, n, out;
|
|
n = str.length;
|
|
byteCount = 0;
|
|
for (i0 = 0; i0 < n;) {
|
|
ch_0 = codePointAt(str, i0, str.length);
|
|
i0 += ch_0 >= $intern_45?2:1;
|
|
ch_0 < 128?++byteCount:ch_0 < $intern_43?(byteCount += 2):ch_0 < $intern_45?(byteCount += 3):ch_0 < $intern_49?(byteCount += 4):ch_0 < $intern_53 && (byteCount += 5);
|
|
}
|
|
bytes = initUnidimensionalArray(B_classLit, $intern_21, 7, byteCount, 15, 1);
|
|
out = 0;
|
|
for (i = 0; i < n;) {
|
|
ch_0 = codePointAt(str, i, str.length);
|
|
i += ch_0 >= $intern_45?2:1;
|
|
out += $encodeUtf8(bytes, out, ch_0);
|
|
}
|
|
return bytes;
|
|
}
|
|
|
|
function EmulatedCharset$UtfCharset(){
|
|
EmulatedCharset.call(this, 'UTF-8');
|
|
}
|
|
|
|
defineClass(470, 320, $intern_139, EmulatedCharset$UtfCharset);
|
|
var Ljavaemul_internal_EmulatedCharset$UtfCharset_2_classLit = createForClass('javaemul.internal', 'EmulatedCharset/UtfCharset', 470);
|
|
function checkCriticalArgument(expression){
|
|
if (!expression) {
|
|
throw toJs(new IllegalArgumentException);
|
|
}
|
|
}
|
|
|
|
function checkCriticalArgument_0(expression, errorMessage){
|
|
if (!expression) {
|
|
throw toJs(new IllegalArgumentException_0(errorMessage));
|
|
}
|
|
}
|
|
|
|
function checkCriticalArrayBounds(end, length_0){
|
|
if (0 > end) {
|
|
throw toJs(new IllegalArgumentException_0('fromIndex: 0 > toIndex: ' + end));
|
|
}
|
|
if (end > length_0) {
|
|
throw toJs(new ArrayIndexOutOfBoundsException_0('fromIndex: 0, toIndex: ' + end + ', length: ' + length_0));
|
|
}
|
|
}
|
|
|
|
function checkCriticalElement(expression){
|
|
if (!expression) {
|
|
throw toJs(new NoSuchElementException);
|
|
}
|
|
}
|
|
|
|
function checkCriticalElementIndex(index_0, size_0){
|
|
if (index_0 < 0 || index_0 >= size_0) {
|
|
throw toJs(new IndexOutOfBoundsException_0('Index: ' + index_0 + ', Size: ' + size_0));
|
|
}
|
|
}
|
|
|
|
function checkCriticalNotNull(reference){
|
|
if (reference == null) {
|
|
throw toJs(new NullPointerException);
|
|
}
|
|
return reference;
|
|
}
|
|
|
|
function checkCriticalNotNull_0(reference, errorMessage){
|
|
if (reference == null) {
|
|
throw toJs(new NullPointerException_0(errorMessage));
|
|
}
|
|
}
|
|
|
|
function checkCriticalPositionIndex(index_0, size_0){
|
|
if (index_0 < 0 || index_0 > size_0) {
|
|
throw toJs(new IndexOutOfBoundsException_0('Index: ' + index_0 + ', Size: ' + size_0));
|
|
}
|
|
}
|
|
|
|
function checkCriticalState(expression){
|
|
if (!expression) {
|
|
throw toJs(new IllegalStateException);
|
|
}
|
|
}
|
|
|
|
function checkCriticalState_0(expression, errorMessage){
|
|
if (!expression) {
|
|
throw toJs(new IllegalStateException_0(errorMessage));
|
|
}
|
|
}
|
|
|
|
function checkCriticalStringBounds(end, length_0){
|
|
if (end > length_0 || end < 0) {
|
|
throw toJs(new StringIndexOutOfBoundsException('fromIndex: 0, toIndex: ' + end + ', length: ' + length_0));
|
|
}
|
|
}
|
|
|
|
function checkCriticalStringElementIndex(index_0, size_0){
|
|
if (index_0 < 0 || index_0 >= size_0) {
|
|
throw toJs(new StringIndexOutOfBoundsException('Index: ' + index_0 + ', Size: ' + size_0));
|
|
}
|
|
}
|
|
|
|
function setPropertySafe(map_0, key, value_0){
|
|
try {
|
|
map_0[key] = value_0;
|
|
}
|
|
catch (ignored) {
|
|
}
|
|
}
|
|
|
|
defineClass(1036, 1, {});
|
|
function getHashCode(o){
|
|
return o.$H || (o.$H = ++nextHashId);
|
|
}
|
|
|
|
var nextHashId = 0;
|
|
function $clinit_StringHashCache(){
|
|
$clinit_StringHashCache = emptyMethod;
|
|
back_0 = new Object_0;
|
|
front = new Object_0;
|
|
}
|
|
|
|
function compute(str){
|
|
var hashCode, i, n, nBatch;
|
|
hashCode = 0;
|
|
n = str.length;
|
|
nBatch = n - 4;
|
|
i = 0;
|
|
while (i < nBatch) {
|
|
hashCode = (checkCriticalStringElementIndex(i + 3, str.length) , str.charCodeAt(i + 3) + (checkCriticalStringElementIndex(i + 2, str.length) , 31 * (str.charCodeAt(i + 2) + (checkCriticalStringElementIndex(i + 1, str.length) , 31 * (str.charCodeAt(i + 1) + (checkCriticalStringElementIndex(i, str.length) , 31 * (str.charCodeAt(i) + 31 * hashCode)))))));
|
|
hashCode = hashCode | 0;
|
|
i += 4;
|
|
}
|
|
while (i < n) {
|
|
hashCode = hashCode * 31 + $charAt_0(str, i++);
|
|
}
|
|
hashCode = hashCode | 0;
|
|
return hashCode;
|
|
}
|
|
|
|
function getHashCode_0(str){
|
|
$clinit_StringHashCache();
|
|
var hashCode, key, result;
|
|
key = ':' + str;
|
|
result = front[key];
|
|
if (result != null) {
|
|
return round_int((checkCriticalNotNull(result) , result));
|
|
}
|
|
result = back_0[key];
|
|
hashCode = result == null?compute(str):round_int((checkCriticalNotNull(result) , result));
|
|
increment();
|
|
front[key] = hashCode;
|
|
return hashCode;
|
|
}
|
|
|
|
function increment(){
|
|
if (count_0 == 256) {
|
|
back_0 = front;
|
|
front = new Object_0;
|
|
count_0 = 0;
|
|
}
|
|
++count_0;
|
|
}
|
|
|
|
var back_0, count_0 = 0, front;
|
|
var C_classLit = createForPrimitive('char', 'C');
|
|
var I_classLit = createForPrimitive('int', 'I');
|
|
var Z_classLit = createForPrimitive('boolean', 'Z');
|
|
var B_classLit = createForPrimitive('byte', 'B');
|
|
var D_classLit = createForPrimitive('double', 'D');
|
|
var $entry = ($clinit_Impl() , entry_0);
|
|
var gwtOnLoad = gwtOnLoad = gwtOnLoad_0;
|
|
addInitFunctions(init);
|
|
setGwtProperty('permProps', [[['locale', 'default'], ['user.agent', 'ie10']]]);
|
|
$sendStats('moduleStartup', 'moduleEvalEnd');
|
|
gwtOnLoad(__gwtModuleFunction.__errFn, __gwtModuleFunction.__moduleName, __gwtModuleFunction.__moduleBase, __gwtModuleFunction.__softPermutationId,__gwtModuleFunction.__computePropValue);
|
|
$sendStats('moduleStartup', 'end');
|
|
$gwt && $gwt.permProps && __gwtModuleFunction.__moduleStartupDone($gwt.permProps);
|
|
//# sourceURL=circuitjs1-0.js
|
|
|