glimmer-dsl-swt 4.20.13.11 → 4.20.13.15

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +21 -0
  3. data/README.md +5 -5
  4. data/VERSION +1 -1
  5. data/docs/reference/GLIMMER_SAMPLES.md +84 -2
  6. data/glimmer-dsl-swt.gemspec +0 -0
  7. data/lib/glimmer-dsl-swt.rb +1 -0
  8. data/lib/glimmer/swt/custom/drawable.rb +1 -0
  9. data/lib/glimmer/swt/custom/shape.rb +20 -1
  10. data/lib/glimmer/swt/custom/shape/arc.rb +2 -0
  11. data/lib/glimmer/swt/custom/shape/cubic.rb +1 -0
  12. data/lib/glimmer/swt/custom/shape/line.rb +1 -0
  13. data/lib/glimmer/swt/custom/shape/oval.rb +2 -0
  14. data/lib/glimmer/swt/custom/shape/path.rb +1 -5
  15. data/lib/glimmer/swt/custom/shape/point.rb +1 -0
  16. data/lib/glimmer/swt/custom/shape/polygon.rb +2 -0
  17. data/lib/glimmer/swt/custom/shape/polyline.rb +1 -0
  18. data/lib/glimmer/swt/custom/shape/rectangle.rb +1 -0
  19. data/samples/elaborate/battleship.rb +79 -0
  20. data/samples/elaborate/battleship/model/cell.rb +84 -0
  21. data/samples/elaborate/battleship/model/game.rb +143 -0
  22. data/samples/elaborate/battleship/model/grid.rb +54 -0
  23. data/samples/elaborate/battleship/model/ship.rb +114 -0
  24. data/samples/elaborate/battleship/model/ship_collection.rb +56 -0
  25. data/samples/elaborate/battleship/view/action_panel.rb +59 -0
  26. data/samples/elaborate/battleship/view/cell.rb +163 -0
  27. data/samples/elaborate/battleship/view/grid.rb +77 -0
  28. data/samples/elaborate/battleship/view/ship.rb +65 -0
  29. data/samples/elaborate/battleship/view/ship_collection.rb +49 -0
  30. data/samples/elaborate/connect4.rb +116 -0
  31. data/samples/elaborate/connect4/model/grid.rb +174 -0
  32. data/samples/elaborate/connect4/model/slot.rb +36 -0
  33. data/samples/elaborate/game_of_life/model/cell.rb +21 -0
  34. data/samples/elaborate/game_of_life/model/grid.rb +21 -0
  35. data/samples/elaborate/klondike_solitaire.rb +1 -1
  36. data/samples/elaborate/klondike_solitaire/view/column_pile.rb +0 -1
  37. data/samples/elaborate/klondike_solitaire/view/foundation_pile.rb +0 -2
  38. data/samples/elaborate/parking.rb +146 -0
  39. data/samples/elaborate/parking/model/parking_floor.rb +41 -0
  40. data/samples/elaborate/parking/model/parking_presenter.rb +42 -0
  41. data/samples/elaborate/parking/model/parking_spot.rb +46 -0
  42. metadata +20 -2
@@ -0,0 +1,42 @@
1
+ # Copyright (c) 2007-2021 Andy Maleh
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining
4
+ # a copy of this software and associated documentation files (the
5
+ # "Software"), to deal in the Software without restriction, including
6
+ # without limitation the rights to use, copy, modify, merge, publish,
7
+ # distribute, sublicense, and/or sell copies of the Software, and to
8
+ # permit persons to whom the Software is furnished to do so, subject to
9
+ # the following conditions:
10
+ #
11
+ # The above copyright notice and this permission notice shall be
12
+ # included in all copies or substantial portions of the Software.
13
+ #
14
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
+
22
+ require_relative 'parking_floor'
23
+
24
+ class Parking
25
+ module Model
26
+ class ParkingPresenter
27
+ attr_reader :floor_count
28
+ attr_accessor :floors, :selected_floor
29
+
30
+ def initialize(floor_count)
31
+ self.floors = 1.upto(floor_count).map do |floor_number|
32
+ ParkingFloor.new(floor_number)
33
+ end
34
+ self.selected_floor = 1
35
+ end
36
+
37
+ def book(parking_spot_letter)
38
+ self.floors[selected_floor - 1].book(parking_spot_letter)
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,46 @@
1
+ # Copyright (c) 2007-2021 Andy Maleh
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining
4
+ # a copy of this software and associated documentation files (the
5
+ # "Software"), to deal in the Software without restriction, including
6
+ # without limitation the rights to use, copy, modify, merge, publish,
7
+ # distribute, sublicense, and/or sell copies of the Software, and to
8
+ # permit persons to whom the Software is furnished to do so, subject to
9
+ # the following conditions:
10
+ #
11
+ # The above copyright notice and this permission notice shall be
12
+ # included in all copies or substantial portions of the Software.
13
+ #
14
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
+
22
+ class Parking
23
+ module Model
24
+ class ParkingSpot
25
+ LETTERS = %W[A B C D E F G H I J K L M N O P]
26
+
27
+ attr_reader :parking_floor, :letter
28
+ attr_accessor :booked
29
+ alias booked? booked
30
+
31
+ def initialize(parking_floor, letter)
32
+ @parking_floor = parking_floor
33
+ @letter = letter
34
+ end
35
+
36
+ def book!
37
+ raise "Floor #{parking_floor.number} Parking Spot #{letter} Is Already Booked!" if booked?
38
+ self.booked = true
39
+ end
40
+
41
+ def free!
42
+ self.booked = false
43
+ end
44
+ end
45
+ end
46
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glimmer-dsl-swt
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.20.13.11
4
+ version: 4.20.13.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Maleh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-08-01 00:00:00.000000000 Z
11
+ date: 2021-08-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -528,6 +528,17 @@ files:
528
528
  - lib/glimmer/ui/custom_shell.rb
529
529
  - lib/glimmer/ui/custom_widget.rb
530
530
  - lib/glimmer/util/proc_tracker.rb
531
+ - samples/elaborate/battleship.rb
532
+ - samples/elaborate/battleship/model/cell.rb
533
+ - samples/elaborate/battleship/model/game.rb
534
+ - samples/elaborate/battleship/model/grid.rb
535
+ - samples/elaborate/battleship/model/ship.rb
536
+ - samples/elaborate/battleship/model/ship_collection.rb
537
+ - samples/elaborate/battleship/view/action_panel.rb
538
+ - samples/elaborate/battleship/view/cell.rb
539
+ - samples/elaborate/battleship/view/grid.rb
540
+ - samples/elaborate/battleship/view/ship.rb
541
+ - samples/elaborate/battleship/view/ship_collection.rb
531
542
  - samples/elaborate/calculator.rb
532
543
  - samples/elaborate/calculator/model/command.rb
533
544
  - samples/elaborate/calculator/model/command/all_clear.rb
@@ -541,6 +552,9 @@ files:
541
552
  - samples/elaborate/calculator/model/command/operation/subtract.rb
542
553
  - samples/elaborate/calculator/model/command/point.rb
543
554
  - samples/elaborate/calculator/model/presenter.rb
555
+ - samples/elaborate/connect4.rb
556
+ - samples/elaborate/connect4/model/grid.rb
557
+ - samples/elaborate/connect4/model/slot.rb
544
558
  - samples/elaborate/contact_manager.rb
545
559
  - samples/elaborate/contact_manager/contact.rb
546
560
  - samples/elaborate/contact_manager/contact_manager_presenter.rb
@@ -568,6 +582,10 @@ files:
568
582
  - samples/elaborate/mandelbrot_fractal.rb
569
583
  - samples/elaborate/meta_sample.rb
570
584
  - samples/elaborate/metronome.rb
585
+ - samples/elaborate/parking.rb
586
+ - samples/elaborate/parking/model/parking_floor.rb
587
+ - samples/elaborate/parking/model/parking_presenter.rb
588
+ - samples/elaborate/parking/model/parking_spot.rb
571
589
  - samples/elaborate/stock_ticker.rb
572
590
  - samples/elaborate/tetris.rb
573
591
  - samples/elaborate/tetris/model/block.rb