📄 encobjectsignature.java
字号:
/* * $Source: /home/data/cvsroot/src/jacomma/icm/io/EncObjectSignature.java,v $ * $Revision: 1.4 $ * $Date: 2000/10/28 20:09:07 $ * * This file is part of the jacomma framework * Copyright (c) 2000 Dimitrios Vyzovitis * mailto:dviz@egnatia.ee.auth.gr * * * * * * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This library 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 Library General Public License for more details. * * You should have received a copy of the GNU Library General Public License * along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307 USA */package jacomma.icm.io;/** * TBA **/public final class EncObjectSignature { public static final String signatureOf( EncObject obj ) { if ( obj.getSignature() == null ) switch ( obj.getType().getByteCode() ) { case (byte)0x80: { // List EncObject[] elements = (EncObject[])obj.getValue(); return (elements.length == 0) ? EmptyList : List + signatureOf( elements[0] ); } case (byte)0x90: { // Tuple EncObject[] elements = (EncObject[])obj.getValue(); String sig = Tuple + new String( new byte[]{(byte)(elements.length)} ); for ( int i = 0; i < elements.length; i++ ) sig += signatureOf( elements[i] ); return sig; } default: return signatureOf( obj.getType() ); } else return obj.getSignature(); } public static final String signatureOf( EncObjectType t ){ switch ( t.getByteCode() ) { case (byte)0x10: case (byte)0x20: case (byte)0x30: return Number; case (byte)0x40: return Symbol; case (byte)0x50: return Handle; case (byte)0x60: return String; case (byte)0x70: return Code; case (byte)0x80: return List; case (byte)0x90: return Tuple; case (byte)0xd0: return Any; case (byte)0xe0: return Opaque; default: throw new IOException( "No signature associated with: " + t); } } public static final String Any = "A"; public static final String Number = "N"; public static final String String = "S"; public static final String Symbol = "s"; public static final String Handle = "h"; public static final String Tuple = "T"; public static final String List = "L"; public static final String Opaque = "O"; public static final String Logical = "l"; public static final String Variable = "$"; public static final String EmptyList = List + Variable + "\000"; public static final String Code = "P" + Tuple + "\000"; public static final String Choice = "|"; public static final String Abstract = "."; public static final String SymbolMarker = "#"; public static final String Label = "R"; public static final String Field = "?";}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -