首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > Web前端 >

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

2012-10-09 
java新建类,要重写的4个方法//******************************************************//// G2Bシステム// クラ

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();
?? ?}
}

热点排行