static { error.put(9999, "失败"); error.put(1000, "参数缺失"); error.put(1001, "正在处理中"); error.put(1002, "用户中途取消"); error.put(1003, "用户名不存在"); error.put(1004, "密码错误"); }
/** * Maps names to numbers (numbers are required by SVMLight format) * * @param names names (e.g., features, outcomes) * @return bidirectional map of name:number */ public static BidiMap mapVocabularyToIntegers(SortedSet<String> names) { BidiMap result = new DualTreeBidiMap(); // start numbering from 1 int index = 1; for (String featureName : names) { result.put(featureName, index); index++; } return result; }
/** Get the ID with which the object is associated with the session, if any */ protected String getSessionObjectId(Object obj) { HttpSession session = getSession(); BidiMap map; synchronized (session) { map = (BidiMap) session.getAttribute(SESSION_KEY_OBJ_MAP); if (map == null) { map = new DualHashBidiMap(); session.setAttribute(SESSION_KEY_OBJ_MAP, map); } } synchronized (map) { String id = (String) map.get(obj); if (id == null) { id = getNewSessionObjectId(); map.put(obj, id); } return id; } }
public PollCheckValues() { commandsBidiMap = new DualHashBidiMap(); commandsBidiMap.put( TelemetryRotatorConstants.SET_POSITION, TelemetryRotatorConstants.GET_POSITION); commandsBidiMap.put( TelemetryRadioConstants.SET_ANTENNA_NR, TelemetryRadioConstants.GET_ANTENNA_NR); commandsBidiMap.put( TelemetryRadioConstants.SET_CTCSS_TONE, TelemetryRadioConstants.GET_CTCSS_TONE); commandsBidiMap.put(TelemetryRadioConstants.SET_DCS_CODE, TelemetryRadioConstants.GET_DCS_CODE); commandsBidiMap.put( TelemetryRadioConstants.SET_FREQUENCY, TelemetryRadioConstants.GET_FREQUENCY); commandsBidiMap.put( TelemetryRadioConstants.SET_MEMORY_CHANNELNR, TelemetryRadioConstants.GET_MEMORY_CHANNELNR); commandsBidiMap.put(TelemetryRadioConstants.SET_MODE, TelemetryRadioConstants.GET_MODE); commandsBidiMap.put(TelemetryRadioConstants.SET_PTT, TelemetryRadioConstants.GET_PTT); commandsBidiMap.put(TelemetryRadioConstants.SET_RIT, TelemetryRadioConstants.GET_RIT); commandsBidiMap.put( TelemetryRadioConstants.SET_RPTR_OFFSET, TelemetryRadioConstants.GET_RPTR_OFFSET); commandsBidiMap.put( TelemetryRadioConstants.SET_RPTR_SHIFT, TelemetryRadioConstants.GET_RPTR_SHIFT); commandsBidiMap.put( TelemetryRadioConstants.SET_SPLIT_VFO, TelemetryRadioConstants.GET_SPLIT_VFO); commandsBidiMap.put( TelemetryRadioConstants.SET_TRANCEIVE_MODE, TelemetryRadioConstants.GET_TRANCEIVE_MODE); commandsBidiMap.put( TelemetryRadioConstants.SET_TRANSMIT_FREQUENCY, TelemetryRadioConstants.GET_TRANSMIT_FREQUENCY); commandsBidiMap.put( TelemetryRadioConstants.SET_TRANSMIT_MODE, TelemetryRadioConstants.GET_TRANSMIT_MODE); commandsBidiMap.put( TelemetryRadioConstants.SET_TUNING_STEP, TelemetryRadioConstants.GET_TUNING_STEP); commandsBidiMap.put(TelemetryRadioConstants.SET_VFO, TelemetryRadioConstants.GET_VFO); commandsThatReturnIntegrer = new ArrayList<String>(); commandsThatReturnIntegrer.add(TelemetryRadioConstants.GET_FREQUENCY); }
static { DateTimeParser[] parsers = { DateTimeFormat.forPattern("yyyy-MM-dd").getParser(), DateTimeFormat.forPattern("yyyy-MM-dd HH:mm Z").getParser(), DateTimeFormat.forPattern("yyyy-MM-dd'T'HH:mm:ss.SSSZ").getParser(), DateTimeFormat.fullDateTime().getParser(), DateTimeFormat.fullDate().getParser(), DateTimeFormat.shortDateTime().getParser(), DateTimeFormat.shortDate().getParser() }; DTF = new DateTimeFormatterBuilder().append(null, parsers).toFormatter(); BidiMap primitiveTypeMap = new DualHashBidiMap(); primitiveTypeMap.put(Integer.class, int.class); primitiveTypeMap.put(Long.class, long.class); primitiveTypeMap.put(Short.class, short.class); primitiveTypeMap.put(Byte.class, byte.class); primitiveTypeMap.put(Byte[].class, byte[].class); primitiveTypeMap.put(Double.class, double.class); primitiveTypeMap.put(Float.class, float.class); primitiveTypeMap.put(Character.class, char.class); primitiveTypeMap.put(Boolean.class, boolean.class); PRIMITIVE_TYPE_MAP = UnmodifiableBidiMap.decorate(primitiveTypeMap); Map<String, Class<?>> primitiveWrapperNameMap = new HashMap<>(); primitiveWrapperNameMap.put(Integer.class.getName(), Integer.class); primitiveWrapperNameMap.put(Long.class.getName(), Long.class); primitiveWrapperNameMap.put(Short.class.getName(), Short.class); primitiveWrapperNameMap.put(Byte.class.getName(), Byte.class); primitiveWrapperNameMap.put(Byte[].class.getName(), Byte[].class); primitiveWrapperNameMap.put(Double.class.getName(), Double.class); primitiveWrapperNameMap.put(Float.class.getName(), Float.class); primitiveWrapperNameMap.put(Character.class.getName(), Character.class); primitiveWrapperNameMap.put(Boolean.class.getName(), Boolean.class); primitiveWrapperNameMap.put(int.class.getName(), Integer.class); primitiveWrapperNameMap.put(long.class.getName(), Long.class); primitiveWrapperNameMap.put(short.class.getName(), Short.class); primitiveWrapperNameMap.put(byte.class.getName(), Byte.class); primitiveWrapperNameMap.put(byte[].class.getName(), Byte[].class); primitiveWrapperNameMap.put(double.class.getName(), Double.class); primitiveWrapperNameMap.put(float.class.getName(), Float.class); primitiveWrapperNameMap.put(char.class.getName(), Character.class); primitiveWrapperNameMap.put(boolean.class.getName(), Boolean.class); PRIMITIVE_WRAPPER_NAME_MAP = primitiveWrapperNameMap; COLLECTION_IMPLEMENTATIONS = new HashMap<>(); // PMD sees this as declaring ArrayList type fields for some reason COLLECTION_IMPLEMENTATIONS.put( List.class.getName(), ArrayList.class); // NOPMD - bug in PMD, objects to ArrayList.class here COLLECTION_IMPLEMENTATIONS.put( Set.class.getName(), HashSet.class); // NOPMD - bug in PMD, objects to HashSet.class here COLLECTION_IMPLEMENTATIONS.put( SortedSet.class.getName(), TreeSet.class); // NOPMD - bug in PMD, objects to TreeSet.class here COLLECTION_IMPLEMENTATIONS.put(Queue.class.getName(), ArrayDeque.class); MAP_SUPPORTED_TYPES = new HashMap<>(); Set<String> keyClasses = new HashSet<>(); keyClasses.add(String.class.getName()); keyClasses.add(Long.class.getName()); keyClasses.add(Integer.class.getName()); Set<String> valueClasses = new HashSet<>(); valueClasses.add(String.class.getName()); valueClasses.add(Long.class.getName()); valueClasses.add(Integer.class.getName()); MAP_SUPPORTED_TYPES.put(MAP_KEY_TYPE, keyClasses); MAP_SUPPORTED_TYPES.put(MAP_VALUE_TYPE, valueClasses); }
private DB() { channelMap = new DualHashBidiMap(); channelMap.put("fixedUrl", FixedUrlChannel.class); channelMap.put("paginated", PaginatedResultChannel.class); channelMap.put("parasplit", ParagraphSplitChannel.class); };