bugged
stringlengths
6
599k
fixed
stringlengths
10
599k
__index_level_0__
int64
0
1.13M
protected void nextSession() { me.nextSession(); }
protected void nextSession() { fireSessionJump(JUMP_NEXT); }
2,148
protected void prevSession() { me.prevSession(); }
protected void prevSession() { fireSessionJump(JUMP_PREVIOUS); }
2,149
private void sendScreenEMail() { JPanel semp = new JPanel(); semp.setLayout(new AlignLayout(2,5,5)); JLabel tol = new JLabel(LangTool.getString("em.to")); JTextField tot = new JTextField(30); JLabel subl = new JLabel(LangTool.getString("em.subject")); JTextField subt = new JTextField(30); JLabel fnl = new JLabel(LangTool.getString("em.fileName")); JTextField fnt = new JTextField("tn5250j.txt",30); semp.add(tol); semp.add(tot); semp.add(subl); semp.add(subt); semp.add(fnl); semp.add(fnt); Object[] message = new Object[1]; message[0] = semp; String[] options = {LangTool.getString("em.optSendLabel"), LangTool.getString("em.optCancelLabel"), LangTool.getString("em.optConfigureLabel")}; int result = 0; result = JOptionPane.showOptionDialog( me.frame, // the parent that the dialog blocks message, // the dialog message array LangTool.getString("em.title"), // the title of the dialog window JOptionPane.DEFAULT_OPTION, // option type JOptionPane.QUESTION_MESSAGE, // message type null, // optional icon, use null to use the default icon options, // options string array, will be made into buttons// options[0] // option that should be made into a default button ); switch(result) { case 0: // Send it SendEMail sem = new SendEMail(); sem.setConfigFile("SMTPProperties.cfg"); sem.setTo(tot.getText()); sem.setSubject(subt.getText()); if (fnt.getText().length() > 0) sem.setFileName(fnt.getText()); StringBuffer sb = new StringBuffer(); char[] s = screen.getScreenAsChars(); int c = screen.getCols(); int l = screen.getRows() * c; int col = 0; for (int x = 0; x < l; x++,col++) { sb.append(s[x]); if (col == c) { sb.append('\n'); col = 0; } } sem.setMessage(sb.toString()); try { sem.send(); } catch (IOException ioe) { System.out.println(ioe.getMessage()); } sem.release(); sem = null; System.out.println("Message sent"); break; case 1: // Cancel // System.out.println("Cancel"); break; default: break; } }
private void sendScreenEMail() { JPanel semp = new JPanel(); semp.setLayout(new AlignLayout(2,5,5)); JLabel tol = new JLabel(LangTool.getString("em.to")); JTextField tot = new JTextField(30); JLabel subl = new JLabel(LangTool.getString("em.subject")); JTextField subt = new JTextField(30); JLabel fnl = new JLabel(LangTool.getString("em.fileName")); JTextField fnt = new JTextField("tn5250j.txt",30); semp.add(tol); semp.add(tot); semp.add(subl); semp.add(subt); semp.add(fnl); semp.add(fnt); Object[] message = new Object[1]; message[0] = semp; String[] options = {LangTool.getString("em.optSendLabel"), LangTool.getString("em.optCancelLabel"), LangTool.getString("em.optConfigureLabel")}; int result = 0; result = JOptionPane.showOptionDialog( this.getParent(), // the parent that the dialog blocks message, // the dialog message array LangTool.getString("em.title"), // the title of the dialog window JOptionPane.DEFAULT_OPTION, // option type JOptionPane.QUESTION_MESSAGE, // message type null, // optional icon, use null to use the default icon options, // options string array, will be made into buttons// options[0] // option that should be made into a default button ); switch(result) { case 0: // Send it SendEMail sem = new SendEMail(); sem.setConfigFile("SMTPProperties.cfg"); sem.setTo(tot.getText()); sem.setSubject(subt.getText()); if (fnt.getText().length() > 0) sem.setFileName(fnt.getText()); StringBuffer sb = new StringBuffer(); char[] s = screen.getScreenAsChars(); int c = screen.getCols(); int l = screen.getRows() * c; int col = 0; for (int x = 0; x < l; x++,col++) { sb.append(s[x]); if (col == c) { sb.append('\n'); col = 0; } } sem.setMessage(sb.toString()); try { sem.send(); } catch (IOException ioe) { System.out.println(ioe.getMessage()); } sem.release(); sem = null; System.out.println("Message sent"); break; case 1: // Cancel // System.out.println("Cancel"); break; default: break; } }
2,150
private void showHexMap() { JPanel srp = new JPanel(); srp.setLayout(new BorderLayout()); DefaultListModel listModel = new DefaultListModel(); StringBuffer sb = new StringBuffer(); // we will use a collator here so that we can take advantage of the locales Collator collator = Collator.getInstance(); CollationKey key = null; Set set = new TreeSet(); for (int x =0;x < 256; x++) { char c = vt.ebcdic2uni(x); char ac = vt.getASCIIChar(x); if (!Character.isISOControl(ac)) { sb.setLength(0); if (Integer.toHexString(ac).length() == 1){ sb.append("0x0" + Integer.toHexString(ac).toUpperCase()); } else { sb.append("0x" + Integer.toHexString(ac).toUpperCase()); } sb.append(" - " + c); key = collator.getCollationKey(sb.toString()); set.add(key); } } Iterator iterator = set.iterator(); while (iterator.hasNext()) { CollationKey keyc = (CollationKey)iterator.next(); listModel.addElement(keyc.getSourceString()); } //Create the list and put it in a scroll pane JList hm = new JList(listModel); hm.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); hm.setSelectedIndex(0); JScrollPane listScrollPane = new JScrollPane(hm); listScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); listScrollPane.setSize(40,100); srp.add(listScrollPane,BorderLayout.CENTER); Object[] message = new Object[1]; message[0] = srp; String[] options = {LangTool.getString("hm.optInsert"), LangTool.getString("hm.optCancel")}; int result = 0; result = JOptionPane.showOptionDialog( null, // the parent that the dialog blocks message, // the dialog message array LangTool.getString("hm.title"), // the title of the dialog window JOptionPane.DEFAULT_OPTION, // option type JOptionPane.INFORMATION_MESSAGE, // message type null, // optional icon, use null to use the default icon options, // options string array, will be made into buttons// options[0] // option that should be made into a default button ); switch(result) { case 0: // Insert character String k = ""; k += ((String)hm.getSelectedValue()).charAt(7); screen.sendKeys(k); break; case 1: // Cancel// System.out.println("Cancel"); break; default: break; } }
private void showHexMap() { JPanel srp = new JPanel(); srp.setLayout(new BorderLayout()); DefaultListModel listModel = new DefaultListModel(); StringBuffer sb = new StringBuffer(); // we will use a collator here so that we can take advantage of the locales Collator collator = Collator.getInstance(); CollationKey key = null; Set set = new TreeSet(); for (int x =0;x < 256; x++) { char c = vt.ebcdic2uni(x); char ac = vt.getASCIIChar(x); if (!Character.isISOControl(ac)) { sb.setLength(0); if (Integer.toHexString(ac).length() == 1){ sb.append("0x0" + Integer.toHexString(ac).toUpperCase()); } else { sb.append("0x" + Integer.toHexString(ac).toUpperCase()); } sb.append(" - " + c); key = collator.getCollationKey(sb.toString()); set.add(key); } } Iterator iterator = set.iterator(); while (iterator.hasNext()) { CollationKey keyc = (CollationKey)iterator.next(); listModel.addElement(keyc.getSourceString()); } //Create the list and put it in a scroll pane JList hm = new JList(listModel); hm.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); hm.setSelectedIndex(0); JScrollPane listScrollPane = new JScrollPane(hm); listScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); listScrollPane.setSize(40,100); srp.add(listScrollPane,BorderLayout.CENTER); Object[] message = new Object[1]; message[0] = srp; String[] options = {LangTool.getString("hm.optInsert"), LangTool.getString("hm.optCancel")}; int result = 0; result = JOptionPane.showOptionDialog( me.frame, // the parent that the dialog blocks message, // the dialog message array LangTool.getString("hm.title"), // the title of the dialog window JOptionPane.DEFAULT_OPTION, // option type JOptionPane.INFORMATION_MESSAGE, // message type me.frame, // optional icon, use null to use the default icon options, // options string array, will be made into buttons// options[0] // option that should be made into a default button ); switch(result) { case 0: // Insert character String k = ""; k += ((String)hm.getSelectedValue()).charAt(7); screen.sendKeys(k); break; case 1: // Cancel// System.out.println("Cancel"); break; default: break; } }
2,151
public TN5250jSplashScreen(String image_location) { // get the URL given the image location URL url = getClass().getResource(image_location); if (url == null) { throw new IllegalArgumentException("Image could not be found: " + image_location); } // convert URL to Image icon ImageIcon image = new ImageIcon(url); initialize(image); }
public TN5250jSplashScreen(String image_location) { // get the URL given the image location URL file=null; try { file = My5250.classLoader.getResource(image_location); if (url == null) { throw new IllegalArgumentException("Image could not be found: " + image_location); } // convert URL to Image icon ImageIcon image = new ImageIcon(url); initialize(image); }
2,152
public TN5250jSplashScreen(String image_location) { // get the URL given the image location URL url = getClass().getResource(image_location); if (url == null) { throw new IllegalArgumentException("Image could not be found: " + image_location); } // convert URL to Image icon ImageIcon image = new ImageIcon(url); initialize(image); }
public TN5250jSplashScreen(String image_location) { // get the URL given the image location URL url = getClass().getResource(image_location); if (url == null) { throw new IllegalArgumentException("Image could not be found: " + image_location); } // convert URL to Image icon ImageIcon image = new ImageIcon(url); initialize(image); }
2,153
public TN5250jSplashScreen(String image_location) { // get the URL given the image location URL url = getClass().getResource(image_location); if (url == null) { throw new IllegalArgumentException("Image could not be found: " + image_location); } // convert URL to Image icon ImageIcon image = new ImageIcon(url); initialize(image); }
public TN5250jSplashScreen(String image_location) { // get the URL given the image location URL url = getClass().getResource(image_location); if (url == null) { throw new IllegalArgumentException("Image could not be found: " + image_location); } // convert URL to Image icon catch (Exception e) { System.err.println(e); } ImageIcon image = new ImageIcon(file); initialize(image); }
2,154
public final void writeTo(SocketBuffer skbuf, int skbufOffset) { skbuf.set(skbufOffset, address, 0, length); }
public final void writeTo(SocketBuffer skbuf, int skbufOffset) { skbuf.set(skbufOffset, address, 0, length); }
2,155
public void insertItemAt(Object element, int index) { if(dataModel instanceof MutableComboBoxModel) { ((MutableComboBoxModel) dataModel).insertElementAt(element, index); } else { throw new RuntimeException("Unable to insert the item because the data model it is not an instance of MutableComboBoxModel."); } }
public void insertItemAt(Object element, int index) { if (dataModel instanceof MutableComboBoxModel) ((MutableComboBoxModel) dataModel).insertElementAt(element, index); } else { throw new RuntimeException("Unable to insert the item because the data model it is not an instance of MutableComboBoxModel."); } }
2,156
public void insertItemAt(Object element, int index) { if(dataModel instanceof MutableComboBoxModel) { ((MutableComboBoxModel) dataModel).insertElementAt(element, index); } else { throw new RuntimeException("Unable to insert the item because the data model it is not an instance of MutableComboBoxModel."); } }
public void insertItemAt(Object element, int index) { if(dataModel instanceof MutableComboBoxModel) { ((MutableComboBoxModel) dataModel).insertElementAt(element, index); } else { throw new RuntimeException("Unable to insert the item because the data model it is not an instance of MutableComboBoxModel."); } }
2,157
public void removeItem(Object element) { if(dataModel instanceof MutableComboBoxModel) { ((MutableComboBoxModel) dataModel).removeElement(element); } else { throw new RuntimeException("Unable to remove the item because the data model it is not an instance of MutableComboBoxModel."); } }
public void removeItem(Object element) { if (dataModel instanceof MutableComboBoxModel) ((MutableComboBoxModel) dataModel).removeElement(element); } else { throw new RuntimeException("Unable to remove the item because the data model it is not an instance of MutableComboBoxModel."); } }
2,158
public void removeItem(Object element) { if(dataModel instanceof MutableComboBoxModel) { ((MutableComboBoxModel) dataModel).removeElement(element); } else { throw new RuntimeException("Unable to remove the item because the data model it is not an instance of MutableComboBoxModel."); } }
public void removeItem(Object element) { if(dataModel instanceof MutableComboBoxModel) { ((MutableComboBoxModel) dataModel).removeElement(element); } else { throw new RuntimeException("Unable to remove the item because the data model it is not an instance of MutableComboBoxModel."); } }
2,159
public void removeItemAt(int index) { if(dataModel instanceof MutableComboBoxModel) { ((MutableComboBoxModel) dataModel).removeElementAt(index); } else { throw new RuntimeException("Unable to remove the item because the data model it is not an instance of MutableComboBoxModel."); } }
public void removeItemAt(int index) { if (dataModel instanceof MutableComboBoxModel) ((MutableComboBoxModel) dataModel).removeElementAt(index); } else { throw new RuntimeException("Unable to remove the item because the data model it is not an instance of MutableComboBoxModel."); } }
2,160
public void removeItemAt(int index) { if(dataModel instanceof MutableComboBoxModel) { ((MutableComboBoxModel) dataModel).removeElementAt(index); } else { throw new RuntimeException("Unable to remove the item because the data model it is not an instance of MutableComboBoxModel."); } }
public void removeItemAt(int index) { if(dataModel instanceof MutableComboBoxModel) { ((MutableComboBoxModel) dataModel).removeElementAt(index); } else { throw new RuntimeException("Unable to remove the item because the data model it is not an instance of MutableComboBoxModel."); } }
2,161
public Statement(Object target, String methodName, Object[] arguments) { this.target = target; this.methodName = methodName; this.arguments = (arguments != null) ? arguments : new Object[0]; storeTargetName(target); }
public Statement(Object target, String methodName, Object[] arguments) { this.target = target; this.methodName = methodName; this.arguments = (arguments != null) ? arguments : new Object[0]; }
2,162
final Object doExecute() throws Exception { Class klazz = (target instanceof Class) ? (Class) target : target.getClass(); Object args[] = (arguments == null) ? new Object[0] : arguments; Class argTypes[] = new Class[args.length]; for (int i = 0; i < args.length; i++) argTypes[i] = args[i].getClass(); if (target.getClass().isArray()) { // FIXME: invoke may have to be used. For now, cast to Number // and hope for the best. If caller didn't behave, we go boom // and throw the exception. if (methodName.equals("get") && argTypes.length == 1) return Array.get(target, ((Number)args[0]).intValue()); if (methodName.equals("set") && argTypes.length == 2) { Object obj = Array.get(target, ((Number)args[0]).intValue()); Array.set(target, ((Number)args[0]).intValue(), args[1]); return obj; } throw new NoSuchMethodException("No matching method for statement " + toString()); } // If we already cached the method, just use it. if (method != null) return method.invoke(target, args); else if (ctor != null) return ctor.newInstance(args); // Find a matching method to call. JDK seems to go through all // this to find the method to call. // if method name or length don't match, skip // Need to go through each arg // If arg is wrapper - check if method arg is matchable builtin // or same type or super // - check that method arg is same or super if (methodName.equals("new") && target instanceof Class) { Constructor ctors[] = klazz.getConstructors(); for (int i = 0; i < ctors.length; i++) { // Skip methods with wrong number of args. Class ptypes[] = ctors[i].getParameterTypes(); if (ptypes.length != args.length) continue; // Check if method matches if (!compatible(ptypes, argTypes)) continue; // Use method[i] if it is more specific. // FIXME: should this check both directions and throw if // neither is more specific? if (ctor == null) { ctor = ctors[i]; continue; } Class mptypes[] = ctor.getParameterTypes(); if (moreSpecific(ptypes, mptypes)) ctor = ctors[i]; } if (ctor == null) throw new InstantiationException("No matching constructor for statement " + toString()); return ctor.newInstance(args); } Method methods[] = klazz.getMethods(); for (int i = 0; i < methods.length; i++) { // Skip methods with wrong name or number of args. if (!methods[i].getName().equals(methodName)) continue; Class ptypes[] = methods[i].getParameterTypes(); if (ptypes.length != args.length) continue; // Check if method matches if (!compatible(ptypes, argTypes)) continue; // Use method[i] if it is more specific. // FIXME: should this check both directions and throw if // neither is more specific? if (method == null) { method = methods[i]; continue; } Class mptypes[] = method.getParameterTypes(); if (moreSpecific(ptypes, mptypes)) method = methods[i]; } if (method == null) throw new NoSuchMethodException("No matching method for statement " + toString()); return method.invoke(target, args); }
final Object doExecute() throws Exception { Class klazz = (target instanceof Class) ? (Class) target : target.getClass(); Object args[] = (arguments == null) ? new Object[0] : arguments; Class argTypes[] = new Class[args.length]; for (int i = 0; i < args.length; i++) argTypes[i] = (args[i] != null) ? args[i].getClass() : null; if (target.getClass().isArray()) { // FIXME: invoke may have to be used. For now, cast to Number // and hope for the best. If caller didn't behave, we go boom // and throw the exception. if (methodName.equals("get") && argTypes.length == 1) return Array.get(target, ((Number)args[0]).intValue()); if (methodName.equals("set") && argTypes.length == 2) { Object obj = Array.get(target, ((Number)args[0]).intValue()); Array.set(target, ((Number)args[0]).intValue(), args[1]); return obj; } throw new NoSuchMethodException("No matching method for statement " + toString()); } // If we already cached the method, just use it. if (method != null) return method.invoke(target, args); else if (ctor != null) return ctor.newInstance(args); // Find a matching method to call. JDK seems to go through all // this to find the method to call. // if method name or length don't match, skip // Need to go through each arg // If arg is wrapper - check if method arg is matchable builtin // or same type or super // - check that method arg is same or super if (methodName.equals("new") && target instanceof Class) { Constructor ctors[] = klazz.getConstructors(); for (int i = 0; i < ctors.length; i++) { // Skip methods with wrong number of args. Class ptypes[] = ctors[i].getParameterTypes(); if (ptypes.length != args.length) continue; // Check if method matches if (!compatible(ptypes, argTypes)) continue; // Use method[i] if it is more specific. // FIXME: should this check both directions and throw if // neither is more specific? if (ctor == null) { ctor = ctors[i]; continue; } Class mptypes[] = ctor.getParameterTypes(); if (moreSpecific(ptypes, mptypes)) ctor = ctors[i]; } if (ctor == null) throw new InstantiationException("No matching constructor for statement " + toString()); return ctor.newInstance(args); } Method methods[] = klazz.getMethods(); for (int i = 0; i < methods.length; i++) { // Skip methods with wrong name or number of args. if (!methods[i].getName().equals(methodName)) continue; Class ptypes[] = methods[i].getParameterTypes(); if (ptypes.length != args.length) continue; // Check if method matches if (!compatible(ptypes, argTypes)) continue; // Use method[i] if it is more specific. // FIXME: should this check both directions and throw if // neither is more specific? if (method == null) { method = methods[i]; continue; } Class mptypes[] = method.getParameterTypes(); if (moreSpecific(ptypes, mptypes)) method = methods[i]; } if (method == null) throw new NoSuchMethodException("No matching method for statement " + toString()); return method.invoke(target, args); }
2,164
public String toString() { StringBuffer result = new StringBuffer(); Class klass = target.getClass(); result.append( ((WeakHashMap) classMaps.get(klass)).get(target)); result.append("."); result.append(methodName); result.append("("); String sep = ""; for (int i = 0; i < arguments.length; i++) { result.append(sep); result.append(arguments[i].getClass().getName()); sep = ", "; } result.append(")"); return result.toString(); }
public String toString() { StringBuffer result = new StringBuffer(); String targetName = target.getClass().getName(); if ( targetName.startsWith("java")) { targetName = targetName.substring(targetName.lastIndexOf('.') + 1); } result.append( ((WeakHashMap) classMaps.get(klass)).get(target)); result.append("."); result.append(methodName); result.append("("); String sep = ""; for (int i = 0; i < arguments.length; i++) { result.append(sep); result.append(arguments[i].getClass().getName()); sep = ", "; } result.append(")"); return result.toString(); }
2,166
public String toString() { StringBuffer result = new StringBuffer(); Class klass = target.getClass(); result.append( ((WeakHashMap) classMaps.get(klass)).get(target)); result.append("."); result.append(methodName); result.append("("); String sep = ""; for (int i = 0; i < arguments.length; i++) { result.append(sep); result.append(arguments[i].getClass().getName()); sep = ", "; } result.append(")"); return result.toString(); }
public String toString() { StringBuffer result = new StringBuffer(); Class klass = target.getClass(); result.append(targetName); result.append("."); result.append(methodName); result.append("("); String sep = ""; for (int i = 0; i < arguments.length; i++) { result.append(sep); result.append(arguments[i].getClass().getName()); sep = ", "; } result.append(")"); return result.toString(); }
2,167
public String toString() { StringBuffer result = new StringBuffer(); Class klass = target.getClass(); result.append( ((WeakHashMap) classMaps.get(klass)).get(target)); result.append("."); result.append(methodName); result.append("("); String sep = ""; for (int i = 0; i < arguments.length; i++) { result.append(sep); result.append(arguments[i].getClass().getName()); sep = ", "; } result.append(")"); return result.toString(); }
public String toString() { StringBuffer result = new StringBuffer(); Class klass = target.getClass(); result.append( ((WeakHashMap) classMaps.get(klass)).get(target)); result.append("."); result.append(methodName); result.append("("); String sep = ""; for (int i = 0; i < arguments.length; i++) { result.append(sep); result.append( ( arguments[i] == null ) ? "null" : ( arguments[i] instanceof String ) ? "\"" + arguments[i] + "\"" : arguments[i].getClass().getName()); sep = ", "; } result.append(")"); return result.toString(); }
2,168
protected void nextRandomBytes(byte[] buffer) { if (rnd != null) { rnd.nextBytes(buffer); } else if (irnd != null) { try { irnd.nextBytes(buffer, 0, buffer.length); } catch (LimitReachedException lre) { irnd = null; new SecureRandom ().nextBytes(buffer); } } else { new SecureRandom ().nextBytes(buffer); } }
protected void nextRandomBytes(byte[] buffer) { if (rnd != null) { rnd.nextBytes(buffer); } else if (irnd != null) { try { irnd.nextBytes(buffer, 0, buffer.length); } catch (LimitReachedException lre) { irnd = null; getDefaultPRNG().nextBytes(buffer); } } else { getDefaultPRNG().nextBytes(buffer); } }
2,170
protected void nextRandomBytes(byte[] buffer) { if (rnd != null) { rnd.nextBytes(buffer); } else if (irnd != null) { try { irnd.nextBytes(buffer, 0, buffer.length); } catch (LimitReachedException lre) { irnd = null; new SecureRandom ().nextBytes(buffer); } } else { new SecureRandom ().nextBytes(buffer); } }
protected void nextRandomBytes(byte[] buffer) { if (rnd != null) { rnd.nextBytes(buffer); } else if (irnd != null) { try { irnd.nextBytes(buffer, 0, buffer.length); } catch (LimitReachedException lre) { irnd = null; new SecureRandom ().nextBytes(buffer); } } else { new SecureRandom ().nextBytes(buffer); } }
2,171
protected void nextRandomBytes(byte[] buffer) { if (rnd != null) { rnd.nextBytes(buffer); } else if (irnd != null) { try { irnd.nextBytes(buffer, 0, buffer.length); } catch (LimitReachedException lre) { irnd = null; new SecureRandom ().nextBytes(buffer); } } else { new SecureRandom ().nextBytes(buffer); } }
protected void nextRandomBytes(byte[] buffer) { if (rnd != null) { rnd.nextBytes(buffer); else if (irnd != null) { try { irnd.nextBytes(buffer, 0, buffer.length); catch (LimitReachedException lre) { irnd = null; new SecureRandom ().nextBytes(buffer); else { new SecureRandom ().nextBytes(buffer);
2,172
public void extensionRemoved(ExtensionPoint point, Extension extension) { final ConfigurationElement[] elements = extension.getConfigurationElements(); for (int j = 0; j < elements.length; j++) { final String className = elements[j].getAttribute("class"); log.debug("Removed provider: class=" + className); if (className != null) { providers.remove(className); } } }
public void extensionRemoved(ExtensionPoint point, Extension extension) { final ConfigurationElement[] elements = extension.getConfigurationElements(); for (int j = 0; j < elements.length; j++) { final String className = elements[j].getAttribute("class"); log.debug("Removed provider: class=" + className); if (className != null) { FontProvider prv = providers.remove(className); if(firstProvider == prv) { firstProvider = null; } } } }
2,173
public void setDisabledIcon(Icon newIcon) { if (disabledIcon != newIcon) { Icon oldIcon = disabledIcon; disabledIcon = newIcon; firePropertyChange(DISABLED_ICON_CHANGED_PROPERTY, oldIcon, newIcon); } }
public void setDisabledIcon(Icon newIcon) { if (disabledIcon != newIcon) { Icon oldIcon = disabledIcon; disabledIcon = newIcon; firePropertyChange("disabledIcon", oldIcon, newIcon); } }
2,175
public void setDisplayedMnemonic(int mnemonic) { if (displayedMnemonic != mnemonic) { firePropertyChange(DISPLAYED_MNEMONIC_CHANGED_PROPERTY, displayedMnemonic, mnemonic); displayedMnemonic = mnemonic; if (text != null) setDisplayedMnemonicIndex(text.toUpperCase().indexOf(mnemonic)); } }
public void setDisplayedMnemonic(int mnemonic) { if (displayedMnemonic != mnemonic) { firePropertyChange("displayedMnemonic", displayedMnemonic, mnemonic); displayedMnemonic = mnemonic; if (text != null) setDisplayedMnemonicIndex(text.toUpperCase().indexOf(mnemonic)); } }
2,176
public void setDisplayedMnemonicIndex(int newIndex) throws IllegalArgumentException { if (newIndex < -1 || (text != null && newIndex >= text.length())) throw new IllegalArgumentException(); if (newIndex == -1 || text == null || text.charAt(newIndex) != displayedMnemonic) newIndex = -1; if (newIndex != displayedMnemonicIndex) { int oldIndex = displayedMnemonicIndex; displayedMnemonicIndex = newIndex; firePropertyChange(DISPLAYED_MNEMONIC_INDEX_CHANGED_PROPERTY, oldIndex, newIndex); } }
public void setDisplayedMnemonicIndex(int newIndex) throws IllegalArgumentException { if (newIndex < -1 || (text != null && newIndex >= text.length())) throw new IllegalArgumentException(); if (newIndex == -1 || text == null || text.charAt(newIndex) != displayedMnemonic) newIndex = -1; if (newIndex != displayedMnemonicIndex) { int oldIndex = displayedMnemonicIndex; displayedMnemonicIndex = newIndex; firePropertyChange("displayedMnemonicIndex", oldIndex, newIndex); } }
2,177
public void setHorizontalAlignment(int alignment) { if (horizontalAlignment == alignment) return; int oldAlignment = horizontalAlignment; horizontalAlignment = checkHorizontalKey(alignment, "horizontalAlignment"); firePropertyChange(HORIZONTAL_ALIGNMENT_CHANGED_PROPERTY, oldAlignment, horizontalAlignment); }
public void setHorizontalAlignment(int alignment) { if (horizontalAlignment == alignment) return; int oldAlignment = horizontalAlignment; horizontalAlignment = checkHorizontalKey(alignment, "horizontalAlignment"); firePropertyChange("horizontalAlignment", oldAlignment, horizontalAlignment); }
2,178
public void setHorizontalTextPosition(int textPosition) { if (textPosition != horizontalTextPosition) { int oldPos = horizontalTextPosition; horizontalTextPosition = checkHorizontalKey(textPosition, "horizontalTextPosition"); firePropertyChange(HORIZONTAL_TEXT_POSITION_CHANGED_PROPERTY, oldPos, horizontalTextPosition); } }
public void setHorizontalTextPosition(int textPosition) { if (textPosition != horizontalTextPosition) { int oldPos = horizontalTextPosition; horizontalTextPosition = checkHorizontalKey(textPosition, "horizontalTextPosition"); firePropertyChange("horizontalTextPosition", oldPos, horizontalTextPosition); } }
2,179
public void setIcon(Icon newIcon) { if (icon != newIcon) { Icon oldIcon = icon; icon = newIcon; firePropertyChange(ICON_CHANGED_PROPERTY, oldIcon, newIcon); } }
public void setIcon(Icon newIcon) { if (icon != newIcon) { Icon oldIcon = icon; icon = newIcon; firePropertyChange("icon", oldIcon, newIcon); } }
2,180
public void setIconTextGap(int newGap) { if (iconTextGap != newGap) { firePropertyChange(ICON_TEXT_GAP_CHANGED_PROPERTY, iconTextGap, newGap); iconTextGap = newGap; } }
public void setIconTextGap(int newGap) { if (iconTextGap != newGap) { firePropertyChange("iconTextGap", iconTextGap, newGap); iconTextGap = newGap; } }
2,181
public void setLabelFor(Component c) { if (c != labelFor) { firePropertyChange(LABEL_FOR_CHANGED_PROPERTY, labelFor, c); labelFor = c; } }
public void setLabelFor(Component c) { if (c != labelFor) { Component oldLabelFor = labelFor; labelFor = c; } }
2,182
public void setText(String newText) { if (text != newText) { String oldText = text; text = newText; firePropertyChange(TEXT_CHANGED_PROPERTY, oldText, newText); if (text != null && text.length() <= displayedMnemonicIndex) setDisplayedMnemonicIndex(text.length() - 1); } }
public void setText(String newText) { if (text != newText) { String oldText = text; text = newText; firePropertyChange("text", oldText, newText); if (text != null && text.length() <= displayedMnemonicIndex) setDisplayedMnemonicIndex(text.length() - 1); } }
2,184
public void setVerticalAlignment(int alignment) { if (alignment == verticalAlignment) return; int oldAlignment = verticalAlignment; verticalAlignment = checkVerticalKey(alignment, "verticalAlignment"); firePropertyChange(VERTICAL_ALIGNMENT_CHANGED_PROPERTY, oldAlignment, verticalAlignment); }
public void setVerticalAlignment(int alignment) { if (alignment == verticalAlignment) return; int oldAlignment = verticalAlignment; verticalAlignment = checkVerticalKey(alignment, "verticalAlignment"); firePropertyChange(VERTICAL_ALIGNMENT_CHANGED_PROPERTY, oldAlignment, verticalAlignment); }
2,185
public void setVerticalTextPosition(int textPosition) { if (textPosition != verticalTextPosition) { int oldPos = verticalTextPosition; verticalTextPosition = checkVerticalKey(textPosition, "verticalTextPosition"); firePropertyChange(VERTICAL_TEXT_POSITION_CHANGED_PROPERTY, oldPos, verticalTextPosition); } }
public void setVerticalTextPosition(int textPosition) { if (textPosition != verticalTextPosition) { int oldPos = verticalTextPosition; verticalTextPosition = checkVerticalKey(textPosition, "verticalTextPosition"); firePropertyChange("verticalTextPosition", oldPos, verticalTextPosition); } }
2,186
public void startInstruction(int address) { this.curInstrLabel = helper.getInstrLabel(address); if (startOfBB) { os.setObjectRef(curInstrLabel); startOfBB = false; } final int offset = os.getLength() - startOffset; cm.add(address, offset); }
public void startInstruction(int address) { this.curInstrLabel = helper.getInstrLabel(address); if (startOfBB) { os.setObjectRef(curInstrLabel); startOfBB = false; } final int offset = os.getLength() - startOffset; cm.add(currentMethod, address, offset); }
2,189
public StringIndexOutOfBoundsException() { super(); }
public StringIndexOutOfBoundsException() { }
2,191
protected final boolean negotiate(byte abyte0[]) throws IOException { int i = 0; // from server negotiations if(abyte0[i] == IAC) { // -1 while(i < abyte0.length && abyte0[i++] == -1)// while(i < abyte0.length && (abyte0[i] == -1 || abyte0[i++] == 0x20)) switch(abyte0[i++]) { // we will not worry about what it WONT do case WONT: // -4 default: break; case DO: //-3 switch(abyte0[i]) { case TERMINAL_TYPE: // 24 baosp.write(IAC); baosp.write(WILL); baosp.write(TERMINAL_TYPE); writeByte(baosp.toByteArray()); baosp.reset(); break; case OPT_END_OF_RECORD: // 25 baosp.write(IAC); baosp.write(WILL); baosp.write(OPT_END_OF_RECORD); writeByte(baosp.toByteArray()); baosp.reset(); break; case TRANSMIT_BINARY: // 0 baosp.write(IAC); baosp.write(WILL); baosp.write(TRANSMIT_BINARY); writeByte(baosp.toByteArray()); baosp.reset(); break; case TIMING_MARK: // 6 rfc860// System.out.println("Timing Mark Received and notifying " +// "the server that we will not do it"); baosp.write(IAC); baosp.write(WONT); baosp.write(TIMING_MARK); writeByte(baosp.toByteArray()); baosp.reset(); break; case NEW_ENVIRONMENT: // 39 rfc1572 if (devName == null && user == null) { baosp.write(IAC); baosp.write(WONT); baosp.write(NEW_ENVIRONMENT); writeByte(baosp.toByteArray()); baosp.reset(); } else { System.out.println(devName); baosp.write(IAC); baosp.write(WILL); baosp.write(NEW_ENVIRONMENT); writeByte(baosp.toByteArray()); baosp.reset(); } break; default: // every thing else we will not do at this time baosp.write(IAC); baosp.write(WONT); baosp.write(abyte0[i]); // either writeByte(baosp.toByteArray()); baosp.reset(); break; } i++; break; case WILL: switch(abyte0[i]) { case OPT_END_OF_RECORD: // 25 baosp.write(IAC); baosp.write(DO); baosp.write(OPT_END_OF_RECORD); writeByte(baosp.toByteArray()); baosp.reset(); break; case TRANSMIT_BINARY: // '\0' baosp.write(IAC); baosp.write(DO); baosp.write(TRANSMIT_BINARY); writeByte(baosp.toByteArray()); baosp.reset(); break; } i++; break; case SB: // -6 if(abyte0[i] == NEW_ENVIRONMENT && abyte0[i + 1] == 1) { negNewEnvironment(); while (++i < abyte0.length && abyte0[i + 1] != IAC); } if(abyte0[i] == TERMINAL_TYPE && abyte0[i + 1] == 1) { baosp.write(IAC); baosp.write(SB); baosp.write(TERMINAL_TYPE); baosp.write(QUAL_IS); if(!support132) baosp.write("IBM-3179-2".getBytes()); else baosp.write("IBM-3477-FC".getBytes()); baosp.write(IAC); baosp.write(SE); writeByte(baosp.toByteArray()); baosp.reset(); i++; } i++; break; } return true; } else { return false; } }
protected final boolean negotiate(byte abyte0[]) throws IOException { int i = 0; // from server negotiations if(abyte0[i] == IAC) { // -1 while(i < abyte0.length && abyte0[i++] == -1)// while(i < abyte0.length && (abyte0[i] == -1 || abyte0[i++] == 0x20)) switch(abyte0[i++]) { // we will not worry about what it WONT do case WONT: // -4 default: break; case DO: //-3 switch(abyte0[i]) { case TERMINAL_TYPE: // 24 baosp.write(IAC); baosp.write(WILL); baosp.write(TERMINAL_TYPE); writeByte(baosp.toByteArray()); baosp.reset(); break; case OPT_END_OF_RECORD: // 25 baosp.write(IAC); baosp.write(WILL); baosp.write(OPT_END_OF_RECORD); writeByte(baosp.toByteArray()); baosp.reset(); break; case TRANSMIT_BINARY: // 0 baosp.write(IAC); baosp.write(WILL); baosp.write(TRANSMIT_BINARY); writeByte(baosp.toByteArray()); baosp.reset(); break; case TIMING_MARK: // 6 rfc860// System.out.println("Timing Mark Received and notifying " +// "the server that we will not do it"); baosp.write(IAC); baosp.write(WONT); baosp.write(TIMING_MARK); writeByte(baosp.toByteArray()); baosp.reset(); break; case NEW_ENVIRONMENT: // 39 rfc1572 if (devName == null && user == null) { baosp.write(IAC); baosp.write(WONT); baosp.write(NEW_ENVIRONMENT); writeByte(baosp.toByteArray()); baosp.reset(); } else { baosp.write(IAC); baosp.write(WILL); baosp.write(NEW_ENVIRONMENT); writeByte(baosp.toByteArray()); baosp.reset(); } break; default: // every thing else we will not do at this time baosp.write(IAC); baosp.write(WONT); baosp.write(abyte0[i]); // either writeByte(baosp.toByteArray()); baosp.reset(); break; } i++; break; case WILL: switch(abyte0[i]) { case OPT_END_OF_RECORD: // 25 baosp.write(IAC); baosp.write(DO); baosp.write(OPT_END_OF_RECORD); writeByte(baosp.toByteArray()); baosp.reset(); break; case TRANSMIT_BINARY: // '\0' baosp.write(IAC); baosp.write(DO); baosp.write(TRANSMIT_BINARY); writeByte(baosp.toByteArray()); baosp.reset(); break; } i++; break; case SB: // -6 if(abyte0[i] == NEW_ENVIRONMENT && abyte0[i + 1] == 1) { negNewEnvironment(); while (++i < abyte0.length && abyte0[i + 1] != IAC); } if(abyte0[i] == TERMINAL_TYPE && abyte0[i + 1] == 1) { baosp.write(IAC); baosp.write(SB); baosp.write(TERMINAL_TYPE); baosp.write(QUAL_IS); if(!support132) baosp.write("IBM-3179-2".getBytes()); else baosp.write("IBM-3477-FC".getBytes()); baosp.write(IAC); baosp.write(SE); writeByte(baosp.toByteArray()); baosp.reset(); i++; } i++; break; } return true; } else { return false; } }
2,197
private boolean writeToDisplay(boolean controlsExist) { int pos = 0; boolean error=false; boolean done=false; int attr; byte nextOne; byte control0 = 0; byte control1 = 0; int saRows = screen52.getRows(); int saCols = screen52.getCols(); try { if (controlsExist) { control0 = bk.getNextByte(); control1 = bk.getNextByte(); processCC0(control0); } while (bk.hasNext() && !done) {// pos = bk.getCurrentPos();// int rowc = screen52.getCurrentRow();// int colc = screen52.getCurrentCol(); switch (bk.getNextByte()) { case 1: // SOH - Start of Header Order error = processSOH(); break; case 02: // RA - Repeat to address int row = screen52.getCurrentRow(); int col = screen52.getCurrentCol(); int toRow = bk.getNextByte(); int toCol = bk.getNextByte() & 0xff; if (toRow >= row) { int repeat = bk.getNextByte(); // a little intelligence here I hope if (row == 1 && col == 2 && toRow == screen52.getRows() && toCol == screen52.getCols()) screen52.clearScreen(); else { if (repeat != 0) { //LDC - 13/02/2003 - convert it to unicode repeat = this.ebcdic2uni(repeat); //repeat = getASCIIChar(repeat); } int times = ((toRow * screen52.getCols()) + toCol) - ((row * screen52.getCols()) + col); while (times-- >= 0) { screen52.setChar(repeat); } } } else { sendNegResponse(NR_REQUEST_ERROR,0x05,0x01,0x23," RA invalid"); error =true; } break; case 03: // EA - Erase to address int EArow = screen52.getCurrentRow(); int EAcol = screen52.getCurrentCol(); int toEARow = bk.getNextByte(); int toEACol = bk.getNextByte() & 0xff; int EALength = bk.getNextByte() & 0xff; while (--EALength > 0) { bk.getNextByte(); } char EAAttr = (char)0; // a little intelligence here I hope if (EArow == 1 && EAcol == 2 && toEARow == screen52.getRows() && toEACol == screen52.getCols()) screen52.clearScreen(); else { int times = ((toEARow * screen52.getCols()) + toEACol) - ((EArow * screen52.getCols()) + EAcol); while (times-- >= 0) { screen52.setChar(EAAttr); } } break; case 04: // Command - Escape done = true; break; case 16: // TD - Transparent Data bk.getNextByte(); int j = bk.getNextByte(); // length while (j-- > 0) bk.getNextByte(); break; case 17: // SBA - set buffer address order (row column) int saRow = bk.getNextByte(); int saCol = bk.getNextByte() & 0xff; // make sure it is in bounds if (saRow >= 0 && saRow <= screen52.getRows() && saCol >= 0 && saCol <= screen52.getCols()) { screen52.goto_XY(saRow,saCol); // now set screen position for output } else { sendNegResponse(NR_REQUEST_ERROR,0x05,0x01,0x22,"invalid row/col order" + " saRow = " + saRow + " saRows = " + screen52.getRows() + " saCol = " + saCol); error = true; } break; case 18: // WEA - Extended Attribute bk.getNextByte(); bk.getNextByte(); break; case 19: // IC - Insert Cursor int icX = bk.getNextByte(); int icY = bk.getNextByte() & 0xff; if (icX >= 0 && icX <= saRows && icY >= 0 && icY <= saCols) {// System.out.println(" IC " + icX + " " + icY); screen52.setPendingInsert(true,icX,icY); } else { sendNegResponse(NR_REQUEST_ERROR,0x05,0x01,0x22," IC/IM position invalid "); error = true; } break; case 20: // MC - Move Cursor int imcX = bk.getNextByte(); int imcY = bk.getNextByte() & 0xff; if (imcX >= 0 && imcX <= saRows && imcY >= 0 && imcY <= saCols) {// System.out.println(" MC " + imcX + " " + imcY); screen52.setPendingInsert(false,imcX,imcY); } else { sendNegResponse(NR_REQUEST_ERROR,0x05,0x01,0x22," IC/IM position invalid "); error = true; } break; case 21: // WTDSF - Write To Display Structured Field order error = writeToDisplayStructuredField(); break; case 29: // SF - Start of Field int fcw1 = 0; int fcw2 = 0; int ffw1 = 0; int ffw0 = bk.getNextByte() & 0xff; // FFW if ((ffw0 & 0x40) == 0x40) { ffw1 = bk.getNextByte() & 0xff; // FFW 1 fcw1 = bk.getNextByte() & 0xff; // check for field control word // check if the first fcw1 is an 0x81 if it is then get the // next pair for checking if (fcw1 == 0x81) { bk.getNextByte(); fcw1 = bk.getNextByte() & 0xff; // check for field control word } if (!isAttribute(fcw1)) { fcw2 = bk.getNextByte() & 0xff; // FCW 2 attr = bk.getNextByte() & 0xff; // attribute field while(!isAttribute(attr)) { System.out.print(Integer.toHexString(fcw1) + " " + Integer.toHexString(fcw2) + " "); System.out.println(Integer.toHexString(attr) + " " + Integer.toHexString(bk.getNextByte() & 0xff));// bk.getNextByte(); attr = bk.getNextByte() & 0xff; // attribute field } } else { attr = fcw1; // attribute of field fcw1 = 0; } } else { attr = ffw0; } int fLength = (bk.getNextByte() & 0xff) << 8 | bk.getNextByte() & 0xff; screen52.addField(attr,fLength, ffw0,ffw1,fcw1,fcw2); break; default: // all others must be output to screen byte byte0 = bk.getByteOffset(-1); if (isAttribute(byte0)) { screen52.setAttr(byte0); } else { if (!screen52.isStatusErrorCode()) { if (!isDataEBCDIC(byte0)) {// if (byte0 == 255) {// sendNegResponse(NR_REQUEST_ERROR,0x05,0x01,0x42,// " Attempt to send FF to screen");// }// else screen52.setChar(byte0); } else //LDC - 13/02/2003 - Convert it to unicode //screen52.setChar(getASCIIChar(byte0)); screen52.setChar(codePage.ebcdic2uni(byte0)); } else { if (byte0 == 0) screen52.setChar(byte0); else //LDC - 13/02/2003 - Convert it to unicode //screen52.setChar(getASCIIChar(byte0)); screen52.setChar(codePage.ebcdic2uni(byte0)); } } break; } if (error) done = true; } } catch (Exception e) { System.out.println("write to display " + e.getMessage()); }; processCC1(control1); return error; }
private boolean writeToDisplay(boolean controlsExist) { int pos = 0; boolean error=false; boolean done=false; int attr; byte nextOne; byte control0 = 0; byte control1 = 0; int saRows = screen52.getRows(); int saCols = screen52.getCols(); try { if (controlsExist) { control0 = bk.getNextByte(); control1 = bk.getNextByte(); processCC0(control0); } while (bk.hasNext() && !done) {// pos = bk.getCurrentPos();// int rowc = screen52.getCurrentRow();// int colc = screen52.getCurrentCol(); switch (bk.getNextByte()) { case 1: // SOH - Start of Header Order error = processSOH(); break; case 02: // RA - Repeat to address int row = screen52.getCurrentRow(); int col = screen52.getCurrentCol(); int toRow = bk.getNextByte(); int toCol = bk.getNextByte() & 0xff; if (toRow >= row) { int repeat = bk.getNextByte(); // a little intelligence here I hope if (row == 1 && col == 2 && toRow == screen52.getRows() && toCol == screen52.getCols()) screen52.clearScreen(); else { if (repeat != 0) { //LDC - 13/02/2003 - convert it to unicode repeat = this.ebcdic2uni(repeat); //repeat = getASCIIChar(repeat); } int times = ((toRow * screen52.getCols()) + toCol) - ((row * screen52.getCols()) + col); while (times-- >= 0) { screen52.setChar(repeat); } } } else { sendNegResponse(NR_REQUEST_ERROR,0x05,0x01,0x23," RA invalid"); error =true; } break; case 03: // EA - Erase to address int EArow = screen52.getCurrentRow(); int EAcol = screen52.getCurrentCol(); int toEARow = bk.getNextByte(); int toEACol = bk.getNextByte() & 0xff; int EALength = bk.getNextByte() & 0xff; while (--EALength > 0) { bk.getNextByte(); } char EAAttr = (char)0; // a little intelligence here I hope if (EArow == 1 && EAcol == 2 && toEARow == screen52.getRows() && toEACol == screen52.getCols()) screen52.clearScreen(); else { int times = ((toEARow * screen52.getCols()) + toEACol) - ((EArow * screen52.getCols()) + EAcol); while (times-- >= 0) { screen52.setChar(EAAttr); } } break; case 04: // Command - Escape done = true; break; case 16: // TD - Transparent Data bk.getNextByte(); int j = bk.getNextByte(); // length while (j-- > 0) bk.getNextByte(); break; case 17: // SBA - set buffer address order (row column) int saRow = bk.getNextByte(); int saCol = bk.getNextByte() & 0xff; // make sure it is in bounds if (saRow >= 0 && saRow <= screen52.getRows() && saCol >= 0 && saCol <= screen52.getCols()) { screen52.goto_XY(saRow,saCol); // now set screen position for output } else { sendNegResponse(NR_REQUEST_ERROR,0x05,0x01,0x22,"invalid row/col order" + " saRow = " + saRow + " saRows = " + screen52.getRows() + " saCol = " + saCol); error = true; } break; case 18: // WEA - Extended Attribute bk.getNextByte(); bk.getNextByte(); break; case 19: // IC - Insert Cursor int icX = bk.getNextByte(); int icY = bk.getNextByte() & 0xff; if (icX >= 0 && icX <= saRows && icY >= 0 && icY <= saCols) {// System.out.println(" IC " + icX + " " + icY); screen52.setPendingInsert(true,icX,icY); } else { sendNegResponse(NR_REQUEST_ERROR,0x05,0x01,0x22," IC/IM position invalid "); error = true; } break; case 20: // MC - Move Cursor int imcX = bk.getNextByte(); int imcY = bk.getNextByte() & 0xff; if (imcX >= 0 && imcX <= saRows && imcY >= 0 && imcY <= saCols) {// System.out.println(" MC " + imcX + " " + imcY); screen52.setPendingInsert(false,imcX,imcY); } else { sendNegResponse(NR_REQUEST_ERROR,0x05,0x01,0x22," IC/IM position invalid "); error = true; } break; case 21: // WTDSF - Write To Display Structured Field order error = writeToDisplayStructuredField(); break; case 29: // SF - Start of Field int fcw1 = 0; int fcw2 = 0; int ffw1 = 0; int ffw0 = bk.getNextByte() & 0xff; // FFW if ((ffw0 & 0x40) == 0x40) { ffw1 = bk.getNextByte() & 0xff; // FFW 1 fcw1 = bk.getNextByte() & 0xff; // check for field control word // check if the first fcw1 is an 0x81 if it is then get the // next pair for checking if (fcw1 == 0x81) { bk.getNextByte(); fcw1 = bk.getNextByte() & 0xff; // check for field control word } if (!isAttribute(fcw1)) { fcw2 = bk.getNextByte() & 0xff; // FCW 2 attr = bk.getNextByte() & 0xff; // attribute field while(!isAttribute(attr)) { System.out.print(Integer.toHexString(fcw1) + " " + Integer.toHexString(fcw2) + " "); System.out.println(Integer.toHexString(attr) + " " + Integer.toHexString(bk.getNextByte() & 0xff));// bk.getNextByte(); attr = bk.getNextByte() & 0xff; // attribute field } } else { attr = fcw1; // attribute of field fcw1 = 0; } } else { attr = ffw0; } int fLength = (bk.getNextByte() & 0xff) << 8 | bk.getNextByte() & 0xff; screen52.addField(attr,fLength, ffw0,ffw1,fcw1,fcw2); break; default: // all others must be output to screen byte byte0 = bk.getByteOffset(-1); if (isAttribute(byte0)) { screen52.setAttr(byte0); } else { if (!screen52.isStatusErrorCode()) { if (!isDataEBCDIC(byte0)) {// if (byte0 == 255) {// sendNegResponse(NR_REQUEST_ERROR,0x05,0x01,0x42,// " Attempt to send FF to screen");// }// else screen52.setChar(byte0); } else //LDC - 13/02/2003 - Convert it to unicode //screen52.setChar(getASCIIChar(byte0)); screen52.setChar(codePage.ebcdic2uni(byte0)); } else { if (byte0 == 0) screen52.setChar(byte0); else //LDC - 13/02/2003 - Convert it to unicode //screen52.setChar(getASCIIChar(byte0)); screen52.setChar(codePage.ebcdic2uni(byte0)); } } break; } if (error) done = true; } } catch (Exception e) { System.out.println("write to display " + e.getMessage()); }; processCC1(control1); return error; }
2,199
public SwingScrollPanePeer(ScrollPane scrollPane) { super(); SwingToolkit.add(scrollPane, this); SwingToolkit.copyAwtProperties(scrollPane, this); }
public SwingScrollPanePeer(ScrollPane scrollPane) { super(); SwingToolkit.add(scrollPane, this); SwingToolkit.copyAwtProperties(scrollPane, this); }
2,202
public AccessibleContext getAccessibleContext(){ /* Create the context if this is the first request */ if (accessibleContext == null) { /* Create the context */ accessibleContext = new AccessibleAWTMenuBar(); } return accessibleContext;}
public AccessibleContext getAccessibleContext() /* Create the context if this is the first request */ if (accessibleContext == null) /* Create the context */ accessibleContext = new AccessibleAWTMenuBar(); } return accessibleContext;}
2,204
public AccessibleContext getAccessibleContext(){ /* Create the context if this is the first request */ if (accessibleContext == null) { /* Create the context */ accessibleContext = new AccessibleAWTMenuBar(); } return accessibleContext;}
public AccessibleContext getAccessibleContext(){ /* Create the context if this is the first request */ if (accessibleContext == null) { /* Create the context */ accessibleContext = new AccessibleAWTMenuBar(); return accessibleContext;
2,205
getPeer(){ return(peer);}
getPeer(){ return(peer);}
2,206
getToolkit(){ return(toolkit);}
getToolkit(){ return(toolkit);}
2,207
setPeer(MenuComponentPeer peer){ this.peer = peer;}
setPeer(MenuComponentPeer peer){ this.peer = peer;}
2,208
removeNotify(){ if (peer != null) peer.dispose(); peer = null;}
removeNotify(){ if (peer != null) peer.dispose(); peer = null;}
2,209
public Rectangle getCellRect(int row, int column, boolean includeSpacing) { int height = getHeight(); int width = columnModel.getColumn(column).getWidth(); int x_gap = columnModel.getColumnMargin(); int y_gap = rowMargin; column = Math.max(0, Math.min(column, getColumnCount() - 1)); row = Math.max(0, Math.min(row, getRowCount() - 1)); int x = 0; int y = (height + y_gap) * row; for (int i = 0; i < column; ++i) { x += columnModel.getColumn(i).getWidth(); x += x_gap; } if (includeSpacing) return new Rectangle(x, y, width, height); else return new Rectangle(x, y, width - x_gap, height - y_gap); }
public Rectangle getCellRect(int row, int column, boolean includeSpacing) { int height = getRowHeight(row); int width = columnModel.getColumn(column).getWidth(); int x_gap = columnModel.getColumnMargin(); int y_gap = rowMargin; column = Math.max(0, Math.min(column, getColumnCount() - 1)); row = Math.max(0, Math.min(row, getRowCount() - 1)); int x = 0; int y = (height + y_gap) * row; for (int i = 0; i < column; ++i) { x += columnModel.getColumn(i).getWidth(); x += x_gap; } if (includeSpacing) return new Rectangle(x, y, width, height); else return new Rectangle(x, y, width - x_gap, height - y_gap); }
2,210
public JSpinner(SpinnerModel model) { this.model = model; model.addChangeListener(listener); setEditor(createEditor(model)); updateUI(); }
public JSpinner() { this.model = model; model.addChangeListener(listener); setEditor(createEditor(model)); updateUI(); }
2,212
public JSpinner(SpinnerModel model) { this.model = model; model.addChangeListener(listener); setEditor(createEditor(model)); updateUI(); }
public JSpinner(SpinnerModel model) { this.model = model; model.addChangeListener(listener); setEditor(createEditor(model)); updateUI(); }
2,213
public DateFormatter(DateFormat format) { super(); setFormat(format); }
public DateFormatter() { super(); setFormat(format); }
2,214
public DateFormatter(DateFormat format) { super(); setFormat(format); }
public DateFormatter(DateFormat format) { super(); setFormat(format); }
2,215
void installDefaults(JComponent c) { c.setOpaque(true); }
protected void installDefaults(JComponent c) { c.setOpaque(true); }
2,216
public void installUI(JComponent c) { super.installUI(c); installListeners(c); }
public void installUI(JComponent c) { super.installUI(c); installDefaults(c); }
2,218
void uninstallDefaults(JComponent c) { }
protected void uninstallDefaults(JComponent c) { }
2,219
public void uninstallUI(JComponent c) { uninstallListeners(c); }
public void uninstallUI(JComponent c) { super.uninstallUI(c); uninstallDefaults(c); }
2,220
public AccessibleJViewport() { // Nothing to do here. }
protected AccessibleJViewport() { // Nothing to do here. }
2,221
protected boolean computeBlit(int dx, int dy, Point blitFrom, Point blitTo, Dimension blitSize, Rectangle blitPaint) { if ((dx != 0 && dy != 0) || damaged) // We cannot blit if the viewport is scrolled in both directions at // once. return false; Rectangle portBounds = SwingUtilities.calculateInnerArea(this, getBounds()); // Compute the blitFrom and blitTo parameters. blitFrom.x = portBounds.x; blitFrom.y = portBounds.y; blitTo.x = portBounds.x; blitTo.y = portBounds.y; if (dy > 0) { blitFrom.y = portBounds.y + dy; } else if (dy < 0) { blitTo.y = portBounds.y - dy; } else if (dx > 0) { blitFrom.x = portBounds.x + dx; } else if (dx < 0) { blitTo.x = portBounds.x - dx; } // Compute size of the blit area. if (dx != 0) { blitSize.width = portBounds.width - Math.abs(dx); blitSize.height = portBounds.height; } else if (dy != 0) { blitSize.width = portBounds.width; blitSize.height = portBounds.height - Math.abs(dy); } // Compute the blitPaint parameter. blitPaint.setBounds(portBounds); if (dy > 0) { blitPaint.y = portBounds.y + portBounds.height - dy; blitPaint.height = dy; } else if (dy < 0) { blitPaint.height = -dy; } if (dx > 0) { blitPaint.x = portBounds.x + portBounds.width - dx; blitPaint.width = dx; } else if (dx < 0) { blitPaint.width = -dx; } return true; }
protected boolean computeBlit(int dx, int dy, Point blitFrom, Point blitTo, Dimension blitSize, Rectangle blitPaint) { if ((dx != 0 && dy != 0) || (dy == 0 && dy == 0) || damaged) // We cannot blit if the viewport is scrolled in both directions at // once. return false; Rectangle portBounds = SwingUtilities.calculateInnerArea(this, getBounds()); // Compute the blitFrom and blitTo parameters. blitFrom.x = portBounds.x; blitFrom.y = portBounds.y; blitTo.x = portBounds.x; blitTo.y = portBounds.y; if (dy > 0) { blitFrom.y = portBounds.y + dy; } else if (dy < 0) { blitTo.y = portBounds.y - dy; } else if (dx > 0) { blitFrom.x = portBounds.x + dx; } else if (dx < 0) { blitTo.x = portBounds.x - dx; } // Compute size of the blit area. if (dx != 0) { blitSize.width = portBounds.width - Math.abs(dx); blitSize.height = portBounds.height; } else if (dy != 0) { blitSize.width = portBounds.width; blitSize.height = portBounds.height - Math.abs(dy); } // Compute the blitPaint parameter. blitPaint.setBounds(portBounds); if (dy > 0) { blitPaint.y = portBounds.y + portBounds.height - dy; blitPaint.height = dy; } else if (dy < 0) { blitPaint.height = -dy; } if (dx > 0) { blitPaint.x = portBounds.x + portBounds.width - dx; blitPaint.width = dx; } else if (dx < 0) { blitPaint.width = -dx; } return true; }
2,222
public DelimitedDialog(JFrame parent) { JPanel opts = new JPanel(); opts.setBorder(BorderFactory.createTitledBorder( LangTool.getString("delm.labelOptions"))); opts.setLayout(new AlignLayout(2,5,5)); JLabel fdl = new JLabel(LangTool.getString("delm.labelField")); JComboBox fd = new JComboBox(); fd.addItem(","); fd.addItem(";"); fd.addItem(":"); fd.addItem("|"); fd.addItem(LangTool.getString("delm.labelSpace")); fd.addItem(LangTool.getString("delm.labelTab")); fd.setEditable(true); fd.setSelectedIndex(0); JLabel tdl = new JLabel(LangTool.getString("delm.labelText")); JComboBox td = new JComboBox(); td.addItem("\""); td.addItem("'"); td.setEditable(true); td.setSelectedIndex(0); opts.add(fdl); opts.add(fd); opts.add(tdl); opts.add(td); Object[] message = new Object[1]; message[0] = opts; String[] options = {UIManager.getString("OptionPane.okButtonText"), UIManager.getString("OptionPane.cancelButtonText")}; int result = JOptionPane.showOptionDialog( parent, // the parent that the dialog blocks message, // the dialog message array LangTool.getString("delm.title"), // the title of the dialog window JOptionPane.DEFAULT_OPTION, // option type JOptionPane.PLAIN_MESSAGE, // message type null, // optional icon, use null to use the default icon options, // options string array, will be made into buttons// options[0] // option that should be made into a default button ); switch(result) { case 0: // change options delimiter = (String)fd.getSelectedItem(); if (delimiter.equals(LangTool.getString("delm.labelSpace"))) delimiter = " "; if (delimiter.equals(LangTool.getString("delm.labelTab"))) delimiter = "\t"; stringQualifier = (String)td.getSelectedItem(); break; case 1: // Cancel // System.out.println("Cancel"); break; default: break; } }
public DelimitedDialog(JFrame parent) { JPanel opts = new JPanel(); opts.setBorder(BorderFactory.createTitledBorder( LangTool.getString("delm.labelOptions"))); opts.setLayout(new AlignLayout(2,5,5)); JLabel fdl = new JLabel(LangTool.getString("delm.labelField")); JComboBox fd = new JComboBox(); fd.addItem(","); fd.addItem(";"); fd.addItem(":"); fd.addItem("|"); fd.addItem(LangTool.getString("delm.labelSpace")); fd.addItem(LangTool.getString("delm.labelNone")); if (delimiter.length() > 0) if (delimiter.equals("\t")) fd.setSelectedItem(LangTool.getString("delm.labelTab")); else if (delimiter.equals(" ")) fd.setSelectedItem(LangTool.getString("delm.labelSpace")); else { if (!delimiter.equals(",") && !delimiter.equals(";") && !delimiter.equals(":") && !delimiter.equals("|")) fd.addItem(delimiter); fd.setSelectedItem(delimiter); } else fd.setSelectedItem(LangTool.getString("delm.labelNone")); fd.setEditable(true); fd.setSelectedIndex(0); JLabel tdl = new JLabel(LangTool.getString("delm.labelText")); JComboBox td = new JComboBox(); td.addItem("\""); td.addItem("'"); td.setEditable(true); td.setSelectedIndex(0); opts.add(fdl); opts.add(fd); opts.add(tdl); opts.add(td); Object[] message = new Object[1]; message[0] = opts; String[] options = {UIManager.getString("OptionPane.okButtonText"), UIManager.getString("OptionPane.cancelButtonText")}; int result = JOptionPane.showOptionDialog( parent, // the parent that the dialog blocks message, // the dialog message array LangTool.getString("delm.title"), // the title of the dialog window JOptionPane.DEFAULT_OPTION, // option type JOptionPane.PLAIN_MESSAGE, // message type null, // optional icon, use null to use the default icon options, // options string array, will be made into buttons// options[0] // option that should be made into a default button ); switch(result) { case 0: // change options delimiter = (String)fd.getSelectedItem(); if (delimiter.equals(LangTool.getString("delm.labelSpace"))) delimiter = " "; if (delimiter.equals(LangTool.getString("delm.labelTab"))) delimiter = "\t"; stringQualifier = (String)td.getSelectedItem(); break; case 1: // Cancel // System.out.println("Cancel"); break; default: break; } }
2,223
public DelimitedDialog(JFrame parent) { JPanel opts = new JPanel(); opts.setBorder(BorderFactory.createTitledBorder( LangTool.getString("delm.labelOptions"))); opts.setLayout(new AlignLayout(2,5,5)); JLabel fdl = new JLabel(LangTool.getString("delm.labelField")); JComboBox fd = new JComboBox(); fd.addItem(","); fd.addItem(";"); fd.addItem(":"); fd.addItem("|"); fd.addItem(LangTool.getString("delm.labelSpace")); fd.addItem(LangTool.getString("delm.labelTab")); fd.setEditable(true); fd.setSelectedIndex(0); JLabel tdl = new JLabel(LangTool.getString("delm.labelText")); JComboBox td = new JComboBox(); td.addItem("\""); td.addItem("'"); td.setEditable(true); td.setSelectedIndex(0); opts.add(fdl); opts.add(fd); opts.add(tdl); opts.add(td); Object[] message = new Object[1]; message[0] = opts; String[] options = {UIManager.getString("OptionPane.okButtonText"), UIManager.getString("OptionPane.cancelButtonText")}; int result = JOptionPane.showOptionDialog( parent, // the parent that the dialog blocks message, // the dialog message array LangTool.getString("delm.title"), // the title of the dialog window JOptionPane.DEFAULT_OPTION, // option type JOptionPane.PLAIN_MESSAGE, // message type null, // optional icon, use null to use the default icon options, // options string array, will be made into buttons// options[0] // option that should be made into a default button ); switch(result) { case 0: // change options delimiter = (String)fd.getSelectedItem(); if (delimiter.equals(LangTool.getString("delm.labelSpace"))) delimiter = " "; if (delimiter.equals(LangTool.getString("delm.labelTab"))) delimiter = "\t"; stringQualifier = (String)td.getSelectedItem(); break; case 1: // Cancel // System.out.println("Cancel"); break; default: break; } }
public DelimitedDialog(JFrame parent) { JPanel opts = new JPanel(); opts.setBorder(BorderFactory.createTitledBorder( LangTool.getString("delm.labelOptions"))); opts.setLayout(new AlignLayout(2,5,5)); JLabel fdl = new JLabel(LangTool.getString("delm.labelField")); JComboBox fd = new JComboBox(); fd.addItem(","); fd.addItem(";"); fd.addItem(":"); fd.addItem("|"); fd.addItem(LangTool.getString("delm.labelSpace")); fd.addItem(LangTool.getString("delm.labelTab")); fd.setEditable(true); JLabel tdl = new JLabel(LangTool.getString("delm.labelText")); JComboBox td = new JComboBox(); td.addItem("\""); td.addItem("'"); td.setEditable(true); td.setSelectedIndex(0); opts.add(fdl); opts.add(fd); opts.add(tdl); opts.add(td); Object[] message = new Object[1]; message[0] = opts; String[] options = {UIManager.getString("OptionPane.okButtonText"), UIManager.getString("OptionPane.cancelButtonText")}; int result = JOptionPane.showOptionDialog( parent, // the parent that the dialog blocks message, // the dialog message array LangTool.getString("delm.title"), // the title of the dialog window JOptionPane.DEFAULT_OPTION, // option type JOptionPane.PLAIN_MESSAGE, // message type null, // optional icon, use null to use the default icon options, // options string array, will be made into buttons// options[0] // option that should be made into a default button ); switch(result) { case 0: // change options delimiter = (String)fd.getSelectedItem(); if (delimiter.equals(LangTool.getString("delm.labelSpace"))) delimiter = " "; if (delimiter.equals(LangTool.getString("delm.labelTab"))) delimiter = "\t"; stringQualifier = (String)td.getSelectedItem(); break; case 1: // Cancel // System.out.println("Cancel"); break; default: break; } }
2,224
public DelimitedDialog(JFrame parent) { JPanel opts = new JPanel(); opts.setBorder(BorderFactory.createTitledBorder( LangTool.getString("delm.labelOptions"))); opts.setLayout(new AlignLayout(2,5,5)); JLabel fdl = new JLabel(LangTool.getString("delm.labelField")); JComboBox fd = new JComboBox(); fd.addItem(","); fd.addItem(";"); fd.addItem(":"); fd.addItem("|"); fd.addItem(LangTool.getString("delm.labelSpace")); fd.addItem(LangTool.getString("delm.labelTab")); fd.setEditable(true); fd.setSelectedIndex(0); JLabel tdl = new JLabel(LangTool.getString("delm.labelText")); JComboBox td = new JComboBox(); td.addItem("\""); td.addItem("'"); td.setEditable(true); td.setSelectedIndex(0); opts.add(fdl); opts.add(fd); opts.add(tdl); opts.add(td); Object[] message = new Object[1]; message[0] = opts; String[] options = {UIManager.getString("OptionPane.okButtonText"), UIManager.getString("OptionPane.cancelButtonText")}; int result = JOptionPane.showOptionDialog( parent, // the parent that the dialog blocks message, // the dialog message array LangTool.getString("delm.title"), // the title of the dialog window JOptionPane.DEFAULT_OPTION, // option type JOptionPane.PLAIN_MESSAGE, // message type null, // optional icon, use null to use the default icon options, // options string array, will be made into buttons// options[0] // option that should be made into a default button ); switch(result) { case 0: // change options delimiter = (String)fd.getSelectedItem(); if (delimiter.equals(LangTool.getString("delm.labelSpace"))) delimiter = " "; if (delimiter.equals(LangTool.getString("delm.labelTab"))) delimiter = "\t"; stringQualifier = (String)td.getSelectedItem(); break; case 1: // Cancel // System.out.println("Cancel"); break; default: break; } }
public DelimitedDialog(JFrame parent) { JPanel opts = new JPanel(); opts.setBorder(BorderFactory.createTitledBorder( LangTool.getString("delm.labelOptions"))); opts.setLayout(new AlignLayout(2,5,5)); JLabel fdl = new JLabel(LangTool.getString("delm.labelField")); JComboBox fd = new JComboBox(); fd.addItem(","); fd.addItem(";"); fd.addItem(":"); fd.addItem("|"); fd.addItem(LangTool.getString("delm.labelSpace")); fd.addItem(LangTool.getString("delm.labelTab")); fd.setEditable(true); fd.setSelectedIndex(0); JLabel tdl = new JLabel(LangTool.getString("delm.labelText")); JComboBox td = new JComboBox(); td.addItem("\""); td.addItem("'"); td.setEditable(true); opts.add(fdl); opts.add(fd); opts.add(tdl); opts.add(td); Object[] message = new Object[1]; message[0] = opts; String[] options = {UIManager.getString("OptionPane.okButtonText"), UIManager.getString("OptionPane.cancelButtonText")}; int result = JOptionPane.showOptionDialog( parent, // the parent that the dialog blocks message, // the dialog message array LangTool.getString("delm.title"), // the title of the dialog window JOptionPane.DEFAULT_OPTION, // option type JOptionPane.PLAIN_MESSAGE, // message type null, // optional icon, use null to use the default icon options, // options string array, will be made into buttons// options[0] // option that should be made into a default button ); switch(result) { case 0: // change options delimiter = (String)fd.getSelectedItem(); if (delimiter.equals(LangTool.getString("delm.labelSpace"))) delimiter = " "; if (delimiter.equals(LangTool.getString("delm.labelTab"))) delimiter = "\t"; stringQualifier = (String)td.getSelectedItem(); break; case 1: // Cancel // System.out.println("Cancel"); break; default: break; } }
2,225
public String parseData(byte[] cByte) { if (!translateIt) { return sbdata.toString(); } StringBuffer sb = new StringBuffer(bufferLength); int end = startOffset + length - 1; switch (type) { case 'P': // Packed decimal format // example field of buffer length 4 with decimal precision 0 // output length is (4 * 2) -1 = 7 // // each byte of the buffer contains 2 digits, one in the zone // portion and one in the zone portion of the byte, the last // byte of the field contains the last digit in the ZONE // portion and the sign is contained in the DIGIT portion. // // The number 1234567 would be represented as follows: // byte 1 of 4 -> 12 // byte 2 of 4 -> 34 // byte 3 of 4 -> 56 // byte 4 of 4 -> 7F The F siginifies a positive number // // The number -1234567 would be represented as follows: // byte 1 of 4 -> 12 // byte 2 of 4 -> 34 // byte 3 of 4 -> 56 // byte 4 of 4 -> 7D The D siginifies a negative number // for (int f = startOffset-1;f < end -1; f++) { byte bzd = cByte[f]; int byteZ = (bzd >> 4) & 0x0f ; // get the zone portion int byteD = (bzd & 0x0f); // get the digit portion sb.append(byteZ); // assign the zone portion as the first digit sb.append(byteD); // assign the digit portion as the second digit } // here we obtain the last byte to determine the sign of the field byte bzd = cByte[end-1]; int byteZ = (bzd >> 4) & 0x0f ; // get the zone portion int byteD = (bzd & 0x0f); // get the digit portion sb.append(byteZ); // append the zone portion as the // the last digit of the number // Here we interrogate the the DIGIT portion for the sign // 0x0f = positive -> 0x0f | 0x0d = 0x0f // 0x0d = negative -> 0x0d | 0x0d = 0x0d if ((byteD | 0x0d) == 0x0d) sb.insert(0,'-'); else sb.insert(0,'+'); break; case 'S': // Signed decimal format // example field of buffer length 5 with decimal precision 0 // output length is 5 // // each byte of the buffer contains a digit. The zone portion // contain F for the EBCDIC number not 3 for ASCII, the digit // portion contains the number, the last byte of the field // contains the last digit in the DIGIT portion and the sign is // contained in the ZONE portion. // // The number 12345 would be represented as follows: // byte 1 of 5 -> F1 // byte 2 of 5 -> F2 // byte 3 of 5 -> F3 // byte 4 of 5 -> F4 // byte 5 of 5 -> F5 The F in the zone portion signifies positive // // The number -12345 would be represented as follows: // byte 1 of 5 -> F1 // byte 2 of 5 -> F2 // byte 3 of 5 -> F3 // byte 4 of 5 -> F4 // byte 5 of 5 -> D5 The D in the zone portion signifies negative for (int f = startOffset-1;f < end; f++) { // we only take the digit portion of the byte sb.append((cByte[f] & 0x0f)); } // Here we interrogate the the ZONE portion for the sign // 0xf0 = positive -> 0xf5 & 0xf0 = 0xf0 // 0xd0 = negative -> 0xd5 & 0xf0 = 0xd0 if ((cByte[end - 1] & 0xf0) == 0xd0) sb.insert(0,'-'); else sb.insert(0,'+'); break; default: for (int f = startOffset-1;f < end; f++) { sb.append(vt.getASCIIChar(cByte[f] & 0xff)); } } if (decPos > 0) { int o = sb.length(); sb.insert(o - decPos,decChar); } data = sb.toString(); return data; }
public String parseData(byte[] cByte) { if (!translateIt) { return sbdata.toString(); } StringBuffer sb = new StringBuffer(bufferLength); int end = startOffset + length - 1; switch (type) { case 'P': // Packed decimal format // example field of buffer length 4 with decimal precision 0 // output length is (4 * 2) -1 = 7 // // each byte of the buffer contains 2 digits, one in the zone // portion and one in the zone portion of the byte, the last // byte of the field contains the last digit in the ZONE // portion and the sign is contained in the DIGIT portion. // // The number 1234567 would be represented as follows: // byte 1 of 4 -> 12 // byte 2 of 4 -> 34 // byte 3 of 4 -> 56 // byte 4 of 4 -> 7F The F siginifies a positive number // // The number -1234567 would be represented as follows: // byte 1 of 4 -> 12 // byte 2 of 4 -> 34 // byte 3 of 4 -> 56 // byte 4 of 4 -> 7D The D siginifies a negative number // for (int f = startOffset-1;f < end -1; f++) { byte bzd = cByte[f]; int byteZ = (bzd >> 4) & 0x0f ; // get the zone portion int byteD = (bzd & 0x0f); // get the digit portion sb.append(byteZ); // assign the zone portion as the first digit sb.append(byteD); // assign the digit portion as the second digit } // here we obtain the last byte to determine the sign of the field byte bzd = cByte[end-1]; int byteZ = (bzd >> 4) & 0x0f ; // get the zone portion int byteD = (bzd & 0x0f); // get the digit portion sb.append(byteZ); // append the zone portion as the // the last digit of the number // Here we interrogate the the DIGIT portion for the sign // 0x0f = positive -> 0x0f | 0x0d = 0x0f // 0x0d = negative -> 0x0d | 0x0d = 0x0d if ((byteD | 0x0d) == 0x0d) sb.insert(0,'-'); else sb.insert(0,'+'); break; case 'S': // Signed decimal format // example field of buffer length 5 with decimal precision 0 // output length is 5 // // each byte of the buffer contains a digit. The zone portion // contain F for the EBCDIC number not 3 for ASCII, the digit // portion contains the number, the last byte of the field // contains the last digit in the DIGIT portion and the sign is // contained in the ZONE portion. // // The number 12345 would be represented as follows: // byte 1 of 5 -> F1 // byte 2 of 5 -> F2 // byte 3 of 5 -> F3 // byte 4 of 5 -> F4 // byte 5 of 5 -> F5 The F in the zone portion signifies positive // // The number -12345 would be represented as follows: // byte 1 of 5 -> F1 // byte 2 of 5 -> F2 // byte 3 of 5 -> F3 // byte 4 of 5 -> F4 // byte 5 of 5 -> D5 The D in the zone portion signifies negative for (int f = startOffset-1;f < end; f++) { // we only take the digit portion of the byte sb.append((cByte[f] & 0x0f)); } // Here we interrogate the the ZONE portion for the sign // 0xf0 = positive -> 0xf5 & 0xf0 = 0xf0 // 0xd0 = negative -> 0xd5 & 0xf0 = 0xd0 if ((cByte[end - 1] & 0xf0) == 0xd0) sb.insert(0,'-'); else sb.insert(0,'+'); break; default: for (int f = startOffset-1;f < end; f++) { sb.append(vt.ebcdic2uni(cByte[f] & 0xff)); } } if (decPos > 0) { int o = sb.length(); sb.insert(o - decPos,decChar); } data = sb.toString(); return data; }
2,227
public DocFlavor(String mimeType, String className) { if (mimeType == null || className == null) throw new NullPointerException(); parseMimeType(mimeType); this.className = className; }
public DocFlavor(String mimeType, String className) { if (mimeType == null || className == null) throw new NullPointerException(); parseMimeType(mimeType); myClassName = className; }
2,228
public String getParameter(String paramName) { if (paramName == null) throw new NullPointerException(); return (String) params.get(paramName); }
public String getParameter(String paramName) { if (paramName == null) throw new NullPointerException(); return (String) params.get(paramName.toLowerCase()); }
2,229
public String getRepresentationClassName() { return className; }
public String getRepresentationClassName() { return myClassName; }
2,230
public int hashCode() { return ((mediaType.hashCode() * mediaSubtype.hashCode() * className.hashCode()) ^ params.hashCode()); }
public int hashCode() { return ((mediaType.hashCode() * mediaSubtype.hashCode() * myClassName.hashCode()) ^ params.hashCode()); }
2,231
private void parseMimeType(String mimeType) { // FIXME: This method is know to be not completely correct, but it works for now. int pos = mimeType.indexOf(';'); if (pos != -1) { String tmp = mimeType.substring(pos + 2); mimeType = mimeType.substring(0, pos); pos = tmp.indexOf('='); params.put(tmp.substring(0, pos), tmp.substring(pos + 1)); } pos = mimeType.indexOf('/'); if (pos == -1) throw new IllegalArgumentException(); mediaType = mimeType.substring(0, pos); mediaSubtype = mimeType.substring(pos + 1); }
private void parseMimeType(String mimeType) { // FIXME: This method is know to be not completely correct, but it works for now. int state = 0; int lastState = 0; int tok; try { String paramName = null; StreamTokenizer in = new StreamTokenizer(new StringReader(mimeType)); in.resetSyntax(); in.whitespaceChars(0x00, 0x20); in.whitespaceChars(0x7F, 0x7F); in.wordChars('A', 'Z'); in.wordChars('a', 'z'); in.wordChars('0', '9'); in.wordChars(0xA0, 0xFF); in.wordChars(0x21, 0x21); in.wordChars(0x23, 0x27); in.wordChars(0x2A, 0x2B); in.wordChars(0x2D, 0x2E); in.wordChars(0x5E, 0x60); in.wordChars(0x7B, 0x7E); in.quoteChar('"'); if (pos != -1) { String tmp = mimeType.substring(pos + 2); mimeType = mimeType.substring(0, pos); pos = tmp.indexOf('='); params.put(tmp.substring(0, pos), tmp.substring(pos + 1)); } pos = mimeType.indexOf('/'); if (pos == -1) throw new IllegalArgumentException(); mediaType = mimeType.substring(0, pos); mediaSubtype = mimeType.substring(pos + 1); }
2,233
private void parseMimeType(String mimeType) { // FIXME: This method is know to be not completely correct, but it works for now. int pos = mimeType.indexOf(';'); if (pos != -1) { String tmp = mimeType.substring(pos + 2); mimeType = mimeType.substring(0, pos); pos = tmp.indexOf('='); params.put(tmp.substring(0, pos), tmp.substring(pos + 1)); } pos = mimeType.indexOf('/'); if (pos == -1) throw new IllegalArgumentException(); mediaType = mimeType.substring(0, pos); mediaSubtype = mimeType.substring(pos + 1); }
private void parseMimeType(String mimeType) { // FIXME: This method is know to be not completely correct, but it works for now. int pos = mimeType.indexOf(';'); while ((tok = in.nextToken()) != StreamTokenizer.TT_EOF) { switch (tok) { case StreamTokenizer.TT_WORD: if (state == 0) { mediaType = in.sval.toLowerCase(); state = MEDIA; break; } if (state == MEDIA) { mediaSubtype = in.sval.toLowerCase(); state = MEDIASUB; break; } if (state == MEDIASUB || state == PARAM_VALUE) { paramName = in.sval.toLowerCase(); state = PARAM_NAME; break; } if (state == PARAM_NAME) { String paramValue = in.sval; if (paramName.equals("charset")) paramValue = paramValue.toLowerCase(); state = PARAM_VALUE; params.put(paramName, paramValue); break; } if (state == COMMENT_START) { break; } break; case '/': if (state != MEDIA) throw new IllegalArgumentException(); break; case '=': if (state != PARAM_NAME) throw new IllegalArgumentException(); break; case ';': if (state != MEDIASUB && state != PARAM_VALUE) throw new IllegalArgumentException(); break; case '(': lastState = state; state = COMMENT_START; break; case ')': state = lastState; break; case '"': if (state == PARAM_NAME) { String paramValue = in.sval; if (paramName.equals("charset")) paramValue = paramValue.toLowerCase(); state = PARAM_VALUE; params.put(paramName, paramValue); break; } throw new IllegalArgumentException(); default: throw new IllegalArgumentException(); } } } catch (IOException e) { String tmp = mimeType.substring(pos + 2); mimeType = mimeType.substring(0, pos); pos = tmp.indexOf('='); params.put(tmp.substring(0, pos), tmp.substring(pos + 1)); } pos = mimeType.indexOf('/'); if (pos == -1) throw new IllegalArgumentException(); mediaType = mimeType.substring(0, pos); mediaSubtype = mimeType.substring(pos + 1); }
2,234
private void parseMimeType(String mimeType) { // FIXME: This method is know to be not completely correct, but it works for now. int pos = mimeType.indexOf(';'); if (pos != -1) { String tmp = mimeType.substring(pos + 2); mimeType = mimeType.substring(0, pos); pos = tmp.indexOf('='); params.put(tmp.substring(0, pos), tmp.substring(pos + 1)); } pos = mimeType.indexOf('/'); if (pos == -1) throw new IllegalArgumentException(); mediaType = mimeType.substring(0, pos); mediaSubtype = mimeType.substring(pos + 1); }
private void parseMimeType(String mimeType) { // FIXME: This method is know to be not completely correct, but it works for now. int pos = mimeType.indexOf(';'); if (pos != -1) { String tmp = mimeType.substring(pos + 2); mimeType = mimeType.substring(0, pos); pos = tmp.indexOf('='); params.put(tmp.substring(0, pos), tmp.substring(pos + 1)); } pos = mimeType.indexOf('/'); if (pos == -1) throw new IllegalArgumentException(); mediaType = mimeType.substring(0, pos); mediaSubtype = mimeType.substring(pos + 1); }
2,235
private void parseMimeType(String mimeType) { // FIXME: This method is know to be not completely correct, but it works for now. int pos = mimeType.indexOf(';'); if (pos != -1) { String tmp = mimeType.substring(pos + 2); mimeType = mimeType.substring(0, pos); pos = tmp.indexOf('='); params.put(tmp.substring(0, pos), tmp.substring(pos + 1)); } pos = mimeType.indexOf('/'); if (pos == -1) throw new IllegalArgumentException(); mediaType = mimeType.substring(0, pos); mediaSubtype = mimeType.substring(pos + 1); }
private void parseMimeType(String mimeType) { // FIXME: This method is know to be not completely correct, but it works for now. int pos = mimeType.indexOf(';'); if (pos != -1) { String tmp = mimeType.substring(pos + 2); mimeType = mimeType.substring(0, pos); pos = tmp.indexOf('='); params.put(tmp.substring(0, pos), tmp.substring(pos + 1)); } pos = mimeType.indexOf('/'); if (pos == -1) throw new IllegalArgumentException(); mediaType = mimeType.substring(0, pos); mediaSubtype = mimeType.substring(pos + 1); }
2,236
public String toString() { return getMimeType(); }
public String toString() { return getMimeType() + "; class=\"" + getRepresentationClassName() + "\""; }
2,237
public void layoutContainer(Container container) { Component[] buttonList = container.getComponents(); int x = container.getInsets().left; if (getCentersChildren()) x += (int) ((double) (container.getSize().width) / 2 - (double) (buttonRowLength(container)) / 2); for (int i = 0; i < buttonList.length; i++) { Dimension dims = buttonList[i].getPreferredSize(); if (getSizeButtonsToSameWidth()) { buttonList[i].setBounds(x, 0, widthOfWidestButton, dims.height); x += widthOfWidestButton + getPadding(); } else { buttonList[i].setBounds(x, 0, dims.width, dims.height); x += dims.width + getPadding(); } } }
public void layoutContainer(Container container) { Component[] buttonList = container.getComponents(); int x = container.getInsets().left; if (getCentersChildren()) x += (int) ((double) (container.getSize().width) / 2 - (double) (buttonRowLength(container)) / 2); for (int i = 0; i < buttonList.length; i++) { Dimension dims = buttonList[i].getPreferredSize(); if (syncAllWidths) { buttonList[i].setBounds(x, 0, widthOfWidestButton, dims.height); x += widthOfWidestButton + getPadding(); } else { buttonList[i].setBounds(x, 0, dims.width, dims.height); x += dims.width + getPadding(); } } }
2,238
public void setCentersChildren(boolean newValue) { centersChildren = newValue; optionPane.invalidate(); }
public void setCentersChildren(boolean newValue) { centersChildren = newValue; }
2,239
public void setPadding(int newPadding) { padding = newPadding; optionPane.invalidate(); }
public void setPadding(int newPadding) { padding = newPadding; }
2,240
public void setSyncAllWidths(boolean newValue) { syncAllWidths = newValue; optionPane.invalidate(); }
public void setSyncAllWidths(boolean newValue) { syncAllWidths = newValue; }
2,241
protected Container createSeparator() { return (Container) Box.createVerticalStrut(17); }
protected Container createSeparator() { return null; }
2,242
public DatagramChannel connect (SocketAddress remote) throws IOException { if (!isOpen()) throw new ClosedChannelException(); socket.connect (remote); return this; }
public DatagramChannel connect (SocketAddress remote) throws IOException { if (!isOpen()) throw new ClosedChannelException(); try { channel.connect((InetSocketAddress) remote, 0); } catch (ClassCastException cce) { throw new IOException("unsupported socked address type"); } return this; }
2,244
public DatagramChannel disconnect () throws IOException { socket.disconnect (); return this; }
public DatagramChannel disconnect () throws IOException { channel.disconnect(); return this; }
2,245
protected void implCloseSelectableChannel () throws IOException { socket.close (); }
protected void implCloseSelectableChannel () throws IOException { channel.close(); }
2,246
protected void implConfigureBlocking (boolean blocking) throws IOException { socket.setSoTimeout (blocking ? 0 : NIOConstants.DEFAULT_TIMEOUT); }
protected void implConfigureBlocking (boolean blocking) throws IOException { channel.setBlocking(blocking); }
2,247
public boolean isConnected () { return socket.isConnected (); }
public boolean isConnected () { try { return channel.getPeerAddress() != null; } catch (IOException ioe) { return false; } }
2,248
public int read (ByteBuffer dst) throws IOException { if (!isConnected ()) throw new NotYetConnectedException (); int remaining = dst.remaining(); receive (dst); return remaining - dst.remaining(); }
public int read (ByteBuffer dst) throws IOException { if (!isConnected ()) throw new NotYetConnectedException (); int remaining = dst.remaining(); receive (dst); return remaining - dst.remaining(); }
2,249
public SocketAddress receive (ByteBuffer dst) throws IOException { if (!isOpen()) throw new ClosedChannelException(); try { DatagramPacket packet; int len = dst.remaining(); if (dst.hasArray()) { packet = new DatagramPacket (dst.array(), dst.arrayOffset() + dst.position(), len); } else { packet = new DatagramPacket (new byte [len], len); } boolean completed = false; try { begin(); setInChannelOperation(true); socket.receive (packet); completed = true; } finally { end (completed); setInChannelOperation(false); } if (!dst.hasArray()) { dst.put (packet.getData(), packet.getOffset(), packet.getLength()); } else { dst.position (dst.position() + packet.getLength()); } return packet.getSocketAddress(); } catch (SocketTimeoutException e) { return null; } }
public SocketAddress receive (ByteBuffer dst) throws IOException { if (!isOpen()) throw new ClosedChannelException(); try { DatagramPacket packet; int len = dst.remaining(); if (dst.hasArray()) { packet = new DatagramPacket (dst.array(), dst.arrayOffset() + dst.position(), len); } else { packet = new DatagramPacket (new byte [len], len); } boolean completed = false; try { begin(); setInChannelOperation(true); socket.receive (packet); completed = true; } finally { end (completed); setInChannelOperation(false); } if (!dst.hasArray()) { dst.put (packet.getData(), packet.getOffset(), packet.getLength()); } else { dst.position (dst.position() + packet.getLength()); } return packet.getSocketAddress(); } catch (SocketTimeoutException e) { return null; } }
2,250
public SocketAddress receive (ByteBuffer dst) throws IOException { if (!isOpen()) throw new ClosedChannelException(); try { DatagramPacket packet; int len = dst.remaining(); if (dst.hasArray()) { packet = new DatagramPacket (dst.array(), dst.arrayOffset() + dst.position(), len); } else { packet = new DatagramPacket (new byte [len], len); } boolean completed = false; try { begin(); setInChannelOperation(true); socket.receive (packet); completed = true; } finally { end (completed); setInChannelOperation(false); } if (!dst.hasArray()) { dst.put (packet.getData(), packet.getOffset(), packet.getLength()); } else { dst.position (dst.position() + packet.getLength()); } return packet.getSocketAddress(); } catch (SocketTimeoutException e) { return null; } }
public SocketAddress receive (ByteBuffer dst) throws IOException { if (!isOpen()) throw new ClosedChannelException(); try { DatagramPacket packet; int len = dst.remaining(); if (dst.hasArray()) { packet = new DatagramPacket (dst.array(), dst.arrayOffset() + dst.position(), len); } else { packet = new DatagramPacket (new byte [len], len); } boolean completed = false; try { begin(); setInChannelOperation(true); socket.receive (packet); completed = true; } finally { end (completed); setInChannelOperation(false); } if (!dst.hasArray()) { dst.put (packet.getData(), packet.getOffset(), packet.getLength()); } else { dst.position (dst.position() + packet.getLength()); } return packet.getSocketAddress(); } catch (SocketTimeoutException e) { return null; } }
2,251
public int send (ByteBuffer src, SocketAddress target) throws IOException { if (!isOpen()) throw new ClosedChannelException(); if (target instanceof InetSocketAddress && ((InetSocketAddress) target).isUnresolved()) throw new IOException("Target address not resolved"); byte[] buffer; int offset = 0; int len = src.remaining(); if (src.hasArray()) { buffer = src.array(); offset = src.arrayOffset() + src.position(); } else { buffer = new byte [len]; src.get (buffer); } DatagramPacket packet = new DatagramPacket (buffer, offset, len, target); boolean completed = false; try { begin(); setInChannelOperation(true); socket.send(packet); completed = true; } finally { end (completed); setInChannelOperation(false); } if (src.hasArray()) { src.position (src.position() + len); } return len; }
public int send (ByteBuffer src, SocketAddress target) throws IOException { if (!isOpen()) throw new ClosedChannelException(); if (target instanceof InetSocketAddress && ((InetSocketAddress) target).isUnresolved()) throw new IOException("Target address not resolved"); byte[] buffer; int offset = 0; int len = src.remaining(); if (src.hasArray()) { buffer = src.array(); offset = src.arrayOffset() + src.position(); } else { buffer = new byte [len]; src.get (buffer); } DatagramPacket packet = new DatagramPacket (buffer, offset, len, target); boolean completed = false; try { begin(); setInChannelOperation(true); socket.send(packet); completed = true; } finally { end (completed); setInChannelOperation(false); } if (src.hasArray()) { src.position (src.position() + len); } return len; }
2,252
public int send (ByteBuffer src, SocketAddress target) throws IOException { if (!isOpen()) throw new ClosedChannelException(); if (target instanceof InetSocketAddress && ((InetSocketAddress) target).isUnresolved()) throw new IOException("Target address not resolved"); byte[] buffer; int offset = 0; int len = src.remaining(); if (src.hasArray()) { buffer = src.array(); offset = src.arrayOffset() + src.position(); } else { buffer = new byte [len]; src.get (buffer); } DatagramPacket packet = new DatagramPacket (buffer, offset, len, target); boolean completed = false; try { begin(); setInChannelOperation(true); socket.send(packet); completed = true; } finally { end (completed); setInChannelOperation(false); } if (src.hasArray()) { src.position (src.position() + len); } return len; }
public int send (ByteBuffer src, SocketAddress target) throws IOException { if (!isOpen()) throw new ClosedChannelException(); if (target instanceof InetSocketAddress && ((InetSocketAddress) target).isUnresolved()) throw new IOException("Target address not resolved"); byte[] buffer; int offset = 0; int len = src.remaining(); if (src.hasArray()) { buffer = src.array(); offset = src.arrayOffset() + src.position(); } else { buffer = new byte [len]; src.get (buffer); } DatagramPacket packet = new DatagramPacket (buffer, offset, len, target); boolean completed = false; try { begin(); setInChannelOperation(true); socket.send(packet); completed = true; } finally { end (completed); setInChannelOperation(false); } if (src.hasArray()) { src.position (src.position() + len); } return len; }
2,253
public int send (ByteBuffer src, SocketAddress target) throws IOException { if (!isOpen()) throw new ClosedChannelException(); if (target instanceof InetSocketAddress && ((InetSocketAddress) target).isUnresolved()) throw new IOException("Target address not resolved"); byte[] buffer; int offset = 0; int len = src.remaining(); if (src.hasArray()) { buffer = src.array(); offset = src.arrayOffset() + src.position(); } else { buffer = new byte [len]; src.get (buffer); } DatagramPacket packet = new DatagramPacket (buffer, offset, len, target); boolean completed = false; try { begin(); setInChannelOperation(true); socket.send(packet); completed = true; } finally { end (completed); setInChannelOperation(false); } if (src.hasArray()) { src.position (src.position() + len); } return len; }
public int send (ByteBuffer src, SocketAddress target) throws IOException { if (!isOpen()) throw new ClosedChannelException(); if (target instanceof InetSocketAddress && ((InetSocketAddress) target).isUnresolved()) throw new IOException("Target address not resolved"); byte[] buffer; int offset = 0; int len = src.remaining(); if (src.hasArray()) { buffer = src.array(); offset = src.arrayOffset() + src.position(); } else { buffer = new byte [len]; src.get (buffer); } DatagramPacket packet = new DatagramPacket (buffer, offset, len, target); boolean completed = false; try { begin(); setInChannelOperation(true); socket.send(packet); completed = true; } finally { end (completed); setInChannelOperation(false); } if (src.hasArray()) { src.position (src.position() + len); } return len; }
2,254
public int write (ByteBuffer src) throws IOException { if (!isConnected ()) throw new NotYetConnectedException (); return send (src, socket.getRemoteSocketAddress()); }
public int write (ByteBuffer src) throws IOException { if (!isConnected ()) throw new NotYetConnectedException (); return channel.write(src); }
2,255
public Date parse (String dateStr, ParsePosition pos) { int fmt_index = 0; int fmt_max = pattern.length(); calendar.clear(); boolean saw_timezone = false; int quote_start = -1; boolean is2DigitYear = false; try { for (; fmt_index < fmt_max; ++fmt_index) { char ch = pattern.charAt(fmt_index); if (ch == '\'') { int index = pos.getIndex(); if (fmt_index < fmt_max - 1 && pattern.charAt(fmt_index + 1) == '\'') { if (! expect (dateStr, pos, ch)) return null; ++fmt_index; } else quote_start = quote_start < 0 ? fmt_index : -1; continue; } if (quote_start != -1 || ((ch < 'a' || ch > 'z') && (ch < 'A' || ch > 'Z'))) { if (! expect (dateStr, pos, ch)) return null; continue; } // We've arrived at a potential pattern character in the // pattern. int fmt_count = 1; while (++fmt_index < fmt_max && pattern.charAt(fmt_index) == ch) { ++fmt_count; } // We might need to limit the number of digits to parse in // some cases. We look to the next pattern character to // decide. boolean limit_digits = false; if (fmt_index < fmt_max && standardChars.indexOf(pattern.charAt(fmt_index)) >= 0) limit_digits = true; --fmt_index; // We can handle most fields automatically: most either are // numeric or are looked up in a string vector. In some cases // we need an offset. When numeric, `offset' is added to the // resulting value. When doing a string lookup, offset is the // initial index into the string array. int calendar_field; boolean is_numeric = true; int offset = 0; boolean maybe2DigitYear = false; boolean oneBasedHour = false; boolean oneBasedHourOfDay = false; Integer simpleOffset; String[] set1 = null; String[] set2 = null; switch (ch) { case 'd': calendar_field = Calendar.DATE; break; case 'D': calendar_field = Calendar.DAY_OF_YEAR; break; case 'F': calendar_field = Calendar.DAY_OF_WEEK_IN_MONTH; break; case 'E': is_numeric = false; offset = 1; calendar_field = Calendar.DAY_OF_WEEK; set1 = formatData.getWeekdays(); set2 = formatData.getShortWeekdays(); break; case 'w': calendar_field = Calendar.WEEK_OF_YEAR; break; case 'W': calendar_field = Calendar.WEEK_OF_MONTH; break; case 'M': calendar_field = Calendar.MONTH; if (fmt_count <= 2) offset = -1; else { is_numeric = false; set1 = formatData.getMonths(); set2 = formatData.getShortMonths(); } break; case 'y': calendar_field = Calendar.YEAR; if (fmt_count <= 2) maybe2DigitYear = true; break; case 'K': calendar_field = Calendar.HOUR; break; case 'h': calendar_field = Calendar.HOUR; oneBasedHour = true; break; case 'H': calendar_field = Calendar.HOUR_OF_DAY; break; case 'k': calendar_field = Calendar.HOUR_OF_DAY; oneBasedHourOfDay = true; break; case 'm': calendar_field = Calendar.MINUTE; break; case 's': calendar_field = Calendar.SECOND; break; case 'S': calendar_field = Calendar.MILLISECOND; break; case 'a': is_numeric = false; calendar_field = Calendar.AM_PM; set1 = formatData.getAmPmStrings(); break; case 'z': case 'Z': // We need a special case for the timezone, because it // uses a different data structure than the other cases. is_numeric = false; calendar_field = Calendar.ZONE_OFFSET; String[][] zoneStrings = formatData.getZoneStrings(); int zoneCount = zoneStrings.length; int index = pos.getIndex(); boolean found_zone = false; simpleOffset = computeOffset(dateStr.substring(index), pos); if (simpleOffset != null) { found_zone = true; saw_timezone = true; calendar.set(Calendar.DST_OFFSET, 0); offset = simpleOffset.intValue(); } else { for (int j = 0; j < zoneCount; j++) { String[] strings = zoneStrings[j]; int k; for (k = 0; k < strings.length; ++k) { if (dateStr.startsWith(strings[k], index)) break; } if (k != strings.length) { found_zone = true; saw_timezone = true; TimeZone tz = TimeZone.getTimeZone (strings[0]); // Check if it's a DST zone or ordinary if(k == 3 || k == 4) calendar.set (Calendar.DST_OFFSET, tz.getDSTSavings()); else calendar.set (Calendar.DST_OFFSET, 0); offset = tz.getRawOffset (); pos.setIndex(index + strings[k].length()); break; } } } if (! found_zone) { pos.setErrorIndex(pos.getIndex()); return null; } break; default: pos.setErrorIndex(pos.getIndex()); return null; } // Compute the value we should assign to the field. int value; int index = -1; if (is_numeric) { numberFormat.setMinimumIntegerDigits(fmt_count); if (limit_digits) numberFormat.setMaximumIntegerDigits(fmt_count); if (maybe2DigitYear) index = pos.getIndex(); Number n = numberFormat.parse(dateStr, pos); if (pos == null || ! (n instanceof Long)) return null; value = n.intValue() + offset; } else if (set1 != null) { index = pos.getIndex(); int i; boolean found = false; for (i = offset; i < set1.length; ++i) { if (set1[i] != null) if (dateStr.toUpperCase().startsWith(set1[i].toUpperCase(), index)) { found = true; pos.setIndex(index + set1[i].length()); break; } } if (!found && set2 != null) { for (i = offset; i < set2.length; ++i) { if (set2[i] != null) if (dateStr.toUpperCase().startsWith(set2[i].toUpperCase(), index)) { found = true; pos.setIndex(index + set2[i].length()); break; } } } if (!found) { pos.setErrorIndex(index); return null; } value = i; } else value = offset; if (maybe2DigitYear) { // Parse into default century if the numeric year string has // exactly 2 digits. int digit_count = pos.getIndex() - index; if (digit_count == 2) { is2DigitYear = true; value += defaultCentury; } } // Calendar uses 0-based hours. // I.e. 00:00 AM is midnight, not 12 AM or 24:00 if (oneBasedHour && value == 12) value = 0; if (oneBasedHourOfDay && value == 24) value = 0; // Assign the value and move on. calendar.set(calendar_field, value); } if (is2DigitYear) { // Apply the 80-20 heuristic to dermine the full year based on // defaultCenturyStart. int year = calendar.get(Calendar.YEAR); if (calendar.getTime().compareTo(defaultCenturyStart) < 0) calendar.set(Calendar.YEAR, year + 100); } if (! saw_timezone) { // Use the real rules to determine whether or not this // particular time is in daylight savings. calendar.clear (Calendar.DST_OFFSET); calendar.clear (Calendar.ZONE_OFFSET); } return calendar.getTime(); } catch (IllegalArgumentException x) { pos.setErrorIndex(pos.getIndex()); return null; } }
public Date parse (String dateStr, ParsePosition pos) { int fmt_index = 0; int fmt_max = pattern.length(); calendar.clear(); boolean saw_timezone = false; int quote_start = -1; boolean is2DigitYear = false; try { for (; fmt_index < fmt_max; ++fmt_index) { char ch = pattern.charAt(fmt_index); if (ch == '\'') { int index = pos.getIndex(); if (fmt_index < fmt_max - 1 && pattern.charAt(fmt_index + 1) == '\'') { if (quote_start == -1 && ch == ' ') { int index = pos.getIndex(); int save = index; while (index < dateStr.length() && Character.isWhitespace(dateStr.charAt(index))) ++index; if (index > save) pos.setIndex(index); else { pos.setErrorIndex(index); return null; } } else if (! expect (dateStr, pos, ch)) return null; ++fmt_index; } else quote_start = quote_start < 0 ? fmt_index : -1; continue; } if (quote_start != -1 || ((ch < 'a' || ch > 'z') && (ch < 'A' || ch > 'Z'))) { if (quote_start == -1 && ch == ' ') { int index = pos.getIndex(); int save = index; while (index < dateStr.length() && Character.isWhitespace(dateStr.charAt(index))) ++index; if (index > save) pos.setIndex(index); else { pos.setErrorIndex(index); return null; } } else if (! expect (dateStr, pos, ch)) return null; continue; } // We've arrived at a potential pattern character in the // pattern. int fmt_count = 1; while (++fmt_index < fmt_max && pattern.charAt(fmt_index) == ch) { ++fmt_count; } // We might need to limit the number of digits to parse in // some cases. We look to the next pattern character to // decide. boolean limit_digits = false; if (fmt_index < fmt_max && standardChars.indexOf(pattern.charAt(fmt_index)) >= 0) limit_digits = true; --fmt_index; // We can handle most fields automatically: most either are // numeric or are looked up in a string vector. In some cases // we need an offset. When numeric, `offset' is added to the // resulting value. When doing a string lookup, offset is the // initial index into the string array. int calendar_field; boolean is_numeric = true; int offset = 0; boolean maybe2DigitYear = false; boolean oneBasedHour = false; boolean oneBasedHourOfDay = false; Integer simpleOffset; String[] set1 = null; String[] set2 = null; switch (ch) { case 'd': calendar_field = Calendar.DATE; break; case 'D': calendar_field = Calendar.DAY_OF_YEAR; break; case 'F': calendar_field = Calendar.DAY_OF_WEEK_IN_MONTH; break; case 'E': is_numeric = false; offset = 1; calendar_field = Calendar.DAY_OF_WEEK; set1 = formatData.getWeekdays(); set2 = formatData.getShortWeekdays(); break; case 'w': calendar_field = Calendar.WEEK_OF_YEAR; break; case 'W': calendar_field = Calendar.WEEK_OF_MONTH; break; case 'M': calendar_field = Calendar.MONTH; if (fmt_count <= 2) offset = -1; else { is_numeric = false; set1 = formatData.getMonths(); set2 = formatData.getShortMonths(); } break; case 'y': calendar_field = Calendar.YEAR; if (fmt_count <= 2) maybe2DigitYear = true; break; case 'K': calendar_field = Calendar.HOUR; break; case 'h': calendar_field = Calendar.HOUR; oneBasedHour = true; break; case 'H': calendar_field = Calendar.HOUR_OF_DAY; break; case 'k': calendar_field = Calendar.HOUR_OF_DAY; oneBasedHourOfDay = true; break; case 'm': calendar_field = Calendar.MINUTE; break; case 's': calendar_field = Calendar.SECOND; break; case 'S': calendar_field = Calendar.MILLISECOND; break; case 'a': is_numeric = false; calendar_field = Calendar.AM_PM; set1 = formatData.getAmPmStrings(); break; case 'z': case 'Z': // We need a special case for the timezone, because it // uses a different data structure than the other cases. is_numeric = false; calendar_field = Calendar.ZONE_OFFSET; String[][] zoneStrings = formatData.getZoneStrings(); int zoneCount = zoneStrings.length; int index = pos.getIndex(); boolean found_zone = false; simpleOffset = computeOffset(dateStr.substring(index), pos); if (simpleOffset != null) { found_zone = true; saw_timezone = true; calendar.set(Calendar.DST_OFFSET, 0); offset = simpleOffset.intValue(); } else { for (int j = 0; j < zoneCount; j++) { String[] strings = zoneStrings[j]; int k; for (k = 0; k < strings.length; ++k) { if (dateStr.startsWith(strings[k], index)) break; } if (k != strings.length) { found_zone = true; saw_timezone = true; TimeZone tz = TimeZone.getTimeZone (strings[0]); // Check if it's a DST zone or ordinary if(k == 3 || k == 4) calendar.set (Calendar.DST_OFFSET, tz.getDSTSavings()); else calendar.set (Calendar.DST_OFFSET, 0); offset = tz.getRawOffset (); pos.setIndex(index + strings[k].length()); break; } } } if (! found_zone) { pos.setErrorIndex(pos.getIndex()); return null; } break; default: pos.setErrorIndex(pos.getIndex()); return null; } // Compute the value we should assign to the field. int value; int index = -1; if (is_numeric) { numberFormat.setMinimumIntegerDigits(fmt_count); if (limit_digits) numberFormat.setMaximumIntegerDigits(fmt_count); if (maybe2DigitYear) index = pos.getIndex(); Number n = numberFormat.parse(dateStr, pos); if (pos == null || ! (n instanceof Long)) return null; value = n.intValue() + offset; } else if (set1 != null) { index = pos.getIndex(); int i; boolean found = false; for (i = offset; i < set1.length; ++i) { if (set1[i] != null) if (dateStr.toUpperCase().startsWith(set1[i].toUpperCase(), index)) { found = true; pos.setIndex(index + set1[i].length()); break; } } if (!found && set2 != null) { for (i = offset; i < set2.length; ++i) { if (set2[i] != null) if (dateStr.toUpperCase().startsWith(set2[i].toUpperCase(), index)) { found = true; pos.setIndex(index + set2[i].length()); break; } } } if (!found) { pos.setErrorIndex(index); return null; } value = i; } else value = offset; if (maybe2DigitYear) { // Parse into default century if the numeric year string has // exactly 2 digits. int digit_count = pos.getIndex() - index; if (digit_count == 2) { is2DigitYear = true; value += defaultCentury; } } // Calendar uses 0-based hours. // I.e. 00:00 AM is midnight, not 12 AM or 24:00 if (oneBasedHour && value == 12) value = 0; if (oneBasedHourOfDay && value == 24) value = 0; // Assign the value and move on. calendar.set(calendar_field, value); } if (is2DigitYear) { // Apply the 80-20 heuristic to dermine the full year based on // defaultCenturyStart. int year = calendar.get(Calendar.YEAR); if (calendar.getTime().compareTo(defaultCenturyStart) < 0) calendar.set(Calendar.YEAR, year + 100); } if (! saw_timezone) { // Use the real rules to determine whether or not this // particular time is in daylight savings. calendar.clear (Calendar.DST_OFFSET); calendar.clear (Calendar.ZONE_OFFSET); } return calendar.getTime(); } catch (IllegalArgumentException x) { pos.setErrorIndex(pos.getIndex()); return null; } }
2,256
public GregorianCalendar(Locale locale) { this(TimeZone.getDefault(), locale); }
public GregorianCalendar() { this(TimeZone.getDefault(), locale); }
2,257
public GregorianCalendar(Locale locale) { this(TimeZone.getDefault(), locale); }
public GregorianCalendar(Locale locale) { this(TimeZone.getDefault(), Locale.getDefault()); }
2,258
public boolean equals (Object obj) { if (!(obj instanceof DateFormat)) return false; DateFormat d = (DateFormat) obj; return numberFormat.equals(d.numberFormat); }
public boolean equals (Object obj) { if (!(obj instanceof DateFormat)) return false; DateFormat d = (DateFormat) obj; return false; }
2,259
public ISO9660Entry(EntryRecord entry) { this.CDFSentry = entry; }
public ISO9660Entry(EntryRecord entry) { this.CDFSentry = entry; }
2,260
public EntryRecord getCDFSentry() { return CDFSentry; }
public EntryRecord getCDFSentry() { return CDFSentry; }
2,261
public FileSystem getFileSystem() { return null; }
public FileSystem getFileSystem() { return null; }
2,262
public String getName() { return CDFSentry.getFileIdentifier(); }
public String getName() { return CDFSentry.getFileIdentifier(); }
2,263
public boolean isDirectory() { return CDFSentry.isDirectory(); }
public boolean isDirectory() { return CDFSentry.isDirectory(); }
2,264
public boolean isFile() { return !CDFSentry.isDirectory(); }
public boolean isFile() { return !CDFSentry.isDirectory(); }
2,265
public void setCDFSentry(EntryRecord sentry) { CDFSentry = sentry; }
public void setCDFSentry(EntryRecord sentry) { CDFSentry = sentry; }
2,266
public void setExceptionListener(ExceptionListener listener) { exceptionListener = (listener != null) ? listener : new ExceptionListener() { public void exceptionThrown(Exception e) { System.err.println("exception thrown: " + e); } }; }
public void setExceptionListener(ExceptionListener listener) { exceptionListener = (listener != null) ? listener : new ExceptionListener() { public void exceptionThrown(Exception e) { System.err.println("exception thrown: " + e); } }; }
2,267
public Expression(Object target, String methodName, Object[] arguments) { super(target, methodName, arguments); this.value = UNSET; }
public Expression(Object value, Object target, String methodName, Object[] arguments) { super(target, methodName, arguments); this.value = UNSET; }
2,268
public Expression(Object target, String methodName, Object[] arguments) { super(target, methodName, arguments); this.value = UNSET; }
public Expression(Object target, String methodName, Object[] arguments) { super(target, methodName, arguments); this.value = value; }
2,269