📄 asn1integer.java
字号:
/* * The contents of this file are subject to the Dyade Public License, * as defined by the file DYADE_PUBLIC_LICENSE.TXT * * You may not use this file except in compliance with the License. You may * obtain a copy of the License on the Dyade web site (www.dyade.fr). * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for * the specific terms governing rights and limitations under the License. * * The Original Code is CmisJava API, including the java package * fr.dyade.cmis, released September 5, 2000. * * The Initial Developer of the Original Code is Dyade. The Original Code and * portions created by Dyade are Copyright Bull and Copyright INRIA. * All Rights Reserved. *//* Copyright 1996-2000 by Institut National de Recherche en Informatique * et en Automatique (INRIA) * All rights reserved. See COPYRIGHT in top-level directory. * * Authors: Laurent Andrey, Eric Dillon, Olivier Festor *///---------------------------------------------------------------------------//// CVS Info//---------------------------------------------------------------------------////// $Id: ASN1Integer.java,v 1.4 2000/09/05 13:30:24 festor Exp $////---------------------------------------------------------------------------//// Todo//---------------------------------------------------------------------------////package fr.dyade.cmis.api.types;/** * Java representation of the ASN.1 Integer type. * The implementation is done by encapsulating a simple Java <code>Int</code> value into this class. * * @see fr.dyade.cmis.api.types.ASN1Boolean * TO DO: - code a couple of "singletons" (!?) to cache common integers (0, 1, 2,...). * - a setValue(int) method ? * * @version cvs $Id: ASN1Integer.java,v 1.4 2000/09/05 13:30:24 festor Exp $ */public class ASN1Integer extends Value implements Comparable { /** * Creates a new instance of ASN1Integer class. * * @param pValue The Java integer value to set the <code>ASN1Integer</code> with. */ public ASN1Integer(int pValue) { super(VALUE_INTEGER); fValue = pValue; } /** * Returns a <code>String</code> representation of the ASN1Integer. * @return A String conversion of the Integer Value. */ public String toString() { return (Integer.toString(fValue)); } /** * Returns the <code>int</code> value of the ASN1Integer object. * @return The <code>int</code> value of the ASN1Integer object. */ public int getValue() { return fValue; } /** * Returns the <code>int</code> value of the ASN1Integer object. * @return The <code>int</code> value of the ASN1Integer object. */ public int toInteger() { return fValue; } /** * To compare equality of ASN1Integer * Mandatory to use ObjectIdentifier in hastable. * @return true, if both internal native int have the same value. */ public boolean equals( Object other ){ return (other instanceof ASN1Integer ? (fValue==((ASN1Integer)other).fValue) : false); } /** * To compare 2 ASN1Integer * Mandatory to use ASN1Integer in ordered container. * @return a negative integer, zero, or a positive integer * as this Object is less than, equal to, or greater than the given Object * Mandatory by Comparable interface. */ public int compareTo(Object other) { int otherValue=((ASN1Integer)other).fValue; if (fValue<otherValue) return -1; if (fValue==otherValue) return 0; return 1; } /** Hash function to allow use as index. * Mandatory to use ASN1Integer in hastable. * TODO: PROFIL this function. * @see java.lang.Object#hashCode * * NOTE: currently this function return the internal native java int value. */ public int hashCode(){ return fValue; } private int fValue; } // ASN1Integer
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -