Example usage for java.lang Long MIN_VALUE

List of usage examples for java.lang Long MIN_VALUE

Introduction

In this page you can find the example usage for java.lang Long MIN_VALUE.

Prototype

long MIN_VALUE

To view the source code for java.lang Long MIN_VALUE.

Click Source Link

Document

A constant holding the minimum value a long can have, -263.

Usage

From source file:gxu.software_engineering.market.android.ui.LoginBoxFragment.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    final View loginForm = getActivity().getLayoutInflater().inflate(R.layout.login, null);
    return new AlertDialog.Builder(getActivity(), android.R.style.Theme_Holo_Dialog)
            .setIcon(R.drawable.social_person).setTitle(R.string.login).setView(loginForm)
            .setNegativeButton(R.string.no, null).setPositiveButton(R.string.ok, new OnClickListener() {
                @Override/*  w  ww .  ja v a  2s .  c o  m*/
                public void onClick(DialogInterface dialog, int which) {
                    app = MarketApp.marketApp();

                    EditText e1 = (EditText) loginForm.findViewById(R.id.account);
                    final String account = e1.getEditableText().toString();
                    EditText e2 = (EditText) loginForm.findViewById(R.id.password);
                    final String password = e2.getEditableText().toString();

                    new Handler().post(new Runnable() {
                        @Override
                        public void run() {
                            Long uid = Long.MIN_VALUE;
                            try {
                                uid = new Login().execute(account, password).get();
                            } catch (Exception e) {
                                Toast.makeText(getActivity(), R.string.login_fail, Toast.LENGTH_SHORT).show();
                                return;
                            }

                            if (uid > 0) {
                                Log.i("login pwd!!!", password);
                                app.setLoginInfo(uid, account, password);
                            }

                            if (app.hasLogedIn()) {
                                Toast.makeText(getActivity(), R.string.login_ok, Toast.LENGTH_SHORT).show();
                                getActivity()
                                        .startActivity(new Intent(getActivity(), UserServiceActivity.class));
                            } else {
                                Toast.makeText(getActivity(), R.string.wrong_login_info, Toast.LENGTH_SHORT)
                                        .show();
                            }
                        }
                    });
                }
            }).create();
}

From source file:com.opengamma.util.timeseries.fast.longint.FastArrayLongDoubleTimeSeries.java

public FastArrayLongDoubleTimeSeries(final DateTimeNumericEncoding encoding, final List<Long> times,
        final List<Double> values) {
    super(encoding);
    if (times.size() != values.size()) {
        throw new IllegalArgumentException("lists are of different sizes");
    }/*ww  w . ja va2s  .  c o  m*/
    _times = new long[times.size()];
    _values = new double[values.size()];
    final Iterator<Double> iter = values.iterator();
    int i = 0;
    long maxTime = Long.MIN_VALUE; // for checking the dates are sorted.
    for (final long time : times) {
        final double value = iter.next();
        if (maxTime < time) {
            _times[i] = time;
            _values[i] = value;
            maxTime = time;
        } else {
            throw new IllegalArgumentException("dates must be ordered");
        }
        i++;
    }
}

From source file:com.nridge.core.io.gson.RangeJSON.java

/**
 * Parses an JSON stream and loads it into a field range.
 *
 * @param aReader Json reader stream instance.
 *
 * @throws java.io.IOException I/O related exception.
 *//* w  ww.  java 2s. com*/
public FieldRange load(JsonReader aReader) throws IOException {
    String jsonName;

    boolean isFirst = true;
    Date firstDate = new Date();
    long firstLong = Long.MIN_VALUE;
    int firstInt = Integer.MIN_VALUE;
    double firstDouble = Double.MIN_VALUE;

    Field.Type rangeType = Field.Type.Text;
    FieldRange fieldRange = new FieldRange();

    aReader.beginObject();
    while (aReader.hasNext()) {
        jsonName = aReader.nextName();
        if (StringUtils.equals(jsonName, IO.JSON_TYPE_MEMBER_NAME))
            rangeType = Field.stringToType(aReader.nextString());
        else if (StringUtils.equals(jsonName, IO.JSON_DELIMITER_MEMBER_NAME))
            fieldRange.setDelimiterChar(aReader.nextString());
        else if (StringUtils.equals(jsonName, IO.JSON_VALUE_MEMBER_NAME))
            fieldRange.setItems(StrUtl.expandToList(aReader.nextString(), fieldRange.getDelimiterChar()));
        else if (StringUtils.equals(jsonName, "min")) {
            switch (rangeType) {
            case Long:
                if (isFirst) {
                    isFirst = false;
                    firstLong = aReader.nextLong();
                } else
                    fieldRange = new FieldRange(aReader.nextLong(), firstLong);
                break;
            case Integer:
                if (isFirst) {
                    isFirst = false;
                    firstInt = aReader.nextInt();
                } else
                    fieldRange = new FieldRange(aReader.nextInt(), firstInt);
                break;
            case Double:
                if (isFirst) {
                    isFirst = false;
                    firstDouble = aReader.nextDouble();
                } else
                    fieldRange = new FieldRange(aReader.nextDouble(), firstDouble);
                break;
            case DateTime:
                if (isFirst) {
                    isFirst = false;
                    firstDate = Field.createDate(aReader.nextString());
                } else
                    fieldRange = new FieldRange(Field.createDate(aReader.nextString()), firstDate);
                break;
            default:
                aReader.skipValue();
                break;
            }
        } else if (StringUtils.equals(jsonName, "max")) {
            switch (rangeType) {
            case Long:
                if (isFirst) {
                    isFirst = false;
                    firstLong = aReader.nextLong();
                } else
                    fieldRange = new FieldRange(firstLong, aReader.nextLong());
                break;
            case Integer:
                if (isFirst) {
                    isFirst = false;
                    firstInt = aReader.nextInt();
                } else
                    fieldRange = new FieldRange(firstInt, aReader.nextInt());
                break;
            case Double:
                if (isFirst) {
                    isFirst = false;
                    firstDouble = aReader.nextDouble();
                } else
                    fieldRange = new FieldRange(firstDouble, aReader.nextDouble());
                break;
            case DateTime:
                if (isFirst) {
                    isFirst = false;
                    firstDate = Field.createDate(aReader.nextString());
                } else
                    fieldRange = new FieldRange(firstDate, Field.createDate(aReader.nextString()));
                break;
            default:
                aReader.skipValue();
                break;
            }
        } else
            aReader.skipValue();
    }

    aReader.endObject();

    return fieldRange;
}

From source file:com.sillelien.dollar.api.types.DollarInfinity.java

@Override
public var $as(@NotNull Type type) {
    if (type.equals(Type.BOOLEAN)) {
        return DollarStatic.$(true);
    } else if (type.equals(Type.STRING)) {
        return DollarStatic.$(positive ? "infinity" : "-infinity");
    } else if (type.equals(Type.LIST)) {
        return DollarStatic.$(Arrays.asList(this));
    } else if (type.equals(Type.MAP)) {
        return DollarStatic.$("value", this);
    } else if (type.equals(Type.DECIMAL)) {
        return DollarStatic.$(positive ? Double.MAX_VALUE : Double.MIN_VALUE);
    } else if (type.equals(Type.INTEGER)) {
        return DollarStatic.$(positive ? Long.MAX_VALUE : Long.MIN_VALUE);
    } else if (type.equals(Type.VOID)) {
        return $void();
    } else if (type.equals(Type.DATE)) {
        return this;
    } else if (type.equals(Type.RANGE)) {
        return DollarFactory.fromValue(new Range($(0), $(0)));
    } else {//w w w.  j  av a 2 s  .c  o  m
        return DollarFactory.failure(ErrorType.INVALID_CAST, type.toString(), false);
    }
}

From source file:com.tc.object.ApplicatorDNAEncodingTest.java

public void testNonPrimitiveArrays() throws Exception {
    final TCByteBufferOutputStream output = new TCByteBufferOutputStream();

    final Object[] array = new Object[] { new ObjectID(12), new Integer(34), new Double(Math.PI),
            ObjectID.NULL_ID, new Long(Long.MIN_VALUE + 34), "timmy" };

    final DNAEncoding encoding = getApplicatorEncoding();
    encoding.encodeArray(array, output);

    final TCByteBufferInputStream input = new TCByteBufferInputStream(output.toArray());

    assertTrue(Arrays.equals(array, (Object[]) encoding.decode(input)));

    assertEquals(0, input.available());/*from   w  w w  .  j  a v a 2  s.  c  o m*/
}

From source file:com.linkedin.pinot.core.query.utils.SimpleSegmentMetadata.java

@Override
public long getPushTime() {
    return Long.MIN_VALUE;
}

From source file:com.cinnober.msgcodec.json.JsonValueHandlerTest.java

@Test
public void testSafeInt64EncodeMinValue() throws IOException {
    StringWriter out = new StringWriter();
    JsonGenerator g = f.createGenerator(out);

    JsonValueHandler.INT64_SAFE.writeValue(Long.MIN_VALUE, g);
    g.flush();//from ww  w  .  j a  va2s .co m
    assertEquals("\"-9223372036854775808\"", out.toString());
}

From source file:com.gsma.mobileconnect.impl.ParseIDTokenTest.java

@Test
public void parseIDToken_withExpiredDiscoveryResponse_shouldThrowDiscoveryResponseExpiredException()
        throws OIDCException, DiscoveryResponseExpiredException {
    // GIVEN//from w w w. j  a  v a2s  . c  o  m
    IOIDC oidc = Factory.getOIDC(null);
    CaptureParsedIdToken captureParsedIdToken = new CaptureParsedIdToken();
    DiscoveryResponse discoveryResponse = new DiscoveryResponse(true, new Date(Long.MIN_VALUE), 0, null,
            buildJsonNode());

    // THEN
    thrown.expect(DiscoveryResponseExpiredException.class);
    thrown.expectMessage(containsString("discoveryResult"));

    // WHEN
    oidc.parseIDToken(discoveryResponse, "", null, captureParsedIdToken);
}

From source file:eu.stratosphere.nephele.io.channels.DistributedChannelWithAccessInfo.java

@Override
public int decrementReferences() {

    int current = this.referenceCounter.get();
    while (true) {
        if (current <= 0) {
            // this is actually an error case, because the channel was deleted before
            throw new IllegalStateException("The references to the file were already at zero.");
        }/*from   ww w.  jav a 2 s .c o m*/

        if (current == 1) {
            // this call decrements to zero, so mark it as deleted
            if (this.referenceCounter.compareAndSet(current, Integer.MIN_VALUE)) {
                current = 0;
                break;
            }
        } else if (this.referenceCounter.compareAndSet(current, current - 1)) {
            current = current - 1;
            break;
        }
        current = this.referenceCounter.get();
    }

    if (current > 0) {
        return current;
    } else if (current == 0) {
        // delete the channel
        this.referenceCounter.set(Integer.MIN_VALUE);
        this.reservedWritePosition.set(Long.MIN_VALUE);
        try {
            this.channel.close();
            if (this.deleteOnClose.get()) {
                this.fs.delete(this.checkpointFile, false);
            }

        } catch (IOException ioex) {
            if (LOG.isErrorEnabled()) {
                LOG.error("Error while closing spill file for file buffers: " + ioex.getMessage(), ioex);
            }
        }
        return current;
    } else {
        throw new IllegalStateException("The references to the file were already at zero.");
    }
}

From source file:de.innovationgate.wgpublisher.webtml.portlet.PortletEvent.java

/**
 * Constructor. Just for internal WGA use.
 * @param name Name of the event/*from www .java 2  s.com*/
 * @param compliance Compliance of the originating WGA design
 */
public PortletEvent(String name, Version compliance) {
    if (name.indexOf("\"") != -1) {
        throw new IllegalArgumentException("Doublequotes in event names are not supported.");
    }
    _name = name;
    _parameters = new HashMap<String, Object>();
    _index = Long.MIN_VALUE;
    _compliance = compliance;
}