/** * Set a namevalue object in this list. */ public void set(NameValue nv) { this.nameValueMap.put(nv.getName().toLowerCase(), nv); }
/** * Set a namevalue object in this list. */ public void set(NameValue nv) { this.put(nv.getName().toLowerCase(), nv); }
protected boolean hasAttribute(String name) { for (int i = 0; i < this.attributeFields.size(); i++) { AttributeField af = (AttributeField) this.attributeFields .elementAt(i); if (af.getAttribute().getName().equals(name)) return true; } return false; }
public String getDuplexity() { int i = 0; for (i = 0; i < this.attributeFields.size(); i++) { AttributeField af = (AttributeField) this.attributeFields .elementAt(i); if (af.getAttribute().getName().equalsIgnoreCase("sendrecv") || af.getAttribute().getName().equalsIgnoreCase("recvonly") || af.getAttribute().getName().equalsIgnoreCase("sendonly") || af.getAttribute().getName().equalsIgnoreCase("inactive")) { return af.getAttribute().getName(); } } return null; }
/** Returns the name of this attribute * @throws SdpParseException if the name is not well formatted. * @return a String identity or null. */ public String getName() throws SdpParseException { NameValue nameValue = getAttribute(); if (nameValue == null) return null; else { String name = nameValue.getName(); if (name == null) return null; else return name; } }
/** * Removes the attribute specified by the value parameter. * * @param name * the name of the attribute. */ public void removeAttribute(String name) { if (name == null) throw new NullPointerException("null arg!"); if (name != null) { int i = 0; for (i = 0; i < this.attributeFields.size(); i++) { AttributeField af = (AttributeField) this.attributeFields .elementAt(i); if (af.getAttribute().getName().equals(name)) break; } if (i < attributeFields.size()) attributeFields.removeElementAt(i); } }
/** * <p>Remove parameter </p> * * @param value - of the parameter * @param name - of the parameter * @return true if parameter was removed, and false if not */ public boolean delete(String value, String name) { Iterator li = this.parameters.iterator(); NameValue nv; boolean removed = false; while (li.hasNext()) { nv = (NameValue) li.next(); if (((String) nv.getValueAsObject()).equalsIgnoreCase(value) && nv.getName().equalsIgnoreCase(name)) { li.remove(); removed = true; } } return removed; }
if (!af.getAttribute().getName().equals("conf")) continue; else
/** * <p>Get all the Charging Collection Function (CCF) Addresses set in this header</p> * * @return ListIterator that constains all CCF addresses of this header */ public ListIterator getChargingCollectionFunctionAddresses() { Iterator li = this.parameters.iterator(); LinkedList ccfLIST = new LinkedList(); NameValue nv; while (li.hasNext()) { nv = (NameValue) li.next(); if (nv.getName().equalsIgnoreCase(ParameterNamesIms.CCF)) { NameValue ccfNV = new NameValue(); ccfNV.setName(nv.getName()); ccfNV.setValueAsObject(nv.getValueAsObject()); ccfLIST.add(ccfNV); } } return ccfLIST.listIterator(); }
public boolean equals(Object that ) { if ( ! (that instanceof AttributeField)) return false; AttributeField other = (AttributeField) that; return other.getAttribute().getName().equalsIgnoreCase(this.getAttribute().getName()) && this.getAttribute().getValueAsObject().equals(other.getAttribute().getValueAsObject()); }
/** * <p>Get all the Event Charging Function (ECF) Addresses set in this header</p> * * @return ListIterator that constains all CCF addresses of this header */ public ListIterator<NameValue> getEventChargingFunctionAddresses() { LinkedList<NameValue> listw = new LinkedList<NameValue>(); Iterator li = this.parameters.iterator(); ListIterator<NameValue> ecfLIST = listw.listIterator(); NameValue nv; boolean removed = false; while (li.hasNext()) { nv = (NameValue) li.next(); if (nv.getName().equalsIgnoreCase(ParameterNamesIms.ECF)) { NameValue ecfNV = new NameValue(); ecfNV.setName(nv.getName()); ecfNV.setValueAsObject(nv.getValueAsObject()); ecfLIST.add(ecfNV); } } return ecfLIST; }
public void setDuplexity(String duplexity) { if ( duplexity == null ) throw new NullPointerException("Null arg"); int i = 0; for (i = 0; i < this.attributeFields.size(); i++) { AttributeField af = (AttributeField) this.attributeFields .elementAt(i); if (af.getAttribute().getName().equalsIgnoreCase("sendrecv") || af.getAttribute().getName().equalsIgnoreCase("recvonly") || af.getAttribute().getName().equalsIgnoreCase("sendonly") || af.getAttribute().getName().equalsIgnoreCase("inactive")) { NameValue nv = new NameValue(duplexity, null); af.setAttribute(nv); return; } } if (i == this.attributeFields.size()) { AttributeField af = new AttributeField(); NameValue nv = new NameValue(duplexity, null); af.setAttribute(nv); // Bug fix by Emil Ivov. this.attributeFields.add(af); } }
/** * Returns the value of the specified attribute. * * @param name * the name of the attribute. * @throws SdpParseException * @return the value of the named attribute */ public String getAttribute(String name) throws SdpParseException { if (name != null) { for (int i = 0; i < this.attributeFields.size(); i++) { AttributeField af = (AttributeField) this.attributeFields .elementAt(i); if (name.equals(af.getAttribute().getName())) return (String) af.getAttribute().getValueAsObject(); } return null; } else throw new NullPointerException("null arg!"); }
if (!af.getAttribute().getName().equals("curr")) continue;
AttributeField af = (AttributeField) this.attributeFields .elementAt(i); if (af.getAttribute().getName().equals(name)) { NameValue nv = af.getAttribute(); nv.setValueAsObject(value);
/** * {@inheritDoc} */ public NameValue getAttribute() { // We've overridden the method getValue() of AttributeField. The // NameValue pair of the method getAttribute() should return the value of // the method getValue() of AttributeField then. Unfortunately, NameValue // accesses its field value in multiple places so it is not a question of // simply overriding a method or two. As a compromise, initialize a new // NameValue with the current name and value upon each invocation. NameValue attribute = super.getAttribute(); String name = getName(); if ((attribute == null) || (name.equals(attribute.getName()) && (attribute.getValue() == null))) { attribute = new NameValue(name, getValue()); } return attribute; }
public BandwidthField bandwidthField() throws ParseException { try { this.lexer.match('b'); this.lexer.SPorHT(); this.lexer.match('='); this.lexer.SPorHT(); BandwidthField bandwidthField = new BandwidthField(); NameValue nameValue = nameValue(':'); String name = nameValue.getName(); String value = (String) nameValue.getValueAsObject(); bandwidthField.setBandwidth(Integer.parseInt(value.trim())); bandwidthField.setBwtype(name); this.lexer.SPorHT(); return bandwidthField; } catch (Exception e) { e.printStackTrace(); throw new ParseException(lexer.getBuffer(), lexer.getPtr()); } }
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); } } }
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); } } }
nameValue = new NameValue(rest.trim(), null); keyField.setType(nameValue.getName()); keyField.setKeyData((String) nameValue.getValueAsObject()); this.lexer.SPorHT();