package com.neoranga55.androidconfchangeloaders.presenters;

import android.os.AsyncTask;

/**
 * Created by neoranga on 28/03/2016.
 */
public class DemoPresenter implements DemoContract.UserActions<DemoContract.ViewActions> {

    private DemoContract.ViewActions mViewActions;
    private Thread mSlowTask;

    @Override
    public void onViewAttached(DemoContract.ViewActions viewActions) {
        mViewActions = viewActions;
    }

    @Override
    public void onViewDetached() {
        mViewActions = null;
    }

    @Override
    public void onDestroyed() {
        // Nothing to clean up
    }

    @Override
    public void loadButtonPressed() {
        mViewActions.showLoading();
        mSlowTask = new Thread(new Runnable() {
            @Override
            public void run() {
                try {
                    Thread.sleep(30000);
                    mViewActions.showContentLoaded();
                } catch (InterruptedException ignored) {
                }
            }
        });
        mSlowTask.start();
    }

    @Override
    public void cancelButtonPressed() {
        if (mSlowTask != null) {
            mSlowTask.interrupt();
        }
        mViewActions.showCancelledRequest();
    }
}

package com.neoranga55.androidconfchangeloaders.presenters;

/**
 * Created by neoranga on 28/03/2016.
 */
public class DemoPresenter implements DemoContract.UserActions<DemoContract.ViewActions> {

    private DemoContract.ViewActions mViewActions;
    private Thread mSlowTask;
    private boolean isLoading;
    private boolean isContentLoaded;
    private boolean isLoadCancelled;

    @Override
    public void onViewAttached(DemoContract.ViewActions viewActions) {
        mViewActions = viewActions;
        if (isLoading) {
            mViewActions.showLoading();
        }
        if (isContentLoaded) {
            mViewActions.showContentLoaded();
        }
        if (isLoadCancelled) {
            mViewActions.showCancelledRequest();
        }
    }

    @Override
    public void onViewDetached() {
        mViewActions = null;
    }

    @Override
    public void onDestroyed() {
        // Nothing to clean up
    }

    @Override
    public void loadButtonPressed() {
        isLoading = true;
        isContentLoaded = false;
        isLoadCancelled = false;
        mViewActions.showLoading();
        mSlowTask = new Thread(new Runnable() {
            @Override
            public void run() {
                try {
                    Thread.sleep(30000);
                    isLoading = false;
                    isContentLoaded = true;
                    mViewActions.showContentLoaded();
                    mSlowTask = null;
                } catch (InterruptedException ignored) {
                }
            }
        });
        mSlowTask.start();
    }

    @Override
    public void cancelButtonPressed() {
        isLoading = false;
        if (mSlowTask != null) {
            isLoadCancelled = true;
            isContentLoaded = false;
            mSlowTask.interrupt();
            mSlowTask = null;
            mViewActions.showCancelledRequest();
        }
    }
}

Save and restore state of view on attach to presenter


package com.ferreusveritas.dynamictrees.compat;

import java.util.List;

import com.ferreusveritas.dynamictrees.blocks.BlockRooty;

import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
import net.minecraft.block.state.IBlockState;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.MathHelper;

public class WailaRootyHandler implements IWailaDataProvider {

	@Override
	public List<String> getWailaBody(ItemStack itemStack, List<String> tooltip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
		IBlockState state = accessor.getWorld().getBlockState(accessor.getPosition());
		if(state.getBlock() instanceof BlockRooty) {
			BlockRooty rooty = (BlockRooty) state.getBlock();
			int life = rooty.getSoilLife(state, accessor.getWorld(), accessor.getPosition());
			tooltip.add("Soil Life: " + MathHelper.floor(life * 6.25f) + "%");
		}

		return tooltip;
	}
}

package com.ferreusveritas.dynamictrees.compat;

import java.util.List;

import com.ferreusveritas.dynamictrees.blocks.BlockRooty;

import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
import net.minecraft.block.state.IBlockState;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.MathHelper;

public class WailaRootyHandler implements IWailaDataProvider {

	@Override
	public List<String> getWailaBody(ItemStack itemStack, List<String> tooltip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
		IBlockState state = accessor.getWorld().getBlockState(accessor.getPosition());
		if(state.getBlock() instanceof BlockRooty) {
			BlockRooty rooty = (BlockRooty) state.getBlock();
			int life = rooty.getSoilLife(state, accessor.getWorld(), accessor.getPosition());
			tooltip.add("Soil Life: " + MathHelper.floor(life * 100 / 15) + "%");
		}

		return tooltip;
	}
}

Correct soil life calculation for waila(now says 100% when full)


package xyz.brassgoggledcoders.steamagerevolution.network;

import net.minecraft.client.Minecraft;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler;
import net.minecraftforge.fml.common.network.simpleimpl.MessageContext;
import xyz.brassgoggledcoders.steamagerevolution.modules.steam.tileentities.TileEntityCastingBench;
import xyz.brassgoggledcoders.steamagerevolution.modules.storage.tileentities.TileEntityBasicFluidTank;

public class FluidUpdateHandler implements IMessageHandler<PacketFluidUpdate, IMessage> {
	public FluidUpdateHandler() {

	}

	@Override
	public IMessage onMessage(PacketFluidUpdate message, MessageContext ctx) {
		TileEntity te = Minecraft.getMinecraft().world.getTileEntity(message.pos);
		if(te instanceof TileEntityBasicFluidTank) {
			TileEntityBasicFluidTank tile = (TileEntityBasicFluidTank) te;
			tile.updateFluid(message.fluid);
		}
		else if(te instanceof TileEntityCastingBench) {
			TileEntityCastingBench tile = (TileEntityCastingBench) te;
			tile.updateFluid(message.fluid);
		}
		return null;
	}
}

package xyz.brassgoggledcoders.steamagerevolution.network;

import net.minecraft.client.Minecraft;
import net.minecraft.client.multiplayer.WorldClient;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler;
import net.minecraftforge.fml.common.network.simpleimpl.MessageContext;
import xyz.brassgoggledcoders.steamagerevolution.modules.steam.tileentities.TileEntityCastingBench;
import xyz.brassgoggledcoders.steamagerevolution.modules.storage.tileentities.TileEntityBasicFluidTank;

public class FluidUpdateHandler implements IMessageHandler<PacketFluidUpdate, IMessage> {
	public FluidUpdateHandler() {

	}

	@Override
	public IMessage onMessage(PacketFluidUpdate message, MessageContext ctx) {
		Minecraft minecraft = Minecraft.getMinecraft();
		final WorldClient worldClient = minecraft.world;
		minecraft.addScheduledTask(new Runnable() {
			public void run() {
				processMessage(worldClient, message);
			}
		});
		return null;
	}

	private void processMessage(WorldClient worldClient, PacketFluidUpdate message) {
		TileEntity te = worldClient.getTileEntity(message.pos);
		if(te instanceof TileEntityBasicFluidTank) {
			TileEntityBasicFluidTank tile = (TileEntityBasicFluidTank) te;
			tile.updateFluid(message.fluid);
		}
		else if(te instanceof TileEntityCastingBench) {
			TileEntityCastingBench tile = (TileEntityCastingBench) te;
			tile.updateFluid(message.fluid);
		}
	}
}

Handle network vs client thread correctly


// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.config.model.api;

import java.util.Optional;

/**
 * Represents an action to re-index a document type in order to handle a config change.
 *
 * @author bjorncs
 */
public interface ConfigChangeReindexAction extends ConfigChangeAction {

    @Override default Type getType() { return Type.REINDEX; }

    /** @return name identifying this kind of change, used to identify names which should be allowed */
    String name();

    /** @return name of the document type that must bed re-indexed, or empty if all document types */
    Optional<String> getDocumentType();
}

// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.config.model.api;

import java.util.Optional;

/**
 * Represents an action to re-index a document type in order to handle a config change.
 *
 * @author bjorncs
 */
public interface ConfigChangeReindexAction extends ConfigChangeAction {

    @Override default Type getType() { return Type.REINDEX; }

    /** @return name identifying this kind of change, used to identify names which should be allowed */
    String name();

    /** @return name of the document type that must be re-indexed, or empty if all document types */
    Optional<String> getDocumentType();
}

Fix typo in Javadoc comment


/**
    ______    _           _
    |  ___|  | |         | |   1.0
    | |_ __ _| |__  _   _| | __ _
    |  _/ _` | '_ \| | | | |/ _` |
    | || (_| | |_) | |_| | | (_| |
    \_| \__,_|_.__/ \__,_|_|\__,_|

    © The Unitry, 2015

**/

package eu.theunitry.fabula;

import eu.theunitry.fabula.UNGameEngine.graphics.UNGameScreen;

public class UNFabula
{
    public static void main(String[] args)
    {
        new UNGameScreen();
    }
}

/**
    ______    _           _
    |  ___|  | |         | |   0.2
    | |_ __ _| |__  _   _| | __ _
    |  _/ _` | '_ \| | | | |/ _` |
    | || (_| | |_) | |_| | | (_| |
    \_| \__,_|_.__/ \__,_|_|\__,_|

    © The Unitry, 2015

**/

package eu.theunitry.fabula;

import eu.theunitry.fabula.UNGameEngine.graphics.UNGameScreen;

public class UNFabula
{
    public static void main(String[] args)
    {
        new UNGameScreen();
    }
}

Change version number in main class


/*
 * Copyright 2006-2022 the original author or 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 org.objenesis.instantiator.exotic.util;

import org.junit.jupiter.api.Test;
import org.objenesis.Objenesis;

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

/**
 * @author Henri Tremblay
 */
public class ClassDefinitionUtilsTest {

   @Test
   public void testDefineClass() throws Exception {
      String className = "org.objenesis.test.EmptyClassBis";
      byte[] b = ClassDefinitionUtils.readClass(className);
      Class<?> c = ClassDefinitionUtils.defineClass(className, b, Objenesis.class, getClass().getClassLoader());
      assertEquals(c.getName(), className);
   }

}

/*
 * Copyright 2006-2022 the original author or 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 org.objenesis.instantiator.exotic.util;

import org.junit.jupiter.api.Test;
import org.objenesis.test.EmptyClass;

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

/**
 * @author Henri Tremblay
 */
public class ClassDefinitionUtilsTest {

   @Test
   public void testDefineClass() throws Exception {
      String className = "org.objenesis.test.EmptyClassBis";
      byte[] b = ClassDefinitionUtils.readClass(className);
      Class<?> c = ClassDefinitionUtils.defineClass(className, b, EmptyClass.class, getClass().getClassLoader());
      assertEquals(c.getName(), className);
   }

}

Use a neighbour for the lookup


package com.haxademic.core.system;

import processing.core.PApplet;
import processing.opengl.PGL;

import com.haxademic.core.app.P;

public class SystemUtil {

	public static String getJavaVersion() {
		return System.getProperty("java.version");
	}

	public static String getTimestamp( PApplet p ) {
		// use P.nf to pad date components to 2 digits for more consistent ordering across systems
		return  String.valueOf( P.year() ) + "-" +
				P.nf( P.month(), 2 ) + "-" +
				P.nf( P.day(), 2 ) + "-" +
				P.nf( P.hour(), 2 ) + "-" +
				P.nf( P.minute(), 2 ) + "-" +
				P.nf( P.second(), 2 );
	}

	public static String getTimestampFine( PApplet p ) {
		return SystemUtil.getTimestamp(p) + "-" + P.nf( p.frameCount, 8 );
	}

	// monkey-patch TAB capture ability - Processing 2.0 broke this in 3D rendering contexts
	public static void p2TabKeyInputPatch() {
		if(PGL.canvas != null) { PGL.canvas.setFocusTraversalKeysEnabled(false); }
	}
}

package com.haxademic.core.system;

import processing.core.PApplet;
import processing.opengl.PGL;

import com.haxademic.core.app.P;

public class SystemUtil {

	public static String getJavaVersion() {
		return System.getProperty("java.version");
	}

	public static String getTimestamp( PApplet p ) {
		// use P.nf to pad date components to 2 digits for more consistent ordering across systems
		return  String.valueOf( P.year() ) + "-" +
				P.nf( P.month(), 2 ) + "-" +
				P.nf( P.day(), 2 ) + "-" +
				P.nf( P.hour(), 2 ) + "-" +
				P.nf( P.minute(), 2 ) + "-" +
				P.nf( P.second(), 2 );
	}

	public static String getTimestampFine( PApplet p ) {
		return SystemUtil.getTimestamp(p) + "-" + P.nf( p.frameCount, 8 );
	}

	// Patch TAB capture ability - Processing 2.0 broke this in 3D rendering contexts
	public static void p2TabKeyInputPatch() {
		if(PGL.canvas != null) { PGL.canvas.setFocusTraversalKeysEnabled(false); }
	}
}

Fix comment to make more sense


package com.iskrembilen.quasseldroid;

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

/**
 * User: Stian
 * Date: 05.07.12
 * Time: 20:14
 */
public enum IrcMode {
    /*
     * Declare in order of rank, this way values() will naturally
     * return the different modes based on rank
     */
    OWNER ("Owner","q", "(s)", R.drawable.irc_operator),
    ADMIN ("Admin","a", "(s)", R.drawable.irc_operator),
    OPERATOR ("Operator","o", "(s)", R.drawable.irc_operator),
    HALF_OPERATOR ("Half Operator","h", "(s)", R.drawable.irc_voice),
    VOICE ("Voiced","v", "", R.drawable.irc_voice),
    USER ("User","", "(s)", R.drawable.im_user); //This will work as a catch-all for unknown modes

    public final String modeName;
    public final String shortModeName;
    public final String pluralization;
    public final int iconResource;

    IrcMode(String modeName, String shortModeName, String pluralization, int iconResource) {
        this.modeName = modeName;
        this.shortModeName = shortModeName;
        this.pluralization = pluralization;
        this.iconResource = iconResource;
    }

}

package com.iskrembilen.quasseldroid;

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

/**
 * User: Stian
 * Date: 05.07.12
 * Time: 20:14
 */
public enum IrcMode {
    /*
     * Declare in order of rank, this way values() will naturally
     * return the different modes based on rank
     */
    OWNER ("Owner","q", "(s)", R.drawable.irc_operator),
    ADMIN ("Admin","a", "(s)", R.drawable.irc_operator),
    OPERATOR ("Operator","o", "(s)", R.drawable.irc_operator),
    HALF_OPERATOR ("Half-Op","h", "(s)", R.drawable.irc_voice),
    VOICE ("Voiced","v", "", R.drawable.irc_voice),
    USER ("User","", "(s)", R.drawable.im_user); //This will work as a catch-all for unknown modes

    public final String modeName;
    public final String shortModeName;
    public final String pluralization;
    public final int iconResource;

    IrcMode(String modeName, String shortModeName, String pluralization, int iconResource) {
        this.modeName = modeName;
        this.shortModeName = shortModeName;
        this.pluralization = pluralization;
        this.iconResource = iconResource;
    }

}

Change name for Half Operator to Half-Op


package net.nanopool;

import java.sql.Connection;
import java.sql.SQLException;

import javax.sql.ConnectionPoolDataSource;
import javax.sql.PooledConnection;

import net.nanopool.cas.CasArray;

public class Connector {
    private final ConnectionPoolDataSource source;
    private final CasArray<Connector> connectors;
    private final int idx;
    private final long timeToLive;
    private PooledConnection connection;
    private long deadTime;

    public Connector(ConnectionPoolDataSource source,
            CasArray<Connector> connectors, int idx, long timeToLive) {
        this.source = source;
        this.connectors = connectors;
        this.idx = idx;
        this.timeToLive = timeToLive;
    }

    Connector() {
        this(null, null, 0, 0);
    }

    public Connection getConnection() throws SQLException {
        long now = System.currentTimeMillis();
        if (deadTime < now)
            connection = null;
        if (connection == null) {
            connection = source.getPooledConnection();
            connection.addConnectionEventListener(new ConnectionListener(this));
            deadTime = now + timeToLive;
        }
        return connection.getConnection();
    }

    public void returnToPool() {
        Connector ticket = connectors.get(idx);
        connectors.cas(idx, this, ticket);
    }

    public void invalidate() {
        connection = null;
    }
}

package net.nanopool;

import java.sql.Connection;
import java.sql.SQLException;

import javax.sql.ConnectionPoolDataSource;
import javax.sql.PooledConnection;

import net.nanopool.cas.CasArray;

public class Connector {
    private final ConnectionPoolDataSource source;
    private final CasArray<Connector> connectors;
    private final int idx;
    private final long timeToLive;
    private PooledConnection connection;
    private long deadTime;

    public Connector(ConnectionPoolDataSource source,
            CasArray<Connector> connectors, int idx, long timeToLive) {
        this.source = source;
        this.connectors = connectors;
        this.idx = idx;
        this.timeToLive = timeToLive;
    }

    Connector() {
        this(null, null, 0, 0);
    }

    public Connection getConnection() throws SQLException {
        long now = System.currentTimeMillis();
        if (deadTime < now) {
            PooledConnection con = connection;
            connection = null;
            con.close();
        }
        if (connection == null) {
            connection = source.getPooledConnection();
            connection.addConnectionEventListener(new ConnectionListener(this));
            deadTime = now + timeToLive;
        }
        return connection.getConnection();
    }

    public void returnToPool() {
        Connector ticket = connectors.get(idx);
        connectors.cas(idx, this, ticket);
    }

    public void invalidate() {
        connection = null;
    }
}

Fix a bug that we didn't properly close our physical connections.


package ee.shy.core;

import org.apache.commons.io.IOUtils;

import java.io.IOException;
import java.nio.file.*;
import java.util.ArrayList;
import java.util.List;

public final class ShyIgnore {

    private static final List<String> globs = new ArrayList<>();

    static {
        Path path = Paths.get(".shyignore");
        if (Files.exists(path)) {
            try {
                globs.addAll(IOUtils.readLines(Files.newInputStream(path)));
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
    }

    public static boolean isIgnored(Path path) {
        for (String glob : globs) {
            PathMatcher pathMatcher = FileSystems.getDefault().getPathMatcher("glob:*" + glob);
            if (pathMatcher.matches(path)) return true;
        }
        return false;
    }
}

package ee.shy.core;

import org.apache.commons.io.IOUtils;

import java.io.IOException;
import java.nio.file.*;
import java.util.ArrayList;
import java.util.List;

public final class ShyIgnore {

    private static final List<String> globs = new ArrayList<>();

    static {
        Path path = Paths.get(".shyignore");
        if (Files.exists(path)) {
            try {
                globs.addAll(IOUtils.readLines(Files.newInputStream(path)));
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
    }

    public static boolean isIgnored(Path path) {
        for (String glob : globs) {
            PathMatcher pathMatcher = FileSystems.getDefault().getPathMatcher("glob:**" + glob);
            if (pathMatcher.matches(path)) return true;
        }
        return false;
    }
}

Fix minor bug with directory ignoring


/**
 * Copyright 2012 Ronen Hamias, Anton Kharenko
 *
 * 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 org.socketio.netty.serialization;

import org.codehaus.jackson.map.ObjectMapper;
import org.codehaus.jackson.map.annotate.JsonSerialize;

// TODO: check support with Gson
public final class JsonObjectMapperProvider {

	private static final ObjectMapper objectMapper = new ObjectMapper();

	static {
		objectMapper.setSerializationInclusion(JsonSerialize.Inclusion.NON_NULL);
	}

	public static ObjectMapper getObjectMapper(){
		return objectMapper;
	}

	/**
     * Don't let anyone instantiate this class.
     */
	private JsonObjectMapperProvider() {}

}

/**
 * Copyright 2012 Ronen Hamias, Anton Kharenko
 *
 * 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 org.socketio.netty.serialization;

import org.codehaus.jackson.map.ObjectMapper;
import org.codehaus.jackson.map.annotate.JsonSerialize;

public final class JsonObjectMapperProvider {

	private static final ObjectMapper objectMapper = new ObjectMapper();

	static {
		objectMapper.setSerializationInclusion(JsonSerialize.Inclusion.NON_NULL);
	}

	public static ObjectMapper getObjectMapper(){
		return objectMapper;
	}

	/**
     * Don't let anyone instantiate this class.
     */
	private JsonObjectMapperProvider() {}

}

Remove not relevant TODO comment


/*
 * Copyright 2015 the original author or 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 org.gradle.tooling;

import org.gradle.api.Incubating;

/**
 * Describes a test.
 *
 * @since 2.4
 */
@Incubating
public interface TestDescriptor {

    /**
     * Returns the name of the test.
     *
     * @return the name of the test, never null
     */
    String getName();

    /**
     * Returns the name of the test class, if any.
     *
     * @return the name of the test class, can be null
     */
    String getClassName();

    /**
     * Returns the parent of this test, if any.
     *
     * @return the parent of this test, can be null
     */
    TestDescriptor getParent();

    /**
     * Returns whether this test is a composite.
     *
     * @return {@code true} if this test is a composite
     */
    boolean isComposite();

}

/*
 * Copyright 2015 the original author or 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 org.gradle.tooling;

import org.gradle.api.Incubating;

/**
 * Describes a test.
 *
 * @since 2.4
 */
@Incubating
public interface TestDescriptor {

    /**
     * Returns the name of the test.
     *
     * @return the name of the test, never null
     */
    String getName();

    /**
     * Returns the name of the test class, if any.
     *
     * @return the name of the test class, can be null
     */
    String getClassName();

    /**
     * Returns the parent of this test, if any.
     *
     * @return the parent of this test, can be null
     */
    TestDescriptor getParent();

}

Remove API 'isComposite' since it will not be needed once we have a class hierarchy of TestProgressEvent


package com.sam_chordas.android.stockhawk.ui;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;

import com.sam_chordas.android.stockhawk.R;

/**
 * Created by frano on 21/03/2016.
 */
public class LineGraphActivity extends AppCompatActivity {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_line_graph);

        if (savedInstanceState == null) {
            LineGraphFragment fragment = new LineGraphFragment();

            getSupportFragmentManager().beginTransaction()
                    .add(R.id.stock_detail_container, fragment)
                    .commit();
        }
    }
}

package com.sam_chordas.android.stockhawk.ui;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;

import com.sam_chordas.android.stockhawk.R;

/**
 * Created by frano on 21/03/2016.
 */
public class LineGraphActivity extends AppCompatActivity {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_line_graph);

        if (savedInstanceState == null) {
            Bundle arguments = new Bundle();
            arguments.putString(getString(R.string.line_graph_extra),
                    getIntent().getStringExtra(getString(R.string.line_graph_extra)));

            LineGraphFragment fragment = new LineGraphFragment();
            fragment.setArguments(arguments);

            getSupportFragmentManager().beginTransaction()
                    .add(R.id.stock_detail_container, fragment)
                    .commit();
        }
    }
}

Put graph activity intent extras into fragment's arguments


package com.pqbyte.coherence;

public final class Constants {
  private static final boolean DEBUG = true;

  public static boolean isDebug() {
    return DEBUG;
  }

  public static final int WORLD_WIDTH = 100;
  public static final int WORLD_HEIGHT = 100;

  /* Mask flags for Box2D filters. */
  public static final short PHYSICS_ENTITY = 0x1;
  public static final short WORLD_ENTITY = 0x2;
}

package com.pqbyte.coherence;

public final class Constants {
  private static final boolean DEBUG = true;

  public static boolean isDebug() {
    return DEBUG;
  }

  public static final int WORLD_WIDTH = 100;
  public static final int WORLD_HEIGHT = 100;

  /* Mask flags for Box2D filters. */
  public static final short PLAYER_ENTITY = 0x1;
  public static final short BULLET_ENTITY = 0x2;
  public static final short WORLD_ENTITY = 0x3;
}

Split bullet and player enitity flags


package fitnesse.http;

import fitnesse.http.MockRequest;
import fitnesse.http.Request;

public class MockRequestBuilder {
  protected String specification;
  private boolean noChunk = false;

  public MockRequestBuilder(String specification) {
    this.specification = specification;
    validate();
  }

  public Request build() {
    MockRequest request = new MockRequest();
    request.parseRequestUri(getCommand());
    if (hasCredentials()) {
      request.setCredentials(getUsername(), getPassword());
    }
    if (noChunk) {
      request.addInput("noChunk", true);
    }
    return request;
  }

  private String getCommand() {
    String actualCommand = null;

    if (hasCredentials())
      actualCommand = commandParts()[2];
    else
      actualCommand = specification;

    if (actualCommand.startsWith("/"))
      return actualCommand;
    else
      return "/" + actualCommand;
  }

  private boolean hasCredentials() {
    return (commandParts().length == 3);
  }

  private boolean hasNoCredentials() {
    return (commandParts().length == 1);
  }

  private void validate() {
    if (!hasCredentials() && !hasNoCredentials())
      throw new IllegalArgumentException("Command specification [" + specification + "] invalid. Format shold be /cmd or user:pass:/cmd");
  }

  private String[] commandParts() {
    return specification.split(":");
  }

  private String getUsername() {
    return commandParts()[0];
  }

  private String getPassword() {
    return commandParts()[1];
  }

  public MockRequestBuilder noChunk() {
    this.noChunk = true;
    return this;
  }
}

package fitnesse.http;

public class MockRequestBuilder {
  protected String specification;
  private boolean noChunk = false;

  public MockRequestBuilder(String specification) {
    this.specification = specification;
    validate();
  }

  public Request build() {
    MockRequest request = new MockRequest();
    request.parseRequestUri(getCommand());
    if (hasCredentials()) {
      request.setCredentials(getUsername(), getPassword());
    }
    if (noChunk) {
      request.addInput("nochunk", true);
    }
    return request;
  }

  private String getCommand() {
    String actualCommand = null;

    if (hasCredentials())
      actualCommand = commandParts()[2];
    else
      actualCommand = specification;

    if (actualCommand.startsWith("/"))
      return actualCommand;
    else
      return "/" + actualCommand;
  }

  private boolean hasCredentials() {
    return (commandParts().length == 3);
  }

  private boolean hasNoCredentials() {
    return (commandParts().length == 1);
  }

  private void validate() {
    if (!hasCredentials() && !hasNoCredentials())
      throw new IllegalArgumentException("Command specification [" + specification + "] invalid. Format shold be /cmd or user:pass:/cmd");
  }

  private String[] commandParts() {
    return specification.split(":");
  }

  private String getUsername() {
    return commandParts()[0];
  }

  private String getPassword() {
    return commandParts()[1];
  }

  public MockRequestBuilder noChunk() {
    this.noChunk = true;
    return this;
  }
}

Fix issue with chunked reponse from command line execution.


package org.project.neutrino.nfvo.core.cli;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.stereotype.Component;

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

/**
 * Created by lto on 16/04/15.
 */
@Component
public class CLIBean implements CommandLineRunner{

    private Logger log = LoggerFactory.getLogger(this.getClass());

    @Autowired
    ConfigurableApplicationContext configurableApplicationContext;

    @Override
    public void run(String... strings) throws Exception {

        BufferedReader br =
                new BufferedReader(new InputStreamReader(System.in));

        String input;
        System.out.print(">> ");
        boolean exit = false;
        while (!exit && (input = br.readLine()) != null) {
            System.out.print(">> ");

            switch (input.toLowerCase()) {
                case "exit":
                    configurableApplicationContext.close();
                    exit = true;
                    break;
                default:

            }
        }
    }
}

package org.project.neutrino.nfvo.core.cli;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.stereotype.Component;

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

/**
 * Created by lto on 16/04/15.
 */
@Component
public class CLIBean implements CommandLineRunner{

    private Logger log = LoggerFactory.getLogger(this.getClass());

    @Autowired
    ConfigurableApplicationContext configurableApplicationContext;

    @Override
    public void run(String... strings) throws Exception {

        BufferedReader br =
                new BufferedReader(new InputStreamReader(System.in));

        String input;
        System.out.print(">> ");
        boolean exit = false;
        while (!exit && (input = br.readLine()) != null) {
            System.out.print(">> ");

            switch (input.toLowerCase()) {
                case "exit":
                    configurableApplicationContext.close();
                    exit = true;
                    break;
                case "list beans":
                    for (String s: configurableApplicationContext.getBeanDefinitionNames())
                        log.info(s);
                default:

            }
        }
    }
}

Add option for listing all beans


package com.intellij.plugins.pageObjectEvaluator;

import org.apache.log4j.BasicConfigurator;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;

public class RunPageObjectMain {

    public static void main(String[] args) {
        BasicConfigurator.configure();
        Logger.getRootLogger().setLevel(Level.INFO);

        EvaluationConfig config = EvaluationConfig.from(args);
        new PageObjectEvaluator(config).evaluate();
    }
}

package com.intellij.plugins.pageObjectEvaluator;

import org.apache.log4j.*;

public class RunPageObjectMain {

    public static void main(String[] args) {
        ConsoleAppender consoleAppender = new ConsoleAppender(new PatternLayout("%m%n"));
        BasicConfigurator.configure(consoleAppender);
        Logger.getRootLogger().setLevel(Level.INFO);
        EvaluationConfig config = EvaluationConfig.from(args);
        new PageObjectEvaluator(config).evaluate();
    }
}

Make log pattern less noisy.


package info.metadude.java.library.halfnarp;

import info.metadude.java.library.halfnarp.model.*;
import retrofit2.Call;
import retrofit2.http.*;

import java.util.List;

@SuppressWarnings("unused")
public interface TalkPreferencesService {

    String BASE_URL = "http://halfnarp.events.ccc.de";

    @GET("/-/talkpreferences")
    Call<List<GetTalksResponse>> getTalks();

    // TODO: Handle post error response

    @POST("/-/talkpreferences")
    Call<CreateTalkPreferencesSuccessResponse> createTalkPreferences(
            @Body TalkIds talkIds);

    // TODO: Handle update error response

    @PUT("/-/talkpreferences/{uniqueId}")
    Call<UpdateTalkPreferencesSuccessResponse> updateTalkPreferences(
            @Path("uniqueId") String uniqueId,
            @Body TalkIds talkIds);

    // TODO: Handle getTalkPreferences error response

    @GET("/-/talkpreferences/{uniqueId}")
    Call<GetTalkPreferencesSuccessResponse> getTalkPreferences(
            @Path("uniqueId") String uniqueId);

}

package info.metadude.java.library.halfnarp;

import info.metadude.java.library.halfnarp.model.*;
import retrofit2.Call;
import retrofit2.http.*;

import java.util.List;

@SuppressWarnings("unused")
public interface TalkPreferencesService {

    String BASE_URL = "https://halfnarp.events.ccc.de";

    @GET("/-/talkpreferences")
    Call<List<GetTalksResponse>> getTalks();

    // TODO: Handle post error response

    @POST("/-/talkpreferences")
    Call<CreateTalkPreferencesSuccessResponse> createTalkPreferences(
            @Body TalkIds talkIds);

    // TODO: Handle update error response

    @PUT("/-/talkpreferences/{uniqueId}")
    Call<UpdateTalkPreferencesSuccessResponse> updateTalkPreferences(
            @Path("uniqueId") String uniqueId,
            @Body TalkIds talkIds);

    // TODO: Handle getTalkPreferences error response

    @GET("/-/talkpreferences/{uniqueId}")
    Call<GetTalkPreferencesSuccessResponse> getTalkPreferences(
            @Path("uniqueId") String uniqueId);

}

Update base URL which has changed.


package com.smartdevicelink.test.util;

import android.os.Build;

public class DeviceUtil {
    public static boolean isEmulator() {
        return Build.FINGERPRINT.startsWith("generic")
                || Build.FINGERPRINT.startsWith("unknown")
                || Build.MODEL.contains("google_sdk")
                || Build.MODEL.contains("Emulator")
                || Build.MODEL.contains("Android SDK built for")
                || (Build.BRAND.startsWith("generic") && Build.DEVICE.startsWith("generic"))
                || (Build.BRAND.startsWith("Android") && Build.DEVICE.startsWith("generic"))
                || (Build.PRODUCT != null && Build.PRODUCT.startsWith("sdk_google_phone"))
                || "google_sdk".equals(Build.PRODUCT);
    }
}

package com.smartdevicelink.test.util;

import android.os.Build;

public class DeviceUtil {
    public static boolean isEmulator() {
        return Build.FINGERPRINT.startsWith("generic")
                || Build.FINGERPRINT.startsWith("unknown")
                || Build.MODEL.contains("google_sdk")
                || Build.MODEL.contains("Emulator")
                || Build.MODEL.contains("Android SDK built for")
                || Build.MANUFACTURER.contains("Genymotion")
                || (Build.BRAND.startsWith("generic") && Build.DEVICE.startsWith("generic"))
                || (Build.BRAND.startsWith("Android") && Build.DEVICE.startsWith("generic"))
                || (Build.PRODUCT != null && Build.PRODUCT.startsWith("sdk_google_phone"))
                || "google_sdk".equals(Build.PRODUCT);
    }
}

Add Genymotion to isEmulator() method


package com.headius.invokebinder;

/**
 * Created by headius on 6/27/17.
 */
public class Util {
    public static boolean isJava9() {
        try {
            return System.getProperty("java.specification.version", "").equals("9");
        } catch (Exception e) {
            return false;
        }
    }
}

package com.headius.invokebinder;

/**
 * Utilities used by InvokeBinder classes.
 */
public class Util {
    public static boolean IS_JAVA9;

    static {
        boolean isJava9;
        try {
            Class.forName("java.lang.Module");
            isJava9 = true;
        } catch (Exception e) {
            isJava9 = false;
        }
        IS_JAVA9 = isJava9;
    }

    public static boolean isJava9() {
        return IS_JAVA9;
    }
}

Fix this to run on all Java 9+ JVMs


package com.brackeen.app.view;

import com.brackeen.app.BitmapFont;
import java.awt.Graphics2D;

@SuppressWarnings("unused")
public class Label extends View {

    private BitmapFont font;
    private String text;

    public Label() {

    }

    public Label(BitmapFont font, String text) {
        this.font = font;
        this.text = text;
        sizeToFit();
    }

    public BitmapFont getFont() {
        return font;
    }

    public void setFont(BitmapFont font) {
        this.font = font;
    }

    public String getText() {
        return text;
    }

    public void setText(String text) {
        this.text = text;
    }

    @Override
    public void sizeToFit() {
        if (font == null) {
            setSize(0, 0);
        }
        else {
            setSize(font.getStringWidth(text), font.getHeight());
        }
    }

    @Override
    public void onDraw(Graphics2D g) {
        if (font != null) {
            font.drawString(g, text);
        }
    }
}

package com.brackeen.app.view;

import com.brackeen.app.BitmapFont;
import java.awt.Graphics2D;

@SuppressWarnings("unused")
public class Label extends View {

    private BitmapFont font;
    private String text;

    public Label() {

    }

    public Label(BitmapFont font, String text) {
        this.font = font;
        this.text = text;
        sizeToFit();
    }

    public BitmapFont getFont() {
        return font;
    }

    public void setFont(BitmapFont font) {
        this.font = font;
    }

    public String getText() {
        return text;
    }

    public void setText(String text) {
        this.text = text;
    }

    @Override
    public void sizeToFit() {
        if (font == null) {
            setSize(0, 0);
        }
        else {
            setSize(font.getStringWidth(text), font.getHeight());
        }
    }

    @Override
    public void onDraw(Graphics2D g) {
        if (font != null) {
            font.drawString(g, text);
        }
    }

    public static View makeMultilineLabel(BitmapFont font, String text, float anchorX) {
        View view = new View();
        int y = 0;
        int index = 0;
        while (true) {
            String line;
            int newIndex = text.indexOf('\n', index);
            if (newIndex == -1) {
                line = text.substring(index);
            } else {
                line = text.substring(index, newIndex);
            }
            Label label = new Label(font, line);
            label.setLocation(0, y);
            label.setAnchor(anchorX, 0);
            view.addSubview(label);
            y += font.getHeight();

            if (newIndex == -1) {
                break;
            }
            index = newIndex + 1;
        }
        view.setHeight(y);
        return view;
    }
}

Add method for multiline labels


package org.wikimedia.commons.campaigns;

import android.net.Uri;
import org.wikimedia.commons.contributions.Contribution;

import java.util.ArrayList;
import java.util.Date;

public class CampaignContribution extends Contribution {
    private Campaign campaign;

    private ArrayList<String> fieldValues;

    public CampaignContribution(Uri localUri, String remoteUri, String filename, String description, long dataLength, Date dateCreated, Date dateUploaded, String creator, String editSummary, Campaign campaign) {
        super(localUri, remoteUri, filename, description, dataLength, dateCreated, dateUploaded, creator, editSummary);
        this.campaign = campaign;
    }

    public Campaign getCampaign() {
        return campaign;
    }

    public void setCampaign(Campaign campaign) {
        this.campaign = campaign;
    }

    @Override
    public String getTrackingTemplates() {
        StringBuffer buffer = new StringBuffer();
        if(campaign.getAutoAddWikitext() != null) {
            buffer.append(campaign.getAutoAddWikitext()).append("\n");
        }
        if(campaign.getAutoAddCategories() != null && campaign.getAutoAddCategories().size() != 0) {
            for(String cat : campaign.getAutoAddCategories()) {
                buffer.append("[[Category:").append(cat).append("]]").append("\n");
            }
        } else {
            buffer.append("{{subst:unc}}\n");
        }
        return buffer.toString();
    }

    @Override
    public String getDescription() {
        return super.getDescription();
    }
}

package org.wikimedia.commons.campaigns;

import android.net.Uri;
import org.wikimedia.commons.contributions.Contribution;

import java.util.ArrayList;
import java.util.Date;

public class CampaignContribution extends Contribution {
    private Campaign campaign;

    private ArrayList<String> fieldValues;

    public CampaignContribution(Uri localUri, String remoteUri, String filename, String description, long dataLength, Date dateCreated, Date dateUploaded, String creator, String editSummary, Campaign campaign) {
        super(localUri, remoteUri, filename, description, dataLength, dateCreated, dateUploaded, creator, editSummary);
        this.campaign = campaign;
    }

    public Campaign getCampaign() {
        return campaign;
    }

    public void setCampaign(Campaign campaign) {
        this.campaign = campaign;
    }

    @Override
    public String getTrackingTemplates() {
        StringBuffer buffer = new StringBuffer();
        if(campaign.getAutoAddWikitext() != null) {
            buffer.append(campaign.getAutoAddWikitext()).append("\n");
        }
        if(campaign.getAutoAddCategories() != null && campaign.getAutoAddCategories().size() != 0) {
            for(String cat : campaign.getAutoAddCategories()) {
                buffer.append("[[Category:").append(cat).append("]]").append("\n");
            }
        } else {
            buffer.append("{{subst:unc}}\n");
        }
        buffer.append("[[Category:").append(campaign.getTrackingCategory()).append("\n");
        return buffer.toString();
    }

    @Override
    public String getDescription() {
        return super.getDescription();
    }
}

Add tracking category when uploading with a Campaign


package org.codeswarm.lipsum;

import org.stringtemplate.v4.ST;
import org.stringtemplate.v4.STGroup;

/**
 * A {@link org.codeswarm.lipsum.Lipsum.ParagraphGenerator} implementation backed by an {@link STGroup}.
 */
class STGroupParagraphGenerator implements Lipsum.ParagraphGenerator {

  interface TemplateNames {
    int getMinIndex();
    int getMaxIndex();
    String getTemplateName(int index);
  }

  private final STGroup stg;
  private final TemplateNames templateNames;

  STGroupParagraphGenerator(STGroup stg, TemplateNames templateNames) {
    this.stg = stg;
    this.templateNames = templateNames;
  }

  @Override
  public String paragraph(long key) {
    int index = templateNames.getMinIndex() + Lipsum.remainder(
      Math.abs(key - templateNames.getMinIndex()),
      templateNames.getMaxIndex());
    String tplName = templateNames.getTemplateName(index);
    ST tpl = stg.getInstanceOf(tplName);
    return tpl.render();
  }

}

package org.codeswarm.lipsum;

import org.stringtemplate.v4.ST;
import org.stringtemplate.v4.STGroup;

/**
 * A {@link Lipsum.ParagraphGenerator} implementation backed by an {@link STGroup}.
 */
class STGroupParagraphGenerator implements Lipsum.ParagraphGenerator {

  interface TemplateNames {
    int getMinIndex();
    int getMaxIndex();
    String getTemplateName(int index);
  }

  private final STGroup stg;
  private final TemplateNames templateNames;

  STGroupParagraphGenerator(STGroup stg, TemplateNames templateNames) {
    this.stg = stg;
    this.templateNames = templateNames;
  }

  @Override
  public String paragraph(long key) {
    int index = templateNames.getMinIndex() + Lipsum.remainder(
      Math.abs(key - templateNames.getMinIndex()),
      templateNames.getMaxIndex());
    String tplName = templateNames.getTemplateName(index);
    ST tpl = stg.getInstanceOf(tplName);
    return tpl.render();
  }

}

Remove unnecessary full class qualification


package com.euler;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;

public class Config {

    private static interface ProblemLoader {
        public Problem load();
    }

    private static final Map<String,ProblemLoader> LOADERS = new HashMap<>();
    {
        // TODO This is a pain to maintain. Can we use ClassLoader magic?
        LOADERS.put("24", new ProblemLoader() {
            @Override
            public Problem load() {
                return new Problem24();
            }
        });
        LOADERS.put("27", new ProblemLoader() {
            @Override
            public Problem load() {
                return new Problem27();
            }
        });
        LOADERS.put("28", new ProblemLoader() {
            @Override
            public Problem load() {
                return new Problem28();
            }
        });
        LOADERS.put("29", new ProblemLoader() {
            @Override
            public Problem load() {
                return new Problem29();
            }
        });
        LOADERS.put("29a", new ProblemLoader() {
            @Override
            public Problem load() {
                return new Problem29a();
            }
        });
        LOADERS.put("30", new ProblemLoader() {
            @Override
            public Problem load() {
                return new Problem30();
            }
        });
    }

    private static Problem loadProblem(String key) {
        ProblemLoader loader = LOADERS.get(key);
        if (loader == null) {
            // TODO Print a list of known problems then.
            throw new IllegalArgumentException(
                "Not a known problem: "+key);
        }
        return loader.load();
    }

    private final String[] args;

    public Config(String[] args) {
        this.args = args;
    }

    public Map<String,Problem> getProblems() {
        Map<String,Problem> result = new TreeMap<>();
        for (int i = 0; i < args.length; ++i) {
            String key = args[i];
            result.put(key, loadProblem(key));
        }
        return result;
    }

}

package com.euler;

import java.util.Map;
import java.util.TreeMap;

public class Config {

    private final String[] args;

    public Config(String[] args) {
        this.args = args;
    }

    public Map<String,Problem> getProblems() {
        Map<String,Problem> result = new TreeMap<>();
        for (int i = 0; i < args.length; ++i) {
            String key = args[i];
            result.put(key, loadProblem(key));
        }
        return result;
    }

    private Problem loadProblem(String key) {
        try {
            String classPath = "com.euler.Problem" + key;
            Class cls = Class.forName(classPath);
            Object obj = cls.newInstance();
            return (Problem)obj;
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
}

Use Class.forName to load problems


package alien4cloud.model.templates;

import lombok.Getter;
import lombok.Setter;

import org.elasticsearch.annotation.ESObject;
import org.elasticsearch.annotation.Id;
import org.elasticsearch.annotation.StringField;
import org.elasticsearch.annotation.query.TermFilter;
import org.elasticsearch.mapping.IndexType;

@Getter
@ESObject
public class TopologyTemplate {
    @Id
    @Setter
    private String id;
    @StringField(includeInAll = true, indexType = IndexType.not_analyzed)
    @TermFilter
    @Setter
    private String name;
    @Setter
    private String description;
    private String topologyId;
}

package alien4cloud.model.templates;

import lombok.Getter;
import lombok.Setter;

import org.elasticsearch.annotation.ESObject;
import org.elasticsearch.annotation.Id;
import org.elasticsearch.annotation.StringField;
import org.elasticsearch.annotation.query.TermFilter;
import org.elasticsearch.mapping.IndexType;

@Getter
@ESObject
public class TopologyTemplate {
    @Id
    @Setter
    private String id;
    @StringField(includeInAll = true, indexType = IndexType.not_analyzed)
    @TermFilter
    @Setter
    private String name;
    @Setter
    private String description;
}

Remove useless topology id that was never set as they are configured in topology template versions.


package com.github.oryanmat.trellowidget.model;

public class User {
    String id;
    String fullName;
    String username;

    @Override
    public String toString() {
        return fullName + "@" + username;
    }
}

package com.github.oryanmat.trellowidget.model;

public class User {
    String id;
    String fullName;
    String username;

    @Override
    public String toString() {
        return fullName + " (@" + username + ")";
    }
}

Fix minor formatting glitch in how usernames are displayed


package com.github.games647.fastlogin.bungee;

import com.github.games647.fastlogin.core.shared.LoginSource;

import java.net.InetSocketAddress;

import net.md_5.bungee.api.chat.TextComponent;
import net.md_5.bungee.api.connection.PendingConnection;
import net.md_5.bungee.api.event.PreLoginEvent;

public class BungeeLoginSource implements LoginSource {

    private final PendingConnection connection;
    private final PreLoginEvent preLoginEvent;

    public BungeeLoginSource(PendingConnection connection, PreLoginEvent preLoginEvent) {
        this.connection = connection;
        this.preLoginEvent = preLoginEvent;
    }

    @Override
    public void setOnlineMode() {
        connection.setOnlineMode(true);
    }

    @Override
    public void kick(String message) {
        preLoginEvent.setCancelled(true);

        if (message != null)
            preLoginEvent.setCancelReason(TextComponent.fromLegacyText(message));
    }

    @Override
    public InetSocketAddress getAddress() {
        return connection.getAddress();
    }

    public PendingConnection getConnection() {
        return connection;
    }

    @Override
    public String toString() {
        return this.getClass().getSimpleName() + '{' +
                "connection=" + connection +
                '}';
    }
}

package com.github.games647.fastlogin.bungee;

import com.github.games647.fastlogin.core.shared.LoginSource;

import java.net.InetSocketAddress;

import net.md_5.bungee.api.ChatColor;
import net.md_5.bungee.api.chat.ComponentBuilder;
import net.md_5.bungee.api.chat.TextComponent;
import net.md_5.bungee.api.connection.PendingConnection;
import net.md_5.bungee.api.event.PreLoginEvent;

public class BungeeLoginSource implements LoginSource {

    private final PendingConnection connection;
    private final PreLoginEvent preLoginEvent;

    public BungeeLoginSource(PendingConnection connection, PreLoginEvent preLoginEvent) {
        this.connection = connection;
        this.preLoginEvent = preLoginEvent;
    }

    @Override
    public void setOnlineMode() {
        connection.setOnlineMode(true);
    }

    @Override
    public void kick(String message) {
        preLoginEvent.setCancelled(true);

        if (message != null)
            preLoginEvent.setCancelReason(TextComponent.fromLegacyText(message));
        else
            preLoginEvent.setCancelReason(new ComponentBuilder("Kicked").color(ChatColor.WHITE).create());
    }

    @Override
    public InetSocketAddress getAddress() {
        return connection.getAddress();
    }

    public PendingConnection getConnection() {
        return connection;
    }

    @Override
    public String toString() {
        return this.getClass().getSimpleName() + '{' +
                "connection=" + connection +
                '}';
    }
}

Set a default kick reason if nothing is specified


/**
 * Created by nick on 8/23/15.
 */
public class Main {

    public static void main(String[] args){

    }
}

import maze.Maze;
import viewer.MazeViewer;

/**
 * Created by nick on 8/23/15.
 */
public class Main {

    public static void main(String[] args){
        Maze maze = new Maze(20, 20);
        maze.generate();
        MazeViewer viewer = new MazeViewer(maze, 20);
    }
}

Add accessor methods for start and end cells


package net.kencochrane.raven.jul;

import net.kencochrane.raven.stub.SentryStub;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;

import java.util.logging.Level;
import java.util.logging.Logger;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;

public class SentryHandlerIT {
    private static final Logger logger = Logger.getLogger(SentryHandlerIT.class.getName());
    private SentryStub sentryStub;

    @BeforeMethod
    public void setUp() {
        sentryStub = new SentryStub();
        sentryStub.removeEvents();
    }

    @AfterMethod
    public void tearDown() {
        sentryStub.removeEvents();
    }

    @Test
    public void testInfoLog() {
        assertThat(sentryStub.getEventCount(), is(0));
        logger.info("This is a test");
        assertThat(sentryStub.getEventCount(), is(1));
    }

    @Test
    public void testChainedExceptions() {
        assertThat(sentryStub.getEventCount(), is(0));
        logger.log(Level.SEVERE, "This is an exception",
                new UnsupportedOperationException("Test", new UnsupportedOperationException()));
        assertThat(sentryStub.getEventCount(), is(1));
    }
}

package net.kencochrane.raven.jul;

import net.kencochrane.raven.stub.SentryStub;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;

import java.util.logging.Level;
import java.util.logging.Logger;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;

public class SentryHandlerIT {
    private static final Logger logger = Logger.getLogger(SentryHandlerIT.class.getName());
    private SentryStub sentryStub;

    @BeforeMethod
    public void setUp() throws Exception {
        sentryStub = new SentryStub();
        sentryStub.removeEvents();
    }

    @AfterMethod
    public void tearDown() throws Exception {
        sentryStub.removeEvents();
    }

    @Test
    public void testInfoLog() throws Exception {
        assertThat(sentryStub.getEventCount(), is(0));
        logger.info("This is a test");
        assertThat(sentryStub.getEventCount(), is(1));
    }

    @Test
    public void testChainedExceptions() throws Exception {
        assertThat(sentryStub.getEventCount(), is(0));
        logger.log(Level.SEVERE, "This is an exception",
                new UnsupportedOperationException("Test", new UnsupportedOperationException()));
        assertThat(sentryStub.getEventCount(), is(1));
    }
}

Throw exception from the integration tests


package com.github.eaglerainbow.gitservlet;

public class LocalInternalServerException extends Exception {

	public LocalInternalServerException(String message, Throwable cause) {
		super(message, cause);
		// TODO Auto-generated constructor stub
	}

	public LocalInternalServerException(String message) {
		super(message);
		// TODO Auto-generated constructor stub
	}

	public LocalInternalServerException(Throwable cause) {
		super(cause);
		// TODO Auto-generated constructor stub
	}

}

package com.github.eaglerainbow.gitservlet;

public class LocalInternalServerException extends Exception {

	public LocalInternalServerException(String message, Throwable cause) {
		super(message, cause);
	}

	public LocalInternalServerException(String message) {
		super(message);
	}

	public LocalInternalServerException(Throwable cause) {
		super(cause);
	}

}

Remove unnecessary TODOs (they are no stubs...)


package com.vaadin.addon.audio.shared;

import java.util.ArrayList;
import java.util.List;

import com.vaadin.addon.audio.shared.SharedEffect;
import com.vaadin.shared.AbstractComponentState;

@SuppressWarnings("serial")
public class AudioPlayerState extends AbstractComponentState {

	// NOTE: set this once and then don't touch it
	public final List<ChunkDescriptor> chunks = new ArrayList<ChunkDescriptor>();

	public final List<String> chunkData = new ArrayList<String>();

	public List<SharedEffect> effects = new ArrayList<SharedEffect>();

}

package com.vaadin.addon.audio.shared;

import java.util.ArrayList;
import java.util.List;

import com.vaadin.addon.audio.shared.SharedEffect;
import com.vaadin.shared.AbstractComponentState;

@SuppressWarnings("serial")
public class AudioPlayerState extends AbstractComponentState {

	public final List<ChunkDescriptor> chunks = new ArrayList<ChunkDescriptor>();

	public final List<SharedEffect> effects = new ArrayList<SharedEffect>();

}

Remove useless bits from shared state


package uk.ac.ebi.quickgo.geneproduct.common;

/**
 * An enumeration of the possible states of proteome membership a gene product can have.
 * @author Tony Wardell
 * Date: 06/03/2018
 * Time: 10:33
 * Created with IntelliJ IDEA.
 */
public enum ProteomeMembership {
    REFERENCE, COMPLETE, NONE, NOT_APPLICABLE
}

package uk.ac.ebi.quickgo.geneproduct.common;

/**
 * An enumeration of the possible states of proteome membership a gene product can have.
 * @author Tony Wardell
 * Date: 06/03/2018
 * Time: 10:33
 * Created with IntelliJ IDEA.
 */
public enum ProteomeMembership {
    REFERENCE, COMPLETE, NONE, NOT_APPLICABLE;

    /**
     * Define the predicates required and order of importance to work out which Proteome membership category is
     * applicable.
     * @param isProtein is the gene product a protein
     * @param isRef is the gene product a reference proteome
     * @param isComplete is the gene product a member of a complete proteome.
     * @return the ProteomeMembership matching the applied constraints
     */
    public static ProteomeMembership membership(boolean isProtein, boolean isRef, boolean isComplete) {
        if (!isProtein) {
            return NOT_APPLICABLE;
        } else if (isRef) {
            return REFERENCE;
        } else if (isComplete) {
            return COMPLETE;
        }
        return NONE;
    }
}

Add memberhip() method for selection logic.


/*
 * Created by brightSPARK Labs
 * www.brightsparklabs.com
 */

package com.brightsparklabs.asanti.validator;

import com.brightsparklabs.assam.validator.Validator;

/**
 * Static utility methods pertaining to {@link Validator} instances.
 *
 * @author brightSPARK Labs
 */
public class Validators
{
    // -------------------------------------------------------------------------
    // CLASS VARIABLES
    // -------------------------------------------------------------------------

    /** the default validator */
    private static Validator instance;

    // -------------------------------------------------------------------------
    // CONSTRUCTION
    // -------------------------------------------------------------------------

    /**
     * Private constructor.
     */
    private Validators()
    {
        // static utility class should never be instantiated
        throw new AssertionError();
    }

    // -------------------------------------------------------------------------
    // PUBLIC METHODS
    // -------------------------------------------------------------------------

    /**
     * Returns the default validator which validates @link{AsnData} against its corresponding
     * schema.
     *
     * @return the default validator
     */
    public static Validator getDefault()
    {
        /*
         * NOTE: Not thread safe, but unlikely this method will actually be called. Generally a
         * custom validator will be used.
         */
        if (instance == null)
        {
            instance = ValidatorImpl.builder().build();
        }
        return instance;
    }

    /**
     * Returns a builder for creating a Validator which which validates {@AsnData} against its
     * corresponding schema as well as any custom validation rules.
     *
     * @return the default validator
     */
    public static ValidatorImpl.Builder newCustomValidatorBuilder()
    {
        return ValidatorImpl.builder();
    }
}

/*
 * Created by brightSPARK Labs
 * www.brightsparklabs.com
 */

package com.brightsparklabs.asanti.validator;

import com.brightsparklabs.assam.data.AsnData;
import com.brightsparklabs.assam.validator.Validator;

/**
 * Static utility methods pertaining to {@link Validator} instances.
 *
 * @author brightSPARK Labs
 */
public class Validators
{
    // -------------------------------------------------------------------------
    // CLASS VARIABLES
    // -------------------------------------------------------------------------

    /** the default validator */
    private static Validator instance;

    // -------------------------------------------------------------------------
    // CONSTRUCTION
    // -------------------------------------------------------------------------

    /**
     * Private constructor.
     */
    private Validators()
    {
        // static utility class should never be instantiated
        throw new AssertionError();
    }

    // -------------------------------------------------------------------------
    // PUBLIC METHODS
    // -------------------------------------------------------------------------

    /**
     * Returns the default validator which validates {@link AsnData} against its corresponding
     * schema.
     *
     * @return the default validator
     */
    public static Validator getDefault()
    {
        /*
         * NOTE: Not thread safe, but unlikely this method will actually be called. Generally a
         * custom validator will be used.
         */
        if (instance == null)
        {
            instance = ValidatorImpl.builder().build();
        }
        return instance;
    }

    /**
     * Returns a builder for creating a Validator which which validates {@link AsnData} against its
     * corresponding schema as well as any custom validation rules.
     *
     * @return the default validator
     */
    public static ValidatorImpl.Builder newCustomValidatorBuilder()
    {
        return ValidatorImpl.builder();
    }
}

Fix Java 8 javadoc errors


package com.cwainner.chris.recipecentral;

import android.support.test.rule.ActivityTestRule;

import org.junit.Rule;
import org.junit.Test;

import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.action.ViewActions.typeText;
import static android.support.test.espresso.assertion.ViewAssertions.matches;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
import static android.support.test.espresso.matcher.ViewMatchers.withText;

public class MainActivityInstrumentationTest {

    @Rule
    public ActivityTestRule<MainActivity> activityTestRule = new ActivityTestRule<>(MainActivity.class);

    @Test
    public void validateEditText(){
        onView(withId(R.id.recipeEditText)).perform(typeText("Brownies"))
                .check(matches(withText("Brownies")));
    }
}

package com.cwainner.chris.recipecentral;

import android.support.test.rule.ActivityTestRule;

import org.junit.Rule;
import org.junit.Test;

import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.action.ViewActions.click;
import static android.support.test.espresso.action.ViewActions.typeText;
import static android.support.test.espresso.assertion.ViewAssertions.matches;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
import static android.support.test.espresso.matcher.ViewMatchers.withText;

public class MainActivityInstrumentationTest {

    @Rule
    public ActivityTestRule<MainActivity> activityTestRule = new ActivityTestRule<>(MainActivity.class);

    @Test
    public void validateEditText(){
        onView(withId(R.id.recipeEditText)).perform(typeText("Brownies"))
                .check(matches(withText("Brownies")));
    }

    @Test
    public void textInputSentToRecipesActivity(){
        String textToInput = "Brownies";
        onView(withId(R.id.recipeEditText)).perform(typeText(textToInput));
        onView(withId(R.id.getRecipesButton)).perform(click());
        onView(withId(R.id.recipeTypeView)).check(matches(withText("Recipe type: " + textToInput)));
    }
}

Add instrumentation test to validate that recipe type is passed to recipes activity


package com.alexstyl.specialdates.search;

import com.alexstyl.specialdates.contact.Contact;
import com.alexstyl.specialdates.date.ContactEvent;
import com.alexstyl.specialdates.events.peopleevents.EventType;

import java.util.ArrayList;
import java.util.List;

final class ContactEventViewModelFactory {

    private final ContactEventLabelCreator eventLabelCreator;

    ContactEventViewModelFactory(ContactEventLabelCreator eventLabelCreator) {
        this.eventLabelCreator = eventLabelCreator;
    }

    List<ContactEventViewModel> createViewModelFrom(List<ContactWithEvents> contactEvents) {
        List<ContactEventViewModel> models = new ArrayList<>();
        for (ContactWithEvents contactEvent : contactEvents) {

            Contact contact = contactEvent.getContact();

            for (ContactEvent event : contactEvent.getEvents()) {
                String eventLabel = eventLabelCreator.createFor(event);
                int variant = getVariationFor(event);
                ContactEventViewModel viewModel = new ContactEventViewModel(contact, eventLabel, colorOf(event.getType()), variant);
                models.add(viewModel);
            }
        }
        return models;
    }

    private int colorOf(EventType type) {
        return 0;
    }

    private int getVariationFor(ContactEvent event) {
        return (int) event.getContact().getContactID();
    }
}

package com.alexstyl.specialdates.search;

import com.alexstyl.specialdates.contact.Contact;
import com.alexstyl.specialdates.date.ContactEvent;
import com.alexstyl.specialdates.upcoming.EventColors;

import java.util.ArrayList;
import java.util.List;

final class ContactEventViewModelFactory {

    private final ContactEventLabelCreator eventLabelCreator;

    ContactEventViewModelFactory(ContactEventLabelCreator eventLabelCreator) {
        this.eventLabelCreator = eventLabelCreator;
    }

    List<ContactEventViewModel> createViewModelFrom(List<ContactWithEvents> contactEvents) {
        List<ContactEventViewModel> models = new ArrayList<>();
        for (ContactWithEvents contactEvent : contactEvents) {

            Contact contact = contactEvent.getContact();

            for (ContactEvent event : contactEvent.getEvents()) {
                String eventLabel = eventLabelCreator.createFor(event);
                int variant = getVariationFor(event);
                ContactEventViewModel viewModel = new ContactEventViewModel(
                        contact,
                        eventLabel,
                        EventColors.INSTANCE.colorOf(event.getType()),
                        variant
                );
                models.add(viewModel);
            }
        }
        return models;
    }

    private int getVariationFor(ContactEvent event) {
        return (int) event.getContact().getContactID();
    }
}

Use EventColors to pass the right event color


package com.netflix.config;

import org.junit.Test;

import static org.junit.Assert.assertEquals;

public class CascadedPropertiesWithDeploymentContextTest {

    @Test
    public void testLoadCascadedPropertiesConfigDeployment() throws Exception {
        ConfigurationBasedDeploymentContext context = new ConfigurationBasedDeploymentContext();
        ConfigurationManager.getConfigInstance().setProperty("archaius.deployment.environment", "test");
        ConfigurationManager.getConfigInstance().setProperty("archaius.deployment.region", "us-east-1");
        ConfigurationManager.loadCascadedPropertiesFromResources("test");
        assertEquals("9", ConfigurationManager.getConfigInstance().getProperty("com.netflix.config.samples.SampleApp.SampleBean.numSeeds"));
        assertEquals("1", ConfigurationManager.getConfigInstance().getProperty("cascaded.property"));
        ConfigurationManager.loadAppOverrideProperties("override");
        assertEquals("200", ConfigurationManager.getConfigInstance().getProperty("cascaded.property"));
    }
}

package com.netflix.config;

import org.junit.Test;

import static org.junit.Assert.assertEquals;

public class CascadedPropertiesWithDeploymentContextTest {

    //@Test
    public void testLoadCascadedPropertiesConfigDeployment() throws Exception {
        ConfigurationManager.getConfigInstance().setProperty("archaius.deployment.environment", "test");
        ConfigurationManager.getConfigInstance().setProperty("archaius.deployment.region", "us-east-1");
        ConfigurationManager.loadCascadedPropertiesFromResources("test");
        assertEquals("9", ConfigurationManager.getConfigInstance().getProperty("com.netflix.config.samples.SampleApp.SampleBean.numSeeds"));
        assertEquals("1", ConfigurationManager.getConfigInstance().getProperty("cascaded.property"));
        ConfigurationManager.loadAppOverrideProperties("override");
        assertEquals("200", ConfigurationManager.getConfigInstance().getProperty("cascaded.property"));
    }
}

Comment out test for loading deployment context until the load order can be fixed.


/*
 * Copyright (©) 2010 Jeff Harris <jefftharris@gmail.com>
 * All rights reserved. Use of the code is allowed under the
 * Artistic License 2.0 terms, as specified in the LICENSE file
 * distributed with this code, or available from
 * http://www.opensource.org/licenses/artistic-license-2.0.php
 */
package com.jefftharris.passwdsafe;

import android.app.Activity;
import android.widget.Spinner;
import android.widget.TextView;

public final class GuiUtils
{
    public static String getTextViewStr(Activity act, int viewId)
    {
        TextView tv = (TextView)act.findViewById(viewId);
        return tv.getText().toString();
    }

    public static String getSpinnerStr(Activity act, int viewId)
    {
        Spinner s = (Spinner)act.findViewById(viewId);
        return s.getSelectedItem().toString();
    }
}

/*
 * Copyright (©) 2010 Jeff Harris <jefftharris@gmail.com>
 * All rights reserved. Use of the code is allowed under the
 * Artistic License 2.0 terms, as specified in the LICENSE file
 * distributed with this code, or available from
 * http://www.opensource.org/licenses/artistic-license-2.0.php
 */
package com.jefftharris.passwdsafe;

import android.app.Activity;
import android.widget.Spinner;
import android.widget.TextView;

public final class GuiUtils
{
    public static String getTextViewStr(Activity act, int viewId)
    {
        TextView tv = (TextView)act.findViewById(viewId);
        return tv.getText().toString();
    }

    public static String getSpinnerStr(Activity act, int viewId)
    {
        Spinner s = (Spinner)act.findViewById(viewId);
        Object obj = s.getSelectedItem();
        return (obj == null) ? null : obj.toString();
    }
}

Fix NPE when starting to edit a record


package io.quarkus.deployment.steps;

import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStreamWriter;
import java.nio.charset.StandardCharsets;
import java.util.List;
import java.util.Properties;

import io.quarkus.deployment.annotations.BuildStep;
import io.quarkus.deployment.builditem.ArchiveRootBuildItem;
import io.quarkus.deployment.builditem.substrate.SubstrateOutputBuildItem;
import io.quarkus.deployment.builditem.substrate.SubstrateSystemPropertyBuildItem;

public class SubstrateSystemPropertiesBuildStep {

    @BuildStep
    SubstrateOutputBuildItem writeNativeProps(ArchiveRootBuildItem root,
            List<SubstrateSystemPropertyBuildItem> props) throws Exception {

        final Properties properties = new Properties();
        for (SubstrateSystemPropertyBuildItem i : props) {
            if (properties.containsKey(i.getKey())) {
                throw new RuntimeException("Duplicate native image system property under " + i.getKey()
                        + " conflicting values of " + i.getValue() + " and " + properties.get(i.getKey()));
            }
            properties.put(i.getKey(), i.getValue());
        }
        try (FileOutputStream os = new FileOutputStream(new File(root.getArchiveRoot().toFile(), "native-image.properties"))) {
            try (OutputStreamWriter osw = new OutputStreamWriter(os, StandardCharsets.UTF_8)) {
                properties.store(osw, "Generated properties (do not edit)");
            }
        }
        return new SubstrateOutputBuildItem();
    }
}

package io.quarkus.deployment.steps;

import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStreamWriter;
import java.nio.charset.StandardCharsets;
import java.util.List;
import java.util.Properties;

import io.quarkus.deployment.annotations.BuildStep;
import io.quarkus.deployment.builditem.ArchiveRootBuildItem;
import io.quarkus.deployment.builditem.substrate.SubstrateOutputBuildItem;
import io.quarkus.deployment.builditem.substrate.SubstrateSystemPropertyBuildItem;

public class SubstrateSystemPropertiesBuildStep {

    @BuildStep
    SubstrateOutputBuildItem writeNativeProps(ArchiveRootBuildItem root,
            List<SubstrateSystemPropertyBuildItem> props) throws Exception {

        final Properties properties = new Properties();
        for (SubstrateSystemPropertyBuildItem i : props) {
            if (!properties.containsKey(i.getKey())) {
                properties.put(i.getKey(), i.getValue());
            } else if (!properties.get(i.getKey()).equals(i.getValue())) {
                throw new RuntimeException("Duplicate native image system property under " + i.getKey()
                        + " conflicting values of " + i.getValue() + " and " + properties.get(i.getKey()));
            }
        }
        try (FileOutputStream os = new FileOutputStream(new File(root.getArchiveRoot().toFile(), "native-image.properties"))) {
            try (OutputStreamWriter osw = new OutputStreamWriter(os, StandardCharsets.UTF_8)) {
                properties.store(osw, "Generated properties (do not edit)");
            }
        }
        return new SubstrateOutputBuildItem();
    }
}

Check both key and value, throw error only if values differ


package org.wikimedia.commons.contributions;

import android.view.View;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;
import org.wikimedia.commons.R;

class ContributionViewHolder {
    final ImageView imageView;
    final TextView titleView;
    final TextView stateView;
    final TextView seqNumView;
    final ProgressBar progressView;

    String url;

    ContributionViewHolder(View parent) {
        imageView = (ImageView)parent.findViewById(R.id.contributionImage);
        titleView = (TextView)parent.findViewById(R.id.contributionTitle);
        stateView = (TextView)parent.findViewById(R.id.contributionState);
        seqNumView = (TextView)parent.findViewById(R.id.contributionSequenceNumber);
        progressView = (ProgressBar)parent.findViewById(R.id.contributionProgress);
    }
}

package org.wikimedia.commons.contributions;

import android.view.View;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;
import org.wikimedia.commons.MediaWikiImageView;
import org.wikimedia.commons.R;

class ContributionViewHolder {
    final MediaWikiImageView imageView;
    final TextView titleView;
    final TextView stateView;
    final TextView seqNumView;
    final ProgressBar progressView;

    String url;

    ContributionViewHolder(View parent) {
        imageView = (MediaWikiImageView) parent.findViewById(R.id.contributionImage);
        titleView = (TextView)parent.findViewById(R.id.contributionTitle);
        stateView = (TextView)parent.findViewById(R.id.contributionState);
        seqNumView = (TextView)parent.findViewById(R.id.contributionSequenceNumber);
        progressView = (ProgressBar)parent.findViewById(R.id.contributionProgress);
    }
}

Make the ImageView to be of the specific type


// You may obtain a copy of the License at
//
//     https://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.google.sps.data;

/**
* This class creates objects that present authentication status
* of the user in order to manipulate the DOM
**/

public final class Login {

  private final boolean status;
  private final String message;

  public Login(boolean status, String message) {
    this.status = status;
    this.message = message;
  }
}

// You may obtain a copy of the License at
//
//     https://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.google.sps.data;

/**
* This class creates objects that present authentication status
* of the user in order to manipulate the DOM
**/

public final class Login {

  private final boolean status;
  private final String message;
  private final String email;

  public Login(boolean status, String message, String email) {
    this.status = status;
    this.message = message;
    this.email = email;
  }
}

Add email feature to the login class.


import java.io.IOException;
import java.net.ServerSocket;
import java.net.SocketException;

/**
 * Created by Xinan on 11/9/15.
 */
public class WebProxy {
  public static void main(String[] args) {
    try {
      int port = Integer.parseInt("1234");
      ServerSocket socket = new ServerSocket(port);
      Runtime.getRuntime().addShutdownHook(new Thread() {
        public void run() {
          try {
            System.out.printf("Server is shutting down...\n");
            socket.close();
          } catch (IOException e) {
            e.printStackTrace();
          }
        }
      });
      System.out.printf("Server listening on %d...\n\n", port);
      while (!socket.isClosed()) {
        (new RequestHandlerThread(socket.accept())).start();
      }
    } catch (SocketException e) {
      System.out.printf("%s\n", e.getMessage());
    } catch (IOException e) {
      e.printStackTrace();
    } catch (IndexOutOfBoundsException | NumberFormatException  e) {
      System.out.printf("Invalid argument!\n");
    }
  }
}

import java.io.IOException;
import java.net.ServerSocket;
import java.net.SocketException;

/**
 * Created by Xinan on 11/9/15.
 */
public class WebProxy {
  public static void main(String[] args) {
    try {
      int port = Integer.parseInt(args[0]);
      ServerSocket socket = new ServerSocket(port);
      Runtime.getRuntime().addShutdownHook(new Thread() {
        public void run() {
          try {
            System.out.printf("Server is shutting down...\n");
            socket.close();
          } catch (IOException e) {
            e.printStackTrace();
          }
        }
      });
      System.out.printf("Server listening on %d...\n\n", port);
      while (!socket.isClosed()) {
        (new RequestHandlerThread(socket.accept())).start();
      }
    } catch (SocketException e) {
      System.out.printf("%s\n", e.getMessage());
    } catch (IOException e) {
      e.printStackTrace();
    } catch (IndexOutOfBoundsException | NumberFormatException  e) {
      System.out.printf("Invalid argument!\n");
    }
  }
}

Use port number from command line argument


package markharder.potatohead;

import javax.swing.JComponent;
import javax.swing.JFrame;

/**
 * A potato head accessorizor
 *
 * @author Mark Harder
 * @version 1.0
 */
public class PotatoHead extends JComponent {
    public static PotatoHead spud;

    public PotatoHead() {
    }

    /**
     * The entrypoint, create the frame, run the game
     *
     * @param args String arguments (unused)
     */
    public static void main(String[] args) {
        spud = new PotatoHead();

        System.out.println(spud);
    }
}

package markharder.potatohead;

import javax.swing.JComponent;
import javax.swing.JFrame;
import java.awt.Graphics;
import java.awt.Color;

/**
 * A potato head accessorizor
 *
 * @author Mark Harder
 * @version 1.0
 */
public class PotatoHead extends JComponent {
    public static PotatoHead spud;

    public PotatoHead() {
    }

    public void paint(Graphics g) {
        g.setColor(new Color(100, 10, 10));
        g.fillRect(0, 0, 480, 600);
    }

    /**
     * The entrypoint, create the frame, run the game
     *
     * @param args String arguments (unused)
     */
    public static void main(String[] args) {
        JFrame frame = new JFrame();
        spud = new PotatoHead();

        // set up the window
        frame.setUndecorated(true);
        frame.add(spud);
        frame.pack();
        frame.setSize(480, 600);
        frame.setResizable(false);
        frame.setLocationRelativeTo(null);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setVisible(true);
    }
}

Set up a basic window


package org.jcodegen.java;

/**
 * ...
 */
public class FunctionArgument {
    private final String name;
    private final String type;
    private final boolean isFinal;

    public FunctionArgument(final String type, final String name) {
        this(type, name, true);
    }

    public FunctionArgument(final String type, final String name, final boolean isFinal) {
        this.type = type;
        this.name = name;
        this.isFinal = isFinal;
    }

    @Override
    public String toString() {
        final StringBuilder buf = new StringBuilder();

        if (isFinal)
            buf.append("final ");
        buf.append(type);
        buf.append(" ");
        buf.append(name);

        return buf.toString();
    }
}

package org.jcodegen.java;

/**
 * ...
 */
public class FunctionArgument {
    private final String name;
    private final String type;
    private final boolean isFinal;

    public FunctionArgument(final String type, final String name) {
        this(type, name, true);
    }

    public FunctionArgument(final String type, final String name, final boolean isFinal) {
        this.type = type;
        this.name = name;
        this.isFinal = isFinal;
    }

    @Override
    public String toString() {
        final StringBuilder buf = new StringBuilder();

        if (isFinal)
            buf.append("final ");
        buf.append(type);
        buf.append(" ");
        buf.append(name);

        return buf.toString();
    }

    public String getName() {
        return name;
    }

    public String getType() {
        return type;
    }

    public boolean isFinal() {
        return isFinal;
    }
}

Add getters for constructor parameters


package de.linkvt.bachelor.features.properties;

import de.linkvt.bachelor.features.Feature;

import org.semanticweb.owlapi.model.OWLClass;
import org.semanticweb.owlapi.model.OWLObjectProperty;
import org.springframework.stereotype.Component;

/**
 * An owl functional property.
 */
@Component
public class OwlInverseOfPropertyFeature extends Feature {
  @Override
  public void addToOntology() {
    OWLClass domain = featurePool.getReusableClass();
    OWLClass range = featurePool.getExclusiveClass("Child");

    OWLObjectProperty property = featurePool.getExclusiveProperty("hasChild");
    addProperty(property, domain, range);

    OWLObjectProperty inverseProperty = featurePool.getExclusiveProperty("hasParent");
    addProperty(property, range, domain);

    addAxiomToOntology(factory.getOWLInverseObjectPropertiesAxiom(property, inverseProperty));
  }

  @Override
  public String getName() {
    return "owl:inverseOf";
  }

  @Override
  public String getToken() {
    return "inverseprop";
  }
}

package de.linkvt.bachelor.features.properties;

import de.linkvt.bachelor.features.Feature;

import org.semanticweb.owlapi.model.OWLClass;
import org.semanticweb.owlapi.model.OWLObjectProperty;
import org.springframework.stereotype.Component;

/**
 * An owl functional property.
 */
@Component
public class OwlInverseOfPropertyFeature extends Feature {
  @Override
  public void addToOntology() {
    OWLClass domain = featurePool.getReusableClass();
    OWLClass range = featurePool.getExclusiveClass("Child");

    OWLObjectProperty property = featurePool.getExclusiveProperty("hasChild");
    addProperty(property, domain, range);

    OWLObjectProperty inverseProperty = featurePool.getExclusiveProperty("hasParent");
    addProperty(inverseProperty, range, domain);

    addAxiomToOntology(factory.getOWLInverseObjectPropertiesAxiom(property, inverseProperty));
  }

  @Override
  public String getName() {
    return "owl:inverseOf";
  }

  @Override
  public String getToken() {
    return "inverseprop";
  }
}

Fix setting wrong property on owl:inverseProperty


package com.sometrik.framework;

import com.sometrik.formtest.R;

import android.content.Context;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.Button;

public class FWButton extends Button implements NativeCommandHandler {

  FrameWork frame;

  public FWButton(FrameWork frameWork) {
    super(frameWork);
    this.frame = frameWork;

  }

  @Override
  public void addChild(View view) {
    System.out.println("FWButton couldn't handle command");
  }

  @Override
  public void removeChild(int id) {
    System.out.println("FWButton couldn't handle command");
  }

  @Override
  public void addOption(int optionId, String text) {
    System.out.println("FWButton couldn't handle command");
  }

  @Override
  public void setValue(String v) {
    setText(v);
    //FIXME Debug animation
    Animation shake = AnimationUtils.loadAnimation(frame, R.anim.shake);
    startAnimation(shake);
  }

  @Override
  public void setValue(int v) {
    System.out.println("FWButton couldn't handle command");
  }

  @Override
  public int getElementId() {
    return getId();
  }

  @Override
  public void setEnabled(Boolean enabled) {
    System.out.println("FWButton couldn't handle command");
  }

}

package com.sometrik.framework;

import com.sometrik.formtest.R;

import android.content.Context;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.view.animation.RotateAnimation;
import android.widget.Button;

public class FWButton extends Button implements NativeCommandHandler {

  FrameWork frame;

  public FWButton(FrameWork frameWork) {
    super(frameWork);
    this.frame = frameWork;

  }

  @Override
  public void addChild(View view) {
    System.out.println("FWButton couldn't handle command");
  }

  @Override
  public void removeChild(int id) {
    System.out.println("FWButton couldn't handle command");
  }

  @Override
  public void addOption(int optionId, String text) {
    System.out.println("FWButton couldn't handle command");
  }

  @Override
  public void setValue(String v) {
    setText(v);
    //FIXME Debug animation
    RotateAnimation r = new RotateAnimation(-5f, 5f,50,50);
    r.setDuration(100);
    r.setRepeatCount(10);
    r.setRepeatMode(RotateAnimation.REVERSE);
    startAnimation(r);
  }

  @Override
  public void setValue(int v) {
    System.out.println("FWButton couldn't handle command");
  }

  @Override
  public int getElementId() {
    return getId();
  }

  @Override
  public void setEnabled(Boolean enabled) {
    System.out.println("FWButton couldn't handle command");
  }

}

Change debug animation to programmatic


/**
 * Generated by Mavanagaiata ${MAVANAGAIATA_VERSION} at ${TIMESTAMP}
 */

package ${PACKAGE_NAME};

public final class ${CLASS_NAME} {

    public static final String COMMIT_ABBREV = "${COMMIT_ABBREV}";

    public static final String COMMIT_SHA = "${COMMIT_SHA}";

    public static final String DESCRIBE = "${DESCRIBE}";

    public static final boolean DIRTY = ${DIRTY};

    public static final String TAG = "${TAG_NAME}";

    public static final String VERSION = "${VERSION}";

    public static String getVersion() {
        if (TAG.equals(VERSION) && TAG.equals(DESCRIBE)) {
            return TAG;
        }

        return String.format("%s (%s)", VERSION, DESCRIBE);
    }

}

/**
 * Generated by Mavanagaiata ${MAVANAGAIATA_VERSION} at ${TIMESTAMP}
 */

package ${PACKAGE_NAME};

public final class ${CLASS_NAME} {

    public static final String BRANCH = "${BRANCH}";

    public static final String COMMIT_ABBREV = "${COMMIT_ABBREV}";

    public static final String COMMIT_SHA = "${COMMIT_SHA}";

    public static final String DESCRIBE = "${DESCRIBE}";

    public static final boolean DIRTY = ${DIRTY};

    public static final String TAG = "${TAG_NAME}";

    public static final String VERSION = "${VERSION}";

    public static String getVersion() {
        if (TAG.equals(VERSION) && TAG.equals(DESCRIBE)) {
            return TAG;
        }

        return String.format("%s (%s)", VERSION, DESCRIBE);
    }

}

Use the BRANCH property in the built-in class template


package com.yahoo.document.restapi;

import com.yahoo.application.Application;
import com.yahoo.application.Networking;
import org.junit.Test;

/**
 * @author bratseth
 */
public class DocumentApiApplicationTest {

    /** Test that it is possible to instantiate an Application with a document-api */
    @Test
    public void application_with_document_api() {
        String services =
                "<container version='1.0'>" +
                "    <document-api/>" +
                "</container>";
        try (Application application = Application.fromServicesXml(services, Networking.enable)) {
        }
    }

}

package com.yahoo.document.restapi;

import com.yahoo.application.Application;
import com.yahoo.application.Networking;
import org.junit.Test;

import java.io.IOException;
import java.net.ServerSocket;

/**
 * @author bratseth
 */
public class DocumentApiApplicationTest {

    /** Test that it is possible to instantiate an Application with a document-api */
    @Test
    public void application_with_document_api() throws IOException {
        String services =
                "<jdisc version='1.0'>" +
                "    <http><server port=\"" + findRandomOpenPortOnAllLocalInterfaces() + "\" id=\"foobar\"/></http>" +
                "    <document-api/>" +
                "</jdisc>";
        try (Application application = Application.fromServicesXml(services, Networking.enable)) {
        }
    }

    private int findRandomOpenPortOnAllLocalInterfaces() throws IOException {
           return new ServerSocket(0).getLocalPort();
    }
}

Make test not require port 4080 to be available.


package aya;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Stack;

import aya.instruction.variable.GetVariableInstruction;

/**
 * Utility class for tracing function calls during Aya execution
 * @author npaul
 *
 */
public class CallStack {
	private Stack<GetVariableInstruction> _stack;

	public CallStack() {
		_stack = new Stack<GetVariableInstruction>();
	}

	public void push(GetVariableInstruction var) {
		_stack.push(var);
	}

	public void pop() {
		_stack.pop();
	}

	public void reset() {
		_stack.clear();
	}

	public String toString() {
		StringBuilder sb = new StringBuilder("Function call traceback:\n  Error ");
		ArrayList<GetVariableInstruction> stack_list = new ArrayList<GetVariableInstruction>(_stack.size());
		for (GetVariableInstruction l : _stack) stack_list.add(l);
		Collections.reverse(stack_list);
		for (GetVariableInstruction l : stack_list)
		{
			sb.append("in: ");
			sb.append(l.toString());
			sb.append("\n  ");
		}
		return sb.toString();
	}

	public boolean isEmpty() {
		return _stack.isEmpty();
	}
}

package aya;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Stack;

import aya.instruction.variable.GetVariableInstruction;

/**
 * Utility class for tracing function calls during Aya execution
 * @author npaul
 *
 */
public class CallStack {
	private Stack<GetVariableInstruction> _stack;

	public CallStack() {
		_stack = new Stack<GetVariableInstruction>();
	}

	public void push(GetVariableInstruction var) {
		_stack.push(var);
	}

	public void pop() {
		_stack.pop();
	}

	public void reset() {
		_stack.clear();
	}

	public String toString() {
		StringBuilder sb = new StringBuilder("Function call traceback:\n  Error ");
		ArrayList<GetVariableInstruction> stack_list = new ArrayList<GetVariableInstruction>(_stack.size());
		for (GetVariableInstruction l : _stack) stack_list.add(l);
		Collections.reverse(stack_list);
		for (GetVariableInstruction l : stack_list)
		{
			sb.append("in: ");
			sb.append(l.toString());
			sb.append("\n  ");
		}
		sb.append("\n");
		return sb.toString();
	}

	public boolean isEmpty() {
		return _stack.isEmpty();
	}
}

Fix extra spaces after callstack print