text:
.class public final Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;
.super Lcom/htc/protobuf/GeneratedMessage$Builder;
.source "SyncProtocol.java"

# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Lcom/htc/cscore/transport/SyncProtocol$Htrace_events;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x19
    name = "Builder"
.end annotation

.annotation system Ldalvik/annotation/Signature;
    value = {
        "Lcom/htc/protobuf/GeneratedMessage$Builder",
        "<",
        "Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;",
        ">;"
    }
.end annotation

# instance fields
.field private result:Lcom/htc/cscore/transport/SyncProtocol$Htrace_events;

# direct methods
.method private constructor <init>()V
    .locals 0

    .prologue
    .line 59920
    invoke-direct {p0}, Lcom/htc/protobuf/GeneratedMessage$Builder;-><init>()V

    return-void
.end method

.method static synthetic access$114300(Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;)Lcom/htc/cscore/transport/SyncProtocol$Htrace_events;
    .locals 1
    .parameter "x0"
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Lcom/htc/protobuf/InvalidProtocolBufferException;
        }
    .end annotation

    .prologue
    .line 59915
    invoke-direct {p0}, Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;->buildParsed()Lcom/htc/cscore/transport/SyncProtocol$Htrace_events;

    move-result-object v0

    return-object v0
.end method

.method static synthetic access$114400()Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;
    .locals 1

    .prologue
    .line 59915
    invoke-static {}, Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;->create()Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;

    move-result-object v0

    return-object v0
.end method

.method private buildParsed()Lcom/htc/cscore/transport/SyncProtocol$Htrace_events;
    .locals 1
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Lcom/htc/protobuf/InvalidProtocolBufferException;
        }
    .end annotation

    .prologue
    .line 59994
    invoke-virtual {p0}, Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;->isInitialized()Z

    move-result v0

    if-nez v0, :cond_0

    .line 59995
    iget-object v0, p0, Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;->result:Lcom/htc/cscore/transport/SyncProtocol$Htrace_events;

    invoke-static {v0}, Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;->newUninitializedMessageException(Lcom/htc/protobuf/Message;)Lcom/htc/protobuf/UninitializedMessageException;

    move-result-object v0

    invoke-virtual {v0}, Lcom/htc/protobuf/UninitializedMessageException;->asInvalidProtocolBufferException()Lcom/htc/protobuf/InvalidProtocolBufferException;

    move-result-object v0

    throw v0

    .line 59998
    :cond_0
    invoke-virtual {p0}, Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;->buildPartial()Lcom/htc/cscore/transport/SyncProtocol$Htrace_events;

    move-result-object v0

    return-object v0
.end method

.method private static create()Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;
    .locals 3

    .prologue
    .line 59923
    new-instance v0, Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;

    invoke-direct {v0}, Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;-><init>()V

    .line 59924
    .local v0, builder:Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;
    new-instance v1, Lcom/htc/cscore/transport/SyncProtocol$Htrace_events;

    const/4 v2, 0x0

    invoke-direct {v1, v2}, Lcom/htc/cscore/transport/SyncProtocol$Htrace_events;-><init>(Lcom/htc/cscore/transport/SyncProtocol$1;)V

    iput-object v1, v0, Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;->result:Lcom/htc/cscore/transport/SyncProtocol$Htrace_events;

    .line 59925
    return-object v0
.end method

# virtual methods
.method public build()Lcom/htc/cscore/transport/SyncProtocol$Htrace_events;
    .locals 1

    .prologue
    .line 59986
    iget-object v0, p0, Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;->result:Lcom/htc/cscore/transport/SyncProtocol$Htrace_events;

    if-eqz v0, :cond_0

    invoke-virtual {p0}, Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;->isInitialized()Z

    move-result v0

    if-nez v0, :cond_0

    .line 59987
    iget-object v0, p0, Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;->result:Lcom/htc/cscore/transport/SyncProtocol$Htrace_events;

    invoke-static {v0}, Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;->newUninitializedMessageException(Lcom/htc/protobuf/Message;)Lcom/htc/protobuf/UninitializedMessageException;

    move-result-object v0

    throw v0

    .line 59989
    :cond_0
    invoke-virtual {p0}, Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;->buildPartial()Lcom/htc/cscore/transport/SyncProtocol$Htrace_events;

    move-result-object v0

    return-object v0
.end method

.method public bridge synthetic build()Lcom/htc/protobuf/Message;
    .locals 1

    .prologue
    .line 59915
    invoke-virtual {p0}, Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;->build()Lcom/htc/cscore/transport/SyncProtocol$Htrace_events;

    move-result-object v0

    return-object v0
.end method

.method public bridge synthetic build()Lcom/htc/protobuf/MessageLite;
    .locals 1

    .prologue
    .line 59915
    invoke-virtual {p0}, Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;->build()Lcom/htc/cscore/transport/SyncProtocol$Htrace_events;

    move-result-object v0

    return-object v0
.end method

.method public buildPartial()Lcom/htc/cscore/transport/SyncProtocol$Htrace_events;
    .locals 3

    .prologue
    .line 60006
    iget-object v1, p0, Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;->result:Lcom/htc/cscore/transport/SyncProtocol$Htrace_events;

    if-nez v1, :cond_0

    .line 60007
    new-instance v1, Ljava/lang/IllegalStateException;

    const-string v2, "build() has already been called on this Builder."

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

    throw v1

    .line 60010
    :cond_0
    iget-object v0, p0, Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;->result:Lcom/htc/cscore/transport/SyncProtocol$Htrace_events;

    .line 60011
    .local v0, returnMe:Lcom/htc/cscore/transport/SyncProtocol$Htrace_events;
    const/4 v1, 0x0

    iput-object v1, p0, Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;->result:Lcom/htc/cscore/transport/SyncProtocol$Htrace_events;

    .line 60012
    return-object v0
.end method

.method public bridge synthetic buildPartial()Lcom/htc/protobuf/Message;
    .locals 1

    .prologue
    .line 59915
    invoke-virtual {p0}, Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;->buildPartial()Lcom/htc/cscore/transport/SyncProtocol$Htrace_events;

    move-result-object v0

    return-object v0
.end method

.method public bridge synthetic buildPartial()Lcom/htc/protobuf/MessageLite;
    .locals 1

    .prologue
    .line 59915
    invoke-virtual {p0}, Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;->buildPartial()Lcom/htc/cscore/transport/SyncProtocol$Htrace_events;

    move-result-object v0

    return-object v0
.end method

.method public clear()Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;
    .locals 2

    .prologue
    .line 59941
    iget-object v0, p0, Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;->result:Lcom/htc/cscore/transport/SyncProtocol$Htrace_events;

    if-nez v0, :cond_0

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

    const-string v1, "Cannot call clear() after build()."

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

    throw v0

    .line 59945
    :cond_0
    new-instance v0, Lcom/htc/cscore/transport/SyncProtocol$Htrace_events;

    const/4 v1, 0x0

    invoke-direct {v0, v1}, Lcom/htc/cscore/transport/SyncProtocol$Htrace_events;-><init>(Lcom/htc/cscore/transport/SyncProtocol$1;)V

    iput-object v0, p0, Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;->result:Lcom/htc/cscore/transport/SyncProtocol$Htrace_events;

    .line 59946
    return-object p0
.end method

.method public bridge synthetic clear()Lcom/htc/protobuf/AbstractMessage$Builder;
    .locals 1

    .prologue
    .line 59915
    invoke-virtual {p0}, Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;->clear()Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;

    move-result-object v0

    return-object v0
.end method

.method public bridge synthetic clear()Lcom/htc/protobuf/Message$Builder;
    .locals 1

    .prologue
    .line 59915
    invoke-virtual {p0}, Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;->clear()Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;

    move-result-object v0

    return-object v0
.end method

.method public bridge synthetic clear()Lcom/htc/protobuf/MessageLite$Builder;
    .locals 1

    .prologue
    .line 59915
    invoke-virtual {p0}, Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;->clear()Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;

    move-result-object v0

    return-object v0
.end method

.method public clearId()Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;
    .locals 2

    .prologue
    .line 60132
    iget-object v0, p0, Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;->result:Lcom/htc/cscore/transport/SyncProtocol$Htrace_events;

    const/4 v1, 0x0

    #setter for: Lcom/htc/cscore/transport/SyncProtocol$Htrace_events;->hasId:Z
    invoke-static {v0, v1}, Lcom/htc/cscore/transport/SyncProtocol$Htrace_events;->access$114602(Lcom/htc/cscore/transport/SyncProtocol$Htrace_events;Z)Z

    .line 60133
    iget-object v0, p0, Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;->result:Lcom/htc/cscore/transport/SyncProtocol$Htrace_events;

    invoke-static {}, Lcom/htc/cscore/transport/SyncProtocol$UniqueId;->getDefaultInstance()Lcom/htc/cscore/transport/SyncProtocol$UniqueId;

    move-result-object v1

    #setter for: Lcom/htc/cscore/transport/SyncProtocol$Htrace_events;->id_:Lcom/htc/cscore/transport/SyncProtocol$UniqueId;
    invoke-static {v0, v1}, Lcom/htc/cscore/transport/SyncProtocol$Htrace_events;->access$114702(Lcom/htc/cscore/transport/SyncProtocol$Htrace_events;Lcom/htc/cscore/transport/SyncProtocol$UniqueId;)Lcom/htc/cscore/transport/SyncProtocol$UniqueId;

    .line 60134
    return-object p0
.end method

.method public clone()Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;
    .locals 2

    .prologue
    .line 59954
    invoke-static {}, Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;->create()Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;

    move-result-object v0

    iget-object v1, p0, Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;->result:Lcom/htc/cscore/transport/SyncProtocol$Htrace_events;

    invoke-virtual {v0, v1}, Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;->mergeFrom(Lcom/htc/cscore/transport/SyncProtocol$Htrace_events;)Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;

    move-result-object v0

    return-object v0
.end method

.method public bridge synthetic clone()Lcom/htc/protobuf/AbstractMessage$Builder;
    .locals 1

    .prologue
    .line 59915
    invoke-virtual {p0}, Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;->clone()Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;

    move-result-object v0

    return-object v0
.end method

.method public bridge synthetic clone()Lcom/htc/protobuf/AbstractMessageLite$Builder;
    .locals 1

    .prologue
    .line 59915
    invoke-virtual {p0}, Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;->clone()Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;

    move-result-object v0

    return-object v0
.end method

.method public bridge synthetic clone()Lcom/htc/protobuf/GeneratedMessage$Builder;
    .locals 1

    .prologue
    .line 59915
    invoke-virtual {p0}, Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;->clone()Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;

    move-result-object v0

    return-object v0
.end method

.method public bridge synthetic clone()Lcom/htc/protobuf/Message$Builder;
    .locals 1

    .prologue
    .line 59915
    invoke-virtual {p0}, Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;->clone()Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;

    move-result-object v0

    return-object v0
.end method

.method public bridge synthetic clone()Lcom/htc/protobuf/MessageLite$Builder;
    .locals 1

    .prologue
    .line 59915
    invoke-virtual {p0}, Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;->clone()Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;

    move-result-object v0

    return-object v0
.end method

.method public bridge synthetic clone()Ljava/lang/Object;
    .locals 1
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/lang/CloneNotSupportedException;
        }
    .end annotation

    .prologue
    .line 59915
    invoke-virtual {p0}, Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;->clone()Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;

    move-result-object v0

    return-object v0
.end method

.method public getDefaultInstanceForType()Lcom/htc/cscore/transport/SyncProtocol$Htrace_events;
    .locals 1

    .prologue
    .line 59971
    invoke-static {}, Lcom/htc/cscore/transport/SyncProtocol$Htrace_events;->getDefaultInstance()Lcom/htc/cscore/transport/SyncProtocol$Htrace_events;

    move-result-object v0

    return-object v0
.end method

.method public bridge synthetic getDefaultInstanceForType()Lcom/htc/protobuf/Message;
    .locals 1

    .prologue
    .line 59915
    invoke-virtual {p0}, Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;->getDefaultInstanceForType()Lcom/htc/cscore/transport/SyncProtocol$Htrace_events;

    move-result-object v0

    return-object v0
.end method

.method public bridge synthetic getDefaultInstanceForType()Lcom/htc/protobuf/MessageLite;
    .locals 1

    .prologue
    .line 59915
    invoke-virtual {p0}, Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;->getDefaultInstanceForType()Lcom/htc/cscore/transport/SyncProtocol$Htrace_events;

    move-result-object v0

    return-object v0
.end method

.method public getDescriptorForType()Lcom/htc/protobuf/Descriptors$Descriptor;
    .locals 1

    .prologue
    .line 59963
    invoke-static {}, Lcom/htc/cscore/transport/SyncProtocol$Htrace_events;->getDescriptor()Lcom/htc/protobuf/Descriptors$Descriptor;

    move-result-object v0

    return-object v0
.end method

.method public getId()Lcom/htc/cscore/transport/SyncProtocol$UniqueId;
    .locals 1

    .prologue
    .line 60089
    iget-object v0, p0, Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;->result:Lcom/htc/cscore/transport/SyncProtocol$Htrace_events;

    invoke-virtual {v0}, Lcom/htc/cscore/transport/SyncProtocol$Htrace_events;->getId()Lcom/htc/cscore/transport/SyncProtocol$UniqueId;

    move-result-object v0

    return-object v0
.end method

.method public hasId()Z
    .locals 1

    .prologue
    .line 60082
    iget-object v0, p0, Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;->result:Lcom/htc/cscore/transport/SyncProtocol$Htrace_events;

    invoke-virtual {v0}, Lcom/htc/cscore/transport/SyncProtocol$Htrace_events;->hasId()Z

    move-result v0

    return v0
.end method

.method protected internalGetResult()Lcom/htc/cscore/transport/SyncProtocol$Htrace_events;
    .locals 1

    .prologue
    .line 59933
    iget-object v0, p0, Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;->result:Lcom/htc/cscore/transport/SyncProtocol$Htrace_events;

    return-object v0
.end method

.method protected bridge synthetic internalGetResult()Lcom/htc/protobuf/GeneratedMessage;
    .locals 1

    .prologue
    .line 59915
    invoke-virtual {p0}, Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;->internalGetResult()Lcom/htc/cscore/transport/SyncProtocol$Htrace_events;

    move-result-object v0

    return-object v0
.end method

.method public isInitialized()Z
    .locals 1

    .prologue
    .line 59979
    iget-object v0, p0, Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;->result:Lcom/htc/cscore/transport/SyncProtocol$Htrace_events;

    invoke-virtual {v0}, Lcom/htc/cscore/transport/SyncProtocol$Htrace_events;->isInitialized()Z

    move-result v0

    return v0
.end method

.method public mergeFrom(Lcom/htc/cscore/transport/SyncProtocol$Htrace_events;)Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;
    .locals 1
    .parameter "other"

    .prologue
    .line 60029
    invoke-static {}, Lcom/htc/cscore/transport/SyncProtocol$Htrace_events;->getDefaultInstance()Lcom/htc/cscore/transport/SyncProtocol$Htrace_events;

    move-result-object v0

    if-ne p1, v0, :cond_0

    .line 60034
    :goto_0
    return-object p0

    .line 60030
    :cond_0
    invoke-virtual {p1}, Lcom/htc/cscore/transport/SyncProtocol$Htrace_events;->hasId()Z

    move-result v0

    if-eqz v0, :cond_1

    .line 60031
    invoke-virtual {p1}, Lcom/htc/cscore/transport/SyncProtocol$Htrace_events;->getId()Lcom/htc/cscore/transport/SyncProtocol$UniqueId;

    move-result-object v0

    invoke-virtual {p0, v0}, Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;->mergeId(Lcom/htc/cscore/transport/SyncProtocol$UniqueId;)Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;

    .line 60033
    :cond_1
    invoke-virtual {p1}, Lcom/htc/cscore/transport/SyncProtocol$Htrace_events;->getUnknownFields()Lcom/htc/protobuf/UnknownFieldSet;

    move-result-object v0

    invoke-virtual {p0, v0}, Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;->mergeUnknownFields(Lcom/htc/protobuf/UnknownFieldSet;)Lcom/htc/protobuf/GeneratedMessage$Builder;

    goto :goto_0
.end method

.method public mergeFrom(Lcom/htc/protobuf/CodedInputStream;Lcom/htc/protobuf/ExtensionRegistryLite;)Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;
    .locals 4
    .parameter "input"
    .parameter "extensionRegistry"
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .prologue
    .line 60045
    invoke-virtual {p0}, Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;->getUnknownFields()Lcom/htc/protobuf/UnknownFieldSet;

    move-result-object v3

    invoke-static {v3}, Lcom/htc/protobuf/UnknownFieldSet;->newBuilder(Lcom/htc/protobuf/UnknownFieldSet;)Lcom/htc/protobuf/UnknownFieldSet$Builder;

    move-result-object v2

    .line 60049
    .local v2, unknownFields:Lcom/htc/protobuf/UnknownFieldSet$Builder;
    :cond_0
    :goto_0
    invoke-virtual {p1}, Lcom/htc/protobuf/CodedInputStream;->readTag()I

    move-result v1

    .line 60050
    .local v1, tag:I
    sparse-switch v1, :sswitch_data_0

    .line 60055
    invoke-virtual {p0, p1, v2, p2, v1}, Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;->parseUnknownField(Lcom/htc/protobuf/CodedInputStream;Lcom/htc/protobuf/UnknownFieldSet$Builder;Lcom/htc/protobuf/ExtensionRegistryLite;I)Z

    move-result v3

    if-nez v3, :cond_0

    .line 60057
    invoke-virtual {v2}, Lcom/htc/protobuf/UnknownFieldSet$Builder;->build()Lcom/htc/protobuf/UnknownFieldSet;

    move-result-object v3

    invoke-virtual {p0, v3}, Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;->setUnknownFields(Lcom/htc/protobuf/UnknownFieldSet;)Lcom/htc/protobuf/GeneratedMessage$Builder;

    .line 60058
    :goto_1
    return-object p0

    .line 60052
    :sswitch_0
    invoke-virtual {v2}, Lcom/htc/protobuf/UnknownFieldSet$Builder;->build()Lcom/htc/protobuf/UnknownFieldSet;

    move-result-object v3

    invoke-virtual {p0, v3}, Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;->setUnknownFields(Lcom/htc/protobuf/UnknownFieldSet;)Lcom/htc/protobuf/GeneratedMessage$Builder;

    goto :goto_1

    .line 60063
    :sswitch_1
    invoke-static {}, Lcom/htc/cscore/transport/SyncProtocol$UniqueId;->newBuilder()Lcom/htc/cscore/transport/SyncProtocol$UniqueId$Builder;

    move-result-object v0

    .line 60064
    .local v0, subBuilder:Lcom/htc/cscore/transport/SyncProtocol$UniqueId$Builder;
    invoke-virtual {p0}, Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;->hasId()Z

    move-result v3

    if-eqz v3, :cond_1

    .line 60065
    invoke-virtual {p0}, Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;->getId()Lcom/htc/cscore/transport/SyncProtocol$UniqueId;

    move-result-object v3

    invoke-virtual {v0, v3}, Lcom/htc/cscore/transport/SyncProtocol$UniqueId$Builder;->mergeFrom(Lcom/htc/cscore/transport/SyncProtocol$UniqueId;)Lcom/htc/cscore/transport/SyncProtocol$UniqueId$Builder;

    .line 60067
    :cond_1
    invoke-virtual {p1, v0, p2}, Lcom/htc/protobuf/CodedInputStream;->readMessage(Lcom/htc/protobuf/MessageLite$Builder;Lcom/htc/protobuf/ExtensionRegistryLite;)V

    .line 60068
    invoke-virtual {v0}, Lcom/htc/cscore/transport/SyncProtocol$UniqueId$Builder;->buildPartial()Lcom/htc/cscore/transport/SyncProtocol$UniqueId;

    move-result-object v3

    invoke-virtual {p0, v3}, Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;->setId(Lcom/htc/cscore/transport/SyncProtocol$UniqueId;)Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;

    goto :goto_0

    .line 60050
    nop

    :sswitch_data_0
    .sparse-switch
        0x0 -> :sswitch_0
        0x2892 -> :sswitch_1
    .end sparse-switch
.end method

.method public mergeFrom(Lcom/htc/protobuf/Message;)Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;
    .locals 1
    .parameter "other"

    .prologue
    .line 60020
    instance-of v0, p1, Lcom/htc/cscore/transport/SyncProtocol$Htrace_events;

    if-eqz v0, :cond_0

    .line 60021
    check-cast p1, Lcom/htc/cscore/transport/SyncProtocol$Htrace_events;

    .end local p1
    invoke-virtual {p0, p1}, Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;->mergeFrom(Lcom/htc/cscore/transport/SyncProtocol$Htrace_events;)Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;

    move-result-object p0

    .line 60024
    .end local p0
    :goto_0
    return-object p0

    .line 60023
    .restart local p0
    .restart local p1
    :cond_0
    invoke-super {p0, p1}, Lcom/htc/protobuf/GeneratedMessage$Builder;->mergeFrom(Lcom/htc/protobuf/Message;)Lcom/htc/protobuf/AbstractMessage$Builder;

    goto :goto_0
.end method

.method public bridge synthetic mergeFrom(Lcom/htc/protobuf/CodedInputStream;Lcom/htc/protobuf/ExtensionRegistryLite;)Lcom/htc/protobuf/AbstractMessage$Builder;
    .locals 1
    .parameter "x0"
    .parameter "x1"
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .prologue
    .line 59915
    invoke-virtual {p0, p1, p2}, Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;->mergeFrom(Lcom/htc/protobuf/CodedInputStream;Lcom/htc/protobuf/ExtensionRegistryLite;)Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;

    move-result-object v0

    return-object v0
.end method

.method public bridge synthetic mergeFrom(Lcom/htc/protobuf/Message;)Lcom/htc/protobuf/AbstractMessage$Builder;
    .locals 1
    .parameter "x0"

    .prologue
    .line 59915
    invoke-virtual {p0, p1}, Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;->mergeFrom(Lcom/htc/protobuf/Message;)Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;

    move-result-object v0

    return-object v0
.end method

.method public bridge synthetic mergeFrom(Lcom/htc/protobuf/CodedInputStream;Lcom/htc/protobuf/ExtensionRegistryLite;)Lcom/htc/protobuf/AbstractMessageLite$Builder;
    .locals 1
    .parameter "x0"
    .parameter "x1"
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .prologue
    .line 59915
    invoke-virtual {p0, p1, p2}, Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;->mergeFrom(Lcom/htc/protobuf/CodedInputStream;Lcom/htc/protobuf/ExtensionRegistryLite;)Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;

    move-result-object v0

    return-object v0
.end method

.method public bridge synthetic mergeFrom(Lcom/htc/protobuf/CodedInputStream;Lcom/htc/protobuf/ExtensionRegistryLite;)Lcom/htc/protobuf/Message$Builder;
    .locals 1
    .parameter "x0"
    .parameter "x1"
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .prologue
    .line 59915
    invoke-virtual {p0, p1, p2}, Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;->mergeFrom(Lcom/htc/protobuf/CodedInputStream;Lcom/htc/protobuf/ExtensionRegistryLite;)Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;

    move-result-object v0

    return-object v0
.end method

.method public bridge synthetic mergeFrom(Lcom/htc/protobuf/Message;)Lcom/htc/protobuf/Message$Builder;
    .locals 1
    .parameter "x0"

    .prologue
    .line 59915
    invoke-virtual {p0, p1}, Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;->mergeFrom(Lcom/htc/protobuf/Message;)Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;

    move-result-object v0

    return-object v0
.end method

.method public bridge synthetic mergeFrom(Lcom/htc/protobuf/CodedInputStream;Lcom/htc/protobuf/ExtensionRegistryLite;)Lcom/htc/protobuf/MessageLite$Builder;
    .locals 1
    .parameter "x0"
    .parameter "x1"
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .prologue
    .line 59915
    invoke-virtual {p0, p1, p2}, Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;->mergeFrom(Lcom/htc/protobuf/CodedInputStream;Lcom/htc/protobuf/ExtensionRegistryLite;)Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;

    move-result-object v0

    return-object v0
.end method

.method public mergeId(Lcom/htc/cscore/transport/SyncProtocol$UniqueId;)Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;
    .locals 2
    .parameter "value"

    .prologue
    .line 60117
    iget-object v0, p0, Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;->result:Lcom/htc/cscore/transport/SyncProtocol$Htrace_events;

    invoke-virtual {v0}, Lcom/htc/cscore/transport/SyncProtocol$Htrace_events;->hasId()Z

    move-result v0

    if-eqz v0, :cond_0

    iget-object v0, p0, Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;->result:Lcom/htc/cscore/transport/SyncProtocol$Htrace_events;

    #getter for: Lcom/htc/cscore/transport/SyncProtocol$Htrace_events;->id_:Lcom/htc/cscore/transport/SyncProtocol$UniqueId;
    invoke-static {v0}, Lcom/htc/cscore/transport/SyncProtocol$Htrace_events;->access$114700(Lcom/htc/cscore/transport/SyncProtocol$Htrace_events;)Lcom/htc/cscore/transport/SyncProtocol$UniqueId;

    move-result-object v0

    invoke-static {}, Lcom/htc/cscore/transport/SyncProtocol$UniqueId;->getDefaultInstance()Lcom/htc/cscore/transport/SyncProtocol$UniqueId;

    move-result-object v1

    if-eq v0, v1, :cond_0

    .line 60119
    iget-object v0, p0, Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;->result:Lcom/htc/cscore/transport/SyncProtocol$Htrace_events;

    iget-object v1, p0, Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;->result:Lcom/htc/cscore/transport/SyncProtocol$Htrace_events;

    #getter for: Lcom/htc/cscore/transport/SyncProtocol$Htrace_events;->id_:Lcom/htc/cscore/transport/SyncProtocol$UniqueId;
    invoke-static {v1}, Lcom/htc/cscore/transport/SyncProtocol$Htrace_events;->access$114700(Lcom/htc/cscore/transport/SyncProtocol$Htrace_events;)Lcom/htc/cscore/transport/SyncProtocol$UniqueId;

    move-result-object v1

    invoke-static {v1}, Lcom/htc/cscore/transport/SyncProtocol$UniqueId;->newBuilder(Lcom/htc/cscore/transport/SyncProtocol$UniqueId;)Lcom/htc/cscore/transport/SyncProtocol$UniqueId$Builder;

    move-result-object v1

    invoke-virtual {v1, p1}, Lcom/htc/cscore/transport/SyncProtocol$UniqueId$Builder;->mergeFrom(Lcom/htc/cscore/transport/SyncProtocol$UniqueId;)Lcom/htc/cscore/transport/SyncProtocol$UniqueId$Builder;

    move-result-object v1

    invoke-virtual {v1}, Lcom/htc/cscore/transport/SyncProtocol$UniqueId$Builder;->buildPartial()Lcom/htc/cscore/transport/SyncProtocol$UniqueId;

    move-result-object v1

    #setter for: Lcom/htc/cscore/transport/SyncProtocol$Htrace_events;->id_:Lcom/htc/cscore/transport/SyncProtocol$UniqueId;
    invoke-static {v0, v1}, Lcom/htc/cscore/transport/SyncProtocol$Htrace_events;->access$114702(Lcom/htc/cscore/transport/SyncProtocol$Htrace_events;Lcom/htc/cscore/transport/SyncProtocol$UniqueId;)Lcom/htc/cscore/transport/SyncProtocol$UniqueId;

    .line 60124
    :goto_0
    iget-object v0, p0, Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;->result:Lcom/htc/cscore/transport/SyncProtocol$Htrace_events;

    const/4 v1, 0x1

    #setter for: Lcom/htc/cscore/transport/SyncProtocol$Htrace_events;->hasId:Z
    invoke-static {v0, v1}, Lcom/htc/cscore/transport/SyncProtocol$Htrace_events;->access$114602(Lcom/htc/cscore/transport/SyncProtocol$Htrace_events;Z)Z

    .line 60125
    return-object p0

    .line 60122
    :cond_0
    iget-object v0, p0, Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;->result:Lcom/htc/cscore/transport/SyncProtocol$Htrace_events;

    #setter for: Lcom/htc/cscore/transport/SyncProtocol$Htrace_events;->id_:Lcom/htc/cscore/transport/SyncProtocol$UniqueId;
    invoke-static {v0, p1}, Lcom/htc/cscore/transport/SyncProtocol$Htrace_events;->access$114702(Lcom/htc/cscore/transport/SyncProtocol$Htrace_events;Lcom/htc/cscore/transport/SyncProtocol$UniqueId;)Lcom/htc/cscore/transport/SyncProtocol$UniqueId;

    goto :goto_0
.end method

.method public setId(Lcom/htc/cscore/transport/SyncProtocol$UniqueId$Builder;)Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;
    .locals 2
    .parameter "builderForValue"

    .prologue
    .line 60108
    iget-object v0, p0, Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;->result:Lcom/htc/cscore/transport/SyncProtocol$Htrace_events;

    const/4 v1, 0x1

    #setter for: Lcom/htc/cscore/transport/SyncProtocol$Htrace_events;->hasId:Z
    invoke-static {v0, v1}, Lcom/htc/cscore/transport/SyncProtocol$Htrace_events;->access$114602(Lcom/htc/cscore/transport/SyncProtocol$Htrace_events;Z)Z

    .line 60109
    iget-object v0, p0, Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;->result:Lcom/htc/cscore/transport/SyncProtocol$Htrace_events;

    invoke-virtual {p1}, Lcom/htc/cscore/transport/SyncProtocol$UniqueId$Builder;->build()Lcom/htc/cscore/transport/SyncProtocol$UniqueId;

    move-result-object v1

    #setter for: Lcom/htc/cscore/transport/SyncProtocol$Htrace_events;->id_:Lcom/htc/cscore/transport/SyncProtocol$UniqueId;
    invoke-static {v0, v1}, Lcom/htc/cscore/transport/SyncProtocol$Htrace_events;->access$114702(Lcom/htc/cscore/transport/SyncProtocol$Htrace_events;Lcom/htc/cscore/transport/SyncProtocol$UniqueId;)Lcom/htc/cscore/transport/SyncProtocol$UniqueId;

    .line 60110
    return-object p0
.end method

.method public setId(Lcom/htc/cscore/transport/SyncProtocol$UniqueId;)Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;
    .locals 2
    .parameter "value"

    .prologue
    .line 60096
    if-nez p1, :cond_0

    .line 60097
    new-instance v0, Ljava/lang/NullPointerException;

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

    throw v0

    .line 60099
    :cond_0
    iget-object v0, p0, Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;->result:Lcom/htc/cscore/transport/SyncProtocol$Htrace_events;

    const/4 v1, 0x1

    #setter for: Lcom/htc/cscore/transport/SyncProtocol$Htrace_events;->hasId:Z
    invoke-static {v0, v1}, Lcom/htc/cscore/transport/SyncProtocol$Htrace_events;->access$114602(Lcom/htc/cscore/transport/SyncProtocol$Htrace_events;Z)Z

    .line 60100
    iget-object v0, p0, Lcom/htc/cscore/transport/SyncProtocol$Htrace_events$Builder;->result:Lcom/htc/cscore/transport/SyncProtocol$Htrace_events;

    #setter for: Lcom/htc/cscore/transport/SyncProtocol$Htrace_events;->id_:Lcom/htc/cscore/transport/SyncProtocol$UniqueId;
    invoke-static {v0, p1}, Lcom/htc/cscore/transport/SyncProtocol$Htrace_events;->access$114702(Lcom/htc/cscore/transport/SyncProtocol$Htrace_events;Lcom/htc/cscore/transport/SyncProtocol$UniqueId;)Lcom/htc/cscore/transport/SyncProtocol$UniqueId;

    .line 60101
    return-object p0
.end method


text:
package weaver.instrumentation.injection;

import javassist.ClassPool;
import javassist.CtClass;

/**
 * @author Saeed Masoumi (saeed@6thsolution.com)
 */
abstract class BaseInjector<Parent extends ResourceBundle>
        implements ResourceBundle {
    protected Parent parent;

    BaseInjector(Parent parent) {
        this.parent = parent;
    }

    public abstract Parent inject() throws Exception;

    @Override
    public CtClass getCtClass() {
        return parent.getCtClass();
    }

    @Override
    public ClassPool getPool() {
        return parent.getPool();
    }

}

redpajama_set_name: RedPajamaGithub


text:
<?xml version="1.0" encoding="UTF-8" standalone="no"?><shape xmlns:android="http://schemas.android.com/apk/res/android">
	<gradient android:angle="270" android:endColor="#5F000000" android:startColor="#5F888574"/>
	<corners android:radius="10px"/>
	<padding android:bottom="0dp" android:left="0dp" android:right="0dp" android:top="0dp"/>
</shape>


text:
<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/cloud/dialogflow/v2/agent.proto

namespace Google\Cloud\Dialogflow\V2;

use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\RepeatedField;
use Google\Protobuf\Internal\GPBUtil;

/**
 * The request message for [Agents.GetValidationResult][google.cloud.dialogflow.v2.Agents.GetValidationResult].
 *
 * Generated from protobuf message google.cloud.dialogflow.v2.GetValidationResultRequest
 */
class GetValidationResultRequest extends \Google\Protobuf\Internal\Message
{
    /**
     * Required. The project that the agent is associated with.
     * Format: `projects/<Project ID>`.
     *
     * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
     */
    private $parent = '';
    /**
     * Optional. The language for which you want a validation result. If not
     * specified, the agent's default language is used. [Many
     * languages](https://cloud.google.com/dialogflow/docs/reference/language)
     * are supported. Note: languages must be enabled in the agent before they can
     * be used.
     *
     * Generated from protobuf field string language_code = 3 [(.google.api.field_behavior) = OPTIONAL];
     */
    private $language_code = '';

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type string $parent
     *           Required. The project that the agent is associated with.
     *           Format: `projects/<Project ID>`.
     *     @type string $language_code
     *           Optional. The language for which you want a validation result. If not
     *           specified, the agent's default language is used. [Many
     *           languages](https://cloud.google.com/dialogflow/docs/reference/language)
     *           are supported. Note: languages must be enabled in the agent before they can
     *           be used.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Dialogflow\V2\Agent::initOnce();
        parent::__construct($data);
    }

    /**
     * Required. The project that the agent is associated with.
     * Format: `projects/<Project ID>`.
     *
     * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
     * @return string
     */
    public function getParent()
    {
        return $this->parent;
    }

    /**
     * Required. The project that the agent is associated with.
     * Format: `projects/<Project ID>`.
     *
     * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
     * @param string $var
     * @return $this
     */
    public function setParent($var)
    {
        GPBUtil::checkString($var, True);
        $this->parent = $var;

        return $this;
    }

    /**
     * Optional. The language for which you want a validation result. If not
     * specified, the agent's default language is used. [Many
     * languages](https://cloud.google.com/dialogflow/docs/reference/language)
     * are supported. Note: languages must be enabled in the agent before they can
     * be used.
     *
     * Generated from protobuf field string language_code = 3 [(.google.api.field_behavior) = OPTIONAL];
     * @return string
     */
    public function getLanguageCode()
    {
        return $this->language_code;
    }

    /**
     * Optional. The language for which you want a validation result. If not
     * specified, the agent's default language is used. [Many
     * languages](https://cloud.google.com/dialogflow/docs/reference/language)
     * are supported. Note: languages must be enabled in the agent before they can
     * be used.
     *
     * Generated from protobuf field string language_code = 3 [(.google.api.field_behavior) = OPTIONAL];
     * @param string $var
     * @return $this
     */
    public function setLanguageCode($var)
    {
        GPBUtil::checkString($var, True);
        $this->language_code = $var;

        return $this;
    }

}


text:
package com.delmar.base.model;

import com.delmar.core.model.CoreModel;

public class CityTrl extends CoreModel {

    private String language;

    private Integer cityId;

    private String name;

    private String remark;

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getLanguage() {
        return language;
    }

    public void setLanguage(String language) {
        this.language = language == null ? null : language.trim();
    }

    public Integer getCityId() {
        return cityId;
    }

    public void setCityId(Integer cityId) {
        this.cityId = cityId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name == null ? null : name.trim();
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark == null ? null : remark.trim();
    }
}


text:
[Index](./index.md)

# Serious OOP Inheritance  Polymorphism

## Inheritance
- ![Motivation for Inheritance](../assets/inheritance-motivation.png)
- Duplicate code -> maintenance nightmare
 - Solution: Inheritance
- Inheritance: **Fundamental Feature of OOP**
- ![Inheritance](../assets/with-inheritance-duplicate-code-issue-resolved.png)
- Inheritance tree or inheritance hierarchy
- Benefits
  - Code reuse
  - Change needed to be done only once in the super class
- Subclasses
  - Specialized version of super classes
    - Inherit members
    - Add new members
    - Override superclass methods
- Subclass <- Superclass + subclass capabilities
- Terminology
  - Superclass -> supertype or base class
  - SubClass -> subtype or derived class
- Further refinement:
- ![Inheritance Refined](../assets/with-inheritance-duplicate-code-issue-resolved-and-refined.png)
- Extending a class
  - **extends** keyword
    - class User{}
    - class Staff **extends** User {}
    - class EmailAdmin **extends** Staff {}
    - class Editor **extends** Staff {}
    - class ChiefEditor **extends** Editor {}
- *A class can extend from **only one** class*

## Access Modifiers and Inheritance
- Classes in a package are like *family*
- Access modifier specify what members of a class are accessible to family members and non-family members
  - family members: classes in the same package
  - non-family members: classes in different package
- Inheritance Accessibility
  - private
    - **NOT** inherited
  - default
    - inherited if from *family* ( non family members can't access them )
      - only family can access inherited members
  - public
    - inherited
      - anyone can access inherited members
  - protected
    - Inherited
      - Allow access to *my* family members ( non family members can access )
- [A1.java](https://github.com/SanthoshBabuMR/Udemy-Java--In-Depth--Become-a-Complete-Java-Engineer/blob/master/javaindepth/src/com/semanticsquare/oop/p1/A1.java)

## IS-A Test
- Helps with design:
  - Helps identify which class should be super class and which should be sub class
- IS-A Relationship test
  - **First and Most fundamental test** for inheritance
- **IS-A Test**
  - Staff IS-A User
  - Editor IS-A Staff
  - Editor IS-A User
  - ChiefEditor IS-A User
  - Surgeon IS-A Doctor
  - Triangle IS-A Shape
  - **Works only in one direction**
   - For eg, *staff IS-A user* but *user IS-NOT-A staff*
- When IS-A test fails, inheritance shouldn't be used
- **HAS-A Test**
  - Bookmark IS-A Review ~ Nope
  - Review IS-A Bookmark ~ Nope
  - Bookmark HAS-A Review ~ Yep // Composition Relationship
  - Bathroom IS-A Tub ~ Nope
  - Tub IS-A Bathroom ~ Nope
  - Bathroom HAS-A Tub ~ Yep
- In some cases, *composition* is preferred over *inheritance*

## Polymorphism
- Because inheritance exits, we are able to take advantage of poylmorphism
- Defining Contract
  - Class defines *contract*
    - It announces *I have these kinds of methods ...*
    - In case of public members, it becomes the API
- Defining Common Protocol
  - Supertype defines **common protocol**
    - It announces *Myself and my subtypes have these kinds of methods ...*
- With polymorphism, **Supertype** can be assigned any of its **subtypes**
```java
void updateProfile(User u){ ... } // Method param is a polymorphic reference

// Due to polymorphism, any of the following types can be passed as argument to the above method
new User()
new Staff()
new Editor()
new ChiefEditor()
```
  - Benefit
    - flexible code ( less susceptible to change )
      - i.e. even when new subtypes gets added, the above method would work fine
    - clean code
      - no need to have a *updateProfile* for each type, one suffices
- *Reference type* & actual *object type* can be different
```java
User user = new Editor();

// User = Reference Type
// Editor = Object Type
```
- Method Invocation
  - Compiler uses *reference type* to decide **Whether** a method can be invoked
```java
User user = new Editor();
user.approveReview(); // Compiler error
```
  - During runtime, JVM uses *object type* to decide **which** method is invoked
    - JVM invokes the most specific version
      - Given a method invocation, along the inheritance tree, JVM climbs up the tree (parent class) from the *object type* and the invokes the first matching method (bottom up)
- ![Resolving method invocation](../assets/inheritance-resolving-method-invocation.png)
- [https://github.com/UserTest.java](https://github.com/SanthoshBabuMR/Udemy-Java--In-Depth--Become-a-Complete-Java-Engineer/blob/master/javaindepth/src/com/semanticsquare/polymorphism/UserTest.java)

## Casting objects and instanceof operator
- Primitive Casting
  - Implicit: float f = 25;     // smaller to larger primitive
  - Explicit: int x = (int)42L; // larger to smaller primitive
- Implicit Casting
  - Due to polymorphism, we can pass a *sub class object* as an argument of a *super class*
  - Subclass-specific methods are no longer valid
```java
Staff s = new Editor();
s.approveReview(); // compile error ( since compiler uses reference type to determine method invocation )
((Editor) s).approveReview(); // Explicit Casting; compiler passes
```
- **ClassCastException**
- instanceof operator
  - objRef **instanceof** aClass
  - objType matters, not referenceType
```java
User u = new User();
Staff s = new Staff();
User us = new Staff();

u instanceOf User ~ True
u instanceOf Staff ~ False
s instanceOf User ~ True
s instanceOf Staff ~ True
us instanceOf User ~ True
us instanceOf Staff ~ True
```

## Type Safety
- Java is type safe language ( relevant to casting )
- Extent to which a programming langauge prevents **type errors**
- Type Errors
  - Bad errors that could lead to undesirable program behaviour
    - Invoking non-existent method on an object
      - `staff.approveReview()`
  - Buffer overflow ~ out-of-bound write
    - Memory safety
    - Buffere overflow associated with languages like C,C++
      - `char data[6] = "hello";`
- Type Safety Enforcement
  - Compile time (static-type checking) ~ C, Pascal
  - Runtime (Dynamic-type checking) ~ Ruby, Python
  - Both ~ java
- Static Type Checking
```java
  int i = 233.3;  // compile error
    int i = (int)233.3; // casting
  Staff s = new Editor();
  s.approveReview(); // compile error
    ((Editor s)).approveReview(); // casting
  // Generics
```
- Dynamic Type Checking
  - ClassCastException
  - ArrayIndexOutOfBoundsException
- Strong vs Weak Typed Systems
  - Strong typing ~ no loopholes
  - Weak typing ~ has loopholes

## Method Overriding
- **Redefine** behaviour of superclass method
  - Add new behaviour
  - Extend behaviour
  - Providing better implementation, e.g., override ineffecticient/bad code in a library
- Fulfilling Contract
  - Supertype define *contract* & *common protocol*
  - When a superclass method is being overridden, you **agree to fulfill the contract**
- Rules
  - Same name for methods in super class and sub class
  - 1: Same parameters + compatible return types
    - return type must be same or subclass type
  - 2: Overriding methods can't be less accessible
    - Access levels must be same or friendlier
- Super keyword
  - Access super class methods from sub class
  - Typically used for extending behaviour defined in super class
  - When a method is **not overridden** ~ access directly or via super
  - When a method is **overridden** ~ access via super
  - Can't be used in *static* method
  - Access *hidden* fields
    - A superclass field is *hidden*, if a field in subclass has the same name
```java
// Method overridding: Extend behaviour
class Staff extends User {
  void postAReview() {
    super.postAReview();
    // behaviour extension code
  }
}
```
- [https://github.com/SanthoshBabuMR/overridding/UserTest.java](https://github.com/SanthoshBabuMR/Udemy-Java--In-Depth--Become-a-Complete-Java-Engineer/blob/9cd1b3da5c580b2e77b739ad968492962123f176/javaindepth/src/com/semanticsquare/overridding/UserTest.java)

## Method Binding
- Mechanism of binding a method call to
  - Method declaration and its implementation
    - Method declaration ~ Method Signarue -> Method Name + Order and Type of params
    - Method Implementation ~ Method body
- Static Method
  - Compile-time Binding ( early binding )
    - Method Signature
    - Method Implementation
- Non-Static Method
  - Compile-time Binding ( early binding )
    - Method Signature
  - Run time Binding ( late binding )
    - Method Implementation
- `javap -v UserTest.class`
- Fields(static and instance variables) are early bounded
```java
User
- void saveWebLink(String)
- void postAReview(String)
Staff extends User
- void RunCampaign()
Editor extends Staff
- boolean apporveReview()
- boolean declineReview()

User u = new Editor();
// During compile time, Reference Type i.e. User type and its super classes are inspected for the RunCampaign
// In this case, User type is the super class and no inheritance exists above User. Hence compiler errros out
u.RunCampaign(); // Instance Methods

// During compile time, Reference Type i.e. Editor type and its super classes are inspected for the RunCampaign
// In this case, Editor type's immediate super class Staff has RunCampaign, whose METHOD SIGNATURE is binded as
// RunCampaign() v ~ no arguments with void return type
((Editor) u).RunCampaign(); // Instance Methods
```
- Tip
  - When encountering an instance method, start lookup from **object type** and go up the parent tree, till found
  - When encountering an static method/instance variable, start lookup from **reference type**  and go up the parent tree, till found

## What is not overridden?
- **final** methods
  - `final returnType methodName() {}`
- Fields ~ Instance & Static
- Static methods
- Method overriding applicable when
  - derived class method has same signature and return type as super class method
- Only instance methods can be overridden, since Method Implementation is done during run time
- Static methods, fields can't be overridden, they are simply hidden
- [Java Method Hiding and Overriding: Override Static Method in Java](https://crunchify.com/java-method-hiding-and-overriding-override-static-method-in-java/)

## java.lang.Object
- Mother of all classes i.e. superclass of everything
- Every class directly or indirectly or implicitily extends Object class
  - Acts as polymorphic type
    - Any JAVA object can be assigned to a variable whose reference type is Object class
    - Includes core methods
- toString()
  - Returns a string representation of the object
  - Default: *com.semanticsquare.overridding.Staff@4aa8f0b4*
  - Item 10: Always override toString
    - Very useful for debugging
    - Return all *interesting* information
- hasCode()
  - Returns object's hashcode (memory address in hexadecimal)
  - Used in hash table
- equals(Object)
  - Tests object equality
  - Default: Uses **==** operator
```java
equals(Object user) {
  this.getId() == ((User) user).getId();
}
```
- **Upcasting is casting to a supertype, while downcasting is casting to a subtype. Upcasting is always allowed, but downcasting involves a type check and can throw a *ClassCastException*.**
- getClass()
  - final method that returns *Class* Object
  - Class object -> class name, superclass name, method names, ...
- clone()
  - *Protected* method that returns a **copy** of the object

## Constructor Chaining
- Subclasses inherit methods from superclass ( Constructor chaining is what makes this possible )
- Inherited methods might depend on *superclass state*
- Super classes must be initialized first
- *A Sub class state should be initialized after all its super class state is initialized, including the top most Object class*
- Constructors initialize *object state*
- ![Constructor Chaining](../assets/constructor-chaining.png)
- Super keyword
  - Invokes superclass constructor, e.g., super()
  - Must be first statement unless *this()* is used
    - *this()* ~ overloaded constructors
  - *this()* or *super()*, but never both
    - With overloaded constructors, *last* invoked will call super
  - If not provided, compiler inserts *super()*
- ![Automatic - No arg constructor and super() insertion by compiler](../assets/automatica--no-arg-consturcotr-super-method-invocation.png)
- Point to NOTE
  - *default no-arg consturctor* is inserted only if NO constructor is explicitly declared
  - when super class constructor signature has parameters, then the default *super()* invocation dynamcially inserted will no longer work and *super()* should be invoked with the correct arguments manually
- ![Constructor Compiler Error](../assets/handling-consturctor-compiler-error.png)

## Preventing Inheritance
- With inheritance, we not only inherit functionality, but also extend, overrirde behaviour defined in super class alongwith adding new functionality
- Why?
  - All methods are *final*
  - *Class semantics (invariants)* is final, e.g., String Class ( has immutability and had inheritance been allowed, this feature might have been compromised )
  - **Item 15: Minimize mutability**
- How?
  - *final* class
  - *private* constructor
- final Class
  - `final class ClassName {...}`
  - Not extendible, but *instantiable*, e.g., String class
  - Preferred over *private constructor* because it is instantiable
- private Constructor
  - Not extendible, *not instantiable*
  - Item 4
    - Enforce noninstantiability with a private constructor
    - Utility classes like Math
    - Saves heap space
  - Can't be invoked from subclass!
    - No constructor chaining -> No subclass
- Institantiate to handle state and behaviour without inheritance ~ final
- Utility class that handles no state ~ private constrcutor

## Conclusion
- Inheritance
  - Polymorphism
  - Method Overriding
  - Constructor Chaining
  - Object class
- Inheritance Benefits
  - Code reuse. Avoid duplicate code. Duplicate code gets abstracted out in super class
  - Better design
    - Helps model objects based on real world hierarchy
  - Redefining behaviour
  - Establishing a contract
    - Polymorphism
      - flexible code ( code that is less susceptible to change )
      - clean code
- IS-A test
- Class can extend from only one class
- Method Invocation
  - **Complier** uses *reference type* to decide **whether** a method can be invoked
  - **JVM** uses *object type* to decide **which** method is invoked
- Static method
  - Not overridden. Compile time bounded!
- Method overriding rule
  - Same Method Signature ( Same method name + Same order and type of arguments )
  - Compatible return types
  - Same or friendlier access level for the method
- Object class
  - Every class directly or indirectly extends Object class
  - Serves as a polymorphic type
- Constructor chaining
  - Super classes must be initialized first i.e. before sub class
  - super() ~ calling super class constructor
  - this() or super(), but never both
  - With overloaded constructors, *last invoked constructor* will call super
- Preventing Inheritance
  - final class ~ String Class
  - private constructor ~ Math Class


text:
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
                        unicode_literals, with_statement)

from collections import defaultdict, namedtuple

from pants.goal.goal import Goal

class ProducerInfo(namedtuple('ProducerInfo', ['product_type', 'task_type', 'goal'])):
  """Describes the producer of a given product type."""

class RoundManager(object):

  class MissingProductError(KeyError):
    """Indicates a required product type is provided by non-one."""

  @staticmethod
  def _index_products():
    producer_info_by_product_type = defaultdict(set)
    for goal in Goal.all():
      for task_type in goal.task_types():
        for product_type in task_type.product_types():
          producer_info = ProducerInfo(product_type, task_type, goal)
          producer_info_by_product_type[product_type].add(producer_info)
    return producer_info_by_product_type

  def __init__(self, context):
    self._dependencies = set()
    self._context = context
    self._producer_infos_by_product_type = None

  def require(self, product_type):
    """Schedules the tasks that produce product_type to be executed before the requesting task."""
    self._dependencies.add(product_type)
    self._context.products.require(product_type)

  def require_data(self, product_type):
    """Schedules the tasks that produce product_type to be executed before the requesting task."""
    self._dependencies.add(product_type)
    self._context.products.require_data(product_type)

  def get_dependencies(self):
    """Returns the set of data dependencies as producer infos corresponding to data requirements."""
    producer_infos = set()
    for product_type in self._dependencies:
      producer_infos.update(self._get_producer_infos_by_product_type(product_type))
    return producer_infos

  def _get_producer_infos_by_product_type(self, product_type):
    if self._producer_infos_by_product_type is None:
      self._producer_infos_by_product_type = self._index_products()

    producer_infos = self._producer_infos_by_product_type[product_type]
    if not producer_infos:
      raise self.MissingProductError("No producers registered for '{0}'".format(product_type))
    return producer_infos


text:
package v1_15 //nolint

import (
	"testing"

	"code.gitea.io/gitea/models/migrations/base"

	"github.com/stretchr/testify/assert"
)

func Test_AddIssueResourceIndexTable(t *testing.T) {
	// Create the models used in the migration
	type Issue struct {
		ID     int64 `xorm:"pk autoincr"`
		RepoID int64 `xorm:"UNIQUE(s)"`
		Index  int64 `xorm:"UNIQUE(s)"`
	}

	// Prepare and load the testing database
	x, deferable := base.PrepareTestEnv(t, 0, new(Issue))
	if x == nil || t.Failed() {
		defer deferable()
		return
	}
	defer deferable()

	// Run the migration
	if err := AddIssueResourceIndexTable(x); err != nil {
		assert.NoError(t, err)
		return
	}

	type ResourceIndex struct {
		GroupID  int64 `xorm:"pk"`
		MaxIndex int64 `xorm:"index"`
	}

	start := 0
	const batchSize = 1000
	for {
		indexes := make([]ResourceIndex, 0, batchSize)
		err := x.Table("issue_index").Limit(batchSize, start).Find(&indexes)
		assert.NoError(t, err)

		for _, idx := range indexes {
			var maxIndex int
			has, err := x.SQL("SELECT max(`index`) FROM issue WHERE repo_id = ?", idx.GroupID).Get(&maxIndex)
			assert.NoError(t, err)
			assert.True(t, has)
			assert.EqualValues(t, maxIndex, idx.MaxIndex)
		}
		if len(indexes) < batchSize {
			break
		}
		start += len(indexes)
	}
}


text:
/**
 * Create initial config object
 *
 * @type {Object}
 */
const config = {};

// Secret for crypto
config.secret = 'someStrongSecretHash';

config.browserlist = ['last 3 versions', 'not < 0.25%', 'not dead', 'not ie 11', 'not op_mini all'];

config.title = 'EdenJS';
config.direction = 1; // 0 = page only, 1 = title before page title, 2 = title after page title

config.domain = 'eden';
config.version = '0.1.0';

config.environment = 'dev';
config.logLevel = config.environment === 'dev' ? 'debug' : 'info';

config.logo = '/data/www/public/assets/images/logo.svg';

config.noSourcemaps = false;

config.modules = [];

config.port = 1337;
config.host = '0.0.0.0';

// Set amount of threads. Setting this as null will count your CPU cores
config.expressThreads = 1;
config.computeThreads = 2;

// Lock configuration
config.lock = {
  maxPending : 1000000,
};

// I18n configuration
config.i18n = {
  defaultNS    : 'default',
  fallbackNS   : 'default',
  fallbackLng  : 'en-au',
  lowerCaseLng : true,
};

// Set config database object
config.database = {
  plug   : 'MongoPlug', // Can be MongoPlug, RethinkPlug, CouchPlug or ElasticPlug
  config : {
    db  : config.domain.split('.')[0],
    url : 'mongodb://localhost:27017',
  },
};

// Redis configuration
config.redis = {
  host : 'localhost',
  port : 6379,
};

// Set SMTP config email object
config.email = {
  service : 'Zoho',
  auth    : {
    user : 'email@domain.com',
    pass : 'superSecretPassword',
  },
};

// Set config ACL object
config.acl = {
  // Default ACL for user. This is added by default to every registered user
  default : [
    {
      name  : 'User',
      value : [
        'user.authenticated',
      ],
    },
  ],

  // Default ACL for first user (admin). This ACL is added only to the first user
  admin : [
    {
      name  : 'Admin',
      value : true, // Assigning true to value gives access to everything
    },
  ],
};

module.exports = config;


text:
using System.Windows;
using System.Windows.Controls;

namespace Certify.UI.Controls
{
    /// <summary>
    /// Interaction logic for GettingStarted.xaml
    /// </summary>
    public partial class GettingStarted : UserControl
    {
        public GettingStarted()
        {
            InitializeComponent();
        }

        private void AddToDashboard_Click(object sender, RoutedEventArgs e)
        {
            var d = new Windows.AddToDashboard { Owner = Window.GetWindow(this) };
            d.ShowDialog();
        }

        private void ViewDashboard_Click(object sender, RoutedEventArgs e)
        {
            System.Diagnostics.Process.Start("https://certifytheweb.com/dashboard");
        }
    }
}


text:
use std::fmt;
use std::io;

#[deriving(Clone)]
pub struct Layout {
    logo: ~str,
    favicon: ~str,
    crate: ~str,
}

pub struct Page<'a> {
    title: &'a str,
    ty: &'a str,
    root_path: &'a str,
}

pub fn render<T: fmt::Default, S: fmt::Default>(
    dst: &mut io::Writer, layout: &Layout, page: &Page, sidebar: &S, t: &T)
{
    write!(dst,
"<!DOCTYPE html>

    <meta charset=\"utf-8\" />
    <title>{title}</title>

    <link href='http://fonts.googleapis.com/css?family=Oswald:700|Inconsolata:400'
          rel='stylesheet' type='text/css'>
    <link rel=\"stylesheet\" type=\"text/css\" href=\"{root_path}{crate}/main.css\">

    {favicon, select, none{} other{<link rel=\"shortcut icon\" href=\"#\" />}}

        {logo, select, none{} other{

        }}

        {sidebar}

        <form class=\"search-form js-only\">
            <button class=\"do-search\">Search</button>

                <input class=\"search-input\" name=\"search\"
                       autocomplete=\"off\"
                       placeholder=\"Search documentation...\"
                       type=\"search\" />

        </form>

{content}

Keyboard shortcuts

?

Show this help dialog

S

Focus the search field

↑

Move up in search results

↓

Move down in search results

&\\#9166;

Go to active search result

Search tricks

                Prefix searches with a type followed by a colon (e.g.
                fn:) to restrict the search to a given type.

                Accepted types are: fn, mod,
                struct (or str), enum,
                trait, typedef (or
                tdef).

",
    content   = *t,
    root_path = page.root_path,
    ty        = page.ty,
    logo      = nonestr(layout.logo),
    title     = page.title,
    favicon   = nonestr(layout.favicon),
    sidebar   = *sidebar,
    crate     = layout.crate,
    );
}

fn nonestr<'a>(s: &'a str) -> &'a str {
    if s == "" { "none" } else { s }
}


text:
package com.franktan.popularmovies.data;

import android.content.ContentValues;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.test.AndroidTestCase;

import com.franktan.popularmovies.data.favorite.FavoriteColumns;
import com.franktan.popularmovies.data.genre.GenreColumns;
import com.franktan.popularmovies.data.movie.MovieColumns;
import com.franktan.popularmovies.data.moviegenre.MovieGenreColumns;
import com.franktan.popularmovies.data.review.ReviewColumns;
import com.franktan.popularmovies.data.trailer.TrailerColumns;

import java.util.HashSet;

/**
 * Created by tan on 15/08/2015.
 */
public class DBHelperTest extends AndroidTestCase {

    public void setUp() {
        deletePopularMoviesDatabase();
    }

    public void testCreateDbAndTables () throws Throwable {
        // build a HashSet of all of the table names we wish to look for
        // Note that there will be another table in the DB that stores the
        // Android metadata (db version information)
        final HashSet<String> tableNameHashSet = new HashSet<String>();
        tableNameHashSet.add(MovieColumns.TABLE_NAME);
        tableNameHashSet.add(GenreColumns.TABLE_NAME);
        tableNameHashSet.add(TrailerColumns.TABLE_NAME);
        tableNameHashSet.add(ReviewColumns.TABLE_NAME);

        // Delete existing database
        deletePopularMoviesDatabase();
        // Create an open a new database
        SQLiteDatabase db = MovieSQLiteOpenHelper.getInstance(
                this.mContext).getWritableDatabase();
        assertEquals(true, db.isOpen());

        // have we created the tables we want?
        Cursor c = db.rawQuery("SELECT name FROM sqlite_master WHERE type='table'", null);

        assertTrue("Tables should exists in the newly created database",
                c.moveToFirst());

        // go through each table in the current database and
        // remove corresponding table from our list
        do {
            tableNameHashSet.remove(c.getString(0));
        } while( c.moveToNext() );
        // at the end of this loop, all tables we want should have been removed from the hashset

        assertTrue("Our tables should have been created in the database",
                tableNameHashSet.isEmpty());

        c.close();

        movieTableHasRightColumns(db);
        genreTableHasRightColumns(db);
        movieGenreTableHasRightColumns(db);
        reviewTableHasRightColumns(db);
        trailerTableHasRightColumns(db);
        favoriteTableHasRightColumns(db);

        db.close();
    }

    public void testMovieTableInsertAndUpdate() {
        // First step: Get reference to writable database
        SQLiteDatabase db = MovieSQLiteOpenHelper.getInstance(mContext).getWritableDatabase();

        assertEquals(true, db.isOpen());
        insertMovie(db);

        // Finally, close the cursor and database

        db.close();
    }

    /*
     * Helper methods
     */

    /**
     * Test trailer table has the right colomns
     * @param db
     */
    public void trailerTableHasRightColumns (SQLiteDatabase db) {
        // test Genre table has correct columns
        Cursor c = db.rawQuery("PRAGMA table_info(" + TrailerColumns.TABLE_NAME + ")",
                null);

        assertTrue("Our trailer table should have columns", c.moveToFirst());

        // Build a HashSet of all of the column names we want to look for
        final HashSet<String> trailerColumnSet = new HashSet<String>();
        trailerColumnSet.add(TrailerColumns._ID);
        trailerColumnSet.add(TrailerColumns.NAME);
        trailerColumnSet.add(TrailerColumns.SIZE);
        trailerColumnSet.add(TrailerColumns.SOURCE);
        trailerColumnSet.add(TrailerColumns.TYPE);
        trailerColumnSet.add(TrailerColumns.MOVIE_ID);

        int columnNameIndexTrailer = c.getColumnIndex("name");
        do {
            String columnName = c.getString(columnNameIndexTrailer);
            trailerColumnSet.remove(columnName);
        } while(c.moveToNext());

        // if this fails, it means that your database doesn't contain all of the required location
        // entry columns
        assertTrue("tailer table should contains all columns we defined",
                trailerColumnSet.isEmpty());
        c.close();
    }

    /**
     * Test favorite table has the right colomns
     * @param db
     */
    public void favoriteTableHasRightColumns (SQLiteDatabase db) {
        // test Genre table has correct columns
        Cursor c = db.rawQuery("PRAGMA table_info(" + FavoriteColumns.TABLE_NAME + ")",
                null);

        assertTrue("Our favorite table should have columns", c.moveToFirst());

        // Build a HashSet of all of the column names we want to look for
        final HashSet<String> favoriteColumnSet = new HashSet<>();
        favoriteColumnSet.add(FavoriteColumns._ID);
        favoriteColumnSet.add(FavoriteColumns.FAVORITE_MOVIEDB_ID);
        favoriteColumnSet.add(FavoriteColumns.CREATED);

        int columnNameIndexFavorite = c.getColumnIndex("name");
        do {
            String columnName = c.getString(columnNameIndexFavorite);
            favoriteColumnSet.remove(columnName);
        } while(c.moveToNext());

        // if this fails, it means that your database doesn't contain all of the required location
        // entry columns
        assertTrue("favorite table should contains all columns we defined",
                favoriteColumnSet.isEmpty());
        c.close();
    }

    /**
     * Test review table has the right colomns
     * @param db
     */
    public void reviewTableHasRightColumns (SQLiteDatabase db) {
        // test Genre table has correct columns
        Cursor c = db.rawQuery("PRAGMA table_info(" + ReviewColumns.TABLE_NAME + ")",
                null);

        assertTrue("Our review table should have columns", c.moveToFirst());

        // Build a HashSet of all of the column names we want to look for
        final HashSet<String> reviewColumnSet = new HashSet<String>();
        reviewColumnSet.add(ReviewColumns._ID);
        reviewColumnSet.add(ReviewColumns.MOVIE_ID);
        reviewColumnSet.add(ReviewColumns.REVIEW_MOVIEDB_ID);
        reviewColumnSet.add(ReviewColumns.AUTHOR);
        reviewColumnSet.add(ReviewColumns.CONTENT);
        reviewColumnSet.add(ReviewColumns.URL);

        int columnNameIndexReview = c.getColumnIndex("name");
        do {
            String columnName = c.getString(columnNameIndexReview);
            reviewColumnSet.remove(columnName);
        } while(c.moveToNext());

        // if this fails, it means that your database doesn't contain all of the required location
        // entry columns
        assertTrue("review table should contains all columns we defined",
                reviewColumnSet.isEmpty());
        c.close();
    }

    /**
     * Test movie_genre table has the right colomns
     * @param db
     */
    public void movieGenreTableHasRightColumns (SQLiteDatabase db) {
        // test Genre table has correct columns
        Cursor c = db.rawQuery("PRAGMA table_info(" + MovieGenreColumns.TABLE_NAME + ")",
                null);

        assertTrue("Our movie_genre table should have columns", c.moveToFirst());

        // Build a HashSet of all of the column names we want to look for
        final HashSet<String> movieGenreColumnSet = new HashSet<String>();
        movieGenreColumnSet.add(MovieGenreColumns._ID);
        movieGenreColumnSet.add(MovieGenreColumns.MOVIE_ID);
        movieGenreColumnSet.add(MovieGenreColumns.GENRE_ID);

        int columnNameIndexMovieGenre = c.getColumnIndex("name");
        do {
            String columnName = c.getString(columnNameIndexMovieGenre);
            movieGenreColumnSet.remove(columnName);
        } while(c.moveToNext());

        // if this fails, it means that your database doesn't contain all of the required location
        // entry columns
        assertTrue("movie_genre table should contains all columns we defined",
                movieGenreColumnSet.isEmpty());
        c.close();
    }

    /**
     * Test genre table has the right colomns
     * @param db
     */
    public void genreTableHasRightColumns (SQLiteDatabase db) {
        // test Genre table has correct columns
        Cursor c = db.rawQuery("PRAGMA table_info(" + GenreColumns.TABLE_NAME + ")",
                null);

        assertTrue("Our genre table should have columns", c.moveToFirst());

        // Build a HashSet of all of the column names we want to look for
        final HashSet<String> genreColumnSet = new HashSet<String>();
        genreColumnSet.add(GenreColumns._ID);
        genreColumnSet.add(GenreColumns.GENRE_MOVIEDB_ID);
        genreColumnSet.add(GenreColumns.NAME);

        int columnNameIndexGenre = c.getColumnIndex("name");
        do {
            String columnName = c.getString(columnNameIndexGenre);
            genreColumnSet.remove(columnName);
        } while(c.moveToNext());

        // if this fails, it means that your database doesn't contain all of the required location
        // entry columns
        assertTrue("Genre table should contains all columns we defined",
                genreColumnSet.isEmpty());
        c.close();
    }

    /**
     * Test the movie table has the right columns
     * @param db
     */
    public void movieTableHasRightColumns (SQLiteDatabase db) {
        // test movie table has correct columns
        Cursor c = db.rawQuery("PRAGMA table_info(" + MovieColumns.TABLE_NAME + ")",
                null);

        assertTrue("Our movie table should have columns", c.moveToFirst());

        // Build a HashSet of all of the column names we want to look for
        final HashSet<String> movieColumnSet = new HashSet<String>();
        movieColumnSet.add(MovieColumns._ID);
        movieColumnSet.add(MovieColumns.BACKDROP_PATH);
        movieColumnSet.add(MovieColumns.MOVIE_MOVIEDB_ID);
        movieColumnSet.add(MovieColumns.ORIGINAL_LAN);
        movieColumnSet.add(MovieColumns.ORIGINAL_TITLE);
        movieColumnSet.add(MovieColumns.OVERVIEW);
        movieColumnSet.add(MovieColumns.RELEASE_DATE);
        movieColumnSet.add(MovieColumns.POSTER_PATH);
        movieColumnSet.add(MovieColumns.POPULARITY);
        movieColumnSet.add(MovieColumns.TITLE);
        movieColumnSet.add(MovieColumns.VOTE_AVERAGE);
        movieColumnSet.add(MovieColumns.VOTE_COUNT);

        int columnNameIndex = c.getColumnIndex("name");
        do {
            String columnName = c.getString(columnNameIndex);
            movieColumnSet.remove(columnName);
        } while(c.moveToNext());

        // if this fails, it means that your database doesn't contain all of the required location
        // entry columns
        assertTrue("Movie table should contains all columns we defined",
                movieColumnSet.isEmpty());
        c.close();
    }

    private void deletePopularMoviesDatabase() {
        mContext.deleteDatabase(MovieSQLiteOpenHelper.DATABASE_FILE_NAME);
    }

    private Long insertMovie(SQLiteDatabase db){
        ContentValues movieEntry = DataTestUtilities.createMovieEntry();
        Long rowId = db.insert(MovieColumns.TABLE_NAME, null, movieEntry);
        assertTrue("Insertion should return row id",rowId != -1);
        Cursor cursor = db.query(MovieColumns.TABLE_NAME,null,null,null,null,null,null);
        assertTrue("The inserted record should be available", cursor.moveToFirst());
        DataTestUtilities.validateMovieRecordUnderCursor("Verifying inserted value failed", cursor, movieEntry);
        assertFalse("Should be only one row", cursor.moveToNext());
        cursor.close();
        return rowId;
    }
}


text:
/*
 * An associative array expressed as JSON
 */
module.exports = function(obj) {
    if(obj.type !== 'JSON_ARRAY') {
        throw "This is not a JSON array!";
    }

    var parser = require('./expression.js'),
        output,
        i,
        vals = [];

    output = 'array(';
    for(i = 0; i < obj.values.length; i += 1) {
        vals.push(parser(obj.values[i].name) + " => " + parser(obj.values[i].value));
    }
    output += vals.join(', ') + ')';

    return output;
};


text:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

	class Login extends CI_Controller	{

		public function __contruct(){
                    parent::__contruct();
		}

		public function index(){

			$data["page"] = "login";
			if (!isset($MSG)){ $data["MSG"] = "Please enter a valid username and password to get access."; }
			if ($this->session->userdata('admin_logged_in')==TRUE){
				header('Location: '.HOST_URL."/adminhome");
				break;
			}

			$this->load->model($this->config->item('admin_folder')."/model_admin_user");

			if (isset($_POST) && count($_POST) != 0){

                            $username 		= $this->input->post("username", TRUE);
                            $password 		= $this->input->post("password", TRUE);
                            $check_user 	= $this->model_admin_user->authenticate($username, $password);

                            switch($check_user) {

                                case("N"): {

                                        $data["MSG"] = "Error : Username or Password is invalid!";
                                        break;
                                }
                                case("S"): {

                                        $data["MSG"] = "Your account has been suspended by Admin";
                                        break;
                                }
                                case("B"): {

                                        $data["MSG"] = "Your account has been blocked!";
                                        break;
                                }
                                case("Y"): {

                                        $user_data = $this->model_admin_user->get_user_info($username, $password);
                                        $encrypted_url = sha1(base_url());
                                        $admin_session_data = array(
                                                'admin_base_url'    	=> $encrypted_url,
                                                'admin_user_id'     	=> $user_data[0]->id,
                                                'admin_full_name'   	=> $user_data[0]->full_name,
                                                'admin_user_type'    => $user_data[0]->user_type,
                                                'admin_rememberme'	=> FALSE,
                                                'admin_logged_in'    => TRUE
                                        );

                                        $this->session->set_userdata($admin_session_data);
                                        header('Location: '.HOST_URL."/adminhome");
                                        break;
                                }

                            }

			}

			$this->load->view($this->config->item('admin_folder').'/template', $data);
		}

	}


text:
console.log('koha connector loading...')

/// ////////////////////////////////////////
// REQUIRES
// Request (for HTTP calls) and cheerio for
// querying the HTML returned.
/// ////////////////////////////////////////
var request = require('request')
var cheerio = require('cheerio')
var common = require('../connectors/common')

/// ///////////////////////
// VARIABLES
/// ///////////////////////
var catUrl = 'cgi-bin/koha/opac-search.pl?format=rss2&idx=nb&q='
var libsUrl = 'cgi-bin/koha/opac-search.pl?[MULTIBRANCH]do=Search&expand=holdingbranch#holdingbranch_id'

/// ////////////////////////////////////////
// Function: getService
/// ////////////////////////////////////////
exports.getService = function (svc) {
  var service = common.getService(svc);
  return service;

}

/// ////////////////////////////////////////
// Function: getLibraries
/// ////////////////////////////////////////
exports.getLibraries = function (service, callback) {
  var responseLibraries = { service: service.Name, code: service.Code, libraries: [], start: new Date() }
  // Request 1: Call search page with option set to expand branches.
  request.get({ url: service.Url + (service.MultiBranchLimit ? libsUrl.replace('[MULTIBRANCH]', 'multibranchlimit=' + service.MultiBranchLimit + '&') : libsUrl.replace('[MULTIBRANCH]', '')), timeout: 60000 }, function (error, message, response) {
    if (common.handleErrors(callback, responseLibraries, error, message)) return
    $ = cheerio.load(response)
    $('div#location select#branchloop option').each(function () {
      if ($(this).text() != 'All libraries') responseLibraries.libraries.push($(this).text().trim())
    })
    $('li#holdingbranch_id ul li span.facet-label').each(function () {
      responseLibraries.libraries.push($(this).text().trim())
    })
    common.completeCallback(callback, responseLibraries)
  })
}

/// ///////////////////////
// Function: searchByISBN
/// ///////////////////////
exports.searchByISBN = function (isbn, lib, callback) {
  var responseHoldings = { service: lib.Name, code: lib.Code, availability: [], start: new Date(), url: lib.Url + catUrl + isbn }
  // Request 1: The ISBN search
  request.get({ url: responseHoldings.url, timeout: 30000 }, function (error, msg, res) {
    if (common.handleErrors(callback, responseHoldings, error, msg)) return
    $ = cheerio.load(res, { normalizeWhitespace: true, xmlMode: true })
    var bibLink = $('guid').text()
    if (!bibLink) { common.completeCallback(callback, responseHoldings); return }
    // Request 2: The item link
    request.get({ url: bibLink + '&viewallitems=1', timeout: 30000, rejectUnauthorized: (!lib.IgnoreSSL) }, function (error, msg, res) {
      if (common.handleErrors(callback, responseHoldings, error, msg)) return
      $ = cheerio.load(res)
      var libs = {}
      $('.holdingst tbody').find('tr').each(function (i, elem) {
        var lib = $(this).find('td.location span span').eq(1).text().trim()
        if (!libs[lib]) libs[lib] = { available: 0, unavailable: 0 }
        $(this).find('td.status span').text().trim() == 'Available' ? libs[lib].available++ : libs[lib].unavailable++
      })
      for (var l in libs) responseHoldings.availability.push({ library: l, available: libs[l].available, unavailable: libs[l].unavailable })
      common.completeCallback(callback, responseHoldings)
    })
  })
}


text:
using namespace seqan;

namespace test_basic_observer

{
struct Foo_
{

    unsigned i = 0;

    Foo_() : i(1)
    {}

    Foo_(unsigned num) : i(num)
    {}

    template <typename TTag>
    inline void operator()(TTag const &)
    {
        i += 2;
    }
};

struct Bar_
{

    unsigned i = 0;

    Bar_() : i(2)
    {}

    Bar_(unsigned num) : i(num)
    {}

    template <typename TTag>
    inline void operator()(TTag const &)
    {
        i += 3;
    }
};

}

SEQAN_DEFINE_TEST(test_basic_observable_constructor)
{
    {  // Default constructor.
        Observable<ObserverList<test_basic_observer::Bar_, test_basic_observer::Foo_> > subject;
        SEQAN_ASSERT(std::get<0>(subject.observers).i == 2);
        SEQAN_ASSERT(std::get<1>(subject.observers).i == 1);
    }

    {  // Copy constructor.
        Observable<ObserverList<test_basic_observer::Bar_, test_basic_observer::Foo_> > subject1;
        std::get<0>(subject1.observers).i = 4;
        std::get<1>(subject1.observers).i = 5;

        Observable<ObserverList<test_basic_observer::Bar_, test_basic_observer::Foo_> > subject(subject1);
        SEQAN_ASSERT(std::get<0>(subject.observers).i == 4);
        SEQAN_ASSERT(std::get<1>(subject.observers).i == 5);
    }

    { // Move constructor.
        Observable<ObserverList<test_basic_observer::Bar_, test_basic_observer::Foo_> > subject1;
        std::get<0>(subject1.observers).i = 4;
        std::get<1>(subject1.observers).i = 5;

        Observable<ObserverList<test_basic_observer::Bar_, test_basic_observer::Foo_> > subject(std::move(subject1));
        SEQAN_ASSERT(std::get<0>(subject.observers).i == 4);
        SEQAN_ASSERT(std::get<1>(subject.observers).i == 5);
    }

    {  // Custom copy constructor.
        Observable<ObserverList<test_basic_observer::Bar_, test_basic_observer::Foo_> > subject1;
        std::get<0>(subject1.observers).i = 4;
        std::get<1>(subject1.observers).i = 5;

        Observable<decltype(subject1.observers)> subject(subject1.observers);

        SEQAN_ASSERT(std::get<0>(subject.observers).i == 4);
        SEQAN_ASSERT(std::get<1>(subject.observers).i == 5);
    }

    {  // Custom move constructor.
        typedef ObserverList<test_basic_observer::Bar_, test_basic_observer::Foo_> TList;
        Observable<TList> subject(std::make_tuple(test_basic_observer::Bar_(4), test_basic_observer::Foo_(5)));

        SEQAN_ASSERT(std::get<0>(subject.observers).i == 4);
        SEQAN_ASSERT(std::get<1>(subject.observers).i == 5);
    }
}

SEQAN_DEFINE_TEST(test_basic_observable_length)
{
    {  // Length 2.
        Observable<ObserverList<test_basic_observer::Bar_, test_basic_observer::Foo_> > subject;
        SEQAN_ASSERT(length(subject) == 2u);
    }

    {  // Length 3.
        Observable<ObserverList<test_basic_observer::Bar_, test_basic_observer::Bar_, test_basic_observer::Foo_> > subject;
        SEQAN_ASSERT(length(subject) == 3);
    }

    {  // Length 0.
        Observable<ObserverList<> > subject;
        SEQAN_ASSERT(length(subject) == 0u);
    }

}

SEQAN_DEFINE_TEST(test_basic_observable_set_observer)
{

    Observable<ObserverList<test_basic_observer::Bar_, test_basic_observer::Foo_, test_basic_observer::Bar_> > subject;
    test_basic_observer::Bar_ bar(4);
    setObserver<0>(subject, bar);
    setObserver<1>(subject, test_basic_observer::Foo_(6));
    setObserver<2>(subject, test_basic_observer::Bar_(8));

    SEQAN_ASSERT(std::get<0>(subject.observers).i == 4);
    SEQAN_ASSERT(std::get<1>(subject.observers).i == 6);
    SEQAN_ASSERT(std::get<2>(subject.observers).i == 8);
}

SEQAN_DEFINE_TEST(test_basic_observable_notify)
{
    Observable<ObserverList<test_basic_observer::Bar_, test_basic_observer::Foo_, test_basic_observer::Bar_> > subject;
    test_basic_observer::Bar_ bar(4);
    setObserver<0>(subject, bar);
    setObserver<1>(subject, test_basic_observer::Foo_(6));
    setObserver<2>(subject, test_basic_observer::Bar_(8));

    notify(subject, Nothing());

    SEQAN_ASSERT(std::get<0>(subject.observers).i == 7);
    SEQAN_ASSERT(std::get<1>(subject.observers).i == 8);
    SEQAN_ASSERT(std::get<2>(subject.observers).i == 11);
}

SEQAN_DEFINE_TEST(test_basic_observable_make_observer_list)
{
    auto list = makeObserverList(test_basic_observer::Bar_(4), test_basic_observer::Foo_(6), test_basic_observer::Bar_(5));
    Observable<decltype(list)> subject(list);

    SEQAN_ASSERT(std::get<0>(subject.observers).i == 4);
    SEQAN_ASSERT(std::get<1>(subject.observers).i == 6);
    SEQAN_ASSERT(std::get<2>(subject.observers).i == 5);
}

#endif // TESTS_JOURNALED_STRING_TREE_TEST_BASIC_OBSERVABLE_H_


text:
using System.Collections.Generic;
using Utf8Json;
using sgffu.Filesystem;

namespace sgffu.Config {

    /// <summary>
    /// コンフィグファイル処理クラス
    /// </summary>
    public class ConfigFile
    {

        public static string defaultFilename = "/Configs/config.json";

        public const string terrainConfigFilename = "/Configs/terrain.json";

        public const string playerConfigFilename = "/Configs/player.json";

        public const string inputConfigFilename = "/Configs/input.json";

        private static Dictionary<string, File> configFileList = new Dictionary<string, File>();

        public static bool exist(string filename) {
            return new File().exist(filename);
        }

        private static File get_file<T>(string filename, T default_content)
        {
            if (!configFileList.ContainsKey(filename)) {
                string json_string = JsonSerializer.ToJsonString(default_content, JsonSerializer.DefaultResolver);
                configFileList.Add(filename, new File(filename, json_string));
            }

            return configFileList[filename];
        }

        /// <summary>
        /// コンフィグファイルにテキストを書き込む
        /// </summary>
        public static bool save<T>(string filename, T obj)
        {
            File config_file = ConfigFile.get_file(filename, "");
            string json_string = JsonSerializer.ToJsonString(obj, JsonSerializer.DefaultResolver);
            return config_file.write(json_string);
        }

        public static T load<T>(string filename, T default_content)
        {
            File config_file = ConfigFile.get_file(filename, default_content);
            byte[] json_bytes = config_file.readBytes();
            return JsonSerializer.Deserialize<T>(json_bytes);
        }

    }

}


text:
package relations;

import gui.ScenarioPanel;
import gui.TemplateView;

import java.io.Serializable;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;

public class Relation implements Serializable {
    /**
     * The name of this relation
     */
    public final String name;
    /**
     * Description of the relation.
     */
    public final String description;
    /**
     * If this relation has a reverse relation, add it here:
     */
    transient public Relation inverse;
    /**
     * A list of entities from which this relation can point.
     */
    private Set<TemplateView> domains = new HashSet<>();
    /**
     * A list of entities to which this relation can point.
     */
    private Set<TemplateView> ranges = new HashSet<>();

    public Relation(String name, String description) {
        this.name = name;
        this.description = description;
    }

    public void addDomain(TemplateView domain) {
        domains.add(domain);
    }

    public void addRange(TemplateView range) {
        ranges.add(range);
    }

    public void addDomains(Set<TemplateView> domains) {
        this.domains.addAll(domains);
    }

    public void addRanges(Set<TemplateView> ranges) {
        this.ranges.addAll(ranges);
    }

    public Set<TemplateView> getParentDomains() {
        return domains;
    }

    public Set<TemplateView> getParentRanges() {
        return ranges;
    }

    public Set<TemplateView> getAllDomains(ScenarioPanel scenarioPanel) {
        Set<TemplateView> all = new HashSet<>();
        all.addAll(domains);
        all.addAll(getChildren(domains, scenarioPanel));
        return all;
    }

    public Set<TemplateView> getAllRanges(ScenarioPanel scenarioPanel) {
        Set<TemplateView> all = new HashSet<>();
        all.addAll(ranges);
        all.addAll(getChildren(ranges, scenarioPanel));
        return all;
    }

    /**
     * For all user added domain and range template also the children of these templates need to be added to the range
     * and domain of this relation.
     */
    private Collection<TemplateView> getChildren(Set<TemplateView> passedParents, ScenarioPanel scenarioPanel) {
        Set<TemplateView> childs = new HashSet<>();
        for (TemplateView parent : passedParents) {
            Set<TemplateView> parents = new HashSet<>();
            parents.add(parent);
            childs.addAll(recursivelyAddChildren(parents, scenarioPanel));
        }
        return childs;
    }

    private Set<TemplateView> recursivelyAddChildren(Set<TemplateView> parents, ScenarioPanel scenarioPanel) {
        Set<TemplateView> children = new HashSet<>();
        for (TemplateView template : scenarioPanel.getAllTemplates()) {
            for (TemplateView parentTemplate : template.parentTemplates) {
                if (parents.contains(parentTemplate)) {
                    children.add(template);
                }
            }
        }
        if (children.size() == 0) {
            return parents; // There are no more children
        } else {
            parents.addAll(children);
            parents.addAll(recursivelyAddChildren(children, scenarioPanel));
            return parents;
        }
    }

    @Override
    public String toString() {
        return name;
    }
}


text:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<groupId>ctgu.jagent</groupId>
	<artifactId>dynamic</artifactId>
	<version>0.0.1-SNAPSHOT</version>

	<build>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-jar-plugin</artifactId>
				<configuration>
					<archive>
						<manifestFile>src/main/resources/META-INF/MANIFEST.MF</manifestFile>
					</archive>
				</configuration>
			</plugin>
		</plugins>
	</build>
</project>


text:
<?php

namespace Front\ExpenseBundle;

use Symfony\Component\HttpKernel\Bundle\Bundle;

class ExpenseBundle extends Bundle
{
}


text:
package events

import (
	"time"

	"fmt"

	"github.com/square/quotaservice/logging"
)

type EventType int

const (
	EVENT_TOKENS_SERVED EventType = iota
	EVENT_TIMEOUT_SERVING_TOKENS
	EVENT_TOO_MANY_TOKENS_REQUESTED
	EVENT_BUCKET_MISS
	EVENT_BUCKET_CREATED
	EVENT_BUCKET_REMOVED
)

var eventNames = []string{
	EVENT_TOKENS_SERVED:             "EVENT_TOKENS_SERVED",
	EVENT_TIMEOUT_SERVING_TOKENS:    "EVENT_TIMEOUT_SERVING_TOKENS",
	EVENT_TOO_MANY_TOKENS_REQUESTED: "EVENT_TOO_MANY_TOKENS_REQUESTED",
	EVENT_BUCKET_MISS:               "EVENT_BUCKET_MISS",
	EVENT_BUCKET_CREATED:            "EVENT_BUCKET_CREATED",
	EVENT_BUCKET_REMOVED:            "EVENT_BUCKET_REMOVED"}

func (et EventType) String() string {
	name := eventNames[et]
	if name == "" {
		panic(fmt.Sprintf("Don't know event %d", et))
	}

	return name
}

type Event interface {
	EventType() EventType
	Namespace() string
	BucketName() string
	Dynamic() bool
	NumTokens() int64
	WaitTime() time.Duration
}

// EventProducer is a hook into the notification system, to inform listeners that certain events
// take place.
type EventProducer struct {
	c chan Event
}

func (e *EventProducer) Emit(event Event) {
	select {
	case e.c <- event:
	// OK
	default:
		logging.Println("Event buffer full; dropping event.")
	}
}

func (e *EventProducer) notifyListeners(l Listener) {
	for event := range e.c {
		l(event)
	}
}

// Listener is a function that consumes an Event
type Listener func(details Event)

// RegisterListener takes a Listener and a buffer size and
// returns an EventProducer that consumes events and notifies listeners
func RegisterListener(listener Listener, bufsize int) *EventProducer {
	if listener == nil {
		panic("Cannot register a nil listener")
	}

	ep := &EventProducer{make(chan Event, bufsize)}

	go ep.notifyListeners(listener)

	return ep
}

type namedEvent struct {
	eventType             EventType
	namespace, bucketName string
	dynamic               bool
}

func (n *namedEvent) String() string {
	return fmt.Sprintf("namedEvent{type: %v, namespace: %v, name: %v, dynamic: %v, numTokens: %v, waitTime: %v}",
		n.eventType, n.namespace, n.bucketName, n.dynamic, 0, 0)
}

func (n *namedEvent) EventType() EventType {
	return n.eventType
}

func (n *namedEvent) Namespace() string {
	return n.namespace
}

func (n *namedEvent) BucketName() string {
	return n.bucketName
}

func (n *namedEvent) Dynamic() bool {
	return n.dynamic
}

func (n *namedEvent) NumTokens() int64 {
	return 0
}

func (n *namedEvent) WaitTime() time.Duration {
	return 0
}

type tokenEvent struct {
	*namedEvent
	numTokens int64
}

func (t *tokenEvent) String() string {
	return fmt.Sprintf("tokenEvent{type: %v, namespace: %v, name: %v, dynamic: %v, numTokens: %v, waitTime: %v}",
		t.eventType, t.namespace, t.bucketName, t.dynamic, t.numTokens, 0)
}

func (t *tokenEvent) NumTokens() int64 {
	return t.numTokens
}

type tokenWaitEvent struct {
	*tokenEvent
	waitTime time.Duration
}

func (t *tokenWaitEvent) String() string {
	return fmt.Sprintf("tokenWaitEvent{type: %v, namespace: %v, name: %v, dynamic: %v, numTokens: %v, waitTime: %v}",
		t.eventType, t.namespace, t.bucketName, t.dynamic, t.numTokens, t.waitTime)
}

func (t *tokenWaitEvent) WaitTime() time.Duration {
	return t.waitTime
}

// NewTokensServedEvent creates a new event with the type EVENT_TOKENS_SERVED
func NewTokensServedEvent(namespace, bucketName string, dynamic bool, numTokens int64, waitTime time.Duration) Event {
	return &tokenWaitEvent{
		tokenEvent: &tokenEvent{
			namedEvent: newNamedEvent(namespace, bucketName, dynamic, EVENT_TOKENS_SERVED),
			numTokens:  numTokens},
		waitTime: waitTime}
}

// NewTimedOutEvent creates a new event with the type EVENT_TIMEOUT_SERVING_TOKENS
func NewTimedOutEvent(namespace, bucketName string, dynamic bool, numTokens int64) Event {
	return &tokenEvent{
		namedEvent: newNamedEvent(namespace, bucketName, dynamic, EVENT_TIMEOUT_SERVING_TOKENS),
		numTokens:  numTokens}
}

// NewTooManyTokensRequestedEvent creates a new event with the type EVENT_TOO_MANY_TOKENS_REQUESTED
func NewTooManyTokensRequestedEvent(namespace, bucketName string, dynamic bool, numTokens int64) Event {
	return &tokenEvent{
		namedEvent: newNamedEvent(namespace, bucketName, dynamic, EVENT_TOO_MANY_TOKENS_REQUESTED),
		numTokens:  numTokens}
}

// NewBucketMissedEvent creates a new event with the type EVENT_BUCKET_MISS
func NewBucketMissedEvent(namespace, bucketName string, dynamic bool) Event {
	return newNamedEvent(namespace, bucketName, dynamic, EVENT_BUCKET_MISS)
}

// NewBucketCreatedEvent creates a new event with the type EVENT_BUCKET_CREATED
func NewBucketCreatedEvent(namespace, bucketName string, dynamic bool) Event {
	return newNamedEvent(namespace, bucketName, dynamic, EVENT_BUCKET_CREATED)
}

// NewBucketRemovedEvent creates a new event with the type EVENT_BUCKET_REMOVED
func NewBucketRemovedEvent(namespace, bucketName string, dynamic bool) Event {
	return newNamedEvent(namespace, bucketName, dynamic, EVENT_BUCKET_REMOVED)
}

func newNamedEvent(namespace, bucketName string, dynamic bool, eventType EventType) *namedEvent {
	return &namedEvent{
		eventType:  eventType,
		namespace:  namespace,
		bucketName: bucketName,
		dynamic:    dynamic}
}


text:
exports.run = async (client, message, args) => {
  let [age, sex, location] = args;
  message.reply(`Hello ${message.author.username}, I see you're a ${age} year old ${sex} from ${location}. Wanna date?`).catch(console.error);
};
exports.conf = {
  enabled: true,
  guildOnly: false,
  aliases: [],
  permLevel: "User"
};

exports.help = {
  name: "asl",
  category: "Miscellaneous",
  description: "Testing with args",
  usage: "...age ...sex ...location"
};


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Gablarski.Clients
{
	public interface IControlMediaPlayer
		: IMediaPlayer
	{
		void Play();
		void Pause();
		void Stop();
		void NextTrack();
		void PreviousTrack();
	}
}


text:
class QueuedEmail::NameTracking < QueuedEmail
  def notification
    get_object(:notification, Notification)
  end

  def naming
    get_object(:naming, Naming)
  end

  def self.create_email(notification, naming)
    raise "Missing notification!" unless notification
    raise "Missing naming!"       unless naming

    sender = notification.user
    observer = naming.observation.user
    result = nil
    if sender != observer
      result = create(sender, observer)
      result.add_integer(:notification, notification.id)
      result.add_integer(:naming, naming.id)
      result.finish
    end
    result
  end

  def deliver_email
    # Make sure naming wasn't deleted since email was queued.
    if naming
      result = NamingTrackerEmail.build(user, naming).deliver_now
      if notification.note_template
        result = NamingObserverEmail.build(
          to_user, naming, notification
        ).deliver_now
      end
    end
    result
  end
end


text:
layout: post
title: '[Curso de ExtJS 4] Aula 29: Menus'
date: 2012-08-28 12:27:19.000000000 -03:00
type: post
published: true
status: publish
categories:
- Curso ExtJS 4
tags:
- Curso ExtJS 4
- ExtJS
- ExtJS 4
language: pt-br
category: pt-br
---

Vídeo/Screencast de hoje: aula 29 do curso gratuito de Ext JS 4!

Na aula de hoje vamos aprender como usar o componente Menu, que como o nome ja diz, é um componente utilizado para fazer menus.

Quem quiser ver todas as aulas já publicadas, é só clicar aqui.

Espero que gostem dessa aula e fico no aguardo do feedback de vocês! :)

Requerimentos:

Ext JS 4 SDK

Servidor Apache (opcional).

Editor de Texto (qualquer um de sua preferência). No vídeo usei o Sublime Text 2 (tem pra Mac OS, Windows e Linux - a versão shareware não expira!)

Browser (de preferência Firefox com Firebug ou Chrome).

Vídeo:

YouTube: http://youtu.be/v1ChR3lH3GA

Código: https://github.com/loiane/curso-extjs4

Slides:

 Curso ExtJS 4 - Aula 29: Menus  from Loiane Groner

Até a próxima aula! :)