@Override public Map<MechSummary, ITechnology> call() throws Exception { Map<MechSummary,ITechnology> map = new HashMap<MechSummary,ITechnology>(); for (MechSummary ms : MechSummaryCache.getInstance().getAllMechs()) { map.put(ms, calcTechProgression(ms, techFaction)); } return map; } };
protected MechSummary getMechByName(String name) { return MechSummaryCache.getInstance().getMech(name); }
public void run() { while (!loadingDone && !MechSummaryCache.getInstance().isInitialized()) { updateCounts(); try { Thread.sleep(UPDATE_FREQUENCY); } catch (InterruptedException e) { // not supposed to come here } } } };
public void die() { MechSummaryCache.getInstance().removeListener(mechSummaryCacheListener); }
MechSummaryCache mscInstance = MechSummaryCache.getInstance(); mechs = mscInstance.getAllMechs(); if (mscInstance.isInitialized() && !useAlternate) MechSummaryCache.getInstance().getFailedFiles(); if ((hFailedFiles != null) && (hFailedFiles.size() > 0)) {
public SkinEditorMainGUI() { super(new BorderLayout()); this.addComponentListener(this); panMain.setLayout(cardsMain); panSecondary.setLayout(cardsSecondary); JPanel panDisplay = new JPanel(new BorderLayout()); panDisplay.add(panMain, BorderLayout.CENTER); panDisplay.add(panSecondary, BorderLayout.SOUTH); add(panDisplay, BorderLayout.CENTER); UnitLoadingDialog unitLoadingDialog = new UnitLoadingDialog(frame); if (!MechSummaryCache.getInstance().isInitialized()) { unitLoadingDialog.setVisible(true); } try { MechSummary ms = MechSummaryCache.getInstance().getMech( "Archer ARC-2W"); testEntity = new MechFileParser(ms.getSourceFile(), ms.getEntryName()).getEntity(); } catch (EntityLoadingException e) { e.printStackTrace(); } }
void updateCounts() { lCacheCount.setText(String.valueOf(MechSummaryCache.getInstance() .getCacheCount())); lFileCount.setText(String.valueOf(MechSummaryCache.getInstance() .getFileCount())); lZipCount.setText(String.valueOf(MechSummaryCache.getInstance() .getZipCount())); } }
public static void main(String[] args) { EquipmentType.initializeTypes(); QuirkRewriteTool qc = new QuirkRewriteTool(); mechSummaryCache = MechSummaryCache.getInstance(true); mechSummaryCache.addListener(qc); }
MechSummaryCache.getInstance().loadMechData(); MechSummary summary = MechSummaryCache.getInstance().getMech(newEntity.getChassis() + " " + newEntity.getModel()); if(null == summary) { throw(new EntityLoadingException());
MechSummaryCache.dispose(); memDump("entering deployment phase"); //$NON-NLS-1$ break; MechSummaryCache.getInstance().addListener(new MechSummaryCache.Listener() { public void doneLoading() { RandomUnitGenerator.getInstance(); if (MechSummaryCache.getInstance().isInitialized()) { RandomUnitGenerator.getInstance();
public static void main(String[] args) { int bad = 0; MechSummaryCache msc = MechSummaryCache.getInstance(); while (!msc.isInitialized()) { try { Thread.sleep(50); for (MechSummary ms : msc.getAllMechs()) { Entity en = null; try { System.out.println("\t" + et.getName() + " (" + et.getStaticTechLevel().toString() + ")"); System.out.println("Failed: " + bad + "/" + msc.getAllMechs().length);
filename = getTokenValue(); nextToken(); MechSummary ms = MechSummaryCache.getInstance().getMech( filename); if (ms == null) { MechSummary[] units = MechSummaryCache.getInstance() .getAllMechs();
+ unit.getEntity().getModel()); MechSummaryCache.getInstance().loadMechData(); } else if (command.equalsIgnoreCase("REMOVE")) { List<Unit> toRemove = new ArrayList<>();
MechSummaryCache mechSummaryCache = MechSummaryCache.getInstance(); mechSummaryCache.addListener(mechSummaryCacheListener); mscLoaded = mechSummaryCache.isInitialized(); butLoad.setEnabled(mscLoaded && rngLoaded); butArmy.setEnabled(mscLoaded && rngLoaded);
Set<String> sKnownFiles = new HashSet<String>(); long lLastCheck = 0; entityVerifier = EntityVerifier.getInstance(new MegaMekFile(getUnitCacheDir(), EntityVerifier.CONFIG_FILENAME).getFile()); hFailedFiles = new HashMap<String, String>(); File unit_cache_path = new MegaMekFile(getUnitCacheDir(), FILENAME_UNITS_CACHE).getFile(); for (int i = 0; i < num_units; i++) { if (interrupted) { done(); fin.close(); istream.close(); boolean bNeedsUpdate = loadMechsFromDirectory(vMechs, sKnownFiles, lLastCheck, Configuration.unitsDir(), ignoreUnofficial); bNeedsUpdate |= loadMechsFromDirectory(vMechs, sKnownFiles, lLastCheck, userDataUnits, ignoreUnofficial); done(); return; bNeedsUpdate |= addLookupNames(lLastCheck); saveCache(); } catch (Exception e) { loadReport.append(" Unable to save mech cache\n");
@Override public void doneLoading() { MechSummary[] ms = mechSummaryCache.getAllMechs(); System.out.println("\n");
public void run() { m_instance.loadMechData(ignoringUnofficial); } }, "Mech Cache Loader");
public static synchronized MechSummaryCache getInstance() { return getInstance(false); }
if (!name.startsWith("@") && (null == msc.getMech(name))) { //$NON-NLS-1$ System.err.println( String.format("The unit %s could not be found in the %s RAT (%s)", //$NON-NLS-1$
public MechSummary[] getAllMechs() { block(); return m_data; }