/**
 * Provides the classes necessary to create requests
 * and responses between nodes .
 *

 * There are several ways of creating requests:
 *

 *
 The default request does not imply an answer from the destination node.
 *      It is therefore asynchronous by default. (@see simizer.app.Application.sendOneWay)
 *

 *
 *
 the second method demands a response from the destination node.
 * the responding node must therefore create a Response object
 * with the originating request as parent parameter, and call the sendResponse method
 * Upon reception a ResponseReceived event will be signaled to the VM and propagated to the Application,
 * which will the call the handle method of the corresponding Application.
 *
 * @since 0.4
 * @see simizer.VM
 * @see  simizer.app
 */
package simizer.requests;

/**
 * Provides the necessary classes to simulate sending requests.
 *

 * There are two main ways to create and send requests:
 *

The default request does not require an answer from the destination
 *         node.  It can therefore be considered asynchronous.  See {@link
 *         Application#sendOneWay(Node,Request)}.
 *
 *
The second way requires a response from the destination node.  The
 *         responding node must therefore send the request back to the caller.
 *         (See {@link Application#sendResponse(Node,Request)}.

 *
 * @since 0.4
 */
package simizer.requests;

Update the documentation for the requests package.


package org.springframework.cloud.service.relational;

import java.util.logging.Logger;

import javax.sql.DataSource;

import org.springframework.beans.BeanWrapper;
import org.springframework.beans.BeanWrapperImpl;
import org.springframework.cloud.service.ServiceConnectorConfig;
import org.springframework.cloud.service.common.RelationalServiceInfo;

/**
 * Common implementation that assumes DBCP connection pool properties.
 *
 * @author Ramnivas Laddad
 *
 * @param <SI>
 */
public abstract class DbcpLikePooledDataSourceCreator<SI extends RelationalServiceInfo> implements PooledDataSourceCreator<SI> {

	protected static Logger logger = Logger.getLogger(PooledDataSourceCreator.class.getName());

	private DataSourceConfigurer configurer = new DataSourceConfigurer();

	protected void setBasicDataSourceProperties(DataSource basicDataSource, RelationalServiceInfo serviceInfo,
											   ServiceConnectorConfig serviceConnectorConfig,
  											   String driverClassName, String validationQuery) {
		BeanWrapper target = new BeanWrapperImpl(basicDataSource);
		target.setPropertyValue("driverClassName", driverClassName);
		target.setPropertyValue("url", serviceInfo.getJdbcUrl());
		if (validationQuery != null) {
			target.setPropertyValue("validationQuery", validationQuery);
			target.setPropertyValue("testOnBorrow", true);
		}
		configurer.configure(basicDataSource, (DataSourceConfig)serviceConnectorConfig);
	}

}

package org.springframework.cloud.service.relational;

import java.util.logging.Logger;

import javax.sql.DataSource;

import org.springframework.beans.BeanWrapper;
import org.springframework.beans.BeanWrapperImpl;
import org.springframework.cloud.service.PooledServiceConnectorConfig.PoolConfig;
import org.springframework.cloud.service.ServiceConnectorConfig;
import org.springframework.cloud.service.common.RelationalServiceInfo;

/**
 * Common implementation that assumes DBCP connection pool properties.
 *
 * @author Ramnivas Laddad
 *
 * @param <SI>
 */
public abstract class DbcpLikePooledDataSourceCreator<SI extends RelationalServiceInfo> implements PooledDataSourceCreator<SI> {

	protected static Logger logger = Logger.getLogger(PooledDataSourceCreator.class.getName());

	private DataSourceConfigurer configurer = new DataSourceConfigurer();

	protected void setBasicDataSourceProperties(DataSource basicDataSource, RelationalServiceInfo serviceInfo,
											   ServiceConnectorConfig serviceConnectorConfig,
  											   String driverClassName, String validationQuery) {
		BeanWrapper target = new BeanWrapperImpl(basicDataSource);
		target.setPropertyValue("driverClassName", driverClassName);
		target.setPropertyValue("url", serviceInfo.getJdbcUrl());
		if (validationQuery != null) {
			target.setPropertyValue("validationQuery", validationQuery);
			target.setPropertyValue("testOnBorrow", true);
		}

		if (serviceConnectorConfig == null) {
		    // choose sensible values so that we set max connection pool size to what
		    // free tier services on Cloud Foundry and Heroku allow
		    serviceConnectorConfig = new DataSourceConfig(new PoolConfig(4, 30000), null);
		}
		configurer.configure(basicDataSource, (DataSourceConfig)serviceConnectorConfig);
	}

}

Choose sensible values for pool config by default


package io.quarkus.hibernate.search.orm.elasticsearch.runtime.devconsole;

import java.time.Duration;
import java.util.stream.Collectors;

import org.hibernate.search.mapper.orm.entity.SearchIndexedEntity;
import org.hibernate.search.mapper.orm.mapping.SearchMapping;

import io.quarkus.devconsole.runtime.spi.DevConsolePostHandler;
import io.quarkus.devconsole.runtime.spi.FlashScopeUtil;
import io.quarkus.runtime.annotations.Recorder;
import io.vertx.core.Handler;
import io.vertx.core.MultiMap;
import io.vertx.ext.web.RoutingContext;

@Recorder
public class HibernateSearchDevConsoleRecorder {

    public Handler<RoutingContext> indexEntity() {
        return new DevConsolePostHandler() {
            @Override
            protected void handlePostAsync(RoutingContext event, MultiMap form) throws Exception {
                if (form.isEmpty()) {
                    return;
                }
                SearchMapping mapping = HibernateSearchSupplier.searchMapping();
                if (mapping == null) {
                    flashMessage(event, "There aren't any indexed entity types!", FlashScopeUtil.FlashMessageStatus.ERROR);
                    return;
                }
                mapping.scope(Object.class,
                        mapping.allIndexedEntities().stream()
                                .map(SearchIndexedEntity::jpaName)
                                .filter(form::contains)
                                .collect(Collectors.toList()))
                        .massIndexer()
                        .startAndWait();
                flashMessage(event, "Entities successfully reindexed", Duration.ofSeconds(10));
            }
        };
    }
}

package io.quarkus.hibernate.search.orm.elasticsearch.runtime.devconsole;

import java.time.Duration;
import java.util.stream.Collectors;

import org.hibernate.search.mapper.orm.entity.SearchIndexedEntity;
import org.hibernate.search.mapper.orm.mapping.SearchMapping;

import io.quarkus.devconsole.runtime.spi.DevConsolePostHandler;
import io.quarkus.devconsole.runtime.spi.FlashScopeUtil;
import io.quarkus.runtime.annotations.Recorder;
import io.vertx.core.Handler;
import io.vertx.core.MultiMap;
import io.vertx.ext.web.RoutingContext;

@Recorder
public class HibernateSearchDevConsoleRecorder {

    public Handler<RoutingContext> indexEntity() {
        return new DevConsolePostHandler() {
            @Override
            protected void handlePostAsync(RoutingContext event, MultiMap form) throws Exception {
                if (form.isEmpty()) {
                    return;
                }
                SearchMapping mapping = HibernateSearchSupplier.searchMapping();
                if (mapping == null) {
                    flashMessage(event, "There are no indexed entity types.", FlashScopeUtil.FlashMessageStatus.ERROR);
                    return;
                }
                mapping.scope(Object.class,
                        mapping.allIndexedEntities().stream()
                                .map(SearchIndexedEntity::jpaName)
                                .filter(form::contains)
                                .collect(Collectors.toList()))
                        .massIndexer()
                        .startAndWait();
                flashMessage(event, "Entities successfully reindexed", Duration.ofSeconds(10));
            }
        };
    }
}

Make error message a bit more neutral

Make error message a bit more neutral


package com.poco.PoCoRuntime;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * Single unit for matching a PoCo event or result.
 */
public class Match implements Matchable {
    private String matchString;

    private boolean isWildcard;

    private boolean isAction;
    private boolean isResult;

    public Match(String matchString) {
        // This constructor creates an Action match
        isAction = true;
        isResult = false;

        isWildcard = (matchString == "%");
        this.matchString = matchString;
    }

    @Override
    public boolean accepts(Event event) {
        if (isWildcard) {
            return true;
        }

        Pattern pattern = Pattern.compile(matchString);
        Matcher matcher = pattern.matcher(event.getSignature());

        return matcher.find();
    }
}

package com.poco.PoCoRuntime;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * Single unit for matching a PoCo event or result.
 */
public class Match implements Matchable {
    private String matchString;

    private boolean isWildcard;

    private boolean isAction;
    private boolean isResult;

    /**
     * This constructor creates an Action match
     * @param matchString
     */
    public Match(String matchString) {
        // This constructor creates an Action match
        isAction = true;
        isResult = false;

        isWildcard = (matchString == "%");
        this.matchString = matchString;
    }

    /**
     * Constructor for Match when it is result instead of action
     * @param matchString
     */
    public Match(String matchString, boolean isaction, boolean isresult) {

        isAction = isaction;
        isResult = isresult;

        isWildcard = (matchString == "%");
        this.matchString = matchString;
    }

    @Override
    public boolean accepts(Event event) {
        if (isWildcard) {
            return true;
        }

        Pattern pattern = Pattern.compile(matchString);
        Matcher matcher = pattern.matcher(event.getSignature());

        return matcher.find();
    }
}

Add a constructor for result

Add a constructor for result

Add a constructor for result


package org.cru.godtools.domain;

import com.googlecode.flyway.core.Flyway;
import com.googlecode.flyway.core.api.MigrationVersion;
import org.cru.godtools.domain.properties.GodToolsProperties;
import org.cru.godtools.domain.properties.GodToolsPropertiesFactory;

/**
 * Created by ryancarlson on 7/18/14.
 */
public class DatabaseMigration
{
	static GodToolsProperties properties = new GodToolsPropertiesFactory().get();

	public static void main(String[] args)
	{
		new DatabaseMigration().build();
	}

	public void build()
	{
		Flyway flyway = new Flyway();
		flyway.setDataSource(properties.getProperty("databaseUrl"), properties.getProperty("databaseUsername") ,properties.getProperty("databasePassword"));
		flyway.setInitVersion("0");
		flyway.migrate();
	}
}

package org.cru.godtools.domain;

import com.googlecode.flyway.core.Flyway;
import com.googlecode.flyway.core.api.MigrationVersion;
import org.cru.godtools.domain.properties.GodToolsProperties;
import org.cru.godtools.domain.properties.GodToolsPropertiesFactory;

/**
 * Created by ryancarlson on 7/18/14.
 */
public class DatabaseMigration
{
	static GodToolsProperties properties = new GodToolsPropertiesFactory().get();

	public static void main(String[] args)
	{
		// i chose an OR here to allow for the process to be invoked from the IDE w/o having to set CLI args.  Jenkins will always pass true or false
		if(args.length == 0 || doDeploy(args[0]))
		{
			String environmentPrefix = args.length > 1 ? (getEnvironmentPrefix(args[1])) : "";

			new DatabaseMigration().build(environmentPrefix);
		}
	}

	public void build(String environmentPrefix)
	{
		Flyway flyway = new Flyway();
		flyway.setDataSource(properties.getProperty(environmentPrefix + "databaseUrl"),
				properties.getProperty(environmentPrefix + "databaseUsername"),
				properties.getProperty(environmentPrefix + "databasePassword"));
		flyway.setInitVersion("0");
		flyway.migrate();
	}

	static boolean doDeploy(String commandLineArg)
	{
		return Boolean.parseBoolean(commandLineArg);
	}

	static String getEnvironmentPrefix(String commandLineArg)
	{
		return  commandLineArg + "_";
	}
}

Add logic to accept command line args to enable migration and set environment prefix


package j2html.tags;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;

import j2html.Config;
import j2html.utils.CSSMin;
import j2html.utils.JSMin;

import static j2html.TagCreator.*;

public class InlineStaticResource {

    public enum TargetFormat {CSS_MIN, CSS, JS_MIN, JS}

    public static ContainerTag get(String path, TargetFormat format) {
        String fileString = getFileAsString(path);
        switch (format) {
            case CSS_MIN : return style().with(rawHtml(Config.cssMinifier.minify(fileString)));
            case JS_MIN  : return script().with(rawHtml(Config.jsMinifier.minify((fileString))));
            case CSS     : return style().with(rawHtml(fileString));
            case JS      : return script().with(rawHtml(fileString));
            default      : throw new RuntimeException("Invalid target format");
        }
    }

    public static String getFileAsString(String path) {
        try {
            return readFileAsString(InlineStaticResource.class.getResource(path).getPath());
        } catch (Exception e1) {
            try {
                return readFileAsString(path);
            } catch (Exception e2) {
                throw new RuntimeException("Couldn't find file with path='" + path + "'");
            }
        }
    }

    /**
     * @author kjheimark <3
     */
    private static String readFileAsString(String path) throws IOException {
        BufferedReader bufferedReader = new BufferedReader(new FileReader(path));
        StringBuilder sb = new StringBuilder();
        int c;
        while ((c = bufferedReader.read()) >= 0 && c >= 0) {
            sb.append((char) c);
        }
        return sb.toString();
    }

}

package j2html.tags;

import java.io.FileInputStream;
import java.io.InputStream;
import java.util.Scanner;

import j2html.Config;

import static j2html.TagCreator.*;

public class InlineStaticResource {

    public enum TargetFormat {CSS_MIN, CSS, JS_MIN, JS}

    public static ContainerTag get(String path, TargetFormat format) {
        String fileString = getFileAsString(path);
        switch (format) {
            case CSS_MIN : return style().with(rawHtml(Config.cssMinifier.minify(fileString)));
            case JS_MIN  : return script().with(rawHtml(Config.jsMinifier.minify((fileString))));
            case CSS     : return style().with(rawHtml(fileString));
            case JS      : return script().with(rawHtml(fileString));
            default      : throw new RuntimeException("Invalid target format");
        }
    }

    public static String getFileAsString(String path) {
        try {
            return streamToString(InlineStaticResource.class.getResourceAsStream(path));
        } catch (Exception expected) { // we don't ask users to specify classpath or file-system
            try {
                return streamToString(new FileInputStream(path));
            } catch (Exception exception) {
                throw new RuntimeException("Couldn't find file with path='" + path + "'");
            }
        }
    }

    private static String streamToString(InputStream inputStream) {
        Scanner s = new Scanner(inputStream).useDelimiter("\\A");
        return s.hasNext() ? s.next() : "";
    }

}

Allow reading static resources from jars


/*
 * Axelor Business Solutions
 *
 * Copyright (C) 2018 Axelor (<http://axelor.com>).
 *
 * This program is free software: you can redistribute it and/or  modify
 * it under the terms of the GNU Affero General Public License, version 3,
 * as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package com.axelor.studio.db.repo;

import com.axelor.meta.db.MetaJsonField;
import com.axelor.meta.db.repo.MetaJsonFieldRepository;
import com.axelor.studio.db.AppBuilder;

public class MetaJsonFieldRepo extends MetaJsonFieldRepository {

  @Override
  public MetaJsonField save(MetaJsonField metajsonField) {

    AppBuilder appBuilder = metajsonField.getAppBuilder();
    if (appBuilder != null) {
      metajsonField.setIncludeIf("__config__.app.isApp('" + appBuilder.getCode() + "')");
    }

    return metajsonField;
  }
}

/*
 * Axelor Business Solutions
 *
 * Copyright (C) 2018 Axelor (<http://axelor.com>).
 *
 * This program is free software: you can redistribute it and/or  modify
 * it under the terms of the GNU Affero General Public License, version 3,
 * as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package com.axelor.studio.db.repo;

import com.axelor.meta.db.MetaJsonField;
import com.axelor.meta.db.repo.MetaJsonFieldRepository;
import com.axelor.studio.db.AppBuilder;

public class MetaJsonFieldRepo extends MetaJsonFieldRepository {

  @Override
  public MetaJsonField save(MetaJsonField metajsonField) {

    AppBuilder appBuilder = metajsonField.getAppBuilder();
    if (appBuilder != null) {
      metajsonField.setIncludeIf("__config__.app.isApp('" + appBuilder.getCode() + "')");
    }

    return super.save(metajsonField);
  }
}

Fix metajson field save issue

Fix metajson field save issue


package com.admicro.vertxlet.core.handler.impl;

import com.admicro.vertxlet.core.handler.FailureHandler;
import com.admicro.vertxlet.core.HttpServerVerticle;
import com.admicro.vertxlet.core.db.IDbConnector;
import io.vertx.core.logging.Logger;
import io.vertx.core.logging.LoggerFactory;
import io.vertx.ext.web.RoutingContext;

import java.util.Map;

public class FailureHandlerImpl implements FailureHandler {

    private static final Logger _logger = LoggerFactory.getLogger(FailureHandlerImpl.class);

    @Override
    public void handle(RoutingContext rc) {
        _logger.error("Unexpected error occur", rc.failure());
        rc.fail(new Exception());

        // Guarantee db connections is closed when error occurs
        Map<String, IDbConnector> iDbAdaptorMap = rc.get(HttpServerVerticle.DATABASE_KEY);
        for (IDbConnector adaptor : iDbAdaptorMap.values()) {
            adaptor.close(v -> {
            });
        }

        rc.response().putHeader("content-type", "text/html")
                .setStatusCode(500).end("
Server internal error
");
    }
}

package com.admicro.vertxlet.core.handler.impl;

import com.admicro.vertxlet.core.handler.FailureHandler;
import com.admicro.vertxlet.core.HttpServerVerticle;
import com.admicro.vertxlet.core.db.IDbConnector;
import io.vertx.core.logging.Logger;
import io.vertx.core.logging.LoggerFactory;
import io.vertx.ext.web.RoutingContext;

import java.util.Map;

public class FailureHandlerImpl implements FailureHandler {

    private static final Logger _logger = LoggerFactory.getLogger(FailureHandlerImpl.class);

    @Override
    public void handle(RoutingContext rc) {
        _logger.error("Unexpected error occur", rc.failure());
        // Guarantee db connections is closed when error occurs
        Map<String, IDbConnector> iDbAdaptorMap = rc.get(HttpServerVerticle.DATABASE_KEY);
        for (IDbConnector adaptor : iDbAdaptorMap.values()) {
            adaptor.close(v -> {
            });
        }

        rc.response().putHeader("content-type", "text/html")
                .setStatusCode(500).end("
Server internal error
");
    }
}

Fix failure handler alway throw exception


package io.collap.bryg.compiler.helper;

import io.collap.bryg.compiler.ast.expression.Expression;
import io.collap.bryg.compiler.parser.BrygMethodVisitor;
import io.collap.bryg.compiler.type.Type;
import io.collap.bryg.compiler.type.TypeHelper;

public class StringBuilderCompileHelper extends ObjectCompileHelper {

    public StringBuilderCompileHelper (BrygMethodVisitor method) {
        super (method, new Type (StringBuilder.class));
    }

    public void compileAppend (Expression expression) {
        compileAppend (expression, true);
    }

    /**
     * StringBuilder -> StringBuilder
     */
    public void compileAppend (Expression expression, boolean compileExpression) {
        Type argumentType = expression.getType ();
        if (!argumentType.getJavaType ().isPrimitive ()) { /* All objects are supplied as either String or Object. */
            if (!argumentType.equals (String.class)) {
                argumentType = new Type (Object.class);
            }
        }else {
            /* Byte and Short primitives need to be appended as integers. */
            if (argumentType.equals (Byte.TYPE) || argumentType.equals (Short.TYPE)) {
                argumentType = new Type (Integer.TYPE);
            }
        }

        if (compileExpression) {
            expression.compile ();
            // -> T
        }

        compileInvokeVirtual ("append", TypeHelper.generateMethodDesc (
                new Type[] { argumentType },
                type
        ));
        // StringBuilder, T -> StringBuilder
    }

    public void compileToString () {
        compileInvokeVirtual ("toString", TypeHelper.generateMethodDesc (null, String.class));
        // StringBuilder -> String
    }

}

package io.collap.bryg.compiler.helper;

import io.collap.bryg.compiler.ast.expression.Expression;
import io.collap.bryg.compiler.parser.BrygMethodVisitor;
import io.collap.bryg.compiler.type.Type;
import io.collap.bryg.compiler.type.TypeHelper;

public class StringBuilderCompileHelper extends ObjectCompileHelper {

    public StringBuilderCompileHelper (BrygMethodVisitor method) {
        super (method, new Type (StringBuilder.class));
    }

    /**
     * Compiles the expression by default!
     */
    public void compileAppend (Expression expression) {
        compileAppend (expression, true);
    }

    /**
     * StringBuilder -> StringBuilder
     */
    public void compileAppend (Expression expression, boolean compileExpression) {
        Type argumentType = expression.getType ();
        if (!argumentType.getJavaType ().isPrimitive ()) { /* All objects are supplied as either String or Object. */
            if (!argumentType.equals (String.class)) {
                argumentType = new Type (Object.class);
            }
        }else {
            /* Byte and Short primitives need to be appended as integers. */
            if (argumentType.equals (Byte.TYPE) || argumentType.equals (Short.TYPE)) {
                argumentType = new Type (Integer.TYPE);
            }
        }

        if (compileExpression) {
            expression.compile ();
            // -> T
        }

        compileInvokeVirtual ("append", TypeHelper.generateMethodDesc (
                new Type[] { argumentType },
                type
        ));
        // StringBuilder, T -> StringBuilder
    }

    public void compileToString () {
        compileInvokeVirtual ("toString", TypeHelper.generateMethodDesc (null, String.class));
        // StringBuilder -> String
    }

}

Clarify compileAppend's handling of expressions.


package com.unidev.zerostorage;

import com.unidev.zerostorage.index.IndexStorage;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;

import java.io.File;

/**
 * Storage index tests
 */
public class TestIndexStorage {

    @Rule
    public TemporaryFolder folder= new TemporaryFolder();

    @Test
    public void testBlankIndexStorageSave() {
        IndexStorage indexStorage = new IndexStorage();

        Storage blankIndex = new Storage();
        indexStorage.index(blankIndex);

        File root = folder.getRoot();

        indexStorage.storageRoot(root);
        indexStorage.save();

    }

    @Test
    public void testIndexStorageSave() {
        IndexStorage indexStorage = new IndexStorage();

        Storage index = new Storage();
        index.details().put("Potato", "Tomato");
        index.details().put("Tomato", null);
        indexStorage.index(index);

        File root = folder.getRoot();

        indexStorage.storageRoot(root);
        indexStorage.save();

    }

}

package com.unidev.zerostorage;

import com.unidev.zerostorage.index.IndexStorage;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;

import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Files;

/**
 * Storage index tests
 */
public class TestIndexStorage {

    @Rule
    public TemporaryFolder folder= new TemporaryFolder();

    @Test
    public void testBlankIndexStorageSave() {
        IndexStorage indexStorage = new IndexStorage();

        Storage blankIndex = new Storage();
        indexStorage.index(blankIndex);

        File root = folder.getRoot();

        indexStorage.storageRoot(root);
        indexStorage.save();

    }

    @Test
    public void testIndexStorageSave() {
        IndexStorage indexStorage = new IndexStorage();

        Storage index = new Storage();
        index.details().put("Potato", "Tomato");
        index.details().put("Tomato", null);
        indexStorage.index(index);

        File root = folder.getRoot();

        indexStorage.storageRoot(root);
        indexStorage.save();

    }

    @Test
    public void testLoadIndexStorage() throws IOException {
        InputStream inputStream = TestStorage.class.getResourceAsStream("/blankIndex.json");
        File root = folder.getRoot();

        File index = new File(root, IndexStorage.INDEX_FILE);
        Files.copy(inputStream, index.toPath());

        IndexStorage indexStorage = new IndexStorage();
        indexStorage.storageRoot(root);
        indexStorage.load();
    }

}

Test loading of blank index file

Test loading of blank index file


/*
Copyright 2007-2009 WebDriver committers
Copyright 2007-2009 Google Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package org.openqa.selenium.internal.selenesedriver;

import com.thoughtworks.selenium.Selenium;
import org.openqa.selenium.Capabilities;
import org.openqa.selenium.Platform;

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

public class NewSession implements SeleneseFunction<Map<String, Object>> {
  public Map<String, Object> apply(Selenium selenium, Map<String, ?> args) {
    selenium.start();
    Capabilities capabilities = (Capabilities) args.get("desiredCapabilities");
    Map<String, Object> seenCapabilities = new HashMap<String, Object>();
    seenCapabilities.put("browserName", capabilities.getBrowserName());
    seenCapabilities.put("version", capabilities.getVersion());
    seenCapabilities.put("platform", Platform.getCurrent().toString());
    seenCapabilities.put("javascriptEnabled", true);
    return seenCapabilities;
  }
}

/*
Copyright 2007-2009 WebDriver committers
Copyright 2007-2009 Google Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package org.openqa.selenium.internal.selenesedriver;

import com.thoughtworks.selenium.Selenium;
import org.openqa.selenium.Capabilities;
import org.openqa.selenium.Platform;

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

public class NewSession implements SeleneseFunction<Map<String, Object>> {
  public Map<String, Object> apply(Selenium selenium, Map<String, ?> args) {
    selenium.start();

    // Emulate behaviour of webdriver
    selenium.useXpathLibrary("javascript-xpath");
    selenium.allowNativeXpath("true");

    Capabilities capabilities = (Capabilities) args.get("desiredCapabilities");
    Map<String, Object> seenCapabilities = new HashMap<String, Object>();
    seenCapabilities.put("browserName", capabilities.getBrowserName());
    seenCapabilities.put("version", capabilities.getVersion());
    seenCapabilities.put("platform", Platform.getCurrent().toString());
    seenCapabilities.put("javascriptEnabled", true);
    return seenCapabilities;
  }
}

SimonStewart: Make the selenium-backed webdriver emulate the normal webdriver's xpath mode

git-svn-id: 4179480af2c2519a5eb5e1e9b541cbdf5cf27696@10674 07704840-8298-11de-bf8c-fd130f914ac9


package io.github.bonigarcia;

/*
 * (C) Copyright 2017 Boni Garcia (http://bonigarcia.github.io/)
 *
 * 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.
 *
 */
public class Address {

    public String firstName;
    public String lastName;

    public Address(String firstName, String lastName) {
        this.firstName = firstName;
        this.lastName = lastName;
    }

    public String getFirstName() {
        return firstName;
    }

    public void setFirstName(String firstName) {
        this.firstName = firstName;
    }

    public String getLastName() {
        return lastName;
    }

    public void setLastName(String lastName) {
        this.lastName = lastName;
    }

}

/*
 * (C) Copyright 2017 Boni Garcia (http://bonigarcia.github.io/)
 *
 * 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 io.github.bonigarcia;

public class Address {

    public String firstName;
    public String lastName;

    public Address(String firstName, String lastName) {
        this.firstName = firstName;
        this.lastName = lastName;
    }

    public String getFirstName() {
        return firstName;
    }

    public void setFirstName(String firstName) {
        this.firstName = firstName;
    }

    public String getLastName() {
        return lastName;
    }

    public void setLastName(String lastName) {
        this.lastName = lastName;
    }

}

Move package declaration to top of class


/**
 * 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.curator.utils;

import org.apache.curator.drivers.TracerDriver;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.concurrent.TimeUnit;

/**
 * Default tracer driver
 */
public class DefaultTracerDriver implements TracerDriver
{
    private final Logger log = LoggerFactory.getLogger(getClass());

    @Override
    public void addTrace(String name, long time, TimeUnit unit)
    {
        log.trace("Trace: " + TimeUnit.MILLISECONDS.convert(time, unit) + " ms");
    }

    @Override
    public void addCount(String name, int increment)
    {
        log.trace("Counter " + name + ": " + increment);
    }
}

/**
 * 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.curator.utils;

import org.apache.curator.drivers.TracerDriver;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.concurrent.TimeUnit;

/**
 * Default tracer driver
 */
public class DefaultTracerDriver implements TracerDriver
{
    private final Logger log = LoggerFactory.getLogger(getClass());

    @Override
    public void addTrace(String name, long time, TimeUnit unit)
    {
        if ( log.isTraceEnabled() )
        {
            log.trace("Trace: " + TimeUnit.MILLISECONDS.convert(time, unit) + " ms");
        }
    }

    @Override
    public void addCount(String name, int increment)
    {
        if ( log.isTraceEnabled() )
        {
            log.trace("Counter " + name + ": " + increment);
        }
    }
}

Use isTraceEnabled to prevent unnecessary string concat


package org.bouncycastle.bcpg;

import java.io.IOException;

import org.bouncycastle.util.Arrays;
import org.bouncycastle.util.Strings;

/**
 * Generic literal data packet.
 */
public class LiteralDataPacket
    extends InputStreamPacket
{
    int     format;
    byte[]  fileName;
    long    modDate;

    LiteralDataPacket(
        BCPGInputStream    in)
        throws IOException
    {
        super(in);

        format = in.read();
        int    l = in.read();

        fileName = new byte[l];
        for (int i = 0; i != fileName.length; i++)
        {
            fileName[i] = (byte)in.read();
        }

        modDate = ((long)in.read() << 24) | (in.read() << 16) | (in.read() << 8) | in.read();
    }

    /**
     * Return the format tag of the data packet.
     */
    public int getFormat()
    {
        return format;
    }

    /**
     * Return the modification time for the file (milliseconds at second level precision).
     */
    public long getModificationTime()
    {
        return modDate * 1000L;
    }

    /**
     * Return the file name associated with the data packet.
     */
    public String getFileName()
    {
        return Strings.fromUTF8ByteArray(fileName);
    }

    /**
     * Return the file name as an uninterpreted byte array.
     */
    public byte[] getRawFileName()
    {
        byte[] tmp = new byte[fileName.length];

        for (int i = 0; i != tmp.length; i++)
        {
            tmp[i] = fileName[i];
        }

        return tmp;
    }
}

package org.bouncycastle.bcpg;

import java.io.IOException;

import org.bouncycastle.util.Arrays;
import org.bouncycastle.util.Strings;

/**
 * Generic literal data packet.
 */
public class LiteralDataPacket
    extends InputStreamPacket
{
    int     format;
    byte[]  fileName;
    long    modDate;

    LiteralDataPacket(
        BCPGInputStream    in)
        throws IOException
    {
        super(in);

        format = in.read();
        int    l = in.read();

        fileName = new byte[l];
        for (int i = 0; i != fileName.length; i++)
        {
            fileName[i] = (byte)in.read();
        }

        modDate = ((long)in.read() << 24) | (in.read() << 16) | (in.read() << 8) | in.read();
    }

    /**
     * Return the format tag of the data packet.
     */
    public int getFormat()
    {
        return format;
    }

    /**
     * Return the modification time for the file (milliseconds at second level precision).
     */
    public long getModificationTime()
    {
        return modDate * 1000L;
    }

    /**
     * Return the file name associated with the data packet.
     */
    public String getFileName()
    {
        return Strings.fromUTF8ByteArray(fileName);
    }

    /**
     * Return the file name as an uninterpreted byte array.
     */
    public byte[] getRawFileName()
    {
        return Arrays.clone(fileName);
    }
}

Replace inline array copy with Arrays.clone


package fr.free.nrw.commons.nearby;

import android.content.Context;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import butterknife.BindView;
import butterknife.ButterKnife;
import fr.free.nrw.commons.R;
import fr.free.nrw.commons.ViewHolder;
import fr.free.nrw.commons.utils.ResourceUtils;

public class NearbyViewHolder implements ViewHolder<Place> {
    @BindView(R.id.tvName) TextView tvName;
    @BindView(R.id.tvDesc) TextView tvDesc;
    @BindView(R.id.distance) TextView distance;
    @BindView(R.id.icon) ImageView icon;

    public NearbyViewHolder(View view) {
        ButterKnife.bind(this, view);
    }

    @Override
    public void bindModel(Context context, Place place) {
        // Populate the data into the template view using the data object
        tvName.setText(place.name);
        String description = place.description;
        if ( description == null || description.isEmpty() || description.equals("?")) {
            description = "No Description Found";
        }
        tvDesc.setText(description);
        distance.setText(place.distance);
        icon.setImageResource(ResourceUtils.getDescriptionIcon(place.description));
    }
}

package fr.free.nrw.commons.nearby;

import android.content.Context;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import butterknife.BindView;
import butterknife.ButterKnife;
import fr.free.nrw.commons.R;
import fr.free.nrw.commons.ViewHolder;
import fr.free.nrw.commons.utils.ResourceUtils;

public class NearbyViewHolder implements ViewHolder<Place> {
    @BindView(R.id.tvName) TextView tvName;
    @BindView(R.id.tvDesc) TextView tvDesc;
    @BindView(R.id.distance) TextView distance;
    @BindView(R.id.icon) ImageView icon;

    public NearbyViewHolder(View view) {
        ButterKnife.bind(this, view);
    }

    @Override
    public void bindModel(Context context, Place place) {
        // Populate the data into the template view using the data object
        tvName.setText(place.name);
        String description = place.description;
        if ( description == null || description.isEmpty() || description.equals("?")) {
            description = context.getString(R.string.no_description_found);
        }
        tvDesc.setText(description);
        distance.setText(place.distance);
        icon.setImageResource(ResourceUtils.getDescriptionIcon(place.description));
    }
}

Use string resource instead of hardcoded string


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

package ru.ming13.gambit.ui.bus;

import com.squareup.otto.Bus;

public class BusProvider
{
	private static Bus instance;

	private BusProvider() {
	}

	public static Bus getInstance() {
		if (instance == null) {
			instance = new Bus();
		}

		return instance;
	}
}

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

package ru.ming13.gambit.ui.bus;

import com.squareup.otto.Bus;

public class BusProvider
{
	private BusProvider() {
	}

	private static final class BusHolder
	{
		public static final Bus BUS = new Bus();
	}

	public static Bus getInstance() {
		return BusHolder.BUS;
	}
}

Change Otto bus provider to be lazy.

Change Otto bus provider to be lazy.


package com.bpedman.lambdas;

import java.util.Arrays;
import java.util.List;
import java.util.stream.IntStream;

/**
 * @author Brandon Pedersen <bpedersen@getjive.com>
 */
public class Example_03
{
  /**
   * Less lines of code but you still need to read the predicate lambda to understand what is
   * happening...
   */
  private static boolean isPrime(final int number)
  {
    return number > 1 &&
        IntStream
            .range(2, number - 1)
            .noneMatch(value -> number % value == 0);
  }

  /**
   * Our goal...turn this set of calculations into something that is as readable as the method name
   * itself and more succinct than it is
   *
   * @param numbers
   *          potentially unordered, non-unique set of numbers
   */
  public static int findDoubleOfFirstPrimeNumberGreaterThan5(List<Integer> numbers)
  {
    int result = 0;
    for (final Integer number : numbers)
    {
      // first check if prime
      if (isPrime(number))
      {
        if (number > 5)
        {
          result = number * 2;
        }
      }
    }

    return result;
  }

  public static void main(String[] args)
  {
    System.out.println(findDoubleOfFirstPrimeNumberGreaterThan5(
        Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11)));
  }
}

package com.bpedman.lambdas;

import java.util.Arrays;
import java.util.List;
import java.util.stream.IntStream;

/**
 * @author Brandon Pedersen <bpedersen@getjive.com>
 */
public class Example_03
{
  /**
   * Less lines of code but you still need to read the predicate lambda to understand what is
   * happening...
   */
  private static boolean isPrime(final int number)
  {
    return number > 1 &&
        IntStream
            .range(2, number - 1)
            .noneMatch((value) -> number % value == 0);
  }

  /**
   * Our goal...turn this set of calculations into something that is as readable as the method name
   * itself and more succinct than it is
   *
   * @param numbers
   *          potentially unordered, non-unique set of numbers
   */
  public static int findDoubleOfFirstPrimeNumberGreaterThan5(List<Integer> numbers)
  {
    int result = 0;
    for (final Integer number : numbers)
    {
      // first check if prime
      if (isPrime(number))
      {
        if (number > 5)
        {
          result = number * 2;
        }
      }
    }

    return result;
  }

  public static void main(String[] args)
  {
    System.out.println(findDoubleOfFirstPrimeNumberGreaterThan5(
        Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11)));
  }
}

Add parenthesis around lambda arg

Add parenthesis around lambda arg


package seedu.taskitty.model.task;

import seedu.taskitty.commons.exceptions.IllegalValueException;

/**
 * Represents a Task's name in the task manager.
 * Guarantees: immutable; is valid as declared in {@link #isValidName(String)}
 */
public class Name {

    public static final String MESSAGE_NAME_CONSTRAINTS = "Task names should be spaces or alphanumeric characters";
    public static final String NAME_VALIDATION_REGEX_FORMAT = "[\\p{Alnum} ]+";

    public final String fullName;

    /**
     * Validates given name.
     *
     * @throws IllegalValueException if given name string is invalid.
     */
    public Name(String name) throws IllegalValueException {
        assert name != null;
        String trimName = name.trim();
        if (!isValidName(trimName)) {
            throw new IllegalValueException(MESSAGE_NAME_CONSTRAINTS);
        }
        this.fullName = trimName;
    }

    /**
     * Returns true if a given string is a valid person name.
     */
    public static boolean isValidName(String test) {
        return test.matches(NAME_VALIDATION_REGEX_FORMAT);
    }

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

    @Override
    public boolean equals(Object other) {
        return other == this // short circuit if same object
                || (other instanceof Name // instanceof handles nulls
                && this.fullName.equals(((Name) other).fullName)); // state check
    }

    @Override
    public int hashCode() {
        return fullName.hashCode();
    }

}

package seedu.taskitty.model.task;

import seedu.taskitty.commons.exceptions.IllegalValueException;

/**
 * Represents a Task's name in the task manager.
 * Guarantees: immutable; is valid as declared in {@link #isValidName(String)}
 */
public class Name {

    public static final String MESSAGE_NAME_CONSTRAINTS =
            "Task names should be alphabets, numbers, spaces and common punctuations, Meow!";
    public static final String NAME_VALIDATION_REGEX_FORMAT = "[\\p{Alnum}!@$%&(),.? ]+";

    public final String fullName;

    /**
     * Validates given name.
     *
     * @throws IllegalValueException if given name string is invalid.
     */
    public Name(String name) throws IllegalValueException {
        assert name != null;
        String trimName = name.trim();
        if (!isValidName(trimName)) {
            throw new IllegalValueException(MESSAGE_NAME_CONSTRAINTS);
        }
        this.fullName = trimName;
    }

    /**
     * Returns true if a given string is a valid person name.
     */
    public static boolean isValidName(String test) {
        return test.matches(NAME_VALIDATION_REGEX_FORMAT);
    }

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

    @Override
    public boolean equals(Object other) {
        return other == this // short circuit if same object
                || (other instanceof Name // instanceof handles nulls
                && this.fullName.equals(((Name) other).fullName)); // state check
    }

    @Override
    public int hashCode() {
        return fullName.hashCode();
    }

}

Improve task name by allowing wider input range


package com.samovich.cop2800.chapter15.assignmnet;

import javax.swing.*;
import java.awt.*;

/**
 * Contain the code for the interface and event handling
 * Filename SimpleTextEditorGUI
 * Created by Valery Samovich
 * Written on 7/27/16
 */
public class SimpleTextEditorGUI  extends JFrame {
    private JMenuBar mnuBar = new JMenuBar();
    private JMenu mnuFile = new JMenu("Edit");
    private JMenu mnuHelp = new JMenu("Help");

    public SimpleTextEditorGUI() {
        setLayout(new BorderLayout());
        setSize(360, 210);
        setJMenuBar(mnuBar);
        mnuBar.add(mnuFile);
        mnuBar.add(mnuHelp);
    }
}

package com.samovich.cop2800.chapter15.assignmnet;

import javax.swing.*;
import java.awt.*;
import java.awt.event.KeyEvent;

/**
 * Contain the code for the interface and event handling
 * Filename SimpleTextEditorGUI
 * Created by Valery Samovich
 * Written on 7/27/16
 */
public class SimpleTextEditorGUI  extends JFrame {
    private JMenuBar mnuBar = new JMenuBar();
    private JMenu mnuFile = new JMenu("Edit");
    private JMenu mnuHelp = new JMenu("Help");
    JPanel plnContent = new JPanel();
    JTextArea txtArea = new JTextArea(200, 100);
    JLabel lblFontSize = new JLabel("Font Size");
    JTextField txtSetSize = new JTextField();

    /**
     * Constructor
     */
    public SimpleTextEditorGUI() {
        setSize(360, 210);
        setLayout(new BorderLayout());
        setJMenuBar(mnuBar);
        txtArea.setLineWrap(true);
        txtArea.setWrapStyleWord(true);
        // add constants from keyboard
        mnuFile.setMnemonic(KeyEvent.VK_F);
        mnuHelp.setMnemonic(KeyEvent.VK_H);
        // add menu
        mnuBar.add(mnuFile);
        mnuBar.add(mnuHelp);
        // text area
        plnContent.setLayout(new BorderLayout());
        plnContent.add(txtArea, BorderLayout.EAST);
        plnContent.add(lblFontSize);
        plnContent.add(txtSetSize);
        setContentPane(plnContent);
    }
}

Add text filed: NOT COMPLETED

Add text filed: NOT COMPLETED


package net.vergien.beanautoutils.annotation;

/**
 *  Used as long java8 and java9/10/.. is on the market
 */
public @interface Generated {

  /**
   * The value element MUST have the name of the code generator. The
   * name is the fully qualified name of the code generator.
   *
   * @return The name of the code generator
   */
  String[] value();

  /**
   * Date when the source was generated. The date element must follow the ISO
   * 8601 standard. For example the date element would have the following
   * value 2017-07-04T12:08:56.235-0700 which represents 2017-07-04 12:08:56
   * local time in the U.S. Pacific Time time zone.
   *
   * @return The date the source was generated
   */
  String date() default "";

  /**
   * A place holder for any comments that the code generator may want to
   * include in the generated code.
   *
   * @return Comments that the code generated included
   */
  String comments() default "";
}

package net.vergien.beanautoutils.annotation;

import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.SOURCE;

import java.lang.annotation.Retention;
import java.lang.annotation.Target;
/**
 * Used as long java8 and java9/10/.. is on the market
 */
@Retention(SOURCE)
@Target(TYPE)
public @interface Generated
{

   /**
    * The value element MUST have the name of the code generator. The name is
    * the fully qualified name of the code generator.
    *
    * @return The name of the code generator
    */
   String[] value();

   /**
    * Date when the source was generated. The date element must follow the ISO
    * 8601 standard. For example the date element would have the following value
    * 2017-07-04T12:08:56.235-0700 which represents 2017-07-04 12:08:56 local
    * time in the U.S. Pacific Time time zone.
    *
    * @return The date the source was generated
    */
   String date() default "";

   /**
    * A place holder for any comments that the code generator may want to
    * include in the generated code.
    *
    * @return Comments that the code generated included
    */
   String comments() default "";
}

Make custom generated anotation only availabe at source


package com.containersol.minimesos.main;

import com.containersol.minimesos.MinimesosException;

public interface Command {

    /**
     * Validates combination of command parameters
     *
     * @return true if command parameters are valid
     */
    boolean validateParameters();

    /**
     * @return name of the command
     */
    String getName();

    /**
     * Executes the command
     */
    void execute() throws MinimesosException;

}

package com.containersol.minimesos.main;

public interface Command {

    /**
     * Validates combination of command parameters
     *
     * @return true if command parameters are valid
     */
    boolean validateParameters();

    /**
     * @return name of the command
     */
    String getName();

    /**
     * Executes the command
     */
    void execute();

}

Remove declaration of unchecked exception throwing


package org.metaborg.util.iterators;

import java.util.Iterator;
import java.util.NoSuchElementException;
import java.util.Queue;

import com.google.common.collect.Queues;

public class CompoundIterator<T> implements Iterator<T> {
    private final Queue<? extends Iterator<T>> iterators;

    public CompoundIterator(Iterable<? extends Iterator<T>> iterators) {
        this.iterators = Queues.newArrayDeque(iterators);
    }

    @Override public boolean hasNext() {
        final Iterator<T> iterator = iterators.peek();
        if(iterator == null) {
            return false;
        }
        return iterator.hasNext();
    }

    @Override public T next() {
        final Iterator<T> iterator = iterators.peek();
        if(iterator == null) {
            throw new NoSuchElementException();
        }

        if(iterator.hasNext()) {
            return iterator.next();
        } else {
            iterators.poll();
            return next();
        }
    }

    @Override public void remove() {
        throw new UnsupportedOperationException();
    }
}

package org.metaborg.util.iterators;

import java.util.Iterator;
import java.util.NoSuchElementException;

import com.google.common.collect.Iterators;

public class CompoundIterator<T> implements Iterator<T> {
    private final Iterator<? extends Iterator<T>> iterators;
    private Iterator<T> iterator = Iterators.emptyIterator();

    public CompoundIterator(Iterable<? extends Iterator<T>> iterators) {
        this.iterators = iterators.iterator();
    }

    @Override public boolean hasNext() {
        if(iterator.hasNext()) {
            return true;
        }
        try {
            iterator = iterators.next();
        } catch(NoSuchElementException ex) {
            return false;
        }
        return hasNext();
    }

    @Override public T next() {
        try {
            return iterator.next();
        } catch(NoSuchElementException ex) {
            iterator = iterators.next();
        }
        return next();
    }

    @Override public void remove() {
        throw new UnsupportedOperationException();
    }
}

Fix compound iterator for case where empty iterators appear in the list.


package org.pdxfinder.graph.dao;

import org.neo4j.ogm.annotation.GraphId;
import org.neo4j.ogm.annotation.NodeEntity;
import org.neo4j.ogm.annotation.Relationship;

import java.util.Set;

/**
 * Created by jmason on 21/07/2017.
 */
@NodeEntity
public class Platform {

    @GraphId
    private Long id;
    private String name;
    private String url;

    @Relationship(type = "GROUP", direction = Relationship.INCOMING)
    private Group group;

    @Relationship(type = "ASSOCIATED_WITH")
    private Set<PlatformAssociation> platformAssociations;

    public Platform() {
    }

    public Platform(Set<PlatformAssociation> platformAssociations) {
        this.platformAssociations = platformAssociations;
    }

    public Set<PlatformAssociation> getPlatformAssociations() {
        return platformAssociations;
    }

    public void setPlatformAssociations(Set<PlatformAssociation> platformAssociations) {
        this.platformAssociations = platformAssociations;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getUrl() {
        return url;
    }

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

    public Group getGroup() {
        return group;
    }

    public void setGroup(Group group) {
        this.group = group;
    }
}

package org.pdxfinder.graph.dao;

import org.neo4j.ogm.annotation.GraphId;
import org.neo4j.ogm.annotation.NodeEntity;
import org.neo4j.ogm.annotation.Relationship;

import java.util.Set;

/**
 * Created by jmason on 21/07/2017.
 */
@NodeEntity
public class Platform {

    @GraphId
    private Long id;
    private String name;
    private String url;
    private String type;

    @Relationship(type = "GROUP", direction = Relationship.INCOMING)
    private Group group;

    @Relationship(type = "ASSOCIATED_WITH")
    private Set<PlatformAssociation> platformAssociations;

    public Platform() {
    }

    public Platform(Set<PlatformAssociation> platformAssociations) {
        this.platformAssociations = platformAssociations;
    }

    public Set<PlatformAssociation> getPlatformAssociations() {
        return platformAssociations;
    }

    public void setPlatformAssociations(Set<PlatformAssociation> platformAssociations) {
        this.platformAssociations = platformAssociations;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getUrl() {
        return url;
    }

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

    public Group getGroup() {
        return group;
    }

    public void setGroup(Group group) {
        this.group = group;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }
}

Add platform type to dao

Add platform type to dao


package com.fasterxml.jackson.dataformat.xml.misc;

import com.fasterxml.jackson.annotation.*;

import com.fasterxml.jackson.dataformat.xml.XmlMapper;
import com.fasterxml.jackson.dataformat.xml.XmlTestBase;

// test(s) for [dataformat-xml#111]
public class EmptyPolymorphicTest extends XmlTestBase
{
    static class Data {
        public String name;

        @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.WRAPPER_OBJECT)
        @JsonSubTypes({ @JsonSubTypes.Type(EmptyProxy.class) })
        public Proxy proxy;

        public Data() { }
        public Data(String n) {
            name = n;
            proxy = new EmptyProxy();
        }
    }

    static interface Proxy { }

    @JsonTypeName("empty")
    static class EmptyProxy implements Proxy { }

    /*
    /**********************************************************
    /* Test methods
    /**********************************************************
     */

    protected XmlMapper MAPPER = new XmlMapper();

    public void testEmpty() throws Exception
    {
        String xml = MAPPER.writerWithDefaultPrettyPrinter().writeValueAsString(new Data("Foobar"));
//System.out.println("XML:\n"+xml);
        final Data data = MAPPER.readValue(xml, Data.class);
//                "<data><name>Foobar</name><proxy><empty></empty></proxy></data>"
        assertNotNull(data);
    }
}

package com.fasterxml.jackson.dataformat.xml.misc;

import com.fasterxml.jackson.annotation.*;

import com.fasterxml.jackson.dataformat.xml.XmlMapper;
import com.fasterxml.jackson.dataformat.xml.XmlTestBase;

// test(s) for [dataformat-xml#169]
public class EmptyPolymorphicTest extends XmlTestBase
{
    static class Data {
        public String name;

        @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.WRAPPER_OBJECT)
        @JsonSubTypes({ @JsonSubTypes.Type(EmptyProxy.class) })
        public Proxy proxy;

        public Data() { }
        public Data(String n) {
            name = n;
            proxy = new EmptyProxy();
        }
    }

    static interface Proxy { }

    @JsonTypeName("empty")
    static class EmptyProxy implements Proxy { }

    /*
    /**********************************************************
    /* Test methods
    /**********************************************************
     */

    protected XmlMapper MAPPER = new XmlMapper();

    public void testEmpty() throws Exception
    {
        String xml = MAPPER.writerWithDefaultPrettyPrinter().writeValueAsString(new Data("Foobar"));
//System.out.println("XML:\n"+xml);
        final Data data = MAPPER.readValue(xml, Data.class);
//                "<data><name>Foobar</name><proxy><empty></empty></proxy></data>"
        assertNotNull(data);
    }
}

Fix incorrect issue ref in test

Fix incorrect issue ref in test


/**
 *
 */
package ca.eandb.sortable;

import java.util.LinkedList;
import java.util.List;

import ca.eandb.sortable.Product.Field;

/**
 * @author brad
 *
 */
public final class ProductTrieBuilder implements ProductVisitor {

	private final TrieNode root = new TrieNode();

	/*(non-Javadoc)
	 * @see ca.eandb.sortable.ProductVisitor#visit(ca.eandb.sortable.Product)
	 */
	@Override
	public void visit(Product product) {
		addProduct(product);
	}

	public void addProduct(Product product) {
		processField(product, Field.MANUFACTURER, product.getManufacturer());
		processField(product, Field.FAMILY, product.getFamily());
		processField(product, Field.MODEL, product.getModel());
	}

	private void processField(Product product, Field field, String value) {
		value = StringUtil.normalize(value);
		String[] words = value.split(" ");
		ProductMatch match = new ProductMatch(product, field);

		for (String word : words) {
			TrieNode node = root.insert(word);
			List<ProductMatch> products = (List<ProductMatch>) node.getData();

			if (products == null) {
				products = new LinkedList<ProductMatch>();
				node.setData(products);
			}

			products.add(match);
		}
	}

	public TrieNode getRoot() {
		return root;
	}

}

/**
 *
 */
package ca.eandb.sortable;

import java.util.LinkedList;
import java.util.List;

import ca.eandb.sortable.Product.Field;

/**
 * @author brad
 *
 */
public final class ProductTrieBuilder implements ProductVisitor {

	private final TrieNode root = new TrieNode();

	/*(non-Javadoc)
	 * @see ca.eandb.sortable.ProductVisitor#visit(ca.eandb.sortable.Product)
	 */
	@Override
	public void visit(Product product) {
		addProduct(product);
	}

	public void addProduct(Product product) {
		processField(product, Field.MANUFACTURER, product.getManufacturer());
		processField(product, Field.MODEL, product.getModel());
		if (product.getFamily() != null) {
			processField(product, Field.FAMILY, product.getFamily());
		}
	}

	private void processField(Product product, Field field, String value) {
		value = StringUtil.normalize(value);
		String[] words = value.split(" ");
		ProductMatch match = new ProductMatch(product, field);

		for (String word : words) {
			TrieNode node = root.insert(word);
			List<ProductMatch> products = (List<ProductMatch>) node.getData();

			if (products == null) {
				products = new LinkedList<ProductMatch>();
				node.setData(products);
			}

			products.add(match);
		}
	}

	public TrieNode getRoot() {
		return root;
	}

}

Check if the optional family field is null before attempting to insert.


package tv.rocketbeans.supermafiosi.graphics;

import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator;
import com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator.FreeTypeFontParameter;

import de.bitbrain.braingdx.assets.SharedAssetManager;

public class BitmapFontBaker {

	   public static BitmapFont bake(String fontPath, int fontSize) {
	      FreeTypeFontGenerator generator = SharedAssetManager.getInstance().get(fontPath, FreeTypeFontGenerator.class);
	      FreeTypeFontParameter parameter = new FreeTypeFontParameter();
	      parameter.size = fontSize;
	      parameter.mono = false;
	      parameter.color = Color.WHITE.cpy();
	      BitmapFont font = generator.generateFont(parameter);
	      return font;
	   }
	}

package tv.rocketbeans.supermafiosi.graphics;

import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator;
import com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator.FreeTypeFontParameter;

import de.bitbrain.braingdx.assets.SharedAssetManager;

public class BitmapFontBaker {

	   public static BitmapFont bake(String fontPath, int fontSize) {
	      FreeTypeFontGenerator generator = SharedAssetManager.getInstance().get(fontPath, FreeTypeFontGenerator.class);
	      FreeTypeFontParameter parameter = new FreeTypeFontParameter();
	      parameter.size = fontSize;
	      parameter.mono = true;
	      parameter.color = Color.WHITE.cpy();
	      BitmapFont font = generator.generateFont(parameter);
	      return font;
	   }
	}

Make font rendering mono (disable anti-aliasing to keep pixel looknfeel


package com.nkming.packageinfo;

import android.app.ActivityManager;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;

import com.nkming.utils.graphic.BitmapCache;

public class MainActivity extends ActionBarActivity
		implements SearchDialog.SearchDialogListener
{
	@Override
	protected void onCreate(Bundle savedInstanceState)
	{
		super.onCreate(savedInstanceState);

		int heapMb = ((ActivityManager)getSystemService(ACTIVITY_SERVICE))
				.getMemoryClass();
		BitmapCache.init(heapMb * 1024 * 1024 / 4);

		setContentView(R.layout.activity_main);
		if (savedInstanceState == null)
		{
			mFrag = new MainFragment();
			getSupportFragmentManager().beginTransaction()
					.add(R.id.container, mFrag)
					.commit();
		}
		getSupportActionBar().setElevation(getResources().getDimension(
				R.dimen.toolbar_z));
	}

	@Override
	public void onSearchRequest(AppFilter req)
	{
		mFrag.onSearchRequest(req);
	}

	private MainFragment mFrag;
}

package com.nkming.packageinfo;

import android.app.ActivityManager;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;

import com.nkming.utils.graphic.BitmapCache;

public class MainActivity extends ActionBarActivity
		implements SearchDialog.SearchDialogListener
{
	@Override
	protected void onCreate(Bundle savedInstanceState)
	{
		super.onCreate(savedInstanceState);

		int heapMb = ((ActivityManager)getSystemService(ACTIVITY_SERVICE))
				.getMemoryClass();
		BitmapCache.init(heapMb * 1024 * 1024 / 4);

		setContentView(R.layout.activity_main);
		if (savedInstanceState == null)
		{
			mFrag = new MainFragment();
			getSupportFragmentManager().beginTransaction()
					.add(R.id.container, mFrag)
					.commit();
		}
		else
		{
			mFrag = (MainFragment)getSupportFragmentManager().findFragmentById(
					R.id.container);
		}
		getSupportActionBar().setElevation(getResources().getDimension(
				R.dimen.toolbar_z));
	}

	@Override
	public void onSearchRequest(AppFilter req)
	{
		mFrag.onSearchRequest(req);
	}

	private MainFragment mFrag;
}

Fix fragment instance not correctly assigned


package seedu.address.commons.core;

/**
 * Container for user visible messages.
 */
public class Messages {

    public static final String MESSAGE_UNKNOWN_COMMAND = "Unknown command";
    public static final String MESSAGE_INVALID_COMMAND_FORMAT = "Invalid command format! \n%1$s";
    public static final String MESSAGE_INVALID_PERSON_DISPLAYED_INDEX = "The person index provided is invalid";
    public static final String MESSAGE_PERSONS_LISTED_OVERVIEW = "%1$d persons listed!";

}

package seedu.address.commons.core;

/**
 * Container for user visible messages.
 */
public class Messages {

    public static final String MESSAGE_UNKNOWN_COMMAND = "Unknown command";
    public static final String MESSAGE_INVALID_COMMAND_FORMAT = "Invalid command format! \n%1$s";
    public static final String MESSAGE_INVALID_PERSON_DISPLAYED_INDEX = "The activity index provided is invalid";
    public static final String MESSAGE_PERSONS_LISTED_OVERVIEW = "%1$d activities listed!";

}

Update messages to reflect activities

Update messages to reflect activities


package de.prob2.ui.helpsystem;

import com.google.inject.Inject;
import com.google.inject.Singleton;
import de.prob2.ui.internal.StageManager;
import javafx.fxml.FXML;
import javafx.scene.control.SplitPane;
import javafx.scene.control.TreeItem;
import javafx.scene.control.TreeView;
import javafx.scene.web.WebEngine;
import javafx.scene.web.WebView;

@Singleton
public class HelpSystem extends SplitPane {
    @FXML private TreeView<String> treeView;
    @FXML private WebView webView;
    WebEngine webEngine;

    @Inject
    public HelpSystem(final StageManager stageManager) {
        stageManager.loadFXML(this, "helpsystem.fxml");
        TreeItem<String> root = new TreeItem<>("Root Node");
        root.setExpanded(true);
        root.getChildren().addAll(
                new TreeItem<>("Item 1"),
                new TreeItem<>("Item 2"),
                new TreeItem<>("Item 3")
        );
        treeView.setRoot(root);
        //treeView.setMaxWidth(0);
        webEngine = webView.getEngine();
        webEngine.load("https://www3.hhu.de/stups/prob/index.php/Main_Page");
    }
}

package de.prob2.ui.helpsystem;

import com.google.inject.Inject;
import com.google.inject.Singleton;

import de.prob2.ui.internal.StageManager;

import javafx.fxml.FXML;
import javafx.scene.control.TreeItem;
import javafx.scene.control.TreeView;
import javafx.scene.layout.StackPane;
import javafx.scene.web.WebEngine;
import javafx.scene.web.WebView;

@Singleton
public class HelpSystem extends StackPane {
    @FXML private TreeView<String> treeView;
    @FXML private WebView webView;
    WebEngine webEngine;

    @Inject
    public HelpSystem(final StageManager stageManager) {
        stageManager.loadFXML(this, "helpsystem.fxml");
        TreeItem<String> root = new TreeItem<>("Root Node");
        root.setExpanded(true);
        root.getChildren().addAll(
                new TreeItem<>("Item 1"),
                new TreeItem<>("Item 2"),
                new TreeItem<>("Item 3")
        );
        treeView.setRoot(root);
        //treeView.setMaxWidth(0);
        webEngine = webView.getEngine();
        webEngine.load("https://www3.hhu.de/stups/prob/index.php/Main_Page");
    }
}

Fix Mac menu bar in help system window

Fix Mac menu bar in help system window


package fi.tekislauta.webserver;

import com.google.gson.Gson;
import fi.tekislauta.db.Database;
import fi.tekislauta.models.Board;
import fi.tekislauta.models.Post;
import fi.tekislauta.models.Resolvable;

import static spark.Spark.*;

import static spark.Spark.get;

public class Webserver {

    private final int port;
    private final Gson gson;
    private final Database db;

    public Webserver(int port) {
        this.port = port;
        this.gson = new Gson();
        this.db = new Database();
    }

    public void listen() {
        port(this.port);

        // spark starts listening when first method listener is added, I think ~cx
        get("/api/boards/:abbreviation", (req, res) -> {
            res.header("Content-Type","application/json");
            Board b = new Board();
            db.resolve(b, req.params("abbreviation"));
            return gson.toJson(b);
        });
    }
}

package fi.tekislauta.webserver;

import com.google.gson.Gson;
import fi.tekislauta.db.Database;
import fi.tekislauta.models.Board;
import fi.tekislauta.models.Post;
import fi.tekislauta.models.Resolvable;

import static spark.Spark.*;

import static spark.Spark.get;

public class Webserver {

    private final int port;
    private final Gson gson;
    private final Database db;

    public Webserver(int port) {
        this.port = port;
        this.gson = new Gson();
        this.db = new Database();
    }

    public void listen() {
        port(this.port);

        // spark starts listening when first method listener is added, I think ~cx
        get("/api/boards/:abbreviation", (req, res) -> {
            res.header("Content-Type","application/json; charset=utf-8");
            Board b = new Board();
            db.resolve(b, req.params("abbreviation"));
            return gson.toJson(b);
        });
    }
}

Add accidentally removed charset header

Add accidentally removed charset header


package seedu.ezdo.logic.parser;

import java.util.regex.Pattern;

import seedu.ezdo.logic.parser.ArgumentTokenizer.Prefix;

/**
 * Contains Command Line Interface (CLI) syntax definitions common to multiple commands
 */
public class CliSyntax {

    /* Prefix definitions */
    public static final Prefix PREFIX_PRIORITY = new Prefix("p/");
    public static final Prefix PREFIX_STARTDATE = new Prefix("s/");
    public static final Prefix PREFIX_DUEDATE = new Prefix("d/");
    public static final Prefix PREFIX_TAG = new Prefix("t/");

    /* Patterns definitions */
    public static final Pattern KEYWORDS_ARGS_FORMAT =
            Pattern.compile("(?<keywords>\\S+(?:\\s+\\S+)*)"); // one or more keywords separated by whitespace

}

package seedu.ezdo.logic.parser;

import java.util.regex.Pattern;

import seedu.ezdo.logic.parser.ArgumentTokenizer.Prefix;

/**
 * Contains Command Line Interface (CLI) syntax definitions common to multiple commands
 */
public class CliSyntax {

    /* Prefix definitions */
    public static final Prefix PREFIX_PRIORITY = new Prefix("p/");
    public static final Prefix PREFIX_STARTDATE = new Prefix("s/");
    public static final Prefix PREFIX_DUEDATE = new Prefix("d/");
    public static final Prefix PREFIX_TAG = new Prefix("t/");
    public static final Prefix PREFIX_MONTH = new Prefix("month/");
    public static final Prefix PREFIX_YEAR = new Prefix("year/");
    public static final Prefix PREFIX_DAY = new Prefix("day/");

    /* Patterns definitions */
    public static final Pattern KEYWORDS_ARGS_FORMAT =
            Pattern.compile("(?<keywords>\\S+(?:\\s+\\S+)*)"); // one or more keywords separated by whitespace

}

Add new prefix options for future opportunities to improve functionalities


package org.freecompany.redline;

import java.io.File;
import org.junit.Test;

public class ScannerTest extends TestBase
{

    @Test
    public void scanNoArchRPMTest() throws Exception {
        Scanner.main ( new String[]{ getTestResourcesDirectory ( ) + File.separator + "rpm-1-1.0-1.noarch.rpm" } );
    }

    @Test
    public void scanSomeArchTest() throws Exception {
        Scanner.main ( new String[]{ getTestResourcesDirectory ( ) + File.separator + "rpm-3-1.0-1.somearch.rpm" } );
    }
}

package org.freecompany.redline;

import java.io.File;
import org.junit.Test;

public class ScannerTest extends TestBase
{

    @Test
    public void scanNoArchRPMTest() throws Exception {
        Scanner.main ( new String[]{ getTestResourcesDirectory ( ) + File.separator + "rpm-1-1.0-1.noarch.rpm" } );
    }

    @Test(expected = ArrayIndexOutOfBoundsException.class)
    public void scanSomeArchTest() throws Exception {
        Scanner.main ( new String[]{ getTestResourcesDirectory ( ) + File.separator + "rpm-3-1.0-1.somearch.rpm" } );
    }
}

Fix for failing test case.

Fix for failing test case.


package seedu.gtd.commons.core;

import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;

import seedu.gtd.commons.core.Config;

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

public class ConfigTest {
    @Rule
    public ExpectedException thrown = ExpectedException.none();

    @Test
    public void toString_defaultObject_stringReturned() {
        String defaultConfigAsString = "App title : TaryTest\n" +
                "Current log level : INFO\n" +
                "Preference file Location : preferences.json\n" +
                "Local data file location : data/tasklist.xml\n" +
                "Task List name : MyTaskList";

        assertEquals(defaultConfigAsString, new Config().toString());
    }

    @Test
    public void equalsMethod(){
        Config defaultConfig = new Config();
        assertFalse(defaultConfig.equals(null));
        assertTrue(defaultConfig.equals(defaultConfig));
    }

}

package seedu.gtd.commons.core;

import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;

import seedu.gtd.commons.core.Config;

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

public class ConfigTest {
    @Rule
    public ExpectedException thrown = ExpectedException.none();

    @Test
    public void toString_defaultObject_stringReturned() {
        String defaultConfigAsString = "App title : Tary\n" +
                "Current log level : INFO\n" +
                "Preference file Location : preferences.json\n" +
                "Local data file location : data/tasklist.xml\n" +
                "Task List name : MyTaskList";

        assertEquals(defaultConfigAsString, new Config().toString());
    }

    @Test
    public void equalsMethod(){
        Config defaultConfig = new Config();
        assertFalse(defaultConfig.equals(null));
        assertTrue(defaultConfig.equals(defaultConfig));
    }

}

Make test config consistent with original config


package com.stewesho.wator;

import com.badlogic.gdx.ApplicationAdapter;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.OrthographicCamera;

public class Main extends ApplicationAdapter {
	SpriteBatch batch;
	OrthographicCamera cam;
	WorldManager world;

	@Override
	public void create () {
		batch = new SpriteBatch();
		cam = new OrthographicCamera(50, 50);
		world = new WorldManager(25, 25);
	}

	@Override
	public void render () {
		Gdx.gl.glClearColor(0.250f, 0.250f, 0.300f, 1.000f);
		Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

		batch.setProjectionMatrix(cam.combined);
		batch.begin();

		batch.draw(world.run(), -world.getMap.getWidth()/2, -world.getMap.getHeight()/2);

		batch.end();
	}

	@Override
	public void dispose () {
		batch.dispose();
		// map.disposeResources();
	}
}

package com.stewesho.wator;

import com.badlogic.gdx.ApplicationAdapter;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.OrthographicCamera;

public class Main extends ApplicationAdapter {
	SpriteBatch batch;
	OrthographicCamera cam;

	@Override
	public void create () {
		batch = new SpriteBatch();
		cam = new OrthographicCamera(50, 50);
	}

	@Override
	public void render () {
		Gdx.gl.glClearColor(0.250f, 0.250f, 0.300f, 1.000f);
		Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

		batch.setProjectionMatrix(cam.combined);
		batch.begin();

		// batch.draw(map.render(), -map.getWidth()/2, -map.getHeight()/2);

		batch.end();
	}

	@Override
	public void dispose () {
		batch.dispose();
		// map.disposeResources();
	}
}

Revert "added entity lists(libgdx arrays) for fishes and sharks"

This reverts commit 80c76c829d63f67faa83ef7c2aaa8a601ce461ef.


package com.catpeds;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

/**
 * Main class for the standalone Spring Boot application execution.
 *
 * @author padriano
 *
 */
@SpringBootApplication
public class Application {

	public static void main(String[] args) {
		SpringApplication.run(Application.class, args);
	}

}

package com.catpeds;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

/**
 * Main class for the standalone Spring Boot application execution.
 *
 * @author padriano
 *
 */
@SpringBootApplication
public class Application {

	private Application() { }

	public static void main(String[] args) {
		SpringApplication.run(Application.class, args);
	}

}

Fix code smell for non instantiation

Fix code smell for non instantiation


/*
 * This file is part of Relaxe.
 * Copyright (c) 2014 Topi Nieminen
 * Author: Topi Nieminen <topi.nieminen@gmail.com>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License version 3
 * as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 * or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU Affero General Public License for more details.
 * You should have received a copy of the GNU Affero General Public License
 * along with this program; if not, see http://www.gnu.org/licenses or write to
 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA, 02110-1301 USA.
 *
 * The interactive user interfaces in modified source and object code versions
 * of this program must display Appropriate Legal Notices, as required under
 * Section 5 of the GNU Affero General Public License.
 */
package com.appspot.relaxe.ent;

import com.appspot.relaxe.ent.value.Attribute;
import com.appspot.relaxe.types.AbstractType;

public interface HasAttribute<
	V extends AbstractType<V>,
	K extends Attribute<E, V, K>,
	E extends HasAttribute<V, K, E>
> {

}

/*
 * This file is part of Relaxe.
 * Copyright (c) 2014 Topi Nieminen
 * Author: Topi Nieminen <topi.nieminen@gmail.com>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License version 3
 * as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 * or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU Affero General Public License for more details.
 * You should have received a copy of the GNU Affero General Public License
 * along with this program; if not, see http://www.gnu.org/licenses or write to
 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA, 02110-1301 USA.
 *
 * The interactive user interfaces in modified source and object code versions
 * of this program must display Appropriate Legal Notices, as required under
 * Section 5 of the GNU Affero General Public License.
 */
package com.appspot.relaxe.ent;

import com.appspot.relaxe.ent.value.Attribute;
import com.appspot.relaxe.types.Type;

public interface HasAttribute<
	V extends Type<V>,
	K extends Attribute<E, V, K>,
	E extends HasAttribute<V, K, E>
> {

}

Use interface type instead of abstract class


//
// $Id: Cluster.java,v 1.5 2003/03/26 23:42:41 mdb Exp $

package com.threerings.whirled.spot.data;

import java.awt.Rectangle;

import com.threerings.io.SimpleStreamableObject;
import com.threerings.presents.dobj.DSet;

/**
 * Contains information on clusters.
 */
public class Cluster extends SimpleStreamableObject
    implements DSet.Entry
{
    /** A unique identifier for this cluster (also the distributed object
     * id of the cluster chat object). */
    public int clusterOid;

    /** The bounds of the cluster in the scene. */
    public int x, y, width, height;

    /**
     * Returns the "footprint" of this cluster in tile coordinates.
     */
    public Rectangle getFootprint ()
    {
        return new Rectangle(x, y, width, height);
    }

    // documentation inherited
    public Comparable getKey ()
    {
        if (_key == null) {
            _key = new Integer(clusterOid);
        }
        return _key;
    }

    // documentation inherited
    public boolean equals (Object other)
    {
        if (other instanceof Cluster) {
            return ((Cluster)other).clusterOid == clusterOid;
        } else {
            return false;
        }
    }

    // documentation inherited
    public int hashCode ()
    {
        return clusterOid;
    }

    /** Used for {@link #geyKey}. */
    protected transient Integer _key;
}

//
// $Id: Cluster.java,v 1.6 2003/03/27 15:57:47 mdb Exp $

package com.threerings.whirled.spot.data;

import java.awt.Rectangle;

import com.samskivert.util.StringUtil;

import com.threerings.io.SimpleStreamableObject;
import com.threerings.io.Streamable;

import com.threerings.presents.dobj.DSet;

/**
 * Contains information on clusters.
 */
public class Cluster extends Rectangle
    implements DSet.Entry, Streamable
{
    /** A unique identifier for this cluster (also the distributed object
     * id of the cluster chat object). */
    public int clusterOid;

    // documentation inherited
    public Comparable getKey ()
    {
        if (_key == null) {
            _key = new Integer(clusterOid);
        }
        return _key;
    }

    // documentation inherited
    public boolean equals (Object other)
    {
        if (other instanceof Cluster) {
            return ((Cluster)other).clusterOid == clusterOid;
        } else {
            return false;
        }
    }

    // documentation inherited
    public int hashCode ()
    {
        return clusterOid;
    }

    /**
     * Generates a string representation of this instance.
     */
    public String toString ()
    {
        return StringUtil.fieldsToString(this);
    }

    /** Used for {@link #geyKey}. */
    protected transient Integer _key;
}

Make cluster extend Rectangle so that we get all of its lovely methods.

git-svn-id: a1a4b28b82a3276cc491891159dd9963a0a72fae@2337 542714f4-19e9-0310-aa3c-eee0fc999fb1


package net.trajano.ms.engine.sample;

import io.vertx.core.Vertx;
import io.vertx.core.VertxOptions;
import io.vertx.core.http.HttpServer;
import io.vertx.ext.web.Router;
import net.trajano.ms.engine.JaxRsRoute;

public class Main {

    public static void main(final String[] args) {

        final VertxOptions options = new VertxOptions();
        Vertx.clusteredVertx(options, event -> {
            final Vertx vertx = event.result();

            final Router router = Router.router(vertx);
            final HttpServer http = vertx.createHttpServer();

            JaxRsRoute.route(vertx, router, MyApp.class);
            http.requestHandler(req -> router.accept(req)).listen(8280);
        });

        //final Vertx vertx = Vertx.vertx();

    }
}

package net.trajano.ms.engine.sample;

import io.vertx.core.AbstractVerticle;
import io.vertx.core.Vertx;
import io.vertx.core.VertxOptions;
import io.vertx.core.http.HttpServer;
import io.vertx.ext.web.Router;
import net.trajano.ms.engine.JaxRsRoute;

public class Main extends AbstractVerticle {

    public static void main(final String[] args) {

        final VertxOptions options = new VertxOptions();
        Vertx.clusteredVertx(options, event -> {
            final Vertx vertx = event.result();
            vertx.deployVerticle(new Main());

        });

        //final Vertx vertx = Vertx.vertx();

    }

    @Override
    public void start() throws Exception {

        final Router router = Router.router(vertx);
        final HttpServer http = vertx.createHttpServer();

        JaxRsRoute.route(vertx, router, MyApp.class);
        http.requestHandler(req -> router.accept(req)).listen(8280);
    }
}

Convert main to a verticle

Convert main to a verticle


package guitests;

import static org.junit.Assert.assertTrue;

import org.junit.Test;

import seedu.ezdo.commons.core.Messages;
import seedu.ezdo.testutil.TestTask;

public class FindCommandTest extends EzDoGuiTest {

    @Test
    public void find_nonEmptyList() {
        assertFindResult("find Mark"); // no results
        assertFindResult("find Meier", td.benson, td.daniel); // multiple results

        //find after deleting one result
        commandBox.runCommand("kill 1");
        assertFindResult("find Meier", td.daniel);
    }

    @Test
    public void find_emptyList() {
        commandBox.runCommand("clear");
        assertFindResult("find Jean"); // no results
    }

    @Test
    public void find_invalidCommand_fail() {
        commandBox.runCommand("findgeorge");
        assertResultMessage(Messages.MESSAGE_UNKNOWN_COMMAND);
    }

    private void assertFindResult(String command, TestTask... expectedHits) {
        commandBox.runCommand(command);
        assertListSize(expectedHits.length);
        assertResultMessage(expectedHits.length + " tasks listed!");
        assertTrue(taskListPanel.isListMatching(expectedHits));
    }
}

package guitests;

import static org.junit.Assert.assertTrue;

import org.junit.Test;

import seedu.ezdo.commons.core.Messages;
import seedu.ezdo.testutil.TestTask;

public class FindCommandTest extends EzDoGuiTest {

    @Test
    public void find_nonEmptyList() {
        assertFindResult("find Mark"); // no results
        assertFindResult("find Meier", td.benson, td.daniel); // multiple results

        //find after deleting one result
        commandBox.runCommand("kill 1");
        assertFindResult("find Meier", td.daniel);
    }

    @Test
    public void find_shortCommand() {
        assertFindResult("f Mark"); // no results
        assertFindResult("f Meier", td.benson, td.daniel); // multiple results

        //find after deleting one result
        commandBox.runCommand("kill 1");
        assertFindResult("f Meier", td.daniel);
    }

    @Test
    public void find_emptyList() {
        commandBox.runCommand("clear");
        assertFindResult("find Jean"); // no results
    }

    @Test
    public void find_invalidCommand_fail() {
        commandBox.runCommand("findgeorge");
        assertResultMessage(Messages.MESSAGE_UNKNOWN_COMMAND);
    }

    private void assertFindResult(String command, TestTask... expectedHits) {
        commandBox.runCommand(command);
        assertListSize(expectedHits.length);
        assertResultMessage(expectedHits.length + " tasks listed!");
        assertTrue(taskListPanel.isListMatching(expectedHits));
    }
}

Add test for shortened find command

Add test for shortened find command


/*
 * The MIT License (MIT)
 *
 * Copyright (c) 2015 CrystalCraftMC
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the
 * "Software"), to deal in the Software without restriction, including
 * without limitation the rights to use, copy, modify, merge, publish,
 * distribute, sublicense, and/or sell copies of the Software, and to
 * permit persons to whom the Software is furnished to do so, subject to
 * the following conditions:
 *
 * The above copyright notice and this permission notice shall be included
 * in all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */

package com.crystalcraftmc.pvpstorm;

import org.bukkit.command.CommandExecutor;
import org.bukkit.event.Listener;

public class GameEndListener implements Listener, CommandExecutor {
    PvPStorm plugin;

    public GameEndListener(PvPStorm plugin) {
        this.plugin = plugin;
    }
}

/*
 * The MIT License (MIT)
 *
 * Copyright (c) 2015 CrystalCraftMC
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the
 * "Software"), to deal in the Software without restriction, including
 * without limitation the rights to use, copy, modify, merge, publish,
 * distribute, sublicense, and/or sell copies of the Software, and to
 * permit persons to whom the Software is furnished to do so, subject to
 * the following conditions:
 *
 * The above copyright notice and this permission notice shall be included
 * in all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */

package com.crystalcraftmc.pvpstorm;

import org.bukkit.command.CommandExecutor;
import org.bukkit.event.Listener;

public class GameEndListener implements Listener, CommandExecutor {
    // TODO Finish and test GameStartListener before working on this.

    PvPStorm plugin;

    public GameEndListener(PvPStorm plugin) {
        this.plugin = plugin;
    }
}

Mark for completion after GameStartListener


package org.embulk.parser.apache.log;

import org.embulk.spi.PageBuilder;
import org.embulk.spi.time.Timestamp;
import org.embulk.spi.time.TimestampParser;

import static org.embulk.spi.type.Types.TIMESTAMP;

public class TimestampLogElement extends LogElement<Timestamp> {

    private final TimestampParser parser;

    public TimestampLogElement(TimestampParser.Task task, String name, String regex) {
        this(task, name, regex, "%d/%b/%Y:%T %z");
    }

    public TimestampLogElement(TimestampParser.Task task, String name, String regex, String pattern) {
        super(name, regex, TIMESTAMP);
        this.parser = new TimestampParser(task.getJRuby(), pattern, task.getDefaultTimeZone());
    }

    @Override
    public Timestamp parse(String s) {
        try{
            return parser.parse(s);
        }catch (Exception e){
            return null;
        }
    }

    @Override
    public void setToPageBuilder(PageBuilder pageBuilder, int i, String value) {
        Timestamp parse = parse(value);
        if(parse != null){
            pageBuilder.setTimestamp(i, parse);
        }else{
            pageBuilder.setNull(i);
        }
    }
}

package org.embulk.parser.apache.log;

import org.embulk.config.ConfigSource;
import org.embulk.config.Task;
import org.embulk.spi.Exec;
import org.embulk.spi.PageBuilder;
import org.embulk.spi.time.Timestamp;
import org.embulk.spi.time.TimestampParser;

import static org.embulk.spi.type.Types.TIMESTAMP;

public class TimestampLogElement extends LogElement<Timestamp> {

    private final TimestampParser parser;

    public TimestampLogElement(TimestampParser.Task task, String name, String regex) {
        this(task, name, regex, "%d/%b/%Y:%T %z");
    }

    private static interface ParserIntlTask extends Task, TimestampParser.Task {}
    private static interface ParserIntlColumnOption extends Task, TimestampParser.TimestampColumnOption {}

    public TimestampLogElement(TimestampParser.Task task, String name, String regex, String pattern) {
        super(name, regex, TIMESTAMP);
        // TODO: Switch to a newer TimestampParser constructor after a reasonable interval.
        // Traditional constructor is used here for compatibility.
        final ConfigSource configSource = Exec.newConfigSource();
        configSource.set("format", pattern);
        configSource.set("timezone", task.getDefaultTimeZone());
        this.parser = new TimestampParser(
            Exec.newConfigSource().loadConfig(ParserIntlTask.class),
            configSource.loadConfig(ParserIntlColumnOption.class));
    }

    @Override
    public Timestamp parse(String s) {
        try{
            return parser.parse(s);
        }catch (Exception e){
            return null;
        }
    }

    @Override
    public void setToPageBuilder(PageBuilder pageBuilder, int i, String value) {
        Timestamp parse = parse(value);
        if(parse != null){
            pageBuilder.setTimestamp(i, parse);
        }else{
            pageBuilder.setNull(i);
        }
    }
}

Use traditional constructors of TimestampParser against Embulk core deprecation

Some constructors of them have been deprecated on the Embulk core side.
See https://github.com/embulk/embulk/issues/745 for the details.


/*
 * Copyright (C) 2011 Archie L. Cobbs. All rights reserved.
 *
 * $Id$
 */

/**
 * Classes supporting automated database schema management.
 *
 * <p>
 * The central classes are {@link org.dellroad.stuff.schema.SchemaUpdater} and
 * {@link org.dellroad.stuff.schema.SpringSchemaUpdater}.
 */
package org.dellroad.stuff.schema;

/*
 * Copyright (C) 2011 Archie L. Cobbs. All rights reserved.
 *
 * $Id$
 */

/**
 * Classes supporting automated database schema management.
 *
 *

 * Features include:
 *

 *
Automatic initialization of the database schema when the application runs for the first time

 *
Automatic application of database schema updates as needed during each application startup cycle

 *
Automated tracking and constraint-based ordering of schema updates supporting multiple code branches

 *
Integration with Spring allowing simple XML declaration of updates

 *
An ant task that verifies schema update correctness

 *

 *

 *
 *

 * See {@link org.dellroad.stuff.schema.SpringSchemaUpdater} for an example of how to declare your
 * {@link javax.sql.DataSource DataSource} and associated schema updates in a Spring application context.
 *

 *
 *

 * Updates may have ordering constraints, and these should be declared explicitly. Once you have done so, then
 * you may safely "cherry pick" individual schema updates for merging into different code branches without worrying
 * whether the schema will get messed up, because any ordering constraint violations will be detected automatically.
 * This verification step is required to detect inconsistencies between the updates and the current code.
 *

 *
 *

 * See DellRoad Stuff's ant macros for the {@code schemacheck}
 * ant macro that can be used to verify that your delcared schema updates, when applied to the original schema,
 * yield the expected result (which is typically generated automatically by your schema generation tool from
 * your current code). It is also a good idea to compare your generated shema matches to an expected result
 * during each build to detect schema changes caused by e.g., inadvertent changes to model classes.
 *

 *
 *

 * The central classes are {@link org.dellroad.stuff.schema.SchemaUpdater} and
 * {@link org.dellroad.stuff.schema.SpringSchemaUpdater}.
 *

 */
package org.dellroad.stuff.schema;

Add some Javadoc describing how schema updates work.