LightJason - AgentSpeak(L++)
EOperator.java
Go to the documentation of this file.
1 /*
2  * @cond LICENSE
3  * ######################################################################################
4  * # LGPL License #
5  * # #
6  * # This file is part of the LightJason AgentSpeak(L++) #
7  * # Copyright (c) 2015-19, LightJason (info@lightjason.org) #
8  * # This program is free software: you can redistribute it and/or modify #
9  * # it under the terms of the GNU Lesser General Public License as #
10  * # published by the Free Software Foundation, either version 3 of the #
11  * # License, or (at your option) any later version. #
12  * # #
13  * # This program is distributed in the hope that it will be useful, #
14  * # but WITHOUT ANY WARRANTY; without even the implied warranty of #
15  * # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
16  * # GNU Lesser General Public License for more details. #
17  * # #
18  * # You should have received a copy of the GNU Lesser General Public License #
19  * # along with this program. If not, see http://www.gnu.org/licenses/ #
20  * ######################################################################################
21  * @endcond
22  */
23 
24 package org.lightjason.agentspeak.language.execution.expression;
25 
26 
30 public enum EOperator
31 {
32  PLUS( "+" ),
33  MINUS( "-" ),
34 
35  MULTIPLY( "*" ),
36  DIVIDE( "/" ),
37  MODULO( "%" ),
38  POWER( "**" ),
39 
40 
41  OR( "||" ),
42  AND( "&&" ),
43  XOR( "^" ),
44  NEGATION( "~" ),
45 
46  EQUAL( "==" ),
47  NOTEQUAL( "\\==" ),
48 
49  LESS( "<" ),
50  LESSEQUAL( "<=" ),
51  GREATER( ">" ),
52  GREATEREQUAL( ">=" );
53 
54 
55 
59  private final String m_name;
60 
66  EOperator( final String p_name )
67  {
68  m_name = p_name;
69  }
70 
71  @Override
72  public final String toString()
73  {
74  return m_name;
75  }
76 
82  public final boolean isLogical()
83  {
84  return ( this == AND ) || ( this == OR ) || ( this == XOR ) || ( this == NEGATION );
85  }
86 
92  public final boolean isNumerical()
93  {
94  return ( this == PLUS ) || ( this == MINUS ) || ( this == MULTIPLY ) || ( this == DIVIDE ) || ( this == MODULO ) || ( this == POWER );
95  }
96 
102  public final boolean isComparable()
103  {
104  return ( this == EQUAL ) || ( this == NOTEQUAL );
105  }
106 
112  public final boolean isRelational()
113  {
114  return ( this == LESS ) || ( this == LESSEQUAL ) || ( this == GREATER ) || ( this == GREATEREQUAL );
115  }
116 
122  public final boolean isAdditive()
123  {
124  return ( this == PLUS ) || ( this == MINUS );
125  }
126 
132  public final boolean isMultiplicative()
133  {
134  return ( this == MULTIPLY ) || ( this == DIVIDE ) || ( this == MODULO );
135  }
136 
142  public final boolean isPower()
143  {
144  return this == POWER;
145  }
146 
152  public final boolean isBinary()
153  {
154  return this != NEGATION;
155  }
156 
162  public final boolean isUnary()
163  {
164  return this == NEGATION;
165  }
166 }
final boolean isLogical()
check of a logical operator
Definition: EOperator.java:82
final boolean isRelational()
check of a relational operator
Definition: EOperator.java:112
final boolean isBinary()
check of a binary operator
Definition: EOperator.java:152
final boolean isComparable()
check of a comparable operator
Definition: EOperator.java:102
final boolean isAdditive()
check of a additive operator
Definition: EOperator.java:122
final boolean isNumerical()
check of a numeric operator
Definition: EOperator.java:92
final boolean isMultiplicative()
check of a multiplicative operator
Definition: EOperator.java:132
final boolean isPower()
check of a power operator
Definition: EOperator.java:142
final boolean isUnary()
check of a unary operator
Definition: EOperator.java:162