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

com.vladsch.flexmark.parser.internal.MatchedBlockParserImpl Maven / Gradle / Ivy

package com.vladsch.flexmark.parser.internal;

import com.vladsch.flexmark.parser.block.BlockParser;
import com.vladsch.flexmark.parser.block.MatchedBlockParser;
import com.vladsch.flexmark.util.data.MutableDataHolder;
import com.vladsch.flexmark.util.sequence.BasedSequence;

import java.util.List;

public class MatchedBlockParserImpl implements MatchedBlockParser {
    final private BlockParser matchedBlockParser;

    @Override
    public List getParagraphLines() {
        if (matchedBlockParser.isParagraphParser()) {
            return matchedBlockParser.getBlockContent().getLines();
        }
        return null;
    }

    public List getParagraphEolLengths() {
        if (matchedBlockParser.isParagraphParser()) {
            return matchedBlockParser.getBlockContent().getLineIndents();
        }
        return null;
    }

    public MatchedBlockParserImpl(BlockParser matchedBlockParser) {
        this.matchedBlockParser = matchedBlockParser;
    }

    @Override
    public BlockParser getBlockParser() {
        return matchedBlockParser;
    }

    @Override
    public BasedSequence getParagraphContent() {
        if (matchedBlockParser.isParagraphParser()) {
            return matchedBlockParser.getBlockContent().getContents();
        }
        return null;
    }

    @Override
    public MutableDataHolder getParagraphDataHolder() {
        if (matchedBlockParser.isParagraphParser()) {
            return matchedBlockParser.getDataHolder();
        }
        return null;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy