text:
.class public Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;
.super Ljava/lang/Object;
.source "FlashlightControllerImpl.java"

# interfaces
.implements Lcom/android/systemui/statusbar/policy/FlashlightController;

# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl$1;,
        Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl$FlashlightBrightnessObserver;
    }
.end annotation

# static fields
.field private static final DEBUG:Z

.field protected static final FLASHLIGHT_VALUE:[I

# instance fields
.field private mCalendar:Ljava/util/Calendar;

.field private mCameraId:Ljava/lang/String;

.field private mCameraManager:Landroid/hardware/camera2/CameraManager;

.field private mCfmsService:Landroid/os/CustomFrequencyManager;

.field private final mContext:Landroid/content/Context;

.field protected mFlashLightDebugLogs:Ljava/util/ArrayList;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/ArrayList",
            "<",
            "Ljava/lang/String;",
            ">;"
        }
    .end annotation
.end field

.field private mFlashlightBrightnessObserver:Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl$FlashlightBrightnessObserver;

.field private mFlashlightEnabled:Z

.field private mFlashlightLevel:I

.field private mHandler:Landroid/os/Handler;

.field private final mListeners:Ljava/util/ArrayList;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/ArrayList",
            "<",
            "Ljava/lang/ref/WeakReference",
            "<",
            "Lcom/android/systemui/statusbar/policy/FlashlightController$FlashlightListener;",
            ">;>;"
        }
    .end annotation
.end field

.field private mTorchAvailable:Z

.field private final mTorchCallback:Landroid/hardware/camera2/CameraManager$TorchCallback;

# direct methods
.method static synthetic -get0()Z
    .locals 1

    sget-boolean v0, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->DEBUG:Z

    return v0
.end method

.method static synthetic -get1(Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;)Ljava/lang/String;
    .locals 1

    iget-object v0, p0, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->mCameraId:Ljava/lang/String;

    return-object v0
.end method

.method static synthetic -get2(Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;)Landroid/hardware/camera2/CameraManager;
    .locals 1

    iget-object v0, p0, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->mCameraManager:Landroid/hardware/camera2/CameraManager;

    return-object v0
.end method

.method static synthetic -get3(Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;)Landroid/content/Context;
    .locals 1

    iget-object v0, p0, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->mContext:Landroid/content/Context;

    return-object v0
.end method

.method static synthetic -get4(Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;)Z
    .locals 1

    iget-boolean v0, p0, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->mFlashlightEnabled:Z

    return v0
.end method

.method static synthetic -get5(Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;)I
    .locals 1

    iget v0, p0, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->mFlashlightLevel:I

    return v0
.end method

.method static synthetic -get6(Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;)Landroid/os/Handler;
    .locals 1

    iget-object v0, p0, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->mHandler:Landroid/os/Handler;

    return-object v0
.end method

.method static synthetic -get7(Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;)Z
    .locals 1

    iget-boolean v0, p0, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->mTorchAvailable:Z

    return v0
.end method

.method static synthetic -get8(Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;)Landroid/hardware/camera2/CameraManager$TorchCallback;
    .locals 1

    iget-object v0, p0, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->mTorchCallback:Landroid/hardware/camera2/CameraManager$TorchCallback;

    return-object v0
.end method

.method static synthetic -set0(Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;Ljava/lang/String;)Ljava/lang/String;
    .locals 0

    iput-object p1, p0, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->mCameraId:Ljava/lang/String;

    return-object p1
.end method

.method static synthetic -set1(Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;Landroid/hardware/camera2/CameraManager;)Landroid/hardware/camera2/CameraManager;
    .locals 0

    iput-object p1, p0, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->mCameraManager:Landroid/hardware/camera2/CameraManager;

    return-object p1
.end method

.method static synthetic -set2(Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;Z)Z
    .locals 0

    iput-boolean p1, p0, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->mFlashlightEnabled:Z

    return p1
.end method

.method static synthetic -set3(Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;I)I
    .locals 0

    iput p1, p0, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->mFlashlightLevel:I

    return p1
.end method

.method static synthetic -set4(Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;Z)Z
    .locals 0

    iput-boolean p1, p0, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->mTorchAvailable:Z

    return p1
.end method

.method static synthetic -wrap0(Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;I)I
    .locals 1

    invoke-direct {p0, p1}, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->convertToFlashlightLevel(I)I

    move-result v0

    return v0
.end method

.method static synthetic -wrap1(Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;)Ljava/lang/String;
    .locals 1

    invoke-direct {p0}, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->getCameraId()Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method

.method static synthetic -wrap2(Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;)Ljava/lang/String;
    .locals 1

    invoke-direct {p0}, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->makeTime()Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method

.method static synthetic -wrap3(Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;Z)V
    .locals 0

    invoke-direct {p0, p1}, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->dispatchAvailabilityChanged(Z)V

    return-void
.end method

.method static synthetic -wrap4(Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;Z)V
    .locals 0

    invoke-direct {p0, p1}, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->dispatchModeChanged(Z)V

    return-void
.end method

.method static constructor <clinit>()V
    .locals 5

    const-string/jumbo v0, "FlashlightController"

    const/4 v1, 0x3

    invoke-static {v0, v1}, Landroid/util/Log;->isLoggable(Ljava/lang/String;I)Z

    move-result v0

    sput-boolean v0, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->DEBUG:Z

    const/16 v0, 0x3e9

    const/16 v1, 0x3ea

    const/16 v2, 0x3ec

    const/16 v3, 0x3ee

    const/16 v4, 0x3f1

    filled-new-array {v0, v1, v2, v3, v4}, [I

    move-result-object v0

    sput-object v0, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->FLASHLIGHT_VALUE:[I

    return-void
.end method

.method public constructor <init>(Landroid/content/Context;)V
    .locals 3

    const/4 v2, 0x0

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

    new-instance v0, Ljava/util/ArrayList;

    const/4 v1, 0x1

    invoke-direct {v0, v1}, Ljava/util/ArrayList;-><init>(I)V

    iput-object v0, p0, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->mListeners:Ljava/util/ArrayList;

    iput-object v2, p0, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->mFlashlightBrightnessObserver:Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl$FlashlightBrightnessObserver;

    new-instance v0, Ljava/util/ArrayList;

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

    iput-object v0, p0, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->mFlashLightDebugLogs:Ljava/util/ArrayList;

    invoke-static {}, Ljava/util/TimeZone;->getDefault()Ljava/util/TimeZone;

    move-result-object v0

    invoke-static {v0}, Ljava/util/Calendar;->getInstance(Ljava/util/TimeZone;)Ljava/util/Calendar;

    move-result-object v0

    iput-object v0, p0, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->mCalendar:Ljava/util/Calendar;

    new-instance v0, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl$1;

    invoke-direct {v0, p0}, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl$1;-><init>(Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;)V

    iput-object v0, p0, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->mTorchCallback:Landroid/hardware/camera2/CameraManager$TorchCallback;

    iput-object p1, p0, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->mContext:Landroid/content/Context;

    iput-object v2, p0, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->mCameraManager:Landroid/hardware/camera2/CameraManager;

    iput-object v2, p0, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->mCameraId:Ljava/lang/String;

    iget-object v0, p0, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->mContext:Landroid/content/Context;

    const-string/jumbo v1, "CustomFrequencyManagerService"

    invoke-virtual {v0, v1}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Landroid/os/CustomFrequencyManager;

    iput-object v0, p0, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->mCfmsService:Landroid/os/CustomFrequencyManager;

    new-instance v0, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl$FlashlightBrightnessObserver;

    invoke-direct {v0, p0}, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl$FlashlightBrightnessObserver;-><init>(Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;)V

    iput-object v0, p0, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->mFlashlightBrightnessObserver:Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl$FlashlightBrightnessObserver;

    invoke-direct {p0}, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->ensureHandler()V

    invoke-virtual {p0}, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->tryInitCamera()V

    return-void
.end method

.method private cleanUpListenersLocked(Lcom/android/systemui/statusbar/policy/FlashlightController$FlashlightListener;)V
    .locals 3

    iget-object v2, p0, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->mListeners:Ljava/util/ArrayList;

    invoke-virtual {v2}, Ljava/util/ArrayList;->size()I

    move-result v2

    add-int/lit8 v1, v2, -0x1

    :goto_0
    if-ltz v1, :cond_2

    iget-object v2, p0, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->mListeners:Ljava/util/ArrayList;

    invoke-virtual {v2, v1}, Ljava/util/ArrayList;->get(I)Ljava/lang/Object;

    move-result-object v2

    check-cast v2, Ljava/lang/ref/WeakReference;

    invoke-virtual {v2}, Ljava/lang/ref/WeakReference;->get()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/android/systemui/statusbar/policy/FlashlightController$FlashlightListener;

    if-eqz v0, :cond_0

    if-ne v0, p1, :cond_1

    :cond_0
    iget-object v2, p0, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->mListeners:Ljava/util/ArrayList;

    invoke-virtual {v2, v1}, Ljava/util/ArrayList;->remove(I)Ljava/lang/Object;

    :cond_1
    add-int/lit8 v1, v1, -0x1

    goto :goto_0

    :cond_2
    return-void
.end method

.method private convertToFlashlightLevel(I)I
    .locals 2

    const/4 v0, 0x0

    :goto_0
    sget-object v1, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->FLASHLIGHT_VALUE:[I

    array-length v1, v1

    if-ge v0, v1, :cond_1

    sget-object v1, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->FLASHLIGHT_VALUE:[I

    aget v1, v1, v0

    if-ne p1, v1, :cond_0

    return v0

    :cond_0
    add-int/lit8 v0, v0, 0x1

    goto :goto_0

    :cond_1
    sget-object v1, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->FLASHLIGHT_VALUE:[I

    array-length v1, v1

    div-int/lit8 v1, v1, 0x2

    return v1
.end method

.method private dispatchAvailabilityChanged(Z)V
    .locals 1

    const/4 v0, 0x2

    invoke-direct {p0, v0, p1}, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->dispatchListeners(IZ)V

    return-void
.end method

.method private dispatchError()V
    .locals 2

    const/4 v0, 0x1

    const/4 v1, 0x0

    invoke-direct {p0, v0, v1}, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->dispatchListeners(IZ)V

    return-void
.end method

.method private dispatchListeners(IZ)V
    .locals 6

    iget-object v5, p0, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->mListeners:Ljava/util/ArrayList;

    monitor-enter v5

    :try_start_0
    iget-object v4, p0, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->mListeners:Ljava/util/ArrayList;

    invoke-virtual {v4}, Ljava/util/ArrayList;->size()I

    move-result v0

    const/4 v1, 0x0

    const/4 v2, 0x0

    :goto_0
    if-ge v2, v0, :cond_4

    iget-object v4, p0, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->mListeners:Ljava/util/ArrayList;

    invoke-virtual {v4, v2}, Ljava/util/ArrayList;->get(I)Ljava/lang/Object;

    move-result-object v4

    check-cast v4, Ljava/lang/ref/WeakReference;

    invoke-virtual {v4}, Ljava/lang/ref/WeakReference;->get()Ljava/lang/Object;

    move-result-object v3

    check-cast v3, Lcom/android/systemui/statusbar/policy/FlashlightController$FlashlightListener;

    if-eqz v3, :cond_3

    if-nez p1, :cond_1

    invoke-interface {v3}, Lcom/android/systemui/statusbar/policy/FlashlightController$FlashlightListener;->onFlashlightError()V

    :cond_0
    :goto_1
    add-int/lit8 v2, v2, 0x1

    goto :goto_0

    :cond_1
    const/4 v4, 0x1

    if-ne p1, v4, :cond_2

    invoke-interface {v3, p2}, Lcom/android/systemui/statusbar/policy/FlashlightController$FlashlightListener;->onFlashlightChanged(Z)V
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    goto :goto_1

    :catchall_0
    move-exception v4

    monitor-exit v5

    throw v4

    :cond_2
    const/4 v4, 0x2

    if-ne p1, v4, :cond_0

    :try_start_1
    invoke-interface {v3, p2}, Lcom/android/systemui/statusbar/policy/FlashlightController$FlashlightListener;->onFlashlightAvailabilityChanged(Z)V

    goto :goto_1

    :cond_3
    const/4 v1, 0x1

    goto :goto_1

    :cond_4
    if-eqz v1, :cond_5

    const/4 v4, 0x0

    invoke-direct {p0, v4}, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->cleanUpListenersLocked(Lcom/android/systemui/statusbar/policy/FlashlightController$FlashlightListener;)V
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    :cond_5
    monitor-exit v5

    return-void
.end method

.method private dispatchModeChanged(Z)V
    .locals 1

    const/4 v0, 0x1

    invoke-direct {p0, v0, p1}, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->dispatchListeners(IZ)V

    return-void
.end method

.method private declared-synchronized ensureHandler()V
    .locals 3

    monitor-enter p0

    :try_start_0
    iget-object v1, p0, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->mHandler:Landroid/os/Handler;

    if-nez v1, :cond_0

    new-instance v0, Landroid/os/HandlerThread;

    const-string/jumbo v1, "FlashlightController"

    const/16 v2, 0xa

    invoke-direct {v0, v1, v2}, Landroid/os/HandlerThread;-><init>(Ljava/lang/String;I)V

    invoke-virtual {v0}, Landroid/os/HandlerThread;->start()V

    new-instance v1, Landroid/os/Handler;

    invoke-virtual {v0}, Landroid/os/HandlerThread;->getLooper()Landroid/os/Looper;

    move-result-object v2

    invoke-direct {v1, v2}, Landroid/os/Handler;-><init>(Landroid/os/Looper;)V

    iput-object v1, p0, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->mHandler:Landroid/os/Handler;
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    :cond_0
    monitor-exit p0

    return-void

    :catchall_0
    move-exception v1

    monitor-exit p0

    throw v1
.end method

.method private getCameraId()Ljava/lang/String;
    .locals 10
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Landroid/hardware/camera2/CameraAccessException;
        }
    .end annotation

    const/4 v9, 0x0

    iget-object v5, p0, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->mCameraManager:Landroid/hardware/camera2/CameraManager;

    invoke-virtual {v5}, Landroid/hardware/camera2/CameraManager;->getCameraIdList()[Ljava/lang/String;

    move-result-object v3

    const/4 v5, 0x0

    array-length v6, v3

    :goto_0
    if-ge v5, v6, :cond_1

    aget-object v2, v3, v5

    iget-object v7, p0, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->mCameraManager:Landroid/hardware/camera2/CameraManager;

    invoke-virtual {v7, v2}, Landroid/hardware/camera2/CameraManager;->getCameraCharacteristics(Ljava/lang/String;)Landroid/hardware/camera2/CameraCharacteristics;

    move-result-object v0

    sget-object v7, Landroid/hardware/camera2/CameraCharacteristics;->FLASH_INFO_AVAILABLE:Landroid/hardware/camera2/CameraCharacteristics$Key;

    invoke-virtual {v0, v7}, Landroid/hardware/camera2/CameraCharacteristics;->get(Landroid/hardware/camera2/CameraCharacteristics$Key;)Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Ljava/lang/Boolean;

    sget-object v7, Landroid/hardware/camera2/CameraCharacteristics;->LENS_FACING:Landroid/hardware/camera2/CameraCharacteristics$Key;

    invoke-virtual {v0, v7}, Landroid/hardware/camera2/CameraCharacteristics;->get(Landroid/hardware/camera2/CameraCharacteristics$Key;)Ljava/lang/Object;

    move-result-object v4

    check-cast v4, Ljava/lang/Integer;

    if-eqz v1, :cond_0

    invoke-virtual {v1}, Ljava/lang/Boolean;->booleanValue()Z

    move-result v7

    if-eqz v7, :cond_0

    if-eqz v4, :cond_0

    invoke-virtual {v4}, Ljava/lang/Integer;->intValue()I

    move-result v7

    const/4 v8, 0x1

    if-ne v7, v8, :cond_0

    return-object v2

    :cond_0
    add-int/lit8 v5, v5, 0x1

    goto :goto_0

    :cond_1
    return-object v9
.end method

.method private makeTime()Ljava/lang/String;
    .locals 4

    iget-object v0, p0, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->mCalendar:Ljava/util/Calendar;

    invoke-static {}, Ljava/lang/System;->currentTimeMillis()J

    move-result-wide v2

    invoke-virtual {v0, v2, v3}, Ljava/util/Calendar;->setTimeInMillis(J)V

    const-string/jumbo v0, "%02d:%02d:%02d.%03d"

    const/4 v1, 0x4

    new-array v1, v1, [Ljava/lang/Object;

    iget-object v2, p0, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->mCalendar:Ljava/util/Calendar;

    const/16 v3, 0xb

    invoke-virtual {v2, v3}, Ljava/util/Calendar;->get(I)I

    move-result v2

    invoke-static {v2}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v2

    const/4 v3, 0x0

    aput-object v2, v1, v3

    iget-object v2, p0, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->mCalendar:Ljava/util/Calendar;

    const/16 v3, 0xc

    invoke-virtual {v2, v3}, Ljava/util/Calendar;->get(I)I

    move-result v2

    invoke-static {v2}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v2

    const/4 v3, 0x1

    aput-object v2, v1, v3

    iget-object v2, p0, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->mCalendar:Ljava/util/Calendar;

    const/16 v3, 0xd

    invoke-virtual {v2, v3}, Ljava/util/Calendar;->get(I)I

    move-result v2

    invoke-static {v2}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v2

    const/4 v3, 0x2

    aput-object v2, v1, v3

    iget-object v2, p0, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->mCalendar:Ljava/util/Calendar;

    const/16 v3, 0xe

    invoke-virtual {v2, v3}, Ljava/util/Calendar;->get(I)I

    move-result v2

    invoke-static {v2}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v2

    const/4 v3, 0x3

    aput-object v2, v1, v3

    invoke-static {v0, v1}, Ljava/lang/String;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method

# virtual methods
.method public addCallback(Lcom/android/systemui/statusbar/policy/FlashlightController$FlashlightListener;)V
    .locals 3

    iget-object v1, p0, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->mListeners:Ljava/util/ArrayList;

    monitor-enter v1

    :try_start_0
    iget-object v0, p0, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->mCameraId:Ljava/lang/String;

    if-nez v0, :cond_0

    invoke-virtual {p0}, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->tryInitCamera()V

    :cond_0
    invoke-direct {p0, p1}, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->cleanUpListenersLocked(Lcom/android/systemui/statusbar/policy/FlashlightController$FlashlightListener;)V

    iget-object v0, p0, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->mListeners:Ljava/util/ArrayList;

    new-instance v2, Ljava/lang/ref/WeakReference;

    invoke-direct {v2, p1}, Ljava/lang/ref/WeakReference;-><init>(Ljava/lang/Object;)V

    invoke-virtual {v0, v2}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z

    iget-boolean v0, p0, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->mTorchAvailable:Z

    invoke-interface {p1, v0}, Lcom/android/systemui/statusbar/policy/FlashlightController$FlashlightListener;->onFlashlightAvailabilityChanged(Z)V

    iget-boolean v0, p0, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->mFlashlightEnabled:Z

    invoke-interface {p1, v0}, Lcom/android/systemui/statusbar/policy/FlashlightController$FlashlightListener;->onFlashlightChanged(Z)V
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    monitor-exit v1

    return-void

    :catchall_0
    move-exception v0

    monitor-exit v1

    throw v0
.end method

.method public bridge synthetic addCallback(Ljava/lang/Object;)V
    .locals 0

    check-cast p1, Lcom/android/systemui/statusbar/policy/FlashlightController$FlashlightListener;

    invoke-virtual {p0, p1}, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->addCallback(Lcom/android/systemui/statusbar/policy/FlashlightController$FlashlightListener;)V

    return-void
.end method

.method public addListener(Lcom/android/systemui/statusbar/policy/FlashlightController$FlashlightListener;)V
    .locals 3

    iget-object v1, p0, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->mListeners:Ljava/util/ArrayList;

    monitor-enter v1

    :try_start_0
    iget-object v0, p0, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->mCameraId:Ljava/lang/String;

    if-nez v0, :cond_0

    invoke-virtual {p0}, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->tryInitCamera()V

    :cond_0
    invoke-direct {p0, p1}, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->cleanUpListenersLocked(Lcom/android/systemui/statusbar/policy/FlashlightController$FlashlightListener;)V

    iget-object v0, p0, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->mListeners:Ljava/util/ArrayList;

    new-instance v2, Ljava/lang/ref/WeakReference;

    invoke-direct {v2, p1}, Ljava/lang/ref/WeakReference;-><init>(Ljava/lang/Object;)V

    invoke-virtual {v0, v2}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    monitor-exit v1

    return-void

    :catchall_0
    move-exception v0

    monitor-exit v1

    throw v0
.end method

.method public dump(Ljava/io/FileDescriptor;Ljava/io/PrintWriter;[Ljava/lang/String;)V
    .locals 4

    const-string/jumbo v2, "FlashlightController state:"

    invoke-virtual {p2, v2}, Ljava/io/PrintWriter;->println(Ljava/lang/String;)V

    const-string/jumbo v2, "  mCameraId="

    invoke-virtual {p2, v2}, Ljava/io/PrintWriter;->print(Ljava/lang/String;)V

    iget-object v2, p0, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->mCameraId:Ljava/lang/String;

    invoke-virtual {p2, v2}, Ljava/io/PrintWriter;->println(Ljava/lang/String;)V

    const-string/jumbo v2, "  mFlashlightEnabled="

    invoke-virtual {p2, v2}, Ljava/io/PrintWriter;->print(Ljava/lang/String;)V

    invoke-virtual {p0}, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->isEnabled()Z

    move-result v2

    invoke-virtual {p2, v2}, Ljava/io/PrintWriter;->println(Z)V

    const-string/jumbo v2, "  mTorchAvailable="

    invoke-virtual {p2, v2}, Ljava/io/PrintWriter;->print(Ljava/lang/String;)V

    iget-boolean v2, p0, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->mTorchAvailable:Z

    invoke-virtual {p2, v2}, Ljava/io/PrintWriter;->println(Z)V

    iget-object v2, p0, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->mFlashLightDebugLogs:Ljava/util/ArrayList;

    invoke-virtual {v2}, Ljava/util/ArrayList;->size()I

    move-result v0

    const/4 v1, 0x0

    :goto_0
    if-ge v1, v0, :cond_0

    new-instance v2, Ljava/lang/StringBuilder;

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

    const-string/jumbo v3, "    ["

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

    move-result-object v2

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

    move-result-object v2

    const-string/jumbo v3, "] "

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

    move-result-object v3

    iget-object v2, p0, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->mFlashLightDebugLogs:Ljava/util/ArrayList;

    invoke-virtual {v2, v1}, Ljava/util/ArrayList;->get(I)Ljava/lang/Object;

    move-result-object v2

    check-cast v2, Ljava/lang/String;

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

    move-result-object v2

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

    move-result-object v2

    invoke-virtual {p2, v2}, Ljava/io/PrintWriter;->println(Ljava/lang/String;)V

    add-int/lit8 v1, v1, 0x1

    goto :goto_0

    :cond_0
    return-void
.end method

.method public getFlashlightLevel()I
    .locals 1

    iget v0, p0, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->mFlashlightLevel:I

    return v0
.end method

.method public hasFlashlight()Z
    .locals 2

    iget-object v0, p0, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->mContext:Landroid/content/Context;

    invoke-virtual {v0}, Landroid/content/Context;->getPackageManager()Landroid/content/pm/PackageManager;

    move-result-object v0

    const-string/jumbo v1, "android.hardware.camera.flash"

    invoke-virtual {v0, v1}, Landroid/content/pm/PackageManager;->hasSystemFeature(Ljava/lang/String;)Z

    move-result v0

    return v0
.end method

.method public declared-synchronized isAvailable()Z
    .locals 1

    monitor-enter p0

    :try_start_0
    invoke-virtual {p0}, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->updateTorchCallback()V

    iget-object v0, p0, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->mCameraId:Ljava/lang/String;

    if-eqz v0, :cond_0

    iget-boolean v0, p0, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->mTorchAvailable:Z
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    :goto_0
    monitor-exit p0

    return v0

    :cond_0
    const/4 v0, 0x0

    goto :goto_0

    :catchall_0
    move-exception v0

    monitor-exit p0

    throw v0
.end method

.method public isCameraManagerReady()Z
    .locals 1

    iget-object v0, p0, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->mCameraId:Ljava/lang/String;

    if-eqz v0, :cond_0

    const/4 v0, 0x1

    :goto_0
    return v0

    :cond_0
    const/4 v0, 0x0

    goto :goto_0
.end method

.method public declared-synchronized isEnabled()Z
    .locals 1

    monitor-enter p0

    :try_start_0
    iget-boolean v0, p0, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->mFlashlightEnabled:Z
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    monitor-exit p0

    return v0

    :catchall_0
    move-exception v0

    monitor-exit p0

    throw v0
.end method

.method public removeCallback(Lcom/android/systemui/statusbar/policy/FlashlightController$FlashlightListener;)V
    .locals 2

    iget-object v0, p0, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->mListeners:Ljava/util/ArrayList;

    monitor-enter v0

    :try_start_0
    invoke-direct {p0, p1}, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->cleanUpListenersLocked(Lcom/android/systemui/statusbar/policy/FlashlightController$FlashlightListener;)V
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    monitor-exit v0

    return-void

    :catchall_0
    move-exception v1

    monitor-exit v0

    throw v1
.end method

.method public bridge synthetic removeCallback(Ljava/lang/Object;)V
    .locals 0

    check-cast p1, Lcom/android/systemui/statusbar/policy/FlashlightController$FlashlightListener;

    invoke-virtual {p0, p1}, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->removeCallback(Lcom/android/systemui/statusbar/policy/FlashlightController$FlashlightListener;)V

    return-void
.end method

.method public removeListener(Lcom/android/systemui/statusbar/policy/FlashlightController$FlashlightListener;)V
    .locals 2

    iget-object v0, p0, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->mListeners:Ljava/util/ArrayList;

    monitor-enter v0

    :try_start_0
    invoke-direct {p0, p1}, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->cleanUpListenersLocked(Lcom/android/systemui/statusbar/policy/FlashlightController$FlashlightListener;)V
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    monitor-exit v0

    return-void

    :catchall_0
    move-exception v1

    monitor-exit v0

    throw v1
.end method

.method public setFlashlight(Z)V
    .locals 5

    const/4 v1, 0x0

    monitor-enter p0

    :try_start_0
    iget-object v2, p0, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->mCameraId:Ljava/lang/String;
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    if-nez v2, :cond_0

    monitor-exit p0

    return-void

    :cond_0
    :try_start_1
    iget-boolean v2, p0, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->mFlashlightEnabled:Z

    if-eq v2, p1, :cond_2

    iput-boolean p1, p0, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->mFlashlightEnabled:Z
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    :try_start_2
    iget-object v2, p0, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->mCameraManager:Landroid/hardware/camera2/CameraManager;

    iget-object v3, p0, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->mCameraId:Ljava/lang/String;

    invoke-virtual {v2, v3, p1}, Landroid/hardware/camera2/CameraManager;->setTorchMode(Ljava/lang/String;Z)V

    if-eqz p1, :cond_1

    iget v2, p0, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->mFlashlightLevel:I

    const/4 v3, 0x0

    invoke-virtual {p0, v2, v3}, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->setFlashlightLevel(IZ)V

    :cond_1
    iget-object v2, p0, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->mFlashLightDebugLogs:Ljava/util/ArrayList;

    new-instance v3, Ljava/lang/StringBuilder;

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

    const-string/jumbo v4, "setTorch at : "

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

    move-result-object v3

    invoke-direct {p0}, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->makeTime()Ljava/lang/String;

    move-result-object v4

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

    move-result-object v3

    const-string/jumbo v4, " cameraID = "

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

    move-result-object v3

    iget-object v4, p0, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->mCameraId:Ljava/lang/String;

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

    move-result-object v3

    const-string/jumbo v4, " enabled = "

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

    move-result-object v3

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

    move-result-object v3

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

    move-result-object v3

    invoke-virtual {v2, v3}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z

    iget-object v2, p0, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->mFlashLightDebugLogs:Ljava/util/ArrayList;

    invoke-virtual {v2}, Ljava/util/ArrayList;->size()I

    move-result v2

    const/16 v3, 0x14

    if-le v2, v3, :cond_2

    iget-object v2, p0, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->mFlashLightDebugLogs:Ljava/util/ArrayList;

    const/4 v3, 0x0

    invoke-virtual {v2, v3}, Ljava/util/ArrayList;->remove(I)Ljava/lang/Object;
    :try_end_2
    .catch Landroid/hardware/camera2/CameraAccessException; {:try_start_2 .. :try_end_2} :catch_0
    .catchall {:try_start_2 .. :try_end_2} :catchall_0

    :cond_2
    :goto_0
    monitor-exit p0

    iget-boolean v2, p0, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->mFlashlightEnabled:Z

    invoke-direct {p0, v2}, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->dispatchModeChanged(Z)V

    if-eqz v1, :cond_3

    invoke-direct {p0}, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->dispatchError()V

    :cond_3
    return-void

    :catch_0
    move-exception v0

    :try_start_3
    const-string/jumbo v2, "FlashlightController"

    const-string/jumbo v3, "Couldn\'t set torch mode"

    invoke-static {v2, v3, v0}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I

    const/4 v2, 0x0

    iput-boolean v2, p0, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->mFlashlightEnabled:Z
    :try_end_3
    .catchall {:try_start_3 .. :try_end_3} :catchall_0

    const/4 v1, 0x1

    goto :goto_0

    :catchall_0
    move-exception v2

    monitor-exit p0

    throw v2
.end method

.method public setFlashlightLevel(IZ)V
    .locals 4

    iget-object v0, p0, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->mCfmsService:Landroid/os/CustomFrequencyManager;

    const-string/jumbo v1, "CLOCK_SET_TORCH_LIGHT"

    sget-object v2, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->FLASHLIGHT_VALUE:[I

    aget v2, v2, p1

    invoke-static {v2}, Ljava/lang/String;->valueOf(I)Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v0, v1, v2}, Landroid/os/CustomFrequencyManager;->sendCommandToSSRM(Ljava/lang/String;Ljava/lang/String;)V

    if-eqz p2, :cond_0

    iget-object v0, p0, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->mContext:Landroid/content/Context;

    invoke-virtual {v0}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v0

    const-string/jumbo v1, "Flashlight_brightness_level"

    sget-object v2, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->FLASHLIGHT_VALUE:[I

    aget v2, v2, p1

    const/4 v3, -0x2

    invoke-static {v0, v1, v2, v3}, Landroid/provider/Settings$System;->putIntForUser(Landroid/content/ContentResolver;Ljava/lang/String;II)Z

    :cond_0
    return-void
.end method

.method public tryInitCamera()V
    .locals 2

    iget-object v0, p0, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->mCameraId:Ljava/lang/String;

    if-nez v0, :cond_0

    iget-object v0, p0, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->mHandler:Landroid/os/Handler;

    if-eqz v0, :cond_0

    iget-object v0, p0, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->mHandler:Landroid/os/Handler;

    new-instance v1, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl$2;

    invoke-direct {v1, p0}, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl$2;-><init>(Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;)V

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

    :cond_0
    return-void
.end method

.method public updateTorchCallback()V
    .locals 6

    const/4 v5, 0x0

    const-string/jumbo v2, "FlashlightController"

    new-instance v3, Ljava/lang/StringBuilder;

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

    const-string/jumbo v4, "updateTorchCallback for mCameraId "

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

    move-result-object v3

    iget-object v4, p0, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->mCameraId:Ljava/lang/String;

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

    move-result-object v3

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

    move-result-object v3

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

    iget-object v2, p0, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->mCameraId:Ljava/lang/String;

    if-nez v2, :cond_1

    iget-object v2, p0, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->mCameraManager:Landroid/hardware/camera2/CameraManager;

    if-nez v2, :cond_0

    iget-object v2, p0, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->mContext:Landroid/content/Context;

    const-string/jumbo v3, "camera"

    invoke-virtual {v2, v3}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object v2

    check-cast v2, Landroid/hardware/camera2/CameraManager;

    iput-object v2, p0, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->mCameraManager:Landroid/hardware/camera2/CameraManager;

    :cond_0
    const/4 v0, 0x0

    :try_start_0
    invoke-direct {p0}, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->getCameraId()Ljava/lang/String;
    :try_end_0
    .catch Ljava/lang/Throwable; {:try_start_0 .. :try_end_0} :catch_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    move-result-object v0

    iput-object v0, p0, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->mCameraId:Ljava/lang/String;

    const-string/jumbo v2, "FlashlightController"

    new-instance v3, Ljava/lang/StringBuilder;

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

    const-string/jumbo v4, "updateTorchCallback mCameraId"

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

    move-result-object v3

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

    move-result-object v3

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

    move-result-object v3

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

    iget-object v2, p0, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->mCameraId:Ljava/lang/String;

    if-eqz v2, :cond_1

    invoke-direct {p0}, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->ensureHandler()V

    iget-object v2, p0, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->mCameraManager:Landroid/hardware/camera2/CameraManager;

    iget-object v3, p0, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->mTorchCallback:Landroid/hardware/camera2/CameraManager$TorchCallback;

    iget-object v4, p0, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->mHandler:Landroid/os/Handler;

    invoke-virtual {v2, v3, v4}, Landroid/hardware/camera2/CameraManager;->registerTorchCallback(Landroid/hardware/camera2/CameraManager$TorchCallback;Landroid/os/Handler;)V

    :cond_1
    return-void

    :catch_0
    move-exception v1

    :try_start_1
    const-string/jumbo v2, "FlashlightController"

    const-string/jumbo v3, "updateTorchCallback Couldn\'t initialize."

    invoke-static {v2, v3, v1}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    iput-object v5, p0, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->mCameraId:Ljava/lang/String;

    const-string/jumbo v2, "FlashlightController"

    new-instance v3, Ljava/lang/StringBuilder;

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

    const-string/jumbo v4, "updateTorchCallback mCameraId"

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

    move-result-object v3

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

    move-result-object v3

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

    move-result-object v3

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

    return-void

    :catchall_0
    move-exception v2

    iput-object v5, p0, Lcom/android/systemui/statusbar/policy/FlashlightControllerImpl;->mCameraId:Ljava/lang/String;

    const-string/jumbo v3, "FlashlightController"

    new-instance v4, Ljava/lang/StringBuilder;

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

    const-string/jumbo v5, "updateTorchCallback mCameraId"

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

    move-result-object v4

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

    move-result-object v4

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

    move-result-object v4

    invoke-static {v3, v4}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I

    throw v2
.end method


text:
title: Glance Integration
category: feature
authors: fsimonce
wiki_title: Features/Glance Integration
wiki_revision_count: 1
wiki_last_updated: 2013-05-16
feature_name: Glance Integration
feature_status: Released in oVirt 3.3
feature_modules: engine, vdsm
---

# Glance Integration

## Summary

This feature will allow oVirt users to consume (use), export and share images with Glance.

### Owner

*   Name: Federico Simoncelli
*   Email: <fsimonce@redhat.com>

## Current Status

### Engine

*   Contribute to the OpenStack Java SDK project to obtain a component mature enough for the oVirt Engine (in progress)
*   Initial support for Keystone in order to access the authenticated Glance servers (in progress)
*   Adapt the current NFS ISO domains to become Image repository, hence being able to manage and display Glance domains (in progress)
*   New Glance Storage Domain (in progress)
*   Import and Export Image Commands

### VDSM

*   Implement the `imageImport` and `imageExport` commands, either explicitly supporting glance or with a more generic http repository support (with additional special headers in the glance case)

## Detailed Description

The Glance project provides services for discovering, registering, and retrieving virtual machine images. These images are to be intended as oVirt templates.

### Phase 1

*   Add the new Storage Domain for Glance (identified by the `StorageType#GLANCE` and the `StorageDomainType#Image`)
*   Add, edit and remove the Glance Storage Domains
*   List the available images in the Glance Storage Domains (leveraging the current infrastructure that oVirt uses for NFS ISO domains, which have many aspects in common)
*   Import images from Glance as oVirt Templates or floating Disks
*   Export single (floating) disks (without snapshots) to Glance

## VDSM API

    importImage(spUUID, sdUUID, imgUUID, volUUID, importInfo)
    exportImage(spUUID, sdUUID, imgUUID, volUUID, exportInfo)

    importInfo = {
       'method': 'http',
       'url': '`[`http://glance/v1/images/image-uuid`](http://glance/v1/images/image-uuid)`',
       'headers': {
         'X-Auth-Token': 'token-uuid',
       },
    }

## Future Phases

Import and Export entire VMs with multiple disks and snapshots using the OVA container format.

## User Experience

![New Glace Domain Dialog](/images/wiki/NewGlanceDomain1.png)
 <br/>
![Glance Domain Listing](/images/wiki/GlanceDomainListing1.png)

## External References

*   [<http://github.com/woorea/openstack-java-sdk>](http://github.com/woorea/openstack-java-sdk)
*   [<http://docs.openstack.org/developer/glance>](http://docs.openstack.org/developer/glance)

redpajama_set_name: RedPajamaGithub


text:
package org.apache.isis.core.runtime.services.persistsession;

import java.util.List;

import org.apache.isis.applib.annotation.DomainService;
import org.apache.isis.applib.annotation.NatureOfService;
import org.apache.isis.applib.annotation.Programmatic;
import org.apache.isis.applib.query.Query;
import org.apache.isis.applib.services.bookmark.Bookmark;
import org.apache.isis.applib.services.bookmark.BookmarkService2;
import org.apache.isis.applib.services.xactn.Transaction;
import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
import org.apache.isis.core.metamodel.adapter.oid.Oid;
import org.apache.isis.core.metamodel.adapter.oid.RootOid;
import org.apache.isis.core.metamodel.services.persistsession.PersistenceSessionServiceInternal;
import org.apache.isis.core.metamodel.spec.ObjectSpecification;
import org.apache.isis.core.metamodel.spec.feature.OneToManyAssociation;
import org.apache.isis.core.metamodel.specloader.SpecificationLoader;
import org.apache.isis.core.runtime.system.persistence.PersistenceSession;
import org.apache.isis.core.runtime.system.session.IsisSessionFactory;
import org.apache.isis.core.runtime.system.transaction.IsisTransactionManager;
import org.apache.isis.core.runtime.system.transaction.TransactionalClosure;

@DomainService(
        nature = NatureOfService.DOMAIN,
        menuOrder = "" + (Integer.MAX_VALUE - 1)  // ie before the Noop impl in metamodel
)
public class PersistenceSessionServiceInternalDefault implements PersistenceSessionServiceInternal {

    @Override
    public ObjectAdapter getAdapterFor(Oid oid) {
        return getPersistenceSession().getAdapterFor(oid);
    }

    @Override
    public ObjectAdapter getAdapterFor(final Object pojo) {
        return getPersistenceSession().getAdapterFor(pojo);
    }

    @Override
    public ObjectAdapter adapterFor(final Object pojo) {
        return getPersistenceSession().adapterFor(pojo);
    }

    @Override
    public ObjectAdapter adapterFor(
            final Object pojo,
            final ObjectAdapter ownerAdapter,
            final OneToManyAssociation collection) {
        return getPersistenceSession().adapterFor(pojo, ownerAdapter, collection);
    }

    @Override
    public ObjectAdapter mapRecreatedPojo(Oid oid, Object recreatedPojo) {
        return getPersistenceSession().mapRecreatedPojo(oid, recreatedPojo);
    }

    @Override
    public void removeAdapter(ObjectAdapter adapter) {
        getPersistenceSession().removeAdapter(adapter);
    }

    @Override
    public void makePersistent(final ObjectAdapter adapter) {
        getPersistenceSession().makePersistentInTransaction(adapter);
    }

    @Override
    public void remove(final ObjectAdapter adapter) {
        getPersistenceSession().destroyObjectInTransaction(adapter);
    }

    @Override
    public ObjectAdapter createTransientInstance(final ObjectSpecification spec) {
        return getPersistenceSession().createTransientInstance(spec);
    }

    @Override
    public ObjectAdapter createViewModelInstance(ObjectSpecification spec, String memento) {
        return getPersistenceSession().createViewModelInstance(spec, memento);
    }

    @Override
    public Object lookup(
            final Bookmark bookmark,
            final BookmarkService2.FieldResetPolicy fieldResetPolicy) {
        return getPersistenceSession().lookup(bookmark, fieldResetPolicy);
    }

    @Override
    public Bookmark bookmarkFor(Object domainObject) {
        final ObjectAdapter adapter = getPersistenceSession().adapterFor(domainObject);
        final Oid oid = adapter.getOid();
        if(oid == null) {
            // values cannot be bookmarked
            return null;
        }
        if(!(oid instanceof RootOid)) {
            // must be root
            return null;
        }
        final RootOid rootOid = (RootOid) oid;
        return rootOid.asBookmark();
    }

    @Override
    public Bookmark bookmarkFor(Class<?> cls, String identifier) {
        final ObjectSpecification objectSpec = getSpecificationLoader().loadSpecification(cls);
        String objectType = objectSpec.getSpecId().asString();
        return new Bookmark(objectType, identifier);
    }

    @Override
    public void resolve(final Object parent) {
        getPersistenceSession().resolve(parent);
    }

    /**
     * @deprecated - left over from manual object resolving.
     */
    @Deprecated
    @Override
    public void resolve(final Object parent, final Object field) {
        if (field == null) {
            resolve(parent);
        }
    }

    @Override
    public void beginTran() {
        getTransactionManager().startTransaction();
    }

    @Override
    public boolean flush() {
        return getTransactionManager().flushTransaction();
    }

    @Override
    public void commit() {
        getTransactionManager().endTransaction();
    }

    @Override
    public Transaction currentTransaction() {
        return getTransactionManager().getCurrentTransaction();
    }

    @Override
    public <T> List<ObjectAdapter> allMatchingQuery(final Query<T> query) {
        return getPersistenceSession().allMatchingQuery(query);
    }

    @Override
    public <T> ObjectAdapter firstMatchingQuery(final Query<T> query) {
        return getPersistenceSession().firstMatchingQuery(query);
    }

    @Override
    public void executeWithinTransaction(TransactionalClosure transactionalClosure) {
        getTransactionManager().executeWithinTransaction(transactionalClosure);
    }

    protected PersistenceSession getPersistenceSession() {
        return getIsisSessionFactory().getCurrentSession().getPersistenceSession();
    }

    private IsisSessionFactory getIsisSessionFactory() {
        return isisSessionFactory;
    }

    @Programmatic
    public IsisTransactionManager getTransactionManager() {
        return getPersistenceSession().getTransactionManager();
    }

    protected SpecificationLoader getSpecificationLoader() {
        return getIsisSessionFactory().getSpecificationLoader();
    }

    @javax.inject.Inject
    IsisSessionFactory isisSessionFactory;

}


text:
<?php

namespace Kordy\Ticketit\Models;

use Illuminate\Database\Eloquent\Model as Model;
use Kordy\Ticketit\Traits\ContentEllipse;

class Configuration extends Model
{
    use ContentEllipse;

    public $table = 'ticketit_settings';

    public $fillable = [
    'lang',
    'slug',
    'value',
    'default',
  ];

    // Null lang column if no value is being stored.

    public function setLangAttribute($lang)
    {
        $this->attributes['lang'] = trim($lang) !== '' ? $lang : null;
    }

    /**
     * The attributes that should be casted to native types.
     *
     * @var array
     */
    protected $casts = [
    'id'         => 'integer',
    'lang'       => 'string',
    'slug'       => 'string',
    'value'      => 'string',
    'default'    => 'string',
  ];

    public static $rules = [

  ];
}


text:
import sys, subprocess, platform
import argparse

parser = argparse.ArgumentParser()

parser.add_argument('--cross-host', default=None, dest='cross_host',
                    help='cross compilation host platform')
parser.add_argument('args', nargs='+')

def dummy_syms(outfilename):
    """Just touch it so relinking happens always."""
    open(outfilename, 'w').close()

def write_if_changed(text, outfilename):
    try:
        oldtext = open(outfilename, 'r').read()
        if text == oldtext:
            return
    except FileNotFoundError:
        pass
    open(outfilename, 'w').write(text)

def linux_syms(libfilename, outfilename):
    pe = subprocess.Popen(['readelf', '-d', libfilename], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    output = pe.communicate()[0].decode()
    if pe.returncode != 0:
        raise RuntimeError('Readelf does not work')
    result = [x for x in output.split('\n') if 'SONAME' in x]
    assert(len(result) <= 1)
    pnm = subprocess.Popen(['nm', '--dynamic', '--extern-only', '--defined-only', '--format=posix', libfilename],
                           stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    output = pnm.communicate()[0].decode()
    if pnm.returncode != 0:
        raise RuntimeError('nm does not work.')
    result += [' '.join(x.split()[0:2]) for x in output.split('\n') if len(x) > 0]
    write_if_changed('\n'.join(result) + '\n', outfilename)

def osx_syms(libfilename, outfilename):
    pe = subprocess.Popen(['otool', '-l', libfilename], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    output = pe.communicate()[0].decode()
    if pe.returncode != 0:
        raise RuntimeError('Otool does not work.')
    arr = output.split('\n')
    for (i, val) in enumerate(arr):
        if 'LC_ID_DYLIB' in val:
            match = i
            break
    result = [arr[match+2], arr[match+5]] # Libreoffice stores all 5 lines but the others seem irrelevant.
    pnm = subprocess.Popen(['nm', '-g', '-P', libfilename], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    output = pnm.communicate()[0].decode()
    if pnm.returncode != 0:
        raise RuntimeError('nm does not work.')
    result += [' '.join(x.split()[0:2]) for x in output.split('\n') if len(x) > 0 and not x.endswith('U')]
    write_if_changed('\n'.join(result) + '\n', outfilename)

def gen_symbols(libfilename, outfilename, cross_host):
    if cross_host is not None:
        # In case of cross builds just always relink.
        # In theory we could determine the correct
        # toolset but there are more important things
        # to do.
        dummy_syms(outfilename)
    elif platform.system() == 'Linux':
        linux_syms(libfilename, outfilename)
    elif platform.system() == 'Darwin':
        osx_syms(libfilename, outfilename)
    else:
        dummy_syms(outfilename)

if __name__ == '__main__':
    options = parser.parse_args()
    if len(options.args) != 2:
        print(sys.argv[0], '<shared library file> <output file>')
        sys.exit(1)
    libfile = options.args[0]
    outfile = options.args[1]
    gen_symbols(libfile, outfile, options.cross_host)


text:
<?php
defined('IN_ADMIN') or exit('No permission resources.');
$show_validator = true;
include $this->admin_tpl('header', 'admin'); ?>

        <form name="myform" action="?m=interfacedocuments&c=interface_package&a=edit" method="post" id="myform">

                    包名
                    <input type="test" name="info[name]" class="input-text" id="name" value="<?php echo $result['name'];?>"></input>

                    描述
                    <input type="test" name="info[description]" class="input-text" id="description" value="<?php echo  $result['description'];?>"></input>

            <input name="info[id]" value="<?php echo $result['id'];?>" type="hidden">
            <input name="dosubmit" type="submit" value="<?php echo L('submit') ?>" class="button">
        </form>


text:
import fetchProducts from '../../src/services/fetch-products';
import mockProducts from '../mocks/products.json';

describe('fetchs products from API', () => {
  const errorStatusCode = 404;
  const errorStatusText = 'Where it go?';

  beforeAll(() => {
    global.fetch = jest
      .fn(() => Promise.resolve({
        ok: true,
        json() {
          return Promise.resolve({
            products: mockProducts,
          });
        },
      }))
      .mockImplementationOnce(() => Promise.resolve({
        ok: false,
        status: errorStatusCode,
        statusText: errorStatusText,
      }));
  });
  afterAll(() => {
    delete global.fetch;
  });

  test('handles errors', () => {
    const sanitizedURL = 'http://localhost:wat';
    expect.assertions(4);

    return fetchProducts('http://localhost', sanitizedURL).catch((error) => {
      expect(error).toBeInstanceOf(Error);
      expect(error.message).toMatch(new RegExp(sanitizedURL));
      expect(error.message).toMatch(new RegExp(errorStatusCode));
      expect(error.message).toMatch(new RegExp(errorStatusText));
    });
  });
  test('returns products', () => {
    const url = 'http://localhost:3000/rando-api/path/its-so/crazy';
    expect.assertions(2);

    return fetchProducts(url).then((response) => {
      const arg = global.fetch.mock.calls[global.fetch.mock.calls.length - 1][0];

      expect(arg).toBe(url);
      expect(response.products).toBe(mockProducts);
    });
  });
});


text:
React with rest api on top of a mysql database scaffold.

* src/ contains your react app
* server/ a restify server which serves static files from the build/ folder by default and have other routes as /api/...
* database/ a mysql database structure with migrating functionality as seen [here](https://blog.codinghorror.com/get-your-database-under-version-control/)

### Installation:
`npm i` will install all dependencies.
`npm run configure` will create a not versioned copy of config.json named config_local.json.
You can configure your own database access and web server port in this file. It will be merge with the config_default.json
if new variables are added to the project.
`npm run databse_install` will drop and recreate database from scratch. You need to create the user in your mysql server first.
`npm run database_update` will only install new patches.

### Development:
`npm run server` will launch the restify server with nodemon and auto reload.
`npm run front` will run react live server with auto reload.

### Production:
`npm run build` will build the react app.
`npm run deploy` will use pm2 to start the process in background.
`npm stop` will stop the current pm2 process.


text:
/*
 * $Id: RefVectorOf.hpp 676911 2008-07-15 13:27:32Z amassari $
 */

#if !defined(XERCESC_INCLUDE_GUARD_REFVECTOROF_HPP)
#define XERCESC_INCLUDE_GUARD_REFVECTOROF_HPP

#include <xercesc/util/BaseRefVectorOf.hpp>

XERCES_CPP_NAMESPACE_BEGIN

/**
 * Class with implementation for vectors of References - implements from the
 * Abstract class Vector
 */
template <class TElem> class RefVectorOf : public BaseRefVectorOf<TElem>
{
public :
    // -----------------------------------------------------------------------
    //  Constructor
    // -----------------------------------------------------------------------
    RefVectorOf(const XMLSize_t maxElems,
                const bool adoptElems = true,
                MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);

    // -----------------------------------------------------------------------
    //  Destructor
    // -----------------------------------------------------------------------
    ~RefVectorOf();

private:
    // -----------------------------------------------------------------------
    //  Unimplemented constructors and operators
    // -----------------------------------------------------------------------
    RefVectorOf(const RefVectorOf<TElem>&);
    RefVectorOf<TElem>& operator=(const RefVectorOf<TElem>&);
};

XERCES_CPP_NAMESPACE_END

#if !defined(XERCES_TMPLSINC)
#include <xercesc/util/RefVectorOf.c>
#endif

#endif


text:
var namespacegtest____break____on____failure____unittest_8js =
[
    [ "namespacegtest__break__on__failure__unittest", "namespacegtest____break____on____failure____unittest_8js.html#acaf9a2a432d992f0659c89f69e1df283", null ]
];


text:
class ChangeColumnsInCryptoPayOutTxns < ActiveRecord::Migration[5.1]
  def change
    add_column :crypto_pay_out_txns, :type, :string
    remove_column :crypto_pay_out_txns, :fee_txn, :boolean
  end
end


text:
title: IMOLEMS – Indonesian Mobile Learning Management System
date: 2014-03-26 11:08:00 +07:00
nohibah: 149
nama: Gunawan
lokasi: Semarang, Jawa Tengah
organisasi: ICT R n D UNISSULA
judul: IMOLEMS - Indonesian Mobile Learning Management System
lama: 12 Bulan
target: Siswa/siswa SMA/K di Jawa Tengah namun akan dikembangkan untuk seluruh Indonesia
keberhasilan: Aplikasi IMOLEMS digunakan oleh 100 SMA/K dengan jumlah user 10.000
  siswa.
tipe: Aplikasi yang dapat diakses secara mobile dengan bahasa dan user interface lebih
  familiar dengan nuansa keberagaman budaya dan bahasa di Indonesia
strategi: |-
  Kuantitias dan kualitas pendidikan di Indonesia belum merata sehingga perlu ada aplikasi yang dapat menjembatani permasalahan tersebut. Dengan adanya aplikasi IMOLEMS dan disupport dengan content yang interaktif dari sekolah favorit maka akhirnya semua content pembelajaran dapat diakses oleh semua siswa diseluruh indonesia dengan mudah. SMA/K di Indonesia tidak semua memiliki infrastruktur TIK yang bagus sehingga diperlukan support aplikasi yang dapat dioptimalkan sekolah tanpa harus membangun infrastruktur TIK sendiri di Sekolah.

  – Kerjasama dengan perguruan tinggi lain (tahap awal di Jawa Tengah dulu) untuk menjalankan program pengabdian masyarakat bidang pendidikan dengan melakukan sosialisasi, pelatihan dan pendampingan penggunakan aplikasi IMOLEMS termasuk strategi pembuatan contentnya. Program pengabdian masyarakat ini memang menjadi salah satu TRIDHARMA PERGURUAN TINGGI.
  – Kerjasama dengan lembaga sosial dan perusahaan termasuk LSM dan ORMAS yang peduli terhadap pengembangan pendidikan di Indonesia
kuantitas: NA
dana: Rp. 700 Juta
deskripsi: |-
  IMOLEMS adalah inisiatif untuk mengembangkan aplikasi Mobile Learning Management System dengan pendekatan nuansa Indonesia dengan keberagaman budaya dan bahasa. Pada tahap awal akan dikembangkan berbasis akses teknologi internet dan khusus untuk memenuhi kebutuhan pembelajaran jarak jauh SMA/K. Namun seiring dengan proyeksi perkembangan konvergensi teknologi internet dengan teknologi TV Digital maka proyeksi jangka panjang akan dikembangkan menggunakan akses teknologi Digital Broadcasting.
  Hal ini seiring dengan yang dilakukan oleh ICT R n D UNISSULA yang melakukan ujicoba dan penelitian penggunakan teknologi TV Digital untuk mendukung pembelajaran jarak jauh.
masalah: |-
  Data dari Kemdikbud, diperkirakan sekitar 1,2juta siswa SMP tidak melanjutkan pendidikan ke SMA/sederajat. Oleh karena itu Kemdikbud akan menjalankan program SMA terbuka dengan kombinasi pembelajaran online dan offline.
  Belum meratanya kualitas dan kuantitas pendidikan di kota besar dengan daerah luar kota (bahkan luar jawa) menuntut adanya program strategis mengembangkan layanan pendidikan yang dapat di akses seluruh masyarakat di Indonesia.Sampai saat ini belum ada Learning Management System (LMS) yang benar-benar bisa dikatakan cocok dengan sistem pembelajaran di Indonesia.
  Oleh karena itu IMOLEMS dikembangkan untuk menjadi solusi sebagai Learning Management System pembelajaran jarak jauh secara mobile dengan tetap mengedepankan nuansa keberagaman budaya dan bahasa di Indonesia.
solusi: |-
  Mengembangkan Learning Management System Mobile yang dapat diakses dengan ringan melalui perangkat smartphone yang dapat digunakan oleh SMA/K diIndonesia. Tahapan yang akan dilakukan :
  – Komunikasi dengan Kampus ataupun SMA/K yang sudah menjalankan pembelajaran online menggunakan LMS untuk mendapatkan evaluasi kelemahan dan kelebihan sistemnya
  – Komunikasi dengan perwakilan SMA/K untuk mengembangkan IMOLEMS
  – Perancangan dan Pembangunan sistem aplikasi
  – Ujicoba aplikasi IMOLEMS di beberapa SMA/K terpilih sekaligus produksi content
  – Ujicoba apliklai IMOLEMS untuk regional dan nasional
  – Mengoptimalkan IMOLEMS dan produksi content pembelajaran untuk mendukung pemerataan pendidikan khusus program Ujian Nasional dan Ujian Masuk Perguruan TInggi.
layout: hibah
---

![149](/static/img/hibahcms/149.png){: .img-responsive }{: width="350" }

### {{ page.nohibah }} - {{ page.title }}

{{ page.deskripsi }}


text:
package com.milan.inzaghi09.activity;

import com.milan.inzaghi09.R;

import android.app.Activity;
import android.os.Bundle;

public class TestActivity extends Activity {
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);

		setContentView(R.layout.activity_test);
	}
}


text:
require 'google/apis/file_v1/service.rb'
require 'google/apis/file_v1/classes.rb'
require 'google/apis/file_v1/representations.rb'

module Google
  module Apis
    # Cloud Filestore API
    #
    # The Cloud Filestore API is used for creating and managing cloud file servers.
    #
    # @see https://cloud.google.com/filestore/
    module FileV1
      VERSION = 'V1'
      REVISION = '20201208'

      # View and manage your data across Google Cloud Platform services
      AUTH_CLOUD_PLATFORM = 'https://www.googleapis.com/auth/cloud-platform'
    end
  end
end


text: from PyLiterDB import DB, VERSION


text:
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;

namespace BrightstarDB.Tests.Sparql11TestSuite {
    [TestClass]
	public partial class DeleteData : SparqlTest {

        public DeleteData() : base()
        {

        }

		[TestInitialize]
		public void SetUp()
		{
			CreateStore();

		}

        [TestCleanup]
        public void TearDown()
        {
			DeleteStore();

        }

		#region Test Methods

		[TestMethod]
		public void SimpleDeleteData1() {
				ImportData(@"delete-data/delete-pre-01.ttl");
				ExecuteUpdate(@"delete-data/delete-data-01.ru");
					ValidateUnamedGraph(@"delete-data/delete-post-01s.ttl");

		}

		[TestMethod]
		public void SimpleDeleteData2() {
				ImportGraph(@"delete-data/delete-pre-01.ttl", new Uri(@"http://example.org/g1"));
				ExecuteUpdate(@"delete-data/delete-data-02.ru");
					ValidateGraph(@"delete-data/delete-post-01s.ttl", new Uri(@"http://example.org/g1"));

		}

		[TestMethod]
		public void SimpleDeleteData3() {
				ImportData(@"delete-data/delete-pre-01.ttl");
				ExecuteUpdate(@"delete-data/delete-data-03.ru");
					ValidateUnamedGraph(@"delete-data/delete-post-01f.ttl");

		}

		[TestMethod]
		public void SimpleDeleteData4() {
				ImportGraph(@"delete-data/delete-pre-01.ttl", new Uri(@"http://example.org/g1"));
				ExecuteUpdate(@"delete-data/delete-data-04.ru");
					ValidateGraph(@"delete-data/delete-post-01f.ttl", new Uri(@"http://example.org/g1"));

		}

		[TestMethod]
		public void GraphSpecificDeleteData1() {
				ImportData(@"delete-data/delete-pre-01.ttl");
					ImportGraph(@"delete-data/delete-pre-02.ttl", new Uri(@"http://example.org/g2"));
					ImportGraph(@"delete-data/delete-pre-03.ttl", new Uri(@"http://example.org/g3"));
				ExecuteUpdate(@"delete-data/delete-data-05.ru");
					ValidateUnamedGraph(@"delete-data/delete-post-01s.ttl");
					ValidateGraph(@"delete-data/delete-post-02f.ttl", new Uri(@"http://example.org/g2"));
					ValidateGraph(@"delete-data/delete-post-03f.ttl", new Uri(@"http://example.org/g3"));

		}

		[TestMethod]
		public void GraphSpecificDeleteData2() {
				ImportData(@"delete-data/delete-pre-01.ttl");
					ImportGraph(@"delete-data/delete-pre-02.ttl", new Uri(@"http://example.org/g2"));
					ImportGraph(@"delete-data/delete-pre-03.ttl", new Uri(@"http://example.org/g3"));
				ExecuteUpdate(@"delete-data/delete-data-06.ru");
					ValidateUnamedGraph(@"delete-data/delete-post-01f.ttl");
					ValidateGraph(@"delete-data/delete-post-02s.ttl", new Uri(@"http://example.org/g2"));
					ValidateGraph(@"delete-data/delete-post-03f.ttl", new Uri(@"http://example.org/g3"));

		}

		#endregion

	}
}


text:
from __future__ import print_function, unicode_literals
import unittest

import mock
import six

from ..managers import SQRLNutManager
from ..models import SQRLNut

TESTING_MODULE = 'sqrl.models'

class TestSQRLNut(unittest.TestCase):
    def test_objects(self):
        self.assertIsInstance(SQRLNut.objects, SQRLNutManager)

    def test_str(self):
        self.assertEqual(
            six.text_type(SQRLNut(nonce='nonce')),
            'nonce'
        )

    @mock.patch(TESTING_MODULE + '.generate_randomness')
    @mock.patch.object(SQRLNut, 'delete')
    @mock.patch.object(SQRLNut, 'save')
    def test_renew(self, mock_save, mock_delete, mock_generate_randomness):
        nut = SQRLNut(nonce='nonce')

        self.assertIsNone(nut.renew())
        self.assertEqual(nut.nonce, mock_generate_randomness.return_value)
        mock_save.assert_called_once_with()
        mock_generate_randomness.assert_called_once_with()


text:
package io.github.jeddict.jpa.modeler.properties.order.type;

import java.awt.event.ActionEvent;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
import javax.swing.JRadioButtonMenuItem;
import io.github.jeddict.jpa.modeler.navigator.nodes.LeafNode;
import io.github.jeddict.jpa.modeler.navigator.nodes.actions.LeafNodeAction;
import io.github.jeddict.jpa.spec.OrderType;
import org.openide.nodes.Node;
import org.openide.util.HelpCtx;
import org.openide.util.NbBundle;
import static org.openide.util.NbBundle.getMessage;
import org.openide.util.actions.NodeAction;
import org.openide.util.actions.Presenter;

public class OrderAction extends NodeAction implements Presenter.Popup, LeafNodeAction {

    private LeafNode leafNode;

    @Override
    protected void performAction(Node[] activatedNodes) {
    }

    @Override
    protected boolean enable(Node[] activatedNodes) {
        return true;
    }

    @Override
    public String getName() {
        return getMessage(OrderAction.class, "OrderAction.name");
    }

    @Override
    public HelpCtx getHelpCtx() {
        return null;
    }

    @Override
    public JMenuItem getPopupPresenter() {
        JMenu submenu = new JMenu(this);
        JRadioButtonMenuItem ASC_item = new JRadioButtonMenuItem(getMessage(OrderAction.class, "OrderAction.asc"));
        ASC_item.addActionListener((ActionEvent e) -> {
            if (getNode() instanceof OrderTypeColumn) {
                ((OrderTypeColumn) getNode()).setOrder(OrderType.ASC);
                ASC_item.setSelected(true);
            }
        });
        JRadioButtonMenuItem DESC_item = new JRadioButtonMenuItem(getMessage(OrderAction.class, "OrderAction.desc"));
        DESC_item.addActionListener((ActionEvent e) -> {
            if (getNode() instanceof OrderTypeColumn) {
                ((OrderTypeColumn) getNode()).setOrder(OrderType.DESC);
                DESC_item.setSelected(true);
            }
        });
        submenu.add(ASC_item);
        submenu.add(DESC_item);
        if (getNode() instanceof OrderTypeColumn) {
            if(((OrderTypeColumn) getNode()).getOrder() == OrderType.DESC){
                DESC_item.setSelected(true);
            } else {
                ASC_item.setSelected(true);
            }
        }
        return submenu;
    }

    @Override
    public void setNode(LeafNode node) {
        this.leafNode = node;
    }

    @Override
    public LeafNode getNode() {
        return leafNode;
    }
}


text:
using System.Xml;
using System.Collections.Generic;
using NPOI.SS.Util;
using System;
using NPOI.OpenXml4Net.OPC;
using System.IO;
using NPOI.OpenXmlFormats.Spreadsheet;
using NPOI.Util;
using System.Collections;
using NPOI.XSSF.UserModel.Helpers;
using NPOI.SS.UserModel;
using System.Text.RegularExpressions;
using System.Globalization;
using NPOI.SS;
using System.Linq;
using NPOI.OOXML.XSSF.UserModel;

namespace NPOI.XSSF.UserModel
{

    /**
     *
     * This class : the Table Part (Open Office XML Part 4:
     * chapter 3.5.1)
     *
     * This implementation works under the assumption that a table Contains mappings to a subtree of an XML.
     * The root element of this subtree an occur multiple times (one for each row of the table). The child nodes
     * of the root element can be only attributes or element with maxOccurs=1 property set
     *
     *
     * @author Roberto Manicardi
     */
    public class XSSFTable : POIXMLDocumentPart, ITable
    {
        private CT_Table ctTable;
        private List<XSSFXmlColumnPr> xmlColumnPrs;
        private List<XSSFTableColumn> tableColumns;
        private Dictionary<String, int> columnMap;
        private CellReference startCellReference;
        private CellReference endCellReference;
        private String commonXPath;

        public XSSFTable()
            : base()
        {

            ctTable = new CT_Table();

        }

        internal XSSFTable(PackagePart part)
            : base(part)
        {
            XmlDocument xml = ConvertStreamToXml(part.GetInputStream());
            ReadFrom(xml);
        }

        [Obsolete("deprecated in POI 3.14, scheduled for removal in POI 3.16")]
        protected XSSFTable(PackagePart part, PackageRelationship rel)
            : this(part)
        {

        }
        public void ReadFrom(XmlDocument xmlDoc)
        {
            try
            {
                TableDocument doc = TableDocument.Parse(xmlDoc, NamespaceManager);
                ctTable = doc.GetTable();
            }
            catch (XmlException e)
            {
                throw new IOException(e.Message);
            }
        }

        public XSSFSheet GetXSSFSheet()
        {
            return (XSSFSheet)GetParent();
        }

        public void WriteTo(Stream out1)
        {
            UpdateHeaders();
            TableDocument doc = new TableDocument();
            doc.SetTable(ctTable);
            doc.Save(out1);
        }

        protected internal override void Commit()
        {
            PackagePart part = GetPackagePart();
            Stream out1 = part.GetOutputStream();
            WriteTo(out1);
            out1.Close();
        }

        public CT_Table GetCTTable()
        {
            return ctTable;
        }

        /**
         * Checks if this Table element Contains even a single mapping to the map identified by id
         * @param id the XSSFMap ID
         * @return true if the Table element contain mappings
         */
        public bool MapsTo(long id)
        {
            bool maps = false;

            List<XSSFXmlColumnPr> pointers = GetXmlColumnPrs();

            foreach (XSSFXmlColumnPr pointer in pointers)
            {
                if (pointer.MapId == id)
                {
                    maps = true;
                    break;
                }
            }

            return maps;
        }
        /**
         *
         * Calculates the xpath of the root element for the table. This will be the common part
         * of all the mapping's xpaths
         *
         * @return the xpath of the table's root element
         */
        public String GetCommonXpath()
        {

            if (commonXPath == null)
            {

                Array commonTokens = null;

                foreach (XSSFTableColumn column in GetColumns())
                {
                    if (column.GetXmlColumnPr() != null)
                    {
                        String xpath = column.GetXmlColumnPr().XPath;
                        String[] tokens = xpath.Split(new char[] { '/' });
                        if (commonTokens==null)
                        {
                            commonTokens = tokens;
                        }
                        else
                        {
                            int maxLenght = commonTokens.Length > tokens.Length ? tokens.Length : commonTokens.Length;
                            for (int i = 0; i < maxLenght; i++)
                            {
                                if (!commonTokens.GetValue(i).Equals(tokens[i]))
                                {
                                    ArrayList subCommonTokens = Arrays.AsList(commonTokens).GetRange(0, i);
                                    commonTokens = subCommonTokens.ToArray(typeof(string));
                                    break;

                                }
                            }
                        }

                    }
                }

                commonXPath = "";

                for (int i = 1; i < commonTokens.Length; i++)
                {
                    commonXPath += "/" + commonTokens.GetValue(i);

                }
            }

            return commonXPath;
        }

        /**
         * Note this list is static - once read, it does not notice later changes to the underlying column structures
         * @return List of XSSFXmlColumnPr
         */
        [Obsolete]
        public List<XSSFXmlColumnPr> GetXmlColumnPrs()
        {

            if (xmlColumnPrs == null)
            {
                xmlColumnPrs = new List<XSSFXmlColumnPr>();
                foreach (CT_TableColumn column in ctTable.tableColumns.tableColumn)
                {
                    if (column.xmlColumnPr != null)
                    {
                        XSSFXmlColumnPr columnPr = new XSSFXmlColumnPr(this, column, column.xmlColumnPr);
                        xmlColumnPrs.Add(columnPr);
                    }
                }
            }
            return xmlColumnPrs;
        }
        private string name;
        /**
         * @return the name of the Table, if set
         */
        public String Name
        {
            get
            {
                if (name == null)
                {
                    Name = ctTable.name;
                }
                return name;
            }
            set
            {
                if (value == null)
                {
                    ctTable.name=null;
                    name = null;
                    return;
                }
                ctTable.name = value;
                name = value;
            }
        }
        public XSSFTableColumn CreateColumn(String columnName)
        {
            return CreateColumn(columnName, this.ColumnCount);
        }
        public XSSFTableColumn CreateColumn(String columnName, int columnIndex)
        {

            int columnCount = ColumnCount;
            if (columnIndex < 0 || columnIndex > columnCount)
            {
                throw new ArgumentException("Column index out of bounds");
            }

            // Ensure we have Table Columns
            CT_TableColumns columns = ctTable.tableColumns;
            if (columns == null)
            {
                columns = ctTable.AddNewTableColumns();
            }

            // check if name is unique and calculate unique column id
            long nextColumnId = 0;
            foreach (XSSFTableColumn tableColumn in this.GetColumns())
            {
                if (columnName != null && columnName.Equals(tableColumn.Name,StringComparison.InvariantCultureIgnoreCase))
                {
                    throw new ArgumentException("Column '" + columnName
                            + "' already exists. Column names must be unique per table.");
                }
                nextColumnId = Math.Max(nextColumnId, tableColumn.Id);
            }
            // Bug #62740, the logic was just re-using the existing max ID, not incrementing beyond it.
            nextColumnId++;

            // Add the new Column
            CT_TableColumn column = columns.InsertNewTableColumn(columnIndex);
            columns.count = columns.count;

            column.id = (uint)nextColumnId;
            if (columnName != null)
            {
                column.name = columnName;
            }
            else
            {
                column.name =  "Column " + nextColumnId;
            }

            /*if (ctTable.@ref != null)
            {
                // calculate new area
                int newColumnCount = columnCount + 1;
                CellReference tableStart = StartCellReference;
                CellReference tableEnd = EndCellReference;
                SpreadsheetVersion version = GetXSSFSheet().GetWorkbook().SpreadsheetVersion;
                CellReference newTableEnd = new CellReference(tableEnd.Row,
                        tableStart.Col + newColumnCount - 1);
                AreaReference newTableArea = new AreaReference(tableStart, newTableEnd, version);

                SetCellRef(newTableArea);
            }*/

            UpdateHeaders();

            return GetColumns()[columnIndex];
        }
        /**
         * Get the area reference for the cells which this table covers. The area
         * includes header rows and totals rows.
         *
         * Does not track updates to underlying changes to CTTable To synchronize
         * with changes to the underlying CTTable, call {@link #updateReferences()}.
         *
         * @return the area of the table
         * @see "Open Office XML Part 4: chapter 3.5.1.2, attribute ref"
         */
        public AreaReference GetCellReferences()
        {
            return new AreaReference(
                    StartCellReference,
                    EndCellReference,
                    SpreadsheetVersion.EXCEL2007
            );
        }
        /**
         * Set the area reference for the cells which this table covers. The area
         * includes includes header rows and totals rows. Automatically synchronizes
         * any changes by calling {@link #updateHeaders()}.
         *
         * Note: The area's width should be identical to the amount of columns in
         * the table or the table may be invalid. All header rows, totals rows and
         * at least one data row must fit inside the area. Updating the area with
         * this method does not create or remove any columns and does not change any
         * cell values.
         *
         * @see "Open Office XML Part 4: chapter 3.5.1.2, attribute ref"
         */
        public void SetCellReferences(AreaReference refs)
        {
            SetCellRef(refs);
        }
        protected void SetCellRef(AreaReference refs)
        {

            // Strip the sheet name,
            // CTWorksheet.getTableParts defines in which sheet the table is
            String reference = refs.FormatAsString();
            if (reference.IndexOf('!') != -1)
            {
                reference = reference.Substring(reference.IndexOf('!') + 1);
            }

            // Update
            ctTable.@ref = reference;
            if (ctTable.IsSetAutoFilter)
            {
                String filterRef;
                int totalsRowCount = TotalsRowCount;
                if (totalsRowCount == 0)
                {
                    filterRef = reference;
                }
                else
                {
                    CellReference start = new CellReference(refs.FirstCell.Row, refs.FirstCell.Col);
                    // account for footer row(s) in auto-filter range, which doesn't include footers
                    CellReference end = new CellReference(refs.LastCell.Row - totalsRowCount, refs.LastCell.Col);
                    // this won't have sheet references because we built the cell references without them
                    filterRef = new AreaReference(start, end, SpreadsheetVersion.EXCEL2007).FormatAsString();
                }
                ctTable.autoFilter.@ref =filterRef;
            }

            // Have everything recomputed
            UpdateReferences();
            UpdateHeaders();
        }
        private String styleName;
        public string StyleName
        {
            get {
                if (styleName == null && ctTable.IsSetTableStyleInfo())
                {
                    StyleName = ctTable.tableStyleInfo.name;
                }
                return styleName;
            }
            set
            {
                if (value == null)
                {
                    if (ctTable.IsSetTableStyleInfo())
                    {
                        ctTable.tableStyleInfo.name =null;
                    }
                    styleName = null;
                    return;
                }
                if (!ctTable.IsSetTableStyleInfo())
                {
                    ctTable.AddNewTableStyleInfo();
                }
                ctTable.tableStyleInfo.name = value;
                styleName = value;
            }
        }
        public ITableStyleInfo Style
        {
            get
            {
                if (!ctTable.IsSetTableStyleInfo()) return null;
                return new XSSFTableStyleInfo(((XSSFWorkbook)((XSSFSheet)GetParent()).Workbook).GetStylesSource(), ctTable.tableStyleInfo);
            }
        }
        /**
         * @return the display name of the Table, if set
         */
        public string DisplayName
        {
            get
            {
                return ctTable.displayName;
            }
            set
            {
                ctTable.displayName = value;
            }

        }

        /**
         * @return  the number of mapped table columns (see Open Office XML Part 4: chapter 3.5.1.4)
         */
        [Obsolete]
        public long NumberOfMappedColumns
        {
            get
            {
                return ctTable.tableColumns.count;
            }
        }
        public int ColumnCount
        {
            get
            {
                CT_TableColumns tableColumns = ctTable.tableColumns;
                if (tableColumns == null)
                {
                    return 0;
                }
                // Casting to int should be safe here - tables larger than the
                // sheet (which holds the actual data of the table) can't exists.
                return (int)tableColumns.tableColumn.Count();
            }
        }
        ///
        /// 0 for no totals rows, 1 for totals row shown.
        /// Values > 1 are not currently used by Excel up through 2016, and the OOXML spec
        /// doesn't define how they would be implemented.
        ///
        public int TotalsRowCount
        {
            get {
                return (int)ctTable.totalsRowCount;
            }
        }
        ///
        /// 0 for no header rows, 1 for table headers shown.
        /// Values > 1 might be used by Excel for pivot tables?
        ///
        public int HeaderRowCount
        {
            get
            {
                return (int)ctTable.headerRowCount;
            }
        }
        /**
         * @return The reference for the cell in the top-left part of the table
         * (see Open Office XML Part 4: chapter 3.5.1.2, attribute ref)
         *
         * To synchronize with changes to the underlying CTTable,
         * call {@link #updateReferences()}.
         */
        public CellReference StartCellReference
        {
            get
            {
                if (startCellReference == null)
                {
                    SetCellReferences();
                }
                return startCellReference;
            }

        }

        /**
         * @return The reference for the cell in the bottom-right part of the table
         * (see Open Office XML Part 4: chapter 3.5.1.2, attribute ref)
         *
         * Does not track updates to underlying changes to CTTable
         * To synchronize with changes to the underlying CTTable,
         * call {@link #updateReferences()}.
         */
        public CellReference EndCellReference
        {
            get
            {
                if (endCellReference == null)
                {
                    SetCellReferences();
                }
                return endCellReference;
            }

        }

        /**
      * @since POI 3.15 beta 3
      */
        private void SetCellReferences()
        {
            String ref1 = ctTable.@ref;
            if (ref1 != null) {
                String[] boundaries = ref1.Split(new char[] { ':' }, 2);
                String from = boundaries[0];
                String to = boundaries[1];
                startCellReference = new CellReference(from);
                endCellReference = new CellReference(to);
            }
        }

        /**
         * Clears the cached values set by {@link #getStartCellReference()}
         * and {@link #getEndCellReference()}.
         * The next call to {@link #getStartCellReference()} and
         * {@link #getEndCellReference()} will synchronize the
         * cell references with the underlying CTTable.
         * Thus, {@link #updateReferences()} is inexpensive.
         *
         * @since POI 3.15 beta 3
         */
        public void UpdateReferences()
        {
            startCellReference = null;
            endCellReference = null;
        }

        /**
         * @return the total number of rows in the selection. (Note: in this version autofiltering is ignored)
         * Returns 0 if the start or end cell references are not set.
         *
         * To synchronize with changes to the underlying CTTable,
         * call {@link #updateReferences()}.
         */
        public int RowCount
        {
            get
            {
                CellReference from = StartCellReference;
                CellReference to = EndCellReference;

                int rowCount = 0;
                if (from != null && to != null)
                {
                    rowCount = to.Row - from.Row + 1;
                }
                return rowCount;
            }
        }

        /**
         * Synchronize table headers with cell values in the parent sheet.
         * Headers must be in sync, otherwise Excel will display a
         * "Found unreadable content" message on startup.
         *
         * If calling both {@link #updateReferences()} and
         * {@link #updateHeaders()}, {@link #updateReferences()}
         * should be called first.
         */
        public void UpdateHeaders()
        {
            XSSFSheet sheet = (XSSFSheet)GetParent();
            CellReference ref1 = StartCellReference;
            if (ref1 == null) return;

            int headerRow = ref1.Row;
            int firstHeaderColumn = ref1.Col;
            XSSFRow row = sheet.GetRow(headerRow) as XSSFRow;

            if (row != null && row.GetCTRow() != null)
            {
                int cellnum = firstHeaderColumn;
                foreach (CT_TableColumn col in GetCTTable().tableColumns.tableColumn)
                {
                    XSSFCell cell = row.GetCell(cellnum) as XSSFCell;
                    if (cell != null)
                    {
                        col.name = (cell.StringCellValue);
                    }
                    cellnum++;
                }
            }
            tableColumns = null;
            columnMap = null;
            xmlColumnPrs = null;
            commonXPath = null;
        }
        /**
         * Gets the relative column index of a column in this table having the header name column.
         * The column index is relative to the left-most column in the table, 0-indexed.
         * Returns -1 if column is not a header name in table.
         *
         * Column Header names are case-insensitive
         *
         * Note: this function caches column names for performance. To flush the cache (because columns
         * have been moved or column headers have been changed), {@link #updateHeaders()} must be called.
         *
         * @since 3.15 beta 2
         */
        public int FindColumnIndex(String columnHeader)
        {
            if (columnHeader == null) return -1;
            if (columnMap == null)
            {
                int count = ColumnCount;
                columnMap = new Dictionary<string, int>(count * 3 / 2);

                int i = 0;
                foreach (XSSFTableColumn column in GetColumns())
                {
                    columnMap.Add(column.Name.ToUpper(CultureInfo.CurrentCulture), i);
                    i++;
                }
            }
            // Table column names with special characters need a single quote escape
            // but the escape is not present in the column definition
            int idx = -1;
            string testKey = columnHeader.Replace("'", "").ToUpper(CultureInfo.CurrentCulture);
            if (columnMap.ContainsKey(testKey))
                idx = columnMap[testKey];
            return idx;
        }
        ///
        /// Note this list is static - once read, it does not notice later changes to the underlying column structures
        ///
        /// <returns></returns>
        public List<XSSFTableColumn> GetColumns()
        {
            if (tableColumns == null)
            {
                var columns = new List<XSSFTableColumn>();
                CT_TableColumns ctTableColumns = ctTable.tableColumns;
                if (ctTableColumns != null)
                {
                    foreach (CT_TableColumn column in ctTableColumns.GetTableColumnList())
                    {
                        XSSFTableColumn tableColumn = new XSSFTableColumn(this, column);
                        columns.Add(tableColumn);
                    }
                }
                tableColumns = columns;
            }
            return tableColumns;
        }
        public void RemoveColumn(XSSFTableColumn column)
        {
            int columnIndex = GetColumns().IndexOf(column);
            if (columnIndex >= 0)
            {
                ctTable.tableColumns.RemoveTableColumn(columnIndex);
                UpdateReferences();
                UpdateHeaders();
            }
        }
        public String SheetName
        {
            get
            {
                return GetXSSFSheet().SheetName;
            }
        }

        ///
        /// This is misleading.  The Spec indicates this is true if the totals row
        /// hasever been shown, not whether or not it is currently displayed.
        ///
        public bool IsHasTotalsRow
        {
            get
            {
                return ctTable.totalsRowShown;
            }
            set
            {
                ctTable.totalsRowShown = value;
            }
        }

        public int StartColIndex
        {
            get
            {
                return StartCellReference.Col;
            }
        }

        public int StartRowIndex
        {
            get
            {
                return StartCellReference.Row;
            }
        }

        public int EndColIndex
        {
            get
            {
                return EndCellReference.Col;
            }
        }

        public int EndRowIndex
        {
            get
            {
                return EndCellReference.Row;
            }
        }
        public bool Contains(CellReference cell)
        {
            if (cell == null) return false;
            // check if cell is on the same sheet as the table
            if (! SheetName.Equals(cell.SheetName)) return false;
            // check if the cell is inside the table
            if (cell.Row >= StartRowIndex
                && cell.Row <= EndRowIndex
                && cell.Col >= StartColIndex
                && cell.Col <= EndColIndex)
            {
                return true;
            }
            return false;
        }
    }
}


text:
function function_style1a
{
    echo "test"
}

function function_style1b
{
    echo "test"
}

function function_style1c
{
    echo "test"
}

function function_style1d {
    echo "test"
}

function function_style2a
{
    echo "test"
}

function function_style2b {
    echo "test"
}

function function_style3a
{
    echo "test"
}

function function_style3b
{
    echo "test"
}

function function_style3c
{
    echo "test"
}

function function_style3d {
    echo "test"
}


text:
package org.jbpm.designer.bpmn2.util;

import java.util.List;

import org.eclipse.bpmn2.Bpmn2Factory;
import org.eclipse.bpmn2.Documentation;
import org.eclipse.bpmn2.ScriptTask;
import org.eclipse.bpmn2.impl.BaseElementImpl;

import org.junit.Test;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;

public class BaseElementFeaturesTest {

    @Test
    public void testBaseElementDocumentationFeature() {
        try {
            Documentation testDocumentation = Bpmn2Factory.eINSTANCE.createDocumentation();
            testDocumentation.setText("test docs");

            // using script task but any base element will do
            ScriptTask scriptTask = Bpmn2Factory.eINSTANCE.createScriptTask();
            scriptTask.getDocumentation().add(testDocumentation);

            BaseElementImpl baseElement = (BaseElementImpl) scriptTask;

            // for base elements the first ("0") feature should
            // always be documentation
            Object eGetFeatureObj = baseElement.eGet(0,
                                                     false,
                                                     true);

            assertNotNull(eGetFeatureObj);
            assertTrue(eGetFeatureObj instanceof List);

            List<Documentation> baseElementDocs = (List<Documentation>) eGetFeatureObj;
            assertEquals("test docs",
                         baseElementDocs.get(0).getText());
        } catch (Throwable t) {
            fail("Error getting base element feature: " + t.getMessage());
        }
    }
}