⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rsutils.java

📁 goText is a program for mobile phones that allows you to send text messages over GPRS/EDGE/UMTS. It
💻 JAVA
字号:
/**
 * Class : short description
 * @author Michele 'Miccar' Cardinale miccar@gmail.com
 * @author Natale Vinto ebballon@interfree.it
 * @version 1.0
 */

 /*
  *  goText : text messaging over GPRS
  *  Copyright (C) 2006  Natale Vinto <ebballon@interfree.it>
  *  OpenJLab Group www.openjlab.org
  *  Copyright (C) 2006  Michele Cardinale 'Miccar' <miccar@gmail.com>
  *  www.miccar.org
  *
  *  This program 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.
  *
  *  This program 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.
  *
  *  You should have received a copy of the GNU General Public License
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */

import javax.microedition.rms.*;

public class RSUtils{
    
    public class OrderByString implements RecordComparator{
        
        public int compare(byte[] rec1, byte[] rec2) {
            String a = new String(rec1);
            String b= new String(rec2);
            
            if (a.compareTo(b) < 0) {
                return RecordComparator.PRECEDES;
            } else if (a.compareTo(b) > 0) {
                return RecordComparator.FOLLOWS;
            } else {
                return RecordComparator.EQUIVALENT;
            }
        }
    }
    
    public class FilterByString implements RecordFilter{
        
        String a;
        
        public FilterByString(String a){
            this.a=a;
        }
        
        public boolean matches(byte[] recordCandidate ){
            String candidate = new String(recordCandidate);
            if (candidate.equals(this.a))
                return true;
            else
                return false;
        }
        
    }
    
    public class FilterByRegionString implements RecordFilter{
        
        String a;
        
        public FilterByRegionString(String a){
            this.a=a;
        }
        
        public boolean matches(byte[] recordCandidate ){
            String candidate = new String(recordCandidate);
            String temp=a.substring(0, a.indexOf(";"));
            if ((candidate.substring(0, candidate.indexOf(";"))).equals(temp)){
                return true;
            }else{
                return false;
            }
        }
        
    }
    
    
}

⌨️ 快捷键说明

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