All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.vladsch.flexmark.util.visitor.AstHandler Maven / Gradle / Ivy

The newest version!
package com.vladsch.flexmark.util.visitor;

import org.jetbrains.annotations.NotNull;

/**
 * Base class for tracking generic node to specific node handler
 *
 * @param  node subclass
 * @param  node action
 */
public abstract class AstHandler> {
  private final @NotNull Class aClass;
  private final @NotNull A adapter;

  public AstHandler(@NotNull Class klass, @NotNull A adapter) {
    aClass = klass;
    this.adapter = adapter;
  }

  public @NotNull Class getNodeType() {
    return aClass;
  }

  public @NotNull A getAdapter() {
    return adapter;
  }

  @Override
  public boolean equals(Object object) {
    if (this == object) {
      return true;
    }
    if (object == null || getClass() != object.getClass()) {
      return false;
    }

    AstHandler other = (AstHandler) object;

    if (aClass != other.aClass) {
      return false;
    }
    return adapter == other.adapter;
  }

  @Override
  public int hashCode() {
    int result = aClass.hashCode();
    result = 31 * result + adapter.hashCode();
    return result;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy