$53 GRAYBYTE WORDPRESS FILE MANAGER $66

SERVER : premium201.web-hosting.com #1 SMP Wed Mar 26 12:08:09 UTC 2025
SERVER IP : 172.67.217.254 | ADMIN IP 216.73.216.36
OPTIONS : CRL = ON | WGT = ON | SDO = OFF | PKEX = OFF
DEACTIVATED : NONE

/opt/alt/ruby25/lib64/ruby/gems/2.5.0/gems/rake-12.3.3/lib/rake/

HOME
Current File : /opt/alt/ruby25/lib64/ruby/gems/2.5.0/gems/rake-12.3.3/lib/rake//linked_list.rb
# frozen_string_literal: true
module Rake

  # Polylithic linked list structure used to implement several data
  # structures in Rake.
  class LinkedList
    include Enumerable
    attr_reader :head, :tail

    # Polymorphically add a new element to the head of a list. The
    # type of head node will be the same list type as the tail.
    def conj(item)
      self.class.cons(item, self)
    end

    # Is the list empty?
    # .make guards against a list being empty making any instantiated LinkedList
    # object not empty by default
    # You should consider overriding this method if you implement your own .make method
    def empty?
      false
    end

    # Lists are structurally equivalent.
    def ==(other)
      current = self
      while !current.empty? && !other.empty?
        return false if current.head != other.head
        current = current.tail
        other = other.tail
      end
      current.empty? && other.empty?
    end

    # Convert to string: LL(item, item...)
    def to_s
      items = map(&:to_s).join(", ")
      "LL(#{items})"
    end

    # Same as +to_s+, but with inspected items.
    def inspect
      items = map(&:inspect).join(", ")
      "LL(#{items})"
    end

    # For each item in the list.
    def each
      current = self
      while !current.empty?
        yield(current.head)
        current = current.tail
      end
      self
    end

    # Make a list out of the given arguments. This method is
    # polymorphic
    def self.make(*args)
      # return an EmptyLinkedList if there are no arguments
      return empty if !args || args.empty?

      # build a LinkedList by starting at the tail and iterating
      # through each argument
      # inject takes an EmptyLinkedList to start
      args.reverse.inject(empty) do |list, item|
        list = cons(item, list)
        list # return the newly created list for each item in the block
      end
    end

    # Cons a new head onto the tail list.
    def self.cons(head, tail)
      new(head, tail)
    end

    # The standard empty list class for the given LinkedList class.
    def self.empty
      self::EMPTY
    end

    protected

    def initialize(head, tail=EMPTY)
      @head = head
      @tail = tail
    end

    # Represent an empty list, using the Null Object Pattern.
    #
    # When inheriting from the LinkedList class, you should implement
    # a type specific Empty class as well. Make sure you set the class
    # instance variable @parent to the associated list class (this
    # allows conj, cons and make to work polymorphically).
    class EmptyLinkedList < LinkedList
      @parent = LinkedList

      def initialize
      end

      def empty?
        true
      end

      def self.cons(head, tail)
        @parent.cons(head, tail)
      end
    end

    EMPTY = EmptyLinkedList.new
  end
end


Current_dir [ NOT WRITEABLE ] Document_root [ NOT WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
1 Jan 1970 12.00 AM
root / root
0
ext
--
3 Mar 2024 10.50 PM
root / root
0755
loaders
--
3 Mar 2024 10.50 PM
root / root
0755
application.rb
24.526 KB
5 Apr 2021 11.46 AM
root / linksafe
0644
backtrace.rb
0.875 KB
5 Apr 2021 11.46 AM
root / linksafe
0644
clean.rb
2.027 KB
5 Apr 2021 11.46 AM
root / linksafe
0644
cloneable.rb
0.438 KB
5 Apr 2021 11.46 AM
root / linksafe
0644
cpu_counter.rb
2.325 KB
5 Apr 2021 11.46 AM
root / linksafe
0644
default_loader.rb
0.259 KB
5 Apr 2021 11.46 AM
root / linksafe
0644
dsl_definition.rb
5.481 KB
5 Apr 2021 11.46 AM
root / linksafe
0644
early_time.rb
0.361 KB
5 Apr 2021 11.46 AM
root / linksafe
0644
file_creation_task.rb
0.683 KB
5 Apr 2021 11.46 AM
root / linksafe
0644
file_list.rb
12.453 KB
5 Apr 2021 11.46 AM
root / linksafe
0644
file_task.rb
1.499 KB
5 Apr 2021 11.46 AM
root / linksafe
0644
file_utils.rb
3.798 KB
5 Apr 2021 11.46 AM
root / linksafe
0644
file_utils_ext.rb
4.081 KB
5 Apr 2021 11.46 AM
root / linksafe
0644
invocation_chain.rb
1.186 KB
5 Apr 2021 11.46 AM
root / linksafe
0644
invocation_exception_mixin.rb
0.45 KB
5 Apr 2021 11.46 AM
root / linksafe
0644
late_time.rb
0.288 KB
5 Apr 2021 11.46 AM
root / linksafe
0644
linked_list.rb
2.77 KB
5 Apr 2021 11.46 AM
root / linksafe
0644
multi_task.rb
0.337 KB
5 Apr 2021 11.46 AM
root / linksafe
0644
name_space.rb
0.686 KB
5 Apr 2021 11.46 AM
root / linksafe
0644
packagetask.rb
5.517 KB
5 Apr 2021 11.46 AM
root / linksafe
0644
phony.rb
0.372 KB
5 Apr 2021 11.46 AM
root / linksafe
0644
private_reader.rb
0.385 KB
5 Apr 2021 11.46 AM
root / linksafe
0644
promise.rb
2.28 KB
5 Apr 2021 11.46 AM
root / linksafe
0644
pseudo_status.rb
0.396 KB
5 Apr 2021 11.46 AM
root / linksafe
0644
rake_module.rb
1.492 KB
5 Apr 2021 11.46 AM
root / linksafe
0644
rake_test_loader.rb
0.493 KB
5 Apr 2021 11.46 AM
root / linksafe
0644
rule_recursion_overflow_error.rb
0.373 KB
5 Apr 2021 11.46 AM
root / linksafe
0644
scope.rb
0.877 KB
5 Apr 2021 11.46 AM
root / linksafe
0644
task.rb
12.083 KB
5 Apr 2021 11.46 AM
root / linksafe
0644
task_argument_error.rb
0.146 KB
5 Apr 2021 11.46 AM
root / linksafe
0644
task_arguments.rb
2.41 KB
5 Apr 2021 11.46 AM
root / linksafe
0644
task_manager.rb
9.659 KB
5 Apr 2021 11.46 AM
root / linksafe
0644
tasklib.rb
0.161 KB
5 Apr 2021 11.46 AM
root / linksafe
0644
testtask.rb
5.998 KB
5 Apr 2021 11.46 AM
root / linksafe
0644
thread_history_display.rb
1.129 KB
5 Apr 2021 11.46 AM
root / linksafe
0644
thread_pool.rb
4.671 KB
5 Apr 2021 11.46 AM
root / linksafe
0644
trace_output.rb
0.562 KB
5 Apr 2021 11.46 AM
root / linksafe
0644
version.rb
0.203 KB
5 Apr 2021 11.46 AM
root / linksafe
0644
win32.rb
1.516 KB
5 Apr 2021 11.46 AM
root / linksafe
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2025 CONTACT ME
Static GIF