Giter Club home page Giter Club logo

mapreduce_1's Introduction

mapreduce_1's People

Contributors

aurbroszniowski avatar gdenning avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

mapreduce_1's Issues

give select support :frst and :last selector function

i want give select support :frst and :last selector function, code under this:

org.jsoup.select.QueryParser#consumeIndex

private int consumeIndex() {
String indexS = tq.chompTo(")").trim();

    if ("first".equals(indexS))
        return 0;
    else if ("last".equals(indexS))
        return -1;
    else if (indexS.startsWith("-"))
        return Integer.parseInt(indexS);

    Validate.isTrue(StringUtil.isNumeric(indexS), "Index must be numeric");
    return Integer.parseInt(indexS);
}

org.jsoup.select.Evaluator.IndexEquals

public static final class IndexEquals extends IndexEvaluator {
public IndexEquals(int index) {
super(index);
}

    @Override
    public boolean matches(Element root, Element element) {
        if(index < 0)
        {
            Element parent = element.parent();
            if (parent == null)
                return false;

            List<Element> siblings = parent.children();
            return siblings.size() + index >= 0 && element.equals(siblings.get(siblings.size() + index));
        }

        return element.elementSiblingIndex() == index;
    }

    @Override
    public String toString() {
        return String.format(":eq(%d)", index);
    }

}

Usage:

li:eq(first)
li:eq(last)
li:eq(-3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.