changeset 108:ae3092cd9cbf

use hash map rather than linear search thru arrays
author Carl Byington <carl@five-ten-sg.com>
date Wed, 18 Jun 2014 12:00:45 -0700
parents afe6962769b9
children 3ac62a543054
files src/org/tn5250j/TN5250jConstants.java src/org/tn5250j/framework/tn5250/Screen5250.java
diffstat 2 files changed, 8 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/org/tn5250j/TN5250jConstants.java	Wed Jun 18 11:43:08 2014 -0700
+++ b/src/org/tn5250j/TN5250jConstants.java	Wed Jun 18 12:00:45 2014 -0700
@@ -22,7 +22,7 @@
 package org.tn5250j;
 import java.util.HashMap;
 
-public interface TN5250jConstants {
+public class TN5250jConstants {
 
    // Version information
    public static final String tn5250jRelease = "0";
--- a/src/org/tn5250j/framework/tn5250/Screen5250.java	Wed Jun 18 11:43:08 2014 -0700
+++ b/src/org/tn5250j/framework/tn5250/Screen5250.java	Wed Jun 18 12:00:45 2014 -0700
@@ -34,9 +34,10 @@
 import java.util.Vector;
 
 import org.tn5250j.TN5250jConstants;
+
 import android.util.Log;
+import de.mud.terminal.VDUBuffer;
 import de.mud.terminal.vt320;
-import de.mud.terminal.VDUBuffer;
 
 
 public class Screen5250 {
@@ -560,7 +561,7 @@
      * @return key value of Mnemonic
      */
     private int getMnemonicValue(String mnem) {
-        if (mnemonicMap.containsKey(mnem)) return mnemonicsMap.get(mnem);
+        if (mnemonicMap.containsKey(mnem)) return mnemonicMap.get(mnem);
         return 0;
     }
 
@@ -3841,10 +3842,10 @@
                 char at = planes.getCharExtended(p);
                 boolean ia = planes.isAttributePlace(p);
                 if (ch < ' ') ch = ' ';
-                int bg = vt320color[(int)((co >> 8) & 0x0f)] + 1;
-                int fg = vt320color[(int)(co        & 0x0f)] + 1;
-                int ul = (int)(at & EXTENDED_5250_UNDERLINE);
-                int nd = (int)(at & EXTENDED_5250_NON_DSP);
+                int bg = vt320color[(co >> 8) & 0x0f] + 1;
+                int fg = vt320color[co        & 0x0f] + 1;
+                int ul = at & EXTENDED_5250_UNDERLINE;
+                int nd = at & EXTENDED_5250_NON_DSP;
                 int vt_attr = (fg << VDUBuffer.COLOR_FG_SHIFT) + (bg << VDUBuffer.COLOR_BG_SHIFT);
                 if (ul > 0) vt_attr |= VDUBuffer.UNDERLINE;
                 if (ia || (nd > 0)) vt_attr |= VDUBuffer.INVISIBLE;