text:
// Métodos implementados (100%):
// - getNombre()
// - getCasilla()
// - isHipotecada()
// - getAlquilerBase()
// - getFactorRevalorizacion()
// - getHipotecaBase()
// - getPrecioEdificar()
// - setHipotecada
// - conmutarHipoteca()
// - toString()
// - cobrarAlquiler(int coste)
// - getHipotecada()
// - propietarioEncarcelado()
// - setCasilla(Casilla casilla)
// - setPropietario(Jugador propietario)
// - tengoPropietario()

package modeloqytetet;

/**
 *
 * @author pepito
 */
public class TituloPropiedad {
    private String nombre;
    private boolean hipotecada;
    private int alquilerBase;
    private float factorRevalorizacion;
    private int hipotecaBase;
    private int precioEdificar;

    private Casilla casilla;
    private Jugador propietario;

    public TituloPropiedad(String n, int alqBase, float fRevalorizacion, int hipoBase, int precioEdif ){
        this.nombre = n;
        this.hipotecada = false;
        this.alquilerBase = alqBase;
        this.factorRevalorizacion = fRevalorizacion;
        this.hipotecaBase = hipoBase;
        this.precioEdificar = precioEdif;
    }

    public TituloPropiedad(String n, int alqBase, float fRevalorizacion, int hipoBase, int precioEdif, Casilla casilla, Jugador jugador){
        this.nombre = n;
        this.hipotecada = false;
        this.alquilerBase = alqBase;
        this.factorRevalorizacion = fRevalorizacion;
        this.hipotecaBase = hipoBase;
        this.precioEdificar = precioEdif;
        this.casilla = casilla;
        this.propietario = jugador;
    }

    public String getNombre() {
        return nombre;
    }

    public Casilla getCasilla(){
        return casilla;
    }

    public boolean isHipotecada() {
        return hipotecada;
    }

    protected int getAlquilerBase() {
        return alquilerBase;
    }

    protected float getFactorRevalorizacion() {
        return factorRevalorizacion;
    }

    protected int getHipotecaBase() {
        return hipotecaBase;
    }

    public int getPrecioEdificar() {
        return precioEdificar;
    }

    public void setHipotecada(boolean h){
        this.hipotecada = h;
    }

    // Método propio de @pepito
    public void conmutarHipoteca(){
        this.hipotecada = !this.hipotecada;
    }

    public String toString(){
        return "Titulo de Propiedad {" + "nombre de la calle = " + this.nombre +
                ",\t¿Está hipotecado? = " + this.hipotecada +
                ",\tPrecio Base a pagar = "+ this.alquilerBase  +
                ",\tRevalorizacion = " + this.factorRevalorizacion +
                ",\tValor Hipoteca Base = " + this.hipotecaBase +
                ",\tPrecio Edificacion = " + this.precioEdificar +
                "}";
    }

    public String getNombreFuncion(){
        // Se podria usar reflexion ;)
        StackTraceElement stackTraceElements[] = (new Throwable()).getStackTrace();
        return "[" + stackTraceElements[1].toString() + "]";
    }

    protected void cobrarAlquiler(int coste){
        throw new UnsupportedOperationException(getNombreFuncion() + "Sin implementar");
    }

    protected boolean getHipotecada(){
        return this.hipotecada;
    }

    protected boolean propietarioEncarcelado(){
        //throw new UnsupportedOperationException(getNombreFuncion() + "Sin implementar");
        return this.propietario.getEncarcelado();
    }

    protected void setCasilla(Casilla casilla){
        this.casilla = casilla;
    }

    protected void setPropietario(Jugador propietario){
        this.propietario = propietario;
    }

    protected boolean tengoPropietario(){
        return this.propietario != null;
    }

}

redpajama_set_name: RedPajamaGithub


text:
package io.descoped.container.undertow.core;

import io.undertow.servlet.api.ClassIntrospecter;
import io.undertow.servlet.api.InstanceFactory;
import io.undertow.servlet.api.InstanceHandle;
import io.undertow.servlet.util.DefaultClassIntrospector;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.enterprise.inject.Instance;
import javax.enterprise.inject.Vetoed;
import javax.enterprise.inject.spi.CDI;

@Vetoed
public class CDIClassIntrospecter implements ClassIntrospecter {

    public static final ClassIntrospecter INSTANCE = new CDIClassIntrospecter();
    private static final Logger log = LoggerFactory.getLogger(CDIClassIntrospecter.class);

    private CDIClassIntrospecter() {
    }

    @Override
    public <T> InstanceFactory<T> createInstanceFactory(Class<T> clazz) throws NoSuchMethodException {
        log.trace("createInstanceFactory: {}", clazz);
        Instance<T> inst = CDI.current().select(clazz);
        if (inst.isUnsatisfied() || inst.isAmbiguous()) {
            return DefaultClassIntrospector.INSTANCE.createInstanceFactory(clazz);
        } else {
            return new CdiInstanceFactory<>(inst);
        }
    }

    // ---------------------------------------------------------------------------------------------------------------

    private static class CdiInstanceFactory<T> implements InstanceFactory<T> {
        private static final Logger log = LoggerFactory.getLogger(CdiInstanceFactory.class);

        private final Instance<T> inst;

        CdiInstanceFactory(Instance<T> inst) {
            this.inst = inst;
        }

        @Override
        public InstanceHandle<T> createInstance() throws InstantiationException {
            log.trace("createInstance: ", inst);
            return new CdiInstanceHandler<>(inst);
        }

    }

    // ---------------------------------------------------------------------------------------------------------------

    private static class CdiInstanceHandler<T> implements InstanceHandle<T> {
        private static final Logger log = LoggerFactory.getLogger(CdiInstanceHandler.class);

        private final Instance<T> inst;
        private T found = null;

        CdiInstanceHandler(Instance<T> inst) {
            this.inst = inst;
        }

        @Override
        public T getInstance() {
            if (this.found == null) {
                this.found = inst.get();
            }
            log.trace("getInstance [ {} ] >> {}", inst, found);
            return this.found;
        }

        @Override
        public void release() {
            inst.destroy(this.found);
        }
    }

}


text:
    if (!(cond))                                   \
    {                                              \
        std::cout << "Error: ##cond" << std::endl; \
        exit(1);                                   \
    }

void test_mask()
{
    namespace kps = psig;

    kps::sigset newsigset{SIGTERM, SIGINT};
    kps::sigset oldsigset = kps::this_thread::set_mask(newsigset);
    kps::sigset cursigset = kps::this_thread::get_mask();

    std::cout << "Signals in new mask: ";
    for (kps::signum_t signum : newsigset.signals()) std::cout << signum << " ";
    std::cout << std::endl;

    KTL_CHECK(oldsigset.empty());
    KTL_CHECK(newsigset == cursigset);
    KTL_CHECK(oldsigset != cursigset);
    KTL_CHECK(newsigset.has(SIGTERM));
    KTL_CHECK(newsigset.has(SIGINT));
    KTL_CHECK(newsigset.has(SIGHUP) == false);

    newsigset.clear();
    KTL_CHECK(newsigset.empty());
    KTL_CHECK(newsigset.has(SIGTERM) == false);
    KTL_CHECK(newsigset.has(SIGINT) == false);
    KTL_CHECK(newsigset.has(SIGHUP) == false);

    kps::this_thread::clear_mask();
    cursigset = kps::this_thread::get_mask();
    KTL_CHECK(cursigset.empty());
    KTL_CHECK(cursigset.has(SIGTERM) == false);
    KTL_CHECK(cursigset.has(SIGINT) == false);
    KTL_CHECK(cursigset.has(SIGHUP) == false);

    kps::this_thread::fill_mask();
    cursigset = kps::this_thread::get_mask();
    KTL_CHECK(cursigset.empty() == false);
    KTL_CHECK(cursigset.has(SIGTERM));
    KTL_CHECK(cursigset.has(SIGINT));
    KTL_CHECK(cursigset.has(SIGHUP));
    KTL_CHECK(cursigset.has(SIGRTMIN));
    KTL_CHECK(cursigset.has(SIGRTMAX));
    KTL_CHECK(cursigset.has(kps::rt::signum(0)));  // SIGRTMIN
    KTL_CHECK(cursigset.has(kps::rt::signum(1)));  // SIGRTMIN+1
    KTL_CHECK(cursigset.has(kps::rt::signum(kps::rt::sigcount())));  // SIGRTMAX
}

void test_wait()
{
    namespace kps = psig;

    kps::sigset signals{SIGTERM, SIGINT, SIGHUP};
    for (kps::sigcnt_t rtsigcnt = 0; rtsigcnt <= kps::rt::sigcount();
         ++rtsigcnt)
        signals += kps::rt::signum(rtsigcnt);

    std::cout << "Please type Ctrl^C" << std::endl;
    const kps::signum_t signum = kps::wait(signals);
    std::cout << "Received signal: " << signum << std::endl;
}

void test_rt_wait()
{
    namespace kps = psig;

    std::cout << "Please type Ctrl^C" << std::endl;
    const kps::signum_t signum = kps::wait({SIGTERM, SIGINT, SIGHUP});
    std::cout << "Received signal: " << signum << std::endl;
}

void test_timed_wait()
{
    namespace kps = psig;

    std::cout << "Please type Ctrl^C within 2.25 seconds" << std::endl;
    const kps::signum_t signum = kps::wait(
        {SIGTERM, SIGINT, SIGHUP}, std::chrono::nanoseconds(2250000000));
    std::cout << "Received signal: " << signum << std::endl;
}

extern "C" int main(int argc, char *argv[])
{
    test_mask();
    test_wait();
    test_rt_wait();
    test_timed_wait();
    return 0;
}


text:
pyclean
# http://stackoverflow.com/a/22916141


text:
.class public Landroid/telephony/SmsCbMessage;
.super Ljava/lang/Object;
.source "SmsCbMessage.java"

# interfaces
.implements Landroid/os/Parcelable;

# static fields
.field public static final CREATOR:Landroid/os/Parcelable$Creator;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Landroid/os/Parcelable$Creator",
            "<",
            "Landroid/telephony/SmsCbMessage;",
            ">;"
        }
    .end annotation
.end field

.field public static final GEOGRAPHICAL_SCOPE_CELL_WIDE:I = 0x3

.field public static final GEOGRAPHICAL_SCOPE_CELL_WIDE_IMMEDIATE:I = 0x0

.field public static final GEOGRAPHICAL_SCOPE_LA_WIDE:I = 0x2

.field public static final GEOGRAPHICAL_SCOPE_PLMN_WIDE:I = 0x1

.field protected static final LOG_TAG:Ljava/lang/String; = "SMSCB"

.field public static final MESSAGE_FORMAT_3GPP:I = 0x1

.field public static final MESSAGE_FORMAT_3GPP2:I = 0x2

.field public static final MESSAGE_PRIORITY_EMERGENCY:I = 0x3

.field public static final MESSAGE_PRIORITY_INTERACTIVE:I = 0x1

.field public static final MESSAGE_PRIORITY_NORMAL:I = 0x0

.field public static final MESSAGE_PRIORITY_URGENT:I = 0x2

# instance fields
.field private final mBody:Ljava/lang/String;

.field private final mCmasWarningInfo:Landroid/telephony/SmsCbCmasInfo;

.field private final mEtwsWarningInfo:Landroid/telephony/SmsCbEtwsInfo;

.field private final mGeographicalScope:I

.field private final mLanguage:Ljava/lang/String;

.field private final mLocation:Landroid/telephony/SmsCbLocation;

.field private final mMessageFormat:I

.field private final mPriority:I

.field private final mSerialNumber:I

.field private final mServiceCategory:I

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

    .prologue
    .line 219
    new-instance v0, Landroid/telephony/SmsCbMessage$1;

    invoke-direct {v0}, Landroid/telephony/SmsCbMessage$1;-><init>()V

    sput-object v0, Landroid/telephony/SmsCbMessage;->CREATOR:Landroid/os/Parcelable$Creator;

    return-void
.end method

.method public constructor <init>(IIILandroid/telephony/SmsCbLocation;ILjava/lang/String;Ljava/lang/String;ILandroid/telephony/SmsCbEtwsInfo;Landroid/telephony/SmsCbCmasInfo;)V
    .locals 0
    .param p1, "messageFormat"    # I
    .param p2, "geographicalScope"    # I
    .param p3, "serialNumber"    # I
    .param p4, "location"    # Landroid/telephony/SmsCbLocation;
    .param p5, "serviceCategory"    # I
    .param p6, "language"    # Ljava/lang/String;
    .param p7, "body"    # Ljava/lang/String;
    .param p8, "priority"    # I
    .param p9, "etwsWarningInfo"    # Landroid/telephony/SmsCbEtwsInfo;
    .param p10, "cmasWarningInfo"    # Landroid/telephony/SmsCbCmasInfo;

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

    .line 147
    iput p1, p0, Landroid/telephony/SmsCbMessage;->mMessageFormat:I

    .line 148
    iput p2, p0, Landroid/telephony/SmsCbMessage;->mGeographicalScope:I

    .line 149
    iput p3, p0, Landroid/telephony/SmsCbMessage;->mSerialNumber:I

    .line 150
    iput-object p4, p0, Landroid/telephony/SmsCbMessage;->mLocation:Landroid/telephony/SmsCbLocation;

    .line 151
    iput p5, p0, Landroid/telephony/SmsCbMessage;->mServiceCategory:I

    .line 152
    iput-object p6, p0, Landroid/telephony/SmsCbMessage;->mLanguage:Ljava/lang/String;

    .line 153
    iput-object p7, p0, Landroid/telephony/SmsCbMessage;->mBody:Ljava/lang/String;

    .line 154
    iput p8, p0, Landroid/telephony/SmsCbMessage;->mPriority:I

    .line 155
    iput-object p9, p0, Landroid/telephony/SmsCbMessage;->mEtwsWarningInfo:Landroid/telephony/SmsCbEtwsInfo;

    .line 156
    iput-object p10, p0, Landroid/telephony/SmsCbMessage;->mCmasWarningInfo:Landroid/telephony/SmsCbCmasInfo;

    .line 157
    return-void
.end method

.method public constructor <init>(Landroid/os/Parcel;)V
    .locals 3
    .param p1, "in"    # Landroid/os/Parcel;

    .prologue
    const/4 v2, 0x0

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

    .line 161
    invoke-virtual {p1}, Landroid/os/Parcel;->readInt()I

    move-result v1

    iput v1, p0, Landroid/telephony/SmsCbMessage;->mMessageFormat:I

    .line 162
    invoke-virtual {p1}, Landroid/os/Parcel;->readInt()I

    move-result v1

    iput v1, p0, Landroid/telephony/SmsCbMessage;->mGeographicalScope:I

    .line 163
    invoke-virtual {p1}, Landroid/os/Parcel;->readInt()I

    move-result v1

    iput v1, p0, Landroid/telephony/SmsCbMessage;->mSerialNumber:I

    .line 164
    new-instance v1, Landroid/telephony/SmsCbLocation;

    invoke-direct {v1, p1}, Landroid/telephony/SmsCbLocation;-><init>(Landroid/os/Parcel;)V

    iput-object v1, p0, Landroid/telephony/SmsCbMessage;->mLocation:Landroid/telephony/SmsCbLocation;

    .line 165
    invoke-virtual {p1}, Landroid/os/Parcel;->readInt()I

    move-result v1

    iput v1, p0, Landroid/telephony/SmsCbMessage;->mServiceCategory:I

    .line 166
    invoke-virtual {p1}, Landroid/os/Parcel;->readString()Ljava/lang/String;

    move-result-object v1

    iput-object v1, p0, Landroid/telephony/SmsCbMessage;->mLanguage:Ljava/lang/String;

    .line 167
    invoke-virtual {p1}, Landroid/os/Parcel;->readString()Ljava/lang/String;

    move-result-object v1

    iput-object v1, p0, Landroid/telephony/SmsCbMessage;->mBody:Ljava/lang/String;

    .line 168
    invoke-virtual {p1}, Landroid/os/Parcel;->readInt()I

    move-result v1

    iput v1, p0, Landroid/telephony/SmsCbMessage;->mPriority:I

    .line 169
    invoke-virtual {p1}, Landroid/os/Parcel;->readInt()I

    move-result v0

    .line 170
    .local v0, "type":I
    packed-switch v0, :pswitch_data_0

    .line 184
    :pswitch_0
    iput-object v2, p0, Landroid/telephony/SmsCbMessage;->mEtwsWarningInfo:Landroid/telephony/SmsCbEtwsInfo;

    .line 185
    iput-object v2, p0, Landroid/telephony/SmsCbMessage;->mCmasWarningInfo:Landroid/telephony/SmsCbCmasInfo;

    .line 187
    :goto_0
    return-void

    .line 173
    :pswitch_1
    new-instance v1, Landroid/telephony/SmsCbEtwsInfo;

    invoke-direct {v1, p1}, Landroid/telephony/SmsCbEtwsInfo;-><init>(Landroid/os/Parcel;)V

    iput-object v1, p0, Landroid/telephony/SmsCbMessage;->mEtwsWarningInfo:Landroid/telephony/SmsCbEtwsInfo;

    .line 174
    iput-object v2, p0, Landroid/telephony/SmsCbMessage;->mCmasWarningInfo:Landroid/telephony/SmsCbCmasInfo;

    goto :goto_0

    .line 179
    :pswitch_2
    iput-object v2, p0, Landroid/telephony/SmsCbMessage;->mEtwsWarningInfo:Landroid/telephony/SmsCbEtwsInfo;

    .line 180
    new-instance v1, Landroid/telephony/SmsCbCmasInfo;

    invoke-direct {v1, p1}, Landroid/telephony/SmsCbCmasInfo;-><init>(Landroid/os/Parcel;)V

    iput-object v1, p0, Landroid/telephony/SmsCbMessage;->mCmasWarningInfo:Landroid/telephony/SmsCbCmasInfo;

    goto :goto_0

    .line 170
    nop

    :pswitch_data_0
    .packed-switch 0x43
        :pswitch_2
        :pswitch_0
        :pswitch_1
    .end packed-switch
.end method

# virtual methods
.method public describeContents()I
    .locals 1

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

    return v0
.end method

.method public getCmasWarningInfo()Landroid/telephony/SmsCbCmasInfo;
    .locals 1

    .prologue
    .line 337
    iget-object v0, p0, Landroid/telephony/SmsCbMessage;->mCmasWarningInfo:Landroid/telephony/SmsCbCmasInfo;

    return-object v0
.end method

.method public getEtwsWarningInfo()Landroid/telephony/SmsCbEtwsInfo;
    .locals 1

    .prologue
    .line 323
    iget-object v0, p0, Landroid/telephony/SmsCbMessage;->mEtwsWarningInfo:Landroid/telephony/SmsCbEtwsInfo;

    return-object v0
.end method

.method public getGeographicalScope()I
    .locals 1

    .prologue
    .line 238
    iget v0, p0, Landroid/telephony/SmsCbMessage;->mGeographicalScope:I

    return v0
.end method

.method public getLanguageCode()Ljava/lang/String;
    .locals 1

    .prologue
    .line 283
    iget-object v0, p0, Landroid/telephony/SmsCbMessage;->mLanguage:Ljava/lang/String;

    return-object v0
.end method

.method public getLocation()Landroid/telephony/SmsCbLocation;
    .locals 1

    .prologue
    .line 262
    iget-object v0, p0, Landroid/telephony/SmsCbMessage;->mLocation:Landroid/telephony/SmsCbLocation;

    return-object v0
.end method

.method public getMessageBody()Ljava/lang/String;
    .locals 1

    .prologue
    .line 292
    iget-object v0, p0, Landroid/telephony/SmsCbMessage;->mBody:Ljava/lang/String;

    return-object v0
.end method

.method public getMessageFormat()I
    .locals 1

    .prologue
    .line 300
    iget v0, p0, Landroid/telephony/SmsCbMessage;->mMessageFormat:I

    return v0
.end method

.method public getMessagePriority()I
    .locals 1

    .prologue
    .line 310
    iget v0, p0, Landroid/telephony/SmsCbMessage;->mPriority:I

    return v0
.end method

.method public getSerialNumber()I
    .locals 1

    .prologue
    .line 249
    iget v0, p0, Landroid/telephony/SmsCbMessage;->mSerialNumber:I

    return v0
.end method

.method public getServiceCategory()I
    .locals 1

    .prologue
    .line 274
    iget v0, p0, Landroid/telephony/SmsCbMessage;->mServiceCategory:I

    return v0
.end method

.method public isCmasMessage()Z
    .locals 1

    .prologue
    .line 361
    iget-object v0, p0, Landroid/telephony/SmsCbMessage;->mCmasWarningInfo:Landroid/telephony/SmsCbCmasInfo;

    if-eqz v0, :cond_0

    const/4 v0, 0x1

    :goto_0
    return v0

    :cond_0
    const/4 v0, 0x0

    goto :goto_0
.end method

.method public isEmergencyMessage()Z
    .locals 2

    .prologue
    .line 345
    iget v0, p0, Landroid/telephony/SmsCbMessage;->mPriority:I

    const/4 v1, 0x3

    if-ne v0, v1, :cond_0

    const/4 v0, 0x1

    :goto_0
    return v0

    :cond_0
    const/4 v0, 0x0

    goto :goto_0
.end method

.method public isEtwsMessage()Z
    .locals 1

    .prologue
    .line 353
    iget-object v0, p0, Landroid/telephony/SmsCbMessage;->mEtwsWarningInfo:Landroid/telephony/SmsCbEtwsInfo;

    if-eqz v0, :cond_0

    const/4 v0, 0x1

    :goto_0
    return v0

    :cond_0
    const/4 v0, 0x0

    goto :goto_0
.end method

.method public toString()Ljava/lang/String;
    .locals 3

    .prologue
    .line 366
    new-instance v0, Ljava/lang/StringBuilder;

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

    const-string v1, "SmsCbMessage{geographicalScope="

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

    move-result-object v0

    iget v1, p0, Landroid/telephony/SmsCbMessage;->mGeographicalScope:I

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

    move-result-object v0

    const-string v1, ", serialNumber="

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

    move-result-object v0

    iget v1, p0, Landroid/telephony/SmsCbMessage;->mSerialNumber:I

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

    move-result-object v0

    const-string v1, ", location="

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

    move-result-object v0

    iget-object v1, p0, Landroid/telephony/SmsCbMessage;->mLocation:Landroid/telephony/SmsCbLocation;

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

    move-result-object v0

    const-string v1, ", serviceCategory="

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

    move-result-object v0

    iget v1, p0, Landroid/telephony/SmsCbMessage;->mServiceCategory:I

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

    move-result-object v0

    const-string v1, ", language="

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

    move-result-object v0

    iget-object v1, p0, Landroid/telephony/SmsCbMessage;->mLanguage:Ljava/lang/String;

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

    move-result-object v0

    const-string v1, ", body="

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

    move-result-object v0

    iget-object v1, p0, Landroid/telephony/SmsCbMessage;->mBody:Ljava/lang/String;

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

    move-result-object v0

    const-string v1, ", priority="

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

    move-result-object v0

    iget v1, p0, Landroid/telephony/SmsCbMessage;->mPriority:I

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

    move-result-object v1

    iget-object v0, p0, Landroid/telephony/SmsCbMessage;->mEtwsWarningInfo:Landroid/telephony/SmsCbEtwsInfo;

    if-eqz v0, :cond_0

    new-instance v0, Ljava/lang/StringBuilder;

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

    const-string v2, ", "

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

    move-result-object v0

    iget-object v2, p0, Landroid/telephony/SmsCbMessage;->mEtwsWarningInfo:Landroid/telephony/SmsCbEtwsInfo;

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

    move-result-object v2

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

    move-result-object v0

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

    move-result-object v0

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

    move-result-object v1

    iget-object v0, p0, Landroid/telephony/SmsCbMessage;->mCmasWarningInfo:Landroid/telephony/SmsCbCmasInfo;

    if-eqz v0, :cond_1

    new-instance v0, Ljava/lang/StringBuilder;

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

    const-string v2, ", "

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

    move-result-object v0

    iget-object v2, p0, Landroid/telephony/SmsCbMessage;->mCmasWarningInfo:Landroid/telephony/SmsCbCmasInfo;

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

    move-result-object v2

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

    move-result-object v0

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

    move-result-object v0

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

    move-result-object v0

    const/16 v1, 0x7d

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

    move-result-object v0

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

    move-result-object v0

    return-object v0

    :cond_0
    const-string v0, ""

    goto :goto_0

    :cond_1
    const-string v0, ""

    goto :goto_1
.end method

.method public writeToParcel(Landroid/os/Parcel;I)V
    .locals 1
    .param p1, "dest"    # Landroid/os/Parcel;
    .param p2, "flags"    # I

    .prologue
    .line 197
    iget v0, p0, Landroid/telephony/SmsCbMessage;->mMessageFormat:I

    invoke-virtual {p1, v0}, Landroid/os/Parcel;->writeInt(I)V

    .line 198
    iget v0, p0, Landroid/telephony/SmsCbMessage;->mGeographicalScope:I

    invoke-virtual {p1, v0}, Landroid/os/Parcel;->writeInt(I)V

    .line 199
    iget v0, p0, Landroid/telephony/SmsCbMessage;->mSerialNumber:I

    invoke-virtual {p1, v0}, Landroid/os/Parcel;->writeInt(I)V

    .line 200
    iget-object v0, p0, Landroid/telephony/SmsCbMessage;->mLocation:Landroid/telephony/SmsCbLocation;

    invoke-virtual {v0, p1, p2}, Landroid/telephony/SmsCbLocation;->writeToParcel(Landroid/os/Parcel;I)V

    .line 201
    iget v0, p0, Landroid/telephony/SmsCbMessage;->mServiceCategory:I

    invoke-virtual {p1, v0}, Landroid/os/Parcel;->writeInt(I)V

    .line 202
    iget-object v0, p0, Landroid/telephony/SmsCbMessage;->mLanguage:Ljava/lang/String;

    invoke-virtual {p1, v0}, Landroid/os/Parcel;->writeString(Ljava/lang/String;)V

    .line 203
    iget-object v0, p0, Landroid/telephony/SmsCbMessage;->mBody:Ljava/lang/String;

    invoke-virtual {p1, v0}, Landroid/os/Parcel;->writeString(Ljava/lang/String;)V

    .line 204
    iget v0, p0, Landroid/telephony/SmsCbMessage;->mPriority:I

    invoke-virtual {p1, v0}, Landroid/os/Parcel;->writeInt(I)V

    .line 205
    iget-object v0, p0, Landroid/telephony/SmsCbMessage;->mEtwsWarningInfo:Landroid/telephony/SmsCbEtwsInfo;

    if-eqz v0, :cond_0

    .line 207
    const/16 v0, 0x45

    invoke-virtual {p1, v0}, Landroid/os/Parcel;->writeInt(I)V

    .line 208
    iget-object v0, p0, Landroid/telephony/SmsCbMessage;->mEtwsWarningInfo:Landroid/telephony/SmsCbEtwsInfo;

    invoke-virtual {v0, p1, p2}, Landroid/telephony/SmsCbEtwsInfo;->writeToParcel(Landroid/os/Parcel;I)V

    .line 217
    :goto_0
    return-void

    .line 209
    :cond_0
    iget-object v0, p0, Landroid/telephony/SmsCbMessage;->mCmasWarningInfo:Landroid/telephony/SmsCbCmasInfo;

    if-eqz v0, :cond_1

    .line 211
    const/16 v0, 0x43

    invoke-virtual {p1, v0}, Landroid/os/Parcel;->writeInt(I)V

    .line 212
    iget-object v0, p0, Landroid/telephony/SmsCbMessage;->mCmasWarningInfo:Landroid/telephony/SmsCbCmasInfo;

    invoke-virtual {v0, p1, p2}, Landroid/telephony/SmsCbCmasInfo;->writeToParcel(Landroid/os/Parcel;I)V

    goto :goto_0

    .line 215
    :cond_1
    const/16 v0, 0x30

    invoke-virtual {p1, v0}, Landroid/os/Parcel;->writeInt(I)V

    goto :goto_0
.end method


text:
test:
	@NODE_ENV=test ./node_modules/gulp/bin/gulp.js test

build:
	./node_modules/gulp/bin/gulp.js clean & ./node_modules/gulp/bin/gulp.js build

.PHONY: test


text:
author: slowe
comments: true
date: 2007-08-06 13:24:25+00:00
layout: post
slug: fusion-released
title: Fusion Released
wordpress_id: 500
categories: News
tags:
- Fusion
- Macintosh
- Virtualization
- VMware
---

I just finished downloading the final release version of [VMware Fusion](http://www.vmware.com/products/fusion/) from the VMware web site, and as I type this blog posting I'm in the process of updating the VMware Tools in my Windows XP Professional VM. Already in my limited testing of the new release I see improvements in Unity (the Windows background no longer shows up when you minimize a window). As I'm a bit limited on time right at the moment (in the midst of a VMware deployment, imagine that!), I'll stop there, and I'll post more thoughts about the final version later today.

Let me reiterate again that my hat is off to VMware and the Fusion product team. Great work!


text:
define( [
    'dojo/_base/declare',
    'dojo/request/xhr',
    'JBrowse/Store/Sequence/StaticChunked',
    'WebApollo/Store/SeqFeature/ScratchPad',
    'WebApollo/View/Track/DraggableHTMLFeatures',
    'WebApollo/JSONUtils',
    'WebApollo/Permission',
    'dojox/widget/Standby',
    'jquery/jquery'
     ],
function( declare,
    xhr,
    StaticChunked,
    ScratchPad,
    DraggableFeatureTrack,
    JSONUtils,
    Permission,
    Standby,
    $
) {

var SequenceTrack = declare( "SequenceTrack", DraggableFeatureTrack,
{

/**
 * Track to display the underlying reference sequence, when zoomed in
 * far enough.
 * @class
 * @constructor
 */
    constructor: function( args ) {
        this.isWebApolloSequenceTrack = true;
        var track = this;

        /**
         * DraggableFeatureTrack now has its own context menu for divs,
         * and adding this flag provides a quick way to short-circuit it's
         * initialization
         */
        this.has_custom_context_menu = true;
        //        this.use_standard_context_menu = false;
        this.show_reverse_strand = true;
        this.show_protein_translation = true;
        this.context_path = "..";
        this.verbose_server_notification = false;

        this.residues_context_menu = new dijit.Menu({});  // placeholder till setAnnotTrack() triggers real menu init
        this.annot_context_menu = new dijit.Menu({});     // placeholder till setAnnotTrack() triggers real menu init

        this.residuesMouseDown = function(event) {
            track.onResiduesMouseDown(event);
        };

//        this.charSize = this.webapollo.getSequenceCharacterSize();
        //        this.charWidth = this.charSize.charWidth;
        //        this.seqHeight = this.charSize.seqHeight;

        // splitting seqHeight into residuesHeight and translationHeight, so future iteration may be possible
        //    for DNA residues and protein translation to be different styles
        //        this.dnaHeight = this.seqHeight;
        //        this.proteinHeight = this.seqHeight;

        // this.refSeq = refSeq;  already assigned in BlockBased superclass

        if (this.store.name == 'refseqs') {
            this.sequenceStore = this.store;
            var annotStoreConfig = dojo.clone(this.config);
            annotStoreConfig.browser = this.browser;
            annotStoreConfig.refSeq = this.refSeq;
            var annotStore = new ScratchPad(annotStoreConfig);
            this.store = annotStore;
            annotStoreConfig.name = this.store.name;
            this.browser._storeCache[this.store.name] = {
                refCount: 1,
                store: this.store
            };
        }
        else  {
            var seqStoreConfig = dojo.clone(this.config);
            seqStoreConfig.storeClass = "JBrowse/Store/Sequence/StaticChunked";
            seqStoreConfig.type = "JBrowse/Store/Sequence/StaticChunked";
            // old style, using residuesUrlTemplate
            if (this.config.residuesUrlTemplate) {
                seqStoreConfig.urlTemplate = this.config.residuesUrlTemplate;
            }

            var inner_config = dojo.clone(seqStoreConfig);
            // need a seqStoreConfig.config,
            //   since in StaticChunked constructor seqStoreConfig.baseUrl is ignored,
            //   and seqStoreConfig.config.baseUrl is used instead (as of JBrowse 1.9.8+)
            seqStoreConfig.config = inner_config;
            // must add browser and refseq _after_ cloning, otherwise get Browser errors
            seqStoreConfig.browser = this.browser;
            seqStoreConfig.refSeq = this.refSeq;

            this.sequenceStore = new StaticChunked(seqStoreConfig);
            this.browser._storeCache[ 'refseqs'] = {
                refCount: 1,
                store: this.sequenceStore
            };
        }

        this.trackPadding = 10;
        this.SHOW_IF_FEATURES = true;
        this.ALWAYS_SHOW = false;
        // this.setLoaded();
        //        this.initContextMenu();

        /*
        var atrack = this.getAnnotTrack();
        if (atrack)  {
            this.setAnnotTrack(atrack);
        }
        */

        this.translationTable = {};

        var initAnnotTrack = dojo.hitch(this, function() {
            var atrack = this.getAnnotTrack();
            if (atrack && this.div) {
                this.setAnnotTrack(atrack);
            }
            else {
                window.setTimeout(initAnnotTrack, 100);
            }
        });
        initAnnotTrack();

    },

// annotSelectionManager is class variable (shared by all AnnotTrack instances)
// SequenceTrack.seqSelectionManager = new FeatureSelectionManager();

// setting up selection exclusiveOr --
//    if selection is made in annot track, any selection in other tracks is deselected, and vice versa,
//    regardless of multi-select mode etc.
// SequenceTrack.seqSelectionManager.addMutualExclusion(DraggableFeatureTrack.selectionManager);
// SequenceTrack.seqSelectionManager.addMutualExclusion(AnnotTrack.annotSelectionManager);
//DraggableFeatureTrack.selectionManager.addMutualExclusion(SequenceTrack.seqSelectionManager);

//    loadSuccess: function(trackInfo)  { }  // loadSuccess no longer called by track initialization/loading
    _defaultConfig: function() {
        var thisConfig = this.inherited(arguments);
        // nulling out menuTemplate to suppress default JBrowse feature contextual menu
        thisConfig.menuTemplate = null;
        thisConfig.maxFeatureScreenDensity = 100000; // set rediculously high, ensures will never show "zoomed too far out" placeholder
        thisConfig.style.renderClassName = null;
        thisConfig.style.arrowheadClass = null;
        thisConfig.style.centerChildrenVertically = false;
        thisConfig.ignoreFeatureFilter = true;
        thisConfig.style.showLabels = false;
        thisConfig.pinned = true;
        return thisConfig;
    },

    /** removing "Pin to top" menuitem, so SequenceTrack is always pinned
     *    and "Delete track" menuitem, so can't be deleted
     *   (very hacky since depends on label property of menuitem config)
     */
   _trackMenuOptions: function() {
       var options = this.inherited( arguments );
       options = this.webapollo.removeItemWithLabel(options, "Pin to top");
       options = this.webapollo.removeItemWithLabel(options, "Delete track");
       return options;
   },

    loadTranslationTable: function() {
        var track = this;
        var query={
            "track": track.annotTrack.getUniqueTrackName(),
            "operation": "get_translation_table"
        };
        return xhr.post(track.context_path + "/AnnotationEditorService", {
            data: JSON.stringify(query),
            handleAs: "json"
        }).then(function(response) { //
            track.translationTable = {};
            var ttable = response.translation_table;
            for (var codon in ttable) {
                // looping through codon table, make sure not hitting generic properties...
                if (ttable.hasOwnProperty(codon)) {
                    var aa = ttable[codon];
                    var nucs = [];
                    for (var i=0; i<3; i++) {
                        var nuc = codon.charAt(i);
                        nucs[i] = [];
                        nucs[i][0] = nuc.toUpperCase();
                        nucs[i][1] = nuc.toLowerCase();
                    }
                    for (var i=0; i<2; i++) {
                        var n0 = nucs[0][i];
                        for (var j=0; j<2; j++) {
                            var n1 = nucs[1][j];
                            for (var k=0; k<2; k++) {
                                var n2 = nucs[2][k];
                                var triplet = n0 + n1 + n2;
                                track.translationTable[triplet] = aa;
                                // console.log("triplet: ", triplet, ", aa: ", aa );
                            }
                        }
                    }
                }
            }
            track.changed();
        },
        function(response) {
            console.log("get_translation_table error",response);
            return response;
        });
    },

    /**
     * called by AnnotTrack to initiate sequence alterations load
     */
    loadSequenceAlterations: function() {
        var track = this;

        var query={
            "track": track.annotTrack.getUniqueTrackName(),
            "operation": "get_sequence_alterations",
            "organism": track.webapollo.organism,
            "clientToken": track.getAnnotTrack().getClientToken()
        };

        return dojo.xhrPost( {
            postData: JSON.stringify(query),
            url: track.context_path + "/AnnotationEditorService",
            handleAs: "json",
            load: function(response, ioArgs) { //
                var responseFeatures = response.features;
                if(!responseFeatures) {
                    alert("Error: "+JSON.stringify(response));
                    return;
                }
                for (var i = 0; i < responseFeatures.length; i++) {
                    var jfeat = JSONUtils.createJBrowseSequenceAlteration(responseFeatures[i]);
                    track.store.insert(jfeat);
                }
                track.featureCount = track.storedFeatureCount();
                if (track.ALWAYS_SHOW || (track.SHOW_IF_FEATURES && track.featureCount > 0)) {
                    track.show();
                }
                else {
                    track.hide();
                }
                track.changed();
            },
            error: function(response) {
                return response;
            }
        });
    },

    startZoom: function(destScale, destStart, destEnd) {
        // would prefer to only try and hide dna residues on zoom if previous scale was at base pair resolution
        //   (otherwise there are no residues to hide), but by time startZoom is called, pxPerBp is already set to destScale,
        //    so would require keeping prevScale var around, or passing in prevScale as additional parameter to startZoom()
        // so for now just always trying to hide residues on a zoom, whether they're present or not

        $(".dna-residues", this.div).css('display', 'none');
        $(".block-seq-container", this.div).css('height', '20px');
        this.heightUpdate(20);
        this.gview.trackHeightUpdate(this.name, Math.max(this.labelHeight, 20));
    },

    endZoom: function(destScale, destBlockBases) {
        var charSize = this.webapollo.getSequenceCharacterSize();

        if( ( destScale == charSize.width ) ||
            this.ALWAYS_SHOW || (this.SHOW_IF_FEATURES && this.featureCount > 0)) {
            this.show();
        }
        else  {
            this.hide();
        }
        this.clear();
    },

    setViewInfo: function( genomeView, numBlocks,
                           trackDiv, labelDiv,
                           widthPct, widthPx, scale ) {

        this.inherited( arguments );

        var charSize = this.webapollo.getSequenceCharacterSize();
        if ( (scale == charSize.width ) ||
            this.ALWAYS_SHOW || (this.SHOW_IF_FEATURES && this.featureCount > 0) ) {
            this.show();
        } else {
            this.hide();
            this.heightUpdate(0);
        }
        this.setLabel( this.key );
    },

    startStandby: function() {
        if (this.standby == null) {
            this.standby = new Standby({target: this.div, color: "transparent",image:"plugins/WebApollo/img/loading.gif"});
            document.body.appendChild(this.standby.domNode);
            this.standby.startup();
            this.standby.show();
        }
    },

    stopStandby: function() {
        if (this.standby != null) {
            this.standby.hide();
        }
    },

    fillBlock: function( args ) {
        var blockIndex = args.blockIndex;
        var block = args.block;
        var leftBase = args.leftBase;
        var rightBase = args.rightBase;
        var scale = args.scale;
        var containerStart = args.containerStart;
        var containerEnd = args.containerEnd;

        var verbose = false;
        var fillArgs = arguments;
        var track = this;

        var finishCallback = args.finishCallback;
            args.finishCallback = function() {
                finishCallback();
                track.stopStandby();
            };

        var charSize = this.webapollo.getSequenceCharacterSize();
        if ((scale == charSize.width) ||
                this.ALWAYS_SHOW || (this.SHOW_IF_FEATURES && this.featureCount > 0) ) {
            this.show();
        } else {
            this.hide();
            this.heightUpdate(0);
        }
        var blockHeight = 0;

        if (this.shown) {
            // make a div to contain the sequences
            var seqNode = document.createElement("div");
            seqNode.className = "wa-sequence";
            // seq_block_container style sets width = 100%, so seqNode fills the block width
            //    regardless of whether holding residue divs or not
            $(seqNode).addClass("block-seq-container");
            block.domNode.appendChild(seqNode);

            var slength = rightBase - leftBase;

            // just always add two base pairs to front and end,
            //    to make sure can do three-frame translation across for every base position in (leftBase..rightBase),
            //    both forward (need tw pairs on end) and reverse (need 2 extra bases at start)
            var leftExtended = leftBase - 2;
            var rightExtended = rightBase + 2;

            var dnaHeight     = charSize.height;
            var proteinHeight = charSize.height;

            if ( scale == charSize.width ) {
                this.sequenceStore.getReferenceSequence(
                    { ref: this.refSeq.name, start: leftExtended, end: rightExtended },
                    function( seq ) {
                        var start = args.leftBase - 2;
                        var end = args.rightBase + 2;

                        if (start < 0) {
                            start = 0;
                        }
                        if (args.leftBase == -1) {
                            var idx = seq.lastIndexOf(" ");
                            seq = seq.substring(0, idx) + SequenceTrack.nbsp + seq.substring(idx + 1);
                        }

                        var blockStart = start + 2;
                        var blockEnd = end - 2;
                        var blockResidues = seq.substring(2, seq.length-2);
                        var blockLength = blockResidues.length;
                        var extendedStart = start;
                        var extendedEnd = end;
                        var extendedStartResidues = seq.substring(0, seq.length-2);
                        var extendedEndResidues = seq.substring(2);

                        if (track.show_protein_translation) {
                            var framedivs = [];
                            for (var i=0; i<3; i++) {
                                var tstart = blockStart + i;
                                var frame = tstart % 3;
                                var transProtein = track.renderTranslation( extendedEndResidues, i, blockLength);
                                // if coloring CDS in feature tracks by frame, use same "cds-frame" styling,
                                //    otherwise use more muted "frame" styling
                                $(transProtein).addClass("cds-frame" + frame);
                                framedivs[frame] = transProtein;
                            }
                            for (var i=2; i>=0; i--) {
                                var transProtein = framedivs[i];
                                seqNode.appendChild(transProtein);
                                $(transProtein).bind("mousedown", track.residuesMouseDown);
                                blockHeight += proteinHeight;
                            }
                        }

                        // add a div for the forward strand
                        var forwardDNA = track.renderResidues( blockResidues );
                        $(forwardDNA).addClass("forward-strand");
                        seqNode.appendChild( forwardDNA );

                        track.residues_context_menu.bindDomNode(forwardDNA);
                        $(forwardDNA).bind("mousedown", track.residuesMouseDown);
                        blockHeight += dnaHeight;

                        if (track.show_reverse_strand) {
                            // and one for the reverse strand
                            // var reverseDNA = track.renderResidues( start, end, track.complement(seq) );
                            var reverseDNA = track.renderResidues( track.complement(blockResidues) );
                            $(reverseDNA).addClass("reverse-strand");
                            seqNode.appendChild( reverseDNA );
                            // dnaContainer.appendChild(reverseDNA);
                            track.residues_context_menu.bindDomNode(reverseDNA);
                            $(reverseDNA).bind("mousedown", track.residuesMouseDown);
                            blockHeight += dnaHeight;
                        }

                        // set up highlighting of base pair underneath mouse
                        $(forwardDNA).bind("mouseleave", function(event) {
                            track.removeTextHighlight(forwardDNA);
                            if (reverseDNA) { track.removeTextHighlight(reverseDNA); }
                            track.last_dna_coord = undefined;
                        } );
                        $(forwardDNA).bind("mousemove", function(event) {
                            var gcoord = track.getGenomeCoord(event);
                            if (gcoord >= 0 && ((!track.last_dna_coord) || (gcoord !== track.last_dna_coord))) {
                                var blockCoord = gcoord - leftBase;
                                track.last_dna_coord = gcoord;
                                track.setTextHighlight(forwardDNA, blockCoord, blockCoord, "dna-highlighted");
                                if (!track.freezeHighlightedBases) {
                                    track.lastHighlightedForwardDNA = forwardDNA;
                                }
                                if (reverseDNA)  {
                                    track.setTextHighlight(reverseDNA, blockCoord, blockCoord, "dna-highlighted");
                                    if (!track.freezeHighlightedBases) {
                                        track.lastHighlightedReverseDNA = reverseDNA;
                                    }
                                }
                            }
                            else if (gcoord < 0) {
                                track.clearHighlightedBases();
                            }
                        } );
                        if (reverseDNA) {
                            $(reverseDNA).bind("mouseleave", function(event) {
                                track.removeTextHighlight(forwardDNA);
                                track.removeTextHighlight(reverseDNA);
                                track.last_dna_coord = undefined;
                            } );
                            $(reverseDNA).bind("mousemove", function(event) {
                                var gcoord = track.getGenomeCoord(event);
                                if (gcoord >= 0 && ((!track.last_dna_coord) || (gcoord !== track.last_dna_coord))) {
                                    var blockCoord = gcoord - leftBase;
                                    track.last_dna_coord = gcoord;
                                    track.setTextHighlight(forwardDNA, blockCoord, blockCoord, "dna-highlighted");
                                    track.setTextHighlight(reverseDNA, blockCoord, blockCoord, "dna-highlighted");
                                    if (!track.freezeHighlightedBases) {
                                        track.lastHighlightedForwardDNA = forwardDNA;
                                        track.lastHighlightedReverseDNA = reverseDNA;
                                    }
                                }
                                else if (gcoord < 0) {
                                    track.clearHighlightedBases();
                                }
                            } );
                        }

                        if (track.show_protein_translation && track.show_reverse_strand) {
                            var extendedReverseComp = track.reverseComplement(extendedStartResidues);
                            if (verbose)  { console.log("extendedReverseComp: " + extendedReverseComp); }
                            var framedivs = [];
                            var offset = ( 2 - (track.refSeq.length  % 3)  )  ;
                            for (var i=2; i>=0; i--) {
                                var transStart = blockStart + 1 - i;
                                var frame = (transStart % 3 + 3) % 3;
                                frame = (frame + offset )% 3;
                                var transProtein = track.renderTranslation( extendedStartResidues, i, blockLength, true);
                                $(transProtein).addClass("neg-cds-frame" + frame);
                                framedivs[frame] = transProtein;
                            }
                            for (var i=2; i>=0; i--) {
                            // for (var i=0; i<3; i++) {
                                var transProtein = framedivs[i];
                                seqNode.appendChild(transProtein);
                                $(transProtein).bind("mousedown", track.residuesMouseDown);
                                blockHeight += proteinHeight;
                            }
                        }
                        track.inherited("fillBlock", fillArgs);
                        blockHeight += 5;  // a little extra padding below (track.trackPadding used for top padding)
                        track.heightUpdate(blockHeight, blockIndex);
                    },
                    function() {}
                    );
                }
                else  {
                    blockHeight = 20;  // default dna track height if not zoomed to base level
                    seqNode.style.height = "20px";

                    track.inherited("fillBlock", arguments);
                    track.heightUpdate(blockHeight, blockIndex);
                }
        } else {
            this.heightUpdate(0, blockIndex);
        }
    },

    addFeatureToBlock: function( feature, uniqueId, block, scale, labelScale, descriptionScale,
                                 containerStart, containerEnd ) {
        var featDiv =
        this.renderFeature(feature, uniqueId, block, scale, labelScale, descriptionScale, containerStart, containerEnd);
        $(featDiv).addClass("sequence-alteration");

        var charSize = this.webapollo.getSequenceCharacterSize();

        var seqNode = $("div.wa-sequence", block.domNode).get(0);
        featDiv.style.top = "0px";
        var ftype = feature.get("type");
        if (ftype) {
            if (ftype == "deletion") {

            }
            else if (ftype == "insertion") {
                if ( scale == charSize.width ) {
                    var container  = document.createElement("div");
                    var residues = feature.get("residues");
                    $(container).addClass("dna-residues");
                    container.appendChild( document.createTextNode( residues ) );
                    container.style.position = "absolute";
                    container.style.top = "-16px";
                    container.style.border = "2px solid #00CC00";
                    container.style.backgroundColor = "#AAFFAA";
                    featDiv.appendChild(container);
                }
            }
            else if ((ftype == "substitution")) {
                if ( scale == charSize.width ) {
                    var container  = document.createElement("div");
                    var residues = feature.get("residues");
                    $(container).addClass("dna-residues");
                    container.appendChild( document.createTextNode( residues ) );
                    container.style.position = "absolute";
                    container.style.top = "-16px";
                    container.style.border = "1px solid black";
                    container.style.backgroundColor = "#FFF506";
                    featDiv.appendChild(container);
                }
            }
        }
        seqNode.appendChild(featDiv);
        return featDiv;
    },

    /**
     *  overriding renderFeature to add event handling right-click context menu
     */
    renderFeature: function( feature, uniqueId, block, scale, labelScale, descriptionScale,
                             containerStart, containerEnd ) {
        var featDiv = this.inherited( arguments );

        if (featDiv && featDiv != null)  {
            this.annot_context_menu.bindDomNode(featDiv);
        }
        return featDiv;
    },

    reverseComplement: function(seq) {
        return this.reverse(this.complement(seq));
    },

    reverse: function(seq) {
        return seq.split("").reverse().join("");
    },

    complement: (function() {
                     var compl_rx   = /[ACGT]/gi;

                     // from bioperl: tr/acgtrymkswhbvdnxACGTRYMKSWHBVDNX/tgcayrkmswdvbhnxTGCAYRKMSWDVBHNX/
                     // generated with:
                     // perl -MJSON -E '@l = split "","acgtrymkswhbvdnxACGTRYMKSWHBVDNX"; print to_json({ map { my $in = $_; tr/acgtrymkswhbvdnxACGTRYMKSWHBVDNX/tgcayrkmswdvbhnxTGCAYRKMSWDVBHNX/; $in => $_ } @l})'
                     var compl_tbl  = {"S":"S","w":"w","T":"A","r":"y","a":"t","N":"N","K":"M","x":"x","d":"h","Y":"R","V":"B","y":"r","M":"K","h":"d","k":"m","C":"G","g":"c","t":"a","A":"T","n":"n","W":"W","X":"X","m":"k","v":"b","B":"V","s":"s","H":"D","c":"g","D":"H","b":"v","R":"Y","G":"C"};

                     var compl_func = function(m) { return compl_tbl[m] || SequenceTrack.nbsp; };
                     return function( seq ) {
                         return seq.replace( compl_rx, compl_func );
                     };
                 })(),

    // given the start and end coordinates, and the sequence bases, creates a div containing the sequence
    renderResidues: function ( seq ) {
        var container  = document.createElement("div");
        $(container).addClass("dna-residues");
        container.appendChild( document.createTextNode( seq ) );
        return container;
    },

    // end is ignored, assume all of seq is translated (except any extra bases at end)
    renderTranslation: function ( input_seq, offset, blockLength, reverse) {
            var CodonTable = this.translationTable;
        var verbose = false;
        // sequence of diagnostic block
        //    var verbose = (input_seq === "GTATATTTTGTACGTTAAAAATAAAAA" || input_seq === "GCGTATATTTTGTACGTTAAAAATAAA" );
        var seq;
        if (reverse) {
            seq = this.reverseComplement(input_seq);
            if (verbose) { console.log("revcomped, input: " + input_seq + ", output: " + seq); }
        }
        else  {
            seq = input_seq;
        }
        var container  = document.createElement("div");
        $(container).addClass("dna-residues");
        $(container).addClass("aa-residues");
        $(container).addClass("offset" + offset);
        var prefix = "";
        var suffix = "";
        for (var i=0; i<offset; i++) { prefix += SequenceTrack.nbsp; }
        for (var i=0; i<(2-offset); i++) { suffix += SequenceTrack.nbsp; }

        var extra_bases = (seq.length - offset) % 3;
        var dnaRes = seq.substring(offset, seq.length - extra_bases);
        if (verbose)  { console.log("to translate: " + dnaRes + ", length = " + dnaRes.length); }
        var aaResidues = dnaRes.replace(/(...)/gi,  function(codon) {
                                            var aa = CodonTable[codon];
                                            // if no mapping and blank in codon, return blank
                                            // if no mapping and no blank in codon,  return "?"
                                            if (!aa) {
                                                if (codon.indexOf(SequenceTrack.nbsp) >= 0) { aa = SequenceTrack.nbsp; }
                                                else  { aa = "?"; }
                                            }
                                            return prefix + aa + suffix;
                                            // return aa;
                                        } );
        var trimmedAaResidues = aaResidues.substring(0, blockLength);
        if (verbose)  { console.log("AaLength: " + aaResidues.length + ", trimmedAaLength = " + trimmedAaResidues.length); }
        aaResidues = trimmedAaResidues;
        if (reverse) {
            var revAaResidues = this.reverse(aaResidues);
            if (verbose) { console.log("reversing aa string, input: \"" + aaResidues + "\", output: \"" + revAaResidues + "\""); }
            aaResidues = revAaResidues;
            while (aaResidues.length < blockLength)  {
                aaResidues = SequenceTrack.nbsp + aaResidues;
            }
        }
        container.appendChild( document.createTextNode( aaResidues ) );
        return container;
    },

    onResiduesMouseDown: function(event)  {
        this.last_mousedown_event = event;
    },

    onFeatureMouseDown: function(event) {
        this.last_mousedown_event = event;
        var ftrack = this;
        if (ftrack.verbose_selection || ftrack.verbose_drag)  {
            console.log("SequenceTrack.onFeatureMouseDown called");
        }
        this.handleFeatureSelection(event);
    },

    initContextMenu: function() {
        var thisObj = this;
        thisObj.contextMenuItems = new Array();
        thisObj.annot_context_menu = new dijit.Menu({});

        var index = 0;
        if (this.annotTrack.permission & Permission.WRITE) {
            thisObj.annot_context_menu.addChild(new dijit.MenuItem( {
                label: "Delete",
                onClick: function() {
                    thisObj.deleteSelectedFeatures();
                }
            } ));
            thisObj.contextMenuItems["delete"] = index++;
        }
        thisObj.annot_context_menu.addChild(new dijit.MenuItem( {
            label: "Information",
            onClick: function(event) {
                thisObj.getInformation();
            }
        } ));
        thisObj.contextMenuItems["information"] = index++;

        thisObj.annot_context_menu.onOpen = function(event) {
                // keeping track of mousedown event that triggered annot_context_menu popup,
                //   because need mouse position of that event for some actions
                thisObj.annot_context_mousedown = thisObj.last_mousedown_event;
                // if (thisObj.permission & Permission.WRITE) { thisObj.updateMenu(); }
                dojo.forEach(this.getChildren(), function(item, idx, arr) {
                    if (item._setSelected)  { item._setSelected(false); }  // test for function existence first
                    if (item._onUnhover)  { item._onUnhover(); }  // test for function existence first
                });
        };

        /**
         *   context menu for right click on sequence residues
         */
        thisObj.residuesMenuItems = new Array();
        thisObj.residues_context_menu = new dijit.Menu({});
        index = 0;

        thisObj.residuesMenuItems["toggle_reverse_strand"] = index++;
        thisObj.residues_context_menu.addChild(new dijit.MenuItem( {
            label: "Toggle Reverse Strand",
            onClick: function(event) {
                thisObj.show_reverse_strand = ! thisObj.show_reverse_strand;
                thisObj.clearHighlightedBases();
                thisObj.changed();
            }
        } ));

        thisObj.residuesMenuItems["toggle_protein_translation"] = index++;
        thisObj.residues_context_menu.addChild(new dijit.MenuItem( {
            label: "Toggle Protein Translation",
            onClick: function(event) {
                thisObj.show_protein_translation = ! thisObj.show_protein_translation;
                thisObj.clearHighlightedBases();
                thisObj.changed();
            }
        } ));

        if (this.annotTrack.permission & Permission.WRITE) {

            thisObj.residues_context_menu.addChild(new dijit.MenuSeparator());
                thisObj.residues_context_menu.addChild(new dijit.MenuItem( {
                    label: "Create Genomic Insertion",
                    onClick: function() {
                        thisObj.freezeHighlightedBases = true;
                        thisObj.createGenomicInsertion();
                    }
                } ));
                thisObj.residuesMenuItems["create_insertion"] = index++;
                thisObj.residues_context_menu.addChild(new dijit.MenuItem( {
                    label: "Create Genomic Deletion",
                    onClick: function(event) {
                            thisObj.freezeHighlightedBases = true;
                            thisObj.createGenomicDeletion();
                    }
                } ));
                thisObj.residuesMenuItems["create_deletion"] = index++;

                thisObj.residues_context_menu.addChild(new dijit.MenuItem( {
                    label: "Create Genomic Substitution",
                    onClick: function(event) {
                            thisObj.freezeHighlightedBases = true;
                            thisObj.createGenomicSubstitution();
                    }
                } ));
                thisObj.residuesMenuItems["create_substitution"] = index++;
        }

        thisObj.residues_context_menu.onOpen = function(event) {
            thisObj.residues_context_mousedown = thisObj.last_mousedown_event;
            dojo.forEach(this.getChildren(), function(item, idx, arr) {
                 if (item._setSelected) { item._setSelected(false); }
                 if (item._onUnhover) { item._onUnhover(); }
            });

            thisObj.freezeHighlightedBases = true;
        };

        thisObj.residues_context_menu.onBlur = function() {
                thisObj.freezeHighlightedBases = false;
        };

        thisObj.residues_context_menu.onClose = function(event) {
                if (!thisObj.freezeHighlightedBases) {
                        thisObj.clearHighlightedBases();
                }
        };

        thisObj.annot_context_menu.startup();
        thisObj.residues_context_menu.startup();
    },

    getUniqueTrackName: function() {
        return this.name + "-" + this.refSeq.name;
    },

    createGenomicInsertion: function()  {
        var gcoord = this.getGenomeCoord(this.residues_context_mousedown);

        var content = this.createAddSequenceAlterationPanel("insertion", gcoord);
        this.annotTrack.openDialog("Add Insertion", content);
    },

    createGenomicDeletion: function()  {
        var gcoord = this.getGenomeCoord(this.residues_context_mousedown);

        var content = this.createAddSequenceAlterationPanel("deletion", gcoord);
        this.annotTrack.openDialog("Add Deletion", content);

    },

    createGenomicSubstitution: function()  {
        var gcoord = this.getGenomeCoord(this.residues_context_mousedown);
        var content = this.createAddSequenceAlterationPanel("substitution", gcoord);
        this.annotTrack.openDialog("Add Substitution", content);
    },

    deleteSelectedFeatures: function()  {
        var selected = this.selectionManager.getSelection();
        this.selectionManager.clearSelection();
        this.requestDeletion(selected);
    },

    requestDeletion: function(selected)  {
        var track = this;
        var features = "[ ";
        for (var i = 0; i < selected.length; ++i) {
                var annot = selected[i].feature;
                if (i > 0) {
                    features += ", ";
                }
                features += '{ "uniquename": "' + annot.id() + '" }';
        }
        features += "]";
        var postData = '{ "track": "' + track.annotTrack.getUniqueTrackName() + '", "features": ' + features + ', "operation": "delete_sequence_alteration" }';
        track.annotTrack.executeUpdateOperation(postData);
    },

    getInformation: function()  {
        var selected = this.selectionManager.getSelection();
        var annotTrack = this.getAnnotTrack();
        if (annotTrack) {
            annotTrack.getInformationForSelectedAnnotations(selected);
        }
    },

    /**
     * sequence alteration annotation ADD command received by a ChangeNotificationListener,
     *      so telling SequenceTrack to add to it's SeqFeatureStore
     */
    annotationsAddedNotification: function(responseFeatures)  {
        if (this.verbose_server_notification)  { console.log("SequenceTrack.annotationsAddedNotification() called"); }
        var track = this;
        // add to store
        for (var i = 0; i < responseFeatures.length; ++i) {
            var feat = JSONUtils.createJBrowseSequenceAlteration( responseFeatures[i] );
            var id = responseFeatures[i].uniquename;
            if (! this.store.getFeatureById(id))  {
                this.store.insert(feat);
            }
        }
        track.featureCount = track.storedFeatureCount();
        if (this.ALWAYS_SHOW || (this.SHOW_IF_FEATURES && this.featureCount > 0)) {
            this.show();
        }
        else {
            this.hide();
        }
        // track.hideAll();   shouldn't need to call hideAll() before changed() anymore
        track.changed();
    },

    /**
     * sequence alteration annotation DELETE command received by a ChangeNotificationListener,
     *      so telling SequenceTrack to remove from it's SeqFeatureStore
     */
    annotationsDeletedNotification: function(annots)  {
        if (this.verbose_server_notification)  {  console.log("SequenceTrack.removeSequenceAlterations() called"); }
        var track = this;
        // remove from SeqFeatureStore
        for (var i = 0; i < annots.length; ++i) {
            var id_to_delete = annots[i].uniquename;
            this.store.deleteFeatureById(id_to_delete);
        }
        track.featureCount = track.storedFeatureCount();
        if (this.ALWAYS_SHOW || (this.SHOW_IF_FEATURES && this.featureCount > 0)) {
            this.show();
        }
        else {
            this.hide();
        }
        // track.hideAll();   shouldn't need to call hideAll() before changed() anymore
        track.changed();
    },

    /*
     *  sequence alteration UPDATE command received by a ChangeNotificationListener
     *  currently handled as if receiving DELETE followed by ADD command
     */
    annotationsUpdatedNotification: function(annots)  {
        this.annotationsDeletedNotification(annots);
        this.annotationAddedNotification(annots);
    },

    storedFeatureCount: function(start, end)  {
        // get accurate count of features loaded (should do this within the XHR.load() function
        var track = this;
        if (start == undefined) {
            //            start = 0;
            start = track.refSeq.start;
        }
        if (end == undefined) {
            //            end = track.refSeq.length;
            end = track.refSeq.end;
        }
        var count = 0;
        track.store.getFeatures({ ref: track.refSeq.name, start: start, end: end}, function() { count++; });

        return count;
    },

    createAddSequenceAlterationPanel: function(type, gcoord) {
        var track = this;
        var content = dojo.create("div");
        var charWidth = 15;
        if (type == "deletion") {
            var deleteDiv = dojo.create("div", { }, content);
            var deleteLabel = dojo.create("label", { innerHTML: "Length", className: "sequence_alteration_input_label" }, deleteDiv);
            var deleteField = dojo.create("input", { type: "text", size: 10, className: "sequence_alteration_input_field" }, deleteDiv);
            var comment = dojo.create("div", { }, content);
            var comLabel = dojo.create("label", { innerHTML: "Comment", className: "sequence_alteration_comment_label" }, comment);
            var comField = dojo.create("input", { type: "text", size: charWidth, className: "sequence_alteration_comment_field" }, comment);
            $(deleteField).keydown(function(e) {
                var unicode = e.charCode || e.keyCode;
                var isBackspace = (unicode == 8);  // 8 = BACKSPACE
                if (unicode == 13) {  // 13 = ENTER/RETURN
                    addSequenceAlteration();
                }
                else {
                    var newchar = String.fromCharCode(unicode);
                    // only allow numeric chars and backspace
                    if (! (newchar.match(/[0-9]/) || isBackspace))  {
                        return false;
                    }
                }
            });
        }
        else {
            var plusDiv = dojo.create("div", { }, content);
            var minusDiv = dojo.create("div", { }, content);
            var plusLabel = dojo.create("label", { innerHTML: "+ strand", className: "sequence_alteration_input_label" }, plusDiv);
            var plusField = dojo.create("input", { type: "text", size: charWidth, className: "sequence_alteration_input_field" }, plusDiv);
            var minusLabel = dojo.create("label", { innerHTML: "- strand", className: "sequence_alteration_input_label" }, minusDiv);
            var minusField = dojo.create("input", { type: "text", size: charWidth, className: "sequence_alteration_input_field" }, minusDiv);
            var comment = dojo.create("div", { }, content);
            var comLabel = dojo.create("label", { innerHTML: " Comment", className: "sequence_alteration_comment_label" }, comment);
            var comField = dojo.create("input", { type: "text", size: charWidth, className: "sequence_alteration_comment_field" }, comment);

            $(plusField).keydown(function(e) {
                var unicode = e.charCode || e.keyCode;
                // ignoring delete key, doesn't do anything in input elements?
                var isBackspace = (unicode == 8);  // 8 = BACKSPACE
                if (unicode == 13) {  // 13 = ENTER/RETURN
                    addSequenceAlteration();
                }
                else {
                    var curval = e.srcElement.value;
                    var newchar = String.fromCharCode(unicode);
                    // only allow acgtnACGTN and backspace
                    //    (and acgtn are transformed to uppercase in CSS)
                    if (newchar.match(/[acgtnACGTN]/) || isBackspace)  {
                        // can't synchronize scroll position of two input elements,
                        // see http://stackoverflow.com/questions/10197194/keep-text-input-scrolling-synchronized
                        // but, if scrolling triggered (or potentially triggered), can hide other strand input element
                        // scrolling only triggered when length of input text exceeds character size of input element
                        if (isBackspace)  {
                            minusField.value = track.complement(curval.substring(0,curval.length-1));
                        }
                        else {
                            minusField.value = track.complement(curval + newchar);
                        }
                        if (curval.length > charWidth) {
                            $(minusDiv).hide();
                        }
                        else {
                            $(minusDiv).show();  // make sure is showing to bring back from a hide
                        }
                    }
                    else { return false; }  // prevents entering any chars other than ACGTN and backspace
                }
            });

            $(minusField).keydown(function(e) {
                var unicode = e.charCode || e.keyCode;
                // ignoring delete key, doesn't do anything in input elements?
                var isBackspace = (unicode == 8);  // 8 = BACKSPACE
                if (unicode == 13) {  // 13 = ENTER
                    addSequenceAlteration();
                }
                else {
                    var curval = e.srcElement.value;
                    var newchar = String.fromCharCode(unicode);
                    // only allow acgtnACGTN and backspace
                    //    (and acgtn are transformed to uppercase in CSS)
                    if (newchar.match(/[acgtnACGTN]/) || isBackspace)  {
                        // can't synchronize scroll position of two input elements,
                        // see http://stackoverflow.com/questions/10197194/keep-text-input-scrolling-synchronized
                        // but, if scrolling triggered (or potentially triggered), can hide other strand input element
                        // scrolling only triggered when length of input text exceeds character size of input element
                        if (isBackspace)  {
                            plusField.value = track.complement(curval.substring(0,curval.length-1));
                        }
                        else {
                            plusField.value = track.complement(curval + newchar);
                        }
                        if (curval.length > charWidth) {
                            $(plusDiv).hide();
                        }
                        else {
                            $(plusDiv).show();  // make sure is showing to bring back from a hide
                        }
                    }
                    else { return false; }  // prevents entering any chars other than ACGTN and backspace
                }
            });

        }
        var buttonDiv = dojo.create("div", { className: "sequence_alteration_button_div" }, content);
        var addButton = dojo.create("button", { innerHTML: "Add", className: "sequence_alteration_button" }, buttonDiv);

        var addSequenceAlteration = function() {
            var ok = true;
            var inputField;
            var commentField = comField;
            var inputField = ((type == "deletion") ? deleteField : plusField);
            // if (type == "deletion") { inputField = deleteField; }
            // else  { inputField = plusField; }
            var input = inputField.value.toUpperCase();
            var commentFieldValue = commentField.value;
            if (input.length == 0) {
                alert("Input cannot be empty for " + type);
                ok = false;
            }
            if (ok) {
                var input = inputField.value.toUpperCase();
                if (type == "deletion") {
                    if (input.match(/\D/)) {
                        alert("The length must be a number");
                        ok = false;
                    }
                    else {
                        input = parseInt(input);
                        if (input <= 0) {
                            alert("The length must be a positive number");
                            ok = false;
                        }
                    }
                }
                else {
                    if (input.match(/[^ACGTN]/)) {
                        alert("The sequence should only containg A, C, G, T, N");
                        ok = false;
                    }
                }
            }
            if (ok) {
                var fmin = gcoord;
                var fmax;
                if (type == "insertion") {
                    fmax = gcoord;
                }
                else if (type == "deletion") {
                    fmax = gcoord + parseInt(input);
                }
                else if (type == "substitution") {
                    fmax = gcoord + input.length;
                }
                if (track.storedFeatureCount(fmin, fmax == fmin ? fmin + 1 : fmax) > 0) {
                    alert("Cannot create overlapping sequence alterations");
                }
                else {
                    var feature = {
                        location: {
                            fmin: fmin,
                            fmax: fmax,
                            strand: 1
                        },
                        type: {
                            name: type,
                            cv: {
                                name: "sequence"
                            }
                        }
                    };
                    if (type != "deletion") {
                        feature.residues = input;
                    }
                    if (commentFieldValue.length != 0) {
                        feature.non_reserved_properties = [
                            {
                                tag: "justification",
                                value: commentFieldValue
                            }
                        ];
                    }
                    var features = [feature];
                    var postData = {
                        "track": track.annotTrack.getUniqueTrackName(),
                        "features": features,
                        "operation": "add_sequence_alteration",
                        "clientToken": track.annotTrack.getClientToken()
                    };
                    track.annotTrack.executeUpdateOperation(JSON.stringify(postData));
                    track.annotTrack.closeDialog();
                }
            }
        };

        dojo.connect(addButton, "onclick", null, function() {
                addSequenceAlteration();
        });

        return content;
    },

    handleError: function(response) {
        console.log("ERROR: ");
        console.log(response);  // in Firebug, allows retrieval of stack trace, jump to code, etc.
        console.log(response.stack);
        var error = eval('(' + response.responseText + ')');
        if (error && error.error) {
            alert(error.error);
            return;
        }
    },

    setAnnotTrack: function(annotTrack) {
        this.startStandby();
        // if (this.annotTrack)  { console.log("WARNING: SequenceTrack.setAnnotTrack called but annoTrack already set"); }
        var track = this;

        this.annotTrack = annotTrack;
        this.initContextMenu();

        this.loadTranslationTable().then(
                function() {
                    if(track.webapollo.getAnnotTrack().isLoggedIn()) {
                        track.loadSequenceAlterations().then(function() {
                            track.stopStandby();
                        });
                    }
                },
                function() {
                    track.stopStandby();
                });
    },

    /*
     * Given an element that contains text, highlights a given range of the text
     * If called repeatedly, removes highlighting from previous call first
     *
     * Assumes there is no additional markup within element, just a text node
     *    (would like to eventually rewrite to remove this restriction?  Possibly could use HTML Range manipulation,
     *        i.e. range.surroundContents() etc. )
     *
     * optionally specify what class to use to indicate highlighting (defaults to "text-highlight")
     *
     * adapted from http://stackoverflow.com/questions/9051369/highlight-substring-in-element
     */
    setTextHighlight: function (element, start, end, classname) {
        if (this.freezeHighlightedBases) {
            return;
        }
        if (! classname) { classname = "text-highlight"; }
        var item = $(element);
        var str = item.text();
        if (!str) {
            str = item.html();
            item.data("origHTML", str);
        }
        var highlighted_base=str.substr(start, end - start + 1);
        if(highlighted_base==SequenceTrack.nbsp) {
            return;
        }
        str = str.substr(0, start) +
            '<span class="' + classname + '">' +
            str.substr(start, end - start + 1) +
            '</span>' +
            str.substr(end + 1);
        item.html(str);
    },

    /*
     *  remove highlighting added with setTextHighlight
     */
    removeTextHighlight: function(element) {
        if (this.freezeHighlightedBases) {
            return;
        }
        var item = $(element);
        var str = item.text();
        if (str) {
            item.html(str);
        }
    },

    clearHighlightedBases: function() {
        this.freezeHighlightedBases = false;
        this.removeTextHighlight(this.lastHighlightedForwardDNA);
        if (this.lastHighlightedReverseDNA) {
            this.removeTextHighlight(this.lastHighlightedReverseDNA);
        }
    },

    getAnnotTrack: function()  {
        if (this.annotTrack)  {
            return this.annotTrack;
        }
        else  {
            var tracks = this.gview.tracks;
            for (var i = 0; i < tracks.length; i++)  {
                // should be doing instanceof here, but class setup is not being cooperative
                if (tracks[i].isWebApolloAnnotTrack)  {
                    this.annotTrack = tracks[i];
                    this.annotTrack.seqTrack = this;
                    break;
                }
            }
        }
        return this.annotTrack;
    },

    hide: function() {
        this.inherited(arguments);
        var annotTrack = this.getAnnotTrack();
        if (annotTrack && !annotTrack.isLoggedIn()) {
            dojo.style(this.genomeView.pinUnderlay, "display", "none");
        }
    }

});

    SequenceTrack.nbsp = String.fromCharCode(160);
    return SequenceTrack;
});


text: Main site for ENEUE


text:
if (typeof exports === "undefined") var exports = {};

var InputQueue = [];

exports.gameLoop = function(canvas) {
    var fps       = 30;
    var timescale = 1.0;
    var gametime  = new GameTime(fps, timescale);

    var blobs = [
        new PlayerBlob(1, new Position(100, 100), new Velocity(0, 5), 35),
        new Blob(new Position(300, 230), new Velocity(5, 0), 40),
        new Blob(new Position(300, 100), new Velocity(0, 5), 10),
        new Blob(new Position(540, 200), new Velocity(5, 0), 40)
    ];
    var bounds = new BouncyBounds(0, 0, 640, 480);
    var world  = new RunningGameState(new Game(blobs, bounds, new MassTransformationCollision()));

    return setInterval(function() {
        var input = new InputHandler(InputQueue.slice());
        InputQueue = [];
        world = world.handle(input, gametime);
        draw(world, canvas);
    }, 1000/fps);
}

exports.input = function(x, y) {
    InputQueue.push({position: new Position(x, y), player: 1});
}

function draw(world, canvas) {
    // clear canvas
    canvas.width = canvas.width;

    var ctx = canvas.getContext("2d");

    // Write status message...
    ctx.font = "bold 12px sans-serif";
    ctx.fillStyle = "#000";
    ctx.textBaseline = "top";
    ctx.fillText(world.status(), 0, 0);

    for (var i = 0; i < world.game.blobs.length; i++) {
        var blob = world.game.blobs[i];

        ctx.beginPath();
        ctx.arc(blob.position.x, blob.position.y, blob.radius, 0, Math.PI*2, false);

        ctx.fillStyle = blob.player? "#777" : "#000";
        ctx.fill();
        ctx.closePath();
    }
}


text:
from transitfeed import Loader, Schedule
from rdflib import Graph, URIRef, Literal, BNode, Namespace
import argparse

parser = argparse.ArgumentParser(description='Convert GTFS data set to RDF or ASP.')
parser.add_argument('gtfs_path', help='path to the GTFS data set')
parser.add_argument('output_file', type=argparse.FileType('w'), help='output file')
parser.add_argument('-f', '--format', choices=['asp', 'xml', 'turtle', 'nt'], default='turtle')
parser.add_argument('-l', '--limit', type=int, default=-1, help='maximum number of trips to convert')

args = parser.parse_args()

sched = Loader(args.gtfs_path).Load()
asp = False

if args.format == 'asp':
    asp = True

g = Graph()

ns = Namespace('http://kr.tuwien.ac.at/dhsr/')

for stop in sched.GetStopList():
    if asp:
        args.output_file.write('hasName(stop' + stop.stop_id.replace('-', '') + ', "' + stop.stop_name + '").\n')
    else:
        s = ns['stop/' + stop.stop_id]
        g.set((s, ns.hasName, Literal(stop.stop_name)))

for route in sched.GetRouteList():
    if asp:
        args.output_file.write('hasName(route' + route.route_id + ', "' + route.route_short_name + '").\n')
        args.output_file.write('hasType(route' + route.route_id + ', ' + str(route.route_type) + ').\n')
    else:
        r = ns['route/' + route.route_id]
        g.set((r, ns.hasName, Literal(route.route_short_name)))
        g.set((r, ns.hasType, Literal(route.route_type)))

i = 0

for trip in sched.GetTripList():
    if i == args.limit:
        break
    i += 1

    if asp:
        args.output_file.write('isonRoute(trip' + trip.trip_id + ', route' + trip.route_id + ').\n')
        args.output_file.write('hasDirection(trip' + trip.trip_id + ', ' + trip.direction_id + ').\n')
        if trip.wheelchair_accessible != None:
            args.output_file.write('isAccessible(trip' + trip.trip_id + ', ' + str(trip.wheelchair_accessible) + ').\n')
    else:
        t = ns['trip/' + trip.trip_id]
        g.set((t, ns.isonRoute, ns['route/' + trip.route_id]))
        g.set((t, ns.hasDirection, Literal(trip.direction_id)))
        g.set((t, ns.isAccessible, Literal(trip.wheelchair_accessible)))

    for stoptime in trip.GetStopTimes():
        if asp:
            st = str(trip.trip_id) + str(stoptime.stop_sequence)
            args.output_file.write('hasStt(trip' + trip.trip_id + ', stoptime' + st + ').\n')
            args.output_file.write('atStop(stoptime' + st + ', stop' + stoptime.stop_id + ').\n')
            args.output_file.write('hasArrtime(stoptime' + st + ', ' + str(stoptime.arrival_secs) + ').\n')
            args.output_file.write('hasDeptime(stoptime' + st + ', ' + str(stoptime.departure_secs) + ').\n')
            args.output_file.write('isSeq(stoptime' + st + ', ' + str(stoptime.stop_sequence) + ').\n')
        else:
            st = ns['stoptime/' + str(trip.trip_id) + str(stoptime.stop_sequence)]
            g.add((t, ns.hasStt, st))
            g.set((st, ns.atStop, ns['stop/' + stoptime.stop_id]))
            g.set((st, ns.hasArrtime, Literal(stoptime.arrival_secs)))
            g.set((st, ns.hasDeptime, Literal(stoptime.departure_secs)))
            g.set((st, ns.isSeq, Literal(stoptime.stop_sequence)))

if not asp:
    args.output_file.write(g.serialize(format = args.format))
    g.close()


text:
package com.ansorgit.plugins.bash.lang.psi.api.heredoc;

/**
 * @author jansorg
 */
public interface BashHereDocEndMarker extends BashHereDocMarker {
}


text:
<?xml version="1.0" encoding="utf-8"?>
<resources>

    <declare-styleable name="CircleImageView">
        <attr name="c_border_color" format="color"></attr>
        <attr name="c_border_width" format="dimension"></attr>
    </declare-styleable>
</resources>


text:
/**
 */
package kieker.model.collection.impl;

import kieker.model.analysismodel.type.OperationType;

import kieker.model.collection.CollectionPackage;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.common.util.BasicEMap;
import org.eclipse.emf.common.util.EMap;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;

/**
 *
 * An implementation of the model object 'Name To Operation Map'.
 *
 *

 * The following features are implemented:
 *

 *

 *
{@link kieker.model.collection.impl.NameToOperationMapImpl#getTypedKey Key}

 *
{@link kieker.model.collection.impl.NameToOperationMapImpl#getTypedValue Value}

 *

 *
 * @generated
 */
public class NameToOperationMapImpl extends MinimalEObjectImpl.Container implements BasicEMap.Entry<String,OperationType> {
	/**
	 * The default value of the '{@link #getTypedKey() Key}' attribute.
	 *
	 *
	 * @see #getTypedKey()
	 * @generated
	 * @ordered
	 */
	protected static final String KEY_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getTypedKey() Key}' attribute.
	 *
	 *
	 * @see #getTypedKey()
	 * @generated
	 * @ordered
	 */
	protected String key = KEY_EDEFAULT;

	/**
	 * The cached value of the '{@link #getTypedValue() Value}' reference.
	 *
	 *
	 * @see #getTypedValue()
	 * @generated
	 * @ordered
	 */
	protected OperationType value;

	/**
	 *
	 *
	 * @generated
	 */
	protected NameToOperationMapImpl() {
		super();
	}

	/**
	 *
	 *
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return CollectionPackage.Literals.NAME_TO_OPERATION_MAP;
	}

	/**
	 *
	 *
	 * @generated
	 */
	public String getTypedKey() {
		return key;
	}

	/**
	 *
	 *
	 * @generated
	 */
	public void setTypedKey(String newKey) {
		String oldKey = key;
		key = newKey;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, CollectionPackage.NAME_TO_OPERATION_MAP__KEY, oldKey, key));
	}

	/**
	 *
	 *
	 * @generated
	 */
	public OperationType getTypedValue() {
		if (value != null && value.eIsProxy()) {
			InternalEObject oldValue = (InternalEObject)value;
			value = (OperationType)eResolveProxy(oldValue);
			if (value != oldValue) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, CollectionPackage.NAME_TO_OPERATION_MAP__VALUE, oldValue, value));
			}
		}
		return value;
	}

	/**
	 *
	 *
	 * @generated
	 */
	public OperationType basicGetTypedValue() {
		return value;
	}

	/**
	 *
	 *
	 * @generated
	 */
	public void setTypedValue(OperationType newValue) {
		OperationType oldValue = value;
		value = newValue;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, CollectionPackage.NAME_TO_OPERATION_MAP__VALUE, oldValue, value));
	}

	/**
	 *
	 *
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case CollectionPackage.NAME_TO_OPERATION_MAP__KEY:
				return getTypedKey();
			case CollectionPackage.NAME_TO_OPERATION_MAP__VALUE:
				if (resolve) return getTypedValue();
				return basicGetTypedValue();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 *
	 *
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case CollectionPackage.NAME_TO_OPERATION_MAP__KEY:
				setTypedKey((String)newValue);
				return;
			case CollectionPackage.NAME_TO_OPERATION_MAP__VALUE:
				setTypedValue((OperationType)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 *
	 *
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case CollectionPackage.NAME_TO_OPERATION_MAP__KEY:
				setTypedKey(KEY_EDEFAULT);
				return;
			case CollectionPackage.NAME_TO_OPERATION_MAP__VALUE:
				setTypedValue((OperationType)null);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 *
	 *
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case CollectionPackage.NAME_TO_OPERATION_MAP__KEY:
				return KEY_EDEFAULT == null ? key != null : !KEY_EDEFAULT.equals(key);
			case CollectionPackage.NAME_TO_OPERATION_MAP__VALUE:
				return value != null;
		}
		return super.eIsSet(featureID);
	}

	/**
	 *
	 *
	 * @generated
	 */
	@Override
	public String toString() {
		if (eIsProxy()) return super.toString();

		StringBuilder result = new StringBuilder(super.toString());
		result.append(" (key: ");
		result.append(key);
		result.append(')');
		return result.toString();
	}

	/**
	 *
	 *
	 * @generated
	 */
	protected int hash = -1;

	/**
	 *
	 *
	 * @generated
	 */
	@Override
	public int getHash() {
		if (hash == -1) {
			Object theKey = getKey();
			hash = (theKey == null ? 0 : theKey.hashCode());
		}
		return hash;
	}

	/**
	 *
	 *
	 * @generated
	 */
	@Override
	public void setHash(int hash) {
		this.hash = hash;
	}

	/**
	 *
	 *
	 * @generated
	 */
	@Override
	public String getKey() {
		return getTypedKey();
	}

	/**
	 *
	 *
	 * @generated
	 */
	@Override
	public void setKey(String key) {
		setTypedKey(key);
	}

	/**
	 *
	 *
	 * @generated
	 */
	@Override
	public OperationType getValue() {
		return getTypedValue();
	}

	/**
	 *
	 *
	 * @generated
	 */
	@Override
	public OperationType setValue(OperationType value) {
		OperationType oldValue = getValue();
		setTypedValue(value);
		return oldValue;
	}

	/**
	 *
	 *
	 * @generated
	 */
	@SuppressWarnings("unchecked")
	public EMap<String, OperationType> getEMap() {
		EObject container = eContainer();
		return container == null ? null : (EMap<String, OperationType>)container.eGet(eContainmentFeature());
	}

} //NameToOperationMapImpl


text:
package ua.romenskyi.webapp.shopping.business;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import ua.romenskyi.webapp.shopping.data.DefaultDAO;
import ua.romenskyi.webapp.shopping.data.ObjectNotExistsException;
import ua.romenskyi.webapp.shopping.domain.EntityInterface;
import ua.romenskyi.webapp.shopping.domain.UniqueNamedEntityInterface;

/**
 * @author dmytro.romenskyi - Jun 28, 2016
 *
 */
@Service
public class DefaultService<ENTITY extends EntityInterface> implements DefaultServiceInterface<ENTITY> {

	@Autowired
	private DefaultDAO dao;

	protected DefaultDAO getDAO() {
		return dao;
	}

	@Override
	@Transactional
	public boolean exists(Class<ENTITY> clazz, Long key) {
		return getDAO().exists(clazz, key);
	}

	@Override
	@Transactional
	public ENTITY get(Class<ENTITY> clazz, Long key) throws ResourceNotFoundException {
		ENTITY entity = null;
		try {
			entity = getDAO().getByKey(clazz, key);
		} catch (ObjectNotExistsException one) {
			throw new ResourceNotFoundException(one.getMessage(), one);
		}

		return entity;
	}

	@Override
	@Transactional
	public List<ENTITY> list(Class<ENTITY> clazz) {
		return getDAO().getAll(clazz);
	}

	@Override
	@Transactional
	public Long add(ENTITY entity) throws ResourceAlreadyExistsException {

		if(entity instanceof UniqueNamedEntityInterface) {
			UniqueNamedEntityInterface unei = (UniqueNamedEntityInterface) entity;
			try {
				getDAO().getKeyByName(unei.getClass(), unei.getName());
			} catch (ObjectNotExistsException e) {
				return getDAO().create(entity);
			}

			throw new ResourceAlreadyExistsException(entity.getClass().getSimpleName() + " entity with provided name already exists: " + unei.getName());
		}

		return getDAO().create(entity);
	}

	@Override
	@Transactional
	public boolean update(ENTITY entity) throws ResourceNotFoundException {
		try {
			return getDAO().update(entity);
		} catch (ObjectNotExistsException e) {
			throw new ResourceNotFoundException(e.getMessage(), e);
		}
	}
}


text:
package no.stelar7.api.r4j.basic.constants.types.lol;

import no.stelar7.api.r4j.basic.constants.types.CodedEnum;

import java.util.Optional;
import java.util.stream.Stream;

public enum LeaguePositionType implements CodedEnum
{
    /**
     * MASTER+ rank gets this for some reason?
     */
    APEX,
    /**
     * Top lane
     */
    TOP,
    /**
     * Jungle
     */
    JUNGLE,
    /**
     * Mid lane
     */
    MIDDLE,
    /**
     * Bottom lane
     */
    BOTTOM,
    /**
     * Support
     */
    UTILITY,
    /**
     * Not a positional queue
     */
    NONE;

    /**
     * Returns an LeaguePositionType from the provided value
     *
     * @param type the type to check
     * @return LeaguePositionType
     */
    public Optional<LeaguePositionType> getFromCode(final String type)
    {
        return Stream.of(LeaguePositionType.values()).filter(t -> t.name().equalsIgnoreCase(type)).findFirst();
    }

    @Override
    public String prettyName()
    {
        switch (this)
        {
            case APEX:
                return "Apex";
            case TOP:
                return "Top";
            case JUNGLE:
                return "Jungle";
            case MIDDLE:
                return "Middle";
            case BOTTOM:
                return "Bottom";
            case UTILITY:
                return "Utility";
            case NONE:
                return "None";
            default:
                return "This enum does not have a pretty name";
        }
    }

    /**
     * The value used to map strings to objects
     *
     * @return String
     */
    public String getCode()
    {
        return this.name();
    }
}


text:
First stage of sync or any update of files

#### Request

Content-Type: application/json

**JSON example**

* [Init](../backup/init.json)
* [Update](../backup/update.json)

#### Response
    {
        "code": "1",
        "status": "success",
        "description": "Empty",
        "response": []
    }