ravensat 1.0.5 → 1.0.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 56180e12d568856b7aecc556c6351157b35214ee2b8baccfbdf7069db9f87f11
4
- data.tar.gz: 61d38033566cc2c5683300765589938e45e2a8140b9fc74646ca7cb9f838818a
3
+ metadata.gz: d64d337bf293ce23f27a118bc1896ecf7c35709f3d0a0a7c217fa3bef2e495a6
4
+ data.tar.gz: 38c00c661b514dff04fd0fdcc2854ae9c37104598fb6dc2f8235eac0178595dd
5
5
  SHA512:
6
- metadata.gz: 6ad53a3be42a987284db8d89f5e3fa4da21097e6c019c82e3fb34f49718b2907de49f9235922dd1892e318d94f193fba2b899b5317e5da780fceb1894cddbfb9
7
- data.tar.gz: 38439434b8b7e40492743a7ee5b8815ffe71adfe8894ec678761c041af0e49db0f81e8ea684d5d3e4aef5288a68ff46796c871ccab9e9b349c424da3d0cdc500
6
+ metadata.gz: 853077cca8f5220f9ecfbcec4c14323678b5f6d36f197892a3b49646ca6cff39a032fbcdf2199e524ab46f3d5806cf86a9f45152a71bd968d4d0388dcf0cacb7
7
+ data.tar.gz: 10de270cfe07b3c1041dd0e398b8c1e8c1bd58d103917b8e116fb3f84caa8235747e5cb775ca9601a2b3be63b673efac5d0b6dade9451e0c121f8dcc9872594b
@@ -1,6 +1,7 @@
1
1
  module Ravensat
2
2
  class AndNode < OprNode
3
3
  def &(object)
4
+ raise TypeError.new("#{object.class} can't be coerced into Ravensat::Node") unless object.is_a? Node
4
5
  @children.append object
5
6
  self
6
7
  end
@@ -1,10 +1,12 @@
1
1
  module Ravensat
2
2
  class InitialNode < Node
3
3
  def &(object)
4
+ raise TypeError.new("#{object.class} can't be coerced into Ravensat::Node") unless object.is_a? Node
4
5
  object
5
6
  end
6
7
 
7
8
  def |(object)
9
+ raise TypeError.new("#{object.class} can't be coerced into Ravensat::Node") unless object.is_a? Node
8
10
  object
9
11
  end
10
12
  end
@@ -63,10 +63,12 @@ module Ravensat
63
63
  end
64
64
 
65
65
  def &(object)
66
+ raise TypeError.new("#{object.class} can't be coerced into Ravensat::Node") unless object.is_a? Node
66
67
  AndNode.new(self, object)
67
68
  end
68
69
 
69
70
  def |(object)
71
+ raise TypeError.new("#{object.class} can't be coerced into Ravensat::Node") unless object.is_a? Node
70
72
  OrNode.new(self, object)
71
73
  end
72
74
 
@@ -1,6 +1,7 @@
1
1
  module Ravensat
2
2
  class OrNode < OprNode
3
3
  def |(object)
4
+ raise TypeError.new("#{object.class} can't be coerced into Ravensat::Node") unless object.is_a? Node
4
5
  @children.append object
5
6
  self
6
7
  end
data/lib/ravensat/claw.rb CHANGED
@@ -1,16 +1,19 @@
1
1
  module Ravensat
2
2
  module Claw
3
3
  def self.alo(bool_vars)
4
+ return bool_vars.first if bool_vars.size == 1
4
5
  bool_vars.reduce(:|)
5
6
  end
6
7
 
7
8
  def self.at_most_k(bool_vars, k)
9
+ return bool_vars.first if bool_vars.size == 1
8
10
  bool_vars.combination(k+1).map do |e|
9
11
  e.map(&:~@).reduce(:|)
10
12
  end.reduce(:&)
11
13
  end
12
14
 
13
15
  def self.at_least_k(bool_vars, k)
16
+ return bool_vars.first if bool_vars.size == 1
14
17
  bool_vars.combination(k-1).map do |e|
15
18
  alo(bool_vars - e)
16
19
  end.reduce(:&)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Ravensat
4
- VERSION = "1.0.5"
4
+ VERSION = "1.0.8"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ravensat
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 1.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - rikuto matsuda
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-08-22 00:00:00.000000000 Z
11
+ date: 2022-08-23 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: