资源简介
设计一个图灵机M,用于判定接收符合如下条件的字符串
C={aibjckdx}subject to i× j×k = x&i, j,k,x ≥1
代码片段和文件信息
import java.awt.FlowLayout;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.ArrayList;
import java.util.Scanner;
import javax.swing.JButton;
import javax.swing.Jframe;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;
public class TM_abcd {
public static String NEW_LINE = “\n“;
public static void main(String[] args) {
TM_abcd tm = new TM_abcd();
Jframe frame = new Jframe(“CFGtoCNF“);
frame.setSize(1100 540);
JPanel panel = new JPanel();
panel.setLayout(new GridBagLayout());
JTextArea jTextArea = new JTextArea(20 40);
JTextArea jTextAreaResult = new JTextArea(20 40);
jTextAreaResult.setEditable(false);
JScrollPane jScrollPane = new JScrollPane(jTextAreaResult);
jScrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
JTextField leftField = new JTextField();
leftField.setText(“Input“);
leftField.setHorizontalAlignment(JTextField.CENTER);
leftField.setEditable(false);
JTextField rightField = new JTextField();
rightField.setText(“Output“);
rightField.setHorizontalAlignment(JTextField.CENTER);
rightField.setEditable(false);
JButton buttonConvert = new JButton(“Judge“);
JButton btnClearLeft = new JButton(“Clear“);
buttonConvert.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
// TODO Auto-generated method stub
String[] lines = jTextArea.getText().split(NEW_LINE);
if (lines.length > 0) {
jTextAreaResult.setText(““);
for (String s : lines) {
if (s.endsWith(“#“)) {
tm.reset();
// int temp = s.indexOf(“a“);
// if (temp != -1) {
// s = s.replaceFirst(“a“ “W“);
// tm.checkA(s 1);
// }
tm.checkA(s 0);
jTextAreaResult.append(tm.getResult()+NEW_LINE);
}else {
jTextAreaResult.append(“Miss # at the end of string“+NEW_LINE);
}
}
}
}
});
btnClearLeft.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
// TODO Auto-generated method stub
super.mouseClicked(e);
jTextAreaResult.setText(““);
jTextArea.setText(““);
}
});
GridBagConstraints constraints = new GridBagConstraints();
constraints.fill = GridBagConstraints.BOTH;
constraints.gridx = 0;
constraints.gridy = 0;
constraints.weightx = 1;
constraints.weighty = 1;
panel.add(leftField constraints);
constraints.gridx = 1;
constraints.gridy = 0;
constraints.weighty = 1;
constraints.weightx = 1;
panel.add(rightField constraints);
constraints.gridx = 0;
constraints.gridy = 1;
constraints.weighty = 3;
panel.add(jTextArea constraints);
constraints.gridx = 1;
constraints.gridy = 1;
constraints.weighty = 3;
panel.add(jScrollPane constraints);
constraints.gridx = 0;
constraints.gridy = 2;
con
- 上一篇:android人物行走动画演示
- 下一篇:javaweb电商项目视频
相关资源
- C#、C++、HTML5、JAVA、Python、数据结构与
- java docx 转 html XHTMLOptions等方法jar包
- java实现任意带table表格的html页面,生
- java课程设计ATM机图形用户代码
- BestMail.jar
- wordToHtml
- java,Eclipse,ATM自动柜台模拟系统
- SpringBoot实现Socket.io消息推送(java+h
- Linux下V4L2视频采集与x264编码RTMP推送源
- java 程序换头像
- rabbitmq:基于java、基于springboot、基于
- htmlparser.jar文件
- java模拟的ATM机实验报告
- (手机移动web)iscroll+html5+css3+js实现
- java实现js、css、图片合并到html文件
- stm32cubeMX_v4.27及f4HAL库包及所需要的
- 包含tm-extractors-0.4.jar
- JAVA做的一个ATM 机模拟程序,图形界面
- ATM模拟系统.zip
- java做的ATM机
-
javaxm
ltoHTML.zip - FiddlerCertMaker.exe
- java docx 转 html XHTMLOptions等方法jar包
- html转为图片,java后端
- dtmf decoder Android rar
- Java+MySql数据库 模拟ATM自助存取款b
- 图书馆管理系统html+jsp+javabean代码
- rabbitmq+spring需要的jar包
- jsp+servlet+SQLserver实现网上商城
- 12306.html
评论
共有 条评论