carats 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +2 -0
- data/LICENSE +5 -0
- data/README +67 -0
- data/Reapfile +72 -0
- data/ToDo +24 -0
- data/bench/b_harray.rb +49 -0
- data/bench/b_range.rb +64 -0
- data/demo/ansicolor/cdiff.rb +20 -0
- data/demo/ansicolor/example.rb +82 -0
- data/demo/io-reactor/chatserver.rb +347 -0
- data/doc/classes/Array.html +172 -0
- data/doc/classes/BBCode.html +638 -0
- data/doc/classes/BinaryReader.html +675 -0
- data/doc/classes/Binding.html +223 -0
- data/doc/classes/ByteOrder.html +284 -0
- data/doc/classes/Class.html +189 -0
- data/doc/classes/Constant.html +785 -0
- data/doc/classes/Constant/CGS.html +609 -0
- data/doc/classes/Continuation.html +113 -0
- data/doc/classes/Coroutine.html +387 -0
- data/doc/classes/CountingSemaphore.html +337 -0
- data/doc/classes/CrossCase.html +561 -0
- data/doc/classes/DynamicMixin.html +185 -0
- data/doc/classes/EnumerableWithArgs.html +550 -0
- data/doc/classes/Expect.html +428 -0
- data/doc/classes/Expect/DefaultChain.html +113 -0
- data/doc/classes/Expect/SeparatedPattern.html +223 -0
- data/doc/classes/Expect/Timeout.html +167 -0
- data/doc/classes/Expect/UnmatchedMessage.html +160 -0
- data/doc/classes/FileList.html +833 -0
- data/doc/classes/FloatString.html +534 -0
- data/doc/classes/Functor.html +211 -0
- data/doc/classes/HArray.html +1872 -0
- data/doc/classes/HTML.html +328 -0
- data/doc/classes/Heap.html +683 -0
- data/doc/classes/Heap/EmptyHeapException.html +111 -0
- data/doc/classes/Heap/Max.html +176 -0
- data/doc/classes/Heap/Min.html +176 -0
- data/doc/classes/IO.html +108 -0
- data/doc/classes/IO/Reactor.html +790 -0
- data/doc/classes/IO/Redirect.html +289 -0
- data/doc/classes/Infinity.html +320 -0
- data/doc/classes/Interval.html +1014 -0
- data/doc/classes/InvalidNackError.html +161 -0
- data/doc/classes/Kernel.html +204 -0
- data/doc/classes/Lisp.html +1132 -0
- data/doc/classes/Lisp/DottedPair.html +379 -0
- data/doc/classes/Lisp/Format.html +178 -0
- data/doc/classes/Lisp/Format/ArgumentError.html +126 -0
- data/doc/classes/Lisp/Format/Directives.html +155 -0
- data/doc/classes/Lisp/Format/Directives/ArgJump.html +178 -0
- data/doc/classes/Lisp/Format/Directives/Ascii.html +119 -0
- data/doc/classes/Lisp/Format/Directives/BeginCaseConversion.html +185 -0
- data/doc/classes/Lisp/Format/Directives/BeginConditional.html +307 -0
- data/doc/classes/Lisp/Format/Directives/BeginIteration.html +338 -0
- data/doc/classes/Lisp/Format/Directives/Binary.html +157 -0
- data/doc/classes/Lisp/Format/Directives/Character.html +228 -0
- data/doc/classes/Lisp/Format/Directives/CharacterDirective.html +203 -0
- data/doc/classes/Lisp/Format/Directives/ClauseSeparator.html +166 -0
- data/doc/classes/Lisp/Format/Directives/Decimal.html +119 -0
- data/doc/classes/Lisp/Format/Directives/Directive.html +397 -0
- data/doc/classes/Lisp/Format/Directives/DollarFP.html +205 -0
- data/doc/classes/Lisp/Format/Directives/EndCaseConversion.html +174 -0
- data/doc/classes/Lisp/Format/Directives/EndConditional.html +159 -0
- data/doc/classes/Lisp/Format/Directives/EndIteration.html +163 -0
- data/doc/classes/Lisp/Format/Directives/ExpFP.html +252 -0
- data/doc/classes/Lisp/Format/Directives/FFFP.html +224 -0
- data/doc/classes/Lisp/Format/Directives/Factory.html +180 -0
- data/doc/classes/Lisp/Format/Directives/FreshLine.html +175 -0
- data/doc/classes/Lisp/Format/Directives/GeneralFP.html +265 -0
- data/doc/classes/Lisp/Format/Directives/Hexadecimal.html +157 -0
- data/doc/classes/Lisp/Format/Directives/Indirection.html +183 -0
- data/doc/classes/Lisp/Format/Directives/Literal.html +187 -0
- data/doc/classes/Lisp/Format/Directives/NewLine.html +158 -0
- data/doc/classes/Lisp/Format/Directives/NewPage.html +158 -0
- data/doc/classes/Lisp/Format/Directives/Number.html +243 -0
- data/doc/classes/Lisp/Format/Directives/Octal.html +157 -0
- data/doc/classes/Lisp/Format/Directives/Plural.html +177 -0
- data/doc/classes/Lisp/Format/Directives/Print.html +237 -0
- data/doc/classes/Lisp/Format/Directives/Radix.html +432 -0
- data/doc/classes/Lisp/Format/Directives/SExpression.html +157 -0
- data/doc/classes/Lisp/Format/Directives/SkipWhitespace.html +165 -0
- data/doc/classes/Lisp/Format/Directives/Tabulate.html +198 -0
- data/doc/classes/Lisp/Format/Directives/Tilde.html +158 -0
- data/doc/classes/Lisp/Format/Directives/UnknownDirectiveError.html +117 -0
- data/doc/classes/Lisp/Format/Formatter.html +193 -0
- data/doc/classes/Lisp/Format/IncompleteParameterError.html +119 -0
- data/doc/classes/Lisp/Format/IndexError.html +126 -0
- data/doc/classes/Lisp/Format/Lexer.html +479 -0
- data/doc/classes/Lisp/Format/MalformedError.html +119 -0
- data/doc/classes/Lisp/Format/MissingParameterError.html +119 -0
- data/doc/classes/Lisp/Format/ModifierError.html +119 -0
- data/doc/classes/Lisp/Format/Output.html +239 -0
- data/doc/classes/Lisp/Format/ParameterError.html +126 -0
- data/doc/classes/Lisp/Format/Parameters.html +123 -0
- data/doc/classes/Lisp/Format/Parameters/Argument.html +172 -0
- data/doc/classes/Lisp/Format/Parameters/ArgumentCount.html +159 -0
- data/doc/classes/Lisp/Format/Parameters/Character.html +119 -0
- data/doc/classes/Lisp/Format/Parameters/Default.html +120 -0
- data/doc/classes/Lisp/Format/Parameters/Integer.html +119 -0
- data/doc/classes/Lisp/Format/Parameters/Parameter.html +206 -0
- data/doc/classes/Lisp/Format/Parser.html +212 -0
- data/doc/classes/Lisp/Format/Positioned.html +166 -0
- data/doc/classes/Lisp/Format/State.html +455 -0
- data/doc/classes/Lisp/Format/SyntaxError.html +126 -0
- data/doc/classes/Method.html +274 -0
- data/doc/classes/Method/DuckHunter.html +281 -0
- data/doc/classes/Module.html +709 -0
- data/doc/classes/Multiton.html +284 -0
- data/doc/classes/Multiton/New.html +164 -0
- data/doc/classes/Multiton/Semi.html +155 -0
- data/doc/classes/NackClass.html +322 -0
- data/doc/classes/NilClass.html +231 -0
- data/doc/classes/NilComparable.html +179 -0
- data/doc/classes/NotCopyable.html +273 -0
- data/doc/classes/Object.html +261 -0
- data/doc/classes/OpenStructable.html +346 -0
- data/doc/classes/OrderedHash.html +939 -0
- data/doc/classes/Parser.html +515 -0
- data/doc/classes/Parser/Main.html +178 -0
- data/doc/classes/Parser/Marker.html +475 -0
- data/doc/classes/Parser/Registry.html +354 -0
- data/doc/classes/Parser/Token.html +399 -0
- data/doc/classes/Parser/UnitToken.html +222 -0
- data/doc/classes/Ref.html +230 -0
- data/doc/classes/SimpleStringIO.html +183 -0
- data/doc/classes/StaticHash.html +202 -0
- data/doc/classes/String.html +172 -0
- data/doc/classes/Struct.html +181 -0
- data/doc/classes/SuperStruct.html +382 -0
- data/doc/classes/Term.html +156 -0
- data/doc/classes/Term/ANSIColor.html +185 -0
- data/doc/classes/Text.html +138 -0
- data/doc/classes/Text/Soundex.html +222 -0
- data/doc/classes/TextTagIterator.html +911 -0
- data/doc/classes/Time.html +119 -0
- data/doc/classes/Time/Limit.html +303 -0
- data/doc/classes/Time/Limit/Dummy.html +181 -0
- data/doc/classes/Timer.html +351 -0
- data/doc/classes/TracePoint.html +532 -0
- data/doc/classes/Tuple.html +178 -0
- data/doc/classes/Uninheritable.html +213 -0
- data/doc/classes/Version.html +783 -0
- data/doc/created.rid +1 -0
- data/doc/files/LICENSE.html +113 -0
- data/doc/files/README.html +201 -0
- data/doc/files/lib/carat/1st_rb.html +107 -0
- data/doc/files/lib/carat/ansicolor_rb.html +146 -0
- data/doc/files/lib/carat/attr_rb.html +101 -0
- data/doc/files/lib/carat/bbcode_rb.html +152 -0
- data/doc/files/lib/carat/binaryreader_rb.html +114 -0
- data/doc/files/lib/carat/binding-of-caller_rb.html +108 -0
- data/doc/files/lib/carat/byteorder_rb.html +107 -0
- data/doc/files/lib/carat/constant_rb.html +167 -0
- data/doc/files/lib/carat/coroutine_rb.html +156 -0
- data/doc/files/lib/carat/crosscase_rb.html +224 -0
- data/doc/files/lib/carat/duckhunter_rb.html +165 -0
- data/doc/files/lib/carat/dynamic-mixin_rb.html +101 -0
- data/doc/files/lib/carat/enumerable-args_rb.html +140 -0
- data/doc/files/lib/carat/expect_rb.html +137 -0
- data/doc/files/lib/carat/filelist_rb.html +130 -0
- data/doc/files/lib/carat/floatstring_rb.html +126 -0
- data/doc/files/lib/carat/functor_rb.html +140 -0
- data/doc/files/lib/carat/harray_rb.html +128 -0
- data/doc/files/lib/carat/heap_rb.html +154 -0
- data/doc/files/lib/carat/html-helpers_rb.html +116 -0
- data/doc/files/lib/carat/infinity_rb.html +142 -0
- data/doc/files/lib/carat/init_rb.html +127 -0
- data/doc/files/lib/carat/interval_rb.html +162 -0
- data/doc/files/lib/carat/io-reactor_rb.html +211 -0
- data/doc/files/lib/carat/io-redirect_rb.html +132 -0
- data/doc/files/lib/carat/lisp-format_rb.html +187 -0
- data/doc/files/lib/carat/lisp_rb.html +152 -0
- data/doc/files/lib/carat/macro_rb.html +129 -0
- data/doc/files/lib/carat/multiton_rb.html +178 -0
- data/doc/files/lib/carat/nack_rb.html +193 -0
- data/doc/files/lib/carat/nil-comparable_rb.html +126 -0
- data/doc/files/lib/carat/nil-missing_rb.html +101 -0
- data/doc/files/lib/carat/notcopyable_rb.html +166 -0
- data/doc/files/lib/carat/orderedhash_rb.html +107 -0
- data/doc/files/lib/carat/ostructable_rb.html +157 -0
- data/doc/files/lib/carat/parser-old_rb.html +239 -0
- data/doc/files/lib/carat/parser_rb.html +244 -0
- data/doc/files/lib/carat/ref_rb.html +107 -0
- data/doc/files/lib/carat/semaphore_rb.html +132 -0
- data/doc/files/lib/carat/snapshot_rb.html +152 -0
- data/doc/files/lib/carat/soundex_rb.html +128 -0
- data/doc/files/lib/carat/sstruct_rb.html +142 -0
- data/doc/files/lib/carat/statichash_rb.html +150 -0
- data/doc/files/lib/carat/tagiter_rb.html +236 -0
- data/doc/files/lib/carat/timelimit_rb.html +136 -0
- data/doc/files/lib/carat/timer_rb.html +153 -0
- data/doc/files/lib/carat/tracepoint_rb.html +160 -0
- data/doc/files/lib/carat/tuple_rb.html +123 -0
- data/doc/files/lib/carat/uninheritable_rb.html +101 -0
- data/doc/files/lib/carat/version_rb.html +141 -0
- data/doc/fr_class_index.html +159 -0
- data/doc/fr_file_index.html +78 -0
- data/doc/fr_method_index.html +663 -0
- data/doc/index.html +24 -0
- data/doc/rdoc-style.css +208 -0
- data/lib/carat-dev/README +11 -0
- data/lib/carat-dev/access-blocks/access_blocks.rb +42 -0
- data/lib/carat-dev/association/association.rb +70 -0
- data/lib/carat-dev/blankslate/blankslate.rb +51 -0
- data/lib/carat-dev/breakpoint.rb +518 -0
- data/lib/carat-dev/class-constructor/constructor_methods.rb +78 -0
- data/lib/carat-dev/class-constructor/tc_constructor.rb +35 -0
- data/lib/carat-dev/closecall/closecall-test.rb +39 -0
- data/lib/carat-dev/closecall/closecall.rb +101 -0
- data/lib/carat-dev/commandrunner/commandrunner.rb +100 -0
- data/lib/carat-dev/conditional/conditionals.rb +106 -0
- data/lib/carat-dev/daemon/daemon.rb +70 -0
- data/lib/carat-dev/detach/detach.rb +363 -0
- data/lib/carat-dev/detach/tc_detach.rb +57 -0
- data/lib/carat-dev/import-module/import-module-0.81.tar.gz +0 -0
- data/lib/carat-dev/import-module/import-module-0.81/LICENSE +1 -0
- data/lib/carat-dev/import-module/import-module-0.81/Makefile +11 -0
- data/lib/carat-dev/import-module/import-module-0.81/README +4 -0
- data/lib/carat-dev/import-module/import-module-0.81/dev-lib/import-module-hash.rb +49 -0
- data/lib/carat-dev/import-module/import-module-0.81/dev-lib/import-module-pip.rb +71 -0
- data/lib/carat-dev/import-module/import-module-0.81/dev-lib/import-module-unbound-method.rb +36 -0
- data/lib/carat-dev/import-module/import-module-0.81/doc/README-ja.html +293 -0
- data/lib/carat-dev/import-module/import-module-0.81/doc/README-ja.rd +306 -0
- data/lib/carat-dev/import-module/import-module-0.81/doc/README.html +290 -0
- data/lib/carat-dev/import-module/import-module-0.81/doc/README.rd +303 -0
- data/lib/carat-dev/import-module/import-module-0.81/doc/style.css +85 -0
- data/lib/carat-dev/import-module/import-module-0.81/install.rb +99 -0
- data/lib/carat-dev/import-module/import-module-0.81/lib/import-module-single-thread.rb +84 -0
- data/lib/carat-dev/import-module/import-module-0.81/lib/import-module.rb +493 -0
- data/lib/carat-dev/import-module/import-module-0.81/test/Makefile +2 -0
- data/lib/carat-dev/import-module/import-module-0.81/test/test +91 -0
- data/lib/carat-dev/import-module/import-module-0.81/test/test-import-module.rb +936 -0
- data/lib/carat-dev/import-module/import-module-0.81/test/test-import_scope.rb +33 -0
- data/lib/carat-dev/import-module/import-module-0.81/test/test-scope_import.rb +33 -0
- data/lib/carat-dev/import-module/import-module-0.81/test/test-time.rb +184 -0
- data/lib/carat-dev/import-module/import-module-0.81/test/test.sh +91 -0
- data/lib/carat-dev/import-module/import-module-0.81/test/time.rb +135 -0
- data/lib/carat-dev/import-module/import-module-0.81/test/times-do.sh +10 -0
- data/lib/carat-dev/interface_work/SCRAP/i-contracts.rb +37 -0
- data/lib/carat-dev/interface_work/SCRAP/interface.rb +105 -0
- data/lib/carat-dev/interface_work/SCRAP/j-interface/interface-0.1.0.zip +0 -0
- data/lib/carat-dev/interface_work/SCRAP/j-interface/interface-0.1.0/CHANGES +3 -0
- data/lib/carat-dev/interface_work/SCRAP/j-interface/interface-0.1.0/MANIFEST +15 -0
- data/lib/carat-dev/interface_work/SCRAP/j-interface/interface-0.1.0/README +32 -0
- data/lib/carat-dev/interface_work/SCRAP/j-interface/interface-0.1.0/doc/interface.rd +73 -0
- data/lib/carat-dev/interface_work/SCRAP/j-interface/interface-0.1.0/doc/interface.txt +94 -0
- data/lib/carat-dev/interface_work/SCRAP/j-interface/interface-0.1.0/install.rb +16 -0
- data/lib/carat-dev/interface_work/SCRAP/j-interface/interface-0.1.0/lib/interface.rb +50 -0
- data/lib/carat-dev/interface_work/SCRAP/j-interface/interface-0.1.0/test/tc_interface.rb +51 -0
- data/lib/carat-dev/interface_work/SCRAP/j-interface/interface-0.1.0/test/test.rb +29 -0
- data/lib/carat-dev/interface_work/SCRAP/j-interface/interface-0.1.0/test/test_instance.rb +24 -0
- data/lib/carat-dev/interface_work/SCRAP/j-interface/interface-0.1.0/test/test_sub.rb +29 -0
- data/lib/carat-dev/interface_work/SCRAP/j-interface/interface-0.1.0/test/test_unrequire.rb +28 -0
- data/lib/carat-dev/interface_work/contracts/contract.zip +0 -0
- data/lib/carat-dev/interface_work/contracts/contract/doc/classes/Contract.html +376 -0
- data/lib/carat-dev/interface_work/contracts/contract/doc/classes/Contract.src/M000001.html +23 -0
- data/lib/carat-dev/interface_work/contracts/contract/doc/classes/Contract.src/M000002.html +18 -0
- data/lib/carat-dev/interface_work/contracts/contract/doc/classes/Contract.src/M000003.html +19 -0
- data/lib/carat-dev/interface_work/contracts/contract/doc/classes/Contract.src/M000004.html +29 -0
- data/lib/carat-dev/interface_work/contracts/contract/doc/classes/Contract.src/M000005.html +18 -0
- data/lib/carat-dev/interface_work/contracts/contract/doc/classes/Contract.src/M000006.html +18 -0
- data/lib/carat-dev/interface_work/contracts/contract/doc/classes/Contract/ContractError.html +142 -0
- data/lib/carat-dev/interface_work/contracts/contract/doc/classes/Contract/ContractException.html +153 -0
- data/lib/carat-dev/interface_work/contracts/contract/doc/classes/Contract/ContractMismatch.html +125 -0
- data/lib/carat-dev/interface_work/contracts/contract/doc/classes/Module.html +157 -0
- data/lib/carat-dev/interface_work/contracts/contract/doc/classes/Module.src/M000007.html +112 -0
- data/lib/carat-dev/interface_work/contracts/contract/doc/created.rid +1 -0
- data/lib/carat-dev/interface_work/contracts/contract/doc/files/lib/contract/assertions_rb.html +109 -0
- data/lib/carat-dev/interface_work/contracts/contract/doc/files/lib/contract/exception_rb.html +108 -0
- data/lib/carat-dev/interface_work/contracts/contract/doc/files/lib/contract/integration_rb.html +108 -0
- data/lib/carat-dev/interface_work/contracts/contract/doc/files/lib/contract/overrides_rb.html +109 -0
- data/lib/carat-dev/interface_work/contracts/contract/doc/files/lib/contract_rb.html +114 -0
- data/lib/carat-dev/interface_work/contracts/contract/doc/fr_class_index.html +31 -0
- data/lib/carat-dev/interface_work/contracts/contract/doc/fr_file_index.html +31 -0
- data/lib/carat-dev/interface_work/contracts/contract/doc/fr_method_index.html +33 -0
- data/lib/carat-dev/interface_work/contracts/contract/doc/index.html +24 -0
- data/lib/carat-dev/interface_work/contracts/contract/doc/rdoc-style.css +208 -0
- data/lib/carat-dev/interface_work/contracts/contract/lib/contract.rb +88 -0
- data/lib/carat-dev/interface_work/contracts/contract/lib/contract/assertions.rb +37 -0
- data/lib/carat-dev/interface_work/contracts/contract/lib/contract/exception.rb +92 -0
- data/lib/carat-dev/interface_work/contracts/contract/lib/contract/integration.rb +132 -0
- data/lib/carat-dev/interface_work/contracts/contract/lib/contract/overrides.rb +32 -0
- data/lib/carat-dev/interface_work/must.rb +37 -0
- data/lib/carat-dev/interface_work/type.rb +232 -0
- data/lib/carat-dev/main/tc_toplevel.rb +23 -0
- data/lib/carat-dev/main/toplevel.rb +33 -0
- data/lib/carat-dev/main/toplevel_test.rb +24 -0
- data/lib/carat-dev/misc/1.rb +40 -0
- data/lib/carat-dev/misc/misc.rb +44 -0
- data/lib/carat-dev/misc/sys.rb +186 -0
- data/lib/carat-dev/misc/temp.rb +1 -0
- data/lib/carat-dev/misc/utils.rb +518 -0
- data/lib/carat-dev/predicate/predicate.rb +109 -0
- data/lib/carat-dev/predicate/predicate_test.rb +67 -0
- data/lib/carat-dev/premshree.rb +40 -0
- data/lib/carat-dev/priority-queue/pqueue.rb +183 -0
- data/lib/carat-dev/priority-queue/priorityqueue.rb +84 -0
- data/lib/carat-dev/quaternion/quaternion.rb +529 -0
- data/lib/carat-dev/range.rb +259 -0
- data/lib/carat-dev/system/rubyinfo.rb +75 -0
- data/lib/carat-dev/system/system.rb +105 -0
- data/lib/carat-dev/tc_range.rb +118 -0
- data/lib/carat-dev/timer/timer-doc/classes/Timer.html +291 -0
- data/lib/carat-dev/timer/timer-doc/classes/Timer.src/M000001.html +26 -0
- data/lib/carat-dev/timer/timer-doc/classes/Timer.src/M000002.html +19 -0
- data/lib/carat-dev/timer/timer-doc/classes/Timer.src/M000003.html +18 -0
- data/lib/carat-dev/timer/timer-doc/classes/Timer.src/M000004.html +18 -0
- data/lib/carat-dev/timer/timer-doc/classes/Timer.src/M000005.html +21 -0
- data/lib/carat-dev/timer/timer-doc/classes/Timer.src/M000006.html +23 -0
- data/lib/carat-dev/timer/timer-doc/created.rid +1 -0
- data/lib/carat-dev/timer/timer-doc/files/timer_rb.html +144 -0
- data/lib/carat-dev/timer/timer-doc/fr_class_index.html +27 -0
- data/lib/carat-dev/timer/timer-doc/fr_file_index.html +27 -0
- data/lib/carat-dev/timer/timer-doc/fr_method_index.html +32 -0
- data/lib/carat-dev/timer/timer-doc/index.html +24 -0
- data/lib/carat-dev/timer/timer-doc/rdoc-style.css +208 -0
- data/lib/carat-dev/timer/timer.rb +160 -0
- data/lib/carat-dev/vars/vars.rb +62 -0
- data/lib/carat/1st.rb +58 -0
- data/lib/carat/ansicolor.rb +122 -0
- data/lib/carat/attr.rb +342 -0
- data/lib/carat/bbcode.rb +352 -0
- data/lib/carat/binaryreader.rb +170 -0
- data/lib/carat/binding-of-caller.rb +83 -0
- data/lib/carat/byteorder.rb +34 -0
- data/lib/carat/constant.rb +287 -0
- data/lib/carat/coroutine.rb +102 -0
- data/lib/carat/crosscase.rb +309 -0
- data/lib/carat/duckhunter.rb +158 -0
- data/lib/carat/dynamic-mixin.rb +71 -0
- data/lib/carat/enumerable-args.rb +125 -0
- data/lib/carat/expect.rb +192 -0
- data/lib/carat/filelist.rb +277 -0
- data/lib/carat/floatstring.rb +153 -0
- data/lib/carat/functor.rb +41 -0
- data/lib/carat/harray.rb +507 -0
- data/lib/carat/heap.rb +193 -0
- data/lib/carat/html-helpers.rb +82 -0
- data/lib/carat/infinity.rb +61 -0
- data/lib/carat/init.rb +33 -0
- data/lib/carat/interval.rb +248 -0
- data/lib/carat/io-reactor.rb +657 -0
- data/lib/carat/io-redirect.rb +99 -0
- data/lib/carat/lisp-format.rb +1832 -0
- data/lib/carat/lisp.rb +336 -0
- data/lib/carat/macro.rb +68 -0
- data/lib/carat/multiton.rb +153 -0
- data/lib/carat/nack.rb +115 -0
- data/lib/carat/nil-comparable.rb +67 -0
- data/lib/carat/nil-missing.rb +12 -0
- data/lib/carat/notcopyable.rb +68 -0
- data/lib/carat/orderedhash.rb +249 -0
- data/lib/carat/ostructable.rb +138 -0
- data/lib/carat/parser-old.rb +350 -0
- data/lib/carat/parser.rb +393 -0
- data/lib/carat/ref.rb +31 -0
- data/lib/carat/semaphore.rb +69 -0
- data/lib/carat/snapshot.rb +94 -0
- data/lib/carat/soundex.rb +104 -0
- data/lib/carat/sstruct.rb +223 -0
- data/lib/carat/statichash.rb +49 -0
- data/lib/carat/tagiter.rb +345 -0
- data/lib/carat/timelimit.rb +114 -0
- data/lib/carat/timer.rb +99 -0
- data/lib/carat/tracepoint.rb +154 -0
- data/lib/carat/tuple.rb +31 -0
- data/lib/carat/uninheritable.rb +68 -0
- data/lib/carat/version.rb +147 -0
- data/pub/doc/sstruct.txt +204 -0
- data/pub/doc/tagiter.html +145 -0
- data/setup.rb +1361 -0
- data/test/fixtures/filelist/testfile.txt +1 -0
- data/test/fixtures/filelist/testfile2.txt +1 -0
- data/test/tc_1st.rb +16 -0
- data/test/tc_ansicolor.rb +23 -0
- data/test/tc_attr.rb +46 -0
- data/test/tc_bbcode.rb +20 -0
- data/test/tc_binaryreader.rb +14 -0
- data/test/tc_binding_of_caller.rb +2 -0
- data/test/tc_byteorder.rb +41 -0
- data/test/tc_constant.rb +12 -0
- data/test/tc_coroutine.rb +50 -0
- data/test/tc_crosscase.rb +33 -0
- data/test/tc_duckhunter.rb +37 -0
- data/test/tc_dynamic-mixin.rb +66 -0
- data/test/tc_enumerable-args.rb +66 -0
- data/test/tc_expect.rb +83 -0
- data/test/tc_filelist.rb +17 -0
- data/test/tc_floatstring.rb +22 -0
- data/test/tc_functor.rb +18 -0
- data/test/tc_harray.rb +280 -0
- data/test/tc_heap.rb +6 -0
- data/test/tc_infinity.rb +23 -0
- data/test/tc_init.rb +29 -0
- data/test/tc_interval.rb +153 -0
- data/test/tc_io-reactor.rb +5 -0
- data/test/tc_io-redirect.rb +5 -0
- data/test/tc_lisp-format.rb +24 -0
- data/test/tc_lisp.rb +32 -0
- data/test/tc_macro.rb +48 -0
- data/test/tc_multiton.rb +188 -0
- data/test/tc_nack.rb +31 -0
- data/test/tc_nil-as-emptiness.rb +19 -0
- data/test/tc_nil-comparable.rb +29 -0
- data/test/tc_nil-missing.rb +0 -0
- data/test/tc_notcopyable.rb +64 -0
- data/test/tc_orderedhash.rb +36 -0
- data/test/tc_ostructable.rb +31 -0
- data/test/tc_semaphore.rb +5 -0
- data/test/tc_snapshot.rb +20 -0
- data/test/tc_soundex.rb +19 -0
- data/test/tc_sstruct.rb +313 -0
- data/test/tc_statichash.rb +24 -0
- data/test/tc_tagiter.rb +80 -0
- data/test/tc_timelimit.rb +47 -0
- data/test/tc_timer.rb +35 -0
- data/test/tc_tracepoint.rb +10 -0
- data/test/tc_tuple.rb +25 -0
- data/test/tc_uninheritable.rb +33 -0
- data/test/tc_version.rb +90 -0
- metadata +531 -0
@@ -0,0 +1,1014 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>Class: Interval</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="classHeader">
|
50
|
+
<table class="header-table">
|
51
|
+
<tr class="top-aligned-row">
|
52
|
+
<td><strong>Class</strong></td>
|
53
|
+
<td class="class-name-in-header">Interval</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../files/lib/carat/interval_rb.html">
|
59
|
+
lib/carat/interval.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
</td>
|
63
|
+
</tr>
|
64
|
+
|
65
|
+
<tr class="top-aligned-row">
|
66
|
+
<td><strong>Parent:</strong></td>
|
67
|
+
<td>
|
68
|
+
<a href="Object.html">
|
69
|
+
Object
|
70
|
+
</a>
|
71
|
+
</td>
|
72
|
+
</tr>
|
73
|
+
</table>
|
74
|
+
</div>
|
75
|
+
<!-- banner header -->
|
76
|
+
|
77
|
+
<div id="bodyContent">
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
<div id="contextContent">
|
82
|
+
|
83
|
+
<div id="description">
|
84
|
+
<p>
|
85
|
+
require ‘carat/infinity‘
|
86
|
+
</p>
|
87
|
+
|
88
|
+
</div>
|
89
|
+
|
90
|
+
|
91
|
+
</div>
|
92
|
+
|
93
|
+
<div id="method-list">
|
94
|
+
<h3 class="section-bar">Methods</h3>
|
95
|
+
|
96
|
+
<div class="name-list">
|
97
|
+
<a href="#M000197">+@</a>
|
98
|
+
<a href="#M000198">-@</a>
|
99
|
+
<a href="#M000207">===</a>
|
100
|
+
<a href="#M000176">[]</a>
|
101
|
+
<a href="#M000183">begin</a>
|
102
|
+
<a href="#M000190">closed</a>
|
103
|
+
<a href="#M000187">degenerate?</a>
|
104
|
+
<a href="#M000189">direction</a>
|
105
|
+
<a href="#M000201">distance</a>
|
106
|
+
<a href="#M000209">each</a>
|
107
|
+
<a href="#M000184">end</a>
|
108
|
+
<a href="#M000211">eql?</a>
|
109
|
+
<a href="#M000185">exclude_begin?</a>
|
110
|
+
<a href="#M000186">exclude_end?</a>
|
111
|
+
<a href="#M000181">exclude_first?</a>
|
112
|
+
<a href="#M000182">exclude_last?</a>
|
113
|
+
<a href="#M000179">first</a>
|
114
|
+
<a href="#M000193">first_closed</a>
|
115
|
+
<a href="#M000195">first_opened</a>
|
116
|
+
<a href="#M000192">half_closed</a>
|
117
|
+
<a href="#M000206">include?</a>
|
118
|
+
<a href="#M000180">last</a>
|
119
|
+
<a href="#M000194">last_closed</a>
|
120
|
+
<a href="#M000196">last_opened</a>
|
121
|
+
<a href="#M000202">length</a>
|
122
|
+
<a href="#M000205">max</a>
|
123
|
+
<a href="#M000208">member?</a>
|
124
|
+
<a href="#M000204">min</a>
|
125
|
+
<a href="#M000177">new</a>
|
126
|
+
<a href="#M000188">null?</a>
|
127
|
+
<a href="#M000191">opened</a>
|
128
|
+
<a href="#M000200">reversed</a>
|
129
|
+
<a href="#M000178">sentinels</a>
|
130
|
+
<a href="#M000203">size</a>
|
131
|
+
<a href="#M000210">step</a>
|
132
|
+
<a href="#M000199">~</a>
|
133
|
+
</div>
|
134
|
+
</div>
|
135
|
+
|
136
|
+
</div>
|
137
|
+
|
138
|
+
|
139
|
+
<!-- if includes -->
|
140
|
+
<div id="includes">
|
141
|
+
<h3 class="section-bar">Included Modules</h3>
|
142
|
+
|
143
|
+
<div id="includes-list">
|
144
|
+
<span class="include-name"><a href="Multiton/New.html">Multiton::New</a></span>
|
145
|
+
<span class="include-name"><a href="EnumerableWithArgs.html">EnumerableWithArgs</a></span>
|
146
|
+
</div>
|
147
|
+
</div>
|
148
|
+
|
149
|
+
<div id="section">
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
|
158
|
+
<!-- if method_list -->
|
159
|
+
<div id="methods">
|
160
|
+
<h3 class="section-bar">Public Class methods</h3>
|
161
|
+
|
162
|
+
<div id="method-M000176" class="method-detail">
|
163
|
+
<a name="M000176"></a>
|
164
|
+
|
165
|
+
<div class="method-heading">
|
166
|
+
<a href="#M000176" class="method-signature">
|
167
|
+
<span class="method-name">[]</span><span class="method-args">( *args )</span>
|
168
|
+
</a>
|
169
|
+
</div>
|
170
|
+
|
171
|
+
<div class="method-description">
|
172
|
+
<p><a class="source-toggle" href="#"
|
173
|
+
onclick="toggleCode('M000176-source');return false;">[Source]</a></p>
|
174
|
+
<div class="method-source-code" id="M000176-source">
|
175
|
+
<pre>
|
176
|
+
<span class="ruby-comment cmt"># File lib/carat/interval.rb, line 55</span>
|
177
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-operator">[]</span>( <span class="ruby-operator">*</span><span class="ruby-identifier">args</span> )
|
178
|
+
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">new</span>( <span class="ruby-operator">*</span><span class="ruby-identifier">args</span> )
|
179
|
+
<span class="ruby-keyword kw">end</span>
|
180
|
+
</pre>
|
181
|
+
</div>
|
182
|
+
</div>
|
183
|
+
</div>
|
184
|
+
|
185
|
+
<div id="method-M000177" class="method-detail">
|
186
|
+
<a name="M000177"></a>
|
187
|
+
|
188
|
+
<div class="method-heading">
|
189
|
+
<a href="#M000177" class="method-signature">
|
190
|
+
<span class="method-name">new</span><span class="method-args">(first, last, exclude_first=false, exclude_last=false )</span>
|
191
|
+
</a>
|
192
|
+
</div>
|
193
|
+
|
194
|
+
<div class="method-description">
|
195
|
+
<p><a class="source-toggle" href="#"
|
196
|
+
onclick="toggleCode('M000177-source');return false;">[Source]</a></p>
|
197
|
+
<div class="method-source-code" id="M000177-source">
|
198
|
+
<pre>
|
199
|
+
<span class="ruby-comment cmt"># File lib/carat/interval.rb, line 59</span>
|
200
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">first</span>, <span class="ruby-identifier">last</span>, <span class="ruby-identifier">exclude_first</span>=<span class="ruby-keyword kw">false</span>, <span class="ruby-identifier">exclude_last</span>=<span class="ruby-keyword kw">false</span> )
|
201
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">"bad value for interval"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">first</span>.<span class="ruby-identifier">class</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">last</span>.<span class="ruby-identifier">class</span>
|
202
|
+
<span class="ruby-ivar">@first</span> = <span class="ruby-identifier">first</span>
|
203
|
+
<span class="ruby-ivar">@last</span> = <span class="ruby-identifier">last</span>
|
204
|
+
<span class="ruby-ivar">@exclude_first</span> = <span class="ruby-identifier">exclude_first</span>
|
205
|
+
<span class="ruby-ivar">@exclude_last</span> = <span class="ruby-identifier">exclude_last</span>
|
206
|
+
<span class="ruby-ivar">@direction</span> = (<span class="ruby-ivar">@last</span> <span class="ruby-operator"><=></span> <span class="ruby-ivar">@first</span>)
|
207
|
+
<span class="ruby-keyword kw">end</span>
|
208
|
+
</pre>
|
209
|
+
</div>
|
210
|
+
</div>
|
211
|
+
</div>
|
212
|
+
|
213
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
214
|
+
|
215
|
+
<div id="method-M000197" class="method-detail">
|
216
|
+
<a name="M000197"></a>
|
217
|
+
|
218
|
+
<div class="method-heading">
|
219
|
+
<a href="#M000197" class="method-signature">
|
220
|
+
<span class="method-name">+@</span><span class="method-args">()</span>
|
221
|
+
</a>
|
222
|
+
</div>
|
223
|
+
|
224
|
+
<div class="method-description">
|
225
|
+
<p>
|
226
|
+
Unary shorthands. These return a new interval exclusive of first, last or
|
227
|
+
both sentinels, repectively.
|
228
|
+
</p>
|
229
|
+
<p><a class="source-toggle" href="#"
|
230
|
+
onclick="toggleCode('M000197-source');return false;">[Source]</a></p>
|
231
|
+
<div class="method-source-code" id="M000197-source">
|
232
|
+
<pre>
|
233
|
+
<span class="ruby-comment cmt"># File lib/carat/interval.rb, line 125</span>
|
234
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-operator">+@</span> ; <span class="ruby-constant">Interval</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">first</span>, <span class="ruby-identifier">last</span>, <span class="ruby-keyword kw">true</span>, <span class="ruby-keyword kw">false</span>) ; <span class="ruby-keyword kw">end</span>
|
235
|
+
</pre>
|
236
|
+
</div>
|
237
|
+
</div>
|
238
|
+
</div>
|
239
|
+
|
240
|
+
<div id="method-M000198" class="method-detail">
|
241
|
+
<a name="M000198"></a>
|
242
|
+
|
243
|
+
<div class="method-heading">
|
244
|
+
<a href="#M000198" class="method-signature">
|
245
|
+
<span class="method-name">-@</span><span class="method-args">()</span>
|
246
|
+
</a>
|
247
|
+
</div>
|
248
|
+
|
249
|
+
<div class="method-description">
|
250
|
+
<p><a class="source-toggle" href="#"
|
251
|
+
onclick="toggleCode('M000198-source');return false;">[Source]</a></p>
|
252
|
+
<div class="method-source-code" id="M000198-source">
|
253
|
+
<pre>
|
254
|
+
<span class="ruby-comment cmt"># File lib/carat/interval.rb, line 126</span>
|
255
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-operator">-@</span> ; <span class="ruby-constant">Interval</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">first</span>, <span class="ruby-identifier">last</span>, <span class="ruby-keyword kw">false</span>, <span class="ruby-keyword kw">true</span>) ; <span class="ruby-keyword kw">end</span>
|
256
|
+
</pre>
|
257
|
+
</div>
|
258
|
+
</div>
|
259
|
+
</div>
|
260
|
+
|
261
|
+
<div id="method-M000207" class="method-detail">
|
262
|
+
<a name="M000207"></a>
|
263
|
+
|
264
|
+
<div class="method-heading">
|
265
|
+
<span class="method-name">===</span><span class="method-args">(x)</span>
|
266
|
+
</div>
|
267
|
+
|
268
|
+
<div class="method-description">
|
269
|
+
<p>
|
270
|
+
Alias for <a href="Interval.html#M000206">include?</a>
|
271
|
+
</p>
|
272
|
+
</div>
|
273
|
+
</div>
|
274
|
+
|
275
|
+
<div id="method-M000183" class="method-detail">
|
276
|
+
<a name="M000183"></a>
|
277
|
+
|
278
|
+
<div class="method-heading">
|
279
|
+
<span class="method-name">begin</span><span class="method-args">()</span>
|
280
|
+
</div>
|
281
|
+
|
282
|
+
<div class="method-description">
|
283
|
+
<p>
|
284
|
+
Alias for <a href="Interval.html#M000179">first</a>
|
285
|
+
</p>
|
286
|
+
</div>
|
287
|
+
</div>
|
288
|
+
|
289
|
+
<div id="method-M000190" class="method-detail">
|
290
|
+
<a name="M000190"></a>
|
291
|
+
|
292
|
+
<div class="method-heading">
|
293
|
+
<a href="#M000190" class="method-signature">
|
294
|
+
<span class="method-name">closed</span><span class="method-args">()</span>
|
295
|
+
</a>
|
296
|
+
</div>
|
297
|
+
|
298
|
+
<div class="method-description">
|
299
|
+
<p>
|
300
|
+
Returns a new interval inclusive of of both sentinels.
|
301
|
+
</p>
|
302
|
+
<p><a class="source-toggle" href="#"
|
303
|
+
onclick="toggleCode('M000190-source');return false;">[Source]</a></p>
|
304
|
+
<div class="method-source-code" id="M000190-source">
|
305
|
+
<pre>
|
306
|
+
<span class="ruby-comment cmt"># File lib/carat/interval.rb, line 105</span>
|
307
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">closed</span>; <span class="ruby-constant">Interval</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@first</span>, <span class="ruby-ivar">@last</span>, <span class="ruby-keyword kw">true</span>, <span class="ruby-keyword kw">true</span>) ; <span class="ruby-keyword kw">end</span>
|
308
|
+
</pre>
|
309
|
+
</div>
|
310
|
+
</div>
|
311
|
+
</div>
|
312
|
+
|
313
|
+
<div id="method-M000187" class="method-detail">
|
314
|
+
<a name="M000187"></a>
|
315
|
+
|
316
|
+
<div class="method-heading">
|
317
|
+
<a href="#M000187" class="method-signature">
|
318
|
+
<span class="method-name">degenerate?</span><span class="method-args">()</span>
|
319
|
+
</a>
|
320
|
+
</div>
|
321
|
+
|
322
|
+
<div class="method-description">
|
323
|
+
<p>
|
324
|
+
Returns <tt>true</tt> if the start and end sentinels are equal and the
|
325
|
+
interval is closed; otherwise <tt>false</tt>.
|
326
|
+
</p>
|
327
|
+
<p><a class="source-toggle" href="#"
|
328
|
+
onclick="toggleCode('M000187-source');return false;">[Source]</a></p>
|
329
|
+
<div class="method-source-code" id="M000187-source">
|
330
|
+
<pre>
|
331
|
+
<span class="ruby-comment cmt"># File lib/carat/interval.rb, line 91</span>
|
332
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">degenerate?</span> ; <span class="ruby-ivar">@direction</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span> <span class="ruby-keyword kw">and</span> <span class="ruby-operator">!</span> (<span class="ruby-ivar">@exclusive_first</span> <span class="ruby-keyword kw">or</span> <span class="ruby-ivar">@exclusive_last</span>) ; <span class="ruby-keyword kw">end</span>
|
333
|
+
</pre>
|
334
|
+
</div>
|
335
|
+
</div>
|
336
|
+
</div>
|
337
|
+
|
338
|
+
<div id="method-M000189" class="method-detail">
|
339
|
+
<a name="M000189"></a>
|
340
|
+
|
341
|
+
<div class="method-heading">
|
342
|
+
<a href="#M000189" class="method-signature">
|
343
|
+
<span class="method-name">direction</span><span class="method-args">()</span>
|
344
|
+
</a>
|
345
|
+
</div>
|
346
|
+
|
347
|
+
<div class="method-description">
|
348
|
+
<p>
|
349
|
+
Returns the direction of the interval indicated by +1, 0 or -1.
|
350
|
+
</p>
|
351
|
+
<pre>
|
352
|
+
(1..5).direction #=> 1
|
353
|
+
(5..1).direction #=> -1
|
354
|
+
(1..1).direction #=> 0
|
355
|
+
</pre>
|
356
|
+
<p><a class="source-toggle" href="#"
|
357
|
+
onclick="toggleCode('M000189-source');return false;">[Source]</a></p>
|
358
|
+
<div class="method-source-code" id="M000189-source">
|
359
|
+
<pre>
|
360
|
+
<span class="ruby-comment cmt"># File lib/carat/interval.rb, line 102</span>
|
361
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">direction</span> ; <span class="ruby-ivar">@direction</span> ; <span class="ruby-keyword kw">end</span>
|
362
|
+
</pre>
|
363
|
+
</div>
|
364
|
+
</div>
|
365
|
+
</div>
|
366
|
+
|
367
|
+
<div id="method-M000201" class="method-detail">
|
368
|
+
<a name="M000201"></a>
|
369
|
+
|
370
|
+
<div class="method-heading">
|
371
|
+
<a href="#M000201" class="method-signature">
|
372
|
+
<span class="method-name">distance</span><span class="method-args">()</span>
|
373
|
+
</a>
|
374
|
+
</div>
|
375
|
+
|
376
|
+
<div class="method-description">
|
377
|
+
<p>
|
378
|
+
Returns the length of the interval as the difference between the first and
|
379
|
+
last elements. Returns <tt>nil</tt> if the sentinal objects do not support
|
380
|
+
distance comparison (<a href="Interval.html#M000201">distance</a>). TODO:
|
381
|
+
Add <tt>n</tt> parameter to count segmentations like those produced by <a
|
382
|
+
href="Interval.html#M000209">each</a>.
|
383
|
+
</p>
|
384
|
+
<p><a class="source-toggle" href="#"
|
385
|
+
onclick="toggleCode('M000201-source');return false;">[Source]</a></p>
|
386
|
+
<div class="method-source-code" id="M000201-source">
|
387
|
+
<pre>
|
388
|
+
<span class="ruby-comment cmt"># File lib/carat/interval.rb, line 141</span>
|
389
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">distance</span>
|
390
|
+
<span class="ruby-ivar">@last</span> <span class="ruby-operator">-</span> <span class="ruby-ivar">@first</span>
|
391
|
+
<span class="ruby-comment cmt">#if @last.respond_to?( :distance )</span>
|
392
|
+
<span class="ruby-comment cmt"># @last.distance( @first )</span>
|
393
|
+
<span class="ruby-comment cmt">#else</span>
|
394
|
+
<span class="ruby-comment cmt"># #self.to_a.length</span>
|
395
|
+
<span class="ruby-comment cmt">#end</span>
|
396
|
+
<span class="ruby-keyword kw">end</span>
|
397
|
+
</pre>
|
398
|
+
</div>
|
399
|
+
</div>
|
400
|
+
</div>
|
401
|
+
|
402
|
+
<div id="method-M000209" class="method-detail">
|
403
|
+
<a name="M000209"></a>
|
404
|
+
|
405
|
+
<div class="method-heading">
|
406
|
+
<a href="#M000209" class="method-signature">
|
407
|
+
<span class="method-name">each</span><span class="method-args">(n=1, d=nil) {|| ...}</span>
|
408
|
+
</a>
|
409
|
+
</div>
|
410
|
+
|
411
|
+
<div class="method-description">
|
412
|
+
<p>
|
413
|
+
Iterates over the interval, passing each _n_th element to the block. If n
|
414
|
+
is not given then n defaults to 1. Each _n_th step is determined by
|
415
|
+
invoking +++ or +\-+ n, depending on the direction of the interval. If n is
|
416
|
+
negative the iteration is preformed in reverse form end sentinal to front
|
417
|
+
sentinal. A second parameter, d, can be given in which case the applied
|
418
|
+
step is calculated as a fraction of the interval’s length times n /
|
419
|
+
d. This allows iteration over the whole interval in equal sized segments.
|
420
|
+
</p>
|
421
|
+
<pre>
|
422
|
+
1..5.each { |e| ... } #=> 1 2 3 4 5
|
423
|
+
1..5.each(2) { |e| ... } #=> 1 3 5
|
424
|
+
1..5.each(1,2) { |e| ... } #=> 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0
|
425
|
+
</pre>
|
426
|
+
<p><a class="source-toggle" href="#"
|
427
|
+
onclick="toggleCode('M000209-source');return false;">[Source]</a></p>
|
428
|
+
<div class="method-source-code" id="M000209-source">
|
429
|
+
<pre>
|
430
|
+
<span class="ruby-comment cmt"># File lib/carat/interval.rb, line 205</span>
|
431
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">each</span>(<span class="ruby-identifier">n</span>=<span class="ruby-value">1</span>, <span class="ruby-identifier">d</span>=<span class="ruby-keyword kw">nil</span>) <span class="ruby-comment cmt"># :yield: </span>
|
432
|
+
<span class="ruby-keyword kw">return</span> (<span class="ruby-identifier">n</span> <span class="ruby-operator"><</span> <span class="ruby-value">0</span> <span class="ruby-operator">?</span> <span class="ruby-ivar">@last</span> <span class="ruby-operator">:</span> <span class="ruby-ivar">@first</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">degenerate?</span> <span class="ruby-comment cmt"># is this right for all values of n ?</span>
|
433
|
+
<span class="ruby-identifier">s</span> = <span class="ruby-identifier">d</span> <span class="ruby-value">? </span><span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">length</span>.<span class="ruby-identifier">to_f</span> <span class="ruby-operator">*</span> (<span class="ruby-identifier">n</span>.<span class="ruby-identifier">to_f</span> <span class="ruby-operator">/</span> <span class="ruby-identifier">d</span>.<span class="ruby-identifier">to_f</span>) <span class="ruby-operator">:</span> <span class="ruby-identifier">n</span>.<span class="ruby-identifier">abs</span>
|
434
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-value str">"Cannot iterate over zero length steps."</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">s</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
|
435
|
+
<span class="ruby-identifier">s</span> = <span class="ruby-identifier">s</span> <span class="ruby-operator">*</span> <span class="ruby-ivar">@direction</span>
|
436
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">n</span> <span class="ruby-operator"><</span> <span class="ruby-value">0</span>
|
437
|
+
<span class="ruby-identifier">e</span> = <span class="ruby-ivar">@exclude_last</span> <span class="ruby-operator">?</span> <span class="ruby-ivar">@last</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">s</span> <span class="ruby-operator">:</span> <span class="ruby-ivar">@last</span>
|
438
|
+
<span class="ruby-comment cmt">#e = @exclude_last ? @last.pred(s) : @last</span>
|
439
|
+
<span class="ruby-identifier">t</span> = <span class="ruby-ivar">@exlude_last</span> <span class="ruby-operator">?</span> <span class="ruby-value">1</span> <span class="ruby-operator">:</span> <span class="ruby-value">0</span>
|
440
|
+
<span class="ruby-comment cmt">#while e.cmp(@first) >= t</span>
|
441
|
+
<span class="ruby-keyword kw">while</span> (<span class="ruby-identifier">e</span> <span class="ruby-operator"><=></span> <span class="ruby-ivar">@first</span>) <span class="ruby-operator">>=</span> <span class="ruby-identifier">t</span>
|
442
|
+
<span class="ruby-keyword kw">yield</span>(<span class="ruby-identifier">e</span>)
|
443
|
+
<span class="ruby-identifier">e</span> <span class="ruby-operator">-=</span> <span class="ruby-identifier">s</span>
|
444
|
+
<span class="ruby-comment cmt">#e = e.pred(s)</span>
|
445
|
+
<span class="ruby-keyword kw">end</span>
|
446
|
+
<span class="ruby-keyword kw">else</span>
|
447
|
+
<span class="ruby-identifier">e</span> = <span class="ruby-ivar">@exclude_first</span> <span class="ruby-operator">?</span> <span class="ruby-ivar">@first</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">s</span> <span class="ruby-operator">:</span> <span class="ruby-ivar">@first</span>
|
448
|
+
<span class="ruby-comment cmt">#e = @exclude_first ? @first.succ(s) : @first</span>
|
449
|
+
<span class="ruby-identifier">t</span> = <span class="ruby-ivar">@exlude_last</span> <span class="ruby-operator">?</span> <span class="ruby-value">-1</span> <span class="ruby-operator">:</span> <span class="ruby-value">0</span>
|
450
|
+
<span class="ruby-comment cmt">#while e.cmp(@last) <= t</span>
|
451
|
+
<span class="ruby-keyword kw">while</span> (<span class="ruby-identifier">e</span> <span class="ruby-operator"><=></span> <span class="ruby-ivar">@last</span>) <span class="ruby-operator"><=</span> <span class="ruby-identifier">t</span>
|
452
|
+
<span class="ruby-keyword kw">yield</span>(<span class="ruby-identifier">e</span>)
|
453
|
+
<span class="ruby-identifier">e</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">s</span>
|
454
|
+
<span class="ruby-comment cmt">#e = e.succ(s)</span>
|
455
|
+
<span class="ruby-keyword kw">end</span>
|
456
|
+
<span class="ruby-keyword kw">end</span>
|
457
|
+
<span class="ruby-keyword kw">end</span>
|
458
|
+
</pre>
|
459
|
+
</div>
|
460
|
+
</div>
|
461
|
+
</div>
|
462
|
+
|
463
|
+
<div id="method-M000184" class="method-detail">
|
464
|
+
<a name="M000184"></a>
|
465
|
+
|
466
|
+
<div class="method-heading">
|
467
|
+
<span class="method-name">end</span><span class="method-args">()</span>
|
468
|
+
</div>
|
469
|
+
|
470
|
+
<div class="method-description">
|
471
|
+
<p>
|
472
|
+
Alias for <a href="Interval.html#M000180">last</a>
|
473
|
+
</p>
|
474
|
+
</div>
|
475
|
+
</div>
|
476
|
+
|
477
|
+
<div id="method-M000211" class="method-detail">
|
478
|
+
<a name="M000211"></a>
|
479
|
+
|
480
|
+
<div class="method-heading">
|
481
|
+
<a href="#M000211" class="method-signature">
|
482
|
+
<span class="method-name">eql?</span><span class="method-args">(other)</span>
|
483
|
+
</a>
|
484
|
+
</div>
|
485
|
+
|
486
|
+
<div class="method-description">
|
487
|
+
<p>
|
488
|
+
Compares two intervals to see if they are equal
|
489
|
+
</p>
|
490
|
+
<p><a class="source-toggle" href="#"
|
491
|
+
onclick="toggleCode('M000211-source');return false;">[Source]</a></p>
|
492
|
+
<div class="method-source-code" id="M000211-source">
|
493
|
+
<pre>
|
494
|
+
<span class="ruby-comment cmt"># File lib/carat/interval.rb, line 240</span>
|
495
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">eql?</span>(<span class="ruby-identifier">other</span>)
|
496
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@first</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">first</span>
|
497
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@last</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">last</span>
|
498
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@exclude_first</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">exclude_first?</span>
|
499
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@exclude_last</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">exclude_last?</span>
|
500
|
+
<span class="ruby-keyword kw">true</span>
|
501
|
+
<span class="ruby-keyword kw">end</span>
|
502
|
+
</pre>
|
503
|
+
</div>
|
504
|
+
</div>
|
505
|
+
</div>
|
506
|
+
|
507
|
+
<div id="method-M000185" class="method-detail">
|
508
|
+
<a name="M000185"></a>
|
509
|
+
|
510
|
+
<div class="method-heading">
|
511
|
+
<span class="method-name">exclude_begin?</span><span class="method-args">()</span>
|
512
|
+
</div>
|
513
|
+
|
514
|
+
<div class="method-description">
|
515
|
+
<p>
|
516
|
+
Alias for <a href="Interval.html#M000181">exclude_first?</a>
|
517
|
+
</p>
|
518
|
+
</div>
|
519
|
+
</div>
|
520
|
+
|
521
|
+
<div id="method-M000186" class="method-detail">
|
522
|
+
<a name="M000186"></a>
|
523
|
+
|
524
|
+
<div class="method-heading">
|
525
|
+
<span class="method-name">exclude_end?</span><span class="method-args">()</span>
|
526
|
+
</div>
|
527
|
+
|
528
|
+
<div class="method-description">
|
529
|
+
<p>
|
530
|
+
Alias for <a href="Interval.html#M000182">exclude_last?</a>
|
531
|
+
</p>
|
532
|
+
</div>
|
533
|
+
</div>
|
534
|
+
|
535
|
+
<div id="method-M000181" class="method-detail">
|
536
|
+
<a name="M000181"></a>
|
537
|
+
|
538
|
+
<div class="method-heading">
|
539
|
+
<a href="#M000181" class="method-signature">
|
540
|
+
<span class="method-name">exclude_first?</span><span class="method-args">()</span>
|
541
|
+
</a>
|
542
|
+
</div>
|
543
|
+
|
544
|
+
<div class="method-description">
|
545
|
+
<p><a class="source-toggle" href="#"
|
546
|
+
onclick="toggleCode('M000181-source');return false;">[Source]</a></p>
|
547
|
+
<div class="method-source-code" id="M000181-source">
|
548
|
+
<pre>
|
549
|
+
<span class="ruby-comment cmt"># File lib/carat/interval.rb, line 81</span>
|
550
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">exclude_first?</span> ; <span class="ruby-ivar">@exclude_first</span> ; <span class="ruby-keyword kw">end</span>
|
551
|
+
</pre>
|
552
|
+
</div>
|
553
|
+
</div>
|
554
|
+
</div>
|
555
|
+
|
556
|
+
<div id="method-M000182" class="method-detail">
|
557
|
+
<a name="M000182"></a>
|
558
|
+
|
559
|
+
<div class="method-heading">
|
560
|
+
<a href="#M000182" class="method-signature">
|
561
|
+
<span class="method-name">exclude_last?</span><span class="method-args">()</span>
|
562
|
+
</a>
|
563
|
+
</div>
|
564
|
+
|
565
|
+
<div class="method-description">
|
566
|
+
<p><a class="source-toggle" href="#"
|
567
|
+
onclick="toggleCode('M000182-source');return false;">[Source]</a></p>
|
568
|
+
<div class="method-source-code" id="M000182-source">
|
569
|
+
<pre>
|
570
|
+
<span class="ruby-comment cmt"># File lib/carat/interval.rb, line 82</span>
|
571
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">exclude_last?</span> ; <span class="ruby-ivar">@exclude_last</span> ; <span class="ruby-keyword kw">end</span>
|
572
|
+
</pre>
|
573
|
+
</div>
|
574
|
+
</div>
|
575
|
+
</div>
|
576
|
+
|
577
|
+
<div id="method-M000179" class="method-detail">
|
578
|
+
<a name="M000179"></a>
|
579
|
+
|
580
|
+
<div class="method-heading">
|
581
|
+
<a href="#M000179" class="method-signature">
|
582
|
+
<span class="method-name">first</span><span class="method-args">()</span>
|
583
|
+
</a>
|
584
|
+
</div>
|
585
|
+
|
586
|
+
<div class="method-description">
|
587
|
+
<p>
|
588
|
+
Returns the first or last sentinal of the interval.
|
589
|
+
</p>
|
590
|
+
<p><a class="source-toggle" href="#"
|
591
|
+
onclick="toggleCode('M000179-source');return false;">[Source]</a></p>
|
592
|
+
<div class="method-source-code" id="M000179-source">
|
593
|
+
<pre>
|
594
|
+
<span class="ruby-comment cmt"># File lib/carat/interval.rb, line 77</span>
|
595
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">first</span> ; <span class="ruby-ivar">@first</span> ; <span class="ruby-keyword kw">end</span>
|
596
|
+
</pre>
|
597
|
+
</div>
|
598
|
+
</div>
|
599
|
+
</div>
|
600
|
+
|
601
|
+
<div id="method-M000193" class="method-detail">
|
602
|
+
<a name="M000193"></a>
|
603
|
+
|
604
|
+
<div class="method-heading">
|
605
|
+
<a href="#M000193" class="method-signature">
|
606
|
+
<span class="method-name">first_closed</span><span class="method-args">()</span>
|
607
|
+
</a>
|
608
|
+
</div>
|
609
|
+
|
610
|
+
<div class="method-description">
|
611
|
+
<p>
|
612
|
+
Returns a new interval with one of the two sentinels opened or closed
|
613
|
+
</p>
|
614
|
+
<p><a class="source-toggle" href="#"
|
615
|
+
onclick="toggleCode('M000193-source');return false;">[Source]</a></p>
|
616
|
+
<div class="method-source-code" id="M000193-source">
|
617
|
+
<pre>
|
618
|
+
<span class="ruby-comment cmt"># File lib/carat/interval.rb, line 118</span>
|
619
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">first_closed</span> ; <span class="ruby-constant">Interval</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@first</span>, <span class="ruby-ivar">@last</span>, <span class="ruby-keyword kw">false</span>, <span class="ruby-keyword kw">true</span>) ; <span class="ruby-keyword kw">end</span>
|
620
|
+
</pre>
|
621
|
+
</div>
|
622
|
+
</div>
|
623
|
+
</div>
|
624
|
+
|
625
|
+
<div id="method-M000195" class="method-detail">
|
626
|
+
<a name="M000195"></a>
|
627
|
+
|
628
|
+
<div class="method-heading">
|
629
|
+
<a href="#M000195" class="method-signature">
|
630
|
+
<span class="method-name">first_opened</span><span class="method-args">()</span>
|
631
|
+
</a>
|
632
|
+
</div>
|
633
|
+
|
634
|
+
<div class="method-description">
|
635
|
+
<p><a class="source-toggle" href="#"
|
636
|
+
onclick="toggleCode('M000195-source');return false;">[Source]</a></p>
|
637
|
+
<div class="method-source-code" id="M000195-source">
|
638
|
+
<pre>
|
639
|
+
<span class="ruby-comment cmt"># File lib/carat/interval.rb, line 120</span>
|
640
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">first_opened</span> ; <span class="ruby-constant">Interval</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@first</span>, <span class="ruby-ivar">@last</span>, <span class="ruby-keyword kw">true</span>, <span class="ruby-keyword kw">false</span>) ; <span class="ruby-keyword kw">end</span>
|
641
|
+
</pre>
|
642
|
+
</div>
|
643
|
+
</div>
|
644
|
+
</div>
|
645
|
+
|
646
|
+
<div id="method-M000192" class="method-detail">
|
647
|
+
<a name="M000192"></a>
|
648
|
+
|
649
|
+
<div class="method-heading">
|
650
|
+
<a href="#M000192" class="method-signature">
|
651
|
+
<span class="method-name">half_closed</span><span class="method-args">(e=false)</span>
|
652
|
+
</a>
|
653
|
+
</div>
|
654
|
+
|
655
|
+
<div class="method-description">
|
656
|
+
<p>
|
657
|
+
Returns a new interval with either the first or the last sentinel
|
658
|
+
exclusive. If the parameter is false, the deafult, then the first sentinel
|
659
|
+
is excluded; if the parameter is true, the last sentinel is excluded.
|
660
|
+
</p>
|
661
|
+
<p><a class="source-toggle" href="#"
|
662
|
+
onclick="toggleCode('M000192-source');return false;">[Source]</a></p>
|
663
|
+
<div class="method-source-code" id="M000192-source">
|
664
|
+
<pre>
|
665
|
+
<span class="ruby-comment cmt"># File lib/carat/interval.rb, line 113</span>
|
666
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">half_closed</span>(<span class="ruby-identifier">e</span>=<span class="ruby-keyword kw">false</span>)
|
667
|
+
<span class="ruby-identifier">e</span> <span class="ruby-value">? </span><span class="ruby-constant">Interval</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@first</span>, <span class="ruby-ivar">@last</span>, <span class="ruby-keyword kw">true</span>, <span class="ruby-keyword kw">false</span>) <span class="ruby-operator">:</span> <span class="ruby-constant">Interval</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@first</span>, <span class="ruby-ivar">@last</span>, <span class="ruby-keyword kw">false</span>, <span class="ruby-keyword kw">true</span>)
|
668
|
+
<span class="ruby-keyword kw">end</span>
|
669
|
+
</pre>
|
670
|
+
</div>
|
671
|
+
</div>
|
672
|
+
</div>
|
673
|
+
|
674
|
+
<div id="method-M000206" class="method-detail">
|
675
|
+
<a name="M000206"></a>
|
676
|
+
|
677
|
+
<div class="method-heading">
|
678
|
+
<a href="#M000206" class="method-signature">
|
679
|
+
<span class="method-name">include?</span><span class="method-args">(x)</span>
|
680
|
+
</a>
|
681
|
+
</div>
|
682
|
+
|
683
|
+
<div class="method-description">
|
684
|
+
<p>
|
685
|
+
Returns true or false if the element is part of the interval.
|
686
|
+
</p>
|
687
|
+
<p><a class="source-toggle" href="#"
|
688
|
+
onclick="toggleCode('M000206-source');return false;">[Source]</a></p>
|
689
|
+
<div class="method-source-code" id="M000206-source">
|
690
|
+
<pre>
|
691
|
+
<span class="ruby-comment cmt"># File lib/carat/interval.rb, line 163</span>
|
692
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">include?</span>(<span class="ruby-identifier">x</span>)
|
693
|
+
<span class="ruby-comment cmt"># todo: infinity? </span>
|
694
|
+
<span class="ruby-identifier">tf</span> = <span class="ruby-identifier">exclude_first?</span> <span class="ruby-value">? </span><span class="ruby-value">1</span> <span class="ruby-operator">:</span> <span class="ruby-value">0</span>
|
695
|
+
<span class="ruby-identifier">tl</span> = <span class="ruby-identifier">exclude_last?</span> <span class="ruby-value">? </span><span class="ruby-operator">-</span><span class="ruby-value">1</span> <span class="ruby-operator">:</span> <span class="ruby-value">0</span>
|
696
|
+
(<span class="ruby-identifier">x</span> <span class="ruby-operator"><=></span> <span class="ruby-identifier">first</span>) <span class="ruby-operator">>=</span> <span class="ruby-identifier">tf</span> <span class="ruby-keyword kw">and</span> (<span class="ruby-identifier">x</span> <span class="ruby-operator"><=></span> <span class="ruby-identifier">last</span>) <span class="ruby-operator"><=</span> <span class="ruby-identifier">tl</span>
|
697
|
+
<span class="ruby-keyword kw">end</span>
|
698
|
+
</pre>
|
699
|
+
</div>
|
700
|
+
</div>
|
701
|
+
</div>
|
702
|
+
|
703
|
+
<div id="method-M000180" class="method-detail">
|
704
|
+
<a name="M000180"></a>
|
705
|
+
|
706
|
+
<div class="method-heading">
|
707
|
+
<a href="#M000180" class="method-signature">
|
708
|
+
<span class="method-name">last</span><span class="method-args">()</span>
|
709
|
+
</a>
|
710
|
+
</div>
|
711
|
+
|
712
|
+
<div class="method-description">
|
713
|
+
<p><a class="source-toggle" href="#"
|
714
|
+
onclick="toggleCode('M000180-source');return false;">[Source]</a></p>
|
715
|
+
<div class="method-source-code" id="M000180-source">
|
716
|
+
<pre>
|
717
|
+
<span class="ruby-comment cmt"># File lib/carat/interval.rb, line 78</span>
|
718
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">last</span> ; <span class="ruby-ivar">@last</span> ; <span class="ruby-keyword kw">end</span>
|
719
|
+
</pre>
|
720
|
+
</div>
|
721
|
+
</div>
|
722
|
+
</div>
|
723
|
+
|
724
|
+
<div id="method-M000194" class="method-detail">
|
725
|
+
<a name="M000194"></a>
|
726
|
+
|
727
|
+
<div class="method-heading">
|
728
|
+
<a href="#M000194" class="method-signature">
|
729
|
+
<span class="method-name">last_closed</span><span class="method-args">()</span>
|
730
|
+
</a>
|
731
|
+
</div>
|
732
|
+
|
733
|
+
<div class="method-description">
|
734
|
+
<p><a class="source-toggle" href="#"
|
735
|
+
onclick="toggleCode('M000194-source');return false;">[Source]</a></p>
|
736
|
+
<div class="method-source-code" id="M000194-source">
|
737
|
+
<pre>
|
738
|
+
<span class="ruby-comment cmt"># File lib/carat/interval.rb, line 119</span>
|
739
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">last_closed</span> ; <span class="ruby-constant">Interval</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@first</span>, <span class="ruby-ivar">@last</span>, <span class="ruby-keyword kw">true</span>, <span class="ruby-keyword kw">false</span>) ; <span class="ruby-keyword kw">end</span>
|
740
|
+
</pre>
|
741
|
+
</div>
|
742
|
+
</div>
|
743
|
+
</div>
|
744
|
+
|
745
|
+
<div id="method-M000196" class="method-detail">
|
746
|
+
<a name="M000196"></a>
|
747
|
+
|
748
|
+
<div class="method-heading">
|
749
|
+
<a href="#M000196" class="method-signature">
|
750
|
+
<span class="method-name">last_opened</span><span class="method-args">()</span>
|
751
|
+
</a>
|
752
|
+
</div>
|
753
|
+
|
754
|
+
<div class="method-description">
|
755
|
+
<p><a class="source-toggle" href="#"
|
756
|
+
onclick="toggleCode('M000196-source');return false;">[Source]</a></p>
|
757
|
+
<div class="method-source-code" id="M000196-source">
|
758
|
+
<pre>
|
759
|
+
<span class="ruby-comment cmt"># File lib/carat/interval.rb, line 121</span>
|
760
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">last_opened</span> ; <span class="ruby-constant">Interval</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@first</span>, <span class="ruby-ivar">@last</span>, <span class="ruby-keyword kw">false</span>, <span class="ruby-keyword kw">true</span>) ; <span class="ruby-keyword kw">end</span>
|
761
|
+
</pre>
|
762
|
+
</div>
|
763
|
+
</div>
|
764
|
+
</div>
|
765
|
+
|
766
|
+
<div id="method-M000202" class="method-detail">
|
767
|
+
<a name="M000202"></a>
|
768
|
+
|
769
|
+
<div class="method-heading">
|
770
|
+
<span class="method-name">length</span><span class="method-args">()</span>
|
771
|
+
</div>
|
772
|
+
|
773
|
+
<div class="method-description">
|
774
|
+
<p>
|
775
|
+
Alias for <a href="Interval.html#M000201">distance</a>
|
776
|
+
</p>
|
777
|
+
</div>
|
778
|
+
</div>
|
779
|
+
|
780
|
+
<div id="method-M000205" class="method-detail">
|
781
|
+
<a name="M000205"></a>
|
782
|
+
|
783
|
+
<div class="method-heading">
|
784
|
+
<a href="#M000205" class="method-signature">
|
785
|
+
<span class="method-name">max</span><span class="method-args">()</span>
|
786
|
+
</a>
|
787
|
+
</div>
|
788
|
+
|
789
|
+
<div class="method-description">
|
790
|
+
<p>
|
791
|
+
Returns the greater of the first and last sentinals.
|
792
|
+
</p>
|
793
|
+
<p><a class="source-toggle" href="#"
|
794
|
+
onclick="toggleCode('M000205-source');return false;">[Source]</a></p>
|
795
|
+
<div class="method-source-code" id="M000205-source">
|
796
|
+
<pre>
|
797
|
+
<span class="ruby-comment cmt"># File lib/carat/interval.rb, line 158</span>
|
798
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">max</span>
|
799
|
+
((<span class="ruby-ivar">@first</span> <span class="ruby-operator"><=></span> <span class="ruby-ivar">@last</span>) <span class="ruby-operator">==</span> <span class="ruby-value">1</span>) <span class="ruby-operator">?</span> <span class="ruby-ivar">@first</span> <span class="ruby-operator">:</span> <span class="ruby-ivar">@last</span>
|
800
|
+
<span class="ruby-keyword kw">end</span>
|
801
|
+
</pre>
|
802
|
+
</div>
|
803
|
+
</div>
|
804
|
+
</div>
|
805
|
+
|
806
|
+
<div id="method-M000208" class="method-detail">
|
807
|
+
<a name="M000208"></a>
|
808
|
+
|
809
|
+
<div class="method-heading">
|
810
|
+
<span class="method-name">member?</span><span class="method-args">(x)</span>
|
811
|
+
</div>
|
812
|
+
|
813
|
+
<div class="method-description">
|
814
|
+
<p>
|
815
|
+
Alias for <a href="Interval.html#M000206">include?</a>
|
816
|
+
</p>
|
817
|
+
</div>
|
818
|
+
</div>
|
819
|
+
|
820
|
+
<div id="method-M000204" class="method-detail">
|
821
|
+
<a name="M000204"></a>
|
822
|
+
|
823
|
+
<div class="method-heading">
|
824
|
+
<a href="#M000204" class="method-signature">
|
825
|
+
<span class="method-name">min</span><span class="method-args">()</span>
|
826
|
+
</a>
|
827
|
+
</div>
|
828
|
+
|
829
|
+
<div class="method-description">
|
830
|
+
<p>
|
831
|
+
Returns the lesser of the first and last sentinals.
|
832
|
+
</p>
|
833
|
+
<p><a class="source-toggle" href="#"
|
834
|
+
onclick="toggleCode('M000204-source');return false;">[Source]</a></p>
|
835
|
+
<div class="method-source-code" id="M000204-source">
|
836
|
+
<pre>
|
837
|
+
<span class="ruby-comment cmt"># File lib/carat/interval.rb, line 153</span>
|
838
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">min</span>
|
839
|
+
((<span class="ruby-ivar">@first</span> <span class="ruby-operator"><=></span> <span class="ruby-ivar">@last</span>) <span class="ruby-operator">==</span> <span class="ruby-value">-1</span>) <span class="ruby-operator">?</span> <span class="ruby-ivar">@first</span> <span class="ruby-operator">:</span> <span class="ruby-ivar">@last</span>
|
840
|
+
<span class="ruby-keyword kw">end</span>
|
841
|
+
</pre>
|
842
|
+
</div>
|
843
|
+
</div>
|
844
|
+
</div>
|
845
|
+
|
846
|
+
<div id="method-M000188" class="method-detail">
|
847
|
+
<a name="M000188"></a>
|
848
|
+
|
849
|
+
<div class="method-heading">
|
850
|
+
<a href="#M000188" class="method-signature">
|
851
|
+
<span class="method-name">null?</span><span class="method-args">()</span>
|
852
|
+
</a>
|
853
|
+
</div>
|
854
|
+
|
855
|
+
<div class="method-description">
|
856
|
+
<p>
|
857
|
+
Returns <tt>true</tt> if the start and end sentinels are equal and the
|
858
|
+
interval is open; otherwise <tt>false</tt>.
|
859
|
+
</p>
|
860
|
+
<p><a class="source-toggle" href="#"
|
861
|
+
onclick="toggleCode('M000188-source');return false;">[Source]</a></p>
|
862
|
+
<div class="method-source-code" id="M000188-source">
|
863
|
+
<pre>
|
864
|
+
<span class="ruby-comment cmt"># File lib/carat/interval.rb, line 94</span>
|
865
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">null?</span> ; <span class="ruby-ivar">@direction</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span> <span class="ruby-keyword kw">and</span> <span class="ruby-ivar">@exclusive_first</span> <span class="ruby-keyword kw">and</span> <span class="ruby-ivar">@exclusive_last</span> ; <span class="ruby-keyword kw">end</span>
|
866
|
+
</pre>
|
867
|
+
</div>
|
868
|
+
</div>
|
869
|
+
</div>
|
870
|
+
|
871
|
+
<div id="method-M000191" class="method-detail">
|
872
|
+
<a name="M000191"></a>
|
873
|
+
|
874
|
+
<div class="method-heading">
|
875
|
+
<a href="#M000191" class="method-signature">
|
876
|
+
<span class="method-name">opened</span><span class="method-args">()</span>
|
877
|
+
</a>
|
878
|
+
</div>
|
879
|
+
|
880
|
+
<div class="method-description">
|
881
|
+
<p>
|
882
|
+
Returns a new interval exclusive of both sentinels.
|
883
|
+
</p>
|
884
|
+
<p><a class="source-toggle" href="#"
|
885
|
+
onclick="toggleCode('M000191-source');return false;">[Source]</a></p>
|
886
|
+
<div class="method-source-code" id="M000191-source">
|
887
|
+
<pre>
|
888
|
+
<span class="ruby-comment cmt"># File lib/carat/interval.rb, line 108</span>
|
889
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">opened</span>; <span class="ruby-constant">Interval</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@first</span>, <span class="ruby-ivar">@last</span>, <span class="ruby-keyword kw">true</span>, <span class="ruby-keyword kw">true</span>) ; <span class="ruby-keyword kw">end</span>
|
890
|
+
</pre>
|
891
|
+
</div>
|
892
|
+
</div>
|
893
|
+
</div>
|
894
|
+
|
895
|
+
<div id="method-M000200" class="method-detail">
|
896
|
+
<a name="M000200"></a>
|
897
|
+
|
898
|
+
<div class="method-heading">
|
899
|
+
<a href="#M000200" class="method-signature">
|
900
|
+
<span class="method-name">reversed</span><span class="method-args">()</span>
|
901
|
+
</a>
|
902
|
+
</div>
|
903
|
+
|
904
|
+
<div class="method-description">
|
905
|
+
<p>
|
906
|
+
Returns a new interval with the sentinels reversed.
|
907
|
+
</p>
|
908
|
+
<pre>
|
909
|
+
(0..10).reversed #=> 10..0
|
910
|
+
</pre>
|
911
|
+
<p><a class="source-toggle" href="#"
|
912
|
+
onclick="toggleCode('M000200-source');return false;">[Source]</a></p>
|
913
|
+
<div class="method-source-code" id="M000200-source">
|
914
|
+
<pre>
|
915
|
+
<span class="ruby-comment cmt"># File lib/carat/interval.rb, line 133</span>
|
916
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">reversed</span>
|
917
|
+
<span class="ruby-constant">Interval</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@last</span>, <span class="ruby-ivar">@first</span>, <span class="ruby-keyword kw">true</span>, <span class="ruby-keyword kw">true</span>)
|
918
|
+
<span class="ruby-keyword kw">end</span>
|
919
|
+
</pre>
|
920
|
+
</div>
|
921
|
+
</div>
|
922
|
+
</div>
|
923
|
+
|
924
|
+
<div id="method-M000178" class="method-detail">
|
925
|
+
<a name="M000178"></a>
|
926
|
+
|
927
|
+
<div class="method-heading">
|
928
|
+
<a href="#M000178" class="method-signature">
|
929
|
+
<span class="method-name">sentinels</span><span class="method-args">()</span>
|
930
|
+
</a>
|
931
|
+
</div>
|
932
|
+
|
933
|
+
<div class="method-description">
|
934
|
+
<p>
|
935
|
+
Returns a two element array of first and last sentinels.
|
936
|
+
</p>
|
937
|
+
<pre>
|
938
|
+
(0..10).sentinels #=> [0,10]
|
939
|
+
</pre>
|
940
|
+
<p><a class="source-toggle" href="#"
|
941
|
+
onclick="toggleCode('M000178-source');return false;">[Source]</a></p>
|
942
|
+
<div class="method-source-code" id="M000178-source">
|
943
|
+
<pre>
|
944
|
+
<span class="ruby-comment cmt"># File lib/carat/interval.rb, line 72</span>
|
945
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">sentinels</span>
|
946
|
+
<span class="ruby-keyword kw">return</span> [<span class="ruby-ivar">@first</span>, <span class="ruby-ivar">@last</span>]
|
947
|
+
<span class="ruby-keyword kw">end</span>
|
948
|
+
</pre>
|
949
|
+
</div>
|
950
|
+
</div>
|
951
|
+
</div>
|
952
|
+
|
953
|
+
<div id="method-M000203" class="method-detail">
|
954
|
+
<a name="M000203"></a>
|
955
|
+
|
956
|
+
<div class="method-heading">
|
957
|
+
<span class="method-name">size</span><span class="method-args">()</span>
|
958
|
+
</div>
|
959
|
+
|
960
|
+
<div class="method-description">
|
961
|
+
<p>
|
962
|
+
Alias for <a href="Interval.html#M000201">distance</a>
|
963
|
+
</p>
|
964
|
+
</div>
|
965
|
+
</div>
|
966
|
+
|
967
|
+
<div id="method-M000210" class="method-detail">
|
968
|
+
<a name="M000210"></a>
|
969
|
+
|
970
|
+
<div class="method-heading">
|
971
|
+
<span class="method-name">step</span><span class="method-args">(n=1, d=nil)</span>
|
972
|
+
</div>
|
973
|
+
|
974
|
+
<div class="method-description">
|
975
|
+
<p>
|
976
|
+
Alias for <a href="Interval.html#M000209">each</a>
|
977
|
+
</p>
|
978
|
+
</div>
|
979
|
+
</div>
|
980
|
+
|
981
|
+
<div id="method-M000199" class="method-detail">
|
982
|
+
<a name="M000199"></a>
|
983
|
+
|
984
|
+
<div class="method-heading">
|
985
|
+
<a href="#M000199" class="method-signature">
|
986
|
+
<span class="method-name">~</span><span class="method-args">()</span>
|
987
|
+
</a>
|
988
|
+
</div>
|
989
|
+
|
990
|
+
<div class="method-description">
|
991
|
+
<p><a class="source-toggle" href="#"
|
992
|
+
onclick="toggleCode('M000199-source');return false;">[Source]</a></p>
|
993
|
+
<div class="method-source-code" id="M000199-source">
|
994
|
+
<pre>
|
995
|
+
<span class="ruby-comment cmt"># File lib/carat/interval.rb, line 127</span>
|
996
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-operator">~@</span> ; <span class="ruby-constant">Interval</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">first</span>, <span class="ruby-identifier">last</span>, <span class="ruby-keyword kw">true</span>, <span class="ruby-keyword kw">true</span>) ; <span class="ruby-keyword kw">end</span>
|
997
|
+
</pre>
|
998
|
+
</div>
|
999
|
+
</div>
|
1000
|
+
</div>
|
1001
|
+
|
1002
|
+
|
1003
|
+
</div>
|
1004
|
+
|
1005
|
+
|
1006
|
+
</div>
|
1007
|
+
|
1008
|
+
|
1009
|
+
<div id="validator-badges">
|
1010
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
1011
|
+
</div>
|
1012
|
+
|
1013
|
+
</body>
|
1014
|
+
</html>
|