<commit_before>/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.umd.cs.findbugs.ba.obl;

import edu.umd.cs.findbugs.util.ExactStringMatcher;
import edu.umd.cs.findbugs.util.StringMatcher;
import edu.umd.cs.findbugs.util.SubtypeTypeMatcher;
import edu.umd.cs.findbugs.util.TypeMatcher;
import java.util.Collection;
import org.apache.bcel.generic.ObjectType;
import org.apache.bcel.generic.ReferenceType;

/**
 *
 * @author daveho
 */
public class MatchMethodEntry implements ObligationPolicyDatabaseEntry {

	private final TypeMatcher receiverType;
	private final StringMatcher methodName;
	private final StringMatcher signature;
	private final boolean isStatic;
	private final ObligationPolicyDatabaseActionType action;
	private final Obligation obligation;
	
	public MatchMethodEntry(
			String receiverType,
			String methodName,
			String signature,
			boolean isStatic,
			ObligationPolicyDatabaseActionType action,
			Obligation obligation
		) {
		this(
			new SubtypeTypeMatcher(new ObjectType(receiverType)),
			new ExactStringMatcher(methodName),
			new ExactStringMatcher(signature),
			isStatic,
			action,
			obligation);
	}

	public MatchMethodEntry(
			TypeMatcher receiverType,<commit_msg>Added header comment, javadoc<commit_after>/*
 * FindBugs - Find bugs in Java programs
 * Copyright (C) 2008, University of Maryland
 * 
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 * 
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
package edu.umd.cs.findbugs.ba.obl;

import edu.umd.cs.findbugs.util.ExactStringMatcher;
import edu.umd.cs.findbugs.util.StringMatcher;
import edu.umd.cs.findbugs.util.SubtypeTypeMatcher;
import edu.umd.cs.findbugs.util.TypeMatcher;
import java.util.Collection;
import org.apache.bcel.generic.ObjectType;
import org.apache.bcel.generic.ReferenceType;

/**
 * An ObligationPolicyDatabaseEntry which creates or deletes
 * an obligation based on a call to a specified method.
 * 
 * @author <NAME>
 */
public class MatchMethodEntry implements ObligationPolicyDatabaseEntry {

	private final TypeMatcher receiverType;
	private final StringMatcher methodName;
	private final StringMatcher signature;
	private final boolean isStatic;
	private final ObligationPolicyDatabaseActionType action;
	private final Obligation obligation;
	
	/**
	 * Constructor.
	 * 
	 * @param receiverType the method receiver type (or class containing a static method)
	 * @param methodName   exact name of the method
	 * @param signature    exact method signature
	 * @param isStatic     true if matched method must be static, false otherwise
	 * @param action       ActionType (ADD or DEL, depending on whether obligation is added or deleted)
	 * @param obligation   Obligation to be added or deleted
	 */
	public MatchMethodEntry(
			String receiverType,
			String methodName,
			String signature,
			boolean isStatic,
			ObligationPolicyDatabaseActionType action,
			Obligation obligation
		) {
		this(
			new SubtypeTypeMatcher(new ObjectType(receiverType)),
			new ExactStringMatcher(methodName),
			new ExactStringMatcher(signature),
			isStatic,
			action,
			obligation);
	}

	/**
	 * Constructor.
	 * 
	 * @param receiverType TypeMatcher to match the receiver type (or class containing static method)
	 * @param methodName   StringMatcher to match name of called method
	 * @param signature    StringMatcher to match signature of called method
	 * @param isStatic     true if matched method must be static, false otherwise
	 * @param action       ActionType (ADD or DEL, depending on whether obligation is added or deleted)
	 * @param obligation   Obligation to be added or deleted
	 */
	public MatchMethodEntry(
			TypeMatcher receiverType,
{'fraction_non_alphanumeric': 0.06594916418594, 'fraction_numerical': 0.004579803068468056, 'mean_word_length': 4.352941176470588, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7321145', 'n_tokens_mistral': 1284, 'n_tokens_neox': 1164, 'n_words': 437}