Basic arithmetic can now be done with arbitrary length numbers, add option to Code Export for including output window text
This commit is contained in:
parent
93949a242d
commit
98d1470e30
@ -29,17 +29,20 @@
|
||||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="jScrollPane1" max="32767" attributes="0"/>
|
||||
<Component id="jPanel1" alignment="0" max="32767" attributes="0"/>
|
||||
<Component id="jScrollPane1" pref="583" max="32767" attributes="0"/>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="jPanel1" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="0" pref="10" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="jScrollPane1" pref="268" max="32767" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="4" max="-2" attributes="0"/>
|
||||
<Component id="jScrollPane1" pref="273" max="32767" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jPanel1" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="10" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
@ -67,11 +70,17 @@
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" max="-2" attributes="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="jLabel5" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
<Component id="outputPlaceBox" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace type="separate" max="-2" attributes="0"/>
|
||||
<Component id="titleBox" pref="154" max="32767" attributes="0"/>
|
||||
<Component id="titleBox" min="-2" pref="154" max="-2" attributes="0"/>
|
||||
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
@ -80,12 +89,12 @@
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="dateBox" max="32767" attributes="0"/>
|
||||
<Component id="authBox" max="32767" attributes="0"/>
|
||||
<Component id="dateBox" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</Group>
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
<EmptySpace type="unrelated" min="-2" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" max="-2" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<Component id="jLabel4" min="-2" max="-2" attributes="0"/>
|
||||
@ -94,19 +103,17 @@
|
||||
</Group>
|
||||
<Component id="jScrollPane2" pref="239" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
<Component id="jPanel2" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jPanel2" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace min="5" pref="5" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="jPanel2" min="-2" max="-2" attributes="0"/>
|
||||
<Group type="102" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="titleBox" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
@ -114,8 +121,9 @@
|
||||
<Component id="jButton1" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<Group type="103" groupAlignment="0" max="-2" attributes="0">
|
||||
<Component id="jScrollPane2" alignment="0" max="32767" attributes="0"/>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="jLabel2" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="authBox" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
@ -125,12 +133,19 @@
|
||||
<Component id="dateBox" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jLabel3" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="jLabel5" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="outputPlaceBox" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Component id="jScrollPane2" min="-2" pref="55" max="-2" attributes="0"/>
|
||||
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
<Component id="jPanel2" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
@ -211,8 +226,8 @@
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="exHtml" alignment="0" max="32767" attributes="0"/>
|
||||
<Component id="exPdf" alignment="0" pref="80" max="32767" attributes="0"/>
|
||||
<Component id="exPdf" max="32767" attributes="0"/>
|
||||
<Component id="exHtml" alignment="0" pref="80" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
@ -221,10 +236,11 @@
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="18" max="-2" attributes="0"/>
|
||||
<Component id="exHtml" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
<Component id="exPdf" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
@ -248,6 +264,23 @@
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Component class="javax.swing.JComboBox" name="outputPlaceBox">
|
||||
<Properties>
|
||||
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
|
||||
<StringArray count="3">
|
||||
<StringItem index="0" value="Below code"/>
|
||||
<StringItem index="1" value="Above code"/>
|
||||
<StringItem index="2" value="No"/>
|
||||
</StringArray>
|
||||
</Property>
|
||||
<Property name="selectedIndex" type="int" value="2"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel5">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Include output:"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
|
@ -63,6 +63,7 @@ import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import javax.swing.JFileChooser;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.filechooser.FileFilter;
|
||||
import javax.swing.filechooser.FileNameExtensionFilter;
|
||||
import org.htmlcleaner.CleanerProperties;
|
||||
@ -81,6 +82,7 @@ public class CodeExport extends javax.swing.JInternalFrame {
|
||||
private String codeLang = "js";
|
||||
private String html;
|
||||
private final String origCode;
|
||||
private String outputTxt = "";
|
||||
|
||||
/**
|
||||
* Creates new form CodeExport
|
||||
@ -90,6 +92,12 @@ public class CodeExport extends javax.swing.JInternalFrame {
|
||||
public CodeExport(String code) {
|
||||
origCode = code;
|
||||
initComponents();
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
html = genHtml(code);
|
||||
}
|
||||
});
|
||||
html = genHtml(code);
|
||||
previewPane.setText(html);
|
||||
previewPane.setCaretPosition(0);
|
||||
@ -106,6 +114,11 @@ public class CodeExport extends javax.swing.JInternalFrame {
|
||||
codeLang = lang;
|
||||
}
|
||||
|
||||
public CodeExport(String code, String lang, String out) {
|
||||
this(code, lang);
|
||||
outputTxt = out;
|
||||
}
|
||||
|
||||
private String genHtml(String code) {
|
||||
String css = "";
|
||||
BufferedReader reader = new BufferedReader(
|
||||
@ -137,9 +150,15 @@ public class CodeExport extends javax.swing.JInternalFrame {
|
||||
if (!headerBox.getText().equals("")) {
|
||||
html += "<p class=\"header\">" + headerBox.getText() + "</p>";
|
||||
}
|
||||
if (outputPlaceBox.getSelectedIndex() == 1) {
|
||||
html += getOutput();
|
||||
}
|
||||
PrettifyParser parser = new PrettifyParser();
|
||||
List<ParseResult> parseResults = parser.parse(codeLang, code);
|
||||
html += PrettifyToHtml.toHtml(code, parseResults);
|
||||
if (outputPlaceBox.getSelectedIndex() == 0) {
|
||||
html += getOutput();
|
||||
}
|
||||
html += "</body></html>";
|
||||
html = html.replace("\t", "<span class=\"tab\"> </span>");
|
||||
html = html.replace("\n", "<br>");
|
||||
@ -153,6 +172,15 @@ public class CodeExport extends javax.swing.JInternalFrame {
|
||||
return html;
|
||||
}
|
||||
|
||||
private String getOutput() {
|
||||
return "<pre>"
|
||||
+ outputTxt.replace("<", "<").
|
||||
replace("&", "&").
|
||||
replace(">", ">").
|
||||
replace("\"", "''")
|
||||
+ "</pre>";
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is called from within the constructor to initialize the form.
|
||||
* WARNING: Do NOT modify this code. The content of this method is always
|
||||
@ -178,6 +206,8 @@ public class CodeExport extends javax.swing.JInternalFrame {
|
||||
jPanel2 = new javax.swing.JPanel();
|
||||
exHtml = new javax.swing.JButton();
|
||||
exPdf = new javax.swing.JButton();
|
||||
outputPlaceBox = new javax.swing.JComboBox();
|
||||
jLabel5 = new javax.swing.JLabel();
|
||||
|
||||
setClosable(true);
|
||||
setIconifiable(true);
|
||||
@ -239,38 +269,49 @@ public class CodeExport extends javax.swing.JInternalFrame {
|
||||
.addGroup(jPanel2Layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(exHtml, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(exPdf, javax.swing.GroupLayout.DEFAULT_SIZE, 80, Short.MAX_VALUE))
|
||||
.addComponent(exPdf, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(exHtml, javax.swing.GroupLayout.DEFAULT_SIZE, 80, Short.MAX_VALUE))
|
||||
.addContainerGap())
|
||||
);
|
||||
jPanel2Layout.setVerticalGroup(
|
||||
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel2Layout.createSequentialGroup()
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addGap(18, 18, 18)
|
||||
.addComponent(exHtml)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(exPdf))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addComponent(exPdf)
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
);
|
||||
|
||||
outputPlaceBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Below code", "Above code", "No" }));
|
||||
outputPlaceBox.setSelectedIndex(2);
|
||||
|
||||
jLabel5.setText("Include output:");
|
||||
|
||||
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
|
||||
jPanel1.setLayout(jPanel1Layout);
|
||||
jPanel1Layout.setHorizontalGroup(
|
||||
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||
.addComponent(jLabel5)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addComponent(outputPlaceBox, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||
.addComponent(jLabel1)
|
||||
.addGap(18, 18, 18)
|
||||
.addComponent(titleBox, javax.swing.GroupLayout.DEFAULT_SIZE, 154, Short.MAX_VALUE))
|
||||
.addComponent(titleBox, javax.swing.GroupLayout.PREFERRED_SIZE, 154, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(0, 0, Short.MAX_VALUE))
|
||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jLabel2)
|
||||
.addComponent(jLabel3))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(dateBox)
|
||||
.addComponent(authBox))))
|
||||
.addComponent(authBox)
|
||||
.addComponent(dateBox))))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||
@ -278,16 +319,14 @@ public class CodeExport extends javax.swing.JInternalFrame {
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(jButton1))
|
||||
.addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 239, Short.MAX_VALUE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addContainerGap())
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
);
|
||||
jPanel1Layout.setVerticalGroup(
|
||||
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||
.addGap(5, 5, 5)
|
||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(titleBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
@ -295,7 +334,8 @@ public class CodeExport extends javax.swing.JInternalFrame {
|
||||
.addComponent(jLabel4)
|
||||
.addComponent(jButton1))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
||||
.addComponent(jScrollPane2)
|
||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(jLabel2)
|
||||
@ -303,25 +343,33 @@ public class CodeExport extends javax.swing.JInternalFrame {
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(dateBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(jLabel3)))
|
||||
.addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE))))
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addComponent(jLabel3))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(jLabel5)
|
||||
.addComponent(outputPlaceBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGap(0, 0, Short.MAX_VALUE)))
|
||||
.addGap(0, 0, Short.MAX_VALUE))
|
||||
.addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addGap(0, 0, 0))
|
||||
);
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
||||
getContentPane().setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jScrollPane1)
|
||||
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 583, Short.MAX_VALUE)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(0, 10, Short.MAX_VALUE))
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 268, Short.MAX_VALUE)
|
||||
.addGap(4, 4, 4)
|
||||
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 273, Short.MAX_VALUE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(10, 10, 10))
|
||||
.addContainerGap())
|
||||
);
|
||||
|
||||
pack();
|
||||
@ -424,10 +472,12 @@ public class CodeExport extends javax.swing.JInternalFrame {
|
||||
private javax.swing.JLabel jLabel2;
|
||||
private javax.swing.JLabel jLabel3;
|
||||
private javax.swing.JLabel jLabel4;
|
||||
private javax.swing.JLabel jLabel5;
|
||||
private javax.swing.JPanel jPanel1;
|
||||
private javax.swing.JPanel jPanel2;
|
||||
private javax.swing.JScrollPane jScrollPane1;
|
||||
private javax.swing.JScrollPane jScrollPane2;
|
||||
private javax.swing.JComboBox outputPlaceBox;
|
||||
private javax.swing.JTextPane previewPane;
|
||||
private javax.swing.JTextField titleBox;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
@ -841,7 +841,7 @@ public class Editor extends javax.swing.JInternalFrame {
|
||||
|
||||
private void exportMenuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exportMenuActionPerformed
|
||||
String lang = pythonOption.isSelected() ? "python" : "js";
|
||||
Main.loadFrame(new CodeExport(codeBox.getText(), lang));
|
||||
Main.loadFrame(new CodeExport(codeBox.getText(), lang, outputBox.getText()));
|
||||
}//GEN-LAST:event_exportMenuActionPerformed
|
||||
|
||||
private void javascriptOptionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_javascriptOptionActionPerformed
|
||||
|
@ -176,6 +176,7 @@ public class Functions {
|
||||
|
||||
/**
|
||||
* Take (a^b) mod m. If b is -1, finds the modular inverse of a mod m.
|
||||
*
|
||||
* @param a Number
|
||||
* @param b Exponent
|
||||
* @param m Modulus
|
||||
@ -189,13 +190,33 @@ public class Functions {
|
||||
return (pow(a, b) % m + m) % m;
|
||||
}
|
||||
|
||||
public int gcd(int a, int b) {
|
||||
/**
|
||||
* Take (a^b) mod m. If b is -1, finds the modular inverse of a mod m.
|
||||
*
|
||||
* @param a Number
|
||||
* @param b Exponent
|
||||
* @param m Modulus
|
||||
* @return pow(a,b)%m.
|
||||
*/
|
||||
public String powermod(String a, String b, String m) {
|
||||
BigInteger in = new BigInteger(a);
|
||||
if (b.equals("-1")) {
|
||||
return in.modInverse(new BigInteger(m)).toString();
|
||||
}
|
||||
return in.modPow(new BigInteger(b), new BigInteger(m)).toString();
|
||||
}
|
||||
|
||||
public long gcd(long a, long b) {
|
||||
if (b == 0) {
|
||||
return a;
|
||||
}
|
||||
return gcd(b, a % b);
|
||||
}
|
||||
|
||||
public String gcd(String a, String b) {
|
||||
return (new BigInteger(a).gcd(new BigInteger(b)).toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* Differentiate the function with respect to idv.
|
||||
*
|
||||
@ -285,6 +306,17 @@ public class Functions {
|
||||
return ans;
|
||||
}
|
||||
|
||||
/**
|
||||
* Multiplies the given numbers together.
|
||||
*
|
||||
* @param a numbers. Calculates first * second * third, etc.
|
||||
* @return The product of the numbers or the value of input if there is only
|
||||
* one input.
|
||||
*/
|
||||
public String times(String a, String b) {
|
||||
return (new BigInteger(a).multiply(new BigInteger(b))).toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Divide the given numbers.
|
||||
*
|
||||
@ -304,6 +336,17 @@ public class Functions {
|
||||
return ans;
|
||||
}
|
||||
|
||||
/**
|
||||
* Divide the given numbers.
|
||||
*
|
||||
* @param a numbers. Calculates (first / second) / third, etc.
|
||||
* @return The quotient of the numbers or the value of input if there is
|
||||
* only one input.
|
||||
*/
|
||||
public String divide(String a, String b) {
|
||||
return (new BigInteger(a).divide(new BigInteger(b))).toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Divide the first number by the second and return the remainder.
|
||||
*
|
||||
@ -323,6 +366,17 @@ public class Functions {
|
||||
return ans;
|
||||
}
|
||||
|
||||
/**
|
||||
* Divide the first number by the second and return the remainder.
|
||||
*
|
||||
* @param a numbers. Calculates (first mod second) mod third, etc.
|
||||
* @return The modulus of the numbers or the value of input if there is only
|
||||
* one input.
|
||||
*/
|
||||
public String mod(String a, String b) {
|
||||
return (new BigInteger(a).mod(new BigInteger(b))).toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the given numbers together.
|
||||
*
|
||||
@ -338,6 +392,17 @@ public class Functions {
|
||||
return ans;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the given numbers together.
|
||||
*
|
||||
* @param a numbers. Calculates first + second + third, etc.
|
||||
* @return The sum of the numbers or the value of input if there is only one
|
||||
* input.
|
||||
*/
|
||||
public String add(String a, String b) {
|
||||
return (new BigInteger(a).subtract(new BigInteger(b))).toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Subtract the given numbers.
|
||||
*
|
||||
@ -357,6 +422,19 @@ public class Functions {
|
||||
return ans;
|
||||
}
|
||||
|
||||
/**
|
||||
* Subtract the given numbers.
|
||||
*
|
||||
* @param a numbers. Calculates (first - second) - third, etc.
|
||||
* @return The difference of the numbers or the value of input if there is
|
||||
* only one input.
|
||||
*/
|
||||
public String subtract(String a, String b) {
|
||||
BigInteger ans = new BigInteger(a);
|
||||
ans = ans.subtract(new BigInteger(b));
|
||||
return ans.toString();
|
||||
}
|
||||
|
||||
public double[][] $minvert(double a[][]) {
|
||||
int n = a.length;
|
||||
double x[][] = new double[n][n];
|
||||
|
Loading…
x
Reference in New Issue
Block a user