package me.rbrickis.mojo.bukkit;

import me.rbrickis.mojo.annotations.Command;
import me.rbrickis.mojo.annotations.Default;
import me.rbrickis.mojo.annotations.Text;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

public class ExampleCommands {

    @Command(aliases = "hello")
    @me.rbrickis.mojo.bukkit.annotations.Player
    public void helloWorld(Player player) {
        player.sendMessage(ChatColor.GOLD + "Hello, " + player.getName());
    }

    @Command(aliases = {"broadcast", "bc"})
    public void broadcast(CommandSender sender, @Text @Default("&6Hello World!") String message) {
        Bukkit.broadcastMessage(ChatColor.translateAlternateColorCodes('&', message));
    }

}

package me.rbrickis.mojo.bukkit;

import me.rbrickis.mojo.annotations.Command;
import me.rbrickis.mojo.annotations.Default;
import me.rbrickis.mojo.annotations.Text;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

public class ExampleCommands {

    @Command(aliases = "hello")
    @me.rbrickis.mojo.bukkit.annotations.Player
    public void helloWorld(Player player) {
        player.sendMessage(ChatColor.GOLD + "Hello, " + player.getName());
    }

    @Command(aliases = {"broadcast", "bc"})
    public void broadcast(CommandSender sender, @Text @Default("&6Hello World!") String message) {
        Bukkit.broadcastMessage(ChatColor.translateAlternateColorCodes('&', message));
    }

    @Command(aliases = {"message", "msg"})
    public void message(Player sender, Player receiver, @Text String message) {
        if (receiver == null) {
            sender.sendMessage(ChatColor.RED + "Could not find player!");
        } else {
            receiver.sendMessage(ChatColor.GRAY + "(From " + sender.getDisplayName() + ChatColor.GRAY + "): "
                    + ChatColor.WHITE + message);
        }
    }

}

Add message command because y not?

Add message command because y not?


package com.sequenceiq.cloudbreak.cloud.aws;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

import com.sequenceiq.cloudbreak.cloud.aws.view.AwsCredentialView;
import com.sequenceiq.cloudbreak.cloud.model.CloudCredential;

@Service
public class AwsDefaultZoneProvider {

    @Value("${cb.aws.zone.parameter.default:us-east-1}")
    private String awsZoneParameterDefault;

    @Value("${cb.aws.gov.zone.parameter.default:us-gov-west-1}")
    private String awsGovZoneParameterDefault;

    public String getDefaultZone(CloudCredential credential) {
        return getDefaultZone(new AwsCredentialView(credential));
    }

    public String getDefaultZone(AwsCredentialView awsCredentialView) {
        return awsCredentialView.isGovernmentCloudEnabled() ? awsGovZoneParameterDefault : awsZoneParameterDefault;
    }

}

package com.sequenceiq.cloudbreak.cloud.aws;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

import com.sequenceiq.cloudbreak.cloud.aws.view.AwsCredentialView;
import com.sequenceiq.cloudbreak.cloud.model.CloudCredential;

@Service
public class AwsDefaultZoneProvider {

    @Value("${cb.aws.zone.parameter.default:eu-west-1}")
    private String awsZoneParameterDefault;

    @Value("${cb.aws.gov.zone.parameter.default:us-gov-west-1}")
    private String awsGovZoneParameterDefault;

    public String getDefaultZone(CloudCredential credential) {
        return getDefaultZone(new AwsCredentialView(credential));
    }

    public String getDefaultZone(AwsCredentialView awsCredentialView) {
        return awsCredentialView.isGovernmentCloudEnabled() ? awsGovZoneParameterDefault : awsZoneParameterDefault;
    }

}

Revert "CB-4915 update AWS default zone provider defaults to Virginia us-east-1"

This reverts commit 04c7f2997a4b41332e4c351ce0d49642dd8ac3ef.


/**
 * 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.
 */

/**
 * Defines the keys for the well known labels used by the cloud debugger.
 *
 * DO NOT EDIT - This file is auto-generated
 */
package com.google.devtools.clouddebugger.v2;

public final class Labels {
  public static final class Breakpoint {

    public static final String REQUEST_LOG_ID = "requestlogid";

    private Breakpoint() {}
  }

  public static final class Debuggee {

    public static final String DOMAIN = "domain";
    public static final String PROJECT_ID = "projectid";
    public static final String MODULE = "module";
    public static final String MINOR_VERSION = "minorversion";
    public static final String VERSION = "version";

    private Debuggee() {}
  }

  private Labels() {}
}

/**
 * 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.
 */

/**
 * Defines the keys for the well known labels used by the cloud debugger.
 *
 * DO NOT EDIT - This file is auto-generated
 */
package com.google.devtools.clouddebugger.v2;

public final class Labels {
  public static final class Debuggee {

    public static final String DOMAIN = "domain";
    public static final String PROJECT_ID = "projectid";
    public static final String MODULE = "module";
    public static final String MINOR_VERSION = "minorversion";
    public static final String VERSION = "version";

    private Debuggee() {}
  }

  public static final class Breakpoint {

    public static final String REQUEST_LOG_ID = "requestlogid";

    private Breakpoint() {}
  }

  private Labels() {}
}

Extend default idle timeout to account for the long and somewhat rare ListActiveBreakpoint calls.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=126710902


package uk.ac.ebi.quickgo.webservice.model;

/**
 * @Author Tony Wardell
 * Date: 05/03/2015
 * Time: 16:58
 * Created with IntelliJ IDEA.
 */
public class EvidenceTypeJson {
	private String ecoTerm;
	private String value;

	public void setKey(String ecoTerm) {
		this.ecoTerm = ecoTerm;
	}

	public String getEcoTerm() {
		return ecoTerm;
	}

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

	public String getValue() {
		return value;
	}
}

package uk.ac.ebi.quickgo.webservice.model;

/**
 * @Author Tony Wardell
 * Date: 05/03/2015
 * Time: 16:58
 * Created with IntelliJ IDEA.
 */
public class EvidenceTypeJson {
	private String ecoTerm;
	private String evidence;
	private String evidenceKey;

	public void setKey(String ecoTerm) {
		this.ecoTerm = ecoTerm;
	}

	public String getEcoTerm() {
		return ecoTerm;
	}

	public void setEvidence(String evidence) {
		this.evidence = evidence;
	}

	public String getEvidence() {
		return evidence;
	}

	public void setEvidenceKey(String evidenceKey) {
		this.evidenceKey = evidenceKey;
	}

	public String getEvidenceKey() {
		return evidenceKey;
	}
}

Change evidence model to help improve layout.


/*
 * 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.commons.dbutils.annotations;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

@Target({ ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
public @interface Column {

    String name() default "";
}

/*
 * 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.commons.dbutils.annotations;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * Annotation for BeanProcessor to receive hints of the field name rather than dissecting the method name.
 *
 * @since 2.0
 */
@Target({ ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
public @interface Column {

    String name() default "";
}

Add javadoc to new annotation

Add javadoc to new annotation


package jfdi.test.logic.events;

import jfdi.logic.events.UnaliasFailedEvent;
import org.junit.Test;

import static org.junit.Assert.assertEquals;

/**
 * @author Xinan
 */
public class UnaliasFailedEventTest {

    private String alias = "alias";
    private UnaliasFailedEvent.Error error = UnaliasFailedEvent.Error.NON_EXISTENT_ALIAS;
    private UnaliasFailedEvent event = new UnaliasFailedEvent(alias, error);

    public void getAlias() throws Exception {
        assertEquals(alias, event.getAlias());
    }

    @Test
    public void getError() throws Exception {
        assertEquals(error, event.getError());
    }

}

package jfdi.test.logic.events;

import jfdi.logic.events.UnaliasFailedEvent;
import org.junit.Test;

import static org.junit.Assert.assertEquals;

/**
 * @author Xinan
 */
public class UnaliasFailedEventTest {

    private String alias = "alias";
    private UnaliasFailedEvent.Error error = UnaliasFailedEvent.Error.NON_EXISTENT_ALIAS;
    private UnaliasFailedEvent event = new UnaliasFailedEvent(alias, error);

    @Test
    public void getAlias() throws Exception {
        assertEquals(alias, event.getAlias());
    }

    @Test
    public void getError() throws Exception {
        assertEquals(error, event.getError());
    }

}

Add missing `@Test` annotation to `UnaliasFailedEvent`


/*
 * Copyright 2016 Red Hat, Inc. and/or its affiliates
 * and other contributors as indicated by the @author tags.
 *
 * 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.keycloak.forms.login;

import org.keycloak.provider.ProviderFactory;

/**
 * @author Stian Thorgersen
 */
public interface LoginFormsProviderFactory extends ProviderFactory {

}

/*
 * Copyright 2016 Red Hat, Inc. and/or its affiliates
 * and other contributors as indicated by the @author tags.
 *
 * 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.keycloak.forms.login;

import org.keycloak.provider.ProviderFactory;

/**
 * @author Stian Thorgersen
 */
public interface LoginFormsProviderFactory extends ProviderFactory<LoginFormsProvider> {

}

KEYCLOAK-15068: Fix 15068 by parameterizing ProviderFactory with LoginFormsProvider.


package com.codingchili.router.controller.transport;

import com.codingchili.router.model.WireType;
import io.vertx.core.json.JsonObject;
import io.vertx.core.net.NetSocket;
import io.vertx.ext.unit.junit.VertxUnitRunner;

import org.junit.runner.RunWith;

/**
 * @author Robin Duda
 *
 * Test cases for UDP transport.
 */
@RunWith(VertxUnitRunner.class)
public class TcpListenerIT extends TransportTestCases {

    public TcpListenerIT() {
        super(WireType.TCP);
    }

    @Override
    void sendRequest(String route, ResponseListener listener, JsonObject data) {
        vertx.createNetClient().connect(port, HOST, connect -> {
            if (connect.succeeded()) {
                NetSocket socket = connect.result();

                socket.handler(buffer -> handleBody(listener, buffer));
                socket.write(data.encode());
            }
        });
    }
}

package com.codingchili.router.controller.transport;

import com.codingchili.router.model.WireType;
import io.vertx.core.json.JsonObject;
import io.vertx.core.net.NetSocket;
import io.vertx.ext.unit.junit.VertxUnitRunner;

import org.junit.runner.RunWith;

/**
 * @author Robin Duda
 *
 * Test cases for UDP transport.
 */
@RunWith(VertxUnitRunner.class)
public class TcpListenerIT extends TransportTestCases {

    public TcpListenerIT() {
        super(WireType.TCP);
    }

    @Override
    void sendRequest(String route, ResponseListener listener, JsonObject data) {
        vertx.createNetClient().connect(port, HOST, connect -> {
            if (connect.succeeded()) {
                NetSocket socket = connect.result();

                socket.handler(buffer -> handleBody(listener, buffer));
                socket.write(data.encode());
            } else {
                throw new RuntimeException(connect.cause());
            }
        });
    }
}

Add exception handling to failed conection.


package sizebay.catalog.client.model;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

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

@Data
@Accessors(chain = true)
@NoArgsConstructor
@JsonIgnoreProperties(ignoreUnknown = true)
public class UserProfileIdentification implements Serializable {

     long id;
     String userId;
     String name;
     String gender;
     int age;
     int weight;
     int height;
     int bodyShapeChest;
     int bodyShapeWaist;
     int bodyShapeHip;
     int footShape;

     UserProfileMeasures measures;
     UserProfileProduct product;

     public static UserProfileIdentification empty() {

          UserProfileIdentification profile = new UserProfileIdentification();
          UserProfileMeasures measures = UserProfileMeasures.empty();
          UserProfileProduct product = UserProfileProduct.empty();

          profile.setName("Você");
          profile.setAge(0);
          profile.setWeight(0);
          profile.setHeight(0);
          profile.setBodyShapeChest(-99);
          profile.setBodyShapeWaist(-99);
          profile.setBodyShapeHip(-99);
          profile.setFootShape(-99);

          profile.setMeasures(measures);
          profile.setProduct(product);

          return profile;
     }

}

package sizebay.catalog.client.model;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.util.Date;
import static java.time.LocalDateTime.now;

@Data
@Accessors(chain = true)
@NoArgsConstructor
@JsonIgnoreProperties(ignoreUnknown = true)
public class UserProfileIdentification implements Serializable {

     private static final BigDecimal DAYS_OF_YEAR = new BigDecimal(365.2425D);

     long id;
     String userId;
     String name;
     String gender;
     int age;
     int weight;
     int height;
     int bodyShapeChest;
     int bodyShapeWaist;
     int bodyShapeHip;
     int footShape;

     UserProfileMeasures measures;
     UserProfileProduct product;

     public static UserProfileIdentification empty() {

          UserProfileIdentification profile = new UserProfileIdentification();
          UserProfileMeasures measures = UserProfileMeasures.empty();
          UserProfileProduct product = UserProfileProduct.empty();

          profile.setName("Você");
          profile.setAge(0);
          profile.setWeight(0);
          profile.setHeight(0);
          profile.setBodyShapeChest(-99);
          profile.setBodyShapeWaist(-99);
          profile.setBodyShapeHip(-99);
          profile.setFootShape(-99);

          profile.setMeasures(measures);
          profile.setProduct(product);

          return profile;
     }

     public Date getBirth(int age) {
          final int days = new BigDecimal(age).multiply(DAYS_OF_YEAR).intValue();
          final ZonedDateTime then = now().minusDays(days).atZone(ZoneId.systemDefault());

          return ( Date.from(then.toInstant()));
     }

}

Add method that returns Birth based on age


/*
 * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com)
 *
 * 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.orientechnologies.orient.test.database.base;

import java.io.File;

import org.testng.annotations.Parameters;
import org.testng.annotations.Test;

@Test
public class DeleteDirectory {
	@Parameters(value = "path")
	public DeleteDirectory(String iPath) {
		final File f = new File(iPath);

		if (f.exists())
			deleteDirectory(f);
		else
			System.err.println("Directory: " + f.getAbsolutePath() + " not found");
	}

	private void deleteDirectory(File iDirectory) {
		if (iDirectory.isDirectory())
			for (File f : iDirectory.listFiles()) {
				if (f.isDirectory())
					deleteDirectory(f);
				else
					f.delete();
			}

	}
}

/*
 * Copyright 2010-2012 Luca Garulli (l.garulli--at--orientechnologies.com)
 *
 * 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.orientechnologies.orient.test.database.base;

import java.io.File;

import org.testng.annotations.Parameters;
import org.testng.annotations.Test;

import com.orientechnologies.orient.core.exception.OConfigurationException;

@Test
public class DeleteDirectory {
  @Parameters(value = "path")
  public DeleteDirectory(String iPath) {
    final File f = new File(iPath);

    if (f.exists())
      deleteDirectory(f);
    else
      System.err.println("Directory: " + f.getAbsolutePath() + " not found");
  }

  private void deleteDirectory(File iDirectory) {
    if (iDirectory.isDirectory())
      for (File f : iDirectory.listFiles()) {
        if (f.isDirectory())
          deleteDirectory(f);
        else if (!f.delete())
          throw new OConfigurationException("Can't delete the file: " + f);
      }

  }
}

Delete database of tests now stops if a file can't be deleted


/**
 * Created by shimin on 9/24/2014.
 */
public class Controller {

    private int temperature;
    private int lighting;
    private int pressure;
    private int humidity;
    private int sound;
    private int sensorID;

    public int getTemperature(){ return temperature;}

    public int getLighting(){ return lighting;}

    public int getPressure(){return pressure;}

    public int getHumidity(){return humidity;}

    public int getSound(){return sound;}

    public int getSensorID(){return sensorID;}

}

import com.mysql.jdbc.Connection;
import db.DBConnector;

import java.sql.ResultSet;
import java.sql.SQLException;

/**
 * Created by shimin on 9/24/2014.
 */
public class Controller extends DBConnector {

    private double temperature = 0.0;
    private int lighting;
    private int pressure;
    private int humidity;
    private int sound;
    private int sensorID;

    /*
     * A database connection is available through the inherited field 'connection'.
     */

    public double getTemperature(){
        String query =  "SELECT Value FROM TemperatureSample JOIN (" +
                        "SELECT MAX(Date) as MaxDate FROM TemperatureSample AS T1" +
                        ") AS T2 WHERE Date = MaxDate";

        try {
            preparedStatement = connection.prepareStatement(query);
            preparedStatement.execute();
            ResultSet results = preparedStatement.getResultSet();
            results.next();
            temperature = results.getDouble(1);
        } catch (SQLException e) {
            e.printStackTrace();
        }

        return temperature;
    }

    public int getLighting(){ return lighting;}

    public int getPressure(){return pressure;}

    public int getHumidity(){return humidity;}

    public int getSound(){return sound;}

    public int getSensorID(){return sensorID;}

    public static void main(String[] args){
        Controller ctrl = new Controller();
        ctrl.connect();
        System.out.println(ctrl.getTemperature());
    }
}

Make the getTemperature() function barely work


package io.github.droidkaigi.confsched2017.view.activity;

import android.app.Activity;
import android.content.Intent;
import android.databinding.DataBindingUtil;
import android.os.Bundle;
import android.support.annotation.NonNull;

import io.github.droidkaigi.confsched2017.R;
import io.github.droidkaigi.confsched2017.databinding.ActivitySearchBinding;
import io.github.droidkaigi.confsched2017.view.fragment.SearchFragment;

public class SearchActivity extends BaseActivity {

    private ActivitySearchBinding binding;

    public static void start(@NonNull Activity activity) {
        Intent intent = new Intent(activity, SearchActivity.class);
        activity.startActivity(intent);
        activity.overridePendingTransition(0, R.anim.activity_fade_exit);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        binding = DataBindingUtil.setContentView(this, R.layout.activity_search);

        initBackToolbar(binding.toolbar);
        replaceFragment(SearchFragment.newInstance(), R.id.content_view);
    }

    @Override
    public void finish() {
        overridePendingTransition(0, R.anim.activity_fade_exit);
        super.finish();
    }

    @Override
    public void onBackPressed() {
        finish();
    }
}

package io.github.droidkaigi.confsched2017.view.activity;

import android.app.Activity;
import android.content.Intent;
import android.databinding.DataBindingUtil;
import android.os.Bundle;
import android.support.annotation.NonNull;

import io.github.droidkaigi.confsched2017.R;
import io.github.droidkaigi.confsched2017.databinding.ActivitySearchBinding;
import io.github.droidkaigi.confsched2017.view.fragment.SearchFragment;

public class SearchActivity extends BaseActivity {

    private ActivitySearchBinding binding;

    public static void start(@NonNull Activity activity) {
        Intent intent = new Intent(activity, SearchActivity.class);
        activity.startActivity(intent);
        activity.overridePendingTransition(0, R.anim.activity_fade_exit);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        binding = DataBindingUtil.setContentView(this, R.layout.activity_search);

        initBackToolbar(binding.toolbar);
        replaceFragment(SearchFragment.newInstance(), R.id.content_view);
    }

    @Override
    public void finish() {
        super.finish();
        overridePendingTransition(0, R.anim.activity_fade_exit);
    }

    @Override
    public void onBackPressed() {
        finish();
    }
}

Move fade out animation after finish()

Move fade out animation after finish()


package openperipheral.api.converter;

/**
 * A type converter can automatically convert objects from Java types to a types understood by script engine.
 */
public interface IOutboundTypeConverter {

	/**
	 * Convert to value understood by script enviroment.
	 * Return only types understood by underlying architecture (i.e. primitives, String, Maps), otherwise it will be converted to null values on script side.
	 * Return null to ignore value. Converter will continue to next handler.
	 *
	 * @param registry
	 *            caller of this method. May be used to recursively convert values
	 * @param obj
	 *            value to be converted
	 *
	 * @return converted value or null
	 */
	public abstract Object fromJava(IConverter converter, Object obj);

}

package openperipheral.api.converter;

/**
 * A type converter can automatically convert objects from Java types to a types understood by script engine.
 */
public interface IOutboundTypeConverter {

	/**
	 * Convert to value understood by script enviroment.
	 * Return only types understood by underlying architecture (i.e. primitives, String, Maps), otherwise it will be converted to null values on script side.
	 * Return null to ignore value. Converter will continue to next handler.
	 *
	 * @param converter
	 *            caller of this method. May be used to recursively convert values
	 * @param obj
	 *            value to be converted
	 *
	 * @return converted value or null
	 */
	public abstract Object fromJava(IConverter converter, Object obj);

}

Align parameter name in javadoc

Align parameter name in javadoc


/*
 * Copyright 2017 MovingBlocks
 *
 * 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.terasology.rendering;

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

import org.junit.Test;

public class FontColorTest {

    @Test
    public void testResetColor() {
        char resetColor = 0xF000;
        assertTrue(FontColor.isValid(resetColor));
    }

    @Test
	public void testFirstColor() {
        char firstColor = 0xE000;
        assertTrue(FontColor.isValid(firstColor));
    }

	@Test
	public void testLastColor() {
        char lastColor = 0xEFFF;
        assertTrue(FontColor.isValid(lastColor));
    }

	@Test
	public void testBetweenColor() {
        char betweenColor = 0xEB8F;
        assertTrue(FontColor.isValid(betweenColor));
    }

	@Test
	public void testInvalidColor() {
        char invalidColor = 0xA10F;
        assertFalse(FontColor.isValid(invalidColor));
    }
}

/*
 * Copyright 2017 MovingBlocks
 *
 * 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.terasology.rendering;

import org.junit.Test;

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

public class FontColorTest {

    @Test
    public void testResetColor() {
        char resetColor = 0xF000;
        assertTrue(FontColor.isValid(resetColor));
    }

    @Test
    public void testFirstColor() {
        char firstColor = 0xE000;
        assertTrue(FontColor.isValid(firstColor));
    }

    @Test
    public void testLastColor() {
        char lastColor = 0xEFFF;
        assertTrue(FontColor.isValid(lastColor));
    }

    @Test
    public void testBetweenColor() {
        char betweenColor = 0xEB8F;
        assertTrue(FontColor.isValid(betweenColor));
    }

    @Test
    public void testInvalidColor() {
        char invalidColor = 0xA10F;
        assertFalse(FontColor.isValid(invalidColor));
    }
}

Reformat tests to use spaces not tabs

Reformat tests to use spaces not tabs


package agent;

public class Neighborhood {

	public enum Direction {
		TOP, TOPRIGHT, RIGHT, BOTTOMRIGHT, BOTTOM, BOTTOMLEFT, LEFT, TOPLEFT
	}

	public int getTemperature() {
		// TODO Auto-generated method stub
		return 0;
	}

}

package agent;

import board.Cell;

public class Neighborhood {

	public enum Direction {
		TOP, TOPRIGHT, RIGHT, BOTTOMRIGHT, BOTTOM, BOTTOMLEFT, LEFT, TOPLEFT
	}

	private Cell first;

	public int getTemperature() {
		// TODO Auto-generated method stub
		return 0;
	}

	public Cell getFirstCell() {
		return first;
	}

}

Add main Cell field to Neighbourhood

Add main Cell field to Neighbourhood


package com.platypii.baseline.views.charts;

import com.platypii.baseline.events.ChartFocusEvent;
import com.platypii.baseline.measurements.MLocation;
import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;
import java.util.Collections;
import org.greenrobot.eventbus.EventBus;

public class TimeChartTouchable extends TimeChart {

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

    @Override
    public boolean onTouchEvent(MotionEvent event) {
        super.onTouchEvent(event);
        if (event.getAction() == MotionEvent.ACTION_MOVE) {
            final long millis = (long) plot.getXinverse(0, event.getX());
            // Find nearest data point
            final MLocation closest = findClosest(millis);
            // Emit chart focus event
            EventBus.getDefault().post(new ChartFocusEvent(closest));
        }
        return true; // if the event was handled
    }

    // Avoid creating new object just to binary search
    private final MLocation touchLocation = new MLocation();
    /**
     * Performs a binary search for the nearest data point
     */
    private MLocation findClosest(long millis) {
        touchLocation.millis = millis;
        int closest_index = Collections.binarySearch(trackData, touchLocation);
        if (closest_index < 0) closest_index = -closest_index;
        if (closest_index == trackData.size()) closest_index--;
        return trackData.get(closest_index);
    }

}

package com.platypii.baseline.views.charts;

import com.platypii.baseline.events.ChartFocusEvent;
import com.platypii.baseline.measurements.MLocation;
import android.content.Context;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.view.MotionEvent;
import java.util.Collections;
import org.greenrobot.eventbus.EventBus;

public class TimeChartTouchable extends TimeChart {

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

    @Override
    public boolean onTouchEvent(MotionEvent event) {
        super.onTouchEvent(event);
        if (event.getAction() == MotionEvent.ACTION_MOVE) {
            final long millis = (long) plot.getXinverse(0, event.getX());
            // Find nearest data point
            final MLocation closest = findClosest(millis);
            // Emit chart focus event
            EventBus.getDefault().post(new ChartFocusEvent(closest));
        }
        return true; // if the event was handled
    }

    // Avoid creating new object just to binary search
    private final MLocation touchLocation = new MLocation();
    /**
     * Performs a binary search for the nearest data point
     */
    @Nullable
    private MLocation findClosest(long millis) {
        if (trackData != null && !trackData.isEmpty()) {
            touchLocation.millis = millis;
            int closest_index = Collections.binarySearch(trackData, touchLocation);
            if (closest_index < 0) closest_index = -closest_index;
            if (closest_index == trackData.size()) closest_index--;
            return trackData.get(closest_index);
        } else {
            return null;
        }
    }

}

Fix null pointer in time chart

Fix null pointer in time chart


package de.hsmannheim.iws2014.indexing;

import org.apache.lucene.document.*;
import org.apache.lucene.index.IndexWriter;

import java.io.IOException;
import java.util.List;

/**
 * This class does all the hard work. Indexing developers.
 */
public class Indexer {

    private final IndexWriter index;

    public Indexer(IndexWriter index) {
        this.index = index;
    }

    public void index(List<Developer> developers) {
        try {
            try {
                for (Developer developer : developers) {
                    Document doc = new Document();
                    doc.add(stringField("firstname", developer.firstname));
                    doc.add(stringField("surname", developer.surname));
                    doc.add(stringField("residence", developer.residence));
                    doc.add(textField("personalAbstract", developer.personalAbstract));
                    index.addDocument(doc);
                }
            } finally {
                index.close();
            }
        } catch (IOException e) {
            new IndexerException("Cannot add dcoument to index.", e);
        }
    }

    private static StringField stringField(String name, String value) {
        return new StringField(name, value, Field.Store.YES);
    }

    private static TextField textField(String name, String value) {
        return new TextField(name, value, Field.Store.NO);
    }

    static class IndexerException extends RuntimeException {
        public IndexerException(String message, Throwable e) {
            super(message, e);
        }
    }
}

package de.hsmannheim.iws2014.indexing;

import org.apache.lucene.document.*;
import org.apache.lucene.index.IndexWriter;

import java.io.IOException;
import java.util.List;

/**
 * This class does all the hard work. Indexing developers.
 */
public class Indexer {

    public static final String FIRSTNAME = "firstname";
    public static final String SURNAME = "surname";
    public static final String RESIDENCE = "residence";
    public static final String PERSONAL_ABSTRACT = "personalAbstract";
    private final IndexWriter index;

    public Indexer(IndexWriter index) {
        this.index = index;
    }

    public void index(List<Developer> developers) {
        try {
            try {
                for (Developer developer : developers) {
                    Document doc = new Document();
                    doc.add(stringField(FIRSTNAME, developer.firstname));
                    doc.add(stringField(SURNAME, developer.surname));
                    doc.add(stringField(RESIDENCE, developer.residence));
                    doc.add(textField(PERSONAL_ABSTRACT, developer.personalAbstract));
                    index.addDocument(doc);
                }
            } finally {
                index.close();
            }
        } catch (IOException e) {
            new IndexerException("Cannot add dcoument to index.", e);
        }
    }

    private static StringField stringField(String name, String value) {
        return new StringField(name, value, Field.Store.YES);
    }

    private static TextField textField(String name, String value) {
        return new TextField(name, value, Field.Store.NO);
    }

    static class IndexerException extends RuntimeException {
        public IndexerException(String message, Throwable e) {
            super(message, e);
        }
    }
}

Make index fields public constants

Make index fields public constants

So they are reusable by other classes.


/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package org.sleuthkit.autopsy.modules.UserArtifacts;

import org.openide.util.NbBundle;
import org.openide.util.lookup.ServiceProvider;
import org.python.apache.xmlcommons.Version;
import org.sleuthkit.autopsy.ingest.DataSourceIngestModule;
import org.sleuthkit.autopsy.ingest.IngestModuleFactory;
import org.sleuthkit.autopsy.ingest.IngestModuleFactoryAdapter;
import org.sleuthkit.autopsy.ingest.IngestModuleIngestJobSettings;

/**
 *
 * @author oliver
 */
@ServiceProvider(service = IngestModuleFactory.class)
public class UserArtifactIngestModuleFactory extends IngestModuleFactoryAdapter {

    static String getModuleName() {
        return NbBundle.getMessage(UserArtifactIngestModuleFactory.class, "UserArtifactIngestModuleFactory.moduleName");
    }

    @Override
    public String getModuleDisplayName() {
        return getModuleName();
    }

    @Override
    public String getModuleDescription() {
        return NbBundle.getMessage(UserArtifactIngestModuleFactory.class, "UserArtifactIngestModuleFactory.moduleDescription");
    }

    @Override
    public String getModuleVersionNumber() {
        return Version.getVersion();
    }

    @Override
    public DataSourceIngestModule createDataSourceIngestModule(IngestModuleIngestJobSettings ingestOptions) {
        return new UserArtifactIngestModule();
    }
    @Override
    public boolean isDataSourceIngestModuleFactory() {
        return true;
    }
}

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package org.sleuthkit.autopsy.modules.UserArtifacts;

import org.openide.util.NbBundle;
import org.openide.util.lookup.ServiceProvider;
import org.python.apache.xmlcommons.Version;
import org.sleuthkit.autopsy.ingest.DataSourceIngestModule;
import org.sleuthkit.autopsy.ingest.IngestModuleFactory;
import org.sleuthkit.autopsy.ingest.IngestModuleFactoryAdapter;
import org.sleuthkit.autopsy.ingest.IngestModuleIngestJobSettings;

/**
 *
 * @author oliver
 */
//@ServiceProvider(service = IngestModuleFactory.class)
public class UserArtifactIngestModuleFactory extends IngestModuleFactoryAdapter {

    static String getModuleName() {
        return NbBundle.getMessage(UserArtifactIngestModuleFactory.class, "UserArtifactIngestModuleFactory.moduleName");
    }

    @Override
    public String getModuleDisplayName() {
        return getModuleName();
    }

    @Override
    public String getModuleDescription() {
        return NbBundle.getMessage(UserArtifactIngestModuleFactory.class, "UserArtifactIngestModuleFactory.moduleDescription");
    }

    @Override
    public String getModuleVersionNumber() {
        return Version.getVersion();
    }

    @Override
    public DataSourceIngestModule createDataSourceIngestModule(IngestModuleIngestJobSettings ingestOptions) {
        return new UserArtifactIngestModule();
    }
    @Override
    public boolean isDataSourceIngestModuleFactory() {
        return true;
    }
}

Disable user-defined artifacts testing module


package org.zstack.storage.backup;

import org.zstack.header.storage.backup.BackupStorageVO;
import org.zstack.header.storage.primary.PrimaryStorageVO;
import org.zstack.header.tag.TagDefinition;
import org.zstack.tag.PatternedSystemTag;

/**
 * Created by mingjian.deng on 2017/9/22.
 */
@TagDefinition
public class BackupStorageSystemTags {
    public static String BACKUP_STORE_DEPLOY_REMOTE_TOKEN = "remote";
    public static PatternedSystemTag BACKUP_STORE_DEPLOY_REMOTE = new PatternedSystemTag(String.format("%s", BACKUP_STORE_DEPLOY_REMOTE_TOKEN), BackupStorageVO.class);

    public static final String BACKUP_STORAGE_DATA_NETWORK_TOKEN = "backupStorageDataNetwork";
    public static PatternedSystemTag BACKUP_STORAGE_DATA_NETWORK = new PatternedSystemTag(String.format("backupStorage::data::network::cidr::{%s}", BACKUP_STORAGE_DATA_NETWORK_TOKEN), BackupStorageVO.class);
}

package org.zstack.storage.backup;

import org.zstack.header.storage.backup.BackupStorageVO;
import org.zstack.header.tag.TagDefinition;
import org.zstack.tag.PatternedSystemTag;

/**
 * Created by mingjian.deng on 2017/9/22.
 */
@TagDefinition
public class BackupStorageSystemTags {
    public static String BACKUP_STORE_DEPLOY_REMOTE_TOKEN = "remote";
    public static PatternedSystemTag BACKUP_STORE_DEPLOY_REMOTE = new PatternedSystemTag(String.format("%s", BACKUP_STORE_DEPLOY_REMOTE_TOKEN), BackupStorageVO.class);

    public static final String BACKUP_STORAGE_DATA_NETWORK_TOKEN = "backupStorageDataNetwork";
    public static PatternedSystemTag BACKUP_STORAGE_DATA_NETWORK = new PatternedSystemTag(String.format("backupStorage::data::network::cidr::{%s}", BACKUP_STORAGE_DATA_NETWORK_TOKEN), BackupStorageVO.class);

    public static String EXTRA_IPS_TOKEN = "extraips";
    public static PatternedSystemTag EXTRA_IPS = new PatternedSystemTag(String.format("extraips::{%s}", EXTRA_IPS_TOKEN), BackupStorageVO.class);
}

Add extra ips systemg tag for backup storage

Resolves ZSTAC-15810

Signed-off-by: AlanJager <7ba0221af525cfcc7adbf94f7fc6b46fa1dcb7c9@outlook.com>


package org.wikipedia.page.gallery;

import org.json.JSONObject;
import org.mediawiki.api.json.Api;
import org.mediawiki.api.json.RequestBuilder;
import org.wikipedia.PageQueryTask;
import org.wikipedia.PageTitle;
import org.wikipedia.Site;

public class GalleryItemFetchTask extends PageQueryTask<GalleryItem> {
    public GalleryItemFetchTask(Api api, Site site, PageTitle title) {
        super(LOW_CONCURRENCY, api, site, title);
    }

    @Override
    public void buildQueryParams(RequestBuilder builder) {
        builder.param("prop", "imageinfo")
               .param("iiprop", "url|dimensions|mime|extmetadata")
               .param("iiurlwidth", "2048");
    }

    @Override
    public GalleryItem processPage(int pageId, PageTitle pageTitle, JSONObject pageData) throws Throwable {
        return new GalleryItem(pageData);
    }
}

package org.wikipedia.page.gallery;

import org.json.JSONObject;
import org.mediawiki.api.json.Api;
import org.mediawiki.api.json.RequestBuilder;
import org.wikipedia.PageQueryTask;
import org.wikipedia.PageTitle;
import org.wikipedia.Site;

public class GalleryItemFetchTask extends PageQueryTask<GalleryItem> {
    public GalleryItemFetchTask(Api api, Site site, PageTitle title) {
        super(LOW_CONCURRENCY, api, site, title);
    }

    @Override
    public void buildQueryParams(RequestBuilder builder) {
        builder.param("prop", "imageinfo")
               .param("iiprop", "url|dimensions|mime|extmetadata")
               .param("iiurlwidth", "2880");
    }

    @Override
    public GalleryItem processPage(int pageId, PageTitle pageTitle, JSONObject pageData) throws Throwable {
        return new GalleryItem(pageData);
    }
}

Adjust image size to fetch for gallery view.

to comply with predefined bucket sizes, for performance/cache reasons:
https://git.wikimedia.org/blob/mediawiki%2Fextensions%2FMultimediaViewer.git/f9e7bae91a8032fa13fc68114a0d57d190ea77f9/resources%2Fmmv%2Fmmv.ThumbnailWidthCalculator.js

Change-Id: I6fef16c591d149e5e1c7a5e7ae53eb057bbef1c3


/**
 * The {@link org.junit.gen5.launcher.Launcher Launcher} is the main starting
 * point for launching a test suite.
 *
 * <p>The {@link org.junit.gen5.launcher.main.TestDiscoveryRequestBuilder
 * TestDiscoveryRequestBuilder} serves as a small DSL for creating a
 * {@link org.junit.gen5.launcher.TestDiscoveryRequest TestDiscoveryRequest}
 * that can be supplied to a launcher.
 */

package org.junit.gen5.launcher.main;

/**
 * Core support classes for the {@link org.junit.gen5.launcher.Launcher Launcher}
 * including the {@link org.junit.gen5.launcher.main.LauncherFactory LauncherFactory}
 * and the {@link org.junit.gen5.launcher.main.TestDiscoveryRequestBuilder
 * TestDiscoveryRequestBuilder}.
 */

package org.junit.gen5.launcher.main;

Revise Javadoc for org.junit.gen5.launcher.main package


/*
 * Copyright (c) 2014, Apptentive, Inc. All Rights Reserved.
 * Please refer to the LICENSE file for the terms and conditions
 * under which redistribution and use of this file is permitted.
 */

package com.apptentive.android.sdk.module.rating.view;

import android.app.Dialog;
import android.content.Context;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.view.Gravity;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;

/**
 * @author Sky Kelsey
 */
public abstract class ApptentiveBaseDialog extends Dialog {
	public ApptentiveBaseDialog(final Context context, int layout) {
		super(context);

		requestWindowFeature(Window.FEATURE_NO_TITLE);
		setContentView(layout); // This needs to be set before the window layout is messed with below.

		// Let the dialog take up the whole device width.
		WindowManager.LayoutParams params = getWindow().getAttributes();
		params.width = ViewGroup.LayoutParams.FILL_PARENT;
		params.height = ViewGroup.LayoutParams.FILL_PARENT;
		params.gravity = Gravity.CENTER;
		params.dimAmount = 0.5f;
		getWindow().setAttributes(params);
		getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
		getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
	}
}

/*
 * Copyright (c) 2014, Apptentive, Inc. All Rights Reserved.
 * Please refer to the LICENSE file for the terms and conditions
 * under which redistribution and use of this file is permitted.
 */

package com.apptentive.android.sdk.module.rating.view;

import android.app.Dialog;
import android.content.Context;
import android.graphics.drawable.ColorDrawable;
import android.view.Gravity;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;

/**
 * @author Sky Kelsey
 */
public abstract class ApptentiveBaseDialog extends Dialog {
	public ApptentiveBaseDialog(final Context context, int layout) {
		super(context);

		requestWindowFeature(Window.FEATURE_NO_TITLE);
		setContentView(layout); // This needs to be set before the window layout is messed with below.

		// Let the dialog take up the whole device width.
		WindowManager.LayoutParams params = getWindow().getAttributes();
		params.width = ViewGroup.LayoutParams.FILL_PARENT;
		params.height = ViewGroup.LayoutParams.FILL_PARENT;
		params.gravity = Gravity.CENTER;
		getWindow().setAttributes(params);
		getWindow().setBackgroundDrawable(new ColorDrawable(0x7F000000));
	}
}

Use alpha layer instead of window flag for dimming.


package eic.beike.projectx.network.projectXServer;

import junit.framework.TestCase;

/**
 * Test the database interaction. As of now this is against the live server.
 * Created by alex on 10/1/15.
 */
public class DatabaseTest extends TestCase {
    private Database db;

    /**
     * We use a fresh object for every test.
     * @throws Exception
     */
    public void setUp() throws Exception {
        super.setUp();
        db = new Database();

    }

    public void testRegister() throws Exception {
        String id = "test" + Long.toString(System.currentTimeMillis());
        //Should be able to register.
        boolean success = db.register(id, "alex");
        assertTrue(success);
        //Should not be able to register twice.
        success = db.register(id, "alex");
        assertFalse(success);
    }

    public void testRecordScore() throws Exception {

    }

    public void testGetTopTen() throws Exception {

    }

    public void testGetPlayerTopTen() throws Exception {

    }
}

package eic.beike.projectx.network.projectXServer;

import junit.framework.TestCase;

/**
 * Test the database interaction. As of now this is against the live server.
 * Created by alex on 10/1/15.
 */
public class DatabaseTest extends TestCase {
    private Database db;

    /**
     * We use a fresh object for every test.
     * @throws Exception
     */
    public void setUp() throws Exception {
        super.setUp();
        db = new Database();

    }

    public void testRegister() throws Exception {
        String id = "test" + Long.toString(System.currentTimeMillis());
        //Should be able to register.
        boolean success = db.register(id, "alex");
        assertTrue(success);
        //Should not be able to register twice.
        success = db.register(id, "alex");
        assertFalse(success);
    }

    public void testRecordScore() throws Exception {
        //Create two users.
        String id1 = "test" + Long.toString(System.currentTimeMillis());
        String id2 = "test" + Long.toString(System.currentTimeMillis() + 10);
        //Register one of them.
        if(db.register(id1, "alex")) {
            //Record a valid score.
            long t = System.currentTimeMillis();
            boolean success = db.recordScore(id1,10,t,"Ericsson$100020");
            assertTrue(success);
            //Try again. This should not be allowed.
            success = db.recordScore(id1,10,t,"Ericsson$100020");
            assertFalse(success);
            //Try with unknown player, should not be allowed.
            success = db.recordScore(id2,10,System.currentTimeMillis(),"Ericsson$100020");
            assertFalse(success);
        }
    }

    public void testGetTopTen() throws Exception {

    }

    public void testGetPlayerTopTen() throws Exception {

    }
}

Add tests for recording a score.

Add tests for recording a score.


package com.opera.core.systems.scope;

import com.opera.core.systems.model.ICommand;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.Map;

/**
 * This enum maps the commands for the Window Manager 2.0.
 *
 */
public enum DesktopWindowManagerCommand implements ICommand {
	    GET_ACTIVE_WINDOW(1),
	    LIST_WINDOWS(2),
	    LIST_QUICK_WIDGETS(3),
	    WINDOW_UPDATED(4),   // event
	    WINDOW_CLOSED(5),    // event
	    WINDOW_ACTIVATED(6), // event
	    WINDOW_LOADED(7),
	    DEFAULT(-1);    // event

	    private int code;
	    private static final Map<Integer, DesktopWindowManagerCommand> lookup = new HashMap<Integer, DesktopWindowManagerCommand>();

	    static {
	        for (DesktopWindowManagerCommand command : EnumSet.allOf(DesktopWindowManagerCommand.class))
	            lookup.put(command.getCommandID(), command);
	    }

	    private DesktopWindowManagerCommand(int code) {
	        this.code = code;
	    }

	    public int getCommandID() {
	        return code;
	    }

	    public String getServiceName() {
	        return "window-manager";
	    }

	    public static DesktopWindowManagerCommand get(int code) {
	        DesktopWindowManagerCommand command = lookup.get(code);
	        return (command != null) ? command : DEFAULT;
	    }

}

package com.opera.core.systems.scope;

import com.opera.core.systems.model.ICommand;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.Map;

/**
 * This enum maps the commands for the Window Manager 2.0.
 *
 */
public enum DesktopWindowManagerCommand implements ICommand {
	    GET_ACTIVE_WINDOW(1),
	    LIST_WINDOWS(2),
	    LIST_QUICK_WIDGETS(3),
	    WINDOW_UPDATED(4),   // event
	    WINDOW_CLOSED(5),    // event
	    WINDOW_ACTIVATED(6), // event
	    WINDOW_LOADED(7),
	    DEFAULT(-1);    // event

	    private int code;
	    private static final Map<Integer, DesktopWindowManagerCommand> lookup = new HashMap<Integer, DesktopWindowManagerCommand>();

	    static {
	        for (DesktopWindowManagerCommand command : EnumSet.allOf(DesktopWindowManagerCommand.class))
	            lookup.put(command.getCommandID(), command);
	    }

	    private DesktopWindowManagerCommand(int code) {
	        this.code = code;
	    }

	    public int getCommandID() {
	        return code;
	    }

	    public String getServiceName() {
	        return "desktop-window-manager";
	    }

	    public static DesktopWindowManagerCommand get(int code) {
	        DesktopWindowManagerCommand command = lookup.get(code);
	        return (command != null) ? command : DEFAULT;
	    }

}

Set correct service-name in command

Set correct service-name in command


package cs437.som.neighborhood;

/**
 * Neighborhood width strategy for self-organizing maps that decays the width
 * exponentially as the iterations progress.
 */
public class ExponentialDecayNeighborhoodWidth {
    private final double initialNeighborhoodWidth;
    private double expectedIterations;

    public ExponentialDecayNeighborhoodWidth(double initialWidth) {
        initialNeighborhoodWidth = initialWidth;
    }

    public void setExpectedIterations(int expectedIterations) {
        this.expectedIterations = expectedIterations;
    }

    public double neighborhoodWidth(int iteration) {
        return initialNeighborhoodWidth * Math.exp(-iteration / expectedIterations);
    }

    @Override
    public String toString() {
        return "ExponentialDecayNeighborhoodWidth";
    }
}

package cs437.som.neighborhood;

/**
 * Neighborhood width strategy for self-organizing maps that decays the width
 * exponentially as the iterations progress.
 *
 * The exact behavior follows the formula:
 *      w_i * e^(-t / t_max)
 *  where
 *      w_i   is the initial width of the neighborhood
 *      e     is the base of the natural logarithm
 *      t     is the current iteration
 *      t_max is the maximum expected iteration
 */
public class ExponentialDecayNeighborhoodWidth {
    private final double initialNeighborhoodWidth;
    private double expectedIterations;

    public ExponentialDecayNeighborhoodWidth(double initialWidth) {
        initialNeighborhoodWidth = initialWidth;
    }

    public void setExpectedIterations(int expectedIterations) {
        this.expectedIterations = expectedIterations;
    }

    public double neighborhoodWidth(int iteration) {
        return initialNeighborhoodWidth * Math.exp(-iteration / expectedIterations);
    }

    @Override
    public String toString() {
        return "ExponentialDecayNeighborhoodWidth";
    }
}

Add formula to exp. decay NW class.

Add formula to exp. decay NW class.


package com.alexrnl.jseries.request.parameters;

/**
 * Parameter indicating to use the new version of the BetaSeries API.

 * @author Alex
 */
public class Version extends Parameter<String> {
	/** Name of the beta parameter */
	private static final String	PARAMETER_BETA	= "v";
	/** Version of the API to use TODO parametrize */
	private static final String	BETA_VERSION	= "2.1";

	/**
	 * Constructor #1.

	 */
	public Version () {
		super(PARAMETER_BETA, BETA_VERSION);
	}
}

package com.alexrnl.jseries.request.parameters;

/**
 * Parameter indicating to use the new version of the BetaSeries API.

 * @author Alex
 */
public class Version extends Parameter<String> {
	/** Name of the beta parameter */
	private static final String	PARAMETER_VERSION	= "v";
	/** Version of the API to use TODO parametrize */
	private static final String	VERSION_NUMBER		= "2.1";

	/**
	 * Constructor #1.

	 */
	public Version () {
		super(PARAMETER_VERSION, VERSION_NUMBER);
	}
}

Update parameter version constant names

Update parameter version constant names


package seedu.address.ui;

import javafx.fxml.FXML;
import javafx.scene.Node;
import javafx.scene.control.Label;
import javafx.scene.layout.HBox;
import seedu.address.model.person.ReadOnlyPerson;

public class PersonCard extends UiPart{

    private static final String FXML = "PersonListCard.fxml";

    @FXML
    private HBox cardPane;
    @FXML
    private Label name;
    @FXML
    private Label id;
    @FXML
    private Label phone;
    @FXML
    private Label address;
    @FXML
    private Label email;
    @FXML
    private Label tags;

    private ReadOnlyPerson person;
    private int displayedIndex;

    public PersonCard(){

    }

    public static PersonCard load(ReadOnlyPerson person, int displayedIndex){
        PersonCard card = new PersonCard();
        card.person = person;
        card.displayedIndex = displayedIndex;
        return UiPartLoader.loadUiPart(card);
    }

    @FXML
    public void initialize() {
        name.setText(person.getName().fullName);
        id.setText(displayedIndex + ". ");
        phone.setText(person.getPhone().value);
        address.setText(person.getAddress().value);
        email.setText(person.getEmail().value);
        tags.setText(person.tagsString());
    }

    public HBox getLayout() {
        return cardPane;
    }

    @Override
    public void setNode(Node node) {
        cardPane = (HBox)node;
    }

    @Override
    public String getFxmlPath() {
        return FXML;
    }
}

package seedu.address.ui;

import javafx.fxml.FXML;
import javafx.scene.Node;
import javafx.scene.control.Label;
import javafx.scene.layout.HBox;
import seedu.address.model.person.ReadOnlyPerson;

public class PersonCard extends UiPart{

    private static final String FXML = "PersonListCard.fxml";

    @FXML
    private HBox cardPane;
    @FXML
    private Label name;
    @FXML
    private Label id;
    @FXML
    private Label tags;

    private ReadOnlyPerson person;
    private int displayedIndex;

    public PersonCard(){

    }

    public static PersonCard load(ReadOnlyPerson person, int displayedIndex){
        PersonCard card = new PersonCard();
        card.person = person;
        card.displayedIndex = displayedIndex;
        return UiPartLoader.loadUiPart(card);
    }

    @FXML
    public void initialize() {
        name.setText(person.getName().fullName);
        id.setText(displayedIndex + ". ");
        tags.setText(person.tagsString());
    }

    public HBox getLayout() {
        return cardPane;
    }

    @Override
    public void setNode(Node node) {
        cardPane = (HBox)node;
    }

    @Override
    public String getFxmlPath() {
        return FXML;
    }
}

Remove phone, address and email from Personcard class in UI


package infn.bed.util;

import infn.bed.geometry.GeometricConstants;

/**
 * Returns the layer of a veto.
 *
 * @author Angelo Licastro
 */
public class GetVetoLayer {

	/**
	 * Returns the layer of a veto.
	 *
	 * @param veto The number of a veto in one-based indexing.
	 * @return The layer of the veto.
	 * If the veto is a crystal, then 1 is returned.
	 * If the veto is an internal veto, then 2 is returned.
	 * If the veto is an external veto, then 3 is returned.
	 * If the veto does not exist, then -1 is returned.
	 */
	public int getVetoLayer(int veto) {
		if (veto > 0 && veto <= GeometricConstants.VETOES) {
			if (veto <= GeometricConstants.CRYSTALS) {
				return 1;
			} else if (veto <= GeometricConstants.INTERNAL_VETOES) {
				return 2;
			} else if (veto <= GeometricConstants.VETOES) {
				return 3;
			}
		}
		return -1;
	}

}

package infn.bed.util;

import infn.bed.geometry.GeometricConstants;

/**
 * Returns the layer of a veto.
 *
 * @author Angelo Licastro
 */
public class GetVetoLayer {

	/**
	 * Returns the layer of a veto.
	 *
	 * @param veto The number of a veto in one-based indexing.
	 * @return The layer of the veto.
	 * If the veto is a crystal, then 1 is returned.
	 * If the veto is an internal veto, then 2 is returned.
	 * If the veto is an external veto, then 3 is returned.
	 * If the veto does not exist, then -1 is returned.
	 */
	public static int getVetoLayer(int veto) {
		if (veto > 0 && veto <= GeometricConstants.VETOES) {
			if (veto <= GeometricConstants.CRYSTALS) {
				return 1;
			} else if (veto <= GeometricConstants.INTERNAL_VETOES + 1) {
				return 2;
			} else if (veto <= GeometricConstants.VETOES) {
				return 3;
			}
		}
		return -1;
	}

}

Support static references of getVetoLayer


package reactmann;

import io.vertx.core.AbstractVerticle;
import rx.Observable;

/**
 * @author blake
 */
public abstract class RiemannVerticle extends AbstractVerticle {
    @Override
    public void start() {
        vertx.deployVerticle("java:reactmann.TcpMessageVerticle", event -> observeStream(Riemann.getEvents(vertx)));
    }

    public abstract void observeStream(Observable<Event> events);
}

package reactmann;

import io.vertx.core.AbstractVerticle;
import rx.Observable;

/**
 * @author blake
 */
public abstract class RiemannVerticle extends AbstractVerticle {
    @Override
    public void start() {
        vertx.deployVerticle("java:" + WebSocketVerticle.class.getName(), webSocketCallback -> {
            vertx.deployVerticle("java:" + TcpMessageVerticle.class.getName(), tcpMessageCallback -> observeStream(Riemann.getEvents(vertx)));
        });
    }

    public abstract void observeStream(Observable<Event> events);
}

Make sure to deploy the websocket verticle by default as well.


package com.sangdol.experiment.portableDb;

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

/**
 * @author hugh
 */
public class ViewTable {
    public static final String TABLE_PREFIX = "true_view";
    private static final int TABLE_COUNT = 100;
    private static final List<String> names = new ArrayList<>();

    static {
        for (int i = 0; i < TABLE_COUNT; i++) {
            names.add(TABLE_PREFIX + i);
        }
    }

    public List<String> getAll() {
        return names;
    }

    // TODO throw exception when trying to get a not existing table
    public String get(int userId) {
        final int HOST_COUNT_IN_TABLE = 100;
        int tableNumber = (userId - 1) / HOST_COUNT_IN_TABLE;
        return TABLE_PREFIX + tableNumber;
    }
}

package com.sangdol.experiment.portableDb;

import javax.ws.rs.WebApplicationException;
import java.util.ArrayList;
import java.util.List;

/**
 * Manage horizontally split table names.
 *
 * @author hugh
 */
public class ViewTable {
    public static final String TABLE_PREFIX = "true_view";
    private static final int TABLE_COUNT = 100;
    private static final List<String> names = new ArrayList<>();

    static {
        for (int i = 0; i < TABLE_COUNT; i++) {
            names.add(TABLE_PREFIX + i);
        }
    }

    /**
     * Returns all table names with designated TABLE_PREFIX and TABLE_COUNT.
     */
    public List<String> getAll() {
        return names;
    }

    /**
     * Returns the allocated table name to the userId.
     * The index of table name is 0-based, e.g. true_view0, true_view1...
     */
    public String get(int userId) {
        final int HOST_COUNT_IN_TABLE = 100;
        int tableNumber = (userId - 1) / HOST_COUNT_IN_TABLE;

        if (tableNumber >= TABLE_COUNT)
            throw new WebApplicationException(404);

        return TABLE_PREFIX + tableNumber;
    }
}

Add docs / Throw exception for wrong userId


package invtweaks.forge;

import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import net.minecraft.client.multiplayer.PlayerControllerMP;
import net.minecraft.entity.player.EntityPlayer;

public class CommonProxy {
    public void preInit(FMLPreInitializationEvent e) {
    }

    public void init(FMLInitializationEvent e) {
    }

    public void postInit(FMLPostInitializationEvent e) {
    }

    public void setServerAssistEnabled(boolean enabled) {
    }

    public void setServerHasInvTweaks(boolean hasInvTweaks) {
    }

    public void slotClick(PlayerControllerMP playerController,
                          int windowId, int slot, int data,
                          int action, EntityPlayer player) {
    }
}

package invtweaks.forge;

import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import net.minecraft.client.multiplayer.PlayerControllerMP;
import net.minecraft.entity.player.EntityPlayer;

public class CommonProxy {
    public void preInit(FMLPreInitializationEvent e) {
    }

    public void init(FMLInitializationEvent e) {
    }

    public void postInit(FMLPostInitializationEvent e) {
    }

    public void setServerAssistEnabled(boolean enabled) {
    }

    public void setServerHasInvTweaks(boolean hasInvTweaks) {
    }

    /* Action values:
     * 0: Standard Click
     * 1: Shift-Click
     * 2: Move item to/from hotbar slot (Depends on current slot and hotbar slot being full or empty)
     * 3: Pick-Block
     * 4: Drop item
     * 5: Spread items (Drag behavior)
     * 6: Merge all valid items with held item
     */
    public void slotClick(PlayerControllerMP playerController,
                          int windowId, int slot, int data,
                          int action, EntityPlayer player) {
    }
}

Comment documenting what the various action values do.


package com.quollwriter.data.comparators;

import java.util.*;

import com.quollwriter.data.*;

public class ChapterItemSorter implements Comparator<ChapterItem>
{

    public int compare (ChapterItem o1,
                        ChapterItem o2)
    {
/*
        if (o1.getKey () == null)
        {

            return 1;

        }

        if (o2.getKey () == null)
        {

            return 1;

        }
  */
        if (o1.getPosition () == o2.getPosition ())
        {

            if ((o1.getKey () == null)
                ||
                (o1.getName () == null)
               )
            {

                return 1;

            }

            if ((o2.getKey () == null)
                ||
                (o2.getName () == null)
               )
            {

                return 1;

            }

            if ((o1 instanceof Scene)
                &&
                (o2 instanceof OutlineItem)
               )
            {

                return -1;

            }

            if ((o2 instanceof Scene)
                &&
                (o1 instanceof OutlineItem)
               )
            {

                return 1;

            }

            return o1.getName ().compareTo (o2.getName ());

            //return (int) (o1.getKey () - o2.getKey ());

        }

        return o1.getPosition () - o2.getPosition ();

    }

    public boolean equals (Object o)
    {

        return this == o;

    }

}

package com.quollwriter.data.comparators;

import java.util.*;

import com.quollwriter.data.*;

public class ChapterItemSorter implements Comparator<ChapterItem>
{

    public int compare (ChapterItem o1,
                        ChapterItem o2)
    {
/*
        if (o1.getKey () == null)
        {

            return 1;

        }

        if (o2.getKey () == null)
        {

            return 1;

        }
  */
        if (o1.getPosition () == o2.getPosition ())
        {

            if ((o1.getKey () == null)
                ||
                (o1.getName () == null)
               )
            {

                return 1;

            }

            if ((o2.getKey () == null)
                ||
                (o2.getName () == null)
               )
            {

                return 1;

            }

            if ((o1 instanceof Scene)
                &&
                (o2 instanceof OutlineItem)
               )
            {

                return -1;

            }

            if ((o2 instanceof Scene)
                &&
                (o1 instanceof OutlineItem)
               )
            {

                return 1;

            }

            int nc = o1.getName ().compareTo (o2.getName ());

            if (nc == 0)
            {

                // Return the one created first.
                return o1.getDateCreated ().compareTo (o2.getDateCreated ());

            }

            return nc;

            //return (int) (o1.getKey () - o2.getKey ());

        }

        return o1.getPosition () - o2.getPosition ();

    }

    public boolean equals (Object o)
    {

        return this == o;

    }

}

Tweak to make sorting work when two objects have same name.


package com.youcruit.billogram.objects.response.billogram;

import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;

public class Callback {

    @Expose
    private String url;
    @SerializedName("sign_key")
    @Expose
    private String signKey;
    @Expose
    private String custom;

    public String getUrl() {
	return url;
    }

    public void setUrl(String url) {
	this.url = url;
    }

    public Callback withUrl(String url) {
	this.url = url;
	return this;
    }

    public String getSignKey() {
	return signKey;
    }

    public void setSignKey(String signKey) {
	this.signKey = signKey;
    }

    public Callback withSignKey(String signKey) {
	this.signKey = signKey;
	return this;
    }

    public String getCustom() {
	return custom;
    }

    public void setCustom(String custom) {
	this.custom = custom;
    }

    public Callback withCustom(String custom) {
	this.custom = custom;
	return this;
    }

}

package com.youcruit.billogram.objects.response.billogram;

import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
import com.youcruit.billogram.objects.response.event.CallbackEvent;

public class Callback {
    @Expose
    CallbackBillogram billogram;
    @Expose
    CallbackEvent event;
    @Expose
    private String url;
    @SerializedName("sign_key")
    @Expose
    private String signKey;
    @Expose
    private String custom;

    public String getUrl() {
	return url;
    }

    public void setUrl(String url) {
	this.url = url;
    }

    public Callback withUrl(String url) {
	this.url = url;
	return this;
    }

    public String getSignKey() {
	return signKey;
    }

    public void setSignKey(String signKey) {
	this.signKey = signKey;
    }

    public Callback withSignKey(String signKey) {
	this.signKey = signKey;
	return this;
    }

    public String getCustom() {
	return custom;
    }

    public void setCustom(String custom) {
	this.custom = custom;
    }

    public Callback withCustom(String custom) {
	this.custom = custom;
	return this;
    }

}

Add attributes in callback class

Add attributes in callback class


package ru.stqa.pft.addressbook.tests;

import org.testng.Assert;
import org.testng.annotations.Test;
import ru.stqa.pft.addressbook.model.GroupData;

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

public class GroupCreationTests extends TestBase {

  @Test
  public void testGroupCreation() {
    app.getNavigationHelper().gotoGroupPage();
    List<GroupData> before = app.getGroupHelper().getGroupList();
    GroupData group = new GroupData("test2", null, null);
    app.getGroupHelper().createGroup(group);
    List<GroupData> after = app.getGroupHelper().getGroupList();
    Assert.assertEquals(after.size(), before.size() + 1);

    group.setId(after.stream().max((o1, o2) -> Integer.compare(o1.getId(), o2.getId())).get().getId());
    before.add(group);
    Assert.assertEquals(new HashSet<>(before), new HashSet<>(after));

  }

}

package ru.stqa.pft.addressbook.tests;

import org.testng.Assert;
import org.testng.annotations.Test;
import ru.stqa.pft.addressbook.model.GroupData;

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

public class GroupCreationTests extends TestBase {

  @Test
  public void testGroupCreation() {
    app.getNavigationHelper().gotoGroupPage();
    List<GroupData> before = app.getGroupHelper().getGroupList();
    GroupData group = new GroupData("test1", null, null);
    app.getGroupHelper().createGroup(group);
    List<GroupData> after = app.getGroupHelper().getGroupList();
    Assert.assertEquals(after.size(), before.size() + 1);

    before.add(group);
    int max = 0;
    for (GroupData g: after){
      if (g.getId()>max){
        max = g.getId();

      }
    }
    group.setId(max);
    before.add(group);

    Assert.assertEquals(new HashSet<>(before), new HashSet<>(after));

  }

}

Revert "изменение теста создания группы при помощи лямбды (блок лекции 4_9)"

This reverts commit 72618e59ddecad96951277e1e77926c4fb5e0184.


package de.gernd.simplemon.endpoints.dto;

import lombok.Builder;
import lombok.Data;

@Builder
@Data
public class MonitoringResult {
    private boolean isUp;
    private long timeNeededForRequest;
}

package de.gernd.simplemon.endpoints.dto;

import lombok.Builder;
import lombok.Data;

@Builder
@Data
public class MonitoringResult {
    private long timeNeededForRequest;
}

Remove isUp flag from DTO

Remove isUp flag from DTO


package remonsinnema.blog.fizzbuzz;

import java.util.Arrays;
import java.util.Collection;

public class FizzBuzz {

  private final Collection<Term> terms = Arrays.asList(new Term(3, "Fizz"), new Term(5, "Buzz"));

  public String get(int n) {
    StringBuilder result = new StringBuilder();
    for (Term term : terms) {
      term.textFor(n)
          .ifPresent(t -> result.append(t));
    }
    if (result.length() > 0) {
      return result.toString();
    }
    return Integer.toString(n);
  }

}

package remonsinnema.blog.fizzbuzz;

import java.util.Arrays;
import java.util.Collection;
import java.util.Optional;

public class FizzBuzz {

  private final Collection<Term> terms = Arrays.asList(new Term(3, "Fizz"), new Term(5, "Buzz"));

  public String get(int n) {
    return terms.stream()
        .map(term -> term.textFor(n))
        .filter(Optional::isPresent)
        .map(o -> o.get())
        .reduce((a, b) -> a + b)
        .orElse(Integer.toString(n));
  }

}

Use streams instead of loops and conditionals


package org.vrjuggler.vrjconfig.ui;

import java.io.File;
import javax.swing.filechooser.*;

/**
 * FileFilter for VR Juggler configuration files.
 */
public class ConfigFileFilter extends FileFilter
{
   /**
    * Verify that the given file is a configuration file.
    */
   public boolean accept(File f)
   {
      String ext = null;
      String s = f.getName();
      int i = s.lastIndexOf('.');

      if (i > 0 &&  i < s.length() - 1)
      {
         ext = s.substring(i+1).toLowerCase();
         if(ext.equals("jconf"))
         {
            return true;
         }
      }
      return false;
   }

   /**
    * Get a description of this filter to display in JFileChooser.
    */
   public String getDescription()
   {
      return("VR Juggler Configuration File (*.jconf)");
   }
}

package org.vrjuggler.vrjconfig.ui;

import java.io.File;
import javax.swing.filechooser.*;

/**
 * FileFilter for VR Juggler configuration files.
 */
public class ConfigFileFilter extends FileFilter
{
   /**
    * Verify that the given file is a configuration file.
    */
   public boolean accept(File f)
   {
      if(f.isDirectory())
      {
         return true;
      }
      String ext = null;
      String s = f.getName();
      int i = s.lastIndexOf('.');

      if (i > 0 &&  i < s.length() - 1)
      {
         ext = s.substring(i+1).toLowerCase();
         if(ext.equals("jconf"))
         {
            return true;
         }
      }
      return false;
   }

   /**
    * Get a description of this filter to display in JFileChooser.
    */
   public String getDescription()
   {
      return("VR Juggler Configuration File (*.jconf)");
   }
}

Allow the user to see directories also.

Allow the user to see directories also.

git-svn-id: 769d22dfa2d22aad706b9a451492fb87c0735f19@14187 08b38cba-cd3b-11de-854e-f91c5b6e4272


package org.synyx.urlaubsverwaltung.absence;

import org.springframework.data.repository.CrudRepository;

public interface AbsenceMappingDAO extends CrudRepository<AbsenceMapping, Integer> {

    AbsenceMapping findAbsenceMappingByAbsenceIdAndAbsenceType(Integer id, AbsenceType absenceType);
}

package org.synyx.urlaubsverwaltung.absence;

import org.springframework.data.repository.CrudRepository;

interface AbsenceMappingDAO extends CrudRepository<AbsenceMapping, Integer> {

    AbsenceMapping findAbsenceMappingByAbsenceIdAndAbsenceType(Integer id, AbsenceType absenceType);
}

Reduce scope of absence mapping dao

Reduce scope of absence mapping dao


package quarks.test.svt.apps;

import quarks.topology.Topology;
public class ObdAnalyticsApplication{

    private final FleetManagementAnalyticsClientApplication app;
    private final Topology t;
    private final String sensorId = "obd";

    public ObdAnalyticsApplication(Topology t, FleetManagementAnalyticsClientApplication app) {
        this.t = t;
        this.app = app;
    }

    /**
     * Add the ODB sensor's analytics to the topology.
     */
    public void addAnalytics() {

    }
}

/**
 * GPS analytics
 *

 * Source is a stream of GPS sensor data {@link GpsSensor}
 *

 * Here's an outline of the topology
 *

 *
Log GPS coordinates by publishing to IotF. The data may be used by a
 * server application to display the vehicle on a map.

 *
Filter to detect speeds above a threshold and publish alert IotF

 *
Filter for GPS coordinates that are outside of a defined Geofence
 * boundary

 *
Windowing to detect hard driving: hard braking or hard acceleration and
 * publish alert to IotF

 *

 *

 */
package quarks.test.svt.apps;

import quarks.test.svt.utils.sensor.gps.GpsSensor;
import quarks.topology.Topology;
public class ObdAnalyticsApplication{

    private final FleetManagementAnalyticsClientApplication app;
    private final Topology t;
    private final String sensorId = "obd";

    public ObdAnalyticsApplication(Topology t, FleetManagementAnalyticsClientApplication app) {
        this.t = t;
        this.app = app;
    }

    /**
     * Add the ODB sensor's analytics to the topology.
     */
    public void addAnalytics() {

    }
}

Add Apache header in OdbAnalyticsApplication.java


/*
 * Copyright 2019, TeamDev. All rights reserved.
 *
 * Redistribution and use in source and/or binary forms, with or without
 * modification, must retain the above copyright notice and the following
 * disclaimer.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

package io.spine.server.enrich;

import com.google.protobuf.Message;
import io.spine.base.EventMessage;
import io.spine.core.EventContext;

/**
 * Base interface for event enrichment functions.
 *
 * @param <M> the type of the event message
 * @param <E> the type of the enrichment message
 */
public interface EventEnrichmentFn<M extends EventMessage, E extends Message>
    extends EnrichmentFn<M, EventContext, E> {
}

/*
 * Copyright 2019, TeamDev. All rights reserved.
 *
 * Redistribution and use in source and/or binary forms, with or without
 * modification, must retain the above copyright notice and the following
 * disclaimer.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

package io.spine.server.enrich;

import com.google.protobuf.Message;
import io.spine.base.EventMessage;
import io.spine.core.EventContext;

/**
 * Base interface for event enrichment functions.
 *
 * @param <M> the type of the event message
 * @param <E> the type of the enrichment message
 */
@FunctionalInterface
public interface EventEnrichmentFn<M extends EventMessage, E extends Message>
    extends EnrichmentFn<M, EventContext, E> {
}

Mark event enrichment as func. interface


/*
 * $Id$
 * $Revision$
 * $Date$
 *
 * ====================================================================
 * 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 wicket.examples.signin2;

import wicket.ISessionFactory;
import wicket.Session;
import wicket.examples.WicketExampleApplication;

/**
 * Forms example.
 * @author Jonathan Locke
 */
public final class SignIn2Application extends WicketExampleApplication
{
    /**
     * Constructor.
     */
    public SignIn2Application()
    {
        getPages().setHomePage(Home.class);
    }

    /**
     * @see wicket.protocol.http.WebApplication#getSessionFactory()
     */
    public ISessionFactory getSessionFactory()
    {
        return new ISessionFactory()
        {
            public Session newSession()
            {
                return new SignIn2Session(SignIn2Application.this);
            }
        };
    }
}

/*
 * $Id$
 * $Revision$
 * $Date$
 *
 * ====================================================================
 * 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 wicket.examples.signin2;

import wicket.ISessionFactory;
import wicket.Session;
import wicket.examples.WicketExampleApplication;
import wicket.markup.html.form.encryption.NoCrypt;

/**
 * Forms example.
 * @author Jonathan Locke
 */
public final class SignIn2Application extends WicketExampleApplication
{
    /**
     * Constructor.
     */
    public SignIn2Application()
    {
        getPages().setHomePage(Home.class);

        // WARNING: DO NOT do this on a real world application!!

        // The NoCrypt class is being used here because not everyone
        // has the java security classes required by Crypt installed
        // and we want them to be able to run the examples out of the
        // box.
        getSettings().setCryptClass(NoCrypt.class);
    }

    /**
     * @see wicket.protocol.http.WebApplication#getSessionFactory()
     */
    public ISessionFactory getSessionFactory()
    {
        return new ISessionFactory()
        {
            public Session newSession()
            {
                return new SignIn2Session(SignIn2Application.this);
            }
        };
    }
}

Set Cypt class to NullCrypt for demo purposes

git-svn-id: ac804e38dcddf5e42ac850d29d9218b7df6087b7@455761 13f79535-47bb-0310-9956-ffa450edef68


package com.battlelancer.seriesguide.ui;

import android.os.Bundle;
import android.support.v4.app.FragmentTransaction;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;

import com.actionbarsherlock.app.SherlockFragment;
import com.uwetrottmann.seriesguide.R;

/**
 * Tells about trakt and how it integrates with SeriesGuide, allows to proceed
 * to entering credentials step.
 */
public class ConnectTraktFragment extends SherlockFragment {

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        return inflater.inflate(R.layout.connect_trakt_fragment, container, false);
    }

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

        // connect button
        getView().findViewById(R.id.buttonConnectTrakt).setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                ConnectTraktCredentialsFragment f = ConnectTraktCredentialsFragment.newInstance();
                FragmentTransaction ft = getFragmentManager().beginTransaction();
                ft.replace(R.id.root_container, f);
                ft.commit();
            }
        });

        // discard button
        getView().findViewById(R.id.buttonDiscard).setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                getActivity().finish();
            }
        });
    }
}

package com.battlelancer.seriesguide.ui;

import android.os.Bundle;
import android.support.v4.app.FragmentTransaction;
import android.text.method.LinkMovementMethod;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.TextView;

import com.actionbarsherlock.app.SherlockFragment;
import com.uwetrottmann.seriesguide.R;

/**
 * Tells about trakt and how it integrates with SeriesGuide, allows to proceed
 * to entering credentials step.
 */
public class ConnectTraktFragment extends SherlockFragment {

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        return inflater.inflate(R.layout.connect_trakt_fragment, container, false);
    }

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

        // connect button
        getView().findViewById(R.id.buttonConnectTrakt).setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                ConnectTraktCredentialsFragment f = ConnectTraktCredentialsFragment.newInstance();
                FragmentTransaction ft = getFragmentManager().beginTransaction();
                ft.replace(R.id.root_container, f);
                ft.commit();
            }
        });

        // discard button
        getView().findViewById(R.id.buttonDiscard).setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                getActivity().finish();
            }
        });

        // make learn more link clickable
        ((TextView) getView().findViewById(R.id.textViewAbout))
                .setMovementMethod(LinkMovementMethod.getInstance());
    }
}

Make learn more link clickable.

Make learn more link clickable.


package io.dropwizard.logging.layout;

import ch.qos.logback.classic.LoggerContext;
import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.contrib.jackson.JacksonJsonFormatter;
import ch.qos.logback.contrib.json.JsonLayoutBase;
import ch.qos.logback.core.pattern.PatternLayoutBase;
import io.dropwizard.logging.DropwizardLayout;
import io.dropwizard.logging.JsonStacktraceLayout;

import java.util.TimeZone;

/**
 * Factory that creates a {@link DropwizardLayout}
 */
public class DropwizardLayoutFactory implements LayoutFactory<ILoggingEvent> {
    @Override
    public PatternLayoutBase<ILoggingEvent> buildPatternLayout(LoggerContext context, TimeZone timeZone) {
        return new DropwizardLayout(context, timeZone);
    }

    @Override
    public JsonLayoutBase<ILoggingEvent> buildJsonLayout(LoggerContext context, TimeZone timeZone,
                                                         String timestampFormat, boolean includeStackTrace,
                                                         boolean prettyPrint) {
        JacksonJsonFormatter jsonFormatter = new JacksonJsonFormatter();
        jsonFormatter.setPrettyPrint(prettyPrint);
        JsonStacktraceLayout jsonLayout = new JsonStacktraceLayout();
        jsonLayout.setJsonFormatter(jsonFormatter);
        jsonLayout.setIncludeStacktrace(includeStackTrace);
        jsonLayout.setContext(context);
        jsonLayout.setTimestampFormat(timestampFormat);
        jsonLayout.setTimestampFormatTimezoneId(timeZone.getID());
        return  jsonLayout;
    }
}

package io.dropwizard.logging.layout;

import ch.qos.logback.classic.LoggerContext;
import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.contrib.jackson.JacksonJsonFormatter;
import ch.qos.logback.contrib.json.JsonLayoutBase;
import ch.qos.logback.core.pattern.PatternLayoutBase;
import io.dropwizard.logging.DropwizardLayout;
import io.dropwizard.logging.JsonStacktraceLayout;

import java.util.TimeZone;

/**
 * Factory that creates a {@link DropwizardLayout}
 */
public class DropwizardLayoutFactory implements LayoutFactory<ILoggingEvent> {
    @Override
    public PatternLayoutBase<ILoggingEvent> buildPatternLayout(LoggerContext context, TimeZone timeZone) {
        return new DropwizardLayout(context, timeZone);
    }

    @Override
    public JsonLayoutBase<ILoggingEvent> buildJsonLayout(LoggerContext context, TimeZone timeZone,
                                                         String timestampFormat, boolean includeStackTrace,
                                                         boolean prettyPrint) {
        JacksonJsonFormatter jsonFormatter = new JacksonJsonFormatter();
        jsonFormatter.setPrettyPrint(prettyPrint);
        JsonStacktraceLayout jsonLayout = new JsonStacktraceLayout();
        jsonLayout.setJsonFormatter(jsonFormatter);
        jsonLayout.setIncludeStacktrace(includeStackTrace);
        jsonLayout.setContext(context);
        jsonLayout.setTimestampFormat(timestampFormat);
        jsonLayout.setTimestampFormatTimezoneId(timeZone.getID());
        jsonLayout.setAppendLineSeparator(true);
        return  jsonLayout;
    }
}

Add line separator in logs from JSON event log to another to facilitate json log parsers


package org.ethereum.config.net;

import org.apache.commons.lang3.tuple.Pair;
import org.ethereum.config.blockchain.DaoHFConfig;
import org.ethereum.config.blockchain.Eip150HFConfig;
import org.ethereum.config.blockchain.Eip160HFConfig;
import org.ethereum.config.blockchain.MordenConfig;
import org.spongycastle.util.encoders.Hex;

import java.util.Collections;
import java.util.List;

/**
 * Created by Anton Nashatyrev on 25.02.2016.
 */
public class MordenNetConfig extends AbstractNetConfig {

    public MordenNetConfig() {
        add(0, new MordenConfig.Frontier());
        add(494_000, new MordenConfig.Homestead());
        add(1_783_000, new Eip150HFConfig(new MordenConfig.Homestead()));
        add(1_885_000, new Eip160HFConfig(new MordenConfig.Homestead()));

    }
}

package org.ethereum.config.net;

import org.apache.commons.lang3.tuple.Pair;
import org.ethereum.config.blockchain.Eip150HFConfig;
import org.ethereum.config.blockchain.Eip160HFConfig;
import org.ethereum.config.blockchain.MordenConfig;
import org.spongycastle.util.encoders.Hex;

import java.util.Collections;
import java.util.List;

/**
 * Created by Anton Nashatyrev on 25.02.2016.
 */
public class MordenNetConfig extends AbstractNetConfig {
    private static final long EIP150_HF_BLOCK = 1_783_000;
    private static final byte[] EIP150_HF_BLOCK_HASH =
            Hex.decode("f376243aeff1f256d970714c3de9fd78fa4e63cf63e32a51fe1169e375d98145");

    public MordenNetConfig() {
        add(0, new MordenConfig.Frontier());
        add(494_000, new MordenConfig.Homestead());
        add(EIP150_HF_BLOCK, new Eip150HFConfig(new MordenConfig.Homestead()) {
            @Override
            public List<Pair<Long, byte[]>> blockHashConstraints() {
                return Collections.singletonList(Pair.of(EIP150_HF_BLOCK, EIP150_HF_BLOCK_HASH));
            }
        });
        add(1_885_000, new Eip160HFConfig(new MordenConfig.Homestead()));

    }
}

Return back separator for Morden since wrong forked peers are still there


/*
 * Copyright (c) 2015 ThanksMister LLC
 *
 * 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.thanksmister.btcblue;

import android.app.Application;

import timber.log.Timber;

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

        if (BuildConfig.DEBUG) {
            Timber.plant(new Timber.DebugTree());
            //ButterKnife.setDebug(BuildConfig.DEBUG);
            //LeakCanary.install(this);
            //refWatcher = LeakCanary.install(this);
        } else {
            //Crashlytics.start(this);
            //Timber.plant(new CrashlyticsTree());
        }

        Injector.init(this);
    }
}

/*
 * Copyright (c) 2015 ThanksMister LLC
 *
 * 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.thanksmister.btcblue;

import android.app.Application;
import android.content.res.Configuration;
import android.content.res.Resources;

import java.util.Locale;

import timber.log.Timber;

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

        if (BuildConfig.DEBUG) {
            Timber.plant(new Timber.DebugTree());
        }

        // Force set the default locale to US for conversions
        Locale.setDefault(Locale.US);
        Resources res = getResources();
        Configuration config = res.getConfiguration();
        config.locale = Locale.US;
        res.updateConfiguration(config, res.getDisplayMetrics());

        Injector.init(this);
    }
}

Set default locale to US to use only periods for decimals, this helps with calculations.


package uk.co.alynn.games.ld30.desktop;

import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration;

import uk.co.alynn.games.ld30.SpaceHams;
import uk.co.alynn.games.ld30.world.Constants;

public class DesktopLauncher {
	public static void main (String[] arg) {
		LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
		config.width = Constants.STANDARD_RES_WIDTH;
		config.height = Constants.STANDARD_RES_HEIGHT;
		config.samples = 2;
		config.vSyncEnabled = true;
		config.title = "Space Hams";
		config.resizable = true;
		config.fullscreen = false;
		new LwjglApplication(new SpaceHams(), config);
	}
}

package uk.co.alynn.games.ld30.desktop;

import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration;

import uk.co.alynn.games.ld30.SpaceHams;
import uk.co.alynn.games.ld30.world.Constants;

public class DesktopLauncher {
	public static void main (String[] arg) {
		LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
		config.width = Constants.STANDARD_RES_WIDTH;
		config.height = Constants.STANDARD_RES_HEIGHT;
		config.samples = 2;
		config.vSyncEnabled = true;
		config.title = "Border Patrol";
		config.resizable = true;
		config.fullscreen = false;
		new LwjglApplication(new SpaceHams(), config);
	}
}

Use "Border Patrol" in the title

Use "Border Patrol" in the title