com.adobe.epubcheck.ctc.css.CSSSelectorCollection Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of epubcheck Show documentation
Show all versions of epubcheck Show documentation
EPUBCheck is a tool to validate the conformance of EPUB publications against
the EPUB specifications. EPUBCheck can be run as a standalone command-line tool or used
as a Java library.
package com.adobe.epubcheck.ctc.css;
import javax.xml.stream.Location;
import java.util.HashMap;
/**
* === WARNING ==========================================
* This class is scheduled to be refactored and integrated
* in another package.
* Please keep changes minimal (bug fixes only) until then.
* ========================================================
*/
public class CSSSelectorCollection
{
private final String name;
private final int scopeId;
private final Location location;
private final HashMap selectors = new HashMap();
public CSSSelectorCollection(String name, Location location, int scopeId)
{
this.name = name;
this.location = location;
this.scopeId = scopeId;
}
public HashMap getSelectors()
{
return selectors;
}
public void addSelector(CSSSelector selector)
{
CSSSelector existing = selectors.get(selector.getName());
if (existing != null)
{
for (CSSSelectorAttribute attribute : selector.getAttributes().values())
{
existing.addAttribute(attribute);
}
selector = existing;
}
selectors.put(selector.getName(), selector);
}
}