Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 package org.chromium.distiller.webdocument; | |
| 2 | |
| 3 public class PlaceHolder extends WebElement { | |
|
wychen
2015/08/01 01:00:20
Might need a more specific name, but not too speci
| |
| 4 | |
| 5 private String tagName; | |
| 6 private TagType tagType; | |
| 7 | |
| 8 public enum TagType { | |
| 9 START, END | |
| 10 } | |
| 11 | |
| 12 public PlaceHolder(String tagName, TagType tagType) { | |
| 13 this.tagName = tagName; | |
| 14 this.tagType = tagType; | |
| 15 } | |
| 16 | |
| 17 public boolean isStart() { | |
| 18 return tagType == TagType.START; | |
| 19 } | |
| 20 | |
| 21 public String getTagName() { | |
| 22 return tagName; | |
| 23 } | |
| 24 | |
| 25 @Override | |
| 26 public String generateOutput(boolean textOnly) { | |
| 27 if (textOnly) { | |
| 28 return ""; | |
| 29 } | |
| 30 StringBuilder sb = new StringBuilder("<"); | |
| 31 if (!isStart()) { | |
| 32 sb.append("/"); | |
| 33 } | |
| 34 sb.append(tagName.toLowerCase()).append(">"); | |
| 35 return sb.toString(); | |
|
mdjones
2015/08/03 16:57:54
I think the following is more clear:
return "<" +
| |
| 36 } | |
| 37 } | |
| OLD | NEW |