Back to project page sodf.
The source code is released under:
Copyright (c) 2013 Lorenz Lehmann Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Sof...
If you think the Android project sodf listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package lal.sodf.framework.ontology; /*from w ww.j av a2 s . c o m*/ import java.util.List; /** * The node which is the root of the functions section * @author Lorenz Lehmann * */ public class FunctionsNode extends KeyNode { /** Create a new functions node, which serves as root of the functions section */ public FunctionsNode(KeyNode _parent) { super(_parent, SodfVocabulary.SODF_FUNCTIONS); } /** Create a new functions node, which serves as root of the functions section */ public FunctionsNode() { super(SodfVocabulary.SODF_FUNCTIONS); } /** * Add a new function to the functions subtree * @param functionKey The key of the new function * @param interactions A list of nodes, which will be added as children of the node with key "sodf/interactions" * @param name The name of this function * @param description A description for this function * @return True on success, false on error, i.e. if a function with the same functionKey already exists */ public boolean addNewFunction(String functionKey, List<Node> interactions, String name, String description){ KeyNode functionRoot = new KeyNode(functionKey); //add the interactions KeyNode interactionsRoot = new KeyNode(SodfVocabulary.SODF_INTERACTION); interactionsRoot.addChildren(interactions); functionRoot.addChild(interactionsRoot); //add name and description as key, value pairs functionRoot.addChild(new KeyValueNode(SodfVocabulary.SODF_NAME, name)); functionRoot.addChild(new KeyValueNode(SodfVocabulary.SODF_DESCRIPTION, description)); //try adding the new function to the functions node return this.addChild(functionRoot); } /** * Add a new function to the functions subtree * @param functionKey The key of the new function * @param interactions A list of nodes, which will be added as children of the node with key "sodf/interactions" * @param name The name of this function * @return True on success, false on error, i.e. if a function with the same functionKey already exists */ public boolean addNewFunction(String functionKey, List<Node> interactions, String name){ KeyNode functionRoot = new KeyNode(functionKey); //add the interactions KeyNode interactionsRoot = new KeyNode(SodfVocabulary.SODF_INTERACTION); interactionsRoot.addChildren(interactions); functionRoot.addChild(interactionsRoot); //add the name as key, value pair functionRoot.addChild(new KeyValueNode(SodfVocabulary.SODF_NAME, name)); //try adding the new function to the functions node return this.addChild(functionRoot); } /** * Add a new function to the functions subtree * @param functionKey The key of the new function * @param interactions A list of nodes, which will be added as children of the node with key "sodf/interactions" * @return True on success, false on error, i.e. if a function with the same functionKey already exists */ public boolean addNewFunction(String functionKey, List<Node> interactions){ KeyNode functionRoot = new KeyNode(functionKey); //add the interactions KeyNode interactionsRoot = new KeyNode(SodfVocabulary.SODF_INTERACTION); interactionsRoot.addChildren(interactions); functionRoot.addChild(interactionsRoot); //try adding the new function to the functions node return this.addChild(functionRoot); } /** * Add a new function to the functions subtree * @param functionKey The key of the new function * @param interactions A RestInteractionNode, which will be added as children of the node with key "sodf/interactions" * @param name The name of this function * @param description A description for this function * @return True on success, false on error, i.e. if a function with the same functionKey already exists */ public boolean addNewRestFunction(String functionKey, RestInteractionNode restInteraction, String name, String description){ KeyNode functionRoot = new KeyNode(functionKey); //add the interactions functionRoot.addChild(restInteraction); //add name and description as key, value pairs functionRoot.addChild(new KeyValueNode(SodfVocabulary.SODF_NAME, name)); functionRoot.addChild(new KeyValueNode(SodfVocabulary.SODF_DESCRIPTION, description)); //try adding the new function to the functions node return this.addChild(functionRoot); } /** * Add a new function to the functions subtree * @param functionKey The key of the new function * @param interactions A RestInteractionNode, which will be added as children of the node with key "sodf/interactions" * @param name The name of this function * @return True on success, false on error, i.e. if a function with the same functionKey already exists */ public boolean addNewRestFunction(String functionKey, RestInteractionNode restInteraction, String name){ KeyNode functionRoot = new KeyNode(functionKey); //add the interactions functionRoot.addChild(restInteraction); //add the name as key, value pair functionRoot.addChild(new KeyValueNode(SodfVocabulary.SODF_NAME, name)); //try adding the new function to the functions node return this.addChild(functionRoot); } /** * Add a new function to the functions subtree * @param functionKey The key of the new function * @param interactions A RestInteractionNode, which will be added as children of the node with key "sodf/interactions" * @return True on success, false on error, i.e. if a function with the same functionKey already exists */ public boolean addNewRestFunction(String functionKey, RestInteractionNode restInteraction){ KeyNode functionRoot = new KeyNode(functionKey); //add the interactions functionRoot.addChild(restInteraction); //try adding the new function to the functions node return this.addChild(functionRoot); } }