/*
 * Copyright 2013-2017 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.cloudfoundry.operations.buildpacks;

import org.immutables.value.Value;

/**
 * A Cloud Foundry Buildpack
 */
@Value.Immutable
abstract class _Buildpack {

    /**
     * The enabled flag
     */
    abstract Boolean getEnabled();

    /**
     * The filename
     */
    abstract String getFilename();

    /**
     * The id
     */
    abstract String getId();

    /**
     * The locked flag
     */
    abstract Boolean getLocked();

    /**
     * The name
     */
    abstract String getName();

    /**
     * The position
     */
    abstract Integer getPosition();

}

/*
 * Copyright 2013-2017 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.cloudfoundry.operations.buildpacks;

import org.cloudfoundry.Nullable;
import org.immutables.value.Value;

/**
 * A Cloud Foundry Buildpack
 */
@Value.Immutable
abstract class _Buildpack {

    /**
     * The enabled flag
     */
    abstract Boolean getEnabled();

    /**
     * The filename
     */
    @Nullable
    abstract String getFilename();

    /**
     * The id
     */
    abstract String getId();

    /**
     * The locked flag
     */
    abstract Boolean getLocked();

    /**
     * The name
     */
    abstract String getName();

    /**
     * The position
     */
    abstract Integer getPosition();

}

Allow for Missing Buildpack Filename


// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.config.server.maintenance;

import com.yahoo.vespa.config.server.ApplicationRepository;
import com.yahoo.vespa.curator.Curator;

import java.time.Duration;

/**
 * Removes inactive sessions
 * <p>
 * Note: Unit test is in ApplicationRepositoryTest
 *
 * @author hmusum
 */
public class SessionsMaintainer extends ConfigServerMaintainer {
    private final boolean hostedVespa;

    SessionsMaintainer(ApplicationRepository applicationRepository, Curator curator, Duration interval) {
        // Start this maintainer immediately. It frees disk space, so if disk goes full and config server
        // restarts this makes sure that cleanup will happen as early as possible
        super(applicationRepository, curator, Duration.ZERO, interval);
        this.hostedVespa = applicationRepository.configserverConfig().hostedVespa();
    }

    @Override
    protected void maintain() {
        applicationRepository.deleteExpiredLocalSessions();

        // Expired remote sessions are not expected to exist, they should have been deleted when
        // a deployment happened or when the application was deleted. We still see them from time to time,
        // probably due to some race or another bug
        if (hostedVespa) {
            Duration expiryTime = Duration.ofDays(30);
            applicationRepository.deleteExpiredRemoteSessions(expiryTime);
        }
    }
}

// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.config.server.maintenance;

import com.yahoo.vespa.config.server.ApplicationRepository;
import com.yahoo.vespa.curator.Curator;

import java.time.Duration;

/**
 * Removes inactive sessions
 * <p>
 * Note: Unit test is in ApplicationRepositoryTest
 *
 * @author hmusum
 */
public class SessionsMaintainer extends ConfigServerMaintainer {
    private final boolean hostedVespa;

    SessionsMaintainer(ApplicationRepository applicationRepository, Curator curator, Duration interval) {
        // Start this maintainer immediately. It frees disk space, so if disk goes full and config server
        // restarts this makes sure that cleanup will happen as early as possible
        super(applicationRepository, curator, Duration.ZERO, interval);
        this.hostedVespa = applicationRepository.configserverConfig().hostedVespa();
    }

    @Override
    protected void maintain() {
        applicationRepository.deleteExpiredLocalSessions();

        // Expired remote sessions are sessions that belong to an application that have external deployments that
        // are no longer active
        if (hostedVespa) {
            Duration expiryTime = Duration.ofDays(7);
            applicationRepository.deleteExpiredRemoteSessions(expiryTime);
        }
    }
}

Reduce the time we keep expired remotes sessions and fix comment


package com.sequenceiq.cloudbreak.service.upgrade.ccm;

import org.springframework.stereotype.Service;

import com.sequenceiq.cloudbreak.api.endpoint.v4.dto.NameOrCrn;
import com.sequenceiq.flow.api.model.FlowIdentifier;

@Service
public class StackCcmUpgradeService {
    public FlowIdentifier upgradeCcm(NameOrCrn nameOrCrn) {
        return null;
    }
}

package com.sequenceiq.cloudbreak.service.upgrade.ccm;

import static com.sequenceiq.cloudbreak.core.flow2.cluster.ccm.upgrade.CcmUpgradeEvent.CCM_UPGRADE_EVENT;

import javax.inject.Inject;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import com.sequenceiq.cloudbreak.api.endpoint.v4.dto.NameOrCrn;
import com.sequenceiq.cloudbreak.core.flow2.service.ReactorNotifier;
import com.sequenceiq.cloudbreak.domain.stack.Stack;
import com.sequenceiq.cloudbreak.logger.MDCBuilder;
import com.sequenceiq.cloudbreak.reactor.api.event.StackEvent;
import com.sequenceiq.cloudbreak.service.stack.StackService;
import com.sequenceiq.cloudbreak.structuredevent.CloudbreakRestRequestThreadLocalService;
import com.sequenceiq.flow.api.model.FlowIdentifier;

@Service
public class StackCcmUpgradeService {

    private static final Logger LOGGER = LoggerFactory.getLogger(StackCcmUpgradeService.class);

    @Inject
    private CloudbreakRestRequestThreadLocalService restRequestThreadLocalService;

    @Inject
    private StackService stackService;

    @Inject
    private ReactorNotifier reactorNotifier;

    public FlowIdentifier upgradeCcm(NameOrCrn nameOrCrn) {
        Long workspaceId = restRequestThreadLocalService.getRequestedWorkspaceId();
        Stack stack = stackService.getByNameOrCrnInWorkspace(nameOrCrn, workspaceId);
        MDCBuilder.buildMdcContext(stack);
        LOGGER.debug("Ccm upgrade has been initiated for stack {}", nameOrCrn.getNameOrCrn());
        String selector = CCM_UPGRADE_EVENT.event();
        return reactorNotifier.notify(stack.getId(), selector, new StackEvent(selector, stack.getId()));
    }
}

Revert "Revert "CB-14584 triggering ccm upgrade flow through internal call""


/**
 * This class will instill 'normal' iterator behavior to a ColumnFamilyResult.
 * Simply instantiate this class while passing your ColumnFamilyResult as a
 * constructor argument.
 *
 * Ex.
 *
 * ColumnFamilyResultIterator myResultsInterator =
 *      new ColumnFamilyResultIterator(someColumnFamilyResult);
 *
 * You can then use myResultsInterator with for loops or iterate with a while loop
 * just as with any standard java iterator.
 *
 */
package me.prettyprint.cassandra.service.template;

import java.util.Iterator;

import me.prettyprint.cassandra.service.template.ColumnFamilyResult;

public class ColumnFamilyResultIterator implements Iterator<ColumnFamilyResult<?,?>> {
        private ColumnFamilyResult<?, ?> res;
        private boolean isStart = true;

        public ColumnFamilyResultIterator(ColumnFamilyResult<?, ?> res) {
            this.res = res;
        }

        public boolean hasNext()
        {
            boolean retval = false;
            if (isStart)
            {
                retval = res.hasResults();
            }
            else
            {
                retval = res.hasNext();
            }
            return retval;
        }

        public ColumnFamilyResult<?, ?> getRes()
        {
            return res;
        }

        public void setRes(ColumnFamilyResult<?, ?> res)
        {
            this.res = res;
        }

        public ColumnFamilyResult<?, ?> next()
        {
            if (isStart)
            {
                isStart = false;
                return res;
            }
            else
            {
                return (ColumnFamilyResult<?, ?>) res.next();
            }
        }

        public void remove()
        {
            res.remove();
        }
}

/**
 * This class will instill 'normal' iterator behavior to a ColumnFamilyResult.
 * Simply instantiate this class while passing your ColumnFamilyResult as a
 * constructor argument.
 *
 * Ex.
 *
 * ColumnFamilyResultIterator myResultsInterator =
 *      new ColumnFamilyResultIterator(someColumnFamilyResult);
 *
 * You can then use myResultsInterator with for loops or iterate with a while loop
 * just as with any standard java iterator.
 *
 */
package me.prettyprint.cassandra.service.template;

import java.util.Iterator;

import me.prettyprint.cassandra.service.template.ColumnFamilyResult;

public class ColumnFamilyResultIterator implements Iterator<ColumnFamilyResult<?,?>> {
        private ColumnFamilyResult<?, ?> res;
        private boolean isStart = true;

        public ColumnFamilyResultIterator(ColumnFamilyResult<?, ?> res) {
            this.res = res;
        }

		public boolean hasNext()
		{
			boolean retval = false;
			if (isStart)
			{
				if(res.hasResults() || res.hasNext())
				{
					retval = true;
				}
			}
			else
			{
				retval = res.hasNext();
			}
			return retval;
		}

        public ColumnFamilyResult<?, ?> getRes()
        {
            return res;
        }

        public void setRes(ColumnFamilyResult<?, ?> res)
        {
            this.res = res;
        }

        public ColumnFamilyResult<?, ?> next()
        {
            if (isStart)
            {
                isStart = false;
                return res;
            }
            else
            {
                return (ColumnFamilyResult<?, ?>) res.next();
            }
        }

        public void remove()
        {
            res.remove();
        }
}

Fix bug in hasNext when no result for a key is returned


/*
 * generated by Xtext
 */
package com.rockwellcollins.atc.agree.serializer;

public class AgreeSyntacticSequencer extends AbstractAgreeSyntacticSequencer {
}

/*
 * generated by Xtext
 */
package com.rockwellcollins.atc.agree.serializer;

import org.eclipse.emf.ecore.EObject;
import org.eclipse.xtext.RuleCall;
import org.eclipse.xtext.nodemodel.INode;

public class AgreeSyntacticSequencer extends AbstractAgreeSyntacticSequencer {
	/**
	 * AppliesToKeywords:
	 * 	'applies' 'to'
	 * ;
	 */
	@Override
	protected String getAppliesToKeywordsToken(EObject semanticObject, RuleCall ruleCall, INode node) {
		if (node != null) {
			return getTokenText(node);
		}
		return "applies to";
	}

	/**
	 * InBindingKeywords:
	 * 	'in' 'binding'
	 * ;
	 */
	@Override
	protected String getInBindingKeywordsToken(EObject semanticObject, RuleCall ruleCall, INode node) {
		if (node != null) {
			return getTokenText(node);
		}
		return "in binding";
	}

	/**
	 * InModesKeywords:
	 * 	'in' 'modes'
	 * ;
	 */
	@Override
	protected String getInModesKeywordsToken(EObject semanticObject, RuleCall ruleCall, INode node) {
		if (node != null) {
			return getTokenText(node);
		}
		return "in modes";
	}
}

Fix keyword sequence serialization for Agree.


/*
 * Copyright 2010-2019 Boxfuse GmbH
 *
 * 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.flywaydb.core.internal.configuration;

import org.flywaydb.core.api.FlywayException;
import org.flywaydb.core.api.configuration.Configuration;

public class ConfigurationValidator {
    public void validate(Configuration configuration) {
        if (configuration.isBatch() && configuration.getErrorOverrides().length > 0) {
            throw new FlywayException("flyway.batch configuration option is incompatible with flyway.errorOverrides.\n" +
                    "It is impossible to intercept the errors in a batch process.\n" +
                    "Set flyway.batch to false, or remove the error overrides.");
        }

        if (configuration.getDataSource() == null) {
            throw new FlywayException("Unable to connect to the database. Configure the url, user and password!");
        }
    }
}

/*
 * Copyright 2010-2019 Boxfuse GmbH
 *
 * 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.flywaydb.core.internal.configuration;

import org.flywaydb.core.api.FlywayException;
import org.flywaydb.core.api.configuration.Configuration;

public class ConfigurationValidator {
    public void validate(Configuration configuration) {

        if (configuration.getDataSource() == null) {
            throw new FlywayException("Unable to connect to the database. Configure the url, user and password!");
        }
    }
}

Fix regression in Community edition


package cecs566_tth;

public class Driver
{
	public static void main(String [] args)
	{
//		System.out.println(Utils.translateTotalToLetters(Utils.compressionFunction(Utils.convertMessageTo4x4Matrices("I leave twenty million dollars to my friendly cousin Bill."))));
//		Integer [] targetNumbers = { 6,25,17,22 };
		String matchingHash = Utils.findMatchingHash("BFQG");
		System.out.println(matchingHash);
		System.out.println(Utils.convertMessageTo4x4Matrices(matchingHash));
	}
}

package cecs566_tth;

public class Driver
{
	public static void main(String [] args)
	{
		String matchingHash = Utils.findMatchingHash("BFQG");
		System.out.println(matchingHash);
		System.out.println(Utils.convertMessageTo4x4Matrices(matchingHash));
		System.out.println(Utils.translateHashValueToLetters(Utils.compressionFunction(Utils.convertMessageTo4x4Matrices(matchingHash))));
	}
}

Remove comments and fix function parameter for generating hash.


/*
 * Copyright (C) 2016 Reece H. Dunn
 *
 * 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 uk.co.reecedunn.intellij.plugin.xquery.psi.impl.xquery;

import com.intellij.extapi.psi.ASTWrapperPsiElement;
import com.intellij.lang.ASTNode;
import org.jetbrains.annotations.NotNull;

public class XQueryCDataSectionPsiImpl extends ASTWrapperPsiElement {
    public XQueryCDataSectionPsiImpl(@NotNull ASTNode node) {
        super(node);
    }
}

/*
 * Copyright (C) 2016 Reece H. Dunn
 *
 * 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 uk.co.reecedunn.intellij.plugin.xquery.psi.impl.xquery;

import com.intellij.extapi.psi.ASTWrapperPsiElement;
import com.intellij.lang.ASTNode;
import org.jetbrains.annotations.NotNull;
import uk.co.reecedunn.intellij.plugin.xquery.ast.xquery.XQueryCDataSection;

public class XQueryCDataSectionPsiImpl extends ASTWrapperPsiElement implements XQueryCDataSection {
    public XQueryCDataSectionPsiImpl(@NotNull ASTNode node) {
        super(node);
    }
}

Use an XQueryCDataSection for the CDataSection PSI.


/*
 *  Copyright 2000-2005 The Apache Software Foundation
 *
 *  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.apache.tomcat.jni;

/** Thread
 *
 * @author Mladen Turk
 * @version $Revision: 300969 $, $Date: 2005-07-12 16:56:11 +0200 (uto, 12 srp 2005) $
 */

public class Thread {

    /**
     * Get the current thread ID handle.
     */
    public static native long current();

}

Add missing new line at the end of file.


package de.fau.amos.virtualledger.android.views.savings.add;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;

import org.apache.commons.lang3.math.NumberUtils;

import butterknife.BindView;
import butterknife.ButterKnife;
import de.fau.amos.virtualledger.R;
import de.fau.amos.virtualledger.dtos.AddSavingsAccountData;

public class AddSavingsAccountAmountFragment extends AddSavingsAccountPage {
    @SuppressWarnings("unused")
    private static final String TAG = AddSavingsAccountAmountFragment.class.getSimpleName();

    @BindView(R.id.add_savings_account_edit_text_amount)
    EditText editText;

    @Nullable
    @Override
    public View onCreateView(final LayoutInflater inflater, @Nullable final ViewGroup container, @Nullable final Bundle savedInstanceState) {
        final View view = inflater.inflate(R.layout.saving_accounts_add_fragment_amount, container, false);
        ButterKnife.bind(this, view);

        return view;
    }

    @Override
    public void fillInData(final AddSavingsAccountData addSavingsAccountResult) {
        addSavingsAccountResult.goalBalance = NumberUtils.toDouble(editText.getText().toString());
    }
}

package de.fau.amos.virtualledger.android.views.savings.add;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.DatePicker;

import butterknife.BindView;
import butterknife.ButterKnife;
import de.fau.amos.virtualledger.R;
import de.fau.amos.virtualledger.dtos.AddSavingsAccountData;

public class AddSavingsAccountFinalDateFragment extends AddSavingsAccountPage {
    @SuppressWarnings("unused")
    private static final String TAG = AddSavingsAccountFinalDateFragment.class.getSimpleName();

    @BindView(R.id.add_savings_account_date_picker_enter_final_date)
    DatePicker datePicker;

    @Nullable
    @Override
    public View onCreateView(final LayoutInflater inflater, @Nullable final ViewGroup container, @Nullable final Bundle savedInstanceState) {
        final View view = inflater.inflate(R.layout.saving_accounts_add_fragment_final_date, container, false);
        ButterKnife.bind(this, view);

        return view;
    }

    @Override
    public void fillInData(final AddSavingsAccountData addSavingsAccountResult) {

    }
}

Add fragment class for final date


package fr.bouyguestelecom.tv.openapi.secondscreen.apiutils;

/**
 * @author Pierre-Etienne Cherière PCHERIER@bouyguestelecom.fr
 */
public class BboxApiUrl {

    public static final String USER_INTERFACE = "userinterface";
    public static final String REMOTE_CONTROLLER = "remotecontroller";
    public static final String SEND_KEY = USER_INTERFACE + "/" + REMOTE_CONTROLLER + "/key";
    public static final String SEND_TEXT = USER_INTERFACE + "/" + REMOTE_CONTROLLER + "/text";
    public static final String VOLUME = "volume";
    public static final String MANAGE_VOLUME = USER_INTERFACE + "/" + VOLUME;
    public static final String APPLICATIONS = "applications";
    public static final String APPLICATIONS_RUN = APPLICATIONS + "/run";
    public static final String APPLICATIONS_REGISTER = APPLICATIONS + "/register";
    public static final String SECURE_AUTH = "security/token";
    public static final String SECURE_CONNECT = "security/sessionId";
    public static final String NOTIFICATION = "notification";
    public static final String PACKAGE_NAME = "packageName";
    public static final String APP_NAME = "appName";
    public static final String LOGO_URL = "logoUrl";
    public static final String APP_ID = "appId";
    public static final String APP_STATE = "appState";
}

package fr.bouyguestelecom.tv.openapi.secondscreen.apiutils;

/**
 * @author Pierre-Etienne Cherière PCHERIER@bouyguestelecom.fr
 */
public class BboxApiUrl {

    public static final String USER_INTERFACE = "userinterface";
    public static final String REMOTE_CONTROLLER = "remotecontroller";
    public static final String SEND_KEY = USER_INTERFACE + "/" + REMOTE_CONTROLLER + "/key";
    public static final String SEND_TEXT = USER_INTERFACE + "/" + REMOTE_CONTROLLER + "/text";
    public static final String VOLUME = "volume";
    public static final String MANAGE_VOLUME = USER_INTERFACE + "/" + VOLUME;
    public static final String APPLICATIONS = "applications";
    public static final String APPLICATIONS_RUN = APPLICATIONS + "/run";
    public static final String APPLICATIONS_REGISTER = APPLICATIONS + "/register";
    public static final String SECURE_AUTH = "security/token";
    public static final String SECURE_CONNECT = "security/sessionId";
    public static final String NOTIFICATION = "notification";
    public static final String PACKAGE_NAME = "packageName";
    public static final String APP_NAME = "appName";
    public static final String LOGO_URL = "logoUrl";
    public static final String APP_ID = "appId";
    public static final String APP_STATE = "appState";
    public static final String MEDIA = "media";
}

Add media URL (used to get the current channel)


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

package org.gradle.api.plugins.migration.model.compare.internal;

public enum ComparisonResultType {
    EQUAL,
    UNEQUAL,
    FROM_ONLY,
    TO_ONLY
}

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

package org.gradle.api.plugins.migration.model.compare.internal;

public enum ComparisonResultType {
    EQUAL,
    UNEQUAL,
    FROM_ONLY,
    TO_ONLY,
    NON_EXISTENT // doesn't exist on either side, nothing to compare
}

Add a new comparison result type for when neither side has it.


/**
 * Created by arran on 21/11/2016.
 */
public interface Command {

    void doCommand();
}

/**
 * Created by arran on 21/11/2016.
 */
public interface Command {

    void doCommand(SceneController sceneController);
}

Add SceneController to do command


package org.codehaus.xfire.aegis;

import javax.xml.namespace.QName;

/**
 * A MessageReader. You must call getNextChildReader() until hasMoreChildReaders()
 * returns false.
 *
 * @author Dan Diephouse
 */
public interface MessageReader
{
    public String getValue();

    public int getValueAsInt();

    public long getValueAsLong();

    public double getValueAsDouble();

    public float getValueAsFloat();

	public boolean getValueAsBoolean();

    public boolean hasMoreAttributeReaders();

    public MessageReader getNextAttributeReader();

    public boolean hasMoreElementReaders();

    public MessageReader getNextElementReader();

    public QName getName();

    /**
     * Get the local name of the element this reader represents.
     * @return
     */
    public String getLocalName();

    /**
     * @return
     */
    public String getNamespace();

}

package org.codehaus.xfire.aegis;

import javax.xml.namespace.QName;

/**
 * A MessageReader. You must call getNextChildReader() until hasMoreChildReaders()
 * returns false.
 *
 * @author Dan Diephouse
 */
public interface MessageReader
{
    public String getValue();

    public int getValueAsInt();

    public long getValueAsLong();

    public double getValueAsDouble();

    public float getValueAsFloat();

	public boolean getValueAsBoolean();

    public MessageReader getAttributeReader( QName qName );

    public boolean hasMoreAttributeReaders();

    public MessageReader getNextAttributeReader();

    public boolean hasMoreElementReaders();

    public MessageReader getNextElementReader();

    public QName getName();

    /**
     * Get the local name of the element this reader represents.
     * @return Local Name
     */
    public String getLocalName();

    /**
     * @return Namespace
     */
    public String getNamespace();

    public String getNamespaceForPrefix( String prefix );

}

Add method to get AttributeReader for specific attribute as well as ability to determine namespaces for a given prefix


package com.proofpoint.jmx;

import com.google.inject.Binder;
import com.google.inject.Module;
import com.proofpoint.configuration.ConfigurationModule;

import javax.management.MBeanServer;
import java.lang.management.ManagementFactory;

public class JMXModule
        implements Module
{
    public void configure(Binder binder)
    {
        binder.bind(MBeanServer.class).toInstance(ManagementFactory.getPlatformMBeanServer());
        ConfigurationModule.bindConfig(binder, JMXConfig.class);
    }
}

package com.proofpoint.jmx;

import com.google.inject.Binder;
import com.google.inject.Module;
import com.google.inject.Scopes;
import com.proofpoint.configuration.ConfigurationModule;

import javax.management.MBeanServer;
import java.lang.management.ManagementFactory;

public class JMXModule
        implements Module
{
    @Override
    public void configure(Binder binder)
    {
        binder.bind(MBeanServer.class).toInstance(ManagementFactory.getPlatformMBeanServer());
        binder.bind(JMXAgent.class).in(Scopes.SINGLETON);
        ConfigurationModule.bindConfig(binder, JMXConfig.class);
    }
}

Make sure JMXAgent gets bound


package org.CG.infrastructure;

import javax.media.opengl.GL;

/**
 *
 * @author ldavid
 */
public abstract class Drawing {

    protected Point start;
    protected ColorByte color;
    protected boolean finished;
    protected int glDrawingType = GL.GL_POINTS;

    public Drawing() {
        // All drawings, except by polygons, are initiated with finished as true, as they don't allow second clicks.
        finished = true;
    }

    abstract public Drawing updateLastCoordinate(Point point);

    public Drawing setNextCoordinate(Point point) {
        if (finished) {
            throw new RuntimeException("Cannot set next coordinate if drawing is already finished.");
        }

        return this;
    }

    public void draw(GL gl) {
        gl.glColor3ub(color.getRed(), color.getGreen(), color.getBlue());
        gl.glBegin(glDrawingType);

        drawShape(gl);

        gl.glEnd();
    }

    abstract protected void drawShape(GL gl);

    public Drawing translate(Point point) {
        return setStart(point);
    }

    public Drawing setStart(Point start) {
        this.start = start;
        return this;
    }

    public Drawing setColor(ColorByte color) {
        this.color = color;
        return this;
    }

    public Drawing setFinished(boolean f) {
        finished = f;
        return this;
    }

    public boolean getFinished() {
        return finished;
    }
}

package org.CG.infrastructure;

import javax.media.opengl.GL;

/**
 *
 * @author ldavid
 */
public abstract class Drawing {

    protected Point start;
    protected ColorByte color;
    protected boolean finished;
    protected int glDrawingType = GL.GL_POINTS;

    public Drawing() {
        // All drawings, except by polygons, are initiated with finished
        // as true, as they don't allow second clicks.
        finished = true;
    }

    abstract public Drawing updateLastCoordinate(Point point);

    public Drawing setNextCoordinate(Point point) {
        if (finished) {
            throw new RuntimeException(
                "Cannot set next coordinate if drawing is already finished.");
        }

        return this;
    }

    public void draw(GL gl) {
        gl.glColor3ub(color.getRed(), color.getGreen(), color.getBlue());
        gl.glBegin(glDrawingType);

        drawShape(gl);

        gl.glEnd();
    }

    abstract protected void drawShape(GL gl);

    public Drawing translate(Point point) {
        return setStart(point);
    }

    public Drawing setStart(Point start) {
        this.start = start;
        return this;
    }

    public Drawing setColor(ColorByte color) {
        this.color = color;
        return this;
    }

    public Drawing setFinished(boolean f) {
        finished = f;
        return this;
    }

    public boolean getFinished() {
        return finished;
    }
}

Break lines so they don't overstep right margin


/*
 * Copyright 2012-2018 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
 *
 *      https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.springframework.boot.configurationsample.recursive;

import org.springframework.boot.configurationsample.ConfigurationProperties;

@ConfigurationProperties("prefix")
public class RecursiveProperties {

	private RecursiveProperties recursive;

	public RecursiveProperties getRecursive() {
		return this.recursive;
	}

	public void setRecursive(RecursiveProperties recursive) {
		this.recursive = recursive;
	}

}

/*
 * Copyright 2012-2019 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
 *
 *      https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.springframework.boot.configurationsample.recursive;

import org.springframework.boot.configurationsample.ConfigurationProperties;

@ConfigurationProperties("prefix")
public class RecursiveProperties {

	private RecursiveProperties recursive;

	public RecursiveProperties getRecursive() {
		return this.recursive;
	}

	public void setRecursive(RecursiveProperties recursive) {
		this.recursive = recursive;
	}

}

Update copyright header of changed files


package org.kohsuke.github;

import org.junit.Assert;
import org.junit.Test;

import java.io.IOException;

public class GHDiscussionTest extends AbstractGitHubWireMockTest {

    @Test
    public void testCreatedDiscussion() throws IOException {
        GHTeam team = gitHub.getOrganization(GITHUB_API_TEST_ORG).getTeamBySlug("dummy-team");
        GHDiscussion discussion = team.createDiscussion("Dummy").body("This is a dummy discussion").create();
        Assert.assertNotNull(discussion);
        Assert.assertEquals("Dummy", discussion.getTitle());
        Assert.assertEquals("This is a dummy discussion", discussion.getBody());
    }

}

package org.kohsuke.github;

import org.junit.Assert;
import org.junit.Test;

import java.io.IOException;

public class GHDiscussionTest extends AbstractGitHubWireMockTest {

    @Test
    public void testCreatedDiscussion() throws IOException {
        GHOrganization org = gitHub.getOrganization(GITHUB_API_TEST_ORG);
        org.name = GITHUB_API_TEST_ORG;
        GHTeam team = org.getTeamBySlug("dummy-team");
        GHDiscussion discussion = team.createDiscussion("Dummy").body("This is a dummy discussion").create();
        Assert.assertNotNull(discussion);
        Assert.assertEquals("Dummy", discussion.getTitle());
        Assert.assertEquals("This is a dummy discussion", discussion.getBody());
    }

}

Set the organisation name to avoid to populate a url request having /orgs/null


/*
 * Copyright 2018-present Facebook, 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 com.facebook.buck.config;

import com.facebook.buck.util.randomizedtrial.WithProbability;

/**
 * Incremental action graph mode with A/B experiment support.
 *
 * <p>Note that only a stable experiment makes sense here, as incrementality requires at least two
 * runs in a row with the feature enabled to show any effect.
 */
public enum IncrementalActionGraphMode implements WithProbability {
  ENABLED(0.1),
  DISABLED(0.9),
  EXPERIMENT(0.0),
  ;

  public static final IncrementalActionGraphMode DEFAULT = DISABLED;

  private final double probability;

  IncrementalActionGraphMode(double probability) {
    this.probability = probability;
  }

  @Override
  public double getProbability() {
    return probability;
  }
}

/*
 * Copyright 2018-present Facebook, 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 com.facebook.buck.config;

import com.facebook.buck.util.randomizedtrial.WithProbability;

/**
 * Incremental action graph mode with A/B experiment support.
 *
 * <p>Note that only a stable experiment makes sense here, as incrementality requires at least two
 * runs in a row with the feature enabled to show any effect.
 */
public enum IncrementalActionGraphMode implements WithProbability {
  ENABLED(0.5),
  DISABLED(0.5),
  EXPERIMENT(0.0),
  ;

  public static final IncrementalActionGraphMode DEFAULT = DISABLED;

  private final double probability;

  IncrementalActionGraphMode(double probability) {
    this.probability = probability;
  }

  @Override
  public double getProbability() {
    return probability;
  }
}

Change experiment to 50/50 split


package toothpick;

import java.util.Stack;
import toothpick.config.Binding;

import static java.lang.String.format;

public abstract class Configuration {

  public static volatile Configuration instance;

  abstract void checkIllegalBinding(Binding binding);

  abstract void checkCyclesStart(Class clazz);

  abstract void checkCyclesEnd();

  static {
    //default mode is production
    production();
  }

  public static void development() {
    instance = new Configuration() {
      private Stack<Class> cycleDetectionStack = new Stack<>();

      @Override
      void checkIllegalBinding(Binding binding) {

      }

      @Override
      void checkCyclesStart(Class clazz) {
        if (cycleDetectionStack.contains(clazz)) {
          //TODO make the message better
          throw new CyclicDependencyException(format("Class %s creates a cycle", clazz.getName()));
        }

        cycleDetectionStack.push(clazz);
      }

      @Override
      void checkCyclesEnd() {
        cycleDetectionStack.pop();
      }
    };
  }

  public static void production() {
    instance = new Configuration() {
      @Override
      void checkIllegalBinding(Binding binding) {
        //do nothing
      }

      @Override
      void checkCyclesStart(Class clazz) {
        //do nothing
      }

      @Override
      void checkCyclesEnd() {
        //do nothing
      }
    };
  }

  /**
   * Allows to pass custom configurations.
   *
   * @param configuration the configuration to use
   */
  static void setConfiguration(Configuration configuration) {
    instance = configuration;
  }
}

package toothpick;

import java.util.Stack;
import java.util.concurrent.locks.ReentrantLock;
import toothpick.config.Binding;

import static java.lang.String.format;

public abstract class Configuration {

  public static volatile Configuration instance;

  abstract void checkIllegalBinding(Binding binding);

  abstract void checkCyclesStart(Class clazz);

  abstract void checkCyclesEnd();

  static {
    //default mode is production
    production();
  }

  public static void development() {
    instance = new Configuration() {
      private Stack<Class> cycleDetectionStack = new Stack<>();
      //used to make the cycle check atomic.
      private ReentrantLock reentrantLock = new ReentrantLock();

      @Override
      void checkIllegalBinding(Binding binding) {

      }

      @Override
      void checkCyclesStart(Class clazz) {
        if (cycleDetectionStack.contains(clazz)) {
          //TODO make the message better
          throw new CyclicDependencyException(format("Class %s creates a cycle", clazz.getName()));
        }

        cycleDetectionStack.push(clazz);
        reentrantLock.lock();
      }

      @Override
      void checkCyclesEnd() {
        cycleDetectionStack.pop();
        reentrantLock.unlock();
      }
    };
  }

  public static void production() {
    instance = new Configuration() {
      @Override
      void checkIllegalBinding(Binding binding) {
        //do nothing
      }

      @Override
      void checkCyclesStart(Class clazz) {
        //do nothing
      }

      @Override
      void checkCyclesEnd() {
        //do nothing
      }
    };
  }

  /**
   * Allows to pass custom configurations.
   *
   * @param configuration the configuration to use
   */
  static void setConfiguration(Configuration configuration) {
    instance = configuration;
  }
}

Make cycle detection atomic. No 2 threads should use getInstance at the same time. The lock is shared for all scopes. This is a problem.


package uk.co.uwcs.choob.modules;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLStreamHandler;

class ChoobURLStreamHandler extends URLStreamHandler {
	@Override
	protected URLConnection openConnection(URL u) throws IOException {
		final String path = u.getPath();

		{
			final URL resource = ChoobURLStreamHandler.class.getResource(path);
			if (null != resource)
				return resource.openConnection();
		}

		for (File sourcePath : new File[] {
				new File("src/main/plugins-alpha"),
				new File("src/main/plugins"),
		}) {
			final File f = new File(sourcePath, u.getPath());
			if (f.isFile())
				return new URL("file:///" + f.getAbsolutePath()).openConnection();
		}

		throw new FileNotFoundException("Couldn't resolve '" + path + "' from the classpath or source directories");
	}
}

package uk.co.uwcs.choob.modules;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLStreamHandler;

class ChoobURLStreamHandler extends URLStreamHandler {
	@Override
	protected URLConnection openConnection(URL u) throws IOException {
		final String path = u.getPath();

		{
			final URL resource = ChoobURLStreamHandler.class.getResource(path);
			if (null != resource)
				return resource.openConnection();
		}

		for (File sourcePath : new File[] {
				new File("main/plugins-alpha"),
				new File("main/plugins"),
		}) {
			final File f = new File(sourcePath, u.getPath());
			if (f.isFile())
				return new URL("file:///" + f.getAbsolutePath()).openConnection();
		}

		throw new FileNotFoundException("Couldn't resolve '" + path + "' from the classpath or source directories");
	}
}

Fix Eclipse resolution of plugins; this may be different in other IDEs


package net.megaroid.math;

import java.util.Scanner;

public class Factors {

	private int mNumber;
	private int[] mFactors;
	private int mCount;

	public Factors(int number) {
		mNumber = number;
	}

	public int getNumber() {
		return mNumber;
	}

	public void printAllFactors() {
		if (mFactors == null) {
			initialize();
		}

		System.out.print("Factors: ");
		for (int i = 0; i < mCount; i++) {
			System.out.print(mFactors[i] + " ");;
		}
		System.out.println("");
 	}

	private void initialize()
	{
		int sqrtN = (int)Math.sqrt(mNumber);
		mCount = 0;

		mFactors = new int[sqrtN * 2];

		for (int i = 1; i <= sqrtN; i++) {
			if (mNumber % i == 0) {
				mFactors[mCount++] = i;
				if (i * i != mNumber) {
					mFactors[mCount++] = mNumber / i;
				}
			}
		}
	}

	public static void main(String[] args) {

		System.out.print("Input a number : ");

		Scanner scanner = new Scanner(System.in);
		int num = scanner.nextInt();
		scanner.close();

		Factors f = new Factors(num);
		System.out.println("The number is " + f.getNumber());

		f.printAllFactors();
	}
}

package net.megaroid.math;

import java.util.Scanner;
import java.util.LinkedList;

public class Factors {

	private int mNumber;
	private LinkedList<Integer> mFactors;

	public Factors(int number) {
		mNumber = number;
	}

	public int getNumber() {
		return mNumber;
	}

	public void printAllFactors() {
		if (mFactors == null) {
			initialize();
		}

		System.out.print("Factors: ");
		for (int i : mFactors) {
			System.out.print(i + " ");
		}
		System.out.println("");
 	}

	private void initialize()
	{
		int sqrtN = (int)Math.sqrt(mNumber);

		mFactors = new LinkedList<Integer>();

		for (int i = 1; i <= sqrtN; i++) {
			if (mNumber % i == 0) {
				mFactors.add(i);
				if (i * i != mNumber) {
					mFactors.add(mNumber / i);
				}
			}
		}
	}

	public static void main(String[] args) {

		System.out.print("Input a number : ");

		Scanner scanner = new Scanner(System.in);
		int num = scanner.nextInt();
		scanner.close();

		Factors f = new Factors(num);
		System.out.println("The number is " + f.getNumber());

		f.printAllFactors();
	}
}

Use LinkedList instead of Array


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

package org.chromium.hostedclient;

import android.app.Service;
import android.content.Intent;
import android.os.Binder;
import android.os.IBinder;

/**
 * Empty service used by the hosted mode to bind to, raising the application's importance.
 */
public class KeepAliveService extends Service {
    private static final Binder sBinder = new Binder();

    @Override
    public IBinder onBind(Intent intent) {
        return sBinder;
    }
}

// Copyright 2015 Google Inc. All Rights Reserved.
//
// 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.chromium.hostedclient;

import android.app.Service;
import android.content.Intent;
import android.os.Binder;
import android.os.IBinder;

/**
 * Empty service used by the hosted mode to bind to, raising the application's importance.
 */
public class KeepAliveService extends Service {
    private static final Binder sBinder = new Binder();

    @Override
    public IBinder onBind(Intent intent) {
        return sBinder;
    }
}

Make one remaining header consistent with LICENSE


/*******************************************************************************
 * Copyright 2014, 2017 gwt-ol3
 *
 * 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 ol.source;

import jsinterop.annotations.JsPackage;
import jsinterop.annotations.JsProperty;
import jsinterop.annotations.JsType;

/**
 * WMTS options.
 *
 * @author Tino Desjardins
 *
 */
@JsType(isNative = true, namespace = JsPackage.GLOBAL, name = "Object")
public class WmtsOptions extends TileImageOptions {

    /**
     * Sets the layername.
     *
     * @param layer layername
     */
    @JsProperty
    public native void setLayer(String layer);

    @JsProperty
    public native void setStyle(String style);

    @JsProperty
    public native void setFormat(String format);

    @JsProperty
    public native void setVersion(String version);

    @JsProperty
    public native void setMatrixSet(String matrixSet);

}

/*******************************************************************************
 * Copyright 2014, 2019 gwt-ol
 *
 * 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 ol.source;

import jsinterop.annotations.JsPackage;
import jsinterop.annotations.JsProperty;
import jsinterop.annotations.JsType;

/**
 * WMTS options.
 *
 * @author Tino Desjardins
 *
 */
@JsType(isNative = true, namespace = JsPackage.GLOBAL, name = "Object")
public class WmtsOptions extends TileImageOptions {

    /**
     * Sets the layername.
     *
     * @param layer layername
     */
    @JsProperty
    public native void setLayer(String layer);

    /**
     * @param requestEncoding Request encoding.
     */
    @JsProperty
    public native void setRequestEncoding(String requestEncoding);

    @JsProperty
    public native void setStyle(String style);

    @JsProperty
    public native void setFormat(String format);

    @JsProperty
    public native void setVersion(String version);

    @JsProperty
    public native void setMatrixSet(String matrixSet);

}

Add request encoding to WMTS source


package jasenmoloy.wirelesscontrol.helpers;

import android.widget.Button;

/**
 * Created by jasenmoloy on 5/20/16.
 */
public class UIHelper {

    /**
     * Visually and functionally enables a button
     * @param button        The button to enable
     */
    public static void enableButton(Button button) {
        button.setAlpha(1.0f);
        button.setClickable(true);
    }

    /**
     * Visually and functionally disables a button
     * @param button        The button to disable
     */
    public static void disableButton(Button button) {
        button.setAlpha(0.25f); //Make the button transparent to visually show the button is disabled.
        button.setClickable(false);
    }
}

package jasenmoloy.wirelesscontrol.helpers;

import android.content.Context;
import android.widget.Button;
import android.widget.Toast;

/**
 * Created by jasenmoloy on 5/20/16.
 */
public class UIHelper {

    /**
     * Visually and functionally enables a button
     * @param button        The button to enable
     */
    public static void enableButton(Button button) {
        button.setAlpha(1.0f);
        button.setClickable(true);
    }

    /**
     * Visually and functionally disables a button
     * @param button        The button to disable
     */
    public static void disableButton(Button button) {
        button.setAlpha(0.25f); //Make the button transparent to visually show the button is disabled.
        button.setClickable(false);
    }

    public static void displayToast(Context context, int duration, String text) {
        Toast.makeText(context, text, duration).show();
    }
}

Add ability to display toasts


package pong;

import java.awt.Color;
import java.awt.Graphics2D;
import java.util.Random;

public class Ball {
  private float x, y;
  private float angle;
  private float size;

  private Color color;

  public Ball() {
    Random r = new Random();
    this.angle = (float) (r.nextFloat() * 2 * Math.PI);
    this.size = 13;
    this.x = Screen.WIDTH / 2 - this.size / 2;
    this.y = Screen.HEIGHT / 2 - this.size / 2;
    this.color = Color.WHITE;
  }

  public void draw(Graphics2D g2d) {
    g2d.setColor(color);
    g2d.fillRect(
        (int) this.x,
        (int) this.y,
        (int) this.size,
        (int) this.size);
  }

  public void tick() {

  }
}

package pong;

import java.awt.Color;
import java.awt.Graphics2D;
import java.util.Random;

public class Ball {
  private float x, y;
  private float angle;
  private float size;

  private float speed;

  private Color color;

  public Ball() {
    Random r = new Random();
    this.angle = (float) (r.nextFloat() * 2 * Math.PI);
    this.size = 13;
    this.speed = 2;
    this.x = Screen.WIDTH / 2 - this.size / 2;
    this.y = Screen.HEIGHT / 2 - this.size / 2;
    this.color = Color.WHITE;
  }

  public void draw(Graphics2D g2d) {
    g2d.setColor(color);
    g2d.fillRect(
        (int) this.x,
        (int) this.y,
        (int) this.size,
        (int) this.size);
  }

  public void tick() {
    if (this.x + this.size > Screen.WIDTH) {
      // game over, one point to left
    } else if (this.x < 0) {
      // game over, one point to right
    }

    if (this.y + this.size > Screen.HEIGHT || this.y < 0) {
      this.angle = (float) (Math.PI - this.angle);
    }

    float d = this.speed;
    float dx = (float) (d * Math.sin(this.angle));
    float dy = (float) (d * Math.cos(this.angle));

    this.x += dx;
    this.y += dy;
  }
}

Make ball bounce off ceiling and floor


package utils;

/**
 * Class containing methods to parse the result lines retrieved from ThingSpeak
 * @author Johan Brunet, Julien Gallego
 *
 */
public class Parser {

	/**
	 * Parsing method that parses the line to retrieve the score value
	 * @param s the line to parse
	 * @return the score value
	 */
	public static int parseScore(String s) {
		String[] parse = s.split(",");
		return Integer.parseInt(parse[2]);
	}
}

package utils;

/**
 * Class containing methods to parse the result lines retrieved from ThingSpeak
 * @author Johan Brunet, Julien Gallego
 *
 */
public class Parser {

	/**
	 * Parsing method that parses the line to retrieve the score value
	 * @param s the line to parse
	 * @return the score value
	 */
	public static int parseScore(String s) {
		String[] parse = s.split(",");
		return Integer.parseInt(parse[2]);
	}

	public static String parseName(String s) {
		String[] parse = s.split(",");
		return parse[3];
	}
}

Add method to parse the name of the player


/*
 * Main.java
 *
 * Created on Wed Jan 14 13:03:12 EST 2004
 *
 * Copyright (c) 2004 Spallation Neutron Source
 * Oak Ridge National Laboratory
 * Oak Ridge, TN 37830
 */

package xal.service.pvlogger;

import xal.extension.service.ServiceDirectory;

/**
 * Main
 *
 * @author  tap
 */
public class Main {
	protected LoggerModel model;

	/** Main Constructor */
	public Main() {
		model = new LoggerModel();
	}

	/**
	 * run the service by starting the logger
	 */
	protected void run() {
		model.startLogging();
		new LoggerService(model);
	}

	/**
	 * Main entry point to the service.  Run the service.
	 * @param args The launch arguments to the service.
	 */
	static public void main(String[] args) {
		new Main().run();
	}
}

/*
 * Main.java
 *
 * Created on Wed Jan 14 13:03:12 EST 2004
 *
 * Copyright (c) 2004 Spallation Neutron Source
 * Oak Ridge National Laboratory
 * Oak Ridge, TN 37830
 */

package xal.service.pvlogger;

import xal.extension.service.ServiceDirectory;

/**
 * Main
 *
 * @author  tap
 */
public class Main {
	protected LoggerModel model;

	/** Main Constructor */
	public Main() {
		model = new LoggerModel();
	}

	/**
	 * run the service by starting the logger
	 */
	protected void run() {
		// get flag to test whether logging should be periodic and on-demand (default) or only on-demand
		final boolean periodicLogging = !Boolean.getBoolean( "xal.logging.noperiod" );
		if ( periodicLogging ) {
			model.startLogging();
		}
		else {
			System.out.println( "Warning! Periodic logging has been disabled due to command line flag. Will log on demand only." );
		}
		new LoggerService(model);
	}

	/**
	 * Main entry point to the service.  Run the service.
	 * @param args The launch arguments to the service.
	 */
	static public void main(String[] args) {
		new Main().run();
	}
}

Add a flag to the PV Logger service to disable periodic logging and only allow on-demand logging.


package com.awesometickets.config;

import java.io.IOException;

import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletResponse;

/**
 * Cross-Origin Resource Sharing filter.
 */
public class CORSFilter implements Filter {

    public void init(FilterConfig filterConfig) throws ServletException {}

    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
        throws IOException, ServletException {
        HttpServletResponse res = (HttpServletResponse)response;
        res.setHeader("Access-Control-Allow-Origin", "http://119.29.152.169");
        res.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE");
        res.setHeader("Access-Control-Max-Age", "3600");
        res.setHeader("Access-Control-Allow-Headers", "x-requested-with");
        res.setHeader("Access-Control-Allow-Credentials", "true");
        chain.doFilter(request, response);
    }

    public void destroy() {}

}

package com.awesometickets.config;

import java.io.IOException;

import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletResponse;

/**
 * Cross-Origin Resource Sharing filter.
 */
public class CORSFilter implements Filter {

    public void init(FilterConfig filterConfig) throws ServletException {}

    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
        throws IOException, ServletException {
        HttpServletResponse res = (HttpServletResponse)response;
        res.setHeader("Access-Control-Allow-Origin", "http://localhost:8080");
        res.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE");
        res.setHeader("Access-Control-Max-Age", "3600");
        res.setHeader("Access-Control-Allow-Headers", "x-requested-with");
        res.setHeader("Access-Control-Allow-Credentials", "true");
        chain.doFilter(request, response);
    }

    public void destroy() {}

}

Update CORS origin to localhost


package org.geojson.object;

public class FeatureCollection {

	private Feature[] features;

	public FeatureCollection(Feature[] features) {
		this.features = features;
	}

	public Feature[] getFeatures() {
		return features;
	}

	public void setFeatures(Feature[] features) {
		this.features = features;
	}
}

package org.geojson.object;

import java.util.List;

public class FeatureCollection {

	private List<Feature> features;

	public FeatureCollection(List<Feature> features) {
		this.features = features;
	}

	public Feature[] getFeatures() {
		return features.toArray(new Feature[0]);
	}
}

Use List<Feature> instead array in constructor.


package org.apache.hadoop.mapred;

import org.apache.hadoop.io.Closeable;
import org.apache.hadoop.mapred.JobConfigurable;

/**
 * A class to implement the trivial close and configure methods.
 * @author Owen O'Malley
 */
public class MapReduceBase implements Closeable, JobConfigurable {

  public void close() {
  }

  public void configure(JobConf job) {
  }

}

/**
 * Copyright 2006 The Apache Software Foundation
 *
 * 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.apache.hadoop.mapred;

import java.io.IOException;

import org.apache.hadoop.io.Closeable;
import org.apache.hadoop.mapred.JobConfigurable;

/** Base class for {@link Mapper} and {@link Reducer} implementations.
 * Provides default implementations for a few methods.
 *
 * @author Owen O'Malley
 */
public class MapReduceBase implements Closeable, JobConfigurable {

  /** Default implementation that does nothing. */
  public void close() throws IOException {
  }

  /** Default implementation that does nothing. */
  public void configure(JobConf job) {
  }

}

Fix so that close() throws IOException, so that classes which override this method can throw IOException, as specified in the Closeable interface. Also add the Apache license (which must be in every file) and add a bit more javadoc.


package leetcode;

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

/**
 * https://leetcode.com/problems/majority-element-ii/
 */
public class Problem229 {
    public List<Integer> majorityElement(int[] nums) {
        List<Integer> result = new ArrayList<>();
        // TODO
        return result;
    }

    public static void main(String[] args) {
        Problem229 prob = new Problem229();
    }
}

package leetcode;

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

/**
 * https://leetcode.com/problems/majority-element-ii/
 */
public class Problem229 {
    public List<Integer> majorityElement(int[] nums) {
        List<Integer> result = new ArrayList<>();
        Map<Integer, Integer> map = new HashMap<>();
        for (int num : nums) {
            if (map.containsKey(num)) {
                map.put(num, map.get(num)+1);
            } else {
                map.put(num, 1);
            }
        }
        map.forEach((num, count) -> {
            if (nums.length / 3 < count) {
                result.add(num);
            }
        });
        return result;
    }
}

Solve problem 229 (with O(n) space)


package org.odk.collect.android.model;

import android.os.Parcelable;

import auto.parcel.AutoParcel;

/**
 * An object that represents a patient.
 */
@AutoParcel
public abstract class Patient implements Parcelable {

    public abstract String getUuid();
    public abstract String getId();
    public abstract String getGivenName();
    public abstract String getFamilyName();

    public static Patient create(String uuid, String id, String givenName, String familyName) {
        return new AutoParcel_Patient(uuid, id, givenName, familyName);
    }
}

package org.odk.collect.android.model;

import android.os.Parcel;
import android.os.Parcelable;

/**
 * Patient details.
 */
public final class Patient implements Parcelable {

    // TODO: Document this field.
    public final String uuid;
    // TODO: Document this field.
    public final String id;
    public final String givenName;
    public final String familyName;

    public Patient(String uuid, String id, String givenName, String familyName) {
        this.uuid = uuid;
        this.id = id;
        this.givenName = givenName;
        this.familyName = familyName;
    }

    protected Patient(Parcel in) {
        uuid = in.readString();
        id = in.readString();
        givenName = in.readString();
        familyName = in.readString();
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(uuid);
        dest.writeString(id);
        dest.writeString(givenName);
        dest.writeString(familyName);
    }

    public static final Parcelable.Creator<Patient> CREATOR = new Parcelable.Creator<Patient>() {
        @Override
        public Patient createFromParcel(Parcel in) {
            return new Patient(in);
        }

        @Override
        public Patient[] newArray(int size) {
            return new Patient[size];
        }
    };
}

Remove auto-parcel dependency from ODK collect.


package burp;

public class BHttpRequestResponseFactory {

    public static BHttpRequestResponse create(IHttpRequestResponse requestResponse,
                                              IBurpExtenderCallbacks callbacks, IExtensionHelpers helpers) {
        BHttpRequestResponse bHttpRequestResponse = new BHttpRequestResponse();
        bHttpRequestResponse.request = BHttpRequestFactory.create(0x00004242, requestResponse,
                helpers.analyzeRequest(requestResponse), callbacks);
        bHttpRequestResponse.response = BHttpResponseFactory.create(0x00004242, requestResponse,
                helpers.analyzeResponse(requestResponse.getResponse()), callbacks);
        bHttpRequestResponse.messageType = "requestResponse";
        return bHttpRequestResponse;
    }
}

package burp;

public class BHttpRequestResponseFactory {

    public static BHttpRequestResponse create(IHttpRequestResponse requestResponse,
                                              IBurpExtenderCallbacks callbacks, IExtensionHelpers helpers) {
        BHttpRequestResponse bHttpRequestResponse = new BHttpRequestResponse();

        if (requestResponse.getRequest() != null && requestResponse.getRequest().length > 0) {
            bHttpRequestResponse.request = BHttpRequestFactory.create(0x00004242, requestResponse,
                    helpers.analyzeRequest(requestResponse), callbacks);
        }

        if (requestResponse.getResponse() != null && requestResponse.getResponse().length > 0) {
            bHttpRequestResponse.response = BHttpResponseFactory.create(0x00004242, requestResponse,
                    helpers.analyzeResponse(requestResponse.getResponse()), callbacks);
        }

        bHttpRequestResponse.messageType = "requestResponse";
        return bHttpRequestResponse;
    }
}

Fix null response issue with sitemap


package io.digdag.cli;

import com.beust.jcommander.IParameterValidator;
import com.beust.jcommander.ParameterException;

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

public class ParameterValidator implements IParameterValidator
{
    public void validate(String name, String value) throws ParameterException
    {
        if (!value.contains("=")) {
            throw new ParameterException("Parameter " + name + " expected a value of the form a=b but got:" + value);
        }
    }

    public static Map<String, String> toMap(List<String> list)
    {
        Map<String, String> map = new HashMap<>();
        list.forEach(value -> map.put(value.substring(0, value.indexOf("=")), value.substring(value.indexOf("=")+1)));
        return map;
    }
}

package io.digdag.cli;

import com.beust.jcommander.IParameterValidator;
import com.beust.jcommander.ParameterException;

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

public class ParameterValidator implements IParameterValidator
{
    public void validate(String name, String value) throws ParameterException
    {
        if (!value.contains("=")) {
            throw new ParameterException("Parameter " + name + " expected a value of the form a=b but got:" + value);
        }
    }

    public static Map<String, String> toMap(List<String> list)
    {
        Map<String, String> map = new HashMap<>();
        String key = null;

        for (String value : list) {
            if (value.contains("=")) {
                key = value.substring(0, value.indexOf("="));
                String val = value.substring(value.indexOf("=") + 1);
                map.put(key, val);
            }
            else {
                String val = new StringBuilder(map.get(key)).append(",").append(value).toString();
                map.put(key, val);
            }
        }

        return map;
    }
}

Fix string index out of bounds


package com.custardsource.parfait.dxm;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

import com.google.common.io.Closeables;

public class PcpConfig {

    private final static String pcpConf = System.getenv("PCP_CONF");
    private final static String pcpDir = System.getenv("PCP_DIR");

    public File getRoot() {
        return new File(pcpDir, "/");
    }

    private File getConfigFile() {
        if (pcpConf == null) {
            File etcDir = new File(getRoot(), "etc");
            return new File(etcDir, "pcp.conf");
        }
        return new File(pcpConf);
    }

    public String getValue(String key) {
        Properties properties = new Properties();
        File configuration = getConfigFile();
        InputStream is = null;
        String value = null;

        try {
            is = new FileInputStream(configuration);
            properties.load(is);
            value = properties.get(key).toString();
        } catch (FileNotFoundException e) {
        } catch (IOException e) {
            // just drop these, and go with defaults
        }
        finally {
            Closeables.closeQuietly(is);
        }
        return value;
    }
}

package com.custardsource.parfait.dxm;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

import com.google.common.io.Closeables;

public class PcpConfig {

    private final static String pcpConf = System.getenv("PCP_CONF");
    private final static String pcpDir = System.getenv("PCP_DIR");

    public File getRoot() {
        return new File(pcpDir, "/");
    }

    private File getConfigFile() {
        if (pcpConf == null) {
            File etcDir = new File(getRoot(), "etc");
            return new File(etcDir, "pcp.conf");
        }
        return new File(pcpConf);
    }

    public String getValue(String key) {
        Properties properties = new Properties();
        File configuration = getConfigFile();
        InputStream is = null;
        String value = System.getenv(key);

        if (value != null) {
            return value;
        }

        try {
            is = new FileInputStream(configuration);
            properties.load(is);
            value = properties.get(key).toString();
        } catch (FileNotFoundException e) {
        } catch (IOException e) {
            // just drop these, and go with defaults
        }
        finally {
            Closeables.closeQuietly(is);
        }
        return value;
    }
}

Allow user-override of pcp config variable like PCP_TMP_DIR.


package io.plumery.core;

/**
 * The role interface representing a command
 */
public abstract class Command implements Action {
    public int version;
}

package io.plumery.core;

/**
 * The role interface representing a command
 */
public abstract class Command implements Action {
    public int originalVersion;
}

Rename version attribute to explicitly mark the original version


package org.amc.servlet.listener;

/**
 *
 * @author Adrian Mclaughlin
 * @version 1
 */
import org.apache.log4j.Logger;

import javax.servlet.ServletContext;
import javax.servlet.annotation.WebListener;
import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpSessionEvent;
import javax.servlet.http.HttpSessionListener;

import com.sun.security.auth.UserPrincipal;

@WebListener
public class APLSessionListener implements HttpSessionListener
{
	private static Logger logger=Logger.getLogger(APLSessionListener.class);
	public static int count=0;
	@Override
	public void sessionCreated(HttpSessionEvent arg0)
	{
		synchronized(this)
		{
			count++;
			String address="";
			logger.info("(Create) There are "+count+" sessions");
			updateSerlvetContext(arg0);
		}

	}

	@Override
	public void sessionDestroyed(HttpSessionEvent arg0)
	{
		synchronized(this)
		{
			if(count>0)
			{
				count--;
			}
			logger.info("(Destroy) There are "+count+" sessions");
			updateSerlvetContext(arg0);
		}

	}

	private void updateSerlvetContext(HttpSessionEvent arg0)
	{
		synchronized(arg0.getSession().getServletContext())
		{
			ServletContext context=arg0.getSession().getServletContext();
			context.setAttribute("session_count", count);
		}
	}

}

package org.amc.servlet.listener;

/**
 *
 * @author Adrian Mclaughlin
 * @version 1
 */
import org.apache.log4j.Logger;

import javax.servlet.ServletContext;
import javax.servlet.annotation.WebListener;
import javax.servlet.http.HttpSessionEvent;
import javax.servlet.http.HttpSessionListener;

@WebListener
public class APLSessionListener implements HttpSessionListener
{
	private static Logger logger=Logger.getLogger(APLSessionListener.class);
	public static int count=0;
	@Override
	public void sessionCreated(HttpSessionEvent arg0)
	{
		synchronized(this)
		{
			count++;
			String address="";
			logger.info("(Create) There are "+count+" sessions");
			updateSerlvetContext(arg0);
		}

	}

	@Override
	public void sessionDestroyed(HttpSessionEvent arg0)
	{
		synchronized(this)
		{
			if(count>0)
			{
				count--;
			}
			logger.info("(Destroy) There are "+count+" sessions");
			updateSerlvetContext(arg0);
		}

	}

	private void updateSerlvetContext(HttpSessionEvent arg0)
	{
		synchronized(arg0.getSession().getServletContext())
		{
			ServletContext context=arg0.getSession().getServletContext();
			context.setAttribute("session_count", count);
		}
	}

}

Remove unnecessary and incorrect import


package flow.netbeans.markdown;

import org.netbeans.api.lexer.InputAttributes;
import org.netbeans.api.lexer.Language;
import org.netbeans.api.lexer.LanguagePath;
import org.netbeans.api.lexer.Token;
import org.netbeans.spi.lexer.LanguageEmbedding;
import org.netbeans.spi.lexer.LanguageProvider;
import flow.netbeans.markdown.highlighter.MarkdownLanguageHierarchy;
import flow.netbeans.markdown.highlighter.MarkdownTokenId;

@org.openide.util.lookup.ServiceProvider(service = org.netbeans.spi.lexer.LanguageProvider.class)
public class MarkdownLanguageProvider extends LanguageProvider {

    public Language<MarkdownTokenId> findLanguage(String mimeType) {
        if ("text/x-markdown".equals(mimeType)) {
            return new MarkdownLanguageHierarchy().language();
        }
        return null;
    }

    @Override
    public LanguageEmbedding<?> findLanguageEmbedding(
            Token arg0,
            LanguagePath arg1,
            InputAttributes arg2) {
        return null;
    }
}

package flow.netbeans.markdown;

import flow.netbeans.markdown.csl.MarkdownLanguageConfig;
import flow.netbeans.markdown.highlighter.MarkdownLanguageHierarchy;
import flow.netbeans.markdown.highlighter.MarkdownTokenId;
import org.netbeans.api.lexer.InputAttributes;
import org.netbeans.api.lexer.Language;
import org.netbeans.api.lexer.LanguagePath;
import org.netbeans.api.lexer.Token;
import org.netbeans.spi.lexer.LanguageEmbedding;
import org.netbeans.spi.lexer.LanguageProvider;

@org.openide.util.lookup.ServiceProvider(service = org.netbeans.spi.lexer.LanguageProvider.class)
public class MarkdownLanguageProvider extends LanguageProvider {

    @Override
    public Language<MarkdownTokenId> findLanguage(String mimeType) {
        if (MarkdownLanguageConfig.MIME_TYPE.equals(mimeType)) {
            return new MarkdownLanguageHierarchy().language();
        }
        return null;
    }

    @Override
    public LanguageEmbedding<?> findLanguageEmbedding(
            Token arg0,
            LanguagePath arg1,
            InputAttributes arg2) {
        return null;
    }
}

Make use of MarkdownLanguageConfig constants


package com.beyondtechnicallycorrect.pong;

/**
 * Hello world!
 *
 */
public class App
{
    public static void main( String[] args )
    {
        System.out.println( "Hello World!" );
    }
}

package com.beyondtechnicallycorrect.pong;

import javax.swing.JFrame;

public class App {

	public static void main( String[] args ) {
		javax.swing.SwingUtilities.invokeLater(
				new Runnable() {
					public void run() {
						setupGui();
					}
			});
	}

	private static void setupGui() {
		JFrame frame = new JFrame("Pong");
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		frame.pack();
		frame.setVisible(true);
	}

}

Add extremely basic GUI setup


package com.quicktravel.ticket_printer;

public class TicketElement {

  private int x = 0;
  private int y = 0;
  private int fontSize = 10;
  private boolean bold = false;
  private boolean italic = false;
  private String value = "";

  public boolean isImage() {
     return this.value.startsWith("image:");
  }

  public int getX() {
    return x;
  }

  public void setX(int x) {
    this.x = x;
  }

  public int getY() {
    return y;
  }

  public void setY(int y) {
    this.y = y;
  }

  public int getFontSize() {
    return fontSize;
  }

  public void setFontSize(int fontSize) {
    this.fontSize = fontSize;
  }

  public boolean isBold() {
    return bold;
  }

  public void setBold(boolean bold) {
    this.bold = bold;
  }

  public boolean isItalic() {
    return italic;
  }

  public void setItalic(boolean italic) {
    this.italic = italic;
  }

  public String getValue() {
    return value;
  }

  public String getImageValue() {
    return this.value.substring(6);
  }

  public void setValue(String value) {
    this.value = value;
  }

}

package com.quicktravel.ticket_printer;

public class TicketElement {

  private int x = 0;
  private int y = 0;
  protected String value = "";
  private int fontSize = 10;
  private boolean bold = false;
  private boolean italic = false;

  public int getX() {
    return x;
  }

  public void setX(int x) {
    this.x = x;
  }

  public int getY() {
    return y;
  }

  public void setY(int y) {
    this.y = y;
  }

  public String getValue() {
    return value;
  }

  public void setValue(String value) {
    this.value = value;
  }

  public boolean isImage() {
    return isImageUrl() || isImageBase64();
  }

  public boolean isImageUrl() {
     return this.value.startsWith("image:");
  }

  public boolean isImageBase64() {
     return this.value.startsWith("imageBase64:");
  }

  public int getFontSize() {
    return fontSize;
  }

  public void setFontSize(int fontSize) {
    this.fontSize = fontSize;
  }

  public boolean isBold() {
    return bold;
  }

  public void setBold(boolean bold) {
    this.bold = bold;
  }

  public boolean isItalic() {
    return italic;
  }

  public void setItalic(boolean italic) {
    this.italic = italic;
  }

  public String getImageValue() {
    return this.value.substring(6);
  }

}

Add imageBase64: prefix alongside image: for ticket element values


package com.tmitim.twittercli;

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

import com.github.rvesse.airline.annotations.Command;

import twitter4j.Status;
import twitter4j.Twitter;
import twitter4j.TwitterException;
import twitter4j.TwitterFactory;

/**
 * Get timeline
 */
@Command(name = "timeline", description = "Get your timeline")
public class TimeLine implements Runnable {

	public void run() {

		System.out.println("Pulling your timeline.");
		Twitter twitter = TwitterFactory.getSingleton();

		List<Status> statuses = new ArrayList<>();
		try {
			statuses = twitter.getHomeTimeline();
		} catch (TwitterException e) {
			e.printStackTrace();
		}
		for (Status status : statuses) {
			System.out.println(status.getUser().getName() + " (@" + status.getUser().getScreenName() + "): ");
			System.out.println(status.getText());
			System.out.println(status.getCreatedAt());
			System.out.println("");
		}
	}
}

package com.tmitim.twittercli;

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

import com.github.rvesse.airline.annotations.Command;

import twitter4j.Status;
import twitter4j.Twitter;
import twitter4j.TwitterException;
import twitter4j.TwitterFactory;

/**
 * Get timeline
 */
@Command(name = "timeline", description = "Get your timeline")
public class TimeLine implements Runnable {

	public void run() {

		System.out.println("Pulling your timeline.");
		Twitter twitter = TwitterFactory.getSingleton();

		List<Status> statuses = new ArrayList<>();
		try {
			statuses = twitter.getHomeTimeline();
		} catch (TwitterException e) {
			e.printStackTrace();
		}
		for (Status status : statuses) {
			System.out.println(status.getUser().getName() + " (@" + status.getUser().getScreenName() + "): ");
			System.out.println(status.getText());
			System.out.println(status.getCreatedAt());
			System.out.println(
				String.format(
					"ID: %d, RT: %d, <3: %d",
					status.getId(),
					status.getRetweetCount(),
					status.getFavoriteCount()
				)
			);
			System.out.println("");
		}
	}
}

Add id, favorite + rt count to timeline


package engine.element;

import java.util.ArrayList;
import java.util.List;
import engine.Endable;
import engine.UpdateAndReturnable;

/**
 * This class contains a wave, which is a set of enemies who are sent out from one spawn point. The
 * enemies may be sent all at once, randomly, or spaced evenly.
 *
 * @author Qian Wang
 * @author Bojia Chen
 *
 */
public class Wave extends GameElement implements UpdateAndReturnable, Endable {
    private List<List<String>> myEnemies;
    private double mySendRate;
    private int myEnemyIndex = 0;
    private int myTimer = 0;

    public Wave () {
        myEnemies = new ArrayList<>();
    }

    @Override
    public boolean hasEnded () {
        return myEnemyIndex == myEnemies.size();
    }

    @Override
    public List<String> update (int counter) {
        if (++myTimer == mySendRate && !hasEnded()) {
            myTimer = 0;
            return myEnemies.get(++myEnemyIndex);
        }
        return null; // No enemies to return
    }

}

package engine.element;

import java.util.ArrayList;
import java.util.List;
import engine.Endable;
import engine.UpdateAndReturnable;

/**
 * This class contains a wave, which is a set of enemies who are sent out from one spawn point. The
 * enemies may be sent all at once, randomly, or spaced evenly.
 *
 * @author Qian Wang
 * @author Bojia Chen
 *
 */
public class Wave extends GameElement implements UpdateAndReturnable, Endable {
    private List<List<String>> myEnemies;
    private double mySendRate;
    private int myEnemyIndex = 0;
    private int myTimer = 0;

    public Wave () {
        myEnemies = new ArrayList<>();
    }

    @Override
    public boolean hasEnded () {
        return myEnemyIndex == myEnemies.size();
    }

    @Override
    public List<String> update (int counter) {
        if (++myTimer == mySendRate && !hasEnded()) {
            myTimer = 0;
            return myEnemies.get(myEnemyIndex++);
        }
        return null; // No enemies to return
    }

}

Increment enemy index after getting enemies


package com.axellience.vuegwt.client.gwtpanel;

import com.axellience.vuegwt.client.VueGWT;
import com.axellience.vuegwt.client.component.VueComponent;
import com.axellience.vuegwt.client.vue.VueJsConstructor;
import com.google.gwt.user.client.ui.SimplePanel;

/**
 * Wrap a {@link VueComponent} instance in a GWT Panel
 * @author Adrien Baron
 */
public class VueGwtPanel<T extends VueComponent> extends SimplePanel
{
    private T vueComponentInstance;

    public VueGwtPanel(VueJsConstructor<T> vueJsConstructor)
    {
        super();
        vueComponentInstance = vueJsConstructor.instantiate();
    }

    public VueGwtPanel(Class<T> vueClass)
    {
        super();
        vueComponentInstance = VueGWT.createInstance(vueClass);
    }

    @Override
    protected void onAttach()
    {
        super.onAttach();
        vueComponentInstance.$mount(getElement());
    }

    public T vue()
    {
        return this.vueComponentInstance;
    }
}

package com.axellience.vuegwt.client.gwtpanel;

import com.axellience.vuegwt.client.VueGWT;
import com.axellience.vuegwt.client.component.VueComponent;
import com.axellience.vuegwt.client.vue.VueFactory;
import com.axellience.vuegwt.client.vue.VueJsConstructor;
import com.google.gwt.user.client.ui.SimplePanel;

/**
 * Wrap a {@link VueComponent} instance in a GWT Panel
 * @author Adrien Baron
 */
public class VueGwtPanel<T extends VueComponent> extends SimplePanel
{
    private T vueComponentInstance;

    public VueGwtPanel(VueFactory<T> vueFactory)
    {
        this(vueFactory.getJsConstructor());
    }

    public VueGwtPanel(VueJsConstructor<T> vueJsConstructor)
    {
        super();
        vueComponentInstance = vueJsConstructor.instantiate();
    }

    public VueGwtPanel(Class<T> vueClass)
    {
        this(VueGWT.getFactory(vueClass));
    }

    @Override
    protected void onAttach()
    {
        super.onAttach();
        vueComponentInstance.$mount(getElement());
    }

    public T vue()
    {
        return this.vueComponentInstance;
    }
}

Update VueGWT panel to support Factory


package com.conveyal.r5.api;

/**
 * Dummy request for GraphQL
 *
 * Since GraphQL request is in JSON Jackson needs this to parse it correctly.
 */
public class GraphQlRequest {
    public String query;
    //FIXME: This should be Map<String, Object> and be serialized automatically with Jackson but it
    //doesn't seems to work.
    public String variables;
}

package com.conveyal.r5.api;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

/**
 * Dummy request for GraphQL
 *
 * Since GraphQL request is in JSON Jackson needs this to parse it correctly.
 */
@JsonIgnoreProperties(ignoreUnknown = true)
public class GraphQlRequest {
    public String query;
    //FIXME: This should be Map<String, Object> and be serialized automatically with Jackson but it
    //doesn't seems to work.
    public String variables;
}

Allow unknown properties in GraphQL requests


package hk.ust.comp4321.database;

/**
 *
 * @author Alex Poon
 */
public class IndexInfo
{

  //Constants and fields.
  // -------------------------------------------------------------------------

  private int id;
  private int frequency;

  // Constructors.
  // -------------------------------------------------------------------------

  /**
   * This constrcutor encapsulates the index id and frequency of an index.
   *
   * @param id
   * @param frequency
   */
  public IndexInfo(int id, int frequency)
  {
    this.id = id;
    this.frequency = frequency;
  }

  /**
   * This method returns the index id of the index instance.
   *
   * @return the id of this index
   */
  public int getId()
  {
    return this.id;
  }
}

package hk.ust.comp4321.database;

/**
 *
 * @author Alex Poon
 */
public class IndexInfo
{

  //Constants and fields.
  // -------------------------------------------------------------------------

  private int id;
  private int frequency;

  // Constructors.
  // -------------------------------------------------------------------------

  /**
   * This constrcutor encapsulates the index id and frequency of an index.
   *
   * @param id
   * @param frequency
   */
  public IndexInfo(int id, int frequency)
  {
    this.id = id;
    this.frequency = frequency;
  }

  /**
   * This method returns the index id of the index instance.
   *
   * @return the id of this index
   */
  public int getId()
  {
    return this.id;
  }

  /**
   * This method returns the frequency of the index instance.
   *
   * @return the frequency of the index instance
   */
  public int getFrequency()
  {
    return this.frequency;
  }
}

Add missing function in index info


/*
 * Copyright 2016 iserge.
 *
 * 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.ol3cesium.client.ol;

import com.google.gwt.core.client.JavaScriptObject;

/**
 *
 * @author Serge Silaev aka iSergio <s.serge.b@gmail.com>
 */
public class RendererType extends JavaScriptObject {
    protected RendererType() {
        //
    }

    public static final String CANVAS = "canvas";
    public static final String DOM    = "dom";
    public static final String WEBGL  = "webgl";
}

/*
 * Copyright 2016 iserge.
 *
 * 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.ol3cesium.client.ol;

/**
 *
 * @author Serge Silaev aka iSergio <s.serge.b@gmail.com>
 */
public enum RendererType {
    CANVAS("canvas"), DOM("dom"), WEBGL("webgl"), UNKNOWN("unknown");

    private final String _value;

    private RendererType(String value) {
        _value = value;
    }

    public static RendererType fromString(String string) {
        if (CANVAS.toString().equalsIgnoreCase(string)) {
            return CANVAS;
        }
        else if (DOM.toString().equalsIgnoreCase(string)) {
            return DOM;
        }
        else if (WEBGL.toString().equalsIgnoreCase(string)) {
            return WEBGL;
        } else {
            return UNKNOWN;
        }
    }

    @Override
    public String toString() {
        return _value;
    }
}

Add enumiration for renderer type.


/*
 * 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.jackrabbit.oak.util;

/**
 * Utility class containing type safe counterparts for some of the predicates of
 * commons-collections.
 */
public class Predicates {
    private static final Predicate<?> NOT_NULL = new Predicate<Object>() {
        @Override
        public boolean evaluate(Object arg) {
            return arg != null;
        }
    };

    private Predicates() {
    }

    @SuppressWarnings("unchecked")
    public static <T> Predicate<T> nonNull() {
        return (Predicate<T>) NOT_NULL;
    }
}

Refactor ModifiedNodeState and related classes to use type safe iterator utilities missing license header (again, sorry)


package kawa.standard;
import kawa.lang.*;

public class list_p extends Procedure1
{
  public kawa.standard.list_p()
  {
    super("list?");
  }

  public Object apply1 (Object arg1)
  {
    if (List.list_length (arg1) >= 0)
      return Interpreter.trueObject;
    else
      return Interpreter.falseObject;
  }
}

package kawa.standard;
import kawa.lang.*;

/** Implement the standard Scheme function "list?". */

public class list_p extends Procedure1
{
  public Object apply1 (Object arg1)
  {
    if (List.list_length (arg1) >= 0)
      return Interpreter.trueObject;
    else
      return Interpreter.falseObject;
  }
}

Remove redundant name qualification (which J++ complains about). Remove constructors. Generally remove verbosity.


package hu.adamsan.selenium.framework.pages;

import org.openqa.selenium.support.ui.WebDriverWait;

import hu.adamsan.selenium.framework.selenium.Driver;

public class LoginPage {

    private static final String LOGIN_PAGE = Driver.BASE_ADDRESS + "/wp-login.php";

    public static void goTo() {
        Driver.INSTANCE.navigate().to(LOGIN_PAGE);
        WebDriverWait wait = new WebDriverWait(Driver.INSTANCE, 5);
        wait.until(driver -> {
            return driver.switchTo().activeElement().getAttribute("id").equals("user_login");
        });

    }

    public static LoginCommand loginAs(String username) {
        return new LoginCommand(username);
    }

}

package hu.adamsan.selenium.framework.pages;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.support.ui.WebDriverWait;

import hu.adamsan.selenium.framework.selenium.Driver;

public class LoginPage {

    private static final String LOGIN_PAGE = Driver.BASE_ADDRESS + "/wp-login.php";

    public static void goTo() {
        Driver.INSTANCE.navigate().to(LOGIN_PAGE);
        WebDriverWait wait = new WebDriverWait(Driver.INSTANCE, 5);
        com.google.common.base.Predicate<WebDriver> p = driver -> {
            return driver.switchTo().activeElement().getAttribute("id").equals("user_login");
        };
        wait.until(p);

    }

    public static LoginCommand loginAs(String username) {
        return new LoginCommand(username);
    }

}

Fix previously not occurring bug:The method until(Predicate<WebDriver>) is ambiguous for the type WebDriverWait


/*
 * Copyright (C) 2017 Yaroslav Mytkalyk
 *
 * 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.doctoror.fuckoffmusicplayer.di;

import android.content.Context;
import android.support.annotation.NonNull;

/**
 * Dagger2 {@link MainComponent} holder
 */
public final class DaggerHolder {

    private static volatile DaggerHolder instance;

    @NonNull
    public static DaggerHolder getInstance(@NonNull final Context context) {
        if (instance == null) {
            synchronized (DaggerHolder.class) {
                if (instance == null) {
                    instance = new DaggerHolder(context.getApplicationContext());
                }
            }
        }
        return instance;
    }

    @NonNull
    private final MainComponent mainComponent;

    private DaggerHolder(@NonNull final Context context) {
        final AppModule appContextModule = new AppModule(context);
        mainComponent = DaggerMainComponent.builder()
                .appContextModule(appContextModule)
                .build();
    }

    @NonNull
    public MainComponent mainComponent() {
        return mainComponent;
    }
}

/*
 * Copyright (C) 2017 Yaroslav Mytkalyk
 *
 * 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.doctoror.fuckoffmusicplayer.di;

import android.content.Context;
import android.support.annotation.NonNull;

/**
 * Dagger2 {@link MainComponent} holder
 */
public final class DaggerHolder {

    private static volatile DaggerHolder instance;

    @NonNull
    public static DaggerHolder getInstance(@NonNull final Context context) {
        if (instance == null) {
            synchronized (DaggerHolder.class) {
                if (instance == null) {
                    instance = new DaggerHolder(context.getApplicationContext());
                }
            }
        }
        return instance;
    }

    @NonNull
    private final MainComponent mainComponent;

    private DaggerHolder(@NonNull final Context context) {
        final AppModule appModule = new AppModule(context);
        mainComponent = DaggerMainComponent.builder()
                .appModule(appModule)
                .build();
    }

    @NonNull
    public MainComponent mainComponent() {
        return mainComponent;
    }
}

Rename appContextModule variable to appModule.