Skip to content

Commit 2dcfb4a

Browse files
committed
Convert to modern, type-annotated Collections calls
1 parent 3da5a4b commit 2dcfb4a

File tree

6 files changed

+55
-49
lines changed

6 files changed

+55
-49
lines changed

SPManager/src/artofillusion/spmanager/HttpSPMFileSystem.java

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import buoy.event.*;
1818
import java.io.*;
1919
import java.util.*;
20+
import java.util.List;
2021
import java.util.zip.*;
2122
import java.net.*;
2223
import javax.swing.text.*;
@@ -164,7 +165,7 @@ private void scanPlugins()
164165
}
165166
if ( statusDialog != null )
166167
statusDialog.setText( SPMTranslate.text( "scanningPlugins" ) );
167-
pluginsInfo = new Vector();
168+
pluginsInfo = new Vector<>();
168169
if ( SPManagerFrame.getParameters().getUseCache() )
169170
{
170171
scanFiles( "Plugins", pluginsInfo );
@@ -300,10 +301,10 @@ private void scanStartupScripts()
300301
* Scans file on a general basis
301302
*
302303
*@param from URL to scan files from
303-
*@param addTo Which vector to add info to
304+
*@param addTo Which list to add info to
304305
*@param suffix Scanned files suffix
305306
*/
306-
private void scanFiles( URL from, Vector addTo, String suffix )
307+
private void scanFiles( URL from, List<SPMObjectInfo> addTo, String suffix )
307308
{
308309
SPMObjectInfo info;
309310
boolean eligible;
@@ -434,9 +435,9 @@ else if ( e instanceof FileNotFoundException )
434435
* Scans file using server cgi
435436
*
436437
*@param dir directory to fetch scripts from
437-
*@param addTo Which vector to add info to
438+
*@param addTo Which list to add info to
438439
*/
439-
private void scanFiles( String dir, Vector addTo )
440+
private void scanFiles( String dir, List<SPMObjectInfo> addTo )
440441
{
441442

442443
URL cgiUrl = null;
@@ -949,8 +950,8 @@ public void handleEndTag( HTML.Tag t, MutableAttributeSet a, int pos )
949950
*/
950951
private class HtmlVersioningParserCallback extends HTMLEditorKit.ParserCallback
951952
{
952-
private Vector v;
953-
private URL from;
953+
private final List<String> v;
954+
private final URL from;
954955

955956

956957
/**
@@ -959,7 +960,7 @@ private class HtmlVersioningParserCallback extends HTMLEditorKit.ParserCallback
959960
*@param v Description of the Parameter
960961
*@param from Description of the Parameter
961962
*/
962-
public HtmlVersioningParserCallback( Vector v, URL from )
963+
public HtmlVersioningParserCallback( List<String> v, URL from )
963964
{
964965
this.v = v;
965966
this.from = from;

SPManager/src/artofillusion/spmanager/InstallSplitPane.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import buoy.event.*;
1919
import java.io.*;
2020
import java.util.*;
21+
import java.util.List;
2122
import java.net.*;
2223

2324

@@ -192,15 +193,15 @@ private void getStartupScripts()
192193
*
193194
*@param addTo Description of the Parameter
194195
*@param infos Description of the Parameter
195-
*@param managerInfoVector Description of the Parameter
196+
*@param managerInfoList Description of the Parameter
196197
*/
197-
private void getFiles( TreePath addTo, Vector infos, Vector managerInfoVector )
198+
private void getFiles( TreePath addTo, List<SPMObjectInfo> infos, List<SPMObjectInfo> managerInfoList )
198199
{
199200
DefaultMutableTreeNode tn;
200201
SPMObjectInfo info;
201202
SPMObjectInfo managerInfo;
202203
boolean eligible;
203-
TreeMap map = new TreeMap();
204+
TreeMap<String, SPMObjectInfo> map = new TreeMap<>();
204205

205206
for ( int i = 0; i < infos.size(); i++ )
206207
{
@@ -213,16 +214,16 @@ private void getFiles( TreePath addTo, Vector infos, Vector managerInfoVector )
213214
eligible = ( workMode == INSTALL );
214215
managerInfo = null;
215216
String name = info.getName();
216-
for ( int j = 0; j < managerInfoVector.size(); ++j )
217+
for ( int j = 0; j < managerInfoList.size(); ++j )
217218
{
218-
if ( ( (SPMObjectInfo) managerInfoVector.elementAt( j ) ).getName().equals( name ) )
219+
if ( (managerInfoList.get( j ) ).getName().equals( name ) )
219220
{
220221
eligible = ( workMode == UPDATE );
221222
if ( eligible )
222223
{
223224
//check if valid update
224225

225-
managerInfo = (SPMObjectInfo) managerInfoVector.elementAt( j );
226+
managerInfo = managerInfoList.get( j );
226227
System.out.println( info.getName() );
227228
System.out.println( "major distant local :" + info.getMajor() + " " + managerInfo.getMajor() );
228229
System.out.println( "minor distant local :" + info.getMinor() + " " + managerInfo.getMinor() );

SPManager/src/artofillusion/spmanager/ManageSplitPane.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import buoy.widget.*;
1717
import java.io.*;
1818
import java.util.*;
19+
import java.util.List;
1920

2021
/**
2122
* Description of the Class
@@ -105,7 +106,7 @@ private void getStartupScripts()
105106
*@param addTo Description of the Parameter
106107
*@param infos Description of the Parameter
107108
*/
108-
private void getFiles( TreePath addTo, Vector infos )
109+
private void getFiles( TreePath addTo, List<SPMObjectInfo> infos )
109110
{
110111
DefaultMutableTreeNode tn;
111112
SPMObjectInfo info;

SPManager/src/artofillusion/spmanager/SPMFileSystem.java

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,12 @@
1111

1212
package artofillusion.spmanager;
1313

14+
import java.util.List;
1415
import java.util.Vector;
1516

1617
public class SPMFileSystem
1718
{
18-
protected Vector pluginsInfo, toolInfo, objectInfo, startupInfo;
19+
protected List<SPMObjectInfo> pluginsInfo, toolInfo, objectInfo, startupInfo;
1920
protected boolean initialized;
2021

2122
public final static short PLUGIN_TYPE = 0;
@@ -25,23 +26,23 @@ public class SPMFileSystem
2526

2627
public SPMFileSystem()
2728
{
28-
pluginsInfo = new Vector();
29-
toolInfo = new Vector();
30-
objectInfo = new Vector();
31-
startupInfo = new Vector();
29+
pluginsInfo = new Vector<>();
30+
toolInfo = new Vector<>();
31+
objectInfo = new Vector<>();
32+
startupInfo = new Vector<>();
3233
initialized = false;
3334
}
3435

3536
public short getInfoType(SPMObjectInfo info)
3637
{
3738
for (int i = 0; i < pluginsInfo.size(); ++i)
38-
if (info == pluginsInfo.elementAt(i)) return PLUGIN_TYPE;
39+
if (info == pluginsInfo.get(i)) return PLUGIN_TYPE;
3940
for (int i = 0; i < toolInfo.size(); ++i)
40-
if (info == toolInfo.elementAt(i)) return TOOL_SCRIPT_TYPE;
41+
if (info == toolInfo.get(i)) return TOOL_SCRIPT_TYPE;
4142
for (int i = 0; i < objectInfo.size(); ++i)
42-
if (info == objectInfo.elementAt(i)) return OBJECT_SCRIPT_TYPE;
43+
if (info == objectInfo.get(i)) return OBJECT_SCRIPT_TYPE;
4344
for (int i = 0; i < startupInfo.size(); ++i)
44-
if (info == startupInfo.elementAt(i)) return STARTUP_SCRIPT_TYPE;
45+
if (info == startupInfo.get(i)) return STARTUP_SCRIPT_TYPE;
4546
return PLUGIN_TYPE;
4647
}
4748

@@ -66,25 +67,25 @@ public void initialize()
6667
startupInfo.clear();
6768
}
6869

69-
public Vector getPlugins()
70+
public List<SPMObjectInfo> getPlugins()
7071
{
7172
if (!initialized) initialize();
7273
return pluginsInfo;
7374
}
7475

75-
public Vector getToolScripts()
76+
public List<SPMObjectInfo> getToolScripts()
7677
{
7778
if (!initialized) initialize();
7879
return toolInfo;
7980
}
8081

81-
public Vector getObjectScripts()
82+
public List<SPMObjectInfo> getObjectScripts()
8283
{
8384
if (!initialized) initialize();
8485
return objectInfo;
8586
}
8687

87-
public Vector getStartupScripts()
88+
public List<SPMObjectInfo> getStartupScripts()
8889
{
8990
if (!initialized) initialize();
9091
return startupInfo;

SPManager/src/artofillusion/spmanager/SPMObjectInfo.java

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/*
22
* Copyright 2004 Francois Guillet
3+
* Changes copyright 2022 by Maksim Khramov
34
* This program is free software; you can redistribute it and/or modify it under the
45
* terms of the GNU General Public License as published by the Free Software
56
* Foundation; either version 2 of the License, or (at your option) any later version.
@@ -13,7 +14,7 @@
1314
import java.util.*;
1415
import org.w3c.dom.*;
1516
import java.net.*;
16-
17+
import java.util.List;
1718

1819
/**
1920
* Description of the Class
@@ -63,12 +64,12 @@ public class SPMObjectInfo
6364
private String description = null;
6465
private String comments = null;
6566

66-
private HashMap externals;
67-
private Vector changeLog;
68-
private Vector details;
67+
private Map<String, String> externals;
68+
private List<String> changeLog;
69+
private List<String> details;
6970

70-
protected HashMap exports;
71-
public HashMap actions;
71+
protected Map<String, String> exports;
72+
public Map<String, String> actions;
7273

7374
/**
7475
* Script file name
@@ -699,12 +700,12 @@ private void readInfoFromDocumentNode(Node script)
699700
SPMParameters params = SPManagerFrame.getParameters();
700701

701702
if (changeLog == null) {
702-
changeLog = new Vector(16);
703-
details = new Vector(16);
704-
externals = new HashMap(16);
703+
changeLog = new Vector<>(16);
704+
details = new Vector<>(16);
705+
externals = new HashMap<>(16);
705706
destination = new ArrayList(16);
706-
actions = new HashMap(16);
707-
exports = new HashMap(32);
707+
actions = new HashMap<>(16);
708+
exports = new HashMap<>(32);
708709
}
709710
else {
710711
changeLog.clear();
@@ -1097,28 +1098,28 @@ public String getComments()
10971098
return comments;
10981099
}
10991100

1100-
/**
1101-
* get the list of external dependencies.
1101+
/**.
1102+
* @return the list of external dependencies
11021103
*/
1103-
public Collection getExternals()
1104-
{ return (externals != null ? externals.values() : null); }
1104+
public Collection<String> getExternals()
1105+
{ return externals == null ? null: externals.values(); }
11051106

11061107
/**
11071108
* get the change log
11081109
*/
1109-
public Vector getChangeLog()
1110+
public List<String> getChangeLog()
11101111
{
1111-
return changeLog;
1112+
return changeLog;
11121113
}
11131114

11141115
/**
11151116
* Gets the details vector
11161117
*
11171118
*@return The details vector
11181119
*/
1119-
public Vector getDetails()
1120+
public List<String> getDetails()
11201121
{
1121-
return details;
1122+
return details;
11221123
}
11231124

11241125
/**

SPManager/src/artofillusion/spmanager/SPMSplitPane.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
package artofillusion.spmanager;
1212

1313
import java.util.*;
14+
import java.util.List;
1415
import java.awt.*;
1516
import javax.swing.*;
1617
import javax.swing.tree.*;
@@ -94,7 +95,7 @@ public class SPMSplitPane extends BSplitPane
9495
private BScrollPane nameSP, descriptionSP;
9596
private BComboBox descSelect;
9697

97-
private Vector descText;
98+
private List<String> descText;
9899

99100
/**
100101
* Description of the Field
@@ -434,7 +435,7 @@ private void displayObjectInfo( SPMObjectInfo info )
434435
objectDescription.setText( (String) descText.get(0) );
435436
else objectDescription.setText("");
436437

437-
Vector changeLog = info.getChangeLog();
438+
List<String> changeLog = info.getChangeLog();
438439
if (changeLog != null) descSelect.setContents(changeLog);
439440
else {
440441
descSelect.removeAll();

0 commit comments

Comments
 (0)