package org.smoothbuild.lang.function.base;

import org.smoothbuild.lang.type.Type;

import com.google.common.collect.ImmutableList;

/**
 * Function's signature.
 */
public class Signature extends TypedName {
  private final ImmutableList<Parameter> parameters;

  public Signature(Type type, Name name, Iterable<Parameter> params) {
    super(type, name);
    this.parameters = ImmutableList.copyOf(params);
  }

  public ImmutableList<Parameter> parameters() {
    return parameters;
  }

  @Override
  public String toString() {
    StringBuilder builder = new StringBuilder();
    builder.append(super.toString() + "(");
    int count = 0;
    for (Parameter parameter : parameters) {
      if (count != 0) {
        builder.append(", ");
      }
      count++;
      builder.append(parameter.type().name());
      builder.append(" ");
      builder.append(parameter.name());
    }

    builder.append(")");
    return builder.toString();
  }
}

@@ -34,24 +34,117 @@
 tion.base;%0A%0A
+import static com.google.common.base.Preconditions.checkNotNull;%0A%0Aimport java.util.Objects;%0A%0A
 import org.s
@@ -280,27 +280,63 @@
 ure 
-extends TypedName %7B
+%7B%0A  private final Type type;%0A  private final Name name;
 %0A  p
@@ -465,20 +465,69 @@
     
-super(type, 
+this.type = checkNotNull(type);%0A    this.name = checkNotNull(
 name
@@ -599,69 +599,475 @@
 lic 
-ImmutableList%3CParameter%3E parameters() %7B%0A    return parameters
+Type type() %7B%0A    return type;%0A  %7D%0A%0A  public Name name() %7B%0A    return name;%0A  %7D%0A%0A  public ImmutableList%3CParameter%3E parameters() %7B%0A    return parameters;%0A  %7D%0A%0A  @Override%0A  public boolean equals(Object object) %7B%0A    if (!(object instanceof Signature)) %7B%0A      return false;%0A    %7D%0A    Signature that = (Signature) object;%0A    return type.equals(that.type)%0A        && name.equals(that.name);%0A  %7D%0A%0A  @Override%0A  public int hashCode() %7B%0A    return Objects.hash(type, name)
 ;%0A  
@@ -1182,13 +1182,36 @@
 end(
-super
+type.toString() + %22 %22 + name
 .toS

refactor Signature to not extend TypedName