• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // © 2017 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
3 /* Copyright (C) 2008-2012 IBM Corporation and Others. All Rights Reserved. */
4 
5 package com.ibm.icu.dev.scan;
6 
7 import java.io.PrintWriter;
8 import java.util.HashMap;
9 import java.util.Map;
10 import java.util.Set;
11 import java.util.TreeSet;
12 
13 public abstract class CapElement implements CapNode {
14 	String com;
CapElement(String str)15 	CapElement(String str) {
16 		com = str;
17 	}
18 
getName()19 	public String getName() {
20 		return com;
21 	}
22 
write(PrintWriter pw, int i)23 	public abstract void write(PrintWriter pw, int i);
24 
compareTo(Object arg0)25 	public int compareTo(Object arg0) {
26 		if(arg0 == this) return 0;
27 		int str = getName().compareTo(((CapNode)arg0).getName());
28 		if(str!=0) return str;
29 
30 		if(arg0 instanceof CapElement) {
31 			CapElement oth = (CapElement)arg0;
32 			return attributes.toString().compareTo(oth.attributes.toString());
33 		}
34 		return 0;
35 	}
36 
37 	Map attributes = new HashMap();
38 	Set children = new TreeSet();
setAttribute(String k, String v)39 	public void setAttribute(String k, String v) {
40 		attributes.put(k, v);
41 
42 	}
43 
appendChild(CapNode e)44 	public void appendChild(CapNode e) {
45 		children.add(e);
46 
47 	}
48 
getNodeName()49 	public String getNodeName() {
50 		return getName();
51 	}
52 
53 }
54