Android Open Source - sodf Functions Node






From Project

Back to project page sodf.

License

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.

Java Source Code

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);
  }
  
}




Java Source Code List

lal.apps.ontap.MainActivity.java
lal.apps.ontap.WifiVocabulary.java
lal.apps.smartfoodenvironment.activities.ExpiredActivity.java
lal.apps.smartfoodenvironment.activities.FactoryActivity.java
lal.apps.smartfoodenvironment.activities.MicrowaveActivity.java
lal.apps.smartfoodenvironment.activities.StartActivity.java
lal.apps.smartfoodenvironment.model.MicrowaveVocabulary.java
lal.apps.smartfoodenvironment.model.ProductFactory.java
lal.apps.smartfoodenvironment.model.ProductVocabulary.java
lal.sodf.example.MainActivity.java
lal.sodf.framework.SodfCallback.java
lal.sodf.framework.SodfCallback.java
lal.sodf.framework.SodfCallback.java
lal.sodf.framework.SodfFramework.java
lal.sodf.framework.SodfFramework.java
lal.sodf.framework.SodfFramework.java
lal.sodf.framework.SodfWrapper.java
lal.sodf.framework.SodfWrapper.java
lal.sodf.framework.SodfWrapper.java
lal.sodf.framework.compressor.CompressionAlgorithm.java
lal.sodf.framework.compressor.CompressionAlgorithm.java
lal.sodf.framework.compressor.CompressionAlgorithm.java
lal.sodf.framework.compressor.Compressor.java
lal.sodf.framework.compressor.Compressor.java
lal.sodf.framework.compressor.Compressor.java
lal.sodf.framework.compressor.Gzip.java
lal.sodf.framework.compressor.Gzip.java
lal.sodf.framework.compressor.Gzip.java
lal.sodf.framework.exceptions.CompressionAlgorithmNotFoundException.java
lal.sodf.framework.exceptions.CompressionAlgorithmNotFoundException.java
lal.sodf.framework.exceptions.CompressionAlgorithmNotFoundException.java
lal.sodf.framework.exceptions.DuplicateKeyException.java
lal.sodf.framework.exceptions.DuplicateKeyException.java
lal.sodf.framework.exceptions.DuplicateKeyException.java
lal.sodf.framework.exceptions.MalformedTypeException.java
lal.sodf.framework.exceptions.MalformedTypeException.java
lal.sodf.framework.exceptions.MalformedTypeException.java
lal.sodf.framework.exceptions.TagEmptyException.java
lal.sodf.framework.exceptions.TagEmptyException.java
lal.sodf.framework.exceptions.TagEmptyException.java
lal.sodf.framework.exceptions.UnformattedTagException.java
lal.sodf.framework.exceptions.UnformattedTagException.java
lal.sodf.framework.exceptions.UnformattedTagException.java
lal.sodf.framework.nfc.NfcContentWrapper.java
lal.sodf.framework.nfc.NfcContentWrapper.java
lal.sodf.framework.nfc.NfcContentWrapper.java
lal.sodf.framework.nfc.NfcHandler.java
lal.sodf.framework.nfc.NfcHandler.java
lal.sodf.framework.nfc.NfcHandler.java
lal.sodf.framework.ontology.FunctionsNode.java
lal.sodf.framework.ontology.FunctionsNode.java
lal.sodf.framework.ontology.FunctionsNode.java
lal.sodf.framework.ontology.KeyNode.java
lal.sodf.framework.ontology.KeyNode.java
lal.sodf.framework.ontology.KeyNode.java
lal.sodf.framework.ontology.KeyValueNode.java
lal.sodf.framework.ontology.KeyValueNode.java
lal.sodf.framework.ontology.KeyValueNode.java
lal.sodf.framework.ontology.MetadataNode.java
lal.sodf.framework.ontology.MetadataNode.java
lal.sodf.framework.ontology.MetadataNode.java
lal.sodf.framework.ontology.Node.java
lal.sodf.framework.ontology.Node.java
lal.sodf.framework.ontology.Node.java
lal.sodf.framework.ontology.PropertiesNode.java
lal.sodf.framework.ontology.PropertiesNode.java
lal.sodf.framework.ontology.PropertiesNode.java
lal.sodf.framework.ontology.RestInteractionNode.java
lal.sodf.framework.ontology.RestInteractionNode.java
lal.sodf.framework.ontology.RestInteractionNode.java
lal.sodf.framework.ontology.RestParameters.java
lal.sodf.framework.ontology.RestParameters.java
lal.sodf.framework.ontology.RestParameters.java
lal.sodf.framework.ontology.SodfTree.java
lal.sodf.framework.ontology.SodfTree.java
lal.sodf.framework.ontology.SodfTree.java
lal.sodf.framework.ontology.SodfVocabulary.java
lal.sodf.framework.ontology.SodfVocabulary.java
lal.sodf.framework.ontology.SodfVocabulary.java
lal.sodf.framework.parser.SodfParser.java
lal.sodf.framework.parser.SodfParser.java
lal.sodf.framework.parser.SodfParser.java