public XmlDeclaration(final Document ownerDocument, final CharSequence version, final CharSequence encoding, final CharSequence standalone) { super(ownerDocument, NodeType.XML_DECLARATION, "xml"); this.version = Util.toString(version); this.encoding = Util.toString(encoding); this.standalone = Util.toString(standalone); }
/** * Compares 2 strings. If one of the strings is <code>null</code>, <code>false</code> is returned. if * both string are <code>null</code>, <code>true</code> is returned. * * @param s1 first string to compare * @param s2 second string * * @return <code>true</code> if strings are equal, otherwise <code>false</code> */ public static boolean equals(String s1, String s2) { return Util.equals(s1, s2); }
@Test void testLength() { assertEquals(0, Util.length(null)); assertEquals(-1, Util.length(1234)); assertEquals(0, Util.length(StringPool.EMPTY)); assertEquals(4, Util.length("abcd")); Collection<String> coll = new ArrayList<>(); assertEquals(0, Util.length(coll)); coll.add("abcd"); coll.add("1234"); assertEquals(2, Util.length(coll)); Iterator<String> iterator = coll.iterator(); assertEquals(2, Util.length(iterator)); Map<Long, String> map = new HashMap<>(); assertEquals(0, Util.length(map)); map.put(1l, "abcd"); map.put(2l, "1234"); assertEquals(2, Util.length(map)); Integer[] array = new Integer[] { 1, 2, 3, 4, 5 }; assertEquals(5, Util.length(array)); ArrayEnumeration<Integer> ae = new ArrayEnumeration<>(array); assertEquals(5, Util.length(ae)); }
@Test void testContainsElement() { assertFalse(Util.containsElement(null, "abcd")); assertFalse(Util.containsElement(1234, "abcd")); assertFalse(Util.containsElement("abcd", null)); assertTrue(Util.containsElement("abcd", "bc")); assertFalse(Util.containsElement("abcd", "xx")); assertTrue(Util.containsElement(coll, "abcd")); assertFalse(Util.containsElement(coll, "xx")); assertTrue(Util.containsElement(iterator, "abcd")); assertFalse(Util.containsElement(iterator, "xx")); assertTrue(Util.containsElement(map, "abcd")); assertFalse(Util.containsElement(map, "xx")); assertTrue(Util.containsElement(array, 1)); assertFalse(Util.containsElement(array, 10)); ArrayEnumeration<Integer> ae = new ArrayEnumeration<>(array); assertTrue(Util.containsElement(ae, 1)); assertFalse(Util.containsElement(ae, 10));
@Override public void doctype(final Doctype doctype) { if (!enabled) { return; } DocumentType documentType = new DocumentType(rootNode, Util.toString(doctype.getName()), Util.toString(doctype.getPublicIdentifier()), Util.toString(doctype.getSystemIdentifier()) ); parentNode.addChild(documentType); }
/** * Compares 2 strings. If one of the strings is <code>null</code>, <code>false</code> is returned. if * both string are <code>null</code>, <code>true</code> is returned. * * @param s1 first string to compare * @param s2 second string * * @return <code>true</code> if strings are equal, otherwise <code>false</code> */ public static boolean equals(final String s1, final String s2) { return Util.equals(s1, s2); }
public Element(final Document ownerNode, final Tag tag, final boolean voidElement, final boolean selfClosed) { super(ownerNode, NodeType.ELEMENT, Util.toString(tag.getName())); this.voidElement = voidElement; this.selfClosed = selfClosed; this.rawTag = tag.isRawTag(); int attrCount = tag.getAttributeCount(); for (int i = 0; i < attrCount; i++) { String key = Util.toString(tag.getAttributeName(i)); String value = Util.toString(tag.getAttributeValue(i)); setAttribute(key, value); } }
while (iter.hasNext()) { Object o = iter.next(); if (equals(o, element)) { return true; while (enumeration.hasMoreElements()) { Object o = enumeration.nextElement(); if (equals(o, element)) { return true; for (int i = 0; i < len; i++) { Object o = Array.get(obj, i); if (equals(o, element)) { return true;
while (iter.hasNext()) { Object o = iter.next(); if (equals(o, element)) { return true; while (enumeration.hasMoreElements()) { Object o = enumeration.nextElement(); if (equals(o, element)) { return true; for (int i = 0; i < len; i++) { Object o = Array.get(obj, i); if (equals(o, element)) { return true;
@Override public void tag(final Tag tag) { if (!insideConditionalComment) { if (tag.nameEquals(T_LINK)) { CharSequence type = tag.getAttributeValue("type"); if (type != null && CharSequenceUtil.equalsIgnoreCase(type, "text/css")) { String media = Util.toString(tag.getAttributeValue("media")); if (media == null || media.contains("screen")) { String href = Util.toString(tag.getAttributeValue("href")); if (cssBundleAction.acceptLink(href)) { String link = cssBundleAction.processLink(href); if (link != null) { tag.setAttribute("href", link); super.tag(tag); } return; } } } } } super.tag(tag); }
@Test void testEquals() { Object a = new Integer(173); Object b = new Integer(1); Object c = new Integer(173); assertTrue(Util.equals(a, a)); assertTrue(Util.equals(a, c)); assertTrue(Util.equals(c, a)); assertFalse(Util.equals(a, b)); assertFalse(Util.equals(b, a)); assertFalse(Util.equals(a, null)); assertFalse(Util.equals(null, a)); assertTrue(Util.equals(null, null)); }
@Override public void script(final Tag tag, final CharSequence body) { if (!insideConditionalComment) { String src = Util.toString(tag.getAttributeValue("src")); if (src == null) { super.script(tag, body); return; } if (jsBundleAction.acceptLink(src)) { String link = jsBundleAction.processLink(src); if (link != null) { tag.setAttributeValue("src", link); super.script(tag, body); } return; } } super.script(tag, body); }
/** * Compares 2 strings. If one of the strings is <code>null</code>, <code>false</code> is returned. if * both string are <code>null</code>, <code>true</code> is returned. * * @param s1 first string to compare * @param s2 second string * * @return <code>true</code> if strings are equal, otherwise <code>false</code> */ public static boolean equals(final String s1, final String s2) { return Util.equals(s1, s2); }
public XmlDeclaration(final Document ownerDocument, final CharSequence version, final CharSequence encoding, final CharSequence standalone) { super(ownerDocument, NodeType.XML_DECLARATION, "xml"); this.version = Util.toString(version); this.encoding = Util.toString(encoding); this.standalone = Util.toString(standalone); }
/** * Compares 2 strings. If one of the strings is <code>null</code>, <code>false</code> is returned. if * both string are <code>null</code>, <code>true</code> is returned. * * @param s1 first string to compare * @param s2 second string * @return <code>true</code> if strings are equal, otherwise <code>false</code> */ public static boolean equals(String s1, String s2) { return Util.equals(s1, s2); }
while (iter.hasNext()) { Object o = iter.next(); if (equals(o, element)) { return true; while (enumeration.hasMoreElements()) { Object o = enumeration.nextElement(); if (equals(o, element)) { return true; for (int i = 0; i < len; i++) { Object o = Array.get(obj, i); if (equals(o, element)) { return true;
while (iter.hasNext()) { Object o = iter.next(); if (equals(o, element)) { return true; while (enumeration.hasMoreElements()) { Object o = enumeration.nextElement(); if (equals(o, element)) { return true; for (int i = 0; i < len; i++) { Object o = Array.get(obj, i); if (equals(o, element)) { return true;