List of usage examples for java.lang Number intValue
public abstract int intValue();
From source file:com.prowidesoftware.swift.model.field.Field11R.java
/** * Set the component3 from a Number object. * <br />//from w w w .j av a 2 s . co m * <em>If the component being set is a fixed length number, the argument will not be * padded.</em> It is recommended for these cases to use the setComponent3(String) * method. * * @see #setComponent3(String) * * @param component3 the Number with the component3 content to set */ public Field11R setComponent3(java.lang.Number component3) { if (component3 != null) { setComponent(3, "" + component3.intValue()); } return this; }
From source file:com.prowidesoftware.swift.model.field.Field11R.java
/** * Set the component4 from a Number object. * <br />/*from w w w.j a v a 2 s. co m*/ * <em>If the component being set is a fixed length number, the argument will not be * padded.</em> It is recommended for these cases to use the setComponent4(String) * method. * * @see #setComponent4(String) * * @param component4 the Number with the component4 content to set */ public Field11R setComponent4(java.lang.Number component4) { if (component4 != null) { setComponent(4, "" + component4.intValue()); } return this; }
From source file:com.prowidesoftware.swift.model.field.Field11S.java
/** * Set the component3 from a Number object. * <br />//from ww w.java 2 s .c om * <em>If the component being set is a fixed length number, the argument will not be * padded.</em> It is recommended for these cases to use the setComponent3(String) * method. * * @see #setComponent3(String) * * @param component3 the Number with the component3 content to set */ public Field11S setComponent3(java.lang.Number component3) { if (component3 != null) { setComponent(3, "" + component3.intValue()); } return this; }
From source file:com.prowidesoftware.swift.model.field.Field11S.java
/** * Set the component4 from a Number object. * <br />/* w w w . ja v a 2 s .c o m*/ * <em>If the component being set is a fixed length number, the argument will not be * padded.</em> It is recommended for these cases to use the setComponent4(String) * method. * * @see #setComponent4(String) * * @param component4 the Number with the component4 content to set */ public Field11S setComponent4(java.lang.Number component4) { if (component4 != null) { setComponent(4, "" + component4.intValue()); } return this; }
From source file:com.tibbo.linkserver.plugin.device.file.item.NumericItem.java
private int toInt(Number value) { if (value instanceof Double) { return (new BigDecimal(value.doubleValue())).setScale(0, RoundingMode.HALF_UP).intValue(); }// ww w .java2 s . co m if (value instanceof Float) { return (new BigDecimal(value.floatValue())).setScale(0, RoundingMode.HALF_UP).intValue(); } if (value instanceof BigDecimal) { return ((BigDecimal) value).setScale(0, RoundingMode.HALF_UP).intValue(); } else { return value.intValue(); } }
From source file:com.hortonworks.streamline.streams.cluster.register.impl.ZookeeperServiceRegistrar.java
private Pair<Component, List<ComponentProcess>> createZookeeperServerComponent(Config config, Map<String, String> flattenConfigMap) { if (!config.contains(PARAM_ZOOKEEPER_SERVER_HOSTNAMES)) { throw new IllegalArgumentException( "Required parameter " + PARAM_ZOOKEEPER_SERVER_HOSTNAMES + " not present."); }/*from w w w . jav a 2 s. co m*/ if (!config.contains(PARAM_ZOOKEEPER_PORT)) { throw new IllegalArgumentException("Required parameter " + PARAM_ZOOKEEPER_PORT + " not present."); } List<String> zookeeperServerHosts; try { zookeeperServerHosts = config.getAny(PARAM_ZOOKEEPER_SERVER_HOSTNAMES); } catch (ClassCastException e) { throw new IllegalArgumentException( "Required parameter " + PARAM_ZOOKEEPER_SERVER_HOSTNAMES + " should be list of string."); } Number zookeeperPort; try { zookeeperPort = config.getAny(PARAM_ZOOKEEPER_PORT); } catch (ClassCastException e) { throw new IllegalArgumentException("Required parameter " + PARAM_ZOOKEEPER_PORT + " should be number."); } Component zookeeperServer = new Component(); zookeeperServer.setName(COMPONENT_ZOOKEEPER_SERVER); List<ComponentProcess> componentProcesses = zookeeperServerHosts.stream().map(host -> { ComponentProcess cp = new ComponentProcess(); cp.setHost(host); cp.setPort(zookeeperPort.intValue()); return cp; }).collect(toList()); return new Pair<>(zookeeperServer, componentProcesses); }
From source file:com.jaspersoft.jasperserver.ws.axis2.scheduling.ReportJobBeanTraslator.java
protected int[] toIntArray(Set values) { int[] vals;/*from w w w . j a v a 2 s .c o m*/ if (values == null || values.isEmpty()) { vals = null; } else { vals = new int[values.size()]; int idx = 0; for (Iterator it = values.iterator(); it.hasNext(); ++idx) { Number value = (Number) it.next(); vals[idx] = value.intValue(); } } return vals; }
From source file:com.jkoolcloud.tnt4j.streams.utils.Utils.java
/** * Checks if number object is {@code null} or has value equal to {@code 0}. * * @param number//from w w w. j a va2s . c o m * number object to check * @return {@code true} if number is {@code null} or number value is {@code 0}, {@code false} - otherwise */ public static boolean isZero(Number number) { return number == null || number.intValue() == 0; }
From source file:it.drwolf.ridire.index.sketch.AsyncSketchCreator.java
private Map<String, Map<String, Number>> createResTable(List<String> lines, StrTokenizer strTokenizer) { Map<String, Map<String, Number>> resTable = new HashMap<String, Map<String, Number>>(); for (String line : lines) { String[] tokens = strTokenizer.reset(line).getTokenArray(); if (tokens.length != 3) { continue; }//from ww w.j a v a2 s . com String[] lemmas = tokens[0].split("\\s"); String[] poss = tokens[1].split("\\s"); if (lemmas.length != poss.length || poss.length < 2) { continue; } String target = tokens[2].trim(); String preArtpre = null; for (int i = 1; i < poss.length; i++) { if (poss[i].trim().matches("PRE|ARTPRE")) { preArtpre = lemmas[i].trim(); break; } } if (preArtpre == null) { continue; } Map<String, Number> tableForPre = resTable.get(preArtpre); if (tableForPre == null) { tableForPre = new HashMap<String, Number>(); } Number n = tableForPre.get(target); if (n == null) { tableForPre.put(target, 1); } else { tableForPre.put(target, n.intValue() + 1); } resTable.put(preArtpre, tableForPre); } return resTable; }
From source file:org.camunda.spin.impl.json.jackson.JacksonJsonNode.java
public SpinJsonNode prop(String name, Number newProperty) { ObjectNode node = (ObjectNode) jsonNode; // Numbers magic because Jackson has no native .put(Number value) if (newProperty instanceof Long) { node.put(name, newProperty.longValue()); } else if (newProperty instanceof Integer) { node.put(name, newProperty.intValue()); } else if (newProperty instanceof Float) { node.put(name, newProperty.floatValue()); } else {//from w w w .ja v a 2 s. c om // convert any other sub class of Number into Float node.put(name, newProperty.floatValue()); } return this; }