Rename clusters to singular names

This commit is contained in:
YNH Webdev
2013-09-20 19:22:46 +02:00
parent 24474e6b31
commit 0a2883e040
12 changed files with 4 additions and 4 deletions

View File

@@ -0,0 +1,24 @@
note
description: "Summary description for {WSF_DECIMAL_VALIDATOR}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
WSF_DECIMAL_VALIDATOR
inherit
WSF_REGEXP_VALIDATOR
create
make_decimal_validator
feature {NONE}
make_decimal_validator (e: STRING)
do
make_regexp_validator ("^[0-9]+(\.[0-9]*)?$|^\.[0-9]+$", e)
end
end

View File

@@ -0,0 +1,24 @@
note
description: "Summary description for {WSF_EMAIL_VALIDATOR}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
WSF_EMAIL_VALIDATOR
inherit
WSF_REGEXP_VALIDATOR
create
make_email_validator
feature {NONE}
make_email_validator (e: STRING)
do
make_regexp_validator ("^[a-zA-Z0-9._%%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,6}$", e)
end
end

View File

@@ -0,0 +1,45 @@
note
description: "Summary description for {WSF_MAX_VALIDATOR}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
WSF_max_VALIDATOR [G]
inherit
WSF_VALIDATOR [LIST [G]]
redefine
state
end
create
make_max_validator
feature {NONE}
make_max_validator (m: INTEGER; e: STRING)
do
make (e)
max := m
end
feature -- Implementation
is_valid (input: LIST [G]): BOOLEAN
do
Result := input.count < max or input.count = max
end
feature
state: JSON_OBJECT
do
Result := Precursor
Result.put (create {JSON_NUMBER}.make_integer (max), create {JSON_STRING}.make_json ("max"))
end
max: INTEGER
end

View File

@@ -0,0 +1,45 @@
note
description: "Summary description for {WSF_MIN_VALIDATOR}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
WSF_MIN_VALIDATOR[G]
inherit
WSF_VALIDATOR [LIST[G]]
redefine
state
end
create
make_min_validator
feature {NONE}
make_min_validator (m:INTEGER; e: STRING)
do
make (e)
min := m
end
feature -- Implementation
is_valid (input:LIST[G]): BOOLEAN
do
Result:= input.count > min or input.count = min
end
feature
state: JSON_OBJECT
do
Result := Precursor
Result.put (create {JSON_NUMBER}.make_integer (min), create {JSON_STRING}.make_json ("min"))
end
min: INTEGER
end

View File

@@ -0,0 +1,24 @@
note
description: "Summary description for {WSF_PHONE_NUMBER_VALIDATOR}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
WSF_PHONE_NUMBER_VALIDATOR
inherit
WSF_REGEXP_VALIDATOR
create
make_with_message
feature {NONE}
make_with_message (e: STRING)
do
make_regexp_validator ("", e)
end
end

View File

@@ -0,0 +1,54 @@
note
description: "Summary description for {WSF_REGEXP_VALIDATOR}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
WSF_REGEXP_VALIDATOR
inherit
WSF_VALIDATOR [STRING]
redefine
state
end
create
make_regexp_validator
feature {NONE}
make_regexp_validator (r, e: STRING)
do
make (e)
regexp_string := r
create regexp
end
feature -- Implementation
is_valid (input: STRING): BOOLEAN
do
--Only compile when used
if not regexp.is_compiled then
regexp.compile (regexp_string)
end
Result := regexp.matches (input)
end
feature
state: JSON_OBJECT
do
create Result.make
Result.put (create {JSON_STRING}.make_json ("WSF_REGEXP_VALIDATOR"), create {JSON_STRING}.make_json ("name"))
Result.put (create {JSON_STRING}.make_json (regexp_string), create {JSON_STRING}.make_json ("expression"))
Result.put (create {JSON_STRING}.make_json (error), create {JSON_STRING}.make_json ("error"))
end
regexp_string: STRING
regexp: REGULAR_EXPRESSION
end

View File

@@ -0,0 +1,20 @@
note
description: "Summary description for {WSF_VALIDATABLE}."
author: ""
date: "$Date$"
revision: "$Revision$"
deferred class
WSF_VALIDATABLE
feature
validate
deferred
end
is_valid: BOOLEAN
deferred
end
end

View File

@@ -0,0 +1,32 @@
note
description: "Summary description for {WSF_VALIDATOR}."
author: ""
date: "$Date$"
revision: "$Revision$"
deferred class
WSF_VALIDATOR [G]
feature {NONE}
make (e: STRING)
do
error := e
end
feature
state: JSON_OBJECT
do
create Result.make
Result.put (create {JSON_STRING}.make_json (generator), create {JSON_STRING}.make_json ("name"))
Result.put (create {JSON_STRING}.make_json (error), create {JSON_STRING}.make_json ("error"))
end
is_valid (input: G): BOOLEAN
deferred
end
error: STRING
end