comparison src/fschmidt/html/HtmlNode.java @ 68:00520880ad02

add fschmidt source
author Franklin Schmidt <fschmidt@gmail.com>
date Sun, 05 Oct 2025 17:24:15 -0600
parents
children
comparison
equal deleted inserted replaced
67:9d0fefce6985 68:00520880ad02
1 package fschmidt.html;
2
3
4 public final class HtmlNode extends HtmlTag {
5 public final Html children;
6
7 public HtmlNode(HtmlTag tag,Html children) {
8 super(tag);
9 if( tag.isEmpty() )
10 throw new RuntimeException();
11 this.children = children;
12 }
13
14 @Override public String toString() {
15 return super.toString() + children + "</" + getName() + ">";
16 }
17
18 @Override public boolean equals(Object obj) {
19 if( !super.equals(obj) )
20 return false;
21 if( !(obj instanceof HtmlNode) )
22 return false;
23 HtmlNode node = (HtmlNode)obj;
24 return children.equals(node.children);
25 }
26
27 void flattenTo(Html html) {
28 html.add( new HtmlTag(this) );
29 children.flattenTo(html);
30 html.add( new HtmlTag( "/" + getName() ) );
31 }
32 }