/*
 * (c) Copyright 2014 Hewlett-Packard Development Company, L.P.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Apache License v2.0 which accompany this distribution.
 *
 * The Apache License is available at
 * http://www.apache.org/licenses/LICENSE-2.0
 */
package org.openscore.lang.compiler;

import org.openscore.lang.compiler.modeller.model.Executable;
import org.openscore.lang.entities.CompilationArtifact;

import java.io.Serializable;
import java.util.Map;
import java.util.Set;

//todo: Eliya - add JavaDoc
public interface SlangCompiler {

    CompilationArtifact compile(SlangSource source, Set<SlangSource> path);

    /**
     * Pre-compile a Slang file into a list of Executables
     * @param source the slang source file
     * @return a list of Executable objects, containing either a flow or a list of all the operations in the file
     */
    Executable preCompile(SlangSource source);

    /**
     * Load system property sources written in slang and map them to fully qualified names
     * @param sources the slang sources containing the system properties
     * @return map containing all of the system properties with fully qualified keys
     */
    Map<String, ? extends Serializable> loadSystemProperties(SlangSource... sources);

}

/*
 * (c) Copyright 2014 Hewlett-Packard Development Company, L.P.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Apache License v2.0 which accompany this distribution.
 *
 * The Apache License is available at
 * http://www.apache.org/licenses/LICENSE-2.0
 */
package org.openscore.lang.compiler;

import org.openscore.lang.compiler.modeller.model.Executable;
import org.openscore.lang.entities.CompilationArtifact;

import java.io.Serializable;
import java.util.Map;
import java.util.Set;

public interface SlangCompiler {

    /**
     * Compile a Slang source & its path to a CompilationArtifact object
     * @param source the slang source file
     * @param path a set of slang sources containing the source dependencies
     * @return the compiled CompilationArtifact
     */
    CompilationArtifact compile(SlangSource source, Set<SlangSource> path);

    /**
     * Pre-compile a Slang source into an Executable
     * @param source the slang source file
     * @return an Executable object, containing either a flow or operation in the file.
     *          Returns null if the source contains Slang system properties
     */
    Executable preCompile(SlangSource source);

    /**
     * Load system property sources written in slang and map them to fully qualified names
     * @param sources the slang sources containing the system properties
     * @return map containing all of the system properties with fully qualified keys
     */
    Map<String, ? extends Serializable> loadSystemProperties(SlangSource... sources);

}

Add & update Java Docs

Add & update Java Docs

Signed-off-by: Orit Stone <530a3c863b274210fbf305df5a70e325b4dbcb5a@hp.com>


package com.usepropeller.routable;

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;

public class RouterActivity extends Activity {
	@Override
	public void onCreate(Bundle savedInstanceState) {
	    super.onCreate(savedInstanceState);

	    Intent intent = getIntent();
	    String url;

	    Bundle extras = intent.getExtras();
	    if (extras.containsKey("url")) {
	    	url = extras.getString("url");
	    }
	    else {
		    Uri data = intent.getData();
		    url = data.getPath();
		    if (url.startsWith("/")) {
		    	url = url.substring(1);
		    }
		    if (Router.sharedRouter().getRootUrl() != null) {
			    Router.sharedRouter().open(Router.sharedRouter().getRootUrl());
		    }
	    }

	    Router.sharedRouter().open(url);

	    setResult(RESULT_OK, null);
	    finish();
	}
}

package com.usepropeller.routable;

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;

public class RouterActivity extends Activity {
	@Override
	public void onCreate(Bundle savedInstanceState) {
	    super.onCreate(savedInstanceState);

	    Intent intent = getIntent();
	    String url;

	    Bundle extras = intent.getExtras();
	    if (extras.containsKey("url")) {
	    	url = extras.getString("url");
	    }
	    else {
		    Uri data = intent.getData();
		    String protocol = data.getScheme() + "://";
		    url = data.toString().replaceFirst(protocol, "");
		    if (Router.sharedRouter().getRootUrl() != null) {
			    Router.sharedRouter().open(Router.sharedRouter().getRootUrl());
		    }
	    }

	    Router.sharedRouter().open(url);

	    setResult(RESULT_OK, null);
	    finish();
	}
}

Change protocol format to use the FULL url instead of just the path


package edu.usc.glidein.service.impl;

import java.rmi.RemoteException;

import org.apache.axis.message.addressing.EndpointReferenceType;
import org.globus.wsrf.ResourceContext;

import edu.usc.glidein.stubs.types.EmptyObject;
import edu.usc.glidein.stubs.types.Site;

public class SiteService
{
	private SiteResource getResource() throws RemoteException
	{
		try {
			return (SiteResource) ResourceContext.getResourceContext().getResource();
		} catch (Exception e) {
			throw new RemoteException("Unable to find site resource", e);
		}
	}

	public Site getSite(EmptyObject empty) throws RemoteException
	{
		return getResource().getSite();
	}

	public EmptyObject submit(EndpointReferenceType credential) throws RemoteException
	{
		getResource().submit(credential);
		return new EmptyObject();
	}

	public EmptyObject remove(boolean force) throws RemoteException
	{
		getResource().remove(force);
		return new EmptyObject();
	}
}

package edu.usc.glidein.service.impl;

import java.rmi.RemoteException;

import org.apache.axis.message.addressing.EndpointReferenceType;
import org.globus.wsrf.ResourceContext;

import edu.usc.glidein.stubs.RemoveRequest;
import edu.usc.glidein.stubs.types.EmptyObject;
import edu.usc.glidein.stubs.types.Site;

public class SiteService
{
	private SiteResource getResource() throws RemoteException
	{
		try {
			return (SiteResource) ResourceContext.getResourceContext().getResource();
		} catch (Exception e) {
			throw new RemoteException("Unable to find site resource", e);
		}
	}

	public Site getSite(EmptyObject empty) throws RemoteException
	{
		return getResource().getSite();
	}

	public EmptyObject submit(EndpointReferenceType credential) throws RemoteException
	{
		getResource().submit(credential);
		return new EmptyObject();
	}

	public EmptyObject remove(RemoveRequest request) throws RemoteException
	{
		boolean force = request.isForce();
		EndpointReferenceType credential = request.getCredential();
		getResource().remove(force,credential);
		return new EmptyObject();
	}
}

Add delegated credential to remove operation

git-svn-id: bdb5f82b9b83a1400e05d69d262344b821646179@1376 e217846f-e12e-0410-a4e5-89ccaea66ff7


package com.socrata.ssync;

import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.io.*;

public class PatchBuilder {
    private final OutputStreamWriteHelper out;
    private final int maxDataBlockSize;

    // Does NOT take ownership of the outputstream!
    public PatchBuilder(OutputStream outStream, String checksumAlgorithm, int blockSize) throws IOException, NoSuchAlgorithmException {
        this.out = new OutputStreamWriteHelper(outStream, MessageDigest.getInstance(checksumAlgorithm));

        if(blockSize <= 0 || blockSize >= Patch.MaxBlockSize)
            throw new IllegalArgumentException("blockSize");
        this.maxDataBlockSize = blockSize * 2;

        out.writeCheckumNameWithoutUpdatingChecksum();
        out.writeInt(blockSize);
    }

    public void writeEnd() throws IOException {
        writeOp(Patch.End);
        out.writeChecksumWithoutUpdatingChecksum();
    }

    public void writeBlockNum(int blockNum) throws IOException {
        writeOp(Patch.Block);
        out.writeInt(blockNum);
    }

    public void writeData(byte[] data) throws IOException {
        writeData(data, 0, data.length);
    }

    public void writeData(byte[] data, int offset, int length) throws IOException {
        while(length != 0) {
            writeOp(Patch.Data);
            int toWrite = Math.min(length, maxDataBlockSize);
            out.writeInt(toWrite);
            out.writeBytes(data, offset, toWrite);
            length -= toWrite;
            offset += toWrite;
        }
    }

    private void writeOp(int op) throws IOException {
        out.writeByte(op);
    }
}

package com.socrata.ssync;

import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.io.*;

public class PatchBuilder {
    private final OutputStreamWriteHelper out;
    private final int blockSize;

    // Does NOT take ownership of the outputstream!
    public PatchBuilder(OutputStream outStream, String checksumAlgorithm, int blockSize) throws IOException, NoSuchAlgorithmException {
        this.out = new OutputStreamWriteHelper(outStream, MessageDigest.getInstance(checksumAlgorithm));

        if(blockSize <= 0 || blockSize >= Patch.MaxBlockSize)
            throw new IllegalArgumentException("blockSize");
        this.blockSize = blockSize;

        out.writeCheckumNameWithoutUpdatingChecksum();
        out.writeInt(blockSize);
    }

    public void writeEnd() throws IOException {
        writeOp(Patch.End);
        out.writeChecksumWithoutUpdatingChecksum();
    }

    public void writeBlockNum(int blockNum) throws IOException {
        writeOp(Patch.Block);
        out.writeInt(blockNum);
    }

    public void writeData(byte[] data) throws IOException {
        writeData(data, 0, data.length);
    }

    public void writeData(byte[] data, int offset, int length) throws IOException {
        while(length != 0) {
            writeOp(Patch.Data);
            int toWrite = Math.min(length, blockSize);
            out.writeInt(toWrite);
            out.writeBytes(data, offset, toWrite);
            length -= toWrite;
            offset += toWrite;
        }
    }

    private void writeOp(int op) throws IOException {
        out.writeByte(op);
    }
}

Remove one last vestage of compressed data chunks

We used to allow data chunks to be up to twice the size of the block
size to allow for incompressible chunks.  Since compression is gone,
so can that be.


package com.bbn.bue.common.primitives;

import org.junit.Test;

import static org.junit.Assert.assertEquals;

/**
 * Created by rgabbard on 1/25/16.
 */
public class DoubleUtilsTest {

  private static final double EPSILON = 1e-6;

  @Test(expected = IllegalArgumentException.class)
  public void testBadBounds() {
    DoubleUtils.clip(2.0, -1.0);
  }

  @Test
  public void testClipping() {
    assertEquals(-2.0, DoubleUtils.clip(-5.0, 2.0), EPSILON);
    assertEquals(2.0, DoubleUtils.clip(5.0, 2.0), EPSILON);
    assertEquals(1.0, DoubleUtils.clip(1.0, 2.0), EPSILON);
  }
}

package com.bbn.bue.common.primitives;

import org.junit.Test;

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

/**
 * Created by rgabbard on 1/25/16.
 */
public class DoubleUtilsTest {

  private static final double EPSILON = 1e-6;

  @Test(expected = IllegalArgumentException.class)
  public void testBadBounds() {
    DoubleUtils.clip(2.0, -1.0);
  }

  @Test
  public void testClipping() {
    assertEquals(-2.0, DoubleUtils.clip(-5.0, 2.0), EPSILON);
    assertEquals(2.0, DoubleUtils.clip(5.0, 2.0), EPSILON);
    assertEquals(1.0, DoubleUtils.clip(1.0, 2.0), EPSILON);
    assertEquals(-2.0, DoubleUtils.clip(Double.NEGATIVE_INFINITY, 2.0), EPSILON);
    assertEquals(2.0, DoubleUtils.clip(Double.POSITIVE_INFINITY, 2.0), EPSILON);
    assertTrue(Double.isNaN(DoubleUtils.clip(Double.NaN, 2.0)));
  }

}

Add clipping test cases for infinities and NaN


package fr.openwide.core.jpa.more.business.search.query;

import java.util.List;
import java.util.Map;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import org.springframework.transaction.annotation.Transactional;

import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;

import fr.openwide.core.jpa.more.business.sort.ISort;
import fr.openwide.core.jpa.more.business.sort.ISort.SortOrder;

public abstract class AbstractSearchQuery<T, S extends ISort<?>> implements ISearchQuery<T, S> /* NOT Serializable */ {

	@PersistenceContext
	protected EntityManager entityManager;

	protected List<S> defaultSorts;
	protected Map<S, SortOrder> sortMap;

	@SafeVarargs
	protected AbstractSearchQuery(S ... defaultSorts) {
		this.defaultSorts = ImmutableList.copyOf(defaultSorts);
	}

	// Sort
	@Override
	public ISearchQuery<T, S> sort(Map<S, SortOrder> sortMap) {
		this.sortMap = ImmutableMap.copyOf(sortMap);
		return this;
	}

	// May be overridden for performance purposes
	@Override
	@Transactional(readOnly = true)
	public List<T> fullList() {
		return list(0, Long.MAX_VALUE);
	}
}

package fr.openwide.core.jpa.more.business.search.query;

import java.util.List;
import java.util.Map;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;

import fr.openwide.core.jpa.more.business.sort.ISort;
import fr.openwide.core.jpa.more.business.sort.ISort.SortOrder;

public abstract class AbstractSearchQuery<T, S extends ISort<?>> implements ISearchQuery<T, S> /* NOT Serializable */ {

	@PersistenceContext
	protected EntityManager entityManager;

	protected List<S> defaultSorts;
	protected Map<S, SortOrder> sortMap;

	@SafeVarargs
	protected AbstractSearchQuery(S ... defaultSorts) {
		this.defaultSorts = ImmutableList.copyOf(defaultSorts);
	}

	// Sort
	@Override
	public ISearchQuery<T, S> sort(Map<S, SortOrder> sortMap) {
		this.sortMap = ImmutableMap.copyOf(sortMap);
		return this;
	}
}

Remove default implementation of fullList()

Using a limit of Long.MAX_VALUE can degrade performances


package io.gravitee.am.gateway.handler.oauth2.userdetails;

import org.springframework.security.core.userdetails.User;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;

import java.util.Collections;

/**
 * @author David BRASSELY (david.brassely at graviteesource.com)
 * @author GraviteeSource Team
 */
public class CustomUserDetailsService implements UserDetailsService {

    @Override
    public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
        return new User("toto", "password", Collections.emptyList());
    }
}

package io.gravitee.am.gateway.handler.oauth2.userdetails;

import org.springframework.security.core.userdetails.User;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;

import java.util.Collections;

/**
 * @author David BRASSELY (david.brassely at graviteesource.com)
 * @author GraviteeSource Team
 */
public class CustomUserDetailsService implements UserDetailsService {

    @Override
    public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
        return new User(username, "password", Collections.emptyList());
    }
}

Use same username for userDetails

fix(oauth2): Use same username for userDetails


/*
 * See the NOTICE file distributed with this work for additional
 * information regarding copyright ownership.
 *
 * This is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this software; if not, write to the Free
 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
 */
package org.xwiki.rendering.transformation.linkchecker;

import org.xwiki.component.annotation.ComponentRole;

/**
 * Configuration options for the Link Checker Transformation.
 *
 * @version $Id$
 * @since 3.3M2
 */
@ComponentRole
public interface LinkCheckerTransformationConfiguration
{
    /**
     * @return the amount of time (in ms) after which a link should be rechecked for validity
     */
    long getCheckTimeout();

    /**
     * @param checkTimeout the time after which a link should be checked again for validity
     */
    public void setCheckTimeout(long checkTimeout);
}

/*
 * See the NOTICE file distributed with this work for additional
 * information regarding copyright ownership.
 *
 * This is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this software; if not, write to the Free
 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
 */
package org.xwiki.rendering.transformation.linkchecker;

import org.xwiki.component.annotation.ComponentRole;

/**
 * Configuration options for the Link Checker Transformation.
 *
 * @version $Id$
 * @since 3.3M2
 */
@ComponentRole
public interface LinkCheckerTransformationConfiguration
{
    /**
     * @return the amount of time (in ms) after which a link should be rechecked for validity
     */
    long getCheckTimeout();

    /**
     * @param checkTimeout the time after which a link should be checked again for validity
     */
    void setCheckTimeout(long checkTimeout);
}

XRENDERING-154: Create a Transformation to check broken external links
* Fix checkstyle error


/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you 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.apache.felix.framework.util;

import java.util.Enumeration;
import java.util.Iterator;

public class IteratorToEnumeration implements Enumeration
{
    private Iterator m_iter = null;

    public IteratorToEnumeration(Iterator iter)
    {
        m_iter = iter;
    }

    public boolean hasMoreElements()
    {
        if (m_iter == null)
            return false;
        return m_iter.hasNext();
    }

    public Object nextElement()
    {
        if (m_iter == null)
            return null;
        return m_iter.next();
    }
}

/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you 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.apache.felix.framework.util;

import java.util.Enumeration;
import java.util.Iterator;

public class IteratorToEnumeration implements Enumeration
{
    private final Iterator m_iter;

    public IteratorToEnumeration(Iterator iter)
    {
        m_iter = iter;
    }

    public boolean hasMoreElements()
    {
        if (m_iter == null)
            return false;
        return m_iter.hasNext();
    }

    public Object nextElement()
    {
        if (m_iter == null)
            return null;
        return m_iter.next();
    }
}

Make iterator member final to prevent visibility issues.

git-svn-id: e057f57e93a604d3b43d277ae69bde5ebf332112@618089 13f79535-47bb-0310-9956-ffa450edef68


package net.imagej.ops.viewOp;

import net.imagej.ops.Computer;
import net.imagej.ops.ViewOps.View;

public interface DefaultView<I, O> extends View, Computer<I, O> {
	// NB: Marker interface
}

package net.imagej.ops.viewOp;

import net.imagej.ops.view.ViewOps;
import net.imagej.ops.view.ViewOps.View;
import net.imglib2.Interval;
import net.imglib2.RandomAccessible;
import net.imglib2.view.IntervalView;
import net.imglib2.view.Views;

import org.scijava.ItemIO;
import org.scijava.plugin.Parameter;
import org.scijava.plugin.Plugin;

@Plugin(type = ViewOps.View.class, name = ViewOps.View.NAME)
public class DefaultView<T>
		extends
		AbstractView<RandomAccessible< T >, IntervalView< T >>
		implements
		View<RandomAccessible< T >, IntervalView< T >> {

	@Parameter(type = ItemIO.INPUT)
	private Interval interval;

	@Override
	public IntervalView< T > compute(RandomAccessible< T > input) {
		return Views.interval(input, interval);
	}

}

Add default implementation of View interface.


package python;

public interface Platform {
    /**
     * Return the number of CPU nanoseconds that this thread has consumed.
     */
    public long clock();

    public void debug(java.lang.String msg);

    public void debug(java.lang.String msg, java.lang.Object obj);

    public org.python.Object getPlatform();

    public org.python.Object stderr();

    public org.python.Object stdout();

    public org.python.Object stdin();

    public org.python.Object args();
}

Fix one last file with missing eof newline


package com.grayben.riskExtractor.headingMarker.elector;

import java.util.List;

import com.grayben.riskExtractor.headingMarker.TextCandidate;
import com.grayben.riskExtractor.headingMarker.nominator.NomineesRetrievable;

public class ElectedTextList implements
	NomineesRetrievable,
	ElecteesRetrievable {

	List<String> textList;

    public List<String> getTextList() {
        return textList;
    }

    public void setTextList(List<String> textList) {
        this.textList = textList;
    }

	List<TextCandidate> nominees;

    @Override
    public List<TextCandidate> getNominees() {
        // TODO Auto-generated method stub
        return null;
    }

    public void setNominees(List<TextCandidate> nominees) {
        this.nominees = nominees;
    }

    List<TextCandidate> electees;

    @Override
    public List<TextCandidate> getElectees() {
        // TODO Auto-generated method stub
        return null;
    }

    public void setElectees(List<TextCandidate> electees) {
        this.electees = electees;
    }

	public ElectedTextList(List<String> textList, List<TextCandidate> nominees, List<TextCandidate> electees){
		super();
		this.textList = textList;
		this.nominees = nominees;
		this.electees = electees;
	}

}

package com.grayben.riskExtractor.headingMarker.elector;

import java.util.List;

import com.grayben.riskExtractor.headingMarker.TextCandidate;
import com.grayben.riskExtractor.headingMarker.nominator.NomineesRetrievable;

public class ElectedTextList implements
	NomineesRetrievable,
	ElecteesRetrievable {

	List<String> textList;

    public List<String> getTextList() {
        return textList;
    }

    public void setTextList(List<String> textList) {
        this.textList = textList;
    }

	List<TextCandidate> nominees;

    @Override
    public List<TextCandidate> getNominees() {
        // TODO Auto-generated method stub
        return this.nominees;
    }

    public void setNominees(List<TextCandidate> nominees) {
        this.nominees = nominees;
    }

    List<TextCandidate> electees;

    @Override
    public List<TextCandidate> getElectees() {
        // TODO Auto-generated method stub
        return this.electees;
    }

    public void setElectees(List<TextCandidate> electees) {
        this.electees = electees;
    }

	public ElectedTextList(List<String> textList, List<TextCandidate> nominees, List<TextCandidate> electees){
		super();
		this.textList = textList;
		this.nominees = nominees;
		this.electees = electees;
	}

}

Fix accessors to pass unit tests

Fix accessors to pass unit tests


package nom.bdezonia.zorbage.type.data.universal;

public interface InternalRepresentation {

	void setInternalRep(TensorOctonionRepresentation rep);
	void setSelf(TensorOctonionRepresentation rep);

}

/*
 * Zorbage: an algebraic data hierarchy for use in numeric processing.
 *
 * Copyright (C) 2016-2017 Barry DeZonia
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * 1. Redistributions of source code must retain the above copyright notice,
 *    this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright notice,
 *    this list of conditions and the following disclaimer in the documentation
 *    and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */
package nom.bdezonia.zorbage.type.data.universal;

/**
 *
 * @author Barry DeZonia
 *
 */
public interface InternalRepresentation {

	void setInternalRep(TensorOctonionRepresentation rep);
	void setSelf(TensorOctonionRepresentation rep);

}

Add a header to a file that needs it

Add a header to a file that needs it


import javafx.application.Application;
import javafx.scene.control.Alert;
import javafx.scene.control.ButtonType;
import javafx.stage.Stage;
import model.ModelDatabase;
import view.View;

/**
 * Created by Thagus on 01/09/16.
 */
public class Main extends Application{
    private Stage window;
    private ModelDatabase db;

    public static void main(String[] args){
        launch(args);
    }

    @Override
    public void start(Stage primaryStage) throws Exception {
        this.window = primaryStage;
        db = ModelDatabase.instance();

        window.setOnCloseRequest(e -> {
            e.consume();
            closeProgram();
        });

        View view = new View();
        view.start(window);
    }

    private void closeProgram(){
        Alert alert = new Alert(Alert.AlertType.CONFIRMATION, "Are you sure you want to quit?", ButtonType.YES, ButtonType.NO, ButtonType.CANCEL);
        alert.setTitle("Exit");
        alert.setHeaderText(null);

        alert.showAndWait();

        if (alert.getResult() == ButtonType.YES){
            db.close();
            window.close();
        }
    }
}

import javafx.application.Application;
import javafx.scene.control.Alert;
import javafx.scene.control.ButtonType;
import javafx.stage.Stage;
import model.ModelDatabase;
import view.View;

/**
 * Created by Thagus on 01/09/16.
 */
public class Main extends Application{
    private Stage window;
    private ModelDatabase db;

    public static void main(String[] args){
        launch(args);
    }

    @Override
    public void start(Stage primaryStage) throws Exception {
        this.window = primaryStage;
        db = ModelDatabase.instance();

        window.setOnCloseRequest(e -> {
            e.consume();
            closeProgram();
        });

        View view = new View();
        view.start(window);
    }

    private void closeProgram(){
        Alert alert = new Alert(Alert.AlertType.CONFIRMATION, "Are you sure you want to quit?", ButtonType.YES, ButtonType.NO, ButtonType.CANCEL);
        alert.setTitle("Exit");
        alert.setHeaderText(null);

        alert.showAndWait();

        if (alert.getResult() == ButtonType.YES){
            db.close();
            window.close();
            System.exit(0);
        }
    }
}

Exit whole system when closing main window


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

public class RevokeUserTokensRequest {

    private String userId;

    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

}

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

public class RevokeUserTokensRequest {

    private String user_id;

    public String getUser_id() {
        return user_id;
    }

    public void setUser_id(String userId) {
        this.user_id = userId;
    }

}

Change the field name so the serialized field name matches the one the server expects


package de.meldanor.VaadinChart.charts;

import java.util.Collection;

import com.vaadin.annotations.JavaScript;

@JavaScript("circlechart_connector.min.js")
public abstract class CircleChart extends Chart {

    private static final long serialVersionUID = 6506866186112698558L;

    protected CircleChart() {
        // For serialization
        this("pie");
    }

    public CircleChart(final String type) {
        getState(false).setType(type);
    }

    public String getType() {
        return getState(false).getType();
    }

    @Override
    protected CircleChartState getState() {
        return (CircleChartState) super.getState();
    }

    @Override
    protected CircleChartState getState(boolean markAsDirty) {
        return (CircleChartState) super.getState(markAsDirty);
    }

    public void addDataSeries(CircleDataSeries series) {
        getState().getSeries().add(series);
    }

    public void addDataSeries(Collection<CircleDataSeries> series) {
        getState().getSeries().addAll(series);
//        CircleChartState state = getState(false);
//        series.forEach(s -> state.getSeries().put(s.getLabel(), s));
//        markAsDirty();
    }
}

package de.meldanor.VaadinChart.charts;

import java.util.Collection;

import com.vaadin.annotations.JavaScript;

@JavaScript("circlechart_connector.min.js")
public abstract class CircleChart extends Chart {

    private static final long serialVersionUID = 6506866186112698558L;

    protected CircleChart() {
        // For serialization
        this("pie");
    }

    public CircleChart(final String type) {
        getState(false).setType(type);
    }

    public String getType() {
        return getState(false).getType();
    }

    @Override
    protected CircleChartState getState() {
        return (CircleChartState) super.getState();
    }

    @Override
    protected CircleChartState getState(boolean markAsDirty) {
        return (CircleChartState) super.getState(markAsDirty);
    }

    public void addDataSeries(CircleDataSeries series) {
        getState().getSeries().add(series);
    }

    public void addDataSeries(Collection<CircleDataSeries> series) {
        getState().getSeries().addAll(series);
    }

    public void removeDataSeries(String label) {
        getState().getSeries().removeIf(s -> s.getLabel().equals(label));
    }
}

Add missing remove function for series

Add missing remove function for series


/*
 * Copyright (c) 2000-2018 TeamDev Ltd. All rights reserved.
 * TeamDev PROPRIETARY and CONFIDENTIAL.
 * Use is subject to license terms.
 */

package io.spine.web.firebase;

import io.spine.web.QueryProcessingResult;

import javax.servlet.ServletResponse;
import java.io.IOException;

/**
 * A result of a query processed by a {@link FirebaseQueryBridge}.
 *
 * <p>This result represents a database path to the requested data.
 * See {@link FirebaseQueryBridge} for more details.
 *
 * @author Dmytro Dashenkov
 */
final class FirebaseQueryProcessingResult implements QueryProcessingResult {

    private static final String MIME_TYPE = "text/plain";

    private final FirebaseDatabasePath path;

    FirebaseQueryProcessingResult(FirebaseDatabasePath path) {
        this.path = path;
    }

    @Override
    public void writeTo(ServletResponse response) throws IOException {
        final String databaseUrl = path.toString();
        response.getWriter().append(databaseUrl);
        response.setContentType(MIME_TYPE);
    }

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

/*
 * Copyright (c) 2000-2018 TeamDev Ltd. All rights reserved.
 * TeamDev PROPRIETARY and CONFIDENTIAL.
 * Use is subject to license terms.
 */

package io.spine.web.firebase;

import io.spine.web.QueryProcessingResult;

import javax.servlet.ServletResponse;
import java.io.IOException;

/**
 * A result of a query processed by a {@link FirebaseQueryBridge}.
 *
 * <p>This result represents a database path to the requested data.
 * See {@link FirebaseQueryBridge} for more details.
 *
 * @author Dmytro Dashenkov
 */
final class FirebaseQueryProcessingResult implements QueryProcessingResult {

    private static final String MIME_TYPE = "text/plain";

    private final FirebaseDatabasePath path;

    FirebaseQueryProcessingResult(FirebaseDatabasePath path) {
        this.path = path;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public void writeTo(ServletResponse response) throws IOException {
        final String databaseUrl = path.toString();
        response.getWriter().append(databaseUrl);
        response.setContentType(MIME_TYPE);
    }

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

Add a formal doc for an overridden method.


package kurs.zadania.adressbook.appmanager;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;

public class NavigationHelper extends HelperBase{

  public NavigationHelper(WebDriver wd) {
    super(wd);
  }

 // public void gotoGroupPage() { click(By.linkText("groups")); }

/* sprawdzanie elementu na stronie i przejście po linku - wariant 1
  public void gotoGroupPage() {
    if (!isElementPresent(By.tagName("h1"))
            || !wd.findElement(By.tagName("h1")).getText().equals("Groups")
            || !isElementPresent(By.name("new"))) {
      click(By.linkText("groups"));
    }
  }
*/
// sprawdzanie elementu na stronie i przejście po linku - wariant 2 lepszy

  public void gotoGroupPage() {
    if (isElementPresent(By.tagName("h1"))
            && !wd.findElement(By.tagName("h1")).getText().equals("Groups")
            && !isElementPresent(By.name("new"))) {
      return;
    }
      click(By.linkText("groups"));
    }

  public void gotoMainPage() {
    if (isElementPresent(By.id("maintable"))) {
      return;
    }
      click(By.linkText("home"));
  }
}

package kurs.zadania.adressbook.appmanager;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;

public class NavigationHelper extends HelperBase{

  public NavigationHelper(WebDriver wd) {
    super(wd);
  }

  public void gotoGroupPage() {
      click(By.linkText("groups"));
  }

  public void gotoMainPage() {
      click(By.linkText("home"));

  }
}

Revert "Revert "Revert "optimization of the transition between the pages"""

This reverts commit 4ad3b97fcc8ee3476a910d0a891eb66b069f2843.


package nl.surfnet.coin.selfservice.api.rest;

import nl.surfnet.coin.selfservice.domain.CoinUser;
import nl.surfnet.coin.selfservice.util.SpringSecurity;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.HttpServletBean;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import static nl.surfnet.coin.selfservice.api.rest.Constants.HTTP_X_IDP_ENTITY_ID;

@Controller
@RequestMapping(value = "/users", produces = MediaType.APPLICATION_JSON_VALUE)
public class UsersController extends BaseController {

  @RequestMapping("/me")
  public ResponseEntity<RestResponse> me(HttpServletRequest request) {
    return new ResponseEntity(this.createRestResponse(SpringSecurity.getCurrentUser()), HttpStatus.OK);
  }

  @RequestMapping("/me/switch-to-idp/{switchToIdp}")
  public ResponseEntity currentIdp(@PathVariable("switchToIdp") String switchToIdp, HttpServletResponse response) {
    SpringSecurity.setCurrentIdp(switchToIdp);
    response.setHeader(HTTP_X_IDP_ENTITY_ID, switchToIdp);
    return new ResponseEntity(HttpStatus.OK);
  }

}

package nl.surfnet.coin.selfservice.api.rest;

import nl.surfnet.coin.selfservice.domain.CoinUser;
import nl.surfnet.coin.selfservice.util.SpringSecurity;
import org.owasp.esapi.waf.internal.InterceptingHTTPServletRequest;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.HandlerMapping;
import org.springframework.web.servlet.HttpServletBean;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import static nl.surfnet.coin.selfservice.api.rest.Constants.HTTP_X_IDP_ENTITY_ID;

@Controller
@RequestMapping(value = "/users", produces = MediaType.APPLICATION_JSON_VALUE)
public class UsersController extends BaseController {

  @RequestMapping("/me")
  public ResponseEntity<RestResponse> me(HttpServletRequest request) {
    return new ResponseEntity(this.createRestResponse(SpringSecurity.getCurrentUser()), HttpStatus.OK);
  }

  @RequestMapping("/me/switch-to-idp/**")
  public ResponseEntity currentIdp(HttpServletResponse response, HttpServletRequest request) {
    String path = (String)request.getAttribute(HandlerMapping.PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE);
    String switchToIdp = path.replaceAll("/users/me/switch-to-idp/", "");
    SpringSecurity.setCurrentIdp(switchToIdp);
    response.setHeader(HTTP_X_IDP_ENTITY_ID, switchToIdp);
    return new ResponseEntity(HttpStatus.OK);
  }

}

Fix issue with the `switch-to-idp` controller mapping

Since the switch-to-idp path variable can be an url, including forward
slashes, it doesn’t match the specified `RequestMapping`. So this
changes the `RequestMapping` to match the complete path, including all
slashes.


package io.quarkus.mutiny.deployment;

import java.util.concurrent.ExecutorService;

import io.quarkus.deployment.Feature;
import io.quarkus.deployment.annotations.BuildStep;
import io.quarkus.deployment.annotations.ExecutionTime;
import io.quarkus.deployment.annotations.Record;
import io.quarkus.deployment.builditem.ExecutorBuildItem;
import io.quarkus.deployment.builditem.FeatureBuildItem;
import io.quarkus.mutiny.runtime.MutinyInfrastructure;

public class MutinyProcessor {

    @BuildStep
    public FeatureBuildItem registerFeature() {
        return new FeatureBuildItem(Feature.MUTINY);
    }

    @BuildStep
    @Record(ExecutionTime.RUNTIME_INIT)
    public void initExecutor(ExecutorBuildItem executorBuildItem, MutinyInfrastructure recorder) {
        ExecutorService executor = executorBuildItem.getExecutorProxy();
        recorder.configureMutinyInfrastructure(executor);
    }

    @BuildStep
    @Record(ExecutionTime.RUNTIME_INIT)
    public void defineDroppedExceptionHandler(MutinyInfrastructure recorder) {
        recorder.configureDroppedExceptionHandler();
    }

    @BuildStep
    @Record(ExecutionTime.RUNTIME_INIT)
    public void defineThreadBlockingChecker(MutinyInfrastructure recorder) {
        recorder.configureThreadBlockingChecker();
    }
}

package io.quarkus.mutiny.deployment;

import java.util.concurrent.ExecutorService;

import io.quarkus.deployment.Feature;
import io.quarkus.deployment.annotations.BuildStep;
import io.quarkus.deployment.annotations.ExecutionTime;
import io.quarkus.deployment.annotations.Record;
import io.quarkus.deployment.builditem.ExecutorBuildItem;
import io.quarkus.deployment.builditem.FeatureBuildItem;
import io.quarkus.mutiny.runtime.MutinyInfrastructure;

public class MutinyProcessor {

    @BuildStep
    public FeatureBuildItem registerFeature() {
        return new FeatureBuildItem(Feature.MUTINY);
    }

    @BuildStep
    @Record(ExecutionTime.RUNTIME_INIT)
    public void initExecutor(ExecutorBuildItem executorBuildItem, MutinyInfrastructure recorder) {
        ExecutorService executor = executorBuildItem.getExecutorProxy();
        recorder.configureMutinyInfrastructure(executor);
    }

    @BuildStep
    @Record(ExecutionTime.STATIC_INIT)
    public void defineDroppedExceptionHandler(MutinyInfrastructure recorder) {
        recorder.configureDroppedExceptionHandler();
    }

    @BuildStep
    @Record(ExecutionTime.STATIC_INIT)
    public void defineThreadBlockingChecker(MutinyInfrastructure recorder) {
        recorder.configureThreadBlockingChecker();
    }
}

Move Mutiny infrastructure initialization to STATIC_INIT


package com.red.alert.config;

public class Alerts {
    // Date format for recent alerts display
    public static final String DATE_FORMAT = "HH:mm:ss (dd/MM/yy)";

    // Time to wait before calling finish() on AlertPopup after POST_IMPACT_WAIT_MINUTES passed
    public static final int ALERT_POPUP_DONE_PADDING = 10;

    // Time that must pass (in seconds) in between alerts for the same zone (to avoid duplicate alerts)
    public static final int DUPLICATE_ALERTS_PADDING_TIME = 60;

}

package com.red.alert.config;

public class Alerts {
    // Date format for recent alerts display
    public static final String DATE_FORMAT = "HH:mm:ss (dd/MM/yy)";

    // Time to wait before calling finish() on AlertPopup after POST_IMPACT_WAIT_MINUTES passed
    public static final int ALERT_POPUP_DONE_PADDING = 10;

    // Time that must pass (in seconds) in between alerts for the same zone (to avoid duplicate alerts)
    public static final int DUPLICATE_ALERTS_PADDING_TIME = 60 * 2;

}

Increase duplicate alert padding time to 2 minutes


/*
 * Copyright (C) 2013 Square, Inc.
 *
 * 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 retrofit2.http;

import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;

/**
 * Denotes that the request body will use form URL encoding. Fields should be declared as parameters
 * and annotated with {@link Field @Field}.
 *
 *
Requests made with this annotation will have {@code application/x-www-form-urlencoded} MIME
 * type. Field names and values will be UTF-8 encoded before being URI-encoded in accordance to RFC-3986.
 */
@Documented
@Target(METHOD)
@Retention(RUNTIME)
public @interface FormUrlEncoded {}

Change old IETF reference link

Change old IETF reference link

Old link will throw 404, so it could be replaced with new working one


package com.github.vedenin.thirdpartylib.htmlparser;

import com.github.vedenin.thirdpartylib.annotations.Atom;
import com.github.vedenin.thirdpartylib.annotations.BoilerPlate;
import org.jsoup.parser.Tag;

/**
 * This Atom pattern (pattern that extends a Proxy pattern that have only minimal methods from original class)
 * This using to light-reference to another third party open-source libraries
 *
 * Created by vvedenin on 12/19/2016.
 */
@Atom
public class TagAtom {
    private final Tag tag;

    public static TagAtom valueOf(String tagString) {
        return new TagAtom(Tag.valueOf(tagString));
    }

    // Just boilerplate code for Atom
    @Override
    @BoilerPlate
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        TagAtom tagAtom = (TagAtom) o;

        return !(tag != null ? !tag.equals(tagAtom.tag) : tagAtom.tag != null);

    }

    @Override
    @BoilerPlate
    public int hashCode() {
        return tag != null ? tag.hashCode() : 0;
    }

    @BoilerPlate
    private TagAtom(Tag tag) {
        this.tag = tag;
    }

    @BoilerPlate
    public static TagAtom getAtom(Tag tag) {
        return new TagAtom(tag);
    }
}

package com.github.vedenin.thirdpartylib.htmlparser;

import com.github.vedenin.thirdpartylib.annotations.Atom;
import com.github.vedenin.thirdpartylib.annotations.BoilerPlate;
import com.github.vedenin.thirdpartylib.annotations.Reference;
import org.jsoup.parser.Tag;

/**
 * This Atom pattern (pattern that extends a Proxy pattern that have only minimal methods from original class)
 * This using to light-reference to another third party open-source libraries
 *
 * Created by vvedenin on 12/19/2016.
 */
@Atom
@Reference({ElementAtom.class})
public class TagAtom {
    private final Tag tag;

    public static TagAtom valueOf(String tagString) {
        return new TagAtom(Tag.valueOf(tagString));
    }

    // Just boilerplate code for Atom
    @Override
    @BoilerPlate
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        TagAtom tagAtom = (TagAtom) o;

        return !(tag != null ? !tag.equals(tagAtom.tag) : tagAtom.tag != null);

    }

    @Override
    @BoilerPlate
    public int hashCode() {
        return tag != null ? tag.hashCode() : 0;
    }

    @BoilerPlate
    private TagAtom(Tag tag) {
        this.tag = tag;
    }

    @BoilerPlate
    public static TagAtom getAtom(Tag tag) {
        return new TagAtom(tag);
    }
}

Create atom-proxy for third party libs

Create atom-proxy for third party libs


package com.elpatika.stepic.view;

import android.os.Bundle;
import android.os.Handler;

import com.elpatika.stepic.R;
import com.elpatika.stepic.base.BaseFragmentActivity;

public class SplashActivity extends BaseFragmentActivity {

    // Splash screen wait time
    private static final int SPLASH_TIME_OUT = 3000;

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

        //This stops from opening again from the Splash screen when minimized
        if (!isTaskRoot()) {
            finish();
            return;
        }

        setContentView(R.layout.activity_splash);
        overridePendingTransition(R.anim.slide_in_from_end, R.anim.slide_out_to_start);

        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                mShell.getScreenProvider().showLaunchScreen(SplashActivity.this, false);

                finish();
            }
        }, SPLASH_TIME_OUT);

    }
}

package com.elpatika.stepic.view;

import android.os.Bundle;
import android.os.Handler;

import com.elpatika.stepic.R;
import com.elpatika.stepic.base.BaseFragmentActivity;

public class SplashActivity extends BaseFragmentActivity {

    // Splash screen wait time
    private static final int SPLASH_TIME_OUT = 3000;

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

        //This stops from opening again from the Splash screen when minimized
        if (!isTaskRoot()) {
            finish();
            return;
        }

        setContentView(R.layout.activity_splash);
        overridePendingTransition(R.anim.slide_in_from_end, R.anim.slide_out_to_start);

        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                if (!isFinishing()) {
                    mShell.getScreenProvider().showLaunchScreen(SplashActivity.this, false);

                    finish();
                }
            }
        }, SPLASH_TIME_OUT);

    }
}

Fix bug with second start splash activity


package org.skife.jdbi.v2;

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

class ListContainerBuilder implements ContainerBuilder<List<?>>
{
    private final ArrayList<Object> list;

    ListContainerBuilder()
    {
        this.list = new ArrayList();
    }

    public ListContainerBuilder add(Object it)
    {
        list.add(it );
        return this;
    }

    public List<?> build()
    {
        return list;
    }
}

package org.skife.jdbi.v2;

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

class ListContainerBuilder implements ContainerBuilder<List<?>>
{
    private final ArrayList<Object> list;

    ListContainerBuilder()
    {
        this.list = new ArrayList<Object>();
    }

    @Override
    public ListContainerBuilder add(Object it)
    {
        list.add(it);
        return this;
    }

    @Override
    public List<?> build()
    {
        return list;
    }
}

Put @Override annotations back in now that jdbi is 1.6 only


package java.util;

import edu.columbia.cs.psl.phosphor.struct.ControlTaintTagStack;
import edu.columbia.cs.psl.phosphor.struct.TaintedBooleanWithObjTag;

public interface Collection<E> extends Iterable<E> {
    int size();

    boolean isEmpty();

    boolean contains(Object o);

    Iterator<E> iterator();

    Object[] toArray();

    <T> T[] toArray(T[] a);

    boolean add(E e);

    TaintedBooleanWithObjTag add$$PHOSPHORTAGGED(E e, TaintedBooleanWithObjTag ret);

    TaintedBooleanWithObjTag add$$PHOSPHORTAGGED(E e, ControlTaintTagStack ctrl, TaintedBooleanWithObjTag ret);

    boolean remove(Object o);

    boolean containsAll(Collection<?> c);

    boolean addAll(Collection<? extends E> c);

    boolean removeAll(Collection<?> c);

    boolean retainAll(Collection<?> c);

    void clear();

    boolean equals(Object o);

    int hashCode();
}

package java.util;

import edu.columbia.cs.psl.phosphor.struct.ControlTaintTagStack;
import edu.columbia.cs.psl.phosphor.struct.TaintedBooleanWithObjTag;

import java.util.stream.Stream;

public interface Collection<E> extends Iterable<E> {
    int size();

    boolean isEmpty();

    boolean contains(Object o);

    Iterator<E> iterator();

    Object[] toArray();

    <T> T[] toArray(T[] a);

    boolean add(E e);

    Stream<E> stream();

    TaintedBooleanWithObjTag add$$PHOSPHORTAGGED(E e, TaintedBooleanWithObjTag ret);

    TaintedBooleanWithObjTag add$$PHOSPHORTAGGED(E e, ControlTaintTagStack ctrl, TaintedBooleanWithObjTag ret);

    boolean remove(Object o);

    boolean containsAll(Collection<?> c);

    boolean addAll(Collection<? extends E> c);

    boolean removeAll(Collection<?> c);

    boolean retainAll(Collection<?> c);

    void clear();

    boolean equals(Object o);

    int hashCode();
}

Add stream() method to collection compile-time interface


package com.tinkerpop.gremlin.server.op.standard;

import com.tinkerpop.gremlin.driver.Tokens;
import com.tinkerpop.gremlin.driver.message.RequestMessage;
import com.tinkerpop.gremlin.server.Context;
import com.tinkerpop.gremlin.server.op.AbstractEvalOpProcessor;
import com.tinkerpop.gremlin.server.op.OpProcessorException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.script.Bindings;
import javax.script.SimpleBindings;
import java.util.Map;
import java.util.Optional;

/**
 * Operations to be used by the {@link StandardOpProcessor}.
 *
 * @author Stephen Mallette (http://stephen.genoprime.com)
 */
final class StandardOps {
    private static final Logger logger = LoggerFactory.getLogger(StandardOps.class);

    public static void evalOp(final Context context) throws OpProcessorException {
        final RequestMessage msg = context.getRequestMessage();
        AbstractEvalOpProcessor.evalOp(context, context::getGremlinExecutor, () -> {
            final Bindings bindings = new SimpleBindings();
            Optional.ofNullable((Map<String, Object>) msg.getArgs().get(Tokens.ARGS_BINDINGS)).ifPresent(bindings::putAll);
            return bindings;
        });
    }
}

package com.tinkerpop.gremlin.server.op.standard;

import com.tinkerpop.gremlin.driver.Tokens;
import com.tinkerpop.gremlin.driver.message.RequestMessage;
import com.tinkerpop.gremlin.server.Context;
import com.tinkerpop.gremlin.server.op.AbstractEvalOpProcessor;
import com.tinkerpop.gremlin.server.op.OpProcessorException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.script.Bindings;
import javax.script.SimpleBindings;
import java.util.Map;
import java.util.Optional;

/**
 * Operations to be used by the {@link StandardOpProcessor}.
 *
 * @author Stephen Mallette (http://stephen.genoprime.com)
 */
final class StandardOps {
    private static final Logger logger = LoggerFactory.getLogger(StandardOps.class);

    public static void evalOp(final Context context) throws OpProcessorException {
        final RequestMessage msg = context.getRequestMessage();

        logger.debug("Sessionless request {} for eval in thread {}", msg.getRequestId(), Thread.currentThread().getName());

        AbstractEvalOpProcessor.evalOp(context, context::getGremlinExecutor, () -> {
            final Bindings bindings = new SimpleBindings();
            Optional.ofNullable((Map<String, Object>) msg.getArgs().get(Tokens.ARGS_BINDINGS)).ifPresent(bindings::putAll);
            return bindings;
        });
    }
}

Add logging message to sessionless op processor.


package com.ezardlabs.dethsquare;

public final class Camera extends Script {
	public final RectF bounds = new RectF();
	public static Camera main;

	public Camera(boolean main) {
		if (main) Camera.main = this;
	}

	public void update() {
		bounds.left = transform.position.x;
		bounds.top = transform.position.y;
		bounds.right = bounds.left + Screen.width / Screen.scale;
		bounds.bottom = bounds.top + Screen.height / Screen.scale;
	}
}

package com.ezardlabs.dethsquare;

public final class Camera extends Script {
	public final RectF bounds = new RectF();
	public static Camera main;
	private boolean isMain = false;

	public Camera(boolean main) {
		isMain = main;
	}

	@Override
	public void start() {
		if (isMain) main = this;
	}

	public void update() {
		bounds.left = transform.position.x;
		bounds.top = transform.position.y;
		bounds.right = bounds.left + Screen.width / Screen.scale;
		bounds.bottom = bounds.top + Screen.height / Screen.scale;
	}
}

Move setting of main camera from constructor to start method


/*
 * Copyright 2002-2013 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.springframework.security.web.csrf;

/**
 * Thrown when no expected {@link CsrfToken} is found but is required.
 *
 * @author Rob Winch
 * @since 3.2
 */
@SuppressWarnings("serial")
public class MissingCsrfTokenException extends CsrfException {

	public MissingCsrfTokenException(String actualToken) {
		super("Expected CSRF token not found. Has your session expired?");
	}
}

/*
 * Copyright 2002-2013 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.springframework.security.web.csrf;

/**
 * Thrown when no expected {@link CsrfToken} is found but is required.
 *
 * @author Rob Winch
 * @since 3.2
 */
@SuppressWarnings("serial")
public class MissingCsrfTokenException extends CsrfException {

	public MissingCsrfTokenException(String actualToken) {
		super("Could not verify the provided CSRF token because your session was not found.");
	}
}

Improve CSRF missing error message

Improve CSRF missing error message

Fixes gh-3738


/**
 *  Licensed to the Apache Software Foundation (ASF) under one or more
 *  contributor license agreements.  See the NOTICE file distributed with
 *  this work for additional information regarding copyright ownership.
 *  The ASF licenses this file to You 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 domainapp.integtests.specs;

import cucumber.api.junit.Cucumber;

import org.junit.runner.RunWith;

/**
 * Runs scenarios in all <tt>.feature</tt> files (this package and any subpackages).
 */
@RunWith(Cucumber.class)
@Cucumber.Options(
        format = {
                "html:target/cucumber-html-report"
                ,"json:target/cucumber.json"
        },
        glue={"classpath:domainapp.integtests.specglue"},
        strict = true,
        tags = { "~@backlog", "~@ignore" })
public class RunSpecs {
    // intentionally empty
}

/**
 *  Licensed to the Apache Software Foundation (ASF) under one or more
 *  contributor license agreements.  See the NOTICE file distributed with
 *  this work for additional information regarding copyright ownership.
 *  The ASF licenses this file to You 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 domainapp.integtests.specs;

import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;

import org.junit.runner.RunWith;

/**
 * Runs scenarios in all <tt>.feature</tt> files (this package and any subpackages).
 */
@RunWith(Cucumber.class)
@CucumberOptions(
        format = {
                "html:target/cucumber-html-report"
                ,"json:target/cucumber.json"
        },
        glue={"classpath:domainapp.integtests.specglue"},
        strict = true,
        tags = { "~@backlog", "~@ignore" })
public class RunSpecs {
    // intentionally empty
}

Replace deprecated @Cucumber.Options with @CucumberOptions


package io.dropwizard.lifecycle;

import org.eclipse.jetty.server.Server;

import java.util.EventListener;

public interface ServerLifecycleListener extends EventListener {
    void serverStarted(Server server);
}

package io.dropwizard.lifecycle;

import org.eclipse.jetty.server.Connector;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.ServerConnector;
import java.util.EventListener;

public interface ServerLifecycleListener extends EventListener {
    void serverStarted(Server server);

    default int getLocalPort(Server server) {
        return ((ServerConnector) server.getConnectors()[0]).getLocalPort();
    }

    default int getAdminPort(Server server) {
        final Connector[] connectors = server.getConnectors();
        return ((ServerConnector) connectors[connectors.length -1]).getLocalPort();
    }
}

Add helper functions for getting the local and admin ports from a server instance


package com.blamejared.mcbot.commands;

import com.blamejared.mcbot.commands.api.Command;
import com.blamejared.mcbot.commands.api.CommandBase;
import com.blamejared.mcbot.commands.api.CommandContext;
import com.blamejared.mcbot.commands.api.CommandException;
import com.blamejared.mcbot.commands.api.Flag;
import com.google.common.base.Joiner;
import com.google.common.collect.Lists;

@Command
public class CommandLMGTFY extends CommandBase {

    private static final Flag FLAG_IE = new SimpleFlag("ie", false);

    public CommandLMGTFY() {
        super("lmgtfy", false, Lists.newArrayList(FLAG_IE));
    }

    @Override
    public void process(CommandContext ctx) throws CommandException {
        if (ctx.getArgs().size() < 1) {
            throw new CommandException("Not enough arguments.");
        }
        int iie = ctx.getFlags().containsKey(FLAG_IE) ? 1 : 0;
        StringBuilder arg = new StringBuilder("http://lmgtfy.com/?iie=").append(iie).append("&q=");
        arg.append(Joiner.on('+').join(ctx.getArgs()));
        ctx.reply(arg.toString());
    }

    public String getUsage() {
        return "<question>";
    }
}

package com.blamejared.mcbot.commands;

import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;

import com.blamejared.mcbot.commands.api.Command;
import com.blamejared.mcbot.commands.api.CommandBase;
import com.blamejared.mcbot.commands.api.CommandContext;
import com.blamejared.mcbot.commands.api.CommandException;
import com.blamejared.mcbot.commands.api.Flag;
import com.google.common.base.Charsets;
import com.google.common.base.Joiner;
import com.google.common.collect.Lists;

@Command
public class CommandLMGTFY extends CommandBase {

    private static final Flag FLAG_IE = new SimpleFlag("ie", false);

    public CommandLMGTFY() {
        super("lmgtfy", false, Lists.newArrayList(FLAG_IE));
    }

    @Override
    public void process(CommandContext ctx) throws CommandException {
        if (ctx.getArgs().size() < 1) {
            throw new CommandException("Not enough arguments.");
        }
        int iie = ctx.getFlags().containsKey(FLAG_IE) ? 1 : 0;
        StringBuilder url = new StringBuilder("<http://lmgtfy.com/?iie=").append(iie).append("&q=");
        String arg = Joiner.on(' ').join(ctx.getArgs());
        try {
            ctx.reply(url.append(URLEncoder.encode(ctx.sanitize(arg), Charsets.UTF_8.name())).append(">").toString());
        } catch (UnsupportedEncodingException e) {
            throw new CommandException(e);
        }
    }

    public String getUsage() {
        return "<question>";
    }
}

Fix URL encoding of lmgtfy output

Fix URL encoding of lmgtfy output


package com.faforever.api.data.domain;

import com.yahoo.elide.annotation.Include;
import lombok.Setter;
import org.hibernate.annotations.Immutable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;

@Entity
@Setter
@Table(name = "map_statistics")
@Include(type = MapStatistics.TYPE_NAME)
@Immutable
public class MapStatistics {
  public static final String TYPE_NAME = "mapStatistics";

  private Integer id;
  private Integer downloads;
  private Integer plays;
  private Integer draws;
  private Map map;

  @Id
  @Column(name = "map_id")
  public int getId() {
    return id;
  }

  @Column(name = "downloads")
  public int getDownloads() {
    return downloads;
  }

  @Column(name = "plays")
  public int getPlays() {
    return plays;
  }

  @Column(name = "draws")
  public int getDraws() {
    return draws;
  }

  @OneToOne(fetch = FetchType.LAZY)
  @JoinColumn(name = "map_id", insertable = false, updatable = false)
  public Map getMap() {
    return map;
  }
}

package com.faforever.api.data.domain;

import com.yahoo.elide.annotation.Include;
import lombok.Setter;
import org.hibernate.annotations.Immutable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;

@Entity
@Setter
@Table(name = "map_statistics")
@Include(type = MapStatistics.TYPE_NAME)
@Immutable
public class MapStatistics {
  public static final String TYPE_NAME = "mapStatistics";

  private Integer id;
  private Integer downloads;
  private Integer plays;
  private Integer draws;
  private Map map;

  @Id
  @Column(name = "map_id")
  public Integer getId() {
    return id;
  }

  @Column(name = "downloads")
  public Integer getDownloads() {
    return downloads;
  }

  @Column(name = "plays")
  public Integer getPlays() {
    return plays;
  }

  @Column(name = "draws")
  public Integer getDraws() {
    return draws;
  }

  @OneToOne(fetch = FetchType.LAZY)
  @JoinColumn(name = "map_id", insertable = false, updatable = false)
  public Map getMap() {
    return map;
  }
}

Set return type to Integer

Set return type to Integer


package com.graphicsengine.charset;

import java.io.IOException;

import com.graphicsengine.assets.AssetManager;
import com.nucleus.renderer.BaseRenderer;
import com.nucleus.texturing.Texture2D;

/**
 * Use to create charmaps from JSON source
 *
 * @author Richard Sahlin
 *
 */
public class PlayfieldFactory {

    public static Playfield createCharmap(BaseRenderer baseRenderer, PlayfieldSetup constructor) throws IOException {

        Playfield map = new Playfield(constructor.mapWidth * constructor.mapHeight);
        PlayfieldProgram program = new PlayfieldProgram();
        baseRenderer.createProgram(program);
        Texture2D texture = AssetManager.getInstance().getTexture(baseRenderer, constructor.textureSource);
        map.createMesh(program, texture, constructor.tileWidth, constructor.tileHeight, constructor.zpos,
                constructor.textureFramesX, constructor.textureFramesY);
        map.setupPlayfield(constructor.mapWidth, constructor.mapHeight, constructor.xpos, constructor.ypos);
        map.setPlayfieldData(constructor.data, 0, 0, constructor.data.length);
        return map;
    }
}

package com.graphicsengine.charset;

import java.io.IOException;

import com.graphicsengine.assets.AssetManager;
import com.nucleus.renderer.BaseRenderer;
import com.nucleus.texturing.Texture2D;

/**
 * Use to create charmaps from JSON source
 *
 * @author Richard Sahlin
 *
 */
public class PlayfieldFactory {

    /**
     * Factory method for creating a playfield
     *
     * @param baseRenderer
     * @param constructor
     * @return
     * @throws IOException
     */
    public static Playfield create(BaseRenderer baseRenderer, PlayfieldSetup constructor) throws IOException {

        Playfield map = new Playfield(constructor.mapWidth * constructor.mapHeight);
        PlayfieldProgram program = new PlayfieldProgram();
        baseRenderer.createProgram(program);
        Texture2D texture = AssetManager.getInstance().getTexture(baseRenderer, constructor.textureSetup);
        map.createMesh(program, texture, constructor.tileWidth, constructor.tileHeight, constructor.zpos,
                constructor.textureFramesX, constructor.textureFramesY);
        map.setupPlayfield(constructor.mapWidth, constructor.mapHeight, constructor.xpos, constructor.ypos);
        map.setPlayfieldData(constructor.data, 0, 0, constructor.data.length);
        return map;
    }
}

Change playfield factory method name to create()


/*
 * Copyright (c) 2014 Wyatt Childers.
 *
 * All Rights Reserved
 */

package com.skelril.aurora.prayer.PrayerFX;

import com.skelril.aurora.prayer.PrayerType;
import org.bukkit.entity.Player;
import org.bukkit.entity.Zombie;

/**
 * Author: Turtle9598
 */
public class ZombieFX extends AbstractEffect {

    @Override
    public PrayerType getType() {

        return PrayerType.ZOMBIE;
    }

    @Override
    public void add(Player player) {

        if (player.getWorld().getEntitiesByClass(Zombie.class).size() < 1000) {
            player.getWorld().spawn(player.getLocation(), Zombie.class);
        }
    }

    @Override
    public void clean(Player player) {

        // Nothing to do here
    }
}

/*
 * Copyright (c) 2014 Wyatt Childers.
 *
 * All Rights Reserved
 */

package com.skelril.aurora.prayer.PrayerFX;

import com.skelril.aurora.prayer.PrayerType;
import org.bukkit.entity.Player;
import org.bukkit.entity.Zombie;

/**
 * Author: Turtle9598
 */
public class ZombieFX extends AbstractEffect {

    @Override
    public PrayerType getType() {

        return PrayerType.ZOMBIE;
    }

    @Override
    public void add(Player player) {

        if (player.getWorld().getEntitiesByClass(Zombie.class).size() < 1000) {
            player.getWorld().spawn(player.getLocation(), Zombie.class).setTarget(player);
        }
    }

    @Override
    public void clean(Player player) {

        // Nothing to do here
    }
}

Set the target of zombies spawned by the Zombie curse


package net.openhft.chronicle.bytes;

import org.junit.Test;

import java.io.File;
import java.io.RandomAccessFile;

import static org.junit.Assert.*;

public class MappedBytesTest {

    @Test
    public void shouldNotBeReadOnly() throws Exception {
        MappedBytes bytes = MappedBytes.mappedBytes(File.createTempFile("mapped", "bytes"), 1024);
        assertFalse(bytes.isBackingFileReadOnly());
        bytes.writeUtf8(null); // used to blow up.
        assertNull(bytes.readUtf8());
        bytes.release();
    }

    @Test
    public void shouldBeReadOnly() throws Exception {
        final File tempFile = File.createTempFile("mapped", "bytes");
        final RandomAccessFile raf = new RandomAccessFile(tempFile, "rw");
        raf.setLength(4096);
        assertTrue(tempFile.setWritable(false));
        final MappedBytes mappedBytes = MappedBytes.readOnly(tempFile);

        assertTrue(mappedBytes.
                isBackingFileReadOnly());
        mappedBytes.release();
    }
}

package net.openhft.chronicle.bytes;

import org.junit.Test;

import java.io.File;
import java.io.RandomAccessFile;

import static org.junit.Assert.*;

public class MappedBytesTest {

    @Test
    public void shouldNotBeReadOnly() throws Exception {
        MappedBytes bytes = MappedBytes.mappedBytes(File.createTempFile("mapped", "bytes"), 64 << 10);
        assertFalse(bytes.isBackingFileReadOnly());
        bytes.writeUtf8(null); // used to blow up.
        assertNull(bytes.readUtf8());
        bytes.release();
    }

    @Test
    public void shouldBeReadOnly() throws Exception {
        final File tempFile = File.createTempFile("mapped", "bytes");
        final RandomAccessFile raf = new RandomAccessFile(tempFile, "rw");
        raf.setLength(4096);
        assertTrue(tempFile.setWritable(false));
        final MappedBytes mappedBytes = MappedBytes.readOnly(tempFile);

        assertTrue(mappedBytes.
                isBackingFileReadOnly());
        mappedBytes.release();
    }
}

Fix a bug where MappedBytes.writeUtf8 crashed the JVM if passed a null


package main;

import org.junit.jupiter.api.Test;

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

public class MatrixTransformationTest {
    @Test
    void rotateTo90Degrees() throws Exception {
        int[][] matrix = new int[][] {
                {0, 0, 0, 0},
                {1, 1, 1, 1},
                {2, 2, 2, 2},
                {3, 3, 3, 3}
        };
        int[][] result = new int[][] {
                {3, 2, 1, 0},
                {3, 2, 1, 0},
                {3, 2, 1, 0},
                {3, 2, 1, 0}
        };
        assertArrayEquals(result, MatrixTransformation.rotateTo90Degrees(matrix));
    }

    @Test
    void zeroefyMatrix() throws Exception {
        int[][] matrix = new int[][] {
                {1, 1, 1, 1, 1},
                {1, 1, 1, 0, 1},
                {1, 1, 1, 1, 1},
                {1, 0, 1, 1, 1}
        };
        int[][] result = new int[][] {
                {1, 0, 1, 0, 1},
                {0, 0, 0, 0, 0},
                {1, 0, 1, 0, 1},
                {0, 0, 0, 0, 0}
        };
        assertArrayEquals(result, MatrixTransformation.zeroefyMatrix(matrix));
    }
}

package main;

import org.junit.jupiter.api.Test;

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

class MatrixTransformationTest {
    @Test
    void rotateTo90Degrees() throws Exception {
        int[][] matrix = new int[][] {
                {0, 0, 0, 0},
                {1, 1, 1, 1},
                {2, 2, 2, 2},
                {3, 3, 3, 3}
        };
        int[][] result = new int[][] {
                {3, 2, 1, 0},
                {3, 2, 1, 0},
                {3, 2, 1, 0},
                {3, 2, 1, 0}
        };
        assertArrayEquals(result, MatrixTransformation.rotateTo90Degrees(matrix));
    }

    @Test
    void zeroefyMatrix() throws Exception {
        int[][] matrix = new int[][] {
                {1, 1, 1, 1, 1},
                {1, 1, 1, 0, 1},
                {1, 1, 1, 1, 1},
                {1, 0, 1, 1, 1}
        };
        int[][] result = new int[][] {
                {1, 0, 1, 0, 1},
                {0, 0, 0, 0, 0},
                {1, 0, 1, 0, 1},
                {0, 0, 0, 0, 0}
        };
        assertArrayEquals(result, MatrixTransformation.zeroefyMatrix(matrix));
    }
}

Remove public declaration from test class.


package com.vaadin.components.gwt.polymer.client;

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

import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Document;
import com.google.gwt.dom.client.Element;
import com.vaadin.components.gwt.polymer.client.element.ImportsMap;

public class Polymer {

    private static Polymer instance = new Polymer();

    private static Set<String> urlImported = new HashSet<>();

    /*
	 * Injects the correspondent html template to page head section.
	 */
    public static void ensureHTMLImport(Class<?> clazz) {
        String tagName = computeTagName(clazz);
        GWT.log(tagName);
        ensureHTMLImport(tagName);
    }

    public static void ensureHTMLImport(String tagName) {
        String href = "bower_components/" + ImportsMap.getInstance().get(tagName);
        if (!urlImported.contains(href)) {
            Element head = Document.get().getElementsByTagName("head").getItem(0);
            Element htmlImport = Document.get().createLinkElement();
            htmlImport.setAttribute("rel", "import");
            htmlImport.setAttribute("href", GWT.getModuleBaseForStaticFiles() + href);
            head.appendChild(htmlImport);
            urlImported.add(href);
        }
    }

    private static String computeTagName(Class<?> clazz) {
        return clazz.getSimpleName().replaceAll("([A-Z])", "-$1").replaceFirst("^-+", "").toLowerCase();
    }

    public static Polymer getInstance() {
        return instance;
    }

    private Polymer() {
    }
}

package com.vaadin.components.gwt.polymer.client;

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

import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Document;
import com.google.gwt.dom.client.Element;
import com.vaadin.components.gwt.polymer.client.element.ImportsMap;

public abstract class Polymer {

    private static Set<String> urlImported = new HashSet<>();

    // Ensures that the tagName has been registered, otherwise injects
    // the appropriate <import> tag in the document header
    public static void ensureHTMLImport(String tagName) {
        String href = "bower_components/" + ImportsMap.getInstance().get(tagName);
        if (!urlImported.contains(href)) {
            Element link = Document.get().createLinkElement();
            link.setAttribute("rel", "import");
            link.setAttribute("href", GWT.getModuleBaseForStaticFiles() + href);
            Document.get().getHead().appendChild(link);
            urlImported.add(href);
        }
    }

}

Remove unused methods and make the class static

Signed-off-by: Manolo Carrasco <0d18e2b6d68973f0f02c17c97e4765f716eca440@apache.org>


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

import com.google.inject.Binder;
import com.google.inject.Module;
import com.google.inject.Scopes;
import org.weakref.jmx.guice.ExportBinder;

import static io.airlift.configuration.ConfigurationModule.bindConfig;
import static io.airlift.http.client.HttpClientBinder.httpClientBinder;

public class FailureDetectorModule
        implements Module
{
    @Override
    public void configure(Binder binder)
    {
        httpClientBinder(binder)
                .bindAsyncHttpClient("failure-detector", ForFailureDetector.class)
                .withTracing();

        bindConfig(binder).to(FailureDetectorConfig.class);

        binder.bind(HeartbeatFailureDetector.class).in(Scopes.SINGLETON);

        binder.bind(FailureDetector.class)
                .to(HeartbeatFailureDetector.class)
                .in(Scopes.SINGLETON);

        ExportBinder.newExporter(binder)
                .export(HeartbeatFailureDetector.class)
                .withGeneratedName();
    }
}

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

import com.google.inject.Binder;
import com.google.inject.Module;
import com.google.inject.Scopes;
import org.weakref.jmx.guice.ExportBinder;

import static io.airlift.configuration.ConfigurationModule.bindConfig;
import static io.airlift.http.client.HttpClientBinder.httpClientBinder;

public class FailureDetectorModule
        implements Module
{
    @Override
    public void configure(Binder binder)
    {
        httpClientBinder(binder)
                .bindAsyncHttpClient("failure-detector", ForFailureDetector.class)
                .withPrivateIoThreadPool()
                .withTracing();

        bindConfig(binder).to(FailureDetectorConfig.class);

        binder.bind(HeartbeatFailureDetector.class).in(Scopes.SINGLETON);

        binder.bind(FailureDetector.class)
                .to(HeartbeatFailureDetector.class)
                .in(Scopes.SINGLETON);

        ExportBinder.newExporter(binder)
                .export(HeartbeatFailureDetector.class)
                .withGeneratedName();
    }
}

Use a private I/O thread pool for failure detector


package bramble.configuration;

public abstract class BrambleConfiguration {

	public static final int MASTER_PORT = 5800;
	public static final int SLAVE_PORT = 5801;
	public static final int WEB_API_SERVER_PORT = 5802;
	public static final int WEB_SERVER_PORT = 8000;
	public static final String MASTER_NODE_IP = "169.254.48.35";

	public static final String WEB_SERVER_FILE_LOCATION = "C:/Users/Tom/workspace/PicoBramble/PicoBrambleWebGUI/";

	public static final int LISTENER_DELAY_MS = 3;
	public static final int HANDSHAKE_FREQUENCY_MS = 5000;
	public static final int NODE_TIMEOUT_MS = HANDSHAKE_FREQUENCY_MS * 3;

	public static final int THREADS_PER_NODE = 5;

}

package bramble.configuration;

public abstract class BrambleConfiguration {

	public static final int MASTER_PORT = 5800;
	public static final int SLAVE_PORT = 5801;
	public static final int WEB_API_SERVER_PORT = 5802;
	public static final int WEB_SERVER_PORT = 8000;
	public static final String MASTER_NODE_IP = "169.254.48.35";

	public static final String WEB_SERVER_FILE_LOCATION = "../PicoBrambleWebGUI/";

	public static final int LISTENER_DELAY_MS = 3;
	public static final int HANDSHAKE_FREQUENCY_MS = 5000;
	public static final int NODE_TIMEOUT_MS = HANDSHAKE_FREQUENCY_MS * 3;

	public static final int THREADS_PER_NODE = 5;

}

Use relative path for web files location


package io.digdag.cli.client;

import io.digdag.cli.SystemExitException;
import io.digdag.client.DigdagClient;
import io.digdag.client.api.RestProject;
import io.digdag.client.api.RestProjectCollection;

import static io.digdag.cli.SystemExitException.systemExit;

public class ShowProjects
        extends ClientCommand
{
    @Override
    public void mainWithClientException()
            throws Exception
    {
        DigdagClient client = buildClient();

        RestProjectCollection projects = client.getProjects();
        for (RestProject proj : projects.getProjects()) {
            ln(proj.getName());
            ln("  id: " + proj.getId());
            ln("  revision: " + proj.getRevision());
            ln("  archive type: " + proj.getArchiveType());
            ln("  project created at: " + proj.getCreatedAt());
            ln("  revision updated at: " + proj.getUpdatedAt());
            ln("");
        }
        err.println("Use `" + programName + " workflows <project-name>` to show details.");
    }

    public SystemExitException usage(String error)
    {
        err.println("Usage: " + programName + " projects");
        showCommonOptions();
        return systemExit(error);
    }
}

package io.digdag.cli.client;

import io.digdag.cli.SystemExitException;
import io.digdag.cli.TimeUtil;
import io.digdag.client.DigdagClient;
import io.digdag.client.api.RestProject;
import io.digdag.client.api.RestProjectCollection;

import static io.digdag.cli.SystemExitException.systemExit;

public class ShowProjects
        extends ClientCommand
{
    @Override
    public void mainWithClientException()
            throws Exception
    {
        DigdagClient client = buildClient();

        RestProjectCollection projects = client.getProjects();
        ln("Projects");
        for (RestProject proj : projects.getProjects()) {
            ln("  name: %s", proj.getName());
            ln("  id: %s", proj.getId());
            ln("  revision: %s", proj.getRevision());
            ln("  archive type: %s", proj.getArchiveType());
            ln("  project created at: %s", TimeUtil.formatTime(proj.getCreatedAt()));
            ln("  revision updated at: %s", TimeUtil.formatTime(proj.getUpdatedAt()));
            ln("");
        }
        err.println("Use `" + programName + " workflows <project-name>` to show details.");
    }

    public SystemExitException usage(String error)
    {
        err.println("Usage: " + programName + " projects");
        showCommonOptions();
        return systemExit(error);
    }
}

Change output format like digdag sessions


package me.coley.recaf.command.impl;

import me.coley.recaf.Recaf;
import me.coley.recaf.control.Controller;
import me.coley.recaf.control.gui.GuiController;
import me.coley.recaf.control.headless.HeadlessController;
import picocli.CommandLine;

import java.io.File;

/**
 * Command line initializer for Recaf, invoked from the main method.
 *
 * @author Matt
 */
@CommandLine.Command(
		name = "Recaf",
		version = Recaf.VERSION,
		description = "Recaf: A modern java bytecode editor.",
		mixinStandardHelpOptions = true)
public class Initializer implements Runnable {
	/**
	 * Workspace file to import.
	 */
	@CommandLine.Option(names = {"--input" }, description = "The input file to load. " +
			"Supported types are: class, jar, json")
	public File input;
	@CommandLine.Option(names = {"--script" }, description = "Script file to load for cli usage")
	public File script;
	@CommandLine.Option(names = { "--cli" }, description = "Run Recaf via CLI")
	public boolean cli;

	@Override
	public void run() {
		Controller controller;
		if (cli || script != null)
			controller = new HeadlessController(input, script);
		else
			controller = new GuiController(input);
		controller.setup();
		controller.run();
	}
}

package me.coley.recaf.command.impl;

import me.coley.recaf.Recaf;
import me.coley.recaf.control.Controller;
import me.coley.recaf.control.gui.GuiController;
import me.coley.recaf.control.headless.HeadlessController;
import picocli.CommandLine;

import java.awt.*;
import java.io.File;

/**
 * Command line initializer for Recaf, invoked from the main method.
 *
 * @author Matt
 */
@CommandLine.Command(
		name = "Recaf",
		version = Recaf.VERSION,
		description = "Recaf: A modern java bytecode editor.",
		mixinStandardHelpOptions = true)
public class Initializer implements Runnable {
	/**
	 * Workspace file to import.
	 */
	@CommandLine.Option(names = {"--input" }, description = "The input file to load. " +
			"Supported types are: class, jar, json")
	public File input;
	@CommandLine.Option(names = {"--script" }, description = "Script file to load for cli usage")
	public File script;
	@CommandLine.Option(names = { "--cli" }, description = "Run Recaf via CLI")
	public boolean cli;

	@Override
	public void run() {
		Controller controller;
		if (cli || script != null || GraphicsEnvironment.isHeadless())
			controller = new HeadlessController(input, script);
		else
			controller = new GuiController(input);
		controller.setup();
		controller.run();
	}
}

Check if we are running in headless environment


package org.usfirst.frc2832.Robot_2016.HID;

import java.util.ArrayList;

public class VirtualGamepad {
	private ArrayList<GamepadState> states;
	private boolean done;

	// Millisecond timings
	long startTime, recordedOffset;
	int lastIndex = 0;

	public VirtualGamepad(ArrayList<GamepadState> states) {
		this.states = states;
	}

	public void start() {
		startTime = System.currentTimeMillis();
		recordedOffset = states.get(0).timestamp;

		done = false;
		lastIndex = 0;
	}

	public boolean isDone() {
		return (done);
	}

	public GamepadState getCurrentState() {
		long time = System.currentTimeMillis();

		// Interpolate the times, using the last recorded gamepad state.
		while (states.get(lastIndex).timestamp - recordedOffset <= time - startTime)
			lastIndex++;
		lastIndex--;

		if (lastIndex >= states.size()) {
			done = true;
			return (null);
		}

		// lastIndex now has the latest recorded data from the gamepad at this current time.
		return (states.get(lastIndex));
	}
}

package org.usfirst.frc2832.Robot_2016.HID;

import java.util.ArrayList;

public class VirtualGamepad {
	private ArrayList<GamepadState> states;
	private boolean done;

	// Millisecond timings
	long startTime, recordedOffset;
	int lastIndex = 0;

	public VirtualGamepad(ArrayList<GamepadState> states) {
		this.states = states;
	}

	public void start() {
		startTime = System.currentTimeMillis();
		recordedOffset = states.get(0).timestamp;

		done = false;
		lastIndex = 0;
	}

	public boolean isDone() {
		return (done);
	}

	public GamepadState getCurrentState() {
		long time = System.currentTimeMillis();

		// Interpolate the times, using the last recorded gamepad state.
		while (lastIndex < states.size()) {
			if (states.get(lastIndex).timestamp - recordedOffset <= time - startTime)
				lastIndex++;
		}

		if (lastIndex >= states.size()) {
			done = true;
			return (null);
		}

		// We overshot in that interpolation stage, that was the first time it "failed"
		lastIndex--;

		// lastIndex now has the latest recorded data from the gamepad at this current time.
		return (states.get(lastIndex));
	}
}

Fix issue with out of bounds array check in recordable autonomous


package de.japkit.roo.japkit.web;

import org.springframework.format.FormatterRegistrar;
import org.springframework.format.FormatterRegistry;

import de.japkit.annotations.ParamNames;
import de.japkit.metaannotations.Method;
import de.japkit.metaannotations.Template;
import de.japkit.roo.base.web.EntityConverterUtil;
import de.japkit.roo.base.web.LabelProvider;

@Template
public abstract class ControllerFormatterMembers implements FormatterRegistrar, LabelProvider<FormBackingObject> {

		@Method(imports={EntityConverterUtil.class} ,
				bodyCode="EntityConverterUtil.registerConverters(#{fbo.name}.class, registry, crudOperations(), this);")
		@ParamNames("registry")
		@Override
		public void registerFormatters(FormatterRegistry registry) {
			//EntityConverterUtil.registerConverters(FormBackingObject.class, registry, crudOperations(), this);
		}

		//TODO
		@Method(bodyCode="return \"ID: \" + entity.getId();")
		@Override
		@ParamNames("entity")
		public String getLabel(FormBackingObject entity) {
			return null;
		}

}

package de.japkit.roo.japkit.web;

import org.springframework.format.FormatterRegistrar;
import org.springframework.format.FormatterRegistry;

import de.japkit.annotations.ParamNames;
import de.japkit.metaannotations.Method;
import de.japkit.metaannotations.Template;
import de.japkit.roo.base.web.EntityConverterUtil;
import de.japkit.roo.base.web.LabelProvider;

@Template
public abstract class ControllerFormatterMembers implements FormatterRegistrar, LabelProvider<FormBackingObject> {

		@Method(imports={EntityConverterUtil.class} ,
				bodyCode="EntityConverterUtil.registerConverters(#{fbo.code}.class, registry, crudOperations(), this);")
		@ParamNames("registry")
		@Override
		public void registerFormatters(FormatterRegistry registry) {
			//EntityConverterUtil.registerConverters(FormBackingObject.class, registry, crudOperations(), this);
		}

		//TODO
		@Method(bodyCode="return \"ID: \" + entity.getId();")
		@Override
		@ParamNames("entity")
		public String getLabel(FormBackingObject entity) {
			return null;
		}

}

Use .code instead of .name for type references in code bodies


/*
 * This file is part of COMPASS. It is subject to the license terms in
 * the LICENSE file found in the top-level directory of this distribution.
 * (Also available at http://www.apache.org/licenses/LICENSE-2.0.txt)
 * You may not use this file except in compliance with the License.
 */
package de.dfki.asr.compass.test.integration;

import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.testng.Arquillian;
import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
import org.jboss.shrinkwrap.resolver.api.maven.Maven;
import static org.testng.Assert.assertTrue;
import org.testng.annotations.Test;

public class DeploymentDeployTest extends Arquillian {
	public static final String ARTIFACT =
			"de.dfki.asr.compass:compass-deployment:ear:?";

	@Deployment
	public static EnterpriseArchive getCoreCompassDeployment() {
		return Maven.configureResolverViaPlugin()
				.resolve(ARTIFACT)
				.withoutTransitivity()
				.asSingle(EnterpriseArchive.class);
	}

	@Test
	public void itWorked() {
		assertTrue(true);
	}
}

/*
 * This file is part of COMPASS. It is subject to the license terms in
 * the LICENSE file found in the top-level directory of this distribution.
 * (Also available at http://www.apache.org/licenses/LICENSE-2.0.txt)
 * You may not use this file except in compliance with the License.
 */
package de.dfki.asr.compass.test.integration;

import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.testng.Arquillian;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.jboss.shrinkwrap.resolver.api.maven.Maven;
import static org.testng.Assert.assertTrue;
import org.testng.annotations.Test;

public class DeploymentDeployTest extends Arquillian {
	public static final String ARTIFACT =
			"de.dfki.asr.compass:compass-deployment:ear:?";

	@Deployment
	public static EnterpriseArchive getCoreCompassDeployment() {
		JavaArchive testWar = ShrinkWrap
				.create(JavaArchive.class)
				.addClass(DeploymentDeployTest.class);
		EnterpriseArchive compass = Maven.configureResolverViaPlugin()
				.resolve(ARTIFACT)
				.withoutTransitivity()
				.asSingle(EnterpriseArchive.class);
		compass.addAsLibrary(testWar);
		return compass;
	}

	@Test
	public void itWorked() {
		assertTrue(true);
	}
}

Add the Unit Test as a Library to the EAR prior to deployment.


import rabbit.Receiver;

public class Client {

    public static void main(String[] args) {
        Receiver receiver = new Receiver();
        receiver.startReceiving();
    }
}

import dmon.core.commons.helpers.CommandLineArgumentParser;
import dmon.core.commons.helpers.PidManipulation;
import dmon.core.commons.helpers.ProgramArguments;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.MDC;
import rabbit.Receiver;

public class Client {
    public static final Logger logger = LoggerFactory.getLogger(Client.class);

    public static void main(String[] args) {
        MDC.put("pid", PidManipulation.getPid());
        logger.info("Scanner is started!");

        new CommandLineArgumentParser(args).parse();
        if (ProgramArguments.getPidFile() != null) {
            PidManipulation.writeOwnPidToFile(ProgramArguments.getPidFile());
        }
        else {
            PidManipulation.writeOwnPidToFile("../var/specs_monitoring_nmap_scheduler.pid");
        }

        Receiver receiver = new Receiver();
        receiver.startReceiving();

        MDC.clear();
    }
}

Add argument parser to Scheduler component.


public class BasicArithmatic
{
	private static final int constant = 10;

	public static int casualMethod()
	{
		return 1;
	}

	public static void main(String args)
	{
		int a = 4;
		int b = 2 + casualMethod();
		int sum = a + b;
		int product = a*b;
		int difference = a -b;
		int addImmediate = a + 2;
		int subImmediate = a - 2;
		//int addConstant = b * constant;
		//addConstant += 2;
		int multiplyImmediate = b * 0x05;
		int parenthesis = a + ( a + b );
		int pemdasFull = (a + b) * 3 - 10;
		int pemdasFullAlternate = a + b * (3 - 10);
		int multipleParenthis = 1 + (a + (b - 5) * 2) * 7;
		//multiplyImmediate = multiplyImmediate << 1;
		//multiplyImmediate++;
		//boolean test = true | false;

		//CasualMethod();

		//Sum(a, b);
		// DO NOT LEX
		/* Do not lex */
		/*
		 * Do not lex 2
		 */
		// /**/ Do not lex 3
		/*
		 *
		 * // */
		// Strings are currently unsupported
		// String s = "/*LexAstring" + lex + "LexAstring*/ LexAstring";
	}
}

public class BasicArithmatic
{
	private static final int constant = 10;

	public static int casualMethod()
	{
		return 1;
	}

	public static void main(String args)
	{
		int a = 4;
		int b = 2 + casualMethod();
		if (true)
		{
			b += 1;
		}
		int sum = a + b;
		int product = a*b;
		int difference = a -b;
		int addImmediate = a + 2;
		int subImmediate = a - 2;
		//int addConstant = b * constant;
		//addConstant += 2;
		int multiplyImmediate = b * 0x05;
		int parenthesis = a + ( a + b );
		int pemdasFull = (a + b) * 3 - 10;
		int pemdasFullAlternate = a + b * (3 - 10);
		int multipleParenthis = 1 + (a + (b - 5) * 2) * 7;
		//multiplyImmediate = multiplyImmediate << 1;
		//multiplyImmediate++;
		//boolean test = true | false;

		//CasualMethod();

		//Sum(a, b);
		// DO NOT LEX
		/* Do not lex */
		/*
		 * Do not lex 2
		 */
		// /**/ Do not lex 3
		/*
		 *
		 * // */
		// Strings are currently unsupported
		// String s = "/*LexAstring" + lex + "LexAstring*/ LexAstring";
	}
}

Add conditional to sample java file

Add conditional to sample java file