2
* This file is a contribution to the the ContentServer project, mainly for research purposes.
4
* Copyright 2009, Christian Mahnke<cmahnke@gmail.com>.
6
* Licensed under the Apache License, Version 2.0 (the “License”);
7
* you may not use this file except in compliance with the License.
8
* You may obtain a copy of the License at
10
* http://www.apache.org/licenses/LICENSE-2.0
12
* Unless required by applicable law or agreed to in writing, software
13
* distributed under the License is distributed on an “AS IS” BASIS,
14
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
* See the License for the specific language governing permissions and
16
* limitations under the License.
19
package de.unigoettingen.sub.commons.util.datasource;
21
import java.util.ArrayList;
22
import java.util.List;
25
* The Class StructureDumper. A simple class for tests and debugging.
27
public class StructureDumper {
30
List<Structure> structList = null;
33
public StructureDumper (Structure struct) {
34
structList = new ArrayList<Structure>();
35
structList.add(struct);
39
@SuppressWarnings("unchecked")
40
public StructureDumper (StructureSource structSource) {
41
this.structList = (List<Structure>) structSource.getStructureList();
49
for (Structure struct: structList) {
50
System.out.println("ROOT: " + struct.getContent());
58
* @param struct the struct
59
* @param level the level
61
protected void dump (Structure struct, Integer level) {
62
for (Structure child: struct.getChildren()) {
63
StringBuffer ident = new StringBuffer();
64
for (int i = 0; i < level; i++) {
67
System.out.println(ident.toString() + "+ " + child.getContent());
68
if (struct.getChildren().size() != 0) {
69
dump(struct, level + 1);