1 package org.jicengine.operation; 2 3 14 public class NegationOperation implements Operation { 15 private Operation operation; 16 public NegationOperation(Operation operation) 17 { 18 this.operation = operation; 19 } 20 21 28 public Object execute(Context context) throws OperationException 29 { 30 Object result = this.operation.execute(context); 31 if( result == null ){ 32 return Boolean.TRUE; 34 } 35 else if( result instanceof Boolean ){ 36 return new Boolean (!((Boolean )result).booleanValue()); 38 } 39 else { 40 return Boolean.FALSE; 42 } 43 44 } 45 46 52 public boolean needsParameter(String name) 53 { 54 return this.operation.needsParameter(name); 55 } 56 57 62 public boolean needsParameters() 63 { 64 return this.operation.needsParameters(); 65 } 66 } 67 | Popular Tags |