All Downloads are FREE. Search and download functionalities are using the official Maven repository.

biz.gabrys.maven.plugins.css.splitter.split.NeighborsManager Maven / Gradle / Ivy

Go to download

Splits CSS stylesheets to smaller files ("parts") which contain maximum X rules.

There is a newer version: 2.0.3
Show newest version
/*
 * CSS Splitter Maven Plugin
 * http://css-splitter-maven-plugin.projects.gabrys.biz/
 *
 * Copyright (c) 2015 Adam Gabrys
 *
 * This file is licensed under the BSD 3-Clause (the "License").
 * You may not use this file except in compliance with the License.
 * You may obtain:
 * - a copy of the License at project page
 * - a template of the License at https://opensource.org/licenses/BSD-3-Clause
 */
package biz.gabrys.maven.plugins.css.splitter.split;

import biz.gabrys.maven.plugins.css.splitter.css.type.NodeRule;

class NeighborsManager {

    void fill(final NodeRule rule, final NodeRule first, final NodeRule second) {
        final NodeRule parent = rule.getParent();
        first.setParent(parent);
        second.setParent(parent);

        final NodeRule previous = rule.getPrevious();
        first.setPrevious(previous);
        if (previous != null) {
            previous.setNext(first);
        }

        first.setNext(second);
        second.setPrevious(first);

        final NodeRule next = rule.getNext();
        second.setNext(next);
        if (next != null) {
            next.setPrevious(second);
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy