001package org.biopax.paxtools.pattern.constraint; 002 003import org.biopax.paxtools.pattern.Constraint; 004import org.biopax.paxtools.pattern.Match; 005 006/** 007 * Negation of a constraint. This is not generative. 008 * 009 * @author Ozgun Babur 010 */ 011public class NOT extends ConstraintAdapter 012{ 013 /** 014 * Constraint to negate 015 */ 016 Constraint con; 017 018 /** 019 * Constructor with the wrapped constraint. 020 * @param con constraint to negate 021 */ 022 public NOT(Constraint con) 023 { 024 this.con = con; 025 } 026 027 /** 028 * Size is equal to the of the negated constraint 029 * @return size of the wrapped constraint 030 */ 031 @Override 032 public int getVariableSize() 033 { 034 return con.getVariableSize(); 035 } 036 037 /** 038 * Negates the satisfies value of the wrapped constraint. 039 * @param match current pattern match 040 * @param ind mapped indices 041 * @return negated value 042 */ 043 @Override 044 public boolean satisfies(Match match, int... ind) 045 { 046 return !con.satisfies(match, ind); 047 } 048}