bugged
stringlengths
6
599k
fixed
stringlengths
10
599k
__index_level_0__
int64
0
1.13M
private int convertBytesToInteger (int numOfBytes, String endianStyle, byte[] bb, int sbyte) { // is it better to use a dispatch table here? switch (numOfBytes) { case 1: // 8-bit return convert1byteToInteger (bb, sbyte); case 2: // 16-bit return convert2bytesToInteger (endianStyle, bb, sbyte); case 3: // 24-bit (unusual) return convert3bytesToInteger (endianStyle, bb, sbyte); case 4: // 32-bit return convert4bytesToInteger (endianStyle, bb, sbyte); // This will most likely break the Java Integer. Lets not pretend // that we support it yet. Will have to contemplate BigInteger implementation for this. /* case 8: // 64-bit return convert8bytesToLong (endianStyle, bb, sbyte); break; */ default: Log.errorln("XDF Can't handle binary integers of byte size:"+numOfBytes+". Aborting!"); System.exit(-1); return -1; } }
private int convertBytesToInteger (int numOfBytes, String endianStyle, byte[] bb, int sbyte) { // is it better to use a dispatch table here? switch (numOfBytes) { case 1: // 8-bit return convert1byteToInteger (bb, sbyte); case 2: // 16-bit return convert2bytesToInteger (endianStyle, bb, sbyte); case 3: // 24-bit (unusual) return convert3bytesToInteger (endianStyle, bb, sbyte); case 4: // 32-bit return convert4bytesToInt (endianStyle, bb, sbyte); // This will most likely break the Java Integer. Lets not pretend // that we support it yet. Will have to contemplate BigInteger implementation for this. /* case 8: // 64-bit return convert8bytesToLong (endianStyle, bb, sbyte); break; */ default: Log.errorln("XDF Can't handle binary integers of byte size:"+numOfBytes+". Aborting!"); System.exit(-1); return -1; } }
7,638
public void toXMLOutputStream ( OutputStream outputstream, Hashtable XMLDeclAttribs, String strIndent, boolean dontCloseNode, String newNodeNameString, String noChildObjectNodeName ) { boolean niceOutput = sPrettyXDFOutput; String indent = ""; indent = indent + strIndent; String nodeName = getClassXDFNodeName(); //open node if (niceOutput) writeOut(outputstream, indent); writeOut(outputstream, "<" + nodeName ); String href = getHref(); if (href !=null) writeOut(outputstream, " href = \"" + href + "\""); Number checksum = getChecksum(); if (checksum !=null) writeOut(outputstream, " checksum = \"" + checksum.toString() + "\""); writeOut(outputstream, ">"); //end of opening code //write out just the data XMLDataIOStyle readObj = parentArray.getXMLDataIOStyle(); OutputStream dataOutputStream; if (href !=null) { //write out to another file, try { dataOutputStream = new FileOutputStream(getHref()); } catch (IOException e) { //oops, sth. is wrong, writ out to the passed in OutputStream dataOutputStream = outputstream; } } else { // no *href* attribute specified, write out to the passed in OutputStream dataOutputStream = outputstream; } Locator currentLocator = parentArray.createLocator(); AxisInterface fastestAxis = (AxisInterface) parentArray.getAxisList().get(0); //stores the NoDataValues for the parentArray, //used in writing out when NoDataException is caught String NoDataValues[] = new String[fastestAxis.getLength()]; if (parentArray.hasFieldAxis()) { DataFormat[] dataFormatList = parentArray.getDataFormatList(); for (int i = 0; i < NoDataValues.length; i++) { DataFormat d = dataFormatList[i]; if (d != null && d.getNoDataValue() != null) NoDataValues[i]=d.getNoDataValue().toString(); } } else { DataFormat d = parentArray.getDataFormat(); for (int i = 0; i < NoDataValues.length; i++) { if (d!=null && d.getNoDataValue() != null) NoDataValues[i] = d.getNoDataValue().toString(); } } if (readObj instanceof TaggedXMLDataIOStyle) { String[] tagOrder = ((TaggedXMLDataIOStyle)readObj).getAxisTags(); int stop = tagOrder.length; String[] tags = new String[stop]; for (int i = stop-1; i >= 0 ; i--) { tags[stop-i-1] = tagOrder[i]; // System.out.println(tagOrder.get(i)); } int[] axes = getMaxDataIndex(); stop =axes.length; int[] axisLength = new int[stop]; for (int i = 0; i < stop; i++) { axisLength[i] =axes[stop - 1 - i]; } writeTaggedData(dataOutputStream, currentLocator, indent, axisLength, tags, 0, fastestAxis, NoDataValues); } //done dealing with with TaggedXMLDataIOSytle else { if (readObj instanceof DelimitedXMLDataIOStyle) { writeDelimitedData( dataOutputStream, currentLocator, (DelimitedXMLDataIOStyle) readObj, fastestAxis, NoDataValues ); } else { writeFormattedData(dataOutputStream, currentLocator, (FormattedXMLDataIOStyle) readObj, fastestAxis, NoDataValues); } } //close the data section appropriately if (niceOutput) { writeOut(outputstream, Constants.NEW_LINE); writeOut(outputstream, indent); } writeOut(outputstream, "</" + nodeName + ">"); if (niceOutput) writeOut(outputstream, Constants.NEW_LINE); }
public void toXMLOutputStream ( OutputStream outputstream, Hashtable XMLDeclAttribs, String strIndent, boolean dontCloseNode, String newNodeNameString, String noChildObjectNodeName ) { boolean niceOutput = Specification.getInstance().isPrettyXDFOutput(); String indent = ""; indent = indent + strIndent; String nodeName = getClassXDFNodeName(); //open node if (niceOutput) writeOut(outputstream, indent); writeOut(outputstream, "<" + nodeName ); String href = getHref(); if (href !=null) writeOut(outputstream, " href = \"" + href + "\""); Number checksum = getChecksum(); if (checksum !=null) writeOut(outputstream, " checksum = \"" + checksum.toString() + "\""); writeOut(outputstream, ">"); //end of opening code //write out just the data XMLDataIOStyle readObj = parentArray.getXMLDataIOStyle(); OutputStream dataOutputStream; if (href !=null) { //write out to another file, try { dataOutputStream = new FileOutputStream(getHref()); } catch (IOException e) { //oops, sth. is wrong, writ out to the passed in OutputStream dataOutputStream = outputstream; } } else { // no *href* attribute specified, write out to the passed in OutputStream dataOutputStream = outputstream; } Locator currentLocator = parentArray.createLocator(); AxisInterface fastestAxis = (AxisInterface) parentArray.getAxisList().get(0); //stores the NoDataValues for the parentArray, //used in writing out when NoDataException is caught String NoDataValues[] = new String[fastestAxis.getLength()]; if (parentArray.hasFieldAxis()) { DataFormat[] dataFormatList = parentArray.getDataFormatList(); for (int i = 0; i < NoDataValues.length; i++) { DataFormat d = dataFormatList[i]; if (d != null && d.getNoDataValue() != null) NoDataValues[i]=d.getNoDataValue().toString(); } } else { DataFormat d = parentArray.getDataFormat(); for (int i = 0; i < NoDataValues.length; i++) { if (d!=null && d.getNoDataValue() != null) NoDataValues[i] = d.getNoDataValue().toString(); } } if (readObj instanceof TaggedXMLDataIOStyle) { String[] tagOrder = ((TaggedXMLDataIOStyle)readObj).getAxisTags(); int stop = tagOrder.length; String[] tags = new String[stop]; for (int i = stop-1; i >= 0 ; i--) { tags[stop-i-1] = tagOrder[i]; // System.out.println(tagOrder.get(i)); } int[] axes = getMaxDataIndex(); stop =axes.length; int[] axisLength = new int[stop]; for (int i = 0; i < stop; i++) { axisLength[i] =axes[stop - 1 - i]; } writeTaggedData(dataOutputStream, currentLocator, indent, axisLength, tags, 0, fastestAxis, NoDataValues); } //done dealing with with TaggedXMLDataIOSytle else { if (readObj instanceof DelimitedXMLDataIOStyle) { writeDelimitedData( dataOutputStream, currentLocator, (DelimitedXMLDataIOStyle) readObj, fastestAxis, NoDataValues ); } else { writeFormattedData(dataOutputStream, currentLocator, (FormattedXMLDataIOStyle) readObj, fastestAxis, NoDataValues); } } //close the data section appropriately if (niceOutput) { writeOut(outputstream, Constants.NEW_LINE); writeOut(outputstream, indent); } writeOut(outputstream, "</" + nodeName + ">"); if (niceOutput) writeOut(outputstream, Constants.NEW_LINE); }
7,639
protected void writeDelimitedData(OutputStream outputstream, Locator locator, DelimitedXMLDataIOStyle readObj, AxisInterface fastestAxis, String[] noDataValues) { String delimiter = readObj.getDelimiter(); String recordTerminator = readObj.getRecordTerminator(); int fastestAxisLength = fastestAxis.getLength(); int dataNum = 0; writeOut(outputstream, "<![CDATA["); do { dataNum ++; try { writeOut(outputstream, getStringData(locator)); } catch (NoDataException e) { //double check, a bug here, "yes" is already printed String noData = noDataValues[locator.getAxisLocation(fastestAxis)]; if (noData == null) { readObj.setRepeatable("no"); } else { writeOut(outputstream, noData); } } //write out delimiter anyway writeOut(outputstream, delimiter); if (dataNum == fastestAxisLength) { writeOut(outputstream, recordTerminator); dataNum = 0; } } while (locator.next()); writeOut(outputstream, "]]>"); }
private void writeDelimitedData(OutputStream outputstream, Locator locator, DelimitedXMLDataIOStyle readObj, AxisInterface fastestAxis, String[] noDataValues) { String delimiter = readObj.getDelimiter(); String recordTerminator = readObj.getRecordTerminator(); int fastestAxisLength = fastestAxis.getLength(); int dataNum = 0; writeOut(outputstream, "<![CDATA["); do { dataNum ++; try { writeOut(outputstream, getStringData(locator)); } catch (NoDataException e) { //double check, a bug here, "yes" is already printed String noData = noDataValues[locator.getAxisLocation(fastestAxis)]; if (noData == null) { readObj.setRepeatable("no"); } else { writeOut(outputstream, noData); } } //write out delimiter anyway writeOut(outputstream, delimiter); if (dataNum == fastestAxisLength) { writeOut(outputstream, recordTerminator); dataNum = 0; } } while (locator.next()); writeOut(outputstream, "]]>"); }
7,640
protected void writeFormattedData(OutputStream outputstream , Locator locator, FormattedXMLDataIOStyle readObj, AxisInterface fastestAxis, String[] noDataValues) { writeOut(outputstream, "<![CDATA["); List commands = readObj.getCommands(); synchronized (data) { //double check on sync hasMoreData = locator.hasNext(); while (hasMoreData) recursiveWriteFormattedData(outputstream, locator, commands, fastestAxis, noDataValues); writeOut(outputstream, "]]>"); } }
private void writeFormattedData(OutputStream outputstream , Locator locator, FormattedXMLDataIOStyle readObj, AxisInterface fastestAxis, String[] noDataValues) { writeOut(outputstream, "<![CDATA["); List commands = readObj.getCommands(); synchronized (data) { //double check on sync hasMoreData = locator.hasNext(); while (hasMoreData) recursiveWriteFormattedData(outputstream, locator, commands, fastestAxis, noDataValues); writeOut(outputstream, "]]>"); } }
7,641
protected void writeTaggedData(OutputStream outputstream, Locator locator, String indent, int[] axisLength, String[] tags, int which, AxisInterface fastestAxis, String[] noDataValues) { String tag = (String) tags[which]; if (sPrettyXDFOutput) { indent += sPrettyXDFOutputIndentation; } //base case (writes the last 2 inner dimensions of the data cube) if (which == tags.length-2) { int stop = axisLength[which]; String tag1 = (String) tags[which+1]; for (int count = 0; count < stop; count++) { if (sPrettyXDFOutput) { writeOut(outputstream, Constants.NEW_LINE); writeOut(outputstream, indent); } writeOut(outputstream, "<" + tag + ">"); if (sPrettyXDFOutput) { writeOut(outputstream, Constants.NEW_LINE); writeOut(outputstream, indent + sPrettyXDFOutputIndentation); } int fastestAxisLength = fastestAxis.getLength(); int dataNum = 0; while (dataNum < fastestAxisLength) { writeOut( outputstream, "<" + tag1 ); try { writeOut( outputstream, ">" + getStringData(locator)); writeOut( outputstream, "</" + tag1 + ">"); } catch (NoDataException e) { // opps! no data in that location. Print out accordingly String noDataValueString = noDataValues[locator.getAxisLocation(fastestAxis)]; if (noDataValueString != null) { writeOut(outputstream, ">" + noDataValueString ); writeOut( outputstream, "</" + tag1 + ">"); } else writeOut( outputstream, "/>"); } dataNum ++; locator.next(); } if (sPrettyXDFOutput) { writeOut(outputstream, Constants.NEW_LINE); writeOut(outputstream, indent); } writeOut(outputstream, "</" + tag+ ">"); } } else { // the 'outer' data tag wrapper. writes dimension 3 or higher tags int stop = axisLength[which]; which++; for (int i = 0; i < stop; i++) { if (sPrettyXDFOutput) { writeOut(outputstream, Constants.NEW_LINE); writeOut(outputstream, indent); } writeOut(outputstream, "<" + tag + ">"); writeTaggedData(outputstream, locator, indent, axisLength, tags, which, fastestAxis, noDataValues); if (sPrettyXDFOutput) { writeOut(outputstream, Constants.NEW_LINE); writeOut(outputstream, indent); } writeOut(outputstream, "</" + tag + ">"); } } }
protected void writeTaggedData(OutputStream outputstream, Locator locator, String indent, int[] axisLength, String[] tags, int which, AxisInterface fastestAxis, String[] noDataValues) { String tag = (String) tags[which]; if (sPrettyXDFOutput) { indent += sPrettyXDFOutputIndentation; } //base case (writes the last 2 inner dimensions of the data cube) if (which == tags.length-2) { int stop = axisLength[which]; String tag1 = (String) tags[which+1]; for (int count = 0; count < stop; count++) { if (sPrettyXDFOutput) { writeOut(outputstream, Constants.NEW_LINE); writeOut(outputstream, indent); } writeOut(outputstream, "<" + tag + ">"); if (sPrettyXDFOutput) { writeOut(outputstream, Constants.NEW_LINE); writeOut(outputstream, indent + sPrettyXDFOutputIndentation); } int fastestAxisLength = fastestAxis.getLength(); int dataNum = 0; while (dataNum < fastestAxisLength) { writeOut( outputstream, "<" + tag1 ); try { writeOut( outputstream, ">" + getStringData(locator)); writeOut( outputstream, "</" + tag1 + ">"); } catch (NoDataException e) { // opps! no data in that location. Print out accordingly String noDataValueString = noDataValues[locator.getAxisLocation(fastestAxis)]; if (noDataValueString != null) { writeOut(outputstream, ">" + noDataValueString ); writeOut( outputstream, "</" + tag1 + ">"); } else writeOut( outputstream, "/>"); } dataNum ++; locator.next(); } if (sPrettyXDFOutput) { writeOut(outputstream, Constants.NEW_LINE); writeOut(outputstream, indent); } writeOut(outputstream, "</" + tag+ ">"); } } else { // the 'outer' data tag wrapper. writes dimension 3 or higher tags int stop = axisLength[which]; which++; for (int i = 0; i < stop; i++) { if (sPrettyXDFOutput) { writeOut(outputstream, Constants.NEW_LINE); writeOut(outputstream, indent); } writeOut(outputstream, "<" + tag + ">"); writeTaggedData(outputstream, locator, indent, axisLength, tags, which, fastestAxis, noDataValues); if (sPrettyXDFOutput) { writeOut(outputstream, Constants.NEW_LINE); writeOut(outputstream, indent); } writeOut(outputstream, "</" + tag + ">"); } } }
7,642
protected void writeTaggedData(OutputStream outputstream, Locator locator, String indent, int[] axisLength, String[] tags, int which, AxisInterface fastestAxis, String[] noDataValues) { String tag = (String) tags[which]; if (sPrettyXDFOutput) { indent += sPrettyXDFOutputIndentation; } //base case (writes the last 2 inner dimensions of the data cube) if (which == tags.length-2) { int stop = axisLength[which]; String tag1 = (String) tags[which+1]; for (int count = 0; count < stop; count++) { if (sPrettyXDFOutput) { writeOut(outputstream, Constants.NEW_LINE); writeOut(outputstream, indent); } writeOut(outputstream, "<" + tag + ">"); if (sPrettyXDFOutput) { writeOut(outputstream, Constants.NEW_LINE); writeOut(outputstream, indent + sPrettyXDFOutputIndentation); } int fastestAxisLength = fastestAxis.getLength(); int dataNum = 0; while (dataNum < fastestAxisLength) { writeOut( outputstream, "<" + tag1 ); try { writeOut( outputstream, ">" + getStringData(locator)); writeOut( outputstream, "</" + tag1 + ">"); } catch (NoDataException e) { // opps! no data in that location. Print out accordingly String noDataValueString = noDataValues[locator.getAxisLocation(fastestAxis)]; if (noDataValueString != null) { writeOut(outputstream, ">" + noDataValueString ); writeOut( outputstream, "</" + tag1 + ">"); } else writeOut( outputstream, "/>"); } dataNum ++; locator.next(); } if (sPrettyXDFOutput) { writeOut(outputstream, Constants.NEW_LINE); writeOut(outputstream, indent); } writeOut(outputstream, "</" + tag+ ">"); } } else { // the 'outer' data tag wrapper. writes dimension 3 or higher tags int stop = axisLength[which]; which++; for (int i = 0; i < stop; i++) { if (sPrettyXDFOutput) { writeOut(outputstream, Constants.NEW_LINE); writeOut(outputstream, indent); } writeOut(outputstream, "<" + tag + ">"); writeTaggedData(outputstream, locator, indent, axisLength, tags, which, fastestAxis, noDataValues); if (sPrettyXDFOutput) { writeOut(outputstream, Constants.NEW_LINE); writeOut(outputstream, indent); } writeOut(outputstream, "</" + tag + ">"); } } }
protected void writeTaggedData(OutputStream outputstream, Locator locator, String indent, int[] axisLength, String[] tags, int which, AxisInterface fastestAxis, String[] noDataValues) { String tag = (String) tags[which]; if (Specification.getInstance().isPrettyXDFOutput()) { indent += sPrettyXDFOutputIndentation; } //base case (writes the last 2 inner dimensions of the data cube) if (which == tags.length-2) { int stop = axisLength[which]; String tag1 = (String) tags[which+1]; for (int count = 0; count < stop; count++) { if (Specification.getInstance().isPrettyXDFOutput()) { writeOut(outputstream, Constants.NEW_LINE); writeOut(outputstream, indent); } writeOut(outputstream, "<" + tag + ">"); if (Specification.getInstance().isPrettyXDFOutput()) { writeOut(outputstream, Constants.NEW_LINE); writeOut(outputstream, indent + sPrettyXDFOutputIndentation); } int fastestAxisLength = fastestAxis.getLength(); int dataNum = 0; while (dataNum < fastestAxisLength) { writeOut( outputstream, "<" + tag1 ); try { writeOut( outputstream, ">" + getStringData(locator)); writeOut( outputstream, "</" + tag1 + ">"); } catch (NoDataException e) { // opps! no data in that location. Print out accordingly String noDataValueString = noDataValues[locator.getAxisLocation(fastestAxis)]; if (noDataValueString != null) { writeOut(outputstream, ">" + noDataValueString ); writeOut( outputstream, "</" + tag1 + ">"); } else writeOut( outputstream, "/>"); } dataNum ++; locator.next(); } if (Specification.getInstance().isPrettyXDFOutput()) { writeOut(outputstream, Constants.NEW_LINE); writeOut(outputstream, indent); } writeOut(outputstream, "</" + tag+ ">"); } } else { // the 'outer' data tag wrapper. writes dimension 3 or higher tags int stop = axisLength[which]; which++; for (int i = 0; i < stop; i++) { if (Specification.getInstance().isPrettyXDFOutput()) { writeOut(outputstream, Constants.NEW_LINE); writeOut(outputstream, indent); } writeOut(outputstream, "<" + tag + ">"); writeTaggedData(outputstream, locator, indent, axisLength, tags, which, fastestAxis, noDataValues); if (Specification.getInstance().isPrettyXDFOutput()) { writeOut(outputstream, Constants.NEW_LINE); writeOut(outputstream, indent); } writeOut(outputstream, "</" + tag + ">"); } } }
7,643
protected void writeTaggedData(OutputStream outputstream, Locator locator, String indent, int[] axisLength, String[] tags, int which, AxisInterface fastestAxis, String[] noDataValues) { String tag = (String) tags[which]; if (sPrettyXDFOutput) { indent += sPrettyXDFOutputIndentation; } //base case (writes the last 2 inner dimensions of the data cube) if (which == tags.length-2) { int stop = axisLength[which]; String tag1 = (String) tags[which+1]; for (int count = 0; count < stop; count++) { if (sPrettyXDFOutput) { writeOut(outputstream, Constants.NEW_LINE); writeOut(outputstream, indent); } writeOut(outputstream, "<" + tag + ">"); if (sPrettyXDFOutput) { writeOut(outputstream, Constants.NEW_LINE); writeOut(outputstream, indent + sPrettyXDFOutputIndentation); } int fastestAxisLength = fastestAxis.getLength(); int dataNum = 0; while (dataNum < fastestAxisLength) { writeOut( outputstream, "<" + tag1 ); try { writeOut( outputstream, ">" + getStringData(locator)); writeOut( outputstream, "</" + tag1 + ">"); } catch (NoDataException e) { // opps! no data in that location. Print out accordingly String noDataValueString = noDataValues[locator.getAxisLocation(fastestAxis)]; if (noDataValueString != null) { writeOut(outputstream, ">" + noDataValueString ); writeOut( outputstream, "</" + tag1 + ">"); } else writeOut( outputstream, "/>"); } dataNum ++; locator.next(); } if (sPrettyXDFOutput) { writeOut(outputstream, Constants.NEW_LINE); writeOut(outputstream, indent); } writeOut(outputstream, "</" + tag+ ">"); } } else { // the 'outer' data tag wrapper. writes dimension 3 or higher tags int stop = axisLength[which]; which++; for (int i = 0; i < stop; i++) { if (sPrettyXDFOutput) { writeOut(outputstream, Constants.NEW_LINE); writeOut(outputstream, indent); } writeOut(outputstream, "<" + tag + ">"); writeTaggedData(outputstream, locator, indent, axisLength, tags, which, fastestAxis, noDataValues); if (sPrettyXDFOutput) { writeOut(outputstream, Constants.NEW_LINE); writeOut(outputstream, indent); } writeOut(outputstream, "</" + tag + ">"); } } }
protected void writeTaggedData(OutputStream outputstream, Locator locator, String indent, int[] axisLength, String[] tags, int which, AxisInterface fastestAxis, String[] noDataValues) { String tag = (String) tags[which]; if (sPrettyXDFOutput) { indent += sPrettyXDFOutputIndentation; } //base case (writes the last 2 inner dimensions of the data cube) if (which == tags.length-2) { int stop = axisLength[which]; String tag1 = (String) tags[which+1]; for (int count = 0; count < stop; count++) { if (sPrettyXDFOutput) { writeOut(outputstream, Constants.NEW_LINE); writeOut(outputstream, indent); } writeOut(outputstream, "<" + tag + ">"); if (sPrettyXDFOutput) { writeOut(outputstream, Constants.NEW_LINE); writeOut(outputstream, indent + Specification.getInstance().getPrettyXDFOutputIndentation()); } int fastestAxisLength = fastestAxis.getLength(); int dataNum = 0; while (dataNum < fastestAxisLength) { writeOut( outputstream, "<" + tag1 ); try { writeOut( outputstream, ">" + getStringData(locator)); writeOut( outputstream, "</" + tag1 + ">"); } catch (NoDataException e) { // opps! no data in that location. Print out accordingly String noDataValueString = noDataValues[locator.getAxisLocation(fastestAxis)]; if (noDataValueString != null) { writeOut(outputstream, ">" + noDataValueString ); writeOut( outputstream, "</" + tag1 + ">"); } else writeOut( outputstream, "/>"); } dataNum ++; locator.next(); } if (sPrettyXDFOutput) { writeOut(outputstream, Constants.NEW_LINE); writeOut(outputstream, indent); } writeOut(outputstream, "</" + tag+ ">"); } } else { // the 'outer' data tag wrapper. writes dimension 3 or higher tags int stop = axisLength[which]; which++; for (int i = 0; i < stop; i++) { if (sPrettyXDFOutput) { writeOut(outputstream, Constants.NEW_LINE); writeOut(outputstream, indent); } writeOut(outputstream, "<" + tag + ">"); writeTaggedData(outputstream, locator, indent, axisLength, tags, which, fastestAxis, noDataValues); if (sPrettyXDFOutput) { writeOut(outputstream, Constants.NEW_LINE); writeOut(outputstream, indent); } writeOut(outputstream, "</" + tag + ">"); } } }
7,644
public synchronized void add(String item) { if (item == null) throw new NullPointerException("item must be non-null"); pItems.addElement(item); int i = pItems.size() - 1; if (peer != null) { ChoicePeer cp = (ChoicePeer) peer; cp.add(item, i); } if (i == 0) select(0); }
add(String item) { if (item == null) throw new NullPointerException("item must be non-null"); pItems.addElement(item); int i = pItems.size() - 1; if (peer != null) { ChoicePeer cp = (ChoicePeer) peer; cp.add(item, i); } if (i == 0) select(0); }
7,645
public synchronized void add(String item) { if (item == null) throw new NullPointerException("item must be non-null"); pItems.addElement(item); int i = pItems.size() - 1; if (peer != null) { ChoicePeer cp = (ChoicePeer) peer; cp.add(item, i); } if (i == 0) select(0); }
public synchronized void add(String item) { if (item == null) throw new NullPointerException("item must be non-null"); pItems.addElement(item); int i = pItems.size() - 1; if (peer != null) { ChoicePeer cp = (ChoicePeer) peer; cp.add(item, i); } if (i == 0) select(0); }
7,646
public synchronized void addItem(String item) { add(item); }
addItem(String item) { add(item); }
7,647
public synchronized void addItemListener(ItemListener listener) { item_listeners = AWTEventMulticaster.add(item_listeners, listener); }
addItemListener(ItemListener listener) { item_listeners = AWTEventMulticaster.add(item_listeners, listener); }
7,648
public void addNotify() { if (peer == null) peer = getToolkit().createChoice(this); super.addNotify(); }
addNotify() { if (peer == null) peer = getToolkit().createChoice(this); super.addNotify(); }
7,649
public int countItems() { return (pItems.size()); }
public int countItems() { return (pItems.size()); }
7,650
public String getItem(int index) { return ((String) pItems.elementAt(index)); }
public String getItem(int index) { return ((String) pItems.elementAt(index)); }
7,651
public int getItemCount() { return (pItems.size()); }
public int getItemCount() { return (pItems.size()); }
7,652
public int getSelectedIndex() { return (selectedIndex); }
public int getSelectedIndex() { return (selectedIndex); }
7,653
public synchronized String getSelectedItem() { return (selectedIndex == -1 ? null : ((String) pItems.elementAt(selectedIndex))); }
public synchronized String getSelectedItem() { return (selectedIndex == -1 ? null : ((String) pItems.elementAt(selectedIndex))); }
7,654
public synchronized Object[] getSelectedObjects() { if (selectedIndex == -1) return null; Object[] objs = new Object[1]; objs[0] = pItems.elementAt(selectedIndex); return (objs); }
getSelectedObjects() { if (selectedIndex == -1) return null; Object[] objs = new Object[1]; objs[0] = pItems.elementAt(selectedIndex); return (objs); }
7,655
public synchronized void insert(String item, int index) { if (index < 0) throw new IllegalArgumentException("index may not be less then 0"); if (index > getItemCount()) index = getItemCount(); pItems.insertElementAt(item, index); if (peer != null) { ChoicePeer cp = (ChoicePeer) peer; cp.add(item, index); } if (getItemCount() == 1 || selectedIndex >= index) select(0); }
insert(String item, int index) { if (index < 0) throw new IllegalArgumentException("index may not be less then 0"); if (index > getItemCount()) index = getItemCount(); pItems.insertElementAt(item, index); if (peer != null) { ChoicePeer cp = (ChoicePeer) peer; cp.add(item, index); } if (getItemCount() == 1 || selectedIndex >= index) select(0); }
7,656
public synchronized void insert(String item, int index) { if (index < 0) throw new IllegalArgumentException("index may not be less then 0"); if (index > getItemCount()) index = getItemCount(); pItems.insertElementAt(item, index); if (peer != null) { ChoicePeer cp = (ChoicePeer) peer; cp.add(item, index); } if (getItemCount() == 1 || selectedIndex >= index) select(0); }
public synchronized void insert(String item, int index) { if (index < 0) throw new IllegalArgumentException("index may not be less then 0"); if (index > getItemCount()) index = getItemCount(); pItems.insertElementAt(item, index); if (peer != null) { ChoicePeer cp = (ChoicePeer) peer; cp.add(item, index); } if (getItemCount() == 1 || selectedIndex >= index) select(0); }
7,657
protected String paramString() { return ("selectedIndex=" + selectedIndex + "," + super.paramString()); }
paramString() { return ("selectedIndex=" + selectedIndex + "," + super.paramString()); }
7,658
public synchronized void remove(String item) { int index = pItems.indexOf(item); if (index == -1) throw new IllegalArgumentException("item \"" + item + "\" not found in Choice"); remove(index); }
remove(String item) { int index = pItems.indexOf(item); if (index == -1) throw new IllegalArgumentException("item \"" + item + "\" not found in Choice"); remove(index); }
7,659
public synchronized void removeAll() { int count = getItemCount(); for (int i = 0; i < count; i++) { // Always remove 0. remove(0); } }
public synchronized void removeAll() { int count = getItemCount(); for (int i = 0; i < count; i++) { // Always remove 0. remove(0); } }
7,660
public synchronized void removeAll() { int count = getItemCount(); for (int i = 0; i < count; i++) { // Always remove 0. remove(0); } }
public synchronized void removeAll() { int count = getItemCount(); for (int i = 0; i < count; i++) { // Always remove 0. remove(0); } }
7,661
public synchronized void select(int index) { if ((index < 0) || (index > getItemCount())) throw new IllegalArgumentException("Bad index: " + index); this.selectedIndex = index; if (peer != null) { ChoicePeer cp = (ChoicePeer) peer; cp.select(index); } }
select(int index) { if ((index < 0) || (index > getItemCount())) throw new IllegalArgumentException("Bad index: " + index); this.selectedIndex = index; if (peer != null) { ChoicePeer cp = (ChoicePeer) peer; cp.select(index); } }
7,663
public synchronized void select(int index) { if ((index < 0) || (index > getItemCount())) throw new IllegalArgumentException("Bad index: " + index); this.selectedIndex = index; if (peer != null) { ChoicePeer cp = (ChoicePeer) peer; cp.select(index); } }
public synchronized void select(int index) { if ((index < 0) || (index > getItemCount())) throw new IllegalArgumentException("Bad index: " + index); this.selectedIndex = index; if (peer != null) { ChoicePeer cp = (ChoicePeer) peer; cp.select(index); } }
7,664
private int getDaysInMonth(int month, int year) { // Most of this is copied from GregorianCalendar.getActualMaximum() if (month == Calendar.FEBRUARY) { return ((year & 3) == 0 && (year % 100 != 0 || year % 400 == 0)) ? 29 : 28; } else if (month < Calendar.AUGUST) return 31 - (month & 1); else return 30 + (month & 1); }
private int getDaysInMonth(int month, int year) { // Most of this is copied from GregorianCalendar.getActualMaximum() if (month == Calendar.FEBRUARY) { return ((year & 3) == 0 && (year % 100 != 0 || year % 400 == 0)) ? 29 : 28; } else if (month < Calendar.AUGUST) return 31 - (month & 1); else return 30 + (month & 1); }
7,667
private int getDaysInMonth(int month, int year) { // Most of this is copied from GregorianCalendar.getActualMaximum() if (month == Calendar.FEBRUARY) { return ((year & 3) == 0 && (year % 100 != 0 || year % 400 == 0)) ? 29 : 28; } else if (month < Calendar.AUGUST) return 31 - (month & 1); else return 30 + (month & 1); }
private int getDaysInMonth(int month, int year) { // Most of this is copied from GregorianCalendar.getActualMaximum() if (month == Calendar.FEBRUARY) { return ((year & 3) == 0 && (year % 100 != 0 || year % 400 == 0)) ? 29 : 28; } else if (month < Calendar.AUGUST) return 31 - (month & 1); else return 30 + (month & 1); }
7,668
private int getDaysInMonth(int month, int year) { // Most of this is copied from GregorianCalendar.getActualMaximum() if (month == Calendar.FEBRUARY) { return ((year & 3) == 0 && (year % 100 != 0 || year % 400 == 0)) ? 29 : 28; } else if (month < Calendar.AUGUST) return 31 - (month & 1); else return 30 + (month & 1); }
private int getDaysInMonth(int month, int year) { // Most of this is copied from GregorianCalendar.getActualMaximum() if (month == Calendar.FEBRUARY) { return ((year & 3) == 0 && (year % 100 != 0 || year % 400 == 0)) ? 29 : 28; } else if (month < Calendar.AUGUST) return 31 - (month & 1); else return monthArr[month]; }
7,669
public int getOffset(int era, int year, int month, int day, int dayOfWeek, int millis) { int daysInMonth = getDaysInMonth(month, year); if (day < 1 || day > daysInMonth) throw new IllegalArgumentException("day out of range"); if (dayOfWeek < Calendar.SUNDAY || dayOfWeek > Calendar.SATURDAY) throw new IllegalArgumentException("dayOfWeek out of range"); if (month < Calendar.JANUARY || month > Calendar.DECEMBER) throw new IllegalArgumentException("month out of range"); // This method is called by Calendar, so we mustn't use that class. int daylightSavings = 0; if (useDaylight && era == GregorianCalendar.AD && year >= startYear) { // This does only work for Gregorian calendars :-( // This is mainly because setStartYear doesn't take an era. boolean afterStart = !isBefore(year, month, day, dayOfWeek, millis, startMode, startMonth, startDay, startDayOfWeek, startTime); boolean beforeEnd = isBefore(year, month, day, dayOfWeek, millis, endMode, endMonth, endDay, endDayOfWeek, endTime); if (startMonth < endMonth) { // use daylight savings, if the date is after the start of // savings, and before the end of savings. daylightSavings = afterStart && beforeEnd ? dstSavings : 0; } else { // use daylight savings, if the date is before the end of // savings, or after the start of savings. daylightSavings = beforeEnd || afterStart ? dstSavings : 0; } } return rawOffset + daylightSavings; }
public int getOffset(int era, int year, int month, int day, int dayOfWeek, int millis) { int daysInMonth = getDaysInMonth(month, year); if (day < 1 || day > daysInMonth) throw new IllegalArgumentException("day out of range"); if (dayOfWeek < Calendar.SUNDAY || dayOfWeek > Calendar.SATURDAY) throw new IllegalArgumentException("dayOfWeek out of range"); if (month < Calendar.JANUARY || month > Calendar.DECEMBER) throw new IllegalArgumentException("month out of range:" + month); // This method is called by Calendar, so we mustn't use that class. int daylightSavings = 0; if (useDaylight && era == GregorianCalendar.AD && year >= startYear) { // This does only work for Gregorian calendars :-( // This is mainly because setStartYear doesn't take an era. boolean afterStart = !isBefore(year, month, day, dayOfWeek, millis, startMode, startMonth, startDay, startDayOfWeek, startTime); boolean beforeEnd = isBefore(year, month, day, dayOfWeek, millis, endMode, endMonth, endDay, endDayOfWeek, endTime); if (startMonth < endMonth) { // use daylight savings, if the date is after the start of // savings, and before the end of savings. daylightSavings = afterStart && beforeEnd ? dstSavings : 0; } else { // use daylight savings, if the date is before the end of // savings, or after the start of savings. daylightSavings = beforeEnd || afterStart ? dstSavings : 0; } } return rawOffset + daylightSavings; }
7,670
public int getOffset(int era, int year, int month, int day, int dayOfWeek, int millis) { int daysInMonth = getDaysInMonth(month, year); if (day < 1 || day > daysInMonth) throw new IllegalArgumentException("day out of range"); if (dayOfWeek < Calendar.SUNDAY || dayOfWeek > Calendar.SATURDAY) throw new IllegalArgumentException("dayOfWeek out of range"); if (month < Calendar.JANUARY || month > Calendar.DECEMBER) throw new IllegalArgumentException("month out of range"); // This method is called by Calendar, so we mustn't use that class. int daylightSavings = 0; if (useDaylight && era == GregorianCalendar.AD && year >= startYear) { // This does only work for Gregorian calendars :-( // This is mainly because setStartYear doesn't take an era. boolean afterStart = !isBefore(year, month, day, dayOfWeek, millis, startMode, startMonth, startDay, startDayOfWeek, startTime); boolean beforeEnd = isBefore(year, month, day, dayOfWeek, millis, endMode, endMonth, endDay, endDayOfWeek, endTime); if (startMonth < endMonth) { // use daylight savings, if the date is after the start of // savings, and before the end of savings. daylightSavings = afterStart && beforeEnd ? dstSavings : 0; } else { // use daylight savings, if the date is before the end of // savings, or after the start of savings. daylightSavings = beforeEnd || afterStart ? dstSavings : 0; } } return rawOffset + daylightSavings; }
public int getOffset(int era, int year, int month, int day, int dayOfWeek, int millis) int daysInMonth = getDaysInMonth(month, year); if (day < 1 || day > daysInMonth) throw new IllegalArgumentException("day out of range"); if (dayOfWeek < Calendar.SUNDAY || dayOfWeek > Calendar.SATURDAY) throw new IllegalArgumentException("dayOfWeek out of range"); if (month < Calendar.JANUARY || month > Calendar.DECEMBER) throw new IllegalArgumentException("month out of range"); // This method is called by Calendar, so we mustn't use that class. int daylightSavings = 0; if (useDaylight && era == GregorianCalendar.AD && year >= startYear) // This does only work for Gregorian calendars :-( // This is mainly because setStartYear doesn't take an era. boolean afterStart = !isBefore(year, month, day, dayOfWeek, millis, startMode, startMonth, startDay, startDayOfWeek, startTime); boolean beforeEnd = isBefore(year, month, day, dayOfWeek, millis, endMode, endMonth, endDay, endDayOfWeek, endTime); if (startMonth < endMonth) // use daylight savings, if the date is after the start of // savings, and before the end of savings. daylightSavings = afterStart && beforeEnd ? dstSavings : 0; } else // use daylight savings, if the date is before the end of // savings, or after the start of savings. daylightSavings = beforeEnd || afterStart ? dstSavings : 0; } } return rawOffset + daylightSavings; }
7,671
public int getOffset(int era, int year, int month, int day, int dayOfWeek, int millis) { int daysInMonth = getDaysInMonth(month, year); if (day < 1 || day > daysInMonth) throw new IllegalArgumentException("day out of range"); if (dayOfWeek < Calendar.SUNDAY || dayOfWeek > Calendar.SATURDAY) throw new IllegalArgumentException("dayOfWeek out of range"); if (month < Calendar.JANUARY || month > Calendar.DECEMBER) throw new IllegalArgumentException("month out of range"); // This method is called by Calendar, so we mustn't use that class. int daylightSavings = 0; if (useDaylight && era == GregorianCalendar.AD && year >= startYear) { // This does only work for Gregorian calendars :-( // This is mainly because setStartYear doesn't take an era. boolean afterStart = !isBefore(year, month, day, dayOfWeek, millis, startMode, startMonth, startDay, startDayOfWeek, startTime); boolean beforeEnd = isBefore(year, month, day, dayOfWeek, millis, endMode, endMonth, endDay, endDayOfWeek, endTime); if (startMonth < endMonth) { // use daylight savings, if the date is after the start of // savings, and before the end of savings. daylightSavings = afterStart && beforeEnd ? dstSavings : 0; } else { // use daylight savings, if the date is before the end of // savings, or after the start of savings. daylightSavings = beforeEnd || afterStart ? dstSavings : 0; } } return rawOffset + daylightSavings; }
public int getOffset(int era, int year, int month, int day, int dayOfWeek, int millis) { int daysInMonth = getDaysInMonth(month, year); if (day < 1 || day > daysInMonth) throw new IllegalArgumentException("day out of range"); if (dayOfWeek < Calendar.SUNDAY || dayOfWeek > Calendar.SATURDAY) throw new IllegalArgumentException("dayOfWeek out of range"); if (month < Calendar.JANUARY || month > Calendar.DECEMBER) throw new IllegalArgumentException("month out of range"); // This method is called by Calendar, so we mustn't use that class. int daylightSavings = 0; if (useDaylight && era == GregorianCalendar.AD && year >= startYear) { // This does only work for Gregorian calendars :-( // This is mainly because setStartYear doesn't take an era. boolean afterStart = !isBefore(year, month, day, dayOfWeek, millis, startMode, startMonth, startDay, startDayOfWeek, startTime); boolean beforeEnd = isBefore(year, month, day, dayOfWeek, millis, endMode, endMonth, endDay, endDayOfWeek, endTime); if (startMonth < endMonth) { // use daylight savings, if the date is after the start of // savings, and before the end of savings. daylightSavings = afterStart && beforeEnd ? dstSavings : 0; else { // use daylight savings, if the date is before the end of // savings, or after the start of savings. daylightSavings = beforeEnd || afterStart ? dstSavings : 0; return rawOffset + daylightSavings;
7,672
public int getScrollableBlockIncrement(Rectangle visibleRect, int orientation, int direction) { return getScrollableUnitIncrement(visibleRect, orientation, direction); }
public int getScrollableBlockIncrement(Rectangle visibleRect, int orientation, int direction) { int block; if (orientation == SwingConstants.VERTICAL) block = visibleRect.height; else block = visibleRect.width; return block; }
7,673
public int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction) { int delta; // Round so that the top would start from the row boundary if (orientation == SwingConstants.VERTICAL) { // One pixel down, otherwise picks another row too high. int row = getClosestRowForLocation(visibleRect.x, visibleRect.y + 1); row = row + direction; if (row < 0) row = 0; Rectangle newTop = getRowBounds(row); delta = newTop.y - visibleRect.y; } else delta = direction * rowHeight == 0 ? 20 : rowHeight; return delta; }
public int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction) { int delta = 0; // Round so that the top would start from the row boundary if (orientation == SwingConstants.VERTICAL) { // One pixel down, otherwise picks another row too high. int row = getClosestRowForLocation(visibleRect.x, visibleRect.y + 1); row = row + direction; if (row < 0) row = 0; Rectangle newTop = getRowBounds(row); delta = newTop.y - visibleRect.y; } else delta = direction * rowHeight == 0 ? 20 : rowHeight; return delta; }
7,674
public int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction) { int delta; // Round so that the top would start from the row boundary if (orientation == SwingConstants.VERTICAL) { // One pixel down, otherwise picks another row too high. int row = getClosestRowForLocation(visibleRect.x, visibleRect.y + 1); row = row + direction; if (row < 0) row = 0; Rectangle newTop = getRowBounds(row); delta = newTop.y - visibleRect.y; } else delta = direction * rowHeight == 0 ? 20 : rowHeight; return delta; }
public int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction) { int delta; // Round so that the top would start from the row boundary if (orientation == SwingConstants.VERTICAL) { // One pixel down, otherwise picks another row too high. int row = getClosestRowForLocation(visibleRect.x, visibleRect.y + 1); row = row + direction; if (row < 0) row = 0; Rectangle newTop = getRowBounds(row); delta = newTop.y - visibleRect.y; } else delta = direction * rowHeight == 0 ? 20 : rowHeight; return delta; }
7,675
public int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction) { int delta; // Round so that the top would start from the row boundary if (orientation == SwingConstants.VERTICAL) { // One pixel down, otherwise picks another row too high. int row = getClosestRowForLocation(visibleRect.x, visibleRect.y + 1); row = row + direction; if (row < 0) row = 0; Rectangle newTop = getRowBounds(row); delta = newTop.y - visibleRect.y; } else delta = direction * rowHeight == 0 ? 20 : rowHeight; return delta; }
public int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction) { int delta; // Round so that the top would start from the row boundary if (orientation == SwingConstants.VERTICAL) { // One pixel down, otherwise picks another row too high. int row = getClosestRowForLocation(visibleRect.x, visibleRect.y + 1); row = row + direction; if (row < 0) row = 0; Rectangle newTop = getRowBounds(row); delta = newTop.y - visibleRect.y; } else { if (direction < 0) { if (row != 0) { b = getRowBounds(row - 1); delta = b.height; } } else delta = b.height; } } } else delta = 4; return delta; }
7,676
public void setSelectionModel(TreeSelectionModel model) { if (selectionModel == model) return; if (selectionModel != null) selectionModel.removeTreeSelectionListener(selectionRedirector); TreeSelectionModel oldValue = selectionModel; selectionModel = model; if (selectionModel != null) selectionModel.addTreeSelectionListener(selectionRedirector); firePropertyChange(SELECTION_MODEL_PROPERTY, oldValue, model); revalidate(); repaint(); }
public void setSelectionModel(TreeSelectionModel model) { if (selectionModel == model) return; selectionModel.removeTreeSelectionListener(selectionRedirector); TreeSelectionModel oldValue = selectionModel; selectionModel = model; selectionModel.addTreeSelectionListener(selectionRedirector); firePropertyChange(SELECTION_MODEL_PROPERTY, oldValue, model); revalidate(); repaint(); }
7,677
private LongItem(int kind, int offsetToFP, Register lsb, Register msb, long val) { super(kind, offsetToFP, lsb, msb); this.value = val; }
private LongItem(int kind, int offsetToFP, Register lsb, Register msb, long val) { super(kind, offsetToFP, lsb, msb); this.value = val; }
7,678
protected DoubleWordItem cloneConstant() { return createConst(getValue()); }
protected DoubleWordItem cloneConstant() { return createConst(getValue()); }
7,679
public synchronized void connect() throws IOException { // Call is ignored if already connected. if (connected) return; jar_url = getJarFileURL(); jar_file = JarFileCache.get (jar_url, useCaches); String entry_name = getEntryName(); if (entry_name != null && !entry_name.equals ("")) { jar_entry = (JarEntry) jar_file.getEntry (entry_name); if(jar_entry == null) throw new IOException ("No entry for " + entry_name + " exists."); } connected = true; }
public synchronized void connect() throws IOException { // Call is ignored if already connected. if (connected) return; jar_url = getJarFileURL(); jar_file = JarFileCache.get (jar_url, useCaches); String entry_name = getEntryName(); if (entry_name != null && !entry_name.equals ("")) { jar_entry = (JarEntry) jar_file.getEntry (entry_name); if(jar_entry == null) throw new FileNotFoundException("No entry for " + entry_name + " exists."); } connected = true; }
7,685
public InputStream getInputStream() throws IOException { if (!connected) connect(); if (! doInput) throw new ProtocolException("Can't open InputStream if doInput is false"); if (jar_entry == null) throw new IOException (jar_url + " couldn't be found."); return jar_file.getInputStream (jar_entry); }
public InputStream getInputStream() throws IOException { if (!connected) connect(); if (! doInput) throw new ProtocolException("Can't open InputStream if doInput is false"); if (jar_entry == null) throw new IOException (jar_url + " couldn't be found."); return jar_file.getInputStream (jar_entry); }
7,686
protected JButton createArrowButton() { return new MetalComboBoxButton(comboBox, new MetalComboBoxIcon(), new CellRendererPane(), listBox); }
protected JButton createArrowButton() { JButton button = new MetalComboBoxButton(comboBox, new MetalComboBoxIcon(), new CellRendererPane(), listBox); }
7,687
protected void editablePropertyChanged(PropertyChangeEvent e) { if (arrowButton instanceof MetalComboBoxButton) { MetalComboBoxButton b = (MetalComboBoxButton) arrowButton; b.setIconOnly(comboBox.isEditable()); } if (comboBox.isEditable()) { arrowButton.setText(null); if (editor != null) editor.setVisible(true); } else { arrowButton.setText(comboBox.getSelectedItem().toString()); if (editor != null) editor.setVisible(true); } }
protected void editablePropertyChanged(PropertyChangeEvent e) { if (arrowButton instanceof MetalComboBoxButton) { MetalComboBoxButton b = (MetalComboBoxButton) arrowButton; b.setIconOnly(comboBox.isEditable()); } if (comboBox.isEditable()) { arrowButton.setText(null); if (editor != null) editor.setVisible(true); } else { String text = ""; Object selected = comboBox.getSelectedItem(); if (selected != null) text = selected.toString(); arrowButton.setText(text); if (editor != null) editor.setVisible(true); } }
7,689
public Dimension getMinimumSize(JComponent c) { // FIXME: this needs work Dimension result = super.getMinimumSize(c); result.height = result.height + 9; return result; }
public Dimension getMinimumSize(JComponent c) { // FIXME: this needs work Dimension result = super.getMinimumSize(c); result.height = result.height + 9; return result; }
7,690
protected PropertyChangeListener createActionPropertyChangeListener(Action action) { return new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent event) { // Update properties "action" and "horizontalAlignment". String name = event.getPropertyName(); if (name.equals("enabled")) { boolean enabled = ((Boolean) event.getNewValue()).booleanValue(); JTextField.this.setEnabled(enabled); } else if (name.equals(Action.SHORT_DESCRIPTION)) { JTextField.this.setToolTipText((String) event.getNewValue()); } } }; }
protected PropertyChangeListener createActionPropertyChangeListener(Action action) { return new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent event) { // Update properties "action" and "horizontalAlignment". String name = event.getPropertyName(); if (name.equals("enabled")) { boolean enabled = ((Boolean) event.getNewValue()).booleanValue(); JTextField.this.setEnabled(enabled); } else if (name.equals(Action.SHORT_DESCRIPTION)) { JTextField.this.setToolTipText((String) event.getNewValue()); } } }; }
7,691
void findHelper() { if (helper != null || helper_NA) return; try { Class helperClass = Class.forName(ObjectCreator.toHelperName(type.id())); helper = (BoxedValueHelper) helperClass.newInstance(); } catch (Exception ex) { helper_NA = true; } }
void findHelper() { if (helper != null || helper_NA) return; try { Class helperClass = ObjectCreator.forName(ObjectCreator.toHelperName(type.id())); helper = (BoxedValueHelper) helperClass.newInstance(); } catch (Exception ex) { helper_NA = true; } }
7,692
public void send() throws Exception, AddressException, MessagingException {// try { if(!loadConfig(configFile)) return; Session session = Session.getDefaultInstance(SMTPProperties, null); session.setDebug(false); // create the Multipart and its parts to it Multipart mp = new MimeMultipart(); Message msg = new MimeMessage(session); InternetAddress[] toAddrs = null, ccAddrs = null; toAddrs = InternetAddress.parse(to, false); msg.setRecipients(Message.RecipientType.TO, toAddrs); if (cc != null) { ccAddrs = InternetAddress.parse(cc, false); msg.setRecipients(Message.RecipientType.CC, ccAddrs); } if (subject != null) msg.setSubject(subject.trim()); if (from != null && from.length() > 0) msg.setFrom(new InternetAddress(from)); if (message != null && message.length() > 0) { // create and fill the attachment message part MimeBodyPart mbp = new MimeBodyPart(); mbp.setText(message,"us-ascii"); mp.addBodyPart(mbp); } msg.setSentDate(new Date()); if (attachment != null && attachment.length() > 0) { // create and fill the attachment message part MimeBodyPart abp = new MimeBodyPart(); abp.setText(attachment,"us-ascii"); if (attachmentName == null || attachmentName.length() == 0) abp.setFileName("tn5250j.txt"); else abp.setFileName(attachmentName); mp.addBodyPart(abp); } if (fileName != null && fileName.length() > 0) { // create and fill the attachment message part MimeBodyPart fbp = new MimeBodyPart(); fbp.setText("File sent using tn5250j","us-ascii"); if (attachmentName == null || attachmentName.length() == 0) fbp.setFileName("tn5250j.txt"); else fbp.setFileName(attachmentName); // Get the attachment DataSource source = new FileDataSource(fileName); // Set the data handler to the attachment fbp.setDataHandler(new DataHandler(source)); mp.addBodyPart(fbp); } // add the Multipart to the message msg.setContent(mp); // send the message Transport.send(msg);// }// catch (SendFailedException sfe) {// System.out.println("Send Failed Exception " + sfe.toString());// JOptionPane.showMessageDialog(parent,// LangTool.getString("em.confirmationMessage") +// " " + tot.getText(),// LangTool.getString("em.titleConfirmation"),// JOptionPane.INFORMATION_ERROR);////// }// catch (Exception mex) {// System.out.println(mex.toString());// } }
public boolean send() throws Exception, AddressException, MessagingException {// try { if(!loadConfig(configFile)) return; Session session = Session.getDefaultInstance(SMTPProperties, null); session.setDebug(false); // create the Multipart and its parts to it Multipart mp = new MimeMultipart(); Message msg = new MimeMessage(session); InternetAddress[] toAddrs = null, ccAddrs = null; toAddrs = InternetAddress.parse(to, false); msg.setRecipients(Message.RecipientType.TO, toAddrs); if (cc != null) { ccAddrs = InternetAddress.parse(cc, false); msg.setRecipients(Message.RecipientType.CC, ccAddrs); } if (subject != null) msg.setSubject(subject.trim()); if (from != null && from.length() > 0) msg.setFrom(new InternetAddress(from)); if (message != null && message.length() > 0) { // create and fill the attachment message part MimeBodyPart mbp = new MimeBodyPart(); mbp.setText(message,"us-ascii"); mp.addBodyPart(mbp); } msg.setSentDate(new Date()); if (attachment != null && attachment.length() > 0) { // create and fill the attachment message part MimeBodyPart abp = new MimeBodyPart(); abp.setText(attachment,"us-ascii"); if (attachmentName == null || attachmentName.length() == 0) abp.setFileName("tn5250j.txt"); else abp.setFileName(attachmentName); mp.addBodyPart(abp); } if (fileName != null && fileName.length() > 0) { // create and fill the attachment message part MimeBodyPart fbp = new MimeBodyPart(); fbp.setText("File sent using tn5250j","us-ascii"); if (attachmentName == null || attachmentName.length() == 0) fbp.setFileName("tn5250j.txt"); else fbp.setFileName(attachmentName); // Get the attachment DataSource source = new FileDataSource(fileName); // Set the data handler to the attachment fbp.setDataHandler(new DataHandler(source)); mp.addBodyPart(fbp); } // add the Multipart to the message msg.setContent(mp); // send the message Transport.send(msg);// }// catch (SendFailedException sfe) {// System.out.println("Send Failed Exception " + sfe.toString());// JOptionPane.showMessageDialog(parent,// LangTool.getString("em.confirmationMessage") +// " " + tot.getText(),// LangTool.getString("em.titleConfirmation"),// JOptionPane.INFORMATION_ERROR);////// }// catch (Exception mex) {// System.out.println(mex.toString());// } }
7,693
public void send() throws Exception, AddressException, MessagingException {// try { if(!loadConfig(configFile)) return; Session session = Session.getDefaultInstance(SMTPProperties, null); session.setDebug(false); // create the Multipart and its parts to it Multipart mp = new MimeMultipart(); Message msg = new MimeMessage(session); InternetAddress[] toAddrs = null, ccAddrs = null; toAddrs = InternetAddress.parse(to, false); msg.setRecipients(Message.RecipientType.TO, toAddrs); if (cc != null) { ccAddrs = InternetAddress.parse(cc, false); msg.setRecipients(Message.RecipientType.CC, ccAddrs); } if (subject != null) msg.setSubject(subject.trim()); if (from != null && from.length() > 0) msg.setFrom(new InternetAddress(from)); if (message != null && message.length() > 0) { // create and fill the attachment message part MimeBodyPart mbp = new MimeBodyPart(); mbp.setText(message,"us-ascii"); mp.addBodyPart(mbp); } msg.setSentDate(new Date()); if (attachment != null && attachment.length() > 0) { // create and fill the attachment message part MimeBodyPart abp = new MimeBodyPart(); abp.setText(attachment,"us-ascii"); if (attachmentName == null || attachmentName.length() == 0) abp.setFileName("tn5250j.txt"); else abp.setFileName(attachmentName); mp.addBodyPart(abp); } if (fileName != null && fileName.length() > 0) { // create and fill the attachment message part MimeBodyPart fbp = new MimeBodyPart(); fbp.setText("File sent using tn5250j","us-ascii"); if (attachmentName == null || attachmentName.length() == 0) fbp.setFileName("tn5250j.txt"); else fbp.setFileName(attachmentName); // Get the attachment DataSource source = new FileDataSource(fileName); // Set the data handler to the attachment fbp.setDataHandler(new DataHandler(source)); mp.addBodyPart(fbp); } // add the Multipart to the message msg.setContent(mp); // send the message Transport.send(msg);// }// catch (SendFailedException sfe) {// System.out.println("Send Failed Exception " + sfe.toString());// JOptionPane.showMessageDialog(parent,// LangTool.getString("em.confirmationMessage") +// " " + tot.getText(),// LangTool.getString("em.titleConfirmation"),// JOptionPane.INFORMATION_ERROR);////// }// catch (Exception mex) {// System.out.println(mex.toString());// } }
public void send() throws Exception, AddressException, MessagingException {// try { if(!loadConfig(configFile)) return false; Session session = Session.getDefaultInstance(SMTPProperties, null); session.setDebug(false); // create the Multipart and its parts to it Multipart mp = new MimeMultipart(); Message msg = new MimeMessage(session); InternetAddress[] toAddrs = null, ccAddrs = null; toAddrs = InternetAddress.parse(to, false); msg.setRecipients(Message.RecipientType.TO, toAddrs); if (cc != null) { ccAddrs = InternetAddress.parse(cc, false); msg.setRecipients(Message.RecipientType.CC, ccAddrs); } if (subject != null) msg.setSubject(subject.trim()); if (from != null && from.length() > 0) msg.setFrom(new InternetAddress(from)); if (message != null && message.length() > 0) { // create and fill the attachment message part MimeBodyPart mbp = new MimeBodyPart(); mbp.setText(message,"us-ascii"); mp.addBodyPart(mbp); } msg.setSentDate(new Date()); if (attachment != null && attachment.length() > 0) { // create and fill the attachment message part MimeBodyPart abp = new MimeBodyPart(); abp.setText(attachment,"us-ascii"); if (attachmentName == null || attachmentName.length() == 0) abp.setFileName("tn5250j.txt"); else abp.setFileName(attachmentName); mp.addBodyPart(abp); } if (fileName != null && fileName.length() > 0) { // create and fill the attachment message part MimeBodyPart fbp = new MimeBodyPart(); fbp.setText("File sent using tn5250j","us-ascii"); if (attachmentName == null || attachmentName.length() == 0) fbp.setFileName("tn5250j.txt"); else fbp.setFileName(attachmentName); // Get the attachment DataSource source = new FileDataSource(fileName); // Set the data handler to the attachment fbp.setDataHandler(new DataHandler(source)); mp.addBodyPart(fbp); } // add the Multipart to the message msg.setContent(mp); // send the message Transport.send(msg);// }// catch (SendFailedException sfe) {// System.out.println("Send Failed Exception " + sfe.toString());// JOptionPane.showMessageDialog(parent,// LangTool.getString("em.confirmationMessage") +// " " + tot.getText(),// LangTool.getString("em.titleConfirmation"),// JOptionPane.INFORMATION_ERROR);////// }// catch (Exception mex) {// System.out.println(mex.toString());// } }
7,695
public static NotEmpty extract(Any a) { try { return ((NotEmptyHolder) a.extract_Streamable()).value; } catch (ClassCastException ex) { throw new BAD_OPERATION(); } }
public static NotEmpty extract(Any a) { try { return ((NotEmptyHolder) a.extract_Streamable()).value; } catch (ClassCastException ex) { BAD_OPERATION bad = new BAD_OPERATION(); bad.initCause(ex); bad.minor = Minor.Any; throw bad; } }
7,697
public Object addMemberObject (Object obj) { if (obj!=null) { if (memberObjHash.add(obj)) return obj; else return null; } else return null; }
public Object addMemberObject (Object obj) { if (obj!=null) { if (memberObjHash.add(obj)) return obj; else return null; } else return null; }
7,698
public boolean hasMemberObj (Object obj) { if (obj!=null) { if (memberObjHash.contains(obj)) { return true; } else return false; } return false; }
public boolean hasMemberObj (Object obj) { if (obj!=null) { if (memberObjHash.contains(obj)) { return true; } else return false; } return false; }
7,699
public boolean hasMemberObj (Object obj) { if (obj!=null) { if (memberObjHash.contains(obj)) { return true; } else return false; } return false; }
public boolean hasMemberObj (Object obj) { if (obj!=null) { if (memberObjHash.contains(obj)) { return true; } else else return false; } else return false; }
7,700
public Object removeMemberObject (Object obj) { if (obj!=null) { if (memberObjHash.contains(obj)) { memberObjHash.remove(obj); return obj; } else return null; } else return null; }
public Object removeMemberObject (Object obj) { if (obj!=null) { if (memberObjHash.contains(obj)) { memberObjHash.remove(obj); return obj; } else return null; } else return null; }
7,701
public Robot() throws AWTException { throw new Error("not implemented"); }
public Robot() throws AWTException { if (GraphicsEnvironment.isHeadless ()) throw new AWTException ("Robot: headless graphics environment"); SecurityManager sm = System.getSecurityManager (); if (sm != null) sm.checkPermission (new AWTPermission ("createRobot")); ClasspathToolkit tk = (ClasspathToolkit) Toolkit.getDefaultToolkit (); peer = tk.createRobot (GraphicsEnvironment.getLocalGraphicsEnvironment () .getDefaultScreenDevice ()); }
7,702
public BufferedImage createScreenCapture(Rectangle screen) { return null; }
public BufferedImage createScreenCapture (Rectangle screenRect) { return null; }
7,703
public BufferedImage createScreenCapture(Rectangle screen) { return null; }
public BufferedImage createScreenCapture(Rectangle screen) { if (screenRect.width <= 0) throw new IllegalArgumentException ("Robot: capture width is <= 0"); if (screenRect.height <= 0) throw new IllegalArgumentException ("Robot: capture height is <= 0"); SecurityManager sm = System.getSecurityManager (); if (sm != null) sm.checkPermission (new AWTPermission ("readDisplayPixels")); int[] pixels = peer.getRGBPixels (screenRect); BufferedImage bufferedImage = new BufferedImage (screenRect.width, screenRect.height, BufferedImage.TYPE_INT_ARGB); bufferedImage.setRGB (0, 0, screenRect.width, screenRect.height, pixels, 0, screenRect.width); return bufferedImage; }
7,704
public void delay(int ms) { if (ms < 0 || ms > 60000) throw new IllegalArgumentException(); }
public void delay(int ms) { if (ms < 0 || ms > 60000) throw new IllegalArgumentException ("Robot: delay length out-of-bounds"); try { Thread.sleep (ms); } catch (InterruptedException e) { System.err.println ("Robot: delay interrupted"); } }
7,705
public Color getPixelColor(int x, int y) { return null; }
public Color getPixelColor(int x, int y) { return new Color (peer.getRGBPixel (x, y)); }
7,706
public void setAutoDelay(int ms) { if (ms < 0 || ms > 60000) throw new IllegalArgumentException(); autoDelay = ms; }
public void setAutoDelay(int ms) { if (ms < 0 || ms > 60000) throw new IllegalArgumentException(); autoDelay = ms; }
7,713
public void setAutoWaitForIdle(boolean value) { waitForIdle = value; }
public void setAutoWaitForIdle (boolean isOn) { waitForIdle = value; }
7,714
public void setAutoWaitForIdle(boolean value) { waitForIdle = value; }
public void setAutoWaitForIdle(boolean value) { waitForIdle = isOn; }
7,715
public String toString() { return "unimplemented"; }
public String toString() { return getClass ().getName () + "[ autoDelay = " + autoDelay + ", autoWaitForIdle = " + waitForIdle + " ]"; }
7,716
public TypeCode _type() { return t_fixed; }
public TypeCode _type() { return new fixedTypeCode(value); }
7,718
public static Object allocObject(VmType<?> vmClass, int size) throws UninterruptiblePragma { vmClass.link(); // Screen.debug("ao cls{"); // Screen.debug(vmClass.getName()); VmHeapManager hm = heapManager; if (hm == null) { heapManager = hm = Vm.getHeapManager(); } Object result; if (size < 0) { result = hm.newInstance(vmClass); } else { result = hm.newInstance(vmClass, size); } // Screen.debug("}"); return result; }
public static Object allocObject(VmType<?> vmClass, int size) throws UninterruptiblePragma { // Screen.debug("ao cls{"); // Screen.debug(vmClass.getName()); VmHeapManager hm = heapManager; if (hm == null) { heapManager = hm = Vm.getHeapManager(); } Object result; if (size < 0) { result = hm.newInstance(vmClass); } else { result = hm.newInstance(vmClass, size); } // Screen.debug("}"); return result; }
7,719
public static Object allocObject(VmType<?> vmClass, int size) throws UninterruptiblePragma { vmClass.link(); // Screen.debug("ao cls{"); // Screen.debug(vmClass.getName()); VmHeapManager hm = heapManager; if (hm == null) { heapManager = hm = Vm.getHeapManager(); } Object result; if (size < 0) { result = hm.newInstance(vmClass); } else { result = hm.newInstance(vmClass, size); } // Screen.debug("}"); return result; }
public static Object allocObject(VmType<?> vmClass, int size) throws UninterruptiblePragma { vmClass.link(); // Screen.debug("ao cls{"); // Screen.debug(vmClass.getName()); VmHeapManager hm = heapManager; if (hm == null) { heapManager = hm = Vm.getHeapManager(); } final Object result; if (size < 0) { result = hm.newInstance(vmClass); } else { result = hm.newInstance(vmClass, size); } // Screen.debug("}"); return result; }
7,720
public void actionPerformed(ActionEvent e) { if (e.getActionCommand().equals("DONE")) { saveProps(); setVisible(false); } if (e.getActionCommand().equals("ADD")) { Configure.doEntry((JFrame)getParent(),null,props); ctm.addSession(); } if (e.getActionCommand().equals("REMOVE")) { removeEntry(); editButton.setEnabled(false); removeButton.setEnabled(false); } if (e.getActionCommand().equals("EDIT")) { int selectedRow = rowSM.getMinSelectionIndex(); Configure.doEntry((JFrame)getParent(),(String)ctm.getValueAt(selectedRow,0),props); ctm.chgSession(selectedRow); } if (e.getActionCommand().equals("CONNECT")) { int selectedRow = rowSM.getMinSelectionIndex(); connectKey = (String)ctm.getValueAt(selectedRow,0); saveProps(); setVisible(false); } }
public void actionPerformed(ActionEvent e) { if (e.getActionCommand().equals("DONE")) { saveProps(); setVisible(false); } if (e.getActionCommand().equals("ADD")) { Configure.doEntry((JFrame)getParent(),null,props); ctm.addSession(); } if (e.getActionCommand().equals("REMOVE")) { removeEntry(); editButton.setEnabled(false); removeButton.setEnabled(false); } if (e.getActionCommand().equals("EDIT")) { int selectedRow = rowSM.getMinSelectionIndex(); Configure.doEntry((JFrame)getParent(),(String)ctm.getValueAt(selectedRow,0),props); ctm.chgSession(selectedRow); } if (e.getActionCommand().equals("CONNECT")) { int selectedRow = rowSM.getMinSelectionIndex(); connectKey = (String)ctm.getValueAt(selectedRow,0); saveProps(); setVisible(false); } }
7,721
void jbInit() throws Exception { // make it non resizable setResizable(false); this.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); // create some reusable borders and layouts Border etchedBorder = BorderFactory.createEtchedBorder(); BorderLayout borderLayout = new BorderLayout(); // get an instance of our table model ctm = new ConfigureTableModel(); // create a table using our custom table model sessions = new JTable(ctm); sessions.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); sessions.setPreferredScrollableViewportSize(new Dimension(500,200)); sessions.setShowGrid(false); //Create the scroll pane and add the table to it. scrollPane = new JScrollPane(sessions); scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); //Setup our selection model listener rowSM = sessions.getSelectionModel(); rowSM.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { //Ignore extra messages. if (e.getValueIsAdjusting()) return; ListSelectionModel lsm = (ListSelectionModel)e.getSource(); if (lsm.isSelectionEmpty()) { //no rows are selected editButton.setEnabled(false); removeButton.setEnabled(false); connectButton.setEnabled(false); } else { int selectedRow = lsm.getMinSelectionIndex(); //selectedRow is selected editButton.setEnabled(true); removeButton.setEnabled(true); connectButton.setEnabled(true); } } }); //Setup panels configOptions.setLayout(borderLayout); sessionPanel.setLayout(borderLayout); configOptions.add(sessionPanel, BorderLayout.CENTER); sessionOpts.add(scrollPane, BorderLayout.CENTER); sessionPanel.add(sessionOpts, BorderLayout.NORTH); sessionPanel.add(sessionOptPanel, BorderLayout.SOUTH); sessionPanel.setBorder(BorderFactory.createRaisedBevelBorder()); // add the option buttons addOptButton(LangTool.getString("ss.optAdd"),"ADD",sessionOptPanel); removeButton = addOptButton(LangTool.getString("ss.optDelete"), "REMOVE", sessionOptPanel, false); editButton = addOptButton(LangTool.getString("ss.optEdit"), "EDIT", sessionOptPanel, false); connectButton = addOptButton(LangTool.getString("ss.optConnect"),"CONNECT",options,false); addOptButton(LangTool.getString("ss.optCancel"),"DONE",options); // add the panels to our dialog getContentPane().add(sessionPanel,BorderLayout.CENTER); getContentPane().add(options, BorderLayout.SOUTH); // pack it and center it on the screen pack(); Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); Dimension frameSize = getSize(); if (frameSize.height > screenSize.height) frameSize.height = screenSize.height; if (frameSize.width > screenSize.width) frameSize.width = screenSize.width; setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2); // set default selection value as the first row if (sessions.getRowCount() > 0) { sessions.getSelectionModel().setSelectionInterval(0,0); } // now show the world what we and they can do show(); }
void jbInit() throws Exception { // make it non resizable setResizable(true); this.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); // create some reusable borders and layouts Border etchedBorder = BorderFactory.createEtchedBorder(); BorderLayout borderLayout = new BorderLayout(); // get an instance of our table model ctm = new ConfigureTableModel(); // create a table using our custom table model sessions = new JTable(ctm); sessions.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); sessions.setPreferredScrollableViewportSize(new Dimension(500,200)); sessions.setShowGrid(false); //Create the scroll pane and add the table to it. scrollPane = new JScrollPane(sessions); scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); //Setup our selection model listener rowSM = sessions.getSelectionModel(); rowSM.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { //Ignore extra messages. if (e.getValueIsAdjusting()) return; ListSelectionModel lsm = (ListSelectionModel)e.getSource(); if (lsm.isSelectionEmpty()) { //no rows are selected editButton.setEnabled(false); removeButton.setEnabled(false); connectButton.setEnabled(false); } else { int selectedRow = lsm.getMinSelectionIndex(); //selectedRow is selected editButton.setEnabled(true); removeButton.setEnabled(true); connectButton.setEnabled(true); } } }); //Setup panels configOptions.setLayout(borderLayout); sessionPanel.setLayout(borderLayout); configOptions.add(sessionPanel, BorderLayout.CENTER); sessionOpts.add(scrollPane, BorderLayout.CENTER); sessionPanel.add(sessionOpts, BorderLayout.NORTH); sessionPanel.add(sessionOptPanel, BorderLayout.SOUTH); sessionPanel.setBorder(BorderFactory.createRaisedBevelBorder()); // add the option buttons addOptButton(LangTool.getString("ss.optAdd"),"ADD",sessionOptPanel); removeButton = addOptButton(LangTool.getString("ss.optDelete"), "REMOVE", sessionOptPanel, false); editButton = addOptButton(LangTool.getString("ss.optEdit"), "EDIT", sessionOptPanel, false); connectButton = addOptButton(LangTool.getString("ss.optConnect"),"CONNECT",options,false); addOptButton(LangTool.getString("ss.optCancel"),"DONE",options); // add the panels to our dialog getContentPane().add(sessionPanel,BorderLayout.CENTER); getContentPane().add(options, BorderLayout.SOUTH); // pack it and center it on the screen pack(); Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); Dimension frameSize = getSize(); if (frameSize.height > screenSize.height) frameSize.height = screenSize.height; if (frameSize.width > screenSize.width) frameSize.width = screenSize.width; setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2); // set default selection value as the first row if (sessions.getRowCount() > 0) { sessions.getSelectionModel().setSelectionInterval(0,0); } // now show the world what we and they can do show(); }
7,722
void jbInit() throws Exception { // make it non resizable setResizable(false); this.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); // create some reusable borders and layouts Border etchedBorder = BorderFactory.createEtchedBorder(); BorderLayout borderLayout = new BorderLayout(); // get an instance of our table model ctm = new ConfigureTableModel(); // create a table using our custom table model sessions = new JTable(ctm); sessions.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); sessions.setPreferredScrollableViewportSize(new Dimension(500,200)); sessions.setShowGrid(false); //Create the scroll pane and add the table to it. scrollPane = new JScrollPane(sessions); scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); //Setup our selection model listener rowSM = sessions.getSelectionModel(); rowSM.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { //Ignore extra messages. if (e.getValueIsAdjusting()) return; ListSelectionModel lsm = (ListSelectionModel)e.getSource(); if (lsm.isSelectionEmpty()) { //no rows are selected editButton.setEnabled(false); removeButton.setEnabled(false); connectButton.setEnabled(false); } else { int selectedRow = lsm.getMinSelectionIndex(); //selectedRow is selected editButton.setEnabled(true); removeButton.setEnabled(true); connectButton.setEnabled(true); } } }); //Setup panels configOptions.setLayout(borderLayout); sessionPanel.setLayout(borderLayout); configOptions.add(sessionPanel, BorderLayout.CENTER); sessionOpts.add(scrollPane, BorderLayout.CENTER); sessionPanel.add(sessionOpts, BorderLayout.NORTH); sessionPanel.add(sessionOptPanel, BorderLayout.SOUTH); sessionPanel.setBorder(BorderFactory.createRaisedBevelBorder()); // add the option buttons addOptButton(LangTool.getString("ss.optAdd"),"ADD",sessionOptPanel); removeButton = addOptButton(LangTool.getString("ss.optDelete"), "REMOVE", sessionOptPanel, false); editButton = addOptButton(LangTool.getString("ss.optEdit"), "EDIT", sessionOptPanel, false); connectButton = addOptButton(LangTool.getString("ss.optConnect"),"CONNECT",options,false); addOptButton(LangTool.getString("ss.optCancel"),"DONE",options); // add the panels to our dialog getContentPane().add(sessionPanel,BorderLayout.CENTER); getContentPane().add(options, BorderLayout.SOUTH); // pack it and center it on the screen pack(); Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); Dimension frameSize = getSize(); if (frameSize.height > screenSize.height) frameSize.height = screenSize.height; if (frameSize.width > screenSize.width) frameSize.width = screenSize.width; setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2); // set default selection value as the first row if (sessions.getRowCount() > 0) { sessions.getSelectionModel().setSelectionInterval(0,0); } // now show the world what we and they can do show(); }
void jbInit() throws Exception { // make it non resizable setResizable(false); this.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); // create some reusable borders and layouts Border etchedBorder = BorderFactory.createEtchedBorder(); BorderLayout borderLayout = new BorderLayout(); // get an instance of our table model ctm = new ConfigureTableModel(); // create a table using our custom table model sessions = new JTable(ctm); sessions.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); sessions.setPreferredScrollableViewportSize(new Dimension(500,200)); sessions.setShowGrid(false); //Create the scroll pane and add the table to it. scrollPane = new JScrollPane(sessions); scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); //Setup our selection model listener rowSM = sessions.getSelectionModel(); rowSM.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { //Ignore extra messages. if (e.getValueIsAdjusting()) return; ListSelectionModel lsm = (ListSelectionModel)e.getSource(); if (lsm.isSelectionEmpty()) { //no rows are selected editButton.setEnabled(false); removeButton.setEnabled(false); connectButton.setEnabled(false); } else { int selectedRow = lsm.getMinSelectionIndex(); //selectedRow is selected editButton.setEnabled(true); removeButton.setEnabled(true); connectButton.setEnabled(true); } } }); //Setup panels configOptions.setLayout(borderLayout); sessionPanel.setLayout(borderLayout); configOptions.add(sessionPanel, BorderLayout.CENTER); sessionOpts.add(scrollPane, BorderLayout.CENTER); sessionPanel.add(sessionOpts, BorderLayout.NORTH); sessionPanel.add(sessionOptPanel, BorderLayout.SOUTH); sessionPanel.setBorder(BorderFactory.createRaisedBevelBorder()); // add the option buttons addOptButton(LangTool.getString("ss.optAdd"),"ADD",sessionOptPanel); removeButton = addOptButton(LangTool.getString("ss.optDelete"), "REMOVE", sessionOptPanel, false); editButton = addOptButton(LangTool.getString("ss.optEdit"), "EDIT", sessionOptPanel, false); connectButton = addOptButton(LangTool.getString("ss.optConnect"),"CONNECT",options,false); addOptButton(LangTool.getString("ss.optCancel"),"DONE",options); // add the panels to our dialog getContentPane().add(sessionPanel,BorderLayout.CENTER); getContentPane().add(options, BorderLayout.SOUTH); // pack it and center it on the screen pack(); Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); Dimension frameSize = getSize(); if (frameSize.height > screenSize.height) frameSize.height = screenSize.height; if (frameSize.width > screenSize.width) frameSize.width = screenSize.width; setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2); // set default selection value as the first row if (sessions.getRowCount() > 0) { sessions.getSelectionModel().setSelectionInterval(0,0); } // now show the world what we and they can do this.setVisible(true); }
7,723
private static PreferencesFactory getFactory() throws SecurityException { // First check for permission SecurityManager sm = System.getSecurityManager(); if (sm != null) { sm.checkPermission(prefsPermission); } // Get the factory if (factory == null) { // Caller might not have enough permissions factory = (PreferencesFactory) AccessController.doPrivileged( new PrivilegedAction() { public Object run() { PreferencesFactory pf = null; String className = System.getProperty ("java.util.prefs.PreferencesFactory"); if (className != null) { try { Class fc = Class.forName(className); Object o = fc.newInstance(); pf = (PreferencesFactory) o; } catch (ClassNotFoundException cnfe) {/*ignore*/} catch (InstantiationException ie) {/*ignore*/} catch (IllegalAccessException iae) {/*ignore*/} catch (ClassCastException cce) {/*ignore*/} } return pf; } }); // Still no factory? Use our default. if (factory == null) { try { Class cls = Class.forName (defaultFactoryClass); factory = (PreferencesFactory) cls.newInstance(); } catch (Exception e) { throw new RuntimeException ("Couldn't load default factory" + " '"+ defaultFactoryClass +"'"); // XXX - when using 1.4 compatible throwables add cause } } } return factory; }
private static PreferencesFactory getFactory() throws SecurityException { // First check for permission SecurityManager sm = System.getSecurityManager(); if (sm != null) { sm.checkPermission(prefsPermission); } // Get the factory if (factory == null) { // Caller might not have enough permissions factory = (PreferencesFactory) AccessController.doPrivileged( new PrivilegedAction() { public Object run() { PreferencesFactory pf = null; String className = System.getProperty ("java.util.prefs.PreferencesFactory"); if (className != null) { try { Class fc = Class.forName(className); Object o = fc.newInstance(); pf = (PreferencesFactory) o; } catch (ClassNotFoundException cnfe) {/*ignore*/} catch (InstantiationException ie) {/*ignore*/} catch (IllegalAccessException iae) {/*ignore*/} catch (ClassCastException cce) {/*ignore*/} } return pf; } }); // Still no factory? Use our default. if (factory == null) { try { Class cls = Class.forName (defaultFactoryClass); factory = (PreferencesFactory) cls.newInstance(); } catch (Exception e) { throw new RuntimeException ("Couldn't load default factory" + " '"+ defaultFactoryClass +"'", e); // XXX - when using 1.4 compatible throwables add cause } } } return factory; }
7,725
public NodeReader(InputStream is, PreferencesFactory factory) { this(new InputStreamReader(is), factory); }
public NodeReader(InputStream is, PreferencesFactory factory) { this(new InputStreamReader(is), factory); }
7,726
public KeyPair generate() { if (p == null) { BigInteger[] params = new FIPS186(L, rnd).generateParameters(); seed = params[FIPS186.DSA_PARAMS_SEED]; counter = params[FIPS186.DSA_PARAMS_COUNTER]; q = params[FIPS186.DSA_PARAMS_Q]; p = params[FIPS186.DSA_PARAMS_P]; e = params[FIPS186.DSA_PARAMS_E]; g = params[FIPS186.DSA_PARAMS_G]; if (DEBUG && debuglevel > 0) { debug("seed: " + seed.toString(16)); debug("counter: " + counter.intValue()); debug("q: " + q.toString(16)); debug("p: " + p.toString(16)); debug("e: " + e.toString(16)); debug("g: " + g.toString(16)); } } BigInteger x = nextX(); BigInteger y = g.modPow(x, p); PublicKey pubK = new DSSPublicKey(p, q, g, y); PrivateKey secK = new DSSPrivateKey(p, q, g, x); return new KeyPair(pubK, secK); }
public KeyPair generate() { if (p == null) { BigInteger[] params = new FIPS186(L, rnd).generateParameters(); seed = params[FIPS186.DSA_PARAMS_SEED]; counter = params[FIPS186.DSA_PARAMS_COUNTER]; q = params[FIPS186.DSA_PARAMS_Q]; p = params[FIPS186.DSA_PARAMS_P]; e = params[FIPS186.DSA_PARAMS_E]; g = params[FIPS186.DSA_PARAMS_G]; if (DEBUG && debuglevel > 0) { debug("seed: " + seed.toString(16)); debug("counter: " + counter.intValue()); debug("q: " + q.toString(16)); debug("p: " + p.toString(16)); debug("e: " + e.toString(16)); debug("g: " + g.toString(16)); } } BigInteger x = nextX(); BigInteger y = g.modPow(x, p); PublicKey pubK = new DSSPublicKey(p, q, g, y); PrivateKey secK = new DSSPrivateKey(p, q, g, x); return new KeyPair(pubK, secK); }
7,727
public void actionPerformed(ActionEvent event) { JTextComponent t = getTextComponent(event); try { if (t != null) { Caret c = t.getCaret(); int x = c.getMagicCaretPosition().x; int pos = Utilities.getPositionAbove(t, t.getCaretPosition(), x); if (pos > -1) t.moveCaretPosition(pos); } } catch(BadLocationException ble) { // FIXME: Swallowing allowed? } }
public void actionPerformed(ActionEvent event) { JTextComponent t = getTextComponent(event); try { if (t != null) { Caret c = t.getCaret(); Point mcp = c.getMagicCaretPosition(); int x = (mcp != null) ? mcp.x : 0; int pos = Utilities.getPositionAbove(t, t.getCaretPosition(), x); if (pos > -1) t.moveCaretPosition(pos); } } catch(BadLocationException ble) { // FIXME: Swallowing allowed? } }
7,729
public void actionPerformed(ActionEvent event) { JTextComponent t = getTextComponent(event); try { if (t != null) { Caret c = t.getCaret(); int x = c.getMagicCaretPosition().x; int pos = Utilities.getPositionBelow(t, t.getCaretPosition(), x); if (pos > -1) t.moveCaretPosition(pos); } } catch(BadLocationException ble) { // FIXME: Swallowing allowed? } }
public void actionPerformed(ActionEvent event) { JTextComponent t = getTextComponent(event); try { if (t != null) { Caret c = t.getCaret(); Point mcp = c.getMagicCaretPosition(); int x = (mcp != null) ? mcp.x : 0; int pos = Utilities.getPositionBelow(t, t.getCaretPosition(), x); if (pos > -1) t.moveCaretPosition(pos); } } catch(BadLocationException ble) { // FIXME: Swallowing allowed? } }
7,730
public void actionPerformed(ActionEvent event) { JTextComponent t = getTextComponent(event); try { if (t != null) { Caret c = t.getCaret(); int x = c.getMagicCaretPosition().x; int pos = Utilities.getPositionAbove(t, t.getCaretPosition(), x); if (pos > -1) t.setCaretPosition(pos); } } catch(BadLocationException ble) { // FIXME: Swallowing allowed? } }
public void actionPerformed(ActionEvent event) { JTextComponent t = getTextComponent(event); try { if (t != null) { Caret c = t.getCaret(); Point mcp = c.getMagicCaretPosition(); int x = (mcp != null) ? mcp.x : 0; int pos = Utilities.getPositionAbove(t, t.getCaretPosition(), x); if (pos > -1) t.setCaretPosition(pos); } } catch(BadLocationException ble) { // FIXME: Swallowing allowed? } }
7,731
public void actionPerformed(ActionEvent event) { JTextComponent t = getTextComponent(event); try { if (t != null) { Caret c = t.getCaret(); int x = c.getMagicCaretPosition().x; int pos = Utilities.getPositionBelow(t, t.getCaretPosition(), x); if (pos > -1) t.setCaretPosition(pos); } } catch(BadLocationException ble) { // FIXME: Swallowing allowed? } }
public void actionPerformed(ActionEvent event) { JTextComponent t = getTextComponent(event); try { if (t != null) { Caret c = t.getCaret(); Point mcp = c.getMagicCaretPosition(); int x = (mcp != null) ? mcp.x : 0; int pos = Utilities.getPositionBelow(t, t.getCaretPosition(), x); if (pos > -1) t.setCaretPosition(pos); } } catch(BadLocationException ble) { // FIXME: Swallowing allowed? } }
7,732
public void actionPerformed(ActionEvent event) { JTextComponent t = getTextComponent(event); if (t != null) { int offs = t.getCaretPosition() - 1; if(offs > 0) { Caret c = t.getCaret(); c.moveDot(offs); try { c.setMagicCaretPosition(t.modelToView(offs).getLocation()); } catch(BadLocationException ble) { // Can't happen. } } } }
public void actionPerformed(ActionEvent event) { JTextComponent t = getTextComponent(event); if (t != null) { int offs = t.getCaretPosition() - 1; if(offs >= 0) { Caret c = t.getCaret(); c.moveDot(offs); try { c.setMagicCaretPosition(t.modelToView(offs).getLocation()); } catch(BadLocationException ble) { // Can't happen. } } } }
7,733
public void installUI(JComponent c) { super.installUI(c); if (c instanceof JScrollBar) { scrollbar = (JScrollBar) c; trackRect = new Rectangle(); thumbRect = new Rectangle(); scrollTimer = new Timer(200, null); scrollTimer.setRepeats(true); installComponents(); installDefaults(); configureScrollBarColors(); installListeners(); calculatePreferredSize(); } }
public void installUI(JComponent c) { super.installUI(c); if (c instanceof JScrollBar) { scrollbar = (JScrollBar) c; trackRect = new Rectangle(); thumbRect = new Rectangle(); scrollTimer = new Timer(50, null); scrollTimer.setRepeats(true); installComponents(); installDefaults(); configureScrollBarColors(); installListeners(); calculatePreferredSize(); } }
7,734
protected void changeState(int stateflag, boolean b) { int oldstate = stateMask; int newstate; if (b) newstate = oldstate | stateflag; else newstate = oldstate & ~ stateflag; if (oldstate == newstate) return; if ((stateflag != SELECTED) && (stateflag != ENABLED) && (stateMask & ENABLED) == 0) return; stateMask = newstate; fireStateChanged(); if ((oldstate & SELECTED) == 0 && (newstate & SELECTED) == SELECTED) { fireItemStateChanged(new ItemEvent(this, ItemEvent.ITEM_STATE_CHANGED, null, ItemEvent.SELECTED)); if (group != null) group.setSelected(this, true); } else if ((oldstate & SELECTED) == SELECTED && (newstate & SELECTED) == 0) { fireItemStateChanged(new ItemEvent(this, ItemEvent.ITEM_STATE_CHANGED, null, ItemEvent.DESELECTED)); if (group != null) group.setSelected(this, false); } else if (((oldstate & ARMED) == ARMED && (oldstate & PRESSED) == PRESSED) && ((newstate & ARMED) == ARMED && (newstate & PRESSED) == 0)) fireActionPerformed(new ActionEvent(this, ActionEvent.ACTION_PERFORMED, actionCommand)); }
private void changeState(int stateflag, boolean b) { int oldstate = stateMask; int newstate; if (b) newstate = oldstate | stateflag; else newstate = oldstate & ~ stateflag; if (oldstate == newstate) return; if ((stateflag != SELECTED) && (stateflag != ENABLED) && (stateMask & ENABLED) == 0) return; stateMask = newstate; fireStateChanged(); if ((oldstate & SELECTED) == 0 && (newstate & SELECTED) == SELECTED) { fireItemStateChanged(new ItemEvent(this, ItemEvent.ITEM_STATE_CHANGED, null, ItemEvent.SELECTED)); if (group != null) group.setSelected(this, true); } else if ((oldstate & SELECTED) == SELECTED && (newstate & SELECTED) == 0) { fireItemStateChanged(new ItemEvent(this, ItemEvent.ITEM_STATE_CHANGED, null, ItemEvent.DESELECTED)); if (group != null) group.setSelected(this, false); } else if (((oldstate & ARMED) == ARMED && (oldstate & PRESSED) == PRESSED) && ((newstate & ARMED) == ARMED && (newstate & PRESSED) == 0)) fireActionPerformed(new ActionEvent(this, ActionEvent.ACTION_PERFORMED, actionCommand)); }
7,736
public void fireActionPerformed(ActionEvent e) { ActionListener[] ll = getActionListeners(); for (int i = 0; i < ll.length; i++) ll[i].actionPerformed(e); }
protected void fireActionPerformed(ActionEvent e) { ActionListener[] ll = getActionListeners(); for (int i = 0; i < ll.length; i++) ll[i].actionPerformed(e); }
7,737
public void fireItemStateChanged(ItemEvent e) { ItemListener[] ll = getItemListeners(); for (int i = 0; i < ll.length; i++) ll[i].itemStateChanged(e); }
protected void fireItemStateChanged(ItemEvent e) { ItemListener[] ll = getItemListeners(); for (int i = 0; i < ll.length; i++) ll[i].itemStateChanged(e); }
7,738
public void fireStateChanged() { ChangeListener[] ll = getChangeListeners(); for (int i = 0; i < ll.length; i++) ll[i].stateChanged(changeEvent); }
protected void fireStateChanged() { ChangeListener[] ll = getChangeListeners(); for (int i = 0; i < ll.length; i++) ll[i].stateChanged(changeEvent); }
7,739
public BinaryQuad(int address, IRBasicBlock block, int lhsIndex, int varIndex1, int operation, int varIndex2) { super(address, block, lhsIndex); this.operand1 = getOperand(varIndex1); this.operation = operation; this.operand2 = getOperand(varIndex2); refs = new Operand[] { operand1, operand2 }; this.commutative = operation == IADD || operation == IMUL || operation == LADD || operation == LMUL || operation == FADD || operation == FMUL || operation == DADD || operation == DMUL || operation == IAND || operation == LAND || operation == IOR || operation == LOR || operation == IXOR || operation == LXOR; }
public BinaryQuad(int address, IRBasicBlock block, int lhsIndex, int varIndex1, int operation, int varIndex2) { super(address, block, lhsIndex); this.operation = operation; this.operand2 = getOperand(varIndex2); refs = new Operand[] { operand1, operand2 }; this.commutative = operation == IADD || operation == IMUL || operation == LADD || operation == LMUL || operation == FADD || operation == FMUL || operation == DADD || operation == DMUL || operation == IAND || operation == LAND || operation == IOR || operation == LOR || operation == IXOR || operation == LXOR; }
7,740
public BinaryQuad(int address, IRBasicBlock block, int lhsIndex, int varIndex1, int operation, int varIndex2) { super(address, block, lhsIndex); this.operand1 = getOperand(varIndex1); this.operation = operation; this.operand2 = getOperand(varIndex2); refs = new Operand[] { operand1, operand2 }; this.commutative = operation == IADD || operation == IMUL || operation == LADD || operation == LMUL || operation == FADD || operation == FMUL || operation == DADD || operation == DMUL || operation == IAND || operation == LAND || operation == IOR || operation == LOR || operation == IXOR || operation == LXOR; }
public BinaryQuad(int address, IRBasicBlock block, int lhsIndex, int varIndex1, int operation, int varIndex2) { super(address, block, lhsIndex); this.operand1 = getOperand(varIndex1); this.operation = operation; this.operand2 = getOperand(varIndex2); refs = new Operand[] { operand1, operand2 }; this.commutative = operation == IADD || operation == IMUL || operation == LADD || operation == LMUL || operation == FADD || operation == FMUL || operation == DADD || operation == DMUL || operation == IAND || operation == LAND || operation == IOR || operation == LOR || operation == IXOR || operation == LXOR; }
7,741
public void doPass2(BootableHashMap liveVariables) { operand1 = operand1.simplify(); operand2 = operand2.simplify(); if (operand1 instanceof Variable) { Variable v = (Variable) operand1; v.setLastUseAddress(this.getAddress()); liveVariables.put(v, v); } if (operand2 instanceof Variable) { Variable v = (Variable) operand2; v.setLastUseAddress(this.getAddress()); liveVariables.put(v, v); } }
public void doPass2(BootableHashMap liveVariables) { operand1 = operand1.simplify(); operand2 = operand2.simplify(); if (operand1 instanceof Variable) { Variable v = (Variable) operand1; v.setLastUseAddress(this.getAddress()); liveVariables.put(v, v); } if (operand2 instanceof Variable) { Variable v = (Variable) operand2; v.setLastUseAddress(this.getAddress()); liveVariables.put(v, v); } }
7,742
public void doPass2(BootableHashMap liveVariables) { operand1 = operand1.simplify(); operand2 = operand2.simplify(); if (operand1 instanceof Variable) { Variable v = (Variable) operand1; v.setLastUseAddress(this.getAddress()); liveVariables.put(v, v); } if (operand2 instanceof Variable) { Variable v = (Variable) operand2; v.setLastUseAddress(this.getAddress()); liveVariables.put(v, v); } }
public void doPass2(BootableHashMap liveVariables) { operand1 = operand1.simplify(); operand2 = operand2.simplify(); if (operand1 instanceof Variable) { Variable v = (Variable) operand1; v.setLastUseAddress(this.getAddress()); liveVariables.put(v, v); } if (operand2 instanceof Variable) { Variable v = (Variable) operand2; v.setLastUseAddress(this.getAddress()); liveVariables.put(v, v); } }
7,743
public Quad foldConstants() { if (operand1 instanceof Constant && operand2 instanceof Constant) { Constant c1 = (Constant) operand1; Constant c2 = (Constant) operand2; switch (operation) { case IADD: return new ConstantRefAssignQuad(this.getAddress(), this.getBasicBlock(), this.getLHS().getIndex(), c1.iAdd(c2)); case ISUB: return new ConstantRefAssignQuad(this.getAddress(), this.getBasicBlock(), this.getLHS().getIndex(), c1.iSub(c2)); case IMUL: return new ConstantRefAssignQuad(this.getAddress(), this.getBasicBlock(), this.getLHS().getIndex(), c1.iMul(c2)); case IDIV: return new ConstantRefAssignQuad(this.getAddress(), this.getBasicBlock(), this.getLHS().getIndex(), c1.iDiv(c2)); case IREM: return new ConstantRefAssignQuad(this.getAddress(), this.getBasicBlock(), this.getLHS().getIndex(), c1.iRem(c2)); case IAND: return new ConstantRefAssignQuad(this.getAddress(), this.getBasicBlock(), this.getLHS().getIndex(), c1.iAnd(c2)); case IOR: return new ConstantRefAssignQuad(this.getAddress(), this.getBasicBlock(), this.getLHS().getIndex(), c1.iOr(c2)); case IXOR: return new ConstantRefAssignQuad(this.getAddress(), this.getBasicBlock(), this.getLHS().getIndex(), c1.iXor(c2)); case ISHL: return new ConstantRefAssignQuad(this.getAddress(), this.getBasicBlock(), this.getLHS().getIndex(), c1.iShl(c2)); case ISHR: return new ConstantRefAssignQuad(this.getAddress(), this.getBasicBlock(), this.getLHS().getIndex(), c1.iShr(c2)); case IUSHR: return new ConstantRefAssignQuad(this.getAddress(), this.getBasicBlock(), this.getLHS().getIndex(), c1.iUshr(c2)); case LADD: return new ConstantRefAssignQuad(this.getAddress(), this.getBasicBlock(), this.getLHS().getIndex(), c1.lAdd(c2)); case LSUB: return new ConstantRefAssignQuad(this.getAddress(), this.getBasicBlock(), this.getLHS().getIndex(), c1.lSub(c2)); case LMUL: return new ConstantRefAssignQuad(this.getAddress(), this.getBasicBlock(), this.getLHS().getIndex(), c1.lMul(c2)); case LDIV: return new ConstantRefAssignQuad(this.getAddress(), this.getBasicBlock(), this.getLHS().getIndex(), c1.lDiv(c2)); case LREM: return new ConstantRefAssignQuad(this.getAddress(), this.getBasicBlock(), this.getLHS().getIndex(), c1.lRem(c2)); case LAND: return new ConstantRefAssignQuad(this.getAddress(), this.getBasicBlock(), this.getLHS().getIndex(), c1.lAnd(c2)); case LOR: return new ConstantRefAssignQuad(this.getAddress(), this.getBasicBlock(), this.getLHS().getIndex(), c1.lOr(c2)); case LXOR: return new ConstantRefAssignQuad(this.getAddress(), this.getBasicBlock(), this.getLHS().getIndex(), c1.lXor(c2)); case LSHL: return new ConstantRefAssignQuad(this.getAddress(), this.getBasicBlock(), this.getLHS().getIndex(), c1.lShl(c2)); case LSHR: return new ConstantRefAssignQuad(this.getAddress(), this.getBasicBlock(), this.getLHS().getIndex(), c1.lShr(c2)); case LUSHR: return new ConstantRefAssignQuad(this.getAddress(), this.getBasicBlock(), this.getLHS().getIndex(), c1.lUshr(c2)); case FADD: return new ConstantRefAssignQuad(this.getAddress(), this.getBasicBlock(), this.getLHS().getIndex(), c1.fAdd(c2)); case FSUB: return new ConstantRefAssignQuad(this.getAddress(), this.getBasicBlock(), this.getLHS().getIndex(), c1.fSub(c2)); case FMUL: return new ConstantRefAssignQuad(this.getAddress(), this.getBasicBlock(), this.getLHS().getIndex(), c1.fMul(c2)); case FDIV: return new ConstantRefAssignQuad(this.getAddress(), this.getBasicBlock(), this.getLHS().getIndex(), c1.fDiv(c2)); case FREM: return new ConstantRefAssignQuad(this.getAddress(), this.getBasicBlock(), this.getLHS().getIndex(), c1.fRem(c2)); case DADD: return new ConstantRefAssignQuad(this.getAddress(), this.getBasicBlock(), this.getLHS().getIndex(), c1.dAdd(c2)); case DSUB: return new ConstantRefAssignQuad(this.getAddress(), this.getBasicBlock(), this.getLHS().getIndex(), c1.dSub(c2)); case DMUL: return new ConstantRefAssignQuad(this.getAddress(), this.getBasicBlock(), this.getLHS().getIndex(), c1.dMul(c2)); case DDIV: return new ConstantRefAssignQuad(this.getAddress(), this.getBasicBlock(), this.getLHS().getIndex(), c1.dDiv(c2)); case DREM: return new ConstantRefAssignQuad(this.getAddress(), this.getBasicBlock(), this.getLHS().getIndex(), c1.dRem(c2)); default: throw new IllegalArgumentException("Don't know how to fold those yet..."); } } return this; }
public Quad foldConstants() { if (operand1 instanceof Constant && operand2 instanceof Constant) { Constant c1 = (Constant) operand1; Constant c2 = (Constant) operand2; switch (operation) { case IADD: return new ConstantRefAssignQuad(this.getAddress(), this.getBasicBlock(), this.getLHS().getIndex(), c1.iAdd(c2)); case ISUB: return new ConstantRefAssignQuad(this.getAddress(), this.getBasicBlock(), this.getLHS().getIndex(), c1.iSub(c2)); case IMUL: return new ConstantRefAssignQuad(this.getAddress(), this.getBasicBlock(), this.getLHS().getIndex(), c1.iMul(c2)); case IDIV: return new ConstantRefAssignQuad(this.getAddress(), this.getBasicBlock(), this.getLHS().getIndex(), c1.iDiv(c2)); case IREM: return new ConstantRefAssignQuad(this.getAddress(), this.getBasicBlock(), this.getLHS().getIndex(), c1.iRem(c2)); case IAND: return new ConstantRefAssignQuad(this.getAddress(), this.getBasicBlock(), this.getLHS().getIndex(), c1.iAnd(c2)); case IOR: return new ConstantRefAssignQuad(this.getAddress(), this.getBasicBlock(), this.getLHS().getIndex(), c1.iOr(c2)); case IXOR: return new ConstantRefAssignQuad(this.getAddress(), this.getBasicBlock(), this.getLHS().getIndex(), c1.iXor(c2)); case ISHL: return new ConstantRefAssignQuad(this.getAddress(), this.getBasicBlock(), this.getLHS().getIndex(), c1.iShl(c2)); case ISHR: return new ConstantRefAssignQuad(this.getAddress(), this.getBasicBlock(), this.getLHS().getIndex(), c1.iShr(c2)); case IUSHR: return new ConstantRefAssignQuad(this.getAddress(), this.getBasicBlock(), this.getLHS().getIndex(), c1.iUshr(c2)); case LADD: return new ConstantRefAssignQuad(this.getAddress(), this.getBasicBlock(), this.getLHS().getIndex(), c1.lAdd(c2)); case LSUB: return new ConstantRefAssignQuad(this.getAddress(), this.getBasicBlock(), this.getLHS().getIndex(), c1.lSub(c2)); case LMUL: return new ConstantRefAssignQuad(this.getAddress(), this.getBasicBlock(), this.getLHS().getIndex(), c1.lMul(c2)); case LDIV: return new ConstantRefAssignQuad(this.getAddress(), this.getBasicBlock(), this.getLHS().getIndex(), c1.lDiv(c2)); case LREM: return new ConstantRefAssignQuad(this.getAddress(), this.getBasicBlock(), this.getLHS().getIndex(), c1.lRem(c2)); case LAND: return new ConstantRefAssignQuad(this.getAddress(), this.getBasicBlock(), this.getLHS().getIndex(), c1.lAnd(c2)); case LOR: return new ConstantRefAssignQuad(this.getAddress(), this.getBasicBlock(), this.getLHS().getIndex(), c1.lOr(c2)); case LXOR: return new ConstantRefAssignQuad(this.getAddress(), this.getBasicBlock(), this.getLHS().getIndex(), c1.lXor(c2)); case LSHL: return new ConstantRefAssignQuad(this.getAddress(), this.getBasicBlock(), this.getLHS().getIndex(), c1.lShl(c2)); case LSHR: return new ConstantRefAssignQuad(this.getAddress(), this.getBasicBlock(), this.getLHS().getIndex(), c1.lShr(c2)); case LUSHR: return new ConstantRefAssignQuad(this.getAddress(), this.getBasicBlock(), this.getLHS().getIndex(), c1.lUshr(c2)); case FADD: return new ConstantRefAssignQuad(this.getAddress(), this.getBasicBlock(), this.getLHS().getIndex(), c1.fAdd(c2)); case FSUB: return new ConstantRefAssignQuad(this.getAddress(), this.getBasicBlock(), this.getLHS().getIndex(), c1.fSub(c2)); case FMUL: return new ConstantRefAssignQuad(this.getAddress(), this.getBasicBlock(), this.getLHS().getIndex(), c1.fMul(c2)); case FDIV: return new ConstantRefAssignQuad(this.getAddress(), this.getBasicBlock(), this.getLHS().getIndex(), c1.fDiv(c2)); case FREM: return new ConstantRefAssignQuad(this.getAddress(), this.getBasicBlock(), this.getLHS().getIndex(), c1.fRem(c2)); case DADD: return new ConstantRefAssignQuad(this.getAddress(), this.getBasicBlock(), this.getLHS().getIndex(), c1.dAdd(c2)); case DSUB: return new ConstantRefAssignQuad(this.getAddress(), this.getBasicBlock(), this.getLHS().getIndex(), c1.dSub(c2)); case DMUL: return new ConstantRefAssignQuad(this.getAddress(), this.getBasicBlock(), this.getLHS().getIndex(), c1.dMul(c2)); case DDIV: return new ConstantRefAssignQuad(this.getAddress(), this.getBasicBlock(), this.getLHS().getIndex(), c1.dDiv(c2)); case DREM: return new ConstantRefAssignQuad(this.getAddress(), this.getBasicBlock(), this.getLHS().getIndex(), c1.dRem(c2)); default: throw new IllegalArgumentException("Don't know how to fold those yet..."); } } return this; }
7,744
public void generateCode(CodeGenerator cg) { cg.checkLabel(getAddress()); Variable lhs = getLHS(); int lhsMode = lhs.getAddressingMode(); int op1Mode = operand1.getAddressingMode(); int op2Mode = operand2.getAddressingMode(); Object reg1 = null; if (lhsMode == Operand.MODE_REGISTER) { RegisterLocation regLoc = (RegisterLocation) lhs.getLocation(); reg1 = regLoc.getRegister(); } Object reg2 = null; if (op1Mode == Operand.MODE_REGISTER) { Variable var = (Variable) operand1; RegisterLocation regLoc = (RegisterLocation) var.getLocation(); reg2 = regLoc.getRegister(); } Object reg3 = null; if (op2Mode == Operand.MODE_REGISTER) { Variable var = (Variable) operand2; RegisterLocation regLoc = (RegisterLocation) var.getLocation(); reg3 = regLoc.getRegister(); } int disp1 = 0; if (lhsMode == Operand.MODE_STACK) { StackLocation stackLoc = (StackLocation) lhs.getLocation(); disp1 = stackLoc.getDisplacement(); } int disp2 = 0; if (op1Mode == Operand.MODE_STACK) { Variable var = (Variable) operand1; StackLocation stackLoc = (StackLocation) var.getLocation(); disp2 = stackLoc.getDisplacement(); } int disp3 = 0; if (op2Mode == Operand.MODE_STACK) { Variable var = (Variable) operand2; StackLocation stackLoc = (StackLocation) var.getLocation(); disp3 = stackLoc.getDisplacement(); } Constant c2 = null; if (op1Mode == Operand.MODE_CONSTANT) { c2 = (Constant) operand1; } Constant c3 = null; if (op2Mode == Operand.MODE_CONSTANT) { c3 = (Constant) operand2; } int aMode = (lhsMode << 16) | (op1Mode << 8) | op2Mode; switch (aMode) { case MODE_RCC: cg.generateBinaryOP(reg1, c2, operation, c3); break; case MODE_RCR: if (reg1 == reg3 && commutative && !cg.supports3AddrOps()) { cg.generateBinaryOP(reg1, reg3, operation, c2); } else { cg.generateBinaryOP(reg1, c2, operation, reg3); } break; case MODE_RCS: cg.generateBinaryOP(reg1, c2, operation, disp3); break; case MODE_RRC: cg.generateBinaryOP(reg1, reg2, operation, c3); break; case MODE_RRR: if (reg1 == reg3 && commutative && !cg.supports3AddrOps()) { cg.generateBinaryOP(reg1, reg3, operation, reg2); } else { cg.generateBinaryOP(reg1, reg2, operation, reg3); } break; case MODE_RRS: cg.generateBinaryOP(reg1, reg2, operation, disp3); break; case MODE_RSC: cg.generateBinaryOP(reg1, disp2, operation, c3); break; case MODE_RSR: if (reg1 == reg3 && commutative && !cg.supports3AddrOps()) { cg.generateBinaryOP(reg1, reg3, operation, disp2); } else { cg.generateBinaryOP(reg1, disp2, operation, reg3); } break; case MODE_RSS: cg.generateBinaryOP(reg1, disp2, operation, disp3); break; case MODE_SCC: cg.generateBinaryOP(disp1, c2, operation, c3); break; case MODE_SCR: cg.generateBinaryOP(disp1, c2, operation, reg3); break; case MODE_SCS: if (disp1 == disp3 && commutative && !cg.supports3AddrOps()) { cg.generateBinaryOP(disp1, disp3, operation, c2); } else { cg.generateBinaryOP(disp1, c2, operation, disp3); } break; case MODE_SRC: cg.generateBinaryOP(disp1, reg2, operation, c3); break; case MODE_SRR: cg.generateBinaryOP(disp1, reg2, operation, reg3); break; case MODE_SRS: if (disp1 == disp3 && commutative && !cg.supports3AddrOps()) { cg.generateBinaryOP(disp1, disp3, operation, reg2); } else { cg.generateBinaryOP(disp1, reg2, operation, disp3); } break; case MODE_SSC: cg.generateBinaryOP(disp1, disp2, operation, c3); break; case MODE_SSR: cg.generateBinaryOP(disp1, disp2, operation, reg3); break; case MODE_SSS: if (disp1 == disp3 && commutative && !cg.supports3AddrOps()) { cg.generateBinaryOP(disp1, disp3, operation, disp2); } else { cg.generateBinaryOP(disp1, disp2, operation, disp3); } break; default: throw new IllegalArgumentException("Undefined addressing mode: " + aMode); } }
public void generateCode(CodeGenerator cg) { cg.checkLabel(getAddress()); Variable lhs = getLHS(); int lhsMode = lhs.getAddressingMode(); int op1Mode = operand1.getAddressingMode(); int op2Mode = operand2.getAddressingMode(); Object reg1 = null; if (lhsMode == Operand.MODE_REGISTER) { RegisterLocation regLoc = (RegisterLocation) lhs.getLocation(); reg1 = regLoc.getRegister(); } Object reg2 = null; if (op1Mode == Operand.MODE_REGISTER) { Variable var = (Variable) operand1; RegisterLocation regLoc = (RegisterLocation) var.getLocation(); reg2 = regLoc.getRegister(); } Object reg3 = null; if (op2Mode == Operand.MODE_REGISTER) { Variable var = (Variable) operand2; RegisterLocation regLoc = (RegisterLocation) var.getLocation(); reg3 = regLoc.getRegister(); } int disp1 = 0; if (lhsMode == Operand.MODE_STACK) { StackLocation stackLoc = (StackLocation) lhs.getLocation(); disp1 = stackLoc.getDisplacement(); } int disp2 = 0; if (op1Mode == Operand.MODE_STACK) { Variable var = (Variable) operand1; StackLocation stackLoc = (StackLocation) var.getLocation(); disp2 = stackLoc.getDisplacement(); } int disp3 = 0; if (op2Mode == Operand.MODE_STACK) { Variable var = (Variable) operand2; StackLocation stackLoc = (StackLocation) var.getLocation(); disp3 = stackLoc.getDisplacement(); } Constant c2 = null; if (op1Mode == Operand.MODE_CONSTANT) { c2 = (Constant) operand1; } Constant c3 = null; if (op2Mode == Operand.MODE_CONSTANT) { c3 = (Constant) operand2; } int aMode = (lhsMode << 16) | (op1Mode << 8) | op2Mode; switch (aMode) { case MODE_RCC: cg.generateBinaryOP(reg1, c2, operation, c3); break; case MODE_RCR: if (reg1 == reg3 && commutative && !cg.supports3AddrOps()) { cg.generateBinaryOP(reg1, reg3, operation, c2); } else { cg.generateBinaryOP(reg1, c2, operation, reg3); } break; case MODE_RCS: cg.generateBinaryOP(reg1, c2, operation, disp3); break; case MODE_RRC: cg.generateBinaryOP(reg1, reg2, operation, c3); break; case MODE_RRR: if (reg1 == reg3 && commutative && !cg.supports3AddrOps()) { cg.generateBinaryOP(reg1, reg3, operation, reg2); } else { cg.generateBinaryOP(reg1, reg2, operation, reg3); } break; case MODE_RRS: cg.generateBinaryOP(reg1, reg2, operation, disp3); break; case MODE_RSC: cg.generateBinaryOP(reg1, disp2, operation, c3); break; case MODE_RSR: if (reg1 == reg3 && commutative && !cg.supports3AddrOps()) { cg.generateBinaryOP(reg1, reg3, operation, disp2); } else { cg.generateBinaryOP(reg1, disp2, operation, reg3); } break; case MODE_RSS: cg.generateBinaryOP(reg1, disp2, operation, disp3); break; case MODE_SCC: cg.generateBinaryOP(disp1, c2, operation, c3); break; case MODE_SCR: cg.generateBinaryOP(disp1, c2, operation, reg3); break; case MODE_SCS: if (disp1 == disp3 && commutative && !cg.supports3AddrOps()) { cg.generateBinaryOP(disp1, disp3, operation, c2); } else { cg.generateBinaryOP(disp1, c2, operation, disp3); } break; case MODE_SRC: cg.generateBinaryOP(disp1, reg2, operation, c3); break; case MODE_SRR: cg.generateBinaryOP(disp1, reg2, operation, reg3); break; case MODE_SRS: if (disp1 == disp3 && commutative && !cg.supports3AddrOps()) { cg.generateBinaryOP(disp1, disp3, operation, reg2); } else { cg.generateBinaryOP(disp1, reg2, operation, disp3); } break; case MODE_SSC: cg.generateBinaryOP(disp1, disp2, operation, c3); break; case MODE_SSR: cg.generateBinaryOP(disp1, disp2, operation, reg3); break; case MODE_SSS: if (disp1 == disp3 && commutative && !cg.supports3AddrOps()) { cg.generateBinaryOP(disp1, disp3, operation, disp2); } else { cg.generateBinaryOP(disp1, disp2, operation, disp3); } break; default: throw new IllegalArgumentException("Undefined addressing mode: " + aMode); } }
7,745
public void generateCode(CodeGenerator cg) { cg.checkLabel(getAddress()); Variable lhs = getLHS(); int lhsMode = lhs.getAddressingMode(); int op1Mode = operand1.getAddressingMode(); int op2Mode = operand2.getAddressingMode(); Object reg1 = null; if (lhsMode == Operand.MODE_REGISTER) { RegisterLocation regLoc = (RegisterLocation) lhs.getLocation(); reg1 = regLoc.getRegister(); } Object reg2 = null; if (op1Mode == Operand.MODE_REGISTER) { Variable var = (Variable) operand1; RegisterLocation regLoc = (RegisterLocation) var.getLocation(); reg2 = regLoc.getRegister(); } Object reg3 = null; if (op2Mode == Operand.MODE_REGISTER) { Variable var = (Variable) operand2; RegisterLocation regLoc = (RegisterLocation) var.getLocation(); reg3 = regLoc.getRegister(); } int disp1 = 0; if (lhsMode == Operand.MODE_STACK) { StackLocation stackLoc = (StackLocation) lhs.getLocation(); disp1 = stackLoc.getDisplacement(); } int disp2 = 0; if (op1Mode == Operand.MODE_STACK) { Variable var = (Variable) operand1; StackLocation stackLoc = (StackLocation) var.getLocation(); disp2 = stackLoc.getDisplacement(); } int disp3 = 0; if (op2Mode == Operand.MODE_STACK) { Variable var = (Variable) operand2; StackLocation stackLoc = (StackLocation) var.getLocation(); disp3 = stackLoc.getDisplacement(); } Constant c2 = null; if (op1Mode == Operand.MODE_CONSTANT) { c2 = (Constant) operand1; } Constant c3 = null; if (op2Mode == Operand.MODE_CONSTANT) { c3 = (Constant) operand2; } int aMode = (lhsMode << 16) | (op1Mode << 8) | op2Mode; switch (aMode) { case MODE_RCC: cg.generateBinaryOP(reg1, c2, operation, c3); break; case MODE_RCR: if (reg1 == reg3 && commutative && !cg.supports3AddrOps()) { cg.generateBinaryOP(reg1, reg3, operation, c2); } else { cg.generateBinaryOP(reg1, c2, operation, reg3); } break; case MODE_RCS: cg.generateBinaryOP(reg1, c2, operation, disp3); break; case MODE_RRC: cg.generateBinaryOP(reg1, reg2, operation, c3); break; case MODE_RRR: if (reg1 == reg3 && commutative && !cg.supports3AddrOps()) { cg.generateBinaryOP(reg1, reg3, operation, reg2); } else { cg.generateBinaryOP(reg1, reg2, operation, reg3); } break; case MODE_RRS: cg.generateBinaryOP(reg1, reg2, operation, disp3); break; case MODE_RSC: cg.generateBinaryOP(reg1, disp2, operation, c3); break; case MODE_RSR: if (reg1 == reg3 && commutative && !cg.supports3AddrOps()) { cg.generateBinaryOP(reg1, reg3, operation, disp2); } else { cg.generateBinaryOP(reg1, disp2, operation, reg3); } break; case MODE_RSS: cg.generateBinaryOP(reg1, disp2, operation, disp3); break; case MODE_SCC: cg.generateBinaryOP(disp1, c2, operation, c3); break; case MODE_SCR: cg.generateBinaryOP(disp1, c2, operation, reg3); break; case MODE_SCS: if (disp1 == disp3 && commutative && !cg.supports3AddrOps()) { cg.generateBinaryOP(disp1, disp3, operation, c2); } else { cg.generateBinaryOP(disp1, c2, operation, disp3); } break; case MODE_SRC: cg.generateBinaryOP(disp1, reg2, operation, c3); break; case MODE_SRR: cg.generateBinaryOP(disp1, reg2, operation, reg3); break; case MODE_SRS: if (disp1 == disp3 && commutative && !cg.supports3AddrOps()) { cg.generateBinaryOP(disp1, disp3, operation, reg2); } else { cg.generateBinaryOP(disp1, reg2, operation, disp3); } break; case MODE_SSC: cg.generateBinaryOP(disp1, disp2, operation, c3); break; case MODE_SSR: cg.generateBinaryOP(disp1, disp2, operation, reg3); break; case MODE_SSS: if (disp1 == disp3 && commutative && !cg.supports3AddrOps()) { cg.generateBinaryOP(disp1, disp3, operation, disp2); } else { cg.generateBinaryOP(disp1, disp2, operation, disp3); } break; default: throw new IllegalArgumentException("Undefined addressing mode: " + aMode); } }
public void generateCode(CodeGenerator cg) { cg.checkLabel(getAddress()); Variable lhs = getLHS(); int lhsMode = lhs.getAddressingMode(); int op1Mode = operand1.getAddressingMode(); int op2Mode = operand2.getAddressingMode(); Object reg1 = null; if (lhsMode == Operand.MODE_REGISTER) { RegisterLocation regLoc = (RegisterLocation) lhs.getLocation(); reg1 = regLoc.getRegister(); } Object reg2 = null; if (op1Mode == Operand.MODE_REGISTER) { Variable var = (Variable) refs[0]; RegisterLocation regLoc = (RegisterLocation) var.getLocation(); reg2 = regLoc.getRegister(); } Object reg3 = null; if (op2Mode == Operand.MODE_REGISTER) { Variable var = (Variable) operand2; RegisterLocation regLoc = (RegisterLocation) var.getLocation(); reg3 = regLoc.getRegister(); } int disp1 = 0; if (lhsMode == Operand.MODE_STACK) { StackLocation stackLoc = (StackLocation) lhs.getLocation(); disp1 = stackLoc.getDisplacement(); } int disp2 = 0; if (op1Mode == Operand.MODE_STACK) { Variable var = (Variable) refs[0]; StackLocation stackLoc = (StackLocation) var.getLocation(); disp2 = stackLoc.getDisplacement(); } int disp3 = 0; if (op2Mode == Operand.MODE_STACK) { Variable var = (Variable) operand2; StackLocation stackLoc = (StackLocation) var.getLocation(); disp3 = stackLoc.getDisplacement(); } Constant c2 = null; if (op1Mode == Operand.MODE_CONSTANT) { c2 = (Constant) operand1; } Constant c3 = null; if (op2Mode == Operand.MODE_CONSTANT) { c3 = (Constant) operand2; } int aMode = (lhsMode << 16) | (op1Mode << 8) | op2Mode; switch (aMode) { case MODE_RCC: cg.generateBinaryOP(reg1, c2, operation, c3); break; case MODE_RCR: if (reg1 == reg3 && commutative && !cg.supports3AddrOps()) { cg.generateBinaryOP(reg1, reg3, operation, c2); } else { cg.generateBinaryOP(reg1, c2, operation, reg3); } break; case MODE_RCS: cg.generateBinaryOP(reg1, c2, operation, disp3); break; case MODE_RRC: cg.generateBinaryOP(reg1, reg2, operation, c3); break; case MODE_RRR: if (reg1 == reg3 && commutative && !cg.supports3AddrOps()) { cg.generateBinaryOP(reg1, reg3, operation, reg2); } else { cg.generateBinaryOP(reg1, reg2, operation, reg3); } break; case MODE_RRS: cg.generateBinaryOP(reg1, reg2, operation, disp3); break; case MODE_RSC: cg.generateBinaryOP(reg1, disp2, operation, c3); break; case MODE_RSR: if (reg1 == reg3 && commutative && !cg.supports3AddrOps()) { cg.generateBinaryOP(reg1, reg3, operation, disp2); } else { cg.generateBinaryOP(reg1, disp2, operation, reg3); } break; case MODE_RSS: cg.generateBinaryOP(reg1, disp2, operation, disp3); break; case MODE_SCC: cg.generateBinaryOP(disp1, c2, operation, c3); break; case MODE_SCR: cg.generateBinaryOP(disp1, c2, operation, reg3); break; case MODE_SCS: if (disp1 == disp3 && commutative && !cg.supports3AddrOps()) { cg.generateBinaryOP(disp1, disp3, operation, c2); } else { cg.generateBinaryOP(disp1, c2, operation, disp3); } break; case MODE_SRC: cg.generateBinaryOP(disp1, reg2, operation, c3); break; case MODE_SRR: cg.generateBinaryOP(disp1, reg2, operation, reg3); break; case MODE_SRS: if (disp1 == disp3 && commutative && !cg.supports3AddrOps()) { cg.generateBinaryOP(disp1, disp3, operation, reg2); } else { cg.generateBinaryOP(disp1, reg2, operation, disp3); } break; case MODE_SSC: cg.generateBinaryOP(disp1, disp2, operation, c3); break; case MODE_SSR: cg.generateBinaryOP(disp1, disp2, operation, reg3); break; case MODE_SSS: if (disp1 == disp3 && commutative && !cg.supports3AddrOps()) { cg.generateBinaryOP(disp1, disp3, operation, disp2); } else { cg.generateBinaryOP(disp1, disp2, operation, disp3); } break; default: throw new IllegalArgumentException("Undefined addressing mode: " + aMode); } }
7,746
public void generateCode(CodeGenerator cg) { cg.checkLabel(getAddress()); Variable lhs = getLHS(); int lhsMode = lhs.getAddressingMode(); int op1Mode = operand1.getAddressingMode(); int op2Mode = operand2.getAddressingMode(); Object reg1 = null; if (lhsMode == Operand.MODE_REGISTER) { RegisterLocation regLoc = (RegisterLocation) lhs.getLocation(); reg1 = regLoc.getRegister(); } Object reg2 = null; if (op1Mode == Operand.MODE_REGISTER) { Variable var = (Variable) operand1; RegisterLocation regLoc = (RegisterLocation) var.getLocation(); reg2 = regLoc.getRegister(); } Object reg3 = null; if (op2Mode == Operand.MODE_REGISTER) { Variable var = (Variable) operand2; RegisterLocation regLoc = (RegisterLocation) var.getLocation(); reg3 = regLoc.getRegister(); } int disp1 = 0; if (lhsMode == Operand.MODE_STACK) { StackLocation stackLoc = (StackLocation) lhs.getLocation(); disp1 = stackLoc.getDisplacement(); } int disp2 = 0; if (op1Mode == Operand.MODE_STACK) { Variable var = (Variable) operand1; StackLocation stackLoc = (StackLocation) var.getLocation(); disp2 = stackLoc.getDisplacement(); } int disp3 = 0; if (op2Mode == Operand.MODE_STACK) { Variable var = (Variable) operand2; StackLocation stackLoc = (StackLocation) var.getLocation(); disp3 = stackLoc.getDisplacement(); } Constant c2 = null; if (op1Mode == Operand.MODE_CONSTANT) { c2 = (Constant) operand1; } Constant c3 = null; if (op2Mode == Operand.MODE_CONSTANT) { c3 = (Constant) operand2; } int aMode = (lhsMode << 16) | (op1Mode << 8) | op2Mode; switch (aMode) { case MODE_RCC: cg.generateBinaryOP(reg1, c2, operation, c3); break; case MODE_RCR: if (reg1 == reg3 && commutative && !cg.supports3AddrOps()) { cg.generateBinaryOP(reg1, reg3, operation, c2); } else { cg.generateBinaryOP(reg1, c2, operation, reg3); } break; case MODE_RCS: cg.generateBinaryOP(reg1, c2, operation, disp3); break; case MODE_RRC: cg.generateBinaryOP(reg1, reg2, operation, c3); break; case MODE_RRR: if (reg1 == reg3 && commutative && !cg.supports3AddrOps()) { cg.generateBinaryOP(reg1, reg3, operation, reg2); } else { cg.generateBinaryOP(reg1, reg2, operation, reg3); } break; case MODE_RRS: cg.generateBinaryOP(reg1, reg2, operation, disp3); break; case MODE_RSC: cg.generateBinaryOP(reg1, disp2, operation, c3); break; case MODE_RSR: if (reg1 == reg3 && commutative && !cg.supports3AddrOps()) { cg.generateBinaryOP(reg1, reg3, operation, disp2); } else { cg.generateBinaryOP(reg1, disp2, operation, reg3); } break; case MODE_RSS: cg.generateBinaryOP(reg1, disp2, operation, disp3); break; case MODE_SCC: cg.generateBinaryOP(disp1, c2, operation, c3); break; case MODE_SCR: cg.generateBinaryOP(disp1, c2, operation, reg3); break; case MODE_SCS: if (disp1 == disp3 && commutative && !cg.supports3AddrOps()) { cg.generateBinaryOP(disp1, disp3, operation, c2); } else { cg.generateBinaryOP(disp1, c2, operation, disp3); } break; case MODE_SRC: cg.generateBinaryOP(disp1, reg2, operation, c3); break; case MODE_SRR: cg.generateBinaryOP(disp1, reg2, operation, reg3); break; case MODE_SRS: if (disp1 == disp3 && commutative && !cg.supports3AddrOps()) { cg.generateBinaryOP(disp1, disp3, operation, reg2); } else { cg.generateBinaryOP(disp1, reg2, operation, disp3); } break; case MODE_SSC: cg.generateBinaryOP(disp1, disp2, operation, c3); break; case MODE_SSR: cg.generateBinaryOP(disp1, disp2, operation, reg3); break; case MODE_SSS: if (disp1 == disp3 && commutative && !cg.supports3AddrOps()) { cg.generateBinaryOP(disp1, disp3, operation, disp2); } else { cg.generateBinaryOP(disp1, disp2, operation, disp3); } break; default: throw new IllegalArgumentException("Undefined addressing mode: " + aMode); } }
public void generateCode(CodeGenerator cg) { cg.checkLabel(getAddress()); Variable lhs = getLHS(); int lhsMode = lhs.getAddressingMode(); int op1Mode = operand1.getAddressingMode(); int op2Mode = operand2.getAddressingMode(); Object reg1 = null; if (lhsMode == Operand.MODE_REGISTER) { RegisterLocation regLoc = (RegisterLocation) lhs.getLocation(); reg1 = regLoc.getRegister(); } Object reg2 = null; if (op1Mode == Operand.MODE_REGISTER) { Variable var = (Variable) operand1; RegisterLocation regLoc = (RegisterLocation) var.getLocation(); reg2 = regLoc.getRegister(); } Object reg3 = null; if (op2Mode == Operand.MODE_REGISTER) { Variable var = (Variable) refs[1]; RegisterLocation regLoc = (RegisterLocation) var.getLocation(); reg3 = regLoc.getRegister(); } int disp1 = 0; if (lhsMode == Operand.MODE_STACK) { StackLocation stackLoc = (StackLocation) lhs.getLocation(); disp1 = stackLoc.getDisplacement(); } int disp2 = 0; if (op1Mode == Operand.MODE_STACK) { Variable var = (Variable) operand1; StackLocation stackLoc = (StackLocation) var.getLocation(); disp2 = stackLoc.getDisplacement(); } int disp3 = 0; if (op2Mode == Operand.MODE_STACK) { Variable var = (Variable) refs[1]; StackLocation stackLoc = (StackLocation) var.getLocation(); disp3 = stackLoc.getDisplacement(); } Constant c2 = null; if (op1Mode == Operand.MODE_CONSTANT) { c2 = (Constant) operand1; } Constant c3 = null; if (op2Mode == Operand.MODE_CONSTANT) { c3 = (Constant) operand2; } int aMode = (lhsMode << 16) | (op1Mode << 8) | op2Mode; switch (aMode) { case MODE_RCC: cg.generateBinaryOP(reg1, c2, operation, c3); break; case MODE_RCR: if (reg1 == reg3 && commutative && !cg.supports3AddrOps()) { cg.generateBinaryOP(reg1, reg3, operation, c2); } else { cg.generateBinaryOP(reg1, c2, operation, reg3); } break; case MODE_RCS: cg.generateBinaryOP(reg1, c2, operation, disp3); break; case MODE_RRC: cg.generateBinaryOP(reg1, reg2, operation, c3); break; case MODE_RRR: if (reg1 == reg3 && commutative && !cg.supports3AddrOps()) { cg.generateBinaryOP(reg1, reg3, operation, reg2); } else { cg.generateBinaryOP(reg1, reg2, operation, reg3); } break; case MODE_RRS: cg.generateBinaryOP(reg1, reg2, operation, disp3); break; case MODE_RSC: cg.generateBinaryOP(reg1, disp2, operation, c3); break; case MODE_RSR: if (reg1 == reg3 && commutative && !cg.supports3AddrOps()) { cg.generateBinaryOP(reg1, reg3, operation, disp2); } else { cg.generateBinaryOP(reg1, disp2, operation, reg3); } break; case MODE_RSS: cg.generateBinaryOP(reg1, disp2, operation, disp3); break; case MODE_SCC: cg.generateBinaryOP(disp1, c2, operation, c3); break; case MODE_SCR: cg.generateBinaryOP(disp1, c2, operation, reg3); break; case MODE_SCS: if (disp1 == disp3 && commutative && !cg.supports3AddrOps()) { cg.generateBinaryOP(disp1, disp3, operation, c2); } else { cg.generateBinaryOP(disp1, c2, operation, disp3); } break; case MODE_SRC: cg.generateBinaryOP(disp1, reg2, operation, c3); break; case MODE_SRR: cg.generateBinaryOP(disp1, reg2, operation, reg3); break; case MODE_SRS: if (disp1 == disp3 && commutative && !cg.supports3AddrOps()) { cg.generateBinaryOP(disp1, disp3, operation, reg2); } else { cg.generateBinaryOP(disp1, reg2, operation, disp3); } break; case MODE_SSC: cg.generateBinaryOP(disp1, disp2, operation, c3); break; case MODE_SSR: cg.generateBinaryOP(disp1, disp2, operation, reg3); break; case MODE_SSS: if (disp1 == disp3 && commutative && !cg.supports3AddrOps()) { cg.generateBinaryOP(disp1, disp3, operation, disp2); } else { cg.generateBinaryOP(disp1, disp2, operation, disp3); } break; default: throw new IllegalArgumentException("Undefined addressing mode: " + aMode); } }
7,747
public void generateCode(CodeGenerator cg) { cg.checkLabel(getAddress()); Variable lhs = getLHS(); int lhsMode = lhs.getAddressingMode(); int op1Mode = operand1.getAddressingMode(); int op2Mode = operand2.getAddressingMode(); Object reg1 = null; if (lhsMode == Operand.MODE_REGISTER) { RegisterLocation regLoc = (RegisterLocation) lhs.getLocation(); reg1 = regLoc.getRegister(); } Object reg2 = null; if (op1Mode == Operand.MODE_REGISTER) { Variable var = (Variable) operand1; RegisterLocation regLoc = (RegisterLocation) var.getLocation(); reg2 = regLoc.getRegister(); } Object reg3 = null; if (op2Mode == Operand.MODE_REGISTER) { Variable var = (Variable) operand2; RegisterLocation regLoc = (RegisterLocation) var.getLocation(); reg3 = regLoc.getRegister(); } int disp1 = 0; if (lhsMode == Operand.MODE_STACK) { StackLocation stackLoc = (StackLocation) lhs.getLocation(); disp1 = stackLoc.getDisplacement(); } int disp2 = 0; if (op1Mode == Operand.MODE_STACK) { Variable var = (Variable) operand1; StackLocation stackLoc = (StackLocation) var.getLocation(); disp2 = stackLoc.getDisplacement(); } int disp3 = 0; if (op2Mode == Operand.MODE_STACK) { Variable var = (Variable) operand2; StackLocation stackLoc = (StackLocation) var.getLocation(); disp3 = stackLoc.getDisplacement(); } Constant c2 = null; if (op1Mode == Operand.MODE_CONSTANT) { c2 = (Constant) operand1; } Constant c3 = null; if (op2Mode == Operand.MODE_CONSTANT) { c3 = (Constant) operand2; } int aMode = (lhsMode << 16) | (op1Mode << 8) | op2Mode; switch (aMode) { case MODE_RCC: cg.generateBinaryOP(reg1, c2, operation, c3); break; case MODE_RCR: if (reg1 == reg3 && commutative && !cg.supports3AddrOps()) { cg.generateBinaryOP(reg1, reg3, operation, c2); } else { cg.generateBinaryOP(reg1, c2, operation, reg3); } break; case MODE_RCS: cg.generateBinaryOP(reg1, c2, operation, disp3); break; case MODE_RRC: cg.generateBinaryOP(reg1, reg2, operation, c3); break; case MODE_RRR: if (reg1 == reg3 && commutative && !cg.supports3AddrOps()) { cg.generateBinaryOP(reg1, reg3, operation, reg2); } else { cg.generateBinaryOP(reg1, reg2, operation, reg3); } break; case MODE_RRS: cg.generateBinaryOP(reg1, reg2, operation, disp3); break; case MODE_RSC: cg.generateBinaryOP(reg1, disp2, operation, c3); break; case MODE_RSR: if (reg1 == reg3 && commutative && !cg.supports3AddrOps()) { cg.generateBinaryOP(reg1, reg3, operation, disp2); } else { cg.generateBinaryOP(reg1, disp2, operation, reg3); } break; case MODE_RSS: cg.generateBinaryOP(reg1, disp2, operation, disp3); break; case MODE_SCC: cg.generateBinaryOP(disp1, c2, operation, c3); break; case MODE_SCR: cg.generateBinaryOP(disp1, c2, operation, reg3); break; case MODE_SCS: if (disp1 == disp3 && commutative && !cg.supports3AddrOps()) { cg.generateBinaryOP(disp1, disp3, operation, c2); } else { cg.generateBinaryOP(disp1, c2, operation, disp3); } break; case MODE_SRC: cg.generateBinaryOP(disp1, reg2, operation, c3); break; case MODE_SRR: cg.generateBinaryOP(disp1, reg2, operation, reg3); break; case MODE_SRS: if (disp1 == disp3 && commutative && !cg.supports3AddrOps()) { cg.generateBinaryOP(disp1, disp3, operation, reg2); } else { cg.generateBinaryOP(disp1, reg2, operation, disp3); } break; case MODE_SSC: cg.generateBinaryOP(disp1, disp2, operation, c3); break; case MODE_SSR: cg.generateBinaryOP(disp1, disp2, operation, reg3); break; case MODE_SSS: if (disp1 == disp3 && commutative && !cg.supports3AddrOps()) { cg.generateBinaryOP(disp1, disp3, operation, disp2); } else { cg.generateBinaryOP(disp1, disp2, operation, disp3); } break; default: throw new IllegalArgumentException("Undefined addressing mode: " + aMode); } }
public void generateCode(CodeGenerator cg) { cg.checkLabel(getAddress()); Variable lhs = getLHS(); int lhsMode = lhs.getAddressingMode(); int op1Mode = operand1.getAddressingMode(); int op2Mode = operand2.getAddressingMode(); Object reg1 = null; if (lhsMode == Operand.MODE_REGISTER) { RegisterLocation regLoc = (RegisterLocation) lhs.getLocation(); reg1 = regLoc.getRegister(); } Object reg2 = null; if (op1Mode == Operand.MODE_REGISTER) { Variable var = (Variable) operand1; RegisterLocation regLoc = (RegisterLocation) var.getLocation(); reg2 = regLoc.getRegister(); } Object reg3 = null; if (op2Mode == Operand.MODE_REGISTER) { Variable var = (Variable) operand2; RegisterLocation regLoc = (RegisterLocation) var.getLocation(); reg3 = regLoc.getRegister(); } int disp1 = 0; if (lhsMode == Operand.MODE_STACK) { StackLocation stackLoc = (StackLocation) lhs.getLocation(); disp1 = stackLoc.getDisplacement(); } int disp2 = 0; if (op1Mode == Operand.MODE_STACK) { Variable var = (Variable) operand1; StackLocation stackLoc = (StackLocation) var.getLocation(); disp2 = stackLoc.getDisplacement(); } int disp3 = 0; if (op2Mode == Operand.MODE_STACK) { Variable var = (Variable) operand2; StackLocation stackLoc = (StackLocation) var.getLocation(); disp3 = stackLoc.getDisplacement(); } Constant c2 = null; if (op1Mode == Operand.MODE_CONSTANT) { c2 = (Constant) refs[0]; } Constant c3 = null; if (op2Mode == Operand.MODE_CONSTANT) { c3 = (Constant) operand2; } int aMode = (lhsMode << 16) | (op1Mode << 8) | op2Mode; switch (aMode) { case MODE_RCC: cg.generateBinaryOP(reg1, c2, operation, c3); break; case MODE_RCR: if (reg1 == reg3 && commutative && !cg.supports3AddrOps()) { cg.generateBinaryOP(reg1, reg3, operation, c2); } else { cg.generateBinaryOP(reg1, c2, operation, reg3); } break; case MODE_RCS: cg.generateBinaryOP(reg1, c2, operation, disp3); break; case MODE_RRC: cg.generateBinaryOP(reg1, reg2, operation, c3); break; case MODE_RRR: if (reg1 == reg3 && commutative && !cg.supports3AddrOps()) { cg.generateBinaryOP(reg1, reg3, operation, reg2); } else { cg.generateBinaryOP(reg1, reg2, operation, reg3); } break; case MODE_RRS: cg.generateBinaryOP(reg1, reg2, operation, disp3); break; case MODE_RSC: cg.generateBinaryOP(reg1, disp2, operation, c3); break; case MODE_RSR: if (reg1 == reg3 && commutative && !cg.supports3AddrOps()) { cg.generateBinaryOP(reg1, reg3, operation, disp2); } else { cg.generateBinaryOP(reg1, disp2, operation, reg3); } break; case MODE_RSS: cg.generateBinaryOP(reg1, disp2, operation, disp3); break; case MODE_SCC: cg.generateBinaryOP(disp1, c2, operation, c3); break; case MODE_SCR: cg.generateBinaryOP(disp1, c2, operation, reg3); break; case MODE_SCS: if (disp1 == disp3 && commutative && !cg.supports3AddrOps()) { cg.generateBinaryOP(disp1, disp3, operation, c2); } else { cg.generateBinaryOP(disp1, c2, operation, disp3); } break; case MODE_SRC: cg.generateBinaryOP(disp1, reg2, operation, c3); break; case MODE_SRR: cg.generateBinaryOP(disp1, reg2, operation, reg3); break; case MODE_SRS: if (disp1 == disp3 && commutative && !cg.supports3AddrOps()) { cg.generateBinaryOP(disp1, disp3, operation, reg2); } else { cg.generateBinaryOP(disp1, reg2, operation, disp3); } break; case MODE_SSC: cg.generateBinaryOP(disp1, disp2, operation, c3); break; case MODE_SSR: cg.generateBinaryOP(disp1, disp2, operation, reg3); break; case MODE_SSS: if (disp1 == disp3 && commutative && !cg.supports3AddrOps()) { cg.generateBinaryOP(disp1, disp3, operation, disp2); } else { cg.generateBinaryOP(disp1, disp2, operation, disp3); } break; default: throw new IllegalArgumentException("Undefined addressing mode: " + aMode); } }
7,748
public void generateCode(CodeGenerator cg) { cg.checkLabel(getAddress()); Variable lhs = getLHS(); int lhsMode = lhs.getAddressingMode(); int op1Mode = operand1.getAddressingMode(); int op2Mode = operand2.getAddressingMode(); Object reg1 = null; if (lhsMode == Operand.MODE_REGISTER) { RegisterLocation regLoc = (RegisterLocation) lhs.getLocation(); reg1 = regLoc.getRegister(); } Object reg2 = null; if (op1Mode == Operand.MODE_REGISTER) { Variable var = (Variable) operand1; RegisterLocation regLoc = (RegisterLocation) var.getLocation(); reg2 = regLoc.getRegister(); } Object reg3 = null; if (op2Mode == Operand.MODE_REGISTER) { Variable var = (Variable) operand2; RegisterLocation regLoc = (RegisterLocation) var.getLocation(); reg3 = regLoc.getRegister(); } int disp1 = 0; if (lhsMode == Operand.MODE_STACK) { StackLocation stackLoc = (StackLocation) lhs.getLocation(); disp1 = stackLoc.getDisplacement(); } int disp2 = 0; if (op1Mode == Operand.MODE_STACK) { Variable var = (Variable) operand1; StackLocation stackLoc = (StackLocation) var.getLocation(); disp2 = stackLoc.getDisplacement(); } int disp3 = 0; if (op2Mode == Operand.MODE_STACK) { Variable var = (Variable) operand2; StackLocation stackLoc = (StackLocation) var.getLocation(); disp3 = stackLoc.getDisplacement(); } Constant c2 = null; if (op1Mode == Operand.MODE_CONSTANT) { c2 = (Constant) operand1; } Constant c3 = null; if (op2Mode == Operand.MODE_CONSTANT) { c3 = (Constant) operand2; } int aMode = (lhsMode << 16) | (op1Mode << 8) | op2Mode; switch (aMode) { case MODE_RCC: cg.generateBinaryOP(reg1, c2, operation, c3); break; case MODE_RCR: if (reg1 == reg3 && commutative && !cg.supports3AddrOps()) { cg.generateBinaryOP(reg1, reg3, operation, c2); } else { cg.generateBinaryOP(reg1, c2, operation, reg3); } break; case MODE_RCS: cg.generateBinaryOP(reg1, c2, operation, disp3); break; case MODE_RRC: cg.generateBinaryOP(reg1, reg2, operation, c3); break; case MODE_RRR: if (reg1 == reg3 && commutative && !cg.supports3AddrOps()) { cg.generateBinaryOP(reg1, reg3, operation, reg2); } else { cg.generateBinaryOP(reg1, reg2, operation, reg3); } break; case MODE_RRS: cg.generateBinaryOP(reg1, reg2, operation, disp3); break; case MODE_RSC: cg.generateBinaryOP(reg1, disp2, operation, c3); break; case MODE_RSR: if (reg1 == reg3 && commutative && !cg.supports3AddrOps()) { cg.generateBinaryOP(reg1, reg3, operation, disp2); } else { cg.generateBinaryOP(reg1, disp2, operation, reg3); } break; case MODE_RSS: cg.generateBinaryOP(reg1, disp2, operation, disp3); break; case MODE_SCC: cg.generateBinaryOP(disp1, c2, operation, c3); break; case MODE_SCR: cg.generateBinaryOP(disp1, c2, operation, reg3); break; case MODE_SCS: if (disp1 == disp3 && commutative && !cg.supports3AddrOps()) { cg.generateBinaryOP(disp1, disp3, operation, c2); } else { cg.generateBinaryOP(disp1, c2, operation, disp3); } break; case MODE_SRC: cg.generateBinaryOP(disp1, reg2, operation, c3); break; case MODE_SRR: cg.generateBinaryOP(disp1, reg2, operation, reg3); break; case MODE_SRS: if (disp1 == disp3 && commutative && !cg.supports3AddrOps()) { cg.generateBinaryOP(disp1, disp3, operation, reg2); } else { cg.generateBinaryOP(disp1, reg2, operation, disp3); } break; case MODE_SSC: cg.generateBinaryOP(disp1, disp2, operation, c3); break; case MODE_SSR: cg.generateBinaryOP(disp1, disp2, operation, reg3); break; case MODE_SSS: if (disp1 == disp3 && commutative && !cg.supports3AddrOps()) { cg.generateBinaryOP(disp1, disp3, operation, disp2); } else { cg.generateBinaryOP(disp1, disp2, operation, disp3); } break; default: throw new IllegalArgumentException("Undefined addressing mode: " + aMode); } }
public void generateCode(CodeGenerator cg) { cg.checkLabel(getAddress()); Variable lhs = getLHS(); int lhsMode = lhs.getAddressingMode(); int op1Mode = operand1.getAddressingMode(); int op2Mode = operand2.getAddressingMode(); Object reg1 = null; if (lhsMode == Operand.MODE_REGISTER) { RegisterLocation regLoc = (RegisterLocation) lhs.getLocation(); reg1 = regLoc.getRegister(); } Object reg2 = null; if (op1Mode == Operand.MODE_REGISTER) { Variable var = (Variable) operand1; RegisterLocation regLoc = (RegisterLocation) var.getLocation(); reg2 = regLoc.getRegister(); } Object reg3 = null; if (op2Mode == Operand.MODE_REGISTER) { Variable var = (Variable) operand2; RegisterLocation regLoc = (RegisterLocation) var.getLocation(); reg3 = regLoc.getRegister(); } int disp1 = 0; if (lhsMode == Operand.MODE_STACK) { StackLocation stackLoc = (StackLocation) lhs.getLocation(); disp1 = stackLoc.getDisplacement(); } int disp2 = 0; if (op1Mode == Operand.MODE_STACK) { Variable var = (Variable) operand1; StackLocation stackLoc = (StackLocation) var.getLocation(); disp2 = stackLoc.getDisplacement(); } int disp3 = 0; if (op2Mode == Operand.MODE_STACK) { Variable var = (Variable) operand2; StackLocation stackLoc = (StackLocation) var.getLocation(); disp3 = stackLoc.getDisplacement(); } Constant c2 = null; if (op1Mode == Operand.MODE_CONSTANT) { c2 = (Constant) operand1; } Constant c3 = null; if (op2Mode == Operand.MODE_CONSTANT) { c3 = (Constant) refs[1]; } int aMode = (lhsMode << 16) | (op1Mode << 8) | op2Mode; switch (aMode) { case MODE_RCC: cg.generateBinaryOP(reg1, c2, operation, c3); break; case MODE_RCR: if (reg1 == reg3 && commutative && !cg.supports3AddrOps()) { cg.generateBinaryOP(reg1, reg3, operation, c2); } else { cg.generateBinaryOP(reg1, c2, operation, reg3); } break; case MODE_RCS: cg.generateBinaryOP(reg1, c2, operation, disp3); break; case MODE_RRC: cg.generateBinaryOP(reg1, reg2, operation, c3); break; case MODE_RRR: if (reg1 == reg3 && commutative && !cg.supports3AddrOps()) { cg.generateBinaryOP(reg1, reg3, operation, reg2); } else { cg.generateBinaryOP(reg1, reg2, operation, reg3); } break; case MODE_RRS: cg.generateBinaryOP(reg1, reg2, operation, disp3); break; case MODE_RSC: cg.generateBinaryOP(reg1, disp2, operation, c3); break; case MODE_RSR: if (reg1 == reg3 && commutative && !cg.supports3AddrOps()) { cg.generateBinaryOP(reg1, reg3, operation, disp2); } else { cg.generateBinaryOP(reg1, disp2, operation, reg3); } break; case MODE_RSS: cg.generateBinaryOP(reg1, disp2, operation, disp3); break; case MODE_SCC: cg.generateBinaryOP(disp1, c2, operation, c3); break; case MODE_SCR: cg.generateBinaryOP(disp1, c2, operation, reg3); break; case MODE_SCS: if (disp1 == disp3 && commutative && !cg.supports3AddrOps()) { cg.generateBinaryOP(disp1, disp3, operation, c2); } else { cg.generateBinaryOP(disp1, c2, operation, disp3); } break; case MODE_SRC: cg.generateBinaryOP(disp1, reg2, operation, c3); break; case MODE_SRR: cg.generateBinaryOP(disp1, reg2, operation, reg3); break; case MODE_SRS: if (disp1 == disp3 && commutative && !cg.supports3AddrOps()) { cg.generateBinaryOP(disp1, disp3, operation, reg2); } else { cg.generateBinaryOP(disp1, reg2, operation, disp3); } break; case MODE_SSC: cg.generateBinaryOP(disp1, disp2, operation, c3); break; case MODE_SSR: cg.generateBinaryOP(disp1, disp2, operation, reg3); break; case MODE_SSS: if (disp1 == disp3 && commutative && !cg.supports3AddrOps()) { cg.generateBinaryOP(disp1, disp3, operation, disp2); } else { cg.generateBinaryOP(disp1, disp2, operation, disp3); } break; default: throw new IllegalArgumentException("Undefined addressing mode: " + aMode); } }
7,749
public String toString() { return getAddress() + ": " + getLHS().toString() + " = " + operand1.toString() + " " + OP_MAP[operation - IADD] + " " + operand2.toString(); }
public String toString() { return getAddress() + ": " + getLHS().toString() + " = " + operand1.toString() + " " + OP_MAP[operation - IADD] + " " + operand2.toString(); }
7,750
private void addDataToCurrentArray ( Locator dataLocator, String thisString, DataFormat CurrentDataFormat, int intRadix ) {/*// this stuff slows down the parser too much to leave commented in.// uncomment as neededLog.debug("Add Data:["+thisString+"] (");List axes = dataLocator.getIterationOrder();Iterator liter = axes.iterator();while (liter.hasNext()) { AxisInterface axis = (AxisInterface) liter.next(); Log.debug(dataLocator.getAxisIndex(axis)+ " ["+axis.getAxisId()+"],");}Log.debugln(") ");*/ // Note that we dont treat binary data at all here try { if ( CurrentDataFormat instanceof StringDataFormat) { CurrentArray.setData(dataLocator, thisString); } else if ( CurrentDataFormat instanceof FloatDataFormat || CurrentDataFormat instanceof BinaryFloatDataFormat) { Double number = new Double (thisString); CurrentArray.setData(dataLocator, number.doubleValue()); } else if ( CurrentDataFormat instanceof IntegerDataFormat || CurrentDataFormat instanceof BinaryIntegerDataFormat) { // Integer number = new Integer (thisString); if (intRadix == 16) // peal off leading "0x" thisString = thisString.substring(2); int thisInt = Integer.parseInt(thisString, intRadix); CurrentArray.setData(dataLocator, thisInt); } else { Log.warnln("Unknown data format, unable to setData:["+thisString+"], ignoring request"); } } catch (SetDataException e) { // bizarre error. Cant add data (out of memory??) :P Log.errorln("Unable to setData:["+thisString+"], ignoring request"); Log.printStackTrace(e); } }
private void addDataToCurrentArray ( Locator dataLocator, String thisString, DataFormat CurrentDataFormat, int intRadix ) {/*// this stuff slows down the parser too much to leave commented in.// uncomment as neededLog.debug("Add Data:["+thisString+"] (");List axes = dataLocator.getIterationOrder();Iterator liter = axes.iterator();while (liter.hasNext()) { AxisInterface axis = (AxisInterface) liter.next(); Log.debug(dataLocator.getAxisIndex(axis)+ " ["+axis.getAxisId()+"],");}Log.debugln(") ");*/ // Note that we dont treat binary data at all here try { if ( CurrentDataFormat instanceof StringDataFormat) { CurrentArray.setData(dataLocator, thisString); } else if ( CurrentDataFormat instanceof FloatDataFormat || CurrentDataFormat instanceof BinaryFloatDataFormat) { Double number = new Double (thisString); CurrentArray.setData(dataLocator, number.doubleValue()); } else if ( CurrentDataFormat instanceof IntegerDataFormat || CurrentDataFormat instanceof BinaryIntegerDataFormat) { // Integer number = new Integer (thisString); if (intRadix == 16) // peal off leading "0x" thisString = thisString.substring(2); int thisInt = 0; try { thisInt = Integer.parseInt(thisString, intRadix); } catch (NumberFormatException e) { if (thisString.startsWith("+")) { thisInt = Integer.parseInt(thisString.substring(1), intRadix); } else { throw e; } } CurrentArray.setData(dataLocator, thisInt); } else { Log.warnln("Unknown data format, unable to setData:["+thisString+"], ignoring request"); } } catch (SetDataException e) { // bizarre error. Cant add data (out of memory??) :P Log.errorln("Unable to setData:["+thisString+"], ignoring request"); Log.printStackTrace(e); } }
7,752
public String getProperty(String key, String def) { return def; }
public String getProperty(String key, String def) { if (settings.containsKey(key)) return settings.getProperty(key); else return def; }
7,756
public MediaPrintableArea(float x, float y, float w, float h, int units) { if (x < 0.0f || y < 0.0f || w <= 0.0f || h <= 0.0f) throw new IllegalArgumentException(); this.x = x; this.y = y; this.width = w; this.height = h; }
public MediaPrintableArea(float x, float y, float w, float h, int units) { if (x < 0.0f || y < 0.0f || w <= 0.0f || h <= 0.0f) throw new IllegalArgumentException(); this.x = x; this.y = y; this.width = w; this.height = h; }
7,758
public float getHeight(int units) { if (units < 1) throw new IllegalArgumentException(); return height * units; }
public float getHeight(int units) { if (units < 1) throw new IllegalArgumentException("units may not be less than 1"); return height * units; }
7,759
public float getHeight(int units) { if (units < 1) throw new IllegalArgumentException(); return height * units; }
public float getHeight(int units) { if (units < 1) throw new IllegalArgumentException(); return height / ((float)units); }
7,760
public float getWidth(int units) { if (units < 1) throw new IllegalArgumentException(); return width * units; }
public float getWidth(int units) { if (units < 1) throw new IllegalArgumentException("units may not be less than 1"); return width * units; }
7,761
public float getWidth(int units) { if (units < 1) throw new IllegalArgumentException(); return width * units; }
public float getWidth(int units) { if (units < 1) throw new IllegalArgumentException(); return width / ((float)units); }
7,762
public float getX(int units) { if (units < 1) throw new IllegalArgumentException(); return x * units; }
public float getX(int units) { if (units < 1) throw new IllegalArgumentException("units may not be less than 1"); return x * units; }
7,763