Package repast.simphony.integration
Enum NewLinePatternConverter
- java.lang.Object
-
- java.lang.Enum<NewLinePatternConverter>
-
- repast.simphony.integration.NewLinePatternConverter
-
- All Implemented Interfaces:
Serializable
,Comparable<NewLinePatternConverter>
public enum NewLinePatternConverter extends Enum<NewLinePatternConverter>
Handles converting newline patterns into different newline patterns. This means it will convert patterns matching "\n" to a pattern that matches Windows newlines "\r\n", unix newlines "\n", system dependent (currently only windows or unix types), or do no conversion. This is NOT for doing "\n" -> "\r\n" type conversions, but is for converting regular expressions that match newline characters from matching "\n" to matching some other type.- Author:
- Jerry Vos
-
-
Enum Constant Summary
Enum Constants Enum Constant Description NONE
Performs no conversionSYSTEM
If the system's line separator is "\r\n" it will do the same as a WINDOWS converter, if the pattern is "\n" it will return a UNIX one, otherwise it will just return the string.UNIX
Returns the string as it is.WINDOWS
Replaces "\n" matches with "\r\n" matches.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract String
convert(String string)
Converts the newline patterns to those specified by its type.static NewLinePatternConverter
getNewLineConverter(String handleType)
Returns the converter that has the specified type as it type.String
getType()
static NewLinePatternConverter
valueOf(String name)
Returns the enum constant of this type with the specified name.static NewLinePatternConverter[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
NONE
public static final NewLinePatternConverter NONE
Performs no conversion
-
SYSTEM
public static final NewLinePatternConverter SYSTEM
If the system's line separator is "\r\n" it will do the same as a WINDOWS converter, if the pattern is "\n" it will return a UNIX one, otherwise it will just return the string.
-
WINDOWS
public static final NewLinePatternConverter WINDOWS
Replaces "\n" matches with "\r\n" matches.
-
UNIX
public static final NewLinePatternConverter UNIX
Returns the string as it is. This does NOT convert "\r\n" matchers to "\n".
-
-
Method Detail
-
values
public static NewLinePatternConverter[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (NewLinePatternConverter c : NewLinePatternConverter.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static NewLinePatternConverter valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-
getNewLineConverter
public static NewLinePatternConverter getNewLineConverter(String handleType)
Returns the converter that has the specified type as it type.- Parameters:
handleType
- the type to find a converter for.- Returns:
- a NewLinePatternConverter or NewLinePatternConverter.NONE if no matching one can be found
-
getType
public String getType()
-
-