more generics

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@4311 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 17 years ago
parent ecd7f8ba4e
commit 016fc594af

@ -255,7 +255,8 @@ public class indexCachedRI implements indexRI {
return wordContainers(startHash, false, rot);
}
public kelondroCloneableIterator<indexContainer> wordContainers(String startHash, boolean ramOnly, boolean rot) {
@SuppressWarnings("unchecked")
public kelondroCloneableIterator<indexContainer> wordContainers(String startHash, boolean ramOnly, boolean rot) {
kelondroCloneableIterator<indexContainer> i;
if (ramOnly) {
i = riExtern.wordContainers(startHash, false);

@ -457,13 +457,13 @@ public class indexContainer extends kelondroRowSet {
public static final serverByteBuffer compressIndex(indexContainer inputContainer, indexContainer excludeContainer, long maxtime) {
// collect references according to domains
long timeout = (maxtime < 0) ? Long.MAX_VALUE : System.currentTimeMillis() + maxtime;
TreeMap doms = new TreeMap();
TreeMap<String, String> doms = new TreeMap<String, String>();
synchronized (inputContainer) {
Iterator i = inputContainer.entries();
Iterator<indexRWIRowEntry> i = inputContainer.entries();
indexRWIEntry iEntry;
String dom, paths;
while (i.hasNext()) {
iEntry = (indexRWIEntry) i.next();
iEntry = i.next();
if ((excludeContainer != null) && (excludeContainer.get(iEntry.urlHash()) != null)) continue; // do not include urls that are in excludeContainer
dom = iEntry.urlHash().substring(6);
if ((paths = (String) doms.get(dom)) == null) {
@ -478,10 +478,10 @@ public class indexContainer extends kelondroRowSet {
// construct a result string
serverByteBuffer bb = new serverByteBuffer(inputContainer.size() * 6);
bb.append('{');
Iterator i = doms.entrySet().iterator();
Map.Entry entry;
Iterator<Map.Entry<String, String>> i = doms.entrySet().iterator();
Map.Entry<String, String> entry;
while (i.hasNext()) {
entry = (Map.Entry) i.next();
entry = i.next();
bb.append((String) entry.getKey());
bb.append(':');
bb.append((String) entry.getValue());
@ -494,7 +494,7 @@ public class indexContainer extends kelondroRowSet {
return bb;
}
public static final void decompressIndex(TreeMap target, serverByteBuffer ci, String peerhash) {
public static final void decompressIndex(TreeMap<String, String> target, serverByteBuffer ci, String peerhash) {
// target is a mapping from url-hashes to a string of peer-hashes
if ((ci.byteAt(0) == '{') && (ci.byteAt(ci.length() - 1) == '}')) {
//System.out.println("DEBUG-DECOMPRESS: input is " + ci.toString());
@ -508,7 +508,7 @@ public class indexContainer extends kelondroRowSet {
assert ci.length() >= 6 : "ci.length() = " + ci.length();
url = ci.toString(0, 6) + dom;
ci.trim(6);
peers = (String) target.get(url);
peers = target.get(url);
if (peers == null) {
target.put(url, peerhash);
} else {

@ -43,6 +43,7 @@ import de.anomic.kelondro.kelondroFixedWidthArray;
import de.anomic.kelondro.kelondroMScoreCluster;
import de.anomic.kelondro.kelondroNaturalOrder;
import de.anomic.kelondro.kelondroRow;
import de.anomic.kelondro.kelondroRow.EntryIndex;
import de.anomic.server.serverByteBuffer;
import de.anomic.server.serverFileUtils;
import de.anomic.server.serverMemory;
@ -53,7 +54,7 @@ public final class indexRAMRI implements indexRI {
// class variables
private final File databaseRoot;
protected final SortedMap cache; // wordhash-container
protected final SortedMap<String, indexContainer> cache; // wordhash-container
private final kelondroMScoreCluster<String> hashScore;
private final kelondroMScoreCluster<String> hashDate;
private long initTime;
@ -70,7 +71,7 @@ public final class indexRAMRI implements indexRI {
// creates a new index cache
// the cache has a back-end where indexes that do not fit in the cache are flushed
this.databaseRoot = databaseRoot;
this.cache = Collections.synchronizedSortedMap(new TreeMap());
this.cache = Collections.synchronizedSortedMap(new TreeMap<String, indexContainer>());
this.hashScore = new kelondroMScoreCluster<String>();
this.hashDate = new kelondroMScoreCluster<String>();
this.initTime = System.currentTimeMillis();
@ -124,7 +125,7 @@ public final class indexRAMRI implements indexRI {
long startTime = System.currentTimeMillis();
long messageTime = System.currentTimeMillis() + 5000;
long wordsPerSecond = 0, wordcount = 0, urlcount = 0;
Map.Entry entry;
Map.Entry<String, indexContainer> entry;
String wordHash;
indexContainer container;
long updateTime;
@ -134,21 +135,21 @@ public final class indexRAMRI implements indexRI {
// write wCache
synchronized (cache) {
Iterator i = cache.entrySet().iterator();
Iterator<Map.Entry<String, indexContainer>> i = cache.entrySet().iterator();
while (i.hasNext()) {
// get entries
entry = (Map.Entry) i.next();
wordHash = (String) entry.getKey();
entry = i.next();
wordHash = entry.getKey();
updateTime = getUpdateTime(wordHash);
container = (indexContainer) entry.getValue();
container = entry.getValue();
// put entries on stack
if (container != null) {
Iterator ci = container.entries();
Iterator<indexRWIRowEntry> ci = container.entries();
occ = kelondroNaturalOrder.encodeLong(container.size(), 4);
time = kelondroNaturalOrder.encodeLong(updateTime, 8);
while (ci.hasNext()) {
iEntry = (indexRWIEntry) ci.next();
iEntry = ci.next();
row.setCol(0, wordHash.getBytes());
row.setCol(1, occ);
row.setCol(2, time);
@ -203,7 +204,7 @@ public final class indexRAMRI implements indexRI {
long urlCount = 0, urlsPerSecond = 0;
try {
synchronized (cache) {
Iterator i = dumpArray.contentRows(-1);
Iterator<EntryIndex> i = dumpArray.contentRows(-1);
String wordHash;
//long creationTime;
indexRWIEntry wordEntry;
@ -211,7 +212,7 @@ public final class indexRAMRI implements indexRI {
//Runtime rt = Runtime.getRuntime();
while (i.hasNext()) {
// get out one entry
row = (kelondroRow.EntryIndex) i.next();
row = i.next();
if ((row == null) || (row.empty(0)) || (row.empty(3))) continue;
wordHash = row.getColString(0, "UTF-8");
//creationTime = kelondroRecords.bytes2long(row[2]);
@ -293,7 +294,7 @@ public final class indexRAMRI implements indexRI {
// plus the mentioned features
private boolean rot;
private Iterator iterator;
private Iterator<indexContainer> iterator;
public wordContainerIterator(String startWordHash, boolean rot) {
this.rot = rot;
@ -393,7 +394,7 @@ public final class indexRAMRI implements indexRI {
return (c == null) ? 0 : c.size();
}
public synchronized indexContainer getContainer(String wordHash, Set urlselection) {
public synchronized indexContainer getContainer(String wordHash, Set<String> urlselection) {
if (wordHash == null) return null;
// retrieve container
@ -435,7 +436,7 @@ public final class indexRAMRI implements indexRI {
return false;
}
public synchronized int removeEntries(String wordHash, Set urlHashes) {
public synchronized int removeEntries(String wordHash, Set<String> urlHashes) {
if (urlHashes.size() == 0) return 0;
indexContainer c = (indexContainer) cache.get(wordHash);
int count;
@ -458,16 +459,16 @@ public final class indexRAMRI implements indexRI {
// urlHash assigned. This can only work if the entry is really fresh
// Such entries must be searched in the latest entries
int delCount = 0;
Iterator i = cache.entrySet().iterator();
Map.Entry entry;
Iterator<Map.Entry<String, indexContainer>> i = cache.entrySet().iterator();
Map.Entry<String, indexContainer> entry;
String wordhash;
indexContainer c;
while (i.hasNext()) {
entry = (Map.Entry) i.next();
wordhash = (String) entry.getKey();
entry = i.next();
wordhash = entry.getKey();
// get container
c = (indexContainer) entry.getValue();
c = entry.getValue();
if (c.remove(urlHash) != null) {
if (c.size() == 0) {
i.remove();

@ -36,19 +36,15 @@ public interface indexRI {
public int size();
public int minMem();
public kelondroCloneableIterator wordContainers(String startWordHash, boolean rot); // method to replace wordHashes
public kelondroCloneableIterator<indexContainer> wordContainers(String startWordHash, boolean rot); // method to replace wordHashes
public long getUpdateTime(String wordHash);
public int indexSize(String wordHash);
public boolean hasContainer(String wordHash); // should only be used if in case that true is returned the getContainer is NOT called
public indexContainer getContainer(String wordHash, Set<String> urlselection); // if urlselection != null all url references which are not in urlselection are removed from the container
public indexContainer deleteContainer(String wordHash);
public boolean removeEntry(String wordHash, String urlHash);
public int removeEntries(String wordHash, Set<String> urlHashes);
public void addEntries(indexContainer newEntries, long creationTime, boolean dhtCase);
public void close();
}

@ -46,7 +46,6 @@ import de.anomic.server.serverDate;
import de.anomic.tools.crypt;
import de.anomic.tools.nxTools;
import de.anomic.yacy.yacyURL;
import de.anomic.index.indexRWIEntry;
public class indexURLEntry {
@ -310,7 +309,7 @@ public class indexURLEntry {
}
public indexURLEntry.Components comp() {
ArrayList cl = nxTools.strings(this.entry.getCol("comp", null), "UTF-8");
ArrayList<String> cl = nxTools.strings(this.entry.getCol("comp", null), "UTF-8");
return new indexURLEntry.Components(
(cl.size() > 0) ? ((String) cl.get(0)).trim() : "",
hash(),

@ -91,11 +91,11 @@ public class kelondroBytesIntMap {
return index.size();
}
public synchronized kelondroCloneableIterator keys(boolean up, byte[] firstKey) throws IOException {
public synchronized kelondroCloneableIterator<byte[]> keys(boolean up, byte[] firstKey) throws IOException {
return index.keys(up, firstKey);
}
public synchronized kelondroCloneableIterator rows(boolean up, byte[] firstKey) throws IOException {
public synchronized kelondroCloneableIterator<kelondroRow.Entry> rows(boolean up, byte[] firstKey) throws IOException {
return index.rows(up, firstKey);
}

@ -145,14 +145,14 @@ public class kelondroFlexSplitTable implements kelondroIndex {
public synchronized kelondroProfile profile() {
kelondroProfile[] profiles = new kelondroProfile[tables.size()];
Iterator i = tables.values().iterator();
Iterator<kelondroIndex> i = tables.values().iterator();
int c = 0;
while (i.hasNext()) profiles[c++] = ((kelondroIndex) i.next()).profile();
return kelondroProfile.consolidate(profiles);
}
public int writeBufferSize() {
Iterator i = tables.values().iterator();
Iterator<kelondroIndex> i = tables.values().iterator();
int s = 0;
kelondroIndex ki;
while (i.hasNext()) {
@ -163,7 +163,7 @@ public class kelondroFlexSplitTable implements kelondroIndex {
}
public void flushSome() {
Iterator i = tables.values().iterator();
Iterator<kelondroIndex> i = tables.values().iterator();
kelondroIndex ki;
while (i.hasNext()) {
ki = ((kelondroIndex) i.next());
@ -177,7 +177,7 @@ public class kelondroFlexSplitTable implements kelondroIndex {
}
public boolean has(byte[] key) throws IOException {
Iterator i = tables.values().iterator();
Iterator<kelondroIndex> i = tables.values().iterator();
kelondroIndex table;
while (i.hasNext()) {
table = (kelondroIndex) i.next();
@ -218,7 +218,7 @@ public class kelondroFlexSplitTable implements kelondroIndex {
}
public synchronized Object[] keeperOf(byte[] key) throws IOException {
Iterator i = tables.values().iterator();
Iterator<kelondroIndex> i = tables.values().iterator();
kelondroIndex table;
kelondroRow.Entry entry;
while (i.hasNext()) {

@ -344,19 +344,19 @@ public class kelondroFlexTable extends kelondroFlexWidthArray implements kelondr
return r;
}
public synchronized kelondroCloneableIterator keys(boolean up, byte[] firstKey) throws IOException {
public synchronized kelondroCloneableIterator<byte[]> keys(boolean up, byte[] firstKey) throws IOException {
return index.keys(up, firstKey);
}
public synchronized kelondroCloneableIterator rows(boolean up, byte[] firstKey) throws IOException {
public synchronized kelondroCloneableIterator<kelondroRow.Entry> rows(boolean up, byte[] firstKey) throws IOException {
if (index == null) return new rowIterator(index, up, firstKey);
assert this.size() == index.size() : "content.size() = " + this.size() + ", index.size() = " + index.size();
return new rowIterator(index, up, firstKey);
}
public class rowIterator implements kelondroCloneableIterator {
public class rowIterator implements kelondroCloneableIterator<kelondroRow.Entry> {
kelondroCloneableIterator indexIterator;
kelondroCloneableIterator<kelondroRow.Entry> indexIterator;
kelondroBytesIntMap index;
boolean up;
@ -378,7 +378,7 @@ public class kelondroFlexTable extends kelondroFlexWidthArray implements kelondr
return indexIterator.hasNext();
}
public Object next() {
public kelondroRow.Entry next() {
kelondroRow.Entry idxEntry = null;
while ((indexIterator.hasNext()) && (idxEntry == null)) {
idxEntry = (kelondroRow.Entry) indexIterator.next();

@ -164,11 +164,11 @@ public class kelondroMHashMap {
int newspace = mem.length * 2;
int newcapacity = capacity() * 2;
byte[] newmem = new byte[newspace];
Iterator i = entries();
Iterator<entry> i = entries();
kelondroMHashMap.entry e;
int mempos;
while (i.hasNext()) {
e = (kelondroMHashMap.entry) i.next();
e = i.next();
hash = findSpace(newmem, e.key, reclen, newspace, newcapacity);
mempos = hash * reclen;
System.arraycopy(e.key, 0, newmem, mempos, keylen);
@ -233,11 +233,11 @@ public class kelondroMHashMap {
}
}
Iterator entries() {
Iterator<entry> entries() {
return new entryIterator();
}
public class entryIterator implements Iterator {
public class entryIterator implements Iterator<entry> {
int hashkey;
@ -249,7 +249,7 @@ public class kelondroMHashMap {
return hashkey >= 0;
}
public Object next() {
public entry next() {
int i = hashkey;
hashkey = anyhashpos(hashkey + 1);
return new entry(i);
@ -320,12 +320,12 @@ public class kelondroMHashMap {
long start = System.currentTimeMillis();
kelondroMHashMap map = new kelondroMHashMap(4);
for (int i = 0; i < 100; i++) map.put(3333 + i, ("" + (1000 + i)).getBytes());
Iterator i = map.entries();
Iterator<entry> i = map.entries();
kelondroMHashMap.entry e;
System.out.println("Enumeration of elements: count=" + map.size());
int c = 0;
while (i.hasNext()) {
e = (kelondroMHashMap.entry) i.next();
e = i.next();
System.out.println("key=" + new String(e.key) + ", value=" + new String(e.value) + ", retrieved=" + new String(map.get(e.key)));
c++;
}

@ -152,13 +152,13 @@ public class kelondroMSetTools {
Iterator<Map.Entry<A, B>> mi = small.entrySet().iterator();
TreeMap<A, B> result = new TreeMap<A, B>(large.comparator());
Map.Entry<A, B> mentry1;
Object mobj2;
B mobj2;
while (mi.hasNext()) {
mentry1 = mi.next();
mobj2 = large.get(mentry1.getKey());
if (mobj2 != null) {
if (mentry1.getValue() instanceof String) {
result.put(mentry1.getKey(), (B) ((concatStrings) ? ((String) mentry1.getValue() + (String) mobj2) : (String) mentry1.getValue()));
result.put(mentry1.getKey(), (B) ((concatStrings) ? (mentry1.getValue() + (String) mobj2) : mentry1.getValue()));
} else {
result.put(mentry1.getKey(), mentry1.getValue());
}

@ -45,7 +45,8 @@ public class kelondroMapObjects extends kelondroObjects {
this(dyn, cachesize, null, null, null, null, null);
}
public kelondroMapObjects(kelondroDyn dyn, int cachesize, String[] sortfields, String[] longaccfields, String[] doubleaccfields, Method externalInitializer, Object externalHandler) {
@SuppressWarnings("unchecked")
public kelondroMapObjects(kelondroDyn dyn, int cachesize, String[] sortfields, String[] longaccfields, String[] doubleaccfields, Method externalInitializer, Object externalHandler) {
super(dyn, cachesize);
// create fast ordering clusters and acc fields

@ -50,13 +50,15 @@ import java.util.Map;
public class kelondroMapTable {
HashMap mTables, tTables, sTables;
File tablesPath;
private HashMap<String, kelondroMapObjects> mTables;
private HashMap<String, kelondroIndex> tTables;
//private HashMap sTables;
private File tablesPath;
public kelondroMapTable(File tablesPath) {
this.mTables = new HashMap();
this.tTables = new HashMap();
this.sTables = new HashMap();
this.mTables = new HashMap<String, kelondroMapObjects>();
this.tTables = new HashMap<String, kelondroIndex>();
//this.sTables = new HashMap();
this.tablesPath = tablesPath;
if (!(tablesPath.exists())) tablesPath.mkdirs();
}
@ -95,7 +97,7 @@ public class kelondroMapTable {
tTables.put(tablename, Tree);
}
public synchronized void update(String tablename, String key, Map map) throws IOException {
public synchronized void update(String tablename, String key, Map<String, String> map) throws IOException {
kelondroMapObjects table = (kelondroMapObjects) mTables.get(tablename);
if (table == null) throw new RuntimeException("kelondroTables.update: map table '" + tablename + "' does not exist.");
if (key.length() > table.keySize()) key = key.substring(0, table.keySize());
@ -110,7 +112,7 @@ public class kelondroMapTable {
tTables.put(tablename, tree);
}
public synchronized Map selectMap(String tablename, String key) {
public synchronized Map<String, String> selectMap(String tablename, String key) {
kelondroMapObjects table = (kelondroMapObjects) mTables.get(tablename);
if (table == null) throw new RuntimeException("kelondroTables.selectMap: map table '" + tablename + "' does not exist.");
if (key.length() > table.keySize()) key = key.substring(0, table.keySize());
@ -141,11 +143,11 @@ public class kelondroMapTable {
return table.maps(up, field);
}
public synchronized kelondroCloneableIterator /* of kelondroRow.Entry-Elements */ rows(String tablename, boolean up, boolean rotating, byte[] firstKey, byte[] secondKey) throws IOException {
public synchronized kelondroCloneableIterator<kelondroRow.Entry> /* of kelondroRow.Entry-Elements */ rows(String tablename, boolean up, boolean rotating, byte[] firstKey, byte[] secondKey) throws IOException {
kelondroIndex tree = (kelondroIndex) tTables.get(tablename);
if (tree == null) throw new RuntimeException("kelondroTables.bytes: tree table '" + tablename + "' does not exist.");
kelondroCloneableIterator i = tree.rows(up, firstKey);
if (rotating) return new kelondroRotateIterator(i, secondKey); else return i;
kelondroCloneableIterator<kelondroRow.Entry> i = tree.rows(up, firstKey);
if (rotating) return new kelondroRotateIterator<kelondroRow.Entry>(i, secondKey); else return i;
}
// if you need the long-values from a row-iteration, please use kelondroRecords.bytes2long to convert from byte[] to long
@ -184,11 +186,11 @@ public class kelondroMapTable {
}
public void close() {
Iterator tablesIt = mTables.values().iterator();
Iterator<kelondroMapObjects> tablesIt = mTables.values().iterator();
while (tablesIt.hasNext()) ((kelondroMapObjects) tablesIt.next()).close();
mTables = null;
Iterator TreeIt = tTables.values().iterator();
Iterator<kelondroIndex> TreeIt = tTables.values().iterator();
while (TreeIt.hasNext()) ((kelondroIndex) TreeIt.next()).close();
tTables = null;
}

@ -47,24 +47,24 @@ import java.util.HashMap;
public final class serverClassLoader extends ClassLoader {
private final HashMap classes;
private final HashMap<File, Class<?>> classes;
public serverClassLoader() {
//super(ClassLoader.getSystemClassLoader());
super(Thread.currentThread().getContextClassLoader());
this.classes = new HashMap();
this.classes = new HashMap<File, Class<?>>();
}
public serverClassLoader(ClassLoader parent) {
super(parent);
classes = new HashMap();
classes = new HashMap<File, Class<?>>();
}
public Package[] packages() {
return super.getPackages();
}
public Class loadClass(File classfile) throws ClassNotFoundException {
public Class<?> loadClass(File classfile) throws ClassNotFoundException {
// we consider that the classkey can either be only the name of a class, or a partial or
// complete path to a class file
@ -81,7 +81,7 @@ public final class serverClassLoader extends ClassLoader {
// try to load the class
synchronized(classFileName.intern()) {
// first try: take the class out of the cache, denoted by the classname
Class c = (Class) this.classes.get(classfile);
Class<?> c = (Class<?>) this.classes.get(classfile);
if (c != null) return c;
// consider classkey as a file and extract the file name

@ -53,13 +53,13 @@ public final class serverInstantThread extends serverAbstractThread implements s
private Long handle;
public static int instantThreadCounter = 0;
public static TreeMap jobs = new TreeMap();
public static TreeMap<Long, String> jobs = new TreeMap<Long, String>();
public serverInstantThread(Object env, String jobExec, String jobCount, String freemem) {
// jobExec is the name of a method of the object 'env' that executes the one-step-run
// jobCount is the name of a method that returns the size of the job
// freemem is the name of a method that tries to free memory and returns void
Class theClass = (env instanceof Class) ? (Class) env : env.getClass();
Class<?> theClass = (env instanceof Class) ? (Class<?>) env : env.getClass();
try {
this.jobExecMethod = theClass.getMethod(jobExec, new Class[0]);
} catch (NoSuchMethodException e) {

@ -34,15 +34,15 @@ import java.util.TreeMap;
public class serverProfiling extends Thread {
private static Map historyMaps; // key=name of history, value=TreeMap of Long/Event
private static Map eventCounter; // key=name of history, value=Integer of event counter
private static Map<String, TreeMap<Long, Event>> historyMaps; // key=name of history, value=TreeMap of Long/Event
private static Map<String, Integer> eventCounter; // key=name of history, value=Integer of event counter
private static long lastCompleteCleanup;
private static serverProfiling systemProfiler;
static {
// initialize profiling
historyMaps = Collections.synchronizedMap(new HashMap());
eventCounter = Collections.synchronizedMap(new HashMap());
historyMaps = Collections.synchronizedMap(new HashMap<String, TreeMap<Long, Event>>());
eventCounter = Collections.synchronizedMap(new HashMap<String, Integer>());
lastCompleteCleanup = System.currentTimeMillis();
systemProfiler = null;
}
@ -78,7 +78,7 @@ public class serverProfiling extends Thread {
public static void update(String eventName, Object eventPayload) {
// get event history container
int counter = eventCounter.containsKey(eventName) ? ((Integer) eventCounter.get(eventName)).intValue() : 0;
TreeMap history = historyMaps.containsKey(eventName) ? ((TreeMap) historyMaps.get(eventName)) : new TreeMap();
TreeMap<Long, Event> history = historyMaps.containsKey(eventName) ? (historyMaps.get(eventName)) : new TreeMap<Long, Event>();
// update entry
Long time = new Long(System.currentTimeMillis());
@ -105,7 +105,7 @@ public class serverProfiling extends Thread {
private static void cleanup(String eventName) {
if (historyMaps.containsKey(eventName)) {
TreeMap history = (TreeMap) historyMaps.get(eventName);
TreeMap<Long, Event> history = historyMaps.get(eventName);
cleanup(history);
if (history.size() > 0) {
historyMaps.put(eventName, history);
@ -115,18 +115,18 @@ public class serverProfiling extends Thread {
}
}
private static void cleanup(TreeMap history) {
private static void cleanup(TreeMap<Long, Event> history) {
// clean up too old entries
while (history.size() > 0) {
Long time = (Long) history.firstKey();
Long time = history.firstKey();
if (System.currentTimeMillis() - time.longValue() < 600000) break;
history.remove(time);
}
}
public static Iterator history(String eventName) {
return (historyMaps.containsKey(eventName) ? ((TreeMap) historyMaps.get(eventName)) : new TreeMap()).values().iterator();
public static Iterator<Event> history(String eventName) {
return (historyMaps.containsKey(eventName) ? (historyMaps.get(eventName)) : new TreeMap<Long, Event>()).values().iterator();
}
public static class Event {

@ -72,19 +72,17 @@ public final class serverSystem {
public static int maxPathLength = 65535;
// Macintosh-specific statics
private static Class macMRJFileUtils = null;
private static Class macMRJOSType = null;
private static Constructor macMRJOSTypeConstructor = null;
private static Class<?> macMRJFileUtils = null;
private static Class<?> macMRJOSType = null;
private static Constructor<?> macMRJOSTypeConstructor = null;
private static Object macMRJOSNullObj = null;
private static Method macGetFileCreator = null;
private static Method macGetFileType = null;
private static Method macSetFileCreator = null;
private static Method macSetFileType = null;
private static Method macOpenURL = null;
public static Hashtable macFSTypeCache = null;
public static Hashtable macFSCreatorCache = null;
public static Hashtable<String, String> macFSTypeCache = null;
public static Hashtable<String, String> macFSCreatorCache = null;
// static initialization
static {
@ -114,8 +112,8 @@ public final class serverSystem {
byte[] nullb = new byte[4];
for (int i = 0; i < 4; i++) nullb[i] = 0;
macMRJOSNullObj = macMRJOSTypeConstructor.newInstance(new Object[] {new String(nullb)});
macFSTypeCache = new Hashtable();
macFSCreatorCache = new Hashtable();
macFSTypeCache = new Hashtable<String, String>();
macFSCreatorCache = new Hashtable<String, String>();
} catch (Exception e) {
//e.printStackTrace();
macMRJFileUtils = null; macMRJOSType = null;
@ -349,13 +347,13 @@ public final class serverSystem {
starterFile.delete();
}
public static Vector execSynchronous(String command) throws IOException {
public static Vector<String> execSynchronous(String command) throws IOException {
// runs a unix/linux command and returns output as Vector of Strings
// this method blocks until the command is executed
Process p = Runtime.getRuntime().exec(command);
BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream()));
String text;
Vector output = new Vector();
Vector<String> output = new Vector<String>();
while ((text = in.readLine()) != null) {
output.add(text);
}

Loading…
Cancel
Save