diff --git a/src/com/bytezone/diskbrowser/applefile/ApplesoftBasicProgram.java b/src/com/bytezone/diskbrowser/applefile/ApplesoftBasicProgram.java index 4c090d3..60e643e 100644 --- a/src/com/bytezone/diskbrowser/applefile/ApplesoftBasicProgram.java +++ b/src/com/bytezone/diskbrowser/applefile/ApplesoftBasicProgram.java @@ -470,7 +470,7 @@ public class ApplesoftBasicProgram extends BasicProgram private class SourceLine { - List sublines = new ArrayList (); + List sublines = new ArrayList<> (); int lineNumber; int linePtr; int length; diff --git a/src/com/bytezone/diskbrowser/applefile/AssemblerProgram.java b/src/com/bytezone/diskbrowser/applefile/AssemblerProgram.java index 691a49e..9e1f5ca 100755 --- a/src/com/bytezone/diskbrowser/applefile/AssemblerProgram.java +++ b/src/com/bytezone/diskbrowser/applefile/AssemblerProgram.java @@ -201,10 +201,9 @@ public class AssemblerProgram extends AbstractFile private List getLines () { - List lines = new ArrayList (); - Map linesMap = - new HashMap (); - List targets = new ArrayList (); + List lines = new ArrayList<> (); + Map linesMap = new HashMap<> (); + List targets = new ArrayList<> (); int ptr = executeOffset; int address = loadAddress + executeOffset; diff --git a/src/com/bytezone/diskbrowser/applefile/FileTypeDescriptorTable.java b/src/com/bytezone/diskbrowser/applefile/FileTypeDescriptorTable.java index fe6692a..cfb803d 100644 --- a/src/com/bytezone/diskbrowser/applefile/FileTypeDescriptorTable.java +++ b/src/com/bytezone/diskbrowser/applefile/FileTypeDescriptorTable.java @@ -15,7 +15,7 @@ public class FileTypeDescriptorTable extends AbstractFile int indexRecordSize; int offsetToIdx; - private final List indexRecords = new ArrayList (); + private final List indexRecords = new ArrayList<> (); public FileTypeDescriptorTable (String name, byte[] buffer) { diff --git a/src/com/bytezone/diskbrowser/applefile/PascalCode.java b/src/com/bytezone/diskbrowser/applefile/PascalCode.java index d5b1481..889deb4 100755 --- a/src/com/bytezone/diskbrowser/applefile/PascalCode.java +++ b/src/com/bytezone/diskbrowser/applefile/PascalCode.java @@ -10,7 +10,7 @@ import com.bytezone.diskbrowser.utilities.HexFormatter; public class PascalCode extends AbstractFile implements PascalConstants, Iterable { - private final List segments = new ArrayList (16); + private final List segments = new ArrayList<> (16); private final String comment; // private final int blockOffset; // private final Relocator relocator; diff --git a/src/com/bytezone/diskbrowser/applefile/PascalCodeStatement.java b/src/com/bytezone/diskbrowser/applefile/PascalCodeStatement.java index 6571f59..0c5207e 100755 --- a/src/com/bytezone/diskbrowser/applefile/PascalCodeStatement.java +++ b/src/com/bytezone/diskbrowser/applefile/PascalCodeStatement.java @@ -20,7 +20,7 @@ public class PascalCodeStatement implements PascalConstants int ptr; // temp byte[] buffer; boolean jumpTarget; - List jumps = new ArrayList (); + List jumps = new ArrayList<> (); public PascalCodeStatement (byte[] buffer, int ptr, int procPtr) { diff --git a/src/com/bytezone/diskbrowser/applefile/SHRPictureFile1.java b/src/com/bytezone/diskbrowser/applefile/SHRPictureFile1.java index bbae752..1abddb2 100644 --- a/src/com/bytezone/diskbrowser/applefile/SHRPictureFile1.java +++ b/src/com/bytezone/diskbrowser/applefile/SHRPictureFile1.java @@ -12,7 +12,7 @@ import com.bytezone.diskbrowser.utilities.HexFormatter; public class SHRPictureFile1 extends HiResImage // -----------------------------------------------------------------------------------// { - private final List blocks = new ArrayList (); + private final List blocks = new ArrayList<> (); private Main mainBlock; private Multipal multipalBlock; private final boolean debug = false; diff --git a/src/com/bytezone/diskbrowser/applefile/SimpleText2.java b/src/com/bytezone/diskbrowser/applefile/SimpleText2.java index f81112f..8a69995 100755 --- a/src/com/bytezone/diskbrowser/applefile/SimpleText2.java +++ b/src/com/bytezone/diskbrowser/applefile/SimpleText2.java @@ -7,7 +7,7 @@ import com.bytezone.diskbrowser.utilities.HexFormatter; public class SimpleText2 extends AbstractFile { - List lineStarts = new ArrayList (); + List lineStarts = new ArrayList<> (); int loadAddress; boolean showByte = false; diff --git a/src/com/bytezone/diskbrowser/appleworks/AppleworksADBFile.java b/src/com/bytezone/diskbrowser/appleworks/AppleworksADBFile.java index 435bb88..5ed48d9 100644 --- a/src/com/bytezone/diskbrowser/appleworks/AppleworksADBFile.java +++ b/src/com/bytezone/diskbrowser/appleworks/AppleworksADBFile.java @@ -38,8 +38,8 @@ public class AppleworksADBFile extends AbstractFile private final int[] continuation = new int[3]; private final String[] comparison = new String[3]; - private final List reports = new ArrayList (); - final List records = new ArrayList (); + private final List reports = new ArrayList<> (); + final List records = new ArrayList<> (); private final Record standardRecord; public AppleworksADBFile (String name, byte[] buffer) diff --git a/src/com/bytezone/diskbrowser/appleworks/AppleworksSSFile.java b/src/com/bytezone/diskbrowser/appleworks/AppleworksSSFile.java index be56e8e..58674ac 100644 --- a/src/com/bytezone/diskbrowser/appleworks/AppleworksSSFile.java +++ b/src/com/bytezone/diskbrowser/appleworks/AppleworksSSFile.java @@ -9,7 +9,7 @@ import com.bytezone.diskbrowser.utilities.HexFormatter; public class AppleworksSSFile extends AbstractFile { Header header; - List rows = new ArrayList (); + List rows = new ArrayList<> (); public AppleworksSSFile (String name, byte[] buffer) { @@ -248,7 +248,7 @@ public class AppleworksSSFile extends AbstractFile private class Row { private final int rowNumber; - private final List cells = new ArrayList (); + private final List cells = new ArrayList<> (); public Row (int ptr) { diff --git a/src/com/bytezone/diskbrowser/appleworks/Record.java b/src/com/bytezone/diskbrowser/appleworks/Record.java index b4d017b..75e54db 100644 --- a/src/com/bytezone/diskbrowser/appleworks/Record.java +++ b/src/com/bytezone/diskbrowser/appleworks/Record.java @@ -11,7 +11,7 @@ class Record { AppleworksADBFile parent; int length; - List items = new ArrayList (); + List items = new ArrayList<> (); Map calculatedItems = new HashMap ();// move to TableReport public Record (AppleworksADBFile parent, byte[] buffer, int ptr) diff --git a/src/com/bytezone/diskbrowser/cpm/DirectoryEntry.java b/src/com/bytezone/diskbrowser/cpm/DirectoryEntry.java index 39e0f9b..ba422a4 100644 --- a/src/com/bytezone/diskbrowser/cpm/DirectoryEntry.java +++ b/src/com/bytezone/diskbrowser/cpm/DirectoryEntry.java @@ -29,8 +29,8 @@ public class DirectoryEntry implements AppleFileSource private final int recordsUsed; // records used in this extent private final byte[] blockList = new byte[16]; // allocation blocks used - private final List entries = new ArrayList (); - private final List blocks = new ArrayList (); + private final List entries = new ArrayList<> (); + private final List blocks = new ArrayList<> (); private final boolean readOnly; private final boolean systemFile; diff --git a/src/com/bytezone/diskbrowser/disk/AppleDisk.java b/src/com/bytezone/diskbrowser/disk/AppleDisk.java index 42fad5a..b135abb 100755 --- a/src/com/bytezone/diskbrowser/disk/AppleDisk.java +++ b/src/com/bytezone/diskbrowser/disk/AppleDisk.java @@ -533,7 +533,7 @@ public class AppleDisk implements Disk @Override public List getDiskAddressList (int... blocks) { - List addressList = new ArrayList (); + List addressList = new ArrayList<> (); for (int block : blocks) { @@ -696,7 +696,7 @@ public class AppleDisk implements Disk { if (blockList == null) { - blockList = new ArrayList (blocks); + blockList = new ArrayList<> (blocks); for (int block = 0; block < blocks; block++) blockList.add (new AppleDiskAddress (this, block)); } diff --git a/src/com/bytezone/diskbrowser/disk/SectorListConverter.java b/src/com/bytezone/diskbrowser/disk/SectorListConverter.java index 4b6e599..1ebd51a 100644 --- a/src/com/bytezone/diskbrowser/disk/SectorListConverter.java +++ b/src/com/bytezone/diskbrowser/disk/SectorListConverter.java @@ -10,7 +10,7 @@ public class SectorListConverter public SectorListConverter (String text, Disk disk) { - sectors = new ArrayList (); + sectors = new ArrayList<> (); sectorText = text; String[] blocks = text.split (";"); diff --git a/src/com/bytezone/diskbrowser/dos/AbstractCatalogEntry.java b/src/com/bytezone/diskbrowser/dos/AbstractCatalogEntry.java index 0a2c1ea..6261cdc 100644 --- a/src/com/bytezone/diskbrowser/dos/AbstractCatalogEntry.java +++ b/src/com/bytezone/diskbrowser/dos/AbstractCatalogEntry.java @@ -4,7 +4,22 @@ import java.time.LocalDateTime; import java.util.ArrayList; import java.util.List; -import com.bytezone.diskbrowser.applefile.*; +import com.bytezone.diskbrowser.applefile.AppleFileSource; +import com.bytezone.diskbrowser.applefile.ApplesoftBasicProgram; +import com.bytezone.diskbrowser.applefile.AssemblerProgram; +import com.bytezone.diskbrowser.applefile.DefaultAppleFile; +import com.bytezone.diskbrowser.applefile.DoubleHiResImage; +import com.bytezone.diskbrowser.applefile.ErrorMessageFile; +import com.bytezone.diskbrowser.applefile.FontFile; +import com.bytezone.diskbrowser.applefile.HiResImage; +import com.bytezone.diskbrowser.applefile.IntegerBasicProgram; +import com.bytezone.diskbrowser.applefile.MerlinSource; +import com.bytezone.diskbrowser.applefile.OriginalHiResImage; +import com.bytezone.diskbrowser.applefile.PrintShopGraphic; +import com.bytezone.diskbrowser.applefile.ShapeTable; +import com.bytezone.diskbrowser.applefile.SimpleText2; +import com.bytezone.diskbrowser.applefile.TextFile; +import com.bytezone.diskbrowser.applefile.VisicalcFile; import com.bytezone.diskbrowser.disk.Disk; import com.bytezone.diskbrowser.disk.DiskAddress; import com.bytezone.diskbrowser.disk.FormattedDisk; @@ -27,8 +42,8 @@ abstract class AbstractCatalogEntry implements AppleFileSource protected LocalDateTime lastModified; protected DiskAddress catalogSectorDA; - protected final List dataSectors = new ArrayList (); - protected final List tsSectors = new ArrayList (); + protected final List dataSectors = new ArrayList<> (); + protected final List tsSectors = new ArrayList<> (); private CatalogEntry link; @@ -355,7 +370,7 @@ abstract class AbstractCatalogEntry implements AppleFileSource @Override public List getSectors () { - List sectors = new ArrayList (); + List sectors = new ArrayList<> (); sectors.add (catalogSectorDA); sectors.addAll (tsSectors); sectors.addAll (dataSectors); diff --git a/src/com/bytezone/diskbrowser/dos/DosDisk.java b/src/com/bytezone/diskbrowser/dos/DosDisk.java index a60944d..63ddbe2 100755 --- a/src/com/bytezone/diskbrowser/dos/DosDisk.java +++ b/src/com/bytezone/diskbrowser/dos/DosDisk.java @@ -9,7 +9,13 @@ import javax.swing.tree.DefaultMutableTreeNode; import com.bytezone.diskbrowser.applefile.AppleFileSource; import com.bytezone.diskbrowser.applefile.BootSector; -import com.bytezone.diskbrowser.disk.*; +import com.bytezone.diskbrowser.disk.AbstractFormattedDisk; +import com.bytezone.diskbrowser.disk.AppleDisk; +import com.bytezone.diskbrowser.disk.DefaultAppleFileSource; +import com.bytezone.diskbrowser.disk.DefaultSector; +import com.bytezone.diskbrowser.disk.Disk; +import com.bytezone.diskbrowser.disk.DiskAddress; +import com.bytezone.diskbrowser.disk.SectorType; import com.bytezone.diskbrowser.gui.DataSource; public class DosDisk extends AbstractFormattedDisk @@ -32,7 +38,7 @@ public class DosDisk extends AbstractFormattedDisk public final SectorType dataSector = new SectorType ("Data", Color.red); public final SectorType dosSector = new SectorType ("DOS", Color.lightGray); - protected List deletedFileEntries = new ArrayList (); + protected List deletedFileEntries = new ArrayList<> (); enum FileType { @@ -462,10 +468,10 @@ public class DosDisk extends AbstractFormattedDisk * There were actually three versions of DOS 3.3 that Apple released without bumping the version number: - + The first version that was released had FPBASIC and INTBASIC files that were 50 sectors in size. - + The second version of DOS 3.3, often referred to as “DOS 3.3e”, appeared at the time the Apple IIe was released. In this version, the FPBASIC and INTBASIC files were 42 sectors in size. The changes introduced at that time included code to turn @@ -473,12 +479,12 @@ public class DosDisk extends AbstractFormattedDisk command. This fix reportedly introduced an even worse bug, but as the command was not heavily used it did not make much of an impact on most programmers. The APPEND fix was applied by utilizing some formerly unused space in the DOS 3.3 code. - + The third version of DOS 3.3 appeared just before the first release of ProDOS. The only mention of this in the press was in the DOSTalk column of Softalk magazine. This final version of DOS 3.3 included a different fix for the APPEND bug, using another bit of unused space in DOS 3.3. - + With regard to the FPBASIC and INTBASIC files: There were three differences between the 50 sector and the 42 sector versions of the INTBASIC file. Firstly, the $F800-$FFFF section was removed. This area was the code for the Monitor, and with diff --git a/src/com/bytezone/diskbrowser/duplicates/DeleteWindow.java b/src/com/bytezone/diskbrowser/duplicates/DeleteWindow.java index 90d85b8..3aff776 100644 --- a/src/com/bytezone/diskbrowser/duplicates/DeleteWindow.java +++ b/src/com/bytezone/diskbrowser/duplicates/DeleteWindow.java @@ -9,7 +9,12 @@ import java.io.File; import java.util.ArrayList; import java.util.List; -import javax.swing.*; +import javax.swing.JButton; +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTable; +import javax.swing.ScrollPaneConstants; import javax.swing.table.AbstractTableModel; import javax.swing.table.TableColumnModel; @@ -17,7 +22,7 @@ import com.bytezone.diskbrowser.gui.DuplicateAction.DiskTableSelectionListener; public class DeleteWindow extends JFrame implements DiskTableSelectionListener { - private List lines = new ArrayList (); + private List lines = new ArrayList<> (); private final JButton btnHide = new JButton ("Close"); private final RootFolderData rootFolderData; diff --git a/src/com/bytezone/diskbrowser/duplicates/DiskDetails.java b/src/com/bytezone/diskbrowser/duplicates/DiskDetails.java index 78a432b..ae3067d 100644 --- a/src/com/bytezone/diskbrowser/duplicates/DiskDetails.java +++ b/src/com/bytezone/diskbrowser/duplicates/DiskDetails.java @@ -16,8 +16,8 @@ public class DiskDetails private final String type; private final long size; - private final List duplicateChecksums = new ArrayList (); - private final List duplicateNames = new ArrayList (); + private final List duplicateChecksums = new ArrayList<> (); + private final List duplicateNames = new ArrayList<> (); private boolean isDuplicateName; private boolean isDuplicateChecksum; diff --git a/src/com/bytezone/diskbrowser/duplicates/DiskTableModel.java b/src/com/bytezone/diskbrowser/duplicates/DiskTableModel.java index 6b0e895..99d0e1c 100644 --- a/src/com/bytezone/diskbrowser/duplicates/DiskTableModel.java +++ b/src/com/bytezone/diskbrowser/duplicates/DiskTableModel.java @@ -10,7 +10,7 @@ public class DiskTableModel extends AbstractTableModel static final String[] headers = { "Path", "Name", "Type", "Size", "# names", "Checksum", "# checksums" }; - private final List lines = new ArrayList (); + private final List lines = new ArrayList<> (); private final RootFolderData rootFolderData; public DiskTableModel (RootFolderData rootFolderData) diff --git a/src/com/bytezone/diskbrowser/duplicates/DisksWindow.java b/src/com/bytezone/diskbrowser/duplicates/DisksWindow.java index 4963b09..475c3dd 100644 --- a/src/com/bytezone/diskbrowser/duplicates/DisksWindow.java +++ b/src/com/bytezone/diskbrowser/duplicates/DisksWindow.java @@ -12,7 +12,15 @@ import java.awt.event.MouseEvent; import java.util.ArrayList; import java.util.List; -import javax.swing.*; +import javax.swing.JButton; +import javax.swing.JCheckBox; +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTable; +import javax.swing.ListSelectionModel; +import javax.swing.RowFilter; +import javax.swing.ScrollPaneConstants; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; import javax.swing.table.JTableHeader; @@ -33,7 +41,7 @@ public class DisksWindow extends JFrame private final JButton btnTotals = new JButton ("Totals"); private final JPanel topPanel = new JPanel (); - private final List boxes = new ArrayList (); + private final List boxes = new ArrayList<> (); private TableRowSorter sorter; private final CheckBoxActionListener checkBoxActionListener = new CheckBoxActionListener (); diff --git a/src/com/bytezone/diskbrowser/duplicates/RootFolderData.java b/src/com/bytezone/diskbrowser/duplicates/RootFolderData.java index 56c97e0..9049295 100644 --- a/src/com/bytezone/diskbrowser/duplicates/RootFolderData.java +++ b/src/com/bytezone/diskbrowser/duplicates/RootFolderData.java @@ -1,6 +1,11 @@ package com.bytezone.diskbrowser.duplicates; -import java.awt.*; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Font; +import java.awt.Graphics; +import java.awt.Graphics2D; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.File; @@ -33,8 +38,7 @@ public class RootFolderData implements RootDirectoryChangeListener public DisksWindow disksWindow; - public final List listeners = - new ArrayList (); + public final List listeners = new ArrayList<> (); public boolean doChecksums; @@ -196,7 +200,7 @@ public class RootFolderData implements RootDirectoryChangeListener public List listDuplicates (long checksum) { - List list = new ArrayList (); + List list = new ArrayList<> (); DiskDetails original = checksumMap.get (checksum); if (original != null) { diff --git a/src/com/bytezone/diskbrowser/gui/AbstractTab.java b/src/com/bytezone/diskbrowser/gui/AbstractTab.java index c0d0ade..ba262cc 100755 --- a/src/com/bytezone/diskbrowser/gui/AbstractTab.java +++ b/src/com/bytezone/diskbrowser/gui/AbstractTab.java @@ -35,7 +35,7 @@ abstract class AbstractTab extends JPanel implements Tab // -----------------------------------------------------------------------------------// { private final static Cursor handCursor = new Cursor (Cursor.HAND_CURSOR); - private final List adapters = new ArrayList (); + private final List adapters = new ArrayList<> (); private Font font; private final JScrollPane scrollPane; final DiskAndFileSelector eventHandler; diff --git a/src/com/bytezone/diskbrowser/gui/DiskLayoutSelection.java b/src/com/bytezone/diskbrowser/gui/DiskLayoutSelection.java index 1d96af7..8fb033c 100755 --- a/src/com/bytezone/diskbrowser/gui/DiskLayoutSelection.java +++ b/src/com/bytezone/diskbrowser/gui/DiskLayoutSelection.java @@ -18,7 +18,7 @@ class DiskLayoutSelection implements Iterable public DiskLayoutSelection () { - highlights = new ArrayList (); + highlights = new ArrayList<> (); } public void doClick (Disk disk, DiskAddress da, boolean extend, boolean append) @@ -136,7 +136,7 @@ class DiskLayoutSelection implements Iterable // This must return a copy, or the redo function will get very confused public List getHighlights () { - return new ArrayList (highlights); + return new ArrayList<> (highlights); } public boolean isSelected (DiskAddress da) diff --git a/src/com/bytezone/diskbrowser/infocom/Abbreviations.java b/src/com/bytezone/diskbrowser/infocom/Abbreviations.java index e885cbf..3d0957d 100755 --- a/src/com/bytezone/diskbrowser/infocom/Abbreviations.java +++ b/src/com/bytezone/diskbrowser/infocom/Abbreviations.java @@ -29,7 +29,7 @@ class Abbreviations extends InfocomAbstractFile private void populate () { - list = new ArrayList (); + list = new ArrayList<> (); for (int i = header.abbreviationsTable; i < header.objectTableOffset; i += 2) list.add (new ZString (header, header.getWord (i) * 2)); diff --git a/src/com/bytezone/diskbrowser/infocom/Dictionary.java b/src/com/bytezone/diskbrowser/infocom/Dictionary.java index 40020f7..05cc1a9 100755 --- a/src/com/bytezone/diskbrowser/infocom/Dictionary.java +++ b/src/com/bytezone/diskbrowser/infocom/Dictionary.java @@ -50,7 +50,7 @@ class Dictionary extends AbstractFile List wordEntryList = synonymList.get (wordEntry.key); if (wordEntryList == null) { - wordEntryList = new ArrayList (); + wordEntryList = new ArrayList<> (); synonymList.put (wordEntry.key, wordEntryList); } wordEntryList.add (wordEntry); @@ -143,7 +143,7 @@ class Dictionary extends AbstractFile public List getVerbs (int value) { - List words = new ArrayList (); + List words = new ArrayList<> (); int ptr = dictionaryPtr + totalSeparators + 4; for (ZString word : dictionary.values ()) @@ -162,7 +162,7 @@ class Dictionary extends AbstractFile public List getPrepositions (int value) { - List words = new ArrayList (); + List words = new ArrayList<> (); int ptr = dictionaryPtr + totalSeparators + 4; for (ZString word : dictionary.values ()) diff --git a/src/com/bytezone/diskbrowser/infocom/InfocomAbstractFile.java b/src/com/bytezone/diskbrowser/infocom/InfocomAbstractFile.java index ed5c1c6..7659624 100644 --- a/src/com/bytezone/diskbrowser/infocom/InfocomAbstractFile.java +++ b/src/com/bytezone/diskbrowser/infocom/InfocomAbstractFile.java @@ -8,7 +8,7 @@ import com.bytezone.diskbrowser.utilities.HexFormatter; public class InfocomAbstractFile extends AbstractFile { - protected List hexBlocks = new ArrayList (); + protected List hexBlocks = new ArrayList<> (); public InfocomAbstractFile (String name, byte[] buffer) { diff --git a/src/com/bytezone/diskbrowser/infocom/InfocomDisk.java b/src/com/bytezone/diskbrowser/infocom/InfocomDisk.java index 31c854b..fe91390 100755 --- a/src/com/bytezone/diskbrowser/infocom/InfocomDisk.java +++ b/src/com/bytezone/diskbrowser/infocom/InfocomDisk.java @@ -70,7 +70,7 @@ public class InfocomDisk extends AbstractFormattedDisk headerNode = addToTree (root, "Header", header, TYPE_LEAF); DefaultAppleFileSource dafs = (DefaultAppleFileSource) headerNode.getUserObject (); - List blocks = new ArrayList (); + List blocks = new ArrayList<> (); blocks.add (disk.getDiskAddress (3, 0)); dafs.setSectors (blocks); @@ -133,7 +133,7 @@ public class InfocomDisk extends AbstractFormattedDisk DefaultMutableTreeNode node) { DefaultAppleFileSource dafs = (DefaultAppleFileSource) node.getUserObject (); - List blocks = new ArrayList (); + List blocks = new ArrayList<> (); int blockNo = sectorFrom / disk.getBlockSize () + 48; int blockTo = sectorTo / disk.getBlockSize () + 48; diff --git a/src/com/bytezone/diskbrowser/infocom/ObjectAnalyser.java b/src/com/bytezone/diskbrowser/infocom/ObjectAnalyser.java index 307f808..b3110e0 100644 --- a/src/com/bytezone/diskbrowser/infocom/ObjectAnalyser.java +++ b/src/com/bytezone/diskbrowser/infocom/ObjectAnalyser.java @@ -123,7 +123,7 @@ class ObjectAnalyser int propertyNumber; int lo; int hi; - List offsets = new ArrayList (); + List offsets = new ArrayList<> (); public Statistics (int propertyNumber) { diff --git a/src/com/bytezone/diskbrowser/infocom/ObjectManager.java b/src/com/bytezone/diskbrowser/infocom/ObjectManager.java index a5601bf..57b2b41 100755 --- a/src/com/bytezone/diskbrowser/infocom/ObjectManager.java +++ b/src/com/bytezone/diskbrowser/infocom/ObjectManager.java @@ -32,7 +32,7 @@ class ObjectManager extends InfocomAbstractFile implements Iterable propertySize = header.globalsOffset - propertyPtr; tableSize = (propertyPtr - tablePtr); int totalObjects = tableSize / ZObject.HEADER_SIZE; - list = new ArrayList (tableSize); + list = new ArrayList<> (tableSize); for (int objectNo = 0; objectNo < totalObjects; objectNo++) list.add (new ZObject (null, buffer, tablePtr + objectNo * ZObject.HEADER_SIZE, diff --git a/src/com/bytezone/diskbrowser/infocom/PropertyManager.java b/src/com/bytezone/diskbrowser/infocom/PropertyManager.java index 039d368..2e5d0fa 100644 --- a/src/com/bytezone/diskbrowser/infocom/PropertyManager.java +++ b/src/com/bytezone/diskbrowser/infocom/PropertyManager.java @@ -11,7 +11,7 @@ import com.bytezone.diskbrowser.disk.FormattedDisk; class PropertyManager extends AbstractFile { - List list = new ArrayList (); + List list = new ArrayList<> (); Header header; public PropertyManager (String name, byte[] buffer, Header header) @@ -57,7 +57,7 @@ class PropertyManager extends AbstractFile private class Statistic { int id; - List list = new ArrayList (); + List list = new ArrayList<> (); public Statistic (int id) { diff --git a/src/com/bytezone/diskbrowser/infocom/PropertyTester.java b/src/com/bytezone/diskbrowser/infocom/PropertyTester.java index 09644cb..38a1710 100644 --- a/src/com/bytezone/diskbrowser/infocom/PropertyTester.java +++ b/src/com/bytezone/diskbrowser/infocom/PropertyTester.java @@ -8,58 +8,58 @@ import com.bytezone.diskbrowser.infocom.ZObject.Property; class PropertyTester implements Iterable { - List objects; - List conditions = new ArrayList (); - List matchedProperties; + List objects; + List conditions = new ArrayList<> (); + List matchedProperties; - public PropertyTester (List objects) - { - this.objects = objects; - } + public PropertyTester (List objects) + { + this.objects = objects; + } - public void addTest (Condition test) - { - conditions.add (test); - } + public void addTest (Condition test) + { + conditions.add (test); + } - public void doTests () - { - boolean[] propFail = new boolean[32]; - int[] propTestCount = new int[32]; - matchedProperties = new ArrayList (); + public void doTests () + { + boolean[] propFail = new boolean[32]; + int[] propTestCount = new int[32]; + matchedProperties = new ArrayList<> (); - for (ZObject object : objects) - propertyLoop: for (Property property : object.properties) - { - if (propFail[property.propertyNumber] || property.length == 0) - continue; - for (Condition condition : conditions) - if (!condition.test (property)) - { - propFail[property.propertyNumber] = true; - continue propertyLoop; - } - ++propTestCount[property.propertyNumber]; - } + for (ZObject object : objects) + propertyLoop: for (Property property : object.properties) + { + if (propFail[property.propertyNumber] || property.length == 0) + continue; + for (Condition condition : conditions) + if (!condition.test (property)) + { + propFail[property.propertyNumber] = true; + continue propertyLoop; + } + ++propTestCount[property.propertyNumber]; + } - for (int i = 1; i < propFail.length; i++) - if (!propFail[i] && propTestCount[i] > 0) - matchedProperties.add (i); - } + for (int i = 1; i < propFail.length; i++) + if (!propFail[i] && propTestCount[i] > 0) + matchedProperties.add (i); + } - @Override - public Iterator iterator () - { - return matchedProperties.iterator (); - } + @Override + public Iterator iterator () + { + return matchedProperties.iterator (); + } - public int totalSuccessfulProperties () - { - return matchedProperties.size (); - } + public int totalSuccessfulProperties () + { + return matchedProperties.size (); + } } abstract class Condition { - abstract boolean test (Property property); + abstract boolean test (Property property); } \ No newline at end of file diff --git a/src/com/bytezone/diskbrowser/infocom/Routine.java b/src/com/bytezone/diskbrowser/infocom/Routine.java index 63aa35c..e144707 100644 --- a/src/com/bytezone/diskbrowser/infocom/Routine.java +++ b/src/com/bytezone/diskbrowser/infocom/Routine.java @@ -13,12 +13,12 @@ class Routine extends InfocomAbstractFile { int startPtr, length, strings, locals; - List parameters = new ArrayList (); - List instructions = new ArrayList (); - List calls = new ArrayList (); - List calledBy = new ArrayList (); - List actions = new ArrayList (); // not used yet - List targets = new ArrayList (); + List parameters = new ArrayList<> (); + List instructions = new ArrayList<> (); + List calls = new ArrayList<> (); + List calledBy = new ArrayList<> (); + List actions = new ArrayList<> (); // not used yet + List targets = new ArrayList<> (); public Routine (int ptr, Header header, int caller) { diff --git a/src/com/bytezone/diskbrowser/infocom/ZObject.java b/src/com/bytezone/diskbrowser/infocom/ZObject.java index 33ee7fb..c0bc73b 100755 --- a/src/com/bytezone/diskbrowser/infocom/ZObject.java +++ b/src/com/bytezone/diskbrowser/infocom/ZObject.java @@ -19,7 +19,7 @@ class ZObject extends AbstractFile implements Comparable private final int propertyTableLength; final int parent, sibling, child; - final List properties = new ArrayList (); + final List properties = new ArrayList<> (); final BitSet attributes = new BitSet (32); public ZObject (String name, byte[] buffer, int offset, int id, Header header) diff --git a/src/com/bytezone/diskbrowser/utilities/LZW.java b/src/com/bytezone/diskbrowser/utilities/LZW.java index 0c79941..f401a7a 100644 --- a/src/com/bytezone/diskbrowser/utilities/LZW.java +++ b/src/com/bytezone/diskbrowser/utilities/LZW.java @@ -8,7 +8,7 @@ class LZW static protected final String[] st = new String[0x1000]; static protected final int TRACK_LENGTH = 0x1000; - protected final List chunks = new ArrayList (); + protected final List chunks = new ArrayList<> (); protected int volume; protected byte runLengthChar; protected int crc; diff --git a/src/com/bytezone/diskbrowser/utilities/NuFX.java b/src/com/bytezone/diskbrowser/utilities/NuFX.java index 6bd452c..7a51940 100644 --- a/src/com/bytezone/diskbrowser/utilities/NuFX.java +++ b/src/com/bytezone/diskbrowser/utilities/NuFX.java @@ -17,8 +17,8 @@ public class NuFX private final byte[] buffer; private final boolean debug = false; - private final List records = new ArrayList (); - private final List threads = new ArrayList (); + private final List records = new ArrayList<> (); + private final List threads = new ArrayList<> (); public NuFX (Path path) throws FileFormatException, IOException { diff --git a/src/com/bytezone/diskbrowser/visicalc/AbstractValue.java b/src/com/bytezone/diskbrowser/visicalc/AbstractValue.java index a06bb66..2e4c21d 100644 --- a/src/com/bytezone/diskbrowser/visicalc/AbstractValue.java +++ b/src/com/bytezone/diskbrowser/visicalc/AbstractValue.java @@ -20,7 +20,7 @@ public abstract class AbstractValue implements Value protected boolean bool; protected ValueResult valueResult = ValueResult.VALID; - protected List values = new ArrayList (); + protected List values = new ArrayList<> (); public AbstractValue (Cell cell, String text) { diff --git a/src/com/bytezone/diskbrowser/visicalc/ConditionList.java b/src/com/bytezone/diskbrowser/visicalc/ConditionList.java index 45d60ff..8521376 100644 --- a/src/com/bytezone/diskbrowser/visicalc/ConditionList.java +++ b/src/com/bytezone/diskbrowser/visicalc/ConditionList.java @@ -6,7 +6,7 @@ import java.util.List; public class ConditionList implements Iterable { - private final List conditions = new ArrayList (); + private final List conditions = new ArrayList<> (); public ConditionList (Cell cell, String text) { diff --git a/src/com/bytezone/diskbrowser/visicalc/Expression.java b/src/com/bytezone/diskbrowser/visicalc/Expression.java index 5d6ee1b..aa45c07 100644 --- a/src/com/bytezone/diskbrowser/visicalc/Expression.java +++ b/src/com/bytezone/diskbrowser/visicalc/Expression.java @@ -5,8 +5,8 @@ import java.util.List; class Expression extends AbstractValue { - private final List operators = new ArrayList (); - private final List signs = new ArrayList (); + private final List operators = new ArrayList<> (); + private final List signs = new ArrayList<> (); public Expression (Cell cell, String text) { diff --git a/src/com/bytezone/diskbrowser/visicalc/Range.java b/src/com/bytezone/diskbrowser/visicalc/Range.java index 03edcef..3ea81c2 100644 --- a/src/com/bytezone/diskbrowser/visicalc/Range.java +++ b/src/com/bytezone/diskbrowser/visicalc/Range.java @@ -14,7 +14,7 @@ class Range implements Iterable
// private static final Pattern addressList = Pattern.compile ("\\(([^,]+(,[^,]+)*)\\)"); private Address from, to; - private final List
range = new ArrayList
(); + private final List
range = new ArrayList<> (); private final Cell cell; private boolean isHorizontal; diff --git a/src/com/bytezone/diskbrowser/visicalc/Sheet.java b/src/com/bytezone/diskbrowser/visicalc/Sheet.java index ddc862c..b276194 100644 --- a/src/com/bytezone/diskbrowser/visicalc/Sheet.java +++ b/src/com/bytezone/diskbrowser/visicalc/Sheet.java @@ -19,7 +19,7 @@ public class Sheet private final Map rowOrderCells = new TreeMap (); private final Map columnOrderCells = new TreeMap (); - private final List lines = new ArrayList (); + private final List lines = new ArrayList<> (); private final Map columnWidths = new TreeMap (); private int columnWidth = 9; @@ -388,7 +388,7 @@ public class Sheet if (debug) { - List counts = new ArrayList (); + List counts = new ArrayList<> (); for (int i = 0; i < functionTotals.length; i++) if (functionTotals[i] > 0) { diff --git a/src/com/bytezone/diskbrowser/visicalc/ValueList.java b/src/com/bytezone/diskbrowser/visicalc/ValueList.java index 78afde7..e46e3c4 100644 --- a/src/com/bytezone/diskbrowser/visicalc/ValueList.java +++ b/src/com/bytezone/diskbrowser/visicalc/ValueList.java @@ -6,7 +6,7 @@ import java.util.List; public class ValueList implements Iterable { - private final List values = new ArrayList (); + private final List values = new ArrayList<> (); private boolean hasRange; public ValueList (Cell cell, String text) diff --git a/src/com/bytezone/diskbrowser/wizardry/Character.java b/src/com/bytezone/diskbrowser/wizardry/Character.java index bb811d0..1da21bb 100755 --- a/src/com/bytezone/diskbrowser/wizardry/Character.java +++ b/src/com/bytezone/diskbrowser/wizardry/Character.java @@ -14,8 +14,8 @@ class Character extends AbstractFile private final Statistics stats; int scenario; - private final Collection spellBook = new ArrayList (); - private final Collection baggageList = new ArrayList (); + private final Collection spellBook = new ArrayList<> (); + private final Collection baggageList = new ArrayList<> (); static String[] races = { "No race", "Human", "Elf", "Dwarf", "Gnome", "Hobbit" }; static String[] alignments = { "Unalign", "Good", "Neutral", "Evil" }; diff --git a/src/com/bytezone/diskbrowser/wizardry/Header.java b/src/com/bytezone/diskbrowser/wizardry/Header.java index 3a77fae..3841172 100755 --- a/src/com/bytezone/diskbrowser/wizardry/Header.java +++ b/src/com/bytezone/diskbrowser/wizardry/Header.java @@ -30,7 +30,7 @@ class Header String scenarioTitle; public int scenarioID; - List data = new ArrayList (8); + List data = new ArrayList<> (8); FormattedDisk owner; public Header (DefaultMutableTreeNode dataNode, FormattedDisk owner) @@ -100,7 +100,7 @@ class Header private void linkText (String title, DiskAddress da, DefaultMutableTreeNode headerNode) { - List blocks = new ArrayList (); + List blocks = new ArrayList<> (); blocks.add (da); StringBuilder text = new StringBuilder (scenarioTitle + "\n\n"); @@ -132,7 +132,7 @@ class Header private void linkPictures (String title, DiskAddress da, DefaultMutableTreeNode headerNode) { - List blocks = new ArrayList (); + List blocks = new ArrayList<> (); blocks.add (da); byte[] buffer = owner.getDisk ().readSector (da); @@ -148,7 +148,7 @@ class Header private void linkSpells (String title, DiskAddress da, DefaultMutableTreeNode headerNode) { - List blocks = new ArrayList (); + List blocks = new ArrayList<> (); blocks.add (da); int level = 1; @@ -223,7 +223,7 @@ class Header dataOffset = buffer[offset + 48] & 0xFF; type = seq; - this.sectors = new ArrayList (totalBlocks); + this.sectors = new ArrayList<> (totalBlocks); for (int i = dataOffset, max = dataOffset + totalBlocks; i < max; i++) if (i < sectors.size ()) this.sectors.add (sectors.get (i)); diff --git a/src/com/bytezone/diskbrowser/wizardry/MazeGridV5.java b/src/com/bytezone/diskbrowser/wizardry/MazeGridV5.java index 036603c..cc8a733 100644 --- a/src/com/bytezone/diskbrowser/wizardry/MazeGridV5.java +++ b/src/com/bytezone/diskbrowser/wizardry/MazeGridV5.java @@ -15,7 +15,7 @@ import com.bytezone.diskbrowser.utilities.HexFormatter; public class MazeGridV5 extends AbstractFile { private final MessageBlock messageBlock; - List grids = new ArrayList (); + List grids = new ArrayList<> (); int minX = 9999; int minY = 9999; int maxX = 0; diff --git a/src/com/bytezone/diskbrowser/wizardry/MazeLevel.java b/src/com/bytezone/diskbrowser/wizardry/MazeLevel.java index 6ab0476..19fd007 100755 --- a/src/com/bytezone/diskbrowser/wizardry/MazeLevel.java +++ b/src/com/bytezone/diskbrowser/wizardry/MazeLevel.java @@ -71,8 +71,8 @@ class MazeLevel extends AbstractFile { "", "Stairs", "Pit", "Chute", "Spinner", "Darkness", "Teleport", "Ouch", "Elevator", "Rock/Water", "Fizzle", "Message/Item", "Monster" }; - List messageList = new ArrayList (); - List monsterList = new ArrayList (); + List messageList = new ArrayList<> (); + List monsterList = new ArrayList<> (); text.append ("\n\nValue Index Contains Table\n"); for (int j = 0; j < 16; j++) diff --git a/src/com/bytezone/diskbrowser/wizardry/Message.java b/src/com/bytezone/diskbrowser/wizardry/Message.java index b2908a6..2b2866d 100755 --- a/src/com/bytezone/diskbrowser/wizardry/Message.java +++ b/src/com/bytezone/diskbrowser/wizardry/Message.java @@ -7,65 +7,65 @@ import com.bytezone.diskbrowser.applefile.AbstractFile; abstract class Message extends AbstractFile { - private static int nextId = 0; - protected String message; - private final int id; - private int totalLines; - List lines = new ArrayList (); + private static int nextId = 0; + protected String message; + private final int id; + private int totalLines; + List lines = new ArrayList<> (); - public Message (byte[] buffer) - { - super ("Message " + nextId, buffer); - this.id = nextId; + public Message (byte[] buffer) + { + super ("Message " + nextId, buffer); + this.id = nextId; - int recordLength = 42; - StringBuilder text = new StringBuilder (); + int recordLength = 42; + StringBuilder text = new StringBuilder (); - for (int ptr = 0; ptr < buffer.length; ptr += recordLength) - { - nextId++; - totalLines++; - String line = getLine (ptr); - text.append (line + "\n"); - lines.add (line); - } - text.deleteCharAt (text.length () - 1); - message = text.toString (); - } + for (int ptr = 0; ptr < buffer.length; ptr += recordLength) + { + nextId++; + totalLines++; + String line = getLine (ptr); + text.append (line + "\n"); + lines.add (line); + } + text.deleteCharAt (text.length () - 1); + message = text.toString (); + } - protected abstract String getLine (int offset); + protected abstract String getLine (int offset); - public boolean match (int messageNum) - { - if (id == messageNum) - return true; + public boolean match (int messageNum) + { + if (id == messageNum) + return true; - // this code is to allow for a bug in scenario #1 - if (messageNum > id && messageNum < (id + totalLines)) - return true; + // this code is to allow for a bug in scenario #1 + if (messageNum > id && messageNum < (id + totalLines)) + return true; - return false; - } + return false; + } - @Override - public String getText () - { - return message; - } + @Override + public String getText () + { + return message; + } - public String toHTMLString () - { - StringBuilder message = new StringBuilder (); - for (String line : lines) - message.append (" " + line + " 
"); - if (message.length () > 0) - for (int i = 0; i < 4; i++) - message.deleteCharAt (message.length () - 1); // remove
tag - return message.toString (); - } + public String toHTMLString () + { + StringBuilder message = new StringBuilder (); + for (String line : lines) + message.append (" " + line + " 
"); + if (message.length () > 0) + for (int i = 0; i < 4; i++) + message.deleteCharAt (message.length () - 1); // remove
tag + return message.toString (); + } - public static void resetMessageId () - { - nextId = 0; - } + public static void resetMessageId () + { + nextId = 0; + } } \ No newline at end of file diff --git a/src/com/bytezone/diskbrowser/wizardry/MessageBlock.java b/src/com/bytezone/diskbrowser/wizardry/MessageBlock.java index fe3e43a..f4f95bf 100644 --- a/src/com/bytezone/diskbrowser/wizardry/MessageBlock.java +++ b/src/com/bytezone/diskbrowser/wizardry/MessageBlock.java @@ -13,8 +13,7 @@ public class MessageBlock extends AbstractFile implements Iterable messageDataBlocks = - new ArrayList (); + private final List messageDataBlocks = new ArrayList<> (); public MessageBlock (byte[] buffer, Huffman huffman) { @@ -49,7 +48,7 @@ public class MessageBlock extends AbstractFile implements Iterable getMessageLines (int messageNo) { - List lines = new ArrayList (); + List lines = new ArrayList<> (); for (MessageDataBlock messageDataBlock : messageDataBlocks) { diff --git a/src/com/bytezone/diskbrowser/wizardry/MessageDataBlock.java b/src/com/bytezone/diskbrowser/wizardry/MessageDataBlock.java index 04cbec2..107ecfc 100644 --- a/src/com/bytezone/diskbrowser/wizardry/MessageDataBlock.java +++ b/src/com/bytezone/diskbrowser/wizardry/MessageDataBlock.java @@ -12,7 +12,7 @@ public class MessageDataBlock extends AbstractFile final int lastMessageNo; private final int groupCount; - private final List messages = new ArrayList (); + private final List messages = new ArrayList<> (); private final Huffman huffman; diff --git a/src/com/bytezone/diskbrowser/wizardry/Monster.java b/src/com/bytezone/diskbrowser/wizardry/Monster.java index ccb9a18..7972d0d 100755 --- a/src/com/bytezone/diskbrowser/wizardry/Monster.java +++ b/src/com/bytezone/diskbrowser/wizardry/Monster.java @@ -33,7 +33,7 @@ class Monster extends AbstractFile implements Comparable int resistance; int abilities; public final Dice groupSize, hitPoints; - List damage = new ArrayList (); + List damage = new ArrayList<> (); static int counter = 0; static boolean debug = true; @@ -45,18 +45,25 @@ class Monster extends AbstractFile implements Comparable { "Fighter", "Mage", "Priest", "Thief", "Midget", "Giant", "Mythical", "Dragon", "Animal", "Were", "Undead", "Demon", "Insect", "Enchanted" }; - private static int[] experience = - { 55, 235, 415, 230, 380, 620, 840, 520, 550, 350, // 00-09 - 475, 515, 920, 600, 735, 520, 795, 780, 990, 795, // 10-19 - 1360, 1320, 1275, 680, 960, 600, 755, 1120, 2075, 870, // 20-29 - 960, 1120, 1120, 2435, 1080, 2280, 975, 875, 1135, 1200, // 30-39 - 620, 740, 1460, 1245, 960, 1405, 1040, 1220, 1520, 1000, // 40-49 - 960, 2340, 2160, 2395, 790, 1140, 1235, 1790, 1720, 2240, // 50-59 - 1475, 1540, 1720, 1900, 1240, 1220, 1020, 20435, 5100, 3515, // 60-69 - 2115, 2920, 2060, 2140, 1400, 1640, 1280, 4450, 42840, 3300, // 70-79 - 40875, 5000, 3300, 2395, 1935, 1600, 3330, 44090, 40840, 5200, // 80-89 - 4155, 3000, 9200, 3160, 7460, 7320, 15880, 1600, 2200, 1000, 1900 // 90-100 - }; + private static int[] experience = { 55, 235, 415, 230, 380, 620, 840, 520, 550, 350, // 00-09 + 475, 515, 920, 600, 735, 520, 795, 780, 990, 795, // 10-19 + 1360, 1320, 1275, 680, 960, 600, 755, 1120, 2075, + 870, // 20-29 + 960, 1120, 1120, 2435, 1080, 2280, 975, 875, 1135, + 1200, // 30-39 + 620, 740, 1460, 1245, 960, 1405, 1040, 1220, 1520, + 1000, // 40-49 + 960, 2340, 2160, 2395, 790, 1140, 1235, 1790, 1720, + 2240, // 50-59 + 1475, 1540, 1720, 1900, 1240, 1220, 1020, 20435, + 5100, 3515, // 60-69 + 2115, 2920, 2060, 2140, 1400, 1640, 1280, 4450, + 42840, 3300, // 70-79 + 40875, 5000, 3300, 2395, 1935, 1600, 3330, 44090, + 40840, 5200, // 80-89 + 4155, 3000, 9200, 3160, 7460, 7320, 15880, 1600, + 2200, 1000, 1900 // 90-100 + }; public Monster (String name, byte[] buffer, List rewards, List monsters) diff --git a/src/com/bytezone/diskbrowser/wizardry/Relocator.java b/src/com/bytezone/diskbrowser/wizardry/Relocator.java index 7d5ac12..f3453d3 100644 --- a/src/com/bytezone/diskbrowser/wizardry/Relocator.java +++ b/src/com/bytezone/diskbrowser/wizardry/Relocator.java @@ -12,7 +12,7 @@ import com.bytezone.diskbrowser.utilities.HexFormatter; public class Relocator extends AbstractFile { private final int checkByte; - private final List diskRecords = new ArrayList (); + private final List diskRecords = new ArrayList<> (); private final int[] diskBlocks = new int[0x800]; private final int[] diskOffsets = new int[0x800]; @@ -92,7 +92,7 @@ public class Relocator extends AbstractFile text.append ("\n"); } - List lines = new ArrayList (); + List lines = new ArrayList<> (); String heading = " Logical Size Disk Physical"; String underline = "--------- ---- ---- ---------"; @@ -153,7 +153,7 @@ public class Relocator extends AbstractFile { int diskNumber; int totDiskSegments; - List diskSegments = new ArrayList (); + List diskSegments = new ArrayList<> (); public DiskRecord (byte[] buffer, int ptr) { diff --git a/src/com/bytezone/diskbrowser/wizardry/Reward.java b/src/com/bytezone/diskbrowser/wizardry/Reward.java index 238b18e..8a40c30 100755 --- a/src/com/bytezone/diskbrowser/wizardry/Reward.java +++ b/src/com/bytezone/diskbrowser/wizardry/Reward.java @@ -13,8 +13,8 @@ class Reward extends AbstractFile int totalElements; List elements; List items; - List goldMonsters = new ArrayList (); - List chestMonsters = new ArrayList (); + List goldMonsters = new ArrayList<> (); + List chestMonsters = new ArrayList<> (); public Reward (String name, byte[] buffer, int id, List items) { @@ -22,7 +22,7 @@ class Reward extends AbstractFile this.id = id; this.items = items; totalElements = buffer[4]; - elements = new ArrayList (totalElements); + elements = new ArrayList<> (totalElements); for (int i = 0; i < totalElements; i++) { @@ -128,8 +128,7 @@ class Reward extends AbstractFile for (int j = 0; j < lineItem.length; j++) lineItem[j] = i + j <= max ? items.get (i + j).getName () : ""; text.append (String.format ("%-17s %-16s %-16s %-16s %-16s%n", lineTitle, - lineItem[0], lineItem[1], lineItem[2], - lineItem[3])); + lineItem[0], lineItem[1], lineItem[2], lineItem[3])); } break; default: diff --git a/src/com/bytezone/diskbrowser/wizardry/Wiz4Monsters.java b/src/com/bytezone/diskbrowser/wizardry/Wiz4Monsters.java index 88215d4..98a4068 100644 --- a/src/com/bytezone/diskbrowser/wizardry/Wiz4Monsters.java +++ b/src/com/bytezone/diskbrowser/wizardry/Wiz4Monsters.java @@ -8,8 +8,8 @@ import com.bytezone.diskbrowser.utilities.HexFormatter; public class Wiz4Monsters extends AbstractFile { - final List images = new ArrayList (); - final List blocks = new ArrayList (); + final List images = new ArrayList<> (); + final List blocks = new ArrayList<> (); public Wiz4Monsters (String name, byte[] buffer) { diff --git a/src/com/bytezone/diskbrowser/wizardry/Wiz5Monsters.java b/src/com/bytezone/diskbrowser/wizardry/Wiz5Monsters.java index 796fede..c99573a 100644 --- a/src/com/bytezone/diskbrowser/wizardry/Wiz5Monsters.java +++ b/src/com/bytezone/diskbrowser/wizardry/Wiz5Monsters.java @@ -11,7 +11,7 @@ import com.bytezone.diskbrowser.utilities.HexFormatter; public class Wiz5Monsters extends AbstractFile implements Iterable { private static final int BLOCK_SIZE = 512; - private final List monsters = new ArrayList (); + private final List monsters = new ArrayList<> (); public Wiz5Monsters (String name, byte[] buffer) { @@ -93,7 +93,7 @@ public class Wiz5Monsters extends AbstractFile implements Iterable dataBuffers = new ArrayList (); + private final List dataBuffers = new ArrayList<> (); private Wiz4Image image; private byte[] data; @@ -130,7 +130,7 @@ public class Wiz5Monsters extends AbstractFile implements Iterable getBlocks () { - List blocks = new ArrayList (); + List blocks = new ArrayList<> (); for (DataBuffer dataBuffer : dataBuffers) blocks.add (dataBuffer.block); return blocks; diff --git a/src/com/bytezone/diskbrowser/wizardry/Wizardry4BootDisk.java b/src/com/bytezone/diskbrowser/wizardry/Wizardry4BootDisk.java index 19737ae..660da35 100644 --- a/src/com/bytezone/diskbrowser/wizardry/Wizardry4BootDisk.java +++ b/src/com/bytezone/diskbrowser/wizardry/Wizardry4BootDisk.java @@ -20,7 +20,7 @@ import com.bytezone.diskbrowser.wizardry.Header.ScenarioData; public class Wizardry4BootDisk extends PascalDisk { public Header scenarioHeader; - // private final List disks = new ArrayList (); + // private final List disks = new ArrayList<> (); private Relocator relocator; private MessageBlock messageBlock; private Huffman huffman; @@ -78,7 +78,7 @@ public class Wizardry4BootDisk extends PascalDisk int count = 0; for (MessageDataBlock mdb : messageBlock) { - List messageBlocks = new ArrayList (); + List messageBlocks = new ArrayList<> (); messageBlocks.add (blocks.get (count++)); addToNode (mdb, messagesNode, messageBlocks); } @@ -145,7 +145,7 @@ public class Wizardry4BootDisk extends PascalDisk int count = 0; for (Wiz4Image image : w4monsters.images) { - List monsterBlocks = new ArrayList (); + List monsterBlocks = new ArrayList<> (); monsterBlocks.add (pictureBlocks.get (w4monsters.blocks.get (count++))); addToNode (image, monstersNode, monsterBlocks); } @@ -162,7 +162,7 @@ public class Wizardry4BootDisk extends PascalDisk for (Wiz5Monsters.Monster monster : w5monsters) { - List monsterBlocks = new ArrayList (); + List monsterBlocks = new ArrayList<> (); for (Integer blockId : monster.getBlocks ()) monsterBlocks.add (pictureBlocks.get (blockId)); addToNode (monster.getImage (), monstersNode, monsterBlocks); @@ -183,7 +183,7 @@ public class Wizardry4BootDisk extends PascalDisk int offset = mazeData.dataOffset * 512 + i * 1024; System.arraycopy (buffer, offset, level, 0, level.length); - List mazeBlocks = new ArrayList (); + List mazeBlocks = new ArrayList<> (); int ptr = mazeData.dataOffset + i * 2; mazeBlocks.add (blocks.get (ptr)); mazeBlocks.add (blocks.get (ptr + 1)); @@ -197,7 +197,7 @@ public class Wizardry4BootDisk extends PascalDisk List blocks = fileEntry.getSectors (); DefaultMutableTreeNode mazeNode = linkNode ("Maze", "Level 5 mazes", scenarioNode); - List allMazeBlocks = new ArrayList (); + List allMazeBlocks = new ArrayList<> (); int dataSize = 0x39A; int base = 0x1800; @@ -209,7 +209,7 @@ public class Wizardry4BootDisk extends PascalDisk System.arraycopy (buffer, offset + 0x2000, data, 0x400, dataSize); MazeGridV5 grid = new MazeGridV5 ("Maze level " + (i + 1), data, messageBlock); - List mazeBlocks = new ArrayList (); + List mazeBlocks = new ArrayList<> (); for (int j = 0; j < 4; j++) mazeBlocks.add (blocks.get (12 + i * 4 + j)); allMazeBlocks.addAll (mazeBlocks); @@ -227,7 +227,7 @@ public class Wizardry4BootDisk extends PascalDisk List blocks = fileEntry.getSectors (); StringBuilder text = new StringBuilder (); - List allBlocks = new ArrayList (); + List allBlocks = new ArrayList<> (); for (int i = 0; i < 23; i++) { allBlocks.add (blocks.get (44 + i)); @@ -254,7 +254,7 @@ public class Wizardry4BootDisk extends PascalDisk List blocks = fileEntry.getSectors (); StringBuilder text = new StringBuilder (); - List allBlocks = new ArrayList (); + List allBlocks = new ArrayList<> (); for (int i = 0; i < 19; i++) { allBlocks.add (blocks.get (87 + i)); @@ -296,7 +296,7 @@ public class Wizardry4BootDisk extends PascalDisk messageBlock.getMessageText (key))); } - List allOracleBlocks = new ArrayList (); + List allOracleBlocks = new ArrayList<> (); for (int i = 0; i < 20; i++) { allOracleBlocks.add (blocks.get (67 + i)); diff --git a/src/com/bytezone/diskbrowser/wizardry/WizardryScenarioDisk.java b/src/com/bytezone/diskbrowser/wizardry/WizardryScenarioDisk.java index 9af8e36..ed6672b 100755 --- a/src/com/bytezone/diskbrowser/wizardry/WizardryScenarioDisk.java +++ b/src/com/bytezone/diskbrowser/wizardry/WizardryScenarioDisk.java @@ -168,9 +168,9 @@ public class WizardryScenarioDisk extends PascalDisk private void extractRewards (DefaultMutableTreeNode node, List sectors) { - List nodeSectors = new ArrayList (); + List nodeSectors = new ArrayList<> (); ScenarioData sd = scenarioHeader.data.get (Header.TREASURE_TABLE_AREA); - rewards = new ArrayList (sd.total); + rewards = new ArrayList<> (sd.total); int max = sd.totalBlocks / 2; int seq = 0; @@ -210,9 +210,9 @@ public class WizardryScenarioDisk extends PascalDisk private void extractCharacters (DefaultMutableTreeNode node, List sectors) { - List nodeSectors = new ArrayList (); + List nodeSectors = new ArrayList<> (); ScenarioData sd = scenarioHeader.data.get (Header.CHARACTER_AREA); - characters = new ArrayList (sd.total); + characters = new ArrayList<> (sd.total); int max = sd.totalBlocks / 2; if (max < sd.total) System.out.println ("Characters short in Wizardry disk"); @@ -271,9 +271,9 @@ public class WizardryScenarioDisk extends PascalDisk private void extractMonsters (DefaultMutableTreeNode node, List sectors) { - List nodeSectors = new ArrayList (); + List nodeSectors = new ArrayList<> (); ScenarioData sd = scenarioHeader.data.get (Header.MONSTER_AREA); - monsters = new ArrayList (sd.total); + monsters = new ArrayList<> (sd.total); int max = sd.totalBlocks / 2; for (int i = 0; i < max; i++) @@ -324,9 +324,9 @@ public class WizardryScenarioDisk extends PascalDisk private void extractItems (DefaultMutableTreeNode node, List sectors) { - List nodeSectors = new ArrayList (); + List nodeSectors = new ArrayList<> (); ScenarioData sd = scenarioHeader.data.get (Header.ITEM_AREA); - items = new ArrayList (sd.total); + items = new ArrayList<> (sd.total); int max = sd.totalBlocks / 2; for (int i = 0; i < max; i++) @@ -376,8 +376,8 @@ public class WizardryScenarioDisk extends PascalDisk private void extractSpells (DefaultMutableTreeNode node, List sectors) { - spells = new ArrayList (); - ArrayList blocks = new ArrayList (2); + spells = new ArrayList<> (); + List blocks = new ArrayList<> (2); int offset = scenarioHeader.scenarioID <= 2 ? 4 : 1; blocks.add (sectors.get (offset)); blocks.add (sectors.get (offset + 1)); @@ -413,7 +413,7 @@ public class WizardryScenarioDisk extends PascalDisk private void extractMessages (DefaultMutableTreeNode node, List sectors) { Message.resetMessageId (); - messages = new ArrayList (); + messages = new ArrayList<> (); // Copy first 504 bytes from each sector to a single contiguous buffer int recordLength = 42; @@ -450,7 +450,7 @@ public class WizardryScenarioDisk extends PascalDisk m = new CodedMessage (newBuffer); messages.add (m); - List messageBlocks = new ArrayList (); + List messageBlocks = new ArrayList<> (); int lastBlock = -1; for (int p2 = messageStart; p2 < messageEnd; p2 += recordLength) { @@ -471,9 +471,9 @@ public class WizardryScenarioDisk extends PascalDisk private void extractLevels (DefaultMutableTreeNode node, List sectors) { - List nodeSectors = new ArrayList (); + List nodeSectors = new ArrayList<> (); ScenarioData sd = scenarioHeader.data.get (Header.MAZE_AREA); - levels = new ArrayList (sd.total); + levels = new ArrayList<> (sd.total); int max = sd.totalBlocks / 2; for (int i = 0; i < max; i++) @@ -505,10 +505,10 @@ public class WizardryScenarioDisk extends PascalDisk private void extractImages (DefaultMutableTreeNode node, List sectors) { - List nodeSectors = new ArrayList (); + List nodeSectors = new ArrayList<> (); ScenarioData sd = scenarioHeader.data.get (Header.IMAGE_AREA); int max = sd.totalBlocks; - images = new ArrayList (); + images = new ArrayList<> (); for (int i = 0; i < max; i++) { @@ -545,9 +545,9 @@ public class WizardryScenarioDisk extends PascalDisk private void extractExperienceLevels (DefaultMutableTreeNode node, List sectors) { - List nodeSectors = new ArrayList (); + List nodeSectors = new ArrayList<> (); ScenarioData sd = scenarioHeader.data.get (Header.EXPERIENCE_AREA); - experiences = new ArrayList (sd.total); + experiences = new ArrayList<> (sd.total); int max = sd.totalBlocks / 2; for (int i = 0; i < max; i++) @@ -576,7 +576,7 @@ public class WizardryScenarioDisk extends PascalDisk private void addToNode (AbstractFile af, DefaultMutableTreeNode node, DiskAddress block, SectorType type) { - ArrayList blocks = new ArrayList (1); + List blocks = new ArrayList<> (1); blocks.add (block); addToNode (af, node, blocks, type); } @@ -594,7 +594,7 @@ public class WizardryScenarioDisk extends PascalDisk private List getTwoBlocks (ScenarioData sd, int i, List sectors) { - ArrayList blocks = new ArrayList (2); + List blocks = new ArrayList<> (2); blocks.add (sectors.get (sd.dataOffset + i * 2)); blocks.add (sectors.get (sd.dataOffset + i * 2 + 1)); return blocks;