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

org.jrubyparser.ast.NamedNode Maven / Gradle / Ivy

Go to download

A library to expose exact char-for-char position information of Ruby syntax.

There is a newer version: 0.5.3
Show newest version
package org.jrubyparser.ast;

import org.jrubyparser.SourcePosition;

/**
 * Nodes with string names are very common.
 */
public abstract class NamedNode extends Node implements INameNode {
    private String name;

    public NamedNode(SourcePosition position, String name) {
        super(position);
        
        assert name != null : "Name node with no null name";
        
        this.name = name;
    }
    
    /**
     * Gets the name.
     * @return Returns a String
     */    
    public String getName() {
        return name;
    }

    /**
     * Sets the name (for refactoring support)
     * @param name is the new name
     */
    public void setName(String name) {
        this.name = name;
    }
    
    /**
     * Does the supplied name match this one?
     * @param name
     */
    public boolean isNameMatch(String testName) {
        return name.equals(testName);
    }    
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy