List of usage examples for java.lang Integer decode
public static Integer decode(String nm) throws NumberFormatException
From source file:lyonlancer5.xatrocore.lib.internal.SplashProgress.java
@SuppressWarnings("unused") private static int getInt(String name, int def) { return Integer.decode(getString(name, Integer.toString(def))); }
From source file:org.kchine.r.server.http.RHttpProxy.java
public static void logOff(String url, String sessionId) throws TunnelingException { if (System.getProperty("proxy_host") != null && !System.getProperty("proxy_host").equals("")) { mainHttpClient.getHostConfiguration().setProxy(System.getProperty("proxy_host"), Integer.decode(System.getProperty("proxy_port"))); }/*from w ww .j av a 2 s . co m*/ GetMethod getLogOut = null; try { Object result = null; getLogOut = new GetMethod(url + "?method=logoff"); if (sessionId != null && !sessionId.equals("")) { getLogOut.getParams().setCookiePolicy(CookiePolicy.IGNORE_COOKIES); getLogOut.setRequestHeader("Cookie", "JSESSIONID=" + sessionId); } try { mainHttpClient.executeMethod(getLogOut); result = new ObjectInputStream(getLogOut.getResponseBodyAsStream()).readObject(); } catch (ConnectException e) { throw new ConnectionFailedException(); } catch (Exception e) { throw new TunnelingException("", e); } if (result != null && result instanceof TunnelingException) { throw (TunnelingException) result; } } finally { if (getLogOut != null) { getLogOut.releaseConnection(); } } }
From source file:lyonlancer5.xatrocore.lib.internal.SplashProgress.java
private static int getHex(String name, int def) { return Integer.decode(getString(name, "0x" + Integer.toString(def, 16).toUpperCase())); }
From source file:com.emergya.persistenceGeo.web.RestFoldersAdminController.java
/** * This method loads layers.json related with a folder * /* w w w. jav a 2 s.co m*/ * @param username * * @return JSON file with layers */ @RequestMapping(value = "/persistenceGeo/moveFolderTo", method = RequestMethod.POST, produces = { MediaType.APPLICATION_JSON_VALUE }) public @ResponseBody Map<String, Object> moveFolderTo(@RequestParam("folderId") String folderId, @RequestParam("toFolder") String toFolder, @RequestParam(value = "toOrder", required = false) String toOrder) { Map<String, Object> result = new HashMap<String, Object>(); FolderDto folder = null; try { /* * //TODO: Secure with logged user String username = ((UserDetails) * SecurityContextHolder.getContext() * .getAuthentication().getPrincipal()).getUsername(); */ Long idFolder = Long.decode(folderId); folder = (FolderDto) foldersAdminService.getById(idFolder); folder.setIdParent(Long.decode(toFolder)); if (toOrder != null) { folder.setOrder(Integer.decode(toOrder)); } folder = (FolderDto) foldersAdminService.update(folder); result.put(SUCCESS, true); } catch (Exception e) { e.printStackTrace(); result.put(SUCCESS, false); } result.put(RESULTS, folder != null ? 1 : 0); result.put(ROOT, folder); return result; }
From source file:org.springmodules.validation.commons.validwhen.ValidWhenParser.java
public final void number() throws RecognitionException, TokenStreamException { Token d = null;/* w ww. j av a 2 s. c om*/ Token h = null; switch (LA(1)) { case DECIMAL_LITERAL: { d = LT(1); match(DECIMAL_LITERAL); argStack.push(new BigDecimal(d.getText())); break; } case HEX_LITERAL: { h = LT(1); match(HEX_LITERAL); argStack.push(new BigDecimal(Integer.decode(h.getText()).toString())); break; } default: { throw new NoViableAltException(LT(1), getFilename()); } } }
From source file:it.eng.spagobi.engines.chart.bo.charttypes.dialcharts.SimpleDial.java
/** * set parameters for the creation of the chart getting them from template or from LOV. * /* w w w .jav a 2s.co m*/ * @param content the content of the template. * * @return A chart that displays a value as a dial. */ public void configureChart(SourceBean content) { logger.debug("IN"); super.configureChart(content); if (!isLovConfDefined) { if (confParameters.get(INCREMENT) != null) { String increment = (String) confParameters.get(INCREMENT); setIncrement(Double.valueOf(increment).doubleValue()); } else { logger.error("increment not defined"); setIncrement(Double.valueOf(1.0).doubleValue()); } if (confParameters.get(MINOR_TICK) != null) { String minorTickCount = (String) confParameters.get(MINOR_TICK); setMinorTickCount(Integer.valueOf(minorTickCount).intValue()); } else { setMinorTickCount(10); } if (confParameters.get(ORIENTATION) != null) { String orientation = (String) confParameters.get(ORIENTATION); if (orientation.equalsIgnoreCase("vertical")) { horizontalViewConfigured = true; horizontalView = false; } else if (orientation.equalsIgnoreCase("horizontal")) { horizontalViewConfigured = true; horizontalView = true; } } //reading intervals information SourceBean intervalsSB = (SourceBean) content.getAttribute("INTERVALS"); if (intervalsSB == null) { intervalsSB = (SourceBean) content.getAttribute("CONF.INTERVALS"); } List intervalsAttrsList = null; if (intervalsSB != null) { intervalsAttrsList = intervalsSB.getContainedSourceBeanAttributes(); } if (intervalsAttrsList == null || intervalsAttrsList.isEmpty()) { // if intervals are not defined realize a single interval logger.warn("intervals not defined; default settings"); /*KpiInterval interval=new KpiInterval(); interval.setMin(getLower()); interval.setMax(getUpper()); interval.setColor(Color.white); addInterval(interval);*/ } else { Iterator intervalsAttrsIter = intervalsAttrsList.iterator(); while (intervalsAttrsIter.hasNext()) { SourceBeanAttribute paramSBA = (SourceBeanAttribute) intervalsAttrsIter.next(); SourceBean param = (SourceBean) paramSBA.getValue(); String min = (String) param.getAttribute(MIN_INTERVAL); String max = (String) param.getAttribute(MAX_INTERVAL); String col = (String) param.getAttribute(COLOR_INTERVAL); KpiInterval interval = new KpiInterval(); interval.setMin(Double.valueOf(min).doubleValue()); interval.setMax(Double.valueOf(max).doubleValue()); Color color = new Color(Integer.decode(col).intValue()); if (color != null) { interval.setColor(color); } else { // sets default color interval.setColor(Color.white); } addInterval(interval); } } } else { String increment = (String) sbRow.getAttribute(INCREMENT); String minorTickCount = (String) sbRow.getAttribute(MINOR_TICK); String orientation = ""; if (sbRow.getAttribute(ORIENTATION) != null) { orientation = (String) sbRow.getAttribute(ORIENTATION); if (orientation.equalsIgnoreCase("vertical")) { horizontalView = false; horizontalViewConfigured = true; } else if (orientation.equalsIgnoreCase("horizontal")) { horizontalView = true; horizontalViewConfigured = true; } } setIncrement(Double.valueOf(increment).doubleValue()); setMinorTickCount(Integer.valueOf(minorTickCount).intValue()); String intervalsNumber = (String) sbRow.getAttribute(INTERVALS_NUMBER); if (intervalsNumber == null || intervalsNumber.equals("") || intervalsNumber.equals("0")) { // if intervals are not specified /*KpiInterval interval=new KpiInterval(); interval.setMin(getLower()); interval.setMax(getUpper()); interval.setColor(Color.WHITE); addInterval(interval);*/ } else { for (int i = 1; i <= Integer.valueOf(intervalsNumber).intValue(); i++) { KpiInterval interval = new KpiInterval(); String min = (String) sbRow.getAttribute("min" + (new Integer(i)).toString()); String max = (String) sbRow.getAttribute("max" + (new Integer(i)).toString()); String col = (String) sbRow.getAttribute("color" + (new Integer(i)).toString()); interval.setMin(Double.valueOf(min).doubleValue()); interval.setMax(Double.valueOf(max).doubleValue()); Color color = new Color(Integer.decode(col).intValue()); interval.setColor(color); addInterval(interval); } } } logger.debug("out"); }
From source file:it.eng.spagobi.engines.chart.bo.charttypes.XYCharts.BlockChart.java
public void configureChart(SourceBean content) { logger.debug("IN"); super.configureChart(content); SourceBean zrange = (SourceBean) content.getAttribute("ZRANGES"); if (zrange == null) { zrange = (SourceBean) content.getAttributeAsList("CONF.ZRANGES"); }//from www . j av a 2 s .c om SourceBean yrange = (SourceBean) content.getAttribute("YRANGES"); if (yrange == null) { yrange = (SourceBean) content.getAttributeAsList("CONF.YRANGES"); } // get grid dimensions (changed way in 3.4) Object gridWidth = confParameters.get("grid_width"); Object gridHeight = confParameters.get("grid_height"); if (gridWidth != null) { blockW = gridWidth.toString(); } if (gridHeight != null) { blockH = gridHeight.toString(); } // get x and y range dimensions (changed way in 3.4) Object xLow = confParameters.get("xrange_value_low"); Object xHigh = confParameters.get("xrange_value_high"); Object yLow = confParameters.get("yrange_value_low"); Object yHigh = confParameters.get("yrange_value_high"); if (xLow != null) { xrangeMin = xLow.toString(); } if (xHigh != null) { xrangeMax = xHigh.toString(); } if (yLow != null) { yrangeMin = yLow.toString(); } if (yHigh != null) { yrangeMax = yHigh.toString(); } // chenge // List confAttrsList2 = content.getAttributeAsList("PARAMETER"); // Iterator confAttrsIter2 = confAttrsList2.iterator(); // while(confAttrsIter2.hasNext()) { // SourceBean param = (SourceBean)confAttrsIter2.next(); // String nameParam = (String)param.getAttribute("name"); // // if (nameParam.equals("xrange")){ // xrangeMin = (String)param.getAttribute("value_low"); // xrangeMax = (String)param.getAttribute("value_high"); // }else if (nameParam.equals("yrange")){ // yrangeMin = (String)param.getAttribute("value_low"); // yrangeMax = (String)param.getAttribute("value_high"); // } // // String valueParam = (String)param.getAttribute("value"); // confParameters.put(nameParam, valueParam); // } if (yrange != null) { List ranges = yrange.getAttributeAsList("RANGE"); int rangesNum = ranges.size(); yLabels = new String[rangesNum + 1]; yLabels[0] = ""; Iterator rangesIter = ranges.iterator(); int j = 0; while (rangesIter.hasNext()) { SourceBean range = (SourceBean) rangesIter.next(); String nameParam = (String) range.getAttribute("label"); String label = ""; if (nameParam != null) { label = nameParam; } yLabels[j + 1] = label; j++; } } if (zrange == null) return; List ranges = zrange.getAttributeAsList("RANGE"); int rangesNum = ranges.size(); legendLabels = new String[rangesNum]; legendLabels[0] = ""; zvalues = new double[rangesNum - 1]; Iterator rangesIter = ranges.iterator(); int j = 0; while (rangesIter.hasNext()) { SourceBean range = (SourceBean) rangesIter.next(); String nameParam = (String) range.getAttribute("label"); String colour = ""; String label = ""; label = nameParam; colour = (String) range.getAttribute("colour"); Color col = new Color(Integer.decode(colour).intValue()); if (!nameParam.equals("outbound")) { String low = (String) range.getAttribute("value_low"); double lowz = new Double(low).doubleValue(); String high = (String) range.getAttribute("value_high"); double highz = new Double(high).doubleValue(); String low_high = low + "," + high; legendLabels[j + 1] = label; colorRangeMap.put(new Double(highz - ((highz - lowz))), col); zvalues[j] = highz - ((highz - lowz)); } else if (nameParam.equals("outbound")) { String val = (String) range.getAttribute("value"); zrangeMax = val; outboundColor = "#FFFFFF"; } j++; } logger.debug("OUT"); }
From source file:com.github.jessemull.microflex.plate.Well.java
/** * Creates a new Well object using the numerical type flag, row number and * column string./*from www . ja va 2s . c o m*/ * @param int the numerical data type * @param int the well row * @param String the well column * @throws IllegalArgumentException invalid column value */ public Well(int type, int row, String column) { this.row = row; this.type = type; try { this.column = Integer.decode(column); } catch (Exception e) { throw new IllegalArgumentException("Illegal column value: " + column); } validateIndices(this.row, this.column); }
From source file:org.openpilot_nonag.androidgcs.fragments.Map.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { //disable the screen from turning off Log.d(TAG, "*** onCreateView"); this.getActivity().getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); // inflate and return the layout View v = inflater.inflate(R.layout.map_fragment, container, false); // final Button buttonApply = (Button) v.findViewById(R.id.applyBtn); // buttonApply.setOnClickListener(new View.OnClickListener() { // public void onClick(View v) { // updateObject(homeLocationObject.getObjID(),homeLocationObject.getInstID()); // } // }); // buttonApply.setEnabled(false); // /*w ww . j a v a2s .c om*/ // final Button buttonSave = (Button) v.findViewById(R.id.saveBtn); // buttonSave.setOnClickListener(new View.OnClickListener() { // public void onClick(View v) { // saveObject(homeLocationObject); // } // }); // buttonSave.setEnabled(false); mapView = (MapView) v.findViewById(R.id.map_view_fragment); mapView.onCreate(savedInstanceState); // get map type from preferences SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getActivity()); int map_type = Integer.decode(prefs.getString("map_type", "1")); // Needs to call MapsInitializer before doing any CameraUpdateFactory // calls MapsInitializer.initialize(getActivity()); // something wrong *here* (only on versions with out Google Play // Services) need to check instead of crashing. // should take care of this int status = GooglePlayServicesUtil.isGooglePlayServicesAvailable(getActivity()); if (status == ConnectionResult.SUCCESS) { // Gets to GoogleMap from the MapView and does initialization stuff mMap = mapView.getMap(); mMap.getUiSettings().setMyLocationButtonEnabled(true); mMap.setIndoorEnabled(true); mMap.setMyLocationEnabled(true); mMap.setOnMyLocationChangeListener(this); switch (map_type) { case 0: mMap.setMapType(GoogleMap.MAP_TYPE_NORMAL); mMap.getUiSettings().setIndoorLevelPickerEnabled(true); break; case 1: mMap.setMapType(GoogleMap.MAP_TYPE_SATELLITE); mMap.getUiSettings().setIndoorLevelPickerEnabled(true); break; case 2: mMap.setMapType(GoogleMap.MAP_TYPE_TERRAIN); break; case 3: mMap.setMapType(GoogleMap.MAP_TYPE_HYBRID); break; } UAVpathLine = mMap.addPolyline(new PolylineOptions().width(5).color(Color.WHITE)); UAVpathLine.setPoints(UAVpathPoints); NEDUAVpathLine = mMap.addPolyline(new PolylineOptions().width(5).color(Color.RED)); NEDUAVpathLine.setPoints(NEDUAVpathPoints); TabletpathLine = mMap.addPolyline(new PolylineOptions().width(5).color(Color.BLUE)); TabletpathLine.setPoints(TabletpathPoints); registerForContextMenu(mapView); // mMap.setOnMapClickListener(new GoogleMap.OnMapClickListener() { // // @Override // public void onMapClick(LatLng arg0) { // // TODO Auto-generated method stub // Log.d(TAG, "Simple Click"); // // } // }); mMap.setOnMapLongClickListener(new GoogleMap.OnMapLongClickListener() { @Override public void onMapLongClick(LatLng arg0) { Log.d(TAG, "Long Click"); //getView().showContextMenu(); mapView.showContextMenu(); touchLocation = arg0; } }); LocationManager locationManager = (LocationManager) getActivity() .getSystemService(Context.LOCATION_SERVICE); Location currentLocation = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER); if (currentLocation == null) { currentLocation = locationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER); } LatLng currentLatLng = new LatLng(0, 0); if (currentLocation != null) { currentLatLng = new LatLng(currentLocation.getLatitude(), currentLocation.getLongitude()); } // zoom to cuurent location mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(currentLatLng, 17)); } else { Toast.makeText(getActivity(), "Google Play Services are not enabled.", Toast.LENGTH_SHORT).show(); } return v; }
From source file:org.mule.endpoint.AbstractEndpointBuilder.java
private static Integer getIntegerProperty(Map<Object, Object> properties, String name, Integer dflt) { if (properties.containsKey(name)) { return Integer.decode((String) properties.get(name)); } else {//from w w w .j a va 2 s . c om return dflt; } }