public void setParameter(String name, String value) throws ParseException { super.setParameter(name,value); }
public Object clone() { PVisitedNetworkID retval = (PVisitedNetworkID) super.clone(); if (this.networkID != null) retval.networkID = this.networkID; retval.isQuoted = this.isQuoted; return retval; }
public boolean equals(Object other) { return (other instanceof PAccessNetworkInfoHeader) && super.equals(other); }
/** * Set the q value * @param qValue float to set * @throws IllegalArgumentException if qValue is <0.0 or >1.0 */ public void setQValue(float qValue) throws InvalidArgumentException { if (qValue == -1) super.removeParameter(ParameterNames.Q); super.setParameter(ParameterNames.Q, qValue); }
/** * Get the parameter as a long value. * * @param parameterName -- the parameter name to fetch. * * @return -1 if the parameter is not defined or the parameter as a long. */ protected long getParameterAsLong(String parameterName) { if (this.getParameterValue(parameterName) != null) { try { if (this.getParameterValue(parameterName) instanceof String) { return Long.parseLong(this.getParameter(parameterName)); } else { return ((Long) getParameterValue(parameterName)) .longValue(); } } catch (NumberFormatException ex) { return -1; } } else return -1; }
protected void parseNameValueList(ParametersHeader parametersHeader) throws ParseException{ parametersHeader.removeParameters(); while (true) { this.lexer.SPorHT(); NameValue nv = nameValue(); parametersHeader.setParameter(nv.getName(), (String) nv.getValueAsObject()); // eat white space this.lexer.SPorHT(); if (lexer.lookAhead(0) != ';') break; else lexer.consume(1); } } }
/** * * @param name -- * parameter name * @param value -- * value of parameter */ public void setParameter(String name, Object value) { /** * @todo ParametersHeader needs to be fix!? missing "throws * ParseException" in setParameter(String, Object) */ if (name.equalsIgnoreCase(ParameterNamesIms.CGI_3GPP) || name.equalsIgnoreCase(ParameterNamesIms.UTRAN_CELL_ID_3GPP) || name.equalsIgnoreCase(ParameterNamesIms.DSL_LOCATION) || name.equalsIgnoreCase(ParameterNamesIms.CI_3GPP2)) { try { super.setQuotedParameter(name, value.toString()); } catch (ParseException e) { } } else { // value can be token either than a quoted-string super.setParameter(name, value); } }
@SuppressWarnings("unchecked") protected final boolean equalParameters( Parameters other ) { if (this==other) return true; for ( Iterator i = this.getParameterNames(); i.hasNext();) { String pname = (String) i.next(); String p1 = this.getParameter( pname ); String p2 = other.getParameter( pname ); // getting them based on this.getParameterNames. Note that p1 may be null // if this is a name-only parameter like rport or lr. if (p1 == null ^ p2 == null) return false; else if (p1 != null && !p1.equalsIgnoreCase(p2) ) return false; } // Also compare other's parameters; some duplicate testing here... for ( Iterator i = other.getParameterNames(); i.hasNext();) { String pname = (String) i.next(); String p1 = other.getParameter( pname ); String p2 = this.getParameter( pname ); // assert( p1 != null ); // if ( p1 == null ) throw new RuntimeException("Assertion check failed!"); // if (p2==null) return false; // getting them based on this.getParameterNames. Note that p1 may be null // if this is a name-only parameter like rport or lr. if (p1 == null ^ p2 == null) return false; else if (p1 != null && !p1.equalsIgnoreCase(p2) ) return false; } return true; }
/** remove duration field */ public void removeDuration() { super.removeParameter(DURATION); }
/** * Get the parameter value as a boolean. * * @param parameterName -- the parameter name * @return boolean value of the parameter. */ protected boolean getParameterAsBoolean(String parameterName) { Object val = getParameterValue(parameterName); if (val == null) { return false; } else if (val instanceof Boolean) { return ((Boolean) val).booleanValue(); } else if (val instanceof String) { return Boolean.valueOf((String) val).booleanValue(); } else return false; }
/** * Return true if the q value has been set. * @return boolean */ public boolean hasQValue() { return super.hasParameter(ParameterNames.Q); }
public Iterator getParameterNames() { return super.getParameterNames(); }
public String getParameter(String name) { return super.getParameter(name); }
/** * Gets the duration value of the RetryAfterHeader. This duration value * is relative time. * * @return the duration value of the RetryAfterHeader, return zero if not * set. * */ public int getDuration() { if (this.getParameter(DURATION) == null) return -1; else return super.getParameterAsInt(DURATION); } }
protected void parseNameValueList(ParametersHeader parametersHeader) throws ParseException{ parametersHeader.removeParameters(); while (true) { this.lexer.SPorHT(); NameValue nv = nameValue(); parametersHeader.setParameter(nv.getName(), (String) nv.getValueAsObject()); // eat white space this.lexer.SPorHT(); if (lexer.lookAhead(0) != ';') break; else lexer.consume(1); } } }
/** * Get the parameter as an integer value. * * @param parameterName -- the parameter name to fetch. * * @return -1 if the parameter is not defined in the header. */ protected int getParameterAsInt(String parameterName) { if (this.getParameterValue(parameterName) != null) { try { if (this.getParameterValue(parameterName) instanceof String) { return Integer.parseInt(this.getParameter(parameterName)); } else { return ((Integer) getParameterValue(parameterName)) .intValue(); } } catch (NumberFormatException ex) { return -1; } } else return -1; }
/** *Remove the q value. */ public void removeQValue() { super.removeParameter(ParameterNames.Q); }
/** * Get the parameter value as a URI. * * @param parameterName -- the parameter name * * @return value of the parameter as a URI or null if the parameter * not present. */ protected GenericURI getParameterAsURI(String parameterName) { Object val = getParameterValue(parameterName); if (val instanceof GenericURI) return (GenericURI) val; else { try { return new GenericURI((String) val); } catch (ParseException ex) { //catch ( URISyntaxException ex) { return null; } } }
/** * Set the qvalue member * * @param q * double to set */ public void setQValue(float q) throws InvalidArgumentException { if (q < 0.0 || q > 1.0) throw new InvalidArgumentException("qvalue out of range!"); super.setParameter("q", q); }
/** Get the parameter as an integer when it is entered as a hex. * *@param parameterName -- The parameter name to fetch. * *@return -1 if the parameter is not defined in the header. */ protected int getParameterAsHexInt(String parameterName) { if (this.getParameterValue(parameterName) != null) { try { if (this.getParameterValue(parameterName) instanceof String) { return Integer.parseInt( this.getParameter(parameterName), 16); } else { return ((Integer) getParameterValue(parameterName)) .intValue(); } } catch (NumberFormatException ex) { return -1; } } else return -1; }