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

com.altova.text.flex.SplitAtDelimiterLineBasedMultipleRegex Maven / Gradle / Ivy

There is a newer version: 2.0.4
Show newest version
////////////////////////////////////////////////////////////////////////
//
// SplitAtDelimiterLineBasedMultipleRegex.java
//
// This file was generated by MapForce 2017sp2.
//
// YOU SHOULD NOT MODIFY THIS FILE, BECAUSE IT WILL BE
// OVERWRITTEN WHEN YOU RE-RUN CODE GENERATION.
//
// Refer to the MapForce Documentation for further details.
// http://www.altova.com/mapforce
//
////////////////////////////////////////////////////////////////////////

package com.altova.text.flex;

public class SplitAtDelimiterLineBasedMultipleRegex extends SplitAtDelimiterLineBasedRegex {
	public SplitAtDelimiterLineBasedMultipleRegex( String pattern, boolean matchcase ) {
		super( pattern, matchcase );
	}
	
	public Range split( Range range )
	{
		SplitLines splitAtFirstLine = new SplitLines(1);
		boolean firstLine = true;
		Range result = new Range(range);
		SplitAtDelimiterRegex splitter = new SplitAtDelimiterRegex( pattern, matchcase, null );
		while ( true )
		{
			Range line = splitAtFirstLine.split( range );
			if ( !line.isValid() )
			{
				result.end = line.start;
				break;
			}
			Range head = splitter.split( line );
			if ( head.end != line.end )
			{
				if (!firstLine)
				{
					result.end = head.start;
					break;
				}
			}
			firstLine = false;
		}
		range.start = result.end;
		return result;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy