Skip to content

Commit

Permalink
Add ICU4J license infromation.
Browse files Browse the repository at this point in the history
  • Loading branch information
KL-7 committed Jun 20, 2012
1 parent 3a70280 commit 98612af
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 6 deletions.
38 changes: 36 additions & 2 deletions NOTICE
Expand Up @@ -2,7 +2,7 @@ twitter-cldr-rb is a Ruby implementation of the Common Locale Data Repository
Copyright (C) 2012 Twitter, Inc.


Portions of this gem were borrowed from Sven Fuchs' ruby-cldr gem. Here is
Portions of this gem were borrowed from Sven Fuchs' ruby-cldr gem. Here is
the license that accompanied Mr. Fuchs' code:

Copyright (c) 2009 Sven Fuchs
Expand Down Expand Up @@ -117,4 +117,38 @@ the software.
6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE.
PURPOSE.


TwitterCldr::Collation::ImplicitCollationElements module was ported from
the ICU4J library (http://site.icu-project.org). Here is its license:

ICU License - ICU 1.8.1 and later

COPYRIGHT AND PERMISSION NOTICE

Copyright (c) 1995-2012 International Business Machines Corporation and others

All rights reserved.

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, and/or sell copies of the Software,
and to permit persons to whom the Software is furnished to do so, provided that
the above copyright notice(s) and this permission notice appear in all copies
of the Software and that both the above copyright notice(s) and this permission
notice appear in supporting documentation.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL
THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM,
OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER
RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
OR PERFORMANCE OF THIS SOFTWARE.

Except as contained in this notice, the name of a copyright holder shall not be
used in advertising or otherwise to promote the sale, use or other dealings in
this Software without prior written authorization of the copyright holder.
11 changes: 7 additions & 4 deletions lib/twitter_cldr/collation/collator.rb
Expand Up @@ -6,14 +6,13 @@
module TwitterCldr
module Collation

# Collator class uses fractional collation elements table form CLDR to generate sort keys for Unicode strings
# as well as compare and sort such strings by generated sort keys.
#
class Collator

FRACTIONAL_UCA_SHORT_RESOURCE = 'collation/FractionalUCA_SHORT.txt'

def sort_key(string_or_code_points)
sort_key_for_code_points(get_code_points(string_or_code_points))
end

def sort(strings)
strings.map{ |s| [s, comparison_key(s)] }.sort{ |a, b| compare_keys(a[1], b[1]) }.map(&:first)
end
Expand All @@ -22,6 +21,10 @@ def compare(string_a, string_b)
string_a == string_b ? 0 : compare_keys(comparison_key(string_a), comparison_key(string_b))
end

def sort_key(string_or_code_points)
sort_key_for_code_points(get_code_points(string_or_code_points))
end

def trie
@trie ||= self.class.trie
end
Expand Down
2 changes: 2 additions & 0 deletions lib/twitter_cldr/collation/implicit_collation_elements.rb
Expand Up @@ -9,6 +9,8 @@ module Collation
# Module for generation of implicit collation elements for code points (including some CJK characters), that are
# not explicitly mentioned in the collation elements table.
#
# This module was ported from the ICU4J library (ImplicitCEGenerator class). See NOTICE file for license information.
#
module ImplicitCollationElements

DEFAULT_SECONDARY_AND_TERTIARY = 5
Expand Down

0 comments on commit 98612af

Please sign in to comment.