|
From: <pe...@us...> - 2004-02-19 15:40:51
|
Update of /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id/targets In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16761/src/java/org/neuclear/id/targets Modified Files: Target.java Log Message: Various cleanups and corrections Index: Target.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id/targets/Target.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Target.java 18 Feb 2004 00:14:31 -0000 1.1 --- Target.java 19 Feb 2004 15:30:20 -0000 1.2 *************** *** 25,28 **** --- 25,31 ---- $Id$ $Log$ + Revision 1.2 2004/02/19 15:30:20 pelle + Various cleanups and corrections + Revision 1.1 2004/02/18 00:14:31 pelle Many, many clean ups. I've readded Targets in a new method. *************** *** 35,39 **** */ final class Target { ! private Target( int type, String href) { this.href = href; this.type = type; --- 38,42 ---- */ final class Target { ! private Target(int type, String href) { this.href = href; this.type = type; *************** *** 48,65 **** } ! final static Target make(String type,String href){ int t = getType(type); ! return new Target(t,href); } final static int getType(String type) { ! int t=0; ! if (type!=null&&typemap.containsKey(type)) ! t=((Byte)typemap.get(type)).byteValue(); return t; } ! final static Target parseElement(Element elem){ ! return make(elem.attributeValue("type"),elem.getTextTrim()); } --- 51,68 ---- } ! final static Target make(String type, String href) { int t = getType(type); ! return new Target(t, href); } final static int getType(String type) { ! int t = 0; ! if (type != null && TYPEMAP.containsKey(type)) ! t = ((Byte) TYPEMAP.get(type)).byteValue(); return t; } ! final static Target parseElement(Element elem) { ! return make(elem.attributeValue("type"), elem.getTextTrim()); } *************** *** 67,77 **** private final int type; ! private final static HashMap typemap=new HashMap(); - // Add further standard types here - private final static String[] types= new String[] {"misc","auditor","receiver","logger"}; { ! for(byte i=0;i<types.length;i++) ! typemap.put(types[i],new Byte(i)); } } --- 70,81 ---- private final int type; ! private final static HashMap TYPEMAP = new HashMap(); ! ! // Add further standard TYPES here ! private final static String[] TYPES = new String[]{"misc", "auditor", "receiver", "logger"}; { ! for (byte i = 0; i < TYPES.length; i++) ! TYPEMAP.put(TYPES[i], new Byte(i)); } } |