text:
<?php

require_once dirname(__FILE__) . '/SugestioClient.php';
require_once dirname(__FILE__) . '/SugestioConsumption.php';
require_once dirname(__FILE__) . '/SugestioUser.php';
require_once dirname(__FILE__) . '/SugestioItem.php';

/**
 * @deprecated
 */
class Controller {

	private $client;

	/**
	 *
	 * Creates a new instance of the Controller wrapper.
	 *
	 * @deprecated
	 * @param string $base_url URL of the API
	 * @param string $account account key
	 * @param string $secretkey secret key
	 * @param boolean $security sign requests
	 */
	public function __construct($base_url=null, $account=null, $secretkey=null, $security=null) {
		$this->client = new SugestioClient($account, $secretkey, $base_url);
	}

	/**
	 *
	 * Called when a user registers on the client website.
	 * Responses:
	 * 202 Accepted: Job was put on the queue and will be processed
	 * 400 Bad Request: Required arguments are missing or malformed
	 * 401 Unauthorized: Missing or incorrect account credentials
	 * 500 Internal Server Error: Serverside problem
	 *
	 * @param string $id User ID on the client website (required)
	 * @param string $location_simple country, ...
	 * @param string $location_latlong GPS coordinates (latitude, longitude)
	 * @param string $gender 'M' or 'F'
	 * @param string $birthday expressed as a UTC timestamp
	 * @return int response HTTP response code
	 */
	public function addUser($id, $location_simple, $location_latlong, $gender, $birthday) {

		$user = new SugestioUser($id);

		$user->gender = $gender;
		$user->birthday = $birthday;
		$user->location_simple = $location_simple;
		$user->location_latlong = $location_latlong;

		$result = $this->client->addUser($user);

		return $result;
	}

	/**
	 *
	 * Called when an item is added to the client website.
	 * Responses:
	 * 202 Accepted: Job was put on the queue and will be processed
	 * 400 Bad Request: Required arguments are missing or malformed
	 * 401 Unauthorized: Missing or incorrect account credentials
	 * 500 Internal Server Error: Serverside problem
	 *
	 * @param string $id Item ID on the client website (required)
	 * @param string $from indicating from when this item may be recommended. Ex: 2004-09-16T17:55:43.54Z
	 * @param string $until indicating until when this item may be recommended. Ex: 2004-09-16T17:55:43.54Z
	 * @param string $location_simple country, venue, ...
	 * @param string $location_latlong GPS coordinates. (latitude, longitude)
	 * @param array $creator Artist, manufacturer, uploader, ...
	 * @param array $tag
	 * @param array $category
	 * @return int response HTTP response code
	 */
	public function addItem($id, $from, $until, $location_simple, $location_latlong, $creator=array(), $tag=array(), $category=array()) {

		$item = new SugestioItem($id);

		$item->from = $from;
		$item->until = $until;
		$item->location_simple = $location_simple;
		$item->location_latlong = $location_latlong;
		$item->category = $category; // category, creator, segment and tag are arrays
		$item->creator = $creator;
		$item->tag = $tag;

		$result = $this->client->addItem($item);

		return $result;
	}

	/**
	 *
	 * Called when a user consumes an item.
	 * Responses:
	 * 202 Accepted: Job was put on the queue and will be processed
	 * 400 Bad Request: Required arguments are missing or malformed
	 * 401 Unauthorized: Missing or incorrect account credentials
	 * 500 Internal Server Error: Serverside problem
	 *
	 * @param string $userid ID of the user that consumed the item (required)
	 * @param string $itemid ID of the item that was consumed (required)
	 * @param string $type The type of consumption (i.e. VIEW, BASKET, RATING)
	 * @param string $detail More information about the consumption
	 * @param string $date The moment of consumption expressed as a UTC timestamp
	 * @param string $location_simple Location where the item is consumed (home, office, ...)
	 * @param string $location_latlong GPS coordinates (latitude, longitude)
	 * @param array $extra associative array with additional parameters
	 * @return int response HTTP response code
	 */
	public function addConsumption($userid, $itemid, $type, $detail, $date, $location_simple, $location_latlong, $extra=array()) {

		$c = new SugestioConsumption($userid, $itemid); // userid, itemid

		$c->date = $date;
		$c->type = $type;
		$c->detail = $detail;
		$c->location_simple = $location_simple;
		$c->location_latlong = $location_latlong;
		$c->extra = $extra;

		$result = $this->client->addConsumption($c);

		return $result;
	}

	/**
	 *
	 * Called when a user consumes an item.
	 * Responses:
	 * 202 Accepted: Job was put on the queue and will be processed
	 * 400 Bad Request: Required arguments are missing or malformed
	 * 401 Unauthorized: Missing or incorrect account credentials
	 * 500 Internal Server Error: Serverside problem
	 *
	 * @param string $userid ID of the user that consumed the item (required)
	 * @param string $itemid ID of the item that was consumed (required)
	 * @param string $type The type of consumption (i.e. VIEW, BASKET, RATING)
	 * @param string $detail More information about the consumption
	 * @param string $date The moment of consumption expressed as a UTC timestamp
	 * @param string $location_simple Location where the item is consumed (home, office, ...)
	 * @param string $location_latlong GPS coordinates (latitude, longitude)
	 * @param array $extra associative array with additional parameters
	 * @return int response HTTP response code
	 */
	public function addConsumptionExtra($userid, $itemid, $type, $detail, $date, $location_simple, $location_latlong, $extra) {
			return $this->addConsumption($userid, $itemid, $type, $detail, $date, $location_simple, $location_latlong, $extra);
	}

	/**
	 *
	 * Returns recommendations for the given user. Recommendations consist of an Item ID and a score.
	 * Recommendations are sorted by descending score.
	 * @param string $userid ID of the user (required)
	 * @return array (itemid=>string, score=>double, certainty=>double, algorithm=>string)
	 */
	public function getRecommendations($userid) {

		try {
			$recommendations = $this->client->getRecommendations($userid);
		} catch (Exception $e) {
			$recommendations = array();
		}

		return $recommendations;
	}

	/**
	 *
	 * A (negative) consumption is created so that the item won't return the next time recommendations are calculated.
	 * Responses:
	 * 202 Accepted: Job was put on the queue and will be processed
	 * 400 Bad Request: Required arguments are missing or malformed
	 * 401 Unauthorized: Missing or incorrect account credentials
	 * 500 Internal Server Error: Serverside problem
	 *
	 * @param string $userid
	 * @param string $itemId
	 * @return int HTTP response code
	 */
	public function deleteRecommendation($userid, $itemId) {
		return $this->client->deleteRecommendation($userid, $itemId);
	}

	/**
	 *
	 * Returns similar items for the given item. Recommendations consist of an Item ID and a score.
	 * Recommendations are sorted by descending score.
	 *
	 * @param string $itemid the item ID
	 * @return array (itemid=>string, score=>double, certainty=>double, algorithm=>string)
	 */
	public function getSimilar($itemid) {

		try {
			$similar = $this->client->getSimilarItems($itemid);
		} catch (Exception $e) {
			$similar = array();
		}

		return $similar;
	}

	public function getRecommendationsXml($userid) {
		return $this->getRecommendations($userid);
	}

	public function getRecommendationsJson($userid) {

		$recs = $this->getRecommendations($userid);

		for ($i=0; $i<count($recs); $i++) {
			$recs[$i]['itemid'] = array($recs[$i]['itemid']);
			$recs[$i]['score'] = array($recs[$i]['score']);
			$recs[$i]['algorithm'] = array($recs[$i]['algorithm']);
		}

		return json_encode($recs);
	}

	public function getRecommendationsCsv($userid) {
		return $this->getRecommendations($userid);
	}

	public function getSimilarXml($itemid) {
		return $this->getSimilarItems($itemid);
	}

	public function getSimilarJson($itemid) {

		$recs = $this->getSimilarItems($itemid);

		for ($i=0; $i<count($recs); $i++) {
			$recs[$i]['itemid'] = array($recs[$i]['itemid']);
			$recs[$i]['score'] = array($recs[$i]['score']);
			$recs[$i]['algorithm'] = array($recs[$i]['algorithm']);
		}

		return json_encode($recs);
	}

	public function getSimilarCsv($itemid) {
		return $this->getSimilarItems($itemid);
	}

}

?>


text:
Add / Edit Business Bank

This will un-set 'verified' status, you will have to verify the bank again.

<?php
foreach($details as  $d){
?>
<?=$this->form->create('',array('url'=>'/users/addbankBussdetails')); ?>
<?=$this->form->field('accountname', array('label'=>'1. Account name','placeholder'=>'Account name','value'=>$d['bankBuss']['accountname'],'class'=>'form-control')); ?>
<?=$this->form->field('companyname', array('label'=>'1a. Company name','placeholder'=>'Company name','value'=>$d['bankBuss']['companyname'],'class'=>'form-control')); ?>
<?=$this->form->field('companynumber', array('label'=>'1b. Company number','placeholder'=>'Company number','value'=>$d['bankBuss']['companynumber'],'class'=>'form-control')); ?>
<?=$this->form->field('sortcode', array('label'=>'2. Sort code','placeholder'=>'Sort code','value'=>$d['bankBuss']['sortcode'],'class'=>'form-control' )); ?>
<?=$this->form->field('accountnumber', array('label'=>'3. Account number','placeholder'=>'Account number','value'=>$d['bankBuss']['accountnumber'],'class'=>'form-control')); ?>
<?=$this->form->field('bankname', array('label'=>'4. Bank name','placeholder'=>'Bank name','value'=>$d['bankBuss']['bankname'] ,'class'=>'form-control')); ?>
<?=$this->form->field('branchaddress', array('label'=>'5. Branch address','placeholder'=>'Branch address','value'=>$d['bankBuss']['branchaddress'],'class'=>'form-control')); ?>
<?=$this->form->submit('Save bank',array('class'=>'btn btn-primary btn-block')); ?>
<?=$this->form->end(); ?>
<?php }?>

Sample bank cheque for adding bank details.

If your bank is not listed, do not worry, please contact us via support@SiiCrypto.com and we will confirm whether or not your bank falls within our locality.

redpajama_set_name: RedPajamaGithub


text:
require 'optparse'
require 'bookscan/commands'

module Bookscan
  class CLI
    def initialize
      @options = Hash.new
      @options[:debug] = false
    end

    def execute(argv)
      begin
        @opt = OptionParser.new
        @opt.on('--version', 'show version') { version;exit }
        @opt.on('--help', 'show this message') { usage;exit }
        @opt.on('--debug', 'debug mode') { @options[:debug] = true }
        cmd_argv = @opt.order!(argv)
        cmd = cmd_argv.shift
        Commands.new(cmd_argv,@options).send(cmd)
      rescue =>e
        puts e
        usage
        raise e if @options[:debug]
      end
    end

    def usage(e=nil)
      puts @opt
      puts "\nCommands:\n"
      COMMANDS.each { |c|
        puts "    " + c
      }
    end

    def version
      File.open(File.dirname(__FILE__) + '/../../VERSION',"r") { |file|
        puts file.gets
      }
    end

    class << self
      def run(argv)
        self.new.execute(argv)
      end
    end
  end
end


text:
package me.normanmaurer.niosmtp.core;

import java.io.IOException;
import java.io.InputStream;
import java.io.PushbackInputStream;

/**
 * {@link InputStream} which takes care of correctly terminating the DATA command. This is done by append a CRLF.CRLF to wrapped
 * {@link InputStream} if needed.
 *
 * This {@link InputStream} also does the dot-stuffing as stated in the SMTP-spec
 *
 * @author Norman Maurer
 *
 */
public class DataTerminatingInputStream extends InputStream {

    private int last;
    private byte[] extraData;
    private int pos = 0;
    boolean startLine = true;
    private boolean endOfStream = false;
    private final PushbackInputStream in;
    private boolean empty = true;
    private final static byte CR = '\r';
    private final static byte LF = '\n';
    private final static byte DOT = '.';
    private final static byte[] DOT_CRLF = new byte[] {DOT, CR, LF};
    private final static byte[] CRLF_DOT_CRLF = new byte[] {CR, LF, DOT, CR, LF};
    private final static byte[] LF_DOT_CRLF = new byte[] {LF, DOT, CR, LF};

    public DataTerminatingInputStream(InputStream in) {
        this.in = new PushbackInputStream(in, 2);
        startLine = true;

    }

    @Override
    public int read() throws IOException {
        int i = in.read();
        if (empty && i != -1) {
            empty = false;
        }

        if (startLine && endOfStream == false) {
            startLine = false;
            if (i == DOT) {
                in.unread(i);
                return DOT;
            }

        }

        if (last == CR && i == LF) {
            startLine = true;
        }

        if (endOfStream == false) {
            if (i == -1) {
                endOfStream = true;
                calculateExtraData();
                return readNext();
            } else {
                last = i;
            }
            return i;

        } else {
            return readNext();
        }

    }

    private void calculateExtraData() {
        if (empty || last == LF) {
            extraData = DOT_CRLF;
        } else if (last == CR) {
            extraData = LF_DOT_CRLF;
        } else {
            extraData = CRLF_DOT_CRLF;
        }

    }

    private int readNext() {
        if (extraData == null || extraData.length == pos) {
            return -1;
        } else {
            return extraData[pos++];
        }
    }

    @Override
    public int available() throws IOException {
        if (endOfStream) {
            return extraData.length - pos;
        } else {
            return in.available();
        }
    }

    @Override
    public void close() throws IOException {
        in.close();
    }

    @Override
    public  void mark(int readlimit) {
    }

    @Override
    public void reset() throws IOException {
        throw new IOException("Not supported");
    }

    @Override
    public boolean markSupported() {
        return false;
    }

}


text:
package org.jboss.weld.bean.proxy;

import java.io.Serializable;
import java.lang.reflect.Method;

import jakarta.enterprise.inject.spi.Bean;
import jakarta.enterprise.inject.spi.PassivationCapable;

import org.jboss.weld.Container;
import org.jboss.weld.bean.CommonBean;
import org.jboss.weld.bean.StringBeanIdentifier;
import org.jboss.weld.interceptor.util.proxy.TargetInstanceProxy;
import org.jboss.weld.logging.BeanLogger;
import org.jboss.weld.proxy.WeldClientProxy.Metadata;
import org.jboss.weld.serialization.spi.BeanIdentifier;
import org.jboss.weld.serialization.spi.ContextualStore;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;

/**
 * A general purpose MethodHandler for all proxies which routes calls to the
 * {@link BeanInstance} associated with this proxy or handler.
 *
 * @author David Allen
 */
@SuppressFBWarnings(value = "SE_TRANSIENT_FIELD_NOT_RESTORED", justification = "bean field is loaded lazily")
public class ProxyMethodHandler implements MethodHandler, Serializable, Metadata {

    private static final long serialVersionUID = 5293834510764991583L;

    // The bean instance to forward calls to
    private final BeanInstance beanInstance;

    private final BeanIdentifier beanId;

    private transient Bean<?> bean;

    private final String contextId;

    public ProxyMethodHandler(String contextId, BeanInstance beanInstance, Bean<?> bean) {
        this.beanInstance = beanInstance;
        this.bean = bean;
        this.contextId = contextId;
        if (bean instanceof CommonBean<?>) {
            this.beanId = ((CommonBean<?>) bean).getIdentifier();
        } else if (bean instanceof PassivationCapable) {
            this.beanId = new StringBeanIdentifier(((PassivationCapable) bean).getId());
        } else {
            this.beanId = null;
        }
    }

    @Override
    public Object getContextualInstance() {
        return this.getInstance();
    }

    /* (non-Javadoc)
    * @see javassist.util.proxy.MethodHandler#invoke(java.lang.Object, java.lang.reflect.Method, java.lang.reflect.Method, java.lang.Object[])
    */
    public Object invoke(Object self, Method thisMethod, Method proceed, Object[] args) throws Throwable {
        if (thisMethod == null) {
            BeanLogger.LOG.methodHandlerProcessingReturningBeanInstance(self.getClass());
            if (beanInstance == null) {
                throw BeanLogger.LOG.beanInstanceNotSetOnProxy(getBean());
            }
            return beanInstance.getInstance();
        }
        BeanLogger.LOG.methodHandlerProcessingCall(thisMethod, self.getClass());
        if (thisMethod.getDeclaringClass().equals(TargetInstanceProxy.class)) {
            if (beanInstance == null) {
                throw BeanLogger.LOG.beanInstanceNotSetOnProxy(getBean());
            }
            if (thisMethod.getName().equals("weld_getTargetInstance")) {
                return beanInstance.getInstance();
            } else if (thisMethod.getName().equals("weld_getTargetClass")) {
                return beanInstance.getInstanceType();
            } else {
                return null;
            }
        } else if (thisMethod.getName().equals("_initMH")) {
            BeanLogger.LOG.settingNewMethodHandler(args[0], self.getClass());
            return new ProxyMethodHandler(contextId, new TargetBeanInstance(args[0]), getBean());
        } else {
            if (beanInstance == null) {
                throw BeanLogger.LOG.beanInstanceNotSetOnProxy(getBean());
            }
            Object instance = beanInstance.getInstance();
            Object result = beanInstance.invoke(instance, thisMethod, args);
            // if the method returns this and the return type matches the proxy type, return the proxy instead
            // to prevent the bean instance escaping
            if (result != null && result == instance && (thisMethod.getReturnType().isAssignableFrom(self.getClass()))) {
                return self;
            }
            return result;
        }
    }

    public Bean<?> getBean() {
        if (bean == null) {
            if (beanId == null) {
                throw BeanLogger.LOG.proxyHandlerSerializedForNonSerializableBean();
            }
            bean = Container.instance(contextId).services().get(ContextualStore.class).<Bean<Object>, Object>getContextual(beanId);
        }
        return bean;
    }

    /**
     * Returns the underlying instance.
     * @return the underlying instance
     */
    public Object getInstance() {
        return beanInstance.getInstance();
    }
}


text:
@implementation KPMathReduceServiceProvider

- (void)reduceMath:(NSPasteboard *)pboard userData:(NSString *)userData error:(NSString **)error {
	// Test for strings on the pasteboard.
	NSArray *classes = @[[NSString class]];
	NSDictionary *options = @{};

	if (![pboard canReadObjectForClasses:classes options:options]) {
		*error = NSLocalizedString(@"Invalid substrate for Math Reduce.", nil);
		return;
	}

	// Get and encrypt the string.
	NSString *pboardString = [pboard stringForType:NSPasteboardTypeString];
	NSError *mathError = nil;
	DDExpression *expression = [DDExpression expressionFromString:pboardString error:&mathError];

	if (mathError) {
		*error = [mathError description];
		return;
	}

	NSNumber *reduced = [[DDMathEvaluator defaultMathEvaluator] evaluateExpression:expression withSubstitutions:nil error:&mathError];

	if (mathError) {
		*error = [mathError description];
		return;
	}

	if (reduced == nil) {
		*error = NSLocalizedString(@"Invalid substrate for Math Reduce.", nil);
		return;
	}

	// Good value, put it on the pasteboard
	[pboard clearContents];
	[pboard writeObjects:[NSArray arrayWithObject:[reduced description]]];
}

@end


text:
#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif

/*
Si scriva un programma C che all'interno del main consenta
di inizializzare da tastiera un vettore di interi
di lunghezza massima pari a 20.

La lunghezza effettiva della sequenza acquisita è
stabilita dall'utente (ad esempio, acquisendo da tastiera
il valore di una variabile n).

Il programma dovrà stampare il vettore,scorrere il vettore e
stampare gli elementi del vettore che hanno un numero pari
nella posizione immediatamente precedente alla propria.

Per esempio, se l'utente sceglie di inserire 10 valori,
avendo letto in input e memorizzato nell'array i seguenti interi:
1 2 3 4 5 6 7 8 9 0
Il programma produrrà il seguente output:
1 2 3 4 5 6 7 8 9 0
3 5 7 9

*/

#include <stdio.h>   // inclusione libreria standard per I/O
#include <stdlib.h>  // inclusione libreria standard per funzioni di sistema

#define MAXDIM 20

int main()
{
	int vet[MAXDIM], i = 0, valore;

	do { /* leggo la lunghezza che deve essere accettabile */
		printf("\nInserisci un numero intero \n");
		scanf("%d", &valore);
	} while (valore<0 || valore>MAXDIM);

	// Leggo i valori e riempo il vettore
	printf("\n Inserisci una sequenza di %d interi:\n", valore);
	for (i = 0; i < valore; i++) {
		scanf("%d", &vet[i]);
	}

	// Stampo la sequenza originaria
	printf("\n La sequenza di %d interi inserita e':\n", valore);
	for (i = 0; i < valore; i++) {
		printf("%d ", vet[i]);
	}

	// Verifico la condizione e stampo i valori che sono preceduti da un numero pari
	printf("\n Stampo elementi con un pari nella posizione precedente: \n");
	for (i = 1; i < valore; i++) /* Il primo elemento non ha precedente*/
		if (vet[i - 1] % 2 == 0)
			printf("%d ", vet[i]);

	printf("\n\n");
	system("pause");
	return 0;
}


text:
/*jslint node:true, vars:true, bitwise:true, unparam:true */
/*jshint unused:true */
/*global */

var ledController = require("./ledController.js");
ledController.clear();
ledController.smile();

var motorController = require("./motorController.js")
motorController.go();
motorController.stop();
//motorController.demo();

var headControler = require("./headcontroller.js");
headControler.lookMiddle();

var theThingsAPI = require('thethingsio-api');
var motionKEY = 'motion';

//create Client
var client = theThingsAPI.createClient();
var lastAction = "@@@";

function readMotions()
{
    //read latest write
    var req1 = client.thingReadLatest(motionKEY);

    //event fired when the response arrives
    req1.on('response',function(res){
        if (res.statusCode == 200 && res.payload !== undefined)
        {
            var payload = JSON.parse(res.payload);
            var newAction = payload.data[0].value;
            if (newAction !== lastAction)
            {
                lastAction = newAction;
                motorController.doAction(newAction);
            }
        }
    });
    req1.end();
}

readMotions();
motorController.stop();

var loopCounter = 0;
setInterval(function() {
    readMotions();
}, 200);


text:
//go:build !providerless
// +build !providerless

package vmsizeclient

import (
	"context"

	"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute"
	"k8s.io/legacy-cloud-providers/azure/retry"
)

const (
	// APIVersion is the API version for compute.
	APIVersion = "2019-07-01"
)

// Interface is the client interface for VirtualMachineSizes.
// Don't forget to run the following command to generate the mock client:
// mockgen -source=$GOPATH/src/k8s.io/kubernetes/staging/src/k8s.io/legacy-cloud-providers/azure/clients/vmsizeclient/interface.go -package=mockvmsizeclient Interface > $GOPATH/src/k8s.io/kubernetes/staging/src/k8s.io/legacy-cloud-providers/azure/clients/vmsizeclient/mockvmsizeclient/interface.go
type Interface interface {
	// List gets compute.VirtualMachineSizeListResult.
	List(ctx context.Context, location string) (result compute.VirtualMachineSizeListResult, rerr *retry.Error)
}


text:
package org.ohdsi.webapi.service;

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

import java.io.IOException;
import org.junit.Before;
import org.junit.Test;
import org.ohdsi.webapi.evidence.EvidenceSearch;
import org.ohdsi.webapi.util.PreparedStatementRenderer;
import org.springframework.beans.factory.annotation.Autowired;

public class EvidenceServiceTest extends AbstractServiceTest {

  @Autowired
  EvidenceService evidenceService;

  @Before
  public void before() {

    if (evidenceService == null) evidenceService = new EvidenceService();
  }

  @Test
  public void prepareGetDrugHoiEvidence() throws IOException {

    String drugId = "4444";
    String hoiId = "5555";
    String key = drugId + "-" + hoiId;

    PreparedStatementRenderer psr = evidenceService.prepareGetDrugHoiEvidence(key, getSource());
    assertSqlEquals("/evidence/sql/getDrugHoiEvidence-expected.sql", psr);
    assertTrue(psr.getOrderedParamsList().contains(4444));
    assertTrue(psr.getOrderedParamsList().contains(5555));

  }
}


text:
Input::
//// [/user/username/projects/myproject/src/tsconfig.json]
{"compilerOptions":{"target":"es2016","module":"Node16","outDir":"../out"}}

//// [/user/username/projects/myproject/src/fileA.ts]
import { foo } from "./fileB.mjs";
foo();

//// [/user/username/projects/myproject/project/src/fileB.mts]
export function foo() {
}

//// [/user/username/projects/myproject/package.json]
{"name":"app","version":"1.0.0"}

//// [/a/lib/lib.es2016.full.d.ts]
/// <reference no-default-lib="true"/>
interface Boolean {}
interface Function {}
interface CallableFunction {}
interface NewableFunction {}
interface IArguments {}
interface Number { toExponential: any; }
interface Object {}
interface RegExp {}
interface String { charAt: any; }
interface Array<T> { length: number; [n: number]: T; }

/a/lib/tsc.js --w --p src --extendedDiagnostics -traceResolution --explainFiles
Output::
[12:00:31 AM] Starting compilation in watch mode...

Current directory: /user/username/projects/myproject CaseSensitiveFileNames: false
FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/tsconfig.json 2000 undefined Config file
Synchronizing program
CreatingProgramWith::
  roots: ["/user/username/projects/myproject/src/fileA.ts"]
  options: {"target":3,"module":100,"outDir":"/user/username/projects/myproject/out","watch":true,"project":"/user/username/projects/myproject/src","extendedDiagnostics":true,"traceResolution":true,"explainFiles":true,"configFilePath":"/user/username/projects/myproject/src/tsconfig.json"}
File '/user/username/projects/myproject/src/package.json' does not exist.
Found 'package.json' at '/user/username/projects/myproject/package.json'.
'package.json' does not have a 'typesVersions' field.
FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/fileA.ts 250 undefined Source file
======== Resolving module './fileB.mjs' from '/user/username/projects/myproject/src/fileA.ts'. ========
Module resolution kind is not specified, using 'Node16'.
Resolving in CJS mode with conditions 'node', 'require', 'types'.
Loading module as file / folder, candidate module location '/user/username/projects/myproject/src/fileB.mjs', target file types: TypeScript, JavaScript, Declaration.
File name '/user/username/projects/myproject/src/fileB.mjs' has a '.mjs' extension - stripping it.
File '/user/username/projects/myproject/src/fileB.mts' does not exist.
File '/user/username/projects/myproject/src/fileB.d.mts' does not exist.
File '/user/username/projects/myproject/src/fileB.mjs' does not exist.
File '/user/username/projects/myproject/src/fileB.mjs.ts' does not exist.
File '/user/username/projects/myproject/src/fileB.mjs.tsx' does not exist.
File '/user/username/projects/myproject/src/fileB.mjs.d.ts' does not exist.
File '/user/username/projects/myproject/src/fileB.mjs.js' does not exist.
File '/user/username/projects/myproject/src/fileB.mjs.jsx' does not exist.
Directory '/user/username/projects/myproject/src/fileB.mjs' does not exist, skipping all lookups in it.
======== Module name './fileB.mjs' was not resolved. ========
DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/fileB.mjs 1 undefined Failed Lookup Locations
Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/fileB.mjs 1 undefined Failed Lookup Locations
DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src 0 undefined Failed Lookup Locations
Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src 0 undefined Failed Lookup Locations
File '/a/lib/package.json' does not exist.
File '/a/package.json' does not exist.
File '/package.json' does not exist.
FileWatcher:: Added:: WatchInfo: /a/lib/lib.es2016.full.d.ts 250 undefined Source file
FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/package.json 2000 undefined File location affecting resolution
FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/package.json 2000 undefined File location affecting resolution
DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/node_modules/@types 1 undefined Type roots
Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/node_modules/@types 1 undefined Type roots
DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 undefined Type roots
Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 undefined Type roots
src/fileA.ts:1:21 - error TS2307: Cannot find module './fileB.mjs' or its corresponding type declarations.

1 import { foo } from "./fileB.mjs";
                      ~~~~~~~~~~~~~

../../../../a/lib/lib.es2016.full.d.ts
  Default library for target 'es2016'
src/fileA.ts
  Matched by default include pattern '**/*'
  File is CommonJS module because 'package.json' does not have field "type"
[12:00:37 AM] Found 1 error. Watching for file changes.

DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory
Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src 1 undefined Wild card directory

Program root files: ["/user/username/projects/myproject/src/fileA.ts"]
Program options: {"target":3,"module":100,"outDir":"/user/username/projects/myproject/out","watch":true,"project":"/user/username/projects/myproject/src","extendedDiagnostics":true,"traceResolution":true,"explainFiles":true,"configFilePath":"/user/username/projects/myproject/src/tsconfig.json"}
Program structureReused: Not
Program files::
/a/lib/lib.es2016.full.d.ts
/user/username/projects/myproject/src/fileA.ts

Semantic diagnostics in builder refreshed for::
/a/lib/lib.es2016.full.d.ts
/user/username/projects/myproject/src/fileA.ts

Shape signatures in builder refreshed for::
/a/lib/lib.es2016.full.d.ts (used version)
/user/username/projects/myproject/src/filea.ts (used version)

PolledWatches::
/user/username/projects/myproject/src/fileb.mjs:
  {"pollingInterval":500}
/user/username/projects/myproject/src/package.json:
  {"pollingInterval":2000}
/user/username/projects/myproject/src/node_modules/@types:
  {"pollingInterval":500}
/user/username/projects/myproject/node_modules/@types:
  {"pollingInterval":500}

FsWatches::
/user/username/projects/myproject/src/tsconfig.json:
  {}
/user/username/projects/myproject/src/filea.ts:
  {}
/user/username/projects/myproject/src:
  {}
/a/lib/lib.es2016.full.d.ts:
  {}
/user/username/projects/myproject/package.json:
  {}

FsWatchesRecursive::
/user/username/projects/myproject/src:
  {}

exitCode:: ExitStatus.undefined

//// [/user/username/projects/myproject/out/fileA.js]
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const fileB_mjs_1 = require("./fileB.mjs");
(0, fileB_mjs_1.foo)();

Change:: Modify package json file to add type module

Input::
//// [/user/username/projects/myproject/package.json]
{"name":"app","version":"1.0.0","type":"module"}

Output::
FileWatcher:: Triggered with /user/username/projects/myproject/package.json 1:: WatchInfo: /user/username/projects/myproject/package.json 2000 undefined File location affecting resolution
Scheduling invalidateFailedLookup
Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/package.json 1:: WatchInfo: /user/username/projects/myproject/package.json 2000 undefined File location affecting resolution
Scheduling update
Synchronizing program
[12:00:41 AM] File change detected. Starting incremental compilation...

CreatingProgramWith::
  roots: ["/user/username/projects/myproject/src/fileA.ts"]
  options: {"target":3,"module":100,"outDir":"/user/username/projects/myproject/out","watch":true,"project":"/user/username/projects/myproject/src","extendedDiagnostics":true,"traceResolution":true,"explainFiles":true,"configFilePath":"/user/username/projects/myproject/src/tsconfig.json"}
File '/a/lib/package.json' does not exist according to earlier cached lookups.
File '/a/package.json' does not exist according to earlier cached lookups.
File '/package.json' does not exist according to earlier cached lookups.
File '/user/username/projects/myproject/src/package.json' does not exist according to earlier cached lookups.
Found 'package.json' at '/user/username/projects/myproject/package.json'.
'package.json' does not have a 'typesVersions' field.
File '/user/username/projects/myproject/src/package.json' does not exist according to earlier cached lookups.
File '/user/username/projects/myproject/package.json' exists according to earlier cached lookups.
======== Resolving module './fileB.mjs' from '/user/username/projects/myproject/src/fileA.ts'. ========
Module resolution kind is not specified, using 'Node16'.
Resolving in ESM mode with conditions 'node', 'import', 'types'.
Loading module as file / folder, candidate module location '/user/username/projects/myproject/src/fileB.mjs', target file types: TypeScript, JavaScript, Declaration.
File name '/user/username/projects/myproject/src/fileB.mjs' has a '.mjs' extension - stripping it.
File '/user/username/projects/myproject/src/fileB.mts' does not exist.
File '/user/username/projects/myproject/src/fileB.d.mts' does not exist.
File '/user/username/projects/myproject/src/fileB.mjs' does not exist.
Directory '/user/username/projects/myproject/src/fileB.mjs' does not exist, skipping all lookups in it.
======== Module name './fileB.mjs' was not resolved. ========
File '/a/lib/package.json' does not exist according to earlier cached lookups.
File '/a/package.json' does not exist according to earlier cached lookups.
File '/package.json' does not exist according to earlier cached lookups.
DirectoryWatcher:: Close:: WatchInfo: /user/username/projects/myproject/src/fileB.mjs 1 undefined Failed Lookup Locations
Elapsed:: *ms DirectoryWatcher:: Close:: WatchInfo: /user/username/projects/myproject/src/fileB.mjs 1 undefined Failed Lookup Locations
src/fileA.ts:1:21 - error TS2307: Cannot find module './fileB.mjs' or its corresponding type declarations.

1 import { foo } from "./fileB.mjs";
                      ~~~~~~~~~~~~~

../../../../a/lib/lib.es2016.full.d.ts
  Default library for target 'es2016'
src/fileA.ts
  Matched by default include pattern '**/*'
  File is ECMAScript module because 'package.json' has field "type" with value "module"
[12:00:45 AM] Found 1 error. Watching for file changes.

Program root files: ["/user/username/projects/myproject/src/fileA.ts"]
Program options: {"target":3,"module":100,"outDir":"/user/username/projects/myproject/out","watch":true,"project":"/user/username/projects/myproject/src","extendedDiagnostics":true,"traceResolution":true,"explainFiles":true,"configFilePath":"/user/username/projects/myproject/src/tsconfig.json"}
Program structureReused: SafeModules
Program files::
/a/lib/lib.es2016.full.d.ts
/user/username/projects/myproject/src/fileA.ts

Semantic diagnostics in builder refreshed for::
/user/username/projects/myproject/src/fileA.ts

Shape signatures in builder refreshed for::
/user/username/projects/myproject/src/filea.ts (computed .d.ts)

PolledWatches::
/user/username/projects/myproject/src/package.json:
  {"pollingInterval":2000}
/user/username/projects/myproject/src/node_modules/@types:
  {"pollingInterval":500}
/user/username/projects/myproject/node_modules/@types:
  {"pollingInterval":500}

FsWatches::
/user/username/projects/myproject/src/tsconfig.json:
  {}
/user/username/projects/myproject/src/filea.ts:
  {}
/user/username/projects/myproject/src:
  {}
/a/lib/lib.es2016.full.d.ts:
  {}
/user/username/projects/myproject/package.json:
  {}

FsWatchesRecursive::
/user/username/projects/myproject/src:
  {}

exitCode:: ExitStatus.undefined

//// [/user/username/projects/myproject/out/fileA.js]
import { foo } from "./fileB.mjs";
foo();

Change:: Modify package.json file to remove type module

Input::
//// [/user/username/projects/myproject/package.json]
{"name":"app","version":"1.0.0"}

Output::
FileWatcher:: Triggered with /user/username/projects/myproject/package.json 1:: WatchInfo: /user/username/projects/myproject/package.json 2000 undefined File location affecting resolution
Scheduling invalidateFailedLookup
Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/package.json 1:: WatchInfo: /user/username/projects/myproject/package.json 2000 undefined File location affecting resolution
Scheduling update
Synchronizing program
[12:00:50 AM] File change detected. Starting incremental compilation...

CreatingProgramWith::
  roots: ["/user/username/projects/myproject/src/fileA.ts"]
  options: {"target":3,"module":100,"outDir":"/user/username/projects/myproject/out","watch":true,"project":"/user/username/projects/myproject/src","extendedDiagnostics":true,"traceResolution":true,"explainFiles":true,"configFilePath":"/user/username/projects/myproject/src/tsconfig.json"}
File '/a/lib/package.json' does not exist according to earlier cached lookups.
File '/a/package.json' does not exist according to earlier cached lookups.
File '/package.json' does not exist according to earlier cached lookups.
File '/user/username/projects/myproject/src/package.json' does not exist according to earlier cached lookups.
Found 'package.json' at '/user/username/projects/myproject/package.json'.
'package.json' does not have a 'typesVersions' field.
File '/user/username/projects/myproject/src/package.json' does not exist according to earlier cached lookups.
File '/user/username/projects/myproject/package.json' exists according to earlier cached lookups.
======== Resolving module './fileB.mjs' from '/user/username/projects/myproject/src/fileA.ts'. ========
Module resolution kind is not specified, using 'Node16'.
Resolving in CJS mode with conditions 'node', 'require', 'types'.
Loading module as file / folder, candidate module location '/user/username/projects/myproject/src/fileB.mjs', target file types: TypeScript, JavaScript, Declaration.
File name '/user/username/projects/myproject/src/fileB.mjs' has a '.mjs' extension - stripping it.
File '/user/username/projects/myproject/src/fileB.mts' does not exist.
File '/user/username/projects/myproject/src/fileB.d.mts' does not exist.
File '/user/username/projects/myproject/src/fileB.mjs' does not exist.
File '/user/username/projects/myproject/src/fileB.mjs.ts' does not exist.
File '/user/username/projects/myproject/src/fileB.mjs.tsx' does not exist.
File '/user/username/projects/myproject/src/fileB.mjs.d.ts' does not exist.
File '/user/username/projects/myproject/src/fileB.mjs.js' does not exist.
File '/user/username/projects/myproject/src/fileB.mjs.jsx' does not exist.
Directory '/user/username/projects/myproject/src/fileB.mjs' does not exist, skipping all lookups in it.
======== Module name './fileB.mjs' was not resolved. ========
DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/fileB.mjs 1 undefined Failed Lookup Locations
Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/fileB.mjs 1 undefined Failed Lookup Locations
File '/a/lib/package.json' does not exist according to earlier cached lookups.
File '/a/package.json' does not exist according to earlier cached lookups.
File '/package.json' does not exist according to earlier cached lookups.
src/fileA.ts:1:21 - error TS2307: Cannot find module './fileB.mjs' or its corresponding type declarations.

1 import { foo } from "./fileB.mjs";
                      ~~~~~~~~~~~~~

../../../../a/lib/lib.es2016.full.d.ts
  Default library for target 'es2016'
src/fileA.ts
  Matched by default include pattern '**/*'
  File is CommonJS module because 'package.json' does not have field "type"
[12:00:54 AM] Found 1 error. Watching for file changes.

Program root files: ["/user/username/projects/myproject/src/fileA.ts"]
Program options: {"target":3,"module":100,"outDir":"/user/username/projects/myproject/out","watch":true,"project":"/user/username/projects/myproject/src","extendedDiagnostics":true,"traceResolution":true,"explainFiles":true,"configFilePath":"/user/username/projects/myproject/src/tsconfig.json"}
Program structureReused: SafeModules
Program files::
/a/lib/lib.es2016.full.d.ts
/user/username/projects/myproject/src/fileA.ts

Semantic diagnostics in builder refreshed for::
/user/username/projects/myproject/src/fileA.ts

Shape signatures in builder refreshed for::
/user/username/projects/myproject/src/filea.ts (computed .d.ts)

PolledWatches::
/user/username/projects/myproject/src/package.json:
  {"pollingInterval":2000}
/user/username/projects/myproject/src/node_modules/@types:
  {"pollingInterval":500}
/user/username/projects/myproject/node_modules/@types:
  {"pollingInterval":500}
/user/username/projects/myproject/src/fileb.mjs:
  {"pollingInterval":500}

FsWatches::
/user/username/projects/myproject/src/tsconfig.json:
  {}
/user/username/projects/myproject/src/filea.ts:
  {}
/user/username/projects/myproject/src:
  {}
/a/lib/lib.es2016.full.d.ts:
  {}
/user/username/projects/myproject/package.json:
  {}

FsWatchesRecursive::
/user/username/projects/myproject/src:
  {}

exitCode:: ExitStatus.undefined

//// [/user/username/projects/myproject/out/fileA.js]
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const fileB_mjs_1 = require("./fileB.mjs");
(0, fileB_mjs_1.foo)();

Change:: Delete package.json

Input::
//// [/user/username/projects/myproject/package.json] deleted

Output::
FileWatcher:: Triggered with /user/username/projects/myproject/package.json 2:: WatchInfo: /user/username/projects/myproject/package.json 2000 undefined File location affecting resolution
Scheduling invalidateFailedLookup
Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/package.json 2:: WatchInfo: /user/username/projects/myproject/package.json 2000 undefined File location affecting resolution
Scheduling update
Synchronizing program
[12:00:56 AM] File change detected. Starting incremental compilation...

CreatingProgramWith::
  roots: ["/user/username/projects/myproject/src/fileA.ts"]
  options: {"target":3,"module":100,"outDir":"/user/username/projects/myproject/out","watch":true,"project":"/user/username/projects/myproject/src","extendedDiagnostics":true,"traceResolution":true,"explainFiles":true,"configFilePath":"/user/username/projects/myproject/src/tsconfig.json"}
File '/a/lib/package.json' does not exist according to earlier cached lookups.
File '/a/package.json' does not exist according to earlier cached lookups.
File '/package.json' does not exist according to earlier cached lookups.
File '/user/username/projects/myproject/src/package.json' does not exist according to earlier cached lookups.
File '/user/username/projects/myproject/package.json' does not exist.
File '/user/username/projects/package.json' does not exist.
File '/user/username/package.json' does not exist.
File '/user/package.json' does not exist.
File '/package.json' does not exist according to earlier cached lookups.
File '/user/username/projects/myproject/src/package.json' does not exist according to earlier cached lookups.
File '/user/username/projects/myproject/package.json' does not exist according to earlier cached lookups.
File '/user/username/projects/package.json' does not exist according to earlier cached lookups.
File '/user/username/package.json' does not exist according to earlier cached lookups.
File '/user/package.json' does not exist according to earlier cached lookups.
File '/package.json' does not exist according to earlier cached lookups.
Reusing resolution of module './fileB.mjs' from '/user/username/projects/myproject/src/fileA.ts' of old program, it was not resolved.
File '/a/lib/package.json' does not exist according to earlier cached lookups.
File '/a/package.json' does not exist according to earlier cached lookups.
File '/package.json' does not exist according to earlier cached lookups.
FileWatcher:: Added:: WatchInfo: /user/username/projects/package.json 2000 undefined File location affecting resolution
src/fileA.ts:1:21 - error TS2307: Cannot find module './fileB.mjs' or its corresponding type declarations.

1 import { foo } from "./fileB.mjs";
                      ~~~~~~~~~~~~~

../../../../a/lib/lib.es2016.full.d.ts
  Default library for target 'es2016'
src/fileA.ts
  Matched by default include pattern '**/*'
  File is CommonJS module because 'package.json' was not found
[12:00:57 AM] Found 1 error. Watching for file changes.

Program root files: ["/user/username/projects/myproject/src/fileA.ts"]
Program options: {"target":3,"module":100,"outDir":"/user/username/projects/myproject/out","watch":true,"project":"/user/username/projects/myproject/src","extendedDiagnostics":true,"traceResolution":true,"explainFiles":true,"configFilePath":"/user/username/projects/myproject/src/tsconfig.json"}
Program structureReused: SafeModules
Program files::
/a/lib/lib.es2016.full.d.ts
/user/username/projects/myproject/src/fileA.ts

Semantic diagnostics in builder refreshed for::

No shapes updated in the builder::

PolledWatches::
/user/username/projects/myproject/src/package.json:
  {"pollingInterval":2000}
/user/username/projects/myproject/src/node_modules/@types:
  {"pollingInterval":500}
/user/username/projects/myproject/node_modules/@types:
  {"pollingInterval":500}
/user/username/projects/myproject/src/fileb.mjs:
  {"pollingInterval":500}
/user/username/projects/package.json:
  {"pollingInterval":2000}

FsWatches::
/user/username/projects/myproject/src/tsconfig.json:
  {}
/user/username/projects/myproject/src/filea.ts:
  {}
/user/username/projects/myproject/src:
  {}
/a/lib/lib.es2016.full.d.ts:
  {}
/user/username/projects/myproject/package.json:
  {}

FsWatchesRecursive::
/user/username/projects/myproject/src:
  {}

exitCode:: ExitStatus.undefined

Change:: Modify package json file to add type module

Input::
//// [/user/username/projects/myproject/package.json]
{"name":"app","version":"1.0.0","type":"module"}

Output::
FileWatcher:: Triggered with /user/username/projects/myproject/package.json 0:: WatchInfo: /user/username/projects/myproject/package.json 2000 undefined File location affecting resolution
Scheduling invalidateFailedLookup
Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/package.json 0:: WatchInfo: /user/username/projects/myproject/package.json 2000 undefined File location affecting resolution
Scheduling update
Synchronizing program
[12:01:01 AM] File change detected. Starting incremental compilation...

CreatingProgramWith::
  roots: ["/user/username/projects/myproject/src/fileA.ts"]
  options: {"target":3,"module":100,"outDir":"/user/username/projects/myproject/out","watch":true,"project":"/user/username/projects/myproject/src","extendedDiagnostics":true,"traceResolution":true,"explainFiles":true,"configFilePath":"/user/username/projects/myproject/src/tsconfig.json"}
File '/a/lib/package.json' does not exist according to earlier cached lookups.
File '/a/package.json' does not exist according to earlier cached lookups.
File '/package.json' does not exist according to earlier cached lookups.
File '/user/username/projects/myproject/src/package.json' does not exist according to earlier cached lookups.
Found 'package.json' at '/user/username/projects/myproject/package.json'.
'package.json' does not have a 'typesVersions' field.
File '/user/username/projects/myproject/src/package.json' does not exist according to earlier cached lookups.
File '/user/username/projects/myproject/package.json' exists according to earlier cached lookups.
======== Resolving module './fileB.mjs' from '/user/username/projects/myproject/src/fileA.ts'. ========
Module resolution kind is not specified, using 'Node16'.
Resolving in ESM mode with conditions 'node', 'import', 'types'.
Loading module as file / folder, candidate module location '/user/username/projects/myproject/src/fileB.mjs', target file types: TypeScript, JavaScript, Declaration.
File name '/user/username/projects/myproject/src/fileB.mjs' has a '.mjs' extension - stripping it.
File '/user/username/projects/myproject/src/fileB.mts' does not exist.
File '/user/username/projects/myproject/src/fileB.d.mts' does not exist.
File '/user/username/projects/myproject/src/fileB.mjs' does not exist.
Directory '/user/username/projects/myproject/src/fileB.mjs' does not exist, skipping all lookups in it.
======== Module name './fileB.mjs' was not resolved. ========
File '/a/lib/package.json' does not exist according to earlier cached lookups.
File '/a/package.json' does not exist according to earlier cached lookups.
File '/package.json' does not exist according to earlier cached lookups.
DirectoryWatcher:: Close:: WatchInfo: /user/username/projects/myproject/src/fileB.mjs 1 undefined Failed Lookup Locations
Elapsed:: *ms DirectoryWatcher:: Close:: WatchInfo: /user/username/projects/myproject/src/fileB.mjs 1 undefined Failed Lookup Locations
FileWatcher:: Close:: WatchInfo: /user/username/projects/package.json 2000 undefined File location affecting resolution
src/fileA.ts:1:21 - error TS2307: Cannot find module './fileB.mjs' or its corresponding type declarations.

1 import { foo } from "./fileB.mjs";
                      ~~~~~~~~~~~~~

../../../../a/lib/lib.es2016.full.d.ts
  Default library for target 'es2016'
src/fileA.ts
  Matched by default include pattern '**/*'
  File is ECMAScript module because 'package.json' has field "type" with value "module"
[12:01:05 AM] Found 1 error. Watching for file changes.

Program root files: ["/user/username/projects/myproject/src/fileA.ts"]
Program options: {"target":3,"module":100,"outDir":"/user/username/projects/myproject/out","watch":true,"project":"/user/username/projects/myproject/src","extendedDiagnostics":true,"traceResolution":true,"explainFiles":true,"configFilePath":"/user/username/projects/myproject/src/tsconfig.json"}
Program structureReused: SafeModules
Program files::
/a/lib/lib.es2016.full.d.ts
/user/username/projects/myproject/src/fileA.ts

Semantic diagnostics in builder refreshed for::
/user/username/projects/myproject/src/fileA.ts

Shape signatures in builder refreshed for::
/user/username/projects/myproject/src/filea.ts (computed .d.ts)

PolledWatches::
/user/username/projects/myproject/src/package.json:
  {"pollingInterval":2000}
/user/username/projects/myproject/src/node_modules/@types:
  {"pollingInterval":500}
/user/username/projects/myproject/node_modules/@types:
  {"pollingInterval":500}

FsWatches::
/user/username/projects/myproject/src/tsconfig.json:
  {}
/user/username/projects/myproject/src/filea.ts:
  {}
/user/username/projects/myproject/src:
  {}
/a/lib/lib.es2016.full.d.ts:
  {}
/user/username/projects/myproject/package.json:
  {}

FsWatchesRecursive::
/user/username/projects/myproject/src:
  {}

exitCode:: ExitStatus.undefined

//// [/user/username/projects/myproject/out/fileA.js]
import { foo } from "./fileB.mjs";
foo();

Change:: Delete package.json

Input::
//// [/user/username/projects/myproject/package.json] deleted

Output::
FileWatcher:: Triggered with /user/username/projects/myproject/package.json 2:: WatchInfo: /user/username/projects/myproject/package.json 2000 undefined File location affecting resolution
Scheduling invalidateFailedLookup
Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/package.json 2:: WatchInfo: /user/username/projects/myproject/package.json 2000 undefined File location affecting resolution
Scheduling update
Synchronizing program
[12:01:07 AM] File change detected. Starting incremental compilation...

CreatingProgramWith::
  roots: ["/user/username/projects/myproject/src/fileA.ts"]
  options: {"target":3,"module":100,"outDir":"/user/username/projects/myproject/out","watch":true,"project":"/user/username/projects/myproject/src","extendedDiagnostics":true,"traceResolution":true,"explainFiles":true,"configFilePath":"/user/username/projects/myproject/src/tsconfig.json"}
File '/a/lib/package.json' does not exist according to earlier cached lookups.
File '/a/package.json' does not exist according to earlier cached lookups.
File '/package.json' does not exist according to earlier cached lookups.
File '/user/username/projects/myproject/src/package.json' does not exist according to earlier cached lookups.
File '/user/username/projects/myproject/package.json' does not exist.
File '/user/username/projects/package.json' does not exist according to earlier cached lookups.
File '/user/username/package.json' does not exist according to earlier cached lookups.
File '/user/package.json' does not exist according to earlier cached lookups.
File '/package.json' does not exist according to earlier cached lookups.
File '/user/username/projects/myproject/src/package.json' does not exist according to earlier cached lookups.
File '/user/username/projects/myproject/package.json' does not exist according to earlier cached lookups.
File '/user/username/projects/package.json' does not exist according to earlier cached lookups.
File '/user/username/package.json' does not exist according to earlier cached lookups.
File '/user/package.json' does not exist according to earlier cached lookups.
File '/package.json' does not exist according to earlier cached lookups.
======== Resolving module './fileB.mjs' from '/user/username/projects/myproject/src/fileA.ts'. ========
Module resolution kind is not specified, using 'Node16'.
Resolving in CJS mode with conditions 'node', 'require', 'types'.
Loading module as file / folder, candidate module location '/user/username/projects/myproject/src/fileB.mjs', target file types: TypeScript, JavaScript, Declaration.
File name '/user/username/projects/myproject/src/fileB.mjs' has a '.mjs' extension - stripping it.
File '/user/username/projects/myproject/src/fileB.mts' does not exist.
File '/user/username/projects/myproject/src/fileB.d.mts' does not exist.
File '/user/username/projects/myproject/src/fileB.mjs' does not exist.
File '/user/username/projects/myproject/src/fileB.mjs.ts' does not exist.
File '/user/username/projects/myproject/src/fileB.mjs.tsx' does not exist.
File '/user/username/projects/myproject/src/fileB.mjs.d.ts' does not exist.
File '/user/username/projects/myproject/src/fileB.mjs.js' does not exist.
File '/user/username/projects/myproject/src/fileB.mjs.jsx' does not exist.
Directory '/user/username/projects/myproject/src/fileB.mjs' does not exist, skipping all lookups in it.
======== Module name './fileB.mjs' was not resolved. ========
DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/fileB.mjs 1 undefined Failed Lookup Locations
Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/fileB.mjs 1 undefined Failed Lookup Locations
File '/a/lib/package.json' does not exist according to earlier cached lookups.
File '/a/package.json' does not exist according to earlier cached lookups.
File '/package.json' does not exist according to earlier cached lookups.
FileWatcher:: Added:: WatchInfo: /user/username/projects/package.json 2000 undefined File location affecting resolution
src/fileA.ts:1:21 - error TS2307: Cannot find module './fileB.mjs' or its corresponding type declarations.

1 import { foo } from "./fileB.mjs";
                      ~~~~~~~~~~~~~

../../../../a/lib/lib.es2016.full.d.ts
  Default library for target 'es2016'
src/fileA.ts
  Matched by default include pattern '**/*'
  File is CommonJS module because 'package.json' was not found
[12:01:11 AM] Found 1 error. Watching for file changes.

Program root files: ["/user/username/projects/myproject/src/fileA.ts"]
Program options: {"target":3,"module":100,"outDir":"/user/username/projects/myproject/out","watch":true,"project":"/user/username/projects/myproject/src","extendedDiagnostics":true,"traceResolution":true,"explainFiles":true,"configFilePath":"/user/username/projects/myproject/src/tsconfig.json"}
Program structureReused: SafeModules
Program files::
/a/lib/lib.es2016.full.d.ts
/user/username/projects/myproject/src/fileA.ts

Semantic diagnostics in builder refreshed for::
/user/username/projects/myproject/src/fileA.ts

Shape signatures in builder refreshed for::
/user/username/projects/myproject/src/filea.ts (computed .d.ts)

PolledWatches::
/user/username/projects/myproject/src/package.json:
  {"pollingInterval":2000}
/user/username/projects/myproject/src/node_modules/@types:
  {"pollingInterval":500}
/user/username/projects/myproject/node_modules/@types:
  {"pollingInterval":500}
/user/username/projects/myproject/src/fileb.mjs:
  {"pollingInterval":500}
/user/username/projects/package.json:
  {"pollingInterval":2000}

FsWatches::
/user/username/projects/myproject/src/tsconfig.json:
  {}
/user/username/projects/myproject/src/filea.ts:
  {}
/user/username/projects/myproject/src:
  {}
/a/lib/lib.es2016.full.d.ts:
  {}
/user/username/projects/myproject/package.json:
  {}

FsWatchesRecursive::
/user/username/projects/myproject/src:
  {}

exitCode:: ExitStatus.undefined

//// [/user/username/projects/myproject/out/fileA.js]
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const fileB_mjs_1 = require("./fileB.mjs");
(0, fileB_mjs_1.foo)();


text:
#pragma once

#include "poScene/ViewController.h"

namespace po {
	namespace scene {

		class ___FILEBASENAME___;
		typedef std::shared_ptr< ___FILEBASENAME___ > ___FILEBASENAME___Ref;

		class ___FILEBASENAME___ : public po::scene::ViewController
		{
		public:
			static ___FILEBASENAME___Ref create();
			void viewDidLoad() override;

		protected:
			 ___FILEBASENAME___();

		};

	}
} //  Namespace: po::scene


text:
package com.hazelcast.cp.internal.raft.impl.state;

import com.hazelcast.cp.internal.raft.impl.RaftEndpoint;

import java.util.HashSet;
import java.util.Set;

/**
 * Mutable state maintained by each candidate during pre-voting & voting phases
 */
public class CandidateState {

    private final int majority;
    private final Set<RaftEndpoint> voters = new HashSet<RaftEndpoint>();

    CandidateState(int majority) {
        this.majority = majority;
    }

    /**
     * Persists vote for the endpoint during election.
     * This method is idempotent, multiple votes from the same point are
     * counted only once.
     *
     * @return false if endpoint is already voted, true otherwise
     */
    public boolean grantVote(RaftEndpoint address) {
        return voters.add(address);
    }

    /**
     * Returns the number of expected majority of the votes.
     */
    public int majority() {
        return majority;
    }

    /**
     * Returns current granted number of the votes.
     */
    public int voteCount() {
        return voters.size();
    }

    /**
     * Returns true if majority of the votes are granted, false otherwise.
     */
    public boolean isMajorityGranted() {
        return voteCount() >= majority();
    }
}


text:
require 'test_helper'

class TournamentsControllerTest < ActionController::TestCase
  # test "the truth" do
  #   assert true
  # end
end


text:
                Lista kontentu

            <button class="btn btn-default pull-right" ng-show="!loadingContent" data-toggle="modal"
                    data-target="#myModal">Dodaj
            </button>

Pobieramy dane...

                    Nazwa
                    Menu
                    Kolejność

                    {{cont.title}}
                    {{cont.menuName}}
                    {{cont.orderNumber}}

                    <button type="button" class="close" data-dismiss="modal">×</button>

Modyfikuj Kontent

Dodaj Kontent

                    <form id="contentForm">

                            Nazwa
                            <input type="text" class="form-control" id="title" placeholder="Nazwa" ng-model="content[1].title">

                            Password
                            <input type="password" class="form-control" id="exampleInputPassword1"
                                   placeholder="Password">

                            Example select
                            <select class="form-control" id="exampleSelect1">
                                <option>1</option>
                                <option>2</option>
                                <option>3</option>
                                <option>4</option>
                                <option>5</option>
                            </select>

                            Example multiple select
                            <select multiple class="form-control" id="exampleSelect2">
                                <option>1</option>
                                <option>2</option>
                                <option>3</option>
                                <option>4</option>
                                <option>5</option>
                            </select>

                            Example textarea
                            <textarea class="form-control" id="exampleTextarea" rows="3"></textarea>

                            File input
                            <input type="file" class="form-control-file" id="exampleInputFile"
                                   aria-describedby="fileHelp">
                            This is some placeholder block-level help
                                text for the above input. It's a bit lighter and easily wraps to a new line.

                        <fieldset class="form-group">
                            <legend>Radio buttons</legend>

                                    <input type="radio" class="form-check-input" name="optionsRadios"
                                           id="optionsRadios1" value="option1" checked>
                                    Option one is this and that—be sure to include why it's great

                                    <input type="radio" class="form-check-input" name="optionsRadios"
                                           id="optionsRadios2" value="option2">
                                    Option two can be something else and selecting it will deselect option one

                                    <input type="radio" class="form-check-input" name="optionsRadios"
                                           id="optionsRadios3" value="option3" disabled>
                                    Option three is disabled

                        </fieldset>

                                <input type="checkbox" class="form-check-input">
                                Check me out

                            <button type="submit" class="btn btn-primary">Submit</button>
                            <button type="button" class="btn btn-default" data-dismiss="modal">Zamknij</button>

                    </form>


text:
package com.bijoykochar.launcher.view;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.bijoykochar.launcher.R;

/**
 * Created by bijoy on 10/17/15.
 */
public class TimeView extends LinearLayout {

    public TextView time, date;

    public TimeView(Context context) {
        super(context);
    }

    public TimeView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public TimeView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    public void init(Context context) {
        LayoutInflater mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        View rootView = mInflater.inflate(R.layout.time_view, this, true);

        time = (TextView) rootView.findViewById(R.id.time);
        date = (TextView) rootView.findViewById(R.id.date);
    }

    public void setTime(String time, String date) {
        this.time.setText(time);
        this.date.setText(date);
    }
}


text: docker build --rm --pull --no-cache -t jgeusebroek/znc .


text:
package eu.bcvsolutions.idm.acc.repository;

import eu.bcvsolutions.idm.acc.entity.SysSystemGroupSystem;
import eu.bcvsolutions.idm.core.api.repository.AbstractEntityRepository;

/**
 * System groups system repository - relation between a system and a group of systems.
 *
 * @author Vít Švanda
 * @since 11.2.0
 *
 */
public interface SysSystemGroupSystemRepository extends AbstractEntityRepository<SysSystemGroupSystem> {

}


text:
package org.omg.SecurityLevel2;

/**
* org/omg/SecurityLevel2/_SecurityManagerStub.java .
* Error reading Messages File.
* Error reading Messages File.
* Thursday, January 14, 2010 1:08:59 AM PST
*/

/* */
public class _SecurityManagerStub extends org.omg.CORBA.portable.ObjectImpl implements org.omg.SecurityLevel2.SecurityManager
{

  // Process/Capsule/ORB Instance specific operations
  public org.omg.Security.MechandOptions[] supported_mechanisms ()
  {
            org.omg.CORBA.portable.InputStream $in = null;
            try {
                org.omg.CORBA.portable.OutputStream $out = _request ("_get_supported_mechanisms", true);
                $in = _invoke ($out);
                org.omg.Security.MechandOptions $result[] = org.omg.Security.MechandOptionsListHelper.read ($in);
                return $result;
            } catch (org.omg.CORBA.portable.ApplicationException $ex) {
                $in = $ex.getInputStream ();
                String _id = $ex.getId ();
                throw new org.omg.CORBA.MARSHAL (_id);
            } catch (org.omg.CORBA.portable.RemarshalException $rm) {
                return supported_mechanisms (        );
            } finally {
                _releaseReply ($in);
            }
  } // supported_mechanisms

  public org.omg.SecurityLevel2.Credentials[] own_credentials ()
  {
            org.omg.CORBA.portable.InputStream $in = null;
            try {
                org.omg.CORBA.portable.OutputStream $out = _request ("_get_own_credentials", true);
                $in = _invoke ($out);
                org.omg.SecurityLevel2.Credentials $result[] = org.omg.SecurityLevel2.CredentialsListHelper.read ($in);
                return $result;
            } catch (org.omg.CORBA.portable.ApplicationException $ex) {
                $in = $ex.getInputStream ();
                String _id = $ex.getId ();
                throw new org.omg.CORBA.MARSHAL (_id);
            } catch (org.omg.CORBA.portable.RemarshalException $rm) {
                return own_credentials (        );
            } finally {
                _releaseReply ($in);
            }
  } // own_credentials

  public org.omg.SecurityLevel2.RequiredRights required_rights_object ()
  {
            org.omg.CORBA.portable.InputStream $in = null;
            try {
                org.omg.CORBA.portable.OutputStream $out = _request ("_get_required_rights_object", true);
                $in = _invoke ($out);
                org.omg.SecurityLevel2.RequiredRights $result = org.omg.SecurityLevel2.RequiredRightsHelper.read ($in);
                return $result;
            } catch (org.omg.CORBA.portable.ApplicationException $ex) {
                $in = $ex.getInputStream ();
                String _id = $ex.getId ();
                throw new org.omg.CORBA.MARSHAL (_id);
            } catch (org.omg.CORBA.portable.RemarshalException $rm) {
                return required_rights_object (        );
            } finally {
                _releaseReply ($in);
            }
  } // required_rights_object

  public org.omg.SecurityLevel2.PrincipalAuthenticator principal_authenticator ()
  {
            org.omg.CORBA.portable.InputStream $in = null;
            try {
                org.omg.CORBA.portable.OutputStream $out = _request ("_get_principal_authenticator", true);
                $in = _invoke ($out);
                org.omg.SecurityLevel2.PrincipalAuthenticator $result = org.omg.SecurityLevel2.PrincipalAuthenticatorHelper.read ($in);
                return $result;
            } catch (org.omg.CORBA.portable.ApplicationException $ex) {
                $in = $ex.getInputStream ();
                String _id = $ex.getId ();
                throw new org.omg.CORBA.MARSHAL (_id);
            } catch (org.omg.CORBA.portable.RemarshalException $rm) {
                return principal_authenticator (        );
            } finally {
                _releaseReply ($in);
            }
  } // principal_authenticator

  public org.omg.SecurityLevel2.AccessDecision access_decision ()
  {
            org.omg.CORBA.portable.InputStream $in = null;
            try {
                org.omg.CORBA.portable.OutputStream $out = _request ("_get_access_decision", true);
                $in = _invoke ($out);
                org.omg.SecurityLevel2.AccessDecision $result = org.omg.SecurityLevel2.AccessDecisionHelper.read ($in);
                return $result;
            } catch (org.omg.CORBA.portable.ApplicationException $ex) {
                $in = $ex.getInputStream ();
                String _id = $ex.getId ();
                throw new org.omg.CORBA.MARSHAL (_id);
            } catch (org.omg.CORBA.portable.RemarshalException $rm) {
                return access_decision (        );
            } finally {
                _releaseReply ($in);
            }
  } // access_decision

  public org.omg.SecurityLevel2.AuditDecision audit_decision ()
  {
            org.omg.CORBA.portable.InputStream $in = null;
            try {
                org.omg.CORBA.portable.OutputStream $out = _request ("_get_audit_decision", true);
                $in = _invoke ($out);
                org.omg.SecurityLevel2.AuditDecision $result = org.omg.SecurityLevel2.AuditDecisionHelper.read ($in);
                return $result;
            } catch (org.omg.CORBA.portable.ApplicationException $ex) {
                $in = $ex.getInputStream ();
                String _id = $ex.getId ();
                throw new org.omg.CORBA.MARSHAL (_id);
            } catch (org.omg.CORBA.portable.RemarshalException $rm) {
                return audit_decision (        );
            } finally {
                _releaseReply ($in);
            }
  } // audit_decision

  public org.omg.SecurityLevel2.TargetCredentials get_target_credentials (org.omg.CORBA.Object obj_ref)
  {
            org.omg.CORBA.portable.InputStream $in = null;
            try {
                org.omg.CORBA.portable.OutputStream $out = _request ("get_target_credentials", true);
                org.omg.CORBA.ObjectHelper.write ($out, obj_ref);
                $in = _invoke ($out);
                org.omg.SecurityLevel2.TargetCredentials $result = org.omg.SecurityLevel2.TargetCredentialsHelper.read ($in);
                return $result;
            } catch (org.omg.CORBA.portable.ApplicationException $ex) {
                $in = $ex.getInputStream ();
                String _id = $ex.getId ();
                throw new org.omg.CORBA.MARSHAL (_id);
            } catch (org.omg.CORBA.portable.RemarshalException $rm) {
                return get_target_credentials (obj_ref        );
            } finally {
                _releaseReply ($in);
            }
  } // get_target_credentials

  public void remove_own_credentials (org.omg.SecurityLevel2.Credentials creds)
  {
            org.omg.CORBA.portable.InputStream $in = null;
            try {
                org.omg.CORBA.portable.OutputStream $out = _request ("remove_own_credentials", true);
                org.omg.SecurityLevel2.CredentialsHelper.write ($out, creds);
                $in = _invoke ($out);
                return;
            } catch (org.omg.CORBA.portable.ApplicationException $ex) {
                $in = $ex.getInputStream ();
                String _id = $ex.getId ();
                throw new org.omg.CORBA.MARSHAL (_id);
            } catch (org.omg.CORBA.portable.RemarshalException $rm) {
                remove_own_credentials (creds        );
            } finally {
                _releaseReply ($in);
            }
  } // remove_own_credentials

  public org.omg.CORBA.Policy get_security_policy (int policy_type)
  {
            org.omg.CORBA.portable.InputStream $in = null;
            try {
                org.omg.CORBA.portable.OutputStream $out = _request ("get_security_policy", true);
                org.omg.CORBA.PolicyTypeHelper.write ($out, policy_type);
                $in = _invoke ($out);
                org.omg.CORBA.Policy $result = org.omg.CORBA.PolicyHelper.read ($in);
                return $result;
            } catch (org.omg.CORBA.portable.ApplicationException $ex) {
                $in = $ex.getInputStream ();
                String _id = $ex.getId ();
                throw new org.omg.CORBA.MARSHAL (_id);
            } catch (org.omg.CORBA.portable.RemarshalException $rm) {
                return get_security_policy (policy_type        );
            } finally {
                _releaseReply ($in);
            }
  } // get_security_policy

  // Type-specific CORBA::Object operations
  private static String[] __ids = {
    "IDL:SecurityLevel2/SecurityManager:1.0"};

  public String[] _ids ()
  {
    return (String[])__ids.clone ();
  }

  private void readObject (java.io.ObjectInputStream s) throws java.io.IOException
  {
     String str = s.readUTF ();
     String[] args = null;
     java.util.Properties props = null;
     org.omg.CORBA.Object obj = org.omg.CORBA.ORB.init (args, props).string_to_object (str);
     org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl) obj)._get_delegate ();
     _set_delegate (delegate);
  }

  private void writeObject (java.io.ObjectOutputStream s) throws java.io.IOException
  {
     String[] args = null;
     java.util.Properties props = null;
     String str = org.omg.CORBA.ORB.init (args, props).object_to_string (this);
     s.writeUTF (str);
  }
} // class _SecurityManagerStub


text:
package org.apache.cassandra.cql3.statements;

import org.apache.cassandra.cql3.ColumnIdentifier;

public class RawSelector
{
    public final Selectable.Raw selectable;
    public final ColumnIdentifier alias;

    public RawSelector(Selectable.Raw selectable, ColumnIdentifier alias)
    {
        this.selectable = selectable;
        this.alias = alias;
    }

    public boolean processesSelection()
    {
        return selectable.processesSelection();
    }
}


text:
/*
 * USER: mslm, Mike
 * DATE: March 8th, 2017
 */

package com.gedder.gedderalarm.google;

import com.gedder.gedderalarm.util.Log;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.util.ArrayList;

/**
 *
Class to parse the JSON received from Google Maps API.

 *
 *
Example usage:

 *
 *

 * public String json = "put json string here";
 * public JsonParser jsonParser = new JsonParser(json);
 * private int duration = jsonParser.duration();
 * private String origin = jsonParser.origin();
 * private String destination = jsonParser.destination();
 * private String route2_origin = jsonParser.origin(1);
 * private String route2_destination = jsonParser.destination(1);
 *

 */

public class JsonParser {
    // For mslm:
    // TODO: Add origin() and destination() functionality.
    // TODO: Add originLatitude() and destinationLatitude() functionality.
    // TODO: Add originLongitude() and destinationLongitude() functionality.

    private static final String TAG = JsonParser.class.getSimpleName();

    private String mJson;
    private JSONObject mJsonObj;

    /**
     * Initializes JsonParser object using a valid JSON string.
     * @param json The JSON string to parse.
     */
    public JsonParser(String json) {
        mJson = json;

        try {
            mJsonObj = new JSONObject(this.mJson);
        } catch (JSONException e) {
            Log.e(TAG, "Invalid JSON string in constructor " + TAG + "::JsonParser(String).");
            mJson = "";
            mJsonObj = null;
        }
    }

    /**
     * Grabs json['routes'][0]['legs'][0]['duration']['value'].
     * @return duration of travel in seconds.
     */
    public int duration() {
        return duration(0, 0);
    }

    /**
     * Grabs json['routes'][route]['legs'][0]['duration']['value'].
     * @param route route, if multiple. Starts from 0.
     * @return duration of travel in seconds.
     */
    public int duration(int route) {
        return duration(route, 0);
    }

    /**
     * Grabs json['routes'][route]['legs'][leg]['duration']['value'].
     * @param route which route, if multiple. Starts from 0.
     * @param leg   which leg, if multiple. Starts from 0.
     * @return duration of travel in seconds.
     */
    public int duration(int route, int leg) {
        JSONArray routes;
        JSONObject route_number;
        JSONArray legs;
        JSONObject leg_number;
        JSONObject durationObj;
        int duration;

        try {
            routes = mJsonObj.getJSONArray("routes");
            route_number = routes.getJSONObject(route);
            legs = route_number.getJSONArray("legs");
            leg_number = legs.getJSONObject(leg);
            durationObj = leg_number.getJSONObject("duration");
            duration = durationObj.getInt("value");
        } catch (JSONException e) {
            Log.e(TAG, "Invalid JSON string in function " + TAG + "::duration.");
            return -1;
        }

        return duration;
    }

    /**
     * Grabs json['routes'][0]['legs'][0]['distance']['value'].
     * @return distance of travel in meters.
     */
    public int distance() {
        return distance(0, 0);
    }

    /**
     * Grabs json['routes'][route]['legs'][0]['distance']['value'].
     * @param route which route, if multiple. Starts from 0.
     * @return distance of travel in meters.
     */
    public int distance(int route) {
        return distance(route, 0);
    }

    /**
     * Grabs json['routes'][route]['legs'][leg]['distance']['value'].
     * @param route which route, if multiple. Starts from 0.
     * @param leg   which leg, if multiple. Starts from 0.
     * @return distance of travel in meters.
     */
    public int distance(int route, int leg) {
        JSONArray routes;
        JSONObject route_number;
        JSONArray legs;
        JSONObject leg_number;
        int distance;

        try {
            routes = mJsonObj.getJSONArray("routes");
            route_number = routes.getJSONObject(route);
            legs = route_number.getJSONArray("legs");
            leg_number = legs.getJSONObject(leg);
            distance = leg_number.getInt("value");
        } catch (JSONException e) {
            Log.e(TAG, "Invalid JSON string in function " + TAG + "::distance.");
            return -1;
        }

        return distance;
    }

    /**
     * Grabs json['routes'][0]['legs'][0]['duration_in_traffic']['value'].
     *
Only exists if the request specified a traffic model.

     * @return duration in traffic in seconds.
     */
    public int durationInTraffic() {
        return durationInTraffic(0, 0);
    }

    /**
     * Grabs json['routes'][route]['legs'][0]['duration_in_traffic']['value'].
     *
Only exists if the request specified a traffic model.

     * @param route which route, if multiple. Starts from 0.
     * @return duration in traffic in seconds.
     */
    public int durationInTraffic(int route) {
        return durationInTraffic(route, 0);
    }

    /**
     * Grabs json['routes'][route]['legs'][leg]['duration_in_traffic']['value'].
     *
Only exists if the request specified a traffic model.

     * @param route which route, if multiple. Starts from 0.
     * @param leg   which leg, if multiple. Starts from 0.
     * @return duration in traffic in seconds.
     */
    public int durationInTraffic(int route, int leg) {
        JSONArray routes;
        JSONObject route_number;
        JSONArray legs;
        JSONObject leg_number;
        JSONObject duration_in_traffic;
        int value;

        try {
            routes = mJsonObj.getJSONArray("routes");
            route_number = routes.getJSONObject(route);
            legs = route_number.getJSONArray("legs");
            leg_number = legs.getJSONObject(leg);
            duration_in_traffic = leg_number.getJSONObject("duration_in_traffic");
            value = duration_in_traffic.getInt("value");
        } catch (JSONException e) {
            Log.e(TAG, "Invalid JSON string in function " + TAG + "::durationInTraffic.");
            return -1;
        }

        return value;
    }

    /**
     * Grabs json['routes'][0]['warnings'] elements and puts them in a ArrayList of Strings.
     * @return an ArrayList<String> object containing all warnings.
     */
    public ArrayList<String> warnings() {
        return warnings(0);
    }

    /**
     * Grabs json['routes'][route]['warnings'] elements and puts them in a ArrayList of Strings.
     * @param route which route, if multiple. Starts from 0.
     * @return an ArrayList<String> object containing all warnings.
     */
    public ArrayList<String> warnings(int route) {
        JSONArray routes;
        JSONObject route_number;
        JSONArray warnings;
        ArrayList<String> warningsList = new ArrayList<>();

        try {
            routes = mJsonObj.getJSONArray("routes");
            route_number = routes.getJSONObject(route);
            warnings = route_number.getJSONArray("warnings");
            for (int i = 0; i < warnings.length(); i++) {
                warningsList.add(warnings.getString(i));
            }
        } catch (JSONException e) {
            Log.e(TAG, "Invalid JSON string in function " + TAG + "::warnings.");
            return null;
        }

        return warningsList;
    }

    /**
     * Grabs json['routes'][0]['copyrights'].
     * @return a String containing the copyright information.
     */
    public String copyrights() {
        return copyrights(0);
    }

    /**
     * Grabs json['routes'][route]['copyrights'].
     * @param route which route, if multiple. Starts from 0.
     * @return a String containing the copyright information.
     */
    public String copyrights(int route) {
        JSONArray routes;
        JSONObject route_number;
        String copyrights;

        try {
            routes = mJsonObj.getJSONArray("routes");
            route_number = routes.getJSONObject(route);
            copyrights = route_number.getString("copyrights");
        } catch (JSONException e) {
            Log.e(TAG, "Invalid JSON string in function " + TAG + "::copyrights.");
            return null;
        }

        return copyrights;
    }

    /**
     * Grabs json['routes'][0]['summary'].
     * @return a String containing summary information for the route.
     */
    public String summary() {
        return summary(0);
    }

    /**
     * Grabs json['routes'][route]['summary'].
     * @param route which route, if multiple. Starts from 0.
     * @return a String containing summary information for the route.
     */
    public String summary(int route) {
        JSONArray routes;
        JSONObject route_number;
        String summary;

        try {
            routes = mJsonObj.getJSONArray("routes");
            route_number = routes.getJSONObject(route);
            summary = route_number.getString("summary");
        } catch (JSONException e) {
            Log.e(TAG, "Invalid JSON string in function " + TAG + "::summary.");
            return null;
        }

        return summary;
    }

    /**
     * Grabs json['routes'][0]['fare']['currency'].
     * @return the ISO 4217 currency code that the fare is expressed in.
     */
    public String fareCurrency() {
        return fareCurrency(0);
    }

    /**
     * Grabs json['routes'][route]['fare']['currency'].
     * @param route which route, if multiple. Starts from 0.
     * @return the ISO 4217 currency code that the fare is expressed in.
     */
    public String fareCurrency(int route) {
        JSONArray routes;
        JSONObject route_number;
        JSONObject fare;
        String currency;

        try {
            routes = mJsonObj.getJSONArray("routes");
            route_number = routes.getJSONObject(route);
            fare = route_number.getJSONObject("fare");
            currency = fare.getString("currency");
        } catch (JSONException e) {
            Log.e(TAG, "Invalid JSON string in function " + TAG + "::fareCurrency.");
            return null;
        }

        return currency;
    }

    /**
     * Grabs json['routes'][0]['fare']['value'].
     * @return the total fare amount in the currency specified by fareCurrency().
     */
    public int fare() {
        return fare(0);
    }

    /**
     * Grabs json['routes'][route]['fare']['value'].
     * @param route which route, if multiple. Starts from 0.
     * @return the total fare amount in the currency specified by fareCurrency(). -1 if there was a
     * JSONException.
     */
    public int fare(int route) {
        JSONArray routes;
        JSONObject route_number;
        JSONObject fareObj;
        int fare;

        try {
            routes = mJsonObj.getJSONArray("routes");
            route_number = routes.getJSONObject(route);
            fareObj = route_number.getJSONObject("fare");
            fare = fareObj.getInt("value");
        } catch (JSONException e) {
            Log.e(TAG, "Invalid JSON string in function " + TAG + "::fare.");
            return -1;
        }

        return fare;
    }

    /**
     * Grabs json['status'].
     * @return status number of the request, corresponding to com.gedder.gedderalarm.util.JSONStatus
     * enumerations.
     */
    public JsonStatus status() {
        JsonStatus code;
        String status;

        try {
            status = mJsonObj.getString("status");
        } catch (JSONException e) {
            Log.e(TAG, "Invalid JSON string in function " + TAG + "::status.");
            return null;
        }

        switch (status) {
            case "OK":
                code = JsonStatus.OK;
                break;
            case "NOT_FOUND":
                code = JsonStatus.NOT_FOUND;
                break;
            case "ZERO_RESULTS":
                code = JsonStatus.ZERO_RESULTS;
                break;
            case "MAX_WAYPOINTS_EXCEEDED":
                code = JsonStatus.MAX_WAYPOINTS_EXCEEDED;
                break;
            case "MAX_ROUTE_LENGTH_EXCEEDED":
                code = JsonStatus.MAX_ROUTE_LENGTH_EXCEEDED;
                break;
            case "INVALID_REQUEST":
                code = JsonStatus.INVALID_REQUEST;
                break;
            case "OVER_QUERY_LIMIT":
                code = JsonStatus.OVER_QUERY_LIMIT;
                break;
            case "REQUEST_DENIED":
                code = JsonStatus.REQUEST_DENIED;
                break;
            default:
                code = JsonStatus.UNKNOWN_ERROR;
                break;
        }

        return code;
    }

    /**
     * Grabs json['error_message']. Only exists if json['status'] != "OK".
     * @return error message string.
     */
    public String errorMessage() {
        String error;

        try {
            error = mJsonObj.getString("error_message");
        } catch (JSONException e) {
            Log.e(TAG, "Invalid JSON string in function " + TAG + "::errorMessage.");
            return "";
        } catch (NullPointerException e) {
            return "";
        }

        return error;
    }

    /**
     * Grabs json['available_travel_modes']. Only exists if a request specifies a travel mode and
     * gets no results.
     * @return an ArrayList<String> object containing all available travel modes.
     */
    public ArrayList<String> availableTravelModes() {
        JSONArray travel_modes;
        ArrayList<String> modes = new ArrayList<>();

        try {
            travel_modes = mJsonObj.getJSONArray("available_travel_modes");
            for (int i = 0; i < travel_modes.length(); i++) {
                modes.add(travel_modes.getString(i));
            }
        } catch (JSONException e) {
            Log.e(TAG, "Invalid JSON string in function " + TAG + "::availableTravelModes.");
            return null;
        }

        return modes;
    }

    /**
     *
     * @param route
     * @param leg
     * @param step
     * @return
     */
    public TravelMode travelMode(int route, int leg, int step) {
        JSONArray routes;
        JSONObject route_number;
        JSONArray legs;
        JSONObject leg_number;
        JSONArray steps;
        JSONObject step_number;
        String travelModeStr;
        TravelMode travelMode;

        try {
            routes = mJsonObj.getJSONArray("routes");
            route_number = routes.getJSONObject(route);
            legs = route_number.getJSONArray("legs");
            leg_number = legs.getJSONObject(leg);
            steps = leg_number.getJSONArray("steps");
            step_number = steps.getJSONObject(step);
            travelModeStr = step_number.getString("travel_mode");
        } catch (JSONException e) {
            Log.e(TAG, "Invalid JSON string in function " + TAG + "::travelMode.");
            return null;
        }

        switch (travelModeStr) {
            case "DRIVING":
                travelMode = TravelMode.DRIVING;
                break;
            case "WALKING":
                travelMode = TravelMode.WALKING;
                break;
            case "BICYCLING":
                travelMode = TravelMode.BICYCLING;
                break;
            case "TRANSIT":
                travelMode = TravelMode.TRANSIT;
                break;
            default:
                travelMode = null;
                break;
        }

        return travelMode;
    }
}


text:
(function () {

'use strict';

angular.module('ManjuApp.Route4-services',[])
.service('Route4_service', function Route4_service($scope) {
    // AngularJS will instantiate a singleton by calling "new" on this function
})

//factories
// .factory('route4-factory', function() {
//     // Service logic
//     // ...

//     var meaningOfLife = 42;

//     // Public API here
//     return {
//       someMethod: function() {
//         return meaningOfLife;
//       }
//     };
// })

// //constants
// .constant('route4-constant', 42)

// //values
// .value('route4-value', 42)

// //Providers
// .provider('route4-provider', function() {

//   // Private variables
//   var salutation = 'Hello';

//   // Private constructor
//   function Greeter() {
//     this.greet = function() {
//       return salutation;
//     };
//   }

//   // Public API for configuration
//   this.setSalutation = function(s) {
//     salutation = s;
//   };

//   // Method for instantiating
//   this.$get = function() {
//     return new Greeter();
//   };
// })

;

}());


text:
/*	$NetBSD$	*/

/*
 * Copyright (c) 2001
 *       HAYAKAWA Koichi.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 3. The name of the author may not be used to endorse or promote products
 *    derived from this software without specific prior written permission.
 *
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */

/*-
 * Copyright (c) 1999 The NetBSD Foundation, Inc.
 * All rights reserved.
 *
 * This code is derived from software contributed to The NetBSD Foundation
 * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
 * NASA Ames Research Center.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 3. All advertising materials mentioning features or use of this software
 *    must display the following acknowledgement:
 *	This product includes software developed by the NetBSD
 *	Foundation, Inc. and its contributors.
 * 4. Neither the name of The NetBSD Foundation nor the names of its
 *    contributors may be used to endorse or promote products derived
 *    from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */

/*
 * Copyright (c) 1999, by UCHIYAMA Yasushi
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. The name of the developer may NOT be used to endorse or promote products
 *    derived from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 */

/* HAYAKAWA Koichi wrote ALi 1543 PCI ICU code basing on VIA82C586 driver */

#include <sys/param.h>
#include <sys/systm.h>
#include <sys/errno.h>
#include <sys/device.h>
#include <sys/malloc.h>
#include <sys/proc.h>

#include <machine/intr.h>
#include <machine/bus.h>

#include <dev/pci/pcivar.h>
#include <dev/pci/pcireg.h>
#include <dev/pci/pcidevs.h>

#include <i386/pci/pci_intr_fixup.h>
#include <i386/pci/piixvar.h>

int ali1543_getclink (pciintr_icu_handle_t, int, int *);
int ali1543_get_intr (pciintr_icu_handle_t, int, int *);
int ali1543_set_intr (pciintr_icu_handle_t, int, int);

const struct pciintr_icu ali1543_icu = {
	ali1543_getclink,
	ali1543_get_intr,
	ali1543_set_intr,
	piix_get_trigger,
	piix_set_trigger,
};

/*
 * Linux source code (linux/arch/i386/kernel/pci-irq.c) says that the
 * irq order of ALi PCI ICU is shuffled.
 */
const static int ali1543_intr_shuffle_get[16] = {
	0, 9, 3, 10, 4, 5, 7, 6, 1, 11, 0, 12, 0, 14, 0, 15
};
const static int ali1543_intr_shuffle_set[16] = {
	0, 8, 0, 2, 4, 5, 7, 6, 0, 1, 3, 9, 11, 0, 13, 15
};

#define ALI1543_IRQ_MASK		0xdefa

#define ALI1543_LEGAL_LINK(link)	(((link) >= 0) && ((link) <= 7))
#define ALI1543_LEGAL_IRQ(irq)		((1 << (irq)) & ALI1543_IRQ_MASK)

#define ALI1543_INTR_CFG_REG		0x48

#define ALI1543_INTR_PIRQA_SHIFT	0
#define ALI1543_INTR_PIRQA_MASK		0x0000000f
#define ALI1543_INTR_PIRQB_SHIFT	4
#define ALI1543_INTR_PIRQB_MASK		0x000000f0
#define ALI1543_INTR_PIRQC_SHIFT	8
#define ALI1543_INTR_PIRQC_MASK		0x00000f00
#define ALI1543_INTR_PIRQD_SHIFT	12
#define ALI1543_INTR_PIRQD_MASK		0x0000f000

#define ALI1543_INTR_PIRQ_SHIFT(clink)	((clink)*4)
#define ALI1543_INTR_PIRQ_IRQ(reg, clink)				\
	(((reg) >> ((clink)*4)) & 0x0f)
#define ALI1543_PIRQ(reg, clink)					\
	ali1543_intr_shuffle_get[ALI1543_INTR_PIRQ_IRQ((reg), (clink))]

int
ali1543_init(pci_chipset_tag_t pc, bus_space_tag_t iot, pcitag_t tag,
    pciintr_icu_tag_t *ptagp, pciintr_icu_handle_t *phandp)
{

	if (piix_init(pc, iot, tag, ptagp, phandp) == 0) {
		*ptagp = &ali1543_icu;

		return (0);
	}

	return (1);
}

int
ali1543_getclink(pciintr_icu_handle_t v, int link, int *clinkp)
{

	if (ALI1543_LEGAL_LINK(link - 1)) {
		*clinkp = link - 1;
		return (0);
	}

	return (1);
}

int
ali1543_get_intr(pciintr_icu_handle_t v, int clink, int *irqp)
{
	struct piix_handle *ph = v;
	pcireg_t reg;
	int val;

	if (ALI1543_LEGAL_LINK(clink) == 0)
		return (1);

	reg = pci_conf_read(ph->ph_pc, ph->ph_tag, ALI1543_INTR_CFG_REG);
#ifdef DEBUG_1543
	printf("ali1543: PIRQ reg 0x%08x\n", reg); /* XXX debug */
#endif /* DEBUG_1543 */
	val = ALI1543_PIRQ(reg, clink);
	*irqp = (val == 0) ?
	    I386_PCI_INTERRUPT_LINE_NO_CONNECTION : val;

	return (0);
}

int
ali1543_set_intr(pciintr_icu_handle_t v, int clink, int irq)
{
	struct piix_handle *ph = v;
	int shift, val;
	pcireg_t reg;

	if (ALI1543_LEGAL_LINK(clink) == 0 || ALI1543_LEGAL_IRQ(irq) == 0)
		return (1);

	reg = pci_conf_read(ph->ph_pc, ph->ph_tag, ALI1543_INTR_CFG_REG);
	ali1543_get_intr(v, clink, &val);
	shift = ALI1543_INTR_PIRQ_SHIFT(clink);
	reg &= ~(0x0f << shift);
	reg |= (ali1543_intr_shuffle_set[irq] << shift);
	pci_conf_write(ph->ph_pc, ph->ph_tag, ALI1543_INTR_CFG_REG, reg);
	if (ali1543_get_intr(v, clink, &val) != 0 || val != irq)
		return (1);

	return (0);
}