1 package com.puppycrawl.tools.checkstyle.checks.javadoc; 20 21 26 class HtmlTag 27 { 28 29 private static final int MAX_TEXT_LEN = 60; 30 31 32 private final String mId; 33 34 35 private final int mLineNo; 36 37 38 private final int mPosition; 39 40 41 private final String mText; 42 43 44 private final boolean mClosedTag; 45 46 47 private final boolean mIncomplete; 48 49 58 HtmlTag(String aId, int aLineNo, int aPosition, boolean aClosedTag, 59 boolean aIncomplete, String aText) 60 { 61 mId = (!"".equals(aId) && (aId.charAt(0) == '/')) 62 ? aId.substring(1) : aId; 63 mLineNo = aLineNo; 64 mPosition = aPosition; 65 mText = aText; 66 mClosedTag = aClosedTag; 67 mIncomplete = aIncomplete; 68 } 69 70 74 public String getId() 75 { 76 return mId; 77 } 78 79 83 public boolean isCloseTag() 84 { 85 if (mPosition == (mText.length() - 1)) { 86 return false; 87 } 88 return (mText.charAt(mPosition + 1) == '/'); 89 } 90 91 95 public boolean isClosedTag() 96 { 97 return mClosedTag; 98 } 99 100 104 public boolean isIncompleteTag() 105 { 106 return mIncomplete; 107 } 108 109 114 public int getLineno() 115 { 116 return mLineNo; 117 } 118 119 124 public int getPosition() 125 { 126 return mPosition; 127 } 128 129 134 public String toString() 135 { 136 final int startOfText = mPosition; 137 final int endOfText = 138 Math.min(startOfText + HtmlTag.MAX_TEXT_LEN, mText.length()); 139 return mText.substring(startOfText, endOfText); 140 } 141 } 142 | Popular Tags |