<commit_before>package com.taig.android.widget.validation

import android.util.Patterns

object Type
{
	class Alpha( enabled: Boolean, message: CharSequence ) extends Validator.Regex( enabled, message, "[\\p{L}]*" )

	class AlphaDash( enabled: Boolean, message: CharSequence ) extends Validator.Regex( enabled, message, "[\\p{L}\\-]*" )

	class AlphaNumeric( enabled: Boolean, message: CharSequence ) extends Validator.Regex( enabled, message, "[\\p{L}0-9]*" )

	class Email( enabled: Boolean, message: CharSequence ) extends Validator.Regex( enabled, message, Patterns.EMAIL_ADDRESS.pattern() )

	class Integer( enabled: Boolean, message: CharSequence ) extends Validator.Regex( enabled, message, "[0-9]*" )

	class Length( enabled: Boolean, message: CharSequence, var value: Int ) extends Validator( enabled, message )
	{
		def this( message: CharSequence, value: Int ) = this( value != -1, message, value )

		override def getMessage = String.format( message.toString, value )

		override def validate( value: CharSequence ) = super.validate( value ) || value.length() == this.value
	}

	abstract class Matches( enabled: Boolean, message: CharSequence, var target: Int ) extends Validator( enabled, message )
	{
		def this( message: CharSequence, target: Int ) = this( target > 0, message, target )

		override def validate( value: CharSequence ) = super.validate( value ) || value.toString == find.toString

		protected def find: CharSequence
	}

	class Max( enabled: Boolean, message: CharSequence, var length: Int ) extends Validator( enabled, message )
	{
		def this( message: CharSequence, length: Int ) = this( length < Int.MaxValue, message, length )

		override def getMessage = String.format( message.toString, length )

		override def validate( value: CharSequence ) = super.validate( value ) || value.length() <= length
	}

	class Min( enabled: Boolean, message: CharSequence, var length: Int ) extends Validator( enabled, message )
	{
		def this( message: CharSequence, length: Int ) = this( length > Int.MinValue, message, length )

		override def getMessage = String.format( message.toString, length )

		override def validate( value: CharSequence ) = super.validate( value ) || value.length() >= length
	}

	class Numeric( enabled: Boolean, message: CharSequence ) extends Validator.Regex( enabled, message, "\\d*([\\.,]\\d+)?" )

	class Phone( enabled: Boolean, message: CharSequence ) extends Validator.Regex( enabled, message, "(\\+?\\d+)?" )

	class Required( enabled: Boolean, message: CharSequence ) extends Validator( enabled, message )
	{
		override def validate( value: CharSequence ) = !enabled || value.length() > 0
	}
}<commit_msg>Switched to scala string formatting, due to compile error<commit_after>package com.taig.android.widget.validation

import android.util.Patterns

object Type
{
	class Alpha( enabled: Boolean, message: CharSequence ) extends Validator.Regex( enabled, message, "[\\p{L}]*" )

	class AlphaDash( enabled: Boolean, message: CharSequence ) extends Validator.Regex( enabled, message, "[\\p{L}\\-]*" )

	class AlphaNumeric( enabled: Boolean, message: CharSequence ) extends Validator.Regex( enabled, message, "[\\p{L}0-9]*" )

	class Email( enabled: Boolean, message: CharSequence ) extends Validator.Regex( enabled, message, Patterns.EMAIL_ADDRESS.pattern() )

	class Integer( enabled: Boolean, message: CharSequence ) extends Validator.Regex( enabled, message, "[0-9]*" )

	class Length( enabled: Boolean, message: CharSequence, var value: Int ) extends Validator( enabled, message )
	{
		def this( message: CharSequence, value: Int ) = this( value != -1, message, value )

		override def getMessage = message.toString.format( value )

		override def validate( value: CharSequence ) = super.validate( value ) || value.length() == this.value
	}

	abstract class Matches( enabled: Boolean, message: CharSequence, var target: Int ) extends Validator( enabled, message )
	{
		def this( message: CharSequence, target: Int ) = this( target > 0, message, target )

		override def validate( value: CharSequence ) = super.validate( value ) || value.toString == find.toString

		protected def find: CharSequence
	}

	class Max( enabled: Boolean, message: CharSequence, var length: Int ) extends Validator( enabled, message )
	{
		def this( message: CharSequence, length: Int ) = this( length < Int.MaxValue, message, length )

		override def getMessage = message.toString.format( length )

		override def validate( value: CharSequence ) = super.validate( value ) || value.length() <= length
	}

	class Min( enabled: Boolean, message: CharSequence, var length: Int ) extends Validator( enabled, message )
	{
		def this( message: CharSequence, length: Int ) = this( length > Int.MinValue, message, length )

		override def getMessage = message.toString.format( length )

		override def validate( value: CharSequence ) = super.validate( value ) || value.length() >= length
	}

	class Numeric( enabled: Boolean, message: CharSequence ) extends Validator.Regex( enabled, message, "\\d*([\\.,]\\d+)?" )

	class Phone( enabled: Boolean, message: CharSequence ) extends Validator.Regex( enabled, message, "(\\+?\\d+)?" )

	class Required( enabled: Boolean, message: CharSequence ) extends Validator( enabled, message )
	{
		override def validate( value: CharSequence ) = !enabled || value.length() > 0
	}
}
{'fraction_non_alphanumeric': 0.12804193186072632, 'fraction_numerical': 0.002620741295394983, 'mean_word_length': 4.732832618025751, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3313747', 'n_tokens_mistral': 1541, 'n_tokens_neox': 1462, 'n_words': 517}