Package heart

Examples of heart.State


    NodeList stateNodes =  hmlElement.getElementsByTagName(HML_STATE);
    LinkedList<State> states = new LinkedList<State>();
    for(int index = 0; index < stateNodes.getLength(); index++){
      Node mainNode  = stateNodes.item(index);
     
      State state = new State();
      Attribute attr = null;
      //check if the node is element node. It should be state Element.
      //If it is not, continue to the main node
      if (mainNode.getNodeType() == Node.ELEMENT_NODE) {
        Element stateElement = (Element) mainNode;
        if(stateElement.hasAttribute(ID)){
          state.setId(stateElement.getAttribute(ID));
         
        }
        if(stateElement.hasAttribute(NAME)){
          state.setName(stateElement.getAttribute(NAME));
        }
       
        //Get a list of state elements frm this element
        NodeList stateElements = stateElement.getChildNodes();
        StateElement stateElementObject = null;
        for(int se = 0; se < stateElements.getLength(); se++){
          Node finalStateNode  = stateElements.item(se);
          if (finalStateNode.getNodeType() == Node.ELEMENT_NODE) {
            Element finalStateElement = (Element) finalStateNode;
            if(finalStateElement.getNodeName().equals(ATTREF)){
              stateElementObject = new StateElement();
              String attrId = finalStateElement.getAttribute(REF);
              attr = model.getAttributeById(attrId);
              stateElementObject.setAttributeName(attr.getName());
            }else if(finalStateElement.getNodeName().equals(SET)){
              Type corresponginType = attr.getType();
              ArrayList<Value> values = parseValues(finalStateElement, corresponginType.getBase());
              if(values.size() > 1){
                stateElementObject.setValue(new SetValue(values));
              }else{
                stateElementObject.setValue(values.get(0));
              }
              state.addStateElement(stateElementObject);
            }
          }
        }
      }
      if(state != null) states.add(state);
View Full Code Here


      SimpleSymbolic walking = new SimpleSymbolic("walking",null,0.8f);
      activityE.setValue(walking);
     
     
     
      State XTTstate = new State();
      XTTstate.addStateElement(activityE);
      XTTstate.addStateElement(weatherE);
      XTTstate.addStateElement(userProfileE);
     
   
    System.out.println("Printing current state");
    State current = HeaRT.getWm().getCurrentState(model);
    for(StateElement se : current){
      System.out.println("Attribute "+se.getAttributeName()+" = "+se.getValue());
    }
      //TODO -
      try{
View Full Code Here

         
          activityE.setAttributeName("activity");
          activityE.setValue(new SimpleSymbolic("walking"));
         
         
          State XTTstate = new State();
          XTTstate.addStateElement(hourE);
          XTTstate.addStateElement(dayE);
          XTTstate.addStateElement(locationE);
          XTTstate.addStateElement(activityE);
         
       
        System.out.println("Printing current state");
        State current = HeaRT.getWm().getCurrentState(model);
        for(StateElement se : current){
          System.out.println("Attribute "+se.getAttributeName()+" = "+se.getValue());
        }
         
          try{
View Full Code Here

TOP

Related Classes of heart.State

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.