Diamond mining

This commit is contained in:
Denis Molony 2020-02-02 20:17:49 +10:00
parent befdf002f1
commit 644540668c
54 changed files with 279 additions and 237 deletions

View File

@ -470,7 +470,7 @@ public class ApplesoftBasicProgram extends BasicProgram
private class SourceLine
{
List<SubLine> sublines = new ArrayList<SubLine> ();
List<SubLine> sublines = new ArrayList<> ();
int lineNumber;
int linePtr;
int length;

View File

@ -201,10 +201,9 @@ public class AssemblerProgram extends AbstractFile
private List<AssemblerStatement> getLines ()
{
List<AssemblerStatement> lines = new ArrayList<AssemblerStatement> ();
Map<Integer, AssemblerStatement> linesMap =
new HashMap<Integer, AssemblerStatement> ();
List<Integer> targets = new ArrayList<Integer> ();
List<AssemblerStatement> lines = new ArrayList<> ();
Map<Integer, AssemblerStatement> linesMap = new HashMap<> ();
List<Integer> targets = new ArrayList<> ();
int ptr = executeOffset;
int address = loadAddress + executeOffset;

View File

@ -15,7 +15,7 @@ public class FileTypeDescriptorTable extends AbstractFile
int indexRecordSize;
int offsetToIdx;
private final List<IndexRecord> indexRecords = new ArrayList<IndexRecord> ();
private final List<IndexRecord> indexRecords = new ArrayList<> ();
public FileTypeDescriptorTable (String name, byte[] buffer)
{

View File

@ -10,7 +10,7 @@ import com.bytezone.diskbrowser.utilities.HexFormatter;
public class PascalCode extends AbstractFile
implements PascalConstants, Iterable<PascalSegment>
{
private final List<PascalSegment> segments = new ArrayList<PascalSegment> (16);
private final List<PascalSegment> segments = new ArrayList<> (16);
private final String comment;
// private final int blockOffset;
// private final Relocator relocator;

View File

@ -20,7 +20,7 @@ public class PascalCodeStatement implements PascalConstants
int ptr; // temp
byte[] buffer;
boolean jumpTarget;
List<Jump> jumps = new ArrayList<Jump> ();
List<Jump> jumps = new ArrayList<> ();
public PascalCodeStatement (byte[] buffer, int ptr, int procPtr)
{

View File

@ -12,7 +12,7 @@ import com.bytezone.diskbrowser.utilities.HexFormatter;
public class SHRPictureFile1 extends HiResImage
// -----------------------------------------------------------------------------------//
{
private final List<Block> blocks = new ArrayList<Block> ();
private final List<Block> blocks = new ArrayList<> ();
private Main mainBlock;
private Multipal multipalBlock;
private final boolean debug = false;

View File

@ -7,7 +7,7 @@ import com.bytezone.diskbrowser.utilities.HexFormatter;
public class SimpleText2 extends AbstractFile
{
List<Integer> lineStarts = new ArrayList<Integer> ();
List<Integer> lineStarts = new ArrayList<> ();
int loadAddress;
boolean showByte = false;

View File

@ -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<Report> reports = new ArrayList<Report> ();
final List<Record> records = new ArrayList<Record> ();
private final List<Report> reports = new ArrayList<> ();
final List<Record> records = new ArrayList<> ();
private final Record standardRecord;
public AppleworksADBFile (String name, byte[] buffer)

View File

@ -9,7 +9,7 @@ import com.bytezone.diskbrowser.utilities.HexFormatter;
public class AppleworksSSFile extends AbstractFile
{
Header header;
List<Row> rows = new ArrayList<Row> ();
List<Row> 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<Cell> cells = new ArrayList<Cell> ();
private final List<Cell> cells = new ArrayList<> ();
public Row (int ptr)
{

View File

@ -11,7 +11,7 @@ class Record
{
AppleworksADBFile parent;
int length;
List<String> items = new ArrayList<String> ();
List<String> items = new ArrayList<> ();
Map<Integer, Double> calculatedItems = new HashMap<Integer, Double> ();// move to TableReport
public Record (AppleworksADBFile parent, byte[] buffer, int ptr)

View File

@ -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<DirectoryEntry> entries = new ArrayList<DirectoryEntry> ();
private final List<DiskAddress> blocks = new ArrayList<DiskAddress> ();
private final List<DirectoryEntry> entries = new ArrayList<> ();
private final List<DiskAddress> blocks = new ArrayList<> ();
private final boolean readOnly;
private final boolean systemFile;

View File

@ -533,7 +533,7 @@ public class AppleDisk implements Disk
@Override
public List<DiskAddress> getDiskAddressList (int... blocks)
{
List<DiskAddress> addressList = new ArrayList<DiskAddress> ();
List<DiskAddress> addressList = new ArrayList<> ();
for (int block : blocks)
{
@ -696,7 +696,7 @@ public class AppleDisk implements Disk
{
if (blockList == null)
{
blockList = new ArrayList<DiskAddress> (blocks);
blockList = new ArrayList<> (blocks);
for (int block = 0; block < blocks; block++)
blockList.add (new AppleDiskAddress (this, block));
}

View File

@ -10,7 +10,7 @@ public class SectorListConverter
public SectorListConverter (String text, Disk disk)
{
sectors = new ArrayList<DiskAddress> ();
sectors = new ArrayList<> ();
sectorText = text;
String[] blocks = text.split (";");

View File

@ -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<DiskAddress> dataSectors = new ArrayList<DiskAddress> ();
protected final List<DiskAddress> tsSectors = new ArrayList<DiskAddress> ();
protected final List<DiskAddress> dataSectors = new ArrayList<> ();
protected final List<DiskAddress> tsSectors = new ArrayList<> ();
private CatalogEntry link;
@ -355,7 +370,7 @@ abstract class AbstractCatalogEntry implements AppleFileSource
@Override
public List<DiskAddress> getSectors ()
{
List<DiskAddress> sectors = new ArrayList<DiskAddress> ();
List<DiskAddress> sectors = new ArrayList<> ();
sectors.add (catalogSectorDA);
sectors.addAll (tsSectors);
sectors.addAll (dataSectors);

View File

@ -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<AppleFileSource> deletedFileEntries = new ArrayList<AppleFileSource> ();
protected List<AppleFileSource> deletedFileEntries = new ArrayList<> ();
enum FileType
{

View File

@ -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<DiskDetails> lines = new ArrayList<DiskDetails> ();
private List<DiskDetails> lines = new ArrayList<> ();
private final JButton btnHide = new JButton ("Close");
private final RootFolderData rootFolderData;

View File

@ -16,8 +16,8 @@ public class DiskDetails
private final String type;
private final long size;
private final List<DiskDetails> duplicateChecksums = new ArrayList<DiskDetails> ();
private final List<DiskDetails> duplicateNames = new ArrayList<DiskDetails> ();
private final List<DiskDetails> duplicateChecksums = new ArrayList<> ();
private final List<DiskDetails> duplicateNames = new ArrayList<> ();
private boolean isDuplicateName;
private boolean isDuplicateChecksum;

View File

@ -10,7 +10,7 @@ public class DiskTableModel extends AbstractTableModel
static final String[] headers =
{ "Path", "Name", "Type", "Size", "# names", "Checksum", "# checksums" };
private final List<TableLine> lines = new ArrayList<DiskTableModel.TableLine> ();
private final List<TableLine> lines = new ArrayList<> ();
private final RootFolderData rootFolderData;
public DiskTableModel (RootFolderData rootFolderData)

View File

@ -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<JCheckBox> boxes = new ArrayList<JCheckBox> ();
private final List<JCheckBox> boxes = new ArrayList<> ();
private TableRowSorter<DiskTableModel> sorter;
private final CheckBoxActionListener checkBoxActionListener =
new CheckBoxActionListener ();

View File

@ -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<DiskTableSelectionListener> listeners =
new ArrayList<DiskTableSelectionListener> ();
public final List<DiskTableSelectionListener> listeners = new ArrayList<> ();
public boolean doChecksums;
@ -196,7 +200,7 @@ public class RootFolderData implements RootDirectoryChangeListener
public List<DiskDetails> listDuplicates (long checksum)
{
List<DiskDetails> list = new ArrayList<DiskDetails> ();
List<DiskDetails> list = new ArrayList<> ();
DiskDetails original = checksumMap.get (checksum);
if (original != null)
{

View File

@ -35,7 +35,7 @@ abstract class AbstractTab extends JPanel implements Tab
// -----------------------------------------------------------------------------------//
{
private final static Cursor handCursor = new Cursor (Cursor.HAND_CURSOR);
private final List<MouseAdapter> adapters = new ArrayList<MouseAdapter> ();
private final List<MouseAdapter> adapters = new ArrayList<> ();
private Font font;
private final JScrollPane scrollPane;
final DiskAndFileSelector eventHandler;

View File

@ -18,7 +18,7 @@ class DiskLayoutSelection implements Iterable<DiskAddress>
public DiskLayoutSelection ()
{
highlights = new ArrayList<DiskAddress> ();
highlights = new ArrayList<> ();
}
public void doClick (Disk disk, DiskAddress da, boolean extend, boolean append)
@ -136,7 +136,7 @@ class DiskLayoutSelection implements Iterable<DiskAddress>
// This must return a copy, or the redo function will get very confused
public List<DiskAddress> getHighlights ()
{
return new ArrayList<DiskAddress> (highlights);
return new ArrayList<> (highlights);
}
public boolean isSelected (DiskAddress da)

View File

@ -29,7 +29,7 @@ class Abbreviations extends InfocomAbstractFile
private void populate ()
{
list = new ArrayList<ZString> ();
list = new ArrayList<> ();
for (int i = header.abbreviationsTable; i < header.objectTableOffset; i += 2)
list.add (new ZString (header, header.getWord (i) * 2));

View File

@ -50,7 +50,7 @@ class Dictionary extends AbstractFile
List<WordEntry> wordEntryList = synonymList.get (wordEntry.key);
if (wordEntryList == null)
{
wordEntryList = new ArrayList<WordEntry> ();
wordEntryList = new ArrayList<> ();
synonymList.put (wordEntry.key, wordEntryList);
}
wordEntryList.add (wordEntry);
@ -143,7 +143,7 @@ class Dictionary extends AbstractFile
public List<String> getVerbs (int value)
{
List<String> words = new ArrayList<String> ();
List<String> words = new ArrayList<> ();
int ptr = dictionaryPtr + totalSeparators + 4;
for (ZString word : dictionary.values ())
@ -162,7 +162,7 @@ class Dictionary extends AbstractFile
public List<String> getPrepositions (int value)
{
List<String> words = new ArrayList<String> ();
List<String> words = new ArrayList<> ();
int ptr = dictionaryPtr + totalSeparators + 4;
for (ZString word : dictionary.values ())

View File

@ -8,7 +8,7 @@ import com.bytezone.diskbrowser.utilities.HexFormatter;
public class InfocomAbstractFile extends AbstractFile
{
protected List<HexBlock> hexBlocks = new ArrayList<HexBlock> ();
protected List<HexBlock> hexBlocks = new ArrayList<> ();
public InfocomAbstractFile (String name, byte[] buffer)
{

View File

@ -70,7 +70,7 @@ public class InfocomDisk extends AbstractFormattedDisk
headerNode = addToTree (root, "Header", header, TYPE_LEAF);
DefaultAppleFileSource dafs = (DefaultAppleFileSource) headerNode.getUserObject ();
List<DiskAddress> blocks = new ArrayList<DiskAddress> ();
List<DiskAddress> 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<DiskAddress> blocks = new ArrayList<DiskAddress> ();
List<DiskAddress> blocks = new ArrayList<> ();
int blockNo = sectorFrom / disk.getBlockSize () + 48;
int blockTo = sectorTo / disk.getBlockSize () + 48;

View File

@ -123,7 +123,7 @@ class ObjectAnalyser
int propertyNumber;
int lo;
int hi;
List<Integer> offsets = new ArrayList<Integer> ();
List<Integer> offsets = new ArrayList<> ();
public Statistics (int propertyNumber)
{

View File

@ -32,7 +32,7 @@ class ObjectManager extends InfocomAbstractFile implements Iterable<ZObject>
propertySize = header.globalsOffset - propertyPtr;
tableSize = (propertyPtr - tablePtr);
int totalObjects = tableSize / ZObject.HEADER_SIZE;
list = new ArrayList<ZObject> (tableSize);
list = new ArrayList<> (tableSize);
for (int objectNo = 0; objectNo < totalObjects; objectNo++)
list.add (new ZObject (null, buffer, tablePtr + objectNo * ZObject.HEADER_SIZE,

View File

@ -11,7 +11,7 @@ import com.bytezone.diskbrowser.disk.FormattedDisk;
class PropertyManager extends AbstractFile
{
List<Statistic> list = new ArrayList<Statistic> ();
List<Statistic> 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<ZObject> list = new ArrayList<ZObject> ();
List<ZObject> list = new ArrayList<> ();
public Statistic (int id)
{

View File

@ -9,7 +9,7 @@ import com.bytezone.diskbrowser.infocom.ZObject.Property;
class PropertyTester implements Iterable<Integer>
{
List<ZObject> objects;
List<Condition> conditions = new ArrayList<Condition> ();
List<Condition> conditions = new ArrayList<> ();
List<Integer> matchedProperties;
public PropertyTester (List<ZObject> objects)
@ -26,7 +26,7 @@ class PropertyTester implements Iterable<Integer>
{
boolean[] propFail = new boolean[32];
int[] propTestCount = new int[32];
matchedProperties = new ArrayList<Integer> ();
matchedProperties = new ArrayList<> ();
for (ZObject object : objects)
propertyLoop: for (Property property : object.properties)

View File

@ -13,12 +13,12 @@ class Routine extends InfocomAbstractFile
{
int startPtr, length, strings, locals;
List<Parameter> parameters = new ArrayList<Parameter> ();
List<Instruction> instructions = new ArrayList<Instruction> ();
List<Integer> calls = new ArrayList<Integer> ();
List<Integer> calledBy = new ArrayList<Integer> ();
List<Integer> actions = new ArrayList<Integer> (); // not used yet
List<Integer> targets = new ArrayList<Integer> ();
List<Parameter> parameters = new ArrayList<> ();
List<Instruction> instructions = new ArrayList<> ();
List<Integer> calls = new ArrayList<> ();
List<Integer> calledBy = new ArrayList<> ();
List<Integer> actions = new ArrayList<> (); // not used yet
List<Integer> targets = new ArrayList<> ();
public Routine (int ptr, Header header, int caller)
{

View File

@ -19,7 +19,7 @@ class ZObject extends AbstractFile implements Comparable<ZObject>
private final int propertyTableLength;
final int parent, sibling, child;
final List<Property> properties = new ArrayList<Property> ();
final List<Property> properties = new ArrayList<> ();
final BitSet attributes = new BitSet (32);
public ZObject (String name, byte[] buffer, int offset, int id, Header header)

View File

@ -8,7 +8,7 @@ class LZW
static protected final String[] st = new String[0x1000];
static protected final int TRACK_LENGTH = 0x1000;
protected final List<byte[]> chunks = new ArrayList<byte[]> ();
protected final List<byte[]> chunks = new ArrayList<> ();
protected int volume;
protected byte runLengthChar;
protected int crc;

View File

@ -17,8 +17,8 @@ public class NuFX
private final byte[] buffer;
private final boolean debug = false;
private final List<Record> records = new ArrayList<Record> ();
private final List<Thread> threads = new ArrayList<Thread> ();
private final List<Record> records = new ArrayList<> ();
private final List<Thread> threads = new ArrayList<> ();
public NuFX (Path path) throws FileFormatException, IOException
{

View File

@ -20,7 +20,7 @@ public abstract class AbstractValue implements Value
protected boolean bool;
protected ValueResult valueResult = ValueResult.VALID;
protected List<Value> values = new ArrayList<Value> ();
protected List<Value> values = new ArrayList<> ();
public AbstractValue (Cell cell, String text)
{

View File

@ -6,7 +6,7 @@ import java.util.List;
public class ConditionList implements Iterable<Value>
{
private final List<Value> conditions = new ArrayList<Value> ();
private final List<Value> conditions = new ArrayList<> ();
public ConditionList (Cell cell, String text)
{

View File

@ -5,8 +5,8 @@ import java.util.List;
class Expression extends AbstractValue
{
private final List<String> operators = new ArrayList<String> ();
private final List<String> signs = new ArrayList<String> ();
private final List<String> operators = new ArrayList<> ();
private final List<String> signs = new ArrayList<> ();
public Expression (Cell cell, String text)
{

View File

@ -14,7 +14,7 @@ class Range implements Iterable<Address>
// private static final Pattern addressList = Pattern.compile ("\\(([^,]+(,[^,]+)*)\\)");
private Address from, to;
private final List<Address> range = new ArrayList<Address> ();
private final List<Address> range = new ArrayList<> ();
private final Cell cell;
private boolean isHorizontal;

View File

@ -19,7 +19,7 @@ public class Sheet
private final Map<Integer, Cell> rowOrderCells = new TreeMap<Integer, Cell> ();
private final Map<Integer, Cell> columnOrderCells = new TreeMap<Integer, Cell> ();
private final List<String> lines = new ArrayList<String> ();
private final List<String> lines = new ArrayList<> ();
private final Map<Integer, Integer> columnWidths = new TreeMap<Integer, Integer> ();
private int columnWidth = 9;
@ -388,7 +388,7 @@ public class Sheet
if (debug)
{
List<String> counts = new ArrayList<String> ();
List<String> counts = new ArrayList<> ();
for (int i = 0; i < functionTotals.length; i++)
if (functionTotals[i] > 0)
{

View File

@ -6,7 +6,7 @@ import java.util.List;
public class ValueList implements Iterable<Value>
{
private final List<Value> values = new ArrayList<Value> ();
private final List<Value> values = new ArrayList<> ();
private boolean hasRange;
public ValueList (Cell cell, String text)

View File

@ -14,8 +14,8 @@ class Character extends AbstractFile
private final Statistics stats;
int scenario;
private final Collection<Spell> spellBook = new ArrayList<Spell> ();
private final Collection<Baggage> baggageList = new ArrayList<Baggage> ();
private final Collection<Spell> spellBook = new ArrayList<> ();
private final Collection<Baggage> baggageList = new ArrayList<> ();
static String[] races = { "No race", "Human", "Elf", "Dwarf", "Gnome", "Hobbit" };
static String[] alignments = { "Unalign", "Good", "Neutral", "Evil" };

View File

@ -30,7 +30,7 @@ class Header
String scenarioTitle;
public int scenarioID;
List<ScenarioData> data = new ArrayList<ScenarioData> (8);
List<ScenarioData> 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<DiskAddress> blocks = new ArrayList<DiskAddress> ();
List<DiskAddress> 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<DiskAddress> blocks = new ArrayList<DiskAddress> ();
List<DiskAddress> 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<DiskAddress> blocks = new ArrayList<DiskAddress> ();
List<DiskAddress> 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<DiskAddress> (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));

View File

@ -15,7 +15,7 @@ import com.bytezone.diskbrowser.utilities.HexFormatter;
public class MazeGridV5 extends AbstractFile
{
private final MessageBlock messageBlock;
List<MazeGrid> grids = new ArrayList<MazeGrid> ();
List<MazeGrid> grids = new ArrayList<> ();
int minX = 9999;
int minY = 9999;
int maxX = 0;

View File

@ -71,8 +71,8 @@ class MazeLevel extends AbstractFile
{ "", "Stairs", "Pit", "Chute", "Spinner", "Darkness", "Teleport", "Ouch",
"Elevator", "Rock/Water", "Fizzle", "Message/Item", "Monster" };
List<MazeAddress> messageList = new ArrayList<MazeAddress> ();
List<MazeAddress> monsterList = new ArrayList<MazeAddress> ();
List<MazeAddress> messageList = new ArrayList<> ();
List<MazeAddress> monsterList = new ArrayList<> ();
text.append ("\n\nValue Index Contains Table\n");
for (int j = 0; j < 16; j++)

View File

@ -11,7 +11,7 @@ abstract class Message extends AbstractFile
protected String message;
private final int id;
private int totalLines;
List<String> lines = new ArrayList<String> ();
List<String> lines = new ArrayList<> ();
public Message (byte[] buffer)
{

View File

@ -13,8 +13,7 @@ public class MessageBlock extends AbstractFile implements Iterable<MessageDataBl
private final int indexLength;
private String text;
private final List<MessageDataBlock> messageDataBlocks =
new ArrayList<MessageDataBlock> ();
private final List<MessageDataBlock> messageDataBlocks = new ArrayList<> ();
public MessageBlock (byte[] buffer, Huffman huffman)
{
@ -49,7 +48,7 @@ public class MessageBlock extends AbstractFile implements Iterable<MessageDataBl
public List<String> getMessageLines (int messageNo)
{
List<String> lines = new ArrayList<String> ();
List<String> lines = new ArrayList<> ();
for (MessageDataBlock messageDataBlock : messageDataBlocks)
{

View File

@ -12,7 +12,7 @@ public class MessageDataBlock extends AbstractFile
final int lastMessageNo;
private final int groupCount;
private final List<Message> messages = new ArrayList<Message> ();
private final List<Message> messages = new ArrayList<> ();
private final Huffman huffman;

View File

@ -33,7 +33,7 @@ class Monster extends AbstractFile implements Comparable<Monster>
int resistance;
int abilities;
public final Dice groupSize, hitPoints;
List<Dice> damage = new ArrayList<Dice> ();
List<Dice> damage = new ArrayList<> ();
static int counter = 0;
static boolean debug = true;
@ -45,17 +45,24 @@ class Monster extends AbstractFile implements Comparable<Monster>
{ "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
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
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<Reward> rewards,

View File

@ -12,7 +12,7 @@ import com.bytezone.diskbrowser.utilities.HexFormatter;
public class Relocator extends AbstractFile
{
private final int checkByte;
private final List<DiskRecord> diskRecords = new ArrayList<DiskRecord> ();
private final List<DiskRecord> 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<String> lines = new ArrayList<String> ();
List<String> 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<DiskSegment> diskSegments = new ArrayList<DiskSegment> ();
List<DiskSegment> diskSegments = new ArrayList<> ();
public DiskRecord (byte[] buffer, int ptr)
{

View File

@ -13,8 +13,8 @@ class Reward extends AbstractFile
int totalElements;
List<RewardElement> elements;
List<Item> items;
List<Monster> goldMonsters = new ArrayList<Monster> ();
List<Monster> chestMonsters = new ArrayList<Monster> ();
List<Monster> goldMonsters = new ArrayList<> ();
List<Monster> chestMonsters = new ArrayList<> ();
public Reward (String name, byte[] buffer, int id, List<Item> items)
{
@ -22,7 +22,7 @@ class Reward extends AbstractFile
this.id = id;
this.items = items;
totalElements = buffer[4];
elements = new ArrayList<RewardElement> (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:

View File

@ -8,8 +8,8 @@ import com.bytezone.diskbrowser.utilities.HexFormatter;
public class Wiz4Monsters extends AbstractFile
{
final List<Wiz4Image> images = new ArrayList<Wiz4Image> ();
final List<Integer> blocks = new ArrayList<Integer> ();
final List<Wiz4Image> images = new ArrayList<> ();
final List<Integer> blocks = new ArrayList<> ();
public Wiz4Monsters (String name, byte[] buffer)
{

View File

@ -11,7 +11,7 @@ import com.bytezone.diskbrowser.utilities.HexFormatter;
public class Wiz5Monsters extends AbstractFile implements Iterable<Wiz5Monsters.Monster>
{
private static final int BLOCK_SIZE = 512;
private final List<Monster> monsters = new ArrayList<Monster> ();
private final List<Monster> monsters = new ArrayList<> ();
public Wiz5Monsters (String name, byte[] buffer)
{
@ -93,7 +93,7 @@ public class Wiz5Monsters extends AbstractFile implements Iterable<Wiz5Monsters.
class Monster
{
private final int id;
private final List<DataBuffer> dataBuffers = new ArrayList<DataBuffer> ();
private final List<DataBuffer> dataBuffers = new ArrayList<> ();
private Wiz4Image image;
private byte[] data;
@ -130,7 +130,7 @@ public class Wiz5Monsters extends AbstractFile implements Iterable<Wiz5Monsters.
List<Integer> getBlocks ()
{
List<Integer> blocks = new ArrayList<Integer> ();
List<Integer> blocks = new ArrayList<> ();
for (DataBuffer dataBuffer : dataBuffers)
blocks.add (dataBuffer.block);
return blocks;

View File

@ -20,7 +20,7 @@ import com.bytezone.diskbrowser.wizardry.Header.ScenarioData;
public class Wizardry4BootDisk extends PascalDisk
{
public Header scenarioHeader;
// private final List<AppleDisk> disks = new ArrayList<AppleDisk> ();
// private final List<AppleDisk> 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<DiskAddress> messageBlocks = new ArrayList<DiskAddress> ();
List<DiskAddress> 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<DiskAddress> monsterBlocks = new ArrayList<DiskAddress> ();
List<DiskAddress> 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<DiskAddress> monsterBlocks = new ArrayList<DiskAddress> ();
List<DiskAddress> 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<DiskAddress> mazeBlocks = new ArrayList<DiskAddress> ();
List<DiskAddress> 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<DiskAddress> blocks = fileEntry.getSectors ();
DefaultMutableTreeNode mazeNode = linkNode ("Maze", "Level 5 mazes", scenarioNode);
List<DiskAddress> allMazeBlocks = new ArrayList<DiskAddress> ();
List<DiskAddress> 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<DiskAddress> mazeBlocks = new ArrayList<DiskAddress> ();
List<DiskAddress> 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<DiskAddress> blocks = fileEntry.getSectors ();
StringBuilder text = new StringBuilder ();
List<DiskAddress> allBlocks = new ArrayList<DiskAddress> ();
List<DiskAddress> 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<DiskAddress> blocks = fileEntry.getSectors ();
StringBuilder text = new StringBuilder ();
List<DiskAddress> allBlocks = new ArrayList<DiskAddress> ();
List<DiskAddress> 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<DiskAddress> allOracleBlocks = new ArrayList<DiskAddress> ();
List<DiskAddress> allOracleBlocks = new ArrayList<> ();
for (int i = 0; i < 20; i++)
{
allOracleBlocks.add (blocks.get (67 + i));

View File

@ -168,9 +168,9 @@ public class WizardryScenarioDisk extends PascalDisk
private void extractRewards (DefaultMutableTreeNode node, List<DiskAddress> sectors)
{
List<DiskAddress> nodeSectors = new ArrayList<DiskAddress> ();
List<DiskAddress> nodeSectors = new ArrayList<> ();
ScenarioData sd = scenarioHeader.data.get (Header.TREASURE_TABLE_AREA);
rewards = new ArrayList<Reward> (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<DiskAddress> sectors)
{
List<DiskAddress> nodeSectors = new ArrayList<DiskAddress> ();
List<DiskAddress> nodeSectors = new ArrayList<> ();
ScenarioData sd = scenarioHeader.data.get (Header.CHARACTER_AREA);
characters = new ArrayList<Character> (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<DiskAddress> sectors)
{
List<DiskAddress> nodeSectors = new ArrayList<DiskAddress> ();
List<DiskAddress> nodeSectors = new ArrayList<> ();
ScenarioData sd = scenarioHeader.data.get (Header.MONSTER_AREA);
monsters = new ArrayList<Monster> (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<DiskAddress> sectors)
{
List<DiskAddress> nodeSectors = new ArrayList<DiskAddress> ();
List<DiskAddress> nodeSectors = new ArrayList<> ();
ScenarioData sd = scenarioHeader.data.get (Header.ITEM_AREA);
items = new ArrayList<Item> (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<DiskAddress> sectors)
{
spells = new ArrayList<Spell> ();
ArrayList<DiskAddress> blocks = new ArrayList<DiskAddress> (2);
spells = new ArrayList<> ();
List<DiskAddress> 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<DiskAddress> sectors)
{
Message.resetMessageId ();
messages = new ArrayList<Message> ();
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<DiskAddress> messageBlocks = new ArrayList<DiskAddress> ();
List<DiskAddress> 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<DiskAddress> sectors)
{
List<DiskAddress> nodeSectors = new ArrayList<DiskAddress> ();
List<DiskAddress> nodeSectors = new ArrayList<> ();
ScenarioData sd = scenarioHeader.data.get (Header.MAZE_AREA);
levels = new ArrayList<MazeLevel> (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<DiskAddress> sectors)
{
List<DiskAddress> nodeSectors = new ArrayList<DiskAddress> ();
List<DiskAddress> nodeSectors = new ArrayList<> ();
ScenarioData sd = scenarioHeader.data.get (Header.IMAGE_AREA);
int max = sd.totalBlocks;
images = new ArrayList<AbstractImage> ();
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<DiskAddress> sectors)
{
List<DiskAddress> nodeSectors = new ArrayList<DiskAddress> ();
List<DiskAddress> nodeSectors = new ArrayList<> ();
ScenarioData sd = scenarioHeader.data.get (Header.EXPERIENCE_AREA);
experiences = new ArrayList<ExperienceLevel> (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<DiskAddress> blocks = new ArrayList<DiskAddress> (1);
List<DiskAddress> blocks = new ArrayList<> (1);
blocks.add (block);
addToNode (af, node, blocks, type);
}
@ -594,7 +594,7 @@ public class WizardryScenarioDisk extends PascalDisk
private List<DiskAddress> getTwoBlocks (ScenarioData sd, int i,
List<DiskAddress> sectors)
{
ArrayList<DiskAddress> blocks = new ArrayList<DiskAddress> (2);
List<DiskAddress> blocks = new ArrayList<> (2);
blocks.add (sectors.get (sd.dataOffset + i * 2));
blocks.add (sectors.get (sd.dataOffset + i * 2 + 1));
return blocks;