text:
.class public final Landroid/support/v4/media/session/MediaControllerCompat;
.super Ljava/lang/Object;
.source "MediaControllerCompat.java"

# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Landroid/support/v4/media/session/MediaControllerCompat$1;,
        Landroid/support/v4/media/session/MediaControllerCompat$TransportControlsApi21;,
        Landroid/support/v4/media/session/MediaControllerCompat$MediaControllerImplApi21;,
        Landroid/support/v4/media/session/MediaControllerCompat$MediaControllerImplBase;,
        Landroid/support/v4/media/session/MediaControllerCompat$MediaControllerImpl;,
        Landroid/support/v4/media/session/MediaControllerCompat$PlaybackInfo;,
        Landroid/support/v4/media/session/MediaControllerCompat$TransportControls;,
        Landroid/support/v4/media/session/MediaControllerCompat$Callback;
    }
.end annotation

# instance fields
.field private final mImpl:Landroid/support/v4/media/session/MediaControllerCompat$MediaControllerImpl;

# direct methods
.method public constructor <init>(Landroid/content/Context;Landroid/support/v4/media/session/MediaSessionCompat$Token;)V
    .locals 2
    .param p1, "context"    # Landroid/content/Context;
    .param p2, "sessionToken"    # Landroid/support/v4/media/session/MediaSessionCompat$Token;
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Landroid/os/RemoteException;
        }
    .end annotation

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

    .line 72
    if-nez p2, :cond_0

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

    const-string v1, "sessionToken must not be null"

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

    throw v0

    .line 76
    :cond_0
    sget v0, Landroid/os/Build$VERSION;->SDK_INT:I

    const/16 v1, 0x15

    if-lt v0, v1, :cond_1

    .line 77
    new-instance v0, Landroid/support/v4/media/session/MediaControllerCompat$MediaControllerImplApi21;

    invoke-direct {v0, p1, p2}, Landroid/support/v4/media/session/MediaControllerCompat$MediaControllerImplApi21;-><init>(Landroid/content/Context;Landroid/support/v4/media/session/MediaSessionCompat$Token;)V

    iput-object v0, p0, Landroid/support/v4/media/session/MediaControllerCompat;->mImpl:Landroid/support/v4/media/session/MediaControllerCompat$MediaControllerImpl;

    .line 81
    :goto_0
    return-void

    .line 79
    :cond_1
    new-instance v0, Landroid/support/v4/media/session/MediaControllerCompat$MediaControllerImplBase;

    invoke-direct {v0}, Landroid/support/v4/media/session/MediaControllerCompat$MediaControllerImplBase;-><init>()V

    iput-object v0, p0, Landroid/support/v4/media/session/MediaControllerCompat;->mImpl:Landroid/support/v4/media/session/MediaControllerCompat$MediaControllerImpl;

    goto :goto_0
.end method

.method public constructor <init>(Landroid/content/Context;Landroid/support/v4/media/session/MediaSessionCompat;)V
    .locals 2
    .param p1, "context"    # Landroid/content/Context;
    .param p2, "session"    # Landroid/support/v4/media/session/MediaSessionCompat;

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

    .line 52
    if-nez p2, :cond_0

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

    const-string v1, "session must not be null"

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

    throw v0

    .line 56
    :cond_0
    sget v0, Landroid/os/Build$VERSION;->SDK_INT:I

    const/16 v1, 0x15

    if-lt v0, v1, :cond_1

    .line 57
    new-instance v0, Landroid/support/v4/media/session/MediaControllerCompat$MediaControllerImplApi21;

    invoke-direct {v0, p1, p2}, Landroid/support/v4/media/session/MediaControllerCompat$MediaControllerImplApi21;-><init>(Landroid/content/Context;Landroid/support/v4/media/session/MediaSessionCompat;)V

    iput-object v0, p0, Landroid/support/v4/media/session/MediaControllerCompat;->mImpl:Landroid/support/v4/media/session/MediaControllerCompat$MediaControllerImpl;

    .line 61
    :goto_0
    return-void

    .line 59
    :cond_1
    new-instance v0, Landroid/support/v4/media/session/MediaControllerCompat$MediaControllerImplBase;

    invoke-direct {v0}, Landroid/support/v4/media/session/MediaControllerCompat$MediaControllerImplBase;-><init>()V

    iput-object v0, p0, Landroid/support/v4/media/session/MediaControllerCompat;->mImpl:Landroid/support/v4/media/session/MediaControllerCompat$MediaControllerImpl;

    goto :goto_0
.end method

# virtual methods
.method public dispatchMediaButtonEvent(Landroid/view/KeyEvent;)Z
    .locals 2
    .param p1, "keyEvent"    # Landroid/view/KeyEvent;

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

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

    const-string v1, "KeyEvent may not be null"

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

    throw v0

    .line 103
    :cond_0
    iget-object v0, p0, Landroid/support/v4/media/session/MediaControllerCompat;->mImpl:Landroid/support/v4/media/session/MediaControllerCompat$MediaControllerImpl;

    invoke-interface {v0, p1}, Landroid/support/v4/media/session/MediaControllerCompat$MediaControllerImpl;->dispatchMediaButtonEvent(Landroid/view/KeyEvent;)Z

    move-result v0

    return v0
.end method

.method public getMediaController()Ljava/lang/Object;
    .locals 1

    .prologue
    .line 218
    iget-object v0, p0, Landroid/support/v4/media/session/MediaControllerCompat;->mImpl:Landroid/support/v4/media/session/MediaControllerCompat$MediaControllerImpl;

    invoke-interface {v0}, Landroid/support/v4/media/session/MediaControllerCompat$MediaControllerImpl;->getMediaController()Ljava/lang/Object;

    move-result-object v0

    return-object v0
.end method

.method public getMetadata()Landroid/support/v4/media/MediaMetadataCompat;
    .locals 1

    .prologue
    .line 121
    iget-object v0, p0, Landroid/support/v4/media/session/MediaControllerCompat;->mImpl:Landroid/support/v4/media/session/MediaControllerCompat$MediaControllerImpl;

    invoke-interface {v0}, Landroid/support/v4/media/session/MediaControllerCompat$MediaControllerImpl;->getMetadata()Landroid/support/v4/media/MediaMetadataCompat;

    move-result-object v0

    return-object v0
.end method

.method public getPlaybackInfo()Landroid/support/v4/media/session/MediaControllerCompat$PlaybackInfo;
    .locals 1

    .prologue
    .line 148
    iget-object v0, p0, Landroid/support/v4/media/session/MediaControllerCompat;->mImpl:Landroid/support/v4/media/session/MediaControllerCompat$MediaControllerImpl;

    invoke-interface {v0}, Landroid/support/v4/media/session/MediaControllerCompat$MediaControllerImpl;->getPlaybackInfo()Landroid/support/v4/media/session/MediaControllerCompat$PlaybackInfo;

    move-result-object v0

    return-object v0
.end method

.method public getPlaybackState()Landroid/support/v4/media/session/PlaybackStateCompat;
    .locals 1

    .prologue
    .line 112
    iget-object v0, p0, Landroid/support/v4/media/session/MediaControllerCompat;->mImpl:Landroid/support/v4/media/session/MediaControllerCompat$MediaControllerImpl;

    invoke-interface {v0}, Landroid/support/v4/media/session/MediaControllerCompat$MediaControllerImpl;->getPlaybackState()Landroid/support/v4/media/session/PlaybackStateCompat;

    move-result-object v0

    return-object v0
.end method

.method public getRatingType()I
    .locals 1

    .prologue
    .line 139
    iget-object v0, p0, Landroid/support/v4/media/session/MediaControllerCompat;->mImpl:Landroid/support/v4/media/session/MediaControllerCompat$MediaControllerImpl;

    invoke-interface {v0}, Landroid/support/v4/media/session/MediaControllerCompat$MediaControllerImpl;->getRatingType()I

    move-result v0

    return v0
.end method

.method public getTransportControls()Landroid/support/v4/media/session/MediaControllerCompat$TransportControls;
    .locals 1

    .prologue
    .line 89
    iget-object v0, p0, Landroid/support/v4/media/session/MediaControllerCompat;->mImpl:Landroid/support/v4/media/session/MediaControllerCompat$MediaControllerImpl;

    invoke-interface {v0}, Landroid/support/v4/media/session/MediaControllerCompat$MediaControllerImpl;->getTransportControls()Landroid/support/v4/media/session/MediaControllerCompat$TransportControls;

    move-result-object v0

    return-object v0
.end method

.method public registerCallback(Landroid/support/v4/media/session/MediaControllerCompat$Callback;)V
    .locals 1
    .param p1, "callback"    # Landroid/support/v4/media/session/MediaControllerCompat$Callback;

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

    invoke-virtual {p0, p1, v0}, Landroid/support/v4/media/session/MediaControllerCompat;->registerCallback(Landroid/support/v4/media/session/MediaControllerCompat$Callback;Landroid/os/Handler;)V

    .line 159
    return-void
.end method

.method public registerCallback(Landroid/support/v4/media/session/MediaControllerCompat$Callback;Landroid/os/Handler;)V
    .locals 2
    .param p1, "callback"    # Landroid/support/v4/media/session/MediaControllerCompat$Callback;
    .param p2, "handler"    # Landroid/os/Handler;

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

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

    const-string v1, "callback cannot be null"

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

    throw v0

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

    .line 174
    new-instance p2, Landroid/os/Handler;

    .end local p2    # "handler":Landroid/os/Handler;
    invoke-direct {p2}, Landroid/os/Handler;-><init>()V

    .line 176
    .restart local p2    # "handler":Landroid/os/Handler;
    :cond_1
    iget-object v0, p0, Landroid/support/v4/media/session/MediaControllerCompat;->mImpl:Landroid/support/v4/media/session/MediaControllerCompat$MediaControllerImpl;

    invoke-interface {v0, p1, p2}, Landroid/support/v4/media/session/MediaControllerCompat$MediaControllerImpl;->registerCallback(Landroid/support/v4/media/session/MediaControllerCompat$Callback;Landroid/os/Handler;)V

    .line 177
    return-void
.end method

.method public sendCommand(Ljava/lang/String;Landroid/os/Bundle;Landroid/os/ResultReceiver;)V
    .locals 2
    .param p1, "command"    # Ljava/lang/String;
    .param p2, "params"    # Landroid/os/Bundle;
    .param p3, "cb"    # Landroid/os/ResultReceiver;

    .prologue
    .line 202
    invoke-static {p1}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z

    move-result v0

    if-eqz v0, :cond_0

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

    const-string v1, "command cannot be null or empty"

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

    throw v0

    .line 205
    :cond_0
    iget-object v0, p0, Landroid/support/v4/media/session/MediaControllerCompat;->mImpl:Landroid/support/v4/media/session/MediaControllerCompat$MediaControllerImpl;

    invoke-interface {v0, p1, p2, p3}, Landroid/support/v4/media/session/MediaControllerCompat$MediaControllerImpl;->sendCommand(Ljava/lang/String;Landroid/os/Bundle;Landroid/os/ResultReceiver;)V

    .line 206
    return-void
.end method

.method public unregisterCallback(Landroid/support/v4/media/session/MediaControllerCompat$Callback;)V
    .locals 2
    .param p1, "callback"    # Landroid/support/v4/media/session/MediaControllerCompat$Callback;

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

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

    const-string v1, "callback cannot be null"

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

    throw v0

    .line 189
    :cond_0
    iget-object v0, p0, Landroid/support/v4/media/session/MediaControllerCompat;->mImpl:Landroid/support/v4/media/session/MediaControllerCompat$MediaControllerImpl;

    invoke-interface {v0, p1}, Landroid/support/v4/media/session/MediaControllerCompat$MediaControllerImpl;->unregisterCallback(Landroid/support/v4/media/session/MediaControllerCompat$Callback;)V

    .line 190
    return-void
.end method


text:
package ch.ivyteam.ivy.maven.engine;

import java.io.File;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import org.apache.commons.io.FileUtils;
import org.apache.commons.io.filefilter.IOFileFilter;
import org.apache.commons.io.filefilter.SuffixFileFilter;
import org.apache.commons.io.filefilter.WildcardFileFilter;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.plugin.logging.Log;
import org.apache.maven.project.MavenProject;
import org.apache.maven.repository.RepositorySystem;

import ch.ivyteam.ivy.maven.util.ClasspathJar;
import ch.ivyteam.ivy.maven.util.SharedFile;

/**
 * Factory that provides an {@link URLClassLoader} for ivy Engine class access.
 * This makes invocation of engine parts possible without starting a new java
 * process.
 *
 * @author Reguel Wermelinger
 * @since 25.09.2014
 */
public class EngineClassLoaderFactory {
  public interface OsgiDir {
    String INSTALL_AREA = "system";
    String PLUGINS = INSTALL_AREA + "/plugins";
    String LIB_BOOT = "lib/boot";
  }

  /** must match version in pom.xml */
  private static final String SLF4J_VERSION = "1.7.36";

  private static final List<String> ENGINE_LIB_DIRECTORIES = Arrays.asList(
          OsgiDir.INSTALL_AREA + "/" + OsgiDir.LIB_BOOT,
          OsgiDir.PLUGINS,
          OsgiDir.INSTALL_AREA + "/configuration/org.eclipse.osgi", // unpacked
                                                                    // jars from
                                                                    // OSGI
                                                                    // bundles
          "webapps" + File.separator + "ivy" + File.separator + "WEB-INF" + File.separator + "lib");

  private MavenContext maven;

  public EngineClassLoaderFactory(MavenContext mavenContext) {
    this.maven = mavenContext;
  }

  public URLClassLoader createEngineClassLoader(File engineDirectory) throws IOException {
    List<File> osgiClasspath = getOsgiBootstrapClasspath(engineDirectory);
    addToClassPath(osgiClasspath, new File(engineDirectory, OsgiDir.PLUGINS),
            new WildcardFileFilter("org.eclipse.osgi_*.jar"));
    osgiClasspath.addAll(0, getSlf4jJars());
    if (maven.log.isDebugEnabled()) {
      maven.log.debug("Configuring OSGi engine classpath:");
      osgiClasspath.stream().forEach(file -> maven.log.debug(" + " + file.getAbsolutePath()));
    }
    return new URLClassLoader(toUrls(osgiClasspath));
  }

  public List<File> getSlf4jJars() {
    return List.of(
            maven.getJar("org.slf4j", "slf4j-api", SLF4J_VERSION),
            maven.getJar("org.slf4j", "slf4j-simple", SLF4J_VERSION),
            maven.getJar("org.slf4j", "log4j-over-slf4j", SLF4J_VERSION));
  }

  public static List<File> getOsgiBootstrapClasspath(File engineDirectory) {
    if (engineDirectory == null || !engineDirectory.isDirectory()) {
      throw new RuntimeException("The engineDirectory is missing: " + engineDirectory);
    }
    List<File> classPathFiles = new ArrayList<>();
    addToClassPath(classPathFiles, new File(engineDirectory, OsgiDir.INSTALL_AREA + "/" + OsgiDir.LIB_BOOT),
            new SuffixFileFilter(".jar"));
    return classPathFiles;
  }

  private static void addToClassPath(List<File> classPathFiles, File dir, IOFileFilter fileFilter) {
    if (dir.isDirectory()) {
      for (File jar : FileUtils.listFiles(dir, fileFilter, null)) {
        classPathFiles.add(jar);
      }
    }
  }

  public static List<File> getIvyEngineClassPathFiles(File engineDirectory) {
    List<File> classPathFiles = new ArrayList<>();
    for (String libDirPath : ENGINE_LIB_DIRECTORIES) {
      File jarDir = new File(engineDirectory, libDirPath + File.separator);
      if (!jarDir.isDirectory()) {
        continue;
      }
      for (File jar : FileUtils.listFiles(jarDir, new String[] {"jar"}, true)) {
        classPathFiles.add(jar);
      }
    }
    return classPathFiles;
  }

  public void writeEngineClasspathJar(File engineDirectory) throws IOException {
    writeEngineClasspathJar(getIvyEngineClassPathFiles(engineDirectory));
  }

  private void writeEngineClasspathJar(List<File> ivyEngineClassPathFiles) throws IOException {
    File classPathJar = new SharedFile(maven.project).getEngineClasspathJar();
    ClasspathJar jar = new ClasspathJar(classPathJar);
    jar.setMainClass("ch.ivyteam.ivy.server.ServerLauncher");
    jar.createFileEntries(ivyEngineClassPathFiles);
  }

  private static URL[] toUrls(List<File> ivyEngineClassPathFiles) throws MalformedURLException {
    List<URL> classPathUrls = new ArrayList<>();
    for (File file : ivyEngineClassPathFiles) {
      classPathUrls.add(new URL(file.toURI().toASCIIString()));
    }
    return classPathUrls.toArray(new URL[classPathUrls.size()]);
  }

  public static class MavenContext {
    private final RepositorySystem repoSystem;
    private final ArtifactRepository localRepository;
    private final MavenProject project;
    private final Log log;

    public MavenContext(RepositorySystem repoSystem, ArtifactRepository localRepository, MavenProject project,
            Log log) {
      this.repoSystem = repoSystem;
      this.localRepository = localRepository;
      this.project = project;
      this.log = log;
    }

    public File getJar(String groupId, String artifactId, String version) {
      Artifact artifact = repoSystem.createArtifact(groupId, artifactId, version, "jar");
      File jar = new File(localRepository.getBasedir(), localRepository.pathOf(artifact));
      if (!jar.exists()) {
        log.warn("Failed to resolve '" + artifactId + "' from local repository in '" + jar + "'.");
      }
      return jar;
    }
  }

}

redpajama_set_name: RedPajamaGithub


text:
package com.amazonaws.services.securityhub.model.transform;

import javax.annotation.Generated;

import com.amazonaws.SdkClientException;
import com.amazonaws.services.securityhub.model.*;

import com.amazonaws.protocol.*;
import com.amazonaws.annotation.SdkInternalApi;

/**
 * VulnerabilityVendorMarshaller
 */
@Generated("com.amazonaws:aws-java-sdk-code-generator")
@SdkInternalApi
public class VulnerabilityVendorMarshaller {

    private static final MarshallingInfo<String> NAME_BINDING = MarshallingInfo.builder(MarshallingType.STRING).marshallLocation(MarshallLocation.PAYLOAD)
            .marshallLocationName("Name").build();
    private static final MarshallingInfo<String> URL_BINDING = MarshallingInfo.builder(MarshallingType.STRING).marshallLocation(MarshallLocation.PAYLOAD)
            .marshallLocationName("Url").build();
    private static final MarshallingInfo<String> VENDORSEVERITY_BINDING = MarshallingInfo.builder(MarshallingType.STRING)
            .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("VendorSeverity").build();
    private static final MarshallingInfo<String> VENDORCREATEDAT_BINDING = MarshallingInfo.builder(MarshallingType.STRING)
            .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("VendorCreatedAt").build();
    private static final MarshallingInfo<String> VENDORUPDATEDAT_BINDING = MarshallingInfo.builder(MarshallingType.STRING)
            .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("VendorUpdatedAt").build();

    private static final VulnerabilityVendorMarshaller instance = new VulnerabilityVendorMarshaller();

    public static VulnerabilityVendorMarshaller getInstance() {
        return instance;
    }

    /**
     * Marshall the given parameter object.
     */
    public void marshall(VulnerabilityVendor vulnerabilityVendor, ProtocolMarshaller protocolMarshaller) {

        if (vulnerabilityVendor == null) {
            throw new SdkClientException("Invalid argument passed to marshall(...)");
        }

        try {
            protocolMarshaller.marshall(vulnerabilityVendor.getName(), NAME_BINDING);
            protocolMarshaller.marshall(vulnerabilityVendor.getUrl(), URL_BINDING);
            protocolMarshaller.marshall(vulnerabilityVendor.getVendorSeverity(), VENDORSEVERITY_BINDING);
            protocolMarshaller.marshall(vulnerabilityVendor.getVendorCreatedAt(), VENDORCREATEDAT_BINDING);
            protocolMarshaller.marshall(vulnerabilityVendor.getVendorUpdatedAt(), VENDORUPDATEDAT_BINDING);
        } catch (Exception e) {
            throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
        }
    }

}


text:
<component name="libraryTable">
  <library name="SBT: org.seleniumhq.selenium:selenium-support:2.25.0">
    <CLASSES>
      <root url="jar://$USER_HOME$/tools/play-2.1.1/repository/local/org.seleniumhq.selenium/selenium-support/2.25.0/jars/selenium-support.jar!/"></root>
    </CLASSES>
    <JAVADOC> </JAVADOC>
    <SOURCES> </SOURCES>
  </library>
</component>


text:
using UnityEngine;
using System.Collections;

public class TileMain : MonoBehaviour {
    public SpriteRenderer UNIT_AIR, UNIT_GROUND, TERRAIN_TOP, TERRAIN_MID, TERRAIN_BOTTOM, BACKGROUND;

    private bool _canHoldCity;
    public bool canHoldCity
    {
        get { return _canHoldCity; }
        set { ChangeCanHoldCity(value); }
    }
    private bool _canHoldUnitWorker;
    public bool canHoldUnitWorker
    {
        get { return _canHoldUnitWorker; }
        set { ChangeCanHoldUnitWorker(value); }
    }
    private bool _canHoldUnitGround;
    public bool canHoldUnitGround
    {
        get { return _canHoldUnitGround; }
        set { ChangeCanHoldUnitGround(value); }
    }
    private bool _canHoldUnitAerial;
    public bool canHoldUnitAerial
    {
        get { return _canHoldUnitAerial; }
        set { ChangeCanHoldUnitAerial(value); }
    }

    public CityBase currentCity;

    public void SetSpriteTerrainBottom(Sprite sprite)
    {
        TERRAIN_BOTTOM.sprite = sprite;
    }
    public void SetSpriteTerrainMid(Sprite sprite)
    {
        TERRAIN_MID.sprite = sprite;
    }
    public void SetSpriteTerrainTop(Sprite sprite)
    {
        TERRAIN_TOP.sprite = sprite;
    }
    private void ChangeCanHoldVillage(bool state)
    {

    }
    private void ChangeCanHoldCity(bool state)
    {

    }
    private void ChangeCanHoldUnitWorker(bool state)
    {

    }
    private void ChangeCanHoldUnitGround(bool state)
    {

    }
    private void ChangeCanHoldUnitAerial(bool state)
    {

    }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

  <title>Qt 4.8: Application Main Window</title>
  <link rel="stylesheet" type="text/css" href="style/style.css" />

  <link rel="stylesheet" type="text/css" href="style/superfish.css" />
  <link rel="stylesheet" type="text/css" href="style/narrow.css" />

      Home

    Qt Reference Documentation

Qt HOME

DEV

          DOC

BLOG

Qt 4.8

ALL VERSIONS

API Lookup

Class index

Function index

Modules

Namespaces

Global Declarations

QML elements

Qt Topics

Programming with Qt

Device UIs & Qt Quick

UI Design with Qt

Supported Platforms

Qt and Key Technologies

How-To's and Best Practices

Examples

Examples

Tutorials

Demos

QML Examples

          Search index:

          <form id="qtdocsearch" action="" onsubmit="return false;">
            <fieldset>
              <input type="text" name="searchstring" id="pageType" value="" />

 Close

All | API | Articles | Examples

 results:

            </fieldset>
          </form>

            API Lookup

Class index

Function index

Modules

Namespaces

Global Declarations

QML elements

            Qt Topics

Programming with Qt

Device UIs & Qt Quick

UI Design with Qt

Supported Platforms

Qt and Key Technologies

How-To's and Best Practices

            Examples

Examples

Tutorials

Demos

QML Examples

Home

Application Main Window

A

A

A

                Print

Contents

Overview of the Main Window Classes

The Main Window Classes

Example Code

Application Main Window

Overview of the Main Window Classes

These classes provide everything you need for a typical modern main application window, like the main window itself, menu and tool bars, a status bar, etc.

QAction

Abstract user interface action that can be inserted into widgets

QActionGroup

Groups actions together

QDockWidget

Widget that can be docked inside a QMainWindow or floated as a top-level window on the desktop

QMainWindow

Main application window

QMdiArea

Area in which MDI windows are displayed

QMdiSubWindow

Subwindow class for QMdiArea

QMenu

Menu widget for use in menu bars, context menus, and other popup menus

QMenuBar

Horizontal menu bar

QSizeGrip

Resize handle for resizing top-level windows

QStatusBar

Horizontal bar suitable for presenting status information

QToolBar

Movable panel that contains a set of controls

QWidgetAction

Extends QAction by an interface for inserting custom widgets into action based containers, such as toolbars

The Main Window Classes

Qt 4 provides the following classes for managing main windows and associated user interface components:

QMainWindow remains the central class around which applications can be built. The interface to this class has been simplified, and much of the functionality previously included in this class is now present in the companion QDockWidget and QToolBar classes.

QDockWidget provides a widget that can be used to create detachable tool palettes or helper windows. Dock widgets keep track of their own properties, and they can be moved, closed, and floated as external windows.

QToolBar provides a generic toolbar widget that can hold a number of different action-related widgets, such as buttons, drop-down menus, comboboxes, and spin boxes. The emphasis on a unified action model in Qt 4 means that toolbars cooperate well with menus and keyboard shortcuts.

Example Code

Using QMainWindow is straightforward. Generally, we subclass QMainWindow and set up menus, toolbars, and dock widgets inside the QMainWindow constructor.

To add a menu bar to the main window, we simply create the menus, and add them to the main window's menu bar. Note that the QMainWindow::menuBar() function will automatically create the menu bar the first time it is called. You can also call QMainWindow::setMenuBar() to use a custom menu bar in the main window.

 MainWindow::MainWindow(QWidget *parent)
     : QMainWindow(parent)
 {
     ...
     newAct = new QAction(tr("&New"), this);
     newAct->setShortcuts(QKeySequence::New);
     newAct->setStatusTip(tr("Create a new file"));
     connect(newAct, SIGNAL(triggered()), this, SLOT(newFile()));

     openAct = new QAction(tr("&Open..."), this);
     openAct->setShortcuts(QKeySequence::Open);
     openAct->setStatusTip(tr("Open an existing file"));
     connect(openAct, SIGNAL(triggered()), this, SLOT(open()));
     ...

Once actions have been created, we can add them to the main window components. To begin with, we add them to the pop-up menus:

     fileMenu = menuBar()->addMenu(tr("&File"));
     fileMenu->addAction(newAct);
     fileMenu->addAction(openAct);
     ...
     fileMenu->addSeparator();
     ...

The QToolBar and QMenu classes use Qt's action system to provide a consistent API. In the above code, some existing actions were added to the file menu with the QMenu::addAction() function. QToolBar also provides this function, making it easy to reuse actions in different parts of the main window. This avoids unnecessary duplication of work.

We create a toolbar as a child of the main window, and add the desired actions to it:

     fileToolBar = addToolBar(tr("File"));
     fileToolBar->addAction(newAct);
     fileToolBar->addAction(openAct);
     ...
 fileToolbar->setAllowedAreas(Qt::TopToolBarArea | Qt::BottomToolBarArea);
 addToolBar(Qt::TopToolBarArea, fileToolbar);

In this example, the toolbar is restricted to the top and bottom toolbar areas of the main window, and is initially placed in the top tool bar area. We can see that the actions specified by <tt>newAct</tt> and <tt>openAct</tt> will be displayed both on the toolbar and in the file menu.

QDockWidget is used in a similar way to QToolBar. We create a dock widget as a child of the main window, and add widgets as children of the dock widget:

     contentsWindow = new QDockWidget(tr("Table of Contents"), this);
     contentsWindow->setAllowedAreas(Qt::LeftDockWidgetArea
                                   | Qt::RightDockWidgetArea);
     addDockWidget(Qt::LeftDockWidgetArea, contentsWindow);

     headingList = new QListWidget(contentsWindow);
     contentsWindow->setWidget(headingList);

In this example, the dock widget can only be placed in the left and right dock areas, and it is initially placed in the left dock area.

The QMainWindow API allows the programmer to customize which dock widget areas occupy the four corners of the dock widget area. If required, the default can be changed with the QMainWindow::setCorner() function:

 setCorner(Qt::TopLeftCorner, Qt::LeftDockWidgetArea);
 setCorner(Qt::BottomLeftCorner, Qt::LeftDockWidgetArea);
 setCorner(Qt::TopRightCorner, Qt::RightDockWidgetArea);
 setCorner(Qt::BottomRightCorner, Qt::RightDockWidgetArea);

The following diagram shows the configuration produced by the above code. Note that the left and right dock widgets will occupy the top and bottom corners of the main window in this layout.

Once all of the main window components have been set up, the central widget is created and installed by using code similar to the following:

 QWidget *centralWidget = new QWidget(this);
 setCentralWidget(centralWidget);

The central widget can be any subclass of QWidget.

      <acronym title="Copyright">©</acronym> 2013 Digia Plc and/or its
      subsidiaries. Documentation contributions included herein are the copyrights of
      their respective owners.

      The documentation provided herein is licensed under the terms of the
      GNU Free Documentation
      License version 1.3 as published by the Free Software Foundation.

      Documentation sources may be obtained from
      www.qt-project.org.

      Digia, Qt and their respective logos are trademarks of Digia Plc
      in Finland and/or other countries worldwide. All other trademarks are property
      of their respective owners. Privacy Policy


text:
#ifndef INDUSTRIAL_MOVEIT_STOMP_MOVEIT_INCLUDE_STOMP_MOVEIT_COST_FUNCTIONS_TOOL_GOAL_POSE_H_
#define INDUSTRIAL_MOVEIT_STOMP_MOVEIT_INCLUDE_STOMP_MOVEIT_COST_FUNCTIONS_TOOL_GOAL_POSE_H_

#include <Eigen/Sparse>
#include <moveit/robot_model/robot_model.h>
#include <moveit/collision_detection_fcl/collision_world_fcl.h>
#include <moveit/collision_detection_fcl/collision_robot_fcl.h>
#include "stomp_moveit/cost_functions/stomp_cost_function.h"

namespace stomp_moveit
{
namespace cost_functions
{

/**
 * @class stomp_moveit::cost_functions::ToolGoalPose
 * @brief Evaluates the cost of the goal pose by determining how far the Cartesian tool pose
 *        is from the desired under-constrained task manifold
 *
 * @par Examples:
 * All examples are located here @ref stomp_plugins_examples
 */
class ToolGoalPose: public StompCostFunction
{
public:
  ToolGoalPose();
  virtual ~ToolGoalPose();

  /**
   * @brief Initializes and configures the Cost Function.
   * @param robot_model_ptr A pointer to the robot model.
   * @param group_name      The designated planning group.
   * @param config          The configuration data.  Usually loaded from the ros parameter server
   * @return true if succeeded, false otherwise.
   */
  virtual bool initialize(moveit::core::RobotModelConstPtr robot_model_ptr,
                          const std::string& group_name,XmlRpc::XmlRpcValue& config) override;

  /**
   * @brief Sets internal members of the plugin from the configuration data.
   * @param config  The configuration data .  Usually loaded from the ros parameter server
   * @return  true if succeeded, false otherwise.
   */
  virtual bool configure(const XmlRpc::XmlRpcValue& config) override;

  /**
   * @brief Stores the planning details which will be used during the costs calculations.
   * @param planning_scene  A smart pointer to the planning scene
   * @param req                 The motion planning request
   * @param config              The  Stomp configuration.
   * @param error_code          Moveit error code.
   * @return  true if succeeded, false otherwise.
   */
  virtual bool setMotionPlanRequest(const planning_scene::PlanningSceneConstPtr& planning_scene,
                   const moveit_msgs::MotionPlanRequest &req,
                   const stomp_core::StompConfiguration &config,
                   moveit_msgs::MoveItErrorCodes& error_code) override;

  /**
   * @brief computes the goal state costs as a function of the distance from the desired task manifold.
   * @param parameters        The parameter values to evaluate for state costs [num_dimensions x num_parameters]
   * @param start_timestep    start index into the 'parameters' array, usually 0.
   * @param num_timesteps     number of elements to use from 'parameters' starting from 'start_timestep'   *
   * @param iteration_number  The current iteration count in the optimization loop
   * @param rollout_number    index of the noisy trajectory whose cost is being evaluated.   *
   * @param costs             vector containing the state costs per timestep.  Only the array's last entry is set. [num_parameters x 1]
   * @param validity          whether or not the trajectory is valid
   * @return true if cost were properly computed
   */
  virtual bool computeCosts(const Eigen::MatrixXd& parameters,
                            std::size_t start_timestep,
                            std::size_t num_timesteps,
                            int iteration_number,
                            int rollout_number,
                            Eigen::VectorXd& costs,
                            bool& validity) override;

  virtual std::string getGroupName() const override
  {
    return group_name_;
  }

  virtual std::string getName() const override
  {
    return name_ + "/" + group_name_;
  }

  /**
   * @brief Called by the Stomp Task at the end of the optimization process
   *
   * @param success           Whether the optimization succeeded
   * @param total_iterations  Number of iterations used
   * @param final_cost        The cost value after optimizing.
   * @param parameters        The parameters generated at the end of current iteration[num_dimensions x num_timesteps]
   */
  virtual void done(bool success,int total_iterations,double final_cost,const Eigen::MatrixXd& parameters) override{}

protected:

  std::string name_;

  // robot details
  std::string group_name_;
  std::string tool_link_;
  moveit::core::RobotModelConstPtr robot_model_;
  moveit::core::RobotStatePtr state_;

  // planning context information
  planning_scene::PlanningSceneConstPtr planning_scene_;
  moveit_msgs::MotionPlanRequest plan_request_;

  // goal pose
  Eigen::Affine3d tool_goal_pose_;                    /**< @brief The desired goal pose for the active plan request **/

  // ros parameters
  Eigen::ArrayXi dof_nullity_;                        /**< @brief Indicates which cartesian DOF's are unconstrained (0) and fully constrained (1)*/
  std::pair<double,double> position_error_range_;     /**< @brief The allowed position error range, [2 x 1] */
  std::pair<double,double> orientation_error_range_;  /**< @brief The allowed orientation error range as euler angles, [2 x 1] **/
  double position_cost_weight_;                       /**< @brief factor multiplied to the scaled position error **/
  double orientation_cost_weight_;                    /**< @brief factor multiplied to the scaled orientation error **/

  // support variables
  Eigen::VectorXd last_joint_pose_;
  Eigen::Affine3d last_tool_pose_;
  Eigen::VectorXd tool_twist_error_;

};

} /* namespace cost_functions */
} /* namespace stomp_moveit */

#endif /* INDUSTRIAL_MOVEIT_STOMP_MOVEIT_INCLUDE_STOMP_MOVEIT_COST_FUNCTIONS_TOOL_GOAL_POSE_H_ */


text:
require 'test_helper'

module DestinyTest
  describe 'Destiny Gem', 'The Destiny API Gem' do
    before do
      @client = Destiny::Client.new ENV['X_API_Key']
    end

    it 'should retrieve a user account' do
      response = @client.account.details ENV['Membership_Type'],
                                         ENV['Display_Name']
      expect(response.keys).must_equal %w(Response ErrorCode
                                          ThrottleSeconds ErrorStatus
                                          Message MessageData)
    end

    it 'should retrieve a user item list' do
      response = @client.account.items ENV['Membership_Type'],
                                       ENV['Display_Name']
      expect(response.keys).must_equal %w(Response ErrorCode
                                          ThrottleSeconds ErrorStatus
                                          Message MessageData)
    end

    it 'should retrieve a user membership ID' do
      valid_response = {
        'Response' => '4611686018433985673',
        'ErrorCode'=>1,
        'ThrottleSeconds'=>0,
        'ErrorStatus'=>'Success',
        'Message'=>'Ok',
        'MessageData'=>{}
      }
      response = @client.account.membership_id_from_display_name ENV['Membership_Type'], ENV['Display_Name']
      expect(response).must_equal valid_response
    end

    it 'should search for a destiny player based on platform and username' do
      valid_response = {
        'Response' => [
          {
            'iconPath' => '/img/theme/destiny/icons/icon_psn.png',
            'membershipType' => 2,
            'membershipId' => '4611686018433985673',
            'displayName' => 'R4z3rsPar4d0x'
          }
        ],
        'ErrorCode' => 1,
        'ThrottleSeconds' => 0,
        'ErrorStatus' => 'Success',
        'Message' => 'Ok',
        'MessageData' => {}
      }
      response = @client.account.search_destiny_player ENV['Membership_Type'],
                                                       ENV['Display_Name']
      expect(response).must_equal valid_response
    end

    it 'should retrieve a user account summary' do
      response = @client.account.summary ENV['Membership_Type'],
                                         ENV['Display_Name']
      expect(response.keys).must_equal %w(Response ErrorCode
                                          ThrottleSeconds ErrorStatus
                                          Message MessageData)
    end

    it 'should retrieve a user account statistics' do
      response = @client.account.stats ENV['Membership_Type'],
                                       ENV['Display_Name']
      expect(response.keys).must_equal %w(Response ErrorCode
                                          ThrottleSeconds ErrorStatus
                                          Message MessageData)
    end
  end
end


text:
package org.nem.core.model;

import org.junit.*;
import org.junit.experimental.runners.Enclosed;
import org.junit.runner.RunWith;
import org.nem.core.model.mosaic.*;
import org.nem.core.model.primitive.*;
import org.nem.core.test.*;

import java.util.stream.IntStream;

@RunWith(Enclosed.class)
public class TransactionFeeCalculatorBeforeForkTest extends AbstractTransactionFeeCalculatorTest {
	private static final long FEE_UNIT = 2;

	@BeforeClass
	public static void setup() {
		DEFAULT_HEIGHT = new BlockHeight(100);
		final MosaicFeeInformationLookup lookup = AbstractTransactionFeeCalculatorTest.createMosaicFeeInformationLookup();
		NemGlobals.setTransactionFeeCalculator(new DefaultTransactionFeeCalculator(
				lookup,
				() -> DEFAULT_HEIGHT,
				new BlockHeight[] { DEFAULT_HEIGHT.next(), new BlockHeight(1_000_000_000L) }));
		setNamespaceAndMosaicRelatedDefaultFee(108_000_000);
		setTransactionDefaultFee(6_000_000);
		setMultisigSignatureMinimumFee(6_000_000);
	}

	@AfterClass
	public static void teardown() {
		Utils.resetGlobals();
	}

	//region calculateMinimumFee

	//region transfer

	public static class TransferMinimumFeeCalculation {
		private static final long SMALL_TRANSFER_PENALTY = 10;
		private static final long MIN_TRANSFER_FEE = FEE_UNIT;

		@Test
		public void feeIsCalculatedCorrectlyForEmptyTransfer() {
			// Assert:
			assertXemFee(0, 0, Amount.fromNem(SMALL_TRANSFER_PENALTY));
		}

		@Test
		public void feeIsCalculatedCorrectlyForPenalizedSmallTransfers() {
			// Assert:
			for (int i = 1; i < 9; ++i) {
				assertXemFee(i, 0, Amount.fromNem(SMALL_TRANSFER_PENALTY - i));
			}
		}

		@Test
		public void feeIsCalculatedCorrectlyForNonPenalizedSmallTransfers() {
			// Assert:
			for (int i = 9; i < 20; ++i) {
				assertXemFee(i, 0, Amount.fromNem(MIN_TRANSFER_FEE));
			}
		}

		@Test
		public void feeIsCalculatedCorrectlyNearTransferStepIncreases() {
			// Assert:
			assertXemFee(4546, 0, Amount.fromNem(2));
			assertXemFee(4547, 0, Amount.fromNem(3));
			assertXemFee(4548, 0, Amount.fromNem(3));

			assertXemFee(6063, 0, Amount.fromNem(3));
			assertXemFee(6064, 0, Amount.fromNem(4));
			assertXemFee(6065, 0, Amount.fromNem(4));
		}

		@Test
		public void feeIsCalculatedCorrectlyForLargeTransfers() {
			// Assert:
			assertXemFee(10000, 0, Amount.fromNem(6));
			assertXemFee(100000, 0, Amount.fromNem(58));
			assertXemFee(1000000, 0, Amount.fromNem(140));
			assertXemFee(2000000, 0, Amount.fromNem(148));
		}

		@Test
		public void feeIsCalculatedCorrectlyForLargeTransfersWithMessages() {
			// Assert:
			assertXemFee(10000, 96, Amount.fromNem(6 + 12));
			assertXemFee(100000, 128, Amount.fromNem(58 + 16));
			assertXemFee(1000000, 96, Amount.fromNem(140 + 12));
			assertXemFee(2000000, 128, Amount.fromNem(148 + 16));
		}

		@Test
		public void feeIsCalculatedCorrectlyForTransferWithSmallestMessage() {
			// Assert:
			assertXemFee(1200, 1, Amount.fromNem(MIN_TRANSFER_FEE + 2));
		}

		@Test
		public void feeIsCalculatedCorrectlyForTransferNearMessageStepIncreases() {
			// Assert:
			assertXemFee(1200, 31, Amount.fromNem(MIN_TRANSFER_FEE + 2));
			assertXemFee(1200, 32, Amount.fromNem(MIN_TRANSFER_FEE + 4));
			assertXemFee(1200, 33, Amount.fromNem(MIN_TRANSFER_FEE + 4));

			assertXemFee(1200, 63, Amount.fromNem(MIN_TRANSFER_FEE + 6));
			assertXemFee(1200, 64, Amount.fromNem(MIN_TRANSFER_FEE + 8));
			assertXemFee(1200, 65, Amount.fromNem(MIN_TRANSFER_FEE + 8));
		}

		@Test
		public void feeIsCalculatedCorrectlyForTransferWithLargeMessage() {
			// Assert:
			assertXemFee(1200, 96, Amount.fromNem(MIN_TRANSFER_FEE + 12));
			assertXemFee(1200, 128, Amount.fromNem(MIN_TRANSFER_FEE + 16));
			assertXemFee(1200, 256, Amount.fromNem(MIN_TRANSFER_FEE + 32));
		}

		@Test
		public void messageFeeIsBasedOnEncodedSize() {
			// Assert:
			assertMessageFee(96, 128, Amount.fromNem(SMALL_TRANSFER_PENALTY + 12));
			assertMessageFee(128, 96, Amount.fromNem(SMALL_TRANSFER_PENALTY + 16));
		}

		// region mosaic transfers

		// mosaic definition data used for the following tests: supply = 100_000_000, divisibility = 3
		// supply ratio: 8_999_999_999 / 100_000_000 ≈ 90
		// divisibility ratio = 1_000_000 / 1_000 = 1000
		// 1000 / 90 = 11.11..., so transferring a quantity of 12 is roughly like transferring 1 xem
		// In comparison to a xem transfer, equivalent mosaic transfers have 25% higher fees (rounded)

		// note that xem as a mosaic transfer is also 25% higher than a regular xem transfer because
		// it takes up more space in the db; this is validated by
		// feesForMosaicTransfersAreTwentyFivePercentHigherThanEquivalentXemTransfers

		@Test
		public void feeIsCalculatedCorrectlyForPenalizedSmallMosaicTransfers() {
			// Assert:
			for (int i = 1; i < 9; ++i) {
				assertSingleMosaicFee(1, 0, i * 12L, Amount.fromNem((SMALL_TRANSFER_PENALTY - i) * 5 / 4));
			}
		}

		@Test
		public void feeIsCalculatedCorrectlyForNonPenalizedSmallMosaicTransfers() {
			// Assert:
			for (int i = 9; i < 20; ++i) {
				assertSingleMosaicFee(1, 0, i * 12L, Amount.fromNem(MIN_TRANSFER_FEE * 5 / 4));
			}
		}

		@Test
		public void feeIsCalculatedCorrectlyNearMosaicTransferStepIncreases() {
			// Assert:
			// 2 -> 3 roughly at 50.5 units
			assertSingleMosaicFee(1, 0, 50_000L, Amount.fromNem(2 * 5 / 4));
			assertSingleMosaicFee(1, 0, 51_000L, Amount.fromNem(3 * 5 / 4));
			assertSingleMosaicFee(1, 0, 52_000L, Amount.fromNem(3 * 5 / 4));

			// 3 -> 5 roughly at 67.3 units
			assertSingleMosaicFee(1, 0, 67_000L, Amount.fromNem(3 * 5 / 4));
			assertSingleMosaicFee(1, 0, 68_000L, Amount.fromNem(4 * 5 / 4));
			assertSingleMosaicFee(1, 0, 69_000L, Amount.fromNem(4 * 5 / 4));
		}

		@Test
		public void feeIsCalculatedCorrectlyForLargeMosaicTransfers() {
			// Assert:
			assertSingleMosaicFee(1, 0, 111_000L, Amount.fromNem(6 * 5 / 4));
			assertSingleMosaicFee(1, 0, 1_110_000L, Amount.fromNem(58 * 5 / 4));
			assertSingleMosaicFee(1, 0, 11_100_000L, Amount.fromNem(140 * 5 / 4));
			assertSingleMosaicFee(1, 0, 22_200_000L, Amount.fromNem(148 * 5 / 4));
		}

		@Test
		public void feeIsCalculatedCorrectlyForMosaicTransfersWithAmountOtherThanOne() {
			// Assert:
			assertSingleMosaicFee(1, 0, 1_000_000L, Amount.fromNem(53 * 5 / 4));
			assertSingleMosaicFee(2, 0, 500_000L, Amount.fromNem(53 * 5 / 4));
			assertSingleMosaicFee(5, 0, 200_000L, Amount.fromNem(53 * 5 / 4));
			assertSingleMosaicFee(10, 0, 100_000L, Amount.fromNem(53 * 5 / 4));
			assertSingleMosaicFee(500, 0, 2_000L, Amount.fromNem(53 * 5 / 4));
			assertSingleMosaicFee(10_000, 0, 100L, Amount.fromNem(53 * 5 / 4));
			assertSingleMosaicFee(1_000_000, 0, 1L, Amount.fromNem(53 * 5 / 4));
		}

		@Test
		public void messageFeeIsAddedToMosaicTransferFee() {
			// Assert:
			assertSingleMosaicFee(1, 31, 1_000_000L, Amount.fromNem(53 * 5 / 4 + 2));
			assertSingleMosaicFee(1, 47, 1_000_000L, Amount.fromNem(53 * 5 / 4 + 4));
			assertSingleMosaicFee(1, 63, 1_000_000L, Amount.fromNem(53 * 5 / 4 + 6));
			assertSingleMosaicFee(1, 79, 1_000_000L, Amount.fromNem(53 * 5 / 4 + 8));
		}

		@Test
		public void feesAreAddedWhenTransferringSeveralMosaics() {
			// Arrange: mosaic definitions are (100M, 3), (200M, 4), (300M, 5)
			final Transaction transaction = createTransferWithMosaics(1, 0, 111_000L, 11_100_000L, 1_110_000_000L);

			// Assert:
			assertTransactionFee(transaction, Amount.fromNem((6 + 31 + 113) * 5 / 4));
		}

		@Test
		public void feesForMosaicTransfersAreTwentyFivePercentHigherThanEquivalentXemTransfers() {
			// Assert:
			IntStream.range(0, 100).forEach(i -> assertXemTransferToMosaicTransferFeeRatio(1000 * i));
		}

		@Test
		public void feesForMosaicTransfersAreTenIfMosaicSupplyIsZero() {
			// Arrange:
			final TransferTransaction transaction = createTransfer(5, null);
			final MosaicId mosaicId = Utils.createMosaicId("foo", "zero supply");
			transaction.getAttachment().addMosaic(mosaicId, Quantity.fromValue(1_000_000));

			// Assert:
			// - zero supply means zero xem equivalent and therefore a penalty fee of 10 * 1.25 xem = 12 xem
			assertTransactionFee(transaction, Amount.fromNem(12));
		}

		@Test
		public void feesCannotBeCalculatedForUnknownMosaic() {
			// Arrange:
			final TransferTransaction transaction = createTransfer(1L, null);
			transaction.getAttachment().addMosaic(Utils.createMosaic("foo", "tokens"));
			final TransactionFeeCalculator calculator = createCalculator();

			// Act:
			ExceptionAssert.assertThrows(
					v -> calculator.calculateMinimumFee(transaction),
					IllegalArgumentException.class);
		}

		// endregion

	}

	//endregion
}


text:
function ptindex=csection( basenm, ts, colorby )
%CSECTION: Plots a vertical stratigraphic section from a CHILD simulation.
%          You select the endpoints of the section.
%  Usage: ptindex = csection( basenm, ts, colorby )
%    basenm - name of the file (without extension)
%    ts - time slice to plot
%    colorby - variable to color-code: 1=date, 2=exposure age, 3=grain size
%  Returns a vector of indices of the points along the section.
figure(1)
hold off
clf
fprintf('CSECTION: Drawing mesh...\n');
nd=cplotmesh(basenm,ts);
cplotarea(basenm,nd,ts);
view(0,90)
fprintf('CSECTION: Reading coordinate and layer information...\n');
xyz=creadxyz(basenm,ts);
axis([min(xyz(:,1)) max(xyz(:,1)) min(xyz(:,2)) max(xyz(:,2)) 0 2*max(xyz(:,3))])
[lay nl] = creadlayers( basenm, ts );
nn=size(lay,1);  % this is number of interior nodes -- remember it for later

keepgoing=1;
sectionfigno=2;
sectionframeno=1;

while keepgoing==1

figure(1)
fprintf('Select starting point for section: ');
pt1=ginput(1);  % User clicks on a point
fprintf('%f, %f\n',pt1(1),pt1(2));
fprintf('Select ending point for section: \n');
pt2=ginput(1);  % User clicks on a point
fprintf('%f, %f\n',pt2(1),pt2(2));
plot([pt1(1) pt2(1)],[pt1(2) pt2(2)]);

% Having gotten our two endpoints, we divide the section line up into
% equal intervals spaced DL apart
dl=input('Distance increment: ');
delx=pt2(1)-pt1(1);
dely=pt2(2)-pt1(2);
length=sqrt(delx.*delx+dely.*dely);
ratio = dl/length;
dx = ratio * delx;
dy = ratio * dely;

% Next we want to find the series of mesh points that are closest to our
% equally spaced section-line points. We obtain a list of indices, PTINDEX,
% that refer back to the xyz coordinates and layer data for each of these
% points.
length = sqrt( delx.*delx + dely.*dely );
numpts = round( length/dl + 1 );
dl
numpts
truenumpts = 0; % we want to keep track of how many unique mesh points we find
cx = pt1(1)
cy = pt1(2)   % Start with first point
lastptindex=0;       % Remember the last point we found (initially zero)
ptindex=[];
for i=1:numpts
  % Find the closest mesh point to CX, CY
  delx = xyz(1:nn,1) - cx;
  dely = xyz(1:nn,2) - cy;
  delx = delx.*delx;
  dely = dely.*dely;
  dist = sqrt( delx + dely );
  [mindist index] = min( dist );
  % If our dl is small, the closest point could be the same as the one we
  % found on the last pass -- if so ignore it; if not, add the new point index
  % to our list
  if index~=lastptindex
    truenumpts = truenumpts + 1;
    ptindex = [ ptindex index ];
  end
  lastptindex = index;
  cx = cx+dx;
  cy = cy+dy;
end

% Now we plot the section using the PATCH graphic command. We consider each
% adjacent pair of points along the section in turn (in the variable names
% below, "L" refers to the left-hand point and "R" to the right-hand one)
figure(sectionfigno)
%subplot(3,1,sectionframeno)
%sectionframeno=sectionframeno+1;
if sectionframeno>3, sectionfigno=sectionfigno+1; sectionframeno=1; end
cla
hold on
maxdate = max(max(lay(:,2)));
ancient = -1;
numignoredlayers = 1;  % Redefine # layers to we ignore the lowermost 1 or 2
nl = nl - numignoredlayers;
for i=1:truenumpts-1
  curptl=ptindex(i);   % indices of current left-hand and
  curptr=ptindex(i+1); % right-hand points
  nll=nl(curptl); % number of layers at left-hand
  nlr=nl(curptr); % and right-hand points
  cll=1; % current layers on left
  clr=1; % and right
  zl=xyz(curptl,3);  % elevation of top of current layer on left-hand
  zr=xyz(curptr,3);  % and right-hand sides
  datel=lay(curptl,1,2);  % date of current layer on left-hand
  dater=lay(curptr,1,2);  % and right-hand sides
  if colorby==1, colorl=datel;colorr=dater;
  elseif colorby==2, colorl=lay(curptl,1,3);colorr=lay(curptr,1,3);
  else colorl=lay(curptl,1,4); colorr=lay(curptr,1,4); end
  % Plot all the layers for this pair of points
  while ( cll<=nll | clr<=nlr )
    if datel>dater
      patch( [xyz(curptl,1) xyz(curptl,1) xyz(curptr,1)], [xyz(curptl,2) xyz(curptl,2) xyz(curptr,2)], [zl zl-lay(curptl,cll,1) zr], colorl )
      % Move to next layer down on left
      zl = zl - lay(curptl,cll,1);
      cll = cll+1;
      if cll>nll, datel=ancient;
      else datel=lay(curptl,cll,2); end
      if colorby==1, colorl=datel;
      elseif colorby==2, colorl=lay(curptl,cll,3);
      else colorl=lay(curptl,cll,4); end
    elseif dater>datel
      patch( [xyz(curptl,1) xyz(curptr,1) xyz(curptr,1)], [xyz(curptl,2) xyz(curptr,2) xyz(curptr,2)], [zl zr-lay(curptr,clr,1) zr], colorr )
      % Move to next layer down on left
      zr = zr - lay(curptr,clr,1);
      clr = clr+1;
      if clr>nlr, dater=ancient;
      else dater=lay(curptr,clr,2); end
      if colorby==1, colorr=dater;
      elseif colorby==2, colorr=lay(curptr,clr,3);
      else colorr=lay(curptr,clr,4); end
    else
      patch( [xyz(curptl,1) xyz(curptl,1) xyz(curptr,1) xyz(curptr,1)], [xyz(curptl,2) xyz(curptl,2) xyz(curptr,2) xyz(curptr,2)], [zl zl-lay(curptl,cll,1) zr-lay(curptr,clr,1) zr], 0.5*(colorl+colorr) )
      % Move to next layer down on both sides
      zl = zl - lay(curptl,cll,1);
      cll = cll+1;
      if cll>nll, datel=ancient;
      else datel=lay(curptl,cll,2); end
      zr = zr - lay(curptr,clr,1);
      clr = clr+1;
      if clr>nlr, dater=ancient;
      else dater=lay(curptr,clr,2); end
      if colorby==1, colorr=dater; colorl=datel;
      elseif colorby==2, colorr=lay(curptr,clr,3); colorl=lay(curptl,cll,3);
      else colorr=lay(curptr,clr,4); colorl=lay(curptl,cll,4); end
    end
  end
end

view(90,0)
minx=min([xyz(ptindex(1),1) xyz(ptindex(truenumpts),1)])
maxx=max([xyz(ptindex(1),1) xyz(ptindex(truenumpts),1)])
miny=min([xyz(ptindex(1),2) xyz(ptindex(truenumpts),2)])
maxy=max([xyz(ptindex(1),2) xyz(ptindex(truenumpts),2)])
axis([minx maxx miny maxy -max(xyz(:,3)) max(xyz(:,3))])

keepgoing=input('Do another section? (1=yes)');

end


text:
#include "berryGuiTkSelectionEvent.h"

#include <sstream>

namespace berry
{

namespace GuiTk
{

SelectionEvent::SelectionEvent(void* item) :
  Event()
{
  this->item = item;
}

}

}


text:
namespace BLA
{
    class MeshRendererComponent;
    class DirectionalLightComponent;
    class PointLightComponent;
    class CameraComponent;

    class BLACORE_API RenderingManager
    {
    public:
        enum RenderManagerType { Game = 0, EditorGizmos = 1 };

        RenderingManager(RenderManagerType type);
        ~RenderingManager();

        blaU32 RegisterMeshRenderer(MeshRendererComponent* object);
        bool   CancelMeshRendererTicket(MeshRendererComponent* object);

        blaU32 RegisterDirectionalLight(DirectionalLightComponent* dirLight, CameraComponent* shadowCamera);
        blaU32 CancelDirectionalLightTicket(DirectionalLightComponent* dirLight);

        blaU32 RegisterPointLight(PointLightComponent* pointLight);
        blaU32 CancelPointLightTicket(PointLightComponent* pointLight);

        blaMap<blaU32, MeshRendererComponent*>* GetTicketedMeshRenderers();
        blaMap<blaU32, blaPair<DirectionalLightComponent*, CameraComponent*>>* GetTicketedDirectionalLights();
        blaMap<blaU32, PointLightComponent*>* GetTicketedPointLights();

        void Update();

    private:

        RenderManagerType m_renderManagerType;

        blaMap<blaU32, MeshRendererComponent*> m_ticketedMeshRenderers;
        blaMap<blaU32, PointLightComponent*> m_ticketedPointLights;
        blaMap<blaU32, blaPair<DirectionalLightComponent*, CameraComponent*>> m_ticketedDirLights;

        int currentTicket;

    };

    class BLACORE_API DebugRenderingManager
    {
    public:

        DebugRenderingManager() = default;
        ~DebugRenderingManager() = default;

        blaVector<blaPair<blaVector<blaVec3>, blaVector<blaVec3>>> m_lineMeshes;
        blaVector<blaPair<blaVector<blaVec3>, blaVector<blaVec4>>> m_filledMeshes;

        blaMap<blaU32, MeshRendererComponent*> m_ticketedMeshRenderers;

        void LoadDebugLineMesh(const blaPair<blaVector<blaVec3>, blaVector<blaVec3>>& lineMesh);
        void LoadDebugFilledMesh(const blaPair<blaVector<blaVec3>, blaVector<blaVec4>>& mesh);

        void Update();
    };
}


text:
namespace pepperl_fuchs {

	using namespace std;
	using namespace Poco;
	using namespace Poco::Net;

    //-----------------------------------------------------------------------------
	HttpCommandInterface::HttpCommandInterface(const std::string &http_host, int http_port)
    {
        http_host_ = http_host;
        http_port_ = http_port;
		http_status_code_ = Poco::Net::HTTPResponse::HTTP_NOT_FOUND;

    }

    //-----------------------------------------------------------------------------
	int HttpCommandInterface::httpGet(const std::string request_path, std::string &header, std::string &content)
    {
        header = "";
        content = "";

        try
		{
			HTTPClientSession httpSession(http_host_, http_port_);
			httpSession.setTimeout(Poco::Timespan(20,0));

			HTTPResponse res;

			// send request
			HTTPRequest req(HTTPRequest::HTTP_GET, request_path, HTTPMessage::HTTP_1_0);
			httpSession.sendRequest(req);

			// receive response header
			istream& response_stream = httpSession.receiveResponse(res);

			// get status code
			HTTPResponse::HTTPStatus status_code = res.getStatus();

			string http_version = res.getVersion();
			if (!response_stream || http_version.substr(0, 5) != "HTTP/")
			{
				std::cout << "Invalid response\n";
				return 0;
			}

			// get headers
			NameValueCollection::ConstIterator i = res.begin();
			while(i != res.end()) {
				header += i->first + "=" + i->second + "\n";
				i++;
			}

			if (status_code != HTTPResponse::HTTP_OK) {
				// dump headers
				std::cout << "headers: " << header;
				std::flush(std::cout);
			}

			std::string tmp;

			// read until eof
			while(!response_stream.eof()) {
				std::getline(response_stream, tmp);
				content += tmp;
			}

			// Substitute CRs by a space
			for( std::size_t i=0; i<header.size(); i++ ) {
                if( header[i] == '\r' )
                    header[i] = ' ';
			}

			for( std::size_t i=0; i<content.size(); i++ ) {
				if( content[i] == '\r' )
					content[i] = ' ';
			}

			return status_code;

		}
		catch (Poco::Exception & exc){
			std::cerr << "Exception: " <<  exc.displayText() << std::endl;
			return 0;
		}
    }

    //-----------------------------------------------------------------------------
    bool HttpCommandInterface::sendHttpCommand(const std::string cmd, const std::map<std::string, std::string> param_values)
    {
        // Build request string
        std::string request_str = "/cmd/" + cmd + "?";

        for( std::map<std::string, std::string>::const_iterator kv = param_values.begin(); kv != param_values.end(); kv++ ) {
            request_str += kv->first + "=" + kv->second + "&";
        }

        if(request_str[request_str.size()-1] == '&' )
            request_str = request_str.substr(0,request_str.size()-1);

        // Do HTTP request
        std::string header, content;
        http_status_code_ = httpGet(request_str, header, content);

        // Try to parse JSON response
		// create parser

		// parse json
		std::stringstream ss(content);

        if (!jsonParser.parse(ss, root))
        {
			std::cerr << "Json::parse" << "Unable to parse string: " << jsonParser.getFormattedErrorMessages() << std::endl;
            return false;
        }

        // Check HTTP-status code
        if( http_status_code_ != 200 )
            return false;
        else
            return true;
    }

    //-----------------------------------------------------------------------------
    bool HttpCommandInterface::sendHttpCommand(const std::string cmd, const std::string param, const std::string value)
    {
        std::map<std::string, std::string> param_values;
        if( param != "" )
            param_values[param] = value;
        return sendHttpCommand(cmd,param_values);
    }

    //-----------------------------------------------------------------------------
    bool HttpCommandInterface::setParameter(const std::string name, const std::string value)
    {
        return sendHttpCommand("set_parameter",name,value) && checkErrorCode();
    }

    //-----------------------------------------------------------------------------
    Poco::Optional< std::string > HttpCommandInterface::getParameter(const std::string name)
    {
        if( !sendHttpCommand("get_parameter","list",name) || ! checkErrorCode()  )
            return Poco::Optional<std::string>();

        // query json for value

		if (!root.isMember(name)) {
			return Poco::Optional<std::string>();
		}

		Json::Value value = root.get(name, "");
		if (!value.isString())
			return Poco::Optional<std::string>();

        return Poco::Optional<std::string>(value.asString());
    }

    //-----------------------------------------------------------------------------
    std::map< std::string, std::string > HttpCommandInterface::getParameters(const std::vector<std::string> &names)
    {
        // Build request string
        std::map< std::string, std::string > key_values;
        std::string namelist;

        for( std::vector<std::string>::const_iterator s = names.begin(); s != names.end(); s++ ) {
            namelist += (*s + ";");
        }

        namelist.substr(0,namelist.size()-1);

        // Read parameter values via HTTP/JSON request/response
        if( !sendHttpCommand("get_parameter","list",namelist) || ! checkErrorCode()  )
            return key_values;

        // Extract values from JSON property_tree
        for( std::vector<std::string>::const_iterator s = names.begin(); s != names.end(); s++ )
        {
			if( root.isMember(*s) ) {

				Json::Value v = root[*s];
				try {

					if (v.isArray()) {

						std::string arrayString;
						for (int i=0; i<v.size()-1; i++) {
							arrayString += v[i].asString() + ", ";
						}
						arrayString += v[v.size()-1].asString();

						key_values[*s] = arrayString;

					} else if (v.isObject()) {
						key_values[*s] = "OBJECT";
					} else {
						key_values[*s] = v.asString();
					}

				} catch (Exception e) {
					std::cerr << "error: " << e.displayText() << std::endl;
				}
			} else {
                key_values[*s] = "--COULD NOT RETRIEVE VALUE--";
			}
        }

        return key_values;
    }

    //-----------------------------------------------------------------------------
    bool HttpCommandInterface::checkErrorCode()
    {
		Json::Value error_value = root["error_code"];
		Json::Value error_string = root["error_text"];

		if (!root.isMember("error_code") || !root["error_code"].isNumeric() || root["error_code"].asInt() != 0 || !root["error_text"].isString() || root["error_text"].asString() != "success") {

			if (root["error_text"].isString()) {
				std::cerr << "ERROR: scanner replied: " << root["error_text"].asString() << std::endl;
			}

			return false;
		}

        return true;
    }

    //-----------------------------------------------------------------------------
    Poco::Optional<ProtocolInfo> HttpCommandInterface::getProtocolInfo()
    {
        // Read protocol info via HTTP/JSON request/response
        if( !sendHttpCommand("get_protocol_info") || !checkErrorCode() )
            return Poco::Optional<ProtocolInfo>();

        // Read and set protocol info
		Json::Value protocol_name = root["protocol_name"];
		Json::Value version_major = root["version_major"];
		Json::Value version_minor = root["version_minor"];
		Json::Value ocommands = root["commands"];

		if (!protocol_name.isString() || !version_major.isNumeric() || !version_minor.isNumeric() || ocommands.isNull())
			return Poco::Optional<ProtocolInfo>();

        ProtocolInfo pi;
		pi.protocol_name = protocol_name.asString();
		pi.version_major = version_major.asInt();
		pi.version_minor = version_minor.asInt();

		if (ocommands.isArray()) {
			for (int i=0; i<ocommands.size(); i++) {
				Json::Value v = ocommands[i];

				try {
					pi.commands.push_back(v.asString());
				} catch(Exception e) {
					std::cerr << e.displayText();
				}
			}
		}

        return pi;
    }

    //-----------------------------------------------------------------------------
    std::vector< std::string > HttpCommandInterface::getParameterList()
    {
        // Read available parameters via HTTP/JSON request/response
        std::vector< std::string > parameter_list;
        if( !sendHttpCommand("list_parameters") || !checkErrorCode() )
            return parameter_list;

		Json::Value oparameters = root["parameters"];

		if (oparameters.isNull()) {
			return parameter_list;
		}

		if (oparameters.isArray()) {
			for (int i=0; i<oparameters.size(); i++) {
				Json::Value v = oparameters[i];
				try {
					parameter_list.push_back(v.asString());
				} catch(Exception e) {
					std::cerr << e.displayText();
				}
			}
		}

        return parameter_list;
    }

    //-----------------------------------------------------------------------------
    Poco::Optional<HandleInfo> HttpCommandInterface::requestHandleTCP(int start_angle)
    {
        // Prepare HTTP request
        std::map< std::string, std::string > params;
        params["packet_type"] = "C";
        params["start_angle"] = Poco::NumberFormatter::format(start_angle);

        // Request handle via HTTP/JSON request/response
        if( !sendHttpCommand("request_handle_tcp", params) || !checkErrorCode() )
            return Poco::Optional<HandleInfo>();

		Json::Value port = root["port"];
		Json::Value handle = root["handle"];

		if(!port.isInt() || !handle.isString())
			return Poco::Optional<HandleInfo>();

        // Prepare return value
        HandleInfo hi;
        hi.handle_type = HandleInfo::HANDLE_TYPE_TCP;
		hi.handle = handle.asString();
        hi.hostname = http_host_;
		hi.port = port.asInt();
        hi.packet_type = 'C';
        hi.start_angle = start_angle;
        hi.watchdog_enabled = true;
        hi.watchdog_timeout = 60000;
        return hi;
    }

    //-----------------------------------------------------------------------------
    Poco::Optional<HandleInfo> HttpCommandInterface::requestHandleUDP(int port, std::string hostname, int start_angle)
    {
        // Prepare HTTP request
        if( hostname == "" )
            hostname = discoverLocalIP();
        std::map< std::string, std::string > params;
        params["packet_type"] = "C";
        params["start_angle"] = Poco::NumberFormatter::format(start_angle);
        params["port"] = Poco::NumberFormatter::format(port);
        params["address"] = hostname;

        // Request handle via HTTP/JSON request/response
        if( !sendHttpCommand("request_handle_udp", params) || !checkErrorCode() )
            return Poco::Optional<HandleInfo>();

		Json::Value handle = root["handle"];
		if(!handle.isString())
			return Poco::Optional<HandleInfo>();

        // Prepare return value
        HandleInfo hi;
        hi.handle_type = HandleInfo::HANDLE_TYPE_UDP;
		hi.handle = handle.asString();
        hi.hostname = hostname;
        hi.port = port;
        hi.packet_type = 'C';
        hi.start_angle = start_angle;
        hi.watchdog_enabled = true;
        hi.watchdog_timeout = 60000;
        return hi;
    }

    //-----------------------------------------------------------------------------
    bool HttpCommandInterface::releaseHandle(const std::string& handle)
    {
        if( !sendHttpCommand("release_handle", "handle", handle) || !checkErrorCode() )
            return false;
        return true;
    }

    //-----------------------------------------------------------------------------
    bool HttpCommandInterface::startScanOutput(const std::string& handle)
    {
        if( !sendHttpCommand("start_scanoutput", "handle", handle) || !checkErrorCode() )
            return false;
        return true;
    }

    //-----------------------------------------------------------------------------
    bool HttpCommandInterface::stopScanOutput(const std::string& handle)
    {
        if( !sendHttpCommand("stop_scanoutput", "handle", handle) || !checkErrorCode() )
            return false;
        return true;
    }
    //-----------------------------------------------------------------------------
    bool HttpCommandInterface::feedWatchdog(const std::string &handle)
    {
        if( !sendHttpCommand("feed_watchdog", "handle", handle) || !checkErrorCode() )
            return false;
        return true;
    }

    //-----------------------------------------------------------------------------
    bool HttpCommandInterface::rebootDevice()
    {
        if( !sendHttpCommand("reboot_device") || !checkErrorCode() )
            return false;
        return true;
    }

    //-----------------------------------------------------------------------------
    bool HttpCommandInterface::resetParameters(const std::vector<std::string> &names)
    {
        // Prepare HTTP request
        std::string namelist;

        for( std::vector<std::string>::const_iterator s = names.begin(); s != names.end(); s++ )
            namelist += (*s + ";");
        namelist.substr(0,namelist.size()-1);

        if( !sendHttpCommand("reset_parameter","list",namelist) || ! checkErrorCode()  )
            return false;

        return true;
    }

    //-----------------------------------------------------------------------------
    std::string HttpCommandInterface::discoverLocalIP()
    {
        std::string local_ip;
        try
        {
			SocketAddress sa(http_host_, http_port_);
			DatagramSocket sock;
			sock.connect(sa);

			// get host address
			SocketAddress a = sock.address();
			local_ip = a.host().toString();

			sock.close();
        }
        catch (std::exception& e)
        {
            std::cerr << "Could not deal with socket-exception: " << e.what() << std::endl;
        }

        return local_ip;
    }
}


text:
<!DOCTYPE html>

  <meta charset="utf-8">
  <base data-ice="baseUrl" href>
  <title data-ice="title">Source | datamatic</title>
  <link type="text/css" rel="stylesheet" href="css/style.css">
  <link type="text/css" rel="stylesheet" href="css/prettify-tomorrow.css">

<meta name="description" content="RxJS + JSON-Schema (Ajv) Based Observable and Validating Data Models and Pipelines"><meta property="twitter:card" content="summary"><meta property="twitter:title" content="datamatic"><meta property="twitter:description" content="RxJS + JSON-Schema (Ajv) Based Observable and Validating Data Models and Pipelines">

  Home

  Reference
  Source

    <input class="search-input">

CAjvWrapper

ModelCAjvWrapper

CNotifiers

CMetaData

CObserverBuilder

CSchemaHelpers

CBaseModel

CModel

CItemsModel

CPropertiesModel

FgetDefaults

FgetPatternPropertyDefaults

FgetSchemaID

FmakeClean

FmakeDirty

FrefAtKeyValidation

FrefValidation

Fvalidate

FwalkObject

V_ajvRef

V_dirtyModels

V_mdRef

V_oBuilders

V_object

V_observerPaths

V_observers

V_schemaHelpers

V_schemaOptions

V_schemaSignatures

V_validators

PipelineCExecutor

CIterator

CPipeListener

CPipeline

CProperties

CValidator

CAjvWrapper

CVxBehaviorSubject

FcastToExec

Ffill

FhandleAsync

FmapArgs

FwrapCallback

V_observers

Source 207/255

      File
      Identifier
      Document
      Size
      Lines
      Updated

      src/Model/_ajvWrapper.js
      AjvWrapper
      77 %7/9
      6952 byte
      233
      2021-10-07 19:06:01 (UTC)

      src/Model/_ajvWrapper.test.js
      -
      -
      1739 byte
      49
      2021-10-03 18:47:22 (UTC)

      src/Model/_branchNotifier.js
      Notifiers
      85 %12/14
      3945 byte
      149
      2021-10-03 18:47:22 (UTC)

      src/Model/_metaData.js
      MetaData
      83 %10/12
      3443 byte
      125
      2021-10-03 18:47:22 (UTC)

      src/Model/_metadata.test.js
      -
      -
      1688 byte
      35
      2021-02-07 15:05:53 (UTC)

      src/Model/_observerBuilder.js
      ObserverBuilder
      76 %10/13
      4871 byte
      170
      2021-10-03 18:47:22 (UTC)

      src/Model/_observerBuilder.test.js
      -
      -
      2228 byte
      74
      2021-10-03 18:47:22 (UTC)

      src/Model/_references.js
      _ajvRef
_dirtyModels
_mdRef
_oBuilders
_object
_observerPaths
_observers
_schemaHelpers
_schemaOptions
_schemaSignatures
_validators
      100 %11/11
      2665 byte
      106
      2021-10-03 18:47:22 (UTC)

      src/Model/_references.test.js
      -
      -
      787 byte
      27
      2021-10-03 18:47:22 (UTC)

      src/Model/_schemaHelpers.js
      SchemaHelpers
      83 %5/6
      3725 byte
      112
      2021-10-03 18:47:22 (UTC)

      src/Model/_schemaHelpers.test.js
      -
      0 %0/1
      1748 byte
      48
      2021-10-03 18:47:22 (UTC)

      src/Model/base-model.js
      BaseModel
      96 %25/26
      11457 byte
      403
      2021-10-03 18:47:22 (UTC)

      src/Model/base-model.test.js
      -
      -
      1674 byte
      55
      2021-10-03 18:47:22 (UTC)

      src/Model/index.js
      Model
      95 %22/23
      8835 byte
      325
      2021-10-01 17:34:03 (UTC)

      src/Model/index.test.js
      -
      -
      1864 byte
      60
      2021-10-07 19:06:01 (UTC)

      src/Model/itemsModel.js
      ItemsModel
      77 %7/9
      8168 byte
      270
      2021-10-03 18:47:22 (UTC)

      src/Model/itemsModel.test.js
      -
      -
      12168 byte
      365
      2021-10-03 18:47:22 (UTC)

      src/Model/model-pipes.test.js
      -
      -
      3247 byte
      108
      2021-10-03 18:47:22 (UTC)

      src/Model/model-rxjs.test.js
      -
      -
      2977 byte
      98
      2021-10-03 18:47:22 (UTC)

      src/Model/propertiesModel.js
      PropertiesModel
      100 %11/11
      7789 byte
      276
      2021-10-03 18:47:22 (UTC)

      src/Model/propertiesModel.test.js
      -
      -
      8879 byte
      256
      2021-10-03 18:47:22 (UTC)

      src/Model/utils.js
      getDefaults
getPatternPropertyDefaults
getSchemaID
makeClean
makeDirty
refAtKeyValidation
refValidation
validate
walkObject
      100 %10/10
      5833 byte
      217
      2021-02-07 15:05:53 (UTC)

      src/Model/utils.test.js
      -
      -
      6196 byte
      166
      2021-10-07 19:06:01 (UTC)

      src/Pipeline/Executor.js
      Executor
      66 %2/3
      2391 byte
      75
      2021-02-02 03:08:52 (UTC)

      src/Pipeline/Iterator.js
      Iterator
      0 %0/6
      1325 byte
      51
      2021-02-02 03:08:52 (UTC)

      src/Pipeline/Iterator.test.js
      -
      -
      1678 byte
      51
      2021-02-02 03:08:52 (UTC)

      src/Pipeline/Pipe-api.test.js
      -
      0 %0/1
      17514 byte
      618
      2021-10-07 20:29:03 (UTC)

      src/Pipeline/Pipe-exec.js
      -
      -
      3689 byte
      137
      2021-10-03 18:47:22 (UTC)

      src/Pipeline/Pipe.test.js
      -
      -
      5413 byte
      208
      2021-10-03 18:47:22 (UTC)

      src/Pipeline/Pipeline.js
      PipeListener
Pipeline
      83 %30/36
      16033 byte
      579
      2021-10-07 16:31:34 (UTC)

      src/Pipeline/Properties.js
      Properties
      50 %1/2
      6277 byte
      173
      2021-10-03 18:47:22 (UTC)

      src/Pipeline/Utils.js
      castToExec
fill
handleAsync
mapArgs
wrapCallback
      100 %6/6
      5055 byte
      182
      2021-10-01 16:23:48 (UTC)

      src/Pipeline/Utils.test.js
      -
      0 %0/1
      3215 byte
      88
      2021-02-02 03:08:52 (UTC)

      src/Pipeline/Validator.js
      Validator
_observers
      72 %13/18
      6750 byte
      227
      2021-10-07 01:59:05 (UTC)

      src/Pipeline/Validator.test.js
      -
      -
      2204 byte
      74
      2021-02-02 03:08:52 (UTC)

      src/Pipeline/_ajvWrapper.js
      AjvWrapper
      66 %10/15
      6537 byte
      236
      2021-10-02 13:23:41 (UTC)

      src/Pipeline/_ajvWrapper.test.js
      -
      -
      2138 byte
      72
      2021-10-02 13:23:41 (UTC)

      src/Pipeline/index.js
      -
      -
      1381 byte
      27
      2021-02-02 03:08:52 (UTC)

      src/Pipeline/vxBehaviorSubject.js
      VxBehaviorSubject
      75 %6/8
      4119 byte
      129
      2021-10-03 18:47:22 (UTC)

      src/Pipeline/vxBehaviorSubject.test.js
      -
      -
      1039 byte
      51
      2021-02-02 03:08:52 (UTC)

      src/ajv-options.js
      -
      -
      1466 byte
      59
      2021-10-03 18:47:22 (UTC)

      src/ajvWrapper.js
      AjvWrapper
      69 %9/13
      6466 byte
      239
      2021-10-02 13:23:41 (UTC)

      src/complex-schema.test.js
      -
      -
      2242 byte
      62
      2021-10-03 18:47:22 (UTC)

      src/dist.test.js
      -
      0 %0/1
      1044 byte
      42
      2021-02-01 16:08:36 (UTC)

      src/index.js
      -
      -
      1510 byte
      31
      2021-02-02 03:08:52 (UTC)

      src/index.test.js
      -
      -
      993 byte
      29
      2021-02-02 03:08:52 (UTC)

      src/schemas/default-pipe-vo.schema.js
      -
      -
      396 byte
      21
      2021-02-07 15:05:53 (UTC)

      src/schemas/pipe-args.schema.js
      -
      -
      2204 byte
      83
      2021-02-07 15:05:53 (UTC)

  Generated by ESDoc(1.1.0)


text:
require 'rubygems'
begin
  require 'nokogiri'
rescue LoadError
end
require 'mechanize'
require 'yaml'

# The automated RockBands live player driver.
class Rocker
  # Create an automated player driver.
  #
  # The required options are:
  #   udid:: the iPhone / iPod's UDID, which identifies the player
  #   pf:: security parameter; computation method TBR (SHA-256 / AES-256?)
  #
  # The options can also be a file name or an IO stream. In that case, YAML will
  # be used to read the options from the file or stream.
  def initialize(options)
    # Accept a file name, and treat it as a YML file.
    if options.respond_to? :to_str
      options = File.open(options, 'r') { |f| YAML.load f }
    end
    # Accept a stream, and read the YML options from there.
    if options.kind_of? IO
      options = YAML.load options
    end
    @user_udid = options[:udid] || options['udid']
    @user_pf =  options[:pf] || options['pf']

    @agent = WWW::Mechanize.new
    @agent.user_agent = self.class.user_agent
    _login
  end

  # A value for User-Agent: accepected by the game server.
  def self.user_agent
    'Mozilla/5.0 ' +
        '(iPhone; U; CPU iPhone OS 3_0 like Mac OS X; en-us) ' +
        'AppleWebKit/528.18 (KHTML, like Gecko) Mobile/7A312g'
  end

  # The host URI for the game server.
  def self.host
    'http://rol.storm8.com'
  end

  # Fetches a page from the game server.
  def _fetch_page(verb, page_name, parameters = {})
    attempts = 5
    loop do
      begin
        return @agent.send(verb, File.join(self.class.host, page_name),
                           parameters)
      rescue
        attempts -= 1
        raise if attempts == 0
      end
    end
  end

  # Fetches a page from the game server via a GET.
  def _get_page(page_name, parameters = {})
    _fetch_page :get, page_name, parameters
  end

  # Fetches a page from the game server via a POST.
  def _post_page(page_name, parameters = {})
    _fetch_page :post, page_name, parameters
  end

  # Extracts a nonce needed by the server to process state-changing requests.
  #
  # The nonces depend on the form that needs to be submitted. Therefore, the
  # page_or_page_name argument should either have a Mechanize page to parse,
  # or a string containing the relative URL of a page containing the form to be
  # submitted. If the argument is a string, it can be followed by a hash of
  # parameters that works similarly to _get_page.
  def _get_form_nonce(page_or_page_name, args = {})
    if page_or_page_name.kind_of? String
      page = _get_page page_or_page_name, args
    else
      page = page_or_page_name
    end
    match_data = /formNonce=([^&"]*)(\&|\")/.match page.body
    match_data[1]
  end

  # Logs into the game, to get the player cookie.
  #
  # This is called in initialize, and should not be called directly.
  def _login
    _get_page 'index.php', :version => '1.0', :udid => @user_udid,
                           :pf => @user_pf, :pnum => '', :model => 'iPhone'
  end

  # Retrieves the player's home page.
  def _home_page
    _get_page 'home.php', :promote => ''
  end

  # True if the page indicates that the previous action succeeded, false if
  # the page indicates the action failed.
  def _page_indicates_success?(page)
    return true if page.root.css('.messageBoxSuccess').length > 0
    return false if page.root.css('.messageBoxFail').length > 0
    return nil
  end

  # Retrieves the players' battle page.
  def _battle_page
    _get_page 'fight.php', :promote => ''
  end
end


text:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>com.starquestminecraft</groupId>
        <artifactId>bukkit-plugin</artifactId>
        <version>1.0</version>
    </parent>

    <groupId>com.starquestminecraft.bukkit</groupId>
    <artifactId>orbits-configupdater</artifactId>
    <version>1.1.0</version>

    <name>SQOrbitsConfigUpdater</name>

    <developers>
        <developer>
            <id>lawrencethefrog</id>
            <roles>
                <role>developer</role>
            </roles>
        </developer>
    </developers>

</project>


text:
import posixpath

from fabric.api import settings, run, sudo, puts, warn, hide

from . import system
from .containers import conf
from .task import Task

__all__ = [
    'install',
    'dump',
    'execute',
    'create_user',
    'drop_user',
    'create_db',
    'drop_db',
    'grant',
]

class Install(Task):
    """Installs MySQL."""

    VERSIONS = {
        'lenny': '5.0',
        'squeeze': '5.1',
        'lucid': '5.1',
        'maverick': '5.1',
    }

    def is_installed(self):
        with settings(warn_only=True):
            output = run('mysql --version')
        return output.succeeded

    def do(self):
        if self.is_installed():
            puts('Mysql is already installed.')
            return

        system.package_install.run(packages='debconf-utils')

        version = self.VERSIONS[self.conf.os]
        debconf_defaults = [
            'mysql-server-%s mysql-server/root_password_again password %s' %
                (version, self.conf.db_root_password),
            'mysql-server-%s mysql-server/root_password password %s' %
                (version, self.conf.db_root_password),
        ]
        sudo('echo "%s" | debconf-set-selections' %
             '\n'.join(debconf_defaults))

        message = ['\n', '=' * 10, '\n',
                   'MySQL root password is "%s"' % self.conf.db_root_password,
                   '\n', '=' * 10, '\n']
        warn(''.join(message))
        system.package_install.run(packages='mysql-server')

install = Install()

class Dump(Task):
    @conf
    def filename(self):
        return '%(db_name)s%(current_time)s.sql' % self.conf

    @conf
    def filepath(self):
        return posixpath.join(self.conf.backup_path, self.conf.filename)

    @conf
    def command(self):
        return 'mysqldump --user="%(db_user)s" --password="%(db_password)s" ' \
               '%(db_name)s > %(filepath)s' % self.conf

    def do(self):
        return run(self.command)

dump = Dump()

class Execute(Task):
    @conf
    def escaped_sql(self):
        return self.conf.sql.replace('"', r'\"')

    def do(self):
        return run('echo "%(escaped_sql)s" | mysql --user="%(db_root_user)s" '
                   '--password="%(db_root_password)s"' % self.conf)

execute = Execute()

class CreateUser(Execute):
    SQL_USER_EXISTS = "SHOW GRANTS FOR '%(db_user)s'@localhost;"
    SQL_CREATE_USER = """
    CREATE USER '%(db_user)s'@localhost
    IDENTIFIED BY '%(db_password)s';
    """.strip()

    @conf
    def sql_user_exists(self):
        return self.SQL_USER_EXISTS % self.conf

    @conf
    def sql(self):
        return self.SQL_CREATE_USER % self.conf

    def user_exists(self):
        with settings(hide('warnings', 'running', 'stdout', 'stderr'),
                      warn_only=True):
            with execute.tmp_conf(self.conf):
                result = execute.run(sql=self.conf.sql_user_exists)
        return result.succeeded

    def do(self):
        if self.user_exists():
            puts('MySQL user "%(db_user)s" already exists' % self.conf)
            return
        super(CreateUser, self).do()

create_user = CreateUser()

class DropUser(Execute):
    SQL_DROP_USER = "DROP USER '%(db_user)s'@localhost;"

    @conf
    def sql(self):
        return self.SQL_DROP_USER % self.conf

drop_user = DropUser()

class CreateDb(Execute):
    SQL_CREATE_DB = """
    CREATE DATABASE %(db_name)s
    DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
    """.strip()

    @conf
    def sql(self):
        return self.SQL_CREATE_DB % self.conf

create_db = CreateDb()

class DropDb(Execute):
    SQL_DROP_DB = "DROP DATABASE %(db_name)s;"

    @conf
    def sql(self):
        return self.SQL_DROP_DB % self.conf

drop_db = DropDb()

class Grant(Execute):
    SQL_GRANT = """
    GRANT ALL ON %(db_name)s.* TO '%(db_user)s'@'localhost';
    FLUSH PRIVILEGES;
    """.strip()

    @conf
    def sql(self):
        return self.SQL_GRANT % self.conf

grant = Grant()


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
#if (OrganizationalAuth || IndividualAuth)
using Microsoft.AspNetCore.Authentication.Extensions;
#endif
using Microsoft.AspNetCore.Builder;
#if (IndividualLocalAuth)
using Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore;
using Microsoft.AspNetCore.Diagnostics.Identity.Service;
#endif
using Microsoft.AspNetCore.Hosting;
#if (OrganizationalAuth || IndividualAuth)
using Microsoft.AspNetCore.Rewrite;
#endif
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;

namespace Company.WebApplication1
{
    public class Startup
    {
        public Startup(IConfiguration configuration)
        {
            Configuration = configuration;
        }

        public IConfiguration Configuration { get; }

        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
#if (IndividualLocalAuth)
            services.AddIdentityServiceAuthentication();
#elseif (IndividualB2CAuth)
            services.AddAzureAdB2CWebApiAuthentication();
#elseif (OrganizationalAuth)
            services.AddAzureAdWebApiAuthentication();
#endif
#if (OrganizationalAuth || IndividualAuth)

#endif
            services.AddMvc();
        }

        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
        {
#if (IndividualLocalAuth)
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseDatabaseErrorPage();
                app.UseDevelopmentCertificateErrorPage(Configuration);
            }

            app.UseStaticFiles();

#endif
#if (OrganizationalAuth || IndividualAuth)
            app.UseRewriter(new RewriteOptions().AddIISUrlRewrite(env.ContentRootFileProvider, "urlRewrite.config"));

            app.UseAuthentication();

#endif
            app.UseMvc();
        }
    }
}