All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.symcpe.wraith.conditions.logical.ComplexCondition Maven / Gradle / Ivy

/**
 * Copyright 2016 Symantec Corporation.
 * 
 * Licensed under the Apache License, Version 2.0 (the “License”); 
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package io.symcpe.wraith.conditions.logical;

import java.util.List;

import io.symcpe.wraith.Event;
import io.symcpe.wraith.Required;
import io.symcpe.wraith.conditions.Condition;

/**
 * Complex conditions are made of more than 1 conditions. Complex conditions also have the provision to short circuit
 * 
 * @author ambud_sharma
 *
 */
public abstract class ComplexCondition implements Condition {
	
	private static final long serialVersionUID = 1L;
	@Required
	private List conditions;
	
	public ComplexCondition(List conditions) {
		this.conditions = conditions;
	}
	
	@Override
	public boolean matches(Event event) {
		boolean matchResult = conditions.get(0).matches(event);
		for(int i=1;i getConditions() {
		return conditions;
	}

	/**
	 * Setter for conditions
	 * @param conditions
	 */
	public void setConditions(List conditions) {
		this.conditions = conditions;
	}

	/* (non-Javadoc)
	 * @see java.lang.Object#toString()
	 */
	@Override
	public String toString() {
		return "ComplexCondition [conditions=" + conditions + "]";
	}
	
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy