com.cyc.query.client.explanations.ProofViewImpl Maven / Gradle / Ivy
/*
* Copyright 2017 Cycorp, Inc..
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.cyc.query.client.explanations;
/*
* #%L
* File: ProofViewImpl.java
* Project: Query Client
* %%
* Copyright (C) 2013 - 2017 Cycorp, Inc.
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
import com.cyc.query.ProofView;
import com.cyc.query.ProofViewNode;
import java.util.HashMap;
import java.util.Map;
/**
*
* @author daves
*/
public class ProofViewImpl extends ProofViewNodeImpl implements ProofView {
// Construction
public ProofViewImpl(com.cyc.xml.query.ProofViewEntry entryJaxb, ProofViewGeneratorImpl proofView) {
super (null, entryJaxb, proofView);
}
// Public
public Map toMap() {
final Map results = new HashMap();
addNodeToMap(this, results);
return results;
}
// Private
private void addNodeToMap(ProofViewNode node, Map nodeMap) {
final ProofViewNodePath id = new ProofViewNodePathImpl(node);
nodeMap.put(id, node);
for (ProofViewNode child : node.getChildren()) {
addNodeToMap(child, nodeMap);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy