Example usage for java.lang Number intValue

List of usage examples for java.lang Number intValue

Introduction

In this page you can find the example usage for java.lang Number intValue.

Prototype

public abstract int intValue();

Source Link

Document

Returns the value of the specified number as an int .

Usage

From source file:IntRange.java

/**
 * <p>Constructs a new <code>IntRange</code> using the specified
 * number as both the minimum and maximum in this range.</p>
 *
 * @param number  the number to use for this range, must not be <code>null</code>
 * @throws IllegalArgumentException if the number is <code>null</code>
 *///from   ww w.  ja  va  2  s  . c o m
public IntRange(Number number) {
    super();
    if (number == null) {
        throw new IllegalArgumentException("The number must not be null");
    }
    this.min = number.intValue();
    this.max = number.intValue();
    if (number instanceof Integer) {
        this.minObject = (Integer) number;
        this.maxObject = (Integer) number;
    }
}

From source file:net.oschina.app.v2.activity.zxing.CaptureActivity.java

private void handleDecodeExternally(Result rawResult, ResultHandler resultHandler, Bitmap barcode) {
    if (barcode != null) {
        viewfinderView.drawResultBitmap(barcode);
    }//from  w  w  w  .ja  v a2  s .  c o  m

    long resultDurationMS;
    if (getIntent() == null) {
        resultDurationMS = DEFAULT_INTENT_RESULT_DURATION_MS;
    } else {
        resultDurationMS = getIntent().getLongExtra(Intents.Scan.RESULT_DISPLAY_DURATION_MS,
                DEFAULT_INTENT_RESULT_DURATION_MS);
    }

    if (resultDurationMS > 0) {
        String rawResultString = String.valueOf(rawResult);
        if (rawResultString.length() > 32) {
            rawResultString = rawResultString.substring(0, 32) + " ...";
        }
        statusView.setText(getString(resultHandler.getDisplayTitle()) + " : " + rawResultString);
    }

    if (copyToClipboard && !resultHandler.areContentsSecure()) {
        CharSequence text = resultHandler.getDisplayContents();
        ClipboardInterface.setText(text, this);
    }

    if (source == IntentSource.NATIVE_APP_INTENT) {

        // Hand back whatever action they requested - this can be changed to Intents.Scan.ACTION when
        // the deprecated intent is retired.
        Intent intent = new Intent(getIntent().getAction());
        intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
        intent.putExtra(Intents.Scan.RESULT, rawResult.toString());
        intent.putExtra(Intents.Scan.RESULT_FORMAT, rawResult.getBarcodeFormat().toString());
        byte[] rawBytes = rawResult.getRawBytes();
        if (rawBytes != null && rawBytes.length > 0) {
            intent.putExtra(Intents.Scan.RESULT_BYTES, rawBytes);
        }
        Map<ResultMetadataType, ?> metadata = rawResult.getResultMetadata();
        if (metadata != null) {
            if (metadata.containsKey(ResultMetadataType.UPC_EAN_EXTENSION)) {
                intent.putExtra(Intents.Scan.RESULT_UPC_EAN_EXTENSION,
                        metadata.get(ResultMetadataType.UPC_EAN_EXTENSION).toString());
            }
            Number orientation = (Number) metadata.get(ResultMetadataType.ORIENTATION);
            if (orientation != null) {
                intent.putExtra(Intents.Scan.RESULT_ORIENTATION, orientation.intValue());
            }
            String ecLevel = (String) metadata.get(ResultMetadataType.ERROR_CORRECTION_LEVEL);
            if (ecLevel != null) {
                intent.putExtra(Intents.Scan.RESULT_ERROR_CORRECTION_LEVEL, ecLevel);
            }
            @SuppressWarnings("unchecked")
            Iterable<byte[]> byteSegments = (Iterable<byte[]>) metadata.get(ResultMetadataType.BYTE_SEGMENTS);
            if (byteSegments != null) {
                int i = 0;
                for (byte[] byteSegment : byteSegments) {
                    intent.putExtra(Intents.Scan.RESULT_BYTE_SEGMENTS_PREFIX + i, byteSegment);
                    i++;
                }
            }
        }
        sendReplyMessage(R.id.return_scan_result, intent, resultDurationMS);

    } else if (source == IntentSource.PRODUCT_SEARCH_LINK) {

        // Reformulate the URL which triggered us into a query, so that the request goes to the same
        // TLD as the scan URL.
        int end = sourceUrl.lastIndexOf("/scan");
        String replyURL = sourceUrl.substring(0, end) + "?q=" + resultHandler.getDisplayContents()
                + "&source=zxing";
        sendReplyMessage(R.id.launch_product_query, replyURL, resultDurationMS);

    } else if (source == IntentSource.ZXING_LINK) {

        if (scanFromWebPageManager != null && scanFromWebPageManager.isScanFromWebPage()) {
            String replyURL = scanFromWebPageManager.buildReplyURL(rawResult, resultHandler);
            scanFromWebPageManager = null;
            sendReplyMessage(R.id.launch_product_query, replyURL, resultDurationMS);
        }
    }
}

From source file:com.prowidesoftware.swift.model.field.Field333.java

/**
 * Set the component3 from a Number object.
 * <br />/*from   w  w w .  jav  a2  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 Field333 setComponent3(java.lang.Number component3) {
    if (component3 != null) {
        setComponent(3, "" + component3.intValue());
    }
    return this;
}

From source file:com.prowidesoftware.swift.model.field.Field333.java

/**
 * Set the component6 from a Number object.
 * <br />/* w  ww .  j a  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 setComponent6(String) 
 * method.
 * 
 * @see #setComponent6(String)
 *
 * @param component6 the Number with the component6 content to set
 */
public Field333 setComponent6(java.lang.Number component6) {
    if (component6 != null) {
        setComponent(6, "" + component6.intValue());
    }
    return this;
}

From source file:com.prowidesoftware.swift.model.field.Field333.java

/**
 * Set the component7 from a Number object.
 * <br />/*from w w w. ja va 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 setComponent7(String) 
 * method.
 * 
 * @see #setComponent7(String)
 *
 * @param component7 the Number with the component7 content to set
 */
public Field333 setComponent7(java.lang.Number component7) {
    if (component7 != null) {
        setComponent(7, "" + component7.intValue());
    }
    return this;
}

From source file:com.prowidesoftware.swift.model.field.Field333.java

/**
 * Set the component8 from a Number object.
 * <br />//from   www. jav  a2 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 setComponent8(String) 
 * method.
 * 
 * @see #setComponent8(String)
 *
 * @param component8 the Number with the component8 content to set
 */
public Field333 setComponent8(java.lang.Number component8) {
    if (component8 != null) {
        setComponent(8, "" + component8.intValue());
    }
    return this;
}

From source file:com.prowidesoftware.swift.model.field.Field59F.java

/**
 * Set the component2 from a Number object.
 * <br />/*from w w w.j  a v  a2 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 setComponent2(String) 
 * method.
 * 
 * @see #setComponent2(String)
 *
 * @param component2 the Number with the component2 content to set
 */
public Field59F setComponent2(java.lang.Number component2) {
    if (component2 != null) {
        setComponent(2, "" + component2.intValue());
    }
    return this;
}

From source file:com.prowidesoftware.swift.model.field.Field59F.java

/**
 * Set the component4 from a Number object.
 * <br />/*from   w w w . ja 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 Field59F setComponent4(java.lang.Number component4) {
    if (component4 != null) {
        setComponent(4, "" + component4.intValue());
    }
    return this;
}

From source file:com.prowidesoftware.swift.model.field.Field59F.java

/**
 * Set the component6 from a Number object.
 * <br />//w  ww.j a 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 setComponent6(String) 
 * method.
 * 
 * @see #setComponent6(String)
 *
 * @param component6 the Number with the component6 content to set
 */
public Field59F setComponent6(java.lang.Number component6) {
    if (component6 != null) {
        setComponent(6, "" + component6.intValue());
    }
    return this;
}

From source file:com.prowidesoftware.swift.model.field.Field59F.java

/**
 * Set the component8 from a Number object.
 * <br />//  w  w w  .  j a va2s .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 setComponent8(String) 
 * method.
 * 
 * @see #setComponent8(String)
 *
 * @param component8 the Number with the component8 content to set
 */
public Field59F setComponent8(java.lang.Number component8) {
    if (component8 != null) {
        setComponent(8, "" + component8.intValue());
    }
    return this;
}