Example usage for android.util Log DEBUG

List of usage examples for android.util Log DEBUG

Introduction

In this page you can find the example usage for android.util Log DEBUG.

Prototype

int DEBUG

To view the source code for android.util Log DEBUG.

Click Source Link

Document

Priority constant for the println method; use Log.d.

Usage

From source file:com.joptimizer.solvers.BasicKKTSolver.java

/**
 * Returns the two vectors v and w./*from w  w w  . j  av a 2  s .  c o m*/
 */
@Override
public double[][] solve() throws Exception {

    RealVector v = null;// dim equals cols of A
    RealVector w = null;// dim equals rank of A

    if (Log.isLoggable(MainActivity.JOPTIMIZER_LOGTAG, Log.DEBUG)) {
        Log.d(MainActivity.JOPTIMIZER_LOGTAG, "H: " + ArrayUtils.toString(H.getData()));
        Log.d(MainActivity.JOPTIMIZER_LOGTAG, "g: " + ArrayUtils.toString(g.toArray()));
    }
    RealMatrix HInv;
    try {
        HInv = Utils.squareMatrixInverse(H);
    } catch (SingularMatrixException e) {
        HInv = null;
    }

    if (HInv != null) {
        // Solving KKT system via elimination
        if (A != null) {
            if (Log.isLoggable(MainActivity.JOPTIMIZER_LOGTAG, Log.DEBUG)) {
                Log.d(MainActivity.JOPTIMIZER_LOGTAG, "A: " + ArrayUtils.toString(A.getData()));
                if (h != null) {
                    Log.d(MainActivity.JOPTIMIZER_LOGTAG, "h: " + ArrayUtils.toString(h.toArray()));
                }
            }
            RealMatrix AHInv = A.multiply(HInv);
            RealMatrix MenoS = AHInv.multiply(AT);
            RealMatrix MenoSInv = Utils.squareMatrixInverse(MenoS);
            if (h == null || Double.compare(h.getNorm(), 0.) == 0) {
                w = MenoSInv.operate(AHInv.operate(g)).mapMultiply(-1.);
            } else {
                w = MenoSInv.operate(h.subtract(AHInv.operate(g)));
            }
            v = HInv.operate(g.add(AT.operate(w)).mapMultiply(-1.));
        } else {
            w = null;
            v = HInv.operate(g).mapMultiply(-1.);
        }
    } else {
        // Solving the full KKT system
        if (A != null) {
            KKTSolver kktSolver = new BasicKKTSolver();
            kktSolver.setCheckKKTSolutionAccuracy(false);
            double[][] fullSol = this.solveFullKKT(new BasicKKTSolver());
            v = new ArrayRealVector(fullSol[0]);
            w = new ArrayRealVector(fullSol[1]);
        } else {
            //@TODO: try with rescaled H
            throw new Exception("KKT solution failed");
        }
    }

    // solution checking
    if (this.checkKKTSolutionAccuracy && !this.checkKKTSolutionAccuracy(v, w)) {
        Log.e(MainActivity.JOPTIMIZER_LOGTAG, "KKT solution failed");
        throw new Exception("KKT solution failed");
    }

    double[][] ret = new double[2][];
    ret[0] = v.toArray();
    ret[1] = (w != null) ? w.toArray() : null;
    return ret;
}

From source file:com.cbsb.ftpserv.Util.java

public static String ipToString(int addr, String sep) {
    //myLog.l(Log.DEBUG, "IP as int: " + addr);
    if (addr > 0) {
        StringBuffer buf = new StringBuffer();
        buf.append(byteOfInt(addr, 0)).append(sep).append(byteOfInt(addr, 1)).append(sep)
                .append(byteOfInt(addr, 2)).append(sep).append(byteOfInt(addr, 3));
        myLog.l(Log.DEBUG, "ipToString returning: " + buf.toString());
        return buf.toString();
    } else {//from   www.j av  a 2s .  com
        return null;
    }
}

From source file:org.swift.ftp.Util.java

public static String ipToString(int addr, String sep) {
    // myLog.l(Log.DEBUG, "IP as int: " + addr);
    if (addr > 0) {
        StringBuffer buf = new StringBuffer();
        buf.append(byteOfInt(addr, 0)).append(sep).append(byteOfInt(addr, 1)).append(sep)
                .append(byteOfInt(addr, 2)).append(sep).append(byteOfInt(addr, 3));
        myLog.l(Log.DEBUG, "ipToString returning: " + buf.toString());
        return buf.toString();
    } else {//from  w  w w.j  a  v  a 2 s  .  co m
        return null;
    }
}

From source file:com.github.mguidi.asyncop.AsyncOp.java

protected final void dispatchResult() {
    Intent intent = new Intent(mIdHelper);
    intent.putExtra(Constants.ARGS_ID_REQUEST, mIdRequest);
    intent.putExtra(Constants.ARGS_ARGS, mArgs);
    intent.putExtra(Constants.ARGS_RESULTS, mResult);

    if (!LocalBroadcastManager.getInstance(mContext).sendBroadcast(intent)) {
        if (Log.isLoggable(Constants.LOG_TAG, Log.DEBUG)) {
            Log.d(Constants.LOG_TAG, "dispatch result missed");
        }/*from   w  w w . j av  a  2 s. com*/
    }
}

From source file:com.example.android.wearable.timer.TimerNotificationService.java

@Override
protected void onHandleIntent(Intent intent) {
    if (Log.isLoggable(TAG, Log.DEBUG)) {
        Log.d(TAG, "onHandleIntent called with intent: " + intent);
    }//from ww  w. j  a  v a  2  s  . com
    String action = intent.getAction();
    if (Constants.ACTION_SHOW_ALARM.equals(action)) {
        showTimerDoneNotification();
    } else if (Constants.ACTION_DELETE_ALARM.equals(action)) {
        deleteTimer();
    } else if (Constants.ACTION_RESTART_ALARM.equals(action)) {
        restartAlarm();
    } else {
        throw new IllegalStateException("Undefined constant used: " + action);
    }
}

From source file:org.fs.todo.views.adapters.StateToDoAdapter.java

private void log(String msg) {
    log(Log.DEBUG, msg);
}

From source file:com.example.android.elizachat.ResponderService.java

@Override
public void onCreate() {
    super.onCreate();
    if (Log.isLoggable(TAG, Log.DEBUG)) {
        Log.d(TAG, "Chat Service started");
    }/*www  .  jav a2s  .  c  om*/
    mResponder = new ElizaResponder();
    mBroadcastManager = LocalBroadcastManager.getInstance(this);
    processIncoming(null);
}

From source file:com.DGSD.Teexter.UI.Recipient.RecipientAlternatesAdapter.java

/**
 * Get a HashMap of address to RecipientEntry that contains all contact
 * information for a contact with the provided address, if one exists. This
 * may block the UI, so run it in an async task.
 * //  w w  w.  j  a v  a  2  s .  c  o  m
 * @param context
 *            Context.
 * @param inAddresses
 *            Array of addresses on which to perform the lookup.
 * @return HashMap<String,RecipientEntry>
 */
public static HashMap<String, RecipientEntry> getMatchingRecipients(Context context, String[] inAddresses) {
    int addressesSize = Math.min(MAX_LOOKUPS, inAddresses.length);
    String[] addresses = new String[addressesSize];
    StringBuilder bindString = new StringBuilder();
    // Create the "?" string and set up arguments.
    for (int i = 0; i < addressesSize; i++) {
        Rfc822Token[] tokens = Rfc822Tokenizer.tokenize(inAddresses[i].toLowerCase());
        addresses[i] = (tokens.length > 0 ? tokens[0].getAddress() : inAddresses[i]);
        bindString.append("?");
        if (i < addressesSize - 1) {
            bindString.append(",");
        }
    }

    if (Log.isLoggable(TAG, Log.DEBUG)) {
        Log.d(TAG, "Doing reverse lookup for " + addresses.toString());
    }

    HashMap<String, RecipientEntry> recipientEntries = new HashMap<String, RecipientEntry>();
    Cursor c = context.getContentResolver().query(Phone.CONTENT_URI, EmailQuery.PROJECTION,
            Email.ADDRESS + " IN (" + bindString.toString() + ")", addresses, null);
    if (c != null) {
        try {
            if (c.moveToFirst()) {
                do {
                    String address = c.getString(EmailQuery.ADDRESS);
                    recipientEntries.put(address,
                            RecipientEntry.constructTopLevelEntry(c.getString(EmailQuery.NAME),
                                    c.getString(EmailQuery.ADDRESS), c.getInt(EmailQuery.ADDRESS_TYPE),
                                    c.getString(EmailQuery.ADDRESS_LABEL), c.getLong(EmailQuery.CONTACT_ID),
                                    c.getLong(EmailQuery.DATA_ID),
                                    c.getString(EmailQuery.PHOTO_THUMBNAIL_URI)));
                    if (Log.isLoggable(TAG, Log.DEBUG)) {
                        Log.d(TAG,
                                "Received reverse look up information for " + address + " RESULTS: "
                                        + " NAME : " + c.getString(EmailQuery.NAME) + " CONTACT ID : "
                                        + c.getLong(EmailQuery.CONTACT_ID) + " ADDRESS :"
                                        + c.getString(EmailQuery.ADDRESS));
                    }
                } while (c.moveToNext());
            }
        } finally {
            c.close();
        }
    }
    return recipientEntries;
}

From source file:com.example.android.common.logger.LogView.java

/**
 * Formats the log data and prints it out to the LogView.
 * @param priority Log level of the data being logged.  Verbose, Error, etc.
 * @param tag Tag for for the log data.  Can be used to organize log statements.
 * @param msg The actual message to be logged. The actual message to be logged.
 * @param tr If an exception was thrown, this can be sent along for the logging facilities
 *           to extract and print useful information.
 *//*from   w w w  .  j a  v a  2 s. com*/
@Override
public void println(int priority, String tag, String msg, Throwable tr) {

    String priorityStr = null;

    // For the purposes of this View, we want to print the priority as readable text.
    switch (priority) {
    case android.util.Log.VERBOSE:
        priorityStr = "VERBOSE";
        break;
    case android.util.Log.DEBUG:
        priorityStr = "DEBUG";
        break;
    case android.util.Log.INFO:
        priorityStr = "INFO";
        break;
    case android.util.Log.WARN:
        priorityStr = "WARN";
        break;
    case android.util.Log.ERROR:
        priorityStr = "ERROR";
        break;
    case android.util.Log.ASSERT:
        priorityStr = "ASSERT";
        break;
    default:
        break;
    }

    // Handily, the Log class has a facility for converting a stack trace into a usable string.
    String exceptionStr = null;
    if (tr != null) {
        exceptionStr = android.util.Log.getStackTraceString(tr);
    }

    // Take the priority, tag, message, and exception, and concatenate as necessary
    // into one usable line of text.
    final StringBuilder outputBuilder = new StringBuilder();

    String delimiter = "\t";
    appendIfNotNull(outputBuilder, priorityStr, delimiter);
    appendIfNotNull(outputBuilder, tag, delimiter);
    appendIfNotNull(outputBuilder, msg, delimiter);
    appendIfNotNull(outputBuilder, exceptionStr, delimiter);

    // In case this was originally called from an AsyncTask or some other off-UI thread,
    // make sure the update occurs within the UI thread.
    ((Activity) getContext()).runOnUiThread((new Thread(new Runnable() {
        @Override
        public void run() {
            // Display the text we just generated within the LogView.
            appendToLog(outputBuilder.toString());
        }
    })));

    if (mNext != null) {
        mNext.println(priority, tag, msg, tr);
    }
}

From source file:com.example.android.wearable.timer.SetTimerActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    int paramLength = getIntent().getIntExtra(AlarmClock.EXTRA_LENGTH, 0);
    if (Log.isLoggable(TAG, Log.DEBUG)) {
        Log.d(TAG, "SetTimerActivity:onCreate=" + paramLength);
    }/*from   www. j av a 2s .  c  o  m*/
    if (paramLength > 0 && paramLength <= 86400) {
        long durationMillis = paramLength * 1000;
        setupTimer(durationMillis);
        finish();
        return;
    }

    Resources res = getResources();
    for (int i = 0; i < NUMBER_OF_TIMES; i++) {
        mTimeOptions[i] = new ListViewItem(res.getQuantityString(R.plurals.timer_minutes, i + 1, i + 1),
                (i + 1) * 60 * 1000);
    }

    setContentView(R.layout.timer_set_timer);

    // Initialize a simple list of countdown time options.
    mListView = (ListView) findViewById(R.id.times_list_view);
    ArrayAdapter<ListViewItem> arrayAdapter = new ArrayAdapter<ListViewItem>(this,
            android.R.layout.simple_list_item_1, mTimeOptions);
    mListView.setAdapter(arrayAdapter);
    mListView.setOnItemClickListener(this);

    mGoogleApiClient = new GoogleApiClient.Builder(this).addApi(Wearable.API).addConnectionCallbacks(this)
            .addOnConnectionFailedListener(this).build();
}