⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 consistenta.java

📁 A simple chaine list example in java Warning: Descriptions and varables may ne hard to understand a
💻 JAVA
字号:

public class Consistenta {

	public static boolean deschis(char x){
		if (x=='[' || x=='{' || x=='(')
			return true;
		return false;
	}
	
	public static boolean inchis(char x){
		if (x==']' || x=='}' || x==')')
			return true;
		return false;
	}
	
	public static boolean compare(char x,char y){
		if (x=='[' && y==']') {
			return true;
		} else if (x=='{' && y=='}') {
			return true;
		} else if (x=='(' && y==')') {
			return true;
		}
		return false;
	}
	
	public static void main(String[] args) {
		
		Stiva a=new Stiva();
		char [] str=args[0].toCharArray();
		boolean g=true;
		
		for (int i=0;i<str.length;i++){
			if (deschis(str[i])) {
				a.Baga(str[i]);
			} else if (inchis(str[i])) {
				char t=a.Scoate();
				if (!compare(t,str[i])) {
					g=false;
				}
			}
		}
		
		if (!a.Gol()) g=false;
		
		if (g) {
			System.out.print("E regulara expresia");
		} else {
			System.out.print("Nu e regulara expresia");
		}
	}

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -