text:
package org.fiteagle.north.sfa.aaa;

import org.bouncycastle.asn1.x500.RDN;
import org.bouncycastle.asn1.x500.X500Name;
import org.bouncycastle.asn1.x500.style.BCStrictStyle;
import org.bouncycastle.asn1.x500.style.IETFUtils;
import org.bouncycastle.cert.jcajce.JcaX509CertificateHolder;
import org.bouncycastle.openssl.PEMWriter;
import org.fiteagle.north.sfa.util.URN;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.StringWriter;
import java.security.*;
import java.security.cert.Certificate;
import java.security.cert.CertificateEncodingException;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.LinkedList;
import java.util.List;

//
//import java.io.FileInputStream;
//import java.io.FileOutputStream;
//import java.io.IOException;
//import java.io.StringWriter;
//import java.security.Key;
//import java.security.KeyStore;
//import java.security.KeyStore.Entry;
//import java.security.KeyStore.PasswordProtection;
//import java.security.KeyStore.PrivateKeyEntry;
//import java.security.KeyStoreException;
//import java.security.NoSuchAlgorithmException;
//import java.security.PrivateKey;
//import java.security.UnrecoverableEntryException;
//import java.security.cert.Certificate;
//import java.security.cert.CertificateEncodingException;
//import java.security.cert.CertificateException;
//import java.security.cert.X509Certificate;
//import java.util.ArrayList;
//import java.util.Enumeration;
//import java.util.LinkedList;
//import java.util.List;
//
//import org.bouncycastle.asn1.x500.RDN;
//import org.bouncycastle.asn1.x500.X500Name;
//import org.bouncycastle.asn1.x500.style.BCStrictStyle;
//import org.bouncycastle.asn1.x500.style.IETFUtils;
//import org.bouncycastle.cert.jcajce.JcaX509CertificateHolder;
//import org.bouncycastle.openssl.PEMWriter;
//import org.fiteagle.core.config.FiteaglePreferences;
//import org.fiteagle.core.config.FiteaglePreferencesXML;
//import org.fiteagle.core.util.URN;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//
//
public class KeyStoreManagement {

//private FiteaglePreferences preferences;

private final String KEYSTORE_LOCATION= System.getProperty("jboss.server.config.dir") + System.getProperty("file.separator") + System.getProperty("keystore_name");
private final String KEYSTORE_PASSWORD = System.getProperty("keystore_pass");
private final String CA_ALIAS =System.getProperty("ca_alias");
private final String CA_PRK_PASS = System.getProperty("ca_prk_pass");
private final String PRK_PASS= System.getProperty("prk_pass");
private final String TRUSTSTORE_LOCATION= System.getProperty("jboss.server.config.dir") + System.getProperty("file.separator") + System.getProperty("truststore_name");
private final String TRUSTSTORE_PASSWORD =  System.getProperty("truststore_pass");
private final String SERVER_ALIAS =System.getProperty("server_alias");
private final String SA_ALIAS=System.getProperty("sa_alias");
private final String SA_PASS=System.getProperty("sa_prkey_pass");
private final String RESOURCE_STORE_LOCATION = System.getProperty("jboss.server.config.dir") + System.getProperty("file.separator") + System.getProperty("resourceStore_name");
private final String RESOURCE_STORE_PASS = System.getProperty("resourceStore_pass");
private static KeyStoreManagement keyStoreManagement;
//
private enum StoreType{
  KEYSTORE,TRUSTSTORE,RESOURCESTORE;
}
public static KeyStoreManagement getInstance(){
  if(keyStoreManagement == null)
    keyStoreManagement = new KeyStoreManagement();
  return keyStoreManagement;

}
private KeyStoreManagement(){

}

protected KeyStore loadKeyStore(StoreType type) throws KeyStoreException, NoSuchAlgorithmException, CertificateException, IOException{
  KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType());
  FileInputStream fis = new FileInputStream(getStorePath(type));
  char[] pass = getStorePass(type);
  ks.load(fis, pass);
  return ks;
}

  private char[] getStorePass(StoreType type) {
    switch(type) {
      case KEYSTORE:
        return getKeyStorePassword();

      case TRUSTSTORE:
        return getTrustStorePassword();

      case RESOURCESTORE:
        return getResourceStorePass();

      default:
        return getTrustStorePassword();
      }
}
  private String getStorePath(StoreType type) {
    switch(type) {
    case KEYSTORE:
      return getKeyStorePath();
    case TRUSTSTORE:
      return getTrustStorePath();

    case RESOURCESTORE:
      return getResourceStorePath();

    default:
      return getTrustStorePath();
    }
}
  private char[] getTrustStorePassword() {
    return TRUSTSTORE_PASSWORD.toCharArray();
}
  private String getTrustStorePath() {
    return TRUSTSTORE_LOCATION;
}
  protected void storeCertificate(String alias, X509Certificate cert, StoreType type) throws KeyStoreException, NoSuchAlgorithmException, CertificateException, IOException {
    KeyStore ks = loadKeyStore(type);
    ks.setCertificateEntry(alias, cert);
    FileOutputStream fos = new FileOutputStream(getStorePath(type));
    char[] pass = getStorePass(type);
    ks.store(fos, pass);

  }

  private String getCAAlias() {

    return CA_ALIAS;
  }

  private String getKeyStorePath() {
    return KEYSTORE_LOCATION;
  }

  public char[] getPrivateKeyPassword(){
    return PRK_PASS.toCharArray();
  }
  private char[] getKeyStorePassword() {
    return KEYSTORE_PASSWORD.toCharArray();
  }
  public PrivateKey getCAPrivateKey() throws KeyStoreException, NoSuchAlgorithmException, CertificateException, IOException, UnrecoverableEntryException {
    PrivateKey privateKey = null;
    KeyStore  ks = loadKeyStore(StoreType.TRUSTSTORE);
    KeyStore.PasswordProtection protection = new KeyStore.PasswordProtection(getCAPrivateKeyPassword());
    KeyStore.Entry keyStoreEntry = ks.getEntry(getCAAlias(), protection);
    if(keyStoreEntry instanceof KeyStore.PrivateKeyEntry){
         KeyStore.PrivateKeyEntry privateKeyEntry = (KeyStore.PrivateKeyEntry)keyStoreEntry;
         privateKey = privateKeyEntry.getPrivateKey();

    }else {
      throw new PrivateKeyException();
    }
    return privateKey;
  }

  private char[] getCAPrivateKeyPassword() {
    return CA_PRK_PASS.toCharArray();
  }
  protected X509Certificate getCACert() throws KeyStoreException, NoSuchAlgorithmException, CertificateException, IOException  {
    KeyStore ks = loadKeyStore(StoreType.TRUSTSTORE);
    X509Certificate caCert = (X509Certificate) ks.getCertificate(getCAAlias());
    return caCert;
  }

  protected List<X509Certificate> getTrustedCerts() throws KeyStoreException, NoSuchAlgorithmException, CertificateException, IOException {

    KeyStore ks = loadKeyStore(StoreType.TRUSTSTORE);
    List<X509Certificate> certificateList = new LinkedList<>();

    for(Enumeration<String> aliases=  ks.aliases(); aliases.hasMoreElements();){
            certificateList.add((X509Certificate)(ks.getCertificate(aliases.nextElement())));
    }

    return certificateList;
  }

  public List<String> getTrustedCertsCommonNames() throws KeyStoreException, NoSuchAlgorithmException, CertificateException, IOException{
    List<X509Certificate> certs;
    certs = getTrustedCerts();

    List<String> certsAsStrings = new ArrayList<String>();
    for(X509Certificate cert : certs){
      certsAsStrings.add(getCertificateCommonName(cert));
    }

    return certsAsStrings;
  }

  private String getCertificateCommonName(X509Certificate cert) throws CertificateEncodingException {
    X500Name x500name = new JcaX509CertificateHolder(cert).getSubject();
    RDN commonName = x500name.getRDNs(BCStrictStyle.CN)[0];
   return IETFUtils.valueToString(commonName.getFirst().getValue());
  }

  public String getTrustedCertificate(String commonName) throws KeyStoreException, NoSuchAlgorithmException, CertificateException, IOException{
    for(X509Certificate cert : getTrustedCerts()){
      if(getCertificateCommonName(cert).equals(commonName)){
        return convertToPem(cert);
      }
    }
    return null;
  }

  public String getAllTrustedCertificates() throws IOException, KeyStoreException, NoSuchAlgorithmException, CertificateException {
    String all = "";
    for(X509Certificate cert : getTrustedCerts()){
        all+=convertToPem(cert);
      }
    return all;
  }

  private String convertToPem(X509Certificate cert) throws CertificateEncodingException, IOException{
    StringWriter sw = new StringWriter();
    PEMWriter pemwriter = new PEMWriter(sw);
    pemwriter.writeObject(cert);
    pemwriter.close();

    return sw.toString();
  }

  public X509Certificate[] getStoredCertificate(String alias) {
    try {
      KeyStore ks = loadKeyStore(StoreType.KEYSTORE);
      Certificate[] certChain =  ks.getCertificateChain(alias);
      X509Certificate[] returnChain = new X509Certificate[certChain.length];
      for(int i = 0; i<certChain.length; i++){
        returnChain[i] = (X509Certificate) certChain[i];
      }
      return returnChain;
    } catch (KeyStoreException | NoSuchAlgorithmException | CertificateException | IOException e) {
      throw new CertificateNotFoundException();
    }
  }

  public PrivateKey getServerPrivateKey() throws KeyStoreException, NoSuchAlgorithmException, CertificateException, IOException, UnrecoverableEntryException {
    PrivateKey privateKey = null;
    KeyStore  ks = loadKeyStore(StoreType.KEYSTORE);
    KeyStore.PasswordProtection protection = new KeyStore.PasswordProtection(getPrivateKeyPassword());
    KeyStore.Entry keyStoreEntry = ks.getEntry(getServerAlias(), protection);
    if(keyStoreEntry instanceof KeyStore.PrivateKeyEntry){
         KeyStore.PrivateKeyEntry privateKeyEntry = (KeyStore.PrivateKeyEntry)keyStoreEntry;
         privateKey = privateKeyEntry.getPrivateKey();

    }else {
      throw new PrivateKeyException();
    }
    return privateKey;
  }
  private String getServerAlias() {
    return SERVER_ALIAS;
  }
  public X509Certificate getSliceAuthorityCert() throws KeyStoreException, NoSuchAlgorithmException, CertificateException, IOException {
      String sa_alias = SA_ALIAS;
      X509Certificate cert = (X509Certificate) loadKeyStore(StoreType.TRUSTSTORE).getCertificate(sa_alias);
      return cert;
  }
  public PrivateKey getSAPrivateKey() throws NoSuchAlgorithmException, CertificateException, KeyStoreException, IOException, UnrecoverableEntryException {
    PrivateKey privateKey = null;
    KeyStore  ks = loadKeyStore(StoreType.TRUSTSTORE);
    KeyStore.PasswordProtection protection = new KeyStore.PasswordProtection(getSA_PrivateKeyPassword());
    KeyStore.Entry keyStoreEntry = ks.getEntry(getSAAlias(), protection);
    if(keyStoreEntry instanceof KeyStore.PrivateKeyEntry){
         KeyStore.PrivateKeyEntry privateKeyEntry = (KeyStore.PrivateKeyEntry)keyStoreEntry;
         privateKey = privateKeyEntry.getPrivateKey();

    }else {
      throw new PrivateKeyException();
    }
    return privateKey;
  }
  private String getSAAlias() {
    return SA_ALIAS;
  }
  private char[] getSA_PrivateKeyPassword() {
    return SA_PASS.toCharArray();
  }
  public X509Certificate getResourceCertificate(String alias) throws KeyStoreException, NoSuchAlgorithmException, CertificateException, IOException {
    KeyStore userCertStore = loadKeyStore(StoreType.RESOURCESTORE);
    if(userCertStore.containsAlias(alias)){
      return (X509Certificate) userCertStore.getCertificate(alias);
    }
    throw new CertificateNotFoundException();
  }
  private char[] getResourceStorePass() {
    return RESOURCE_STORE_PASS.toCharArray();
  }
  private String getResourceStorePath() {
    return RESOURCE_STORE_LOCATION;
  }
  public void storeResourceCertificate(X509Certificate cert) throws KeyStoreException, NoSuchAlgorithmException, CertificateException, IOException {
    URN urn = X509Util.getURN(cert);
	String alias  = urn.getSubjectAtDomain();
    storeCertificate(alias, cert, StoreType.RESOURCESTORE);
  }

  public class PrivateKeyException extends RuntimeException {
    private static final long serialVersionUID = 2842186524464171483L;

  }
  public class CertificateNotFoundException extends RuntimeException {
    private static final long serialVersionUID = -3514307715237455008L;

  }
  public List<X509Certificate> getResourceCertificates(List<String> urns) throws KeyStoreException, NoSuchAlgorithmException, CertificateException, IOException {
   KeyStore ks = loadKeyStore(StoreType.RESOURCESTORE);
   List<X509Certificate> certificates = new LinkedList<>();
   for(String urn: urns){
     if(ks.containsAlias(urn))
       certificates.add((X509Certificate) ks.getCertificate(urn));
   }

   return certificates;
  }

}


text:
/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package tech.tablesaw.index;

import com.google.common.base.Preconditions;
import it.unimi.dsi.fastutil.ints.IntArrayList;
import it.unimi.dsi.fastutil.shorts.Short2ObjectAVLTreeMap;
import it.unimi.dsi.fastutil.shorts.Short2ObjectOpenHashMap;
import it.unimi.dsi.fastutil.shorts.Short2ObjectSortedMap;
import tech.tablesaw.api.ShortColumn;
import tech.tablesaw.columns.numbers.ShortColumnType;
import tech.tablesaw.selection.BitmapBackedSelection;
import tech.tablesaw.selection.Selection;

/** An index for {@link ShortColumn} */
public class ShortIndex implements Index {

  private final Short2ObjectAVLTreeMap<IntArrayList> index;

  /** Constructs an index for the given column */
  public ShortIndex(ShortColumn column) {
    Preconditions.checkArgument(
        column.type().equals(ShortColumnType.instance()),
        "Short indexing only allowed on SHORT numeric columns");
    int sizeEstimate = Integer.min(1_000_000, column.size() / 100);
    Short2ObjectOpenHashMap<IntArrayList> tempMap = new Short2ObjectOpenHashMap<>(sizeEstimate);
    for (int i = 0; i < column.size(); i++) {
      short value = column.getShort(i);
      IntArrayList recordIds = tempMap.get(value);
      if (recordIds == null) {
        recordIds = new IntArrayList();
        recordIds.add(i);
        tempMap.trim();
        tempMap.put(value, recordIds);
      } else {
        recordIds.add(i);
      }
    }
    index = new Short2ObjectAVLTreeMap<>(tempMap);
  }

  private static void addAllToSelection(IntArrayList tableKeys, Selection selection) {
    for (int i : tableKeys) {
      selection.add(i);
    }
  }

  /**
   * Returns a bitmap containing row numbers of all cells matching the given int
   *
   * @param value This is a 'key' from the index perspective, meaning it is a value from the
   *     standpoint of the column
   */
  public Selection get(short value) {
    Selection selection = new BitmapBackedSelection();
    IntArrayList list = index.get(value);
    if (list != null) {
      addAllToSelection(list, selection);
    }
    return selection;
  }

  /** Returns a {@link Selection} of all values at least as large as the given value */
  public Selection atLeast(short value) {
    Selection selection = new BitmapBackedSelection();
    Short2ObjectSortedMap<IntArrayList> tail = index.tailMap(value);
    for (IntArrayList keys : tail.values()) {
      addAllToSelection(keys, selection);
    }
    return selection;
  }

  /** Returns a {@link Selection} of all values greater than the given value */
  public Selection greaterThan(short value) {
    Selection selection = new BitmapBackedSelection();
    Short2ObjectSortedMap<IntArrayList> tail = index.tailMap((short) (value + 1));
    for (IntArrayList keys : tail.values()) {
      addAllToSelection(keys, selection);
    }
    return selection;
  }

  /** Returns a {@link Selection} of all values at most as large as the given value */
  public Selection atMost(short value) {
    Selection selection = new BitmapBackedSelection();
    Short2ObjectSortedMap<IntArrayList> head =
        index.headMap((short) (value + 1)); // we add 1 to get values equal to the arg
    for (IntArrayList keys : head.values()) {
      addAllToSelection(keys, selection);
    }
    return selection;
  }

  /** Returns a {@link Selection} of all values less than the given value */
  public Selection lessThan(short value) {
    Selection selection = new BitmapBackedSelection();
    Short2ObjectSortedMap<IntArrayList> head =
        index.headMap(value); // we add 1 to get values equal to the arg
    for (IntArrayList keys : head.values()) {
      addAllToSelection(keys, selection);
    }
    return selection;
  }
}

redpajama_set_name: RedPajamaGithub


text:
redirect_from: /docs/1.0.0-beta.1/interfaces/state.statedeclaration.html
---
<!doctype html>

	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<title>StateDeclaration | UI-Router</title>
	<meta name="description" content="">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<link rel="stylesheet" href="../assets/css/main.css">
	<link rel="stylesheet" href="../assets/css/typedoctheme.css">

						Search
						<input id="tsd-search-field" type="text" />

Preparing search index...

The search index is not available

					UI-Router

						Options

								All

Public

Public/Protected

All

							<input type="checkbox" id="tsd-filter-inherited" checked />
							Inherited
							<input type="checkbox" id="tsd-filter-externals" checked />
							Externals
							<input type="checkbox" id="tsd-filter-only-exported" />
							Only exported

					Menu

					Globals

					state

					StateDeclaration

Interface StateDeclaration

The StateDeclaration object is used to define a state or nested state.
						It should be registered with the $stateProvider.

example

// StateDeclaration object
var foldersState = {
  name: 'folders',
  url: '/folders',
  resolve: {
    allfolders: function(FolderService) {
      return FolderService.list();
    }
  },
  template: "<ul><li ng-repeat='folder in allfolders'>{{folder.name}}</li></ul>",
  controller: function(allfolders, $scope) {
    $scope.allfolders = allfolders;
  }
}

Hierarchy

						StateDeclaration

Index

Properties

abstract

data

name

on<wbr>Enter

on<wbr>Exit

on<wbr>Retain

params

parent

redirect<wbr>To

reload<wbr>OnSearch

resolve

resolve<wbr>Policy

url

views

Properties

abstract: boolean

 abstract state indicator

abstract state indicator

An abstract state can never be directly activated.  Use an abstract state to provide inherited
							properties (url, resolve, data, etc) to children states.

Defined in state/interface.ts:128

data: any

 An inherited property to store state data

An inherited property to store state data

This is a spot for you to store inherited state metadata.
							Child states' data object will prototypally inherit from their parent state.

This is a good spot to put metadata such as requiresAuth.

Note: because prototypal inheritance is used, changes to parent data objects reflect in the child data objects.
								Care should be taken if you are using hasOwnProperty on the data object.
							Properties from parent objects will return false for hasOwnProperty.

Defined in state/interface.ts:402

name: string

 The state name

The state name

A unique state name, e.g. "home", "about", "contacts".
							To create a parent/child state use a dot, e.g. "about.sales", "home.newest".

Note: States require unique names.  If you omit this property, you must provide
							the state name when you register it with the $stateProvider.

Defined in state/interface.ts:120

on<wbr>Enter: TransitionStateHookFn

 A Transition Hook called with the state is being entered.  See: IHookRegistry.onEnter

A Transition Hook called with the state is being entered.  See: IHookRegistry.onEnter

example

.state({
  name: 'mystate',
  onEnter: function(trans, state) {
    console.log("Entering " + state.name);
  }
});

Note: The above onEnter on the state declaration is effectively sugar for:
										```
										transitionService.onEnter({ entering: 'mystate' }, function(trans, state) {
										console.log("Entering " + state.name);
									});</p>
								</dd>
							</dl>
						</div>
					</div>
					<aside class="tsd-sources">
						<ul>
							<li>Defined in <a href="https://github.com/angular-ui/ui-router/blob/70a237a/src/state/interface.ts#L480">state/interface.ts:480</a></li>
						</ul>
					</aside>
				</section>
				<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
					<a name="onexit" class="tsd-anchor"></a>
					<!---->
					<!--<h3><span class="tsd-flag ts-flagOptional">Optional</span> on<wbr>Exit</h3>-->
					<!---->
					<div class="tsd-signature tsd-kind-icon">on<wbr>Exit<span class="tsd-signature-symbol">:</span> <a href="transition.transitionstatehookfn.html" class="tsd-signature-type">TransitionStateHookFn</a>        <div class="tsd-header">
							<p> A Transition Hook called with the state is being exited. See: <a href="transition.ihookregistry.html#onexit">IHookRegistry.onExit</a> </p>
						</div>
					</div>
					<div class="tsd-declaration">
						<div class="tsd-comment tsd-typography">
							<div class="lead">
								<p>A Transition Hook called with the state is being exited. See: <a href="transition.ihookregistry.html#onexit">IHookRegistry.onExit</a></p>
							</div>
							<dl class="tsd-comment-tags">
								<dt>example</dt>
								<dd><pre><code class="lang-js">
.state({
  name: <span class="hljs-string">'mystate'</span>,
  onExit: <span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params">trans, state</span>) </span>{
    <span class="hljs-built_in">console</span>.log(<span class="hljs-string">"Leaving "</span> + state.name);
  }
});
</code></pre>
									<p>Note: The above <code>onRetain</code> on the state declaration is effectively sugar for:
										```
										transitionService.onExit({ exiting: 'mystate' }, function(trans, state) {
										console.log("Leaving " + state.name);
									});

Defined in state/interface.ts:522

on<wbr>Retain: TransitionStateHookFn

 A TransitionStateHookFn called with the state is being retained/kept. See: IHookRegistry.onRetain

A TransitionStateHookFn called with the state is being retained/kept. See: IHookRegistry.onRetain

example

.state({
  name: 'mystate',
  onRetain: function(trans, state) {
    console.log(state.name + " is still active!");
  }
});

Note: The above onRetain on the state declaration is effectively sugar for:
										```
										transitionService.onRetain({ retained: 'mystate' }, function(trans, state) {
										console.log(state.name + " is still active!");
									});</p>
								</dd>
							</dl>
						</div>
					</div>
					<aside class="tsd-sources">
						<ul>
							<li>Defined in <a href="https://github.com/angular-ui/ui-router/blob/70a237a/src/state/interface.ts#L501">state/interface.ts:501</a></li>
						</ul>
					</aside>
				</section>
				<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
					<a name="params" class="tsd-anchor"></a>
					<!---->
					<!--<h3><span class="tsd-flag ts-flagOptional">Optional</span> params</h3>-->
					<!---->
					<div class="tsd-signature tsd-kind-icon">params<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">object</span>        <div class="tsd-header">
							<p> Params configuration </p>
						</div>
					</div>
					<div class="tsd-declaration">
						<div class="tsd-comment tsd-typography">
							<div class="lead">
								<p>Params configuration</p>
							</div>
							<p>An object which optionally configures parameters declared in the url, or defines additional non-url
							parameters. For each parameter being configured, add a <a href="params.paramdeclaration.html">ParamDeclaration</a> keyed to the name of the parameter.</p>
							<dl class="tsd-comment-tags">
								<dt>example</dt>
								<dd><pre><code class="lang-js">
params: {
  param1: {
   type: <span class="hljs-string">"int"</span>,
   array: <span class="hljs-literal">true</span>,
   value: []
  },
  param2: {
    value: <span class="hljs-string">"index"</span>
  }
}
</code></pre>
								</dd>
							</dl>
						</div>
					</div>
					<aside class="tsd-sources">
						<ul>
							<li>Defined in <a href="https://github.com/angular-ui/ui-router/blob/70a237a/src/state/interface.ts#L340">state/interface.ts:340</a></li>
						</ul>
					</aside>
					<div class="tsd-type-declaration">
						<h4>Type declaration</h4>
						<ul class="tsd-parameters">
							<li class="tsd-parameter-index-signature">
								<h5><span class="tsd-signature-symbol">[</span>key: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">]: </span><span class="tsd-signature-type">any</span></h5>
							</li>
						</ul>
					</div>
				</section>
				<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
					<a name="parent" class="tsd-anchor"></a>
					<!---->
					<!--<h3><span class="tsd-flag ts-flagOptional">Optional</span> parent</h3>-->
					<!---->
					<div class="tsd-signature tsd-kind-icon">parent<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><a href="state.statedeclaration.html" class="tsd-signature-type">StateDeclaration</a>        <div class="tsd-header">
							<p> The parent state </p>
						</div>
					</div>
					<div class="tsd-declaration">
						<div class="tsd-comment tsd-typography">
							<div class="lead">
								<p>The parent state</p>
							</div>
							<p>Normally, a state's parent is implied from the state's <a href="state.statedeclaration.html#name">name</a>, e.g., <code>"parentstate.childstate"</code>.</p>
							<p>Alternatively, you can explicitly set the parent state using this property.  This allows shorter state
							names, e.g., <code><a ui-sref="childstate">Child</a></code> instead of `<a ui-sref="parentstate.childstate">Child</a></p>
							<p>When using this property, the state's name should not have any dots in it.</p>
							<dl class="tsd-comment-tags">
								<dt>example</dt>
								<dd><pre><code class="lang-js">
<span class="hljs-keyword">var</span> parentstate = {
  name: <span class="hljs-string">'parentstate'</span>
}
<span class="hljs-keyword">var</span> childstate = {
  name: <span class="hljs-string">'childstate'</span>,
  parent: <span class="hljs-string">'parentstate'</span>
  <span class="hljs-comment">// or use a JS var which is the parent StateDeclaration, i.e.:</span>
  <span class="hljs-comment">// parent: parentstate</span>
}
</code></pre>
								</dd>
							</dl>
						</div>
					</div>
					<aside class="tsd-sources">
						<ul>
							<li>Defined in <a href="https://github.com/angular-ui/ui-router/blob/70a237a/src/state/interface.ts#L154">state/interface.ts:154</a></li>
						</ul>
					</aside>
				</section>
				<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
					<a name="redirectto" class="tsd-anchor"></a>
					<!---->
					<!--<h3><span class="tsd-flag ts-flagOptional">Optional</span> redirect<wbr>To</h3>-->
					<!---->
					<div class="tsd-signature tsd-kind-icon">redirect<wbr>To<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">function</span>        <div class="tsd-header">
							<p> Synchronously or asynchronously redirects Transitions to a different state/params </p>
						</div>
					</div>
					<div class="tsd-declaration">
						<div class="tsd-comment tsd-typography">
							<div class="lead">
								<p>Synchronously or asynchronously redirects Transitions to a different state/params</p>
							</div>
							<p>If this property is defined, a Transition directly to this state will be redirected based on the property's value.</p>
							<ul>
								<li><p>If the value is a <code>string</code>, the Transition is redirected to the state named by the string.</p>
								</li>
								<li><p>If the property is an object with a <code>state</code> and/or <code>params</code> property,
									the Transition is redirected to the named <code>state</code> and/or <code>params</code>.</p>
								</li>
								<li><p>If the value is a <a href="../classes/state.targetstate.html">TargetState</a> the Transition is redirected to the <code>TargetState</code></p>
								</li>
								<li><p>If the property is a function:</p>
									<ul>
										<li>The function is called with two parameters:<ul>
												<li>The current <a href="../classes/transition.transition-1.html">Transition</a></li>
												<li>An injector which can be used to get dependencies using [[UIRInjector.get]]</li>
											</ul>
										</li>
										<li>The return value is processed using the previously mentioned rules.</li>
										<li>If the return value is a promise, the promise is waited for, then the resolved async value is processed using the same rules.</li>
									</ul>
								</li>
							</ul>
							<dl class="tsd-comment-tags">
								<dt>example</dt>
								<dd><p>```js

// a string
										.state('A', {
										redirectTo: 'A.B'
										})
										// a {state, params} object
										.state('C', {
										redirectTo: { state: 'C.D', params: { foo: 'index' } }
										})
										// a fn
										.state('E', {
										redirectTo: () => "A"
										})
										// a fn conditionally returning a {state, params}
										.state('F', {
										redirectTo: (trans) => {
										if (trans.params().foo < 10)
										return { state: 'F', params: { foo: 10 } };
										}
										})
										// a fn returning a promise for a redirect
										.state('G', {
										redirectTo: (trans) => {
										let svc = trans.injector().get('SomeAsyncService')
										let promise = svc.getAsyncRedirectTo(trans.params.foo);
										return promise;
										}
									})

Defined in state/interface.ts:454

Type declaration

($transition$: Transition): TargetState | object | string

Parameters

$transition$: Transition

Returns TargetState
												 |
												object
												 |
												string

reload<wbr>OnSearch: boolean

deprecated

define individual parameters as ParamDeclaration.dynamic

Defined in state/interface.ts:527

resolve: Array<Resolvable | ResolvableLiteral | ProviderLike> | object

 Resolve - a mechanism to asynchronously fetch data, participating in the Transition lifecycle

Resolve - a mechanism to asynchronously fetch data, participating in the Transition lifecycle

The resolve: property defines data (or other dependencies) to be fetched asynchronously when the state
								is being entered.  After the data is fetched, it can be used in views, transition hooks or other resolves
							that belong to this state, or to any views or resolves that belong to nested states.

As an array

Each array element should either be:

a ResolvableLiteral object (a plain old javascript object), e.g., { token: 'token', resolveFn: (http) => http.get('/'), deps: [ Http ] }

a Resolvable object, e.g., new Resolvable('token', (http) => http.get('/'), [ Http ])

an Angular 2 style provider literal, e.g.,
								{ provide: 'token', useFactory: (http) => http.get('/'), deps: [ Http ] }

example

import {Resolvable} from "ui-router-ng2"; // or "angular-ui-router"
...

// ng2 example
resolve: [
  // If you inject `myStateDependency` into a component, you'll get "abc"
  { provide: 'myStateDependency', useFactory: () => 'abc' }, // ng2 style provide literal
  new Resolvable('myFoos', (http, trans) => http.get(`/foos/<span class="hljs-subst">${trans.params().fooId}</span>`), [Http, Transition])
]

As an object

The key (string) is the name of the dependency.

The value (function) is an injectable function which returns the dependency, or a promise for the dependency.

Note: You cannot specify a policy for each Resolvable, nor can you use non-string
									tokens when using the object style resolve: block.

example

// ng1 example
resolve: {
  // If you inject `myStateDependency` into a controller, you'll get "abc"
  myStateDependency: function() {
    return "abc";
  },
  myAsyncData: ['$http', '$transition$' function($http, $transition$) {
    // Return a promise (async) for the data
    return $http.get("/foos/" + $transition$.params().foo);
  }]
}

Lifecycle

Since a resolve function can return a promise, the router will delay entering the state until the  promises
									are ready.  If any of the promises are rejected, the Transition is aborted with an Error.

By default, resolves for a state are fetched just before that state is entered. Note that only states
										which are being entered have their resolves fetched.  States that are "retained" do not have their resolves
										re-fetched.  If you are currently in a parent state A and are transitioning to a child state A.B, the
									previously resolved data for state A can be injected into A.B without delay.

Any resolved data for A.B is retained until A.B is exited, e.g., by transitioning back to the parent state A.

Because of this, resolves are a great place to fetch your application's primary data.

Injecting resolves into other things

During a transition, Resolve data can be injected into:

ui-view Controllers

TemplateProviders and ControllerProviders

Other resolves

Injecting other things into resolves

Since resolve functions are injected, a common pattern is to inject a custom service such as UserService
									and delegate to a custom service method, such as UserService.list();

Angular 1

An Angular 1 resolve function can inject some special values:

$transition$: The current Transition object; information and API about the current transition, such as
										"to" and "from" State Parameters and transition options.

Other resolves: This resolve can depend on another resolve, either from the same state, or from any parent state.

$stateParams: (deprecated) The parameters for the current state (Note: these parameter values are

Angular 2

An Angular 2 resolve function can inject some special values:

Transition: The current Transition object; information and API about the current transition, such as
										"to" and "from" State Parameters and transition options.

Other resolves: This resolve can depend on another resolve, either from the same state, or from any parent state.

example

// Injecting a resolve into another resolve
resolve: [
  // Define a resolve 'allusers' which delegates to the UserService.list()
  // which returns a promise (async) for all the users
  { provide: 'allusers', useFactory: (UserService) => UserService.list(), deps: [UserService] },

  // Define a resolve 'user' which depends on the allusers resolve.
  // This resolve function is not called until 'allusers' is ready.
  { provide: 'user', (allusers, trans) => _.find(allusers, trans.params().userId, deps: ['allusers', Transition] }
}

Defined in state/interface.ts:273

resolve<wbr>Policy: ResolvePolicy

 Sets the resolve policy defaults for all resolves on this state

Sets the resolve policy defaults for all resolves on this state

This should be an ResolvePolicy object.

It can contain the following optional keys/values:

when: (optional) defines when the resolve is fetched. Accepted values: "LAZY" or "EAGER"

async: (optional) if the transition waits for the resolve. Accepted values: "WAIT", "NOWAIT", "RXWAIT"

See ResolvePolicy for more details.

Defined in state/interface.ts:287

url: string

 The url fragment for the state

The url fragment for the state

A URL fragment (with optional parameters) which is used to match the browser location with this state.

This fragment will be appended to the parent state's URL in order to build up the overall URL for this state.
							See UrlMatcher for details on acceptable patterns.

examples

url: "/home"
// Define a parameter named 'userid'
url: "/users/:userid"
// param 'bookid' has a custom regexp
url: "/books/{bookid:[a-zA-Z_-]}"
// param 'categoryid' is of type 'int'
url: "/books/{categoryid:int}"
// two parameters for this state
url: "/books/{publishername:string}/{categoryid:int}"
// Query parameters
url: "/messages?before&after"
// Query parameters of type 'date'
url: "/messages?{before:date}&{after:date}"
// Path and query parameters
url: "/messages/:mailboxid?{before:date}&{after:date}"

Defined in state/interface.ts:317

views: object

 Named views

Named views

An optional object which defines multiple views, or explicitly targets specific named ui-views.

What is a view config

What is a ui-view

Shorthand controller/template

Incompatible with ^

Examples:

Targets three named ui-views in the parent state's template

example

views: {
  header: {
    controller: "headerCtrl",
    templateUrl: "header.html"
  }, body: {
    controller: "bodyCtrl",
    templateUrl: "body.html"
  }, footer: {
    controller: "footCtrl",
    templateUrl: "footer.html"
  }
}

example

// Targets named ui-view="header" from ancestor state 'top''s template, and
// named `ui-view="body" from parent state's template.
views: {
  'header@top': {
    controller: "msgHeaderCtrl",
    templateUrl: "msgHeader.html"
  }, 'body': {
    controller: "messagesCtrl",
    templateUrl: "messages.html"
  }
}

Defined in state/interface.ts:388

Type declaration

[key: string]: _ViewDeclaration

						Globals

						common

						common_<wbr>hof

						common_<wbr>predicates

						common_<wbr>strings

						core

						hooks

						justjs

						ng1

						ng1_<wbr>directives

						ng1_<wbr>state_<wbr>events

						ng2

						ng2_<wbr>directives

						params

						path

						resolve

						state

						trace

						transition

						url

						view

						State

						State<wbr>Builder

						State<wbr>Matcher

						State<wbr>Provider

						State<wbr>Queue<wbr>Manager

						State<wbr>Registry

						State<wbr>Service

						Target<wbr>State

						Builders

						Href<wbr>Options

						Provider<wbr>Like

						State<wbr>Declaration

								abstract

								data

								name

								on<wbr>Enter

								on<wbr>Exit

								on<wbr>Retain

								params

								parent

								redirect<wbr>To

								reload<wbr>OnSearch

								resolve

								resolve<wbr>Policy

								url

								views

						Transition<wbr>Promise

						Builder<wbr>Function

						Resolve<wbr>Types

						State<wbr>OrName

						$<wbr>Included<wbr>ByState<wbr>Filter

						$<wbr>IsState<wbr>Filter

						data<wbr>Builder

						get<wbr>Navigable<wbr>Builder

						get<wbr>Url<wbr>Builder

						includes<wbr>Builder

						params<wbr>Builder

						parse<wbr>Url

						path<wbr>Builder

						resolvables<wbr>Builder

						self<wbr>Builder

Legend

Module

Object literal

Variable

Function

Function with type parameter

Index signature

Type alias

Enumeration

Enumeration member

Property

Method

Interface

Interface with type parameter

Constructor

Property

Method

Index signature

Class

Class with type parameter

Constructor

Property

Method

Accessor

Index signature

Inherited constructor

Inherited property

Inherited method

Inherited accessor

Protected property

Protected method

Protected accessor

Private property

Private method

Private accessor

Static property

Static method

Generated using TypeDoc


text:
package com.voxelplugineering.voxelsniper.forge.service;

import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Set;

import com.google.common.base.Optional;
import com.google.common.collect.Lists;
import com.voxelplugineering.voxelsniper.config.BaseConfiguration;
import com.voxelplugineering.voxelsniper.registry.ProvidedWeakRegistry;
import com.voxelplugineering.voxelsniper.service.AbstractService;
import com.voxelplugineering.voxelsniper.service.registry.MaterialRegistry;
import com.voxelplugineering.voxelsniper.service.registry.RegistryProvider;
import com.voxelplugineering.voxelsniper.util.Context;
import com.voxelplugineering.voxelsniper.world.material.Material;

/**
 * A standard material registry for materials.
 *
 * @param <T> The underlying material type
 */
public class ProvidedMaterialRegistryService<T> extends AbstractService implements MaterialRegistry<T>
{

    private ProvidedWeakRegistry<T, Material> registry;
    private final RegistryProvider<T, Material> provider;
    private String defaultMaterialName;

    /**
     * Creates a new {@link ProvidedMaterialRegistryService} with the given provider.
     *
     * @param provider The material provider
     */
    public ProvidedMaterialRegistryService(Context context, RegistryProvider<T, Material> provider)
    {
        super(context);
        this.provider = provider;
    }

    @Override
    protected void _init()
    {
        this.registry = new ProvidedWeakRegistry<T, Material>(this.provider);
        this.registry.setCaseSensitiveKeys(false);
        this.defaultMaterialName = BaseConfiguration.defaultMaterialName;
    }

    @Override
    protected void _shutdown()
    {
        this.registry = null;
        this.defaultMaterialName = null;
    }

    @Override
    public Material getAirMaterial()
    {
        return getMaterial(this.defaultMaterialName).get();
    }

    @Override
    public Optional<Material> getMaterial(String name)
    {
        check("getMaterial");
        return this.registry.get(name);
    }

    @Override
    public Optional<Material> getMaterial(T material)
    {
        check("getMaterial");
        return this.registry.get(material);
    }

    @Override
    public void registerMaterial(String name, T object, Material material)
    {
        // TODO clean up the registry to remove this method
        throw new UnsupportedOperationException("Cannot register with a provided registry");
    }

    @Override
    public Collection<Material> getMaterials()
    {
        check("getMaterials");
        Set<Map.Entry<T, Material>> entries = this.registry.getRegisteredValues();
        List<Material> mats = Lists.newArrayList();
        for (Map.Entry<T, Material> entry : entries)
        {
            mats.add(entry.getValue());
        }
        return mats;
    }

}


text:
from django.conf.urls import patterns, include, url

from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('',
    # Examples:
    # url(r'^$', 'nextboard.views.home', name='home'),
    # url(r'^blog/', include('blog.urls')),

    url(r'^admin/', include(admin.site.urls)),
    url(r'', include('forum.urls')),
)


text:
<title>Sample Html test form</title>

Sample Html test elements

<form name="frmRegistration" method="post" action="">

Username
		<input type="text" class="demoInputBox" name="userName" value="">

First Name
		<input type="text" class="demoInputBox" name="firstName" value="">

Last Name
		<input type="text" class="demoInputBox" name="lastName" value="">

Password
		<input type="password" class="demoInputBox" name="password" value="">

Confirm Password
		<input type="password" class="demoInputBox" name="confirm_password" value="">

Email
		<input type="text" class="demoInputBox" name="userEmail" value="">

Gender
		<input type="radio" name="gender[]" value="Male" > Male
		<input type="radio" name="gender[]" value="Female" > Female

		<input type="checkbox" name="terms"> I accept Terms and Conditions

<input type="submit" name="submit" value="Register" class="btnRegister">

</form>


text:
package id.ac.ui.edoocatia;

import id.ac.ui.edoocatia.model.Profile;
import id.ac.ui.edoocatia.service.ProfileService;
import id.ac.ui.edoocatia.util.Log;

import java.util.ResourceBundle;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Screen;
import com.badlogic.gdx.assets.AssetManager;
import com.badlogic.gdx.graphics.GL10;
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.ui.Skin;

/**
 * The superclass for all Edunesia game screen.
 *
 * @author Fikrul
 * @author Yahya M.
 */
public abstract class AbstractScreen implements Screen {

	/** Absolute dimension of the screen viewport in pixel. */
	public static final int VIEWPORT_WIDTH = 320, VIEWPORT_HEIGHT = 240;
	//public static final float VIEWPORT_WIDTH = 10f, VIEWPORT_HEIGHT = 6f;

	/**
	 * Do not change the screen.
	 * @see #startScreen(int, AbstractScreen)
	 */
	protected static final int SCREEN_NONE = 0;

	/**
	 * Go to custom screen.
	 * @see #startScreen(int, AbstractScreen)
	 */
	protected static final int SCREEN_CUSTOM = 1;

	/**
	 * Go to Pause screen.
	 * @see #startScreen(int, AbstractScreen)
	 */
	protected static final int SCREEN_PAUSE = 2;

	/**
	 * Go to Menu screen.
	 * @see #startScreen(int, AbstractScreen)
	 */
	protected static final int SCREEN_MENU = 3;

	/** Base name for resources specific for this screen. This field is used only if necessary. */
	protected final String resourceBase;

	/** The stage used for this screen. */
	protected Stage stage;

	/** Asset manager for this screen. Make sure all assets are loaded by using asset manager. */
	protected static AssetManager asset = new AssetManager();

	/** Texture atlas for this screen, loaded from {@link #asset}. */
	protected final TextureAtlas textureAtlas;

	/** Skin for this screen, loaded from {@link #asset}. */
	protected final Skin skin;

	/** Multi-language support for this screen. */
	protected final ResourceBundle lang;

	/** Next screen signature/signal. */
	protected int nextScreenSign;
	protected boolean disposeScreen = false;

	/** Next custom screen (only relevant if nextScreenSign is custom. */
	protected AbstractScreen nextScreenCustom;

	protected Profile profile;

	// CONSTRUCTOR

	/**
	 * Create the screen and initiate the resources.
	 *
	 * @param resourceBase
	 *            base name for resources specific for this screen (e.g.
	 *            "mod1" means all specific resources prefixed with
	 *            "mod1/").
	 */
	public AbstractScreen(String resourceBase) {
		Log.d("SCREEN <CONSTRUCT>");

		/* Apa yang diinisiasi disini, di-dispose di method dispose. */

		this.resourceBase = resourceBase;

		this.stage = new Stage(VIEWPORT_WIDTH, VIEWPORT_HEIGHT, true);

		asset.load("img/pack.atlas", TextureAtlas.class);
		asset.load("skin/uiskin.json", Skin.class);
		asset.finishLoading();

		this.textureAtlas = asset.get("img/pack.atlas", TextureAtlas.class);
		this.skin = asset.get("skin/uiskin.json", Skin.class);
		this.profile = ProfileService.get().getProfile();
		if(resourceBase != null && resourceBase.equals(EdoocatiaGame.MODULE1)
				|| resourceBase.equals(EdoocatiaGame.JELAJAH))
			this.lang = ResourceBundle.getBundle(resourceBase, profile.getPreferredLanguage());
		else
			this.lang = null;
	}

	// METHODS

	@Override
	public void render(float delta) {
		stage.act(delta);

		Gdx.gl.glClearColor(0f, 0f, 0f, 1f);
		Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);

		stage.draw();
	}

	@Override
	public void resize(int width, int height) {
		Log.d("SCREEN RESIZE to " + width + "x" + height);
		stage.setViewport(width, height, true);
	}

	@Override
	public void show() {
		Log.d("SCREEN SHOW");
		Gdx.input.setInputProcessor(stage);
		Gdx.input.setCatchBackKey(true);
		Gdx.input.setCatchMenuKey(true);
	}

	@Override
	public void hide() {
		Log.d("SCREEN HIDE");
		Gdx.input.setInputProcessor(null);
		nextScreenSign = SCREEN_NONE;
	}

	@Override
	public void pause() {
		Log.d("SCREEN PAUSE");
	}

	@Override
	public void resume() {
		Log.d("SCREEN RESUME");
	}

	@Override
	public void dispose() {
		Log.d("SCREEN DISPOSE");
		stage.dispose();
	}

	/**
	 * Start screen.
	 *

	 * Actual swithing is done in the next loop.
	 * @param screen next screen sign (e.g. SCREEN_MENU)
	 * @param customScreen custom screen if screen is SCREEN_CUSTOM
	 */
	protected void startScreen(int screen, AbstractScreen customScreen) {
		nextScreenSign = screen;
		if (screen == SCREEN_CUSTOM)
			nextScreenCustom = customScreen;
	}
}


text:
'use strict';
(function($) {
  $.mimiUI = $.mimiUI || {};
  $.mimiUI.accordion = {
    initializeAll: function() {
      $('[data-accordion-content]').data('accordion-state', 'closed');
    },

    activeHeaderClass: function() {
      return 'mm-accorion__header--active';
    },

    applyClickHandler: function() {
      $('[data-accordion-header]').click(function() {
        var $state = $(this).next('[data-accordion-content]')
                            .data('accordion-state');
        var $contentToReveal = $(this).next('[data-accordion-content]');
        var $contentHeader = $(this);

        if ($state === 'open') {
          $.mimiUI.accordion._closeCurrentAccordion($(this));
          return;
        }

        $.mimiUI.accordion._closeAllAccordions($(this));
        $.mimiUI.accordion._removeActiveClass($(this));

        $contentHeader.addClass($.mimiUI.accordion.activeHeaderClass());
        $contentToReveal.data('accordion-state', 'open');
        $contentToReveal.slideDown('fast');
      });
    },

    _closeAllAccordions: function($currentEl) {
      var $parentAccordion = $currentEl.closest('[data-accordion]');
      var $content = $parentAccordion.find('[data-accordion-content]');

      $content.slideUp('fast');
      $content.data('accordion-state', 'closed');
    },

    _removeActiveClass: function($currentEl) {
      var $parentAccordion = $currentEl.closest('[data-accordion]');
      $parentAccordion.find('[data-accordion-header]')
                      .removeClass($.mimiUI.accordion.activeHeaderClass());
    },

    _closeCurrentAccordion: function($currentEl) {
      var $content = $currentEl.next('[data-accordion-content]');

      $content.slideUp('fast');
      $currentEl.removeClass($.mimiUI.accordion.activeHeaderClass());
      $content.data('accordion-state', 'closed');
    },

    /**
    * Initialize module
    */
    initialize: function() {
      this.initializeAll();
      this.applyClickHandler();
    }
  };
})(jQuery);


text:
static const u16 GROUP_TOOLS_VERSION  	= 0x0000;
//----------------------------------------------------
enum{
    CHUNK_VERSION			= 0x1001ul,
};
//----------------------------------------------------

bool ESceneGroupTools::Load(IReader& F)
{
	u16 version 	= 0;
    if(F.r_chunk(CHUNK_VERSION,&version))
        if( version!=GROUP_TOOLS_VERSION ){
            ELog.DlgMsg( mtError, "%s tools: Unsupported version.",ClassDesc());
            return false;
        }

	if (!inherited::Load(F)) return false;

    return true;
}
//----------------------------------------------------

void ESceneGroupTools::Save(IWriter& F)
{
	inherited::Save	(F);

	F.w_chunk		(CHUNK_VERSION,(u16*)&GROUP_TOOLS_VERSION,sizeof(GROUP_TOOLS_VERSION));
}
//----------------------------------------------------

bool ESceneGroupTools::LoadSelection(IReader& F)
{
	u16 version 	= 0;
    R_ASSERT(F.r_chunk(CHUNK_VERSION,&version));
    if( version!=GROUP_TOOLS_VERSION ){
        ELog.DlgMsg( mtError, "%s tools: Unsupported version.",ClassDesc());
        return false;
    }

	return inherited::LoadSelection(F);
}
//----------------------------------------------------

void ESceneGroupTools::SaveSelection(IWriter& F)
{
	F.w_chunk		(CHUNK_VERSION,(u16*)&GROUP_TOOLS_VERSION,sizeof(GROUP_TOOLS_VERSION));

	inherited::SaveSelection(F);
}
//----------------------------------------------------

void ESceneGroupTools::GetStaticDesc(int& v_cnt, int& f_cnt)
{
	for (ObjectIt it=m_Objects.begin(); it!=m_Objects.end(); it++){
    	CGroupObject* group = (CGroupObject*)(*it);
	    ObjectIt _O1 = group->GetObjects().begin();
    	ObjectIt _E1 = group->GetObjects().end();
	    for(;_O1!=_E1;_O1++){
	    	CSceneObject* obj = dynamic_cast<CSceneObject*>(*_O1);
			if (obj&&obj->IsStatic()){
				f_cnt	+= obj->GetFaceCount();
    	    	v_cnt  	+= obj->GetVertexCount();
	        }
        }
    }
}
//----------------------------------------------------


text:
package com.karanumcoding.adamantineshield.lookup;

import java.io.IOException;
import java.util.UUID;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import org.spongepowered.api.CatalogType;
import org.spongepowered.api.block.BlockType;
import org.spongepowered.api.data.DataView;
import org.spongepowered.api.item.ItemType;
import org.spongepowered.api.text.Text;
import org.spongepowered.api.text.format.TextColors;

import com.flowpowered.math.vector.Vector3i;
import com.google.common.reflect.TypeToken;
import com.karanumcoding.adamantineshield.enums.ActionType;
import com.karanumcoding.adamantineshield.util.DataUtils;
import com.karanumcoding.adamantineshield.util.PlayerUtils;

import ninja.leaping.configurate.ConfigurationNode;
import ninja.leaping.configurate.objectmapping.ObjectMappingException;

public class LookupLine {

	private Vector3i pos;
	private UUID world;
	private ActionType type;
	private String cause;
	private CatalogType target;
	private int count;
	private int slot;
	private String data;
	private boolean rolledBack;
	private long timestamp;

	public LookupLine(Vector3i pos, UUID world, ActionType type, String cause, String data, CatalogType target,
			int count, int slot, boolean rolledBack, long timestamp) {
		this.pos = pos;
		this.world = world;
		this.type = type;
		this.cause = cause;
		this.target = target;
		this.count = count;
		this.slot = slot;
		this.data = data;
		this.rolledBack = rolledBack;
		this.timestamp = timestamp;
	}

	public Vector3i getPos() {
		return pos;
	}

	public int getX() {
		return pos.getX();
	}

	public int getY() {
		return pos.getY();
	}

	public int getZ() {
		return pos.getZ();
	}

	public UUID getWorld() {
		return world;
	}

	public ActionType getAction() {
		return type;
	}

	public String getNamedCause() {
		return cause;
	}

	public boolean causeIsPlayer() {
		return (type == ActionType.PLACE || type == ActionType.DESTROY);
	}

	public UUID getPlayerCause() {
		return UUID.fromString(cause);
	}

	public CatalogType getTarget() {
		return target;
	}

	public int getCount() {
		return count;
	}

	public int getSlot() {
		return slot;
	}

	public long getTime() {
		return timestamp;
	}

	public boolean getRolledBack() {
		return rolledBack;
	}

	public DataView getDataAsView() {
		DataView result = null;
		if (data == null)
			return result;
		try {
			result = DataUtils.dataFromString(data);
		} catch (IOException e) {
			e.printStackTrace();
		}
		return result;
	}

	public Text getHoverText() {
		Text result = Text.of(TextColors.DARK_AQUA, "Location: ", TextColors.AQUA, pos.toString());
		if (data == null)
			return result;

		ConfigurationNode workingNode = null;
		ConfigurationNode node = null;
		try {
			node = DataUtils.configNodeFromString(data);
		} catch (IOException e) {
			e.printStackTrace();
			return result;
		}

		//Common tags
		workingNode = node.getNode("UnsafeDamage");
		if (!workingNode.isVirtual()) {
			result = Text.of(result, Text.NEW_LINE, TextColors.DARK_AQUA, "Damage: ", TextColors.AQUA, workingNode.getInt());
		}

		//Item exclusive tags
		if (target instanceof ItemType) {
			workingNode = node.getNode("UnsafeData", "SkullOwner");
			if (!workingNode.isVirtual()) {
				String name = workingNode.getString();
				if (!workingNode.getNode("Name").isVirtual())
					name = workingNode.getNode("Name").getString();
				result = Text.of(result, Text.NEW_LINE, TextColors.DARK_AQUA, "Player: ", TextColors.AQUA, name);
			}

			workingNode = node.getNode("UnsafeData", "display");
			if (!workingNode.isVirtual()) {
				ConfigurationNode innerNode = workingNode.getNode("Name");
				if (!innerNode.isVirtual()) {
					result = Text.of(result, Text.NEW_LINE, TextColors.DARK_AQUA, "Name: ", TextColors.AQUA, innerNode.getString());
				}

				innerNode = workingNode.getNode("color");
				if (!innerNode.isVirtual()) {
					int color = innerNode.getInt();
					result = Text.of(result, Text.NEW_LINE, TextColors.DARK_AQUA, "Color: ", TextColors.AQUA, "(",
							TextColors.RED, color >> 16, TextColors.AQUA, ", ",
							TextColors.GREEN, (color >> 8) % 256, TextColors.AQUA, ", ",
							TextColors.BLUE, color % 256, TextColors.AQUA, ")");
				}

				innerNode = workingNode.getNode("Lore");
				if (!innerNode.isVirtual()) {
					try {
						Text sub = Text.of(TextColors.DARK_AQUA, "Lore: ");
						for (String line : innerNode.getList(TypeToken.of(String.class))) {
							sub = Text.of(sub, Text.NEW_LINE, TextColors.DARK_AQUA, " - ", TextColors.AQUA, line);
						}
						result = Text.of(result, Text.NEW_LINE, sub);
					} catch (ObjectMappingException e) {
						e.printStackTrace();
					}
				}
			}

			workingNode = node.getNode("UnsafeData", "title");
			if (!workingNode.isVirtual()) {
				result = Text.of(result, Text.NEW_LINE, TextColors.DARK_AQUA, "Title: ", TextColors.AQUA, workingNode.getString());
			}

			workingNode = node.getNode("UnsafeData", "author");
			if (!workingNode.isVirtual()) {
				result = Text.of(result, Text.NEW_LINE, TextColors.DARK_AQUA, "Author: ", TextColors.AQUA, workingNode.getString());
			}

			workingNode = node.getNode("UnsafeData", "Unbreakable");
			if (!workingNode.isVirtual()) {
				result = Text.of(result, Text.NEW_LINE, TextColors.AQUA, "Is unbreakable");
			}
		}

		//Block exclusive tags
		if (target instanceof BlockType) {
			workingNode = node.getNode("UnsafeData", "Owner", "Name");
			if (!workingNode.isVirtual() && !workingNode.getString().isEmpty()) {
				result = Text.of(result, Text.NEW_LINE, TextColors.DARK_AQUA, "Player: ", TextColors.AQUA, workingNode.getString());
			}

			workingNode = node.getNode("UnsafeData", "CustomName");
			if (!workingNode.isVirtual()) {
				result = Text.of(result, Text.NEW_LINE, TextColors.DARK_AQUA, "Name: ", TextColors.AQUA, workingNode.getString());
			}

			workingNode = node.getNode("UnsafeData", "Text1");
			if (!workingNode.isVirtual()) {
				ConfigurationNode dataNode = node.getNode("UnsafeData");
				if (!(dataNode.getNode("Text2").isVirtual() || dataNode.getNode("Text3").isVirtual() || dataNode.getNode("Text4").isVirtual())) {
					result = Text.of(result, Text.NEW_LINE, TextColors.DARK_AQUA, "Text:");
					Pattern p = DataUtils.SIGN_TEXT_REGEX;
					for (int i = 1; i <= 4; ++i) {
						Matcher m = p.matcher(dataNode.getNode("Text" + i).getString());
						if (m.matches()) {
							result = Text.of(result, Text.NEW_LINE, TextColors.DARK_AQUA, " - ", TextColors.AQUA, m.group(1));
						}
					}
				} else {
					result = Text.of(result, Text.NEW_LINE, TextColors.RED, "Contains incomplete sign data");
				}
			}

			workingNode = node.getNode("UnsafeData", "Lock");
			if (!workingNode.isVirtual()) {
				result = Text.of(result, Text.NEW_LINE, TextColors.AQUA, "Is locked");
			}
		}

		return result;
	}

	@Override
	public String toString() {
		switch (type) {
			case PLACE:
				return PlayerUtils.getName(getPlayerCause()) + " placed " + target.getId();
			case DESTROY:
				return PlayerUtils.getName(getPlayerCause()) + " broke " + target.getId();
			case FLOW:
				return cause.substring(0, 1).toUpperCase() + cause.substring(1) + " flow occurred";
			case MOB_DESTROY:
				return "Entity " + cause + " broke " + target.getId();
			case MOB_PLACE:
				return "Entity " + cause + " placed " + target.getId();
			case CONTAINER_ADD:
				return PlayerUtils.getName(getPlayerCause()) + " added " + count + "x " + target.getId();
			case CONTAINER_REMOVE:
				return PlayerUtils.getName(getPlayerCause()) + " removed " + count + "x " + target.getId();
			case ENTITY_CONTAINER_ADD:
				return "Entity " + cause + " added " + count + "x " + target.getId();
			case ENTITY_CONTAINER_REMOVE:
				return "Entity " + cause + " removed " + count + "x " + target.getId();
			default:
				return "(unsupported action type)";
		}
	}

}


text:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.statful.client.framework</groupId>
    <artifactId>statful-springboot-starter</artifactId>
    <version>1.0.2-SNAPSHOT</version>

    <name>statful-springboot-starter</name>
    <description>Spring Boot starter to send metrics to Statful.</description>
    <url>http://www.statful.com</url>

    <licenses>
        <license>
            <name>MIT License</name>
            <url>http://www.opensource.org/licenses/mit-license.php</url>
        </license>
    </licenses>

    <developers>
        <developer>
            <name>Miguel Fonseca</name>
            <email>miguel.fonseca@mindera.com</email>
            <organization>Statful</organization>
            <organizationUrl>http://www.statful.com</organizationUrl>
        </developer>
    </developers>

    <scm>
        <connection>scm:git:git@github.com:statful/statful-client-springboot.git</connection>
        <developerConnection>scm:git:git@github.com:statful/statful-client-springboot.git</developerConnection>
        <url>https://github.com/statful/statful-client-springboot.git</url>
        <tag>HEAD</tag>
    </scm>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <java.version>1.8</java.version>
        <statful-client.version>2.3.2</statful-client.version>
        <aspectj.version>1.9.4</aspectj.version>
        <statful-micrometer-registry.version>1.0.5</statful-micrometer-registry.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>com.statful.client.framework</groupId>
            <artifactId>statful-micrometer-registry</artifactId>
            <version>${statful-micrometer-registry.version}</version>
        </dependency>

        <dependency>
            <groupId>com.statful.client</groupId>
            <artifactId>http-client</artifactId>
            <version>${statful-client.version}</version>
        </dependency>

        <dependency>
            <groupId>com.statful.client</groupId>
            <artifactId>udp-client</artifactId>
            <version>${statful-client.version}</version>
        </dependency>

        <dependency>
            <groupId>com.statful.client</groupId>
            <artifactId>aspects</artifactId>
            <version>${statful-client.version}</version>
        </dependency>

        <dependency>
            <groupId>org.aspectj</groupId>
            <artifactId>aspectjrt</artifactId>
            <version>${aspectj.version}</version>
        </dependency>

        <dependency>
            <groupId>org.aspectj</groupId>
            <artifactId>aspectjweaver</artifactId>
            <version>${aspectj.version}</version>
        </dependency>

    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>aspectj-maven-plugin</artifactId>
                <version>1.11</version>
                <configuration>
                    <showWeaveInfo>false</showWeaveInfo>
                    <complianceLevel>1.8</complianceLevel>
                    <source>1.8</source>
                    <target>1.8</target>
                    <Xlint>ignore</Xlint>
                    <weaveDependencies>
                        <weaveDependency>
                            <groupId>com.statful.client</groupId>
                            <artifactId>aspects</artifactId>
                        </weaveDependency>
                    </weaveDependencies>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-release-plugin</artifactId>
                <version>2.5.3</version>
                <configuration>
                    <autoVersionSubmodules>true</autoVersionSubmodules>
                    <useReleaseProfile>false</useReleaseProfile>
                    <releaseProfiles>release</releaseProfiles>
                    <goals>deploy</goals>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <version>2.1.7.RELEASE</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.3</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>release</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <version>3.0.1</version>
                        <executions>
                            <execution>
                                <id>attach-sources</id>
                                <goals>
                                    <goal>jar-no-fork</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <version>2.10.4</version>
                        <executions>
                            <execution>
                                <id>attach-javadocs</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>1.5</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

    <distributionManagement>
        <snapshotRepository>
            <id>ossrh</id>
            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
        </snapshotRepository>
        <repository>
            <id>ossrh</id>
            <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
        </repository>
    </distributionManagement>
</project>


text:
/*
 * Authors:
 *  Vladislav Burundukov <vlad.be@gmail.com>
 */
#include <Rect.h>
#include <Menu.h>
#include <MenuBar.h>
#include <MenuItem.h>
#include <ScrollView.h>
#include <ScrollBar.h>
#include <OutlineListView.h>
#include "PropertyWindow.h"
#include "PropertyListItem.h"
#include "AddPropertyItemWindow.h"

PropertyWindow::PropertyWindow():
	BWindow(BRect(40, 40, 400, 320), "Property Editor", B_TITLED_WINDOW,
	B_QUIT_ON_WINDOW_CLOSE),
	list(NULL)
{
	BMenuBar *menubar = new BMenuBar(BRect(0, 0, 10, 10), "MenuBar");

	AddChild(menubar);

	BMenu *file = new BMenu("File");

	if (file)
	{
		menubar->AddItem(file);

		file->AddItem(new BMenuItem("Open...", new BMessage('open'), 'O'));

		file->AddItem(new BMenuItem("Save", new BMessage('save'), 'S'));

		file->AddItem(new BMenuItem("Save As...", new BMessage('s_as')));

		file->AddSeparatorItem();

		file->AddItem(new BMenuItem("About Property Editor...",
			new BMessage(B_ABOUT_REQUESTED)));

		file->AddSeparatorItem();

		file->AddItem(new BMenuItem("Quit",
			new BMessage(B_QUIT_REQUESTED), 'Q'));
	}

	BMenu *edit = new BMenu("Edit");

	if (edit)
	{
		menubar->AddItem(edit);

		edit->AddItem(new BMenuItem("Add Child", new BMessage('addc')));

		edit->AddItem(new BMenuItem("Delete Item", new BMessage('deli')));
	}

	BRect frame = menubar->Frame();

	menubar->RemoveSelf();

	frame = BRect(frame.left, frame.bottom,
		frame.right - B_V_SCROLL_BAR_WIDTH - 1, Bounds().bottom + 1);

	SimpleListView<BOutlineListView> *list =
		new SimpleListView<BOutlineListView>(frame, "list",
		B_SINGLE_SELECTION_LIST, B_FOLLOW_ALL_SIDES);

	BScrollView *scroll = new BScrollView("scroll", list,
		B_FOLLOW_ALL_SIDES, 0, false, true, B_NO_BORDER);

	list->SetViewColor(ui_color(B_MENU_BACKGROUND_COLOR));

	AddChild(scroll);
	AddChild(menubar);

	// ---- Cut here :-)
//	list->AddItem(new BStringItem("test"));
	PropertyListItem *t = NULL;
	PropertyListItem *k = NULL;

	list->AddItem(new PropertyListItem("test1 super test"));
	list->AddItem(new PropertyListItem("test2 super test"));
	list->AddItem(t = new PropertyListItem("test3 super test"));

	list->AddUnder(new PropertyListItem("test3 super test"), t);
	list->AddUnder(new PropertyListItem("test3 super test"), t);
	list->AddUnder(k = new PropertyListItem("test3 super test"), t);

	list->AddUnder(new PropertyListItem("test4.5 super test"), k);
	list->AddUnder(new PropertyListItem("test4.5 super test"), k);
	list->AddUnder(new PropertyListItem("test4.5 super test"), k);

	list->AddItem(new PropertyListItem("test4 super test"));

}

PropertyWindow::~PropertyWindow()
{
}

void PropertyWindow::FrameMoved(BPoint origin)
{
}

void PropertyWindow::FrameResized(float width, float height)
{
}

void PropertyWindow::MessageReceived(BMessage *message)
{
	switch (message->what)
	{
		case 'addc':
			(new AddPropertyItemWindow())->Show();
			break;

		default:
			BWindow::MessageReceived(message);
	}
}


text:
package lou.arane.app.usecases;

import java.nio.file.Path;

import org.jsoup.nodes.Document;

import lou.arane.app.Context;
import lou.arane.app.Download;
import lou.arane.core.Cmd;
import lou.arane.util.Log;
import lou.arane.util.ToString;
import lou.arane.util.URLResource;
import lou.arane.util.Util;

/**
 * Common flow for a use case.
 *
 * @author Phuc
 */
public abstract class UseCase implements Cmd {

    private final Context ctx;

    public UseCase(Context context) {
        this.ctx = context;
    }

    @Override
    public String toString() {
        return ToString.of(UseCase.class).add(baseUrl()).nln().add(ctx).str();
    }

    @Override
    public final boolean canRun() {
        String url = ctx.source.externalForm();
        return url.startsWith(baseUrl().externalForm());
    }

    abstract URLResource baseUrl();

    /** Run all the steps of downloading the manga */
    @Override
    public final void doRun() {
        ctx.downloadChapterList();
        downloadChapters();
        downloadPages();
        downloadImages();
    }

    /**
     * Download chapter pages by extracting their urls from the master html file
     */
    private void downloadChapters() {
        Document initial = ctx.chapterList.parseHtml(baseUrl().externalForm());
        Iterable<Download> chapters = getChaptersFromInitialFile(initial);
        ctx.download(chapters);
    }

    /**
     * Get downloads for chapters extracted from the initial chapter listing
     */
    abstract Iterable<Download> getChaptersFromInitialFile(Document initial);

    /**
     * Download pages for each chapter. A page url is built from chapter-index
     * and page-index.
     */
    private void downloadPages() {
        if (Util.notExists(ctx.chaptersDir)) {
            throw new RuntimeException("No chapters downloaded to " + ctx.chaptersDir);
        }
        for (Path chapterHtml : Util.findHtmlFiles(ctx.chaptersDir)) {
            Document chapter = Util.parseHtml(chapterHtml, baseUrl().externalForm());
            Iterable<Download> pages = getPagesFromChapter(chapter);
            ctx.download(pages);
            Iterable<Download> images = getImagesFromChapter(chapter);
            ctx.download(images);
        }
    }

    /**
     * Get html pages listed in each chapter. Return empty if the chapter does
     * not contain page links (in this case, it should contains direct image
     * link).
     */
    abstract Iterable<Download> getPagesFromChapter(Document chapter);

    /**
     * Get image links listed in each chapter. Return empty if the chapter does
     * not contain image links (in this case, it should contain the html page
     * link)
     */
    abstract Iterable<Download> getImagesFromChapter(Document chapter);

    /**
     * Download the actual images from the html image files.
     */
    private void downloadImages() {
        if (Util.notExists(ctx.pagesDir)) {
            Log.info(ctx.pagesDir, "does not exist, skip getting pages from", ctx.pagesDir);
        }
        for (Path pageHtml : Util.findHtmlFiles(ctx.pagesDir)) {
            Document page = Util.parseHtml(pageHtml);
            Iterable<Download> images = getImagesFromPage(page);
            ctx.download(images);
        }
    }

    abstract Iterable<Download> getImagesFromPage(Document page);

}


text:
#include "unicode/unistr.h"
#include "unicode/fmtable.h"

using namespace icu;

#ifndef UPRV_LENGTHOF
#define UPRV_LENGTHOF(array) (int32_t)(sizeof(array)/sizeof((array)[0]))
#endif

// Verify that a UErrorCode is successful; exit(1) if not
void check(UErrorCode& status, const char* msg);

// Replace nonprintable characters with unicode escapes
UnicodeString escape(const UnicodeString &source);

// Print the given string to stdout
void uprintf(const UnicodeString &str);

// Create a display string for a formattable
UnicodeString formattableToString(const Formattable& f);


text:
using UnityEngine;
using UnityEngine.UI;

using System.IO;
using System.Text;
using System.Collections;
using System.Collections.Generic;

public class PreludeReader : MonoBehaviour {

    [SerializeField]
    Text prelude_text;

    [SerializeField]
    public string filename = "Assets/main/models/mock_prelude.txt";

    public Phrases phrases_manager;

    public class Phrase
    {
        public float seconds;
        public string text;

        public Phrase(float seconds, string text)
        {
            this.seconds = seconds;
            this.text = text;
        }
    }

    public class Phrases : MonoBehaviour
    {
        Text text;
        public void setPhrases(Text text)
        {
            this.text = text;
        }

        IEnumerator show_phrase()
        {
            while (true) {
                Phrase p;
                try {
                    p = getPhrase();
                }
                catch
                {
                    gameObject.SetActive(false);
                    GameManager.Instance.player.gameObject.SetActive(true);
                    break;
                }
                text.text = p.text;
                yield return new WaitForSeconds(p.seconds);
                text.text = null;
            }
        }

        public void active()
        {
            StartCoroutine("show_phrase");
        }

        void OnDisable()
        {
            // TODO: DO SOMETHING TO START STAGE
            // GameManager.StartStage();
        }

            List<Phrase> list = new List<Phrase>();

        public void add(float seconds, string text)
        {
            list.Add(new Phrase(seconds, text));
        }

        public Phrase getPhrase() {
            Phrase p = list[0];
            list.Remove(p);

            return p;
        }
    }

    public void load()
    {
        StreamReader reader = new StreamReader(filename, Encoding.Default);
        using (reader)
        {
            string[] prelude_text = reader.ReadToEnd().Split('*');
            foreach(string s in prelude_text)
            {
                string[] p = s.Split(':');
                phrases_manager.add(float.Parse(p[0]), p[1]);
            }
        }
    }

	void Start () {
        Text prelude_text = GetComponentInChildren<Text>();
        phrases_manager = gameObject.AddComponent<Phrases>();
        phrases_manager.setPhrases(prelude_text);
        load();
	}
}