text:
package jast

import (
	"encoding/json"

	"github.com/infobloxopen/themis/jparser"
	"github.com/infobloxopen/themis/pdp"
)

func (ctx context) unmarshalObligationItem(d *json.Decoder) (pdp.AttributeAssignmentExpression, error) {
	var (
		a pdp.Attribute
		e pdp.AttributeValue
	)

	if err := jparser.UnmarshalObject(d, func(k string, d *json.Decoder) error {
		var (
			ok  bool
			err error
		)

		a, ok = ctx.attrs[k]
		if !ok {
			return newUnknownAttributeError(k)
		}

		e, err = ctx.unmarshalValueByType(a.GetType(), d)
		if err != nil {
			return bindError(err, k)
		}

		return nil
	}, "obligation"); err != nil {
		return pdp.AttributeAssignmentExpression{}, err
	}

	return pdp.MakeAttributeAssignmentExpression(a, e), nil
}

func (ctx *context) unmarshalObligations(d *json.Decoder) ([]pdp.AttributeAssignmentExpression, error) {
	if err := jparser.CheckArrayStart(d, "obligations"); err != nil {
		return nil, err
	}

	r := []pdp.AttributeAssignmentExpression{}
	if err := jparser.UnmarshalObjectArray(d, func(idx int, d *json.Decoder) error {
		o, err := ctx.unmarshalObligationItem(d)
		if err != nil {
			return bindErrorf(err, "%d", idx)
		}

		r = append(r, o)

		return nil
	}, "obligations"); err != nil {
		return nil, err
	}

	return r, nil
}


text:
using System;
using Microsoft.AspNet.Mvc;

namespace SystemCheck.Compiler.Preprocess
{
    public class RazorPreCompilation : RazorPreCompileModule
    {
        public RazorPreCompilation(IServiceProvider provider) : base(provider)
        {
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
<?php
/**
 * Roots configuration and constants
 */
add_theme_support('root-relative-urls');    // Enable relative URLs
add_theme_support('rewrite-urls');          // Enable URL rewrites
add_theme_support('h5bp-htaccess');         // Enable HTML5 Boilerplate's .htaccess
add_theme_support('bootstrap-top-navbar');  // Enable Bootstrap's fixed navbar

// Define which pages shouldn't have the sidebar
function roots_sidebar() {
  if (is_404() || is_page_template('page-custom.php')) {
    return false;
  } else {
    return true;
  }
}

// #main CSS classes
function roots_main_class() {
  if (roots_sidebar()) {
    echo 'span8';
  } else {
    echo 'span12';
  }
}

// #sidebar CSS classes
function roots_sidebar_class() {
  echo 'span4';
}

$get_theme_name = explode('/themes/', get_template_directory());
define('GOOGLE_ANALYTICS_ID',       ''); // UA-XXXXX-Y
define('POST_EXCERPT_LENGTH',       40);
define('WP_BASE',                   wp_base_dir());
define('THEME_NAME',                next($get_theme_name));
define('RELATIVE_PLUGIN_PATH',      str_replace(site_url() . '/', '', plugins_url()));
define('FULL_RELATIVE_PLUGIN_PATH', WP_BASE . '/' . RELATIVE_PLUGIN_PATH);
define('RELATIVE_CONTENT_PATH',     str_replace(site_url() . '/', '', content_url()));
define('THEME_PATH',                RELATIVE_CONTENT_PATH . '/themes/' . THEME_NAME);

// Set the content width based on the theme's design and stylesheet
if (!isset($content_width)) { $content_width = 940; }


text:
<?php

require_once __DIR__ . '/vendor/Primer/Loader.php';
require_once __DIR__ . '/vendor/Twig/Autoloader.php';
\Twig_Autoloader::register();
\Primer\Loader::register();


text:
package androidx.car.app.navigation.model;

import static androidx.car.app.model.constraints.ActionsConstraints.ACTIONS_CONSTRAINTS_MAP;
import static androidx.car.app.model.constraints.ActionsConstraints.ACTIONS_CONSTRAINTS_NAVIGATION;
import static androidx.car.app.model.constraints.CarColorConstraints.UNCONSTRAINED;

import static java.util.Objects.requireNonNull;

import android.annotation.SuppressLint;

import androidx.annotation.Keep;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.car.app.Screen;
import androidx.car.app.SurfaceCallback;
import androidx.car.app.annotations.CarProtocol;
import androidx.car.app.annotations.RequiresCarApi;
import androidx.car.app.model.Action;
import androidx.car.app.model.ActionStrip;
import androidx.car.app.model.CarColor;
import androidx.car.app.model.Template;
import androidx.car.app.model.Toggle;

import java.util.Objects;

/**
 * A template for showing navigation information.
 *
 *
This template has two independent sections which can be updated:
 *
 *

 *
Navigation information such as routing instructions or navigation-related messages.
 *
Travel estimates to the destination.
 *

 *
 *
To update the template as the user navigates, call {@link Screen#invalidate} to provide the
 * host with a new template with the updated information.
 *
 *
The template itself does not expose a drawing surface. In order to draw on the canvas, use
 * {@link androidx.car.app.AppManager#setSurfaceCallback(SurfaceCallback)}.
 *
 *
See {@link androidx.car.app.notification.CarAppExtender} for how to show
 * alerts with notifications. Frequent alert notifications distract the driver and are discouraged.
 *
 *
Pan and Zoom

 *
 * This template allows an app to provide pan and zoom functionality. To support pan and zoom,
 * respond to the user input in {@link SurfaceCallback} methods, such as:
 *
 *

 *
{@link SurfaceCallback#onScroll(float, float)}

 *
{@link SurfaceCallback#onFling(float, float)}

 *
{@link SurfaceCallback#onScale(float, float, float)}

 *

 *
 * In order to receive the callbacks, add an {@link Action#PAN} button in a map
 * {@link ActionStrip} via the {@link Builder#setMapActionStrip(ActionStrip)} method:
 *
 *
{@code
 * ...
 * Action panAction = new Action.Builder(Action.PAN).setIcon(myPanIcon).build();
 * ActionStrip mapActionStrip = new ActionStrip.Builder().addAction(panAction).build();
 * NavigationTemplate.Builder builder = new NavigationTemplate.Builder();
 * builder.setMapActionStrip(mapActionStrip);
 * ...
 * }

 *
 * When the user presses the {@link Action#PAN} button, the host enters the pan mode. In this
 * mode, the host translates the user input from non-touch input devices, such as rotary controllers
 * and touchpads, and calls the appropriate {@link SurfaceCallback} methods. Respond to the user
 * action to enter or exit the pan mode via {@link Builder#setPanModeListener(PanModeListener)}.
 *
 *
If the app does not include this button in the map {@link ActionStrip}, the app will not
 * receive the user input for panning gestures from {@link SurfaceCallback} methods, and the host
 * will exit any previously activated pan mode.
 *
 *
The host may hide the pan button in some head units in which the user does not need it.
 * Also, the host may hide other UI components in the template while the user is in the pan mode.
 *
 *
Note that not all head units support touch gestures, and not all touch screens support
 * multi-touch gestures. Therefore, some {@link SurfaceCallback} methods may not be called in
 * some cars. In order to support different head units, use the buttons in the map action strip
 * to provide necessary functionality, such as the zoom-in and zoom-out buttons.
 *
 *
Template Restrictions

 *
 * In regard to template refreshes, as described in {@link Screen#onGetTemplate()}, this template
 * supports any content changes as refreshes. This allows apps to interactively update the
 * turn-by-turn instructions without the templates being counted against the template quota.
 *
 *
Further, this template is considered a view that the user will stay and consume contents from,
 * and the host will reset the template quota once an app reaches this template.
 *
 *
In order to use this template your car app MUST declare that it uses the {@code
 * androidx.car.app.NAVIGATION_TEMPLATES} permission in the manifest.
 */
@CarProtocol
public final class NavigationTemplate implements Template {

    /**
     * Represents navigation information such as routing instructions or navigation-related
     * messages.
     */
    public interface NavigationInfo {
    }

    @Keep
    @Nullable
    private final NavigationInfo mNavigationInfo;
    @Keep
    @Nullable
    private final CarColor mBackgroundColor;
    @Keep
    @Nullable
    private final TravelEstimate mDestinationTravelEstimate;
    @Keep
    @Nullable
    private final ActionStrip mActionStrip;
    @Keep
    @Nullable
    private final ActionStrip mMapActionStrip;
    @Keep
    @Nullable
    private final Toggle mPanModeToggle;
    @Keep
    @Nullable
    private final PanModeDelegate mPanModeDelegate;

    /**
     * Returns the {@link ActionStrip} for this template or {@code null} if not set.
     *
     * @see Builder#setActionStrip(ActionStrip)
     */
    @Nullable
    public ActionStrip getActionStrip() {
        return requireNonNull(mActionStrip);
    }

    /**
     * Returns the map {@link ActionStrip} for this template or {@code null} if not set.
     *
     * @see Builder#setMapActionStrip(ActionStrip)
     */
    @RequiresCarApi(2)
    @Nullable
    public ActionStrip getMapActionStrip() {
        return mMapActionStrip;
    }

    /**
     * Returns whether this template is in the pan mode.
     *
     * @deprecated use {@link #getPanModeDelegate()}
     */
    // TODO(b/187989940): remove after hosts switch over to using getPanModeDelegate/
    @Deprecated
    @RequiresCarApi(2)
    @Nullable
    public Toggle getPanModeToggle() {
        return mPanModeToggle;
    }

    /**
     * Returns the {@link PanModeDelegate} that should be called when the user interacts with
     * pan mode on this template, or {@code null} if a {@link PanModeListener} was not set.
     */
    @RequiresCarApi(2)
    @Nullable
    public PanModeDelegate getPanModeDelegate() {
        return mPanModeDelegate;
    }

    /**
     * Returns the navigation information displayed on the template or {@code null} if there is no
     * navigation information on top of the map.
     */
    @Nullable
    public NavigationInfo getNavigationInfo() {
        return mNavigationInfo;
    }

    /**
     * Returns the background color used for the navigation information or {@code null} if set to
     * the default value.
     */
    @Nullable
    public CarColor getBackgroundColor() {
        return mBackgroundColor;
    }

    /**
     * Returns the {@link TravelEstimate} to the final destination or {@code null} if there is no
     * travel estimate information.
     */
    @Nullable
    public TravelEstimate getDestinationTravelEstimate() {
        return mDestinationTravelEstimate;
    }

    @NonNull
    @Override
    public String toString() {
        return "NavigationTemplate";
    }

    @Override
    public int hashCode() {
        return Objects.hash(mNavigationInfo, mBackgroundColor, mDestinationTravelEstimate,
                mActionStrip, mMapActionStrip, mPanModeToggle, mPanModeDelegate == null);
    }

    @Override
    public boolean equals(@Nullable Object other) {
        if (this == other) {
            return true;
        }
        if (!(other instanceof NavigationTemplate)) {
            return false;
        }
        NavigationTemplate otherTemplate = (NavigationTemplate) other;

        return Objects.equals(mNavigationInfo, otherTemplate.mNavigationInfo)
                && Objects.equals(mBackgroundColor, otherTemplate.mBackgroundColor)
                && Objects.equals(mDestinationTravelEstimate,
                otherTemplate.mDestinationTravelEstimate)
                && Objects.equals(mActionStrip, otherTemplate.mActionStrip)
                && Objects.equals(mMapActionStrip, otherTemplate.mMapActionStrip)
                && Objects.equals(mPanModeToggle, otherTemplate.mPanModeToggle)
                && Objects.equals(mPanModeDelegate == null, otherTemplate.mPanModeDelegate == null);
    }

    NavigationTemplate(Builder builder) {
        mNavigationInfo = builder.mNavigationInfo;
        mBackgroundColor = builder.mBackgroundColor;
        mDestinationTravelEstimate = builder.mDestinationTravelEstimate;
        mActionStrip = builder.mActionStrip;
        mMapActionStrip = builder.mMapActionStrip;
        mPanModeToggle = builder.mPanModeToggle;
        mPanModeDelegate = builder.mPanModeDelegate;
    }

    /** Constructs an empty instance, used by serialization code. */
    private NavigationTemplate() {
        mNavigationInfo = null;
        mBackgroundColor = null;
        mDestinationTravelEstimate = null;
        mActionStrip = null;
        mMapActionStrip = null;
        mPanModeToggle = null;
        mPanModeDelegate = null;
    }

    /** A builder of {@link NavigationTemplate}. */
    public static final class Builder {
        @Nullable
        NavigationInfo mNavigationInfo;
        @Nullable
        CarColor mBackgroundColor;
        @Nullable
        TravelEstimate mDestinationTravelEstimate;
        @Nullable
        ActionStrip mActionStrip;
        @Nullable
        ActionStrip mMapActionStrip;
        @Nullable
        Toggle mPanModeToggle;
        @Nullable
        PanModeDelegate mPanModeDelegate;

        /**
         * Sets the navigation information to display on the template.
         *
         *
Unless set with this method, navigation info won't be displayed on the template.
         *
         * @throws NullPointerException if {@code navigationInfo} is {@code null}
         */
        @NonNull
        public Builder setNavigationInfo(@NonNull NavigationInfo navigationInfo) {
            mNavigationInfo = requireNonNull(navigationInfo);
            return this;
        }

        /**
         * Sets the background color to use for the navigation information.
         *
         *
Depending on contrast requirements, capabilities of the vehicle screens, or other
         * factors, the color may be ignored by the host or overridden by the vehicle system.
         */
        @NonNull
        public Builder setBackgroundColor(@NonNull CarColor backgroundColor) {
            UNCONSTRAINED.validateOrThrow(requireNonNull(backgroundColor));
            mBackgroundColor = backgroundColor;
            return this;
        }

        /**
         * Sets the {@link TravelEstimate} to the final destination.
         *
         * @throws IllegalArgumentException if the {@link TravelEstimate}'s remaining time is
         *                                  {@link TravelEstimate#REMAINING_TIME_UNKNOWN} or less
         *                                  than zero
         * @throws NullPointerException     if {@code destinationTravelEstimate} is {@code null}
         */
        @NonNull
        public Builder setDestinationTravelEstimate(
                @NonNull TravelEstimate destinationTravelEstimate) {
            if (requireNonNull(destinationTravelEstimate).getRemainingTimeSeconds() < 0) {
                throw new IllegalArgumentException(
                        "The destination travel estimate's remaining time must be greater or "
                                + "equal to zero");
            }
            mDestinationTravelEstimate = destinationTravelEstimate;
            return this;
        }

        /**
         * Sets an {@link ActionStrip} with a list of template-scoped actions for this template.
         *
         *
The {@link Action} buttons in Map Based Template are automatically adjusted based
         * on the screen size. On narrow width screen, icon {@link Action}s show by
         * default. If no icon specify, showing title {@link Action}s instead. On wider width
         * screen, title {@link Action}s show by default. If no title specify, showing icon
         * {@link Action}s instead.
         *
         *
Requirements

         *
         * This template allows up to 4 {@link Action}s in its {@link ActionStrip}. Of the 4
         * allowed {@link Action}s, it can either be a title {@link Action} as set via
         * {@link Action.Builder#setTitle}, or a icon {@link Action} as set via
         * {@link Action.Builder#setIcon}.
         *
         * @throws IllegalArgumentException if {@code actionStrip} does not meet the template's
         *                                  requirements
         * @throws NullPointerException     if {@code actionStrip} is {@code null}
         */
        @NonNull
        public Builder setActionStrip(@NonNull ActionStrip actionStrip) {
            ACTIONS_CONSTRAINTS_NAVIGATION.validateOrThrow(
                    requireNonNull(actionStrip).getActions());
            mActionStrip = actionStrip;
            return this;
        }

        /**
         * Sets an {@link ActionStrip} with a list of map-control related actions for this
         * template, such as pan or zoom.
         *
         *
The host will draw the buttons in an area that is associated with map controls.
         *
         *
If the app does not include the {@link Action#PAN} button in this
         * {@link ActionStrip}, the app will not receive the user input for panning gestures from
         * {@link SurfaceCallback} methods, and the host will exit any previously activated pan
         * mode.
         *
         *
Requirements

         *
         * This template allows up to 4 {@link Action}s in its map {@link ActionStrip}. Only
         * {@link Action}s with icons set via {@link Action.Builder#setIcon} are allowed.
         *
         * @throws IllegalArgumentException if {@code actionStrip} does not meet the template's
         *                                  requirements
         * @throws NullPointerException     if {@code actionStrip} is {@code null}
         */
        @RequiresCarApi(2)
        @NonNull
        public Builder setMapActionStrip(@NonNull ActionStrip actionStrip) {
            ACTIONS_CONSTRAINTS_MAP.validateOrThrow(
                    requireNonNull(actionStrip).getActions());
            mMapActionStrip = actionStrip;
            return this;
        }

        /**
         * Sets a {@link PanModeListener} that notifies when the user enters and exits
         * the pan mode.
         *
         *
If the app does not include the {@link Action#PAN} button in the map
         * {@link ActionStrip}, the app will not receive the user input for panning gestures from
         * {@link SurfaceCallback} methods, and the host will exit any previously activated pan
         * mode.
         *
         * @throws NullPointerException if {@code panModeListener} is {@code null}
         */
        @SuppressLint({"MissingGetterMatchingBuilder", "ExecutorRegistration"})
        @RequiresCarApi(2)
        @NonNull
        public Builder setPanModeListener(@NonNull PanModeListener panModeListener) {
            requireNonNull(panModeListener);
            mPanModeToggle =
                    new Toggle.Builder(
                            (isInPanMode) -> panModeListener.onPanModeChanged(isInPanMode)).build();
            mPanModeDelegate = PanModeDelegateImpl.create(panModeListener);
            return this;
        }

        /**
         * Constructs the {@link NavigationTemplate} defined by this builder.
         *
         * @throws IllegalStateException if an {@link ActionStrip} is not set on this template
         */
        @NonNull
        public NavigationTemplate build() {
            if (mActionStrip == null) {
                throw new IllegalStateException("Action strip for this template must be set");
            }
            return new NavigationTemplate(this);
        }

        /** Constructs an empty {@link Builder} instance. */
        public Builder() {
        }
    }
}


text:
.class public final Landroid/media/RemoteDisplay;
.super Ljava/lang/Object;
.source "RemoteDisplay.java"

# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Landroid/media/RemoteDisplay$Listener;
    }
.end annotation

# static fields
.field public static final DISPLAY_ERROR_CONNECTION_DROPPED:I = 0x2

.field public static final DISPLAY_ERROR_UNKOWN:I = 0x1

.field public static final DISPLAY_FLAG_SECURE:I = 0x1

.field private static final TAG:Ljava/lang/String; = "RemoteDisplay"

.field private static isDispose:Z

.field private static final lock:Ljava/lang/Object;

# instance fields
.field private final mGuard:Ldalvik/system/CloseGuard;

.field private final mHandler:Landroid/os/Handler;

.field private final mListener:Landroid/media/RemoteDisplay$Listener;

.field private mPtr:I

# direct methods
.method static constructor <clinit>()V
    .locals 1

    .prologue
    .line 55
    const/4 v0, 0x0

    sput-boolean v0, Landroid/media/RemoteDisplay;->isDispose:Z

    .line 56
    new-instance v0, Ljava/lang/Object;

    invoke-direct {v0}, Ljava/lang/Object;-><init>()V

    sput-object v0, Landroid/media/RemoteDisplay;->lock:Ljava/lang/Object;

    return-void
.end method

.method private constructor <init>(Landroid/media/RemoteDisplay$Listener;Landroid/os/Handler;)V
    .locals 1
    .param p1, "listener"    # Landroid/media/RemoteDisplay$Listener;
    .param p2, "handler"    # Landroid/os/Handler;

    .prologue
    .line 66
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 43
    invoke-static {}, Ldalvik/system/CloseGuard;->get()Ldalvik/system/CloseGuard;

    move-result-object v0

    iput-object v0, p0, Landroid/media/RemoteDisplay;->mGuard:Ldalvik/system/CloseGuard;

    .line 67
    iput-object p1, p0, Landroid/media/RemoteDisplay;->mListener:Landroid/media/RemoteDisplay$Listener;

    .line 68
    iput-object p2, p0, Landroid/media/RemoteDisplay;->mHandler:Landroid/os/Handler;

    .line 69
    return-void
.end method

.method static synthetic access$000(Landroid/media/RemoteDisplay;)Landroid/media/RemoteDisplay$Listener;
    .locals 1
    .param p0, "x0"    # Landroid/media/RemoteDisplay;

    .prologue
    .line 33
    iget-object v0, p0, Landroid/media/RemoteDisplay;->mListener:Landroid/media/RemoteDisplay$Listener;

    return-object v0
.end method

.method public static connect(Ljava/lang/String;Landroid/view/Surface;Landroid/media/RemoteDisplay$Listener;Landroid/os/Handler;)Landroid/media/RemoteDisplay;
    .locals 3
    .param p0, "iface"    # Ljava/lang/String;
    .param p1, "surface"    # Landroid/view/Surface;
    .param p2, "listener"    # Landroid/media/RemoteDisplay$Listener;
    .param p3, "handler"    # Landroid/os/Handler;

    .prologue
    .line 189
    const-string v1, "RemoteDisplay"

    const-string v2, "connect"

    invoke-static {v1, v2}, Landroid/util/Slog;->d(Ljava/lang/String;Ljava/lang/String;)I

    .line 190
    if-nez p0, :cond_0

    .line 191
    new-instance v1, Ljava/lang/IllegalArgumentException;

    const-string v2, "iface must not be null"

    invoke-direct {v1, v2}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V

    throw v1

    .line 193
    :cond_0
    if-nez p2, :cond_1

    .line 194
    new-instance v1, Ljava/lang/IllegalArgumentException;

    const-string/jumbo v2, "listener must not be null"

    invoke-direct {v1, v2}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V

    throw v1

    .line 196
    :cond_1
    if-nez p3, :cond_2

    .line 197
    new-instance v1, Ljava/lang/IllegalArgumentException;

    const-string v2, "handler must not be null"

    invoke-direct {v1, v2}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V

    throw v1

    .line 200
    :cond_2
    new-instance v0, Landroid/media/RemoteDisplay;

    invoke-direct {v0, p2, p3}, Landroid/media/RemoteDisplay;-><init>(Landroid/media/RemoteDisplay$Listener;Landroid/os/Handler;)V

    .line 201
    .local v0, "display":Landroid/media/RemoteDisplay;
    invoke-direct {v0, p0, p1}, Landroid/media/RemoteDisplay;->startConnecting(Ljava/lang/String;Landroid/view/Surface;)V

    .line 202
    return-object v0
.end method

.method private dispose(Z)V
    .locals 3
    .param p1, "finalized"    # Z

    .prologue
    const/4 v2, 0x0

    .line 132
    const-string v0, "RemoteDisplay"

    const-string v1, "dispose"

    invoke-static {v0, v1}, Landroid/util/Slog;->d(Ljava/lang/String;Ljava/lang/String;)I

    .line 133
    iget v0, p0, Landroid/media/RemoteDisplay;->mPtr:I

    if-eqz v0, :cond_1

    .line 134
    iget-object v0, p0, Landroid/media/RemoteDisplay;->mGuard:Ldalvik/system/CloseGuard;

    if-eqz v0, :cond_0

    .line 135
    if-eqz p1, :cond_2

    .line 136
    iget-object v0, p0, Landroid/media/RemoteDisplay;->mGuard:Ldalvik/system/CloseGuard;

    invoke-virtual {v0}, Ldalvik/system/CloseGuard;->warnIfOpen()V

    .line 142
    :cond_0
    :goto_0
    iget v0, p0, Landroid/media/RemoteDisplay;->mPtr:I

    invoke-direct {p0, v0}, Landroid/media/RemoteDisplay;->nativeDispose(I)V

    .line 143
    iput v2, p0, Landroid/media/RemoteDisplay;->mPtr:I

    .line 146
    :cond_1
    sget-object v1, Landroid/media/RemoteDisplay;->lock:Ljava/lang/Object;

    monitor-enter v1

    .line 148
    :try_start_0
    const-string v0, "RemoteDisplay"

    const-string v2, "dispose finish"

    invoke-static {v0, v2}, Landroid/util/Slog;->d(Ljava/lang/String;Ljava/lang/String;)I

    .line 149
    const/4 v0, 0x0

    sput-boolean v0, Landroid/media/RemoteDisplay;->isDispose:Z

    .line 150
    monitor-exit v1
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    .line 151
    return-void

    .line 138
    :cond_2
    iget-object v0, p0, Landroid/media/RemoteDisplay;->mGuard:Ldalvik/system/CloseGuard;

    invoke-virtual {v0}, Ldalvik/system/CloseGuard;->close()V

    goto :goto_0

    .line 150
    :catchall_0
    move-exception v0

    :try_start_1
    monitor-exit v1
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    throw v0
.end method

.method public static listen(Ljava/lang/String;Landroid/media/RemoteDisplay$Listener;Landroid/os/Handler;)Landroid/media/RemoteDisplay;
    .locals 3
    .param p0, "iface"    # Ljava/lang/String;
    .param p1, "listener"    # Landroid/media/RemoteDisplay$Listener;
    .param p2, "handler"    # Landroid/os/Handler;

    .prologue
    .line 88
    const-string v1, "RemoteDisplay"

    const-string/jumbo v2, "listen"

    invoke-static {v1, v2}, Landroid/util/Slog;->d(Ljava/lang/String;Ljava/lang/String;)I

    .line 89
    if-nez p0, :cond_0

    .line 90
    new-instance v1, Ljava/lang/IllegalArgumentException;

    const-string v2, "iface must not be null"

    invoke-direct {v1, v2}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V

    throw v1

    .line 92
    :cond_0
    if-nez p1, :cond_1

    .line 93
    new-instance v1, Ljava/lang/IllegalArgumentException;

    const-string/jumbo v2, "listener must not be null"

    invoke-direct {v1, v2}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V

    throw v1

    .line 95
    :cond_1
    if-nez p2, :cond_2

    .line 96
    new-instance v1, Ljava/lang/IllegalArgumentException;

    const-string v2, "handler must not be null"

    invoke-direct {v1, v2}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V

    throw v1

    .line 99
    :cond_2
    new-instance v0, Landroid/media/RemoteDisplay;

    invoke-direct {v0, p1, p2}, Landroid/media/RemoteDisplay;-><init>(Landroid/media/RemoteDisplay$Listener;Landroid/os/Handler;)V

    .line 100
    .local v0, "display":Landroid/media/RemoteDisplay;
    invoke-direct {v0, p0}, Landroid/media/RemoteDisplay;->startListening(Ljava/lang/String;)V

    .line 101
    return-object v0
.end method

.method private native nativeConnect(Ljava/lang/String;Landroid/view/Surface;)I
.end method

.method private native nativeDispose(I)V
.end method

.method private native nativeGetWfdParam(II)I
.end method

.method private native nativeListen(Ljava/lang/String;)I
.end method

.method private native nativePause(I)V
.end method

.method private native nativeResume(I)V
.end method

.method private native nativeSendUibcEvent(ILjava/lang/String;)V
.end method

.method private native nativeSetWfdLevel(II)V
.end method

.method private native nativeSuspendDisplay(IZLandroid/view/Surface;)V
.end method

.method private notifyDisplayConnected(Landroid/view/Surface;IIII)V
    .locals 8
    .param p1, "surface"    # Landroid/view/Surface;
    .param p2, "width"    # I
    .param p3, "height"    # I
    .param p4, "flags"    # I
    .param p5, "session"    # I

    .prologue
    .line 252
    const-string v0, "RemoteDisplay"

    const-string/jumbo v1, "notifyDisplayConnected"

    invoke-static {v0, v1}, Landroid/util/Slog;->d(Ljava/lang/String;Ljava/lang/String;)I

    .line 253
    iget-object v7, p0, Landroid/media/RemoteDisplay;->mHandler:Landroid/os/Handler;

    new-instance v0, Landroid/media/RemoteDisplay$1;

    move-object v1, p0

    move-object v2, p1

    move v3, p2

    move v4, p3

    move v5, p4

    move v6, p5

    invoke-direct/range {v0 .. v6}, Landroid/media/RemoteDisplay$1;-><init>(Landroid/media/RemoteDisplay;Landroid/view/Surface;IIII)V

    invoke-virtual {v7, v0}, Landroid/os/Handler;->post(Ljava/lang/Runnable;)Z

    .line 259
    return-void
.end method

.method private notifyDisplayDisconnected()V
    .locals 2

    .prologue
    .line 263
    const-string v0, "RemoteDisplay"

    const-string/jumbo v1, "notifyDisplayDisconnected"

    invoke-static {v0, v1}, Landroid/util/Slog;->d(Ljava/lang/String;Ljava/lang/String;)I

    .line 264
    iget-object v0, p0, Landroid/media/RemoteDisplay;->mHandler:Landroid/os/Handler;

    new-instance v1, Landroid/media/RemoteDisplay$2;

    invoke-direct {v1, p0}, Landroid/media/RemoteDisplay$2;-><init>(Landroid/media/RemoteDisplay;)V

    invoke-virtual {v0, v1}, Landroid/os/Handler;->post(Ljava/lang/Runnable;)Z

    .line 270
    return-void
.end method

.method private notifyDisplayError(I)V
    .locals 2
    .param p1, "error"    # I

    .prologue
    .line 274
    const-string v0, "RemoteDisplay"

    const-string/jumbo v1, "notifyDisplayError"

    invoke-static {v0, v1}, Landroid/util/Slog;->d(Ljava/lang/String;Ljava/lang/String;)I

    .line 275
    iget-object v0, p0, Landroid/media/RemoteDisplay;->mHandler:Landroid/os/Handler;

    new-instance v1, Landroid/media/RemoteDisplay$3;

    invoke-direct {v1, p0, p1}, Landroid/media/RemoteDisplay$3;-><init>(Landroid/media/RemoteDisplay;I)V

    invoke-virtual {v0, v1}, Landroid/os/Handler;->post(Ljava/lang/Runnable;)Z

    .line 281
    return-void
.end method

.method private notifyDisplayGenericMsgEvent(I)V
    .locals 2
    .param p1, "event"    # I

    .prologue
    .line 295
    const-string v0, "RemoteDisplay"

    const-string/jumbo v1, "notifyDisplayGenericMsgEvent"

    invoke-static {v0, v1}, Landroid/util/Slog;->d(Ljava/lang/String;Ljava/lang/String;)I

    .line 296
    iget-object v0, p0, Landroid/media/RemoteDisplay;->mHandler:Landroid/os/Handler;

    new-instance v1, Landroid/media/RemoteDisplay$5;

    invoke-direct {v1, p0, p1}, Landroid/media/RemoteDisplay$5;-><init>(Landroid/media/RemoteDisplay;I)V

    invoke-virtual {v0, v1}, Landroid/os/Handler;->post(Ljava/lang/Runnable;)Z

    .line 302
    return-void
.end method

.method private notifyDisplayKeyEvent(II)V
    .locals 2
    .param p1, "uniCode"    # I
    .param p2, "flags"    # I

    .prologue
    .line 285
    const-string v0, "RemoteDisplay"

    const-string/jumbo v1, "notifyDisplayKeyEvent"

    invoke-static {v0, v1}, Landroid/util/Slog;->d(Ljava/lang/String;Ljava/lang/String;)I

    .line 286
    iget-object v0, p0, Landroid/media/RemoteDisplay;->mHandler:Landroid/os/Handler;

    new-instance v1, Landroid/media/RemoteDisplay$4;

    invoke-direct {v1, p0, p1, p2}, Landroid/media/RemoteDisplay$4;-><init>(Landroid/media/RemoteDisplay;II)V

    invoke-virtual {v0, v1}, Landroid/os/Handler;->post(Ljava/lang/Runnable;)Z

    .line 292
    return-void
.end method

.method private startConnecting(Ljava/lang/String;Landroid/view/Surface;)V
    .locals 3
    .param p1, "iface"    # Ljava/lang/String;
    .param p2, "surface"    # Landroid/view/Surface;

    .prologue
    .line 211
    const-string v0, "RemoteDisplay"

    const-string/jumbo v1, "startConnecting"

    invoke-static {v0, v1}, Landroid/util/Slog;->d(Ljava/lang/String;Ljava/lang/String;)I

    .line 213
    invoke-direct {p0, p1, p2}, Landroid/media/RemoteDisplay;->nativeConnect(Ljava/lang/String;Landroid/view/Surface;)I

    move-result v0

    iput v0, p0, Landroid/media/RemoteDisplay;->mPtr:I

    .line 214
    iget v0, p0, Landroid/media/RemoteDisplay;->mPtr:I

    if-nez v0, :cond_0

    .line 215
    new-instance v0, Ljava/lang/IllegalStateException;

    new-instance v1, Ljava/lang/StringBuilder;

    invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

    const-string v2, "Could not start connecting for remote display connection on \""

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    const-string v2, "\""

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-direct {v0, v1}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V

    throw v0

    .line 218
    :cond_0
    iget-object v0, p0, Landroid/media/RemoteDisplay;->mGuard:Ldalvik/system/CloseGuard;

    const-string v1, "dispose"

    invoke-virtual {v0, v1}, Ldalvik/system/CloseGuard;->open(Ljava/lang/String;)V

    .line 219
    return-void
.end method

.method private startListening(Ljava/lang/String;)V
    .locals 3
    .param p1, "iface"    # Ljava/lang/String;

    .prologue
    .line 154
    const-string v0, "RemoteDisplay"

    const-string/jumbo v1, "startListening"

    invoke-static {v0, v1}, Landroid/util/Slog;->d(Ljava/lang/String;Ljava/lang/String;)I

    .line 155
    invoke-direct {p0, p1}, Landroid/media/RemoteDisplay;->nativeListen(Ljava/lang/String;)I

    move-result v0

    iput v0, p0, Landroid/media/RemoteDisplay;->mPtr:I

    .line 156
    iget v0, p0, Landroid/media/RemoteDisplay;->mPtr:I

    if-nez v0, :cond_0

    .line 157
    new-instance v0, Ljava/lang/IllegalStateException;

    new-instance v1, Ljava/lang/StringBuilder;

    invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

    const-string v2, "Could not start listening for remote display connection on \""

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    const-string v2, "\""

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-direct {v0, v1}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V

    throw v0

    .line 160
    :cond_0
    iget-object v0, p0, Landroid/media/RemoteDisplay;->mGuard:Ldalvik/system/CloseGuard;

    const-string v1, "dispose"

    invoke-virtual {v0, v1}, Ldalvik/system/CloseGuard;->open(Ljava/lang/String;)V

    .line 161
    return-void
.end method

# virtual methods
.method public dispose()V
    .locals 3

    .prologue
    .line 108
    const-string v0, "RemoteDisplay"

    const-string v1, "dispose"

    invoke-static {v0, v1}, Landroid/util/Slog;->d(Ljava/lang/String;Ljava/lang/String;)I

    .line 110
    sget-object v1, Landroid/media/RemoteDisplay;->lock:Ljava/lang/Object;

    monitor-enter v1

    .line 112
    :try_start_0
    sget-boolean v0, Landroid/media/RemoteDisplay;->isDispose:Z

    if-eqz v0, :cond_0

    .line 113
    const-string v0, "RemoteDisplay"

    const-string v2, "dispose done"

    invoke-static {v0, v2}, Landroid/util/Slog;->d(Ljava/lang/String;Ljava/lang/String;)I

    .line 114
    monitor-exit v1

    .line 119
    :goto_0
    return-void

    .line 116
    :cond_0
    const/4 v0, 0x1

    sput-boolean v0, Landroid/media/RemoteDisplay;->isDispose:Z

    .line 117
    monitor-exit v1
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    .line 118
    const/4 v0, 0x0

    invoke-direct {p0, v0}, Landroid/media/RemoteDisplay;->dispose(Z)V

    goto :goto_0

    .line 117
    :catchall_0
    move-exception v0

    :try_start_1
    monitor-exit v1
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    throw v0
.end method

.method protected finalize()V
    .locals 1
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/lang/Throwable;
        }
    .end annotation

    .prologue
    .line 74
    const/4 v0, 0x1

    :try_start_0
    invoke-direct {p0, v0}, Landroid/media/RemoteDisplay;->dispose(Z)V
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    .line 76
    invoke-super {p0}, Ljava/lang/Object;->finalize()V

    .line 78
    return-void

    .line 76
    :catchall_0
    move-exception v0

    invoke-super {p0}, Ljava/lang/Object;->finalize()V

    throw v0
.end method

.method public getWfdParam(I)I
    .locals 1
    .param p1, "paramType"    # I

    .prologue
    .line 178
    iget v0, p0, Landroid/media/RemoteDisplay;->mPtr:I

    invoke-direct {p0, v0, p1}, Landroid/media/RemoteDisplay;->nativeGetWfdParam(II)I

    move-result v0

    return v0
.end method

.method public pause()V
    .locals 2

    .prologue
    .line 122
    const-string v0, "RemoteDisplay"

    const-string/jumbo v1, "pause"

    invoke-static {v0, v1}, Landroid/util/Slog;->d(Ljava/lang/String;Ljava/lang/String;)I

    .line 123
    iget v0, p0, Landroid/media/RemoteDisplay;->mPtr:I

    invoke-direct {p0, v0}, Landroid/media/RemoteDisplay;->nativePause(I)V

    .line 124
    return-void
.end method

.method public resume()V
    .locals 2

    .prologue
    .line 127
    const-string v0, "RemoteDisplay"

    const-string/jumbo v1, "resume"

    invoke-static {v0, v1}, Landroid/util/Slog;->d(Ljava/lang/String;Ljava/lang/String;)I

    .line 128
    iget v0, p0, Landroid/media/RemoteDisplay;->mPtr:I

    invoke-direct {p0, v0}, Landroid/media/RemoteDisplay;->nativeResume(I)V

    .line 129
    return-void
.end method

.method public sendUibcEvent(Ljava/lang/String;)V
    .locals 1
    .param p1, "eventDesc"    # Ljava/lang/String;

    .prologue
    .line 245
    iget v0, p0, Landroid/media/RemoteDisplay;->mPtr:I

    invoke-direct {p0, v0, p1}, Landroid/media/RemoteDisplay;->nativeSendUibcEvent(ILjava/lang/String;)V

    .line 246
    return-void
.end method

.method public setWfdLevel(I)V
    .locals 1
    .param p1, "level"    # I

    .prologue
    .line 169
    iget v0, p0, Landroid/media/RemoteDisplay;->mPtr:I

    invoke-direct {p0, v0, p1}, Landroid/media/RemoteDisplay;->nativeSetWfdLevel(II)V

    .line 170
    return-void
.end method

.method public suspendDisplay(ZLandroid/view/Surface;)V
    .locals 2
    .param p1, "suspend"    # Z
    .param p2, "surface"    # Landroid/view/Surface;

    .prologue
    .line 227
    const-string v0, "RemoteDisplay"

    const-string/jumbo v1, "suspendDisplay"

    invoke-static {v0, v1}, Landroid/util/Slog;->d(Ljava/lang/String;Ljava/lang/String;)I

    .line 228
    if-eqz p1, :cond_0

    if-eqz p2, :cond_0

    .line 229
    new-instance v0, Ljava/lang/IllegalArgumentException;

    const-string/jumbo v1, "surface must be null when suspend display"

    invoke-direct {v0, v1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V

    throw v0

    .line 231
    :cond_0
    if-nez p1, :cond_1

    if-nez p2, :cond_1

    .line 232
    new-instance v0, Ljava/lang/IllegalArgumentException;

    const-string/jumbo v1, "surface must not be null when resume display"

    invoke-direct {v0, v1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V

    throw v0

    .line 235
    :cond_1
    iget v0, p0, Landroid/media/RemoteDisplay;->mPtr:I

    invoke-direct {p0, v0, p1, p2}, Landroid/media/RemoteDisplay;->nativeSuspendDisplay(IZLandroid/view/Surface;)V

    .line 236
    return-void
.end method


text:
module WWTD
  module Ruby
    class << self
      def available?(version)
        !version || switch_statement(version)
      end

      # - rvm: "rvm xxx do"
      # - chruby: "chruby-exec xxx --"
      # - others: env hash
      # - unknown: nil
      def switch_statement(version, options={})
        return unless version
        version = normalize_ruby_version(version)
        if rvm_executable
          command = "rvm #{version} do "
          command if cache_command("#{command} ruby -v")
        elsif chruby_executable
          command = "chruby-exec #{version} -- "
          command if cache_command("#{command} ruby -v")
        elsif options[:rerun]
          if rbenv_executable
            # cannot call different ruby from inside ruby, but ok for copy-paste
            "RBENV_VERSION=#{version} "
          else
            # don't print giant path hack :/
            "USE-RUBY-#{version}"
          end
        else
          if ruby_root = ENV["RUBY_ROOT"] # chruby or RUBY_ROOT set
            switch_via_env(File.dirname(ruby_root), version)
          elsif rbenv_executable
            rubies_root = cache_command("rbenv root") + "/versions"
            switch_via_env(rubies_root, version)
          end
        end
      end

      private

      def switch_via_env(rubies_root, version)
        base = extract_jruby_rbenv_options!(version)
        if ruby_root = ruby_root(rubies_root, version)
          gem_home = Dir["#{ruby_root}/lib/ruby/gems/*"].first
          base.merge(
            "PATH" => "#{ruby_root}/bin:#{ENV["PATH"]}",
            "GEM_HOME" => gem_home,
            "GEM_PATH" => gem_home
          )
        end
      end

      def rvm_executable
        cache_command("which rvm")
      end

      def rbenv_executable
        cache_command("which rbenv")
      end

      def chruby_executable
        !ENV["PATH"].include?("/rbenv/") && cache_command("which chruby-exec")
      end

      def cache_command(command)
        cache(command) do
          if result = capture(command)
            result.strip
          end
        end
      end

      def ruby_root(root, version)
        Dir.glob("#{root}/*").detect do |p|
          File.basename(p).sub(/^ruby-/,"").start_with?(version)
        end
      end

      def cache(key)
        @cache ||= {}
        if @cache.key?(key)
          @cache[key]
        else
          @cache[key] = yield
        end
      end

      # set ruby-opts for jruby flavors
      def extract_jruby_rbenv_options!(version)
        if version.sub!("-d19", "")
          { "JRUBY_OPTS" => "--1.9" }
        elsif version.sub!("-d18", "")
          { "JRUBY_OPTS" => "--1.8" }
        else
          {}
        end
      end

      def capture(command)
        result = `#{command}`
        $?.success? ? result : nil
      end

      # Taken from https://github.com/travis-ci/travis-build/blob/master/lib/travis/build/script/rvm.rb
      def normalize_ruby_version(rvm)
        rvm.to_s.
          gsub(/-(\d{2})mode$/, '-d\1').
          gsub(/^rbx$/, 'rbx-weekly-d18').
          gsub(/^rbx-d(\d{2})$/, 'rbx-weekly-d\1')
      end
    end
  end
end


text:
	MARGIN: 10px auto; WIDTH: 100%
}
#top {
	PADDING-RIGHT: 0.5em; PADDING-LEFT: 0.5em; PADDING-BOTTOM: 0.5em; PADDING-TOP: 0.5em
}
#tabs {
	PADDING-RIGHT: 0px; PADDING-LEFT: 50px; FONT-WEIGHT: normal; PADDING-BOTTOM: 0px; PADDING-TOP: 0px
}
#tabs UL {
	PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px; WHITE-SPACE: nowrap
}
#tabs LI {
	DISPLAY: inline; LIST-STYLE-TYPE: none
}
#tabs A {
	BORDER-RIGHT: #fff 1px solid; PADDING-RIGHT: 10px; BORDER-TOP: #fff 1px solid; PADDING-LEFT: 10px; FONT-WEIGHT: normal; PADDING-BOTTOM: 0px; BORDER-LEFT: #fff 1px solid; PADDING-TOP: 4px; BORDER-BOTTOM: #fff 1px solid; moz-border-radius-topleft: 6px; khtml-border-top-left-radius: 6px; webkit-border-top-left-radius: 6px; border-top-left-radius: 6px; moz-border-radius-topright: 6px; khtml-border-top-right-radius: 6px; webkit-border-top-right-radius: 6px; border-top-right-radius: 6px
}
#tabs A:link {
	COLOR: #fff; TEXT-DECORATION: none
}
#tabs A:visited {
	COLOR: #fff; TEXT-DECORATION: none
}
#tabs A:hover {
	PADDING-RIGHT: 10px; PADDING-LEFT: 10px; PADDING-BOTTOM: 0px; COLOR: #000; PADDING-TOP: 4px; BORDER-BOTTOM: #fff 1px solid; BACKGROUND-COLOR: #fff; TEXT-DECORATION: none
}
#tabs A.active:link {
	PADDING-RIGHT: 10px; PADDING-LEFT: 10px; PADDING-BOTTOM: 0px; COLOR: #000; PADDING-TOP: 4px; BORDER-BOTTOM: #fff 1px solid; BACKGROUND-COLOR: #fff; TEXT-DECORATION: none
}
#tabs A.active:visited {
	PADDING-RIGHT: 10px; PADDING-LEFT: 10px; PADDING-BOTTOM: 0px; COLOR: #000; PADDING-TOP: 4px; BORDER-BOTTOM: #fff 1px solid; BACKGROUND-COLOR: #fff; TEXT-DECORATION: none
}
#subtabs {
	BORDER-RIGHT: #000 1px solid; PADDING-RIGHT: 20px; BORDER-TOP: #000 1px solid; PADDING-LEFT: 20px; PADDING-BOTTOM: 2px; BORDER-LEFT: #000 1px solid; COLOR: #000; PADDING-TOP: 2px; BORDER-BOTTOM: medium none; BACKGROUND-COLOR: #fff; TEXT-ALIGN: left; moz-border-radius-topleft: 6px; khtml-border-top-left-radius: 6px; webkit-border-top-left-radius: 6px; border-top-left-radius: 6px; moz-border-radius-topright: 6px; khtml-border-top-right-radius: 6px; webkit-border-top-right-radius: 6px; border-top-right-radius: 6px
}
#subtabs A {
	COLOR: #000
}
.activesubtab {
	COLOR: #000
}
#breadcrumbs {
	BORDER-RIGHT: #fff 1px solid; PADDING-RIGHT: 0px; BORDER-TOP: #fff 1px dotted; PADDING-LEFT: 10px; FONT-WEIGHT: normal; PADDING-BOTTOM: 0px; BORDER-LEFT: #fff 1px solid; COLOR: #fff; PADDING-TOP: 0px; BORDER-BOTTOM: medium none; BACKGROUND-COLOR: #000
}
#breadcrumbs FORM {
	FLOAT: right
}
#content {
	BORDER-RIGHT: #fff 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #fff 1px dotted; PADDING-LEFT: 5px; PADDING-BOTTOM: 5px; BORDER-LEFT: #fff 1px solid; PADDING-TOP: 5px; BORDER-BOTTOM: #fff 1px solid; BACKGROUND-COLOR: #000; moz-border-radius-bottomleft: 6px; khtml-border-bottom-left-radius: 6px; webkit-border-bottom-left-radius: 6px; border-bottom-left-radius: 6px; moz-border-radius-bottomright: 6px; khtml-border-bottom-right-radius: 6px; webkit-border-bottom-right-radius: 6px; border-bottom-right-radius: 6px
}
#footer {
	CLEAR: both; PADDING-RIGHT: 0.5em; PADDING-LEFT: 0.5em; PADDING-BOTTOM: 0.5em; MARGIN: 0px; PADDING-TOP: 0.5em
}
#footer A.subtle {
	FONT-SIZE: 8pt
}
BODY {
	MARGIN-TOP: 0px; FONT-SIZE: 10pt; COLOR: #fff; FONT-FAMILY: arial,serif; BACKGROUND-COLOR: #000
}
PRE {
	BORDER-RIGHT: #fff 1px solid; BORDER-TOP: #fff 1px solid; BORDER-LEFT: #fff 1px solid; COLOR: #fff; BORDER-BOTTOM: #fff 1px solid; BACKGROUND-COLOR: #000
}
A {
	COLOR: #fff
}
A:visited {
	COLOR: #fff
}
A IMG {
	BORDER-RIGHT: medium none; BORDER-TOP: medium none; BORDER-LEFT: medium none; BORDER-BOTTOM: medium none
}
TD.line {
	PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 1px; PADDING-BOTTOM: 0px; PADDING-TOP: 0px; BACKGROUND-COLOR: #fff; border-spacing: 0px
}
TD.border_bottom {
	PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 1px; PADDING-BOTTOM: 0px; WIDTH: 100%; PADDING-TOP: 0px; BORDER-BOTTOM: #fff 1px dotted; HEIGHT: 1px
}
TD.border_top {
	PADDING-RIGHT: 0px; BORDER-TOP: #fff 1px dotted; PADDING-LEFT: 0px; FONT-SIZE: 1px; PADDING-BOTTOM: 0px; WIDTH: 100%; PADDING-TOP: 0px; HEIGHT: 1px
}
TD.border_left {
	PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 1px; PADDING-BOTTOM: 0px; BORDER-LEFT: #fff 1px dotted; WIDTH: 100%; PADDING-TOP: 0px; HEIGHT: 1px
}
.title {
	FONT-WEIGHT: bold; FONT-SIZE: 12pt; COLOR: #fff; BACKGROUND-COLOR: #000; TEXT-DECORATION: none
}
.title:hover {
	FONT-WEIGHT: bold; FONT-SIZE: 12pt; COLOR: #fff; BACKGROUND-COLOR: #000; TEXT-DECORATION: none
}
.title:visited {
	FONT-WEIGHT: bold; FONT-SIZE: 12pt; COLOR: #fff; BACKGROUND-COLOR: #000; TEXT-DECORATION: none
}
.center {
	TEXT-ALIGN: center
}
INPUT.small {
	FONT-SIZE: 8pt; BACKGROUND-COLOR: #000
}
INPUT.smallbtn {
	FONT-SIZE: 8pt; BACKGROUND-COLOR: #c0c0c0
}
A.small {
	FONT-SIZE: 8pt; TEXT-DECORATION: underline
}
TD.small {
	PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; PADDING-TOP: 0px; TEXT-ALIGN: left; border-spacing: 0px
}
TD.colname {
	FONT-WEIGHT: bold; COLOR: #000; BACKGROUND-COLOR: #888
}
TD.collight {
	BACKGROUND-COLOR: #f1f1f1
}
H1 {
	FONT-WEIGHT: bold; FONT-SIZE: 16pt
}
H2 {
	FONT-WEIGHT: bold; FONT-SIZE: 12pt
}
H3 {
	FONT-WEIGHT: bold; FONT-SIZE: 10pt
}
H4 {
	FONT-WEIGHT: bold; FONT-SIZE: 8pt
}
H5 {
	FONT-WEIGHT: bold; FONT-SIZE: 6pt
}
.searchform {
	BORDER-RIGHT: #c0c0c0 1px solid; BORDER-TOP: #c0c0c0 1px solid; BORDER-LEFT: #c0c0c0 1px solid; BORDER-BOTTOM: #c0c0c0 1px solid
}


text:
.sfquicklinks {
	float:right;
	width:525px;
	height:50px;
	overflow:hidden;
}
.sfquicklinks ul li {
	margin:0 0 0 5px;
	float:left;
}
.sfquicklinks ul li a {
	font:12px Arial, Helvetica, sans-serif;
	color:#464545;
	text-shadow:0px 1px 1px #fff;
	text-align:center;
	-webkit-border-radius: 3px;
	-moz-border-radius: 3px;
	border-radius: 3px;
	background:#f2f2f2;
	border:1px solid #d1d1d1;
	padding:10px 0 0 0;
	text-decoration:none;
	display:inline-block;
	height:49px;
	width:57px;
	-webkit-box-sizing: border-box;
	-moz-box-sizing: border-box;
	box-sizing:border-box;
	-moz-transition: all 0.3s ease-out;
	-o-transition: all 0.3s ease-out;
	-webkit-transition: all 0.3s ease-out;
	-ms-transition: all 0.3s ease-out;
	transition: all 0.3s ease-out;
}
.sfquicklinks ul li a img {
	padding:0 0 10px 0;
}
.sfquicklinks ul li a span {
	display:none;
	padding:0 0 10px 0;
}
.sfquicklinks ul li a:hover {
	background:#fff;
	color:#000;
	text-shadow:none;
	-webkit-box-shadow: 0 0 3px rgba(0, 0, 0, 0.2);
	-moz-box-shadow: 0 0 3px rgba(0, 0, 0, 0.2);
	box-shadow: 0 0 3px rgba(0, 0, 0, 0.2);
}
.sfquicklinks .jcarousel-container-horizontal {
	width: 245px;
	padding: 20px 40px;
}
.jcarousel-clip-horizontal {
	margin:0 46px;
}
.sfquicklinks .jcarousel-item {
	width: 52px !important;
	height: 50px;
}
.sfquicklinks .jcarousel-item-horizontal {
	margin-left: 0;
	margin-right: 10px;
}
.sfquicklinks .jcarousel-item-placeholder {
	background: #fff;
	color: #000;
}
.sfquicklinks .jcarousel-next-horizontal {
	position: absolute;
	top: 10px;
	right: 5px;
	width: 32px;
	height: 32px;
	cursor: pointer;
	background: transparent url(../images/next-horizontal.png) no-repeat 0 0;
}
.sfquicklinks .jcarousel-next-horizontal:hover {
	background: transparent url(../images/next-horizontal-hover.png) no-repeat 0 0;
}
.sfquicklinks .jcarousel-prev-horizontal {
	position: absolute;
	top: 10px;
	left: 5px;
	width: 32px;
	height: 32px;
	cursor: pointer;
	background: transparent url(../images/prev-horizontal.png) no-repeat 0 0;
}
.sfquicklinks .jcarousel-prev-horizontal:hover {
	background: transparent url(../images/prev-horizontal-hover.png) no-repeat 0 0;
}
.sfquicklinks .jcarousel-prev-disabled-horizontal, .sfquicklinks .jcarousel-prev-disabled-horizontal:hover {
	background: transparent url(../images/prev-horizontal-disable.png) no-repeat 0 0;
	cursor:default;
}
.sfquicklinks .jcarousel-next-disabled-horizontal, .sfquicklinks .jcarousel-next-disabled-horizontal:hover {
	background: transparent url(../images/next-horizontal-disable.png) no-repeat 0 0;
	cursor:default;
}


text:
=======
Modules
=======

mongrey.policy
==============

.. autoclass:: mongrey.policy.Policy
   :members:

mongrey.server
==============

.. autoclass:: mongrey.server.core.PolicyServer
   :members:

.. currentmodule:: mongrey.server.core

.. data:: DEFAULT_CONFIG

   :class:`PolicyServer`


text:
<!DOCTYPE html>

<title>OffscreenCanvas test: 2d.imageData.get.order.rows</title>

2d.imageData.get.order.rows

getImageData() returns topmost rows first


text:
package com.chiorichan.factory;

/**
 * Provides an interface for which the Scripting Engine to notify Scripts of events, such as exception or before execution.
 */
public interface ScriptingEvents
{
	void onBeforeExecute( ScriptingContext context );

	void onAfterExecute( ScriptingContext context );

	void onException( ScriptingContext context, Throwable throwable );
}


text:
require_relative 'base'

module WavefrontDisplay
  #
  # Format human-readable output for external links.
  #
  class ExternalLink < Base
    def do_describe
      readable_time(:createdEpochMillis, :updatedEpochMillis)
      long_output
    end
  end
end


text:
package org.mlflow.tracking;

import com.google.common.collect.Lists;
import org.apache.http.client.utils.URIBuilder;
import org.mlflow.artifacts.ArtifactRepository;
import org.mlflow.artifacts.ArtifactRepositoryFactory;
import org.mlflow.artifacts.CliBasedArtifactRepository;
import org.mlflow.api.proto.ModelRegistry.*;
import org.mlflow.api.proto.Service.*;
import org.mlflow.tracking.creds.*;

import java.io.Closeable;
import java.io.File;
import java.io.Serializable;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;

/**
 * Client to an MLflow Tracking Sever.
 */
public class MlflowClient implements Serializable, Closeable {
  protected static final String DEFAULT_EXPERIMENT_ID = "0";
  private static final String DEFAULT_MODELS_ARTIFACT_REPOSITORY_SCHEME = "models";

  private final MlflowProtobufMapper mapper = new MlflowProtobufMapper();
  private final ArtifactRepositoryFactory artifactRepositoryFactory;
  private final MlflowHttpCaller httpCaller;
  private final MlflowHostCredsProvider hostCredsProvider;

  /** Return a default client based on the MLFLOW_TRACKING_URI environment variable. */
  public MlflowClient() {
    this(getDefaultTrackingUri());
  }

  /** Instantiate a new client using the provided tracking uri. */
  public MlflowClient(String trackingUri) {
    this(getHostCredsProviderFromTrackingUri(trackingUri));
  }

  /**
   * Create a new MlflowClient; users should prefer constructing ApiClients via
   * {@link #MlflowClient()} or {@link #MlflowClient(String)} if possible.
   */
  public MlflowClient(MlflowHostCredsProvider hostCredsProvider) {
    this.hostCredsProvider = hostCredsProvider;
    this.httpCaller = new MlflowHttpCaller(hostCredsProvider);
    this.artifactRepositoryFactory = new ArtifactRepositoryFactory(hostCredsProvider);
  }

  /**
   * Get metadata, params, tags, and metrics for a run. A single value is returned for each metric
   * key: the most recently logged metric value at the largest step.
   *
   * @return Run associated with the ID.
   */
  public Run getRun(String runId) {
    URIBuilder builder = newURIBuilder("runs/get")
      .setParameter("run_uuid", runId)
      .setParameter("run_id", runId);
    return mapper.toGetRunResponse(httpCaller.get(builder.toString())).getRun();
  }

  public List<Metric> getMetricHistory(String runId, String key) {
    URIBuilder builder = newURIBuilder("metrics/get-history")
      .setParameter("run_uuid", runId)
      .setParameter("run_id", runId)
      .setParameter("metric_key", key);
    return mapper.toGetMetricHistoryResponse(httpCaller.get(builder.toString())).getMetricsList();
  }

  /**
   * Create a new run under the default experiment with no application name.
   * @return RunInfo created by the server.
   */
  public RunInfo createRun() {
    return createRun(DEFAULT_EXPERIMENT_ID);
  }

  /**
   * Create a new run under the given experiment.
   * @return RunInfo created by the server.
   */
  public RunInfo createRun(String experimentId) {
    CreateRun.Builder request = CreateRun.newBuilder();
    request.setExperimentId(experimentId);
    request.setStartTime(System.currentTimeMillis());
    // userId is deprecated and will be removed in a future release.
    // It should be set as the `mlflow.user` tag instead.
    String username = System.getProperty("user.name");
    if (username != null) {
      request.setUserId(System.getProperty("user.name"));
    }
    return createRun(request.build());
  }

  /**
   * Create a new run. This method allows providing all possible fields of CreateRun, and can be
   * invoked as follows:
   *
   *

   *   import org.mlflow.api.proto.Service.CreateRun;
   *   CreateRun.Builder request = CreateRun.newBuilder();
   *   request.setExperimentId(experimentId);
   *   request.setSourceVersion("my-version");
   *   createRun(request.build());
   *

   *
   * @return RunInfo created by the server.
   */
  public RunInfo createRun(CreateRun request) {
    String ijson = mapper.toJson(request);
    String ojson = sendPost("runs/create", ijson);
    return mapper.toCreateRunResponse(ojson).getRun().getInfo();
  }

  /**
   * @return A list of all RunInfos associated with the given experiment.
   */
  public List<RunInfo> listRunInfos(String experimentId) {
    List<String> experimentIds = new ArrayList<>();
    experimentIds.add(experimentId);
    return searchRuns(experimentIds, null);
  }

  /**
   * Return RunInfos from provided list of experiments that satisfy the search query.
   * @deprecated As of 1.1.0 - please use {@link #searchRuns(List, String, ViewType, int)} or
   *                    similar that returns a page of Run results.
   *
   * @param experimentIds List of experiment IDs.
   * @param searchFilter SQL compatible search query string. Format of this query string is
   *                     similar to that specified on MLflow UI.
   *                     Example : "params.model = 'LogisticRegression' and metrics.acc = 0.9"
   *                     If null, the result will be equivalent to having an empty search filter.
   *
   * @return A list of all RunInfos that satisfy search filter.
   */
  public List<RunInfo> searchRuns(List<String> experimentIds, String searchFilter) {
    return searchRuns(experimentIds, searchFilter, ViewType.ACTIVE_ONLY, 1000).getItems().stream()
      .map(Run::getInfo).collect(Collectors.toList());
  }

  /**
   * Return RunInfos from provided list of experiments that satisfy the search query.
   * @deprecated As of 1.1.0 - please use {@link #searchRuns(List, String, ViewType, int)} or
   *                    similar that returns a page of Run results.
   *
   * @param experimentIds List of experiment IDs.
   * @param searchFilter SQL compatible search query string. Format of this query string is
   *                     similar to that specified on MLflow UI.
   *                     Example : "params.model = 'LogisticRegression' and metrics.acc != 0.9"
   *                     If null, the result will be equivalent to having an empty search filter.
   * @param runViewType ViewType for expected runs. One of (ACTIVE_ONLY, DELETED_ONLY, ALL)
   *                    If null, only runs with viewtype ACTIVE_ONLY will be searched.
   *
   * @return A list of all RunInfos that satisfy search filter.
   */
  public List<RunInfo> searchRuns(List<String> experimentIds,
                              String searchFilter,
                              ViewType runViewType) {
    return searchRuns(experimentIds, searchFilter, runViewType, 1000).getItems().stream()
      .map(Run::getInfo).collect(Collectors.toList());
  }

  /**
   * Return runs from provided list of experiments that satisfy the search query.
   *
   * @param experimentIds List of experiment IDs.
   * @param searchFilter SQL compatible search query string. Format of this query string is
   *                     similar to that specified on MLflow UI.
   *                     Example : "params.model = 'LogisticRegression' and metrics.acc != 0.9"
   *                     If null, the result will be equivalent to having an empty search filter.
   * @param runViewType ViewType for expected runs. One of (ACTIVE_ONLY, DELETED_ONLY, ALL)
   *                    If null, only runs with viewtype ACTIVE_ONLY will be searched.
   * @param maxResults Maximum number of runs desired in one page.
   *
   * @return A list of all Runs that satisfy search filter.
   */
  public RunsPage searchRuns(List<String> experimentIds,
                              String searchFilter,
                              ViewType runViewType,
                              int maxResults) {
    return searchRuns(experimentIds, searchFilter, runViewType, maxResults, new ArrayList<>(),
                      null);
  }

  /**
   * Return runs from provided list of experiments that satisfy the search query.
   *
   * @param experimentIds List of experiment IDs.
   * @param searchFilter SQL compatible search query string. Format of this query string is
   *                     similar to that specified on MLflow UI.
   *                     Example : "params.model = 'LogisticRegression' and metrics.acc != 0.9"
   *                     If null, the result will be equivalent to having an empty search filter.
   * @param runViewType ViewType for expected runs. One of (ACTIVE_ONLY, DELETED_ONLY, ALL)
   *                    If null, only runs with viewtype ACTIVE_ONLY will be searched.
   * @param maxResults Maximum number of runs desired in one page.
   * @param orderBy List of properties to order by. Example: "metrics.acc DESC".
   *
   * @return A list of all Runs that satisfy search filter.
   */
  public RunsPage searchRuns(List<String> experimentIds,
                              String searchFilter,
                              ViewType runViewType,
                              int maxResults,
                              List<String> orderBy) {
    return searchRuns(experimentIds, searchFilter, runViewType, maxResults, orderBy, null);
  }

  /**
   * Return runs from provided list of experiments that satisfy the search query.
   *
   * @param experimentIds List of experiment IDs.
   * @param searchFilter SQL compatible search query string. Format of this query string is
   *                     similar to that specified on MLflow UI.
   *                     Example : "params.model = 'LogisticRegression' and metrics.acc != 0.9"
   *                     If null, the result will be equivalent to having an empty search filter.
   * @param runViewType ViewType for expected runs. One of (ACTIVE_ONLY, DELETED_ONLY, ALL)
   *                    If null, only runs with viewtype ACTIVE_ONLY will be searched.
   * @param maxResults Maximum number of runs desired in one page.
   * @param orderBy List of properties to order by. Example: "metrics.acc DESC".
   * @param pageToken String token specifying the next page of results. It should be obtained from
   *             a call to {@link #searchRuns(List, String)}.
   *
   * @return A page of Runs that satisfy the search filter.
   */
  public RunsPage searchRuns(List<String> experimentIds,
                              String searchFilter,
                              ViewType runViewType,
                              int maxResults,
                              List<String> orderBy,
                              String pageToken) {
    SearchRuns.Builder builder = SearchRuns.newBuilder()
            .addAllExperimentIds(experimentIds)
            .addAllOrderBy(orderBy)
            .setMaxResults(maxResults);

    if (searchFilter != null) {
      builder.setFilter(searchFilter);
    }
    if (runViewType != null) {
      builder.setRunViewType(runViewType);
    }
    if (pageToken != null) {
      builder.setPageToken(pageToken);
    }
    SearchRuns request = builder.build();
    String ijson = mapper.toJson(request);
    String ojson = sendPost("runs/search", ijson);
    SearchRuns.Response response = mapper.toSearchRunsResponse(ojson);
    return new RunsPage(response.getRunsList(), response.getNextPageToken(), experimentIds,
      searchFilter, runViewType, maxResults, orderBy, this);
  }

  /**
   * Return experiments that satisfy the search query.
   *
   * @param searchFilter SQL compatible search query string.
   *                     Examples:
   *                         - "attribute.name = 'MyExperiment'"
   *                         - "tags.problem_type = 'iris_regression'"
   *                     If null, the result will be equivalent to having an empty search filter.
   * @param experimentViewType ViewType for expected experiments. One of
   *                           (ACTIVE_ONLY, DELETED_ONLY, ALL). If null, only experiments with
   *                           viewtype ACTIVE_ONLY will be searched.
   * @param maxResults Maximum number of experiments desired in one page.
   * @param orderBy List of properties to order by. Example: "metrics.acc DESC".
   *
   * @return A page of experiments that satisfy the search filter.
   */
  public ExperimentsPage searchExperiments(String searchFilter,
                                           ViewType experimentViewType,
                                           int maxResults,
                                           List<String> orderBy) {
    return searchExperiments(searchFilter, experimentViewType, maxResults, orderBy, null);
  }

  /**
   * Return up to 1000 active experiments.
   *
   * @return A page of active experiments with up to 1000 items.
   */
  public ExperimentsPage searchExperiments() {
    return searchExperiments("", null, 1000, new ArrayList<>(), null);
  }

  /**
   * Return up to the first 1000 active experiments that satisfy the search query.
   *
   * @param searchFilter SQL compatible search query string.
   *                     Examples:
   *                         - "attribute.name = 'MyExperiment'"
   *                         - "tags.problem_type = 'iris_regression'"
   *                     If null, the result will be equivalent to having an empty search filter.
   *
   * @return A page of up to active 1000 experiments that satisfy the search filter.
   */
  public ExperimentsPage searchExperiments(String searchFilter) {
    return searchExperiments(searchFilter, null, 1000, new ArrayList<>(), null);
  }

  /**
   * Return experiments that satisfy the search query.
   *
   * @param searchFilter SQL compatible search query string.
   *                     Examples:
   *                         - "attribute.name = 'MyExperiment'"
   *                         - "tags.problem_type = 'iris_regression'"
   *                     If null, the result will be equivalent to having an empty search filter.
   * @param experimentViewType ViewType for expected experiments. One of
   *                           (ACTIVE_ONLY, DELETED_ONLY, ALL). If null, only experiments with
   *                           viewtype ACTIVE_ONLY will be searched.
   * @param maxResults Maximum number of experiments desired in one page.
   * @param orderBy List of properties to order by. Example: "metrics.acc DESC".
   * @param pageToken String token specifying the next page of results. It should be obtained from
   *             a call to {@link #searchExperiments(String)}.
   *
   * @return A page of experiments that satisfy the search filter.
   */
  public ExperimentsPage searchExperiments(String searchFilter,
                                           ViewType experimentViewType,
                                           int maxResults,
                                           List<String> orderBy,
                                           String pageToken) {
    SearchExperiments.Builder builder = SearchExperiments.newBuilder()
            .addAllOrderBy(orderBy)
            .setMaxResults(maxResults);

    if (searchFilter != null) {
      builder.setFilter(searchFilter);
    }
    if (experimentViewType != null) {
      builder.setViewType(experimentViewType);
    } else {
      builder.setViewType(ViewType.ACTIVE_ONLY);
    }
    if (pageToken != null) {
      builder.setPageToken(pageToken);
    }
    SearchExperiments request = builder.build();
    String ijson = mapper.toJson(request);
    String ojson = sendPost("experiments/search", ijson);
    SearchExperiments.Response response = mapper.toSearchExperimentsResponse(ojson);
    return new ExperimentsPage(response.getExperimentsList(), response.getNextPageToken(),
      searchFilter, experimentViewType, maxResults, orderBy, this);
  }

  /** @return  An experiment with the given ID. */
  public Experiment getExperiment(String experimentId) {
    URIBuilder builder = newURIBuilder("experiments/get")
      .setParameter("experiment_id", experimentId);
    return mapper.toGetExperimentResponse(httpCaller.get(builder.toString())).getExperiment();
  }

  /** @return  The experiment associated with the given name or Optional.empty if none exists. */
  public Optional<Experiment> getExperimentByName(String experimentName) {
    URIBuilder builder = newURIBuilder("experiments/get-by-name")
      .setParameter("experiment_name", experimentName);
    try {
      return Optional.of(
          mapper.toGetExperimentByNameResponse(httpCaller.get(builder.toString())).getExperiment()
      );
    } catch (MlflowHttpException e) {
      if (e.getStatusCode() == 404) {
        return Optional.<Experiment>empty();
      } else {
        throw e;
      }
    }
  }

  /**
   * Create a new experiment using the default artifact location provided by the server.
   * @param experimentName Name of the experiment. This must be unique across all experiments.
   * @return Experiment ID of the newly created experiment.
   */
  public String createExperiment(String experimentName) {
    String ijson = mapper.makeCreateExperimentRequest(experimentName);
    String ojson = httpCaller.post("experiments/create", ijson);
    return mapper.toCreateExperimentResponse(ojson).getExperimentId();
  }

  /**
   * Create a new experiment. This method allows providing all possible
   * fields of CreateExperiment, and can be invoked as follows:
   *
   *

   *   import org.mlflow.api.proto.Service.CreateExperiment;
   *   CreateExperiment.Builder request = CreateExperiment.newBuilder();
   *   request.setName(name);
   *   request.setArtifactLocation(artifactLocation);
   *   request.addTags(experimentTag);
   *   createExperiment(request.build());
   *

   *
   * @return ID of the experiment created by the server.
   */
  public String createExperiment(CreateExperiment request) {
    String ijson = mapper.toJson(request);
    String ojson = sendPost("experiments/create", ijson);
    return mapper.toCreateExperimentResponse(ojson).getExperimentId();
  }

  /** Mark an experiment and associated runs, params, metrics, etc. for deletion. */
  public void deleteExperiment(String experimentId) {
    String ijson = mapper.makeDeleteExperimentRequest(experimentId);
    httpCaller.post("experiments/delete", ijson);
  }

  /** Restore an experiment marked for deletion. */
  public void restoreExperiment(String experimentId) {
    String ijson = mapper.makeRestoreExperimentRequest(experimentId);
    httpCaller.post("experiments/restore", ijson);
  }

  /** Update an experiment's name. The new name must be unique. */
  public void renameExperiment(String experimentId, String newName) {
    String ijson = mapper.makeUpdateExperimentRequest(experimentId, newName);
    httpCaller.post("experiments/update", ijson);
  }

  /**
   * Delete a run with the given ID.
   */
  public void deleteRun(String runId) {
    String ijson = mapper.makeDeleteRun(runId);
    httpCaller.post("runs/delete", ijson);
  }

  /**
   * Restore a deleted run with the given ID.
   */
  public void restoreRun(String runId) {
    String ijson = mapper.makeRestoreRun(runId);
    httpCaller.post("runs/restore", ijson);
  }

  /**
   * Log a parameter against the given run, as a key-value pair.
   * This cannot be called against the same parameter key more than once.
   */
  public void logParam(String runId, String key, String value) {
    sendPost("runs/log-parameter", mapper.makeLogParam(runId, key, value));
  }

  /**
   * Log a new metric against the given run, as a key-value pair. Metrics are recorded
   * against two axes: timestamp and step. This method uses the number of milliseconds
   * since the Unix epoch for the timestamp, and it uses the default step of zero.
   *
   * @param runId The ID of the run in which to record the metric.
   * @param key The key identifying the metric for which to record the specified value.
   * @param value The value of the metric.
   */
  public void logMetric(String runId, String key, double value) {
    logMetric(runId, key, value, System.currentTimeMillis(), 0);
  }

  /**
   * Log a new metric against the given run, as a key-value pair. Metrics are recorded
   * against two axes: timestamp and step.
   *
   * @param runId The ID of the run in which to record the metric.
   * @param key The key identifying the metric for which to record the specified value.
   * @param value The value of the metric.
   * @param timestamp The timestamp at which to record the metric value.
   * @param step The step at which to record the metric value.
   */
  public void logMetric(String runId, String key, double value, long timestamp, long step) {
    sendPost("runs/log-metric", mapper.makeLogMetric(runId, key, value, timestamp, step));
  }

  /**
   * Log a new tag against the given experiment as a key-value pair.
   * @param experimentId The ID of the experiment on which to set the tag
   * @param key The key used to identify the tag.
   * @param value The value of the tag.
   */
  public void setExperimentTag(String experimentId, String key, String value) {
    sendPost("experiments/set-experiment-tag",
            mapper.makeSetExperimentTag(experimentId, key, value));
  }

  /**
   * Log a new tag against the given run, as a key-value pair.
   * @param runId The ID of the run on which to set the tag
   * @param key The key used to identify the tag.
   * @param value The value of the tag.
   */
  public void setTag(String runId, String key, String value) {
    sendPost("runs/set-tag", mapper.makeSetTag(runId, key, value));
  }

  /**
   * Delete a tag on the run ID with a specific key. This is irreversible.
   * @param runId String ID of the run
   * @param key Name of the tag
   */
  public void deleteTag(String runId, String key) {
    sendPost("runs/delete-tag", mapper.makeDeleteTag(runId, key));
  }

  /**
   * Log multiple metrics, params, and/or tags against a given run (argument runId).
   * Argument metrics, params, and tag iterables can be nulls.
   */
  public void logBatch(String runId,
      Iterable<Metric> metrics,
      Iterable<Param> params,
      Iterable<RunTag> tags) {
    sendPost("runs/log-batch", mapper.makeLogBatch(runId, metrics, params, tags));
  }

  /** Set the status of a run to be FINISHED at the current time. */
  public void setTerminated(String runId) {
    setTerminated(runId, RunStatus.FINISHED);
  }

  /** Set the status of a run to be completed at the current time. */
  public void setTerminated(String runId, RunStatus status) {
    setTerminated(runId, status, System.currentTimeMillis());
  }

  /** Set the status of a run to be completed at the given endTime. */
  public void setTerminated(String runId, RunStatus status, long endTime) {
    sendPost("runs/update", mapper.makeUpdateRun(runId, status, endTime));
  }

  /**
   * Send a GET to the following path, including query parameters.
   * This is mostly an internal API, but allows making lower-level or unsupported requests.
   * @return JSON response from the server.
   */
  public String sendGet(String path) {
    return httpCaller.get(path);
  }

  /**
   * Send a POST to the following path, with a String-encoded JSON body.
   * This is mostly an internal API, but allows making lower-level or unsupported requests.
   * @return JSON response from the server.
   */
  public String sendPost(String path, String json) {
    return httpCaller.post(path, json);
  }

  public String sendPatch(String path, String json) {
    return httpCaller.patch(path, json);
  }

  /**
   * @return HostCredsProvider backing this MlflowClient. Visible for testing.
   */
  MlflowHostCredsProvider getInternalHostCredsProvider() {
    return hostCredsProvider;
  }

  private URIBuilder newURIBuilder(String base) {
    try {
      return new URIBuilder(base);
    } catch (URISyntaxException e) {
      throw new MlflowClientException("Failed to construct URI for " + base, e);
    }
  }

  /**
   * Return the tracking URI from MLFLOW_TRACKING_URI or throws if not available.
   * This is used as the body of the no-argument constructor, as constructors must first call
   * this().
   */
  private static String getDefaultTrackingUri() {
    String defaultTrackingUri = System.getenv("MLFLOW_TRACKING_URI");
    if (defaultTrackingUri == null) {
      throw new IllegalStateException("Default client requires MLFLOW_TRACKING_URI is set." +
        " Use fromTrackingUri() instead.");
    }
    return defaultTrackingUri;
  }

  /**
   * Return the MlflowHostCredsProvider associated with the given tracking URI.
   * This is used as the body of the String-argument constructor, as constructors must first call
   * this().
   */
  private static MlflowHostCredsProvider getHostCredsProviderFromTrackingUri(String trackingUri) {
    URI uri = URI.create(trackingUri);
    MlflowHostCredsProvider provider;

    if ("http".equals(uri.getScheme()) || "https".equals(uri.getScheme())) {
      provider = new BasicMlflowHostCreds(trackingUri);
    } else if (trackingUri.equals("databricks")) {
      MlflowHostCredsProvider profileProvider = new DatabricksConfigHostCredsProvider();
      MlflowHostCredsProvider dynamicProvider =
        DatabricksDynamicHostCredsProvider.createIfAvailable();
      if (dynamicProvider != null) {
        provider = new HostCredsProviderChain(dynamicProvider, profileProvider);
      } else {
        provider = profileProvider;
      }
    } else if ("databricks".equals(uri.getScheme())) {
      provider = new DatabricksConfigHostCredsProvider(uri.getHost());
    } else if (uri.getScheme() == null || "file".equals(uri.getScheme())) {
      throw new IllegalArgumentException("Java Client currently does not support" +
        " local tracking URIs. Please point to a Tracking Server.");
    } else {
      throw new IllegalArgumentException("Invalid tracking server uri: " + trackingUri);
    }
    return provider;
  }

  /**
   * Upload the given local file or directory to the run's root artifact directory. For example,
   *
   *

   *   logArtifact(runId, "/my/localModel")
   *   listArtifacts(runId) // returns "localModel"
   *

   *
   * @param runId Run ID of an existing MLflow run.
   * @param localFile File or directory to upload. Must exist.
   */
  public void logArtifact(String runId, File localFile) {
    if (localFile.isDirectory()) {
      getArtifactRepository(runId).logArtifacts(localFile, localFile.getName());
    }
    else {
      getArtifactRepository(runId).logArtifact(localFile);
    }
  }

  /**
   * Upload the given local file or directory to an artifactPath
   * within the run's root directory. For example,
   *
   *

   *   logArtifact(runId, "/my/localModel", "model")
   *   listArtifacts(runId, "model") // returns "model/localModel"
   *

   *
   * (i.e., the localModel file is now available in model/localModel).
   * If logging a directory, the directory is renamed to artifactPath.
   *
   * @param runId Run ID of an existing MLflow run.
   * @param localFile File or directory to upload. Must exist.
   * @param artifactPath Artifact path relative to the run's root directory. Should NOT
   *                     start with a /.
   */
  public void logArtifact(String runId, File localFile, String artifactPath) {
    if (localFile.isDirectory()) {
      getArtifactRepository(runId).logArtifacts(localFile, artifactPath);
    }
    else {
      getArtifactRepository(runId).logArtifact(localFile, artifactPath);
    }
  }

  /**
   * Upload all files within the given local directory the run's root artifact directory.
   * For example, if /my/local/dir/ contains two files "file1" and "file2", then
   *
   *

   *   logArtifacts(runId, "/my/local/dir")
   *   listArtifacts(runId) // returns "file1" and "file2"
   *

   *
   * @param runId Run ID of an existing MLflow run.
   * @param localDir Directory to upload. Must exist, and must be a directory (not a simple file).
   */
  public void logArtifacts(String runId, File localDir) {
    getArtifactRepository(runId).logArtifacts(localDir);
  }

  /**
   * Upload all files within the given local director an artifactPath within the run's root
   * artifact directory. For example, if /my/local/dir/ contains two files "file1" and "file2", then
   *
   *

   *   logArtifacts(runId, "/my/local/dir", "model")
   *   listArtifacts(runId, "model") // returns "model/file1" and "model/file2"
   *

   *
   * (i.e., the contents of the local directory are now available in model/).
   *
   * @param runId Run ID of an existing MLflow run.
   * @param localDir Directory to upload. Must exist, and must be a directory (not a simple file).
   * @param artifactPath Artifact path relative to the run's root directory. Should NOT
   *                     start with a /.
   */
  public void logArtifacts(String runId, File localDir, String artifactPath) {
    getArtifactRepository(runId).logArtifacts(localDir, artifactPath);
  }

  /**
   * List the artifacts immediately under the run's root artifact directory. This does not
   * recursively list; instead, it will return FileInfos with isDir=true where further
   * listing may be done.
   * @param runId Run ID of an existing MLflow run.
   */
  public List<FileInfo> listArtifacts(String runId) {
    return getArtifactRepository(runId).listArtifacts();
  }

  /**
   * List the artifacts immediately under the given artifactPath within the run's root artifact
   * directory. This does not recursively list; instead, it will return FileInfos with isDir=true
   * where further listing may be done.
   * @param runId Run ID of an existing MLflow run.
   * @param artifactPath Artifact path relative to the run's root directory. Should NOT
   *                     start with a /.
   */
  public List<FileInfo> listArtifacts(String runId, String artifactPath) {
    return getArtifactRepository(runId).listArtifacts(artifactPath);
  }

  /**
   * Return a local directory containing *all* artifacts within the run's artifact directory.
   * Note that this will download the entire directory path, and so may be expensive if
   * the directory has a lot of data.
   * @param runId Run ID of an existing MLflow run.
   */
  public File downloadArtifacts(String runId) {
    return getArtifactRepository(runId).downloadArtifacts();
  }

  /**
   * Return a local file or directory containing all artifacts within the given artifactPath
   * within the run's root artifactDirectory. For example, if "model/file1" and "model/file2"
   * exist within the artifact directory, then
   *
   *

   *   downloadArtifacts(runId, "model") // returns a local directory containing "file1" and "file2"
   *   downloadArtifacts(runId, "model/file1") // returns a local *file* with the contents of file1.
   *

   *
   * Note that this will download the entire subdirectory path, and so may be expensive if
   * the subdirectory has a lot of data.
   *
   * @param runId Run ID of an existing MLflow run.
   * @param artifactPath Artifact path relative to the run's root directory. Should NOT
   *                     start with a /.
   */
  public File downloadArtifacts(String runId, String artifactPath) {
    return getArtifactRepository(runId).downloadArtifacts(artifactPath);
  }

  /**
   * @param runId Run ID of an existing MLflow run.
   * @return ArtifactRepository, capable of uploading and downloading MLflow artifacts.
   */
  private ArtifactRepository getArtifactRepository(String runId) {
    URI baseArtifactUri = URI.create(getRun(runId).getInfo().getArtifactUri());
    return artifactRepositoryFactory.getArtifactRepository(baseArtifactUri, runId);
  }

  // ********************
  // * Model Registry *
  // ********************

  /**
   * Return the latest model version for each stage.
   * The current available stages are: [None, Staging, Production, Archived].
   *
   *

   *        import org.mlflow.api.proto.ModelRegistry.ModelVersion;
   *        List{@code <ModelVersion>} detailsList = getLatestVersions("model");
   *
   *        for (ModelVersion details : detailsList) {
   *            System.out.println("Model Name: " + details.getModelVersion()
   *                                                       .getRegisteredModel()
   *                                                       .getName());
   *            System.out.println("Model Version: " + details.getModelVersion().getVersion());
   *            System.out.println("Current Stage: " + details.getCurrentStage());
   *        }
   *

   *
   * @param modelName The name of the model
   * @return A collection of {@link org.mlflow.api.proto.ModelRegistry.ModelVersion}
   */
  public List<ModelVersion> getLatestVersions(String modelName) {
      return getLatestVersions(modelName, Collections.emptyList());
  }

  /**
   * Return the latest model version for each stage requested.
   * The current available stages are: [None, Staging, Production, Archived].
   *
   *

   *        import org.mlflow.api.proto.ModelRegistry.ModelVersion;
   *        List{@code <ModelVersion>} detailsList =
   *          getLatestVersions("model", Lists.newArrayList{@code <String>}("Staging"));
   *
   *        for (ModelVersion details : detailsList) {
   *            System.out.println("Model Name: " + details.getModelVersion()
   *                                                       .getRegisteredModel()
   *                                                       .getName());
   *            System.out.println("Model Version: " + details.getModelVersion().getVersion());
   *            System.out.println("Current Stage: " + details.getCurrentStage());
   *        }
   *

   *
   * @param modelName The name of the model
   * @param stages A list of stages
   * @return The latest model version
   *         {@link org.mlflow.api.proto.ModelRegistry.ModelVersion}
   */
  public List<ModelVersion> getLatestVersions(String modelName, Iterable<String> stages) {
    String json = sendGet(mapper.makeGetLatestVersion(modelName, stages));
    GetLatestVersions.Response response =  mapper.toGetLatestVersionsResponse(json);
    return response.getModelVersionsList();
  }

  /**
   *
   *

   *       import org.mlflow.api.proto.ModelRegistry.ModelVersion;
   *       ModelVersion modelVersion = getModelVersion("model", "version");
   *

   *
   * @param modelName Name of the containing registered model. *
   * @param version Version number as a string of the model version.
   * @return a single model version
   *        {@link org.mlflow.api.proto.ModelRegistry.ModelVersion}
   */
  public ModelVersion getModelVersion(String modelName, String version) {
    String json = sendGet(mapper.makeGetModelVersion(modelName, version));
    GetModelVersion.Response response = mapper.toGetModelVersionResponse(json);
    return response.getModelVersion();
  }

  /**
   * Return the model URI containing for the given model version. The model URI can be used
   * to download the model version artifacts.
   *
   *

   *        String modelUri = getModelVersionDownloadUri("model", 0);
   *

   *
   * @param modelName The name of the model
   * @param version The version number of the model
   * @return The specified model version's URI.
   */
  public String getModelVersionDownloadUri(String modelName, String version) {
    String json = sendGet(mapper.makeGetModelVersionDownloadUri(modelName, version));
    return mapper.toGetModelVersionDownloadUriResponse(json);
  }

  /**
   * Returns a directory containing all artifacts within the given registered model
   * version. The method will download the model version artifacts to the local file system. Note
   * that this method will not work if the `download_uri` refers to a single file (and not a
   * directory) due to the way many ArtifactRepository's `download_artifacts` handle empty subpaths.
   *
   *

   *        File modelVersionDir = downloadModelVersion("model", 0);
   *

   *
   * @param modelName The name of the model
   * @param version The version number of the model
   * @return A directory ({@link java.io.File}) containing model artifacts
   */
  public File downloadModelVersion(String modelName, String version) {
    String path = modelName + "/" + version;
    URIBuilder downloadUriBuilder = new URIBuilder()
            .setScheme(DEFAULT_MODELS_ARTIFACT_REPOSITORY_SCHEME).setPath(path);
    CliBasedArtifactRepository repository = new CliBasedArtifactRepository(null, null,
            hostCredsProvider);
    return repository.downloadArtifactFromUri(downloadUriBuilder.toString());
  }

  /**
   * Returns a directory containing all artifacts within the latest registered
   * model version in the given stage. The method will download the model version artifacts
   * to the local file system.
   *
   *

   *        File modelVersionDir = downloadLatestModelVersion("model", "Staging");
   *

   *
   * (i.e., the contents of the local directory are now available).
   *
   * @param modelName The name of the model
   * @param stage The name of the stage
   * @return A directory ({@link java.io.File}) containing model artifacts
   */
  public File downloadLatestModelVersion(String modelName, String stage) {
      List<ModelVersion> versions = getLatestVersions(modelName, Lists.newArrayList(stage));

      if (versions.size() < 1) {
        throw new MlflowClientException("No model version found for " + modelName +
                "and stage " + stage);
      }

      ModelVersion details = versions.get(0);
      return downloadModelVersion(modelName, details.getVersion());
  }

  /**
   * Closes the MlflowClient and releases any associated resources.
   */
  public void close() {
    this.httpCaller.close();
  }
}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
null

#### Original name
Cryptosporium maculans Corda

### Remarks
null


text:
package dictionaries;

import java.util.HashMap;

class Main {
    public static void main(String[] args) {
        // Types
        HashMap<String, Integer> foo = new HashMap<String, Integer>();
        HashMap<String, HashMap<String, Integer>> bar = new HashMap<String, HashMap<String, Integer>>();

        // Indices
        foo.put("baz", 7);
        Integer qux = foo.get("baz");
        System.out.println(String.format("baz is %d", foo.get("baz")));
        System.out.println(String.format("qux is %d", qux));

        // Initialization
        HashMap<String, Integer> container = new HashMap<String, Integer>() {{
            put("bbb", 1);
            put("ccc", 2);
            put("ddd", 3);
        }};

        // Contains Key
        Boolean containsFalse = container.containsKey("aaa");

        if (containsFalse) {
            System.out.println("wrong");
        }

        if (container.containsKey("bbb")) {
            System.out.println("contains bbb");
        }

        // Setting
        container.put("aaa", 7);
        System.out.println(container.get("aaa"));
    }
}