-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathop2.java
More file actions
74 lines (66 loc) · 2.02 KB
/
op2.java
File metadata and controls
74 lines (66 loc) · 2.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package regex;
/**
*
* @author Hp
*/
public class op2 {
String IsOperators(String input)
{
String i= null;
if(input.equals("+") ||input.equals("-") )
{
System.out.print(" \n PMOP");
return "true";
}
else if(input.equals("/")|| input.equals("%")){
System.out.print(" \n DMOP");
return "true";
}
else if(input.equals("*")){
System.out.print(" \n MOP \n");
return "true";
}
else if(input.equals("++") || input.equals("--") )
{
System.out.print(" \n INDECCOP \n");
return "true";
}
else if(input.equals("<") || input.equals(">") || input.equals("<=") || input.equals(">=") || input.equals("==") || input.equals("!="))
{
System.out.print("\n REOP \n");
return "true";
}
else if(input.equals("||") || input.equals("&&")|| input.equals("!"))
{
System.out.print("\n LOP \n");
return "true";
}
else if(input.equals("+=")|| input.equals("-=") || input.equals("%=")|| input.equals("/=") || input.equals("*=") )
{
System.out.print("\n ASOP \n");
return "true";
}
else if(input.equals("<<") || input.equals(">>") )
{
System.out.print("\n SOP \n");
return "true";
}
else if(input.equals("~") )
{
System.out.print("\n SHIFTOP ");
return "true";
}
else if(input.equals("=") )
{
System.out.print("\n AOP ");
return "true";
}
System.out.print("\n invalid lex");
return "false";
}
}