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

src.it.unimi.dsi.lama4j.NamedElement Maven / Gradle / Ivy

Go to download

LaMa4J ("Lattice Manipulation for Java") is a set of Java classes that implement a number of lattices and lattice operations.

The newest version!
package it.unimi.dsi.lama4j;

/*		 
 * LaMa4J: Lattice Manipulation for Java
 *
 * Copyright (C) 2006-2016 Marco Rosa and Sebastiano Vigna 
 *
 *  This library is free software; you can redistribute it and/or modify it
 *  under the terms of the GNU Lesser General Public License as published by the Free
 *  Software Foundation; either version 2.1 of the License, or (at your option)
 *  any later version.
 *
 *  This library is distributed in the hope that it will be useful, but
 *  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 *  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
 *  for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 *
 */


/**
 * An extension of {@link AbstractElement} the associates a name with the element. Instances of this
 * class are used by many lattices to build their elements.
 * 
 * 

Equality is defined by equality of the * {@linkplain Element#lattice() containing lattice} and of the {@link #name}. */ public class NamedElement extends AbstractElement { /** The name of this element. */ public final String name; /** * Create a new abstract element, initialising its * {@linkplain Element#lattice() containing lattice} and its {@link #name}. * * @param lattice the containing lattice of this abstract element. * @param name a name for this element. */ public NamedElement( final Lattice lattice, final String name ) { super( lattice ); this.name = name; } public String toString() { return name; } public boolean equals( final Object o ) { if ( o instanceof NamedElement ) { NamedElement element = (NamedElement)o; return element.lattice == lattice && element.name.equals( name ); } else return false; } public int hashCode() { return lattice.hashCode() ^ name.hashCode(); } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy