Skip to content

Commit

Permalink
fill in some generic types (#66)
Browse files Browse the repository at this point in the history
  • Loading branch information
elharo authored May 31, 2021
1 parent 80e16ac commit 382491c
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ public class RtfSink

private int charSet = DEFAULT_CHAR_SET;

private final Hashtable fontTable;
private final Hashtable<String, Font> fontTable;

private Context context;

Expand All @@ -189,9 +189,9 @@ public class RtfSink

private int listItemIndent;

private final Vector numbering;
private final Vector<Integer> numbering;

private final Vector itemNumber;
private final Vector<Counter> itemNumber;

private int style = STYLE_ROMAN;

Expand Down Expand Up @@ -220,7 +220,7 @@ public class RtfSink

/** Map of warn messages with a String as key to describe the error type and a Set as value.
* Using to reduce warn messages. */
private Map warnMessages;
private Map<String, Set<String>> warnMessages;

// -----------------------------------------------------------------------

Expand Down Expand Up @@ -252,14 +252,14 @@ protected RtfSink( OutputStream output )
*
* @param output not null
* @param encoding a valid charset
* @throws java.io.IOException if any.
* @throws java.io.IOException if any
*/
protected RtfSink( OutputStream output, String encoding )
throws IOException
{
this.fontTable = new Hashtable();
this.numbering = new Vector();
this.itemNumber = new Vector();
this.fontTable = new Hashtable<>();
this.numbering = new Vector<>();
this.itemNumber = new Vector<>();

Writer w;
this.stream = new BufferedOutputStream( output );
Expand Down Expand Up @@ -1351,7 +1351,7 @@ private void writeImage( String source )
bytesPerLine = 4 * ( ( srcWidth + 3 ) / 4 );
byte[] bitmap = new byte[srcHeight * bytesPerLine];

Vector colors = new Vector( 256 );
Vector<Color> colors = new Vector<>( 256 );
colors.addElement( Color.white );
colors.addElement( Color.black );

Expand Down Expand Up @@ -1920,16 +1920,13 @@ public void close()

if ( getLog().isWarnEnabled() && this.warnMessages != null )
{
for ( Object o1 : this.warnMessages.entrySet() )
for ( Map.Entry<String, Set<String>> entry : this.warnMessages.entrySet() )
{
Map.Entry entry = (Map.Entry) o1;

Set set = (Set) entry.getValue();
Set<String> set = entry.getValue();

for ( Object o : set )
for ( String msg : set )
{
String msg = (String) o;

getLog().warn( msg );
}
}
Expand Down Expand Up @@ -1960,13 +1957,13 @@ private void logMessage( String key, String msg )

if ( warnMessages == null )
{
warnMessages = new HashMap();
warnMessages = new HashMap<>();
}

Set set = (Set) warnMessages.get( key );
Set<String> set = warnMessages.get( key );
if ( set == null )
{
set = new TreeSet();
set = new TreeSet<>();
}
set.add( msg );
warnMessages.put( key, set );
Expand Down Expand Up @@ -2039,7 +2036,7 @@ static class Context
{
private int context = CONTEXT_UNDEFINED;

private Vector stack = new Vector();
private Vector<Integer> stack = new Vector<>();

void set( int context )
{
Expand All @@ -2051,7 +2048,7 @@ void restore()
{
if ( !stack.isEmpty() )
{
context = (Integer) stack.lastElement();
context = stack.lastElement();
stack.removeElementAt( stack.size() - 1 );
}
}
Expand Down Expand Up @@ -2172,7 +2169,7 @@ class Space

private int next;

private Vector stack = new Vector();
private Vector<Integer> stack = new Vector<>();

Space( int space /*twips*/ )
{
Expand All @@ -2196,7 +2193,7 @@ void restore()
{
if ( !stack.isEmpty() )
{
space = (Integer) stack.lastElement();
space = stack.lastElement();
stack.removeElementAt( stack.size() - 1 );
next = space;
}
Expand Down Expand Up @@ -2234,7 +2231,7 @@ static class Indentation
{
private int indent;

private Vector stack = new Vector();
private Vector<Integer> stack = new Vector<>();

Indentation( int indent /*twips*/ )
{
Expand All @@ -2256,7 +2253,7 @@ void restore()
{
if ( !stack.isEmpty() )
{
indent = (Integer) stack.lastElement();
indent = stack.lastElement();
stack.removeElementAt( stack.size() - 1 );
}
}
Expand All @@ -2277,15 +2274,15 @@ static class Table

boolean grid;

Vector rows;
Vector<Row> rows;

Table( int[] justification, boolean grid )
{
numColumns = justification.length;
columnWidths = new int[numColumns];
this.justification = justification;
this.grid = grid;
rows = new Vector();
rows = new Vector<>();
}

void add( Row row )
Expand All @@ -2298,7 +2295,7 @@ void add( Row row )
{
break;
}
Cell cell = (Cell) row.cells.elementAt( i );
Cell cell = row.cells.elementAt( i );
int width = cell.boundingBox().width;
if ( width > columnWidths[i] )
{
Expand All @@ -2324,7 +2321,7 @@ int width()

static class Row
{
Vector cells = new Vector();
Vector<Cell> cells = new Vector<>();

void add( Cell cell )
{
Expand All @@ -2337,7 +2334,7 @@ int height()
int numCells = cells.size();
for ( int i = 0; i < numCells; ++i )
{
Cell cell = (Cell) cells.elementAt( i );
Cell cell = cells.elementAt( i );
Box box = cell.boundingBox();
if ( box.height > height )
{
Expand All @@ -2350,7 +2347,7 @@ int height()

class Cell
{
Vector lines = new Vector();
Vector<Line> lines = new Vector<>();

void add( Line line )
{
Expand Down Expand Up @@ -2403,7 +2400,7 @@ Box boundingBox()

static class Line
{
Vector items = new Vector();
Vector<Item> items = new Vector<>();

void add( Item item )
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class WMFWriter

private short numOfParams;

private Vector records;
private Vector<Record> records;

WMFWriter()
{
Expand All @@ -69,7 +69,7 @@ class WMFWriter
maxRecordSize = trailer.size();
numOfParams = 0;

records = new Vector();
records = new Vector<>();
}

void add( Record record )
Expand Down

0 comments on commit 382491c

Please sign in to comment.