2009-08-11 sponge
* Code Janitor time! Many fixes and documenting fixes that should be done in the future. for the most part, this is a general code cleanup. * On smaller/embedded systems, the "final" keyword cleanups will have more of an impact than on larger systems. * Document missing hashCode() methods. * Unhide more variables to make code easier to read.
This commit is contained in:
@ -5,10 +5,10 @@
|
||||
* Copyright (C) Satoshi Konno 2002
|
||||
*
|
||||
* File: StateVariable.java
|
||||
*
|
||||
* Revision;
|
||||
*
|
||||
* 12/06/02
|
||||
*
|
||||
* Revision;
|
||||
*
|
||||
* 12/06/02
|
||||
* - first revision.
|
||||
* 06/17/03
|
||||
* - Added setSendEvents(), isSendEvents().
|
||||
@ -41,28 +41,28 @@
|
||||
* - Changed getAllowedValueList() to use AllowedValue instead of String as the member.
|
||||
*
|
||||
******************************************************************/
|
||||
|
||||
package org.cybergarage.upnp;
|
||||
|
||||
import org.cybergarage.xml.*;
|
||||
|
||||
package org.cybergarage.upnp;
|
||||
|
||||
import org.cybergarage.xml.*;
|
||||
import org.cybergarage.util.*;
|
||||
|
||||
import org.cybergarage.upnp.control.*;
|
||||
import org.cybergarage.upnp.xml.*;
|
||||
|
||||
public class StateVariable extends NodeData
|
||||
{
|
||||
////////////////////////////////////////////////
|
||||
// Constants
|
||||
////////////////////////////////////////////////
|
||||
|
||||
public final static String ELEM_NAME = "stateVariable";
|
||||
|
||||
////////////////////////////////////////////////
|
||||
// Member
|
||||
////////////////////////////////////////////////
|
||||
|
||||
private Node stateVariableNode;
|
||||
|
||||
public class StateVariable extends NodeData
|
||||
{
|
||||
////////////////////////////////////////////////
|
||||
// Constants
|
||||
////////////////////////////////////////////////
|
||||
|
||||
public final static String ELEM_NAME = "stateVariable";
|
||||
|
||||
////////////////////////////////////////////////
|
||||
// Member
|
||||
////////////////////////////////////////////////
|
||||
|
||||
private Node stateVariableNode;
|
||||
private Node serviceNode;
|
||||
|
||||
public Node getServiceNode()
|
||||
@ -72,73 +72,73 @@ public class StateVariable extends NodeData
|
||||
|
||||
public Service getService()
|
||||
{
|
||||
Node serviceNode = getServiceNode();
|
||||
if (serviceNode == null)
|
||||
Node _serviceNode = getServiceNode();
|
||||
if (_serviceNode == null)
|
||||
return null;
|
||||
return new Service(serviceNode);
|
||||
return new Service(_serviceNode);
|
||||
}
|
||||
|
||||
public Node getStateVariableNode()
|
||||
{
|
||||
return stateVariableNode;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////
|
||||
// Constructor
|
||||
////////////////////////////////////////////////
|
||||
|
||||
|
||||
public Node getStateVariableNode()
|
||||
{
|
||||
return stateVariableNode;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////
|
||||
// Constructor
|
||||
////////////////////////////////////////////////
|
||||
|
||||
public StateVariable()
|
||||
{
|
||||
this.serviceNode = null;
|
||||
this.stateVariableNode = new Node();
|
||||
}
|
||||
|
||||
public StateVariable(Node serviceNode, Node stateVarNode)
|
||||
public StateVariable(Node serviceNode, Node stateVarNode)
|
||||
{
|
||||
this.serviceNode = serviceNode;
|
||||
this.stateVariableNode = stateVarNode;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////
|
||||
// isStateVariableNode
|
||||
////////////////////////////////////////////////
|
||||
|
||||
public static boolean isStateVariableNode(Node node)
|
||||
{
|
||||
return StateVariable.ELEM_NAME.equals(node.getName());
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////
|
||||
// name
|
||||
////////////////////////////////////////////////
|
||||
|
||||
private final static String NAME = "name";
|
||||
|
||||
public void setName(String value)
|
||||
{
|
||||
getStateVariableNode().setNode(NAME, value);
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return getStateVariableNode().getNodeValue(NAME);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////
|
||||
// dataType
|
||||
////////////////////////////////////////////////
|
||||
|
||||
private final static String DATATYPE = "dataType";
|
||||
|
||||
public void setDataType(String value)
|
||||
{
|
||||
getStateVariableNode().setNode(DATATYPE, value);
|
||||
}
|
||||
|
||||
public String getDataType()
|
||||
{
|
||||
return getStateVariableNode().getNodeValue(DATATYPE);
|
||||
}
|
||||
this.serviceNode = serviceNode;
|
||||
this.stateVariableNode = stateVarNode;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////
|
||||
// isStateVariableNode
|
||||
////////////////////////////////////////////////
|
||||
|
||||
public static boolean isStateVariableNode(Node node)
|
||||
{
|
||||
return StateVariable.ELEM_NAME.equals(node.getName());
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////
|
||||
// name
|
||||
////////////////////////////////////////////////
|
||||
|
||||
private final static String NAME = "name";
|
||||
|
||||
public void setName(String value)
|
||||
{
|
||||
getStateVariableNode().setNode(NAME, value);
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return getStateVariableNode().getNodeValue(NAME);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////
|
||||
// dataType
|
||||
////////////////////////////////////////////////
|
||||
|
||||
private final static String DATATYPE = "dataType";
|
||||
|
||||
public void setDataType(String value)
|
||||
{
|
||||
getStateVariableNode().setNode(DATATYPE, value);
|
||||
}
|
||||
|
||||
public String getDataType()
|
||||
{
|
||||
return getStateVariableNode().getNodeValue(DATATYPE);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////
|
||||
// dataType
|
||||
@ -301,8 +301,8 @@ public class StateVariable extends NodeData
|
||||
queryRes.setResponse(retVar);
|
||||
}
|
||||
else {
|
||||
UPnPStatus upnpStatus = retVar.getStatus();
|
||||
queryRes.setFaultResponse(upnpStatus.getCode(), upnpStatus.getDescription());
|
||||
UPnPStatus _upnpStatus = retVar.getStatus();
|
||||
queryRes.setFaultResponse(_upnpStatus.getCode(), _upnpStatus.getDescription());
|
||||
}
|
||||
queryReq.post(queryRes);
|
||||
return true;
|
||||
|
Reference in New Issue
Block a user