private Object readResolve() { return getInstance(value); }
/** * Returns true if the contained condition returns false. * * This implies that it returns false if the contained condition is null. * * @param element the object to be evaluated. * @return true if the contained condition returns false. */ @Override public boolean isTrue(Object element) { if(condition != null) { return !condition.isTrue(element); } return false; }
@Override public Not clone() throws CloneNotSupportedException { Not result = (Not) super.clone(); if(result.condition != null) { result.condition = result.condition.clone(); } return result; }
public void internalTestEquals(Condition original, Condition other) { assertEquals(original, other); if(other instanceof ConditionGroup) { ConditionGroup originalGroup = (ConditionGroup) original; ConditionGroup clonedGroup = (ConditionGroup) other; assertEquals(originalGroup.getConditions(), clonedGroup.getConditions()); } else if(other instanceof ConditionWrapper) { ConditionWrapper originalWrapper = (ConditionWrapper) original; ConditionWrapper clonedWrapper = (ConditionWrapper) other; assertEquals(originalWrapper.getCondition(), clonedWrapper.getCondition()); } } }
@Test public void containsWrapper() { ConditionWrapper conditionWrapper = new Not(); assertTrue(Conditions.contains(conditionWrapper, null)); assertTrue(Conditions.contains(conditionWrapper, conditionWrapper)); ConditionWrapper otherWrapper=new Not(); assertTrue(Conditions.contains(conditionWrapper, otherWrapper)); otherWrapper.setCondition(BooleanValues.TRUE); assertFalse(Conditions.contains(conditionWrapper, otherWrapper)); conditionWrapper.setCondition(BooleanValues.TRUE); assertFalse(Conditions.contains(conditionWrapper, null)); assertTrue(Conditions.contains(conditionWrapper, conditionWrapper)); assertTrue(Conditions.contains(conditionWrapper, BooleanValues.TRUE)); assertFalse(Conditions.contains(conditionWrapper, BooleanValues.FALSE)); }
@Test public void empty() throws CloneNotSupportedException, IOException, ClassNotFoundException { Or condition = new Or(); assertNull(condition.getConditions()); assertFalse(condition.isTrue(null)); internalTestCondition(condition); List<Condition> conditions = new ArrayList<>(); condition.setConditions(conditions); assertNotNull(condition.getConditions()); assertEquals(conditions, condition.getConditions()); assertFalse(condition.isTrue(null)); internalTestCondition(condition); }
@Test public void testTrue() throws CloneNotSupportedException, IOException, ClassNotFoundException { Not condition = new Not(); condition.setCondition(BooleanValues.FALSE); assertTrue(condition.isTrue(null)); internalTestCondition(condition); }
public void internalTestCloneEquals(Condition condition) throws CloneNotSupportedException { Condition clone = condition.clone(); internalTestEquals(condition, clone); }
@Test public void empty() throws CloneNotSupportedException, IOException, ClassNotFoundException { Not condition = new Not(); assertNull(condition.getCondition()); assertFalse(condition.isTrue(null)); internalTestCondition(condition); }
@Test public void testFalse() throws CloneNotSupportedException, IOException, ClassNotFoundException { BooleanValues condition = BooleanValues.FALSE; assertFalse(condition.isTrue(null)); internalTestCondition(condition); }
public void internalTestCondition(Condition condition) throws CloneNotSupportedException, IOException, ClassNotFoundException { internalTestCloneEquals(condition); internalTestSerialization(condition); }
/** * Returns true if the contained condition returns false. * * This implies that it returns false if the contained condition is null. * * @param element the object to be evaluated. * @return true if the contained condition returns false. */ @Override public boolean isTrue(Object element) { if(condition != null) { return !condition.isTrue(element); } return false; }
@Test public void testFalse() throws CloneNotSupportedException, IOException, ClassNotFoundException { Not condition = new Not(); condition.setCondition(BooleanValues.TRUE); assertFalse(condition.isTrue(null)); internalTestCondition(condition); }
@Override public Not clone() throws CloneNotSupportedException { Not result = (Not) super.clone(); if(result.condition != null) { result.condition = result.condition.clone(); } return result; }
private Object readResolve() { return getInstance(value); }
@Test public void testTrue() throws CloneNotSupportedException, IOException, ClassNotFoundException { BooleanValues condition = BooleanValues.TRUE; assertTrue(condition.isTrue(null)); internalTestCondition(condition); }
/** * Returns true if any of the contained conditions is true. * * This implies that it returns false if the contained conditions are either null or empty. * * @param element the object to be evaluated. * @return true if any of the contained conditions is true. */ @Override public boolean isTrue(Object element) { if(conditions != null) { for(Condition condition : conditions) { if(condition.isTrue(element)) { return true; } } } return false; }
/** * Returns false if any of the contained conditions is false. * * This implies that it returns true if the contained conditions are either null or empty. * * @param element the object to be evaluated. * @return false if any of the contained conditions is false. */ @Override public boolean isTrue(Object element) { if(conditions != null) { for(Condition condition : conditions) { if(!condition.isTrue(element)) { return false; } } } return true; }
/** * Returns false if any of the contained conditions is false. * * This implies that it returns true if the contained conditions are either null or empty. * * @param element the object to be evaluated. * @return false if any of the contained conditions is false. */ @Override public boolean isTrue(Object element) { if(conditions != null) { for(Condition condition : conditions) { if(!condition.isTrue(element)) { return false; } } } return true; }
/** * Returns true if any of the contained conditions is true. * * This implies that it returns false if the contained conditions are either null or empty. * * @param element the object to be evaluated. * @return true if any of the contained conditions is true. */ @Override public boolean isTrue(Object element) { if(conditions != null) { for(Condition condition : conditions) { if(condition.isTrue(element)) { return true; } } } return false; }