substringfingerprintconfig.java

来自「dump3 morpheus 0.2.9 src」· Java 代码 · 共 120 行

JAVA
120
字号
/**
 * DuMP3 version morpheus_0.2.9 - a duplicate/similar file finder in Java<BR>
 * Copyright 2005 Alexander Gr&auml;sser<BR>
 * All Rights Reserved, http://dump3.sourceforge.net/<BR>
 * <BR>
 * This file is part of DuMP3.<BR>
 * <BR>
 * DuMP3 is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software
 * Foundation; either version 2 of the License, or (at your option) any later version.<BR>
 * <BR>
 * DuMP3 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 General Public License for more details.<BR>
 * <BR>
 * You should have received a copy of the GNU General Public License along with DuMP3; if not, write to the Free Software Foundation, Inc., 51 Franklin St,
 * Fifth Floor, Boston, MA 02110-1301 USA
 */
package net.za.grasser.duplicate.fingerprint.configure;

import java.beans.PropertyVetoException;
import net.za.grasser.duplicate.Configure;
import net.za.grasser.duplicate.fingerprint.SubstringFingerprint;
import org.apache.log4j.Logger;

/**
 * @author Alexander
 */
public class SubstringFingerprintConfig extends FingerprintConfig {
  /**
   * <code>serialVersionUID</code> SubstringFingerprintConfig.java -
   */
  private static final long serialVersionUID = -1144273283363496369L;
  /**
   * <code>log</code> SubstringFingerprintConfig -
   */
  private static final Logger log = Logger.getLogger(SubstringFingerprintConfig.class);
  /**
   * <code>fc</code> SubstringFingerprintConfig -
   */
  private static FingerprintConfig fc = null;
  /**
   * <code>FINGER_LENGTH</code> SubstringFingerprintConfig - number of rarest substrings
   */
  protected int fingerLength = 20;

  /**
   * This class ...
   * 
   * @author <a href="http://sourceforge.net/sendmessage.php?touser=733840">pyropunk at sourceforge dot net</a>
   * @version $Revision: 1.6 $
   */
  static class Factory extends ConfigFactory {
    /**
     * @see net.za.grasser.duplicate.fingerprint.configure.ConfigFactory#create()
     */
    @Override
    protected FingerprintConfig create() {
      return SubstringFingerprintConfig.getInstance();
    }
  }

  static {
    ConfigFactory.addFactory(SubstringFingerprintConfig.class.getSimpleName(), new Factory());
  }

  /**
   * 
   */
  private SubstringFingerprintConfig() {
    super();
    Configure.load();
    // configure
    setFingerLength(Configure.getIntProperty("fingerprint length", fingerLength, SubstringFingerprint.class.getName()));
    try {
      setSimilarityThreshhold((float)Configure.getDoubleProperty("similarity threshhold", 80.0, SubstringFingerprint.class.getName()));
    } catch (final PropertyVetoException e) {
      log.warn("Could not set similarity threshhold.", e);
    }
  }

  /**
   * @return FingerprintConfig
   */
  public final static FingerprintConfig getInstance() {
    if (fc == null) {
      fc = new SubstringFingerprintConfig();
    }
    return fc;
  }

  /**
   * @return String
   */
  public final int getFingerLength() {
    return fingerLength;
  }

  /**
   * @param pLength
   */
  public void setFingerLength(final int pLength) {
    fingerLength = pLength;
  }

  /**
   * @see net.za.grasser.duplicate.fingerprint.configure.FingerprintConfig#getFingerprintDescription()
   */
  @Override
  public String getFingerprintDescription() {
    return "An modified version of the Sif fingerprint, where only certain substrings are examined.";
  }

  /**
   * @see net.za.grasser.duplicate.fingerprint.configure.FingerprintConfig#getFingerprintName()
   */
  @Override
  public String getFingerprintName() {
    return "Substring Fingerprint";
  }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?