/*
 * @author Ranides Atterwim <ranides@gmail.com>
 * @copyright Ranides Atterwim
 * @license WTFPL
 * @url http://ranides.net/projects/assira
 */
package net.ranides.assira.xml;

import java.util.List;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Predicate;
import net.ranides.assira.collection.maps.MultiMap;
import net.ranides.assira.collection.query.CQuery;
import org.w3c.dom.Node;

/**
 *
 * @author Ranides Atterwim <ranides@gmail.com>
 */
@SuppressWarnings({
    "PMD.TooManyDifferentMethods",
    "PMD.TooManyPublicMethods"
})
public interface XMLElements extends Iterable<XMLElement> {
    
    List<Node> nodes();
    
    List<String> names();
    
    List<String> xpaths();
    
    String content();
    
    List<String> contents();
    
    String text();
    
    String text(Function<String, String> function);
    
    List<String> texts();
    
    List<String> texts(Function<String, String> function);
    
    XMLElements attrs();
    
    XMLElements attrs(String name);
    
    
    
    int size();
    
    CQuery<XMLElement> stream();
    
    <T> CQuery<T> stream(Function<? super XMLElement, ? extends T> function);
    
    XMLElements each(Consumer<? super XMLElement> consumer);
    
    XMLElement first();
    
    XMLElement first(String selector);
    
    XMLElement first(Predicate<XMLContext> selector);
    
    XMLElement last();
    
    XMLElement last(String selector);
    
    XMLElement last(Predicate<XMLContext> selector);
    
    XMLElements concat(XMLElements elements);
    
    
    
    XMLElements filter(String selector);
    
    XMLElements filter(Predicate<XMLContext> selector);
    
    XMLElements discard(String selector);
    
    XMLElements discard(Predicate<XMLContext> selector);
    
    XMLElements limit(String selector);
    
    XMLElements limit(Predicate<XMLContext> selector);

    
    
    boolean matches();
    
    MultiMap<String, String> map();
    
    XMLElements map(XMLSelector function);
    
    XMLElements map(Function<? super XMLElement, ? extends XMLElement> function);
    
    XMLElements find(String selector);
    
    XMLElements find(XMLSelector selector);
    
    XMLElements children();
    
    XMLElements children(String selector);
    
    XMLElements children(Predicate<XMLContext> selector);
    
    boolean has();
    
    boolean has(String selector);
    
    boolean has(Predicate<XMLContext> selector);
    
    XMLElements next();
    
    XMLElements next(String selector);
    
    XMLElements next(Predicate<XMLContext> selector);
    
    XMLElements prev();
    
    XMLElements prev(String selector);
    
    XMLElements prev(Predicate<XMLContext> selector);
    
    XMLElements siblings();
    
    XMLElements siblings(String selector);
    
    XMLElements siblings(Predicate<XMLContext> selector);
    
    XMLElements parent();
    
    XMLElements parent(String selector);
    
    XMLElements parent(Predicate<XMLContext> selector);
    


    XMLElements normalize();
    
    XMLElements clear();
        
    XMLElements before(XMLElement element);
    
    XMLElements after(XMLElement element);
    
    XMLElements prepend(XMLElement element);
    
    XMLElements append(XMLElement element);
    
    XMLElements replace(XMLElement element);
    
    XMLElements rename(String tagname);
    
    XMLElements remove();
    
    XMLElements wrap(String tagname);
    
    XMLElements unwrap();
    
    XMLElements content(XMLElement value);
    
    XMLElements content(String value);
    
    XMLElements text(String value);
        
}
