Skip to content

Commit

Permalink
update javadoc
Browse files Browse the repository at this point in the history
  • Loading branch information
nimakarimipour committed Oct 4, 2024
1 parent 4d2620a commit 6de3d0e
Showing 1 changed file with 18 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

package edu.ucr.cs.riple.core.registries.index;

import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableSet;
import edu.ucr.cs.riple.injector.Helper;
import edu.ucr.cs.riple.injector.changes.ASTChange;
Expand Down Expand Up @@ -67,7 +68,7 @@ public Set<Location> toLocations() {
}

/**
* Checks if fix is targeting a method.
* Checks if fix contains only one change and the change is on a method.
*
* @return true, if fix is targeting a method.
*/
Expand All @@ -76,11 +77,14 @@ public boolean isOnMethod() {
}

/**
* Returns the targeted method information.
* Returns the targeted method location if this fix contains only one change and that change is on
* method.
*
* @return Target method information.
*/
public OnMethod toMethod() {
Preconditions.checkArgument(
isOnMethod(), "This fix contains more than one change or the change is not on method.");
return changes.iterator().next().getLocation().toMethod();
}

Expand All @@ -96,7 +100,7 @@ public void ifOnMethod(Consumer<OnMethod> consumer) {
}

/**
* Checks if fix is targeting a parameter.
* Checks if fix contains only one change and the change is on a parameter.
*
* @return true, if fix is targeting a parameter.
*/
Expand All @@ -105,11 +109,15 @@ public boolean isOnParameter() {
}

/**
* Returns the targeted parameter information.
* Returns the targeted parameter location if this fix contains only one change and that change is
* on a parameter.
*
* @return Target method parameter.
*/
public OnParameter toParameter() {
Preconditions.checkArgument(
isOnParameter(),
"This fix contains more than one change or the change is not on parameter.");
return changes.iterator().next().getLocation().toParameter();
}

Expand All @@ -125,7 +133,7 @@ public void ifOnParameter(Consumer<OnParameter> consumer) {
}

/**
* Checks if fix is targeting a field.
* Checks if fix contains only one change and the change is on a field.
*
* @return true, if fix is targeting a field.
*/
Expand All @@ -134,11 +142,14 @@ public boolean isOnField() {
}

/**
* Returns the targeted field information.
* Returns the targeted field location if this fix contains only one change and that change is on
* a field.
*
* @return Target field information.
*/
public OnField toField() {
Preconditions.checkArgument(
isOnField(), "This fix contains more than one change or the change is not on field.");
return changes.iterator().next().getLocation().toField();
}

Expand Down Expand Up @@ -180,7 +191,7 @@ public JSONObject getJson() {
}

/**
* Checks if fix is modifying constructor (parameter or method).
* Checks if fix is a single change and is modifying constructor (parameter or method).
*
* @return true, if fix is modifying constructor.
*/
Expand Down

0 comments on commit 6de3d0e

Please sign in to comment.