comparison src/org/tn5250j/framework/tn5250/Screen5250.java @ 107:afe6962769b9

use hash map rather than linear search thru arrays
author Carl Byington <carl@five-ten-sg.com>
date Wed, 18 Jun 2014 11:43:08 -0700
parents 12425771714d
children ae3092cd9cbf
comparison
equal deleted inserted replaced
106:12425771714d 107:afe6962769b9
551 public void setBuffer(vt320 buffer) { 551 public void setBuffer(vt320 buffer) {
552 this.buffer = buffer; 552 this.buffer = buffer;
553 } 553 }
554 554
555 /** 555 /**
556 * Searches the mnemonicData array looking for the specified string. If it 556 * converts mnemonic string values into aid integers
557 * is found it will return the value associated from the mnemonicValue
558 * 557 *
559 * @see #sendKeys 558 * @see #sendKeys
560 * @param mnem 559 * @param mnem string mnemonic value
561 * string mnemonic value
562 * @return key value of Mnemonic 560 * @return key value of Mnemonic
563 */ 561 */
564 private int getMnemonicValue(String mnem) { 562 private int getMnemonicValue(String mnem) {
565 563 if (mnemonicMap.containsKey(mnem)) return mnemonicsMap.get(mnem);
566 for (int x = 0; x < mnemonicData.length; x++) {
567
568 if (mnemonicData[x].equals(mnem))
569 return mnemonicValue[x];
570 }
571 return 0; 564 return 0;
572
573 } 565 }
574 566
575 protected void setPrehelpState(boolean setErrorCode, boolean lockKeyboard, 567 protected void setPrehelpState(boolean setErrorCode, boolean lockKeyboard,
576 boolean unlockIfLocked) { 568 boolean unlockIfLocked) {
577 if (oia.isKeyBoardLocked() && unlockIfLocked) 569 if (oia.isKeyBoardLocked() && unlockIfLocked)