/*
# Licensed Materials - Property of IBM
# Copyright IBM Corp. 2015
 */
/**
 * Low-level graph builder.
 * {@link com.ibm.streamsx.topology.builder.GraphBuilder} provides a layer
 * on top of {@code com.ibm.streams.flow.OperatorGraph}
 * to define a directed graph of connected operators.
 * Where possible information is maintained in
 * the graph declared by {@code OperatorGraph}
 * but this class maintains additional information
 * in order to allow SPL generation (through JSON).
 *
 */
package com.ibm.streamsx.topology.builder;

/*
# Licensed Materials - Property of IBM
# Copyright IBM Corp. 2015
 */
/**
 * Low-level graph builder.
 * {@link com.ibm.streamsx.topology.builder.GraphBuilder} provides a layer
 * on top of {@code com.ibm.streams.flow.OperatorGraph}
 * to define a directed graph of connected operators.
 * Where possible information is maintained in
 * the graph declared by {@code OperatorGraph}
 * but this class maintains additional information
 * in order to allow SPL generation (through JSON).
 *

 * Note that the classes and methods in this
 * package is subject to change including the resultant
 * JSON object describing the graph.
 *

 * The intended API for the Java Application API is the
 * functional API described by the package
 * {@code com.ibm.streamsx.topology}.
 *

 */
package com.ibm.streamsx.topology.builder;

Mark the builder api as subject to change


package com.vav.CTCI.Common;

/**
 * Created by Vaibhav on 5/6/2017.
 */
public class CTCICommon {
    public static void main(String arg[]){

    }
}

package com.vav.CTCI.Common;

/**
 * Created by Vaibhav on 5/6/2017.
 */
public class CTCICommon {
    public static void main(String arg[]){
        //No Code
    }
}

Test commit from new machine

Test commit from new machine


package org.yukung.tutorial.junit;

import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.*;

import java.util.Date;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

public class DateTest {

	@Before
	public void setUp() throws Exception {
	}

	@After
	public void tearDown() throws Exception {
	}

	@Test
	public void testDate() {
		assertThat(new Date(), is(IsDate.dateOf(2012, 1, 12)));
	}

}

package org.yukung.tutorial.junit;

import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.*;
import static org.yukung.tutorial.junit.IsDate.*;

import java.util.Date;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

public class DateTest {

	@Before
	public void setUp() throws Exception {
	}

	@After
	public void tearDown() throws Exception {
	}

	@Test
	public void testDate() {
		assertThat(new Date(), is(dateOf(2012, 1, 12)));
	}

}

Fix test case using static import to 'IsDate' class.


/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.wpi.first.wpilibj.templates.commands;

/**
 *
 * @author TJ2
 */
public class KickerAuto extends CommandBase {
    double timeout;
    double power = 1;
    public KickerAuto(double time) {
        super("kicker auto");
        requires(kicker);
        timeout = time;
        // Use requires() here to declare subsystem dependencies
        // eg. requires(chassis);
    }

    // Called just before this Command runs the first time
    protected void initialize() {
        setTimeout(timeout);
    }

    // Called repeatedly when this Command is scheduled to run
    protected void execute() {
        kicker.KickerOpenLoop(power);
    }

    // Make this return true when this Command no longer needs to run execute()
    protected boolean isFinished() {
        return isTimedOut();
    }

    // Called once after isFinished returns true
    protected void end() {
        kicker.KickerOpenLoop(0);
    }

    // Called when another command which requires one or more of the same
    // subsystems is scheduled to run
    protected void interrupted() {
    }
}

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.wpi.first.wpilibj.templates.commands;

import edu.wpi.first.wpilibj.templates.Wiring;

/**
 *
 * @author TJ2
 */
public class KickerAuto extends CommandBase {
    double timeout;
    double power = Wiring.kickerPower;
    public KickerAuto(double time) {
        super("kicker auto");
        requires(kicker);
        timeout = time;
        // Use requires() here to declare subsystem dependencies
        // eg. requires(chassis);
    }

    // Called just before this Command runs the first time
    protected void initialize() {
        setTimeout(timeout);
    }

    // Called repeatedly when this Command is scheduled to run
    protected void execute() {
        kicker.KickerOpenLoop(power);
    }

    // Make this return true when this Command no longer needs to run execute()
    protected boolean isFinished() {
        return isTimedOut();
    }

    // Called once after isFinished returns true
    protected void end() {
        kicker.KickerOpenLoop(0);
    }

    // Called when another command which requires one or more of the same
    // subsystems is scheduled to run
    protected void interrupted() {
    }
}

Add wiring constant for kicker power

Add wiring constant for kicker power


package xyz.openmodloader.server;

import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.text.ITextComponent;
import xyz.openmodloader.OpenModLoader;
import xyz.openmodloader.SidedHandler;
import xyz.openmodloader.launcher.strippable.Side;

public class OMLServerHandler implements SidedHandler {
    private final MinecraftServer server;

    public OMLServerHandler(MinecraftServer server) {
        this.server = server;
    }

    @Override
    public void onInitialize() {

    }

    @Override
    public Side getSide() {
        return Side.SERVER;
    }

    @Override
    public void openSnackbar(ITextComponent component) {
        OpenModLoader.INSTANCE.getChannel()
                .send("snackbar")
                .set("component", component)
                .toAll();
    }

    @Override
    public EntityPlayerSP getClientPlayer() {
        return null;
    }

    @Override
    public void handleOnMainThread(Runnable runnable) {
        getServer().addScheduledTask(runnable);
    }

    @Override
    public MinecraftServer getServer() {
        return server;
    }
}

package xyz.openmodloader.server;

import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.text.ITextComponent;
import xyz.openmodloader.OpenModLoader;
import xyz.openmodloader.SidedHandler;
import xyz.openmodloader.event.impl.MessageEvent;
import xyz.openmodloader.launcher.strippable.Side;

public class OMLServerHandler implements SidedHandler {
    private final MinecraftServer server;

    public OMLServerHandler(MinecraftServer server) {
        this.server = server;
    }

    @Override
    public void onInitialize() {

    }

    @Override
    public Side getSide() {
        return Side.SERVER;
    }

    @Override
    public void openSnackbar(ITextComponent component) {
        component = MessageEvent.Snackbar.handle(component, Side.SERVER);
        if (component == null) {
            return;
        }
        OpenModLoader.INSTANCE.getChannel()
                .send("snackbar")
                .set("component", component)
                .toAll();
    }

    @Override
    public EntityPlayerSP getClientPlayer() {
        return null;
    }

    @Override
    public void handleOnMainThread(Runnable runnable) {
        getServer().addScheduledTask(runnable);
    }

    @Override
    public MinecraftServer getServer() {
        return server;
    }
}

Add snackbar event on server

Add snackbar event on server


package shouty;

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

public class CoordinateTest {

    @Test
    public void itCalculatesTheDistanceFromAnotherCoordinateAlongXAxis() {
        Coordinate a = new Coordinate(0, 0);
        Coordinate b = new Coordinate(1000, 0);
        assertEquals(1000, a.distanceFrom(b));
    }
}

package shouty;

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

public class CoordinateTest {

    @Test
    public void it_calculates_the_distance_from_another_coordinate_along_x_axis() {
        Coordinate a = new Coordinate(0, 0);
        Coordinate b = new Coordinate(1000, 0);
        assertEquals(1000, a.distanceFrom(b));
    }
}

Improve legibility of JUnit test

Improve legibility of JUnit test


package net.shadowfacts.foodies.item;

import cpw.mods.fml.common.registry.GameRegistry;

/**
 * Helper class for registering items.
 * @author shadowfacts
 */
public class FItems {
	// Foods
	public static Food toast;
	public static Food tomato;
	public static Food beefPattie;
	public static Food hamburger;

	public static void preInit() {
		// Create Items
		toast = new Food(3, 0.3f).setUnlocalizedName("foodToast").setTextureName("foodToast");
		tomato = new Food(1, 0.1f).setUnlocalizedName("fruitTomato").setTextureName("fruitTomato");
		beefPattie = new Food(7, 0.4f).setUnlocalizedName("foodBeefPattie").setTextureName("foodBeefPattie");
		hamburger = new Food(5, 0.7f).setUnlocalizedName("foodHamburger").setTextureName("foodHamburger");

		// Register items
		GameRegistry.registerItem(toast, "foodToast");
		GameRegistry.registerItem(tomato, "fruitTomato");
		GameRegistry.registerItem(beefPattie, "foodBeefPattie");
		GameRegistry.registerItem(hamburger, "foodHamburger");
	}

	public static void load() {

	}

	public static void postInit() {

	}
}

package net.shadowfacts.foodies.item;

import cpw.mods.fml.common.registry.GameRegistry;

/**
 * Helper class for registering items.
 * @author shadowfacts
 */
public class FItems {
	// Foods
	public static Food toast;
	public static Food tomato;
	public static Food beefPattie;
	public static Food hamburger;

	public static void preInit() {
		// Create Items
		toast = new Food(3, 0.3f).setUnlocalizedName("foodToast").setTextureName("foodToast");
		tomato = new Food(1, 0.1f).setUnlocalizedName("fruitTomato").setTextureName("fruitTomato");
		beefPattie = new Food(3, 0.6f).setUnlocalizedName("foodBeefPattie").setTextureName("foodBeefPattie");
		hamburger = new Food(5, 0.7f).setUnlocalizedName("foodHamburger").setTextureName("foodHamburger");

		// Register items
		GameRegistry.registerItem(toast, "foodToast");
		GameRegistry.registerItem(tomato, "fruitTomato");
		GameRegistry.registerItem(beefPattie, "foodBeefPattie");
		GameRegistry.registerItem(hamburger, "foodHamburger");
	}

	public static void load() {

	}

	public static void postInit() {

	}
}

Change hunger values for beef pattie

Change hunger values for beef pattie


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

import android.graphics.Typeface;

import java.util.HashMap;
import java.util.Map;

import playn.core.AbstractFont;

class AndroidFont extends AbstractFont {

  public final Typeface typeface;

  public AndroidFont(String name, Style style, float size) {
    super(name, style, size);
    this.typeface = Typeface.create(name, TO_ANDROID_STYLE.get(style));
  }

  protected static final Map<Style,Integer> TO_ANDROID_STYLE = new HashMap<Style,Integer>();
  static {
    TO_ANDROID_STYLE.put(Style.PLAIN,       Typeface.NORMAL);
    TO_ANDROID_STYLE.put(Style.BOLD,        Typeface.BOLD);
    TO_ANDROID_STYLE.put(Style.ITALIC,      Typeface.ITALIC);
    TO_ANDROID_STYLE.put(Style.BOLD_ITALIC, Typeface.BOLD_ITALIC);
  }
}

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

import android.graphics.Typeface;

import java.util.EnumMap;
import java.util.Map;

import playn.core.AbstractFont;

class AndroidFont extends AbstractFont {

  public final Typeface typeface;

  public AndroidFont(String name, Style style, float size) {
    super(name, style, size);
    this.typeface = Typeface.create(name, TO_ANDROID_STYLE.get(style));
  }

  protected static final Map<Style,Integer> TO_ANDROID_STYLE =
    new EnumMap<Style,Integer>(Style.class);
  static {
    TO_ANDROID_STYLE.put(Style.PLAIN,       Typeface.NORMAL);
    TO_ANDROID_STYLE.put(Style.BOLD,        Typeface.BOLD);
    TO_ANDROID_STYLE.put(Style.ITALIC,      Typeface.ITALIC);
    TO_ANDROID_STYLE.put(Style.BOLD_ITALIC, Typeface.BOLD_ITALIC);
  }
}

Use an EnumMap rather than a HashMap.

Use an EnumMap rather than a HashMap.


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

package net.openhft.chronicle.core.values;

public interface LongValue {
    long getValue();

    void setValue(long value);

    long getVolatileValue();

    void setVolatileValue(long value);

    void setOrderedValue(long value);

    long addValue(long delta);

    long addAtomicValue(long delta);

    boolean compareAndSwapValue(long expected, long value);

    default void setMaxValue(long value) {
        for (; ; ) {
            long pos = getVolatileValue();
            if (pos >= value)
                break;
            if (compareAndSwapValue(pos, value))
                break;
        }
    }

    default void setMinValue(long value) {
        for (; ; ) {
            long pos = getVolatileValue();
            if (pos <= value)
                break;
            if (compareAndSwapValue(pos, value))
                break;
        }
    }
}

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

package net.openhft.chronicle.core.values;

public interface LongValue {
    long getValue();

    void setValue(long value);

    long getVolatileValue();

    default long getVolatileValue(long closedValue) {
        return getVolatileValue();
    }

    void setVolatileValue(long value);

    void setOrderedValue(long value);

    long addValue(long delta);

    long addAtomicValue(long delta);

    boolean compareAndSwapValue(long expected, long value);

    default void setMaxValue(long value) {
        for (; ; ) {
            long pos = getVolatileValue();
            if (pos >= value)
                break;
            if (compareAndSwapValue(pos, value))
                break;
        }
    }

    default void setMinValue(long value) {
        for (; ; ) {
            long pos = getVolatileValue();
            if (pos <= value)
                break;
            if (compareAndSwapValue(pos, value))
                break;
        }
    }
}

Support accessing a long value after being closed for graceful shutdown


/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package epfc.cours3449;

/**
 *
 * @author jedepaepe
 */
public class lesson11 {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
    }

}

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package epfc.cours3449;

/**
 *
 * @author jedepaepe
 */
public class lesson11 {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        System.out.println("Hello Git");
    }

}

Change code, add "hello git"

Change code, add "hello git"


import individu.Assassin;
import individu.Barbare;

import java.rmi.RemoteException;

import controle.Console;

/**
 * Test de la Console avec un Element qui s'ajoute a l'Arene (apres lancement Arene et IHM). A lancer en plusieurs exemplaires.
 */
public class TestConsole {

	/**
	 * @param args
	 * @throws RemoteException
	 */
	public static void main(String[] args) throws RemoteException {
		Assassin ass1 = new Assassin();
		//Random r = new Random();
		new Console(ass1, 40, 40);

		Barbare bar1 = new Barbare();
		//Random r = new Random();
		new Console(bar1, 70, 70);
	}

}

import individu.Assassin;
import individu.Barbare;

import java.rmi.RemoteException;
import java.util.Random;

import serveur.Arene;

import controle.Console;

/**
 * Test de la Console avec un Element qui s'ajoute a l'Arene (apres lancement Arene et IHM). A lancer en plusieurs exemplaires.
 */
public class TestConsole {

	/**
	 * @param args
	 * @throws RemoteException
	 */
	public static void main(String[] args) throws RemoteException {
		Assassin ass1 = new Assassin();
		new Console(ass1, new Random().nextInt(Arene.tailleAreneX), new Random().nextInt(Arene.tailleAreneY));

		Barbare bar1 = new Barbare();
		// new Console(bar1, new Random().nextInt(Arene.tailleAreneX), new Random().nextInt(Arene.tailleAreneY));
	}

}

Test Console utilise maintenant les valeur de la taille d'arène et ne fait plus piper de barbares


package org.jvirtanen.nassau.util;

public class SystemClock implements Clock {

    public static final SystemClock INSTANCE = new SystemClock();

    private SystemClock() {
    }

    @Override
    public long currentTimeMillis() {
        return System.currentTimeMillis();
    }

}

package org.jvirtanen.nassau.util;

/**
 * The system time source.
 */
public class SystemClock implements Clock {

    public static final SystemClock INSTANCE = new SystemClock();

    private SystemClock() {
    }

    @Override
    public long currentTimeMillis() {
        return System.currentTimeMillis();
    }

}

Add documentation for system clock

Add documentation for system clock


package bool;

import java.util.List;

public class Evaluator implements Visitor<Boolean, List<String>> {
    @Override
    public Boolean visit(Var node, List<String> vars) {
        return vars.contains(node.token.getValue());
    }

    @Override
    public Boolean visit(And node, List<String> vars) {
        return evaluate(node.left, vars) && evaluate(node.right, vars);
    }

    @Override
    public Boolean visit(Or node, List<String> vars) {
        return evaluate(node.left, vars) || evaluate(node.right, vars);
    }

    @Override
    public Boolean visit(Not node, List<String> vars) {
        return !evaluate(node.operand, vars);
    }

    private Boolean evaluate(Node node, List<String> vars) {
        return node.accept(this, vars);
    }
}

package bool;

import java.util.Collection;

public class Evaluator implements Visitor<Boolean, Collection<String>> {
    @Override
    public Boolean visit(Var node, Collection<String> vars) {
        return vars.contains(node.token.getValue());
    }

    @Override
    public Boolean visit(And node, Collection<String> vars) {
        return evaluate(node.left, vars) && evaluate(node.right, vars);
    }

    @Override
    public Boolean visit(Or node, Collection<String> vars) {
        return evaluate(node.left, vars) || evaluate(node.right, vars);
    }

    @Override
    public Boolean visit(Not node, Collection<String> vars) {
        return !evaluate(node.operand, vars);
    }

    private Boolean evaluate(Node node, Collection<String> vars) {
        return node.accept(this, vars);
    }
}

Use collection instead of List

Use collection instead of List


package bool;

import org.junit.Test;

import java.io.IOException;

import static org.junit.Assert.assertEquals;

public class LexerTest {
    @Test
    public void test_lex() throws IOException {
        Lexer lexer = new Lexer("foo && bar");
        assertEquals(Parser.TOKEN_VAR, lexer.yylex());
        assertEquals("foo", lexer.yytext());

        assertEquals(Parser.TOKEN_AND, lexer.yylex());
        assertEquals("&&", lexer.yytext());

        assertEquals(Parser.TOKEN_VAR, lexer.yylex());
        assertEquals("bar", lexer.yytext());
    }
}

package bool;

import org.junit.Test;

import java.io.IOException;

import static org.junit.Assert.assertEquals;

public class LexerTest {
    @Test
    public void test_simple_lex() throws IOException {
        Lexer lexer = new Lexer("foo && bar");
        assertEquals(Parser.TOKEN_VAR, lexer.yylex());
        assertEquals("foo", lexer.yytext());

        assertEquals(Parser.TOKEN_AND, lexer.yylex());
        assertEquals("&&", lexer.yytext());

        assertEquals(Parser.TOKEN_VAR, lexer.yylex());
        assertEquals("bar", lexer.yytext());
    }

    @Test
    public void test_lex_or() throws IOException {
        Lexer lexer = new Lexer("foo || bar");
        assertEquals(Parser.TOKEN_VAR, lexer.yylex());
        assertEquals("foo", lexer.yytext());

        assertEquals(Parser.TOKEN_OR, lexer.yylex());
        assertEquals("||", lexer.yytext());

        assertEquals(Parser.TOKEN_VAR, lexer.yylex());
        assertEquals("bar", lexer.yytext());
    }

    @Test
    public void test_less_simple_lex() throws IOException {
    	Lexer lexer = new Lexer("a && b && (!c || !d)");
        assertEquals(Parser.TOKEN_VAR, lexer.yylex());
        assertEquals("a", lexer.yytext());

        assertEquals(Parser.TOKEN_AND, lexer.yylex());
        assertEquals("&&", lexer.yytext());

        assertEquals(Parser.TOKEN_VAR, lexer.yylex());
        assertEquals("b", lexer.yytext());

        assertEquals(Parser.TOKEN_AND, lexer.yylex());
        assertEquals("&&", lexer.yytext());

        assertEquals(Parser.TOKEN_LPAREN, lexer.yylex());
        assertEquals("(", lexer.yytext());

        assertEquals(Parser.TOKEN_NOT, lexer.yylex());
        assertEquals("!", lexer.yytext());

        assertEquals(Parser.TOKEN_VAR, lexer.yylex());
        assertEquals("c", lexer.yytext());

        assertEquals(Parser.TOKEN_OR, lexer.yylex());
        assertEquals("||", lexer.yytext());

        assertEquals(Parser.TOKEN_NOT, lexer.yylex());
        assertEquals("!", lexer.yytext());

        assertEquals(Parser.TOKEN_VAR, lexer.yylex());
        assertEquals("d", lexer.yytext());

        assertEquals(Parser.TOKEN_RPAREN, lexer.yylex());
        assertEquals(")", lexer.yytext());
    }

}

Add a lexer test for all operators

Add a lexer test for all operators


package org.cryptonit.cloud.interfaces;

import org.bouncycastle.asn1.x500.X500Name;

public interface IdentityStore {
    public String newIdentity(String domain, String keyId, X500Name subject) throws Exception;
}

package org.cryptonit.cloud.interfaces;

import javax.security.cert.X509Certificate;
import org.bouncycastle.asn1.x500.X500Name;

public interface IdentityStore {

    public String newIdentity(String domain, String keyId, X500Name subject) throws Exception;

    public boolean setCertificate(String domain, String identityId, X509Certificate certificate) throws Exception;
}

Add interface to set certificate value

Add interface to set certificate value


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

package ru.ming13.gambit;

import android.app.Application;
import com.bugsense.trace.BugSenseHandler;
import ru.ming13.gambit.local.DbProvider;

public class GambitApplication extends Application
{
	@Override
	public void onCreate() {
		super.onCreate();

		setUpDatabase();
		setUpBugsense();
	}

	private void setUpDatabase() {
		DbProvider.getInstance(this);
	}

	private void setUpBugsense() {
		if (BuildConfig.DEBUG) {
			return;
		}

		BugSenseHandler.initAndStartSession(this, getBugsenseProjectKey());
	}

	private String getBugsenseProjectKey() {
		return getString(R.string.key_bugsense_project);
	}
}

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

package ru.ming13.gambit;

import android.app.Application;
import com.bugsense.trace.BugSenseHandler;

public class GambitApplication extends Application
{
	@Override
	public void onCreate() {
		super.onCreate();

		setUpBugsense();
	}

	private void setUpBugsense() {
		if (BuildConfig.DEBUG) {
			return;
		}

		BugSenseHandler.initAndStartSession(this, getBugsenseProjectKey());
	}

	private String getBugsenseProjectKey() {
		return getString(R.string.key_bugsense_project);
	}
}

Remove database initialization via application.


package org.ingrahamrobotics.robottables.util;

public class Platform {

    private static final Object LOCK = new Object();
    private static boolean ready = false;
    private static boolean onRobot = false;

    public static boolean onRobot() {
        synchronized (LOCK) {
            if (!ready) {
                init();
            }
        }
        return onRobot;
    }

    private static void init() {
        try {
            Class.forName("java.util.ArrayList");
            onRobot = false;
        } catch (ClassNotFoundException ex) {
            onRobot = true;
        }
//        // One of these (or a combination thereof) will let me figure out if we're running on the robot
//        System.getProperty("java.version");
//        System.getProperty("java.vendor");
//        System.getProperty("java.compiler");
//        System.getProperty("os.name");
//        onRobot = false;

        ready = true;
    }
}

package org.ingrahamrobotics.robottables.util;

public class Platform {

    private static final Object LOCK = new Object();
    private static boolean ready = false;
    private static boolean onRobot = false;

    public static boolean onRobot() {
        synchronized (LOCK) {
            if (!ready) {
                init();
            }
        }
        return onRobot;
    }

    private static void init() {
        onRobot = false;
//        // One of these (or a combination thereof) will let me figure out if we're running on the robot
//        System.getProperty("java.version");
//        System.getProperty("java.vendor");
//        System.getProperty("java.compiler");
//        System.getProperty("os.name");
//        onRobot = false;
        ready = true;
    }
}

Remove temporary code to tell if networktables is running on the robot, as it no longer works with the RoboRIO.


package de.dbaelz.secludedness.level;

public class Player {
	private int mPositionX;
	private int mPositionY;

	public Player(int positionX, int positionY) {
		mPositionX = positionX;
		mPositionY = positionY;
	}

	public int getPositionX() {
		return mPositionX;
	}

	public void setPositionX(int positionX) {
		this.mPositionX = positionX;
	}

	public int getPositionY() {
		return mPositionY;
	}

	public void setPositionY(int positionY) {
		this.mPositionY = positionY;
	}

}

package de.dbaelz.secludedness.level;

public class Player {
	private final int mStartPositionX;
	private final int mStartPositionY;
	private int mPositionX;
	private int mPositionY;

	public Player(int positionX, int positionY) {
		mStartPositionX = positionX;
		mStartPositionY = positionY;

		mPositionX = positionX;
		mPositionY = positionY;
	}

	public int getPositionX() {
		return mPositionX;
	}

	public void setPositionX(int positionX) {
		this.mPositionX = positionX;
	}

	public void changeXPositionBy(int value) {
		this.mPositionX += value;
	}

	public int getPositionY() {
		return mPositionY;
	}

	public void setPositionY(int positionY) {
		this.mPositionY = positionY;
	}

	public void changeYPositionBy(int value) {
		this.mPositionY += value;
	}

	public void resetToStart() {
		mPositionX = mStartPositionX;
		mPositionY = mStartPositionY;
	}
}

Save fix start position and add method to reset player on this position


package com.royalrangers.utils;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.royalrangers.bean.ResponseResult;
import lombok.Getter;

public class ResponseBuilder {

    public static ResponseResult success() {
        return new ResponseResult(true, new EmptyJsonResponse());
    }

    public static ResponseResult success(Object data) {
        return new ResponseResult(true, data);
    }

    public static ResponseResult success(String message) {
        return new ResponseResult(true, new ResponseMessage(message));
    }

    public static ResponseResult fail() {
        return new ResponseResult(false, new EmptyJsonResponse());
    }

    public static ResponseResult fail(String message) {
        return new ResponseResult(false, new ResponseMessage(message));
    }

    @JsonSerialize
    private static class EmptyJsonResponse { }

    @Getter
    @JsonSerialize
    private static class ResponseMessage{
        private String message;

        ResponseMessage (String message) {
            this.message = message;
        }
    }
}

package com.royalrangers.utils;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.royalrangers.bean.ResponseResult;
import lombok.Getter;

import java.util.HashMap;
import java.util.Map;

public class ResponseBuilder {

    public static ResponseResult success() {
        return new ResponseResult(true, new EmptyJsonResponse());
    }

    public static ResponseResult success(Object data) {
        return new ResponseResult(true, data);
    }

    public static ResponseResult success(String message) {
        return new ResponseResult(true, new ResponseMessage(message));
    }
    public static ResponseResult success(String key, String value) {
        Map<String, String> data = new HashMap<>();
        data.put(key, value);
        return new ResponseResult(true, data);
    }

    public static ResponseResult fail() {
        return new ResponseResult(false, new EmptyJsonResponse());
    }

    public static ResponseResult fail(String message) {
        return new ResponseResult(false, new ResponseMessage(message));
    }

    @JsonSerialize
    private static class EmptyJsonResponse { }

    @Getter
    @JsonSerialize
    private static class ResponseMessage{
        private String message;

        ResponseMessage (String message) {
            this.message = message;
        }
    }
}

Add success method for custom message in data.


/*
 * VowlData.java
 *
 */

package de.uni_stuttgart.vis.vowl.owl2vowl.model;

import de.uni_stuttgart.vis.vowl.owl2vowl.model.nodes.classes.AbstractClass;

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

/**
 * Contains all data WebVOWL needs.
 */
public class VowlData {

	private Set<AbstractClass> classes = new HashSet<>();

	public void addClass(AbstractClass vowlClass) {
		classes.add(vowlClass);
	}

}

/*
 * VowlData.java
 *
 */

package de.uni_stuttgart.vis.vowl.owl2vowl.model;

import de.uni_stuttgart.vis.vowl.owl2vowl.model.nodes.AbstractNode;
import de.uni_stuttgart.vis.vowl.owl2vowl.model.nodes.classes.AbstractClass;

import org.semanticweb.owlapi.model.IRI;

import java.util.HashMap;

/**
 * Contains all data WebVOWL needs.
 */
public class VowlData {

	private HashMap<IRI, AbstractClass> classMap = new HashMap<>();

	public void addClass(AbstractClass vowlClass) {
		classMap.put(vowlClass.getIri(), vowlClass);
	}

	public AbstractNode getNodeForIri(IRI iri) {
		if (classMap.containsKey(iri)) {
			return classMap.get(iri);
		} else {
			throw new IllegalStateException("Can't find node for passed iri: " + iri);
		}
	}
}

Add method for requesting nodes by iri

Add method for requesting nodes by iri


import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;

public class TrieExample {
  public static void main(String[] args) {

    // Open the data file
    Scanner scf = null;
    try {
      scf = new Scanner(new File("./data/peter_piper.txt"));
    } catch (FileNotFoundException e) {
      e.printStackTrace();
    }

    TrieST<Integer> st = new TrieST<Integer>();

    // Read file's next line
    while (scf.hasNextLine()) {
      Scanner scl = new Scanner(scf.nextLine());

      // Read line's next word
      int i = 0;
      while (scl.hasNext()) {
        String key = scl.next();
        st.put(key, i);
        i++;
      }
    }

    // print results
    for (String key : st.keys()) {
      System.out.println(key + " " + st.get(key));
    }

    System.out.println();

    System.out.println("Keys with prefix \"pi\"");
    for (String key : st.keysWithPrefix("pi")) {
      System.out.println(key);
    }
    System.out.println();
  }
}

import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;

public class TrieExample {
  public static void main(String[] args) {

    // Open the data file
    Scanner scf = null;
    try {
      scf = new Scanner(new File("./data/peter_piper.txt"));
    } catch (FileNotFoundException e) {
      e.printStackTrace();
    }

    TrieST<Integer> st = new TrieST<Integer>();

    // Read file's next line
    while (scf.hasNextLine()) {
      Scanner scl = new Scanner(scf.nextLine());

      // Read line's next word
      int i = 0;
      while (scl.hasNext()) {
        String key = scl.next();
        st.put(key, i);
        i++;
      }
    }

    // print results
    System.out.println("Symbol table:");
    for (String key : st.keys()) {
      System.out.println("* " + key + " " + st.get(key));
    }

    System.out.println();

    System.out.println("Keys with prefix \"pi\":");
    for (String key : st.keysWithPrefix("pi")) {
      System.out.println("* " + key);
    }
    System.out.println();

    System.out.println("Longest prefix of \"peckleton\":");
    System.out.println("* " + st.longestPrefixOf("peckleton"));
    System.out.println();
  }
}

Add usage example for longestPRefixOf() method


package app;

import app.action.Action;
import app.action.ActionEvent;
import app.action.Drop;
import app.shipper.BasicShipper;

import java.util.ArrayList;
import java.util.List;
import java.util.Observable;
import java.util.Observer;

/**
 * Created by Benjamin on 03/02/2016.
 */
public class ShippingTrackerObserver implements Observer {
	List<String> achievedDeliveries = new ArrayList<>();

	@Override
	public void update(Observable o, Object arg) {
		ActionEvent actionEvent = (ActionEvent) arg;

		if(o instanceof Drop && actionEvent.equals(ActionEvent.ENDED)) {

			Drop action = (Drop) o;
			System.out.printf("\n\t[DELIVERY DONE] %s has performed package %s\n", action.getTarget().getName(), action.getTarget().getPack());

		}
	}
}

package app;

import app.action.Action;
import app.action.ActionEvent;
import app.action.Drop;
import app.shipper.BasicShipper;

import java.util.ArrayList;
import java.util.List;
import java.util.Observable;
import java.util.Observer;

/**
 * Created by Benjamin on 03/02/2016.
 */
public class ShippingTrackerObserver implements Observer {
	List<String> achievedDeliveries = new ArrayList<>();

	@Override
	public void update(Observable o, Object arg) {
		ActionEvent actionEvent = (ActionEvent) arg;

		if(o instanceof Drop && actionEvent.equals(ActionEvent.ENDED)) {

			Drop action = (Drop) o;
			System.out.printf("\n\t[DELIVERY DONE] %s has performed package %s\n", action.getTarget().getName(), action.getTarget().getPack());
			achievedDeliveries.add(action.getTarget().getPack());
		}
	}

	public void sendToServer(String packageDelivered) {
		// TODO: 03/02/2016 do http call
	}
}

Update new spy shipping tracker observer


package de.fred4jupiter.plaincamel;

import org.apache.camel.CamelContext;
import org.apache.camel.main.Main;

/**
 * Created by michael on 12.09.2017.
 */
public class Application extends org.apache.camel.main.Main {

	public Application() throws Exception {
		super();
		getOrCreateCamelContext().addRoutes(new MyRouteBuilder());
	}

	@Override
	protected CamelContext createContext() {
		CamelContext camelContext = CamelContextCreator.createCamelContext();
		return camelContext;
	}

	public static void main(String[] args) throws Exception {

		Application application = new Application();
		application.run();

	}
}

package de.fred4jupiter.plaincamel;

import org.apache.camel.CamelContext;
import org.apache.camel.main.Main;

/**
 * Created by michael on 12.09.2017.
 */
public class Application extends Main {

    public Application() throws Exception {
        super();
        getOrCreateCamelContext().addRoutes(new MyRouteBuilder());
    }

    @Override
    protected CamelContext createContext() {
        CamelContext camelContext = CamelContextCreator.createCamelContext();
        return camelContext;
    }

    public static void main(String[] args) throws Exception {
        Application application = new Application();
        application.run();
    }
}

Use org.apache.camel.main.Main for sample application


package structures.data.actions.library;

import structures.data.DataAction;
import structures.data.actions.params.CheckboxParam;
import structures.data.actions.params.DoubleParam;
import structures.data.actions.params.StringParam;

public class SetGlobalVariable extends DataAction {

	public SetGlobalVariable(){
		init(new StringParam("EditVariableKey"),
				new DoubleParam("EditVariableValue"),
				new CheckboxParam("RelativeVariable?"));
	}

	@Override
	public String getTitle() {
		return "SetGlobalVariable";
	}

	@Override
	public String getDescription() {
		if((boolean) get("RelativeVariable?").getValue()){
			return String.format("change %s by %.2f", get("EditVariableKey").getValue(), get("EditVariableValue").getValue());
		}
		else{
			return String.format("make %s equal %.2f", get("EditVariableKey").getValue(), get("EditVariableValue").getValue());
		}
	}

	@Override
	protected String getSyntax() {
		return "library.set_variable('%s', %f, %b);";
	}

}

package structures.data.actions.library;

import structures.data.DataAction;
import structures.data.actions.params.CheckboxParam;
import structures.data.actions.params.GroovyParam;
import structures.data.actions.params.StringParam;

public class SetGlobalVariable extends DataAction {

	public SetGlobalVariable(){
		init(new StringParam("Variable Name"),
				new GroovyParam("Value"),
				new CheckboxParam("Relative"));
	}

	@Override
	public String getTitle() {
		return "Set Global Var";
	}

	@Override
	public String getDescription() {
		if ((boolean) get("Relative").getValue()) {
			return String.format("Change global '%s' by %s", get("Variable Name").getValue(), get("Value").getValue());
		}
		else{
			return String.format("Set global '%s' to %s", get("Variable Name").getValue(), get("Value").getValue());
		}
	}

	@Override
	public String compileSyntax() {
		if ((boolean) get("Relative").getValue()) {
			return String.format("globals.%s = globals.%s + %s;\n", get("Variable Name").getValue(), get("Variable Name").getValue(), get("Value").getValue());
		} else {
			return String.format("globals.%s = %s;\n", get("Variable Name").getValue(), get("Value").getValue());
		}

	}

	@Override
	protected String getSyntax() {
		return null;
	}

}

Set Global Variable action created

Set Global Variable action created


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

package com.exorath.service.treasurehunt.test;

import com.exorath.service.treasurehunt.Treasure;
import org.junit.Assert;
import org.junit.Test;

public class TreasureTest {
	private static final String TREASURE_TEST_ID_1 = "598782lklsjflasf;09";

	@Test
	public void testTreasureIdEqualsConstructorId() {
		Treasure treasure = new Treasure(TREASURE_TEST_ID_1);
		Assert.assertEquals(treasure.getId(), TREASURE_TEST_ID_1);

		treasure = new Treasure("");
		Assert.assertEquals(treasure.getId(), TREASURE_TEST_ID_1);
	}
}

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

package com.exorath.service.treasurehunt.test;

import com.exorath.service.treasurehunt.Treasure;
import org.junit.Assert;
import org.junit.Test;

public class TreasureTest {
	private static final String TREASURE_TEST_ID_1 = "598782lklsjflasf;09";
	private static final String TREASURE_TEST_ID_2 = "";

	@Test
	public void testTreasureIdEqualsConstructorId() {
		Treasure treasure = new Treasure(TREASURE_TEST_ID_1);
		Assert.assertEquals(treasure.getId(), TREASURE_TEST_ID_1);

		treasure = new Treasure(TREASURE_TEST_ID_2);
		Assert.assertEquals(treasure.getId(), TREASURE_TEST_ID_2);
	}
}

Fix 2nd treasureId in test

Fix 2nd treasureId in test


package edu.kit.iks.Cryptographics;

import edu.kit.iks.CryptograhicsLib.AbstractController;

public class StartController extends AbstractController {
	private PopoverView _popoverView;

	private TimelineView _timelineView;

	private WelcomeView _welcomeView;

	public void presentPopoverAction(AbstractVisualizationInfo visualizationInfo) {

	}

	public void dismissPopoverAction() {

	}

	public void startVisualizationAction(AbstractVisualizationInfo visualizationInfo) {

	}

	private void _loadAllVisualizationInfos() {

	}
}

package edu.kit.iks.Cryptographics;

import java.util.List;
import edu.kit.iks.CryptograhicsLib.AbstractController;

public class StartController extends AbstractController {
	private PopoverView _popoverView;

	private TimelineView _timelineView;

	private WelcomeView _welcomeView;

	private List<AbstractVisualizationInfo> visualizationInfos;

	public void presentPopoverAction(AbstractVisualizationInfo visualizationInfo) {

	}

	public void dismissPopoverAction() {

	}

	public void startVisualizationAction(AbstractVisualizationInfo visualizationInfo) {

	}

	private void _loadAllVisualizationInfos() {

	}
}

Add list of visualization infos.

Add list of visualization infos.


package org.example.shelf.auth;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;

@Configuration
@EnableWebSecurity
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
    @Override
    protected void configure(HttpSecurity http) throws Exception {
        http.authorizeRequests()
            .antMatchers("/secure/**", "/users/**").hasRole("USER")
            .and()
            .httpBasic();
    }

    @Autowired
    public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
        auth.inMemoryAuthentication().withUser("testuser").password("password").roles("USER");
    }
}

package org.example.shelf.auth;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;

@Configuration
@EnableWebSecurity
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
    @Override
    protected void configure(HttpSecurity http) throws Exception {
        http.authorizeRequests()
            .antMatchers("/secure/**", "/users/**").hasRole("USER")
            .anyRequest().permitAll()
            .and()
            .httpBasic();
    }

    @Autowired
    public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
        auth.inMemoryAuthentication().withUser("testuser").password("password").roles("USER");
    }
}

Fix javascript access in spring security


package com.github.aureliano.verbum_domini.helper;

import javax.servlet.ServletRequest;
import javax.servlet.http.HttpServletRequest;

import org.apache.commons.lang.StringUtils;

public final class UrlHelper {

	private UrlHelper() {
		super();
	}

	public static String join(Object...tokens) {
		return "/" + StringUtils.join(tokens, '/');
	}

	public static String buildWebAppUrl(ServletRequest request, String path) {
		String contextPath = ((HttpServletRequest) request).getContextPath();
		return join(contextPath.substring(1), path);
	}

	public static String buildWebAppUrl(String path) {
		return buildWebAppUrl(WebHelper.getRequest(), path);
	}
}

package com.github.aureliano.verbum_domini.helper;

import javax.servlet.ServletRequest;
import javax.servlet.http.HttpServletRequest;

import org.apache.commons.lang.StringUtils;

public final class UrlHelper {

	private UrlHelper() {
		super();
	}

	public static String join(Object...tokens) {
		return "/" + StringUtils.join(tokens, '/');
	}

	public static String buildWebAppUrl(ServletRequest request, String path) {
		String contextPath = ((HttpServletRequest) request).getContextPath();
		if (contextPath.startsWith("/")) {
			contextPath = contextPath.substring(1);
		}
		return join(contextPath, path);
	}

	public static String buildWebAppUrl(String path) {
		return buildWebAppUrl(WebHelper.getRequest(), path);
	}
}

Build URL with server context path.

Build URL with server context path.


package com.bungleton.yarrgs;

import java.io.File;
import java.util.List;

public class cp
{
    public boolean recursive;

    @Positional(0) @Unmatched
    public List<File> sourceFiles;

    @Positional(-1)
    public File destination;
}

package com.bungleton.yarrgs;

import java.io.File;
import java.util.List;

public class cp
{
    @Usage("Should subdirectories of directores in sourceFiles be copied")
    public boolean recursive;

    @Usage("Files and directories to be copied") @Positional(0) @Unmatched
    public List<File> sourceFiles;

    @Usage("Directory to which sourceFiles should be copied") @Positional(-1)
    public File destination;

    public static void main (String[] args)
    {
        cp cp = Yarrgs.parseInMain(cp.class, args);
        System.out.println("Recursive: " + cp.recursive);
        System.out.println("Source files: " + cp.sourceFiles);
        System.out.println("Dest: " + cp.destination);
    }
}

Add some usage and a main to let me use this as an example


package com.galvarez.ttw.model.components;

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

import com.artemis.Component;
import com.artemis.Entity;
import com.galvarez.ttw.model.map.MapPosition;

public final class AIControlled extends Component {

  /** All neighboring empires. */
  public final Set<Entity> neighbors = new HashSet<>();

  public List<MapPosition> estimatedTiles;

  public int estimationTurn;

  public int lastMove;

  public MapPosition lastPosition;

  public AIControlled() {
  }

}

package com.galvarez.ttw.model.components;

import com.artemis.Component;
import com.galvarez.ttw.model.map.MapPosition;

public final class AIControlled extends Component {

  public int lastMove;

  public MapPosition lastPosition;

  public AIControlled() {
  }

}

Remove unused variables from AI component.


package dgcj;

public class DgcjProblem {
	private static boolean single;

	public void testLocally() {
		testLocally(1, 6, 1);
	}

	public void testLocally(int nodes) {
		LocalTesting.run(this.getClass().getSimpleName(), nodes);
	}

	public void testLocally(int nodesFrom, int nodesTo, int step) {
		for (int i = nodesFrom; i < nodesTo; i += step) {
			testLocally(i);
		}
	}

	public static boolean single() {
		return single;
	}

	@Override
	public boolean equals(Object obj) {
		if (obj instanceof String[]) {
			String[] args = (String[]) obj;
			if (args.length == 1 && args[0].equals("0")) {
				testLocally();
				System.exit(0);
			}
			if (args.length == 1 && args[0].equals("1")) {
				single = true;
			}
			return false;
		}
		LocalTesting.log(obj.toString());
		return false;
	}

	// To avoid a warning
	@Override
	public int hashCode() {
		return super.hashCode();
	}
}

package dgcj;

public class DgcjProblem {
	private static boolean single;

	public void testLocally() {
		testLocally(1, 6, 1);
		testLocally(7);
		testLocally(100);
	}

	public void testLocally(int nodes) {
		LocalTesting.run(this.getClass().getSimpleName(), nodes);
	}

	public void testLocally(int nodesFrom, int nodesTo, int step) {
		for (int i = nodesFrom; i < nodesTo; i += step) {
			testLocally(i);
		}
	}

	public static boolean single() {
		return single;
	}

	@Override
	public boolean equals(Object obj) {
		if (obj instanceof String[]) {
			String[] args = (String[]) obj;
			if (args.length == 1 && args[0].equals("0")) {
				testLocally();
				System.exit(0);
			}
			if (args.length == 1 && args[0].equals("1")) {
				single = true;
			}
			return false;
		}
		LocalTesting.log(obj.toString());
		return false;
	}

	// To avoid a warning
	@Override
	public int hashCode() {
		return super.hashCode();
	}
}

Add default testing with 7 and 100 nodes


package com.jakewharton.trakt.enumerations;

import java.util.HashMap;
import java.util.Map;
import com.jakewharton.trakt.TraktEnumeration;

public enum Rating implements TraktEnumeration {
    Love("love"),
    Hate("hate"),
    Unrate("unrate");

    private final String value;

    private Rating(String value) {
        this.value = value;
    }

    @Override
    public String toString() {
        return this.value;
    }

    private static final Map<String, Rating> STRING_MAPPING = new HashMap<String, Rating>();

    static {
        for (Rating via : Rating.values()) {
            STRING_MAPPING.put(via.toString().toUpperCase(), via);
        }
    }

    public static Rating fromValue(String value) {
        return STRING_MAPPING.get(value.toUpperCase());
    }
}

package com.jakewharton.trakt.enumerations;

import java.util.HashMap;
import java.util.Map;
import com.jakewharton.trakt.TraktEnumeration;

public enum Rating implements TraktEnumeration {
    WeakSauce("1"),
    Terrible("2"),
    Bad("3"),
    Poor("4"),
    Meh("5"),
    Fair("6"),
    Good("7"),
    Great("8"),
    Superb("9"),
    TotallyNinja("10"),
    Unrate("0");

    private final String value;

    private Rating(String value) {
        this.value = value;
    }

    @Override
    public String toString() {
        return this.value;
    }

    private static final Map<String, Rating> STRING_MAPPING = new HashMap<String, Rating>();

    static {
        for (Rating via : Rating.values()) {
            STRING_MAPPING.put(via.toString().toUpperCase(), via);
        }
    }

    public static Rating fromValue(String value) {
        return STRING_MAPPING.get(value.toUpperCase());
    }
}

Use new rating values. It is recommended to always send the new ones, so removed Love and Hate and modified Unrate to be 0 instead of 'unrate'.


package editor;

import utility.Observer;
import xml.Element;

import javax.swing.*;

/**
 * The ElementTreeView controls the section of the GUI that displays the tree
 * representation of an XML element tree.
 */
public class ElementTreeView extends JPanel implements Observer {
    private JTree tree;
    private Element root;

    /**
     * Create the tree view and associate it with a particular model (root of
     * the XML element tree)
     * @param root The root element of the XML element tree.
     */
    public ElementTreeView(Element root) {
        root.registerObserver(this);
        this.root = root;

        tree = new JTree();
        add(tree);

        setVisible(false);
    }

    /**
     * When the associated element tree root has changed, change the view
     */
    public void notifyObserver() {
        if (root != null) {
            // TODO: Change the tree
            System.out.println("[DEBUG] root has changed");
            setVisible(true);
        }
    }
}

package editor;

import utility.Observer;
import xml.Element;

import javax.swing.*;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeModel;

/**
 * The ElementTreeView controls the section of the GUI that displays the tree
 * representation of an XML element tree.
 */
public class ElementTreeView extends JPanel implements Observer {
    private JTree tree;
    private Element root;
    private DefaultMutableTreeNode treeNode;
    private DefaultTreeModel model;

    /**
     * Create the tree view and associate it with a particular model (root of
     * the XML element tree)
     * @param root The root element of the XML element tree.
     */
    public ElementTreeView(Element root) {
        root.registerObserver(this);
        this.root = root;

        treeNode = new DefaultMutableTreeNode();
        tree = new JTree(treeNode);
        model = (DefaultTreeModel) tree.getModel();
        add(tree);

        setVisible(false);
    }

    /**
     * When the associated element tree root has changed, change the view
     */
    public void notifyObserver() {
        if (root != null) {
            // TODO: Change the tree
            treeNode.setUserObject("DEBUG_ROOT");
            model.nodeChanged(treeNode);
            System.out.println("[DEBUG] root has changed");
            setVisible(true);
        }
    }
}

Add the setting of root element label

Add the setting of root element label


package org.texastorque.texastorque20145.subsystem;

import edu.wpi.first.wpilibj.Solenoid;
import edu.wpi.first.wpilibj.Victor;
import org.texastorque.texastorque20145.constants.Constants;
import org.texastorque.texastorque20145.torquelib.Motor;

public class Drivebase extends Subsystem {

    private Motor left;
    private Motor right;
    private Solenoid shifter;

    public Drivebase()
    {
        left = new Motor(new Victor(Constants.leftDrivePort.getInt()), false);
        right = new Motor(new Victor(Constants.rightDrivePort.getInt()), true);
        shifter = new Solenoid(Constants.shifterPort.getInt());
    }

    public void update() {
        if (outputEnabled)
        {
            left.set(input.getLeftSpeed());
            right.set(input.getRightSpeed());
            shifter.set(input.getGear());
        }
    }

}

Remove unneeded method that shouldnt have been committed


package com.jeffreydiaz.search;

/**
 * Implementation of the classic Linear Search algorithm.
 * @author Jeffrey Diaz
 */
public class LinearSearch {

	/**
	 * Linearly search for item elem in array items.
	 * @param items an array of Item objects who've implemented the equals method.
	 * @param elem item to search array items for.
	 * @return true if elem is found within items.
	 */
	public static <Item> boolean search(Item[] items, Item elem)
	{
		for (int i = 0; i < items.length; ++i) {
			if (items[i].equals(elem)){
				return true;
			}
		}
		return false;
	}

	/**
	 * Linearly search for elem in Iterable items.
	 * @param items Collection implementing the Iterable interface.
	 * @param elem Item to search collection for.
	 * @return true if elem is found within items.
	 */
	public static <Item> boolean search(Iterable<Item> items, Item elem)
	{
		for (Item item : items) {
			if (item.equals(elem)) {
				return true;
			}
		}
		return false;
	}
}

package com.jeffreydiaz.search;

/**
 * Implementation of the classic Linear Search algorithm.
 * Complexity: ~N
 * @author Jeffrey Diaz
 */
public class LinearSearch {

	/**
	 * Linearly search for item elem in array items.
	 * @param items an array of Item objects who've implemented the equals method.
	 * @param elem item to search array items for.
	 * @return true if elem is found within items.
	 */
	public static <Item> boolean search(Item[] items, Item elem)
	{
		for (int i = 0; i < items.length; ++i) {
			if (items[i].equals(elem)){
				return true;
			}
		}
		return false;
	}

	/**
	 * Linearly search for elem in Iterable items.
	 * @param items Collection implementing the Iterable interface.
	 * @param elem Item to search collection for.
	 * @return true if elem is found within items.
	 */
	public static <Item> boolean search(Iterable<Item> items, Item elem)
	{
		for (Item item : items) {
			if (item.equals(elem)) {
				return true;
			}
		}
		return false;
	}
}

Add complexity in tilde notation.

Add complexity in tilde notation.


package test.integration;

import static org.junit.jupiter.api.Assertions.assertEquals;

import com.github.sormuras.bach.Project;
import com.github.sormuras.bach.project.JavaStyle;
import com.github.sormuras.bach.project.Libraries;
import java.lang.module.ModuleDescriptor.Version;
import org.junit.jupiter.api.Test;

class ProjectTests {

  @Test
  void defaults() {
    var project = new Project();
    assertEquals("noname", project.name().name());
    assertEquals(Version.parse("0"), project.version().version());
    assertEquals(Libraries.of(), project.libraries());
    assertEquals(JavaStyle.FREE, project.spaces().style());
  }
}

package test.integration;

import static org.junit.jupiter.api.Assertions.assertEquals;

import com.github.sormuras.bach.Project;
import com.github.sormuras.bach.project.JavaStyle;
import com.github.sormuras.bach.project.Libraries;
import java.lang.module.ModuleDescriptor;
import org.junit.jupiter.api.Test;

class ProjectTests {

  @Test
  void defaults() {
    var project = new Project();
    assertEquals("noname", project.name().name());
    assertEquals(ModuleDescriptor.Version.parse("0"), project.version().version());
    assertEquals(Libraries.of(), project.libraries());
    assertEquals(JavaStyle.FREE, project.spaces().style());
  }
}

Optimize readability of expected value

Optimize readability of expected value

[skip ci]


package com.twu.biblioteca;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import java.io.ByteArrayOutputStream;
import java.io.PrintStream;

import static org.junit.Assert.assertEquals;

/**
 * Created by watsonarw on 16/04/15.
 */
public class MainMenuTest {

    private ByteArrayOutputStream outStream = new ByteArrayOutputStream();

    @Before
    public void setupStreams() {
        System.setOut(new PrintStream(outStream));
    }

    @After
    public void tearDown() {
        System.setOut(null);
    }

    @Test
    public void testDisplayMainMenu() {
        String expected = "------ Main Menu ------\n" +
                          "Select an option below:\n" +
                          " 1 | List Books\n";
        MainMenu menu = new MainMenu();
        menu.show();
        assertEquals(expected, outStream.toString());
    }
}

package com.twu.biblioteca;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.PrintStream;

import static org.junit.Assert.assertEquals;

/**
 * Created by watsonarw on 16/04/15.
 */
public class MainMenuTest {

    private ByteArrayOutputStream outStream = new ByteArrayOutputStream();

    @Before
    public void setupStreams() {
        System.setOut(new PrintStream(outStream));
    }

    @After
    public void tearDown() {
        System.setOut(null);
        System.setIn(System.in);
    }

    @Test
    public void testDisplayMainMenu() {
        String expected = "------ Main Menu ------\n" +
                          "Select an option below:\n" +
                          " 1 | List Books\n";
        MainMenu menu = new MainMenu();
        menu.show();
        assertEquals(expected, outStream.toString());
    }

    @Test
    public void testSelectionOneShowsListOfBooks() {
        String expected = BibliotecaApp.getLibrary().getBookList();
        MainMenu menu = new MainMenu();
        nextInputAs("1\n");
        menu.handleResponse();

        assertEquals(expected, outStream.toString());
    }

    private void nextInputAs(String s) {
        ByteArrayInputStream inStream = new ByteArrayInputStream(s.getBytes());
        System.setIn(inStream);
    }
}

Add test for handling input (not working)


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

import playn.core.Keyboard;
import playn.core.PlayN;
import playn.core.util.Callback;

class IOSKeyboard implements Keyboard
{
  @Override
  public void setListener(Listener listener) {
    PlayN.log().warn("Keyboard not (currently) supported on iOS.");
  }

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

  @Override
  public void getText(TextType textType, String label, String initVal, Callback<String> callback) {
    callback.onFailure(new UnsupportedOperationException("Not yet implemented."));
  }
}

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

import playn.core.Keyboard;
import playn.core.PlayN;
import playn.core.util.Callback;

class IOSKeyboard implements Keyboard
{
  @Override
  public void setListener(Listener listener) {
    PlayN.log().warn("iOS cannot generate keyboard events. Use Keyboard.getText() instead");
  }

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

  @Override
  public void getText(TextType textType, String label, String initVal, Callback<String> callback) {
    callback.onFailure(new UnsupportedOperationException("Not yet implemented."));
  }
}

Update setListener() warning for iOS.

Update setListener() warning for iOS.


// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package org.domokit.vsync;

import android.view.Choreographer;

import org.chromium.mojo.system.MessagePipeHandle;
import org.chromium.mojo.system.MojoException;
import org.chromium.mojom.vsync.VSyncProvider;

/**
 * Android implementation of VSyncProvider.
 */
public class VSyncProviderImpl implements VSyncProvider, Choreographer.FrameCallback {
    private Choreographer mChoreographer;
    private AwaitVSyncResponse mCallback;
    private MessagePipeHandle mPipe;

    public VSyncProviderImpl(MessagePipeHandle pipe) {
        mPipe = pipe;
        mChoreographer = Choreographer.getInstance();
    }

    @Override
    public void close() {}

    @Override
    public void onConnectionError(MojoException e) {}

    @Override
    public void awaitVSync(final AwaitVSyncResponse callback) {
        if (mCallback != null) {
            mPipe.close();
            return;
        }
        mCallback = callback;
        mChoreographer.postFrameCallback(this);
    }

    @Override
    public void doFrame(long frameTimeNanos) {
        mCallback.call(frameTimeNanos / 1000);
        mCallback = null;
    }
}

// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package org.domokit.vsync;

import android.view.Choreographer;

import org.chromium.mojo.system.MessagePipeHandle;
import org.chromium.mojo.system.MojoException;
import org.chromium.mojom.vsync.VSyncProvider;

import java.util.ArrayList;

/**
 * Android implementation of VSyncProvider.
 */
public class VSyncProviderImpl implements VSyncProvider, Choreographer.FrameCallback {
    private Choreographer mChoreographer;
    private ArrayList<AwaitVSyncResponse> mCallbacks = new ArrayList<AwaitVSyncResponse>();
    private MessagePipeHandle mPipe;

    public VSyncProviderImpl(MessagePipeHandle pipe) {
        mPipe = pipe;
        mChoreographer = Choreographer.getInstance();
    }

    @Override
    public void close() {}

    @Override
    public void onConnectionError(MojoException e) {}

    @Override
    public void awaitVSync(final AwaitVSyncResponse callback) {
        mCallbacks.add(callback);
        if (mCallbacks.size() == 1) {
            mChoreographer.postFrameCallback(this);
        }
    }

    @Override
    public void doFrame(long frameTimeNanos) {
        long frameTimeMicros = frameTimeNanos / 1000;
        for (AwaitVSyncResponse callback : mCallbacks) {
            callback.call(frameTimeMicros);
        }
        mCallbacks.clear();
    }
}

Allow multiple callbacks in the VSyncProvider

It's possible for multiple calls to AwaitVSync to be pending while reloading
an application.  The Animator may get an AwaitVSync, a Reset, and then another
AwaitVSync before the first vsync completes.

If this happens, invoke both callbacks.  If we close the pipe, then the
Animator will no longer make progress.


package org.msf.records.net.model;

/**
 * Created by Gil on 11/10/2014.
 */
public class PatientLocation {

    public String uuid;
    public String zone;
    public String tent;
    public String bed;
}

package org.msf.records.net.model;

/**
 * Created by Gil on 11/10/2014.
 */
public class PatientLocation {

    public String uuid;
    public String parent_uuid;

    public String zone;
    public String tent;
    public String bed;
}

Add parent_uuid to the representation of location for patients.


package leetcode;

/**
 * https://leetcode.com/problems/nth-digit/
 */
public class Problem400 {
    public int findNthDigit(int n) {
        // TODO
        return 0;
    }

    public static void main(String[] args) {
        Problem400 prob = new Problem400();
        System.out.println(prob.findNthDigit(3)); // 3
        System.out.println(prob.findNthDigit(11)); // 0
    }
}

package leetcode;

/**
 * https://leetcode.com/problems/nth-digit/
 */
public class Problem400 {
    public int findNthDigit(int n) {
        // TODO
        return 0;
    }

    public static void main(String[] args) {
        Problem400 prob = new Problem400();
        System.out.println(prob.findNthDigit(3)); // 3
        System.out.println(prob.findNthDigit(11)); // 0
        System.out.println(prob.findNthDigit(15)); // 2
    }
}

Add test cases for problem 400

Add test cases for problem 400


/* Copyright (C) 2005-2011 Fabio Riccardi */

package com.lightcrafts.utils.awt;

import java.awt.EventQueue;
import java.util.EmptyStackException;
import java.lang.reflect.InvocationTargetException;

/**
 * A PoppableEventQueue is-an {@link EventQueue} that merely
 * makes the ordinarily protected method pop()
 * public.
 *
 * @author Paul J. Lucas [paul@lightcrafts.com]
 */
public class PoppableEventQueue extends EventQueue {

    /**
     * {@inheritDoc}
     */
    public void pop() throws EmptyStackException {
        super.pop();
    }

    // Enqueue a placeholder task and wait until it (and all preceding tasks)
    // are dequeued.  This helps prevent tasks from running after the pop().
    public static void drain() {
        if (EventQueue.isDispatchThread()) {
            String msg = "Can't drain the event queue from the event thread.";
            // throw new IllegalThreadStateException(msg);
            System.err.println(msg);
            return;
        }
        try {
            EventQueue.invokeAndWait(
                new Runnable() {
                    public void run() {
                        // do nothing
                    }
                }
            );
        }
        catch (InterruptedException e) {
            e.printStackTrace();
        }
        catch (InvocationTargetException e) {
            e.printStackTrace();
        }
    }

}
/* vim:set et sw=4 ts=4: */

/* Copyright (C) 2005-2011 Fabio Riccardi */

package com.lightcrafts.utils.awt;

import java.awt.EventQueue;
import java.util.EmptyStackException;
import java.lang.reflect.InvocationTargetException;

/**
 * A PoppableEventQueue is-an {@link EventQueue} that merely
 * makes the ordinarily protected method pop()
 * public.
 *
 * @author Paul J. Lucas [paul@lightcrafts.com]
 */
public class PoppableEventQueue extends EventQueue {

    /**
     * {@inheritDoc}
     */
    public void pop() throws EmptyStackException {
        super.pop();
    }

    // Enqueue a placeholder task and wait until it (and all preceding tasks)
    // are dequeued.  This helps prevent tasks from running after the pop().
    public static void drain() {
        if (EventQueue.isDispatchThread()) {
            throw new IllegalThreadStateException(
                "Can't drain the event queue from the event thread."
            );
        }
        try {
            EventQueue.invokeAndWait(
                new Runnable() {
                    public void run() {
                        // do nothing
                    }
                }
            );
        }
        catch (InterruptedException e) {
            e.printStackTrace();
        }
        catch (InvocationTargetException e) {
            e.printStackTrace();
        }
    }

}
/* vim:set et sw=4 ts=4: */

Revert "MacOSX - Suppress EDT exception in NoInputEventQueue.drain()"

This reverts commit 98807717fd5f0153ad1ce918236ea7ab8ad5be40.


package som.interpreter.actors;

import som.vmobjects.SAbstractObject;
import som.vmobjects.SClass;
import som.vmobjects.SSymbol;

import com.oracle.truffle.api.CompilerDirectives.CompilationFinal;

public final class SFarReference extends SAbstractObject {
  @CompilationFinal private static SClass farReferenceClass;

  private final Actor  actor;
  private final Object value;

  public SFarReference(final Actor actor, final Object value) {
    this.actor = actor;
    this.value = value;
  }

  public Actor getActor() {
    return actor;
  }

  public Object getValue() {
    return value;
  }

  @Override
  public SClass getSOMClass() {
    return farReferenceClass;
  }

  @Override
  public String toString() {
    return "FarRef[" + value.toString() + ", " + actor.toString() + "]";
  }

  @Override
  public boolean isValue() {
    return true;
  }

  public static void setSOMClass(final SClass cls) {
    assert farReferenceClass == null || cls == null;
    farReferenceClass = cls;
  }

  public SPromise eventualSend(final Actor currentActor, final SSymbol selector,
      final Object[] args) {
    return actor.eventualSend(currentActor, selector, args);
  }
}

package som.interpreter.actors;

import som.vmobjects.SAbstractObject;
import som.vmobjects.SClass;
import som.vmobjects.SSymbol;

import com.oracle.truffle.api.CompilerDirectives.CompilationFinal;

public final class SFarReference extends SAbstractObject {
  @CompilationFinal private static SClass farReferenceClass;

  private final Actor  actor;
  private final Object value;

  public SFarReference(final Actor actor, final Object value) {
    this.actor = actor;
    this.value = value;
    assert !(value instanceof SFarReference);
  }

  public Actor getActor() {
    return actor;
  }

  public Object getValue() {
    return value;
  }

  @Override
  public SClass getSOMClass() {
    return farReferenceClass;
  }

  @Override
  public String toString() {
    return "FarRef[" + value.toString() + ", " + actor.toString() + "]";
  }

  @Override
  public boolean isValue() {
    return true;
  }

  public static void setSOMClass(final SClass cls) {
    assert farReferenceClass == null || cls == null;
    farReferenceClass = cls;
  }

  public SPromise eventualSend(final Actor currentActor, final SSymbol selector,
      final Object[] args) {
    return actor.eventualSend(currentActor, selector, args);
  }
}

Make sure we never construct a far ref for a far ref

Signed-off-by: Stefan Marr <46f1a0bd5592a2f9244ca321b129902a06b53e03@stefan-marr.de>


import com.google.sps.data.Book;
import com.google.sps.data.BookServiceClient;
import java.text.ParseException;
import java.lang.IllegalAccessException;
import java.lang.NullPointerException;
import org.json.JSONObject;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

/**
   This is a test class for BookServiceClient.java
    Tests the implementations ability to call the
    Book API, given the title, and return the book's information.
*/

@RunWith(JUnit4.class)
public final class BookServiceClientTest {

  @Test
  public void getTopResult(){
    //calls the API with the title and checks to make sure it only returns one item
    String title = "A Court of Wings and Ruin";
    String bookInfo = "";
    try{
        bookInfo = BookServiceClient.getBookInfo(title);
    }catch(Exception e){
        String failureMessage = "Was not able to query the Book API. \n"+e;
        Assert.fail(failureMessage);
    }
    JSONObject jsonObject = new JSONObject(bookInfo);
    Assert.assertEquals(true,jsonObject.has("volumeInfo"));
    Assert.assertEquals(false,jsonObject.has("items"));
  }

  @Test(expected = NullPointerException.class)
  public void queryNull() throws Exception{
      //attempts to query a null value
      BookServiceClient.getBookInfo(null);
  }

  @Test(expected = NullPointerException.class)
  public void queryEmpty() throws Exception{
      //attempts to query an empty value
      BookServiceClient.getBookInfo("");
  }
}

import com.google.sps.data.Book;
import com.google.sps.data.BookServiceClient;
import java.text.ParseException;
import java.lang.IllegalAccessException;
import java.lang.NullPointerException;
import org.json.JSONObject;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

/**
   This is a test class for BookServiceClient.java
    Tests the implementations ability to call the
    Book API, given the title, and return the book's information.
*/

@RunWith(JUnit4.class)
public final class BookServiceClientTest {

  @Test(expected = NullPointerException.class)
  public void queryNull() throws Exception{
      //attempts to query a null value
      BookServiceClient.getBookInfo(null);
  }

  @Test(expected = NullPointerException.class)
  public void queryEmpty() throws Exception{
      //attempts to query an empty value
      BookServiceClient.getBookInfo("");
  }
}

Remove test that calls api

Remove test that calls api


package com.annimon.stream.operator;

import com.annimon.stream.iterator.LsaExtIterator;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;

public class ObjDistinct<T> extends LsaExtIterator<T> {

    private final Iterator<? extends T> iterator;
    private final Set<T> set;

    public ObjDistinct(Iterator<? extends T> iterator) {
        this.iterator = iterator;
        set = new HashSet<T>();
    }

    @Override
    protected void nextIteration() {
        while (hasNext = iterator.hasNext()) {
            next = iterator.next();
            if (!set.contains(next)) {
                set.add(next);
                return;
            }
        }
    }
}

package com.annimon.stream.operator;

import com.annimon.stream.iterator.LsaExtIterator;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;

public class ObjDistinct<T> extends LsaExtIterator<T> {

    private final Iterator<? extends T> iterator;
    private final Set<T> set;

    public ObjDistinct(Iterator<? extends T> iterator) {
        this.iterator = iterator;
        set = new HashSet<T>();
    }

    @Override
    protected void nextIteration() {
        while (hasNext = iterator.hasNext()) {
            next = iterator.next();
            if (set.add(next)) {
                return;
            }
        }
    }
}

Remove unnecessary check in distinct operator


package com.ushahidi.android.data.entity;

import com.google.gson.annotations.SerializedName;

/**
 * @author Ushahidi Team <team@ushahidi.com>
 */
public class Data {

    @SerializedName("id")
    public Long _id;
}

package com.ushahidi.android.data.entity;

import com.google.gson.annotations.SerializedName;

/**
 * @author Ushahidi Team <team@ushahidi.com>
 */
public abstract class Data {

    @SerializedName("id")
    public Long _id;
}

Make data entity abstract so it should be extended and not instantiated


package Test;

/**
 * Created by Lukas on 16.10.2017.
 */

import org.junit.Test;

import static org.junit.Assert.assertEquals;

public class HelloWorldTest {
    HelloWorld greeter = new HelloWorld();

    @Test
    public void test() {
        assertEquals("Hello World! ", greeter.greetings(""));
    }
}

package Test;

/**
 * Created by Lukas on 16.10.2017.
 */

import org.junit.Test;

import static org.junit.Assert.assertEquals;

public class HelloWorldTest {
    HelloWorld greeter = new HelloWorld();

    @Test
    public void test() {
        assertEquals("Hello World! ", greeter.greetings(""));
    }
    public void test2(){}
    }
}

Revert "Revert "intellij commit 2""

Revert "Revert "intellij commit 2""

This reverts commit 16287ec36062d06641140d0dda1fa4c337ff9953.


package com.twu.biblioteca;

import com.twu.biblioteca.menu.MainMenu;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class BibliotecaApp {

    private static MainMenu menu = MainMenu.instance;

    public static boolean testing = false; //Used to prevent infinite loop during unit tests

    public static void main(String[] args) {
        displayWelcomeMessage();
        menu.loop();
    }

    public static String readLine() throws IOException {
        return new BufferedReader(new InputStreamReader(System.in)).readLine();
    }

    private static void displayWelcomeMessage() {
        print("Welcome to Biblioteca.\n");
    }

    public static void print(String str) {
        System.out.print(str);
    }

    public static void setTesting(boolean testing) {
        BibliotecaApp.testing = testing;
    }
}

package com.twu.biblioteca;

import com.twu.biblioteca.menu.MainMenu;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class BibliotecaApp {

    private MainMenu menu = MainMenu.instance;

    public static boolean testing = false; //Used to prevent infinite loop during unit tests

    public static void main(String[] args) {
        BibliotecaApp app = new BibliotecaApp();
        app.run();
    }

    private void run() {
        displayWelcomeMessage();
        menu.loop();
    }

    public static String readLine() throws IOException {
        return new BufferedReader(new InputStreamReader(System.in)).readLine();
    }

    private void displayWelcomeMessage() {
        print("Welcome to Biblioteca.\n");
    }

    public static void print(String str) {
        System.out.print(str);
    }

    public static void setTesting(boolean testing) {
        BibliotecaApp.testing = testing;
    }
}

Make Biblioteca methods non static

Make Biblioteca methods non static


package com.dev.pygmy;

import android.app.Activity;
import android.os.Bundle;

public class GameBoardInterfaceActivity extends Activity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(new GameBoardView(getApplicationContext()));;
    }
}

package com.dev.pygmy;

import android.annotation.SuppressLint;
import android.app.ActionBar.LayoutParams;
import android.app.Activity;
import android.os.Bundle;
import android.view.ViewGroup;
import android.widget.FrameLayout;

@SuppressLint("ResourceAsColor")
public class GameBoardInterfaceActivity extends Activity {

	static final String TAG = "Pygmy";

	private GameBoardView gameBoardView = null;
	private EntityView entityView = null;

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		FrameLayout mainLayout = createMainLayout();
		setContentView(mainLayout);

		gameBoardView = new GameBoardView(getApplicationContext());
		mainLayout.addView(gameBoardView);

		entityView = new EntityView(this);
		mainLayout.addView(entityView);
	}

	private FrameLayout createMainLayout() {
		FrameLayout mainLayout = new FrameLayout(this);
		LayoutParams gerenalLayoutParams = new LayoutParams(
				ViewGroup.LayoutParams.MATCH_PARENT,
				ViewGroup.LayoutParams.MATCH_PARENT);
		mainLayout.setLayoutParams(gerenalLayoutParams);
		mainLayout.setBackgroundColor(R.color.blue);

		return mainLayout;
	}
}

Put GameBoardView and EntityView in the same layout


package sagan.renderer;

import javax.validation.constraints.Pattern;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.validation.annotation.Validated;

/**
 * Configuration properties for the Sagan Renderer application
 */
@ConfigurationProperties("sagan.renderer")
@Validated
public class RendererProperties {

	private final Github github = new Github();

	private final Guides guides = new Guides();

	public Github getGithub() {
		return this.github;
	}

	public Guides getGuides() {
		return this.guides;
	}

	public static class Github {

		/**
		 * Access token to query public github endpoints.
		 * https://developer.github.com/v3/auth/#authenticating-for-saml-sso
		 */
		@Pattern(regexp = "([0-9a-z]*)?")
		private String token;

		public String getToken() {
			return this.token;
		}

		public void setToken(String token) {
			this.token = token;
		}

	}

	public static class Guides {

		/**
		 * Name of the Github organization to fetch guides from.
		 */
		private String organization = "spring-guides";

		public String getOrganization() {
			return this.organization;
		}

		public void setOrganization(String organization) {
			this.organization = organization;
		}
	}
}

package sagan.renderer;

import javax.validation.constraints.Pattern;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.validation.annotation.Validated;

/**
 * Configuration properties for the Sagan Renderer application
 */
@ConfigurationProperties("sagan.renderer")
@Validated
public class RendererProperties {

	private final Github github = new Github();

	private final Guides guides = new Guides();

	public Github getGithub() {
		return this.github;
	}

	public Guides getGuides() {
		return this.guides;
	}

	public static class Github {

		/**
		 * Access token to query public github endpoints.
		 * https://developer.github.com/v3/auth/#authenticating-for-saml-sso
		 */
		@Pattern(regexp = "([0-9a-zA-Z_]*)?")
		private String token;

		public String getToken() {
			return this.token;
		}

		public void setToken(String token) {
			this.token = token;
		}

	}

	public static class Guides {

		/**
		 * Name of the Github organization to fetch guides from.
		 */
		private String organization = "spring-guides";

		public String getOrganization() {
			return this.organization;
		}

		public void setOrganization(String organization) {
			this.organization = organization;
		}
	}
}

Allow new GitHub token format

Allow new GitHub token format

GitHub rolled out a new OAuth token format, see
https://github.blog/2021-04-05-behind-githubs-new-authentication-token-formats/

This commit updates the configuration properties validation to allow it.


package com.gentics.mesh.test;

import javax.annotation.PostConstruct;

import org.elasticsearch.node.Node;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

import com.gentics.mesh.cli.Mesh;
import com.gentics.mesh.etc.config.MeshOptions;
import com.gentics.mesh.graphdb.OrientDBDatabaseProviderImpl;

@Configuration
@ComponentScan(basePackages = { "com.gentics.mesh" })
public class SpringTestConfiguration {

	@Bean
	public String graphProviderClassname() {
		// return TinkerGraphDatabaseProviderImpl.class.getName();
		return OrientDBDatabaseProviderImpl.class.getName();
		// return TitanDBDatabaseProviderImpl.class.getName();
	}

	@Bean
	public Node elasticSearchNode() {
		// For testing it is not needed to start ES in most cases. This will speedup test execution since ES does not need to initialize.
		return null;
	}

	@PostConstruct
	public void setup() {
		MeshOptions options = new MeshOptions();
		options.setDatabaseProviderClass(graphProviderClassname());
		options.setHttpPort(TestUtil.getRandomPort());
		Mesh.initalize(options);
	}

}

package com.gentics.mesh.test;

import javax.annotation.PostConstruct;

import org.elasticsearch.node.Node;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

import com.gentics.mesh.cli.Mesh;
import com.gentics.mesh.etc.config.MeshOptions;
import com.gentics.mesh.graphdb.TinkerGraphDatabaseProviderImpl;

@Configuration
@ComponentScan(basePackages = { "com.gentics.mesh" })
public class SpringTestConfiguration {

	@Bean
	public String graphProviderClassname() {
		return TinkerGraphDatabaseProviderImpl.class.getName();
		//return OrientDBDatabaseProviderImpl.class.getName();
		// return TitanDBDatabaseProviderImpl.class.getName();
	}

	@Bean
	public Node elasticSearchNode() {
		// For testing it is not needed to start ES in most cases. This will speedup test execution since ES does not need to initialize.
		return null;
	}

	@PostConstruct
	public void setup() {
		MeshOptions options = new MeshOptions();
		options.setDatabaseProviderClass(graphProviderClassname());
		options.setHttpPort(TestUtil.getRandomPort());
		Mesh.initalize(options);
	}

}

Switch tests back to tinkerpop graph api


package no.stelar7.api.l4j8.basic.constants.types;

import java.util.*;
import java.util.stream.*;

public enum TeamType implements CodedEnum
{

    BLUE(100),
    RED(200);

    private final Integer code;

    TeamType(final int code)
    {
        this.code = code;
    }

    public Optional<TeamType> getFromCode(final String teamId)
    {
        return Stream.of(TeamType.values()).filter(t -> t.code.equals(Integer.valueOf(teamId))).findFirst();
    }

    public Integer getValue()
    {
        return this.code;
    }
}

package no.stelar7.api.l4j8.basic.constants.types;

import java.util.*;
import java.util.stream.*;

public enum TeamType implements CodedEnum
{

    BLUE(100),
    RED(200),
    AI(300);

    private final Integer code;

    TeamType(final int code)
    {
        this.code = code;
    }

    public Optional<TeamType> getFromCode(final String teamId)
    {
        return Stream.of(TeamType.values()).filter(t -> t.code.equals(Integer.valueOf(teamId))).findFirst();
    }

    public Integer getValue()
    {
        return this.code;
    }
}

Add AI team (only found in cdragon atm)

Add AI team (only found in cdragon atm)


package monoxide.forgebackup.coremod.asm;

import java.util.Map;

import monoxide.forgebackup.BackupLog;

import org.objectweb.asm.Opcodes;
import org.objectweb.asm.tree.ClassNode;
import org.objectweb.asm.tree.InsnNode;
import org.objectweb.asm.tree.MethodNode;

import com.google.common.collect.Maps;

public class EssentialsBackupTransformer extends AsmTransformer {
	public EssentialsBackupTransformer() {
		Map<String, String> tmp;
		// MCP/obfuscated version. Nothing needs to change in a live MC instance.
		tmp = Maps.newHashMap();
		mappings.put("com.ForgeEssentials.backup.ModuleBackup", tmp);
	}

	@Override
	protected void doTransform(ClassNode classNode, Map<String, String> mapping) {
		BackupLog.info("Mangling ForgeEssentials for its own good. Their Backups module was not actually loaded.");

		classNode.fields.clear();
		for (int i = 0; i < classNode.methods.size();) {
			MethodNode node = (MethodNode)classNode.methods.get(i);

			BackupLog.info("Inspecting method: %s", node.name);
			if (!node.name.equals("<init>")) {
				classNode.methods.remove(i);
			} else {
				i++;
			}
		}
	}
}

package monoxide.forgebackup.coremod.asm;

import java.util.Map;

import monoxide.forgebackup.BackupLog;

import org.objectweb.asm.Opcodes;
import org.objectweb.asm.tree.ClassNode;
import org.objectweb.asm.tree.InsnNode;
import org.objectweb.asm.tree.MethodNode;

import com.google.common.collect.Maps;

public class EssentialsBackupTransformer extends AsmTransformer {
	public EssentialsBackupTransformer() {
		Map<String, String> tmp;
		// MCP/obfuscated version. Nothing needs to change in a live MC instance.
		tmp = Maps.newHashMap();
		mappings.put("com.ForgeEssentials.backup.ModuleBackup", tmp);
	}

	@Override
	protected void doTransform(ClassNode classNode, Map<String, String> mapping) {
		BackupLog.info("Mangling ForgeEssentials for its own good. Their Backups module was not actually loaded.");

		classNode.fields.clear();
		for (int i = 0; i < classNode.methods.size();) {
			MethodNode node = (MethodNode)classNode.methods.get(i);

			BackupLog.fine("Inspecting method: %s", node.name);
			if (!node.name.equals("<init>")) {
				classNode.methods.remove(i);
			} else {
				i++;
			}
		}
	}
}

Adjust logging level while removing Backups module


package tk.martijn_heil.kingdomessentials.signs;

import com.google.common.base.Preconditions;
import org.bukkit.ChatColor;
import org.bukkit.block.Sign;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;

public class Signs
{
    public static boolean isKingdomEssSign(@NotNull Sign s)
    {
        Preconditions.checkNotNull(s, "s can not be null.");
        return s.getLine(0).equals(ChatColor.YELLOW + "[KingdomKits]");
    }

    @Contract(pure = true)
    public static boolean isKingdomEssSign(@NotNull String firstLine)
    {
        Preconditions.checkNotNull(firstLine, "firstLine can not be null.");

        return firstLine.equals(ChatColor.YELLOW + "[KingdomEss]");
    }

    @Contract(pure = true)
    public static String getKingdomEssPrefix()
    {
        return ChatColor.YELLOW + "[KingdomEss]";
    }
}

package tk.martijn_heil.kingdomessentials.signs;

import com.google.common.base.Preconditions;
import org.bukkit.ChatColor;
import org.bukkit.block.Sign;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;

public class Signs
{
    public static boolean isKingdomEssSign(@NotNull Sign s)
    {
        Preconditions.checkNotNull(s, "s can not be null.");
        return s.getLine(0).equals(ChatColor.YELLOW + "[KingdomEss]");
    }

    @Contract(pure = true)
    public static boolean isKingdomEssSign(@NotNull String firstLine)
    {
        Preconditions.checkNotNull(firstLine, "firstLine can not be null.");

        return firstLine.equals(ChatColor.YELLOW + "[KingdomEss]");
    }

    @Contract(pure = true)
    public static String getKingdomEssPrefix()
    {
        return ChatColor.YELLOW + "[KingdomEss]";
    }
}

Fix another issue with signs

Fix another issue with signs


package jfdi.logic;

import jfdi.logic.commands.InvalidCommand;
import jfdi.logic.interfaces.Command;
import jfdi.logic.interfaces.ILogic;
import jfdi.parser.InputParser;
import jfdi.parser.exceptions.InvalidInputException;
import jfdi.storage.apis.MainStorage;
import jfdi.storage.exceptions.FilesReplacedException;

/**
 * @author Liu Xinan
 */
public class ControlCenter implements ILogic {

    private static ControlCenter ourInstance = new ControlCenter();

    private ControlCenter() {
        try {
            MainStorage.getInstance().initialize();
        } catch (FilesReplacedException e) {
            e.printStackTrace();
        }
    }

    public static ControlCenter getInstance() {
        return ourInstance;
    }

    @Override
    public void handleInput(String input) {
        InputParser parser = InputParser.getInstance();
        Command command;
        try {
            command = parser.parse(input);
        } catch (InvalidInputException e) {
            command = new InvalidCommand.Builder().build();
        }
        command.execute();
    }
}

package jfdi.logic;

import jfdi.logic.commands.InvalidCommand;
import jfdi.logic.interfaces.Command;
import jfdi.logic.interfaces.ILogic;
import jfdi.parser.InputParser;
import jfdi.parser.exceptions.InvalidInputException;
import jfdi.storage.apis.AliasDb;
import jfdi.storage.apis.MainStorage;
import jfdi.storage.exceptions.FilesReplacedException;

/**
 * @author Liu Xinan
 */
public class ControlCenter implements ILogic {

    private static ControlCenter ourInstance = new ControlCenter();

    private ControlCenter() {
        initStorage();
        initParser();
    }

    public static ControlCenter getInstance() {
        return ourInstance;
    }

    @Override
    public void handleInput(String input) {
        InputParser parser = InputParser.getInstance();
        Command command;
        try {
            command = parser.parse(input);
        } catch (InvalidInputException e) {
            command = new InvalidCommand.Builder().build();
        }
        command.execute();
    }

    private void initStorage() {
        try {
            MainStorage.getInstance().initialize();
        } catch (FilesReplacedException e) {
            e.printStackTrace();
        }
    }

    private void initParser() {
        InputParser.getInstance().setAliases(AliasDb.getInstance().getAll());
    }
}

Initialize Parser with aliases at startup


package net.elprespufferfish.rssreader;

import android.app.Application;
import android.os.StrictMode;

public class RssReaderApplication extends Application {

    @Override
    public void onCreate() {
        super.onCreate();

        Feeds.initialize();

        if (BuildConfig.DEBUG) {
            StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
                    .detectAll()
                    .penaltyLog()
                    .penaltyDeath()
                    .build());
            StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder()
                    .detectAll()
                    .penaltyLog()
                    .penaltyDeath()
                    .build());

        }
    }
}

package net.elprespufferfish.rssreader;

import android.app.Application;
import android.os.Build;
import android.os.StrictMode;
import android.webkit.WebView;

public class RssReaderApplication extends Application {

    @Override
    public void onCreate() {
        super.onCreate();

        Feeds.initialize();

        if (BuildConfig.DEBUG) {
            StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
                    .detectAll()
                    .penaltyLog()
                    .penaltyDeath()
                    .build());
            StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder()
                    .detectAll()
                    .penaltyLog()
                    .penaltyDeath()
                    .build());

            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
                WebView.setWebContentsDebuggingEnabled(true);
            }
        }
    }
}

Enable chrome://inspect on debug builds

Enable chrome://inspect on debug builds