text:
unless defined? Linguistics::TestCase
	testsdir = File::dirname( File::dirname(File::expand_path( __FILE__ )) )
	$LOAD_PATH.unshift testsdir unless $LOAD_PATH.include?( testsdir )

	require 'lingtestcase'
end

### This test case tests the english pluralization routines of the Linguistics
### module.
class EnglishInflectionTestCase < Linguistics::TestCase

	InflectFromItems = [ %w{foo bar}, "foo bar", 15, 18.13 ]

	NumberTests = [
		["0", "zero", "zero", "zero", "zero", "zeroth", ],
		["1", "one", "one", "one", "one", "first", ],
		["2", "two", "two", "two", "two", "second", ],
		["3", "three", "three", "three", "three", "third", ],
		["4", "four", "four", "four", "four", "fourth", ],
		["5", "five", "five", "five", "five", "fifth", ],
		["6", "six", "six", "six", "six", "sixth", ],
		["7", "seven", "seven", "seven", "seven", "seventh", ],
		["8", "eight", "eight", "eight", "eight", "eighth", ],
		["9", "nine", "nine", "nine", "nine", "ninth", ],
		["10", "ten", "one, zero", "ten", "ten", "tenth", ],
		["11", "eleven", "one, one", "eleven", "eleven", "eleventh", ],
		["12", "twelve", "one, two", "twelve", "twelve", "twelfth", ],
		["13", "thirteen", "one, three", "thirteen", "thirteen", "thirteenth", ],
		["14", "fourteen", "one, four", "fourteen", "fourteen", "fourteenth", ],
		["15", "fifteen", "one, five", "fifteen", "fifteen", "fifteenth", ],
		["16", "sixteen", "one, six", "sixteen", "sixteen", "sixteenth", ],
		["17", "seventeen", "one, seven", "seventeen", "seventeen", "seventeenth", ],
		["18", "eighteen", "one, eight", "eighteen", "eighteen", "eighteenth", ],
		["19", "nineteen", "one, nine", "nineteen", "nineteen", "nineteenth", ],
		["20", "twenty", "two, zero", "twenty", "twenty", "twentieth", ],
		["21", "twenty-one", "two, one", "twenty-one", "twenty-one", "twenty-first", ],
		["29", "twenty-nine", "two, nine", "twenty-nine", "twenty-nine", "twenty-ninth", ],
		["99", "ninety-nine", "nine, nine", "ninety-nine", "ninety-nine", "ninety-ninth", ],

		["100", "one hundred", "one, zero, zero", "ten, zero", "one zero zero",
			"one hundredth", ],
		["101", "one hundred and one", "one, zero, one", "ten, one", "one zero one",
			"one hundred and first", ],
		["110", "one hundred and ten", "one, one, zero", "eleven, zero", "one ten",
			"one hundred and tenth", ],
		["111", "one hundred and eleven", "one, one, one", "eleven, one", "one eleven",
			"one hundred and eleventh", ],
		["900", "nine hundred", "nine, zero, zero", "ninety, zero", "nine zero zero",
			"nine hundredth", ],
		["999", "nine hundred and ninety-nine", "nine, nine, nine", "ninety-nine, nine",
			"nine ninety-nine", "nine hundred and ninety-ninth", ],

		["1000", "one thousand", "one, zero, zero, zero", "ten, zero zero",
			"one zero zero, zero", "one thousandth", ],
		["1001", "one thousand and one", "one, zero, zero, one", "ten, zero one",
			"one zero zero, one", "one thousand and first", ],
		["1010", "one thousand and ten", "one, zero, one, zero", "ten, ten",
			"one zero one, zero", "one thousand and tenth", ],
		["1100", "one thousand, one hundred", "one, one, zero, zero",
			"eleven, zero zero", "one ten, zero", "one thousand, one hundredth", ],
		["2000", "two thousand", "two, zero, zero, zero", "twenty, zero zero",
			"two zero zero, zero", "two thousandth", ],
		["10000", "ten thousand", "one, zero, zero, zero, zero", "ten, zero zero, zero",
			"one zero zero, zero zero", "ten thousandth", ],

		["100000", "one hundred thousand", "one, zero, zero, zero, zero, zero",
			"ten, zero zero, zero zero", "one zero zero, zero zero zero",
			"one hundred thousandth", ],
		["100001", "one hundred thousand and one", "one, zero, zero, zero, zero, one",
			"ten, zero zero, zero one", "one zero zero, zero zero one",
			"one hundred thousand and first", ],
		["123456", "one hundred and twenty-three thousand, four hundred and fifty-six",
			"one, two, three, four, five, six", "twelve, thirty-four, fifty-six",
			"one twenty-three, four fifty-six",
			"one hundred and twenty-three thousand, four hundred and fifty-sixth", ],
		["0123456", "one hundred and twenty-three thousand, four hundred and fifty-six",
			"zero, one, two, three, four, five, six",
			"zero one, twenty-three, forty-five, six",
			"zero twelve, three forty-five, six",
			"one hundred and twenty-three thousand, four hundred and fifty-sixth", ],

		["1234567",
			"one million, two hundred and thirty-four thousand, five hundred and sixty-seven",
			"one, two, three, four, five, six, seven", "twelve, thirty-four, fifty-six, seven",
			"one twenty-three, four fifty-six, seven",
			"one million, two hundred and thirty-four thousand, five hundred and sixty-seventh", ],
		["12345678",
			"twelve million, three hundred and forty-five thousand, six hundred and seventy-eight",
			"one, two, three, four, five, six, seven, eight",
			"twelve, thirty-four, fifty-six, seventy-eight",
			"one twenty-three, four fifty-six, seventy-eight",
			"twelve million, three hundred and forty-five thousand, six hundred and seventy-eighth", ],
		["12_345_678",
			"twelve million, three hundred and forty-five thousand, six hundred and seventy-eight",
			"one, two, three, four, five, six, seven, eight",
			"twelve, thirty-four, fifty-six, seventy-eight",
			"one twenty-three, four fifty-six, seventy-eight", ],
		["1234,5678",
			"twelve million, three hundred and forty-five thousand, six hundred and seventy-eight",
			"one, two, three, four, five, six, seven, eight",
			"twelve, thirty-four, fifty-six, seventy-eight",
			"one twenty-three, four fifty-six, seventy-eight", ],
		["1234567890",
			"one billion, two hundred and thirty-four million, five hundred and sixty-seven thousand, eight hundred and ninety",
			"one, two, three, four, five, six, seven, eight, nine, zero",
			"twelve, thirty-four, fifty-six, seventy-eight, ninety",
			"one twenty-three, four fifty-six, seven eighty-nine, zero",
			"one billion, two hundred and thirty-four million, five hundred and sixty-seven thousand, eight hundred and ninetieth", ],
		["123456789012345",
			"one hundred and twenty-three trillion, four hundred and fifty-six billion, seven hundred and eighty-nine million, twelve thousand, three hundred and forty-five",
			"one, two, three, four, five, six, seven, eight, nine, zero, one, two, three, four, five",
			"twelve, thirty-four, fifty-six, seventy-eight, ninety, twelve, thirty-four, five",
			"one twenty-three, four fifty-six, seven eighty-nine, zero twelve, three forty-five",
			"one hundred and twenty-three trillion, four hundred and fifty-six billion, seven hundred and eighty-nine million, twelve thousand, three hundred and forty-fifth", ],
		["12345678901234567890",
			"twelve quintillion, three hundred and forty-five quadrillion, six hundred and seventy-eight trillion, nine hundred and one billion, two hundred and thirty-four million, five hundred and sixty-seven thousand, eight hundred and ninety",
			"one, two, three, four, five, six, seven, eight, nine, zero, one, two, three, four, five, six, seven, eight, nine, zero",
			"twelve, thirty-four, fifty-six, seventy-eight, ninety, twelve, thirty-four, fifty-six, seventy-eight, ninety",
			"one twenty-three, four fifty-six, seven eighty-nine, zero twelve, three forty-five, six seventy-eight, ninety",
			"twelve quintillion, three hundred and forty-five quadrillion, six hundred and seventy-eight trillion, nine hundred and one billion, two hundred and thirty-four million, five hundred and sixty-seven thousand, eight hundred and ninetieth", ],

		["0.987654", "zero point nine eight seven six five four",
			"zero, point, nine, eight, seven, six, five, four",
			"zero, point, ninety-eight, seventy-six, fifty-four",
			"zero, point, nine eighty-seven, six fifty-four",
			"zero point nine eight seven six five fourth", ],
		[".987654", "point nine eight seven six five four",
			"point, nine, eight, seven, six, five, four",
			"point, ninety-eight, seventy-six, fifty-four",
			"point, nine eighty-seven, six fifty-four",
			"point nine eight seven six five fourth", ],
		["9.87654", "nine point eight seven six five four",
			"nine, point, eight, seven, six, five, four",
			"nine, point, eighty-seven, sixty-five, four",
			"nine, point, eight seventy-six, fifty-four",
			"nine point eight seven six five fourth", ],
		["98.7654", "ninety-eight point seven six five four",
			"nine, eight, point, seven, six, five, four",
			"ninety-eight, point, seventy-six, fifty-four",
			"ninety-eight, point, seven sixty-five, four",
			"ninety-eight point seven six five fourth", ],
		["987.654", "nine hundred and eighty-seven point six five four",
			"nine, eight, seven, point, six, five, four",
			"ninety-eight, seven, point, sixty-five, four",
			"nine eighty-seven, point, six fifty-four",
			"nine hundred and eighty-seven point six five fourth", ],
		["9876.54", "nine thousand, eight hundred and seventy-six point five four",
			"nine, eight, seven, six, point, five, four",
			"ninety-eight, seventy-six, point, fifty-four",
			"nine eighty-seven, six, point, fifty-four",
			"nine thousand, eight hundred and seventy-six point five fourth", ],
		["98765.4", "ninety-eight thousand, seven hundred and sixty-five point four",
			"nine, eight, seven, six, five, point, four",
			"ninety-eight, seventy-six, five, point, four",
			"nine eighty-seven, sixty-five, point, four",
			"ninety-eight thousand, seven hundred and sixty-five point fourth", ],
		["101.202.303", "one hundred and one point two zero two three zero three",
			"one, zero, one, point, two, zero, two, point, three, zero, three",
			"ten, one, point, twenty, two, point, thirty, three",
			"one zero one, point, two zero two, point, three zero three",
		]
	]

	Ordinals = {
		:numbers => {
			0		=> "0th",
			1		=> "1st",
			2		=> "2nd",
			3		=> "3rd",
			4		=> "4th",
			5		=> "5th",
			6		=> "6th",
			7		=> "7th",
			8		=> "8th",
			9		=> "9th",
			10		=> "10th",
			11		=> "11th",
			12		=> "12th",
			13		=> "13th",
			14		=> "14th",
			15		=> "15th",
			16		=> "16th",
			17		=> "17th",
			18		=> "18th",
			19		=> "19th",
			20		=> "20th",
			21		=> "21st",
			22		=> "22nd",
			23		=> "23rd",
			24		=> "24th",
			100		=> "100th",
			101		=> "101st",
			102		=> "102nd",
			103		=> "103rd",
			104		=> "104th",
		},

		:words => {
			'zero'		=> "zeroth",
			'one'		=> "first",
			'two'		=> "second",
			'three'		=> "third",
			'four'		=> "fourth",
			'five'		=> "fifth",
			'six'		=> "sixth",
			'seven'		=> "seventh",
			'eight'		=> "eighth",
			'nine'		=> "ninth",
			'ten'		=> "tenth",

			'eleven'		=> "eleventh",
			'twelve'		=> "twelfth",
			'thirteen'		=> "thirteenth",
			'fourteen'		=> "fourteenth",
			'fifteen'		=> "fifteenth",
			'sixteen'		=> "sixteenth",
			'seventeen'		=> "seventeenth",
			'eighteen'		=> "eighteenth",
			'nineteen'		=> "nineteenth",
			'twenty'		=> "twentieth",

			'twenty-one'		=> "twenty-first",
			'twenty-two'		=> "twenty-second",
			'twenty-three'		=> "twenty-third",
			'twenty-four'		=> "twenty-fourth",
			'one hundred'		=> "one hundredth",

			'one hundred and one'		=> "one hundred and first",
			'one hundred and two'		=> "one hundred and second",
			'one hundred and three'		=> "one hundred and third",
			'one hundred and four'		=> "one hundred and fourth",
		}
	}

	PresentParticiples = {
		'sees'	=> "seeing",
		'eats'	=> "eating",
		'bats'	=> "batting",
		'hates'	=> "hating",
		'spies'	=> "spying",
	}

	PluralDataLine = /^\s*(.*?)\s*->\s*(.*?)\s*(?:\|\s*(.*?)\s*)?(?:#\s*(.*))?$/
	ArticleDataLine = /^\s+(an?)\s+(.*?)\s*$/

	### Auto-generate tests for pluralization and indefinite articles
	begin
		inDataSection = false
		methodCounter = 100
		File::readlines( __FILE__ ).find_all do |line|
			case line
			when /^__END_DATA__$/
				inDataSection = false
				false

			when /^__END__$/
				inDataSection = true
				false

			else
				inDataSection
			end
		end.each do |line|
			case line
			when PluralDataLine
				singular, plural, altplural, comment = $~.to_a[1,4]
				methodName = "test_%04d_pluralize%s" %
					[ methodCounter, singular.gsub(/\W+/, '').capitalize ]
				define_method( methodName.intern ) {||
					printTestHeader "English: Plural of '#{singular}'"
					assertPlural( singular, plural, altplural, comment )
				}
				methodCounter += 1

			when ArticleDataLine
				article, word = $~.to_a[1,2]
				methodName = "test_%04d_%s%s" %
					[ methodCounter, article, word.gsub(/\W+/, '').capitalize ]
				define_method( methodName.intern ) {||
					printTestHeader "English: Indefinite article for '#{word}'"
					assertArticle( article, word )
				}

				methodCounter += 1
			else
				debug_msg "Skipped test data line '#{line.chomp}'"
			end
		end
	end

	### Overridden initializer: auto-generated test methods have an arity of 1
	### even though they don't require an argument (as of the current Ruby CVS),
	### and the default initializer throws an :invalid_test for methods with
	### arity != 0.
	def initialize( test_method_name )
        if !respond_to?( test_method_name )
			throw :invalid_test
        end
        @method_name = test_method_name
        @test_passed = true

		Linguistics::use( :en )
	end

	#################################################################
	###	T E S T S
	#################################################################

	def test_0000_loaded
		assert_respond_to Linguistics::EN, :numwords
	end

	def test_0030_numwords
		printTestHeader "English: Numbers to words"
		rval = nil

		NumberTests.each do
			|origin, regular, group1, group2, group3, numord, ordnum|

			op = "Regular numwords for #{origin}"
			assert_nothing_raised( op ) { rval = origin.en.numwords }
			assert_equal regular, rval, op

			op = "Group 1 numwords for #{origin}"
			assert_nothing_raised( op ) { rval = origin.en.numwords( :group => 1 ) }
			assert_equal group1, rval, op

			op = "Group 2 numwords for #{origin}"
			assert_nothing_raised( op ) { rval = origin.en.numwords( :group => 2 ) }
			assert_equal group2, rval, op

			op = "Group 3 numwords for #{origin}"
			assert_nothing_raised( op ) { rval = origin.en.numwords( :group => 3 ) }
			assert_equal group3, rval, op

			if numord
				op = "Numwords -> ordinal for #{origin}"
				assert_nothing_raised( op ) { rval = origin.en.numwords.en.ordinal }
				assert_equal numord, rval, op
			end
		end
	end

	def test_numwords_with_an_symboland_should_use_it_to_join_words
		rval = nil

		assert_nothing_raised do
			rval = 2006.en.numwords( :and => ' ' )
		end

		assert_equal "two thousand six", rval
	end

	def test_0040_ordinalNumbers
		printTestHeader "English: Numbers to ordinals"
		rval = nil

		Ordinals[:numbers].each do |input,output|
			op = "Ordinal for #{input.inspect}"
			assert_nothing_raised( op ) { rval = input.en.ordinal }
			assert_kind_of String, rval, op
			assert_equal output, rval, op
		end
	end

	def test_0045_ordinalWords
		printTestHeader "English: Number words to ordinals"
		rval = nil

		Ordinals[:numbers].each do |input,output|
			op = "Ordinal for #{input.inspect}"
			assert_nothing_raised( op ) { rval = input.en.ordinal }
			assert_kind_of String, rval, op
			assert_equal output, rval, op
		end
	end

	#
	# Common routines for auto-generated test methods
	#

	def assertPlural( singular, plural, altplural, comment )
		rval, pl_noun, pl_verb, pl, pl_val, altpl_val = [nil] * 6

		isNv = false
		case comment
		when /verb/i
			isNv = 'verb'
		when /noun/i
			isNv = 'noun'
		end

		op = "Pluralizing '#{singular}': "
		assert_nothing_raised( op + "plural verb" ) {
			pl_verb = singular.en.plural_verb
		}
		assert_nothing_raised( op + "plural noun" ) {
			pl_noun = singular.en.plural_noun
		}
		assert_nothing_raised( op + "plural" ) {
			pl = singular.en.plural
		}

		if !altplural.nil? && !altplural.empty?
			begin
				assert_nothing_raised( op + "classical" ) {
					Linguistics::classical = true
					altpl_val = singular.en.plural
				}
			ensure
				Linguistics::classical = false
			end
		end

		pl_val = isNv ? (isNv == "noun" ? pl_noun : pl_verb) : pl

		assert_equal plural, pl_val, "Plural of '#{singular}'"
		assert_equal altplural, altpl_val,
			"Classical plural of '#{singular}'" unless
			altplural.nil? or altplural.empty?
	end

	def assertArticle( article, word )
		rval = nil
		op = "Indefinite article for '#{word}'"
		assert_nothing_raised( op ) {
			rval = word.en.a
		}
		assert_equal "#{article} #{word}", rval, op
	end

end

### Dataset is from Lingua::EN::Inflect's test suite.
__END__

                    a  ->  some                         # INDEFINITE ARTICLE
                    a  ->  as                           # NOUN FORM
       A.C.R.O.N.Y.M.  ->  A.C.R.O.N.Y.M.s
             abscissa  ->  abscissas|abscissae
             Achinese  ->  Achinese
            acropolis  ->  acropolises
                adieu  ->  adieus|adieux
     adjutant general  ->  adjutant generals
                aegis  ->  aegises
             afflatus  ->  afflatuses
               afreet  ->  afreets|afreeti
                afrit  ->  afrits|afriti
              agendum  ->  agenda
         aide-de-camp  ->  aides-de-camp
             Alabaman  ->  Alabamans
               albino  ->  albinos
                album  ->  albums
             Alfurese  ->  Alfurese
                 alga  ->  algae
                alias  ->  aliases
                 alto  ->  altos|alti
               alumna  ->  alumnae
              alumnus  ->  alumni
             alveolus  ->  alveoli
                   am  ->  are
             am going  ->  are going
  ambassador-at-large  ->  ambassadors-at-large
            Amboinese  ->  Amboinese
          Americanese  ->  Americanese
               amoeba  ->  amoebas|amoebae
              Amoyese  ->  Amoyese
                   an  ->  some                         # INDEFINITE ARTICLE
             analysis  ->  analyses
             anathema  ->  anathemas|anathemata
           Andamanese  ->  Andamanese
             Angolese  ->  Angolese
             Annamese  ->  Annamese
              antenna  ->  antennas|antennae
                 anus  ->  anuses
                 apex  ->  apexes|apices
               apex's  ->  apexes'|apices'              # POSSESSIVE FORM
             aphelion  ->  aphelia
            apparatus  ->  apparatuses|apparatus
             appendix  ->  appendixes|appendices
                apple  ->  apples
             aquarium  ->  aquariums|aquaria
            Aragonese  ->  Aragonese
            Arakanese  ->  Arakanese
          archipelago  ->  archipelagos
                  are  ->  are
             are made  ->  are made
            armadillo  ->  armadillos
             arpeggio  ->  arpeggios
            arthritis  ->  arthritises
             asbestos  ->  asbestoses
            asparagus  ->  asparaguses
                  ass  ->  asses
             Assamese  ->  Assamese
               asylum  ->  asylums
            asyndeton  ->  asyndeta
                at it  ->  at them                      # ACCUSATIVE
                  ate  ->  ate
                atlas  ->  atlases
     attorney general  ->  attorneys general
   attorney of record  ->  attorneys of record
               aurora  ->  auroras|aurorae
             aviatrix  ->  aviatrixes|aviatrices
           aviatrix's  ->  aviatrixes'|aviatrices'
           Avignonese  ->  Avignonese
                  axe  ->  axes
                 axis  ->  axes
        Azerbaijanese  ->  Azerbaijanese
             bacillus  ->  bacilli
            bacterium  ->  bacteria
              Bahaman  ->  Bahamans
             Balinese  ->  Balinese
               bamboo  ->  bamboos
                banjo  ->  banjoes
                 bass  ->  basses                       # INSTRUMENT, NOT FISH
                basso  ->  bassos|bassi
               bathos  ->  bathoses
                 beau  ->  beaus|beaux
                 beef  ->  beefs|beeves
           beneath it  ->  beneath them                 # ACCUSATIVE
            Bengalese  ->  Bengalese
                 bent  ->  bent                         # VERB FORM
                 bent  ->  bents                        # NOUN FORM
              Bernese  ->  Bernese
            Bhutanese  ->  Bhutanese
                 bias  ->  biases
               biceps  ->  biceps
                bison  ->  bisons|bison
            Bolognese  ->  Bolognese
                bonus  ->  bonuses
             Borghese  ->  Borghese
                 boss  ->  bosses
            Bostonese  ->  Bostonese
                  box  ->  boxes
                  boy  ->  boys
                bravo  ->  bravoes
                bream  ->  bream
             breeches  ->  breeches
          bride-to-be  ->  brides-to-be
             britches  ->  britches
           bronchitis  ->  bronchitises
             bronchus  ->  bronchi
              brother  ->  brothers|brethren
            brother's  ->  brothers'|brethren's
              buffalo  ->  buffaloes|buffalo
             Buginese  ->  Buginese
                 buoy  ->  buoys
               bureau  ->  bureaus|bureaux
               Burman  ->  Burmans
              Burmese  ->  Burmese
             bursitis  ->  bursitises
                  bus  ->  buses
                 buzz  ->  buzzes
               buzzes  ->  buzz                         # VERB FORM
                by it  ->  by them                      # ACCUSATIVE
               caddis  ->  caddises
                 cake  ->  cakes
            Calabrese  ->  Calabrese
                 calf  ->  calves
               callus  ->  calluses
          Camaldolese  ->  Camaldolese
                cameo  ->  cameos
               campus  ->  campuses
                  can  ->  cans                         # NOUN FORM
                  can  ->  can                          # VERB FORM (all pers.)
          candelabrum  ->  candelabra
             cannabis  ->  cannabises
                canto  ->  cantos
            Cantonese  ->  Cantonese
               cantus  ->  cantus
               canvas  ->  canvases
              CAPITAL  ->  CAPITALS
            carcinoma  ->  carcinomas|carcinomata
                 care  ->  cares
                cargo  ->  cargoes
            Carlylese  ->  Carlylese
                 carp  ->  carp
            Cassinese  ->  Cassinese
                  cat  ->  cats
              catfish  ->  catfish
             Celanese  ->  Celanese
            Ceylonese  ->  Ceylonese
             chairman  ->  chairmen
              chamois  ->  chamois
                chaos  ->  chaoses
              chapeau  ->  chapeaus|chapeaux
             charisma  ->  charismas|charismata
               chases  ->  chase
              chassis  ->  chassis
              chateau  ->  chateaus|chateaux
               cherub  ->  cherubs|cherubim
           chickenpox  ->  chickenpox
                chief  ->  chiefs
                child  ->  children
              Chinese  ->  Chinese
               chorus  ->  choruses
               church  ->  churches
             cicatrix  ->  cicatrixes|cicatrices
               circus  ->  circuses
                class  ->  classes
              classes  ->  class                        # VERB FORM
             clippers  ->  clippers
             clitoris  ->  clitorises|clitorides
                  cod  ->  cod
                codex  ->  codices
               coitus  ->  coitus
             commando  ->  commandos
           compendium  ->  compendiums|compendia
             Congoese  ->  Congoese
            Congolese  ->  Congolese
           conspectus  ->  conspectuses
            contralto  ->  contraltos|contralti
          contretemps  ->  contretemps
            conundrum  ->  conundrums
                corps  ->  corps
               corpus  ->  corpuses|corpora
               cortex  ->  cortexes|cortices
               cosmos  ->  cosmoses
        court martial  ->  courts martial
                  cow  ->  cows|kine
              cranium  ->  craniums|crania
            crescendo  ->  crescendos
            criterion  ->  criteria
           curriculum  ->  curriculums|curricula
                 dais  ->  daises
           data point  ->  data points
                datum  ->  data
               debris  ->  debris
              decorum  ->  decorums
                 deer  ->  deer
           delphinium  ->  delphiniums
          desideratum  ->  desiderata
             diabetes  ->  diabetes
               dictum  ->  dictums|dicta
                  did  ->  did
             did need  ->  did need
            digitalis  ->  digitalises
                dingo  ->  dingoes
              diploma  ->  diplomas|diplomata
               discus  ->  discuses
                 dish  ->  dishes
                ditto  ->  dittos
                djinn  ->  djinn
                 does  ->  do
                  dog  ->  dogs
                dogma  ->  dogmas|dogmata
           dominatrix  ->  dominatrixes|dominatrices
               domino  ->  dominoes
            Dongolese  ->  Dongolese
                drama  ->  dramas|dramata
                 drum  ->  drums
                dwarf  ->  dwarves
               dynamo  ->  dynamos
                edema  ->  edemas|edemata
                eland  ->  elands|eland
                  elf  ->  elves
                  elk  ->  elks|elk
               embryo  ->  embryos
             emporium  ->  emporiums|emporia
         encephalitis  ->  encephalitises
             enconium  ->  enconiums|enconia
                enema  ->  enemas|enemata
               enigma  ->  enigmas|enigmata
            ephemeris  ->  ephemerides
            epidermis  ->  epidermises
              erratum  ->  errata
                ethos  ->  ethoses
           eucalyptus  ->  eucalyptuses
             extremum  ->  extrema
                 eyas  ->  eyases
             factotum  ->  factotums
              Faroese  ->  Faroese
                fauna  ->  faunas|faunae
                  fax  ->  faxes
            Ferrarese  ->  Ferrarese
                ferry  ->  ferries
                fetus  ->  fetuses
               fiance  ->  fiances
              fiancee  ->  fiancees
               fiasco  ->  fiascos
                 fish  ->  fish
                 fizz  ->  fizzes
             flamingo  ->  flamingoes
                flora  ->  floras|florae
             flounder  ->  flounder
                focus  ->  focuses|foci
               foetus  ->  foetuses
                folio  ->  folios
           Foochowese  ->  Foochowese
                 foot  ->  feet
               foot's  ->  feet's                       # POSSESSIVE FORM
              foramen  ->  foramens|foramina
              formula  ->  formulas|formulae
                forum  ->  forums
               fought  ->  fought
                  fox  ->  foxes
             from him  ->  from them
              from it  ->  from them                    # ACCUSATIVE
               fungus  ->  funguses|fungi
             Gabunese  ->  Gabunese
              gallows  ->  gallows
             ganglion  ->  ganglions|ganglia
                  gas  ->  gases
               gateau  ->  gateaus|gateaux
                 gave  ->  gave
        generalissimo  ->  generalissimos
             Genevese  ->  Genevese
                genie  ->  genies|genii
               genius  ->  geniuses|genii
              Genoese  ->  Genoese
                genus  ->  genera
               German  ->  Germans
               ghetto  ->  ghettos
           Gilbertese  ->  Gilbertese
              glottis  ->  glottises
              Goanese  ->  Goanese
                goose  ->  geese
     Governor General  ->  Governors General
                  goy  ->  goys|goyim
             graffiti  ->  graffiti
             graffito  ->  graffiti
                guano  ->  guanos
            guardsman  ->  guardsmen
             Guianese  ->  Guianese
                gumma  ->  gummas|gummata
            gymnasium  ->  gymnasiums|gymnasia
                  had  ->  had
          had thought  ->  had thought
            Hainanese  ->  Hainanese
         handkerchief  ->  handkerchiefs
             Hararese  ->  Hararese
            Harlemese  ->  Harlemese
            harmonium  ->  harmoniums
                  has  ->  have
           has become  ->  have become
             has been  ->  have been
             has-been  ->  has-beens
             Havanese  ->  Havanese
                 have  ->  have
        have conceded  ->  have conceded
                   he  ->  they
         headquarters  ->  headquarters
            Heavenese  ->  Heavenese
                helix  ->  helices
            hepatitis  ->  hepatitises
                  her  ->  them                         # PRONOUN
                  her  ->  their                        # POSSESSIVE ADJ
                 hero  ->  heroes
               herpes  ->  herpes
                 hers  ->  theirs                       # POSSESSIVE NOUN
              herself  ->  themselves
               hiatus  ->  hiatuses|hiatus
            highlight  ->  highlights
              hijinks  ->  hijinks
                  him  ->  them
              himself  ->  themselves
         hippopotamus  ->  hippopotamuses|hippopotami
           Hiroshiman  ->  Hiroshimans
                  his  ->  their                        # POSSESSIVE ADJ
                  his  ->  theirs                       # POSSESSIVE NOUN
           honorarium  ->  honorariums|honoraria
                 hoof  ->  hoofs|hooves
           Hoosierese  ->  Hoosierese
         Hottentotese  ->  Hottentotese
                house  ->  houses
            housewife  ->  housewives
               hubris  ->  hubrises
                human  ->  humans
             Hunanese  ->  Hunanese
                hydra  ->  hydras|hydrae
           hyperbaton  ->  hyperbata
            hyperbola  ->  hyperbolas|hyperbolae
                    I  ->  we
                 ibis  ->  ibises
            ignoramus  ->  ignoramuses
              impetus  ->  impetuses|impetus
              incubus  ->  incubuses|incubi
                index  ->  indexes|indices
          Indochinese  ->  Indochinese
              inferno  ->  infernos
              innings  ->  innings
    Inspector General  ->  Inspectors General
          interregnum  ->  interregnums|interregna
                 iris  ->  irises|irides
                   is  ->  are
             is eaten  ->  are eaten
                   it  ->  they                         # NOMINATIVE
                  its  ->  their                        # POSSESSIVE FORM
               itself  ->  themselves
           jackanapes  ->  jackanapes
             Japanese  ->  Japanese
             Javanese  ->  Javanese
                Jerry  ->  Jerrys
                jerry  ->  jerries
                 jinx  ->  jinxes
               jinxes  ->  jinx                         # VERB FORM
           Johnsonese  ->  Johnsonese
                Jones  ->  Joneses
                jumbo  ->  jumbos
             Kanarese  ->  Kanarese
           Kiplingese  ->  Kiplingese
                knife  ->  knives                       # NOUN FORM
                knife  ->  knife                        # VERB FORM (1st/2nd pers.)
               knifes  ->  knife                        # VERB FORM (3rd pers.)
             Kongoese  ->  Kongoese
            Kongolese  ->  Kongolese
               lacuna  ->  lacunas|lacunae
      lady in waiting  ->  ladies in waiting
            Lapponese  ->  Lapponese
               larynx  ->  larynxes|larynges
                latex  ->  latexes|latices
                 leaf  ->  leaf                         # VERB FORM (1st/2nd pers.)
                 leaf  ->  leaves                       # NOUN FORM
                leafs  ->  leaf                         # VERB FORM (3rd pers.)
             Lebanese  ->  Lebanese
                lemma  ->  lemmas|lemmata
                 lens  ->  lenses
              Leonese  ->  Leonese
      lick of the cat  ->  licks of the cat
   Lieutenant General  ->  Lieutenant Generals
                 life  ->  lives
                Liman  ->  Limans
                lingo  ->  lingos
                 loaf  ->  loaves
                locus  ->  loci
            Londonese  ->  Londonese
           Lorrainese  ->  Lorrainese
             lothario  ->  lotharios
                louse  ->  lice
             Lucchese  ->  Lucchese
              lumbago  ->  lumbagos
                lumen  ->  lumens|lumina
              lustrum  ->  lustrums|lustra
               lyceum  ->  lyceums
             lymphoma  ->  lymphomas|lymphomata
                 lynx  ->  lynxes
              Lyonese  ->  Lyonese
               M.I.A.  ->  M.I.A.s
             Macanese  ->  Macanese
          Macassarese  ->  Macassarese
             mackerel  ->  mackerel
                 made  ->  made
             Madurese  ->  Madurese
                magma  ->  magmas|magmata
              magneto  ->  magnetos
        Major General  ->  Major Generals
           Malabarese  ->  Malabarese
              Maltese  ->  Maltese
                  man  ->  men
             mandamus  ->  mandamuses
            manifesto  ->  manifestos
               mantis  ->  mantises
              marquis  ->  marquises
                 Mary  ->  Marys
              maximum  ->  maximums|maxima
              measles  ->  measles
               medico  ->  medicos
               medium  ->  mediums|media
             medium's  ->  mediums'|media's
               medusa  ->  medusas|medusae
           memorandum  ->  memorandums|memoranda
             meniscus  ->  menisci
            Messinese  ->  Messinese
        metamorphosis  ->  metamorphoses
           metropolis  ->  metropolises
                 mews  ->  mews
               miasma  ->  miasmas|miasmata
             Milanese  ->  Milanese
               milieu  ->  milieus|milieux
            millenium  ->  milleniums|millenia
              minimum  ->  minimums|minima
                 minx  ->  minxes
                 miss  ->  miss                         # VERB FORM (1st/2nd pers.)
                 miss  ->  misses                       # NOUN FORM
               misses  ->  miss                         # VERB FORM (3rd pers.)
             mittamus  ->  mittamuses
             Modenese  ->  Modenese
             momentum  ->  momentums|momenta
                money  ->  monies
             mongoose  ->  mongooses
                moose  ->  mooses|moose
        mother-in-law  ->  mothers-in-law
                mouse  ->  mice
                mumps  ->  mumps
             Muranese  ->  Muranese
                murex  ->  murices
               museum  ->  museums
            mustachio  ->  mustachios
                   my  ->  our                          # POSSESSIVE FORM
               myself  ->  ourselves
               mythos  ->  mythoi
            Nakayaman  ->  Nakayamans
           Nankingese  ->  Nankingese
           nasturtium  ->  nasturtiums
            Navarrese  ->  Navarrese
               nebula  ->  nebulas|nebulae
             Nepalese  ->  Nepalese
             neuritis  ->  neuritises
             neurosis  ->  neuroses
                 news  ->  news
                nexus  ->  nexus
              Niasese  ->  Niasese
           Nicobarese  ->  Nicobarese
               nimbus  ->  nimbuses|nimbi
            Nipponese  ->  Nipponese
                   no  ->  noes
              nostrum  ->  nostrums
             noumenon  ->  noumena
                 nova  ->  novas|novae
            nucleolus  ->  nucleoluses|nucleoli
              nucleus  ->  nuclei
                  oaf  ->  oafs
               octavo  ->  octavos
              octopus  ->  octopuses|octopodes
               oedema  ->  oedemas|oedemata
            Oklahoman  ->  Oklahomans
              omnibus  ->  omnibuses
                on it  ->  on them                      # ACCUSATIVE
                 onus  ->  onuses
                opera  ->  operas
              optimum  ->  optimums|optima
                 opus  ->  opuses|opera
              organon  ->  organa
          ought to be  ->  ought to be                  # VERB (UNLIKE bride to be)
                 ovum  ->  ova
                   ox  ->  oxen
                 ox's  ->  oxen's                       # POSSESSIVE FORM
             oxymoron  ->  oxymorons|oxymora
              Panaman  ->  Panamans
             parabola  ->  parabolas|parabolae
              Parmese  ->  Parmese
               pathos  ->  pathoses
              pegasus  ->  pegasuses
            Pekingese  ->  Pekingese
               pelvis  ->  pelvises
             pendulum  ->  pendulums
                penis  ->  penises|penes
             penumbra  ->  penumbras|penumbrae
           perihelion  ->  perihelia
              persona  ->  personae
            petroleum  ->  petroleums
              phalanx  ->  phalanxes|phalanges
                  PhD  ->  PhDs
           phenomenon  ->  phenomena
             philtrum  ->  philtrums
                photo  ->  photos
               phylum  ->  phylums|phyla
                piano  ->  pianos|piani
          Piedmontese  ->  Piedmontese
               pincer  ->  pincers
              pincers  ->  pincers
            Pistoiese  ->  Pistoiese
              plateau  ->  plateaus|plateaux
                 play  ->  plays
               plexus  ->  plexuses|plexus
               pliers  ->  pliers
                plies  ->  ply                          # VERB FORM
                polis  ->  polises
             Polonese  ->  Polonese
             pontifex  ->  pontifexes|pontifices
          portmanteau  ->  portmanteaus|portmanteaux
           Portuguese  ->  Portuguese
               potato  ->  potatoes
                  pox  ->  pox
               pragma  ->  pragmas|pragmata
              premium  ->  premiums
          prima donna  ->  prima donnas|prime donne
                  pro  ->  pros
          proceedings  ->  proceedings
         prolegomenon  ->  prolegomena
                proof  ->  proofs
     proof of concept  ->  proofs of concept
          prosecutrix  ->  prosecutrixes|prosecutrices
           prospectus  ->  prospectuses|prospectus
            protozoan  ->  protozoans
            protozoon  ->  protozoa
                  put  ->  put
              quantum  ->  quantums|quanta
quartermaster general  ->  quartermasters general
               quarto  ->  quartos
               quorum  ->  quorums
               rabies  ->  rabies
               radius  ->  radiuses|radii
                radix  ->  radices
                rebus  ->  rebuses
             reindeer  ->  reindeer
                rhino  ->  rhinos
           rhinoceros  ->  rhinoceroses|rhinoceros
            Romagnese  ->  Romagnese
             Romanese  ->  Romanese
                romeo  ->  romeos
                 roof  ->  roofs
              rostrum  ->  rostrums|rostra
               ruckus  ->  ruckuses
               salmon  ->  salmon
            Sangirese  ->  Sangirese
                 sank  ->  sank
           Sarawakese  ->  Sarawakese
              sarcoma  ->  sarcomas|sarcomata
            sassafras  ->  sassafrases
                  saw  ->  saws                         # NOUN FORM
                  saw  ->  saw                          # VERB FORM (1st/2nd pers.)
                 saws  ->  saw                          # VERB FORM (3rd pers.)
                scarf  ->  scarves
               schema  ->  schemas|schemata
             scissors  ->  scissors
             Scotsman  ->  Scotsmen
             sea-bass  ->  sea-bass
                 self  ->  selves
               Selman  ->  Selmans
           Senegalese  ->  Senegalese
               seraph  ->  seraphs|seraphim
               series  ->  series
            shall eat  ->  shall eat
              Shavese  ->  Shavese
            Shawanese  ->  Shawanese
                  she  ->  they
                sheaf  ->  sheaves
               shears  ->  shears
                sheep  ->  sheep
                shelf  ->  shelves
          should have  ->  should have
              Siamese  ->  Siamese
              Sienese  ->  Sienese
            Sikkimese  ->  Sikkimese
                silex  ->  silices
              simplex  ->  simplexes|simplices
           Singhalese  ->  Singhalese
            Sinhalese  ->  Sinhalese
                sinus  ->  sinuses|sinus
                 size  ->  sizes
                sizes  ->  size                         #VERB FORM
             smallpox  ->  smallpox
                Smith  ->  Smiths
           Sogdianese  ->  Sogdianese
            soliloquy  ->  soliloquies
                 solo  ->  solos|soli
                 soma  ->  somas|somata
       son of a bitch  ->  sons of bitches
              Sonaman  ->  Sonamans
              soprano  ->  sopranos|soprani
               sought  ->  sought
              species  ->  species
             spectrum  ->  spectrums|spectra
             speculum  ->  speculums|specula
                spent  ->  spent
         spermatozoon  ->  spermatozoa
               sphinx  ->  sphinxes|sphinges
              stadium  ->  stadiums|stadia
               stamen  ->  stamens|stamina
               status  ->  statuses|status
               stereo  ->  stereos
               stigma  ->  stigmas|stigmata
             stimulus  ->  stimuli
                stoma  ->  stomas|stomata
               storey  ->  storeys
                story  ->  stories
              stratum  ->  strata
               strife  ->  strifes
                stylo  ->  stylos
               stylus  ->  styluses|styli
             succubus  ->  succubuses|succubi
             Sudanese  ->  Sudanese
               suffix  ->  suffixes
            Sundanese  ->  Sundanese
             superior  ->  superiors
      Surgeon-General  ->  Surgeons-General
              surplus  ->  surpluses
            Swahilese  ->  Swahilese
                swine  ->  swines|swine
              syringe  ->  syringes
               syrinx  ->  syrinxes|syringes
              tableau  ->  tableaus|tableaux
              Tacoman  ->  Tacomans
               tattoo  ->  tattoos
                tempo  ->  tempos|tempi
           Tenggerese  ->  Tenggerese
            testatrix  ->  testatrixes|testatrices
               testes  ->  testes
               testis  ->  testes
                 that  ->  those
                their  ->  their                        # POSSESSIVE FORM (GENDER-INCLUSIVE)
             themself  ->  themselves                   # ugly but gaining currency
                 they  ->  they                         # for indeterminate gender
                 this  ->  these
              thought  ->  thought                      # VERB FORM
              thought  ->  thoughts                     # NOUN FORM
                Times  ->  Timeses
             Timorese  ->  Timorese
             Tirolese  ->  Tirolese
               to her  ->  to them
           to herself  ->  to themselves
               to him  ->  to them
           to himself  ->  to themselves
                to it  ->  to them
                to it  ->  to them                      # ACCUSATIVE
            to itself  ->  to themselves
                to me  ->  to us
            to myself  ->  to ourselves
              to them  ->  to them                      # for indeterminate gender
          to themself  ->  to themselves                # ugly but gaining currency
               to you  ->  to you
          to yourself  ->  to yourselves
            Tocharese  ->  Tocharese
               tomato  ->  tomatoes
            Tonkinese  ->  Tonkinese
          tonsillitis  ->  tonsillitises
                tooth  ->  teeth
             Torinese  ->  Torinese
                torus  ->  toruses|tori
            trapezium  ->  trapeziums|trapezia
               trauma  ->  traumas|traumata
              travois  ->  travois
              trellis  ->  trellises
                tries  ->  try
               trilby  ->  trilbys
             trousers  ->  trousers
            trousseau  ->  trousseaus|trousseaux
                trout  ->  trout
                  try  ->  tries
                 tuna  ->  tuna
                 turf  ->  turfs|turves
             Tyrolese  ->  Tyrolese
            ultimatum  ->  ultimatums|ultimata
            umbilicus  ->  umbilicuses|umbilici
                umbra  ->  umbras|umbrae
               uterus  ->  uteruses|uteri
               vacuum  ->  vacuums|vacua
               vellum  ->  vellums
                velum  ->  velums|vela
           Vermontese  ->  Vermontese
             Veronese  ->  Veronese
             vertebra  ->  vertebrae
               vertex  ->  vertexes|vertices
             Viennese  ->  Viennese
           Vietnamese  ->  Vietnamese
                virus  ->  viruses
                vixen  ->  vixens
               vortex  ->  vortexes|vortices
               walrus  ->  walruses
                  was  ->  were
       was faced with  ->  were faced with
           was hoping  ->  were hoping
           Wenchowese  ->  Wenchowese
                 were  ->  were
           were found  ->  were found
                wharf  ->  wharves
              whiting  ->  whiting
           Whitmanese  ->  Whitmanese
                 wife  ->  wives
           wildebeest  ->  wildebeests|wildebeest
                 will  ->  will                         # VERB FORM
                 will  ->  wills                        # NOUN FORM
             will eat  ->  will eat                     # VERB FORM
                wills  ->  will                         # VERB FORM
                 wish  ->  wishes
             with him  ->  with them
              with it  ->  with them                    # ACCUSATIVE
                 wolf  ->  wolves
                woman  ->  women
   woman of substance  ->  women of substance
              woman's  ->  women's                      # POSSESSIVE FORM
            woodlouse  ->  woodlice
              Yakiman  ->  Yakimans
             Yengeese  ->  Yengeese
            Yokohaman  ->  Yokohamans
                  you  ->  you
                 your  ->  your                         # POSSESSIVE FORM
             yourself  ->  yourselves
                Yuman  ->  Yumans
            Yunnanese  ->  Yunnanese
                 zoon  ->  zoa

	an A.B.C
	an AI
	an AGE
	an agendum
	an aide-de-camp
	an albino
	 a B.L.T. sandwich
	 a BMW
	 a BLANK
	 a bacterium
	 a Burmese restaurant
	 a C.O.
	 a CCD
	 a COLON
	 a cameo
	 a CAPITAL
	 a D.S.M.
	 a DNR
	 a DINNER
	 a dynamo
	an E.K.G.
	an ECG
	an EGG
	an embryo
	an erratum
	 a eucalyptus
	an Euler number
	 a eulogy
	 a euphemism
	 a euphoria
	 a ewe
	 a ewer
	an extremum
	an eye
	an F.B.I. agent
	an FSM
	 a FACT
	 a FAQ
	an F.A.Q.
	 a fish
	 a G-string
	 a GSM phone
	 a GOD
	 a genus
	 a Governor General
	an H-Bomb
	an H.M.S Ark Royal
	an HSL colour space
	 a HAL 9000
	an H.A.L. 9000
	 a has-been
	 a height
	an heir
	 a honed blade
	an honest man
	 a honeymoon
	an honorarium
	an honorary degree
	an honoree
	an honorific
	 a Hough transform
	 a hound
	an hour
	an hourglass
	 a houri
	 a house
	an I.O.U.
	an IQ
	an IDEA
	an inferno
	an Inspector General
	 a jumbo
	 a knife
	an L.E.D.
	 a LED
	an LCD
	 a lady in waiting
	 a leaf
	an M.I.A.
	 a MIASMA
	an MTV channel
	 a Major General
	an N.C.O.
	an NCO
	 a NATO country
	 a note
	an O.K.
	an OK
	an OLE
	an octavo
	an octopus
	an okay
	 a once-and-future-king
	an oncologist
	 a one night stand
	an onerous task
	an opera
	an optimum
	an opus
	an ox
	 a Ph.D.
	 a PET
	 a P.E.T. scan
	 a plateau
	 a quantum
	an R.S.V.P.
	an RSVP
	 a REST
	 a reindeer
	an S.O.S.
	 a SUM
	an SST
	 a salmon
	 a T.N.T. bomb
	 a TNT bomb
	 a TENT
	 a thought
	 a tomato
	 a U-boat
	 a U.F.O.
	 a UFO
	 a ubiquity
	 a unicorn
	an unidentified flying object
	 a uniform
	 a unimodal system
	an unimpressive record
	an uninformed opinion
	an uninvited guest
	 a union
	 a uniplex
	 a uniprocessor
	 a unique opportunity
	 a unisex hairdresser
	 a unison
	 a unit
	 a unitarian
	 a united front
	 a unity
	 a univalent bond
	 a univariate statistic
	 a universe
	an unordered meal
	 a uranium atom
	an urban myth
	an urbane miss
	an urchin
	 a urea detector
	 a urethane monomer
	an urge
	an urgency
	 a urinal
	an urn
	 a usage
	 a use
	an usher
	 a usual suspect
	 a usurer
	 a usurper
	 a utensil
	 a utility
	an utmost urgency
	 a utopia
	an utterance
	 a V.I.P.
	 a VIPER
	 a viper
	an X-ray
	an X.O.
	 a XYLAPHONE
	an XY chromosome
	 a xenophobe
	 a Y-shaped pipe
	 a Y.Z. plane
	 a YMCA
	an YBLENT eye
	an yblent eye
	an yclad body
	 a yellowing
	 a yield
	 a youth
	 a youth
	an ypsiliform junction
	an yttrium atom
	 a zoo

__END_DATA__


text:
#ifndef TEXTWIDGET_H
#define TEXTWIDGET_H

#include <string>
#include <algorithm>

#include "../enums.h"
#include "../MLIFont.h"
#include "../LocalizableContent.h"
#include "../Utils.h"

using namespace std;

class TextWidget : public ILocalizableTextOwner
{
public:

    TextWidget(const string &textId = "", MLIFont *pFont = NULL, Color textColor = Color(1.0, 0.0, 0.0, 0.0),
               HAlignment hAlignment = HAlignmentLeft, VAlignment vAlignment = VAlignmentTop);
    virtual ~TextWidget();

    void Draw() const;
    void Draw(double x, double y, HAlignment hAlignment) const;
    void Draw(double x, double y, HAlignment hAlignment, VAlignment vAlignment) const;
    void Update(int delta) { }
    bool IsReady() const { return true; }

    const string & GetText() const { return this->text; }
    void SetText(const string &text);
    void SetTextId(const string &textId);

    MLIFont * GetFont() const { return this->pFont; }
    void SetFont(MLIFont *pFont) { this->pFont = pFont; }

    const Color & GetTextColor() const { return this->textColor; }
    void SetTextColor(const Color &textColor) { this->textColor = textColor; }

    HAlignment GetTextAlignment() const { return this->hAlignment; }
    void SetTextAlignment(HAlignment textAlignment) { this->hAlignment = textAlignment; }

    double GetOpacity() const { return this->textColor.GetA(); }
    void SetOpacity(double opacity) { return this->textColor.SetA(opacity); }

    double GetX() const { return this->x; }
    void SetX(double x) { this->x = x; }

    double GetY() const { return this->y; }
    void SetY(double y) { this->y = y; }

    double GetWidth() const { return this->width; }
    void SetWidth(double width) { this->width = width; }

    double GetHeight() const { return this->height; }
    void SetHeight(double height) { this->height = height; }

    void WrapText() { WrapText(GetWidth()); }
    void WrapText(double width);

    void FitSizeToContent();
    void ReloadLocalizableText() override;

private:

    double GetTextHeight() const;
    double GetTextWidth() const;
    void SplitText(double maxWidth);

    string textId;
    string text;
    double wrapTextWidth;
    MLIFont *pFont;
    Color textColor;
    HAlignment hAlignment;
    VAlignment vAlignment;

    double x;
    double y;
    double width;
    double height;

    deque<string> lines;
};

#endif // TEXTWIDGET_H

redpajama_set_name: RedPajamaGithub


text:
<title>
Pressure builds on military recruiters
</title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<?php include "../../legacy-includes/Script.htmlf" ?>

<?php include "../../legacy-includes/TopLogo.htmlf" ?>

<?php include "../../legacy-includes/TopAd.htmlf" ?>

<?php include "../../legacy-includes/LeftButtons.htmlf" ?>

<?php include "../../legacy-includes/BodyInsert.htmlf" ?>

Pressure builds on military recruiters

By Eric Ruder | May 20, 2005 | Page 1

THE U.S. military is having trouble recruiting enough people to fill its ranks. And now Pentagon officials admit that they're also having trouble getting their recruiters to follow the law.

On May 20, the U.S. Army's 7,500 recruiters will halt recruiting activities for a day to hold a nationwide "values stand-down." "It's ethics-under-pressure training," said Douglas Smith, spokesperson for the Army's recruiting command. "Some of it is simply part of an Army-wide reaffirmation of ethics. It also is directly related to the allegations that we've seen of recruiting improprieties."

This is an admission that recruiters are bending the rules--or worse--to meet recruiting quotas.

In Ohio, one family reported that recruiters signed up their mentally ill son, even though the Army's own rules forbid this. "David McSwane, a 17-year-old who lives outside Denver, also recently caught one recruiter on tape, advising him on how to create a fake diploma, and another helping him buy a product that purportedly cleansed his system of illegal-drug residue," the New York Times reported. One recruiter gave laxatives to a recruit so that he could quickly shed weight and pass an Army physical.

In several cases, recruiters have threatened their targets with jail or arrest for missing an appointment or trying to get out of enlistment.

For three months in a row, the Army has failed to meet its recruiting quotas, and the Marines haven't met their goal since January. One reason is obvious--mounting U.S. casualties in the occupation of Iraq. In addition, counter-recruitment efforts by activists on campuses nationwide have presented new obstacles for recruiters to overcome.

The pressure that Army officials put on recruiters is so intense, however, that some told the New York Times that "they were not convinced the content of the training would be meaningful. [These recruiters] said they saw it as a routine day of safety training, with a dose of ethics as an afterthought."

<?php include "../../legacy-includes/BottomNavLinks.htmlf" ?>

<?php include "../../legacy-includes/RightAdFolder.htmlf" ?>


text:
<?
	include_once($PagePrefix.'database.class.php');
	include_once($PagePrefix.'project.class.php');

class Entity {
	var $Id;
	var $Code;
	var $IdProject;
	var $Description;
	var $Name;
	var $SetName;
	var $TableName;
	var $Descriptor;
	var $PluralDescriptor;
	var $Genre;
	var $Comments;
	var $DateTimeInsert;
	var $DateTimeUpdate;

	var $Fields;
	var $Project;

	function &LoadById($Id) {
		$ent = new Entity();
		Database::LoadObjectById($ent,'entities',$Id);
		return $ent;
	}

	function &GetFields() {
		if (!$this->Fields) {
			$this->Fields = array();
			$rs = mysql_query("select * from entity_fields where IdEntity = $this->Id order by OrderNo, Id");

			while ($fld = mysql_fetch_object($rs))
				$this->Fields[] = $fld;

			mysql_free_result($rs);
		}

		return $this->Fields;
	}

	function GetFieldNames() {
		$flds = $this->GetFields();
		$names = array();

		foreach ($flds as $fld)
			$names[] = $fld->Name;

		return $names;
	}

	function GetFieldList() {
		$names = $this->GetFieldNames();

		return join(',',$names);
	}

	function GetIdField() {
		$flds = $this->GetFields();

		return $flds[0];
	}

	function GetDescriptorField() {
		$flds = $this->GetFields();

		return $flds[1];
	}

	function GetProject() {
		if (!$this->Project) {
			$this->Project = Project::LoadById($this->IdProject);
		}

		return $this->Project;
	}

	function GetGenre() {
		if ($this->Genre=='F' || $this->Genre=='f')
			return 'a';
		return 'o';
	}
}

?>


text:
package org.apache.camel.itest.karaf;

import java.io.File;
import java.io.InputStream;
import java.lang.reflect.Field;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;

import javax.inject.Inject;

import org.apache.camel.CamelContext;
import org.apache.camel.impl.DefaultRouteContext;
import org.apache.camel.model.DataFormatDefinition;
import org.apache.camel.osgi.CamelContextFactory;

import org.junit.After;
import org.junit.Before;

import org.ops4j.pax.exam.Option;
import org.ops4j.pax.exam.karaf.options.KarafDistributionOption;
import org.ops4j.pax.exam.karaf.options.LogLevelOption;
import org.ops4j.pax.exam.options.MavenArtifactProvisionOption;
import org.ops4j.pax.exam.options.UrlReference;
import org.osgi.framework.BundleContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import static org.junit.Assert.assertNotNull;

import static org.ops4j.pax.exam.CoreOptions.maven;
import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
import static org.ops4j.pax.exam.CoreOptions.vmOption;

public abstract class AbstractFeatureTest {

    private static final Logger LOG = LoggerFactory.getLogger(AbstractFeatureTest.class);

    @Inject
    protected BundleContext bundleContext;

    @Before
    public void setUp() throws Exception {
        LOG.info("Calling the setUp method ");
        LOG.info("The BundleContext is " + bundleContext);
        Thread.sleep(3000);
    }

    @After
    public void tearDown() throws Exception {
        LOG.info("Calling the tearDown method ");
    }

    protected void testComponent(String component) throws Exception {
        long max = System.currentTimeMillis() + 10000;
        while (true) {
            try {
                assertNotNull("Cannot get component with name: " + component, createCamelContext().getComponent(component));
                return;
            } catch (Exception t) {
                if (System.currentTimeMillis() < max) {
                    Thread.sleep(1000);
                } else {
                    throw t;
                }
            }
        }
    }

    protected void testComponent() throws Exception {
        testComponent(extractName(getClass()));
    }

    protected void testDataFormat(String format) throws Exception {
        long max = System.currentTimeMillis() + 10000;
        while (true) {
            try {
                DataFormatDefinition dataFormatDefinition = createDataformatDefinition(format);
                assertNotNull(dataFormatDefinition);
                assertNotNull(dataFormatDefinition.getDataFormat(new DefaultRouteContext(createCamelContext())));
                return;
            } catch (Exception t) {
                if (System.currentTimeMillis() < max) {
                    Thread.sleep(1000);
                } else {
                    throw t;
                }
            }
        }
    }

    protected DataFormatDefinition createDataformatDefinition(String format) {
        return null;
    }

    protected void testLanguage(String lang) throws Exception {
        long max = System.currentTimeMillis() + 10000;
        while (true) {
            try {
                assertNotNull(createCamelContext().resolveLanguage(lang));
                return;
            } catch (Exception t) {
                if (System.currentTimeMillis() < max) {
                    Thread.sleep(1000);
                } else {
                    throw t;
                }
            }
        }
    }

    protected CamelContext createCamelContext() throws Exception {
        LOG.info("Creating the CamelContext ...");
        setThreadContextClassLoader();
        CamelContextFactory factory = new CamelContextFactory();
        factory.setBundleContext(bundleContext);
        LOG.info("Get the bundleContext is " + bundleContext);
        return factory.createContext();
    }

    protected void setThreadContextClassLoader() {
        // set the thread context classloader current bundle classloader
        Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
    }

    public static String extractName(Class<?> clazz) {
        String name = clazz.getName();
        int id0 = name.indexOf("Camel") + "Camel".length();
        int id1 = name.indexOf("Test");
        StringBuilder sb = new StringBuilder();
        for (int i = id0; i < id1; i++) {
            char c = name.charAt(i);
            if (Character.isUpperCase(c) && sb.length() > 0) {
                sb.append("-");
            }
            sb.append(Character.toLowerCase(c));
        }
        return sb.toString();
    }

    public static UrlReference getCamelKarafFeatureUrl() {
        return mavenBundle().
                groupId("org.apache.camel.karaf").
                artifactId("apache-camel").
                versionAsInProject().type("xml/features");
    }

    public static UrlReference getKarafFeatureUrl() {
        String karafVersion = System.getProperty("karafVersion");
        LOG.info("*** The karaf version is " + karafVersion + " ***");

        String type = "xml/features";
        return mavenBundle().groupId("org.apache.karaf.assemblies.features").
            artifactId("standard").version(karafVersion).type(type);
    }

    private static void switchPlatformEncodingToUTF8() {
        try {
            System.setProperty("file.encoding", "UTF-8");
            Field charset = Charset.class.getDeclaredField("defaultCharset");
            charset.setAccessible(true);
            charset.set(null, null);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

    private static String getKarafVersion() {
        InputStream ins = AbstractFeatureTest.class.getResourceAsStream("/META-INF/maven/dependencies.properties");
        Properties p = new Properties();
        try {
            p.load(ins);
        } catch (Throwable t) {
            //
        }
        String karafVersion = p.getProperty("org.apache.karaf/apache-karaf/version");
        if (karafVersion == null) {
            karafVersion = System.getProperty("karafVersion");
        }
        if (karafVersion == null) {
            // setup the default version of it
            karafVersion = "2.4.0";
        }
        return karafVersion;
    }
    public static MavenArtifactProvisionOption getJUnitBundle() {
        MavenArtifactProvisionOption mavenOption = mavenBundle().groupId("org.apache.servicemix.bundles")
            .artifactId("org.apache.servicemix.bundles.junit");
        mavenOption.versionAsInProject().start(true).startLevel(10);
        return mavenOption;
    }

    public static Option[] configure(String mainFeature, String... extraFeatures) {
        switchPlatformEncodingToUTF8();
        String karafVersion = getKarafVersion();
        LOG.info("*** The karaf version is " + karafVersion + " ***");

        List<String> list = new ArrayList<String>();
        list.add("cxf-jaxb");
        list.add("camel-core");
        list.add("camel-spring");
        list.add("camel-" + mainFeature);
        for (String extra : extraFeatures) {
            list.add("camel-" + extra);
        }
        String[] features = list.toArray(new String[list.size()]);

        Option[] options = new Option[] {
            // for remote debugging
            //org.ops4j.pax.exam.CoreOptions.vmOption("-Xdebug"),
            //org.ops4j.pax.exam.CoreOptions.vmOption("-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5008"),

            KarafDistributionOption.karafDistributionConfiguration()
                    .frameworkUrl(maven().groupId("org.apache.karaf").artifactId("apache-karaf").type("tar.gz").versionAsInProject())
                    .karafVersion(karafVersion)
                    .name("Apache Karaf")
                    .useDeployFolder(false).unpackDirectory(new File("target/paxexam/unpack/")),

            vmOption("-Dfile.encoding=UTF-8"),

            //KarafDistributionOption.keepRuntimeFolder(),
            // override the config.properties (to fix pax-exam bug)
            //KarafDistributionOption.replaceConfigurationFile("etc/config.properties", new File("src/test/resources/org/apache/camel/itest/karaf/config.properties")),
            // Update the jre.properties to export the sun.misc package
            KarafDistributionOption.replaceConfigurationFile("etc/jre.properties", new File("src/test/resources/org/apache/camel/itest/karaf/jre.properties")),
            KarafDistributionOption.replaceConfigurationFile("etc/custom.properties", new File("src/test/resources/org/apache/camel/itest/karaf/custom.properties")),
            KarafDistributionOption.replaceConfigurationFile("etc/org.ops4j.pax.url.mvn.cfg", new File("src/test/resources/org/apache/camel/itest/karaf/org.ops4j.pax.url.mvn.cfg")),

            getJUnitBundle(),

            // we need INFO logging otherwise we cannot see what happens
            new LogLevelOption(LogLevelOption.LogLevel.INFO),

            // install the cxf jaxb spec as the karaf doesn't provide it by default
            KarafDistributionOption.features(getCamelKarafFeatureUrl(), features)
        };

        return options;
    }

    protected Option[] configureComponent() {
        return configure(extractName(getClass()));
    }

}


text:
class Hadoop < Formula
  desc "Framework for distributed processing of large data sets"
  homepage "https://hadoop.apache.org/"
  url "https://www.apache.org/dyn/closer.lua?path=hadoop/common/hadoop-3.2.1/hadoop-3.2.1.tar.gz"
  mirror "https://archive.apache.org/dist/hadoop/common/hadoop-3.2.1/hadoop-3.2.1.tar.gz"
  sha256 "f66a3a4115b8f16c1077d1a198a06854dbef0e4233291712ed08d0a10629ed37"
  revision 1

  bottle :unneeded

  depends_on "openjdk"

  conflicts_with "yarn", :because => "both install `yarn` binaries"

  def install
    rm_f Dir["bin/*.cmd", "sbin/*.cmd", "libexec/*.cmd", "etc/hadoop/*.cmd"]
    libexec.install %w[bin sbin libexec share etc]
    Dir["#{libexec}/bin/*"].each do |path|
      (bin/File.basename(path)).write_env_script path, :JAVA_HOME => Formula["openjdk"].opt_prefix
    end
    Dir["#{libexec}/sbin/*"].each do |path|
      (sbin/File.basename(path)).write_env_script path, :JAVA_HOME => Formula["openjdk"].opt_prefix
    end
    Dir["#{libexec}/libexec/*.sh"].each do |path|
      (libexec/File.basename(path)).write_env_script path, :JAVA_HOME => Formula["openjdk"].opt_prefix
    end
    # Temporary fix until https://github.com/Homebrew/brew/pull/4512 is fixed
    chmod 0755, Dir["#{libexec}/*.sh"]
  end

  test do
    system bin/"hadoop", "fs", "-ls"
  end
end


text:
package api

import "github.com/Azure/acs-engine/pkg/api/vlabs"

///////////////////////////////////////////////////////////
// The converter exposes functions to convert the top level
// ContainerService resource
//
// All other functions are internal helper functions used
// for converting.
///////////////////////////////////////////////////////////

// ConvertUpgradeContainerServiceToVLabs converts an unversioned ContainerService to a vlabs ContainerService
func ConvertUpgradeContainerServiceToVLabs(api *UpgradeContainerService) *vlabs.UpgradeContainerService {
	vlabsUCS := &vlabs.UpgradeContainerService{}
	vlabsUCS.OrchestratorProfile = &vlabs.OrchestratorProfile{}
	convertUpgradeOrchestratorProfileToVLabs(api.OrchestratorProfile, vlabsUCS.OrchestratorProfile)
	return vlabsUCS
}

func convertUpgradeOrchestratorProfileToVLabs(api *OrchestratorProfile, o *vlabs.OrchestratorProfile) {
	o.OrchestratorType = vlabs.OrchestratorType(api.OrchestratorType)

	if api.OrchestratorVersion != "" {
		o.OrchestratorVersion = vlabs.OrchestratorVersion(api.OrchestratorVersion)
	}
}


text:
package com.intellij.codeInsight.daemon.impl.quickfix;

import com.intellij.codeInsight.CodeInsightUtilBase;
import com.intellij.codeInsight.ExpectedTypeInfo;
import com.intellij.codeInsight.daemon.QuickFixBundle;
import com.intellij.codeInsight.template.Template;
import com.intellij.codeInsight.template.TemplateBuilderImpl;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.TextRange;
import com.intellij.psi.*;
import com.intellij.psi.impl.source.codeStyle.CodeEditUtil;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.psi.util.PsiUtil;
import org.jetbrains.annotations.NotNull;

/**
 * @author Mike
 */
public class CreateFieldFromUsageFix extends CreateVarFromUsageFix {
  private static final Logger LOG = Logger.getInstance("#com.intellij.codeInsight.daemon.impl.quickfix.CreateFieldFromUsageFix");

  public CreateFieldFromUsageFix(PsiReferenceExpression referenceElement) {
    super(referenceElement);
  }

  protected String getText(String varName) {
    return QuickFixBundle.message("create.field.from.usage.text", varName);
  }

  protected boolean createConstantField() {
    return false;
  }

  protected void invokeImpl(final PsiClass targetClass) {
    if (CreateFromUsageUtils.isValidReference(myReferenceExpression, true)) {
      return;
    }

    Project project = myReferenceExpression.getProject();
    PsiElementFactory factory = JavaPsiFacade.getInstance(project).getElementFactory();

    PsiMember enclosingContext = null;
    PsiClass parentClass;
    do {
      enclosingContext = PsiTreeUtil.getParentOfType(enclosingContext == null ? myReferenceExpression : enclosingContext, PsiMethod.class,
                                    PsiField.class, PsiClassInitializer.class);
      parentClass = enclosingContext == null ? null : enclosingContext.getContainingClass();
    }
    while (parentClass instanceof PsiAnonymousClass);

    PsiFile targetFile = targetClass.getContainingFile();

    ExpectedTypeInfo[] expectedTypes = CreateFromUsageUtils.guessExpectedTypes(myReferenceExpression, false);

    String fieldName = myReferenceExpression.getReferenceName();
    PsiField field;
    if (!createConstantField()) {
      field = factory.createField(fieldName, PsiType.INT);
    }
    else {
      PsiClass aClass = factory.createClassFromText("int i = 0;", null);
      field = aClass.getFields()[0];
      field.setName(fieldName);
    }
    if (enclosingContext != null && enclosingContext.getParent() == parentClass && targetClass == parentClass
        && enclosingContext instanceof PsiField) {
      field = (PsiField)targetClass.addBefore(field, enclosingContext);
    }
    else if (enclosingContext != null && enclosingContext.getParent() == parentClass && targetClass == parentClass
             && enclosingContext instanceof PsiClassInitializer) {
      field = (PsiField)targetClass.addBefore(field, enclosingContext);
      targetClass.addBefore(CodeEditUtil.createLineFeed(field.getManager()), enclosingContext);
    }
    else {
      field = (PsiField)targetClass.add(field);
    }

    setupVisibility(parentClass, targetClass, field.getModifierList());

    if (shouldCreateStaticMember(myReferenceExpression, targetClass)) {
      PsiUtil.setModifierProperty(field, PsiModifier.STATIC, true);
    }

    if (createConstantField()) {
      PsiUtil.setModifierProperty(field, PsiModifier.STATIC, true);
      PsiUtil.setModifierProperty(field, PsiModifier.FINAL, true);
    }

    TemplateBuilderImpl builder = new TemplateBuilderImpl(field);
    PsiElement context = PsiTreeUtil.getParentOfType(myReferenceExpression, PsiClass.class, PsiMethod.class);
    new GuessTypeParameters(factory)
      .setupTypeElement(field.getTypeElement(), expectedTypes, getTargetSubstitutor(myReferenceExpression),
                        builder, context, targetClass);

    if (createConstantField()) {
      builder.replaceElement(field.getInitializer(), new EmptyExpression());
    }

    builder.setEndVariableAfter(field.getNameIdentifier());
    field = CodeInsightUtilBase.forcePsiPostprocessAndRestoreElement(field);
    Template template = builder.buildTemplate();

    Editor newEditor = positionCursor(project, targetFile, field);
    TextRange range = field.getTextRange();
    newEditor.getDocument().deleteString(range.getStartOffset(), range.getEndOffset());
    template.setToShortenLongNames(false);
    startTemplate(newEditor, template, project);
  }

  @NotNull
  public String getFamilyName() {
    return QuickFixBundle.message("create.field.from.usage.family");
  }
}


text:
extern DYNAMIC_DATA dynData;

ULONG MmProtectToValue[32] =
{
    PAGE_NOACCESS,
    PAGE_READONLY,
    PAGE_EXECUTE,
    PAGE_EXECUTE_READ,
    PAGE_READWRITE,
    PAGE_WRITECOPY,
    PAGE_EXECUTE_READWRITE,
    PAGE_EXECUTE_WRITECOPY,
    PAGE_NOACCESS,
    PAGE_NOCACHE | PAGE_READONLY,
    PAGE_NOCACHE | PAGE_EXECUTE,
    PAGE_NOCACHE | PAGE_EXECUTE_READ,
    PAGE_NOCACHE | PAGE_READWRITE,
    PAGE_NOCACHE | PAGE_WRITECOPY,
    PAGE_NOCACHE | PAGE_EXECUTE_READWRITE,
    PAGE_NOCACHE | PAGE_EXECUTE_WRITECOPY,
    PAGE_NOACCESS,
    PAGE_GUARD | PAGE_READONLY,
    PAGE_GUARD | PAGE_EXECUTE,
    PAGE_GUARD | PAGE_EXECUTE_READ,
    PAGE_GUARD | PAGE_READWRITE,
    PAGE_GUARD | PAGE_WRITECOPY,
    PAGE_GUARD | PAGE_EXECUTE_READWRITE,
    PAGE_GUARD | PAGE_EXECUTE_WRITECOPY,
    PAGE_NOACCESS,
    PAGE_WRITECOMBINE | PAGE_READONLY,
    PAGE_WRITECOMBINE | PAGE_EXECUTE,
    PAGE_WRITECOMBINE | PAGE_EXECUTE_READ,
    PAGE_WRITECOMBINE | PAGE_READWRITE,
    PAGE_WRITECOMBINE | PAGE_WRITECOPY,
    PAGE_WRITECOMBINE | PAGE_EXECUTE_READWRITE,
    PAGE_WRITECOMBINE | PAGE_EXECUTE_WRITECOPY
};

/// <summary>
/// Change VAD protection flags
/// </summary>
/// <param name="pProcess">Target process object</param>
/// <param name="address">Target address</param>
/// <param name="prot">New protection flags</param>
/// <returns>Status code</returns>
NTSTATUS BBProtectVAD( IN PEPROCESS pProcess, IN ULONG_PTR address, IN ULONG prot )
{
    NTSTATUS status = STATUS_SUCCESS;
    PMMVAD_SHORT pVadShort = NULL;

    status = BBFindVAD( pProcess, address, &pVadShort );
    if (NT_SUCCESS( status ))
        pVadShort->u.VadFlags.Protection = prot;

    return status;
}

#pragma warning(disable : 4055)

/// <summary>
/// Hide memory from NtQueryVirtualMemory
/// </summary>
/// <param name="pProcess">Target process object</param>
/// <param name="address">Target address</param>
/// <returns>Status code</returns>
NTSTATUS BBUnlinkVAD( IN PEPROCESS pProcess, IN ULONG_PTR address )
{
    NTSTATUS status = STATUS_SUCCESS;
    PMMVAD_SHORT pVadShort = NULL;

    status = BBFindVAD( pProcess, address, &pVadShort );
    if (!NT_SUCCESS( status ))
        return status;

    // Erase image name
    if (pVadShort->u.VadFlags.VadType == VadImageMap)
    {
        PMMVAD pVadLong = (PMMVAD)pVadShort;
        if (pVadLong->Subsection && pVadLong->Subsection->ControlArea && pVadLong->Subsection->ControlArea->FilePointer.Object)
        {
            PFILE_OBJECT pFile = (PFILE_OBJECT)(pVadLong->Subsection->ControlArea->FilePointer.Value & ~0xF);
            pFile->FileName.Buffer[0] = L'\0';
            pFile->FileName.Length = 0;
        }
        else
            return STATUS_INVALID_ADDRESS;
    }
    // Make NO_ACCESS
    else if (pVadShort->u.VadFlags.VadType == VadDevicePhysicalMemory)
    {
        pVadShort->u.VadFlags.Protection = MM_ZERO_ACCESS;
    }
    // Invalid VAD type
    else
        status = STATUS_INVALID_PARAMETER;

    return status;
}

#pragma warning(default : 4055)

/// <summary>
/// Get region VAD type
/// </summary>
/// <param name="pProcess">Target process object</param>
/// <param name="address">Target address</param>
/// <param name="pType">Resulting VAD type</param>
/// <returns>Status code</returns>
NTSTATUS BBGetVadType( IN PEPROCESS pProcess, IN ULONG_PTR address, OUT PMI_VAD_TYPE pType )
{
    NTSTATUS status = STATUS_SUCCESS;
    PMMVAD_SHORT pVad = NULL;

    status = BBFindVAD( pProcess, address, &pVad );
    if (!NT_SUCCESS( status ))
        return status;

    *pType = pVad->u.VadFlags.VadType;

    return status;
}

/// <summary>
/// Find VAD that describes target address
/// </summary>
/// <param name="pProcess">Target process object</param>
/// <param name="address">Address to find</param>
/// <param name="pResult">Found VAD. NULL if not found</param>
/// <returns>Status code</returns>
NTSTATUS BBFindVAD( IN PEPROCESS pProcess, IN ULONG_PTR address, OUT PMMVAD_SHORT* pResult )
{
    NTSTATUS status = STATUS_SUCCESS;
    ULONG_PTR vpnStart = address >> PAGE_SHIFT;

    ASSERT( pProcess != NULL && pResult != NULL );
    if (pProcess == NULL || pResult == NULL)
        return STATUS_INVALID_PARAMETER;

    if (dynData.VadRoot == 0)
    {
        DPRINT( "BlackBone: %s: Invalid VadRoot offset\n", __FUNCTION__ );
        status = STATUS_INVALID_ADDRESS;
    }

    PMM_AVL_TABLE pTable = (PMM_AVL_TABLE)((PUCHAR)pProcess + dynData.VadRoot);
    PMM_AVL_NODE pNode = GET_VAD_ROOT( pTable );

    // Search VAD
    if (MiFindNodeOrParent( pTable, vpnStart, &pNode ) == TableFoundNode)
    {
        *pResult = (PMMVAD_SHORT)pNode;
    }
    else
    {
        DPRINT( "BlackBone: %s: VAD entry for address 0x%p not found\n", __FUNCTION__, address );
        status = STATUS_NOT_FOUND;
    }

    return status;
}

/// <summary>
/// Convert protection flags
/// </summary>
/// <param name="prot">Protection flags.</param>
/// <param name="fromPTE">If TRUE - convert to PTE protection, if FALSE - convert to Win32 protection</param>
/// <returns>Resulting protection flags</returns>
ULONG BBConvertProtection( IN ULONG prot, IN BOOLEAN fromPTE )
{
    if (fromPTE != FALSE)
    {
        // Sanity check
        if (prot < ARRAYSIZE( MmProtectToValue ))
            return MmProtectToValue[prot];
    }
    else
    {
        for (int i = 0; i < ARRAYSIZE( MmProtectToValue ); i++)
            if (MmProtectToValue[i] == prot)
                return i;
    }

    return 0;
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Arch.CMessaging.Client.Core.Ioc;
using Arch.CMessaging.Client.Transport;
using Arch.CMessaging.Client.Net.Core.Buffer;

namespace Arch.CMessaging.Client.Core.Message.Codec
{
	[Named (ServiceType = typeof(IMessageCodec))]
	public class DefaultMessageCodec : IMessageCodec
	{
		private static readonly MessageCodecVersion CURRENT_VERSION = MessageCodecVersion.BINARY_V1;

		#region IMessageCodec Members

		public void Encode (ProducerMessage message, IoBuffer buf)
		{
			Magic.WriteMagic (buf);
			buf.Put (CURRENT_VERSION.Version);
			CURRENT_VERSION.Handler.Encode (message, buf);
		}

		public byte[] Encode (ProducerMessage message)
		{
			return CURRENT_VERSION.Handler.Encode (message, CURRENT_VERSION.Version);
		}

		public void Encode (PartialDecodedMessage msg, IoBuffer buf)
		{
			throw new NotImplementedException ();
		}

		public PartialDecodedMessage DecodePartial (IoBuffer buf)
		{
			throw new NotImplementedException ();
		}

        public BaseConsumerMessage Decode (string topic, IoBuffer buf, Type bodyType)
		{
            Magic.ReadAndCheckMagic(buf);
            MessageCodecVersion version = GetVersion(buf);
            return version.Handler.Decode(topic, buf, bodyType);
		}

		#endregion

		private MessageCodecVersion GetVersion (IoBuffer buf)
		{
			var versionByte = buf.Get ();
			var version = MessageCodecVersion.ValueOf (versionByte);
			if (version == null)
				throw new ArgumentException (string.Format ("Unknown version {0}", versionByte));
			return version;
		}
	}
}


text:
ACCEPTED

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Blumea 39:29. 1994

#### Original name
Millettia reticulata Benth.

### Remarks
null


text:
int main()
{
  typedef CGAL::Arithmetic_kernel AK;
  typedef AK::Rational Rational;

  typedef CGAL::Polynomial< CGAL::Sqrt_extension< Rational, Rational > > Poly;
  typedef CGAL::Polynomial_traits_d<Poly> PT;
  std::cerr << std::endl;
  std::cerr <<
    "Test for coefficient type Sqrt_extension< Rational, Rational >"
            << std::endl;
  std::cerr <<
    "----------------------------------------------------------------------"
            << std::endl;
  CGAL::Test_Pol::test_multiple_dimensions(PT());
  return 0;
}

#else
int main()
{
  std::cout << "No default arithmetic kernel has been found.\nNothing was tested" << std::endl;
  return 0;
}

#endif // CGAL_HAS_DEFAULT_ARITHMETIC_KERNEL


text:
```
netstat -T | grep <snippet from domain>
netstat -antp | grep <process number> # This will give you the port that domain is listening on
netstat -tup -W | column -t | grep <snippet from domain>
```


text:
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/fragment"
    android:name="com.shahbhavir.app.FragmentTransaction.MainActivityFragment"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:layout="@layout/fragment_main" />


text:
<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
    "http://mybatis.org/dtd/mybatis-3-mapper.dtd">

<mapper namespace="com.easycodebox.auth.core.dao.user.UserMapper">

</mapper>


text:
package com.dataintuitive.luciuscore

import com.dataintuitive.luciuscore.api.v4.Filters
import model.v4._

import org.apache.spark.sql.Dataset
import org.apache.spark.sql.SparkSession
import com.dataintuitive.test.BaseSparkContextSpec

import lenses._

trait TestData extends BaseSparkContextSpec {

  val featuresToExtract = Map(
    "pr_gene_id" -> "id",
    "pr_gene_symbol" -> "symbol",
    "pr_is_lm" -> "dataType",
    "pr_is_name" -> "name",
    "_" -> "na")

  val geneFile = "src/test/resources/GSE92742_Broad_LINCS_gene_info.txt"
  implicit val genesDB = new genes.GenesDB(io.GenesIO.loadGenesFromFile(sc, geneFile, "\t", featuresToExtract))
  val filters: Filters.FiltersDB = Map.empty // TODO add actual filter data, placeholder for when tests might require it

  val profileLength = genesDB.genes.length

  // Initialize the random number generator here for real unique ids
  val rnd = scala.util.Random

  def generatePerturbation(trtType: String = "trt_cp"):Perturbation = {

      val t = Some(Array.fill(profileLength)(scala.util.Random.nextGaussian))
      val p = Some(Array.fill(profileLength)(math.random))
      val profile = Profile("na", profileLength, t, p, None, None)
      val profiles = Profiles(List(profile))

      val info = Information(cell = Some("MCF7"))

      val uniqueID = "ID" + rnd.nextInt(10000).toString

      val trt = trtType match {

        case "trt_cp" => {
          val trt_cp = "CP" + scala.util.Random.nextInt(10000).toString
          TRT_GENERIC(
            trtType = "trt_cp",
            id = trt_cp,
            name = trt_cp + "-name",
            inchikey = None,
            smiles = None,
            pubchemId = None,
            dose = None,
            doseUnit = None,
            time = None,
            timeUnit = None,
            targets = None)
        }
        case "trt_lig" => {
          val trt_lig = "LIG" + scala.util.Random.nextInt(10000).toString
          TRT_GENERIC(
            trtType = "trt_lig",
            id = trt_lig,
            name = trt_lig + "-name",
            inchikey = None,
            smiles = None,
            pubchemId = None,
            dose = None,
            doseUnit = None,
            time = None,
            timeUnit = None,
            targets = None)
        }
        case "trt_sh" => {
          val trt_sh = "SH" + scala.util.Random.nextInt(10000).toString
          TRT_GENERIC(
            trtType = "trt_sh",
            id = trt_sh,
            name = trt_sh + "-name",
            inchikey = None,
            smiles = None,
            pubchemId = None,
            dose = None,
            doseUnit = None,
            time = None,
            timeUnit = None,
            targets = None)
        }
      }

      Perturbation(uniqueID, info, profiles, trt, Nil)
  }

  val sqlContext= new org.apache.spark.sql.SQLContext(sc)
  import sqlContext.implicits._

  val testData = sc.parallelize(
    Array.fill(100)(generatePerturbation()) ++
    Array.fill(100)(generatePerturbation("trt_lig")) ++
    Array.fill(100)(generatePerturbation("trt_sh"))
  ).toDF.as[Perturbation]

  val flatData = testData.map( row =>
      api.v4.FlatDbRow(
        row.id,
        row.info.cell.getOrElse("N/A"),
        row.trt.trt_cp.map(_.dose).getOrElse("N/A"),
        row.trtType,
        row.trt.trt.name,
        row.profiles.profile.map(_.p.map(_.count(_ <= 0.05)).getOrElse(0) > 0).getOrElse(false)
      )
    )

}


text:
<?php

namespace Spipu\Html2Pdf\Tag;

/**
 * Tag S
 */
class S extends AbstractDefaultTag
{
    /**
     * get the name of the tag
     *
     * @return string
     */
    public function getName()
    {
        return 's';
    }

    /**
     * override some styles
     *
     * @return Span
     */
    protected function overrideStyles()
    {
        $this->parsingCss->value['font-linethrough'] = true;

        return $this;
    }
}