// Copyright 2014, Kevin Ko <kevin@faveset.com>

package com.faveset.khttpserver;

import java.io.IOException;
import sun.misc.Signal;
import sun.misc.SignalHandler;

import com.faveset.log.OutputStreamLog;

public class HttpServer {
    public static void main(String[] args) throws IOException {
        if (args.length < 1) {
            System.out.println("<port>");
            return;
        }

        int port = new Integer(args[0]);

        OutputStreamLog log = new OutputStreamLog(System.out);

        final com.faveset.khttp.HttpServer server = new com.faveset.khttp.HttpServer();
        server.setLog(log);

        // Set up the signal handler.
        Signal.handle(new Signal("INT"), new SignalHandler() {
            @Override
            public void handle(Signal sig) {
                server.stop();
            }
        });
        server.listenAndServe("::", port);

        log.close();
    }
}

// Copyright 2014, Kevin Ko <kevin@faveset.com>

package com.faveset.khttpserver;

import java.io.IOException;
import sun.misc.Signal;
import sun.misc.SignalHandler;

import com.faveset.khttp.HttpHandler;
import com.faveset.khttp.HttpRequest;
import com.faveset.khttp.HttpResponseWriter;

import com.faveset.log.OutputStreamLog;

public class HttpServer {
    public static void main(String[] args) throws IOException {
        if (args.length < 1) {
            System.out.println("<port>");
            return;
        }

        int port = new Integer(args[0]);

        OutputStreamLog log = new OutputStreamLog(System.out);

        final com.faveset.khttp.HttpServer server = new com.faveset.khttp.HttpServer();
        server.setLog(log);

        // Set up the signal handler for exiting the server.
        Signal.handle(new Signal("INT"), new SignalHandler() {
            @Override
            public void handle(Signal sig) {
                server.stop();
            }
        });

        // Register handlers.

        server.registerHandler("/", new HttpHandler() {
            public void onRequest(HttpRequest req, HttpResponseWriter w) {
                w.getHeadersBuilder().set("Content-Type", "text/html");
                w.write("Hello");
            }
        });
        server.listenAndServe("::", port);

        log.close();
    }
}

Add simple handler for demonstrating usage.


package io.cine.android;

import android.util.Log;

/**
 * Created by thomas on 1/16/15.
 */
public class BroadcastConfig {
    private int width;
    private int height;
    private String requestedCamera;
    private String lockedOrientation;

    public int getWidth() {
        return width;
    }

    public void setWidth(int width) {
        this.width = width;
    }

    public int getHeight() {
        return height;
    }

    public void setHeight(int height) {
        this.height = height;
    }

    public String getLockedOrientation() {
        return lockedOrientation;
    }

    public void lockOrientation(String lockedOrientation) {
        if(lockedOrientation.equals("landscape") || lockedOrientation.equals("portrait") || lockedOrientation == null){
            this.lockedOrientation = lockedOrientation;
        } else {
            throw new RuntimeException("Orientation must be \"landscape\" or \"portrait\"");
        }
    }

    public String getRequestedCamera() {
        return requestedCamera;
    }

    public void selectCamera(String camera) {
        if(camera.equals("back") || camera.equals("front") || camera == null){
            this.requestedCamera = camera;
        } else {
            throw new RuntimeException("Camera must be \"front\" or \"back\"");
        }
    }
}

package io.cine.android;

import android.util.Log;

/**
 * Created by thomas on 1/16/15.
 */
public class BroadcastConfig {
    private Integer width;
    private Integer height;
    private String requestedCamera;
    private String lockedOrientation;

    public int getWidth() {
        if (width == null){
            return -1;
        }else{
            return width;
        }
    }

    public void setWidth(int width) {
        this.width = width;
    }

    public int getHeight() {
        if (height == null){
            return -1;
        }else{
            return height;
        }
    }

    public void setHeight(int height) {
        this.height = height;
    }

    public String getLockedOrientation() {
        return lockedOrientation;
    }

    public void lockOrientation(String lockedOrientation) {
        if(lockedOrientation.equals("landscape") || lockedOrientation.equals("portrait") || lockedOrientation == null){
            this.lockedOrientation = lockedOrientation;
        } else {
            throw new RuntimeException("Orientation must be \"landscape\" or \"portrait\"");
        }
    }

    public String getRequestedCamera() {
        return requestedCamera;
    }

    public void selectCamera(String camera) {
        if(camera.equals("back") || camera.equals("front") || camera == null){
            this.requestedCamera = camera;
        } else {
            throw new RuntimeException("Camera must be \"front\" or \"back\"");
        }
    }
}

Set BroadCastConfig width and height to Integers, and check for null values; return -1 if null. This allows us to avoid the problem of ints defaulting to 0 which messes up the default settings for screen width/height


package anaware.leakcanarysample;

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

import com.squareup.leakcanary.RefWatcher;

public class AnotherActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_another);
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        RefWatcher refWatcher = MyApplication.getRefWatcher(this);
        refWatcher.watch(this);
    }
}

package anaware.leakcanarysample;

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

import com.squareup.leakcanary.RefWatcher;

public class AnotherActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_another);

        // Invoke the GC to accelerate the analysis.
        System.gc();
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        RefWatcher refWatcher = MyApplication.getRefWatcher(this);
        refWatcher.watch(this);
    }
}

Call GC to accelerate the analysis

Call GC to accelerate the analysis


package org.wisdom.content.bodyparsers;

import org.apache.felix.ipojo.annotations.Component;
import org.apache.felix.ipojo.annotations.Instantiate;
import org.apache.felix.ipojo.annotations.Provides;
import org.wisdom.api.content.BodyParser;
import org.wisdom.api.http.Context;
import org.wisdom.api.http.MimeTypes;
import org.wisdom.content.json.Json;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;

@Component
@Provides
@Instantiate
public class BodyParserJson implements BodyParser {

    private final Logger logger = LoggerFactory.getLogger(BodyParserJson.class);

    public <T> T invoke(Context context, Class<T> classOfT) {
        T t = null;
        try {
            t = Json.mapper().readValue(context.getReader(), classOfT);
        } catch (IOException e) {
            logger.error("Error parsing incoming Json", e);
        }

        return t;
    }

    @Override
    public <T> T invoke(byte[] bytes, Class<T> classOfT) {
        T t = null;
        try {
            t = Json.mapper().readValue(bytes, classOfT);
        } catch (IOException e) {
            logger.error("Error parsing incoming Json", e);
        }

        return t;
    }

    public String getContentType() {
        return MimeTypes.JSON;
    }

}

package org.wisdom.content.bodyparsers;

import org.apache.felix.ipojo.annotations.Component;
import org.apache.felix.ipojo.annotations.Instantiate;
import org.apache.felix.ipojo.annotations.Provides;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.wisdom.api.content.BodyParser;
import org.wisdom.api.http.Context;
import org.wisdom.api.http.MimeTypes;
import org.wisdom.content.json.Json;

import java.io.IOException;

@Component
@Provides
@Instantiate
public class BodyParserJson implements BodyParser {

    private final Logger logger = LoggerFactory.getLogger(BodyParserJson.class);

    public <T> T invoke(Context context, Class<T> classOfT) {
        T t = null;
        try {
            final String content = context.body();
            if (content == null  || content.length() == 0) {
                return null;
            }
            t = Json.mapper().readValue(content, classOfT);
        } catch (IOException e) {
            logger.error("Error parsing incoming Json", e);
        }

        return t;
    }

    @Override
    public <T> T invoke(byte[] bytes, Class<T> classOfT) {
        T t = null;
        try {
            t = Json.mapper().readValue(bytes, classOfT);
        } catch (IOException e) {
            logger.error("Error parsing incoming Json", e);
        }

        return t;
    }

    public String getContentType() {
        return MimeTypes.JSON;
    }

}

Check for null and empty body before trying to map a json string to an object.

Signed-off-by: Clement Escoffier <6397137e57d1f87002962a37058f2a1c76fca9db@gmail.com>


package org.verapdf.model.impl.pb.cos;

import org.apache.log4j.Logger;
import org.apache.pdfbox.cos.COSString;
import org.verapdf.model.coslayer.CosString;

/**
 * Created by Evgeniy Muravitskiy on 4/28/15.
 * <p>
 *     Current class is representation of CosString interface of abstract model.
 *     This class is analogue of COSString in pdfbox.
 * </p>
 */
public class PBCosString extends PBCosObject implements CosString {

    public PBCosString(COSString value) {
        super(value);
        setType("CosString");
    }

    /** Get Unicode string value stored in the PDF object
     */
    @Override
    public String getvalue() {
        return ((COSString) baseObject).getString();
    }

    /** true if the string is stored in Hex format
     */
    @Override
    public Boolean getisHex() {
        return ((COSString) baseObject).isHex() != null;
    }

    /** Get original string value of the string before applying Hex decoding
     *  and any encodings (but after ignoring all white spaces)
     */
    @Override
    public String getorigValue() {
        return new String(((COSString) baseObject).getBytes());
    }
}

package org.verapdf.model.impl.pb.cos;

import org.apache.log4j.Logger;
import org.apache.pdfbox.cos.COSString;
import org.verapdf.model.coslayer.CosString;

/**
 * Created by Evgeniy Muravitskiy on 4/28/15.
 * <p>
 *     Current class is representation of CosString interface of abstract model.
 *     This class is analogue of COSString in pdfbox.
 * </p>
 */
public class PBCosString extends PBCosObject implements CosString {

    public PBCosString(COSString value) {
        super(value);
        setType("CosString");
    }

    /** Get Unicode string value stored in the PDF object
     */
    @Override
    public String getvalue() {
        return ((COSString) baseObject).getString();
    }

    /** true if the string is stored in Hex format
     */
    @Override
    public Boolean getisHex() {
        return ((COSString) baseObject).isHex() != null;
    }

    /** true if all symbols below range 0-9,a-f,A-F
     */
    public Boolean getisHexSymbols() {
        for (byte symbol : ((COSString) baseObject).getBytes()) {
            if (Character.digit(symbol, 16) == -1) {
                return false;
            }
        }
        return true;
    }

    /** Get original string value of the string before applying Hex decoding
     *  and any encodings (but after ignoring all white spaces)
     */
    @Override
    public String getorigValue() {
        return new String(((COSString) baseObject).getBytes());
    }
}

Add support of hexadecimal string for CosString


package org.apache.maven.plugin.version;

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

import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.plugin.InvalidPluginException;
import org.apache.maven.project.MavenProject;
import org.apache.maven.settings.Settings;
import org.apache.maven.execution.MavenSession;

public interface PluginVersionManager
{
    String ROLE = PluginVersionManager.class.getName();

    String resolvePluginVersion( String groupId, String artifactId, MavenProject project, MavenSession session )
        throws PluginVersionResolutionException, InvalidPluginException, PluginVersionNotFoundException;

    String resolveReportPluginVersion( String groupId, String artifactId, MavenProject project, MavenSession session )
        throws PluginVersionResolutionException, InvalidPluginException, PluginVersionNotFoundException;

}

package org.apache.maven.plugin.version;

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

import org.apache.maven.execution.MavenSession;
import org.apache.maven.plugin.InvalidPluginException;
import org.apache.maven.project.MavenProject;

public interface PluginVersionManager
{
    String ROLE = PluginVersionManager.class.getName();

    String resolvePluginVersion( String groupId, String artifactId, MavenProject project, MavenSession session )
        throws PluginVersionResolutionException, InvalidPluginException, PluginVersionNotFoundException;

    String resolveReportPluginVersion( String groupId, String artifactId, MavenProject project, MavenSession session )
        throws PluginVersionResolutionException, InvalidPluginException, PluginVersionNotFoundException;

}

Remove unused and unavailable imports

Remove unused and unavailable imports

git-svn-id: 2c527eb49caa05e19d6b2be874bf74fa9d7ea670@497304 13f79535-47bb-0310-9956-ffa450edef68


/*
 * Java core library component.
 *
 * Copyright (c) 1997, 1998
 *      Transvirtual Technologies, Inc.  All rights reserved.
 *
 * See the file "license.terms" for information on usage and redistribution
 * of this file.
 */

package java.util;

public interface Map {

	interface Entry {
		Object getKey();
		Object getValue();
		Object setValue(Object value);
		boolean equals(Object o);
		int hashCode();
	}

	int size();
	boolean isEmpty();
	boolean containsKey(Object o);
	boolean containsValue(Object o);
	Object get(Object key);
	Object put(Object key, Object value);
	void putAll(Map m);
	void clear();
	Set keySet();
	Set entrySet();
	Collection values();
	boolean equals(Object o);
	int hashCode();
	Object remove(Object o);

}

/*
 * Java core library component.
 *
 * Copyright (c) 1997, 1998
 *      Transvirtual Technologies, Inc.  All rights reserved.
 *
 * See the file "license.terms" for information on usage and redistribution
 * of this file.
 */

package java.util;

public interface Map {

	public interface Entry {
		Object getKey();
		Object getValue();
		Object setValue(Object value);
		boolean equals(Object o);
		int hashCode();
	}

	int size();
	boolean isEmpty();
	boolean containsKey(Object o);
	boolean containsValue(Object o);
	Object get(Object key);
	Object put(Object key, Object value);
	void putAll(Map m);
	void clear();
	Set keySet();
	Set entrySet();
	Collection values();
	boolean equals(Object o);
	int hashCode();
	Object remove(Object o);

}

Make nested interface 'Entry' public again, or else the nightly build seems to break. Not sure if this is a compiler bug or not.


package com.slicingdice.jslicer.exceptions.api.index;

import com.slicingdice.jslicer.exceptions.api.SlicingDiceException;

public class IndexInvalidRangeException extends SlicingDiceException {
    public IndexInvalidRangeException(String message) {
        super(message);
    }
}

package com.slicingdice.jslicer.exceptions.api.index;

import com.slicingdice.jslicer.exceptions.api.SlicingDiceException;

public class IndexInvalidRangeException extends SlicingDiceException {
    public IndexInvalidRangeException(final String message) {
        super(message);
    }
}

Make changes according to review

Make changes according to review


package com.neoranga55.cleanguitestarchitecture.test;

import cucumber.api.CucumberOptions;

/**
 * This class configures the Cucumber test framework and Java glue code
 */
@CucumberOptions(features = "features", // Test scenarios
        glue = {"com.neoranga55.cleanguitestarchitecture.cucumber.steps"}, // Steps definitions
        format = {"pretty", // Cucumber report formats and location to store them in phone
                "html:/mnt/sdcard/cucumber-reports/report.html",
                "json:/mnt/sdcard/cucumber-reports/cucumber.json",
                "junit:/mnt/sdcard/cucumber-reports/cucumber.xml"
        },
        tags={"~@manual", "@login-scenarios"}
)
public class CucumberTestCase {
}

package com.neoranga55.cleanguitestarchitecture.test;

import cucumber.api.CucumberOptions;

/**
 * This class configures the Cucumber test framework and Java glue code
 */
@CucumberOptions(features = "features", // Test scenarios
        glue = {"com.neoranga55.cleanguitestarchitecture.cucumber.steps"}, // Steps definitions
        format = {"pretty", // Cucumber report formats and location to store them in phone
                "html:/mnt/sdcard/cucumber-reports/html-report",
                "json:/mnt/sdcard/cucumber-reports/cucumber.json",
                "junit:/mnt/sdcard/cucumber-reports/cucumber.xml"
        },
        tags={"~@manual", "@login-scenarios"}
)
public class CucumberTestCase {
}

Fix cucumber test results location on device


package com.braintreepayments.popupbridge.example;

import android.app.Activity;
import android.os.Bundle;
import android.webkit.WebView;

import com.braintreepayments.popupbridge.PopupBridge;

public class MainActivity extends Activity {

    private static final String URL = "https://braintree.github.io/popup-bridge-example/";

    private WebView mWebView;
    private PopupBridge mPopupBridge;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        mWebView = (WebView) findViewById(R.id.web_view);
        mWebView.getSettings().setJavaScriptEnabled(true);

        mPopupBridge = PopupBridge.newInstance(this, mWebView);

        mWebView.loadUrl(URL);
    }
}

package com.braintreepayments.popupbridge.example;

import android.app.Activity;
import android.os.Bundle;
import android.webkit.WebView;

import com.braintreepayments.popupbridge.PopupBridge;

public class MainActivity extends Activity {

    private static final String URL = "https://braintree.github.io/popup-bridge-example/";

    private WebView mWebView;
    private PopupBridge mPopupBridge;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        mWebView = (WebView) findViewById(R.id.web_view);

        mPopupBridge = PopupBridge.newInstance(this, mWebView);

        mWebView.loadUrl(URL);
    }
}

Remove unneeded code in example app

Remove unneeded code in example app


package org.vaadin.elements;

import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.vaadin.elements.impl.RootImpl;

import com.vaadin.ui.Label;

import elemental.json.JsonArray;

public class RootTest {

    private RootImpl root;
    private Element child;

    @Before
    public void init() {
        child = Elements.create("div");
        root = (RootImpl) ElementIntegration.getRoot(new Label());
    }

    @Test
    public void testAppendChild() {
        root.appendChild(child);

        JsonArray pendingCommands = root.flushPendingCommands();

        Assert.assertEquals(
                "[[\"createElement\",3,\"div\"],[\"appendChild\",0,3]]",
                pendingCommands.toJson());
    }

    @Test
    public void testRemoveChild() {
        root.appendChild(child);
        root.flushPendingCommands();

        child.remove();

        JsonArray pendingCommands = root.flushPendingCommands();

        Assert.assertEquals("[[\"remove\",3]]", pendingCommands.toJson());
    }

}

package org.vaadin.elements;

import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.vaadin.elements.impl.RootImpl;

import com.vaadin.ui.Label;

import elemental.json.JsonArray;

public class RootTest {

    private RootImpl root;
    private Element child;

    @Before
    public void init() {
        child = Elements.create("div");
        root = (RootImpl) ElementIntegration.getRoot(new Label());
    }

    @Test
    public void testAppendChild() {
        root.appendChild(child);

        JsonArray pendingCommands = root.flushPendingCommands();

        Assert.assertEquals(
                "[[\"createElement\",2,\"div\"],[\"appendChild\",0,2]]",
                pendingCommands.toJson());
    }

    @Test
    public void testRemoveChild() {
        root.appendChild(child);
        root.flushPendingCommands();

        child.remove();

        JsonArray pendingCommands = root.flushPendingCommands();

        Assert.assertEquals("[[\"remove\",2]]", pendingCommands.toJson());
    }

}

Update test for changed indexing

Update test for changed indexing


package com.smartdevicelink.managers.file;

import com.smartdevicelink.AndroidTestCase2;
import com.smartdevicelink.managers.file.filetypes.SdlArtwork;
import com.smartdevicelink.managers.file.filetypes.SdlFile;
import com.smartdevicelink.proxy.rpc.enums.StaticIconName;
import com.smartdevicelink.test.Test;

public class SdlArtworkTests extends AndroidTestCase2 {

    public void testClone(){
        SdlArtwork original = Test.GENERAL_ARTWORK;
        SdlArtwork clone = original.clone();

        assertNotNull(clone);
        assertNotSame(original,clone);

        assertEquals(original.getResourceId(), clone.getResourceId());

        assertEquals(original.getFileData(), clone.getFileData());

        assertNotNull(original.getImageRPC());
        assertNotNull(clone.getImageRPC());

        assertNotSame(original.getImageRPC(),clone.getImageRPC());
        assertEquals(original.getImageRPC().getIsTemplate(), clone.getImageRPC().getIsTemplate());
        assertEquals(original.getImageRPC().getValue(), clone.getImageRPC().getValue());
        assertEquals(original.getImageRPC().getImageType(), clone.getImageRPC().getImageType());

        SdlArtwork artwork = new SdlArtwork(StaticIconName.ALBUM);
        assertNotNull(artwork);

        SdlArtwork staticIconClone = artwork.clone();
        assertNotNull(staticIconClone);

        assertTrue(clone instanceof Cloneable);
        assertTrue(artwork instanceof Cloneable);

    }
}

package com.smartdevicelink.managers.file;

import com.smartdevicelink.AndroidTestCase2;
import com.smartdevicelink.managers.file.filetypes.SdlArtwork;
import com.smartdevicelink.managers.file.filetypes.SdlFile;
import com.smartdevicelink.proxy.rpc.enums.StaticIconName;
import com.smartdevicelink.test.Test;

public class SdlArtworkTests extends AndroidTestCase2 {

    public void testClone(){
        SdlArtwork original = Test.GENERAL_ARTWORK;
        SdlArtwork clone = original.clone();

        equalTest(original, clone);

        SdlArtwork artwork = new SdlArtwork(StaticIconName.ALBUM);
        assertNotNull(artwork);

        SdlArtwork staticIconClone = artwork.clone();
        assertNotNull(staticIconClone);

        assertTrue(clone instanceof Cloneable);
        assertTrue(artwork instanceof Cloneable);

    }

    public static boolean equalTest(SdlArtwork original, SdlArtwork clone){

        assertNotNull(original);
        assertNotNull(clone);
        assertNotSame(original,clone);

        assertEquals(original.getResourceId(), clone.getResourceId());

        assertEquals(original.getFileData(), clone.getFileData());

        assertNotNull(original.getImageRPC());
        assertNotNull(clone.getImageRPC());

        assertNotSame(original.getImageRPC(),clone.getImageRPC());
        assertEquals(original.getImageRPC().getIsTemplate(), clone.getImageRPC().getIsTemplate());
        assertEquals(original.getImageRPC().getValue(), clone.getImageRPC().getValue());
        assertEquals(original.getImageRPC().getImageType(), clone.getImageRPC().getImageType());

        return true;
    }
}

Update SdlArtwork test to have reusable equalTest


/**
 * Copyright (C) 2009 - 2010 by OpenGamma Inc.
 *
 * Please see distribution for license.
 */
package com.opengamma.financial.security.option;

import com.opengamma.financial.Currency;
import com.opengamma.id.Identifier;
import com.opengamma.id.UniqueIdentifier;
import com.opengamma.util.time.Expiry;

/**
 * An American equity option security.
 */
public class AmericanVanillaEquityOptionSecurity extends EquityOptionSecurity implements AmericanVanillaOption {

  /**
   * Creates the security.
   * @param optionType
   * @param strike
   * @param expiry
   * @param underlyingIdentifier
   * @param currency
   * @param exchange
   */
  public AmericanVanillaEquityOptionSecurity(final OptionType optionType, final double strike, final Expiry expiry, final Identifier underlyingIdentifier,
      final Currency currency, final double pointValue, final String exchange) {
    super(optionType, strike, expiry, underlyingIdentifier, currency, pointValue, exchange);
  }

  //-------------------------------------------------------------------------
  @Override
  public <T> T accept(final OptionVisitor<T> visitor) {
    return visitor.visitAmericanVanillaOption(this);
  }

  @Override
  public <T> T accept(final EquityOptionSecurityVisitor<T> visitor) {
    return visitor.visitAmericanVanillaEquityOptionSecurity(this);
  }

}

/**
 * Copyright (C) 2009 - 2010 by OpenGamma Inc.
 *
 * Please see distribution for license.
 */
package com.opengamma.financial.security.option;

import com.opengamma.financial.Currency;
import com.opengamma.id.Identifier;
import com.opengamma.util.time.Expiry;

/**
 * An American equity option security.
 */
public class AmericanVanillaEquityOptionSecurity extends EquityOptionSecurity implements AmericanVanillaOption {

  /**
   * Creates the security.
   * @param optionType the type of option CALL or PUT
   * @param strike the strike price
   * @param expiry the expire date
   * @param underlyingIdentifier Identifier for underlying equity
   * @param currency currency in which it trades
   * @param pointValue the option point value
   * @param exchange exchange where the option trades
   */
  public AmericanVanillaEquityOptionSecurity(final OptionType optionType, final double strike, final Expiry expiry, final Identifier underlyingIdentifier,
      final Currency currency, final double pointValue, final String exchange) {
    super(optionType, strike, expiry, underlyingIdentifier, currency, pointValue, exchange);
  }

  //-------------------------------------------------------------------------
  @Override
  public <T> T accept(final OptionVisitor<T> visitor) {
    return visitor.visitAmericanVanillaOption(this);
  }

  @Override
  public <T> T accept(final EquityOptionSecurityVisitor<T> visitor) {
    return visitor.visitAmericanVanillaEquityOptionSecurity(this);
  }

}

[DVI-34] Make code conform to Checkstyle standards


package org.jenkinsci.plugins.github.pullrequest;

import hudson.Extension;
import hudson.model.AbstractProject;
import hudson.model.Action;
import hudson.model.TransientProjectActionFactory;

import java.io.IOException;
import java.util.Collection;
import java.util.Collections;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 * @author Kanstantsin Shautsou
 */
@Extension
public class GitHubPRRepositoryFactory extends TransientProjectActionFactory {
    private final static Logger LOGGER = Logger.getLogger(GitHubPRRepositoryFactory.class.getName());

    @Override
    public Collection<? extends Action> createFor(AbstractProject project) {
        if (project.getTrigger(GitHubPRTrigger.class) != null) {
            return Collections.singleton(GitHubPRRepository.forProject(project));
        }

        return Collections.emptyList();
    }

}

package org.jenkinsci.plugins.github.pullrequest;

import hudson.Extension;
import hudson.model.AbstractProject;
import hudson.model.Action;
import hudson.model.TransientProjectActionFactory;

import java.io.IOException;
import java.util.Collection;
import java.util.Collections;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 * @author Kanstantsin Shautsou
 */
@Extension
public class GitHubPRRepositoryFactory extends TransientProjectActionFactory {
    private final static Logger LOGGER = Logger.getLogger(GitHubPRRepositoryFactory.class.getName());

    @Override
    public Collection<? extends Action> createFor(AbstractProject project) {
        try {
            if (project.getTrigger(GitHubPRTrigger.class) != null) {
                return Collections.singleton(GitHubPRRepository.forProject(project));
            }
        } catch (Throwable t) {
            // bad configured project i.e. github project property wrong
            return Collections.emptyList();
        }

        return Collections.emptyList();
    }

}

Allow save job that had no GH project property before.


/*                                                                      *\
**                    SICU Stress Measurement System                    **
**                      Project P04  |  C380 Team A                     **
**          EBME 380: Biomedical Engineering Design Experience          **
**                    Case Western Reserve University                   **
**                          2016 Fall Semester                          **
\*                                                                      */

package edu.cwru.sicu_sms.util;

import jssc.SerialPortEvent;

/**
 * This class is used to configure and manage the serial port for receiving EKG channel data.
 *
 * @since December 12, 2016
 * @author Ted Frohlich <ttf10@case.edu>
 * @author Abby Walker <amw138@case.edu>
 */
public class EKGSerialPort extends AbstractSerialPort {

    public EKGSerialPort() {
        super("src/main/resources/util/EKGSerialPort.properties");
    }

    @Override
    public void serialEvent(SerialPortEvent serialPortEvent) {
        // TODO
    }

}

/*                                                                      *\
**                    SICU Stress Measurement System                    **
**                      Project P04  |  C380 Team A                     **
**          EBME 380: Biomedical Engineering Design Experience          **
**                    Case Western Reserve University                   **
**                          2016 Fall Semester                          **
\*                                                                      */

package edu.cwru.sicu_sms.util;

import jssc.SerialPortEvent;

/**
 * This class is used to configure and manage the serial port for receiving EKG channel data.
 *
 * @since December 12, 2016
 * @author Ted Frohlich <ttf10@case.edu>
 * @author Abby Walker <amw138@case.edu>
 */
public class EKGSerialPort extends AbstractSerialPort {

    public EKGSerialPort() {
        super("util/EKGSerialPort.properties");
    }

    @Override
    public void serialEvent(SerialPortEvent serialPortEvent) {
        // TODO
    }

}

Correct filename argument in constructor


package interactivelearner.gui;

import interactivelearner.classifier.NaiveBayesianClassifier;
import interactivelearner.data.Corpus;
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.stage.Stage;

import java.io.File;

public class NaiveBayesGUI extends Application {

    @Override
    public void start(Stage primaryStage) throws Exception {
        FXMLLoader loader = new FXMLLoader(getClass().getResource("/gui/TrainGUI.fxml"));
        Parent train = loader.load();
        TrainController controller = loader.getController();
        controller.getStage(primaryStage);
        primaryStage.setTitle("Naive bayesian classifier");
        Scene trainScene = new Scene(train, 600, 400);
        primaryStage.setScene(trainScene);
        primaryStage.show();
    }

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

package interactivelearner.gui;

import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;

public class NaiveBayesGUI extends Application {

    @Override
    public void start(Stage primaryStage) throws Exception {
        FXMLLoader loader = new FXMLLoader(getClass().getResource("/gui/TrainGUI.fxml"));
        Parent train = loader.load();
        TrainController controller = loader.getController();
        controller.getStage(primaryStage);
        primaryStage.setTitle("Naive bayesian classifier");
        Scene trainScene = new Scene(train, 600, 400);
        primaryStage.setScene(trainScene);
        primaryStage.show();
    }

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

Remove unused imports in GUI class

Remove unused imports in GUI 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.jackrabbit.extractor;

/**
 * Composite text extractor that by default contains the standard
 * text extractors found in this package.
 */
public class DefaultTextExtractor extends CompositeTextExtractor {

    /**
     * Creates the default text extractor by adding instances of the standard
     * text extractors as components.
     */
    public DefaultTextExtractor() {
        addTextExtractor(new PlainTextExtractor());
        addTextExtractor(new XMLTextExtractor());
    }

}

/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.apache.jackrabbit.extractor;

/**
 * Composite text extractor that by default contains the standard
 * text extractors found in this package.
 *
 * @deprecated Use {@link TikaTextExtractor} instead
 */
public class DefaultTextExtractor extends TikaTextExtractor {
}

Use Apache Tika for text extraction

JCR-1878: Use Apache Tika for text extraction

Automatically improve any configurations that use DefaultTextExtractor by making that class extend TikaTextExtractor.

git-svn-id: 02b679d096242155780e1604e997947d154ee04a@762813 13f79535-47bb-0310-9956-ffa450edef68


package seedu.todo.guitests;

import static org.junit.Assert.*;

import org.junit.Test;

import seedu.todo.guitests.guihandles.AliasItemHandle;

// @@author A0139812A
public class AliasCommandTest extends GuiTest {

    @Test
    public void alias_view_success() {
        console.runCommand("alias");
        assertTrue(aliasView.hasLoaded());
    }

    @Test
    public void alias_toList_success() {
        console.runCommand("alias list ls");
        System.out.println("hello");
        assertAliasItemVisible("list", "ls");
    }

    /**
     * Helper function to assert that AliasItem is visible.
     */
    private void assertAliasItemVisible(String aliasKey, String aliasValue) {
        // Make sure we can see the Alias View.
        assertTrue(aliasView.hasLoaded());

        // Gets the matching AliasItem. Since it matches, if it's not null -> it definitely exists.
        AliasItemHandle aliasItem = aliasView.getAliasItem(aliasKey, aliasValue);
        assertNotNull(aliasItem);
    }

}

package seedu.todo.guitests;

import static org.junit.Assert.*;

import org.junit.Test;

import seedu.todo.guitests.guihandles.AliasItemHandle;
import seedu.todo.models.Task;

// @@author A0139812A
public class AliasCommandTest extends GuiTest {

    @Test
    public void alias_view_success() {
        console.runCommand("alias");
        assertTrue(aliasView.hasLoaded());
    }

    @Test
    public void alias_toList_success() {
        console.runCommand("alias list ls");
        assertAliasItemVisible("list", "ls");

        console.runCommand("add Buy milk");
        Task testTask = new Task();
        testTask.setName("Buy milk");
        assertTaskVisibleAfterCmd("ls", testTask);
    }

    /**
     * Helper function to assert that AliasItem is visible.
     */
    private void assertAliasItemVisible(String aliasKey, String aliasValue) {
        // Make sure we can see the Alias View.
        assertTrue(aliasView.hasLoaded());

        // Gets the matching AliasItem. Since it matches, if it's not null -> it definitely exists.
        AliasItemHandle aliasItem = aliasView.getAliasItem(aliasKey, aliasValue);
        assertNotNull(aliasItem);
    }

}

Complete alias list test case

Complete alias list test case


package org.realityforge.arez.processor;

import javax.annotation.Nonnull;
import javax.lang.model.element.Element;
import javax.lang.model.element.Modifier;
import javax.lang.model.element.PackageElement;
import javax.lang.model.element.TypeElement;
import javax.lang.model.util.Elements;
import javax.lang.model.util.Types;
import org.realityforge.arez.annotations.Container;

final class ContainerDescriptorParser
{
  private ContainerDescriptorParser()
  {
  }

  static ContainerDescriptor parse( @Nonnull final Element element,
                                    @Nonnull final Elements elementUtils,
                                    @Nonnull final Types typeUtils )
    throws ArezProcessorException
  {
    final PackageElement packageElement = elementUtils.getPackageOf( element );
    final TypeElement typeElement = (TypeElement) element;
    if ( !element.getKind().isClass() )
    {
      throw new ArezProcessorException( "@Container target must be a class", element );
    }
    else if ( element.getModifiers().contains( Modifier.ABSTRACT ) )
    {
      throw new ArezProcessorException( "@Container target must not be abstract", element );
    }
    else if ( element.getModifiers().contains( Modifier.FINAL ) )
    {
      throw new ArezProcessorException( "@Container target must not be final", element );
    }
    final Container container = typeElement.getAnnotation( Container.class );
    final String name =
      container.name().equals( "<default>" ) ? typeElement.getSimpleName().toString() : container.name();

    return new ContainerDescriptor( name, container.singleton(), packageElement, typeElement );
  }
}

package org.realityforge.arez.processor;

import javax.annotation.Nonnull;
import javax.lang.model.element.Element;
import javax.lang.model.element.Modifier;
import javax.lang.model.element.PackageElement;
import javax.lang.model.element.TypeElement;
import javax.lang.model.util.Elements;
import javax.lang.model.util.Types;
import org.realityforge.arez.annotations.Container;

final class ContainerDescriptorParser
{
  private ContainerDescriptorParser()
  {
  }

  static ContainerDescriptor parse( @Nonnull final Element element,
                                    @Nonnull final Elements elementUtils,
                                    @Nonnull final Types typeUtils )
    throws ArezProcessorException
  {
    final PackageElement packageElement = elementUtils.getPackageOf( element );
    final TypeElement typeElement = (TypeElement) element;
    if ( !element.getKind().isClass() )
    {
      throw new ArezProcessorException( "@Container target must be a class", element );
    }
    else if ( element.getModifiers().contains( Modifier.ABSTRACT ) )
    {
      throw new ArezProcessorException( "@Container target must not be abstract", element );
    }
    else if ( element.getModifiers().contains( Modifier.FINAL ) )
    {
      throw new ArezProcessorException( "@Container target must not be final", element );
    }
    final Container container = typeElement.getAnnotation( Container.class );
    final String name =
      container.name().equals( "<default>" ) ? typeElement.getSimpleName().toString() : container.name();

    final ContainerDescriptor descriptor =
      new ContainerDescriptor( name, container.singleton(), packageElement, typeElement );
    return descriptor;
  }
}

Save descriptor into field so can start parsing other elkements


/*
 * Copyright 2016 Crown Copyright
 *
 * 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 stroom.data.client.presenter;

public final class ColumnSizeConstants {

    public static final int CHECKBOX_COL = 16;
    public static final int ICON_COL = 23;
    public static final int SMALL_COL = 70;
    public static final int MEDIUM_COL = 100;
    public static final int BIG_COL = 400;
    public static final int DATE_COL = 160;

    private ColumnSizeConstants() {
        // Constants.
    }
}

/*
 * Copyright 2016 Crown Copyright
 *
 * 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 stroom.data.client.presenter;

public final class ColumnSizeConstants {

    public static final int CHECKBOX_COL = 16;
    public static final int ICON_COL = 23;
    public static final int SMALL_COL = 70;
    public static final int MEDIUM_COL = 100;
    public static final int BIG_COL = 400;
    public static final int DATE_COL = 200;

    private ColumnSizeConstants() {
        // Constants.
    }
}

Increase `Created` column width to accommodate timezone ID


package info.elexis.server.core.rest.test.swagger;

import static info.elexis.server.core.rest.test.AllTests.REST_URL;
import static org.junit.Assert.assertEquals;

import java.io.IOException;
import java.net.HttpURLConnection;

import org.junit.Test;

import com.google.gson.Gson;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;

import info.elexis.server.core.rest.test.AllTests;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;

public class SwaggerTest {

	private OkHttpClient client = AllTests.getDefaultOkHttpClient();
	private Response response;

	Gson gson = new Gson();

	@Test
	public void testGetSwaggerConfiguration() throws IOException {
		Request request = new Request.Builder().url(REST_URL + "/swagger.json").get().build();
		response = client.newCall(request).execute();
		assertEquals(HttpURLConnection.HTTP_OK, response.code());

		String swaggerJson = response.body().string();
		JsonElement jelem = gson.fromJson(swaggerJson, JsonElement.class);
		JsonObject swagger = jelem.getAsJsonObject();

		JsonObject securityDefinitions = swagger.getAsJsonObject("securityDefinitions");
		JsonObject esoAuth = securityDefinitions.get("esoauth").getAsJsonObject();
		assertEquals("oauth2", esoAuth.get("type").getAsString());
	}

}

package info.elexis.server.core.rest.test.swagger;

import static info.elexis.server.core.rest.test.AllTests.REST_URL;
import static org.junit.Assert.assertEquals;

import java.io.IOException;
import java.net.HttpURLConnection;

import org.junit.Test;

import com.google.gson.Gson;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;

import info.elexis.server.core.rest.test.AllTests;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;

public class SwaggerTest {

	private OkHttpClient client = AllTests.getDefaultOkHttpClient();
	private Response response;

	Gson gson = new Gson();

	@Test
	public void testGetSwaggerConfiguration() throws IOException {
		Request request = new Request.Builder().url(REST_URL + "/swagger.json").get().build();
		response = client.newCall(request).execute();
		assertEquals(HttpURLConnection.HTTP_OK, response.code());

		String swaggerJson = response.body().string();
		JsonElement jelem = gson.fromJson(swaggerJson, JsonElement.class);
//		JsonObject swagger = jelem.getAsJsonObject();

//		JsonObject securityDefinitions = swagger.getAsJsonObject("securityDefinitions");
//		JsonObject esoAuth = securityDefinitions.get("esoauth").getAsJsonObject();
//		assertEquals("oauth2", esoAuth.get("type").getAsString());
	}

}

Remove HTTPS support, fix swagger test

[18009] Remove HTTPS support, fix swagger test


/**
 * @Company Facebook
 *
 * Given two strings, str and pattern, return true if the str has a valid mapping between the words in str and the characters in the pattern.
 * The str will be whitespace separated and the pattern will be depicted using characters.
 *
 * Problem Ex.
 *   Input: 'cat dog dog cat', 'abba'
 *   Output: true because cat = a and dog = b.
 *
 *   Input: 'cat dog dog foo', 'abba'
 *   Output: false because cat = a so foo cannot == a
 */
public boolean isValidPattern(String str, String pattern) { }

/**
 * @Company Facebook
 *
 * Given two strings, str and pattern, return true if the str has a valid mapping between the words in str and the characters in the pattern.
 * The str will be whitespace separated and the pattern will be depicted using characters.
 *
 * Problem Ex.
 *   Input: 'cat dog dog cat', 'abba'
 *   Output: true because cat = a and dog = b.
 *
 *   Input: 'cat dog dog foo', 'abba'
 *   Output: false because cat = a so foo cannot == a
 *
 * Note: use may assume the pattern string will only contain lowercase alphabet letters.
 */
public boolean wordPattern(String pattern, String str) {
  // map each letter to a string.
  String[] strs = str.split("\\s");
  // character -> string mapping
  String[] map = new String[26];
  HashSet<String> set = new HashSet<String>();

  // Must be equal in length.
  if (strs.length != pattern.length()) return false;

  for (int i = 0; i < strs.length; i ++) {
    String string = strs[i];
    char c = pattern.charAt(i);
    int index = c - 'a';

    // First occurence of the character.
    if (map[index] == null && !set.contains(string)) {
      map[index] = string;
      set.add(string);

    // Valid pattern match
    } else if (map[index] != null && map[index].equals(string)) {
      continue;
    } else {
      return false;
    }
  }

  return true;
}

Add bipartite pattern matching solution

Add bipartite pattern matching solution


package ru.nsu.ccfit.bogush.view;

import ru.nsu.ccfit.bogush.CarFactoryModel;

import javax.swing.*;

public class FactoryView extends JPanel {
	private JPanel mainPanel;
	private ControlPanel controlPanel;
	private InformationPanel infoPanel;
	private ButtonPanel buttonPanel;

	private CarFactoryModel model;

	public FactoryView(CarFactoryModel model) {
		this.model = model;
		JFrame frame = new JFrame("Car Factory");
		frame.setContentPane(mainPanel);
		frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
		frame.setResizable(false);
		frame.setLocation(0, 0);
		frame.pack();
		frame.setVisible(true);
	}

	private void createUIComponents() {
		controlPanel = new ControlPanel(model);
		infoPanel = new InformationPanel(model);
		buttonPanel = new ButtonPanel(model);
	}
}

package ru.nsu.ccfit.bogush.view;

import ru.nsu.ccfit.bogush.CarFactoryModel;
import ru.nsu.ccfit.bogush.factory.Supplier;

import javax.swing.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

public class FactoryView extends JPanel {
	private JPanel mainPanel;
	private ControlPanel controlPanel;
	private InformationPanel infoPanel;
	private ButtonPanel buttonPanel;

	private CarFactoryModel model;

	public FactoryView(CarFactoryModel model) {
		this.model = model;
		JFrame frame = new JFrame("Car Factory");
		frame.setContentPane(mainPanel);
		frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
		frame.addWindowListener(new WindowAdapter() {
			@Override
			public void windowClosed(WindowEvent e) {
				model.getStore().stop();
				model.getEngineSupplier().getThread().interrupt();
				model.getBodySupplier().getThread().interrupt();
				for (Supplier s : model.getAccessorySuppliers()) {
					s.getThread().interrupt();
				}
				model.getCarFactory().getThreadPool().stop();
			}
		});
		frame.setResizable(false);
		frame.setLocation(0, 0);
		frame.pack();
		frame.setVisible(true);
	}

	private void createUIComponents() {
		controlPanel = new ControlPanel(model);
		infoPanel = new InformationPanel(model);
		buttonPanel = new ButtonPanel(model);
	}
}

Change default close operation of main window to "dispose" Add windowClosed listener which interrupts all model threads


package org.yakindu.sct.generator.core;

import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.xtext.generator.JavaIoFileSystemAccess;
import org.yakindu.sct.model.sgen.GeneratorEntry;

import com.google.inject.Inject;
import com.google.inject.Injector;

/**
 *  @author oliver bohl
 *
 */

public abstract class AbstractSGenGenerator implements ISCTGenerator {

	@Inject protected IWorkspaceRoot root;
	@Inject protected JavaIoFileSystemAccess fsa;
	@Inject protected Injector injector;

	protected abstract void generateContent(GeneratorEntry entry,
			JavaIoFileSystemAccess fsa, String targetProjectPath);

	public void generate(GeneratorEntry entry) {
		// Does actually nothing
		// generateInternal(entry);
	}

//	private void generateInternal(GeneratorEntry entry) {
//
//
//		 String targetProject = GeneratorUtils.getTargetProject(entry).toString();
//		 targetProject = targetProject.substring(1);
//
//		 IProject targetProjectRoot = root.getProject(targetProject);
//
//		 if(targetProjectRoot.exists() && targetProjectRoot.isOpen()){
//		 String targetFolder =
//		 GeneratorUtils.getTargetFolder(entry).toString();
//		 fsa.setOutputPath(IFileSystemAccess.DEFAULT_OUTPUT, targetFolder);
//
//		 String targetProjectPath = targetProject.replaceAll("\\.", "/");
//		 generateContent(entry, fsa, targetProjectPath);
//		 }
//	}

}

[YAKHMI-870] SCTUnit: Create abstract SGenGenerator for SCTUnit
-added generated Code


package de.gurkenlabs.litiengine.environment.tilemap.xml;

import org.junit.Test;

import junit.framework.Assert;

public class CustomPropertyProviderTests {

  @Test
  public void testSetCustomProperty() {
    CustomPropertyProvider propProvider = new CustomPropertyProvider();
    propProvider.setCustomProperty("test", "testvalue");

    Assert.assertEquals("testvalue", propProvider.getCustomProperty("test"));
    Assert.assertNull(propProvider.getCustomProperty("test2"));
    Assert.assertEquals(1, propProvider.getAllCustomProperties().size());

    propProvider.setCustomProperty("test", "testvalue2");

    Assert.assertEquals("testvalue2", propProvider.getCustomProperty("test"));
  }
}

package de.gurkenlabs.litiengine.environment.tilemap.xml;

import java.util.ArrayList;

import org.junit.Test;

import junit.framework.Assert;

public class CustomPropertyProviderTests {

  @Test
  public void testSetCustomProperty() {
    CustomPropertyProvider propProvider = new CustomPropertyProvider();
    propProvider.setCustomProperty("test", "testvalue");

    Assert.assertEquals("testvalue", propProvider.getCustomProperty("test"));
    Assert.assertNull(propProvider.getCustomProperty("test2"));
    Assert.assertEquals(1, propProvider.getAllCustomProperties().size());

    propProvider.setCustomProperty("test", "testvalue2");

    Assert.assertEquals("testvalue2", propProvider.getCustomProperty("test"));

    ArrayList<Property> props = new ArrayList<>();
    props.add(new Property("test2", "testvalue3"));
    props.add(new Property("test3", "testvalue4"));

    propProvider.setCustomProperties(props);

    Assert.assertEquals(2, propProvider.getAllCustomProperties().size());
    Assert.assertEquals("testvalue3", propProvider.getCustomProperty("test2"));
    Assert.assertEquals("testvalue4", propProvider.getCustomProperty("test3"));
  }
}

Add additional test case for setting custom properties by a collection.


package eu.liveandgov.wp1.human_activity_recognition;

import eu.liveandgov.wp1.human_activity_recognition.containers.CountWindow;
import eu.liveandgov.wp1.human_activity_recognition.containers.TaggedWindow;
import eu.liveandgov.wp1.human_activity_recognition.helper.Persistor;
import eu.liveandgov.wp1.human_activity_recognition.producers.*;

/**
 * Created with IntelliJ IDEA.
 * User: cehlen
 * Date: 06/01/14
 * Time: 21:23
 * To change this template use File | Settings | File Templates.
 */
public class Main {

    public static void main(String args[]) {
        CSVReader csvReader = new CSVReader();

        WindowProducer windowProducer = new WindowProducer(5000, 4995);
        csvReader.setConsumer(windowProducer);

        QualityFilter qualityFilter = new QualityFilter(50.0, 1.0, "windowFreq.log");
        windowProducer.setConsumer(qualityFilter);

        Interpolator interpolator = new Interpolator(50.0);
        qualityFilter.setConsumer(interpolator);

        Persistor<CountWindow> p = new Persistor("out.csv");
        interpolator.setConsumer(p);

        csvReader.read("/Users/cehlen/TrainingData/WALKING/12");
    }

}

package eu.liveandgov.wp1.human_activity_recognition;

import eu.liveandgov.wp1.human_activity_recognition.containers.CountWindow;
import eu.liveandgov.wp1.human_activity_recognition.containers.TaggedWindow;
import eu.liveandgov.wp1.human_activity_recognition.helper.Persistor;
import eu.liveandgov.wp1.human_activity_recognition.producers.*;

/**
 * Created with IntelliJ IDEA.
 * User: cehlen
 * Date: 06/01/14
 * Time: 21:23
 * To change this template use File | Settings | File Templates.
 */
public class Main {

    public static void main(String args[]) {
        CSVReader csvReader = new CSVReader();

        WindowProducer windowProducer = new WindowProducer(1001, 995);
        csvReader.setConsumer(windowProducer);

        QualityFilter qualityFilter = new QualityFilter(50.0, 10, "windowFreq.log");
        windowProducer.setConsumer(qualityFilter);

        Interpolator interpolator = new Interpolator(50.0);
        qualityFilter.setConsumer(interpolator);

        PrintProducer<CountWindow> pp = new PrintProducer<CountWindow>("InterpolatedWindow");
        interpolator.setConsumer(pp);

        Persistor<CountWindow> pers = new Persistor<CountWindow>("out.csv");
        pp.setConsumer(pers);

        csvReader.read("Test/test.csv");
    }

}

Set main() to test data.

Set main() to test data.


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

/* $Id$ */

package org.apache.fop.area;

/**
 * The normal-flow-reference-area class.
 * Each span-reference-area contains one or more of these objects
 * See fo:region-body definition in the XSL Rec for more information.
 */
public class NormalFlow extends BlockParent {
    /**
     * Constructor.
     * @param ipd of Normal flow object
     */
    public NormalFlow(int ipd) {
        addTrait(Trait.IS_REFERENCE_AREA, Boolean.TRUE);
        setIPD(ipd);
    }
}

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

/* $Id$ */

package org.apache.fop.area;

/**
 * The normal-flow-reference-area class.
 * Each span-reference-area contains one or more of these objects
 * See fo:region-body definition in the XSL Rec for more information.
 */
public class NormalFlow extends BlockParent {
    /**
     * Constructor.
     * @param ipd of Normal flow object
     */
    public NormalFlow(int ipd) {
        addTrait(Trait.IS_REFERENCE_AREA, Boolean.TRUE);
        setIPD(ipd);
    }

    /** @see org.apache.fop.area.BlockParent#addBlock(org.apache.fop.area.Block) */
    public void addBlock(Block block) {
        super.addBlock(block);
        bpd += block.getAllocBPD();
    }
}

Accumulate the BPD extent used by the normal flow's children.

git-svn-id: 102839466c3b40dd9c7e25c0a1a6d26afc40150a@202359 13f79535-47bb-0310-9956-ffa450edef68


package constant;

/*
 * Copyright 2015 Taylor Caldwell
 *
 * 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 enum PlatformId {

		NA("NA1"),
		BR("BR1"),
		LAN("LA1"),
		LAS("LA2"),
		OCE("OC1"),
		EUNE("EUN1"),
		EUW("EUW1"),
		KR("KR"),
		RU("RU"),
		TR("TR1");

	    private String id;

	    PlatformId(String id) {
	        this.id = id;
	    }

	    public String getId() {
	        return id;
	    }
}

package constant;

/*
 * Copyright 2015 Taylor Caldwell
 *
 * 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 enum PlatformId {

		NA("NA1", "na"),
		BR("BR1", "br"),
		LAN("LA1", "lan"),
		LAS("LA2", "las"),
		OCE("OC1", "oce"),
		EUNE("EUN1", "eune"),
		EUW("EUW1", "euw"),
		KR("KR", "kr"),
		RU("RU", "ru"),
		TR("TR1", "tr");

	    private String id;
	    private String name;

	    PlatformId(String id, String name) {
	        this.id = id;
	        this.name = name;
	    }

	    public String getId() {
	        return id;
	    }

	    public String getName() {
	    	return name;
	    }
}

Add region names to platform id constants


package org.nwapw.abacus.number;

import java.util.HashMap;

public class FunctionDatabase {

    private HashMap<String, Function> functions;

    private void registerDefault(){

    }

    public FunctionDatabase(){
        functions = new HashMap<>();
    }

    public Function getFunction(String name){
        return functions.get(name);
    }

}

package org.nwapw.abacus.number;

import java.util.HashMap;

public class FunctionDatabase {

    private HashMap<String, Function> functions;

    private void registerDefault(){

        functions.put("+", new Function() {
            @Override
            protected boolean matchesParams(Number[] params) {
                return params.length >= 1;
            }

            @Override
            protected Number applyInternal(Number[] params) {
                Number sum = params[0];
                for(int i = 1; i < params.length; i++){
                    sum = sum.add(params[i]);
                }
                return sum;
            }
        });

        functions.put("-", new Function() {
            @Override
            protected boolean matchesParams(Number[] params) {
                return params.length == 2;
            }

            @Override
            protected Number applyInternal(Number[] params) {
                return params[0].subtract(params[1]);
            }
        });

        functions.put("*", new Function() {
            @Override
            protected boolean matchesParams(Number[] params) {
                return params.length >= 1;
            }

            @Override
            protected Number applyInternal(Number[] params) {
                Number product = params[1];
                for(int i = 1; i < params.length; i++){
                    product = product.multiply(params[i]);
                }
                return product;
            }
        });

        functions.put("/", new Function() {
            @Override
            protected boolean matchesParams(Number[] params) {
                return params.length == 2;
            }

            @Override
            protected Number applyInternal(Number[] params) {
                return params[0].divide(params[1]);
            }
        });
    }

    public FunctionDatabase(){
        functions = new HashMap<>();
        registerDefault();
    }

    public Function getFunction(String name){
        return functions.get(name);
    }

}

Add the four external essential functions.


/**
 *
 */
package main;

<<<<<<< Updated upstream
/**
 * @author Bart
 *
 */
public class MainClass {

	/**
	 * @param arg - the main arguments
	 */
	public static void main(String[] args) {

		System.out.println("Welcom to the main class of goto-fail;");

	}

=======
import lombok.Getter;
import lombok.Setter;

public class MainClass {
    @Getter
    @Setter
    public static int counter;

    /**
     * @param args - the main arguments.
     */
    public static void main(String[] args) {
        setCounter(5);
        System.out.println(getCounter());
    System.out.println("Welcome to the main class of goto-fail;");
    }
>>>>>>> Stashed changes
}

package main;

import lombok.Getter;
import lombok.Setter;

public class MainClass {
    @Getter @Setter
    public static int counter;

    /**
     * @param args - the main arguments.
     */
    public static void main(String[] args) {
        setCounter(5);
        System.out.println(getCounter());
        System.out.println("Welcome to the main class of goto-fail;");
    }
}

Remove wierd git behaviour & Fix name javadoc


package com.stripe.model;

import java.util.List;

import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
public final class ChargeLevel3 extends StripeObject {
  protected List<ChargeLevel3LineItem> lineItems;
  protected String merchantReference;
  protected String shippingAddressZip;
  protected Long shippingAmount;
}

package com.stripe.model;

import java.util.List;

import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
public final class ChargeLevel3 extends StripeObject {
  protected String customerReference;
  protected List<ChargeLevel3LineItem> lineItems;
  protected String merchantReference;
  protected String shippingAddressZip;
  protected String shippingFromZip;
  protected Long shippingAmount;
}

Add extra properties to the Level III data on a Charge


import org.junit.Test;

import static org.junit.Assert.assertEquals;

public class HelloWorldTest {

    @Test
    public void helloNoName() {
        assertEquals("Hello, World!", HelloWorld.hello(""));
        assertEquals("Hello, World!", HelloWorld.hello(null));
    }

    @Test
    public void helloSampleName() {
        assertEquals("Hello, Alice!", HelloWorld.hello("Alice"));
    }

    @Test
    public void helloAnotherSampleName() throws Exception {
        assertEquals("Hello, Bob!", HelloWorld.hello("Bob"));
    }
}

import org.junit.Test;

import static org.junit.Assert.assertEquals;

public class HelloWorldTest {

    @Test
    public void helloNoName() {
        assertEquals("Hello, World!", HelloWorld.hello(""));
        assertEquals("Hello, World!", HelloWorld.hello(null));
    }

    @Test
    public void helloSampleName() {
        assertEquals("Hello, Alice!", HelloWorld.hello("Alice"));
    }

    @Test
    public void helloAnotherSampleName() {
        assertEquals("Hello, Bob!", HelloWorld.hello("Bob"));
    }
}

Remove needless Exception from method signature

Fixes https://github.com/winterchord/xjava/commit/d09fb713d19abbcbdaaa979adb59aa7fc94532fd#commitcomment-14962172

The original PR (https://github.com/exercism/xjava/pull/69) that this issue
could have been fixed in was merged before I could fix this issue.


// Licensed to the Software Freedom Conservancy (SFC) under one
// or more contributor license agreements.  See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership.  The SFC 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.openqa.selenium.grid;public class ActualMain {
}

Add missing copyright file. No logical changes


package io.freefair.gradle.plugins.github;

import org.gradle.api.Plugin;
import org.gradle.api.Project;
import org.gradle.api.publish.PublishingExtension;
import org.gradle.api.publish.maven.plugins.MavenPublishPlugin;

/**
 * @author Lars Grefer
 */
public class GithubPackageRegistryMavenPublishPlugin implements Plugin<Project> {
    @Override
    public void apply(Project project) {

        project.getPlugins().apply(MavenPublishPlugin.class);
        project.getPlugins().apply(GithubPomPlugin.class);

        GithubExtension githubExtension = project.getRootProject().getExtensions().getByType(GithubExtension.class);

        project.afterEvaluate(p -> p.getExtensions().getByType(PublishingExtension.class)
                .getRepositories()
                .maven(githubRepo -> {
                    String owner = githubExtension.getOwner().get();
                    githubRepo.setName("GitHub " + owner + " Maven Packages");
                    githubRepo.setUrl("https://maven.pkg.github.com/" + owner);

                    if (githubExtension.getUsername().isPresent() && githubExtension.getToken().isPresent()) {
                        githubRepo.credentials(passwordCredentials -> {
                            passwordCredentials.setUsername(githubExtension.getUsername().get());
                            passwordCredentials.setPassword(githubExtension.getToken().get());
                        });
                    }

                }));

    }
}

package io.freefair.gradle.plugins.github;

import org.gradle.api.Plugin;
import org.gradle.api.Project;
import org.gradle.api.publish.PublishingExtension;
import org.gradle.api.publish.maven.plugins.MavenPublishPlugin;

/**
 * @author Lars Grefer
 */
public class GithubPackageRegistryMavenPublishPlugin implements Plugin<Project> {
    @Override
    public void apply(Project project) {

        project.getPlugins().apply(MavenPublishPlugin.class);
        project.getPlugins().apply(GithubPomPlugin.class);

        GithubExtension githubExtension = project.getRootProject().getExtensions().getByType(GithubExtension.class);

        project.afterEvaluate(p -> p.getExtensions().getByType(PublishingExtension.class)
                .getRepositories()
                .maven(githubRepo -> {
                    String owner = githubExtension.getOwner().get();
                    githubRepo.setName("GitHub " + owner + " Maven Packages");
                    githubRepo.setUrl("https://maven.pkg.github.com/" + githubExtension.getSlug());

                    if (githubExtension.getUsername().isPresent() && githubExtension.getToken().isPresent()) {
                        githubRepo.credentials(passwordCredentials -> {
                            passwordCredentials.setUsername(githubExtension.getUsername().get());
                            passwordCredentials.setPassword(githubExtension.getToken().get());
                        });
                    }

                }));

    }
}

Add the repo name to the github package repo url

see https://github.com/freefair/gradle-plugins/issues/50#issuecomment-517961934


/*
 * 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.prestosql.tests.product.launcher.env;

public final class EnvironmentDefaults
{
    public static final String DOCKER_IMAGES_VERSION = "33";
    public static final String HADOOP_BASE_IMAGE = "prestodev/hdp2.6-hive";
    public static final String HADOOP_IMAGES_VERSION = DOCKER_IMAGES_VERSION;
    public static final String TEMPTO_ENVIRONMENT_CONFIG = "/dev/null";

    private EnvironmentDefaults() {}
}

/*
 * 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.prestosql.tests.product.launcher.env;

public final class EnvironmentDefaults
{
    public static final String DOCKER_IMAGES_VERSION = "34";
    public static final String HADOOP_BASE_IMAGE = "prestodev/hdp2.6-hive";
    public static final String HADOOP_IMAGES_VERSION = DOCKER_IMAGES_VERSION;
    public static final String TEMPTO_ENVIRONMENT_CONFIG = "/dev/null";

    private EnvironmentDefaults() {}
}

Update docker images to version 34

Update docker images to version 34


package axiom.delauth.token;

public class DemoAuthenticator implements Authenticator {

	public boolean authenticate(String username, String password) {
		return password.equals("123456");
	}

}

package axiom.delauth.token;

public class DemoAuthenticator implements Authenticator {

	public boolean authenticate(String username, String password) {
        return !(null == username || null == password) && password.equals("123456");
    }

}

Fix DemoAuthenicator to require username and password not be null. (eclipse)


package net.md_5.gauge.monitor;

import org.bukkit.Bukkit;
import org.bukkit.entity.Player;

public class PlayersMonitor implements Runnable
{

    @Override
    public void run()
    {
        Player[] players = Bukkit.getServer().getOnlinePlayers();
    }
}

package net.md_5.gauge.monitor;

import java.util.HashSet;
import java.util.Set;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;

public class PlayersMonitor implements Runnable
{

    private final Set<String> seen = new HashSet<>();

    @Override
    public void run()
    {
        Player[] players = Bukkit.getServer().getOnlinePlayers();
        Set<String> joined = new HashSet<>();
        Set<String> left = new HashSet<>( seen );

        for ( Player player : players )
        {
            String name = player.getName();
            if ( !seen.contains( name ) )
            {
                joined.add( name );
            }
            left.remove( name );
        }

        int joinedCount = joined.size();
        int leftCount = left.size();
        int onlineCount = players.length;
    }
}

Add player join / parts + online count.

Add player join / parts +  online count.


package shadow.test.doctool;

import java.util.ArrayList;

import org.junit.Before;
import org.junit.Test;

import shadow.doctool.DocumentationTool;

public class DocumentationTest
{
	private ArrayList<String> args = new ArrayList<String>();

	@Before
	public void setup() throws Exception
	{
		if (System.getProperty("os.name").contains("Windows")) {
			args.add("-c");
			args.add("windows.xml");
		}
	}

	@Test public void misplacedTest() throws Exception
	{
		args.add("shadow/test/doctool/Misplaced.shadow");
		DocumentationTool.main(args.toArray(new String[] { }));
	}
}

package shadow.test.doctool;

import java.util.ArrayList;

import org.junit.Before;
import org.junit.Test;

import shadow.doctool.DocumentationTool;

public class DocumentationTest
{
	private ArrayList<String> args = new ArrayList<String>();

	@Before
	public void setup() throws Exception
	{
		if (System.getProperty("os.name").contains("Windows")) {
			args.add("-c");
			args.add("windows.xml");
		}
	}

	@Test public void misplacedTest() throws Exception
	{
		args.add("shadow/test/doctool/Misplaced.shadow");
		DocumentationTool.document(args.toArray(new String[] { }));
	}
}

Correct crash caused by the documentation test


package mmarquee.automation;

import mmarquee.automation.uiautomation.IUIAutomation;
import mmarquee.automation.uiautomation.IUIAutomationElement;

/**
 * Created by inpwt on 26/01/2016.
 */
public class AutomationEditBox extends AutomationBase implements IAutomationEditBox {
    public String text() {
        return this.name();
    }

    public AutomationEditBox(IUIAutomation uiAuto, IUIAutomationElement element) {
        this.element = element;
        this.uiAuto = uiAuto;
    }
}

package mmarquee.automation;

import mmarquee.automation.uiautomation.*;

/**
 * Created by inpwt on 26/01/2016.
 */
public class AutomationEditBox extends AutomationBase implements IAutomationEditBox {
    public String text() {
        //return this.name();
        com4j.Com4jObject unknown = this.element.getCurrentPattern(PatternID.ValuePatternId);

        String value = "";

        if (unknown != null) {
            IUIAutomationValuePattern pattern =
                    unknown.queryInterface(IUIAutomationValuePattern.class);

            if (pattern != null) {
                value = pattern.currentValue();
            }
        }

        return value;
    }

    public AutomationEditBox(IUIAutomation uiAuto, IUIAutomationElement element) {
        this.element = element;
        this.uiAuto = uiAuto;
    }
}

Fix issue with the value of editboxes

Fix issue with the value of editboxes


package org.ovirt.engine.core.common.action;

import org.ovirt.engine.core.common.businessentities.Network;
import org.ovirt.engine.core.common.businessentities.VDSGroup;
import org.ovirt.engine.core.common.businessentities.network_cluster;

public class AttachNetworkToVdsGroupParameter extends NetworkClusterParameters {
    private static final long serialVersionUID = -2874549285727269806L;
    private Network _network;

    public AttachNetworkToVdsGroupParameter(VDSGroup group, Network net) {
        super(new network_cluster(group.getId(),
                net.getId(),
                null,

                // Cluster attachment data can sometimes be missing, so use defaults in that case.
                net.getCluster() == null ? false : net.getCluster().getis_display(),
                net.getCluster() == null ? true : net.getCluster().isRequired()));
        _network = net;
    }

    public Network getNetwork() {
        return _network;
    }

    public AttachNetworkToVdsGroupParameter() {
    }
}

package org.ovirt.engine.core.common.action;

import org.ovirt.engine.core.common.businessentities.Network;
import org.ovirt.engine.core.common.businessentities.NetworkStatus;
import org.ovirt.engine.core.common.businessentities.VDSGroup;
import org.ovirt.engine.core.common.businessentities.network_cluster;

public class AttachNetworkToVdsGroupParameter extends NetworkClusterParameters {
    private static final long serialVersionUID = -2874549285727269806L;
    private Network _network;

    public AttachNetworkToVdsGroupParameter(VDSGroup group, Network net) {
        super(new network_cluster(group.getId(),
                net.getId(),
                NetworkStatus.NonOperational,

                // Cluster attachment data can sometimes be missing, so use defaults in that case.
                net.getCluster() == null ? false : net.getCluster().getis_display(),
                net.getCluster() == null ? true : net.getCluster().isRequired()));
        _network = net;
    }

    public Network getNetwork() {
        return _network;
    }

    public AttachNetworkToVdsGroupParameter() {
    }
}

Fix default network status on attach

core: Fix default network status on attach

Network status is being saved to DB & later on updated, so need to save
some default value and NonOperational is a reasonable choice.

Change-Id: I17ea1594fe54203ce5d98fedd77dade64537f57c
Signed-off-by: Mike Kolesnik <c6947eedc1b0e500810c3b3db45e5f4633b0ea7d@redhat.com>


package io.github.skepter.skepbot.modules;

import java.util.concurrent.ThreadLocalRandom;

public class Magic8 extends Module {

	String[] responses = { "It is certain", "It is decidedly so", "Without a doubt", "Yes definitely",
			"You may rely on it", "As I see it, yes", "Most likely", "Outlook good", "Yes", "Signs point to yes",
			"Reply hazy try again", "Ask again later", "Better not tell you now", "Cannot predict now",
			"Concentrate and ask again", "Don't count on it", "My reply is no", "My sources say no",
			"Outlook not so good", "Very doubtful" };

	public Magic8() {
		super(PatternType.STARTS_WITH, "magic8");
	}

	@Override
	public boolean extraConditions() {
		return input.endsWith("?");
	}

	@Override
	public String output() {
		return responses[ThreadLocalRandom.current().nextInt(0, responses.length)];
	}

}

package io.github.skepter.skepbot.modules;

import java.util.concurrent.ThreadLocalRandom;

public class Magic8 extends Module {

	String[] responses = { "It is certain", "It is decidedly so", "Without a doubt", "Yes definitely",
			"You may rely on it", "As I see it, yes", "Most likely", "Outlook good", "Yes", "Signs point to yes",
			"Reply hazy try again", "Ask again later", "Better not tell you now", "Cannot predict now",
			"Concentrate and ask again", "Don't count on it", "My reply is no", "My sources say no",
			"Outlook not so good", "Very doubtful" };

	public Magic8() {
		super(PatternType.CONTAINS, "magic8", "magic 8");
	}

	@Override
	public boolean extraConditions() {
		return input.endsWith("?");
	}

	@Override
	public String output() {
		return responses[ThreadLocalRandom.current().nextInt(0, responses.length)];
	}

}

Update magic 8 ball syntax

Update magic 8 ball syntax


/*******************************************************************************
 * Copyright (c) 2009 David A Carlson.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     David A Carlson (XMLmodeling.com) - initial API and implementation
 *
 * $Id$
 *******************************************************************************/
package org.openhealthtools.mdht.uml.common.notation;

import org.eclipse.uml2.uml.Element;

public interface INotationProvider {

	/**
	 * Returns the complete print string for displaying a model element.
	 */
	public String getPrintString(Element element);

	/**
	 * Returns only the annotations for a model element.
	 */
	public String getAnnotation(Element element);

}

/*******************************************************************************
 * Copyright (c) 2009 David A Carlson.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     David A Carlson (XMLmodeling.com) - initial API and implementation
 *
 * $Id$
 *******************************************************************************/
package org.openhealthtools.mdht.uml.common.notation;

import org.eclipse.uml2.uml.Element;

public interface INotationProvider {

	/**
	 * Returns the complete print string for displaying a model element.
	 */
	public String getPrintString(Element element);

	/**
	 * Returns only the annotations for a model element.
	 */
	public String getAnnotation(Element element);

	/**
	 * Returns an image for the model element, or null.
	 */
	public Object getElementImage(Element element);

	/**
	 * Returns an image for the annotations, or null.
	 */
	public Object getAnnotationImage(Element element);

}

Add support for notation images.

Add support for notation images.


public class Main {
    public static void main(String[] args) {
        System.out.println("Hello, World!");
    	}
}
// public > all languages can access
// static > will run without making an instance
// void > will not return a value
// main > method name
/**
 *system > prefdefined class of methods/variables
 *out > stdout static variable
 *println > prints that line out
 */

 //Create all the the primitives with different values. C
 //oncatenate them into a string and print it to the screen so it will print: H3110 w0r1d 2.0 true

 public class Main2 {
    public static void main2(String[] args) {
        byte zero = 0;
        short a = 3;
        int b = 1;
        char d = ' ';
        float e = 2.0f;
        boolean f = true;
        String output = "H" + a + b + b + zero + d + "w" + zero + "r" + b + "d" + d + e + d + f;
        System.out.println(output);
    }
}


package org.ovirt.engine.core.searchbackend;

import org.ovirt.engine.core.common.businessentities.ProviderType;

public class ProviderConditionFieldAutoCompleter extends BaseConditionFieldAutoCompleter {

    public static final String NAME = "NAME";
    public static final String TYPE = "TYPE";
    public static final String DESCRIPTION = "DESCRIPTION";
    public static final String URL = "URL";

    public ProviderConditionFieldAutoCompleter() {
        // Building the basic verbs dict.
        mVerbs.add(NAME);
        mVerbs.add(TYPE);
        mVerbs.add(DESCRIPTION);
        mVerbs.add(URL);

        // Building the autoCompletion dict.
        buildCompletions();

        // Building the types dict.
        getTypeDictionary().put(NAME, String.class);
        getTypeDictionary().put(TYPE, ProviderType.class);
        getTypeDictionary().put(DESCRIPTION, String.class);
        getTypeDictionary().put(URL, String.class);

        // building the ColumnName dict.
        columnNameDict.put(NAME, "name");
        columnNameDict.put(TYPE, "provider_type");
        columnNameDict.put(DESCRIPTION, "description");
        columnNameDict.put(URL, "url");

        // Building the validation dict.
        buildBasicValidationTable();
    }

    @Override
    public IAutoCompleter getFieldRelationshipAutoCompleter(final String fieldName) {
        return StringConditionRelationAutoCompleter.INSTANCE;
    }

    @Override
    public IConditionValueAutoCompleter getFieldValueAutoCompleter(String fieldName) {
        if (TYPE.equals(fieldName)) {
            return new EnumValueAutoCompleter(ProviderType.class);
        }
        return null;
    }

}

package org.ovirt.engine.core.searchbackend;

import org.ovirt.engine.core.common.businessentities.ProviderType;

public class ProviderConditionFieldAutoCompleter extends BaseConditionFieldAutoCompleter {

    public static final String NAME = "NAME";
    public static final String TYPE = "TYPE";
    public static final String DESCRIPTION = "DESCRIPTION";
    public static final String URL = "URL";

    public ProviderConditionFieldAutoCompleter() {
        // Building the basic verbs dict.
        mVerbs.add(NAME);
        mVerbs.add(TYPE);
        mVerbs.add(DESCRIPTION);
        mVerbs.add(URL);

        // Building the autoCompletion dict.
        buildCompletions();

        // Building the types dict.
        getTypeDictionary().put(NAME, String.class);
        getTypeDictionary().put(TYPE, ProviderType.class);
        getTypeDictionary().put(DESCRIPTION, String.class);
        getTypeDictionary().put(URL, String.class);

        // building the ColumnName dict.
        columnNameDict.put(NAME, "name");
        columnNameDict.put(TYPE, "provider_type");
        columnNameDict.put(DESCRIPTION, "description");
        columnNameDict.put(URL, "url");

        // Building the validation dict.
        buildBasicValidationTable();
    }

    @Override
    public IAutoCompleter getFieldRelationshipAutoCompleter(final String fieldName) {
        return StringConditionRelationAutoCompleter.INSTANCE;
    }

    @Override
    public IConditionValueAutoCompleter getFieldValueAutoCompleter(String fieldName) {
        if (TYPE.equals(fieldName)) {
            return new EnumNameAutoCompleter(ProviderType.class);
        }
        return null;
    }

}

Use enum name to search providers

core: Use enum name to search providers

Currently we build search queries for providers using the numeric value
of the type, and comparing it to the "providers.provider_type" database
column. But this column stores the name of the enum, not the numeric
value. This patch changes the autocompleter so that it uses the name.

Change-Id: I4822be2cfd57c093d4fdf11f0410c055faea8be2
Bug-Url: https://bugzilla.redhat.com/1145247
Signed-off-by: Juan Hernandez <59e5b8140de97cc91c3fb6c5342dce948469af8c@redhat.com>


package cpw.mods.fml.common;

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

public class FMLLog
{
    private static cpw.mods.fml.relauncher.FMLRelaunchLog coreLog = cpw.mods.fml.relauncher.FMLRelaunchLog.log;

    public static void log(Level level, String format, Object... data)
    {
        coreLog.log(level, String.format(format, data));
    }

    public static void log(Level level, Throwable ex, String format, Object... data)
    {
        coreLog.log(level, String.format(format, data), ex);
    }

    public static void severe(String format, Object... data)
    {
        log(Level.SEVERE, format, data);
    }

    public static void warning(String format, Object... data)
    {
        log(Level.WARNING, format, data);
    }

    public static void info(String format, Object... data)
    {
        log(Level.INFO, format, data);
    }

    public static void fine(String format, Object... data)
    {
        log(Level.FINE, format, data);
    }

    public static void finer(String format, Object... data)
    {
        log(Level.FINER, format, data);
    }

    public static void finest(String format, Object... data)
    {
        log(Level.FINEST, format, data);
    }
    public static Logger getLogger()
    {
        return coreLog.getLogger();
    }
}

package cpw.mods.fml.common;

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

public class FMLLog
{
    private static cpw.mods.fml.relauncher.FMLRelaunchLog coreLog = cpw.mods.fml.relauncher.FMLRelaunchLog.log;

    public static void log(Level level, String format, Object... data)
    {
        coreLog.log(level, String.format(format, data));
    }

    public static void log(Level level, Throwable ex, String format, Object... data)
    {
        coreLog.log(level, ex, String.format(format, data));
    }

    public static void severe(String format, Object... data)
    {
        log(Level.SEVERE, format, data);
    }

    public static void warning(String format, Object... data)
    {
        log(Level.WARNING, format, data);
    }

    public static void info(String format, Object... data)
    {
        log(Level.INFO, format, data);
    }

    public static void fine(String format, Object... data)
    {
        log(Level.FINE, format, data);
    }

    public static void finer(String format, Object... data)
    {
        log(Level.FINER, format, data);
    }

    public static void finest(String format, Object... data)
    {
        log(Level.FINEST, format, data);
    }
    public static Logger getLogger()
    {
        return coreLog.getLogger();
    }
}

Fix exception based logging to actually log the exception!


/* Classe: Carte
 * @author MARECAL Thomas
 * @author QUENTIN Thibaut
 * @author MARTIN Florian
 * Groupe I2
 * @version 1 du 04/06/2014
**/

package metier;

public class Carte {
	private static String[] COULEURS = { "ROUGE", "JAUNE", "VERT", "BLEU", "GRIS"};

	private String couleur = "NULL";
	private int valeur;

	public Carte ( String couleur, int valeur) {
		for ( String ch : COULEURS)
			if ( ch.equals(couleur))
				this.couleur = couleur;

		this.valeur = valeur;
	}
}

/* Classe: Carte
 * @author MARECAL Thomas
 * @author QUENTIN Thibaut
 * @author MARTIN Florian
 * Groupe I2
 * @version 1 du 04/06/2014
**/

package metier;

public class Carte {
	private final static String[] COULEURS = { "ROUGE", "JAUNE", "VERT", "BLEU", "GRIS"};

	private String couleur = "NULL";
	private int valeur;

	public Carte ( String couleur, int valeur) {
		for ( String ch : COULEURS)
			if ( ch.equals(couleur))
				this.couleur = couleur;

		this.valeur = valeur;
	}

	public String getCouleur () { return this.couleur; }
	public int    getValeur  () { return this.valeur;  }
}

Add getters for valeur and couleur

Add getters for valeur and couleur


package tr.xip.wanikani.settings;

import android.os.Build;
import android.os.Bundle;
import android.preference.Preference;
import android.preference.PreferenceActivity;

import tr.xip.wanikani.R;
import tr.xip.wanikani.managers.PrefManager;

/**
 * Created by xihsa_000 on 4/4/14.
 */
public class SettingsActivity extends PreferenceActivity {

    PrefManager prefMan;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        addPreferencesFromResource(R.xml.preferences);

        prefMan = new PrefManager(this);

        Preference mApiKey = findPreference(PrefManager.PREF_API_KEY);
        mApiKey.setSummary(prefMan.getApiKey());
    }

    @Override
    public void onBackPressed() {
        if (Build.VERSION.SDK_INT >= 16) {
            super.onNavigateUp();
        } else {
            super.onBackPressed();
        }
    }
}

package tr.xip.wanikani.settings;

import android.os.Build;
import android.os.Bundle;
import android.preference.Preference;
import android.preference.PreferenceActivity;

import tr.xip.wanikani.R;
import tr.xip.wanikani.managers.PrefManager;

/**
 * Created by xihsa_000 on 4/4/14.
 */
public class SettingsActivity extends PreferenceActivity {

    PrefManager prefMan;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        addPreferencesFromResource(R.xml.preferences);

        prefMan = new PrefManager(this);

        Preference mApiKey = findPreference(PrefManager.PREF_API_KEY);

        String apiKey = prefMan.getApiKey();
        String maskedApiKey = "************************";

        for (int i = 25; i < apiKey.length(); i++) {
            maskedApiKey += apiKey.charAt(i);
        }

        mApiKey.setSummary(maskedApiKey);
    }

    @Override
    public void onBackPressed() {
        if (Build.VERSION.SDK_INT >= 16) {
            super.onNavigateUp();
        } else {
            super.onBackPressed();
        }
    }
}

Mask the API key shown in settings

Mask the API key shown in settings


package com.darwinsys.clientware;

import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;

/**
 * A JAX-RS client NOT using the JAX-RS Client API
 * In fact, not using anything except Core Java APIs.
 */
public class UrlJaxRsClient {

	static final String BASE_URL =
			"http://androidcookbook.com/seam/resource/rest/recipe";

	public static void main(String[] args) throws Exception {
		URL url = new URL(BASE_URL + "/4");
		final HttpURLConnection connection = (HttpURLConnection) url.openConnection();
		connection.addRequestProperty("Accept", "application/json");
		InputStream is = connection.getInputStream();
		// Read "is" to get the response from a GET
		BufferedReader bi = new BufferedReader(new InputStreamReader(is));
		String line = null;
		while ((line = bi.readLine()) != null) {
			System.out.println(line);
		}
	}
}

package com.darwinsys.clientware;

import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;

/**
 * A JAX-RS client NOT using the JAX-RS Client API
 * In fact, not using anything except Core Java APIs.
 */
public class UrlJaxRsClient {

	static final String BASE_URL =
		"http://androidcookbook.com/seam/resource/rest/recipe";

	public static void main(String[] args) throws Exception {
		final int recipeId = 4;
		URL url = new URL(BASE_URL + "/" + recipeId);
		final HttpURLConnection connection = (HttpURLConnection) url.openConnection();
		connection.addRequestProperty("Accept", "application/json");
		InputStream is = connection.getInputStream();
		// Read "is" to get the response from a GET
		BufferedReader bi = new BufferedReader(new InputStreamReader(is));
		String line = null;
		while ((line = bi.readLine()) != null) {
			System.out.println(line);
		}
	}
}

Clarify client code a bit

Clarify client code a bit


package org.callimachusproject.xslt;

import java.io.InputStream;
import java.io.Reader;

import javax.xml.transform.TransformerFactory;

public class XSLTransformerFactory {
	private static final XSLTransformerFactory instance = new XSLTransformerFactory();

	public static XSLTransformerFactory getInstance() {
		return instance;
	}

	private final TransformerFactory tfactory = new CachedTransformerFactory();

	XSLTransformerFactory() {
		super();
	}

	public XSLTransformer createTransformer(String systemId) {
		return new XSLTransformer(systemId, tfactory);
	}

	public XSLTransformer createTransformer(InputStream in, String systemId) {
		return new XSLTransformer(in, systemId, tfactory);
	}

	public XSLTransformer createTransformer(Reader r, String systemId) {
		return new XSLTransformer(r, systemId, tfactory);
	}

}

package org.callimachusproject.xslt;

import java.io.InputStream;
import java.io.Reader;

import javax.xml.transform.TransformerFactory;

public class XSLTransformerFactory {
	private static final XSLTransformerFactory instance = new XSLTransformerFactory();

	public static XSLTransformerFactory getInstance() {
		return instance;
	}

	private final TransformerFactory tfactory = new CachedTransformerFactory();

	XSLTransformerFactory() {
		super();
	}

	public XSLTransformer createTransformer() {
		return new XSLTransformer(null, tfactory);
	}

	public XSLTransformer createTransformer(String systemId) {
		return new XSLTransformer(systemId, tfactory);
	}

	public XSLTransformer createTransformer(InputStream in, String systemId) {
		return new XSLTransformer(in, systemId, tfactory);
	}

	public XSLTransformer createTransformer(Reader r, String systemId) {
		return new XSLTransformer(r, systemId, tfactory);
	}

}

Add identify transformer factory method

Add identify transformer factory method