MCPcopy Create free account
hub / github.com/beanshell/beanshell / booleanBinaryOperation

Method booleanBinaryOperation

src/bsh/Primitive.java:283–312  ·  view source on GitHub ↗
(Boolean B1, Boolean B2, int kind)

Source from the content-addressed store, hash-verified

281 }
282
283 static Boolean booleanBinaryOperation(Boolean B1, Boolean B2, int kind)
284 {
285 boolean lhs = B1.booleanValue();
286 boolean rhs = B2.booleanValue();
287
288 switch(kind)
289 {
290 case EQ:
291 return lhs == rhs ? Boolean.TRUE : Boolean.FALSE;
292
293 case NE:
294 return lhs != rhs ? Boolean.TRUE : Boolean.FALSE;
295
296 case BOOL_OR:
297 case BOOL_ORX:
298 case BIT_OR:
299 return lhs || rhs ? Boolean.TRUE : Boolean.FALSE;
300
301 case BOOL_AND:
302 case BOOL_ANDX:
303 case BIT_AND:
304 return lhs && rhs ? Boolean.TRUE : Boolean.FALSE;
305
306 case XOR:
307 return lhs ^ rhs ? Boolean.TRUE : Boolean.FALSE;
308
309 default:
310 throw new InterpreterError("unimplemented binary operator");
311 }
312 }
313
314 // returns Object covering both Long and Boolean return types
315 static Object longBinaryOperation(Long L1, Long L2, int kind)

Callers 1

binaryOperationImplMethod · 0.95

Calls 1

booleanValueMethod · 0.80

Tested by

no test coverage detected