Class: Squash::Java::Argument

Inherits:
Object
  • Object
show all
Defined in:
lib/squash/java/namespace.rb

Overview

A Method argument. Includes the argument Type and whether it is a scalar or an array.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type, dimensionality = 0) ⇒ Argument

Returns a new instance of Argument.



532
533
534
535
# File 'lib/squash/java/namespace.rb', line 532

def initialize(type, dimensionality=0)
  @type           = type
  @dimensionality = dimensionality
end

Instance Attribute Details

#dimensionalityFixnum (readonly)

Returns The number of dimensions for vector values. A type of ‘int[]` has a dimensionality of 2. Scalars have a dimensionality of 0.

Returns:

  • (Fixnum)

    The number of dimensions for vector values. A type of ‘int[]` has a dimensionality of 2. Scalars have a dimensionality of 0.



529
530
531
# File 'lib/squash/java/namespace.rb', line 529

def dimensionality
  @dimensionality
end

#typeSquash::Java::Type (readonly)

Returns The argument type.

Returns:



525
526
527
# File 'lib/squash/java/namespace.rb', line 525

def type
  @type
end

Instance Method Details

#==(other) ⇒ Object



538
539
540
541
542
# File 'lib/squash/java/namespace.rb', line 538

def ==(other)
  other.kind_of?(Squash::Java::Argument) &&
      type == other.type &&
      dimensionality == other.dimensionality
end

#inspectObject



548
# File 'lib/squash/java/namespace.rb', line 548

def inspect() "#<#{self.class} #{to_s}>" end

#to_sString

Returns The type’s full name, with “[]” appended for arrays.

Returns:

  • (String)

    The type’s full name, with “[]” appended for arrays.



545
# File 'lib/squash/java/namespace.rb', line 545

def to_s() "#{type.full_name}#{'[]'*dimensionality}" end