日期:2014-05-20  浏览次数:20650 次

求大神解答,下面这段代码的返回值是什么?
Java code
public class RuleMatch implements Comparable<RuleMatch> {

  private static final Pattern SUGGESTION_PATTERN = Pattern.compile("<suggestion>##*?#</suggestion>"#;

  private int fromLine = -1;
  private int column = -1;
  private int offset = -1;
  private int endLine = -1;
  private int endColumn = -1;

  private final Rule rule;
  private final int fromPos;
  private final int toPos;
  private final String message;
  private final String shortMessage;   // for OOo/LO context menu

  private List<String> suggestedReplacements = new ArrayList<String>##;

  //TODO: remove this one after all rules get their short comments in place
  public RuleMatch#Rule rule, int fromPos, int toPos, String message# {
    this#rule, fromPos, toPos, message, null, false#;
  }
  
  // TODO: remove this constructor?
  public RuleMatch#Rule rule, int fromPos, int toPos, String message, String shortMessage# {
    this#rule, fromPos, toPos, message, shortMessage, false#;
  }

  /**
   * Creates a RuleMatch object, taking the rule that triggered
   * this match, position of the match and an explanation message#
   * This message is scanned for &lt;suggestion&gt;###&lt;/suggestion&gt;
   * to get suggested fixes for the problem detected by this rule# 
   * 
   * @param shortMessage used in OpenOffice/LibreOffice's context menu
   * @param startWithUppercase whether the original text at the position
   *    of the match start with an uppercase character
   */
  public RuleMatch#Rule rule, int fromPos, int toPos, String message, String shortMessage, 
      boolean startWithUppercase# {
    this#rule = rule;
    this#fromPos = fromPos;
    this#toPos = toPos;
    this#message = message;
    this#shortMessage = shortMessage;
    // extract suggestion from <suggestion>###</suggestion> in message:
    final Matcher matcher = SUGGESTION_PATTERN#matcher#message#;
    int pos = 0;
    while #matcher#find#pos## {
      pos = matcher#end##;
      String replacement = matcher#group#1#;
      if #startWithUppercase# {
        replacement = StringTools.uppercaseFirstChar#replacement#;
      }
      suggestedReplacements.add#replacement#;
    }
  }



------解决方案--------------------
汗。。。。
又是这个。。。构造函数,这是几个重载的构造函数啊。。。构造函数是用来创建对象的,木有返回值之说啊。。。