读书人

java新建种要重写的4个方法

发布时间: 2012-10-09 10:21:45 作者: rapoo

java新建类,要重写的4个方法

//******************************************************
//
// G2Bシステム
// クラス名称:G2B2Lgc8310
// クラスの概要:G2B2Lgc8310 ファイル名でファイルをソトするには
//
// <<修正履>>
//?? ?1?? ?2011/07/12? 1.00?? ?BFS)BaiLingzhou?? ?VSLP:Issues10)VSLPにするALL PAGE DL 新作成
//
// All Rights Reserved,
// Copyright (株) 日立作所、(株) ピアンドアイ、富士通 (株)
//
//******************************************************
package jp.co.nissan.g2b2.util;



/**
?* TSVファイルをソト
?* @version?? ?1.00
?* @author?? ?BFS)BaiLingzhou
?*
?*/
public class G2B2UtlTsvFileName implements Comparable<G2B2UtlTsvFileName>
{
?? ?private String frontName;
?? ?
?? ?private String endName;
?? ?
?? ?private String fileName;
?? ?/**
?? ? * TSVファイルクラスのConstructor
?? ? * @param fileName?? ?Oldファイル名
?? ? */
?? ?public G2B2UtlTsvFileName(String fileName)
?? ?{
?? ??? ?// the position of "_Object" or "_Criteria"
?? ??? ?int position = fileName.indexOf("_Object")>0?fileName.indexOf("_Object"):fileName.indexOf("_Criteria");
?? ??? ?this.frontName = fileName.substring(0, position);
?? ??? ?this.endName?? = fileName.substring(position,fileName.length());
?? ??? ?this.fileName? = fileName;
?? ?}

?? ?
?? ?public String toString()
?? ?{
?? ??? ?return this.fileName;
?? ?}

?? ?/**
?? ? * 比名前の前,等しい合,アレンジメント
?? ? *???????????? 等しくない合,逆アレンジメント
?? ? * @param?? ?ファイルの名前
?? ? * @return?? ?等しいか、等しくないか
?? ? */
?? ?@Override
?? ?public int compareTo(G2B2UtlTsvFileName other)
?? ?{
?? ??? ?// 名前の前、等しいか、等しくないか
?? ??? ?if(this.frontName.equals(other.frontName))
?? ??? ?{
?? ??? ??? ?// 比名前の後、等しいか、等しくないか
?? ??? ??? ?return this.endName.compareTo(other.endName);
?? ??? ?}
?? ??? ?else
?? ??? ?{
?? ??? ??? ?// 名前の前、等しいか、逆アレンジメント
?? ??? ??? ?return other.frontName.compareTo(this.frontName);
?? ??? ?}
?? ?}
?? ?
?? ?/**
?? ? * equalsはObject定されたメソッドなので、オバライドが必要のメソッドです
?? ? */
?? ?@Override
?? ?public boolean equals(Object other)
?? ?{
?? ??? ?G2B2UtlTsvFileName o;
?? ??? ?if(other instanceof G2B2UtlTsvFileName)
?? ??? ?{
?? ??? ??? ?o = (G2B2UtlTsvFileName)other;
?? ??? ?}else{
?? ??? ??? ?return false;
?? ??? ?}
?? ??? ?return this.fileName.equals(o.fileName);
?? ?}
?? ?
?? ?/**
?? ? * hashCodeはObject定されたメソッドなので、オバライドが必要のメソッドです
?? ? */
?? ?@Override
?? ?public int hashCode()
?? ?{
?? ??? ?return this.fileName.hashCode();
?? ?}
}

读书人网 >Web前端

热点推荐