Package org.aspectj.util

Examples of org.aspectj.util.FuzzyBoolean


 
  public Question anyChanges() {
    for (Iterator i = questionsAndAnswers.entrySet().iterator(); i.hasNext(); ) {
      Map.Entry entry = (Map.Entry)i.next();
      Question question = (Question)entry.getKey();
      FuzzyBoolean expectedAnswer = (FuzzyBoolean)entry.getValue();
     
      FuzzyBoolean currentAnswer = question.ask();
      //System.out.println(question + ":" + currentAnswer);
      if (currentAnswer != expectedAnswer) {
        return question;
      }
    }
View Full Code Here


    StringBuffer buf = new StringBuffer();
    buf.append("TypePatternQuestions{");
    for (Iterator i = questionsAndAnswers.entrySet().iterator(); i.hasNext(); ) {
      Map.Entry entry = (Map.Entry)i.next();
      Question question = (Question)entry.getKey();
      FuzzyBoolean expectedAnswer = (FuzzyBoolean)entry.getValue();
      buf.append(question);
      buf.append(":");
      buf.append(expectedAnswer);
      buf.append(", ");
    }
View Full Code Here

    }
  }
  public abstract FuzzyBoolean matchesInstanceof(ResolvedType type)
 
  public final FuzzyBoolean matches(ResolvedType type, MatchKind kind) {
    FuzzyBoolean typeMatch = null;
    //??? This is part of gracefully handling missing references
    if (type.isMissing()) return FuzzyBoolean.NO;
   
    if (kind == STATIC) {
//      typeMatch = FuzzyBoolean.fromBoolean(matchesStatically(type));
View Full Code Here

    if (numArgsMatchedByEllipsis < 0) return FuzzyBoolean.NO;
    if ((numArgsMatchedByEllipsis > 0) && (ellipsisCount == 0)) {
      return FuzzyBoolean.NO;
    }
    // now work through the args and the patterns, skipping at ellipsis
      FuzzyBoolean ret = FuzzyBoolean.YES;
      int argsIndex = 0;
      for (int i = 0; i < typePatterns.length; i++) {
      if (typePatterns[i] == AnnotationTypePattern.ELLIPSIS) {
        // match ellipsisMatchCount args
        argsIndex += numArgsMatchedByEllipsis;
      } else if (typePatterns[i] == AnnotationTypePattern.ANY) {
        argsIndex++;
      } else {
        // match the argument type at argsIndex with the ExactAnnotationTypePattern
        // we know it is exact because nothing else is allowed in args
        if (someArgs[argsIndex].isPrimitiveType()) return FuzzyBoolean.NO; // can never match
        ExactAnnotationTypePattern ap = (ExactAnnotationTypePattern)typePatterns[i];
        FuzzyBoolean matches = ap.matchesRuntimeType(someArgs[argsIndex]);
        if (matches == FuzzyBoolean.NO) {
          return FuzzyBoolean.MAYBE;  // could still match at runtime
        } else {
          argsIndex++;
          ret = ret.and(matches);
View Full Code Here

    int nameIndex = 0;
    int patternIndex = 0;
   
    if (ellipsisCount == 0) {
      if (nameLength != patternLength) return FuzzyBoolean.NO;
      FuzzyBoolean finalReturn = FuzzyBoolean.YES;
      while (patternIndex < patternLength) {
        FuzzyBoolean ret = typePatterns[patternIndex++].matches(types[nameIndex++], kind);
        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 {
          FuzzyBoolean ret = p.matches(types[nameIndex++], kind);
            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);
//            System.err.println(b);
            return b;
      }
    }
View Full Code Here

    private static FuzzyBoolean outOfStar(final TypePattern[] pattern, final ResolvedType[] target,
                                                  int           pi,            int    ti,
                                                  int           pLeft,         int    tLeft,
                                           final int           starsLeft, TypePattern.MatchKind kind) {
        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);
            }
            FuzzyBoolean ret = pattern[pi].matches(target[ti], kind);
            if (ret == FuzzyBoolean.NO) return ret;
            if (ret == FuzzyBoolean.MAYBE) finalReturn = ret;
            pi++; ti++; pLeft--; tLeft--;
        }
    }   
View Full Code Here

            patternChar = pattern[++pi];
        }
        while (true) {
            // invariant: if (tLeft > 0) then (ti < target.length)
            if (pLeft > tLeft) return FuzzyBoolean.NO;
            FuzzyBoolean ff = patternChar.matches(target[ti], kind);
            if (ff.maybeTrue()) {
                FuzzyBoolean xx = outOfStar(pattern, target, pi+1, ti+1, pLeft-1, tLeft-1, starsLeft, kind);
                if (xx.maybeTrue()) return ff.and(xx);
            }
            ti++; tLeft--;
        }
    }
View Full Code Here

TOP

Related Classes of org.aspectj.util.FuzzyBoolean

Copyright © 2018 www.massapicom. 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.