brute-fuzzy 2.0.0-java

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,8 @@
1
+ === 2.0.0 (2010-8-21)
2
+ * FuzzySet64 is now an interface, FizzyList64 for brute force search.
3
+ * New FuzzyTree64 search tree impl. Faster for sets of keys
4
+ approx. greater than 100.
5
+ * Other general perf. improvements.
6
+
7
+ === 1.0.0 (2010-3-3)
8
+ * Birthday.
@@ -0,0 +1,10 @@
1
+ History.rdoc
2
+ Manifest.txt
3
+ README.rdoc
4
+ Rakefile
5
+ pom.xml
6
+ bin/brute-fuzzy-perftest
7
+ lib/brute-fuzzy/base.rb
8
+ lib/brute-fuzzy.rb
9
+ test/test_fuzzy_set.rb
10
+ lib/brute-fuzzy/brute-fuzzy-2.0.0.jar
@@ -0,0 +1,33 @@
1
+ = brute-fuzzy
2
+
3
+ * http://github.com/dekellum/brute-fuzzy
4
+
5
+ == Description
6
+
7
+ Provides set-like containers of 64-bit keys, constrained such that no
8
+ two keys have bit difference (aka Hamming distance) less than some
9
+ threshold number of bits. A performance test driver is also included.
10
+
11
+ == Dependencies
12
+
13
+ * Java 1.5+
14
+
15
+ For tests:
16
+
17
+ * JRuby 1.3+
18
+
19
+ == License
20
+
21
+ Copyright (c) 2010 David Kellum
22
+
23
+ Licensed under the Apache License, Version 2.0 (the "License"); you
24
+ may not use this file except in compliance with the License. You
25
+ may obtain a copy of the License at:
26
+
27
+ http://www.apache.org/licenses/LICENSE-2.0
28
+
29
+ Unless required by applicable law or agreed to in writing, software
30
+ distributed under the License is distributed on an "AS IS" BASIS,
31
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
32
+ implied. See the License for the specific language governing
33
+ permissions and limitations under the License.
@@ -0,0 +1,35 @@
1
+ # -*- ruby -*-
2
+
3
+ $LOAD_PATH << './lib'
4
+ require 'brute-fuzzy/base'
5
+
6
+ require 'rubygems'
7
+ gem 'rjack-tarpit', '~> 1.2.0'
8
+ require 'rjack-tarpit'
9
+
10
+ t = RJack::TarPit.new( 'brute-fuzzy',
11
+ BruteFuzzy::VERSION,
12
+ :no_assembly, :java_platform )
13
+
14
+ t.specify do |h|
15
+ h.developer( "David Kellum", "dek-oss@gravitext.com" )
16
+ h.extra_dev_deps += [ [ 'gravitext-util', '>= 1.3.2' ] ]
17
+ end
18
+
19
+ file 'Manifest.txt' => [ 'pom.xml' ]
20
+
21
+ task :check_pom_version do
22
+ t.test_line_match( 'pom.xml', /<version>/, /#{t.version}/ )
23
+ end
24
+ task :check_history_version do
25
+ t.test_line_match( 'History.rdoc', /^==/, / #{t.version} / )
26
+ end
27
+ task :check_history_date do
28
+ t.test_line_match( 'History.rdoc', /^==/, /\([0-9\-]+\)$/ )
29
+ end
30
+
31
+ task :gem => [ :check_pom_version, :check_history_version ]
32
+ task :tag => [ :check_pom_version, :check_history_version, :check_history_date ]
33
+ task :push => [ :check_history_date ]
34
+
35
+ t.define_tasks
@@ -0,0 +1,42 @@
1
+ #!/usr/bin/env jruby
2
+ # -*- ruby -*-
3
+ #.hashdot.vm.options += -Xmx1G
4
+
5
+ #--
6
+ # Copyright (c) 2010 David Kellum
7
+ #
8
+ # Licensed under the Apache License, Version 2.0 (the "License"); you
9
+ # may not use this file except in compliance with the License. You may
10
+ # obtain a copy of the License at
11
+ #
12
+ # http://www.apache.org/licenses/LICENSE-2.0
13
+ #
14
+ # Unless required by applicable law or agreed to in writing, software
15
+ # distributed under the License is distributed on an "AS IS" BASIS,
16
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
17
+ # implied. See the License for the specific language governing
18
+ # permissions and limitations under the License.
19
+ #++
20
+
21
+ $LOAD_PATH.unshift File.join( File.dirname(__FILE__), "..", "lib" )
22
+
23
+ require 'rubygems'
24
+ require 'brute-fuzzy'
25
+
26
+ require 'gravitext-util'
27
+ require 'gravitext-util/perftest'
28
+
29
+ module PerfTest
30
+ include BruteFuzzy
31
+
32
+ def self.run( args = ARGV )
33
+ tests = FuzzySetPerfTest::Mode.values.map do |mode|
34
+ FuzzySetPerfTest.new( mode, *( ARGV.map {|a| a.to_i } ) )
35
+ end
36
+ harness = Gravitext::PerfTest::Harness.new( tests )
37
+ # harness.thread_count = 4
38
+ harness.execute
39
+ end
40
+ end
41
+
42
+ PerfTest.run
@@ -0,0 +1,31 @@
1
+ #--
2
+ # Copyright (c) 2010 David Kellum
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License"); you
5
+ # may not use this file except in compliance with the License. You may
6
+ # obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
13
+ # implied. See the License for the specific language governing
14
+ # permissions and limitations under the License.
15
+ #++
16
+
17
+ require 'brute-fuzzy/base.rb'
18
+
19
+ require 'java'
20
+ require 'gravitext-util'
21
+
22
+ module BruteFuzzy
23
+
24
+ require "brute-fuzzy/brute-fuzzy-#{VERSION}.jar"
25
+
26
+ import 'brutefuzzy.BruteFuzzy'
27
+ import 'brutefuzzy.FuzzyList64'
28
+ import 'brutefuzzy.FuzzyTree64'
29
+ import 'brutefuzzy.FuzzySetPerfTest'
30
+
31
+ end
@@ -0,0 +1,19 @@
1
+ #--
2
+ # Copyright (c) 2010 David Kellum
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License"); you
5
+ # may not use this file except in compliance with the License. You may
6
+ # obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
13
+ # implied. See the License for the specific language governing
14
+ # permissions and limitations under the License.
15
+ #++
16
+
17
+ module BruteFuzzy
18
+ VERSION = '2.0.0'
19
+ end
data/pom.xml ADDED
@@ -0,0 +1,52 @@
1
+ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
2
+ <modelVersion>4.0.0</modelVersion>
3
+ <groupId>com.gravitext</groupId>
4
+ <artifactId>brute-fuzzy</artifactId>
5
+ <packaging>jar</packaging>
6
+ <version>2.0.0</version>
7
+ <name>Brute Fuzziness</name>
8
+
9
+ <repositories>
10
+ <repository>
11
+ <id>gravitext</id>
12
+ <url>http://gravitext.com/repo/releases</url>
13
+ </repository>
14
+ </repositories>
15
+
16
+ <dependencies>
17
+ <dependency>
18
+ <groupId>com.gravitext</groupId>
19
+ <artifactId>gravitext-util</artifactId>
20
+ <version>[1.3.2,]</version>
21
+ </dependency>
22
+ </dependencies>
23
+
24
+ <build>
25
+ <plugins>
26
+
27
+ <plugin>
28
+ <artifactId>maven-compiler-plugin</artifactId>
29
+ <configuration>
30
+ <source>1.5</source>
31
+ <target>1.5</target>
32
+ <optimize>true</optimize>
33
+ <debug>true</debug>
34
+ <encoding>UTF-8</encoding>
35
+ <showDeprecation>true</showDeprecation>
36
+ <showWarnings>true</showWarnings>
37
+ </configuration>
38
+ </plugin>
39
+
40
+ <plugin>
41
+ <artifactId>maven-source-plugin</artifactId>
42
+ <executions>
43
+ <execution>
44
+ <goals>
45
+ <goal>jar</goal>
46
+ </goals>
47
+ </execution>
48
+ </executions>
49
+ </plugin>
50
+ </plugins>
51
+ </build>
52
+ </project>
@@ -0,0 +1,96 @@
1
+ #!/usr/bin/env jruby
2
+ #--
3
+ # Copyright (c) 2010 David Kellum
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License"); you
6
+ # may not use this file except in compliance with the License. You may
7
+ # obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
14
+ # implied. See the License for the specific language governing
15
+ # permissions and limitations under the License.
16
+ #++
17
+
18
+ #.hashdot.profile += jruby-shortlived
19
+
20
+ $LOAD_PATH.unshift File.join( File.dirname(__FILE__), "..", "lib" )
21
+
22
+ require 'rubygems'
23
+
24
+ require 'brute-fuzzy'
25
+ require 'test/unit'
26
+
27
+ class TestFuzzySet < Test::Unit::TestCase
28
+ include BruteFuzzy
29
+
30
+ # Series that will allow all but last at 3 bit threshold, all at 2
31
+ # bit threshold.
32
+ TEST_SERIES = [ %w[ FFFF_FFFF_FFFF_FFFF
33
+ 7FFF_7FFF_7FFF_7FFF
34
+ F7FF_F7FF_F7FF_F7FF
35
+ FF7F_FF7F_FF7F_FFFF ] ]
36
+
37
+ def test_hex
38
+ assert_equal( 0x1000_0000, hex( "1000_0000" ) )
39
+ assert_equal( 0x7FFF_FFFF_FFFF_FFFF, hex( "7FFF_FFFF_FFFF_FFFF" ) )
40
+ assert_equal( -1, hex( "FFFF_FFFF_FFFF_FFFF" ) )
41
+ end
42
+
43
+ def test_match
44
+ m = FuzzyList64.new( 100, 4 )
45
+ assert( m.fuzzy_match( 0, 0 ) )
46
+ assert( m.fuzzy_match( hex( '7FFF_FFFF_FFFF_FFFF' ),
47
+ hex( '7FFF_FFFF_7777_FFFF' ) ) )
48
+
49
+ assert( m.fuzzy_match( hex( 'FFFF_FFFF_FFFF_FFFF' ),
50
+ hex( 'FFFF_FFFF_7777_FFFF' ) ) )
51
+
52
+ assert( ! m.fuzzy_match( hex( '7FFF_FFFF_FFFF_FFFF' ),
53
+ hex( '7FFF_FFFF_EFFF_7777' ) ) )
54
+
55
+ assert( ! m.fuzzy_match( hex( 'FFFF_FFFF_FFFF_FFFF' ),
56
+ hex( 'FFFF_FFFF_EFFF_7777' ) ) )
57
+ end
58
+
59
+ def test_add
60
+ m = FuzzyList64.new( 100, 4 )
61
+ assert( m.add( 0x0 ) )
62
+ assert( m.add( 0xFF ) )
63
+ assert( ! m.add( 0xFE ) )
64
+ assert( ! m.add( 0x1 ) )
65
+ end
66
+
67
+ def test_series_list
68
+ assert_series( FuzzyList64 )
69
+ end
70
+
71
+ def test_series_tree
72
+ assert_series( FuzzyTree64 )
73
+ end
74
+
75
+ def assert_series( fclz )
76
+ TEST_SERIES.each do |s|
77
+ assert_series_last( fclz.new( 5, 3 ), s )
78
+ assert_series_all( fclz.new( 5, 2 ), s )
79
+ end
80
+ end
81
+
82
+ def assert_series_last( fset, s )
83
+ s = s.dup
84
+ last = s.pop # Remove last for now
85
+ assert_series_all( fset, s )
86
+ assert( ! fset.add( hex( last ) ), last )
87
+ end
88
+
89
+ def assert_series_all( fset, s )
90
+ s.each { |k| assert( fset.add( hex( k ) ), k ) }
91
+ end
92
+
93
+ def hex( h )
94
+ BruteFuzzy::unsignedHexToLong( h.gsub( /_/, '' ) )
95
+ end
96
+ end
metadata ADDED
@@ -0,0 +1,105 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: brute-fuzzy
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 2
7
+ - 0
8
+ - 0
9
+ version: 2.0.0
10
+ platform: java
11
+ authors:
12
+ - David Kellum
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2010-08-21 00:00:00 -07:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: gravitext-util
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ segments:
28
+ - 1
29
+ - 3
30
+ - 2
31
+ version: 1.3.2
32
+ type: :development
33
+ version_requirements: *id001
34
+ - !ruby/object:Gem::Dependency
35
+ name: rjack-tarpit
36
+ prerelease: false
37
+ requirement: &id002 !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ~>
40
+ - !ruby/object:Gem::Version
41
+ segments:
42
+ - 1
43
+ - 2
44
+ - 2
45
+ version: 1.2.2
46
+ type: :development
47
+ version_requirements: *id002
48
+ description: |-
49
+ Provides set-like containers of 64-bit keys, constrained such that no
50
+ two keys have bit difference (aka Hamming distance) less than some
51
+ threshold number of bits. A performance test driver is also included.
52
+ email:
53
+ - dek-oss@gravitext.com
54
+ executables:
55
+ - brute-fuzzy-perftest
56
+ extensions: []
57
+
58
+ extra_rdoc_files:
59
+ - Manifest.txt
60
+ - History.rdoc
61
+ - README.rdoc
62
+ files:
63
+ - History.rdoc
64
+ - Manifest.txt
65
+ - README.rdoc
66
+ - Rakefile
67
+ - pom.xml
68
+ - bin/brute-fuzzy-perftest
69
+ - lib/brute-fuzzy/base.rb
70
+ - lib/brute-fuzzy.rb
71
+ - test/test_fuzzy_set.rb
72
+ - lib/brute-fuzzy/brute-fuzzy-2.0.0.jar
73
+ has_rdoc: true
74
+ homepage: http://github.com/dekellum/brute-fuzzy
75
+ licenses: []
76
+
77
+ post_install_message:
78
+ rdoc_options:
79
+ - --main
80
+ - README.rdoc
81
+ require_paths:
82
+ - lib
83
+ required_ruby_version: !ruby/object:Gem::Requirement
84
+ requirements:
85
+ - - ">="
86
+ - !ruby/object:Gem::Version
87
+ segments:
88
+ - 0
89
+ version: "0"
90
+ required_rubygems_version: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - ">="
93
+ - !ruby/object:Gem::Version
94
+ segments:
95
+ - 0
96
+ version: "0"
97
+ requirements: []
98
+
99
+ rubyforge_project: brute-fuzzy
100
+ rubygems_version: 1.3.6
101
+ signing_key:
102
+ specification_version: 3
103
+ summary: Provides set-like containers of 64-bit keys, constrained such that no two keys have bit difference (aka Hamming distance) less than some threshold number of bits
104
+ test_files:
105
+ - test/test_fuzzy_set.rb