package ca.ubc.ece.salt.sdjsb.classify.alert;

import ca.ubc.ece.salt.sdjsb.batch.AnalysisMetaInformation;

/**
 * Alert to notify changes on the bounded context of a function call through the
 * use of .call(), .apply() or .bind(). It stores the functionName and type is
 * being used to mark whether call, apply or bind was used.
 */
public class BoundedContextAlert extends ClassifierAlert {

	public BoundedContextAlert(AnalysisMetaInformation ami, String functionName, String type) {
		super(ami, functionName, type, "BOUNDED_CONTEXT");
	}

	@Override
	public String getAlertDescription() {
		return "The function call '" + this.functionName + "' has a new bounded context.";
	}

	@Override
	public String getAlertExplanation() {
		return "The function was being called with a undesired bounded context. The repair is using call(), apply() or bind() to pass the desired context.";
	}

	@Override
	public boolean equals(Object o) {
		if (o instanceof BoundedContextAlert && super.equals(o)) {
			BoundedContextAlert wbca = (BoundedContextAlert) o;
			return this.functionName.equals(wbca.functionName);
		}
		return false;
	}

}

@@ -474,16 +474,19 @@
  String 
+sub
 type) %7B%0A
@@ -515,14 +515,8 @@
 ame,
- type,
  %22BO
@@ -524,17 +524,16 @@
 NDED
-_
 CONTEXT%22
 );%0A%09
@@ -528,16 +528,25 @@
 CONTEXT%22
+, subtype
 );%0A%09%7D%0A%0A%09
@@ -833,17 +833,16 @@
 g call()
-,
  apply()
@@ -1059,16 +1059,17 @@
 %09return 
+(
 this.fun
@@ -1103,16 +1103,54 @@
 ionName)
+ && this.subtype.equals(wbca.subtype))
 ;%0A%09%09%7D%0A%09%09

Rename BoundedContextAlert type string