/** * Predicate to determine if this attribute has an equals sign but no value. * @return <code>true</code> if this attribute is an empty attribute. * <code>false</code> if has an equals sign and a value. */ public boolean isEmpty () { return ((null != getAssignment ()) && (null == getValue ())); }
/** * Predicate to determine if this attribute has no equals sign (or value). * @return <code>true</code> if this attribute is a standalone attribute. * <code>false</code> if has an equals sign. */ public boolean isStandAlone () { return ((null != getName ()) && (null == getAssignment ())); }
/** * Predicate to determine if this attribute has no equals sign (or value). * @return <code>true</code> if this attribute is a standalone attribute. * <code>false</code> if has an equals sign. */ public boolean isStandAlone () { return ((null != getName ()) && (null == getAssignment ())); }
/** * Predicate to determine if this attribute has an equals sign but no value. * @return <code>true</code> if this attribute is an empty attribute. * <code>false</code> if has an equals sign and a value. */ public boolean isEmpty () { return ((null != getAssignment ()) && (null == getValue ())); }
/** * Get the assignment string of this attribute. * @param buffer The buffer to place the assignment string in. * @see #getAssignment() */ public void getAssignment (StringBuffer buffer) { int length; char ch; String assignment; assignment = super.getAssignment (); if (null == assignment) { if ((null != mPage) && (0 <= mNameEnd) && (0 <= mValueStart)) { mPage.getText (buffer, mNameEnd, mValueStart); // remove a possible quote included in the assignment // since mValueStart points at the real start of the value length = buffer.length () - 1; ch = buffer.charAt (length); if (('\'' == ch) || ('"' == ch)) buffer.setLength (length); } } else buffer.append (assignment); }
/** * Get the assignment string of this attribute. * @param buffer The buffer to place the assignment string in. * @see #getAssignment() */ public void getAssignment (StringBuilder buffer) { int length; char ch; String assignment; assignment = super.getAssignment (); if (null == assignment) { if ((null != mPage) && (0 <= mNameEnd) && (0 <= mValueStart)) { mPage.getText (buffer, mNameEnd, mValueStart); // remove a possible quote included in the assignment // since mValueStart points at the real start of the value length = buffer.length () - 1; ch = buffer.charAt (length); if (('\'' == ch) || ('"' == ch)) buffer.setLength (length); } } else buffer.append (assignment); }
/** * Get a text representation of this attribute. * @param buffer The accumulator for placing the text into. * @see #toString() */ public void toString (StringBuffer buffer) { getName (buffer); getAssignment (buffer); getRawValue (buffer); }
/** * Get a text representation of this attribute. * @param buffer The accumulator for placing the text into. * @see #toString() */ public void toString (StringBuilder buffer) { getName (buffer); getAssignment (buffer); getRawValue (buffer); }
/** * Get the assignment string of this attribute. * This is usually just an equals sign, but in poorly formed attributes it * can include whitespace on either or both sides of an equals sign. * @return The assignment string. */ public String getAssignment () { String ret; ret = super.getAssignment (); if (null == ret) { if ((null != mPage) && (0 <= mNameEnd) && (0 <= mValueStart)) { ret = mPage.getText (mNameEnd, mValueStart); // remove a possible quote included in the assignment // since mValueStart points at the real start of the value if (ret.endsWith ("\"") || ret.endsWith ("'")) ret = ret.substring (0, ret.length () - 1); setAssignment (ret); // cache the value } } return (ret); }
/** * Get the assignment string of this attribute. * This is usually just an equals sign, but in poorly formed attributes it * can include whitespace on either or both sides of an equals sign. * @return The assignment string. */ public String getAssignment () { String ret; ret = super.getAssignment (); if (null == ret) { if ((null != mPage) && (0 <= mNameEnd) && (0 <= mValueStart)) { ret = mPage.getText (mNameEnd, mValueStart); // remove a possible quote included in the assignment // since mValueStart points at the real start of the value if (ret.endsWith ("\"") || ret.endsWith ("'")) ret = ret.substring (0, ret.length () - 1); setAssignment (ret); // cache the value } } return (ret); }
private static Vector cloneAttributes(Vector<Attribute> attributes) { Vector<Attribute> newAttributes = new Vector<>(attributes.size()); for (Attribute a : attributes) { newAttributes.add(new Attribute(a.getName(), a.getAssignment(), a.getValue(), a.getQuote())); } return newAttributes; }
private static Vector cloneAttributes(Vector<Attribute> attributes) { Vector<Attribute> newAttributes = new Vector<>(attributes.size()); for (Attribute a : attributes) { newAttributes.add(new Attribute(a.getName(), a.getAssignment(), a.getValue(), a.getQuote())); } return newAttributes; }
/** * Predicate to determine if this attribute has no equals sign (or value). * @return <code>true</code> if this attribute is a standalone attribute. * <code>false</code> if has an equals sign. */ public boolean isStandAlone () { return (!isWhitespace () // not whitespace && (null == super.getAssignment ()) // and no explicit assignment provided && !isValued () // and has no value && ((null == mPage) // and either its not coming from a page // or it is coming from a page and it doesn't have an assignment part || ((null != mPage) && (0 <= mNameEnd) && (0 > mValueStart)))); }
/** * Predicate to determine if this attribute has no equals sign (or value). * @return <code>true</code> if this attribute is a standalone attribute. * <code>false</code> if has an equals sign. */ public boolean isStandAlone () { return (!isWhitespace () // not whitespace && (null == super.getAssignment ()) // and no explicit assignment provided && !isValued () // and has no value && ((null == mPage) // and either its not coming from a page // or it is coming from a page and it doesn't have an assignment part || ((null != mPage) && (0 <= mNameEnd) && (0 > mValueStart)))); }
/** * Get the length of the string value of this attribute. * @return The number of characters required to express this attribute. */ public int getLength () { String name; String assignment; String value; char quote; int ret; ret = 0; name = getName (); if (null != name) ret += name.length (); assignment = getAssignment (); if (null != assignment) ret += assignment.length (); value = getValue (); if (null != value) ret += value.length (); quote = getQuote (); if (0 != quote) ret += 2; return (ret); }
/** * Get the length of the string value of this attribute. * @return The number of characters required to express this attribute. */ public int getLength () { String name; String assignment; String value; char quote; int ret; ret = 0; name = getName (); if (null != name) ret += name.length (); assignment = getAssignment (); if (null != assignment) ret += assignment.length (); value = getValue (); if (null != value) ret += value.length (); quote = getQuote (); if (0 != quote) ret += 2; return (ret); }
else if ((null != mPage) && (0 <= mNameStart) && (0 <= mNameEnd)) ret += mNameEnd - mNameStart; assignment = super.getAssignment (); if (null != assignment) ret += assignment.length ();
else if ((null != mPage) && (0 <= mNameStart) && (0 <= mNameEnd)) ret += mNameEnd - mNameStart; assignment = super.getAssignment (); if (null != assignment) ret += assignment.length ();