Warning : session_start(): open(/var/lib/php/sessions/sess_nt445rcq13drc5812li8k82ut6, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51
Warning : session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
import java.util.*;
import java.util.zip.*;
import java.util.List;
import java.util.regex.*;
import java.util.concurrent.*;
import java.util.concurrent.atomic.*;
import java.util.concurrent.locks.*;
import java.util.function.*;
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.text.*;
import javax.swing.table.*;
import java.io.*;
import java.net.*;
import java.lang.reflect.*;
import java.lang.ref.*;
import java.lang.management.*;
import java.security.*;
import java.security.spec.*;
import java.awt.*;
import java.awt.event.*;
import java.awt.image.*;
import java.awt.geom.*;
import javax.imageio.*;
import java.math.*;
import java.time.Duration;
import org.fife.ui.autocomplete.*;
import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea;
import org.fife.ui.rsyntaxtextarea.RSyntaxDocument;
import com.github.sarxos.webcam.*;
import org.apache.bcel.classfile.ClassParser;
import org.apache.bcel.classfile.JavaClass;
import org.apache.bcel.Const;
import org.apache.bcel.generic.*;
import java.lang.reflect.Type;
import org.ejml.data.*;
import org.ejml.dense.row.*;
import org.ejml.dense.row.decomposition.eig.*;
import me.saharnooby.qoi.plugin.*;
import static loadableUtils.utils.VF1;
import static loadableUtils.utils.l;
import static loadableUtils.utils.getOpt;
import static loadableUtils.utils.setOpt;
import static loadableUtils.utils.callOpt;
import static loadableUtils.utils.newDangerousWeakHashMap;
import static loadableUtils.utils.get;
import static loadableUtils.utils.get_raw;
import static loadableUtils.utils.assertTrue;
import static loadableUtils.utils.isTrue;
import loadableUtils.utils;
import static loadableUtils.utils.match;
import static loadableUtils.utils.setOpt_raw;
import static loadableUtils.utils.getField;
import static loadableUtils.utils.bindToComponent;
import static loadableUtils.utils.struct;
import static loadableUtils.utils.structure;
import static loadableUtils.utils.structureToPrintWriter;
import static loadableUtils.utils.loadPage;
import static loadableUtils.utils.cset;
import static loadableUtils.utils.DynamicObject_loading;
import static loadableUtils.utils.dynamicObjectIsLoading;
import static loadableUtils.utils.rethrow;
import loadableUtils.utils.F0;
import loadableUtils.utils.F1;
import loadableUtils.utils.IF0;
import loadableUtils.utils.IF1;
import loadableUtils.utils.IVF1;
import loadableUtils.utils.IVF2;
import loadableUtils.utils.Matches;
import loadableUtils.utils.SingleComponentPanel;
import loadableUtils.utils.Q;
import loadableUtils.utils.ImageSurface;
import loadableUtils.utils.structure_Data;
import loadableUtils.utils.RGBImage;
import loadableUtils.utils.RGB;
import loadableUtils.utils.BWImage;
import loadableUtils.utils.MakesBufferedImage;
import loadableUtils.utils.MultiSet;
import loadableUtils.utils.Concept;
import loadableUtils.utils.Concepts;
import loadableUtils.utils.IterableIterator;
import loadableUtils.utils.PersistableThrowable;
import loadableUtils.utils.DynModule;
import loadableUtils.utils.DynPrintLog;
import loadableUtils.utils.Rect;
import loadableUtils.utils.Pt;
import loadableUtils.utils.SynchronizedArrayList;
import loadableUtils.utils.SecretValue;
import static loadableUtils.utils.db_mainConcepts;
import static loadableUtils.utils.joinWithSpace;
import static loadableUtils.utils.callF;
import static loadableUtils.utils.javaTok;
import static loadableUtils.utils.jlabel;
import static loadableUtils.utils.doEvery;
import static loadableUtils.utils.join;
import static loadableUtils.utils.set;
import static loadableUtils.utils.call;
import static loadableUtils.utils.fail;
import static loadableUtils.utils.print;
import static loadableUtils.utils.printAlsoToSystemOut;
import static loadableUtils.utils.doLater;
import static loadableUtils.utils.cget;
import static loadableUtils.utils.db;
import loadableUtils.utils.IntRange;
import loadableUtils.utils.FixedRateTimer;
import loadableUtils.utils.MultiMap;
import loadableUtils.utils.IMultiMap;
import loadableUtils.utils.Meta;
import loadableUtils.utils.ITokCondition;
import loadableUtils.utils.TokCondition;
import loadableUtils.utils.PingSource;
import loadableUtils.utils.ThreadPool;
import loadableUtils.utils.SimpleLiveValue;
import loadableUtils.utils.Matrix;
import loadableUtils.utils.Best;
import loadableUtils.utils.F2;
import loadableUtils.utils.RandomAccessAbstractList;
import loadableUtils.utils.IProbabilisticScheduler;
import loadableUtils.utils.IBWIntegralImage;
import loadableUtils.utils.IntBuffer;
import loadableUtils.utils.ShortBuffer;
import loadableUtils.utils.Cache;
import loadableUtils.utils.AbstractMatrix;
import loadableUtils.utils.OKOrError;
import loadableUtils.utils.WithTimestamp;
import loadableUtils.utils.LiveValue;
import loadableUtils.utils.Timestamp;
import loadableUtils.utils.Complex;
import loadableUtils.utils.QuickException;
import loadableUtils.utils.ProbabilisticScheduler;
import loadableUtils.utils.RestartableCountdown;
import loadableUtils.utils.Steppable;
import loadableUtils.utils.FunctionCall;
import loadableUtils.utils.T3;
import loadableUtils.utils.Swingable;
import loadableUtils.utils.Average;
import loadableUtils.utils.IAutoCloseableF0;
import loadableUtils.utils.GrabbableIntPixels;
import loadableUtils.utils.BWIntegralImage;
import loadableUtils.utils.DoubleRange;
import loadableUtils.utils.WithProbability;
import static loadableUtils.utils.addPrefixOptIfNempty;
import static loadableUtils.utils.year;
import static loadableUtils.utils.withTimestamp;
import static loadableUtils.utils.lambdaMapMethod;
import static loadableUtils.utils.negativeInfinity;
import static loadableUtils.utils.score;
import static loadableUtils.utils.stepAll;
import static loadableUtils.utils.jreplaceExpandRefs;
import static loadableUtils.utils.wrappedTextArea;
import static loadableUtils.utils.infoMessage;
import static loadableUtils.utils.withBorder;
import static loadableUtils.utils.sorted;
import static loadableUtils.utils.loadFont_cached;
import static loadableUtils.utils.quickSubstring;
import static loadableUtils.utils.childrenOfType;
import static loadableUtils.utils.nanoTime;
import static loadableUtils.utils.activateFrame_v3;
import static loadableUtils.utils.addPrefix;
import static loadableUtils.utils.b;
import static loadableUtils.utils.doEvery_daemon;
import static loadableUtils.utils.jCenteredSection;
import static loadableUtils.utils.dm_fieldLabel;
import static loadableUtils.utils.n;
import static loadableUtils.utils.htmlencode_noQuotes;
import static loadableUtils.utils.abs;
import static loadableUtils.utils.runnableThreadsWithStackTraces;
import static loadableUtils.utils.findEndOfBracketPart;
import static loadableUtils.utils.lIntArray;
import static loadableUtils.utils.containerAddFirst;
import static loadableUtils.utils.getComponents;
import static loadableUtils.utils.rep;
import static loadableUtils.utils.area;
import static loadableUtils.utils.add;
import static loadableUtils.utils.singleComponentPanel;
import static loadableUtils.utils.simpleDateFormat_local;
import static loadableUtils.utils.withMargin;
import static loadableUtils.utils.addActionListener;
import static loadableUtils.utils.clearTokens;
import static loadableUtils.utils.printStruct;
import static loadableUtils.utils.containsOneOf;
import static loadableUtils.utils.intersectRects;
import static loadableUtils.utils.deleteFile;
import static loadableUtils.utils.stopTimer;
import static loadableUtils.utils.dm_os;
import static loadableUtils.utils.hideWindow;
import static loadableUtils.utils.cyclicGet;
import static loadableUtils.utils.ymdMinusHMS;
import static loadableUtils.utils.addSlash;
import static loadableUtils.utils.withLeftMargin;
import static loadableUtils.utils.jPopDownButton_noText;
import static loadableUtils.utils.simpleDateFormat;
import static loadableUtils.utils.swingLater;
import static loadableUtils.utils.tok_unCurlyBracket;
import static loadableUtils.utils.imageMergeSpacing;
import static loadableUtils.utils.setImage;
import static loadableUtils.utils.regexp;
import static loadableUtils.utils.simpleQuote;
import static loadableUtils.utils.indexOfAny;
import static loadableUtils.utils.html_valueLessParam;
import static loadableUtils.utils.alwaysOnTop;
import static loadableUtils.utils.setFrameTitle;
import static loadableUtils.utils.tsNow;
import static loadableUtils.utils.jfind_preprocess;
import static loadableUtils.utils.formatFunctionCall;
import static loadableUtils.utils.copyBufferedImage;
import static loadableUtils.utils.localDateWithSeconds;
import static loadableUtils.utils.dm_reload;
import static loadableUtils.utils.addMargin;
import static loadableUtils.utils.setFrameIcon;
import static loadableUtils.utils.isIdentifier;
import static loadableUtils.utils.getTimeZone;
import static loadableUtils.utils.jFullCenter;
import static loadableUtils.utils.getJavaModifiers;
import static loadableUtils.utils.toMinutes;
import static loadableUtils.utils.scanForComponents;
import static loadableUtils.utils.scaffoldingEnabled;
import static loadableUtils.utils.indent;
import static loadableUtils.utils.infoBox;
import static loadableUtils.utils.toSeconds;
import static loadableUtils.utils.rect;
import static loadableUtils.utils.cleanUp;
import static loadableUtils.utils.dm_stem;
import static loadableUtils.utils.forEach;
import static loadableUtils.utils.disposeWindow;
import static loadableUtils.utils.textFieldFromComboBox;
import static loadableUtils.utils.getScore;
import static loadableUtils.utils.stdcompare;
import static loadableUtils.utils.centerAndEast;
import static loadableUtils.utils.aGlobalID;
import static loadableUtils.utils.eqGetOneOf;
import static loadableUtils.utils.okOrError;
import static loadableUtils.utils.setDoubleBuffered;
import static loadableUtils.utils.asVirtualList;
import static loadableUtils.utils.bufferedImage;
import static loadableUtils.utils.maximumSafeArraySize;
import static loadableUtils.utils.dm_q;
import static loadableUtils.utils.withLeftAndRightMargin;
import static loadableUtils.utils.pcallOpt;
import static loadableUtils.utils.shortName;
import static loadableUtils.utils.hgrid;
import static loadableUtils.utils.decimalFormatEnglish;
import static loadableUtils.utils.getMainBot;
import static loadableUtils.utils.formatDouble;
import static loadableUtils.utils.getParent;
import static loadableUtils.utils.strOrEmpty;
import static loadableUtils.utils.dir2zip_recurse;
import static loadableUtils.utils.toStringWithClassName;
import static loadableUtils.utils.indexOfSubList;
import static loadableUtils.utils.run;
import static loadableUtils.utils.replaceExtension;
import static loadableUtils.utils.has;
import static loadableUtils.utils.last;
import static loadableUtils.utils.checkCondition;
import static loadableUtils.utils.intSum;
import static loadableUtils.utils.warn;
import static loadableUtils.utils.getMultipleKeys;
import static loadableUtils.utils.distance;
import static loadableUtils.utils.toRect;
import static loadableUtils.utils.formatDouble_significant2;
import static loadableUtils.utils.installWindowDragger;
import static loadableUtils.utils.onLeftClick;
import static loadableUtils.utils.addIfNotNull;
import static loadableUtils.utils.smartTimerTask;
import static loadableUtils.utils.isString;
import static loadableUtils.utils.clipBufferedImage;
import static loadableUtils.utils.formatDouble1;
import static loadableUtils.utils.setText;
import static loadableUtils.utils.findButton;
import static loadableUtils.utils.splitAtSpace;
import static loadableUtils.utils.parseIntOrLong;
import static loadableUtils.utils.toJava;
import static loadableUtils.utils.getBounds;
import static loadableUtils.utils.northAndCenterWithMargin;
import static loadableUtils.utils.renderUserThreadsWithStackTraces;
import static loadableUtils.utils.nBytes;
import static loadableUtils.utils.newConceptsWithClassFinder;
import static loadableUtils.utils.replaceSublist;
import static loadableUtils.utils.codeTokensOnly;
import static loadableUtils.utils.standardCredentialsUser;
import static loadableUtils.utils.joinSubList;
import static loadableUtils.utils.mapToPairs;
import static loadableUtils.utils.javaTokC;
import static loadableUtils.utils.ratioToIntPercent;
import static loadableUtils.utils.jreplace;
import static loadableUtils.utils.newButton;
import static loadableUtils.utils.newButton_autoToolTip;
import static loadableUtils.utils.onUpdate;
import static loadableUtils.utils.formatInt;
import static loadableUtils.utils.intMax;
import static loadableUtils.utils.addAndReturnCollection;
import static loadableUtils.utils.awtLater;
import static loadableUtils.utils.replace;
import static loadableUtils.utils.profileToConsole;
import static loadableUtils.utils.nChars;
import static loadableUtils.utils.findCodeTokens;
import static loadableUtils.utils.printWithMS;
import static loadableUtils.utils.format;
import static loadableUtils.utils.get2;
import static loadableUtils.utils.onEnter;
import static loadableUtils.utils.hsplit;
import static loadableUtils.utils.screenRectangle;
import static loadableUtils.utils.mapWithIndex;
import static loadableUtils.utils.containsNewLine;
import static loadableUtils.utils.centerAndEastWithMargin;
import static loadableUtils.utils.getFrame;
import static loadableUtils.utils.centerAndSouth;
import static loadableUtils.utils.jscroll_center;
import static loadableUtils.utils.jhsplit;
import static loadableUtils.utils.dm_fieldLiveValue;
import static loadableUtils.utils.isLetter;
import static loadableUtils.utils.findAllFiles_noDirs;
import static loadableUtils.utils.toObjectArray;
import static loadableUtils.utils.getScreenSize;
import static loadableUtils.utils.rectFromPoints;
import static loadableUtils.utils.runnableThread;
import static loadableUtils.utils.toolTip;
import static loadableUtils.utils.getLine;
import static loadableUtils.utils.fromUtf8;
import static loadableUtils.utils.firstToUpper;
import static loadableUtils.utils.allScreenBounds;
import static loadableUtils.utils.findClass_fullName;
import static loadableUtils.utils.withBottomMargin;
import static loadableUtils.utils.copyLocalLog;
import static loadableUtils.utils.jscroll_centered;
import static loadableUtils.utils.isWindows;
import static loadableUtils.utils.evalInQ;
import static loadableUtils.utils.hfulltag;
import static loadableUtils.utils.endMarker;
import static loadableUtils.utils.gazelle_wavySpacer;
import static loadableUtils.utils.callOnLoadMethods;
import static loadableUtils.utils.reTok;
import static loadableUtils.utils.startsWithAny;
import static loadableUtils.utils.fullAlphaMask;
import static loadableUtils.utils.toString;
import static loadableUtils.utils.div;
import static loadableUtils.utils.squareBracket;
import static loadableUtils.utils.isQuoted;
import static loadableUtils.utils.checkTokCondition;
import static loadableUtils.utils.formatLocalDateWithSeconds;
import static loadableUtils.utils.applyDefaultMargin;
import static loadableUtils.utils.removeFromParent;
import static loadableUtils.utils.month;
import static loadableUtils.utils.isDigit;
import static loadableUtils.utils.dm_callOS;
import static loadableUtils.utils.loadTextFileFromZip;
import static loadableUtils.utils.regionMatches;
import static loadableUtils.utils.logQuoted;
import static loadableUtils.utils.newRandomAccessFile;
import static loadableUtils.utils.grabbableIntPixels;
import static loadableUtils.utils.synchronizedMRUCache;
import static loadableUtils.utils.asObjectArray;
import static loadableUtils.utils.printFileInfo;
import static loadableUtils.utils.dm_callOSOpt;
import static loadableUtils.utils.metaSet;
import static loadableUtils.utils.consoleFrame;
import static loadableUtils.utils.centerLabel;
import static loadableUtils.utils.javaxCodeDir;
import static loadableUtils.utils.jLiveValueLabel;
import static loadableUtils.utils.combineAutoCloseables;
import static loadableUtils.utils.shortClassName_dropNumberPrefix;
import static loadableUtils.utils.identityHashCode;
import static loadableUtils.utils.minimizeWindow;
import static loadableUtils.utils.sqrt;
import static loadableUtils.utils.listFilesWithSuffix;
import static loadableUtils.utils.jbutton;
import static loadableUtils.utils.setEnabled;
import static loadableUtils.utils.charToString;
import static loadableUtils.utils.northAndCenter;
import static loadableUtils.utils.jline;
import static loadableUtils.utils.toMS;
import static loadableUtils.utils.intFromBytes_littleEndian_partial;
import static loadableUtils.utils.creator;
import static loadableUtils.utils.forward;
import static loadableUtils.utils.change;
import static loadableUtils.utils.assertEquals;
import static loadableUtils.utils.joinMap;
import static loadableUtils.utils.isJAR;
import static loadableUtils.utils.clearAllTokens;
import static loadableUtils.utils.withProbability;
import static loadableUtils.utils.toPath;
import static loadableUtils.utils.getPreferredSize;
import static loadableUtils.utils.md5;
import static loadableUtils.utils.getBorder;
import static loadableUtils.utils.onClick;
import static loadableUtils.utils.screenDevices;
import static loadableUtils.utils.renderFileInfo;
import static loadableUtils.utils.jCheckBoxMenuItem;
import static loadableUtils.utils.appendToFile;
import static loadableUtils.utils.find;
import static loadableUtils.utils.jenableUndoRedo;
import static loadableUtils.utils.setChecked;
import static loadableUtils.utils.setFont;
import static loadableUtils.utils.takeFirst;
import static loadableUtils.utils.formatColonProperties;
import static loadableUtils.utils.numberOfCores;
import static loadableUtils.utils.showWindow;
import static loadableUtils.utils.plus;
import static loadableUtils.utils.filterMap;
import static loadableUtils.utils.fillJPopupMenu;
import static loadableUtils.utils.ifloor;
import static loadableUtils.utils.hmsWithColonsAndMS;
import static loadableUtils.utils.blend;
import static loadableUtils.utils.enableWordWrapForTextArea;
import static loadableUtils.utils.isSystemThread;
import static loadableUtils.utils.smartIndexOf;
import static loadableUtils.utils.indexOf;
import static loadableUtils.utils.sqr;
import static loadableUtils.utils.repeat;
import static loadableUtils.utils.ok;
import static loadableUtils.utils.nohup;
import static loadableUtils.utils.jCheckBox;
import static loadableUtils.utils.toMS_int;
import static loadableUtils.utils.runnableToIF0;
import static loadableUtils.utils.rectTopLeftCorner;
import static loadableUtils.utils.scored;
import static loadableUtils.utils.onWindowClosing;
import static loadableUtils.utils.htag;
import static loadableUtils.utils.asArray;
import static loadableUtils.utils.pt;
import static loadableUtils.utils.mapMethod;
import static loadableUtils.utils.showText;
import static loadableUtils.utils.afterDollar;
import static loadableUtils.utils.getBytecodePathForClass;
import static loadableUtils.utils.smartAdd;
import static loadableUtils.utils.replaceCollection;
import static loadableUtils.utils.transpileRaw_makeTranslator;
import static loadableUtils.utils.installWindowResizeDraggerOnBorder;
import static loadableUtils.utils.clearTokens_reTok;
import static loadableUtils.utils.minus;
import static loadableUtils.utils.printWithIndent;
import static loadableUtils.utils.keysList;
import static loadableUtils.utils.reversedList;
import static loadableUtils.utils.intRange;
import static loadableUtils.utils.ratio;
import static loadableUtils.utils.countIterator;
import static loadableUtils.utils.boolPar;
import static loadableUtils.utils.isNaN;
import static loadableUtils.utils.fillRect;
import static loadableUtils.utils.resizeIntArray;
import static loadableUtils.utils.westCenterAndEastWithMargin;
import static loadableUtils.utils.indentx;
import static loadableUtils.utils.isChecked;
import static loadableUtils.utils.similarEmptyMap;
import static loadableUtils.utils.toFile;
import static loadableUtils.utils.intArrayToList;
import static loadableUtils.utils.eqGet;
import static loadableUtils.utils.tempAdd;
import static loadableUtils.utils.onMouseDown;
import static loadableUtils.utils.checkFields;
import static loadableUtils.utils.iff;
import static loadableUtils.utils.pixelCount;
import static loadableUtils.utils.pairA;
import static loadableUtils.utils.appendToBaseName;
import static loadableUtils.utils.dropFirst;
import static loadableUtils.utils.mod;
import static loadableUtils.utils.javaTok_substringN;
import static loadableUtils.utils.squareBracketed;
import static loadableUtils.utils.makeUndecoratedFrame;
import static loadableUtils.utils.seconds;
import static loadableUtils.utils.quickFail;
import static loadableUtils.utils.findClass;
import static loadableUtils.utils.nanosToSeconds;
import static loadableUtils.utils.grabbableIntPixels_fastOrSlow;
import static loadableUtils.utils.addSuffix;
import static loadableUtils.utils.intToHex_flexLength;
import static loadableUtils.utils.asSet;
import static loadableUtils.utils.westCenterAndEast;
import static loadableUtils.utils.scaffoldCalled;
import static loadableUtils.utils.restart;
import static loadableUtils.utils.installTrayIcon;
import static loadableUtils.utils.shootScreen2;
import static loadableUtils.utils.toStringWithClass;
import static loadableUtils.utils.hopeningTag;
import static loadableUtils.utils.filter;
import static loadableUtils.utils.assertEqualsVerbose;
import static loadableUtils.utils.syncLinkedHashSet;
import static loadableUtils.utils.sortFilesByName;
import static loadableUtils.utils.mapPut;
import static loadableUtils.utils.tag;
import static loadableUtils.utils.onChange;
import static loadableUtils.utils.pingSource;
import static loadableUtils.utils.mapToParams;
import static loadableUtils.utils.isNonEmptySingleZip_byMagicHeader;
import static loadableUtils.utils.utf8streamToString;
import static loadableUtils.utils.isInQ;
import static loadableUtils.utils.uniqueFileNameUsingMD5_80_v2;
import static loadableUtils.utils.withTopMargin;
import static loadableUtils.utils.dirOfFile;
import static loadableUtils.utils.error;
import static loadableUtils.utils.setBackground;
import static loadableUtils.utils.renderVars;
import static loadableUtils.utils.sysNow;
import static loadableUtils.utils.hotwire;
import static loadableUtils.utils.metaGet;
import static loadableUtils.utils.heldInstance;
import static loadableUtils.utils.listCreateAndAdd;
import static loadableUtils.utils.nestedIterator;
import static loadableUtils.utils.trayIcon_imageAutoSize;
import loadableUtils.utils.Pair;
import loadableUtils.utils.ISleeper_v2;
import loadableUtils.utils.Sleeping;
import loadableUtils.utils.IBWImage;
import loadableUtils.utils.WidthAndHeight;
import loadableUtils.utils.WidthAndHeightImpl;
import loadableUtils.utils.Enterable;
import loadableUtils.utils.G2Drawable;
import loadableUtils.utils.JConceptsTable;
import loadableUtils.utils.SimpleCRUD_v2;
import static loadableUtils.utils.getPrintLog;
import static loadableUtils.utils.unstructure;
import static loadableUtils.utils.StefansOS_ConnectToServer;
import static loadableUtils.utils._MethodCache;
import static loadableUtils.utils.preferredScreen;
import static loadableUtils.utils.showForm_makeFrame;
import loadableUtils.utils.Decolorizer;
import static loadableUtils.utils.utilsSnippetID;
import static loadableUtils.utils.htmldecode;
import loadableUtils.utils.ChangeTriggerable;
import loadableUtils.utils.ChangeTrigger;
import loadableUtils.utils.IHasChangeListeners;
import loadableUtils.utils.MultiSetMap;
import loadableUtils.utils.SimpleLeftToRightParser;
import loadableUtils.utils.Zip4j_MergeZipFilesWithFilter;
import loadableUtils.utils.ByteBuffer;
import loadableUtils.utils.FlexibleRateTimer;
import loadableUtils.utils.JFastLogView_noWrap;
import loadableUtils.utils.LongBuffer;
import loadableUtils.utils.SynchronizedLongBuffer;
import loadableUtils.utils.ReliableSingleThread;
import loadableUtils.utils.DynamicHStack;
import loadableUtils.utils.DynamicStack;
import loadableUtils.utils.ListAndIndex;
import static loadableUtils.utils.unquote;
import loadableUtils.utils.FileWatchService;
import static loadableUtils.utils.DiskSnippetCache_file;
import static loadableUtils.utils._close;
import static loadableUtils.utils._entrySet;
import static loadableUtils.utils._get;
import static loadableUtils.utils._getClass;
import static loadableUtils.utils._hashCode;
import static loadableUtils.utils._onJavaXSet;
import static loadableUtils.utils._run;
import static loadableUtils.utils.a;
import static loadableUtils.utils.aOrAn;
import static loadableUtils.utils.absDiff;
import static loadableUtils.utils.actionListener;
import static loadableUtils.utils.addAll;
import static loadableUtils.utils.addAndReturn;
import static loadableUtils.utils.addAndRevalidate;
import static loadableUtils.utils.addBorderToImage;
import static loadableUtils.utils.addMenuItem;
import static loadableUtils.utils.addMenuItems;
import static loadableUtils.utils.addMouseListener;
import static loadableUtils.utils.addTab;
import static loadableUtils.utils.addWeakChangeListener;
import static loadableUtils.utils.all;
import static loadableUtils.utils.allConcepts;
import static loadableUtils.utils.allImageFiles;
import static loadableUtils.utils.allToString;
import static loadableUtils.utils.antiAliasGraphics;
import static loadableUtils.utils.antiAliasOn;
import static loadableUtils.utils.any;
import static loadableUtils.utils.appendBracketed;
import static loadableUtils.utils.appendParamsToURL;
import static loadableUtils.utils.appendQueryToURL;
import static loadableUtils.utils.appendToFileName;
import static loadableUtils.utils.appendToTextFile;
import static loadableUtils.utils.arrayPlus;
import static loadableUtils.utils.arraycopy;
import static loadableUtils.utils.asList;
import static loadableUtils.utils.asTreeSet;
import static loadableUtils.utils.assertIdentifier;
import static loadableUtils.utils.assertNempty;
import static loadableUtils.utils.assertNotNull;
import static loadableUtils.utils.assertSameSize;
import static loadableUtils.utils.awtCalcEvery;
import static loadableUtils.utils.awtCalcRegularly;
import static loadableUtils.utils.awtColor;
import static loadableUtils.utils.awtEvery;
import static loadableUtils.utils.awtEveryAndNow;
import static loadableUtils.utils.base64encode;
import static loadableUtils.utils.bindComboBoxToVar;
import static loadableUtils.utils.bindListenerToComponent;
import static loadableUtils.utils.blendColors;
import static loadableUtils.utils.boolToInt;
import static loadableUtils.utils.boostHashCombine;
import static loadableUtils.utils.borderless;
import static loadableUtils.utils.borderlessScrollPane;
import static loadableUtils.utils.bwDistance;
import static loadableUtils.utils.bwIntegralImage;
import static loadableUtils.utils.bwIntegralImage_withMeta;
import static loadableUtils.utils.bytesFromHex;
import static loadableUtils.utils.bytesToHex;
import static loadableUtils.utils.cDeref;
import static loadableUtils.utils.cMigrateField;
import static loadableUtils.utils.calcFitScale;
import static loadableUtils.utils.callMC;
import static loadableUtils.utils.callOpt_getCache;
import static loadableUtils.utils.call_withVarargs;
import static loadableUtils.utils.cancelThread;
import static loadableUtils.utils.caseInsensitiveMap;
import static loadableUtils.utils.ccallOpt;
import static loadableUtils.utils.center;
import static loadableUtils.utils.centerAndSouthOrEast;
import static loadableUtils.utils.centerAndSouthWithMargin;
import static loadableUtils.utils.centerDialogOverOwner;
import static loadableUtils.utils.centerFrame;
import static loadableUtils.utils.centeredLiveValueLabel;
import static loadableUtils.utils.charAt;
import static loadableUtils.utils.charIndexToCharInToken;
import static loadableUtils.utils.characters;
import static loadableUtils.utils.checkmarkIconID;
import static loadableUtils.utils.ciMap;
import static loadableUtils.utils.ciSorted;
import static loadableUtils.utils.cic;
import static loadableUtils.utils.clamp;
import static loadableUtils.utils.clampZeroToOne;
import static loadableUtils.utils.classForName;
import static loadableUtils.utils.classLoader;
import static loadableUtils.utils.className;
import static loadableUtils.utils.classNames;
import static loadableUtils.utils.cleanExit;
import static loadableUtils.utils.clear;
import static loadableUtils.utils.clearConceptsOf;
import static loadableUtils.utils.cloneBufferedImageWithMeta;
import static loadableUtils.utils.cloneKeys;
import static loadableUtils.utils.cloneList;
import static loadableUtils.utils.cloneMap;
import static loadableUtils.utils.cloneSubList;
import static loadableUtils.utils.close;
import static loadableUtils.utils.cmp;
import static loadableUtils.utils.cmpAlphanumIC;
import static loadableUtils.utils.codeTokens;
import static loadableUtils.utils.collect;
import static loadableUtils.utils.collectionMutex;
import static loadableUtils.utils.colorFromHex;
import static loadableUtils.utils.colorToIntOpaque;
import static loadableUtils.utils.comboBoxContainsItem;
import static loadableUtils.utils.commaCombine;
import static loadableUtils.utils.compileRegexp;
import static loadableUtils.utils.componentPopupMenuItem;
import static loadableUtils.utils.componentPopupMenuItems;
import static loadableUtils.utils.computerID;
import static loadableUtils.utils.concatArrays;
import static loadableUtils.utils.concatLists;
import static loadableUtils.utils.concatMap;
import static loadableUtils.utils.conceptsDir;
import static loadableUtils.utils.conceptsFileName;
import static loadableUtils.utils.conceptsWhere;
import static loadableUtils.utils.contains;
import static loadableUtils.utils.containsIgnoreCase;
import static loadableUtils.utils.containsKey;
import static loadableUtils.utils.containsPred;
import static loadableUtils.utils.containsTabNameWithoutTrailingCount;
import static loadableUtils.utils.copyFields;
import static loadableUtils.utils.copyFile;
import static loadableUtils.utils.copyFileVerbose;
import static loadableUtils.utils.copyImageToClipboard;
import static loadableUtils.utils.copyStream;
import static loadableUtils.utils.copyToClipboard;
import static loadableUtils.utils.countConcepts;
import static loadableUtils.utils.countFilesInZip;
import static loadableUtils.utils.countIteratorAsList_incl;
import static loadableUtils.utils.countIterator_inclusive_backwards;
import static loadableUtils.utils.createEmptyConceptsFileInDir;
import static loadableUtils.utils.createGraphics;
import static loadableUtils.utils.createOrAddToSyncLinkedHashSet;
import static loadableUtils.utils.currentProcessCommand;
import static loadableUtils.utils.currentThread;
import static loadableUtils.utils.customLayoutPanel;
import static loadableUtils.utils.dO;
import static loadableUtils.utils.dataToTable;
import static loadableUtils.utils.dateWithMSUTC;
import static loadableUtils.utils.deleteConcept;
import static loadableUtils.utils.deleteConcepts;
import static loadableUtils.utils.deleteFileVerbose_assertSuccess;
import static loadableUtils.utils.deriveFont;
import static loadableUtils.utils.descTreeMap;
import static loadableUtils.utils.desktopOpen;
import static loadableUtils.utils.dirExists;
import static loadableUtils.utils.dirPath;
import static loadableUtils.utils.disableButton;
import static loadableUtils.utils.disposeFrame;
import static loadableUtils.utils.dm_callStem;
import static loadableUtils.utils.dm_checkBox;
import static loadableUtils.utils.dm_onFieldChange;
import static loadableUtils.utils.dm_rcheckBox;
import static loadableUtils.utils.dm_rst;
import static loadableUtils.utils.dm_spinner;
import static loadableUtils.utils.dm_transientCalculatedLabel;
import static loadableUtils.utils.dm_transientCalculatedToolTip;
import static loadableUtils.utils.dm_watchFieldAndNow;
import static loadableUtils.utils.doPost;
import static loadableUtils.utils.doPostBinaryToFile;
import static loadableUtils.utils.domainIsUnder;
import static loadableUtils.utils.done;
import static loadableUtils.utils.done2_always;
import static loadableUtils.utils.doubleRatio;
import static loadableUtils.utils.doubleRectFromPoints;
import static loadableUtils.utils.drawImage;
import static loadableUtils.utils.drawImageOnImage;
import static loadableUtils.utils.drawLine;
import static loadableUtils.utils.dropLast;
import static loadableUtils.utils.dropPrefix;
import static loadableUtils.utils.dropSuffix;
import static loadableUtils.utils.dropTrailingBracketedCount;
import static loadableUtils.utils.dualLog;
import static loadableUtils.utils.dynamicHStack;
import static loadableUtils.utils.empty;
import static loadableUtils.utils.emptyIntArray;
import static loadableUtils.utils.emptyList;
import static loadableUtils.utils.emptyObjectArray;
import static loadableUtils.utils.enclosingViewPosition;
import static loadableUtils.utils.endsWith;
import static loadableUtils.utils.entries;
import static loadableUtils.utils.entrySet;
import static loadableUtils.utils.eq;
import static loadableUtils.utils.eqOneOf;
import static loadableUtils.utils.eqic;
import static loadableUtils.utils.eqicOneOf;
import static loadableUtils.utils.eqicOrEq;
import static loadableUtils.utils.evalWithTimeoutOrFail;
import static loadableUtils.utils.evalWithTimeoutOrTypedException;
import static loadableUtils.utils.even;
import static loadableUtils.utils.ewic;
import static loadableUtils.utils.exceptionToStringShort;
import static loadableUtils.utils.exceptionToStringShorter;
import static loadableUtils.utils.exceptionToStringShorter_dontDropOuterExceptions;
import static loadableUtils.utils.execFileChooser;
import static loadableUtils.utils.f2s;
import static loadableUtils.utils.fileExists;
import static loadableUtils.utils.fileExtension;
import static loadableUtils.utils.fileInSubDir;
import static loadableUtils.utils.fileInfo;
import static loadableUtils.utils.fileName;
import static loadableUtils.utils.fileSize;
import static loadableUtils.utils.findConceptWhereCI;
import static loadableUtils.utils.findIntArg;
import static loadableUtils.utils.findWebCamByName;
import static loadableUtils.utils.first;
import static loadableUtils.utils.firstChar;
import static loadableUtils.utils.firstIntAsString;
import static loadableUtils.utils.firstIntFromLong;
import static loadableUtils.utils.firstThat;
import static loadableUtils.utils.firstToLower;
import static loadableUtils.utils.firstValue;
import static loadableUtils.utils.flattenCollectionsAndArrays;
import static loadableUtils.utils.flattenToList;
import static loadableUtils.utils.floatRatio;
import static loadableUtils.utils.focus;
import static loadableUtils.utils.focusOnFirstShow;
import static loadableUtils.utils.focusOnFirstShowVerbose;
import static loadableUtils.utils.fontSizePlus;
import static loadableUtils.utils.formatDoubleX;
import static loadableUtils.utils.formatRecordVars;
import static loadableUtils.utils.formatSeconds;
import static loadableUtils.utils.formatSnippetID;
import static loadableUtils.utils.formatSnippetIDOpt;
import static loadableUtils.utils.fromLines;
import static loadableUtils.utils.fsI;
import static loadableUtils.utils.getCaretPosition;
import static loadableUtils.utils.getClass;
import static loadableUtils.utils.getClassLoader;
import static loadableUtils.utils.getClassName;
import static loadableUtils.utils.getContentPane;
import static loadableUtils.utils.getFileSize;
import static loadableUtils.utils.getHeight;
import static loadableUtils.utils.getMainClass;
import static loadableUtils.utils.getMenuItems;
import static loadableUtils.utils.getMetaSrc;
import static loadableUtils.utils.getMinimumSize;
import static loadableUtils.utils.getOrCreate;
import static loadableUtils.utils.getProgramFile;
import static loadableUtils.utils.getRandomizer;
import static loadableUtils.utils.getSelectedItem_typed;
import static loadableUtils.utils.getStackTrace;
import static loadableUtils.utils.getString;
import static loadableUtils.utils.getText;
import static loadableUtils.utils.getTextTrim;
import static loadableUtils.utils.getType;
import static loadableUtils.utils.getVar;
import static loadableUtils.utils.getWidth;
import static loadableUtils.utils.getWindow;
import static loadableUtils.utils.getterVarOnly;
import static loadableUtils.utils.graphics;
import static loadableUtils.utils.grayToColor;
import static loadableUtils.utils.gzipString;
import static loadableUtils.utils.hasMethodNamed;
import static loadableUtils.utils.hashCode;
import static loadableUtils.utils.hideTrayIcon;
import static loadableUtils.utils.hijackPrint;
import static loadableUtils.utils.horizontalStrut;
import static loadableUtils.utils.hstack;
import static loadableUtils.utils.hstackWithSpacing;
import static loadableUtils.utils.iBWImageFromFunction;
import static loadableUtils.utils.iceil;
import static loadableUtils.utils.identifiers;
import static loadableUtils.utils.identityHashSet;
import static loadableUtils.utils.imageGraphics;
import static loadableUtils.utils.imageIcon;
import static loadableUtils.utils.imageSurface;
import static loadableUtils.utils.imageSurfaceOnLeftMouseDown;
import static loadableUtils.utils.imageSurface_pixelated;
import static loadableUtils.utils.inc;
import static loadableUtils.utils.incAtomicLong;
import static loadableUtils.utils.indentStructureString;
import static loadableUtils.utils.indentedStructureForUser;
import static loadableUtils.utils.indexConceptField;
import static loadableUtils.utils.indexConceptFieldCI;
import static loadableUtils.utils.indexOfTabName;
import static loadableUtils.utils.indexOfTabNameWithoutTrailingCount;
import static loadableUtils.utils.inputImage;
import static loadableUtils.utils.intArrayToBufferedImage;
import static loadableUtils.utils.intFromSpinner;
import static loadableUtils.utils.invokeMethod;
import static loadableUtils.utils.iround;
import static loadableUtils.utils.is;
import static loadableUtils.utils.isAnonymousClassName;
import static loadableUtils.utils.isDeepContainedInDir_canonical;
import static loadableUtils.utils.isEmpty;
import static loadableUtils.utils.isExtendedStateNormal;
import static loadableUtils.utils.isFile;
import static loadableUtils.utils.isImageFile;
import static loadableUtils.utils.isImageFileName;
import static loadableUtils.utils.isInstance;
import static loadableUtils.utils.isInstanceX;
import static loadableUtils.utils.isInteger;
import static loadableUtils.utils.isLetterOrDigit;
import static loadableUtils.utils.isMain;
import static loadableUtils.utils.isScreenCoordinateInWindow;
import static loadableUtils.utils.isShowing;
import static loadableUtils.utils.isSnippetID;
import static loadableUtils.utils.isStaticMethod;
import static loadableUtils.utils.isSubclassOf;
import static loadableUtils.utils.isURL;
import static loadableUtils.utils.isValidFileName;
import static loadableUtils.utils.itemPlus;
import static loadableUtils.utils.iterateListWithIndex;
import static loadableUtils.utils.iterateWithIndex;
import static loadableUtils.utils.iterator;
import static loadableUtils.utils.iteratorFromFunction;
import static loadableUtils.utils.jBorderlessHigherScrollPane;
import static loadableUtils.utils.jCenteredLabel;
import static loadableUtils.utils.jCenteredLine;
import static loadableUtils.utils.jCenteredRaisedSection;
import static loadableUtils.utils.jCheckBoxMenuItem_dyn;
import static loadableUtils.utils.jComboBox;
import static loadableUtils.utils.jErrorView;
import static loadableUtils.utils.jFastLogView_noWrap;
import static loadableUtils.utils.jHigherScrollPane;
import static loadableUtils.utils.jImage_scaledToHeight;
import static loadableUtils.utils.jLabel;
import static loadableUtils.utils.jListSpinner;
import static loadableUtils.utils.jLiveTextField;
import static loadableUtils.utils.jLiveValueComboBox;
import static loadableUtils.utils.jMaxWidth;
import static loadableUtils.utils.jMenuItem;
import static loadableUtils.utils.jMinHeight;
import static loadableUtils.utils.jMinSize;
import static loadableUtils.utils.jMinWidth;
import static loadableUtils.utils.jOnDemand;
import static loadableUtils.utils.jPreferHeight;
import static loadableUtils.utils.jProgressBarWithText;
import static loadableUtils.utils.jRaisedCenteredSection;
import static loadableUtils.utils.jRaisedSection;
import static loadableUtils.utils.jSimpleLabel;
import static loadableUtils.utils.jSmallErrorView;
import static loadableUtils.utils.jSpinner;
import static loadableUtils.utils.jTextArea_noUndo;
import static loadableUtils.utils.jTextField;
import static loadableUtils.utils.jTopOrLeftTabs;
import static loadableUtils.utils.jTypedComboBox;
import static loadableUtils.utils.javaVersion;
import static loadableUtils.utils.javaxCachesDir;
import static loadableUtils.utils.javaxDataDir;
import static loadableUtils.utils.javaxSecretDir;
import static loadableUtils.utils.jbuttonWithDisable;
import static loadableUtils.utils.jcenteredLabel;
import static loadableUtils.utils.jcenteredlabel;
import static loadableUtils.utils.jcenteredline;
import static loadableUtils.utils.jfind;
import static loadableUtils.utils.jfullcenter;
import static loadableUtils.utils.jimageButton;
import static loadableUtils.utils.jimageButtonScaledToWidth;
import static loadableUtils.utils.joinNempties;
import static loadableUtils.utils.joinNemptiesWithComma;
import static loadableUtils.utils.joinWithComma;
import static loadableUtils.utils.jpanel;
import static loadableUtils.utils.jscroll;
import static loadableUtils.utils.jscrollHorizontal;
import static loadableUtils.utils.jscroll_center_borderless;
import static loadableUtils.utils.jscroll_centered_borderless;
import static loadableUtils.utils.jsonEncode;
import static loadableUtils.utils.jtabs;
import static loadableUtils.utils.jtextfield;
import static loadableUtils.utils.jtransparent_recursive;
import static loadableUtils.utils.jvsplit;
import static loadableUtils.utils.keys;
import static loadableUtils.utils.lCommonPrefix;
import static loadableUtils.utils.lastIndexOf;
import static loadableUtils.utils.length;
import static loadableUtils.utils.lessThan;
import static loadableUtils.utils.licensed;
import static loadableUtils.utils.liftLast;
import static loadableUtils.utils.lightBlue;
import static loadableUtils.utils.lines;
import static loadableUtils.utils.linesFromFile;
import static loadableUtils.utils.linesFromReader;
import static loadableUtils.utils.linesOfCode_javaTok;
import static loadableUtils.utils.lines_possiblyRTrim;
import static loadableUtils.utils.lines_rtrim;
import static loadableUtils.utils.list;
import static loadableUtils.utils.listAllFrames;
import static loadableUtils.utils.listDirs;
import static loadableUtils.utils.listDirsContainingFileNamed;
import static loadableUtils.utils.listFields;
import static loadableUtils.utils.listFromFunction;
import static loadableUtils.utils.listGetMulti;
import static loadableUtils.utils.listGetOrCreate;
import static loadableUtils.utils.listMinusSet;
import static loadableUtils.utils.listWebCams;
import static loadableUtils.utils.listWithout;
import static loadableUtils.utils.lithashset;
import static loadableUtils.utils.litlist;
import static loadableUtils.utils.litmap_impl;
import static loadableUtils.utils.litorderedmap;
import static loadableUtils.utils.litset;
import static loadableUtils.utils.liveValueCheckBox;
import static loadableUtils.utils.liveValue_hasChangeListeners;
import static loadableUtils.utils.ll;
import static loadableUtils.utils.loadBinaryPage_noHeaders;
import static loadableUtils.utils.loadImage2;
import static loadableUtils.utils.loadLibrary;
import static loadableUtils.utils.loadTextFile;
import static loadableUtils.utils.lock;
import static loadableUtils.utils.lockOrFail;
import static loadableUtils.utils.longestPrefixInTreeSet;
import static loadableUtils.utils.lowest;
import static loadableUtils.utils.makeAccessible;
import static loadableUtils.utils.makeBold;
import static loadableUtils.utils.makeFileNameUnique_beforeExtension_startWith1_noDot;
import static loadableUtils.utils.makeForm3;
import static loadableUtils.utils.makePostData;
import static loadableUtils.utils.map;
import static loadableUtils.utils.mapEachLine;
import static loadableUtils.utils.mapGet;
import static loadableUtils.utils.mapI;
import static loadableUtils.utils.mapKeys;
import static loadableUtils.utils.mapLL;
import static loadableUtils.utils.mapNonNulls;
import static loadableUtils.utils.mapPlus;
import static loadableUtils.utils.mapSortedByValue;
import static loadableUtils.utils.mapToArray;
import static loadableUtils.utils.mapToTreeSet;
import static loadableUtils.utils.mapWithSingleValue;
import static loadableUtils.utils.max;
import static loadableUtils.utils.maxWindowBounds;
import static loadableUtils.utils.maximizeFrame;
import static loadableUtils.utils.maximizeOrRestoreFrame;
import static loadableUtils.utils.menuItem;
import static loadableUtils.utils.mergeRects;
import static loadableUtils.utils.messageBox;
import static loadableUtils.utils.methodNames;
import static loadableUtils.utils.microSymbol;
import static loadableUtils.utils.min;
import static loadableUtils.utils.minWindowWidth;
import static loadableUtils.utils.mkdirsForFile;
import static loadableUtils.utils.mouseArea;
import static loadableUtils.utils.mouseLocationPt;
import static loadableUtils.utils.mul;
import static loadableUtils.utils.myJar;
import static loadableUtils.utils.n2;
import static loadableUtils.utils.nFiles;
import static loadableUtils.utils.nFrames;
import static loadableUtils.utils.nImages;
import static loadableUtils.utils.nLabels;
import static loadableUtils.utils.nLines;
import static loadableUtils.utils.nRegions;
import static loadableUtils.utils.nResults;
import static loadableUtils.utils.nameRelativeToPhysicalSubdirectory;
import static loadableUtils.utils.nempty;
import static loadableUtils.utils.neq;
import static loadableUtils.utils.newBufferedImage;
import static loadableUtils.utils.newFile;
import static loadableUtils.utils.newFileInputStream;
import static loadableUtils.utils.newFileOutputStream;
import static loadableUtils.utils.newGZIPInputStream;
import static loadableUtils.utils.newImage;
import static loadableUtils.utils.nonNulls;
import static loadableUtils.utils.northAndCenterWithMargins;
import static loadableUtils.utils.northCenterAndSouthWithMargin;
import static loadableUtils.utils.now;
import static loadableUtils.utils.nsToMicroseconds;
import static loadableUtils.utils.nu;
import static loadableUtils.utils.nuInstance;
import static loadableUtils.utils.nullIfEmpty;
import static loadableUtils.utils.numberOfScreens;
import static loadableUtils.utils.objectToMap;
import static loadableUtils.utils.odd;
import static loadableUtils.utils.onBoundsChange;
import static loadableUtils.utils.onChangeAndNow;
import static loadableUtils.utils.onFirstShow;
import static loadableUtils.utils.onFirstShowing;
import static loadableUtils.utils.onTabSelected;
import static loadableUtils.utils.onWindowDeiconified;
import static loadableUtils.utils.oneOf;
import static loadableUtils.utils.openConnection;
import static loadableUtils.utils.optCast;
import static loadableUtils.utils.optPar;
import static loadableUtils.utils.or;
import static loadableUtils.utils.or2;
import static loadableUtils.utils.or2_rev;
import static loadableUtils.utils.orderMapByValue;
import static loadableUtils.utils.origin;
import static loadableUtils.utils.outerProduct;
import static loadableUtils.utils.ownResource;
import static loadableUtils.utils.packFrame;
import static loadableUtils.utils.packWindow;
import static loadableUtils.utils.pair;
import static loadableUtils.utils.pairB;
import static loadableUtils.utils.paramsPlus;
import static loadableUtils.utils.paramsToMap;
import static loadableUtils.utils.paramsToOrderedMap;
import static loadableUtils.utils.parseDouble;
import static loadableUtils.utils.parseInt;
import static loadableUtils.utils.parseLong;
import static loadableUtils.utils.pcallF;
import static loadableUtils.utils.pcallFAll;
import static loadableUtils.utils.persistSelectedTabAsLiveValue;
import static loadableUtils.utils.persistableThrowable;
import static loadableUtils.utils.picturesDir;
import static loadableUtils.utils.ping;
import static loadableUtils.utils.ping_v3_setPingSourceMaker;
import static loadableUtils.utils.pixelatedImageSurface;
import static loadableUtils.utils.pnl;
import static loadableUtils.utils.pnlToLines;
import static loadableUtils.utils.pnlToString;
import static loadableUtils.utils.popLast;
import static loadableUtils.utils.possibleMD5;
import static loadableUtils.utils.postBinaryPageToFile;
import static loadableUtils.utils.postPage;
import static loadableUtils.utils.posterizeBWImage_withMeta;
import static loadableUtils.utils.powersOfTwoUpTo;
import static loadableUtils.utils.prependIfNempty;
import static loadableUtils.utils.printJavaVersion;
import static loadableUtils.utils.printLog;
import static loadableUtils.utils.printRunningThreads;
import static loadableUtils.utils.printStackTrace;
import static loadableUtils.utils.printVars;
import static loadableUtils.utils.println;
import static loadableUtils.utils.programDir;
import static loadableUtils.utils.proxy;
import static loadableUtils.utils.psI;
import static loadableUtils.utils.ptMinus;
import static loadableUtils.utils.put;
import static loadableUtils.utils.putAll;
import static loadableUtils.utils.quote;
import static loadableUtils.utils.quoteAll;
import static loadableUtils.utils.r_dm_q;
import static loadableUtils.utils.random;
import static loadableUtils.utils.randomID;
import static loadableUtils.utils.regexpMatcher;
import static loadableUtils.utils.register;
import static loadableUtils.utils.registerConcept;
import static loadableUtils.utils.remove;
import static loadableUtils.utils.removeAll;
import static loadableUtils.utils.removeAllComponents;
import static loadableUtils.utils.removeSubList;
import static loadableUtils.utils.renameFileVerbose;
import static loadableUtils.utils.renameFileVerbose_assertSuccess;
import static loadableUtils.utils.renderComponentToImage;
import static loadableUtils.utils.renderRecordVars;
import static loadableUtils.utils.renderStackTrace;
import static loadableUtils.utils.repaint;
import static loadableUtils.utils.replaceAll;
import static loadableUtils.utils.replaceLast;
import static loadableUtils.utils.replacePrefix;
import static loadableUtils.utils.replaceTabTitleComponent;
import static loadableUtils.utils.replaceTokens;
import static loadableUtils.utils.reproduceRasterBars;
import static loadableUtils.utils.resizeImageIcon;
import static loadableUtils.utils.rethrowAndAppendToMessage;
import static loadableUtils.utils.revalidate;
import static loadableUtils.utils.rightAlignLabel;
import static loadableUtils.utils.rightAlignedLine;
import static loadableUtils.utils.round;
import static loadableUtils.utils.roundBracket;
import static loadableUtils.utils.roundDownTo;
import static loadableUtils.utils.runnableToIVF1;
import static loadableUtils.utils.runnableToVF1;
import static loadableUtils.utils.sameFile;
import static loadableUtils.utils.sameSize;
import static loadableUtils.utils.sameSnippetID;
import static loadableUtils.utils.saveBinaryFile;
import static loadableUtils.utils.saveGZStructureToFile;
import static loadableUtils.utils.saveImage;
import static loadableUtils.utils.saveImageWithCounter;
import static loadableUtils.utils.saveInImageDirectoryWithCounter;
import static loadableUtils.utils.saveJPG;
import static loadableUtils.utils.saveTextFile;
import static loadableUtils.utils.saveTiming_noPrint;
import static loadableUtils.utils.scaleAndPosterize;
import static loadableUtils.utils.scaleImageWithOp;
import static loadableUtils.utils.scalePt;
import static loadableUtils.utils.scaleRect;
import static loadableUtils.utils.scaledBWImageFromBWIntegralImage_withMeta_height;
import static loadableUtils.utils.screenCount;
import static loadableUtils.utils.screenNrContaining;
import static loadableUtils.utils.screenNrOfWindow;
import static loadableUtils.utils.scrollingTabs;
import static loadableUtils.utils.second;
import static loadableUtils.utils.secondIntFromLong;
import static loadableUtils.utils.selectItem;
import static loadableUtils.utils.selectTab;
import static loadableUtils.utils.selectedTabName;
import static loadableUtils.utils.setAlwaysOnTop;
import static loadableUtils.utils.setBorder;
import static loadableUtils.utils.setBounds;
import static loadableUtils.utils.setButtonImage;
import static loadableUtils.utils.setComboBoxItems;
import static loadableUtils.utils.setComponent;
import static loadableUtils.utils.setDialogContents;
import static loadableUtils.utils.setEnclosingViewPosition;
import static loadableUtils.utils.setFrameContents;
import static loadableUtils.utils.setHeaders;
import static loadableUtils.utils.setHorizontalAlignment;
import static loadableUtils.utils.setLocation;
import static loadableUtils.utils.setMargin;
import static loadableUtils.utils.setMetaSrc;
import static loadableUtils.utils.setOpaqueBackground;
import static loadableUtils.utils.setProgressBarText;
import static loadableUtils.utils.setProgressBarValue;
import static loadableUtils.utils.setSectionTitle;
import static loadableUtils.utils.setSelected;
import static loadableUtils.utils.setSelectedItem;
import static loadableUtils.utils.setSpinnerValue;
import static loadableUtils.utils.setTab;
import static loadableUtils.utils.setTabTitle;
import static loadableUtils.utils.setTextKeepCaret;
import static loadableUtils.utils.setToolTip;
import static loadableUtils.utils.setToolTipText;
import static loadableUtils.utils.sexyTable;
import static loadableUtils.utils.sfuIndent;
import static loadableUtils.utils.shallowClone;
import static loadableUtils.utils.shootWindow;
import static loadableUtils.utils.shortClassName;
import static loadableUtils.utils.shortDynName;
import static loadableUtils.utils.shorten;
import static loadableUtils.utils.shortenClassName;
import static loadableUtils.utils.showErrorFrame;
import static loadableUtils.utils.showFrame;
import static loadableUtils.utils.showImage;
import static loadableUtils.utils.showPackedFrame;
import static loadableUtils.utils.showTextWordWrapped;
import static loadableUtils.utils.showText_fast_noWrap;
import static loadableUtils.utils.sixteenToNine_p;
import static loadableUtils.utils.sleep;
import static loadableUtils.utils.sleepSeconds;
import static loadableUtils.utils.snippetImageURL;
import static loadableUtils.utils.snippetUpdateConnector;
import static loadableUtils.utils.sort;
import static loadableUtils.utils.sortInPlaceByCalculatedField;
import static loadableUtils.utils.sortedByCalculatedField;
import static loadableUtils.utils.sortedByComparator;
import static loadableUtils.utils.spaces;
import static loadableUtils.utils.stackTraceToString;
import static loadableUtils.utils.standardImports;
import static loadableUtils.utils.standardImports_fullyImportedPackages;
import static loadableUtils.utils.startQ;
import static loadableUtils.utils.startThread;
import static loadableUtils.utils.startsWith;
import static loadableUtils.utils.startsWithDigit;
import static loadableUtils.utils.startsWithIgnoreCase;
import static loadableUtils.utils.startsWithOneOf;
import static loadableUtils.utils.stdHash;
import static loadableUtils.utils.str;
import static loadableUtils.utils.strOrClassName;
import static loadableUtils.utils.strOrNull;
import static loadableUtils.utils.str_shorten;
import static loadableUtils.utils.str_toKB;
import static loadableUtils.utils.str_toMB_oneDigit;
import static loadableUtils.utils.stringLiveValue;
import static loadableUtils.utils.stringify;
import static loadableUtils.utils.stringsSortedByLength;
import static loadableUtils.utils.subList;
import static loadableUtils.utils.substring;
import static loadableUtils.utils.swic;
import static loadableUtils.utils.swing;
import static loadableUtils.utils.swingAndWait;
import static loadableUtils.utils.swingConfirm;
import static loadableUtils.utils.swingNu;
import static loadableUtils.utils.syncAdd;
import static loadableUtils.utils.syncGetOrCreate;
import static loadableUtils.utils.syncL;
import static loadableUtils.utils.syncMRUCache;
import static loadableUtils.utils.syncMap;
import static loadableUtils.utils.syncRemove;
import static loadableUtils.utils.syncSet;
import static loadableUtils.utils.synchronizedSet;
import static loadableUtils.utils.systemExit;
import static loadableUtils.utils.tabComponentClickFixer;
import static loadableUtils.utils.tabNames;
import static loadableUtils.utils.tableDependentButton;
import static loadableUtils.utils.tablePopupMenuItem_top;
import static loadableUtils.utils.tempDisableButton;
import static loadableUtils.utils.tempDisableButtons;
import static loadableUtils.utils.tempInfoBox;
import static loadableUtils.utils.tempInfoBoxNoHide;
import static loadableUtils.utils.tempInfoBox_noHide;
import static loadableUtils.utils.tempMapPut;
import static loadableUtils.utils.tempMapPutAll;
import static loadableUtils.utils.tempProgressBar_addToWindowIfPossible;
import static loadableUtils.utils.tempSetButtonImages;
import static loadableUtils.utils.tempSetRandomSeed;
import static loadableUtils.utils.tempSetTL;
import static loadableUtils.utils.textOut_or;
import static loadableUtils.utils.tlft;
import static loadableUtils.utils.toArray;
import static loadableUtils.utils.toBW;
import static loadableUtils.utils.toBWImage;
import static loadableUtils.utils.toBufferedImage;
import static loadableUtils.utils.toCIMap;
import static loadableUtils.utils.toColor;
import static loadableUtils.utils.toDouble;
import static loadableUtils.utils.toHex;
import static loadableUtils.utils.toIF1;
import static loadableUtils.utils.toInt;
import static loadableUtils.utils.toLines;
import static loadableUtils.utils.toLinesFullTrim;
import static loadableUtils.utils.toList;
import static loadableUtils.utils.toLong;
import static loadableUtils.utils.toRect_round;
import static loadableUtils.utils.toScanlineBitMatrix;
import static loadableUtils.utils.toStringArray;
import static loadableUtils.utils.toTypedArray;
import static loadableUtils.utils.toUtf8;
import static loadableUtils.utils.todo;
import static loadableUtils.utils.translatePt;
import static loadableUtils.utils.transpileOnNewServer;
import static loadableUtils.utils.trim;
import static loadableUtils.utils.tsNowPlusMS;
import static loadableUtils.utils.ubyteToInt;
import static loadableUtils.utils.unimplemented;
import static loadableUtils.utils.uniq;
import static loadableUtils.utils.uniqCI;
import static loadableUtils.utils.uniq_returnIfNew;
import static loadableUtils.utils.unlisted;
import static loadableUtils.utils.unlock;
import static loadableUtils.utils.unnull;
import static loadableUtils.utils.unnullForIteration;
import static loadableUtils.utils.updateEnclosingTabTitleWithCount;
import static loadableUtils.utils.userDir;
import static loadableUtils.utils.userDir_oneOf;
import static loadableUtils.utils.userDir_oneOf_createFirstIfNone;
import static loadableUtils.utils.usingStarter;
import static loadableUtils.utils.utf8;
import static loadableUtils.utils.value;
import static loadableUtils.utils.values;
import static loadableUtils.utils.valuesList;
import static loadableUtils.utils.varWithNotifyToLiveValue;
import static loadableUtils.utils.verticalStrut;
import static loadableUtils.utils.virtualCountList;
import static loadableUtils.utils.vmBus_onMessage;
import static loadableUtils.utils.vmBus_send;
import static loadableUtils.utils.vm_generalMap_put;
import static loadableUtils.utils.vstack;
import static loadableUtils.utils.vstack2;
import static loadableUtils.utils.vstackWithSpacing;
import static loadableUtils.utils.vstackWithSpacing_fixed;
import static loadableUtils.utils.waitUntil;
import static loadableUtils.utils.weakHashMap;
import static loadableUtils.utils.westAndCenter;
import static loadableUtils.utils.westAndCenterWithMargin;
import static loadableUtils.utils.white;
import static loadableUtils.utils.whiteImage;
import static loadableUtils.utils.withCenteredBoldTitle;
import static loadableUtils.utils.withCenteredTitle;
import static loadableUtils.utils.withLabel;
import static loadableUtils.utils.withLabelToTheRight;
import static loadableUtils.utils.withRightAlignedButtons;
import static loadableUtils.utils.withRightMargin;
import static loadableUtils.utils.withSideAndBottomMargin;
import static loadableUtils.utils.withSideAndTopMargin;
import static loadableUtils.utils.withSideMargin;
import static loadableUtils.utils.withSideMargins;
import static loadableUtils.utils.withToolTip;
import static loadableUtils.utils.withTopAndBottomMargin;
import static loadableUtils.utils.withTopRightAndBottomMargin;
import static loadableUtils.utils.withoutNulls;
import static loadableUtils.utils.wrap;
import static loadableUtils.utils.yesNoShort;
import static loadableUtils.utils.yesNo_short;
import static loadableUtils.utils.zipFile;
import static loadableUtils.utils.zipFileToJSONFingerprint_md5;
import loadableUtils.utils.AbstractLayoutManager;
import loadableUtils.utils.AnimatedLine;
import loadableUtils.utils.Animation;
import loadableUtils.utils.BackgroundProcessesUI;
import loadableUtils.utils.IBackgroundProcesses;
import loadableUtils.utils.IBackgroundProcess;
import loadableUtils.utils.CenteredComboBoxRenderer;
import loadableUtils.utils.CharInToken;
import loadableUtils.utils.ClassNameResolver;
import loadableUtils.utils.ClearForAutoRun;
import loadableUtils.utils.CloseableIterableIterator;
import loadableUtils.utils.CombinedStringifier;
import loadableUtils.utils.ComputerCountListener;
import loadableUtils.utils.ConceptWithChangeListeners;
import loadableUtils.utils.ConceptWithGlobalID;
import loadableUtils.utils.ConceptsComboBox;
import loadableUtils.utils.CountingOutputStream;
import loadableUtils.utils.DoubleFPSCounter;
import loadableUtils.utils.FastRegions_BWImage;
import loadableUtils.utils.FieldVar;
import loadableUtils.utils.Flag;
import loadableUtils.utils.FunctionTimings;
import loadableUtils.utils.HasChangeListeners;
import loadableUtils.utils.IDoublePt;
import loadableUtils.utils.IF0WithChangeListeners;
import loadableUtils.utils.IF2;
import loadableUtils.utils.IF2_IntInt_Double;
import loadableUtils.utils.IFieldsToList;
import loadableUtils.utils.IHasTokenRangeWithSrc;
import loadableUtils.utils.IIBWVirtualClip;
import loadableUtils.utils.IImageRegion;
import loadableUtils.utils.IImageRegions;
import loadableUtils.utils.IVar;
import loadableUtils.utils.IVarWithNotify;
import loadableUtils.utils.IfThen;
import loadableUtils.utils.ImageSurfaceSelector;
import loadableUtils.utils.ImageSurface_PositionToolTip;
import loadableUtils.utils.IntMinMax;
import loadableUtils.utils.IntPair;
import loadableUtils.utils.JFFMPEGVideoPlayer;
import loadableUtils.utils.JFilePathLabel;
import loadableUtils.utils.JGallery;
import loadableUtils.utils.JMiniJavaIDE;
import loadableUtils.utils.JObjectTable;
import loadableUtils.utils.JPaintTool;
import loadableUtils.utils.JPopDownButton;
import loadableUtils.utils.JVideoLibDownloader;
import loadableUtils.utils.LineAndColumn;
import loadableUtils.utils.Lowest;
import loadableUtils.utils.MRUCache;
import loadableUtils.utils.MetaWithChangeListeners;
import loadableUtils.utils.NotifyingSet;
import loadableUtils.utils.PosterizeBWImage;
import loadableUtils.utils.PtBuffer;
import loadableUtils.utils.RSyntaxTextAreaWithSearch;
import loadableUtils.utils.RegionBorder_innerPoints;
import loadableUtils.utils.RollingAverage;
import loadableUtils.utils.ScanlineBitMatrix;
import loadableUtils.utils.ScoredStringSearcher;
import loadableUtils.utils.ScreenCamStream;
import loadableUtils.utils.ScreenShotMeta;
import loadableUtils.utils.SingleThread;
import loadableUtils.utils.SnPSettings;
import loadableUtils.utils.SourceTriggeredStream;
import loadableUtils.utils.StefansOS_ConnectToServer;
import loadableUtils.utils.TimestampRange;
import loadableUtils.utils.TokenRange;
import loadableUtils.utils.TokenRangeWithSrc;
import loadableUtils.utils.TrayIconLastPosition;
import loadableUtils.utils.UIURLSystem;
import loadableUtils.utils.Value;
import loadableUtils.utils.Var;
import loadableUtils.utils.VarContext;
import loadableUtils.utils.VarWithNotify;
import loadableUtils.utils.VirtualVar;
import loadableUtils.utils.WeakVar;
import loadableUtils.utils.WithToolTip;
import loadableUtils.utils.DoublePt;
import loadableUtils.utils.JExtendedTabbedPane;
import static loadableUtils.utils.addClassNameToInclude;
import static loadableUtils.utils.addComponentAtIndex;
import static loadableUtils.utils.addFunctionNameToInclude;
import static loadableUtils.utils.addInFront;
import static loadableUtils.utils.addKeyListener;
import static loadableUtils.utils.addLibrary;
import static loadableUtils.utils.addOrRemoveComponent;
import static loadableUtils.utils.addPair;
import static loadableUtils.utils.allToBufferedImage;
import static loadableUtils.utils.appendNewLineIfNempty;
import static loadableUtils.utils.appendPrefixIfNempty;
import static loadableUtils.utils.appendSquareBracketed;
import static loadableUtils.utils.asRuntimeException;
import static loadableUtils.utils.assertSetEquals;
import static loadableUtils.utils.atan2;
import static loadableUtils.utils.autoUnindent_mls;
import static loadableUtils.utils.averageBrightness;
import static loadableUtils.utils.awtCalcContinuously;
import static loadableUtils.utils.benchForNSeconds;
import static loadableUtils.utils.bindChangeListenerToComponent;
import static loadableUtils.utils.bindComboBoxToVar_withUserChangeListener;
import static loadableUtils.utils.bindHasChangeListenersToComponent;
import static loadableUtils.utils.blendColor;
import static loadableUtils.utils.boostHashCombine64;
import static loadableUtils.utils.bwImage;
import static loadableUtils.utils.byteArrayStartsWith;
import static loadableUtils.utils.castTo;
import static loadableUtils.utils.charToTokenIndex_left;
import static loadableUtils.utils.chunks;
import static loadableUtils.utils.ciSet;
import static loadableUtils.utils.classToBCELType;
import static loadableUtils.utils.clearMetaSrc;
import static loadableUtils.utils.cloneMultiSet;
import static loadableUtils.utils.cloneTakeFirst;
import static loadableUtils.utils.closeAll;
import static loadableUtils.utils.closeAndClear;
import static loadableUtils.utils.cnewUnlisted;
import static loadableUtils.utils.colorToInt;
import static loadableUtils.utils.combineSteppables_dontDropEnded;
import static loadableUtils.utils.compileRegexpIC;
import static loadableUtils.utils.componentMetaSrc;
import static loadableUtils.utils.concatMapStrings;
import static loadableUtils.utils.concatMap_lists;
import static loadableUtils.utils.concatMethodArgs;
import static loadableUtils.utils.conceptsFile;
import static loadableUtils.utils.conceptsFileIn;
import static loadableUtils.utils.constructorsWithNumberOfArguments;
import static loadableUtils.utils.containsPt;
import static loadableUtils.utils.cos;
import static loadableUtils.utils.countIteratorToList_incl;
import static loadableUtils.utils.createOrRemoveFile;
import static loadableUtils.utils.curly;
import static loadableUtils.utils.cyclicSubList;
import static loadableUtils.utils.cyclicSubList_incl;
import static loadableUtils.utils.dbDir;
import static loadableUtils.utils.deRoundBracket;
import static loadableUtils.utils.dec;
import static loadableUtils.utils.defaultAgeBasedBackupRetentionStrategy_shouldKeep;
import static loadableUtils.utils.deleteDB;
import static loadableUtils.utils.doublePt;
import static loadableUtils.utils.doubleSum;
import static loadableUtils.utils.drawRect;
import static loadableUtils.utils.dropPrefixOrNull;
import static loadableUtils.utils.editImageID;
import static loadableUtils.utils.editSnippet;
import static loadableUtils.utils.emptyBitSet;
import static loadableUtils.utils.emptyItIt;
import static loadableUtils.utils.f2s_opt;
import static loadableUtils.utils.fieldNames;
import static loadableUtils.utils.fieldObject;
import static loadableUtils.utils.fileForLibrary;
import static loadableUtils.utils.fillArray;
import static loadableUtils.utils.findAllFiles;
import static loadableUtils.utils.findFieldOfClass;
import static loadableUtils.utils.findSingleInterfaceMethodOrFail;
import static loadableUtils.utils.firstKey;
import static loadableUtils.utils.fixFieldValues;
import static loadableUtils.utils.floor;
import static loadableUtils.utils.floorValue;
import static loadableUtils.utils.fontMetrics;
import static loadableUtils.utils.fontSize;
import static loadableUtils.utils.formatElapsedTimeWithAppropriateUnit;
import static loadableUtils.utils.frac;
import static loadableUtils.utils.getAndClear;
import static loadableUtils.utils.getBit;
import static loadableUtils.utils.getCenterComponent;
import static loadableUtils.utils.getColor;
import static loadableUtils.utils.getComponentAtIndex;
import static loadableUtils.utils.getConcept;
import static loadableUtils.utils.getFont;
import static loadableUtils.utils.getIndentOfLine;
import static loadableUtils.utils.getList;
import static loadableUtils.utils.getMethodCache;
import static loadableUtils.utils.getPixel;
import static loadableUtils.utils.getSliderValue;
import static loadableUtils.utils.growRect;
import static loadableUtils.utils.handleObjectMethodsInProxyInvocationHandler;
import static loadableUtils.utils.hasAlpha;
import static loadableUtils.utils.hash;
import static loadableUtils.utils.hashRefTok;
import static loadableUtils.utils.hostToIP;
import static loadableUtils.utils.iceil_div;
import static loadableUtils.utils.iff_null;
import static loadableUtils.utils.imageRect;
import static loadableUtils.utils.imageSize;
import static loadableUtils.utils.imageSurfaceOnHover;
import static loadableUtils.utils.inRange;
import static loadableUtils.utils.indexOfSelectedTab;
import static loadableUtils.utils.infinity;
import static loadableUtils.utils.innerExceptionOfType;
import static loadableUtils.utils.inputText;
import static loadableUtils.utils.installCompletionProvider;
import static loadableUtils.utils.intArrayToBufferedImageWithoutAlpha;
import static loadableUtils.utils.intFromBinary;
import static loadableUtils.utils.intRange_incl;
import static loadableUtils.utils.integralImage;
import static loadableUtils.utils.intern;
import static loadableUtils.utils.invokeMethodWithWidening;
import static loadableUtils.utils.isAbsoluteURL;
import static loadableUtils.utils.isAnonymousClass;
import static loadableUtils.utils.isArray;
import static loadableUtils.utils.isDeepContainedInDir_absolute;
import static loadableUtils.utils.isDirectory;
import static loadableUtils.utils.isIPv4;
import static loadableUtils.utils.isInterface;
import static loadableUtils.utils.isPrimitiveType;
import static loadableUtils.utils.isSameFile;
import static loadableUtils.utils.isStandardClass;
import static loadableUtils.utils.isStandardFunction;
import static loadableUtils.utils.isStaticField;
import static loadableUtils.utils.iteratorToSteppable;
import static loadableUtils.utils.iterator_gen;
import static loadableUtils.utils.jBoldLabel;
import static loadableUtils.utils.jCenteredRaisedBoldLiveValueSection;
import static loadableUtils.utils.jExtendedTabs;
import static loadableUtils.utils.jFilePathButton;
import static loadableUtils.utils.jGazelleLogo;
import static loadableUtils.utils.jImageButton;
import static loadableUtils.utils.jImageButtonScaledToWidth;
import static loadableUtils.utils.jLabelShortCalcedEvery;
import static loadableUtils.utils.jLiveValueCheckBoxMenuItem;
import static loadableUtils.utils.jMinWidth_pure;
import static loadableUtils.utils.jThreadedButton;
import static loadableUtils.utils.jVarCheckBox;
import static loadableUtils.utils.jVarTextField;
import static loadableUtils.utils.jVerticalStrut;
import static loadableUtils.utils.javaxClassShortcuts;
import static loadableUtils.utils.jcenterNarrowLabel;
import static loadableUtils.utils.jcheckbox;
import static loadableUtils.utils.jlist;
import static loadableUtils.utils.joinMaps;
import static loadableUtils.utils.joinNemptiesWithEmptyLines;
import static loadableUtils.utils.joinNemptiesWithSpace;
import static loadableUtils.utils.joinNemptiesWithSpacedPlus;
import static loadableUtils.utils.joinNemptiesWithVBar;
import static loadableUtils.utils.joinSets;
import static loadableUtils.utils.joinWithCommaOr;
import static loadableUtils.utils.jscrollVertical;
import static loadableUtils.utils.jscroll_borderless;
import static loadableUtils.utils.jscroll_vertical;
import static loadableUtils.utils.keySet;
import static loadableUtils.utils.lambdaArgsToString_pureJava;
import static loadableUtils.utils.lastEntry;
import static loadableUtils.utils.linesIterator;
import static loadableUtils.utils.linkVars;
import static loadableUtils.utils.listFiles;
import static loadableUtils.utils.listFilesNotDirs;
import static loadableUtils.utils.listMinus;
import static loadableUtils.utils.listToSquareishChunks;
import static loadableUtils.utils.litmap;
import static loadableUtils.utils.liveValueLabel;
import static loadableUtils.utils.llNonNulls;
import static loadableUtils.utils.lmap;
import static loadableUtils.utils.load;
import static loadableUtils.utils.loadBeginningOfBinaryFile;
import static loadableUtils.utils.loadFirstBytes;
import static loadableUtils.utils.localFont;
import static loadableUtils.utils.localFontFamilies;
import static loadableUtils.utils.lookupOrKeep;
import static loadableUtils.utils.lower;
import static loadableUtils.utils.mapToArrayOrNull;
import static loadableUtils.utils.mapToIntArray;
import static loadableUtils.utils.map_pcall;
import static loadableUtils.utils.markVisualizer;
import static loadableUtils.utils.matcherInt;
import static loadableUtils.utils.mlsUnindent;
import static loadableUtils.utils.moveCaretToLineAndCol;
import static loadableUtils.utils.multiMapIndex;
import static loadableUtils.utils.multiMapToMapPairs;
import static loadableUtils.utils.multiSetMapToMapPairs;
import static loadableUtils.utils.n2OrStrOrNull;
import static loadableUtils.utils.nCharacters;
import static loadableUtils.utils.nPixels;
import static loadableUtils.utils.nPoints;
import static loadableUtils.utils.nSteps;
import static loadableUtils.utils.nanos;
import static loadableUtils.utils.neg;
import static loadableUtils.utils.nempties;
import static loadableUtils.utils.newInstance;
import static loadableUtils.utils.newObject;
import static loadableUtils.utils.newPreciseCall;
import static loadableUtils.utils.nextFromIterator;
import static loadableUtils.utils.not;
import static loadableUtils.utils.notNull;
import static loadableUtils.utils.numberOfBitsNeededToRepresentNOptions;
import static loadableUtils.utils.onSelect;
import static loadableUtils.utils.onSelectionChanged;
import static loadableUtils.utils.onTabSelectedAndNow;
import static loadableUtils.utils.onePathDirection;
import static loadableUtils.utils.onePathDirection_long;
import static loadableUtils.utils.onePathLookupDirection;
import static loadableUtils.utils.optimizedUniq;
import static loadableUtils.utils.overlappingPairs;
import static loadableUtils.utils.pairsA;
import static loadableUtils.utils.paragraphs;
import static loadableUtils.utils.parseFloat;
import static loadableUtils.utils.parseHexInt;
import static loadableUtils.utils.parseHexRange;
import static loadableUtils.utils.parseLineAndColumn;
import static loadableUtils.utils.parseList;
import static loadableUtils.utils.pcallF_typed;
import static loadableUtils.utils.pixelsOfBufferedImage;
import static loadableUtils.utils.pointDistance;
import static loadableUtils.utils.popFirst;
import static loadableUtils.utils.pow;
import static loadableUtils.utils.preciseGetOrCallMethod;
import static loadableUtils.utils.preciseNuObject;
import static loadableUtils.utils.primitiveToBoxedType;
import static loadableUtils.utils.printVarsInMultipleLines;
import static loadableUtils.utils.proxyFromInvocationHandler;
import static loadableUtils.utils.ptDiff;
import static loadableUtils.utils.ptPlus;
import static loadableUtils.utils.regexReplace;
import static loadableUtils.utils.regexpFind;
import static loadableUtils.utils.regexpIC;
import static loadableUtils.utils.regexpReplace;
import static loadableUtils.utils.regexpReplace_direct;
import static loadableUtils.utils.removeLast;
import static loadableUtils.utils.repArray;
import static loadableUtils.utils.replaceIfEqual;
import static loadableUtils.utils.replaceRegexp;
import static loadableUtils.utils.resolve;
import static loadableUtils.utils.restructure;
import static loadableUtils.utils.reverseInPlace;
import static loadableUtils.utils.reversed;
import static loadableUtils.utils.rightAlignedLabel;
import static loadableUtils.utils.rotatePtLeft;
import static loadableUtils.utils.rotatePtRight;
import static loadableUtils.utils.roundBracketed;
import static loadableUtils.utils.roundRobinCombinedIterator;
import static loadableUtils.utils.rst;
import static loadableUtils.utils.rstWithPreDelay;
import static loadableUtils.utils.rtrim;
import static loadableUtils.utils.runResultWithTimestamps;
import static loadableUtils.utils.sansSerif;
import static loadableUtils.utils.scaleImage;
import static loadableUtils.utils.scp;
import static loadableUtils.utils.selectTabComponent;
import static loadableUtils.utils.setBit;
import static loadableUtils.utils.setEditable;
import static loadableUtils.utils.setFontSize;
import static loadableUtils.utils.setLast;
import static loadableUtils.utils.setPixel;
import static loadableUtils.utils.shortToString;
import static loadableUtils.utils.showFormTitled3;
import static loadableUtils.utils.similarEmptyMultiSet;
import static loadableUtils.utils.similarEmptySet;
import static loadableUtils.utils.sin;
import static loadableUtils.utils.sortByCalculatedFieldAlphaNumIC;
import static loadableUtils.utils.sortByMap_inPlace;
import static loadableUtils.utils.sortFilesAlphaNumIC;
import static loadableUtils.utils.sortIntArrayInPlaceDesc;
import static loadableUtils.utils.spinnerSetNumberList;
import static loadableUtils.utils.splitAtComma;
import static loadableUtils.utils.splitAtComma_trim;
import static loadableUtils.utils.standardClassesMap_clearCache;
import static loadableUtils.utils.standardClassesSnippetIDs;
import static loadableUtils.utils.stdFunctionListSnippetIDs;
import static loadableUtils.utils.stdFunctions_clearCache;
import static loadableUtils.utils.step;
import static loadableUtils.utils.steppableToIterator;
import static loadableUtils.utils.str_pcall;
import static loadableUtils.utils.str_px;
import static loadableUtils.utils.str_toK;
import static loadableUtils.utils.str_toM;
import static loadableUtils.utils.str_toMB;
import static loadableUtils.utils.stringIf;
import static loadableUtils.utils.synchroLinkedList;
import static loadableUtils.utils.synchroNavigableMap;
import static loadableUtils.utils.tabToSingleSpace;
import static loadableUtils.utils.tempAddGlobalCtrlKeyListener;
import static loadableUtils.utils.tempGlobalPopupMenu;
import static loadableUtils.utils.tempRestoreMap;
import static loadableUtils.utils.tempSetBoolVar;
import static loadableUtils.utils.testBit;
import static loadableUtils.utils.timestampFromYMDHM;
import static loadableUtils.utils.toArrayOrNull;
import static loadableUtils.utils.toDoubleOrNull;
import static loadableUtils.utils.toIVF1;
import static loadableUtils.utils.toLowerCase;
import static loadableUtils.utils.toPNG;
import static loadableUtils.utils.toPoint;
import static loadableUtils.utils.toVF1;
import static loadableUtils.utils.transformedLiveValueLabel;
import static loadableUtils.utils.trimAll;
import static loadableUtils.utils.ubyteFromBits;
import static loadableUtils.utils.uneditableBlack;
import static loadableUtils.utils.uneditableTextArea;
import static loadableUtils.utils.uploadImageFileDialog;
import static loadableUtils.utils.upper;
import static loadableUtils.utils.usedMemory;
import static loadableUtils.utils.virtualCountList_incl;
import static loadableUtils.utils.waitForVarPredicate;
import static loadableUtils.utils.waitUntilNotNull;
import static loadableUtils.utils.widthAndHeight;
import static loadableUtils.utils.withAlpha;
import static loadableUtils.utils.withTopAndLeftMargin;
import static loadableUtils.utils.wordWrapTypeWriterTextArea;
import static loadableUtils.utils.zip;
import loadableUtils.utils.AWTOnConceptChangesByClass;
import loadableUtils.utils.BoundsFinder;
import loadableUtils.utils.ClassMaker;
import loadableUtils.utils.CollapsibleLeftPanel;
import loadableUtils.utils.CollapsibleNorthPanel;
import loadableUtils.utils.DefaultButtonBorder;
import loadableUtils.utils.DeleteFilesDialog;
import loadableUtils.utils.GazellePresenceListener;
import loadableUtils.utils.HasTokenRangeWithSrc;
import loadableUtils.utils.HashRefTokenMaker;
import loadableUtils.utils.HashedBWImage;
import loadableUtils.utils.IBinaryImage;
import loadableUtils.utils.IF2_Int;
import loadableUtils.utils.IIntIntPred;
import loadableUtils.utils.IPersistenceInfo;
import loadableUtils.utils.Image2B;
import loadableUtils.utils.ImageFileFilter;
import loadableUtils.utils.InMemoryClassLoader;
import loadableUtils.utils.IndexIterator;
import loadableUtils.utils.InstantNeverHideToolTip;
import loadableUtils.utils.JSyntaxTextFileEditor;
import loadableUtils.utils.JVMStackCellType;
import loadableUtils.utils.JavaXPeepholeShortener;
import loadableUtils.utils.MethodMaker;
import loadableUtils.utils.NamedConcept;
import loadableUtils.utils.OnePathWithOrigin;
import loadableUtils.utils.PersistableOKOrError;
import loadableUtils.utils.PopupMenuMaker;
import loadableUtils.utils.PtSet;
import loadableUtils.utils.RSTADummyParser;
import loadableUtils.utils.RecognizedRegion;
import loadableUtils.utils.RectAsRecognizedBox;
import loadableUtils.utils.RegionBorder_innerPoints_v2;
import loadableUtils.utils.RegionBorder_innerPoints_withDiagonals;
import loadableUtils.utils.RenderRecognizedBox;
import loadableUtils.utils.RenderText;
import loadableUtils.utils.RunResultWithTimestamps;
import loadableUtils.utils.TreeMultiMap;
import loadableUtils.utils.UniquifyUsingHasher;
import loadableUtils.utils.WeightlessShuffledIterator;
import loadableUtils.utils.IntSize;
import loadableUtils.utils.TransientObject;
import loadableUtils.utils.IMakeEmptyClone;
import loadableUtils.utils.ByteIO;
import loadableUtils.utils.ByteHead;
import loadableUtils.utils.BufferedImageWithMeta;
import loadableUtils.utils.RegionToImage2B;
import loadableUtils.utils.WeakValueMap;
import loadableUtils.utils.RunnablesReferenceQueue;
import static loadableUtils.utils._print;
import static loadableUtils.utils.absdiff;
import static loadableUtils.utils.allEq;
import static loadableUtils.utils.allToStruct;
import static loadableUtils.utils.alphaChannelAverage;
import static loadableUtils.utils.alphaChannelFromPixels;
import static loadableUtils.utils.antiFilter;
import static loadableUtils.utils.appendRoundBracketed;
import static loadableUtils.utils.areaRoot;
import static loadableUtils.utils.asPercentIncrease;
import static loadableUtils.utils.assertNotSame;
import static loadableUtils.utils.assertProperStreaks;
import static loadableUtils.utils.assertValidFileName;
import static loadableUtils.utils.average;
import static loadableUtils.utils.avg;
import static loadableUtils.utils.baseDirInZip;
import static loadableUtils.utils.biggestRegionsFirst;
import static loadableUtils.utils.biggestSSIsFirst;
import static loadableUtils.utils.bindTextComponentToVarWithNotify_noInitialUndo;
import static loadableUtils.utils.bindVarToVar;
import static loadableUtils.utils.bitCount;
import static loadableUtils.utils.blackImage;
import static loadableUtils.utils.blendRGBInts;
import static loadableUtils.utils.blurBufferedImage;
import static loadableUtils.utils.blurFilterBufferedImage;
import static loadableUtils.utils.boxed;
import static loadableUtils.utils.boxedIntOrLong;
import static loadableUtils.utils.bufferedImageContrastAndBrightness;
import static loadableUtils.utils.bwImageFromFunction;
import static loadableUtils.utils.cachePosterizer;
import static loadableUtils.utils.canonicalFile;
import static loadableUtils.utils.cbrt;
import static loadableUtils.utils.centerTextField;
import static loadableUtils.utils.certaintyImage;
import static loadableUtils.utils.cicOneOf;
import static loadableUtils.utils.classIs;
import static loadableUtils.utils.classNameWithIdentity;
import static loadableUtils.utils.cloneAndClear;
import static loadableUtils.utils.colonCombine;
import static loadableUtils.utils.color;
import static loadableUtils.utils.combinedChildBounds;
import static loadableUtils.utils.compilationDateFromClassPath;
import static loadableUtils.utils.componentToFront;
import static loadableUtils.utils.concat;
import static loadableUtils.utils.conceptCount;
import static loadableUtils.utils.copyTextToClipboardVerbose;
import static loadableUtils.utils.count;
import static loadableUtils.utils.createOrAddToSet;
import static loadableUtils.utils.cset_trueIfChanged;
import static loadableUtils.utils.ctrlLetterKeyListener;
import static loadableUtils.utils.cubed;
import static loadableUtils.utils.decodeImage;
import static loadableUtils.utils.defaultTimeZone;
import static loadableUtils.utils.diff;
import static loadableUtils.utils.dir2zip;
import static loadableUtils.utils.directChildrenOfType;
import static loadableUtils.utils.distancePointToLineSegment;
import static loadableUtils.utils.domain;
import static loadableUtils.utils.doubleAverage;
import static loadableUtils.utils.doubleMin;
import static loadableUtils.utils.doubleRange;
import static loadableUtils.utils.drawPixels;
import static loadableUtils.utils.dropStarPrefix;
import static loadableUtils.utils.file2stream;
import static loadableUtils.utils.fileModificationTime;
import static loadableUtils.utils.fileSavedInfoBox;
import static loadableUtils.utils.findMethod_withPrimitiveWidening_onTypes;
import static loadableUtils.utils.findMethodsNamed_cached;
import static loadableUtils.utils.firstNCubes;
import static loadableUtils.utils.firstNonNull;
import static loadableUtils.utils.flatInfoBox;
import static loadableUtils.utils.flipCoin;
import static loadableUtils.utils.formatDouble2;
import static loadableUtils.utils.formatDouble2X;
import static loadableUtils.utils.formatPercent;
import static loadableUtils.utils.functionKeyListener;
import static loadableUtils.utils.genericStreaks;
import static loadableUtils.utils.getMyIP;
import static loadableUtils.utils.getTransferData;
import static loadableUtils.utils.greaterOrEq;
import static loadableUtils.utils.growRectTopAndLeft;
import static loadableUtils.utils.hasStaticMethodNamed;
import static loadableUtils.utils.haveTranspilationPassword;
import static loadableUtils.utils.hi15ToRGBInt_clean;
import static loadableUtils.utils.highestBy;
import static loadableUtils.utils.highestByField;
import static loadableUtils.utils.image2BFromFunction;
import static loadableUtils.utils.imageToPixels;
import static loadableUtils.utils.indentedStruct;
import static loadableUtils.utils.insertAt;
import static loadableUtils.utils.instancesOf;
import static loadableUtils.utils.intRangesOverlapNempty;
import static loadableUtils.utils.intToHex_fullLength;
import static loadableUtils.utils.intersectRanges;
import static loadableUtils.utils.isSpace;
import static loadableUtils.utils.itemPlusArray;
import static loadableUtils.utils.jLiveValueSlider_int_bothWays;
import static loadableUtils.utils.jSlider;
import static loadableUtils.utils.javaxBackupDir;
import static loadableUtils.utils.jsonDecode;
import static loadableUtils.utils.jsonDecodeMap;
import static loadableUtils.utils.jsonTok;
import static loadableUtils.utils.jvsplit_minZero;
import static loadableUtils.utils.lasTok;
import static loadableUtils.utils.lastConceptChange;
import static loadableUtils.utils.lastIdentifier;
import static loadableUtils.utils.lessThanOrEqual;
import static loadableUtils.utils.listChildren;
import static loadableUtils.utils.listCombine;
import static loadableUtils.utils.listZipFile;
import static loadableUtils.utils.loadBinaryPageToFile;
import static loadableUtils.utils.loadTextFilePart;
import static loadableUtils.utils.log;
import static loadableUtils.utils.longSum;
import static loadableUtils.utils.longerThan;
import static loadableUtils.utils.lookupStandardFunctionOrClassNameIC;
import static loadableUtils.utils.makeFileNameUnique;
import static loadableUtils.utils.mapItemsToListIndex;
import static loadableUtils.utils.mapPairsToList;
import static loadableUtils.utils.maxMemory;
import static loadableUtils.utils.megapixels;
import static loadableUtils.utils.mergeBufferedImagesAsSquare;
import static loadableUtils.utils.minutesToDays;
import static loadableUtils.utils.modificationTime;
import static loadableUtils.utils.moveFile;
import static loadableUtils.utils.moveFileVerbose;
import static loadableUtils.utils.msToNanos;
import static loadableUtils.utils.nemptyLines_extractLists;
import static loadableUtils.utils.newPreciseCall_sentinel;
import static loadableUtils.utils.nextToLast;
import static loadableUtils.utils.nlCombine;
import static loadableUtils.utils.openInBrowser;
import static loadableUtils.utils.openPlatformBrowser;
import static loadableUtils.utils.options;
import static loadableUtils.utils.parentName;
import static loadableUtils.utils.parseDoubleOpt;
import static loadableUtils.utils.parsePrimitiveType;
import static loadableUtils.utils.percentIncrease;
import static loadableUtils.utils.pixelsWithInvertedAlpha;
import static loadableUtils.utils.platformQuoteArgs;
import static loadableUtils.utils.preciseGetOrCallMethod_sentinel;
import static loadableUtils.utils.printFunctionCall;
import static loadableUtils.utils.printWriter;
import static loadableUtils.utils.putOrCreateLinkedHashMap;
import static loadableUtils.utils.randomValue;
import static loadableUtils.utils.rangeSliderZeroToOne;
import static loadableUtils.utils.readLine;
import static loadableUtils.utils.reallyLazyMap;
import static loadableUtils.utils.rectDistance;
import static loadableUtils.utils.regionToIBinaryImage;
import static loadableUtils.utils.render;
import static loadableUtils.utils.renderImageOnBackground;
import static loadableUtils.utils.replaceIfEquals;
import static loadableUtils.utils.revalidateIncludingFullCenterContainer;
import static loadableUtils.utils.rgbAlphaZeroToOne;
import static loadableUtils.utils.rgbDistanceSquaredInt;
import static loadableUtils.utils.rgbIntFullAlpha;
import static loadableUtils.utils.runResultWithTimestamps_dontPrintStackTrace;
import static loadableUtils.utils.sanitizeFileName;
import static loadableUtils.utils.scaledBWImageFromBWIntegralImage_withMeta;
import static loadableUtils.utils.scaledIBinaryImage;
import static loadableUtils.utils.serve404;
import static loadableUtils.utils.setRGB;
import static loadableUtils.utils.setSize;
import static loadableUtils.utils.setSliderValue;
import static loadableUtils.utils.sfOrSCSnippet;
import static loadableUtils.utils.shallowCloneElements;
import static loadableUtils.utils.shiftIntRanges;
import static loadableUtils.utils.shootLeftScreenHalf;
import static loadableUtils.utils.shootScreen;
import static loadableUtils.utils.shuffled;
import static loadableUtils.utils.shuffledIterator;
import static loadableUtils.utils.sign;
import static loadableUtils.utils.silentException;
import static loadableUtils.utils.snippetURL;
import static loadableUtils.utils.sortedDesc;
import static loadableUtils.utils.spaceCombine;
import static loadableUtils.utils.standardDeviation;
import static loadableUtils.utils.stdToString;
import static loadableUtils.utils.structTok;
import static loadableUtils.utils.structWordWrap;
import static loadableUtils.utils.syncSetAdd;
import static loadableUtils.utils.sysSeconds;
import static loadableUtils.utils.tailFile2;
import static loadableUtils.utils.takeFirstNSSILines;
import static loadableUtils.utils.takeFirst_unnull;
import static loadableUtils.utils.takeLast;
import static loadableUtils.utils.tempPrintAlsoToSystemOut;
import static loadableUtils.utils.tempPut;
import static loadableUtils.utils.tempShowLoadingAnimation;
import static loadableUtils.utils.textAndCaretPosition;
import static loadableUtils.utils.threadCount;
import static loadableUtils.utils.timeZone;
import static loadableUtils.utils.toByteArray;
import static loadableUtils.utils.toImage2B;
import static loadableUtils.utils.toMultiSet;
import static loadableUtils.utils.toPt_round;
import static loadableUtils.utils.toShort_enforce;
import static loadableUtils.utils.toTimestamp;
import static loadableUtils.utils.toWidthAndHeight;
import static loadableUtils.utils.totalSSILines;
import static loadableUtils.utils.totalSizeInInts;
import static loadableUtils.utils.transparentImage;
import static loadableUtils.utils.treeMultiSetMap;
import static loadableUtils.utils.trimJoinSubList;
import static loadableUtils.utils.trimSubstring;
import static loadableUtils.utils.truncateList;
import static loadableUtils.utils.typeToBCELType;
import static loadableUtils.utils.typeToClass;
import static loadableUtils.utils.typeToVMSignature;
import static loadableUtils.utils.uniquify;
import static loadableUtils.utils.unixTime;
import static loadableUtils.utils.unquoteSingleOrDoubleQuotes;
import static loadableUtils.utils.unquote_relaxedMLS;
import static loadableUtils.utils.unstructureGZFile;
import static loadableUtils.utils.uri;
import static loadableUtils.utils.urlConnection;
import static loadableUtils.utils.utf8BufferedReader;
import static loadableUtils.utils.waitForCalculatedValueUsingChangeListener;
import static loadableUtils.utils.waitForFrameClose;
import static loadableUtils.utils.wrapArrayAsImmutableList;
import static loadableUtils.utils.y2;
import static loadableUtils.utils.zeroToOneSine;
import static loadableUtils.utils.zip2dir;
import static loadableUtils.utils.zipTwoLists;
import loadableUtils.utils.AbstractFastRegions;
import loadableUtils.utils.AbstractSSI;
import loadableUtils.utils.AbstractSSIList;
import loadableUtils.utils.AutoVMExit;
import loadableUtils.utils.BStack;
import loadableUtils.utils.BijectiveMap;
import loadableUtils.utils.BitBuffer;
import loadableUtils.utils.BoolVarWithNotify;
import loadableUtils.utils.BresenhamLineDrawer;
import loadableUtils.utils.CheckerBoard2;
import loadableUtils.utils.ComponentDragger;
import loadableUtils.utils.ComponentResizeDragger;
import loadableUtils.utils.CutListToBudget;
import loadableUtils.utils.DoubleBuffer;
import loadableUtils.utils.SynchronizedFloatBufferPresentingAsDoubles;
import loadableUtils.utils.IDoubleBuffer;
import loadableUtils.utils.ILongBuffer;
import loadableUtils.utils.DummyPosterizer;
import loadableUtils.utils.EphemeralObjectIDs;
import loadableUtils.utils.FastRegions_Hi15Image;
import loadableUtils.utils.FlexibleVarContext;
import loadableUtils.utils.GeneralSSIList;
import loadableUtils.utils.GenericArrayTypeImpl;
import loadableUtils.utils.Hi15Image;
import loadableUtils.utils.HuffmanByteArray;
import loadableUtils.utils.IPosterizer;
import loadableUtils.utils.IStackWithOptions;
import loadableUtils.utils.IUnstructured;
import loadableUtils.utils.JComponentWithChangeListeners;
import loadableUtils.utils.JustCountingOutputStream;
import loadableUtils.utils.MethodOnObject;
import loadableUtils.utils.NanoHTTPD;
import loadableUtils.utils.NotifyingList;
import loadableUtils.utils.ParameterizedTypeImpl;
import loadableUtils.utils.ProbabilisticList;
import loadableUtils.utils.RSTVar;
import loadableUtils.utils.Range;
import loadableUtils.utils.SSI;
import loadableUtils.utils.SinglePixelPosterizer;
import loadableUtils.utils.TailFile;
import loadableUtils.utils.TargetAndActual;
import loadableUtils.utils.TranspileWithErrorWindow;
import loadableUtils.utils.VStack;
import loadableUtils.utils.VStackComputableWithStep;
import loadableUtils.utils.VectorOptimizedSSIList;
import loadableUtils.utils.IPixelSet;
import loadableUtils.utils.IF0_Bool;
import loadableUtils.utils.IBest;
import loadableUtils.utils.IToolTipMaker;
import static loadableUtils.utils.doPost_extraHeaders;
import loadableUtils.utils.Scorer;
import static loadableUtils.utils.pcallFail;
import static loadableUtils.utils.addGlobalLastErrorsBufferToDefaultPCallPolicy;
import loadableUtils.utils.Updateable;
import loadableUtils.utils.IMultiSet;
import loadableUtils.utils.IntegrityCheckable;
import loadableUtils.utils.IResolvableClass;
import org.apache.commons.io.input.ReversedLinesFileReader;
import java.text.SimpleDateFormat;
import java.text.*;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import java.awt.font.GlyphVector;
import javax.management.MBeanServer;
import java.lang.management.ManagementFactory;
import javax.net.*;
import javax.net.ssl.*;
import javax.swing.border.TitledBorder;
import java.awt.geom.AffineTransform;
import com.nqzero.permit.Permit;
import javax.sound.sampled.*;
import java.awt.datatransfer.Transferable;
import java.awt.datatransfer.DataFlavor;
import java.awt.geom.*;
import oshi.software.os.*;
import oshi.SystemInfo;
import org.java_websocket.client.WebSocketClient;
import org.java_websocket.handshake.ServerHandshake;
import java.security.Principal;
import java.security.PrivateKey;
import java.security.cert.X509Certificate;
public class main {
static public List _stickyLibs_1400546 = ll("#1400546", "#1400547", "#1400548");
static public List _stickyLibs_1013490 = ll("#1400553", "#1400552", "#1004016", "#1004015");
static public String programID;
static public void _onLoad_initUtils() {
utils.__javax = javax();
}
static public ThreadLocal dynamicObjectIsLoading_threadLocal() {
return DynamicObject_loading;
}
static {
defineRewrite("Challenge", "G22Challenge");
}
static {
defineRewrite("Label", "G22Label");
}
static {
defineRewrite("GalleryImage", "G22GalleryImage");
}
static public class GazelleScreenCam extends DynModule implements G22ProjectActions {
volatile public boolean enabled = true;
transient public JPanel buttons;
public void setEnabled(boolean b) {
setField("enabled", b);
}
public JComponent visualize_enabled() {
return dm_checkBox("enabled");
}
{
enabled = false;
}
transient static public boolean autoRunSelfTests = false;
public SnPSettings screenCamSnPSettings = new SnPSettings();
public transient FieldVar varScreenCamShowDecolorizerSelection_cache;
public FieldVar varScreenCamShowDecolorizerSelection() {
if (varScreenCamShowDecolorizerSelection_cache == null)
varScreenCamShowDecolorizerSelection_cache = varScreenCamShowDecolorizerSelection_load();
return varScreenCamShowDecolorizerSelection_cache;
}
public FieldVar varScreenCamShowDecolorizerSelection_load() {
return new FieldVar(this, "screenCamShowDecolorizerSelection", () -> screenCamShowDecolorizerSelection(), screenCamShowDecolorizerSelection -> screenCamShowDecolorizerSelection(screenCamShowDecolorizerSelection));
}
final public GazelleScreenCam setScreenCamShowDecolorizerSelection(boolean screenCamShowDecolorizerSelection) {
return screenCamShowDecolorizerSelection(screenCamShowDecolorizerSelection);
}
public GazelleScreenCam screenCamShowDecolorizerSelection(boolean screenCamShowDecolorizerSelection) {
if (!eq(this.screenCamShowDecolorizerSelection, screenCamShowDecolorizerSelection)) {
this.screenCamShowDecolorizerSelection = screenCamShowDecolorizerSelection;
change();
}
return this;
}
final public boolean getScreenCamShowDecolorizerSelection() {
return screenCamShowDecolorizerSelection();
}
public boolean screenCamShowDecolorizerSelection() {
return screenCamShowDecolorizerSelection;
}
public boolean screenCamShowDecolorizerSelection = false;
public String script = "64p 8c gradientImage";
public transient FieldVar varNewScript_cache;
public FieldVar varNewScript() {
if (varNewScript_cache == null)
varNewScript_cache = varNewScript_load();
return varNewScript_cache;
}
public FieldVar varNewScript_load() {
return new FieldVar(this, "newScript", () -> newScript(), newScript -> newScript(newScript));
}
final public GazelleScreenCam setNewScript(String newScript) {
return newScript(newScript);
}
public GazelleScreenCam newScript(String newScript) {
if (!eq(this.newScript, newScript)) {
this.newScript = newScript;
change();
}
return this;
}
final public String getNewScript() {
return newScript();
}
public String newScript() {
return newScript;
}
public String newScript;
public String screenCamScript;
public String selectedTab;
public String javaCode;
public boolean horizontalLayout = false;
public int fpsTarget = 20;
public String webCamName;
public boolean webCamAccessEnabled = true;
static transient public boolean autoStartEnabled = true;
final public Set getProjectLibs() {
return projectLibs();
}
public Set projectLibs() {
return projectLibs;
}
public Set projectLibs = syncSet();
public G22WatchTarget watchTarget;
public G22_TestScreenPanel testScreen = new G22_TestScreenPanel();
transient public ImageSurface isPosterized;
transient public ScreenCamStream imageStream = new ScreenCamStream();
transient public Gazelle22_ImageToRegions imageToRegions_finished;
transient public DoubleFPSCounter fpsCounter = new DoubleFPSCounter();
transient public int fps;
transient public WatchTargetSelector watchTargetSelector;
transient public RollingAverage remainingMSPerFrame = new RollingAverage();
transient public int remainingMS;
transient public FunctionTimings functionTimings = new FunctionTimings();
transient public ReliableSingleThread rstRunScript = dm_rst(me(), new Runnable() {
public void run() {
try {
_runScript();
} catch (Exception __e) {
throw rethrow(__e);
}
}
public String toString() {
return "_runScript();";
}
});
transient public JGazelleVScriptRunner scriptRunner;
public UIURLSystem uiURLs = new UIURLSystem();
transient public JComboBox cbWebCam;
transient public SingleComponentPanel scpWebCamImage;
transient public WebcamPanel webCamPanel;
transient public JLeftArrowScriptIDE screenCamScriptIDE;
transient public GazelleV_LeftArrowScript.Script runningScreenCamScript;
final public Concepts getConcepts() {
return concepts();
}
public Concepts concepts() {
return concepts;
}
transient public Concepts concepts;
public String uiURL = "Main Tabs";
transient public SimpleCRUD_v2 labelCRUD;
transient public SimpleCRUD_v2 galleryCRUD;
transient public JComponent galleryCRUDVis;
transient public SimpleCRUD_v2 entityCRUD;
transient public JGallery paintToolGallery;
transient public FlexibleRateTimer screenCamTimer;
transient public SingleComponentPanel scpMain;
final public DynamicVStack getTopStack() {
return topStack();
}
public DynamicVStack topStack() {
return topStack;
}
transient public DynamicVStack topStack;
final public JTabbedPane getMainTabs() {
return mainTabs();
}
public JTabbedPane mainTabs() {
return mainTabs;
}
transient public JTabbedPane mainTabs;
transient public boolean showRegionsAsOutline = true;
transient public JComponent watchScreenPane;
transient public String screenCamRecognitionOutput;
final public G22Utils getG22utils() {
return g22utils();
}
public G22Utils g22utils() {
return g22utils;
}
transient public G22Utils g22utils = new G22Utils();
transient public BackgroundProcessesUI backgroundProcessesUI = new BackgroundProcessesUI();
transient public BackgroundProcessesUI.Entry bgScreenCam = backgroundProcessesUI.new Entry("Screen Cam").menuItem(jMenuItem("Screen Cam", new Runnable() {
public void run() {
try {
showScreenCam();
} catch (Exception __e) {
throw rethrow(__e);
}
}
public String toString() {
return "showScreenCam();";
}
}));
transient public BackgroundProcessesUI.Entry bgWebCam = backgroundProcessesUI.new Entry("Web Cam").menuItem(jMenuItem("Web Cam", new Runnable() {
public void run() {
try {
showWebCam();
} catch (Exception __e) {
throw rethrow(__e);
}
}
public String toString() {
return "showWebCam();";
}
}));
public boolean autoRunChallenge = true;
transient public G22ChallengesPanel challengesPanel;
transient public JComponent urlBar;
transient public JVideoLibDownloader videoLibDownloader;
transient public JFFMPEGVideoPlayer videoPlayer;
public transient FieldVar varPaintTool_cache;
public FieldVar varPaintTool() {
if (varPaintTool_cache == null)
varPaintTool_cache = varPaintTool_load();
return varPaintTool_cache;
}
public FieldVar varPaintTool_load() {
return new FieldVar(this, "paintTool", () -> paintTool(), paintTool -> paintTool(paintTool));
}
final public GazelleScreenCam setPaintTool(JPaintTool paintTool) {
return paintTool(paintTool);
}
public GazelleScreenCam paintTool(JPaintTool paintTool) {
if (!eq(this.paintTool, paintTool)) {
this.paintTool = paintTool;
change();
}
return this;
}
final public JPaintTool getPaintTool() {
return paintTool();
}
public JPaintTool paintTool() {
return paintTool;
}
public JPaintTool paintTool;
public G22AnalysisPanel paintAnalysisPanel;
final public G22SelfTests getSelfTests() {
return selfTests();
}
public G22SelfTests selfTests() {
return selfTests;
}
transient public G22SelfTests selfTests;
public transient FieldVar varPaintToolGalleryExpanded_cache;
public FieldVar varPaintToolGalleryExpanded() {
if (varPaintToolGalleryExpanded_cache == null)
varPaintToolGalleryExpanded_cache = varPaintToolGalleryExpanded_load();
return varPaintToolGalleryExpanded_cache;
}
public FieldVar varPaintToolGalleryExpanded_load() {
return new FieldVar(this, "paintToolGalleryExpanded", () -> paintToolGalleryExpanded(), paintToolGalleryExpanded -> paintToolGalleryExpanded(paintToolGalleryExpanded));
}
final public GazelleScreenCam setPaintToolGalleryExpanded(boolean paintToolGalleryExpanded) {
return paintToolGalleryExpanded(paintToolGalleryExpanded);
}
public GazelleScreenCam paintToolGalleryExpanded(boolean paintToolGalleryExpanded) {
if (!eq(this.paintToolGalleryExpanded, paintToolGalleryExpanded)) {
this.paintToolGalleryExpanded = paintToolGalleryExpanded;
change();
}
return this;
}
final public boolean getPaintToolGalleryExpanded() {
return paintToolGalleryExpanded();
}
public boolean paintToolGalleryExpanded() {
return paintToolGalleryExpanded;
}
public boolean paintToolGalleryExpanded = false;
transient public JComponent screenCamTab;
transient public GazelleV_LeftArrowScriptParser prototypeParser;
final public JPanel getGeneralInfoPanel() {
return generalInfoPanel();
}
public JPanel generalInfoPanel() {
return generalInfoPanel;
}
transient public JPanel generalInfoPanel = jline();
public transient FieldVar varScreenCamAnalyzer_cache;
public FieldVar varScreenCamAnalyzer() {
if (varScreenCamAnalyzer_cache == null)
varScreenCamAnalyzer_cache = varScreenCamAnalyzer_load();
return varScreenCamAnalyzer_cache;
}
public FieldVar varScreenCamAnalyzer_load() {
return new FieldVar(this, "screenCamAnalyzer", () -> screenCamAnalyzer(), screenCamAnalyzer -> screenCamAnalyzer(screenCamAnalyzer));
}
final public GazelleScreenCam setScreenCamAnalyzer(G22Analyzer screenCamAnalyzer) {
return screenCamAnalyzer(screenCamAnalyzer);
}
public GazelleScreenCam screenCamAnalyzer(G22Analyzer screenCamAnalyzer) {
if (!eq(this.screenCamAnalyzer, screenCamAnalyzer)) {
this.screenCamAnalyzer = screenCamAnalyzer;
change();
}
return this;
}
final public G22Analyzer getScreenCamAnalyzer() {
return screenCamAnalyzer();
}
public G22Analyzer screenCamAnalyzer() {
return screenCamAnalyzer;
}
public G22Analyzer screenCamAnalyzer;
public transient FieldVar varShowCasedScript_cache;
public FieldVar varShowCasedScript() {
if (varShowCasedScript_cache == null)
varShowCasedScript_cache = varShowCasedScript_load();
return varShowCasedScript_cache;
}
public FieldVar varShowCasedScript_load() {
return new FieldVar(this, "showCasedScript", () -> showCasedScript(), showCasedScript -> showCasedScript(showCasedScript));
}
final public GazelleScreenCam setShowCasedScript(G22LeftArrowScript showCasedScript) {
return showCasedScript(showCasedScript);
}
public GazelleScreenCam showCasedScript(G22LeftArrowScript showCasedScript) {
if (!eq(this.showCasedScript, showCasedScript)) {
this.showCasedScript = showCasedScript;
change();
}
return this;
}
final public G22LeftArrowScript getShowCasedScript() {
return showCasedScript();
}
public G22LeftArrowScript showCasedScript() {
return showCasedScript;
}
public G22LeftArrowScript showCasedScript;
transient public G22Analyzer.CompiledAnalyzer runningScreenCamAnalyzer;
transient public SourceTriggeredStream imageStreamForAnalyzer;
transient public SingleComponentPanel scpScreenCamImage = scp();
public transient FieldVar varImageRecognitionEnabled_cache;
public FieldVar varImageRecognitionEnabled() {
if (varImageRecognitionEnabled_cache == null)
varImageRecognitionEnabled_cache = varImageRecognitionEnabled_load();
return varImageRecognitionEnabled_cache;
}
public FieldVar varImageRecognitionEnabled_load() {
return new FieldVar(this, "imageRecognitionEnabled", () -> imageRecognitionEnabled(), imageRecognitionEnabled -> imageRecognitionEnabled(imageRecognitionEnabled));
}
final public GazelleScreenCam setImageRecognitionEnabled(boolean imageRecognitionEnabled) {
return imageRecognitionEnabled(imageRecognitionEnabled);
}
public GazelleScreenCam imageRecognitionEnabled(boolean imageRecognitionEnabled) {
if (!eq(this.imageRecognitionEnabled, imageRecognitionEnabled)) {
this.imageRecognitionEnabled = imageRecognitionEnabled;
change();
}
return this;
}
final public boolean getImageRecognitionEnabled() {
return imageRecognitionEnabled();
}
public boolean imageRecognitionEnabled() {
return imageRecognitionEnabled;
}
public boolean imageRecognitionEnabled = true;
final public List getProjectErrors() {
return projectErrors();
}
public List projectErrors() {
return projectErrors;
}
public List projectErrors = syncLinkedList();
final public GazelleScreenCam setMaxProjectErrors(int maxProjectErrors) {
return maxProjectErrors(maxProjectErrors);
}
public GazelleScreenCam maxProjectErrors(int maxProjectErrors) {
this.maxProjectErrors = maxProjectErrors;
return this;
}
final public int getMaxProjectErrors() {
return maxProjectErrors();
}
public int maxProjectErrors() {
return maxProjectErrors;
}
transient public int maxProjectErrors = 40;
public void start() {
try {
super.start();
g22utils.module(this);
for (String libID : projectLibs) {
File f = fileForLibrary(libID);
if (fileExists(f)) {
print("Loading iibrary " + libID);
addLibrary(f);
}
}
testScreen.g22utils(g22utils);
testScreen.onChange(() -> change());
dm_onFieldChange("horizontalLayout", new Runnable() {
public void run() {
try {
dm_reload();
} catch (Exception __e) {
throw rethrow(__e);
}
}
public String toString() {
return "dm_reload();";
}
});
concepts.quietSave = true;
concepts.modifyOnCreate(true);
setModuleName(replaceIfEquals(g22utils.projectName(), g22utils.defaultDBName(), ""));
indexConceptField(concepts, G22GalleryImage.class, "path");
indexConceptField(concepts, Example.class, "item");
indexConceptFieldCI(concepts, G22Label.class, "name");
indexConceptField(concepts, G22Variable.class, "name");
indexConceptField(concepts, G22TravelLogEntry.class, "timestamp");
ensureConceptClassesAreIndexed(concepts, G22PointOfInterest.class);
g22utils.concepts(concepts);
concepts.miscMapPut(G22Utils.class, g22utils);
g22utils.backgroundProcessesUI(backgroundProcessesUI);
g22utils.functionTimings(functionTimings);
G22ProjectInfo projectInfo = g22utils.projectInfo();
File oldProjectDir = projectInfo.projectDir;
File projectDir = g22utils.projectDir();
if (cset_trueIfChanged(projectInfo, "projectDir", projectDir) && oldProjectDir != null) {
projectInfo.addHistoricalProjectDir(oldProjectDir);
}
if (G22TravelLogEntry.shouldCreateEntry(g22utils))
startThread("Make Travel Log Entry", new Runnable() {
public void run() {
try {
printWithMS("Creating travel log entry.");
registerConcept(concepts, G22TravelLogEntry.create(g22utils).scanProject(g22utils).action("First travel log entry"));
printWithMS("Created travel log entry.");
} catch (Exception __e) {
throw rethrow(__e);
}
}
public String toString() {
return "printWithMS(\"Creating travel log entry.\");\r\n registerConcept(concepts,...";
}
});
for (var c : list(concepts)) fixFieldValues(c);
makePrototypeParser();
g22utils.onSettingUpParser(__47 -> adaptLeftArrowParser(__47));
g22utils.projectActions(this);
g22utils.onSettingUpScriptIDE(ide -> {
ide.addGoToDefinitionHandler(tokPtr -> {
String prevToken = _get(tokPtr.list(), tokPtr.idx() - 2);
String token = tokPtr.get();
if (eq(prevToken, "callScript") && isInteger(token)) {
var script = g22utils.getScript(parseLong(token));
if (script != null)
return () -> g22utils.editScript(script);
}
return null;
});
ide.addGoToDefinitionHandler(tokPtr -> {
String token = tokPtr.get();
if (!isIdentifier(token))
return null;
var def = findDefinition(token);
return def == null ? null : () -> goToSource(def);
});
if (!devMode())
return;
var scp = scp();
addInFront(ide.buttons(), scp);
ide.varCompileResult().onChange(cr -> {
AutoCloseable __24 = enter();
try {
var e = innerExceptionOfType(GazelleV_LeftArrowScriptParser.UnknownObject.class, cr == null ? null : cr.compileError);
if (e != null) {
if (isStandardFunction(e.name)) {
var btn = jbuttonWithDisable("Add function " + e.name, new Runnable() {
public void run() {
try {
infoBoxAndCompile(addFunctionNameToInclude(functionsIncludeID(), e.name));
} catch (Exception __e) {
throw rethrow(__e);
}
}
public String toString() {
return "infoBoxAndCompile(addFunctionNameToInclude(functionsIncludeID(), e.name));";
}
});
componentPopupMenuItem(btn, "Add but don't recompile", runnableThread(new Runnable() {
public void run() {
try {
addFunctionNameToInclude(functionsIncludeID(), e.name);
infoBox("Added");
} catch (Exception __e) {
throw rethrow(__e);
}
}
public String toString() {
return "addFunctionNameToInclude(functionsIncludeID(), e.name);\r\n info...";
}
}));
{
scp.set(btn);
return;
}
}
if (isStandardClass(e.name)) {
scp.set(jbuttonWithDisable("Add class " + e.name, new Runnable() {
public void run() {
try {
infoBoxAndCompile(addClassNameToInclude(functionsIncludeID(), e.name));
} catch (Exception __e) {
throw rethrow(__e);
}
}
public String toString() {
return "infoBoxAndCompile(addClassNameToInclude(functionsIncludeID(), e.name));";
}
}));
return;
}
}
scp.clear();
} finally {
_close(__24);
}
});
});
g22utils.autoStarter().init();
uiURLs.owner = me();
uiURLs.uiURL = dm_fieldLiveValue("uiURL");
uiURLs.addPreferredUIURL("Main Tabs");
dm_watchFieldAndNow("enabled", () -> backgroundProcessesUI.addOrRemove(enabled, bgScreenCam));
scriptRunner = new JGazelleVScriptRunner(dm_fieldLiveValue("script", me()));
printWithMS("Making image stream");
imageStream.onNewElement(img -> {
fpsCounter.inc();
setField("fps", iround(fpsCounter.get()));
assertTrue("meta", getMetaSrc(img) instanceof ScreenShotMeta);
if (screenCamAnalyzer != null) {
{
if (imageStreamForAnalyzer != null)
imageStreamForAnalyzer.newElement(img);
}
} else {
Gazelle22_ImageToRegions itr = new Gazelle22_ImageToRegions(functionTimings, img, screenCamSnPSettings);
itr.run();
imageToRegions_finished = itr;
if (shouldRunScript())
rstRunScript.go();
if (screenCamScriptIDE != null && screenCamScriptIDE.visible())
try {
g22_runPostAnalysisLeftArrowScript(itr, runningScreenCamScript);
} catch (Throwable e) {
printStackTrace(e);
screenCamScriptIDE.showRuntimeError(e);
}
String text = nRegions(itr.regions.regionCount());
setField("screenCamRecognitionOutput", text);
g22_renderPosterizedHighlightedImage(isPosterized, itr, showRegionsAsOutline);
}
});
if (watchTarget == null) {
watchTarget = defaultWatchTarget();
change();
}
watchTargetSelector = new WatchTargetSelector();
watchTargetSelector.visualize();
isPosterized = g22utils.stdImageSurface();
varScreenCamAnalyzer().onChangeAndNow(analyzer -> q().add(() -> {
if (analyzer == null) {
runningScreenCamAnalyzer = null;
imageStreamForAnalyzer = null;
scpScreenCamImage.set(withTools(isPosterized));
} else {
runningScreenCamAnalyzer = analyzer.compileForAutoRun();
imageStreamForAnalyzer = new SourceTriggeredStream();
G22AnalysisContext context = new G22AnalysisContext(g22utils, imageStreamForAnalyzer);
Object analyzerResult = runningScreenCamAnalyzer.get(context);
print("analyzerResult", analyzerResult);
scpScreenCamImage.set(new G22JavaObjectVisualizer(g22utils, analyzerResult));
}
}));
printWithMS("Starting screen cam");
ownResource(screenCamTimer = new FlexibleRateTimer(fpsTarget, new Runnable() {
public void run() {
try {
AutoCloseable __25 = enter();
try {
if (!enabled)
return;
{
if (watchTargetSelector != null)
watchTargetSelector.updateScreenCount();
}
Timestamp deadline = tsNowPlusMS(1000 / fpsTarget);
{
if (watchTarget != null)
watchTarget.mainWindow(getWindow(urlBar));
}
{
if (watchTarget != null)
watchTarget.configureScreenCamStream(imageStream);
}
imageStream.step();
long remaining = deadline.minus(tsNow());
remainingMSPerFrame.add(remaining);
setField("remainingMS", iround(remainingMSPerFrame.get()));
} finally {
_close(__25);
}
} catch (Exception __e) {
throw rethrow(__e);
}
}
public String toString() {
return "temp enter(); \r\n if (!enabled) return;\r\n watchTargetSelector?.updat...";
}
}));
screenCamTimer.start();
dm_onFieldChange("fpsTarget", () -> screenCamTimer.setFrequencyImmediately(fpsTarget));
printWithMS("Gathering images from disk");
addDirToGallery(conceptsDir(concepts));
printWithMS("Got dem images");
transpileRaw_makeTranslator = () -> hotwire("#7");
} catch (Exception __e) {
throw rethrow(__e);
}
}
public void addDirToGallery(File dir) {
watchDirForGallery(dir);
for (var f : allImageFiles(dir)) addToGallery(f);
}
public void watchDirForGallery(File dir) {
g22utils.onProjectFileChanged(file -> {
if (isImageFile(file))
addToGallery(file);
});
}
public transient JComponent visualize_cache;
public JComponent visualize() {
if (visualize_cache == null)
visualize_cache = visualize_load();
return visualize_cache;
}
public JComponent visualize_load() {
return markVisualizer(this, visualize_impl());
}
public JComponent visualize_impl() {
imageSurfaceOnHover(isPosterized, pt -> {
if (!enabled && imageToRegions_finished != null)
g22_renderPosterizedHighlightedImage(isPosterized, imageToRegions_finished, showRegionsAsOutline);
});
labelCRUD = new SimpleCRUD_v2(concepts, G22Label.class);
labelCRUD.hideFields("globalID");
labelCRUD.itemToMap_inner2 = l -> litorderedmap("Name", l.name, "# Examples", n2(countConcepts(concepts, Example.class, "label", l)));
galleryCRUD = new SimpleCRUD_v2(concepts, G22GalleryImage.class);
galleryCRUD.itemToMap_inner2 = img -> litorderedmap("File", fileName(img.path), "Folder", dirPath(img.path));
galleryCRUD.defaultAction(img -> {
{
startThread(new Runnable() {
public void run() {
try {
showImage(img.path);
} catch (Exception __e) {
throw rethrow(__e);
}
}
public String toString() {
return "showImage(img.path)";
}
});
}
});
galleryCRUDVis = galleryCRUD.visualize();
galleryCRUD.addButton(jPopDownButton_noText("Forget missing images", runnableThread(new Runnable() {
public void run() {
try {
AutoCloseable __52 = enter();
try {
forgetMissingImages();
} finally {
_close(__52);
}
} catch (Exception __e) {
throw rethrow(__e);
}
}
public String toString() {
return "temp enter(); forgetMissingImages();";
}
})));
galleryCRUD.addButton("Back to gallery", runnableThread(new Runnable() {
public void run() {
try {
AutoCloseable __26 = enter();
try {
uiURLs.showUIURL("Gallery");
} finally {
_close(__26);
}
} catch (Exception __e) {
throw rethrow(__e);
}
}
public String toString() {
return "temp enter(); showUIURL(\"Gallery\")";
}
}));
galleryCRUD.newConcept = () -> {
JFileChooser fc = new JFileChooser();
fc.setDialogTitle("Add image to gallery");
fc.setCurrentDirectory(conceptsDir(concepts));
fc.setFileFilter(new ImageFileFilter().allowDirectories(true));
addToGallery(execFileChooser(fc));
};
var screenCamSnPSelector = new G22SnPSelector(screenCamSnPSettings).allowDecolorizerSelection(true);
screenCamSnPSelector.onChange(() -> change());
linkVars(varScreenCamShowDecolorizerSelection(), screenCamSnPSelector.varShowDecolorizerSelection());
watchScreenPane = jHigherScrollPane_borderless_center(vstack(withLeftAndRightMargin(hstack(dm_rcheckBox("enabled", "Watch"), watchTargetSelector.visualize(), jlabel(" in "), screenCamSnPSelector, jlabel(" Analyzer "), bindComboBoxToVar(varScreenCamAnalyzer(), swing(() -> new ConceptsComboBox(g22utils.concepts(), G22Analyzer.class).allowNull(true))))), verticalStrut(2), withSideMargins(centerAndEastWithMargin(dm_fieldLabel("screenCamRecognitionOutput"), dm_transientCalculatedToolTip(() -> speedInfo_long(), rightAlignLabel(dm_transientCalculatedLabel(() -> speedInfo())))))));
topStack = dynamicVStack();
topStack.spacing(0);
initUIURLs();
mainTabs = scrollingTabs(jTopOrLeftTabs(horizontalLayout));
addUIURLToMainTabs("Project Overview");
addUIURLToMainTabs("Showcase");
addUIURLToMainTabs("Scripts");
if (imageRecognitionEnabled) {
addUIURLToMainTabs("Masks");
addUIURLToMainTabs("Shape Collector");
addUIURLToMainTabs("Points of interest");
}
addUIURLToMainTabs("Gallery");
addUIURLToMainTabs("Scratchpad");
addUIURLToMainTabs("Paint");
if (imageRecognitionEnabled) {
addUIURLToMainTabs("Analyzers");
}
addUIURLToMainTabs("Projects");
for (String tab : tabNames(mainTabs)) {
var _tab_50 = dropTrailingBracketedCount(tab);
uiURLs.put(_tab_50, () -> {
int i = indexOfTabNameWithoutTrailingCount(mainTabs, _tab_50);
if (i < 0)
return jcenteredlabel("Hmm. Tab not found");
selectTab(mainTabs, i);
return mainTabs;
});
}
onTabSelected(mainTabs, () -> {
if (!isShowing(mainTabs))
return;
String tabName = dropTrailingBracketedCount(selectedTabName(mainTabs));
if (!eqicOneOf(uiURL, "Main Tabs", tabName))
uiURLs.showUIURL("Main Tabs");
});
var cbEnabled = toolTip("Switch screen cam on or off", dm_checkBox("enabled", ""));
var lblScreenCam = setToolTip("Show scaled down and color-reduced screen image", jlabel("Screen Cam"));
tabComponentClickFixer(lblScreenCam);
screenCamTab = hstackWithSpacing(cbEnabled, lblScreenCam);
addActionListener(cbEnabled, () -> {
if (enabled)
selectTabComponent(mainTabs, screenCamTab);
});
replaceTabTitleComponent(mainTabs, "Screen Cam", screenCamTab);
persistSelectedTabAsLiveValue(mainTabs, dm_fieldLiveValue("selectedTab"));
urlBar = uiURLs.urlBar();
focusOnFirstShow(urlBar);
setToolTip(uiURLs.comboBox, "UI navigation system");
scpMain = singleComponentPanel();
uiURLs.scp(scpMain);
uiURLs.go();
var projectSelector = new JG22ProjectSelector(g22utils);
generalInfoPanel.add(backgroundProcessesUI.shortLabel());
topStack.addComponent(verticalStrut(6));
topStack.addComponent(westCenterAndEast(withLabelToTheRight(projectSelector.visualize(), "| "), urlBar, withLeftMargin(generalInfoPanel)));
var vis = northAndCenter(withSideMargin(topStack), scpMain);
if (autoStartEnabled)
g22utils.autoStarter().start();
if (autoRunSelfTests) {
autoRunSelfTests = false;
onFirstShow(vis, () -> runSelfTests());
}
return vis;
}
public void runSelfTests() {
startThread("Self-Tests", new Runnable() {
public void run() {
try {
selfTests = new G22SelfTests(g22utils);
selfTests.run();
selfTestsDone();
} catch (Exception __e) {
throw rethrow(__e);
}
}
public String toString() {
return "selfTests = new G22SelfTests(g22utils);\r\n selfTests.run();\r\n selfTe...";
}
});
}
transient public Set onSelfTestsDone;
public GazelleScreenCam onSelfTestsDone(Runnable r) {
onSelfTestsDone = createOrAddToSyncLinkedHashSet(onSelfTestsDone, r);
return this;
}
public GazelleScreenCam removeSelfTestsDoneListener(Runnable r) {
loadableUtils.utils.remove(onSelfTestsDone, r);
return this;
}
public void selfTestsDone() {
if (onSelfTestsDone != null)
for (var listener : onSelfTestsDone) pcallF_typed(listener);
}
transient public Set onProjectErrorsChanged;
public GazelleScreenCam onProjectErrorsChanged(Runnable r) {
onProjectErrorsChanged = createOrAddToSyncLinkedHashSet(onProjectErrorsChanged, r);
return this;
}
public GazelleScreenCam removeProjectErrorsChangedListener(Runnable r) {
loadableUtils.utils.remove(onProjectErrorsChanged, r);
return this;
}
public void projectErrorsChanged() {
if (onProjectErrorsChanged != null)
for (var listener : onProjectErrorsChanged) pcallF_typed(listener);
}
transient public Set> onProjectErrorOccurred;
public GazelleScreenCam onProjectErrorOccurred(IVF1 f) {
onProjectErrorOccurred = createOrAddToSyncLinkedHashSet(onProjectErrorOccurred, f);
return this;
}
public GazelleScreenCam removeProjectErrorOccurredListener(IVF1 f) {
loadableUtils.utils.remove(onProjectErrorOccurred, f);
return this;
}
public void projectErrorOccurred(PersistableThrowable error) {
if (onProjectErrorOccurred != null)
for (var listener : onProjectErrorOccurred) pcallF_typed(listener, error);
}
public JComponent screenCamPanel() {
return centerAndSouthOrEast(horizontalLayout, scpScreenCamImage, watchScreenPane);
}
public JComponent screenCamPlusScriptPanel() {
AutoCloseable __27 = enter();
try {
print("screenCamPlusScriptPanel");
try {
var ide = screenCamScriptIDE = leftArrowScriptIDE();
ide.runButtonShouldBeEnabled = () -> eq(getText(ide.btnRun), "Stop") || ide.runButtonShouldBeEnabled_base();
ide.runScript = () -> {
if (eq(getText(ide.btnRun), "Stop"))
runningScreenCamScript = null;
else {
runningScreenCamScript = screenCamScriptIDE.parsedScript();
ide.showStatus("Running");
}
setText(ide.btnRun, runningScreenCamScript == null ? "Run" : "Stop");
};
return centerAndSouthOrEast(horizontalLayout, jhsplit(jscroll_centered_borderless(isPosterized), screenCamScriptIDE.lvScript(dm_fieldLiveValue("screenCamScript")).visualize()), watchScreenPane);
} catch (Throwable e) {
print(e);
throw rethrow(e);
}
} finally {
_close(__27);
}
}
public String speedInfo() {
return "FPS " + fps + " idle " + remainingMS + " ms";
}
public String speedInfo_long() {
return "Screen cam running at " + nFrames(fps) + "/second. " + n2(remainingMS) + " ms remaining per frame in first core" + " (of targeted " + fpsTarget + " FPS)";
}
public boolean useErrorHandling() {
return false;
}
public String renderFunctionTimings() {
return lines(ciSorted(map(functionTimings.get(), (f, avg) -> firstToUpper(f) + ": " + n2(iround(nsToMicroseconds(avg.get()))) + " " + microSymbol() + "s (" + n2(iround(avg.n())) + ")")));
}
transient public long _runScript_idx;
public void _runScript() {
scriptRunner.parseAndRunOn(imageToRegions_finished.ii);
}
public boolean shouldRunScript() {
return isShowing(scriptRunner.scpScriptResult);
}
public JComponent testScreenPanel() {
return withSideAndTopMargin(testScreen.visualize());
}
public JComponent timingsPanel() {
JTextArea taTimings = jTextArea_noUndo();
awtEveryAndNow(taTimings, .5, new Runnable() {
public void run() {
try {
setText(taTimings, renderFunctionTimings());
} catch (Exception __e) {
throw rethrow(__e);
}
}
public String toString() {
return "setText(taTimings, renderFunctionTimings())";
}
});
return withRightAlignedButtons(taTimings, "Reset", new Runnable() {
public void run() {
try {
resetTimings();
} catch (Exception __e) {
throw rethrow(__e);
}
}
public String toString() {
return "resetTimings();";
}
});
}
public List popDownItems() {
return ll(jCheckBoxMenuItem_dyn("Horizontal Layout", () -> horizontalLayout, b -> setField("horizontalLayout", b)));
}
public void unvisualize() {
}
public void resetTimings() {
functionTimings.reset();
}
public JComponent withTools(ImageSurface is) {
return withTools(jscroll_centered_borderless(is), is);
}
public JComponent withTools(JComponent component, ImageSurface is) {
return centerAndEastWithMargin(component, vstack(verticalStrut(5), jimageButtonScaledToWidth(16, "#1103054", "Save screenshot in gallery", runnableThread(new Runnable() {
public void run() {
try {
saveScreenshotToGallery();
} catch (Exception __e) {
throw rethrow(__e);
}
}
public String toString() {
return "saveScreenshotToGallery();";
}
}))));
}
public class WatchTargetSelector implements Swingable {
public JComboBox cb = jComboBox();
public int screenCount, camCount;
public transient JComponent visualize_cache;
public JComponent visualize() {
if (visualize_cache == null)
visualize_cache = visualize_load();
return visualize_cache;
}
public JComponent visualize_load() {
return markVisualizer(this, visualize_impl());
}
public JComponent visualize_impl() {
updateList();
selectItem(cb, watchTarget);
loadableUtils.utils.onChangeAndNow(cb, watchTarget -> {
setField("watchTarget", watchTarget);
toolTip(cb, watchTarget == null ? null : watchTarget.toolTip());
});
return cb;
}
public void updateScreenCount() {
if (screenCount != screenCount())
updateList();
}
public void updateList() {
swing(() -> {
setComboBoxItems(cb, makeWatchTargets());
});
}
public List makeWatchTargets() {
return flattenToList(countIteratorAsList_incl(1, screenCount = screenCount(), i -> new WatchScreen(i)), new WatchMouse(), new WatchScreenWithMouse(), new WatchOtherScreen());
}
}
public JComponent wrapCRUD(String title, SimpleCRUD_v2 crud) {
return wrapCRUD(title, crud, crud.visualize());
}
public JComponent wrapCRUD(String title, SimpleCRUD_v2 crud, JComponent vis) {
return crud == null ? null : withTopAndBottomMargin(jCenteredRaisedSection(title, withMargin(vis)));
}
public File galleryDir() {
return picturesDir(gazelle22_imagesSubDirName());
}
public void saveScreenshotToGallery() {
AutoCloseable __28 = enter();
try {
var img = imageStream.get();
addToGallery(saveImageWithCounter(galleryDir(), "Screenshot", img));
} finally {
_close(__28);
}
}
public G22GalleryImage addToGallery(BufferedImage image) {
return addToGallery("Unnamed Image", image);
}
public G22GalleryImage addToGallery(String name, BufferedImage image) {
return addToGallery(saveImageWithCounter(g22utils.dbDir(), name, image));
}
public void saveWebCamImageToGallery() {
AutoCloseable __29 = enter();
try {
var img = webCamPanel.getImage();
addToGallery(saveImageWithCounter(galleryDir(), "Webcam", img));
} finally {
_close(__29);
}
}
public G22GalleryImage addToGallery(File imgFile) {
if (!isImageFile(imgFile))
return null;
var img = uniq(concepts, G22GalleryImage.class, "path", imgFile);
printVars("addToGallery", "imgFile", imgFile, "img", img);
return img;
}
public class StudyPanel {
public G22SnPSelector snpSelector = new G22SnPSelector();
public G22GalleryImage image;
public BufferedImage originalImage;
public ImageSurface isOriginalWithRegions = g22utils.stdImageSurface();
public ImageSurface isPosterized = g22utils.stdImageSurface();
public SingleComponentPanel scp = singleComponentPanel();
public SingleComponentPanel analysisPanel = singleComponentPanel();
public SingleComponentPanel scpExampleCRUD = singleComponentPanel();
public ConceptsComboBox cbImage = g22utils.galleryImagesComboBox();
public Gazelle22_ImageToRegions itr;
public int iSelectedRegion;
public SimpleCRUD_v2 regionCRUD;
public SimpleCRUD_v2 exampleCRUD;
public StudyPanel() {
print("Making StudyPanel " + this);
cbImage.sortTheList = l -> sortedByComparator(l, (a, b) -> cmpAlphanumIC(fileName(a.path), fileName(b.path)));
loadableUtils.utils.onChangeAndNow(cbImage, img -> {
dm_q(me(), new Runnable() {
public void run() {
try {
print("Image selected: " + img);
image = img;
scp.setComponent(studyImagePanel());
} catch (Exception __e) {
throw rethrow(__e);
}
}
public String toString() {
return "print(\"Image selected: \" + img);\r\n image = img;\r\n scp.setCo...";
}
});
});
isPosterized.removeAllTools();
isPosterized.onMousePositionChanged(r_dm_q(me(), () -> regionUpdate()));
imageSurfaceOnLeftMouseDown(isPosterized, pt -> dm_q(me(), new Runnable() {
public void run() {
try {
chooseRegionAt(pt);
} catch (Exception __e) {
throw rethrow(__e);
}
}
public String toString() {
return "chooseRegionAt(pt)";
}
}));
snpSelector.onChange(r_dm_q(me(), () -> runSnP()));
}
public void chooseRegionAt(Pt p) {
if (itr == null)
return;
iSelectedRegion = itr.regions.regionAt(p);
if (iSelectedRegion > 0) {
var savedRegion = uniq_returnIfNew(concepts, SavedRegion.class, "image", image, "snpSettings", snpSelector.settings.cloneMe(), "regionIndex", iSelectedRegion);
if (savedRegion != null) {
print("Saved new region!");
var bitMatrix = toScanlineBitMatrix(itr.regions.regionBitMatrix(iSelectedRegion));
cset(savedRegion, "bitMatrix", bitMatrix);
}
}
regionUpdate();
}
public JComponent studyImagePanel() {
if (image == null)
return null;
originalImage = loadImage2(image.path);
if (originalImage == null)
return jcenteredlabel("Image not found");
isOriginalWithRegions.setImage(originalImage);
iSelectedRegion = 0;
itr = new Gazelle22_ImageToRegions(functionTimings, originalImage, snpSelector.settings);
runSnP();
regionCRUD = new SimpleCRUD_v2(concepts, SavedRegion.class);
regionCRUD.addFilter("image", image);
regionCRUD.showSearchBar(false).showAddButton(false).showEditButton(false).iconButtons(true);
regionCRUD.itemToMap_inner2 = region -> {
var examples = conceptsWhere(concepts, Example.class, "item", region);
return litorderedmap("Pixels", region.bitMatrix == null ? "-" : n2(region.bitMatrix.pixelCount()), "Labels", joinWithComma(map(examples, e -> e.label)), "Position", region.bitMatrix == null ? "-" : region.bitMatrix.boundingBoxOfTrueBits());
};
var regionCRUDComponent = regionCRUD.visualize();
regionCRUD.onSelectionChanged(() -> updateExampleCRUD());
return hsplit(jtabs("Image + regions", jscroll_centered_borderless(isOriginalWithRegions), "Posterized", jscroll_centered_borderless(isPosterized)), northAndCenterWithMargin(analysisPanel, hsplit(jCenteredSection("Saved regions", regionCRUDComponent), scpExampleCRUD)));
}
public void runSnP() {
if (itr == null)
return;
itr.run();
regionUpdate();
}
public void regionUpdate() {
if (itr == null)
return;
var pixels = itr.posterized.getRGBPixels();
g22_highlightRegion(pixels, isPosterized, itr, showRegionsAsOutline);
itr.regions.markRegionInPixelArray(pixels, iSelectedRegion, 0xFFADD8E6);
var highlighted = bufferedImage(pixels, itr.posterized.getWidth(), itr.posterized.getHeight());
isPosterized.setImage(highlighted);
isPosterized.performAutoZoom();
updateAnalysis();
}
public void updateAnalysis() {
}
public void updateExampleCRUD() {
var region = regionCRUD.selected();
if (region == null) {
scpExampleCRUD.clear();
return;
}
exampleCRUD = new SimpleCRUD_v2(concepts, Example.class);
exampleCRUD.entityName = () -> "label for region";
exampleCRUD.addFilter("item", region);
exampleCRUD.showSearchBar(false);
exampleCRUD.iconButtons(true);
scpExampleCRUD.set(jCenteredSection("Labels for region", exampleCRUD.visualize()));
}
public void importImage() {
JFileChooser fc = new JFileChooser();
if (fc.showOpenDialog(cbImage) == JFileChooser.APPROVE_OPTION) {
File file = fc.getSelectedFile().getAbsoluteFile();
if (!isImageFile(file)) {
infoMessage("Not an image file");
return;
}
var img = addToGallery(file);
waitUntil(250, 5.0, () -> comboBoxContainsItem(cbImage, img));
setSelectedItem(cbImage, img);
}
}
public JComponent visualize() {
return jRaisedSection(northAndCenterWithMargins(centerAndEast(withLabel("Study", cbImage), hstack(jlabel(" in "), snpSelector.visualize(), horizontalStrut(10), jPopDownButton_noText("Import image...", runnableThread(new Runnable() {
public void run() {
try {
AutoCloseable __53 = enter();
try {
importImage();
} finally {
_close(__53);
}
} catch (Exception __e) {
throw rethrow(__e);
}
}
public String toString() {
return "temp enter(); importImage();";
}
})))), scp));
}
}
public void initUIURLs() {
uiURLs.put("Main Tabs", () -> horizontalLayout ? withMargin(mainTabs) : withSideMargin(mainTabs));
uiURLs.put("Screen Cam FPS", () -> jFullCenter(vstackWithSpacing(jCenteredLabel("FPS target (frames per second) for screen cam:"), jFullCenter(dm_spinner("fpsTarget", 1, 60)), jCenteredLabel("(You can lower this value if you have a slower computer)"))));
uiURLs.put("Timings", () -> timingsPanel());
uiURLs.put("Test Screen", () -> testScreenPanel());
uiURLs.put("Settings", () -> settingsPanel());
uiURLs.put("System Info", () -> systemInfoPanel());
uiURLs.put("Web Cam", () -> webCamPanel());
uiURLs.put("Labels", () -> wrapCRUD("Labels", labelCRUD));
uiURLs.put(new WithToolTip("Screen Cam + Linear Script", "Run a simple (linear) Gazelle V script"), () -> withBottomMargin(scriptRunner.scriptAndResultPanel()));
uiURLs.put(new WithToolTip("Scratchpad", "Write and run a \"left-arrow script\""), () -> withBottomMargin(jOnDemand(() -> scratchpad())));
uiURLs.put("Screen Cam + Script", () -> jOnDemand(() -> screenCamPlusScriptPanel()));
uiURLs.put(new WithToolTip("Gallery CRUD", "Gallery view with more functions (delete etc)"), () -> wrapCRUD("Images", galleryCRUD, galleryCRUDVis));
uiURLs.put(new WithToolTip("Paint", "Paint a picture for Gazelle with your mouse!"), () -> withBottomMargin(jOnDemand(() -> paintPanel())));
uiURLs.put(new WithToolTip("Video", "A little video player (Note: no sound and doesn't handle some videos)"), () -> withBottomMargin(videoPanel()));
uiURLs.put(new WithToolTip("Analyzers", "Manage image analyzers here"), () -> withBottomMargin(analyzersPanel().visualize()));
uiURLs.put(new WithToolTip("Scripts", "Manage all left-arrow scripts here"), () -> withBottomMargin(scriptsPanel().visualize()));
uiURLs.put(new WithToolTip("Shape Collector", "Looks at your screen live"), () -> withBottomMargin(shapeCollectorPanel().visualize()));
uiURLs.put(new WithToolTip("Points of interest", "Points in random images you have clicked on"), () -> withBottomMargin(poisPanel().visualize()));
uiURLs.put(new WithToolTip("Networks", "Manage recognition networks"), () -> withBottomMargin(networksPanel().visualize()));
uiURLs.put("Screen Cam", () -> jOnDemand(() -> screenCamPanel())).put(new WithToolTip("Study", "Here you can analyze gallery images"), () -> withTopAndBottomMargin(studyPanel().visualize())).put(new WithToolTip("Java", "Write & run actual Java code"), () -> withBottomMargin(jOnDemand(() -> javaPanel()))).put(new WithToolTip("Gallery", "Gallery view with preview images"), () -> galleryPanel().visualize()).put(new WithToolTip("Challenges", "Gazelle's self-tests"), () -> challengesPanel()).put(new WithToolTip("Projects", "Manage/load Gazelle projects"), () -> databasesPanel().visualize()).put(new WithToolTip("Entities", "Define entities (meta-level)"), () -> entitiesPanel()).put("Local Fonts", () -> localFontsPanel().visualize()).put("Points of interest", () -> new G22POIsPanel().g22utils(g22utils).visualize()).put("Scripts from all projects", () -> new G22ScriptsFromAllDBsPanel(g22utils).visualize()).put("Networks from all projects", () -> new G22NetworksFromAllDBsPanel(g22utils).visualize()).put("Files in project", () -> new G22DBFileBrowser(g22utils).visualize()).put("Project Overview", () -> new G22ProjectOverviewPanel(g22utils).visualize()).put("Showcase", () -> withTopMargin(new G22ShowCasePanel(g22utils).visualize())).put("Story", () -> new G22ProjectStoryEditor(g22utils).visualize()).put("All objects by ID", () -> new G22AllConceptsPanel(g22utils).visualize()).put("Variables", () -> g22utils.makeVariablesPanel().visualize()).put("Connectivity", () -> new G22ConnectivityPanel().g22utils(g22utils).visualize()).put("Travel Log", () -> new G22TravelLogPanel(g22utils).visualize()).put("Screen parts", () -> screenPartsPanel().g22utils(g22utils).visualize()).put("Masks", () -> masksPanel().g22utils(g22utils).visualize());
}
transient public G22LocalFontsPanel localFontsPanel_cache;
public G22LocalFontsPanel localFontsPanel() {
if (localFontsPanel_cache == null)
localFontsPanel_cache = localFontsPanel_load();
return localFontsPanel_cache;
}
public G22LocalFontsPanel localFontsPanel_load() {
return new G22LocalFontsPanel(g22utils);
}
public JComponent settingsPanel() {
var cbMinimizeToTray = jCheckBox(isTrue(getOpt(dm_stem(), "minimizeToTray")));
onUpdate(cbMinimizeToTray, () -> dm_callStem(me(), "setMinimizeToTray", isChecked(cbMinimizeToTray)));
return jscroll_vertical(makeForm3("Minimize to tray", toolTip("Remove Gazelle from task bar when minimized (click Gazelle icon in system tray to reactivate)", cbMinimizeToTray), "Access web cams", dm_checkBox("webCamAccessEnabled")));
}
public JComponent operatorsPanel() {
return jcenteredlabel("TODO");
}
public JLeftArrowScriptIDE leftArrowScriptIDE() {
return g22utils.leftArrowIDE();
}
public void makePrototypeParser() {
var parser = prototypeParser = new GazelleV_LeftArrowScriptParser();
parser.allowTheWorld(me(), new G22MaskUtils(g22utils), g22utils, mc(), utils.class);
parser.isBlockedFunctionContainerMethod = (fc, name) -> fc == this && eqOneOf(name, "onChange", "onChangeAndNow", "removeChangeListener");
var classNames = parser.globalClassNames();
classNames.put("Timestamp", "loadableUtils.utils$Timestamp");
}
public void adaptLeftArrowParser(GazelleV_LeftArrowScriptParser parser) {
parser.copyFunctionContainersFrom(prototypeParser);
}
public JComponent scratchpad() {
var scratchpad = uniq(concepts(), G22LAScratchpad.class);
if (nempty(newScript)) {
scratchpad.text(newScript);
newScript(null);
}
return scratchpad.visualize();
}
public void saveAsNewScript(String text) {
inputText("Name for this script", description -> {
AutoCloseable __30 = enter();
try {
uiURLs.showUIURL("Scripts");
var script = cnewUnlisted(G22LeftArrowScript.class, "description", description, "text", text);
scriptsPanel().selectAfterUpdate(script);
concepts.register(script);
} finally {
_close(__30);
}
});
}
public JComponent javaPanel() {
AutoCloseable __31 = enter();
try {
var scpResult = singleComponentPanel();
JMiniJavaIDE ide = new JMiniJavaIDE();
ide.stringifier(g22utils.stringifier);
ide.extraClassMembers = script -> {
List tok = javaTok(script);
if (contains(tok, "draw"))
return "\r\n import java.awt.*;\r\n import java.awt.image.*;\r\n \r\n interface SimpleRenderable {\r\n void renderOn(Graphics2D g);\r\n }\r\n \r\n static BufferedImage draw(int w, int h, SimpleRenderable r) {\r\n BufferedImage img = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);\r\n Graphics2D g = img.createGraphics();\r\n g.setColor(Color.white);\r\n g.fillRect(0, 0, w, h);\r\n g.setColor(Color.black);\r\n r.renderOn(g);\r\n return img;\r\n }\r\n ";
return "";
};
ide.callCompiledObject = o -> {
Object result = ide.callCompiledObject_base(o);
if (result instanceof BufferedImage)
scpResult.set(jscroll_centered_borderless(g22utils.stdImageSurface((BufferedImage) result)));
return result;
};
ide.lvScript(dm_fieldLiveValue("javaCode"));
return jhsplit(jCenteredSection("Image will show here", scpResult), ide.visualize());
} finally {
_close(__31);
}
}
public JComponent webCamPanel() {
if (cbWebCam == null) {
var cams = listWebCams();
cbWebCam = jTypedComboBox(cams, findWebCamByName(cams, webCamName));
}
if (scpWebCamImage == null)
scpWebCamImage = singleComponentPanel();
return northAndCenterWithMargins(centerAndEastWithMargin(withLabel("Cam", cbWebCam), jline(jbutton("Start", runnableThread(new Runnable() {
public void run() {
try {
AutoCloseable __54 = enter();
try {
startWebCam();
} finally {
_close(__54);
}
} catch (Exception __e) {
throw rethrow(__e);
}
}
public String toString() {
return "temp enter(); startWebCam();";
}
})), jbutton("Stop", runnableThread(new Runnable() {
public void run() {
try {
AutoCloseable __55 = enter();
try {
stopWebCam();
} finally {
_close(__55);
}
} catch (Exception __e) {
throw rethrow(__e);
}
}
public String toString() {
return "temp enter(); stopWebCam();";
}
})))), scpWebCamImage);
}
public void stopWebCam() {
if (webCamPanel != null) {
webCamPanel.stop();
webCamPanel = null;
{
if (scpWebCamImage != null)
scpWebCamImage.clear();
}
backgroundProcessesUI.remove(bgWebCam);
}
}
public void startWebCam() {
AutoCloseable __32 = tempInfoBox("Starting Web Cam");
try {
stopWebCam();
var cam = getSelectedItem_typed(cbWebCam);
setField("webCamName", cam == null ? null : cam.getName());
if (cam != null) {
scpWebCamImage.set(northAndCenterWithMargin(rightAlignedLine(jimageButtonScaledToWidth(16, "#1103054", "Save web cam image in gallery", runnableThread(new Runnable() {
public void run() {
try {
saveWebCamImageToGallery();
} catch (Exception __e) {
throw rethrow(__e);
}
}
public String toString() {
return "saveWebCamImageToGallery();";
}
}))), webCamPanel = new WebcamPanel(cam, true)));
backgroundProcessesUI.add(bgWebCam);
}
} finally {
_close(__32);
}
}
public void forgetMissingImages() {
int n = l(deleteConcepts(concepts, G22GalleryImage.class, img -> !img.imageExists()));
infoBox(n == 0 ? "Nothing to forget" : "Forgot " + nImages(n));
}
public boolean hasUIURL(String url) {
return uiURLs.hasURL(url);
}
public void addUIURLToMainTabs(String url) {
swing(() -> {
if (containsTabNameWithoutTrailingCount(mainTabs, url))
return;
if (!hasUIURL(url)) {
print("URL not found: " + url);
return;
}
addTab(mainTabs, new WithToolTip(uiURLs.toolTipForURL(url), url), uiURLs.renderUIURL(url));
});
}
public void showScreenCam() {
uiURLs.showUIURL("Screen Cam");
}
public void showWebCam() {
uiURLs.showUIURL("Web Cam");
}
transient public G22NetworksPanel networksPanel_cache;
public G22NetworksPanel networksPanel() {
if (networksPanel_cache == null)
networksPanel_cache = networksPanel_load();
return networksPanel_cache;
}
public G22NetworksPanel networksPanel_load() {
return uniq(concepts, G22NetworksPanel.class).g22utils(g22utils);
}
public JComponent challengesPanel() {
if (challengesPanel == null)
challengesPanel = new G22ChallengesPanel().g22utils(g22utils);
return challengesPanel.visualize();
}
transient public G22GalleryPanel galleryPanel_cache;
public G22GalleryPanel galleryPanel() {
if (galleryPanel_cache == null)
galleryPanel_cache = galleryPanel_load();
return galleryPanel_cache;
}
public G22GalleryPanel galleryPanel_load() {
return new G22GalleryPanel().g22utils(g22utils);
}
public JComponent entitiesPanel() {
if (entityCRUD == null)
entityCRUD = new SimpleCRUD_v2(concepts, Entity.class);
return wrapCRUD("Entities", entityCRUD);
}
public Gazelle22_ImageToRegions imageToRegions(BufferedImage inputImage, SnPSettings snpSettings) {
return new Gazelle22_ImageToRegions(functionTimings, inputImage, snpSettings);
}
public Gazelle22_ImageToRegions imageToRegionsWithDiagonals(BufferedImage inputImage, SnPSettings snpSettings) {
return imageToRegions(inputImage, snpSettings).withDiagonals(true);
}
public G22DatabasesPanel databasesPanel() {
return new G22DatabasesPanel(g22utils);
}
transient public JComponent paintPanel_cache;
public JComponent paintPanel() {
if (paintPanel_cache == null)
paintPanel_cache = paintPanel_load();
return paintPanel_cache;
}
public JComponent paintPanel_load() {
if (paintToolGallery == null) {
paintToolGallery = new JGallery().horizontal(false);
paintToolGallery.openImage = img -> paintTool.loadImageProtected(img);
paintToolGallery.imageLoader().imageHeight(50);
new AWTOnConceptChangesByClass(concepts, G22GalleryImage.class, paintToolGallery.visualize(), () -> {
var images = galleryImagesIn(conceptsDir(concepts));
print("Paint tool images: " + l(images));
paintToolGallery.setImageFiles(sortFilesAlphaNumIC(images));
}).install();
}
if (paintTool == null)
paintTool(new JPaintTool());
ownResource(paintTool);
loadableUtils.utils.onChange(paintTool, me());
paintTool.createAutoPersistFile = () -> makeFileNameUnique_beforeExtension_startWith1_noDot(conceptsDir(concepts, "Painting.png"));
JG22Labels labelsView = new JG22Labels();
paintTool.bottomLeftControls = () -> labelsView.visualize();
var paintToolVis = paintTool.visualize();
paintTool.imageSurface().defaultImageDir = () -> g22utils.dbDir();
if (!isDeepContainedInDir_canonical(paintTool.autoPersistFile(), conceptsDir(concepts)))
paintTool.newImage();
paintTool.varAutoPersistFile().onChangeAndNow(imageFile -> {
labelsView.setLabels(g22utils.labelsForFile(imageFile));
paintToolGallery.selectFile(imageFile);
});
labelsView.addLabel = text -> {
var imageFile = paintTool.autoPersistFile();
var labels = g22utils.labelsForFile(imageFile);
labels.add(g22utils.getLabel(text));
print("labels", labels);
g22utils.setLabelsForFile(imageFile, labels);
labelsView.setLabels(labels);
};
labelsView.removeLabel = label -> {
var imageFile = paintTool.autoPersistFile();
var labels = g22utils.labelsForFile(imageFile);
labels = listWithout(labels, label);
g22utils.setLabelsForFile(imageFile, labels);
labelsView.setLabels(labels);
};
if (paintAnalysisPanel == null)
paintAnalysisPanel = new G22AnalysisPanel();
paintAnalysisPanel.editAnalyzer = __48 -> editAnalyzer(__48);
paintAnalysisPanel.g22utils(g22utils).imageSurface(paintTool.imageSurface());
ownResource(paintAnalysisPanel);
loadableUtils.utils.onChange(paintAnalysisPanel, me());
paintTool.onImageChanged(img -> paintAnalysisPanel.setImage(img));
paintAnalysisPanel.setImage(paintTool.getImage());
var collapsiblePanel = new CollapsibleLeftPanel(false, "Paintings", paintToolGallery.visualize(), paintToolVis);
linkVars(varPaintToolGalleryExpanded(), collapsiblePanel.varExpanded());
paintToolGallery.varFiles().onChangeAndNow(files -> collapsiblePanel.sidePanelName(n2(files, "Painting")));
return jvsplit(0.75, collapsiblePanel.visualize(), jRaisedCenteredSection("Image Analysis", paintAnalysisPanel.visualize()));
}
public JComponent videoPanel() {
if (videoLibDownloader == null) {
videoLibDownloader = new JVideoLibDownloader();
videoLibDownloader.forward(() -> videoPlayer().visualize());
}
return videoLibDownloader.visualize();
}
public JFFMPEGVideoPlayer videoPlayer() {
if (videoPlayer == null)
videoPlayer = new JFFMPEGVideoPlayer();
return videoPlayer;
}
transient public G22AnalyzersPanel analyzersPanel_cache;
public G22AnalyzersPanel analyzersPanel() {
if (analyzersPanel_cache == null)
analyzersPanel_cache = analyzersPanel_load();
return analyzersPanel_cache;
}
public G22AnalyzersPanel analyzersPanel_load() {
return uniq(concepts, G22AnalyzersPanel.class).g22utils(g22utils);
}
transient public G22ScriptsPanel scriptsPanel_cache;
public G22ScriptsPanel scriptsPanel() {
if (scriptsPanel_cache == null)
scriptsPanel_cache = scriptsPanel_load();
return scriptsPanel_cache;
}
public G22ScriptsPanel scriptsPanel_load() {
return uniq(concepts, G22ScriptsPanel.class).g22utils(g22utils);
}
transient public G22ScreenPartsPanel screenPartsPanel_cache;
public G22ScreenPartsPanel screenPartsPanel() {
if (screenPartsPanel_cache == null)
screenPartsPanel_cache = screenPartsPanel_load();
return screenPartsPanel_cache;
}
public G22ScreenPartsPanel screenPartsPanel_load() {
return uniq(concepts, G22ScreenPartsPanel.class).g22utils(g22utils);
}
transient public G22MasksPanel masksPanel_cache;
public G22MasksPanel masksPanel() {
if (masksPanel_cache == null)
masksPanel_cache = masksPanel_load();
return masksPanel_cache;
}
public G22MasksPanel masksPanel_load() {
return uniq(concepts, G22MasksPanel.class).g22utils(g22utils);
}
transient public G22POIsPanel poisPanel_cache;
public G22POIsPanel poisPanel() {
if (poisPanel_cache == null)
poisPanel_cache = poisPanel_load();
return poisPanel_cache;
}
public G22POIsPanel poisPanel_load() {
return uniq(concepts, G22POIsPanel.class).g22utils(g22utils);
}
public G22ShapeCollectorPanel shapeCollectorPanel() {
return G22ShapeCollectorPanel.fullyConfigured(g22utils);
}
public Collection galleryImagesIn(File dir) {
return mapNonNulls(list(concepts, G22GalleryImage.class), i -> isDeepContainedInDir_absolute(i.path, dir) ? i.path : null);
}
public void editAnalyzer(G22Analyzer analyzer) {
if (analyzer == null)
return;
analyzersPanel().edit(analyzer);
uiURLs.showUIURL("Analyzers");
}
public void editScript(G22LeftArrowScript script) {
if (script == null)
return;
uiURLs.showUIURL("Scripts");
scriptsPanel().edit(script);
}
public void editScreenPart(G22ScreenPart screenPart) {
screenPartsPanel().edit(screenPart);
uiURLs.showUIURL("Screen parts");
}
public Object inlineScript(long scriptID, VarContext varContext) {
var script = getConcept(concepts, G22LeftArrowScript.class, scriptID);
if (script == null)
throw fail("Script ID " + scriptID + " not found");
GazelleV_LeftArrowScript.Script parsedScript = script.compileSaved().parsedScript;
return parsedScript.get(varContext);
}
transient public StudyPanel studyPanel_cache;
public StudyPanel studyPanel() {
if (studyPanel_cache == null)
studyPanel_cache = studyPanel_load();
return studyPanel_cache;
}
public StudyPanel studyPanel_load() {
return new StudyPanel();
}
public SingleComponentPanel jOnDemand(IF0 makeComponent) {
return loadableUtils.utils.jOnDemand(() -> {
AutoCloseable __33 = enter();
try {
return makeComponent == null ? null : makeComponent.get();
} finally {
_close(__33);
}
});
}
public void editScripts() {
uiURLs.showUIURL("Scripts");
}
public void editProjectStory() {
uiURLs.showUIURL("Story");
}
public void openObjectInProject(long id) {
var c = getConcept(concepts, id);
if (c == null)
infoBox("Object ID not found in project: " + id);
else
openConcept(c);
}
public void openConcept(Concept c) {
if (c instanceof G22Analyzer) {
uiURLs.showUIURL("Analyzers");
analyzersPanel().setSelected((G22Analyzer) c);
} else if (c instanceof G22LeftArrowScript) {
editScript((G22LeftArrowScript) c);
} else if (c instanceof G22PointOfInterest) {
uiURLs.showUIURL("Points of interest");
poisPanel().setSelected((G22PointOfInterest) c);
} else if (c instanceof G22GalleryImage) {
showInGallery((G22GalleryImage) c);
} else if (c instanceof G22Network) {
showNetwork((G22Network) c);
} else
infoBox("Don't know how to show " + c);
}
public void showNetwork(G22Network network) {
if (network == null)
return;
uiURLs.showUIURL("Networks");
networksPanel().setSelected(network);
}
public void openUIURL(String url) {
uiURLs.showUIURL(url);
}
public boolean openPathInProject(String path) {
path = trim(path);
String path2;
if ((path2 = dropPrefixOrNull("../", path)) != null) {
masterStuff().openDB(path2, false);
return true;
}
if (isInteger(path)) {
openObjectInProject(parseLong(path));
return true;
}
if (hasUIURL(path)) {
openUIURL(path);
return true;
}
File f = newFile(g22utils.dbDir(), path);
print("f", f);
if (isFile(f)) {
if (isImageFile(f)) {
showInGallery(addToGallery(f));
return true;
} else {
infoBox("Unknown file type: " + fileName(f));
return false;
}
}
infoBox("Not a UI URL, object ID or project file: " + path);
return false;
}
public void showInGallery(G22GalleryImage img) {
if (img == null)
return;
uiURLs.showUIURL("Gallery");
galleryPanel().selectImage(img);
}
public G22GalleryImage galleryImageConcept(long id) {
return getConcept(concepts, G22GalleryImage.class, id);
}
public BufferedImage getGalleryImage(long id) {
var img = galleryImageConcept(id);
if (img == null)
throw fail("Image not found: " + id);
return img.load();
}
public void cleanMeUp_g22utils() {
g22utils.close();
}
final public void waitForAutoStart() {
waitUntilStarted();
}
public void waitUntilStarted() {
g22utils.autoStarter().waitUntilDone();
}
public String functionsIncludeID() {
return "#1034034";
}
public void infoBoxAndCompile(String msg) {
infoBox(msg);
if (cic(msg, "edited"))
dm_callOS("compile");
}
public boolean devMode() {
return g22_devMode();
}
public G22WatchTarget defaultWatchTarget() {
return screenCount() > 1 ? new WatchOtherScreen() : new WatchScreen(1);
}
public G22MasterStuff masterStuff() {
return g22utils.masterStuff();
}
public void addProjectLibs(Collection libs) {
if (addAll(projectLibs, libs))
change();
}
public void removeProjectLibs(Collection libs) {
if (removeAll(projectLibs, libs))
change();
}
public void addUIURL(String url, IF0 extends JComponent> maker) {
uiURLs.put(url, maker);
}
public List> quickRegions(BufferedImage image, int colors) {
return imageToRegions(image, new SnPSettings(image, colors)).get().get();
}
public List> quickRegionsWithDiagonals(BufferedImage image, int colors) {
return imageToRegionsWithDiagonals(image, new SnPSettings(image, colors)).get().get();
}
public WebcamListener webcamImageObtainedListener(IVF1 r) {
return new WebcamListener() {
public void webcamOpen(WebcamEvent we) {
}
public void webcamClosed(WebcamEvent we) {
}
public void webcamDisposed(WebcamEvent we) {
}
public void webcamImageObtained(WebcamEvent we) {
{
if (r != null)
r.get(we);
}
}
};
}
public void restartGazelle() {
masterStuff().restart();
}
public void closeProject() {
masterStuff().closeDatabase(g22utils.projectDir());
}
public A addProjectError(A e) {
if (e == null)
return null;
printStackTrace(e);
var persistable = toPersistableThrowable(e);
addToListWithMaxSize(projectErrors, persistable, maxProjectErrors);
change();
projectErrorOccurred(persistable);
projectErrorsChanged();
return e;
}
public void clearProjectErrors() {
if (syncClear_trueIfChanged(projectErrors)) {
change();
projectErrorsChanged();
}
}
public JComponent systemInfoPanel() {
return new G22SystemInfoPanel(g22utils).visualize();
}
public void goToSource(TokenRangeWithSrc src) {
if (src == null)
return;
var script = src.sourceInfo();
if (script instanceof G22LeftArrowScript) {
if (((G22LeftArrowScript) script)._concepts() != concepts()) {
main.g22utils(((G22LeftArrowScript) script)._concepts).projectActions().goToSource(src);
} else {
uiURLs.showUIURL("Scripts");
scriptsPanel().edit(((G22LeftArrowScript) script), src.startLineAndCol());
}
}
}
public TokenRangeWithSrc findDefinition(String id) {
var fd = g22utils.projectWideFunctionDefs.get(id);
if (fd != null)
return fd.tokenRangeWithSrc();
Class c = g22utils.projectWideClassDefs.get(id);
if (c != null)
return (TokenRangeWithSrc) getOpt(c, "__srcRef");
return null;
}
}
static public boolean _moduleClass_GazelleScreenCam = true;
static public class SavedRegion extends Concept {
static final public String _fieldOrder = "image snpSettings regionIndex bitMatrix";
public Ref image = new Ref();
public SnPSettings snpSettings;
public int regionIndex;
public ScanlineBitMatrix bitMatrix;
}
static public class Example extends Concept {
static final public String _fieldOrder = "label item confidence";
public Ref label = new Ref();
public Ref item = new Ref();
public double confidence = 1;
}
static public class IfThenTheory extends Concept {
public Ref if_ = new Ref();
public Ref then = new Ref();
}
static public class Entity extends NamedConcept {
}
abstract static public class AbstractJavaObjectEntity extends Entity {
abstract public A object();
public String toString() {
String s = super.toString();
Object o = object();
if (o != null)
s += " " + str_pcall(o);
return s;
}
}
static public class TransientJavaObjectEntity extends AbstractJavaObjectEntity {
final public A getObject() {
return object();
}
public A object() {
return object;
}
transient public A object;
}
static public class PersistentJavaObjectEntity extends AbstractJavaObjectEntity {
final public A getObject() {
return object();
}
public A object() {
return object;
}
public A object;
}
static public class ConceptEntity extends AbstractJavaObjectEntity {
public Ref concept = new Ref();
public ConceptEntity(A concept) {
this.concept.set(concept);
}
public A object() {
return concept.get();
}
}
static public class FieldInObjectEntity extends Entity {
static final public String _fieldOrder = "objectEntity fieldName";
public Ref> objectEntity = new Ref();
public String fieldName;
public FieldInObjectEntity(AbstractJavaObjectEntity objectEntity, String fieldName) {
this.objectEntity.set(objectEntity);
this.fieldName = fieldName;
}
public Object value() {
return !objectEntity.has() ? null : getOpt(objectEntity.get().object(), fieldName);
}
public String toString() {
String s = super.toString() + " " + fieldName + " in " + objectEntity;
Object value = value();
if (value != null)
s += appendBracketed("value of type " + className(value));
return s;
}
}
static public class DeclaredFieldEntity extends Entity {
static final public String _fieldOrder = "theClass fieldName";
public Class theClass;
public String fieldName;
public DeclaredFieldEntity(Class theClass, String fieldName) {
this.fieldName = fieldName;
this.theClass = theClass;
}
public Field fieldObject() {
return findFieldOfClass(theClass, fieldName);
}
public String toString() {
var fieldObject = fieldObject();
return super.toString() + " " + (fieldObject != null ? str(fieldObject) : "[field not found: " + className(theClass) + "." + fieldName + "]");
}
}
static public void standaloneInit() {
__javax = x30.class;
x30.__javax = x30.class;
x30_pkg.x30_util.__setJavaX(x30.class);
x30.cleanKillMsg = "";
callOnLoadMethods(mc());
}
static public class PrintLogModule extends DynPrintLog {
public void start() {
try {
super.start();
setModuleName("Log");
} catch (Exception __e) {
throw rethrow(__e);
}
}
public String getPrintLog() {
return printLog();
}
public boolean useErrorHandling() {
return false;
}
}
static public class Stem extends ConceptWithChangeListeners implements AutoCloseable {
static final public String _fieldOrder = "host db module frameRect minimized maximized alwaysOnTop minimizeToTray window btnMax titleComponent compileButton started startedWhen selfVis scpMainWindowContents scpMainWindowWithTitle scpFrameIcon tenSecondProfilerScript";
transient public GazelleHost host;
transient public LoadedDB db;
public DynModule module;
public transient FieldVar varFrameRect_cache;
public FieldVar varFrameRect() {
if (varFrameRect_cache == null)
varFrameRect_cache = varFrameRect_load();
return varFrameRect_cache;
}
public FieldVar varFrameRect_load() {
return new FieldVar(this, "frameRect", () -> frameRect(), frameRect -> frameRect(frameRect));
}
final public Stem setFrameRect(Rect frameRect) {
return frameRect(frameRect);
}
public Stem frameRect(Rect frameRect) {
if (!eq(this.frameRect, frameRect)) {
this.frameRect = frameRect;
change();
}
return this;
}
final public Rect getFrameRect() {
return frameRect();
}
public Rect frameRect() {
return frameRect;
}
public Rect frameRect;
public boolean minimized, maximized, alwaysOnTop, minimizeToTray;
final public JFrame getWindow() {
return window();
}
public JFrame window() {
return window;
}
transient public JFrame window;
transient public JButton btnMax;
transient public JLabel titleComponent;
final public JButton getCompileButton() {
return compileButton();
}
public JButton compileButton() {
return compileButton;
}
transient public JButton compileButton;
transient public boolean started = false;
final public Stem setStartedWhen(long startedWhen) {
return startedWhen(startedWhen);
}
public Stem startedWhen(long startedWhen) {
this.startedWhen = startedWhen;
return this;
}
final public long getStartedWhen() {
return startedWhen();
}
public long startedWhen() {
return startedWhen;
}
transient public long startedWhen;
public Stem() {
}
public Stem(LoadedDB db) {
this.db = db;
host = db.host;
}
public Stem(LoadedDB db, DynModule module) {
this(db);
this.module = module;
}
transient public Component selfVis;
transient public LazyVar scpMainWindowContents = new LazyVar<>(() -> scp());
public SingleComponentPanel scpMainWindowContents() {
return scpMainWindowContents.get();
}
transient public LazyVar scpMainWindowWithTitle = new LazyVar<>(() -> scp());
public SingleComponentPanel scpMainWindowWithTitle() {
return scpMainWindowWithTitle.get();
}
transient public LazyVar scpFrameIcon = new LazyVar<>(() -> scp());
public SingleComponentPanel scpFrameIcon() {
return scpFrameIcon.get();
}
public Rect grabFrameRect() {
return toRect(getBounds(window));
}
public void saveFrameRect() {
frameRect(grabFrameRect());
}
public void restoreFrameRect() {
if (frameRect != null)
setBounds(window, frameRect);
}
public void setAlwaysOnTop(boolean alwaysOnTop) {
this.alwaysOnTop = alwaysOnTop;
change();
alwaysOnTop(window, alwaysOnTop);
}
public void setMinimizeToTray(boolean minimizeToTray) {
cset(this, "minimizeToTray", minimizeToTray);
}
public void setWindow(JFrame window) {
this.window = window;
restoreFrameRect();
onBoundsChange(window, new Runnable() {
public void run() {
try {
saveFrameRect();
} catch (Exception __e) {
throw rethrow(__e);
}
}
public String toString() {
return "saveFrameRect();";
}
});
if (host.restrictWindowsToScreenSize)
restrictWindowToScreenSize(window);
alwaysOnTop(window, alwaysOnTop);
}
public void activateWindow() {
print("activateWindow: " + window);
if (window != null)
activateFrame_v3(window);
else
startAndShow(false);
}
public boolean isMain() {
return this == db.mainStem;
}
public void minimize() {
cset(this, "minimized", true);
if (!minimizeToTray || host.trayIcon == null || !isMain())
minimizeWindow(window);
else
hideWindow(window);
}
public void deleteMe() {
AutoCloseable __34 = tempPrintAlsoToSystemOut();
try {
print("deleteMe " + isMain());
if (isMain())
host.closeDatabase(db);
else
delete();
} finally {
_close(__34);
}
}
public void close() {
try {
disposeWindow(window);
cleanUp(module);
} catch (Exception __e) {
throw rethrow(__e);
}
}
public void delete() {
close();
super.delete();
}
public void grabWindowState() {
setField("maximized", !isExtendedStateNormal(window));
}
public void updateBtnMax() {
if (!isShowing(btnMax))
return;
grabWindowState();
setText(btnMax, maximized ? "NORM" : "MAX");
}
public JComponent makeWindowBorderAndTitle(JComponent contents, String title) {
var icons = jline();
if (host.allowFrameMaximization) {
icons.add(btnMax = jbutton("", runnableThread(new Runnable() {
public void run() {
try {
maximizeOrRestoreFrame(window);
updateBtnMax();
} catch (Exception __e) {
throw rethrow(__e);
}
}
public String toString() {
return "maximizeOrRestoreFrame(window);\r\n updateBtnMax();";
}
})));
onFirstShowing(btnMax, new Runnable() {
public void run() {
try {
updateBtnMax();
} catch (Exception __e) {
throw rethrow(__e);
}
}
public String toString() {
return "updateBtnMax();";
}
});
}
icons.add(toolTip("Minimize this window", jbutton("MIN", new Runnable() {
public void run() {
try {
minimize();
} catch (Exception __e) {
throw rethrow(__e);
}
}
public String toString() {
return "minimize();";
}
})));
icons.add(toolTip("Close this window", jimageButtonScaledToWidth(16, "#1103067", runnableThread(new Runnable() {
public void run() {
try {
deleteMe();
} catch (Exception __e) {
throw rethrow(__e);
}
}
public String toString() {
return "deleteMe();";
}
}))));
icons.add(new JPopDownButton(menu -> fillJPopupMenu(menu, flattenToList(jCheckBoxMenuItem("Always on top", alwaysOnTop, alwaysOnTop -> setAlwaysOnTop(alwaysOnTop)), "---", "Exit Gazelle", runnableThread(new Runnable() {
public void run() {
try {
host.cleanExit();
} catch (Exception __e) {
throw rethrow(__e);
}
}
public String toString() {
return "host.cleanExit()";
}
}), "Restart", runnableThread(new Runnable() {
public void run() {
try {
host.restart();
} catch (Exception __e) {
throw rethrow(__e);
}
}
public String toString() {
return "host.restart()";
}
}), "Re-open project", runnableThread(new Runnable() {
public void run() {
try {
host.reopenDB(db);
} catch (Exception __e) {
throw rethrow(__e);
}
}
public String toString() {
return "host.reopenDB(db)";
}
}), "Hide project", runnableThread(new Runnable() {
public void run() {
try {
db.hide();
} catch (Exception __e) {
throw rethrow(__e);
}
}
public String toString() {
return "db.hide()";
}
}), "Update Gazelle", runnableThread(new Runnable() {
public void run() {
try {
host.upgradeGazelle();
} catch (Exception __e) {
throw rethrow(__e);
}
}
public String toString() {
return "host.upgradeGazelle()";
}
}), !isMain() ? null : jCheckBoxMenuItem("Auto-Update", print("autoUpdate", db.g22utils.autoUpdateEnabled()), b -> {
db.g22utils.setAutoUpdate(b);
if (b) {
startThread(new Runnable() {
public void run() {
try {
host.upgradeGazelle();
} catch (Exception __e) {
throw rethrow(__e);
}
}
public String toString() {
return "host.upgradeGazelle();";
}
});
}
}), "---", !isMain() ? null : ll("Screenshoot this window", runnableThread(new Runnable() {
public void run() {
try {
shootWindow();
} catch (Exception __e) {
throw rethrow(__e);
}
}
public String toString() {
return "shootWindow();";
}
}), "Dump threads", runnableThread(new Runnable() {
public void run() {
try {
showText("User threads", renderUserThreadsWithStackTraces());
} catch (Exception __e) {
throw rethrow(__e);
}
}
public String toString() {
return "showText(\"User threads\", renderUserThreadsWithStackTraces());";
}
}), "Log", !isMain() ? null : new Runnable() {
public void run() {
try {
db.showPrintLog();
} catch (Exception __e) {
throw rethrow(__e);
}
}
public String toString() {
return "db.showPrintLog()";
}
}, "Copy log to clipboard", !isMain() ? null : runnableThread(new Runnable() {
public void run() {
try {
copyToClipboard(printLog());
infoBox("Copied log to clipboard");
} catch (Exception __e) {
throw rethrow(__e);
}
}
public String toString() {
return "copyToClipboard(printLog());\r\n infoBox(\"Copied log to clipboard\");";
}
}), "10 Second Profiler", runnableThread(new Runnable() {
public void run() {
try {
runTenSecondProfiler();
} catch (Exception __e) {
throw rethrow(__e);
}
}
public String toString() {
return "runTenSecondProfiler();";
}
})), ccallOpt(module, "popDownItems")))));
JComponent actualTitle = titleComponent = fontSizePlus(7, jCenteredLabel(title));
installWindowDragger(actualTitle);
if (host.devMode())
actualTitle = centerAndEastWithMargin(actualTitle, jline(compileButton = makeCompileButton(), installWindowDragger(lblComputerAndUserCount())));
updateFrameIcon();
var spacer = gazelle_wavySpacer(color1(), color2());
var titleBarMain = setOpaqueBackground(color1(), jtransparent_recursive(westCenterAndEastWithMargin(scpFrameIcon(), actualTitle, setOpaqueBackground(color2(), spacer))));
installWindowDragger(spacer);
var titleBar = setBackground(color2(), centerAndEast(titleBarMain, icons));
var border = BorderFactory.createLineBorder(color1(), host.borderSize);
var outerPanel = withBorder(border, northAndCenter(titleBar, contents));
installWindowResizeDraggerOnBorder(outerPanel);
return markVisualizer(this, outerPanel);
}
transient public IF0 frameIconID;
public String frameIconID() {
return frameIconID != null ? frameIconID.get() : frameIconID_base();
}
final public String frameIconID_fallback(IF0 _f) {
return _f != null ? _f.get() : frameIconID_base();
}
public String frameIconID_base() {
return host.trayIconImageID;
}
transient public IF0 frameIconHeight;
public int frameIconHeight() {
return frameIconHeight != null ? frameIconHeight.get() : frameIconHeight_base();
}
final public int frameIconHeight_fallback(IF0 _f) {
return _f != null ? _f.get() : frameIconHeight_base();
}
public int frameIconHeight_base() {
return 24;
}
public Stem frameIconID(String iconID) {
frameIconID = () -> iconID;
updateFrameIcon();
return this;
}
transient public IF0 makeFrameIcon;
public JComponent makeFrameIcon() {
return makeFrameIcon != null ? makeFrameIcon.get() : makeFrameIcon_base();
}
final public JComponent makeFrameIcon_fallback(IF0 _f) {
return _f != null ? _f.get() : makeFrameIcon_base();
}
public JComponent makeFrameIcon_base() {
return jImage_scaledToHeight(frameIconHeight(), frameIconID());
}
public void updateFrameIcon() {
scpFrameIcon().set(makeFrameIcon());
}
transient public IF0 color1;
public Color color1() {
return color1 != null ? color1.get() : color1_base();
}
final public Color color1_fallback(IF0 _f) {
return _f != null ? _f.get() : color1_base();
}
public Color color1_base() {
return host.color1;
}
transient public IF0 color2;
public Color color2() {
return color2 != null ? color2.get() : color2_base();
}
final public Color color2_fallback(IF0 _f) {
return _f != null ? _f.get() : color2_base();
}
public Color color2_base() {
return host.color2;
}
public JLabel lblComputerAndUserCount() {
JLabel label = jlabel();
Runnable update = () -> {
Integer computerCount = host.computerCount();
Integer userCount = host.lvGazelleUserCount().get();
setText(label, (computerCount == null ? "" : n2(computerCount)) + appendSquareBracketed(userCount == null ? "" : n2(userCount)));
};
bindChangeListenerToComponent(label, host.lvComputerCount(), update);
bindChangeListenerToComponent(label, host.lvGazelleUserCount(), update);
return label;
}
public JButton makeCompileButton() {
var gears = resizeImageIcon(imageIcon("#1103061"), 16);
var btn = jimageButtonScaledToWidth(16, "#1101268", "Compile & update", runnableThread(new Runnable() {
public void run() {
try {
host.compile();
} catch (Exception __e) {
throw rethrow(__e);
}
}
public String toString() {
return "host.compile()";
}
}));
componentPopupMenuItems(btn, "Compile all", runnableThread(new Runnable() {
public void run() {
try {
host.compileAll();
} catch (Exception __e) {
throw rethrow(__e);
}
}
public String toString() {
return "host.compileAll()";
}
}), "Compile main library", runnableThread(new Runnable() {
public void run() {
try {
host.compileUtilsAndRepackage();
} catch (Exception __e) {
throw rethrow(__e);
}
}
public String toString() {
return "host.compileUtilsAndRepackage()";
}
}), "Repackage", runnableThread(new Runnable() {
public void run() {
try {
host.repackage();
} catch (Exception __e) {
throw rethrow(__e);
}
}
public String toString() {
return "host.repackage()";
}
}));
return btn;
}
public JComponent wrapVis(JComponent vis) {
return vis;
}
public void startAndShow() {
startAndShow(false);
}
public void startAndShow(boolean hidden) {
if (module._host != this) {
module._host = this;
setOpt_raw(module, "threadPool", threadPool);
setOpt_raw(module, "concepts", db.concepts);
setOpt_raw(module, "g22utils", db.g22utils);
copyLocalLog(module, mc());
}
var __45 = startAndVisualize();
var vis = __45.a;
var title = __45.b;
if (!hidden) {
printWithMS("Show frame");
JFrame frame = makeUndecoratedFrame(title, wrapVis(vis));
setFrameIcon(frame, host.trayIconImageID);
setWindow(frame);
frame.addPropertyChangeListener("title", evt -> setText(titleComponent, frame.getTitle()));
if (minimized)
minimize();
onWindowDeiconified(frame, () -> cset(this, "minimized", false));
showWindow(window);
if (maximized && host.allowFrameMaximization)
maximizeFrame(window);
}
}
public Pair startAndVisualize() {
JComponent vis = null;
{
printWithMS("Starting " + module);
try {
if (!started) {
started = true;
startedWhen(sysNow());
AutoCloseable __35 = module.enter();
try {
module.start();
} finally {
_close(__35);
}
}
printWithMS("Visualize");
vis = swing(() -> {
AutoCloseable __36 = module.enter();
try {
return module.visualize();
} finally {
_close(__36);
}
});
} catch (Throwable e) {
waitForFrameClose(showErrorFrame(e));
throw rethrow(e);
}
}
selfVis = vis;
var scp1 = scpMainWindowContents();
scp1.set(vis);
String title = createTitleText();
var vis2 = makeWindowBorderAndTitle(scp1, title);
var scp2 = scpMainWindowWithTitle();
scp2.set(vis2);
return pair(scp2, title);
}
public String createTitleText() {
String moduleName = takeFirst_unnull(800, module.moduleName());
if (isMain())
return joinNemptiesWithVBar(moduleName, host.windowTitle);
else
return moduleName;
}
public void revisualize() {
if (window == null)
return;
try {
module.unvisualize();
} catch (Throwable __e) {
pcallFail(__e);
}
var __46 = startAndVisualize();
var vis = __46.a;
var title = __46.b;
setFrameContents(window, wrapVis(vis));
}
public void shootWindow() {
var img = renderComponentToImage(window);
copyImageToClipboard(img);
File imgFile = saveInImageDirectoryWithCounter(gazelle22_imagesSubDirName() + "/Gazelle", img);
pcallOpt(module, "addToGallery", imgFile);
}
public Component vis() {
return scpMainWindowContents().get();
}
public String tenSecondProfilerScript = "\r\n temp profiler <- new AllThreadsProfiler\r\n infoBox \"Profiling...\"\r\n profiler start\r\n sleepSeconds 10\r\n showText \"10 Second Profile\" < profiler renderFullResults false\r\n ";
public File byteCodePath() {
return assertNotNull(getBytecodePathForClass(this));
}
public ClassNameResolver classNameResolver() {
return new ClassNameResolver().byteCodePath(byteCodePath()).init();
}
public GazelleV_LeftArrowScriptParser leftArrowParser() {
GazelleV_LeftArrowScriptParser parser = new GazelleV_LeftArrowScriptParser();
parser.classNameResolver(classNameResolver());
parser.allowTheWorld(mc(), utils.class);
return parser;
}
public void runTenSecondProfiler() {
leftArrow(leftArrowParser(), tenSecondProfilerScript);
}
}
static public class LoadedDB implements AutoCloseable, IG22LoadedDB {
public GazelleHost host;
final public Concepts getConcepts() {
return concepts();
}
public Concepts concepts() {
return concepts;
}
public Concepts concepts;
final public G22Utils getG22utils() {
return g22utils();
}
public G22Utils g22utils() {
return g22utils;
}
public G22Utils g22utils = new G22Utils();
public Stem mainStem;
final public boolean getHidden() {
return hidden();
}
public boolean hidden() {
return hidden;
}
public boolean hidden = false;
public LoadedDB(GazelleHost host, Concepts concepts, boolean hidden) {
this.hidden = hidden;
this.concepts = concepts;
this.host = host;
g22utils.concepts(concepts);
g22utils.masterStuff(host);
}
public String name() {
return fileName(conceptsDir(concepts));
}
public void start() {
concepts.grabThroughSocket(false);
concepts.makeStructureData = () -> {
structure_Data data = concepts.makeStructureData_base();
data.realShortName = name -> {
String n = dropPrefixOrNull("userCode.", name);
if (n != null)
return takeFirst(n, indexOf(n, '_'));
return data.realShortName_base(name);
};
data.mcDollar = mcDollar();
return data;
};
var lock = concepts.fileLock();
try {
lock.contentsForLockFile("Locked by computer " + computerID() + "\n");
lock.lockOrFail();
} catch (Throwable e) {
printStackTrace(e);
if (cic(str(e), "Couldn't aquire lock")) {
if (!lock.hasExpectedContents()) {
infoBox("Overriding project lock (" + lock.actualContents() + ")");
lock.forceLock();
} else {
String msg = "This project is already opened in another process";
infoBox(msg, 10.0);
sleepSeconds(1);
throw fail(msg);
}
} else
throw rethrow(e);
}
concepts.fileLock().deleteOnExit();
thinAProgramsBackups_v2(concepts.conceptsDir(), true);
concepts.loadConcepts();
var projectInfo = optimizedUniq(concepts, G22ProjectInfo.class);
String compilationDate = compilationDateFromClassPath(this);
print("Compilation date in project: " + projectInfo.compilationDate);
if (nempty(projectInfo.compilationDate) && lessThan(compilationDate, projectInfo.compilationDate)) {
messageBoxAndFail("Trying to open project with old Gazelle version - please update Gazelle first (" + compilationDate + " vs " + projectInfo.compilationDate + ")");
}
if (cset(projectInfo, "compilationDate", compilationDate) != 0)
print("Bumped compilation date in project to " + compilationDate);
concepts.autoSaveConcepts();
var stems = stems();
print("Stems in DB: " + l(stems));
mainStem = first(stems);
if (mainStem == null) {
print("Starting new module");
var module = host.makeModule();
mainStem = registerConcept(concepts, new Stem(this, module));
print("Stems in DB: " + l(stems()));
}
for (var stem : stems()) {
stem.db = this;
stem.host = host;
stem.startAndShow(hidden);
}
print("Stems in DB: " + l(stems()));
}
public List stems() {
return list(Stem.class, concepts);
}
public Q systemQ() {
return host.systemQ;
}
public Stem findPrintLog() {
return firstThat(list(concepts, Stem.class), stem -> stem.module instanceof PrintLogModule);
}
public void showPrintLog() {
systemQ().add(() -> {
var logModule = findPrintLog();
if (logModule != null)
logModule.activateWindow();
else
registerConcept(concepts, new Stem(this, new PrintLogModule())).startAndShow();
});
}
public void hidePrintLog() {
systemQ().add(() -> deleteConcept(findPrintLog()));
}
public void activate() {
print("Activating DB: " + conceptsFile(concepts));
if (hidden) {
hidden = false;
host.loadedDBsChange();
}
{
if (mainStem != null)
mainStem.activateWindow();
}
}
public void hide() {
hideWindow(mainWindow());
if (!hidden) {
hidden = true;
host.loadedDBsChange();
}
}
public JFrame mainWindow() {
return mainStem == null ? null : mainStem.window;
}
public void close() {
try {
print("Cleaning up " + concepts);
print("Stems in DB: " + l(stems()));
for (Concept c : allConcepts(concepts)) cleanUp(c);
print("Releasing DB (" + n2(list(concepts, Stem.class), "stem") + ")");
{
cleanUp(concepts);
concepts = null;
}
host.loadedDBs.remove(this);
host.loadedDBsChange();
print("Remaining DBs: " + l(host.loadedDBs));
} catch (Exception __e) {
throw rethrow(__e);
}
}
public String toString() {
return name();
}
public DynModule module() {
return mainStem == null ? null : mainStem.module;
}
public G22ProjectActions projectActions() {
return (G22ProjectActions) module();
}
}
static public class GazelleHost implements G22MasterStuff {
public boolean _isTransient() {
return true;
}
public Set loadedDBs = syncLinkedHashSet();
transient public Set onLoadedDBsChange;
public GazelleHost onLoadedDBsChange(Runnable r) {
onLoadedDBsChange = createOrAddToSyncLinkedHashSet(onLoadedDBsChange, r);
return this;
}
public GazelleHost removeLoadedDBsChangeListener(Runnable r) {
loadableUtils.utils.remove(onLoadedDBsChange, r);
return this;
}
public void loadedDBsChange() {
if (onLoadedDBsChange != null)
for (var listener : onLoadedDBsChange) pcallF_typed(listener);
}
transient public Set onNewClassesDefined;
public GazelleHost onNewClassesDefined(Runnable r) {
onNewClassesDefined = createOrAddToSyncLinkedHashSet(onNewClassesDefined, r);
return this;
}
public GazelleHost removeNewClassesDefinedListener(Runnable r) {
loadableUtils.utils.remove(onNewClassesDefined, r);
return this;
}
public void newClassesDefined() {
if (onNewClassesDefined != null)
for (var listener : onNewClassesDefined) pcallF_typed(listener);
}
transient public String repackageURL = "https://botcompany.de/jar/1033860?withX30=1&withLibs=1&noSrc=1&mainClassForManifest=Starter&repackage=1";
transient public String windowTitle = "Gazelle 22";
transient public String trayIconImageID = "#1103047";
transient public int borderSize = 5;
transient public Color color1 = awtColor("ADD8E6");
transient public Color color2 = awtColor("EEEEEE");
transient public Color color3 = awtColor("A3C0AA");
transient public IF0 moduleMaker;
transient public ThreadPool threadPool;
transient public File dbMotherDir;
transient public TrayIcon trayIcon;
transient public TrayIconLastPosition trayIconLastPosition;
transient public String[] args;
transient public Set argsSet;
transient public boolean incrementalDownloads = true;
transient volatile public boolean shuttingDown = false;
transient public boolean restrictWindowsToScreenSize = false;
transient public boolean allowFrameMaximization = false;
transient public G22Utils g22utils;
transient public StefansOS_ConnectToServer serverConnector;
transient public ComputerCountListener computerCount;
transient public GazellePresenceListener gazellePresenceListener;
final public Q getSystemQ() {
return systemQ();
}
public Q systemQ() {
return systemQ;
}
transient public Q systemQ = startQ("System Q");
transient public AutoCloseable pimpedPopups;
final public RunnablesReferenceQueue getRunnablesReferenceQueue() {
return runnablesReferenceQueue();
}
public RunnablesReferenceQueue runnablesReferenceQueue() {
return runnablesReferenceQueue;
}
public RunnablesReferenceQueue runnablesReferenceQueue = new RunnablesReferenceQueue();
final public ILASClassLoader getLasClassLoader() {
return lasClassLoader();
}
public ILASClassLoader lasClassLoader() {
return lasClassLoader;
}
transient public ILASClassLoader lasClassLoader = new LASMultiClassLoader(mc()).runnablesReferenceQueue(assertNotNull(runnablesReferenceQueue));
final public EphemeralObjectIDs getEphemeralObjectIDs() {
return ephemeralObjectIDs();
}
public EphemeralObjectIDs ephemeralObjectIDs() {
return ephemeralObjectIDs;
}
public EphemeralObjectIDs ephemeralObjectIDs = new EphemeralObjectIDs().runnablesReferenceQueue(assertNotNull(runnablesReferenceQueue));
transient public boolean autoExitDisabled = false;
final public GazelleHost setBooted(boolean booted) {
return booted(booted);
}
public GazelleHost booted(boolean booted) {
this.booted = booted;
return this;
}
final public boolean getBooted() {
return booted();
}
public boolean booted() {
return booted;
}
transient volatile public boolean booted = false;
transient public Set> onFillingTrayIconMenu;
public GazelleHost onFillingTrayIconMenu(IVF1 f) {
onFillingTrayIconMenu = createOrAddToSyncLinkedHashSet(onFillingTrayIconMenu, f);
return this;
}
public GazelleHost removeFillingTrayIconMenuListener(IVF1 f) {
loadableUtils.utils.remove(onFillingTrayIconMenu, f);
return this;
}
public void fillingTrayIconMenu(PopupMenu menu) {
if (onFillingTrayIconMenu != null)
for (var listener : onFillingTrayIconMenu) pcallF_typed(listener, menu);
}
public GazelleHost(ThreadPool threadPool, IF0 moduleMaker) {
this.moduleMaker = moduleMaker;
this.threadPool = threadPool;
g22utils = new G22Utils().masterStuff(this);
onLoadedDBsChange(() -> {
if (shuttingDown)
return;
var dbs = getLoadedDBs();
if (nempty(dbs))
g22utils.setOpenDBs(dbs);
updateTrayIconMenu();
});
}
public A inSystemQ(IF0 f) {
return evalInQ(systemQ(), f);
}
public JFrame mainWindow() {
return firstNonNull(loadedDBs(), db -> db.mainWindow());
}
public void trayIconLeftClick() {
first(loadedDBs()).activate();
}
public void makeTrayIcon() {
try {
trayIcon_imageAutoSize = false;
trayIcon = installTrayIcon(trayIconImageID, windowTitle, new Runnable() {
public void run() {
try {
trayIconLeftClick();
} catch (Exception __e) {
throw rethrow(__e);
}
}
public String toString() {
return "trayIconLeftClick();";
}
});
updateTrayIconMenu();
trayIconLastPosition = new TrayIconLastPosition(trayIcon);
} catch (Throwable __e) {
print(exceptionToStringShort(__e));
}
}
public void updateTrayIconMenu() {
rstUpdateTrayIconMenu.trigger();
}
transient public ReliableSingleThread rstUpdateTrayIconMenu = rstWithPostDelay(1000, () -> updateTrayIconMenuImpl());
public void updateTrayIconMenuImpl() {
if (trayIcon == null)
return;
PopupMenu menu = new PopupMenu();
var projects = openProjects();
printVars("updateTrayIconMenuImpl", "projects", projects);
for (IG22LoadedDB otherDB : projects) {
String name = otherDB.g22utils().projectName();
String status = otherDB.hidden() ? "Hidden" : "";
addMenuItem(menu, name + appendSquareBracketed(status), runnableThread(new Runnable() {
public void run() {
try {
otherDB.activate();
} catch (Exception __e) {
throw rethrow(__e);
}
}
public String toString() {
return "otherDB.activate()";
}
}));
}
fillingTrayIconMenu(menu);
addMenuItem(menu, "Exit " + windowTitle, runnableThread(new Runnable() {
public void run() {
try {
cleanExit();
} catch (Exception __e) {
throw rethrow(__e);
}
}
public String toString() {
return "cleanExit();";
}
}));
trayIcon.setPopupMenu(menu);
}
public void run(String[] args) {
try {
this.args = args;
run2(args);
} catch (Throwable e) {
printStackTrace(e);
hideTrayIcon(trayIcon);
onWindowClosing(() -> systemExit(1), getWindow(showText_fast_noWrap("Gazelle Error", renderStackTrace(e))));
}
}
public void run2(String[] args) {
argsSet = asSet(args);
String s = first(args);
boolean isDirectory = isDirectory(s);
if (isDirectory)
dbMotherDir = canonicalFile(s);
printVars("args", asList(args), "s", s, "isDirectory", isDirectory, "dbMotherDir", dbMotherDir);
print("Using mother directory: " + databasesMotherDir());
windowTitle = or2(loadTextFile(newFile(dbMotherDir, "Gazelle Name")), windowTitle);
if (!argsSet.contains("noflatlaf"))
com.formdev.flatlaf.FlatLightLaf.setup();
if (contains(args, "profile"))
profileToConsole(() -> actualMain(args));
else
actualMain(args);
if (argsSet.contains("brexit"))
System.exit(0);
}
public void actualMain(String... args) {
vm_generalMap_put("stefansOS", this);
System.out.println(hmsWithColonsAndMS() + ": Init");
printJavaVersion();
if (contains(argsSet, "profile"))
doEvery(1.0, new Runnable() {
public void run() {
try {
printRunningThreads();
} catch (Exception __e) {
throw rethrow(__e);
}
}
public String toString() {
return "printRunningThreads();";
}
});
if (containsOneOf(argsSet, "upgrade", "update")) {
upgradeGazelle();
return;
}
makeTrayIcon();
initAutoUpdate();
if (devMode()) {
print("Pimping popup menus");
PopupMenuMaker.fix();
pimpedPopups = tempGlobalPopupMenu((c, menu) -> {
printVars("pimpedPopups", "c", className(c));
if (contains(className(c), "XTrayIcon"))
return;
if (any(getMenuItems(menu), menuItem -> cicOneOf(menuItem.getText(), "Component: ", "src: ")))
return;
Object src = componentMetaSrc(c);
menu.add(commaCombine(classNameAndEphString(c), src == null ? null : "src: " + classNameAndEphString(src)));
});
}
List dbNames = g22utils.dbsToOpen();
for (String dbName : dbNames) {
String name2 = dropPrefix("*", dbName);
openDB(name2, !eq(dbName, name2));
}
booted(true);
exitIfAllDBsClosed();
printWithMS("Dudadoneski");
}
public boolean projectExists(String dbName) {
File conceptsFile = newFile(newFile(databasesMotherDir(), dbName), conceptsFileName());
return isFile(conceptsFile);
}
public LoadedDB openDB(String dbName) {
return openDB(dbName, false);
}
public LoadedDB openDB(String dbName, boolean hidden) {
File conceptsFile = newFile(newFile(databasesMotherDir(), dbName), conceptsFileName());
return openDB(conceptsFile, hidden);
}
public IG22LoadedDB getLoadedDB(Concepts concepts) {
return firstThat(cloneList(loadedDBs), db -> db.concepts == concepts);
}
public IG22LoadedDB getLoadedDBForConceptDir(File dir) {
return findLoadedDBForConceptsDir(dir);
}
public LoadedDB findLoadedDBForConceptsDir(File conceptsDir) {
return firstThat(cloneList(loadedDBs), db -> sameFile(conceptsDir(db.concepts), conceptsDir));
}
public LoadedDB findLoadedDBForConceptsFile(File conceptsFile) {
return firstThat(cloneList(loadedDBs), db -> sameFile(conceptsFile(db.concepts), conceptsFile));
}
public IG22LoadedDB reopenDB(IG22LoadedDB db) {
return reopenDB((LoadedDB) db);
}
public LoadedDB reopenDB(LoadedDB db) {
File conceptsFile = db.concepts.conceptsFile();
try {
autoExitDisabled = true;
closeDatabase(db);
return openDB(conceptsFile);
} finally {
autoExitDisabled = false;
}
}
public LoadedDB openDB(File conceptsFile) {
return openDB(conceptsFile, false);
}
public LoadedDB openDB(File conceptsFile, boolean hidden) {
var loadedDB_quick = findLoadedDBForConceptsFile(conceptsFile);
if (loadedDB_quick != null) {
if (!hidden)
loadedDB_quick.activate();
return loadedDB_quick;
}
return inSystemQ(() -> {
var loadedDB = findLoadedDBForConceptsFile(conceptsFile);
if (loadedDB != null) {
if (!hidden)
loadedDB.activate();
return loadedDB;
}
AutoCloseable __37 = tempInfoBoxNoHide("Opening Gazelle project " + quote(fileName(dirOfFile(conceptsFile))));
try {
print("Loading new DB: " + f2s(conceptsFile));
g22utils.addToRecentDBNames(parentName(conceptsFile), hidden);
Concepts concepts = newConceptsWithClassFinder(conceptsFile, makeClassFinder());
concepts.onSaveError(__49 -> infoBox(__49));
concepts.closeConceptsOnExit(true);
var db = new LoadedDB(this, concepts, hidden);
loadedDBs.add(db);
try {
db.start();
loadedDBsChange();
} catch (Throwable e) {
printStackTrace(e);
loadedDBs.remove(db);
_close(db);
}
return db;
} finally {
_close(__37);
}
});
}
public Collection openConceptDirs() {
return cloneMap(loadedDBs, _db -> conceptsDir(_db.concepts));
}
public Object resolveModule(Object moduleOrStem) {
return moduleOrStem instanceof Stem ? ((Stem) moduleOrStem).module : moduleOrStem;
}
public void cleanExit() {
shuttingDown = true;
print("Closing " + n2(loadedDBs, "database"));
closeAndClear(loadedDBs);
System.exit(0);
}
public File myJar() {
return getBytecodePathForClass(this);
}
public AutoCloseable tempDisableCompileButtons() {
return tempDisableButtons(compileButtons());
}
transient public Runnable upgradeGazelleForeplay;
public void upgradeGazelleForeplay() {
if (upgradeGazelleForeplay != null)
upgradeGazelleForeplay.run();
else
upgradeGazelleForeplay_base();
}
final public void upgradeGazelleForeplay_fallback(Runnable _f) {
if (_f != null)
_f.run();
else
upgradeGazelleForeplay_base();
}
public void upgradeGazelleForeplay_base() {
infoBox("Updating Gazelle in 10...");
sleepSeconds(10);
upgradeGazelle();
}
public void upgradeGazelle() {
try {
AutoCloseable __38 = tempPrintAlsoToSystemOut();
try {
AutoCloseable __39 = tempInfoBox("Updating Gazelle...");
try {
AutoCloseable __40 = tempDisableCompileButtons();
try {
File myJar = myJar();
print("myJar", myJar);
String existingFilesComp = !incrementalDownloads ? null : existingFilesInfo();
String date = ymdMinusHMS();
File f = javaxCodeDir("Downloaded Updates/" + "gazelle-" + date + ".jar");
var progress = tempProgressBar_addToWindowIfPossible(mainWindow(), "Updating Gazelle");
try {
progress.setText("Downloading Update...");
long _startTime_22 = sysNow();
postBinaryPageToFile(downloadURL(), f, "existingFilesComp", existingFilesComp);
done2_always("Downloading zip", _startTime_22);
printFileInfo(f);
if (!isNonEmptySingleZip_byMagicHeader(f)) {
infoBox("Bad file downloaded... :(");
return;
}
boolean replaced = false;
if (isFile(myJar)) {
progress.setText("Replacing with new version: " + renderFileInfo(myJar));
File myJarSaved = fileInSubDir("old-code", appendToBaseName(myJar, ".bak." + date));
File myJarNew = appendToFileName(myJar, ".new");
Set toKeep = asSet(tlft(loadTextFileFromZip(f, "to-keep")));
if (nempty(toKeep)) {
int toUpdate = countFilesInZip(f) - 1;
progress.setText("Updating " + nFiles(toUpdate));
int have = countFilesInZip(myJar);
if (l(toKeep) == have && countFilesInZip(f) == 1) {
infoBox("Nothing to update - Gazelle is up to date!");
deleteFile(myJarNew);
deleteFile(myJarSaved);
return;
}
Zip4j_MergeZipFilesWithFilter merger = new Zip4j_MergeZipFilesWithFilter(myJarNew);
try {
merger.addZipFile(myJar, name -> contains(toKeep, name));
merger.addZipFile(f, name -> !eq(name, "to-keep"));
merger.finish();
} finally {
_close(merger);
}
} else
myJarNew = f;
if (isWindows()) {
copyFileVerbose(myJar, myJarSaved);
copyFileVerbose(myJarNew, myJar);
deleteFileVerbose_assertSuccess(myJarNew);
} else {
renameFileVerbose_assertSuccess(myJar, myJarSaved);
renameFileVerbose_assertSuccess(myJarNew, myJar);
}
printFileInfo(myJar);
replaced = true;
}
progress.setText("Done");
if (replaced)
infoBox("Installed update, replaced " + f2s(myJar) + " - now starting");
else
infoBox("Updated but could not replace originally downloaded jar");
restart(replaced ? myJar : f);
} finally {
_close(progress);
}
} finally {
_close(__40);
}
} finally {
_close(__39);
}
} finally {
_close(__38);
}
} catch (Throwable e) {
printStackTrace(e);
throw rethrow(e);
}
}
public void restart() {
restart(myJar());
}
public void restart(File jar) {
AutoCloseable __41 = tempPrintAlsoToSystemOut();
try {
String javaCmd = or2(currentProcessCommand(), "java");
String cmd = platformQuoteArgs(flattenToList(javaCmd, "-jar", jar, args));
print(cmd);
nohup(cmd);
cleanExit();
} finally {
_close(__41);
}
}
public DynModule makeModule() {
return callF(moduleMaker);
}
public void reloadModuleInBackground(Stem mod) {
restart();
}
public void initAutoUpdate() {
print("Making server connection for updates.");
serverConnector = snippetUpdateConnector();
vmBus_onMessage("snippetUpdate", new VF1() {
public void get(List l) {
try {
String uri = getString(l, 1);
Matches m = new Matches();
if (swic(uri, "/transpileOK/", m)) {
if (sameSnippetID(programID(), firstIntAsString(m.rest()))) {
if (g22utils.autoUpdateEnabled()) {
upgradeGazelleForeplay();
}
}
} else if (swic(uri, "/edit/", m)) {
String snippetID = fsI(firstIntAsString(m.rest()));
if (contains(stdFunctionListSnippetIDs(), snippetID))
stdFunctions_clearCache();
if (contains(standardClassesSnippetIDs(), snippetID))
standardClassesMap_clearCache();
}
} catch (Exception __e) {
throw rethrow(__e);
}
}
public String toString() {
return "S uri = getString(l, 1);\r\n new Matches m;\r\n if (swic(uri, \"/transpi...";
}
});
try {
computerCount = new ComputerCountListener(serverConnector);
computerCount.init();
} catch (Throwable __e) {
pcallFail(__e);
}
try {
gazellePresenceListener = new GazellePresenceListener(serverConnector);
gazellePresenceListener.init();
} catch (Throwable __e) {
pcallFail(__e);
}
}
public String downloadURL() {
return "https://botcompany.de/jar/" + psI(programID()) + "?withLibs=1&withX30=1" + "&mainClassForManifest=Starter" + (!downloadJarWithSrc() ? "&noSrc=1" : "") + (downloadUncompressedJAR() ? "&uncompressed=1" : "");
}
public boolean downloadJarWithSrc() {
return true;
}
public boolean downloadUncompressedJAR() {
return false;
}
public void revisualizeModule(Stem stem) {
stem.revisualize();
}
public Integer computerCount() {
return computerCount == null ? (Integer) 0 : computerCount.get();
}
public LiveValue lvComputerCount() {
return computerCount == null ? null : computerCount.liveValue();
}
public IF0WithChangeListeners lvGazelleUserCount() {
return gazellePresenceListener == null ? null : gazellePresenceListener.userCount;
}
public List compileButtons() {
return mapNonNulls(allStems(), s -> s.compileButton());
}
public List allStems() {
return concatLists(cloneMap(loadedDBs, db -> list(db.concepts, Stem.class)));
}
public void compile() {
compile(programID, null);
}
public void resetNeedLatest() {
editSnippet("#1035306", "need latest .");
}
public void compileAll() {
resetNeedLatest();
compile(utilsSnippetID(), () -> compile());
}
public void compileUtilsAndRepackage() {
compile(utilsSnippetID(), () -> repackage());
}
public void compile(String snippetID, Runnable onSuccess) {
print("Compiling " + snippetID);
var gears = resizeImageIcon(imageIcon("#1103061"), 16);
AutoCloseable __42 = tempDisableCompileButtons();
try {
AutoCloseable __43 = tempSetButtonImages(compileButtons(), gears);
try {
{
startThread(new Runnable() {
public void run() {
try {
existingFilesInfo();
} catch (Exception __e) {
throw rethrow(__e);
}
}
public String toString() {
return "existingFilesInfo();";
}
});
}
var tr = new TranspileWithErrorWindow().snippetID(snippetID);
tr.transpileAction(() -> {
var p = transpileOnNewServer(snippetID, "medium");
if (!p.a)
throw fail(p.b);
});
tr.onSuccess(onSuccess);
tr.run();
print("Done transpilation of " + snippetID);
} finally {
_close(__43);
}
} finally {
_close(__42);
}
}
public void repackage() {
File f = javaxCachesDir("Gazelle-22/repackaged.jar");
deleteFile(f);
loadBinaryPageToFile(appendParamsToURL(repackageURL, "uniq", randomID()), f);
if (isJAR(f))
infoBox("Repackaged.");
else
messageBox("Oh shit");
}
public void closeDatabase(LoadedDB db) {
db.close();
exitIfAllDBsClosed();
}
public void exitIfAllDBsClosed() {
if (!autoExitDisabled && empty(loadedDBs))
cleanExit();
}
final public Collection extends IG22LoadedDB> loadedDBs() {
return getLoadedDBs();
}
public Collection extends IG22LoadedDB> getLoadedDBs() {
return cloneList(loadedDBs);
}
public void closeDatabase(File conceptsDir) {
for (var db : cloneList(loadedDBs)) if (sameFile(conceptsDir, conceptsDir(db.concepts)))
db.close();
}
public void switchToDatabase(File conceptsDir) {
if (conceptsDir == null)
return;
var db = openDatabase(conceptsDir);
if (db == null)
return;
closeAllDBsExcept(db);
}
public void closeAllDBsExcept(LoadedDB db) {
closeAll(listMinus(loadedDBs, db));
}
public LoadedDB openDatabase(File conceptsDir) {
return openDatabase(conceptsDir, false);
}
public LoadedDB openDatabase(File conceptsDir, boolean hidden) {
AutoCloseable __44 = tempPrintAlsoToSystemOut();
try {
File conceptsFile = newFile(conceptsDir, conceptsFileName());
if (!fileExists(conceptsFile))
throw fail(infoBox("Database not found: " + conceptsFile));
var db = openDB(conceptsFile, hidden);
print("Database opening complete");
return db;
} finally {
_close(__44);
}
}
public Map classMigrations() {
return litmap("G22RecognizerScript", G22Analyzer.class, "GalleryImage", G22GalleryImage.class);
}
public IF1 makeClassFinder() {
IF1 defaultClassFinder = toIF1(_defaultClassFinder());
var migrations = classMigrations();
IF1 classFinder = name -> {
String shortName = dropPrefixOrNull("main$", name);
if (shortName != null) {
Class c = migrations.get(shortName);
if (c != null) {
String newName = className(c);
print("Migrating legacy class " + name + " to " + newName);
name = newName;
}
}
return defaultClassFinder.get(name);
};
assertEquals(callF(classFinder, "main$Stem"), Stem.class);
return classFinder;
}
transient public Cache existingFilesInfo_cache = new Cache<>(() -> existingFilesInfo_load());
public String existingFilesInfo() {
return existingFilesInfo_cache.get();
}
public String existingFilesInfo_load() {
List fingerprints = zipFileToJSONFingerprint_md5(myJar());
String s = base64encode(gzipString(jsonEncode(fingerprints)));
print("existingFilesInfo", nBytes(l(s)));
return s;
}
public boolean devMode() {
return g22_devMode();
}
public String ephString(Object o) {
return o == null ? "" : "eph " + ephemeralObjectIDs.remember(o);
}
public String classNameAndEphString(Object o) {
return o == null ? null : spaceCombine(ephString(o), className(o));
}
public File databasesMotherDir() {
if (dbMotherDir == null)
dbMotherDir = javaxDataDir("Gazelle-22");
return dbMotherDir;
}
public boolean isLoading() {
return !booted;
}
}
static public String windowTitle = "Gazelle 22";
static public String progIDForDBAndAutoUpdate = "#1033860";
static public boolean pingSourceStrictMode = false;
static public GazelleHost host;
static public ThreadPool threadPool;
static public String devTitleSuffix = "";
public static void main(final String[] args) throws Exception {
godMode();
loadableUtils.utils.__setJavaX(x30.class);
standaloneInit();
ping_v3_setPingSourceMaker(() -> {
if (pingSourceStrictMode)
throw fail("Strict mode - make a ping source first!!");
return new PingSource(threadPool, "legacy");
});
threadPool = new ThreadPool(findIntArg("cores", args, numberOfCores()));
print(threadPool);
PingSource ps = new PingSource(threadPool, print("Starting Gazelle"));
ps.dO(() -> {
System.out.println("Pinging");
ping();
print("Pinged");
programID = progIDForDBAndAutoUpdate;
AutoVMExit.install();
print("AutoVMExit installed");
addGlobalLastErrorsBufferToDefaultPCallPolicy();
print("Recording global errors");
preferredScreen = () -> {
if (host == null)
return 0;
int screen = max(0, screenNrOfWindow(mainWindow()));
return screen;
};
showForm_makeFrame = (title, panel) -> {
var dialog = new JDialog(mainWindow(), title);
setDialogContents(dialog, withMargin(panel));
packWindow(dialog);
minWindowWidth(dialog, 400);
centerDialogOverOwner(dialog);
dialog.setVisible(true);
};
if (cic(args, "delete-session")) {
print("Deleting session (" + programDir(programID) + ")");
clearConceptsOf(programID);
}
F1 baseClassFinder = (F1) (_defaultClassFinder());
setDefaultClassFinder(new F1() {
public Class get(String name) {
try {
name = replacePrefix("loadableUtils.utils$", "main$", name);
if (eq(name, "main$Challenge")) {
print("Legacy Challenge converted!");
return G22Challenge.class;
}
return baseClassFinder.get(name);
} catch (Exception __e) {
throw rethrow(__e);
}
}
public String toString() {
return "name = replacePrefix(\"loadableUtils.utils$\", \"main$\", name);\r\n //print(\"...";
}
});
host = new GazelleHost(threadPool, () -> new GazelleScreenCam());
if (sameSnippetID(programID, "#1033860"))
windowTitle += devTitleSuffix;
host.windowTitle = windowTitle;
host.run(args);
if (!cic(args, "console")) {
print("Stopping System.out");
printAlsoToSystemOut = false;
}
});
print("aha.");
}
static public Window mainWindow() {
return host.mainWindow();
}
static public Map generalMap = syncMap();
static public ReversedLinesFileReader reversedLinesFileReader(File f) {
try {
try {
return new ReversedLinesFileReader(f);
} catch (FileNotFoundException e) {
return null;
}
} catch (Exception __e) {
throw rethrow(__e);
}
}
static public double ceil(double d) {
return Math.ceil(d);
}
static public JTable sexyTableWithData(Object data) {
JTable table = sexyTable();
dataToTable(table, data);
return table;
}
static public double nullToNaN(Double x) {
return x == null ? Double.NaN : x;
}
static public playAudioFromSampleMakingFunction_AudioLoop playAudioFromSampleMakingFunction(int bufSize, VF1 sampleMaker) {
playAudioFromSampleMakingFunction_AudioLoop loop = new playAudioFromSampleMakingFunction_AudioLoop(bufSize, sampleMaker);
loop.start();
return loop;
}
static public playAudioFromSampleMakingFunction_AudioLoop playAudioFromSampleMakingFunction_dontStart(int bufSize, VF1 sampleMaker) {
return new playAudioFromSampleMakingFunction_AudioLoop(bufSize, sampleMaker);
}
static public class playAudioFromSampleMakingFunction_AudioLoop extends Thread implements AutoCloseable {
public SourceDataLine out;
public Flag stopFlag = new Flag();
public byte[] buf;
public VF1 sampleMaker;
public AudioFormat quality = javaSound_cdQuality();
public long samplesPlayed;
public playAudioFromSampleMakingFunction_AudioLoop(int bufSize, VF1 sampleMaker) {
this.sampleMaker = sampleMaker;
out = javaSound_outputLine(quality, bufSize);
buf = new byte[bufSize];
}
public void start() {
out.start();
super.start();
}
public void stopPlaying() {
if (stopFlag.isUp())
return;
stopFlag.raise();
out.close();
print("Audio output loop stopped.");
}
public void close() {
stopPlaying();
}
public void run() {
print("Audio output loop started. Buffer size=" + l(buf) + " (" + iround(l(buf) / 44100.0 / 4 * 1000) + " ms)");
double[] pair = new double[2];
while (licensed() && !stopFlag.isUp()) {
for (int i = 0; i < l(buf); i += 4) {
sampleMaker.get(pair);
short l = clipShort(pair[0]);
short r = clipShort(pair[1]);
buf[i] = (byte) l;
buf[i + 1] = (byte) (l >> 8);
buf[i + 2] = (byte) r;
buf[i + 3] = (byte) (r >> 8);
}
int n = out.write(buf, 0, l(buf));
samplesPlayed += n;
if (n != l(buf)) {
print("huh: " + n + " of " + l(buf));
return;
}
}
}
}
static public File documentsDir() {
return userDir_oneOf("Documents", "Dokumente");
}
static public File documentsDir(String sub) {
return newFile(documentsDir(), sub);
}
static public String h2(String s, Object... params) {
return tag("h2", s, params);
}
static public Concepts loadConceptsFromFile(File file) {
Concepts c = new Concepts();
c.clearConcepts();
c.conceptsFile = file;
DynamicObject_loading.set(true);
try {
Map map = (Map) unstructureGZFile(file);
c.concepts.putAll(map);
c.assignConceptsToUs();
for (long l : map.keySet()) c.idCounter = max(c.idCounter, l);
} finally {
DynamicObject_loading.set(null);
}
return c;
}
static public MultiMap treeMultiMapIndex(IF1 f, Iterable l) {
TreeMultiMap map = new TreeMultiMap();
for (A a : unnullForIteration(l)) {
B val = f.get(a);
if (val != null)
map.put(val, a);
}
return map;
}
static public MultiMap treeMultiMapIndex(Iterable l, IF1 f) {
return treeMultiMapIndex(f, l);
}
static public String regexpForFloatingPointWithoutSign_v2() {
String startingWithDigit = "\\d+(\\.\\d*)?";
String startingWithDot = "\\.\\d+";
String optExp = "([eE][+-]?\\d+)?";
return "(" + startingWithDigit + "|" + startingWithDot + ")" + optExp;
}
static public Map mapPlus_inFront(Map m, Object... data) {
LinkedHashMap m2 = new LinkedHashMap();
litmap_impl(m2, data);
putAll(m2, m);
return m2;
}
static public Rect screenRect() {
return new Rect(screenRectangle());
}
static public Rect screenRect(GraphicsDevice device) {
return toRect(screenRectangle(device));
}
static public void setFrameBounds(final Component c, final Rectangle bounds) {
if (c != null) {
swing(() -> {
JFrame f = getFrame(c);
if (f != null) {
f.setBounds(bounds);
revalidate(f);
}
});
}
}
static public void setFrameBounds(Component c, int x, int y, int w, int h) {
setFrameBounds(c, new Rectangle(x, y, w, h));
}
static public boolean isMaximized(JFrame f) {
return f != null && swing(() -> f.getExtendedState() == JFrame.MAXIMIZED_BOTH);
}
static public String hhmm() {
return hhmm(now());
}
static public String hhmm(long time) {
return new SimpleDateFormat("HHmm").format(time);
}
static public int incAndGet(AtomicInteger i) {
return i.incrementAndGet();
}
static public boolean dm_isBooting() {
return dm_osLoading();
}
static public Pair> parseFunctionCall(String s) {
return tok_parseFunctionCall(s);
}
static public Pair> parseFunctionCall(List tok) {
return tok_parseFunctionCall(tok);
}
static public void onFileChange(double seconds, File file, Runnable r) {
onFileChange(seconds, file, modificationTime(file), r);
}
static public void onFileChange(double seconds, File file, long lastModificationSeen, Runnable r) {
doEvery_daemon(toMS(seconds), new Runnable() {
public long lastMod = lastModificationSeen;
public void run() {
try {
long mod = modificationTime(file);
if (mod != lastMod) {
lastMod = mod;
call(r);
}
} catch (Exception __e) {
throw rethrow(__e);
}
}
});
call(r);
}
static public boolean regexpMatches(String pat, String s) {
return pat != null && s != null && regexp(pat, s).matches();
}
static public boolean regexpMatches(java.util.regex.Pattern pat, String s) {
return pat != null && s != null && regexp(pat, s).matches();
}
static public Pair, List> filterAntiFilter(Iterable c, Object pred) {
List yes = new ArrayList();
List no = new ArrayList();
if (c != null)
for (A o : c) (isTrue(callF(pred, o)) ? yes : no).add(o);
return pair(yes, no);
}
static public Pair, List> filterAntiFilter(Iterable c, IF1 pred) {
return filterAntiFilter(c, (Object) pred);
}
static public Pair, List> filterAntiFilter(IF1 pred, Iterable c) {
return filterAntiFilter(c, pred);
}
static public Pair, List> filterAntiFilter(Object pred, Iterable c) {
return filterAntiFilter(c, pred);
}
static public boolean containsDuplicates(Collection l) {
return l(uniquify(l)) < l(l);
}
static public boolean isSorted(Collection l) {
return isSortedList(l);
}
static public List replaceIC(List l, String a, String b) {
List l2 = new ArrayList();
for (int i = 0; i < l(l); i++) {
String s = l.get(i);
l2.add(eqic(s, a) ? b : s);
}
return l2;
}
static public String replaceIC(String s, String a, String b) {
return s.replaceAll("(?i)" + patternQuote(a), quoteReplacement(b));
}
static public boolean containsWhere(Collection l, String field, Object value) {
if (l != null)
for (Object x : l) if (eq(getOpt(x, field), value))
return true;
return false;
}
static public void assertEquals_6digits(double x, double y) {
assertEquals_6digits("", x, y);
}
static public void assertEquals_6digits(String msg, double x, double y) {
assertEquals(formatDouble_significant(x, 6), formatDouble_significant(y, 6));
}
static public boolean notNaN(double d) {
return !Double.isNaN(d);
}
static public boolean notNaN(float f) {
return !Float.isNaN(f);
}
static public void assertNequals(String msg, Object a, Object b) {
assertNotEquals(msg, a, b);
}
static public void assertNequals(Object a, Object b) {
assertNotEquals(a, b);
}
static public void assertException(Runnable r) {
assertFail(r);
}
static public String copyToClipboardVerbose(Object _text) {
return copyTextToClipboardVerbose(_text);
}
static public String linuxDistro() {
return linuxDistroProperties().get("PRETTY_NAME");
}
static public String cutStackTrace(String stackTrace) {
return dropAfterSubstring(stackTrace, "\n\tat");
}
static public List dropAfter(A a, List l) {
int n = l(l);
for (int i = 0; i < n; i++) if (eq(a, l.get(i)))
return takeFirst(l, i);
return l;
}
static public List linesStartingWith(String prefix, String text) {
return startingWith(lines(text), prefix);
}
static public int[] subArray(int[] b, int start, int end) {
int[] x = new int[end - start];
System.arraycopy(b, start, x, 0, end - start);
return x;
}
static public byte[] subArray(byte[] b, int start, int end) {
start = max(start, 0);
end = min(end, l(b));
if (start >= end)
return new byte[0];
byte[] x = new byte[end - start];
System.arraycopy(b, start, x, 0, end - start);
return x;
}
static public long[] subArray(long[] b, int start, int end) {
start = max(start, 0);
end = min(end, l(b));
if (start >= end)
return new long[0];
long[] x = new long[end - start];
System.arraycopy(b, start, x, 0, end - start);
return x;
}
static public short[] subArray(short[] b, int start, int end) {
if (start <= 0 && end >= l(b))
return b;
short[] x = new short[end - start];
System.arraycopy(b, start, x, 0, end - start);
return x;
}
static public float[] subArray(float[] b, int start, int end) {
float[] x = new float[end - start];
System.arraycopy(b, start, x, 0, end - start);
return x;
}
static public Object[] subArray(Object[] b, int start) {
return subArray(b, start, l(b));
}
static public Object[] subArray(Object[] b, int start, int end) {
start = max(start, 0);
end = min(end, l(b));
if (start >= end)
return new Object[0];
Object[] x = new Object[end - start];
System.arraycopy(b, start, x, 0, end - start);
return x;
}
static public String timeInTimeZoneWithOptionalDate_24(String timezone, long time) {
return timeInTimeZoneWithOptionalDate_24(timeZone(timezone), time);
}
static public String timeInTimeZoneWithOptionalDate_24(TimeZone timezone, long time) {
SimpleDateFormat format = simpleDateFormat("yyyy/MM/dd", timezone);
String date = format.format(time);
boolean needDate = neq(date, format.format(now()));
return (needDate ? date + " " : "") + timeInTimeZone(timezone, time);
}
static public String loadTextFileMandatory(File file) {
String contents = loadTextFile(file);
if (contents == null)
throw fail("File not found: " + file.getPath());
return contents;
}
static public Properties litprop(Object... x) {
Properties prop = new Properties();
litmap_impl(prop, x);
return prop;
}
static public A printWithClass(String name, A a) {
print(name, toStringWithClass(a));
return a;
}
static public List objectsWhereCI(Collection c, Object... data) {
return objectsWhereIC(c, data);
}
static public boolean notZero(Double d) {
return isNonZero(d);
}
static public boolean notZero(Long l) {
return isNonZero(l);
}
static public boolean notZero(Integer l) {
return isNonZero(l);
}
static public IntRange shrinkIntRange(IntRange r, int i) {
return r == null ? null : intRange(r.start + i, r.end - i);
}
static public List tok_parseInnerArgsList(String s) {
return tok_parseInnerArgsList(javaTok(s));
}
static public List tok_parseInnerArgsList(List tok) {
return tok_parseInnerArgsList(tok, getBracketMap(tok));
}
static public List tok_parseInnerArgsList(List tok, Map bracketMap) {
List args = new ArrayList();
int argStart = 1, i = 1;
while (i < l(tok) - 2) {
Integer j = bracketMap.get(i);
if (j != null) {
i = j + 2;
continue;
}
if (eqGetOneOf(tok, i, ",")) {
if (i > argStart)
args.add(trimJoinSubList(tok, argStart, i));
argStart = i + 2;
}
i += 2;
}
if (i > argStart)
args.add(trimJoinSubList(tok, argStart, i));
return args;
}
static public String htmlFullDecode(String html) {
return htmldecode_dropTagsAndComments_trim(html);
}
static public long unixTime_startOfDay() {
return unixTime_startOfDay(now());
}
static public long unixTime_startOfDay(long time) {
return unixDay(time) * 24 * 60 * 60;
}
static public boolean parseBoolean(String s) {
return "true".equals(s);
}
static public String ltrim(String s) {
if (s == null)
return null;
int i = 0;
while (i < s.length() && " \t\r\n".indexOf(s.charAt(i)) >= 0) ++i;
return i > 0 ? substring(s, i) : s;
}
static public int countSpacesAtEnd(String s) {
int n = l(s), i = n;
while (i > 0 && s.charAt(i - 1) == ' ') --i;
return n - i;
}
static public String jreplace_first_dyn(String s, String in, Object out) {
return jreplace_first_dyn(s, in, out, null);
}
static public String jreplace_first_dyn(String s, String in, Object out, Object condition) {
List tok = javaTok(s);
return jreplace_first_dyn(tok, in, out, false, false, condition) ? join(tok) : s;
}
static public boolean jreplace_first_dyn(List tok, String in, Object out) {
return jreplace_first_dyn(tok, in, out, false, true, null);
}
static public boolean jreplace_first_dyn(List tok, String in, Object out, Object condition) {
return jreplace_first_dyn(tok, in, out, false, true, condition);
}
static public boolean jreplace_first_dyn(List tok, String in, Object out, boolean ignoreCase, boolean reTok, Object condition) {
List tokin = javaTok(in);
jfind_preprocess(tokin);
boolean anyChange = false;
int i = 1;
if ((i = findCodeTokens(tok, i, ignoreCase, toStringArray(codeTokensOnly(tokin)), condition)) >= 0) {
List subList = tok.subList(i - 1, i + l(tokin) - 1);
String expansion = (String) (callF(out, tok, i));
int end = i + l(tokin) - 2;
clearAllTokens(tok, i, end);
tok.set(i, expansion);
if (reTok)
reTok(tok, i, end);
anyChange = true;
}
return anyChange;
}
static public double nan() {
return Double.NaN;
}
static public List tok_splitAtComma(String s) {
return tok_splitAtComma(javaTok(s));
}
static public List tok_splitAtComma(List tok) {
List out = new ArrayList();
for (int i = 0; i < l(tok); i++) {
int j = smartIndexOf(tok, ",", i);
out.add(joinSubList(tok, i + 1, j - 1));
i = j;
}
return out;
}
static public List tokSubList(List l, IntRange r) {
return subList(l, r.start & ~1, r.end | 1);
}
static public Comparator calculatedFieldComparator(final Object f) {
return new Comparator () {
public int compare(A a, A b) {
return cmp(callF(f, a), callF(f, b));
}
};
}
static public boolean jMatchStart(String pat, String s) {
return jMatchStart(pat, s, null);
}
static public boolean jMatchStart(String pat, String s, Matches matches) {
if (s == null)
return false;
return jMatchStart(pat, javaTok(s), matches);
}
static public boolean jMatchStart(String pat, List toks) {
return jMatchStart(pat, toks, null);
}
static public boolean jMatchStart(String pat, List toks, Matches matches) {
List tokpat = jfind_preprocess(javaTok(pat));
if (toks.size() < tokpat.size())
return false;
String[] m = match2x(tokpat, toks.subList(0, tokpat.size()));
if (m == null)
return false;
if (matches != null) {
matches.m = new String[m.length + 1];
arraycopy(m, matches.m);
matches.m[m.length] = join(toks.subList(tokpat.size(), toks.size()));
}
return true;
}
static public String shortenToFirstAndLast(int chars, String s) {
if (s == null)
return "";
return s.length() <= chars * 2 ? s : takeFirst(chars, s) + "..." + takeLast(chars, s);
}
static public CloseableWrapper threadAsCloseable(Thread t) {
return t == null ? null : new CloseableWrapper(t, () -> cancelThread(t));
}
static public List pineTok(String s) {
ArrayList tok = new ArrayList();
int l = s == null ? 0 : s.length();
int i = 0;
while (i < l) {
int j = i;
char c, d;
while (j < l) {
c = s.charAt(j);
d = j + 1 >= l ? '\0' : s.charAt(j + 1);
if (c == ' ' || c == '\t' || c == '\r' || c == '\n')
++j;
else if (c == '/' && d == '*') {
do ++j; while (j < l && !regionMatches(s, j, "*/"));
j = Math.min(j + 2, l);
} else if (c == '/' && d == '/') {
do ++j; while (j < l && "\r\n".indexOf(s.charAt(j)) < 0);
} else
break;
}
tok.add(javaTok_substringN(s, i, j));
i = j;
if (i >= l)
break;
c = s.charAt(i);
d = i + 1 >= l ? '\0' : s.charAt(i + 1);
if (c == '\'' || c == '"') {
char opener = c;
++j;
while (j < l) {
int c2 = s.charAt(j);
if (c2 == opener || c2 == '\n' && opener == '\'') {
++j;
break;
} else if (c2 == '\\' && j + 1 < l)
j += 2;
else
++j;
}
} else if (Character.isJavaIdentifierStart(c))
do ++j; while (j < l && (Character.isJavaIdentifierPart(s.charAt(j)) || s.charAt(j) == '\''));
else if (Character.isDigit(c)) {
do ++j; while (j < l && Character.isDigit(s.charAt(j)));
if (j < l && s.charAt(j) == 'L')
++j;
} else
++j;
tok.add(s.substring(i, j));
i = j;
}
if ((tok.size() % 2) == 0)
tok.add("");
return tok;
}
static public List pine_singleToDoubleQuotes(List tok) {
return mapCodeTokens(tok, t -> {
if (startsWith(t, "'"))
return quote(unquoteSingleOrDoubleQuotes(t));
return t;
});
}
static public int jfind_any(String src, String... patterns) {
return jfind_any(javaTok(src), patterns);
}
static public int jfind_any(List tok, String... patterns) {
return jfind_any(tok, 1, patterns);
}
static public int jfind_any(List tok, int startIdx, String... patterns) {
return jfind_any(tok, startIdx, null, patterns);
}
static public int jfind_any(List tok, TokCondition cond, String... patterns) {
return jfind_any(tok, 1, cond, patterns);
}
static public int jfind_any(List tok, int startIdx, TokCondition cond, String... patterns) {
int i = -1;
for (String pat : patterns) i = minUnlessMinus1(i, jfind(tok, startIdx, pat, cond));
return i;
}
static public int dropFunctionCalls_reTok(List tok, String functionName) {
int removed = 0;
while (true) {
var r = tok_findFunctionCall(tok, functionName);
if (r != null) {
clearTokens_reTok(tok, r);
++removed;
} else
break;
}
return removed;
}
static public TokenRange tok_findFunctionCall(List tok, String functionName) {
int idx = jfind(tok, contains(functionName, "(") ? functionName : functionName + "(");
if (idx < 0)
return null;
int iOpening = indexOf(tok, "(", idx);
int iEnd = findEndOfBracketPart(tok, iOpening);
return new TokenRange(idx, iEnd);
}
static public int indexOfNTokenContainingIC(List tok, String pattern) {
for (int i = 0; i < l(tok); i += 2) if (cic(tok.get(i), pattern))
return i;
return -1;
}
static public boolean nonNegative(int i) {
return i >= 0;
}
static public boolean nonNegative(long i) {
return i >= 0;
}
static public boolean nonNegative(double i) {
return i >= 0;
}
static public boolean jreplace_multi(List tok, List ins, String out) {
boolean change = false;
for (String in : ins) if (jreplace(tok, in, out))
change = true;
return change;
}
static public String jreplace_multi(String s, String... replacements) {
if (empty(replacements))
return s;
List tok = javaTok(s);
boolean change = false;
for (int i = 0; i < l(replacements); i += 2) if (jreplace(tok, replacements[i], replacements[i + 1]))
change = true;
return change ? join(tok) : s;
}
static public List jreplace_multi(List tok, String... replacements) {
for (int i = 0; i < l(replacements); i += 2) jreplace(tok, replacements[i], replacements[i + 1]);
return tok;
}
static public String unnullString(String s) {
return s == null ? "" : s;
}
static public String javaDropSlashStarComments(String s) {
return join(javaDropSlashStarComments(javaTok(s)));
}
static public List javaDropSlashStarComments(List tok) {
for (int i = 0; i < l(tok); i += 2) tok.set(i, tok_javaDropSlashStarCommentsFromWhitespace(tok.get(i)));
return tok;
}
static public List allToLong(Collection l) {
return lmap(__76 -> toLong(__76), l);
}
static public Long longMin(Iterable l) {
Long min = null;
for (long x : l) min = min == null ? x : Math.min(min, x);
return min;
}
static public AutoCloseable timerAsAutoCloseable(java.util.Timer timer) {
return timerAsAutocloseable(timer);
}
static public String rjreplace(String in, String out, String s) {
return jreplace(s, in, out);
}
static public String rjreplace(String in, String out, ITokCondition condition, String s) {
return jreplace(s, in, out, condition);
}
static public boolean rjreplace(String in, String out, List tok) {
return jreplace(tok, in, out);
}
static public boolean rjreplace(String in, String out, ITokCondition condition, List tok) {
return jreplace(tok, in, out, condition);
}
static public String lastToken(List tok) {
return get(tok, (l(tok) | 1) - 2);
}
static public LinkedHashMap linkedHashMap() {
return new LinkedHashMap();
}
static public String jsonIndent(Object o) {
return jsonIndent(5, o);
}
static public String jsonIndent(int levels, Object o) {
return jsonEncode_breakAtLevels(levels, o);
}
static public void jsonIndent(int levels, Object o, StringBuilder buf, int level) {
jsonEncode_breakAtLevels(levels, o, buf, level);
}
static public CloseableIterableIterator linesOfFile(File f) {
return linesFromFile(f);
}
static public void pine_replaceInputDefault(List tok, String varName, Object newDefaultValue) {
int i = jfind(tok, varName + " = input.(");
if (i < 0)
return;
int iOpen = indexOf(tok, "(", i);
int iDefault = iOpen + 2;
int iEndDefault = indexOfAny(tok, iDefault, ",", ")");
replaceTokens_reTok(tok, iDefault, iEndDefault, str(newDefaultValue));
}
static public boolean jcontains(String s, String pat) {
return jfind(s, pat) >= 0;
}
static public boolean jcontains(List tok, String pat) {
return jfind(tok, pat) >= 0;
}
static public boolean jcontains(List tok, String pat, Object condition) {
return jfind(tok, pat, condition) >= 0;
}
static public int bitNot(int a) {
return ~a;
}
static public int tok_findEndOfLine(List tok, int i) {
int n = l(tok);
if (odd(i))
++i;
while (i < n) {
String t = tok.get(i);
if (containsNewLine(t))
return i;
i += 2;
}
return n - 1;
}
static public boolean parseMandatoryBoolean(String s) {
if (eq(s, "true"))
return true;
if (eq(s, "false"))
return false;
throw fail("true/false expected: " + s);
}
static public boolean jreplace_dyn_allowDollarRefs(List tok, String in, IF1 out) {
return jreplace_dyn(tok, in, (_tok, cIdx) -> {
String replacement = out.get(cIdx);
List subList = subList(tok, cIdx - 1);
return jreplaceExpandRefs(replacement, subList);
});
}
static public String jreplace_first(String s, String in, String out) {
return jreplace_first(s, in, out, null);
}
static public String jreplace_first(String s, String in, String out, Object condition) {
List tok = javaTok(s);
return jreplace_first(tok, in, out, false, false, condition) ? join(tok) : s;
}
static public boolean jreplace_first(List tok, String in, String out) {
return jreplace_first(tok, in, out, false, true, null);
}
static public boolean jreplace_first(List tok, String in, String out, Object condition) {
return jreplace_first(tok, in, out, false, true, condition);
}
static public boolean jreplace_first(List tok, String in, String out, boolean ignoreCase, boolean reTok, Object condition) {
List tokin = javaTok(in);
jfind_preprocess(tokin);
boolean anyChange = false;
int i = 1;
if ((i = findCodeTokens(tok, i, ignoreCase, toStringArray(codeTokensOnly(tokin)), condition)) >= 0) {
List subList = tok.subList(i - 1, i + l(tokin) - 1);
String expansion = jreplaceExpandRefs(out, subList);
int end = i + l(tokin) - 2;
clearAllTokens(tok, i, end);
tok.set(i, expansion);
if (reTok)
reTok(tok, i, end);
anyChange = true;
}
return anyChange;
}
static public boolean jreplace_first_debug = false;
static public String simpleEmptyLines(String s) {
if (s == null)
return null;
List l = new ArrayList();
boolean lastEmpty = false;
for (String line : lines(s)) {
if (!emptyAfterTrim(line))
lastEmpty = false;
else if (lastEmpty)
continue;
else
lastEmpty = true;
l.add(line);
}
return lines(l);
}
static public String jreplace1(String s, String in, String out) {
return jreplace1(s, in, out, null);
}
static public String jreplace1(String s, String in, String out, Object condition) {
List tok = javaTok(s);
return jreplace1(tok, in, out, condition) ? join(tok) : s;
}
static public boolean jreplace1(List tok, String in, String out) {
return jreplace1(tok, in, out, false, true, null);
}
static public boolean jreplace1(List tok, String in, String out, Object condition) {
return jreplace1(tok, in, out, false, true, condition);
}
static public boolean jreplace1(List tok, String in, String out, boolean ignoreCase, boolean reTok, Object condition) {
List tokin = javaTok(in);
jfind_preprocess(tokin);
boolean anyChange = false;
int i = 1;
while ((i = findCodeTokens(tok, i, ignoreCase, toStringArray(codeTokensOnly(tokin)), condition)) >= 0) {
List subList = tok.subList(i - 1, i + l(tokin) - 1);
String expansion = jreplaceExpandRefs(out, subList);
int end = i + l(tokin) - 2;
clearAllTokens(tok, i, end);
tok.set(i, expansion);
int l = l(tok);
if (reTok)
reTok(tok, i, end);
i = end + l(tok) - l;
anyChange = true;
}
return anyChange;
}
static public boolean jreplace1_debug = false;
static public List mapNonCodeTokens(Object f, List l) {
List out = emptyList(l);
for (int i = 0; i < l(l); i++) {
Object o = l.get(i);
out.add(even(i) ? callF(f, o) : o);
}
return out;
}
static public List mapNonCodeTokens(List l, Object f) {
return mapNonCodeTokens(f, l);
}
static public List mapNonCodeTokens(List tok, IF1 f) {
return mapNonCodeTokens(tok, (Object) f);
}
static public List mapNonCodeTokens(IF1 f, List tok) {
return mapNonCodeTokens(tok, f);
}
static public String betterAutoUnindent(String s) {
int n = betterGetIndent(s);
if (n == 0)
return s;
List l = toLines(s);
for (int i = 0; i < l(l); i++) l.set(i, substring(l.get(i), n));
return fromLines(l);
}
static public String unindent_mls(String s) {
return autoUnindent_mls(s);
}
static public String htablecenter(Object contents, Object... __) {
return tag("table", tr(td(contents, "align", "center", "valign", "top")), paramsPlus(__, "width", "100%"));
}
static public String unicode_blackRightArrow() {
return charToString(0x27a1);
}
static public List deltas(List extends Number> l) {
int n = l(l);
List deltas = new ArrayList();
for (int i = 0; i < n - 1; i++) deltas.add(toDouble(l.get(i + 1)) - toDouble(l.get(i)));
return deltas;
}
static public Timestamp daysAgo(double days) {
return tsNow().minus(daysToMS(days));
}
static public String trimSubstringAfter(String a, String b) {
return trim(substring(a, smartIndexOfAfter(a, b)));
}
static public String hsubmit(String text, Object... params) {
return tag("input", "", concatArrays(new Object[] { "type", "submit", "value", text }, params));
}
static public String hsubmit() {
return hsubmit("Submit");
}
static public String hpassword(String name, Object... params) {
return hpasswordfield(name, params);
}
static public String hpassword(String name) {
return hpasswordfield(name);
}
static public String hform(Object contents, Object... params) {
return htag("form", contents, params);
}
static public int weekInYear(long time, TimeZone tz) {
return parseInt(simpleDateFormat("w", tz).format(time));
}
static public String stringCombine(Object... l) {
return customSeparatorCombine("", l);
}
static public File fileFromClipboard() {
return first(getFilesFromClipboard());
}
static public List latestFilesFirst(Collection files) {
return sortFilesByDateDesc(files);
}
static public List listDir(File dir) {
return listFiles_asList(dir);
}
static public List listDir(String dir) {
return listFiles_asList(dir);
}
static public File backupFile(String f) {
return backupFile(toFile(f));
}
static public File backupFile(File f) {
if (isDirectory(f))
throw fail("Is a directory: " + f);
if (!fileExists(f))
return null;
File fBackup = makeFileNameUnique(newFile(javaxBackupDir(), uniqueFileNameUsingMD5_80_v2(f2s(f))));
copyFile(f, fBackup);
return fBackup;
}
static public SimpleAttributeSet style_center() {
return style_center(new SimpleAttributeSet());
}
static public SimpleAttributeSet style_center(SimpleAttributeSet a) {
StyleConstants.setAlignment(a, StyleConstants.ALIGN_CENTER);
return a;
}
static public SimpleAttributeSet style_fontSize(int n) {
return style_fontSize(new SimpleAttributeSet(), n);
}
static public SimpleAttributeSet style_fontSize(SimpleAttributeSet a, int n) {
StyleConstants.setFontSize(a, n);
return a;
}
static public SimpleAttributeSet style_fontSize(int n, SimpleAttributeSet a) {
return style_fontSize(a, n);
}
static public void textPane_paragraphAttributes(JTextPane p, AttributeSet attributes) {
try {
StyledDocument doc = p.getStyledDocument();
doc.setParagraphAttributes(0, doc.getLength(), attributes, false);
} catch (Exception __e) {
throw rethrow(__e);
}
}
static public JTextPane jTextPane() {
return jtextpane();
}
static public JTextPane jTextPane(String text, AttributeSet attributes) {
return jtextpane(text, attributes);
}
static public JTextPane jTextPane(String text) {
return jtextpane(text);
}
static public String youtubeEmbed_newer(String youtubeID) {
return embedYoutube_newer(youtubeID);
}
static public String youtubeEmbed_newer(String youtubeID, int w) {
return embedYoutube_newer(youtubeID, w, null);
}
static public String youtubeEmbed_newer(String youtubeID, int w, int h) {
return embedYoutube_newer(youtubeID, w, h, null);
}
static public Map cloneTreeMap(Map map) {
if (map == null)
return new TreeMap();
else
synchronized (map) {
return new TreeMap(map);
}
}
static public Set syncTreeSet() {
return synchroTreeSet();
}
static public Map filterValues(Map map, IF1 pred) {
return filterMapByValuePredicate(map, pred);
}
static public Map filterValues(IF1 pred, Map map) {
return filterMapByValuePredicate(pred, map);
}
static public List allToDouble(Iterable l) {
return map(__77 -> toDouble(__77), l);
}
static public AutoCloseable tempSyncAdd(Collection l, A a) {
if (l == null)
return null;
if (!syncAdd(l, a))
return null;
return new tempSyncAdd_undo(l, a);
}
static public class tempSyncAdd_undo implements AutoCloseable, IFieldsToList {
public Collection l;
public A a;
public tempSyncAdd_undo() {
}
public tempSyncAdd_undo(Collection l, A a) {
this.a = a;
this.l = l;
}
public String toString() {
return shortClassName_dropNumberPrefix(this) + "(" + l + ", " + a + ")";
}
public Object[] _fieldsToList() {
return new Object[] { l, a };
}
public void close() {
try {
syncRemove(l, a);
} catch (Exception __e) {
throw rethrow(__e);
}
}
}
static public String htmlEncode_nlToBR(String s) {
return htmlEncode_nlToBr(s);
}
static public String h1(String s, Object... params) {
return hfulltag("h1", s, params);
}
static public A conceptWhereIC(Class c, Object... params) {
return findConceptWhereCI(c, params);
}
static public Concept conceptWhereIC(String c, Object... params) {
return findConceptWhereCI(db_mainConcepts(), c, params);
}
static public A conceptWhereIC(Concepts concepts, Class c, Object... params) {
return findConceptWhereCI(concepts, c, params);
}
static public Concept conceptWhereIC(Concepts concepts, String c, Object... params) {
return findConceptWhereCI(concepts, c, params);
}
static public void logStruct(File logFile, Object o) {
logStructure(logFile, o);
}
static public void logStruct(String fileName, Object o) {
logStructure(fileName, o);
}
static public void logStruct(String progID, String fileName, Object o) {
logStructure(progID, fileName, o);
}
static public List notNulls(List l) {
return notNullOnly(l);
}
static public List notNulls(A... l) {
return notNullOnly(l);
}
static public List containing(Collection l, final String x) {
List out = new ArrayList();
for (String s : unnull(l)) if (contains(s, x))
out.add(s);
return out;
}
static public List containing(String x, Collection l) {
return containing(l, x);
}
static public String a_name(String anchor) {
return aname(anchor);
}
static public String a_name(String anchor, Object contents, Object... params) {
return aname(anchor, contents, params);
}
static public List lazyReversed(List l) {
return new RandomAccessAbstractList () {
final public int size = l(l);
public int size() {
return l.size();
}
public A get(int i) {
return l.get(size() - 1 - i);
}
public A set(int i, A a) {
return l.set(size() - 1 - i, a);
}
};
}
static public String reversedLines(String s) {
return lines_possiblyRTrim(s, reversed(lines(s)));
}
static public double minutesToSeconds(double minutes) {
return minutes * 60;
}
static public Map mapKeysAndValues(Object f, Map map) {
return mapKeysAndValues(f, f, map);
}
static public Map mapKeysAndValues(Object fKey, Object fValue, Map map) {
if (map == null)
return null;
Map m = similarEmptyMap(map);
for (Map.Entry extends Object, ? extends Object> __1 : _entrySet((Map) map)) {
Object key = __1.getKey();
Object val = __1.getValue();
m.put(callF(fKey, key), callF(fValue, val));
}
return m;
}
static public Map mapKeysAndValues(IF1 f, Map map) {
return mapKeysAndValues(f, f, map);
}
static public Map mapKeysAndValues(IF1 fKey, IF1 fValue, Map map) {
if (map == null)
return null;
Map m = similarEmptyMap(map);
for (Map.Entry extends A, ? extends B> __0 : _entrySet(map)) {
A key = __0.getKey();
B val = __0.getValue();
m.put(fKey.get(key), fValue.get(val));
}
return m;
}
static public B rmapGet(Map map, A a) {
return map == null || a == null ? null : map.get(a);
}
static public B rmapGet(A a, Map map) {
return map == null || a == null ? null : map.get(a);
}
static public Object rget(String field, Object o) {
return get(o, field);
}
static public String dropAfterSlash(String s) {
if (s == null)
return null;
int i = s.indexOf('/');
return i < 0 ? s : rtrim(substring(s, 0, i));
}
static public Pair reversePair(Pair p) {
return p == null ? null : pair(p.b, p.a);
}
static public TreeMap treeMap() {
return treeMap(null);
}
static public TreeMap treeMap(Comparator cmp) {
return cmp == null ? new TreeMap() : new TreeMap(cmp);
}
static public Map multiSetToMap(MultiSet ms) {
return ms == null ? null : ms.asMap();
}
static public MultiSet multiMapKeysMultiSet(final MultiMap mm) {
if (mm == null)
return null;
MultiSet out = similarEmptyMultiSet(mm.data);
for (A key : keys(mm)) out.add(key, l(mm.get(key)));
return out;
}
static public List> objectsToMaps(Iterable l) {
return objectToMap(l);
}
static public Map getMultipleKeys_ordered(Map map, A... keys) {
Map map2 = new LinkedHashMap();
if (map != null && keys != null)
for (A key : keys) map2.put(key, map.get(key));
return map2;
}
static public Map getMultipleKeys_ordered(Map map, Iterable keys) {
Map map2 = new LinkedHashMap();
if (map != null && keys != null)
for (A key : keys) map2.put(key, map.get(key));
return map2;
}
static public String makeAbsoluteURL(String baseURL, String url) {
try {
return empty(baseURL) ? url : str(new URL(new URL(baseURL), url));
} catch (Exception __e) {
throw rethrow(__e);
}
}
static public Set setIntersection(Collection a, Collection b) {
Set set = similarEmptySet(a);
if (nempty(a) && nempty(b)) {
Set bSet = asSet(b);
for (A x : a) if (bSet.contains(x))
set.add(x);
}
return set;
}
static public String dropSuffixOrNull(String suffix, String s) {
return s != null && s.endsWith(suffix) ? s.substring(0, l(s) - l(suffix)) : null;
}
static public NanoHTTPD.Response serveRedirect(String url) {
return serveRedirect(url, NanoHTTPD.MIME_PLAINTEXT);
}
static public NanoHTTPD.Response serveRedirect(String url, String contentType) {
NanoHTTPD.IStatus status = new NanoHTTPD.IStatus() {
public String getDescription() {
return "302 Moved temporarily";
}
public int getRequestStatus() {
return 302;
}
};
NanoHTTPD.Response r = NanoHTTPD.newFixedLengthResponse(status, contentType, "");
r.addHeader("Location", url);
return r;
}
static public List objectsWhere(Collection c, Object... data) {
return filterByFields(c, data);
}
static public double fileAgeInDays(File f) {
return f == null ? -1 : msToDays(now() - fileModificationTime(f));
}
static public String limitedStruct(int limit, Object o) {
var baos = new ByteArrayOutputStream();
var out = new LimitedOutputStream(baos, limit);
var writer = printWriter(out);
final class _C_1 {
public void failMe() {
throw fail("Struct exceeds limit of " + n2(limit) + " bytes: " + shorten(fromUtf8(baos.toByteArray()), limit));
}
}
final _C_1 __2 = new _C_1();
try {
structureToPrintWriter(o, writer);
} catch (Throwable e) {
writer.close();
__2.failMe();
}
writer.close();
String struct = fromUtf8(baos.toByteArray());
if (l(struct) > limit)
__2.failMe();
return struct;
}
static public String regexpForFloatingPoint() {
return "[+-]?" + regexpForFloatingPointWithoutSign();
}
static public Object serveText(Object s) {
if (getMainBot() == null)
return serveText_direct(str(s));
return call(getMainBot(), "serveByteArray", toUtf8(str(s)), "text/plain; charset=utf8");
}
static public List splitAtSlash(String s) {
return trimAll(asList(s.split("/")));
}
static public String ymdWithMinuses() {
return ymdWithMinuses(now());
}
static public String ymdWithMinuses(long time) {
return simpleDateFormat_local("yyyy-MM-dd").format(time);
}
static public String appendNewLine(String s) {
return unnull(s) + "\n";
}
static public String ahref(String link, Object contents, Object... params) {
return link == null ? str(contents) : href(link, contents, params);
}
static public String hrefresh(String target) {
return hrefresh(0, target);
}
static public String hrefresh(double seconds) {
return hrefresh(seconds, "");
}
static public String hrefresh(double seconds, String target) {
return tag("meta", "", "http-equiv", "refresh", "content", iceil(seconds) + (nempty(target) ? "; url=" + target : ""));
}
static public IterableIterator> mapToPairsIterator(Map