Examples of FuzzyBoolean


Examples of org.aspectj.util.FuzzyBoolean

        }
      }
    }
    if (world.areInfoMessagesEnabled() && world.isTimingEnabled()) {
      long starttime = System.nanoTime();
      FuzzyBoolean isMatch = pointcut.match(shadow);
      long endtime = System.nanoTime();
      world.record(pointcut, endtime - starttime);
      return isMatch.maybeTrue();
    } else {
      FuzzyBoolean isMatch = pointcut.match(shadow);
      return isMatch.maybeTrue();
    }
  }
View Full Code Here

Examples of org.aspectj.util.FuzzyBoolean

            continue;
          }
        }
        Pointcut pointcut = munger.getPointcut();
        long starttime = System.nanoTime();
        FuzzyBoolean fb = pointcut.fastMatch(info);
        long endtime = System.nanoTime();
        world.recordFastMatch(pointcut, endtime - starttime);
        if (fb.maybeTrue()) {
          result.add(munger);
        }
      }
    } else {
      for (ShadowMunger munger : list) {
        if (typeWeaverState != null) { // will only be null if overweaving is ON and there is weaverstate
          ResolvedType declaringAspect = munger.getConcreteAspect();// getDeclaringType();
          if (typeWeaverState.isAspectAlreadyApplied(declaringAspect)) {
            continue;
          }
        }
        Pointcut pointcut = munger.getPointcut();
        FuzzyBoolean fb = pointcut.fastMatch(info);
        if (fb.maybeTrue()) {
          result.add(munger);
        }
      }
    }
    return result;
View Full Code Here

Examples of org.aspectj.util.FuzzyBoolean

      for (Iterator i = factory.getWorld().getDeclareSoft().iterator(); i.hasNext();) {
        DeclareSoft d = (DeclareSoft) i.next();
        // We need the exceptionType to match the type in the declare soft statement
        // This means it must either be the same type or a subtype
        ResolvedType throwException = factory.fromEclipse((ReferenceBinding) exceptionType);
        FuzzyBoolean isExceptionTypeOrSubtype = d.getException().matchesInstanceof(throwException);
        if (!isExceptionTypeOrSubtype.alwaysTrue())
          continue;

        if (callSite != null) {
          FuzzyBoolean match = d.getPointcut().match(callSite);
          if (match.alwaysTrue()) {
            // System.err.println("matched callSite: " + callSite + " with " + d);
            return;
          } else if (!match.alwaysFalse()) {
            // !!! need this check to happen much sooner
            // throw new RuntimeException("unimplemented, shouldn't have fuzzy match here");
          }
        }
        if (enclosingExec != null) {
          FuzzyBoolean match = d.getPointcut().match(enclosingExec);
          if (match.alwaysTrue()) {
            // System.err.println("matched enclosingExec: " + enclosingExec + " with " + d);
            return;
          } else if (!match.alwaysFalse()) {
            // !!! need this check to happen much sooner
            // throw new RuntimeException("unimplemented, shouldn't have fuzzy match here");
          }
        }
      }
View Full Code Here

Examples of org.aspectj.util.FuzzyBoolean

   */
  public final FuzzyBoolean match(Shadow shadow) {
    if (shadow.shadowId == lastMatchedShadowId) {
      return lastMatchedShadowResult;
    }
    FuzzyBoolean ret;
    // this next test will prevent a lot of un-needed matching going on....
    if (shadow.getKind().isSet(couldMatchKinds())) {
      ret = matchInternal(shadow);
    } else {
      ret = FuzzyBoolean.NO;
View Full Code Here

Examples of org.aspectj.util.FuzzyBoolean

  public FuzzyBoolean fastMatch(FastMatchInfo type) {
    return left.fastMatch(type).and(right.fastMatch(type));
  }

  protected FuzzyBoolean matchInternal(Shadow shadow) {
    FuzzyBoolean leftMatch = left.match(shadow);
    if (leftMatch.alwaysFalse()) {
      return leftMatch;
    }
    return leftMatch.and(right.match(shadow));
  }
View Full Code Here

Examples of org.aspectj.util.FuzzyBoolean

    if (ellipsisCount == 0) {
      if (nameLength != patternLength) {
        return FuzzyBoolean.NO;
      }
      FuzzyBoolean finalReturn = FuzzyBoolean.YES;
      while (patternIndex < patternLength) {
        ResolvedType t = types[nameIndex];
        FuzzyBoolean ret = null;
        try {
          if (parameterAnnotations != null) {
            t.temporaryAnnotationTypes = parameterAnnotations[nameIndex];
          }
          ret = typePatterns[patternIndex].matches(t, kind);
        } finally {
          t.temporaryAnnotationTypes = null;
        }
        patternIndex++;
        nameIndex++;
        if (ret == FuzzyBoolean.NO) {
          return ret;
        }
        if (ret == FuzzyBoolean.MAYBE) {
          finalReturn = ret;
        }
      }
      return finalReturn;
    } else if (ellipsisCount == 1) {
      if (nameLength < patternLength - 1) {
        return FuzzyBoolean.NO;
      }
      FuzzyBoolean finalReturn = FuzzyBoolean.YES;
      while (patternIndex < patternLength) {
        TypePattern p = typePatterns[patternIndex++];
        if (p == TypePattern.ELLIPSIS) {
          nameIndex = nameLength - (patternLength - patternIndex);
        } else {
          ResolvedType t = types[nameIndex];
          FuzzyBoolean ret = null;
          try {
            if (parameterAnnotations != null) {
              t.temporaryAnnotationTypes = parameterAnnotations[nameIndex];
            }
            ret = p.matches(t, kind);
          } finally {
            t.temporaryAnnotationTypes = null;
          }
          nameIndex++;
          if (ret == FuzzyBoolean.NO) {
            return ret;
          }
          if (ret == FuzzyBoolean.MAYBE) {
            finalReturn = ret;
          }
        }
      }
      return finalReturn;
    } else {
      // System.err.print("match(" + arguments + ", " + types + ") -> ");
      FuzzyBoolean b = outOfStar(typePatterns, types, 0, 0, patternLength - ellipsisCount, nameLength, ellipsisCount, kind,
          parameterAnnotations);
      // System.err.println(b);
      return b;
    }
  }
View Full Code Here

Examples of org.aspectj.util.FuzzyBoolean

  private static FuzzyBoolean outOfStar(final TypePattern[] pattern, final ResolvedType[] target, int pi, int ti, int pLeft,
      int tLeft, final int starsLeft, TypePattern.MatchKind kind, ResolvedType[][] parameterAnnotations) {
    if (pLeft > tLeft) {
      return FuzzyBoolean.NO;
    }
    FuzzyBoolean finalReturn = FuzzyBoolean.YES;
    while (true) {
      // invariant: if (tLeft > 0) then (ti < target.length && pi < pattern.length)
      if (tLeft == 0) {
        return finalReturn;
      }
      if (pLeft == 0) {
        if (starsLeft > 0) {
          return finalReturn;
        } else {
          return FuzzyBoolean.NO;
        }
      }
      if (pattern[pi] == TypePattern.ELLIPSIS) {
        return inStar(pattern, target, pi + 1, ti, pLeft, tLeft, starsLeft - 1, kind, parameterAnnotations);
      }
      FuzzyBoolean ret = null;
      try {
        if (parameterAnnotations != null) {
          target[ti].temporaryAnnotationTypes = parameterAnnotations[ti];
        }
        ret = pattern[pi].matches(target[ti], kind);
View Full Code Here

Examples of org.aspectj.util.FuzzyBoolean

      // invariant: if (tLeft > 0) then (ti < target.length)
      if (pLeft > tLeft) {
        return FuzzyBoolean.NO;
      }

      FuzzyBoolean ff = null;
      try {
        if (parameterAnnotations != null) {
          target[ti].temporaryAnnotationTypes = parameterAnnotations[ti];
        }
        ff = patternChar.matches(target[ti], kind);
      } finally {
        target[ti].temporaryAnnotationTypes = null;
      }

      if (ff.maybeTrue()) {
        FuzzyBoolean xx = outOfStar(pattern, target, pi + 1, ti + 1, pLeft - 1, tLeft - 1, starsLeft, kind,
            parameterAnnotations);
        if (xx.maybeTrue()) {
          return ff.and(xx);
        }
      }
      ti++;
      tLeft--;
View Full Code Here

Examples of org.aspectj.util.FuzzyBoolean

    if (ellipsisCount == 0) {
      if (nameLength != patternLength) {
        return FuzzyBoolean.NO;
      }
      FuzzyBoolean finalReturn = FuzzyBoolean.YES;
      while (patternIndex < patternLength) {
        ResolvedType t = types.getResolved(nameIndex);
        FuzzyBoolean ret = null;
        try {
          if (parameterAnnotations != null) {
            t.temporaryAnnotationTypes = parameterAnnotations[nameIndex];
          }
          ret = typePatterns[patternIndex].matches(t, kind);
        } finally {
          t.temporaryAnnotationTypes = null;
        }
        patternIndex++;
        nameIndex++;
        if (ret == FuzzyBoolean.NO) {
          return ret;
        }
        if (ret == FuzzyBoolean.MAYBE) {
          finalReturn = ret;
        }
      }
      return finalReturn;
    } else if (ellipsisCount == 1) {
      if (nameLength < patternLength - 1) {
        return FuzzyBoolean.NO;
      }
      FuzzyBoolean finalReturn = FuzzyBoolean.YES;
      while (patternIndex < patternLength) {
        TypePattern p = typePatterns[patternIndex++];
        if (p == TypePattern.ELLIPSIS) {
          nameIndex = nameLength - (patternLength - patternIndex);
        } else {
          ResolvedType t = types.getResolved(nameIndex);
          FuzzyBoolean ret = null;
          try {
            if (parameterAnnotations != null) {
              t.temporaryAnnotationTypes = parameterAnnotations[nameIndex];
            }
            ret = p.matches(t, kind);
          } finally {
            t.temporaryAnnotationTypes = null;
          }
          nameIndex++;
          if (ret == FuzzyBoolean.NO) {
            return ret;
          }
          if (ret == FuzzyBoolean.MAYBE) {
            finalReturn = ret;
          }
        }
      }
      return finalReturn;
    } else {
      // System.err.print("match(" + arguments + ", " + types + ") -> ");
      FuzzyBoolean b = outOfStar(typePatterns, types, 0, 0, patternLength - ellipsisCount, nameLength, ellipsisCount, kind,
          parameterAnnotations);
      // System.err.println(b);
      return b;
    }
  }
View Full Code Here

Examples of org.aspectj.util.FuzzyBoolean

  private static FuzzyBoolean outOfStar(final TypePattern[] pattern, ResolvableTypeList target, int pi, int ti, int pLeft,
      int tLeft, final int starsLeft, TypePattern.MatchKind kind, ResolvedType[][] parameterAnnotations) {
    if (pLeft > tLeft) {
      return FuzzyBoolean.NO;
    }
    FuzzyBoolean finalReturn = FuzzyBoolean.YES;
    while (true) {
      // invariant: if (tLeft > 0) then (ti < target.length && pi < pattern.length)
      if (tLeft == 0) {
        return finalReturn;
      }
      if (pLeft == 0) {
        if (starsLeft > 0) {
          return finalReturn;
        } else {
          return FuzzyBoolean.NO;
        }
      }
      if (pattern[pi] == TypePattern.ELLIPSIS) {
        return inStar(pattern, target, pi + 1, ti, pLeft, tLeft, starsLeft - 1, kind, parameterAnnotations);
      }
      FuzzyBoolean ret = null;
      ResolvedType type = target.getResolved(ti);
      try {
        if (parameterAnnotations != null) {
          type.temporaryAnnotationTypes = parameterAnnotations[ti];
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.