hexsha stringlengths 40 40 | size int64 3 1.05M | ext stringclasses 1 value | lang stringclasses 1 value | max_stars_repo_path stringlengths 5 1.02k | max_stars_repo_name stringlengths 4 126 | max_stars_repo_head_hexsha stringlengths 40 78 | max_stars_repo_licenses list | max_stars_count float64 1 191k ⌀ | max_stars_repo_stars_event_min_datetime stringlengths 24 24 ⌀ | max_stars_repo_stars_event_max_datetime stringlengths 24 24 ⌀ | max_issues_repo_path stringlengths 5 1.02k | max_issues_repo_name stringlengths 4 114 | max_issues_repo_head_hexsha stringlengths 40 78 | max_issues_repo_licenses list | max_issues_count float64 1 92.2k ⌀ | max_issues_repo_issues_event_min_datetime stringlengths 24 24 ⌀ | max_issues_repo_issues_event_max_datetime stringlengths 24 24 ⌀ | max_forks_repo_path stringlengths 5 1.02k | max_forks_repo_name stringlengths 4 136 | max_forks_repo_head_hexsha stringlengths 40 78 | max_forks_repo_licenses list | max_forks_count float64 1 105k ⌀ | max_forks_repo_forks_event_min_datetime stringlengths 24 24 ⌀ | max_forks_repo_forks_event_max_datetime stringlengths 24 24 ⌀ | avg_line_length float64 2.55 99.9 | max_line_length int64 3 1k | alphanum_fraction float64 0.25 1 | index int64 0 1M | content stringlengths 3 1.05M |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
9233121722f60afe6113ead48cef1e6080c2ac90 | 487 | java | Java | src/main/java/com/dji/sample/manage/model/param/DeviceQueryParam.java | dji-sdk/DJI-Cloud-API-Demo | a9db6c9a9bc010e612b7b5089a0c77b4a074e01f | [
"MIT"
] | 5 | 2022-03-22T02:04:12.000Z | 2022-03-28T11:17:25.000Z | src/main/java/com/dji/sample/manage/model/param/DeviceQueryParam.java | dji-sdk/DJI-Cloud-API-Demo | a9db6c9a9bc010e612b7b5089a0c77b4a074e01f | [
"MIT"
] | null | null | null | src/main/java/com/dji/sample/manage/model/param/DeviceQueryParam.java | dji-sdk/DJI-Cloud-API-Demo | a9db6c9a9bc010e612b7b5089a0c77b4a074e01f | [
"MIT"
] | 5 | 2022-03-22T08:30:54.000Z | 2022-03-30T04:09:28.000Z | 15.21875 | 42 | 0.704312 | 996,453 | package com.dji.sample.manage.model.param;
import lombok.Builder;
import lombok.Data;
/**
* The object of the device query field.
*
* @author sean.zhou
* @date 2021/11/16
* @version 0.1
*/
@Data
@Builder
public class DeviceQueryParam {
private String deviceSn;
private String workspaceId;
private Integer deviceType;
private Integer subType;
private Integer domain;
private String childSn;
private boolean orderBy;
private boolean isAsc;
} |
923312d7efcdff3d8543bbc653c7d5133b7935e3 | 2,686 | java | Java | src/test/java/ezvcard/util/Utf8ReaderTest.java | mangstadt/ez-vcard | 96e455b1e798b71c01973fde08d519a9659ed97d | [
"BSD-2-Clause-FreeBSD"
] | 368 | 2015-03-27T12:37:51.000Z | 2022-02-28T11:20:00.000Z | src/test/java/ezvcard/util/Utf8ReaderTest.java | mangstadt/ez-vcard | 96e455b1e798b71c01973fde08d519a9659ed97d | [
"BSD-2-Clause-FreeBSD"
] | 98 | 2015-05-06T20:44:18.000Z | 2022-03-11T16:36:53.000Z | src/test/java/ezvcard/util/Utf8ReaderTest.java | mangstadt/ez-vcard | 96e455b1e798b71c01973fde08d519a9659ed97d | [
"BSD-2-Clause-FreeBSD"
] | 103 | 2015-03-25T23:53:00.000Z | 2021-12-12T20:15:12.000Z | 34 | 81 | 0.774013 | 996,454 | package ezvcard.util;
import static org.junit.Assert.assertEquals;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStreamWriter;
import java.io.Writer;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
/*
Copyright (c) 2012-2021, Michael Angstadt
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
The views and conclusions contained in the software and documentation are those
of the authors and should not be interpreted as representing official policies,
either expressed or implied, of the FreeBSD Project.
*/
/**
* @author Michael Angstadt
*/
public class Utf8ReaderTest {
@Rule
public TemporaryFolder folder = new TemporaryFolder();
@Test
public void inputStream() throws Exception {
String data = "one two three";
byte bytes[] = data.getBytes("UTF-8");
Utf8Reader reader = new Utf8Reader(new ByteArrayInputStream(bytes));
String expected = data;
String actual = new Gobble(reader).asString();
assertEquals(expected, actual);
}
@Test
public void file() throws Exception {
String data = "one two three";
File file = folder.newFile();
Writer writer = new OutputStreamWriter(new FileOutputStream(file), "UTF-8");
writer.write(data);
writer.close();
Utf8Reader reader = new Utf8Reader(file);
String expected = data;
String actual = new Gobble(reader).asString();
assertEquals(expected, actual);
}
}
|
92331376f1d3b7516fcbdc33c7fddb6091d11b8e | 794 | java | Java | minecraft/net/minecraft/block/BlockLeavesBase.java | MrTheShy/Minecraft-Hack-BaseClient | 5801f7c573b2148f730f364ef6ba1b5b433c8e59 | [
"MIT"
] | 253 | 2020-04-15T11:39:44.000Z | 2022-03-28T02:15:10.000Z | minecraft/net/minecraft/block/BlockLeavesBase.java | MrTheShy/Minecraft-Hack-BaseClient | 5801f7c573b2148f730f364ef6ba1b5b433c8e59 | [
"MIT"
] | 82 | 2020-02-02T05:36:58.000Z | 2022-03-27T01:04:10.000Z | minecraft/net/minecraft/block/BlockLeavesBase.java | MrTheShy/Minecraft-Hack-BaseClient | 5801f7c573b2148f730f364ef6ba1b5b433c8e59 | [
"MIT"
] | 64 | 2020-03-28T23:43:33.000Z | 2022-03-18T22:34:52.000Z | 28.357143 | 135 | 0.779597 | 996,455 | package net.minecraft.block;
import net.minecraft.block.material.Material;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.IBlockAccess;
public class BlockLeavesBase extends Block {
protected boolean fancyGraphics;
protected BlockLeavesBase(Material materialIn, boolean fancyGraphics) {
super(materialIn);
this.fancyGraphics = fancyGraphics;
}
/**
* Used to determine ambient occlusion and culling when rebuilding chunks for
* render
*/
public boolean isOpaqueCube() {
return false;
}
public boolean shouldSideBeRendered(IBlockAccess worldIn, BlockPos pos, EnumFacing side) {
return !this.fancyGraphics && worldIn.getBlockState(pos).getBlock() == this ? false : super.shouldSideBeRendered(worldIn, pos, side);
}
}
|
9233145d7f8be000470f237d8cec5b835a2036db | 5,368 | java | Java | src/test/java/fr/paris/lutece/portal/web/xpages/SiteMapAppCycleTest.java | rzara/lutece-core | 2b2adb79a778389f0e768237b6264a110a245898 | [
"BSD-3-Clause"
] | 46 | 2015-01-23T00:45:32.000Z | 2021-11-20T00:51:08.000Z | src/test/java/fr/paris/lutece/portal/web/xpages/SiteMapAppCycleTest.java | rzara/lutece-core | 2b2adb79a778389f0e768237b6264a110a245898 | [
"BSD-3-Clause"
] | 105 | 2015-02-05T18:05:12.000Z | 2022-02-11T14:57:28.000Z | src/test/java/fr/paris/lutece/portal/web/xpages/SiteMapAppCycleTest.java | rzara/lutece-core | 2b2adb79a778389f0e768237b6264a110a245898 | [
"BSD-3-Clause"
] | 46 | 2015-06-08T07:22:54.000Z | 2022-01-14T12:59:10.000Z | 35.084967 | 115 | 0.681446 | 996,456 | /*
* Copyright (c) 2002-2021, City of Paris
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright notice
* and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice
* and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of 'Mairie de Paris' nor 'Lutece' nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* License 1.0
*/
package fr.paris.lutece.portal.web.xpages;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.security.SecureRandom;
import java.util.Properties;
import org.springframework.mock.web.MockHttpServletRequest;
import fr.paris.lutece.portal.business.page.Page;
import fr.paris.lutece.portal.business.style.PageTemplateHome;
import fr.paris.lutece.portal.service.page.IPageService;
import fr.paris.lutece.portal.service.portal.PortalService;
import fr.paris.lutece.portal.service.spring.SpringContextService;
import fr.paris.lutece.portal.service.util.AppLogService;
import fr.paris.lutece.portal.service.util.AppPropertiesService;
import fr.paris.lutece.test.LuteceTestCase;
/**
* Tests that a cycle in the page hierarchy is handled by the site map
*/
public class SiteMapAppCycleTest extends LuteceTestCase
{
private Page _top;
private Page _middle;
private Page _bottom;
private IPageService _pageService;
private int _nInitialRootId;
@Override
protected void setUp( ) throws Exception
{
super.setUp( );
_pageService = ( IPageService ) SpringContextService.getBean( "pageService" );
// create pages
_top = getPage( null );
_middle = getPage( _top.getId( ) );
_bottom = getPage( _middle.getId( ) );
// set up the cyle
_top.setParentPageId( _bottom.getId( ) );
_pageService.updatePage( _top );
// change root id
_nInitialRootId = PortalService.getRootPageId( );
setRootPageId( _top.getId( ) );
}
private Page getPage( Integer parentId )
{
Page page = new Page( );
if ( parentId != null )
{
page.setParentPageId( parentId );
}
page.setPageTemplateId( PageTemplateHome.getPageTemplatesList( ).get( 0 ).getId( ) );
page.setName( "page" + new SecureRandom( ).nextLong( ) );
_pageService.createPage( page );
return page;
}
@Override
protected void tearDown( ) throws Exception
{
removePageQuietly( _bottom.getId( ) );
removePageQuietly( _middle.getId( ) );
removePageQuietly( _top.getId( ) );
setRootPageId( _nInitialRootId );
super.tearDown( );
}
private void setRootPageId( int nRootPageId ) throws IOException
{
AppLogService.info( "Setting root page id to " + nRootPageId );
File luteceProperties = new File( getResourcesDir( ), "WEB-INF/conf/lutece.properties" );
Properties props = new Properties( );
try ( InputStream is = new FileInputStream( luteceProperties ) )
{
props.load( is );
}
props.setProperty( "lutece.page.root", Integer.toString( nRootPageId ) );
try ( OutputStream os = new FileOutputStream( luteceProperties ) )
{
props.store( os, "saved for junit " + this.getClass( ).getCanonicalName( ) );
}
AppPropertiesService.reloadAll( );
}
private void removePageQuietly( int nPageId )
{
try
{
_pageService.removePage( nPageId );
}
catch ( Throwable t )
{
AppLogService.error( "Could not remove page " + nPageId, t );
}
}
public void testGetPage( )
{
SiteMapApp app = new SiteMapApp( );
XPage res = app.getPage( new MockHttpServletRequest( ), 0, null );
assertNotNull( res );
assertTrue( "SiteMap should contain reference to page", res.getContent( ).contains( _middle.getName( ) ) );
assertTrue( "SiteMap should contain reference to page", res.getContent( ).contains( _bottom.getName( ) ) );
}
}
|
9233155297872bd86b1d8ac71afd54ef2af2b4be | 6,282 | java | Java | src/test/java/org/jitsi/meet/test/pageobjects/web/SettingsDialog.java | TheNetStriker/jitsi-meet-torture | bb0c9629002dd920c91444a204f59b0c5a898810 | [
"Apache-2.0"
] | 1 | 2022-03-17T21:42:13.000Z | 2022-03-17T21:42:13.000Z | src/test/java/org/jitsi/meet/test/pageobjects/web/SettingsDialog.java | TheNetStriker/jitsi-meet-torture | bb0c9629002dd920c91444a204f59b0c5a898810 | [
"Apache-2.0"
] | null | null | null | src/test/java/org/jitsi/meet/test/pageobjects/web/SettingsDialog.java | TheNetStriker/jitsi-meet-torture | bb0c9629002dd920c91444a204f59b0c5a898810 | [
"Apache-2.0"
] | 1 | 2020-06-20T21:37:28.000Z | 2020-06-20T21:37:28.000Z | 28.816514 | 80 | 0.637695 | 996,457 | package org.jitsi.meet.test.pageobjects.web;
import org.jitsi.meet.test.util.*;
import org.jitsi.meet.test.web.*;
import org.openqa.selenium.*;
import org.openqa.selenium.support.ui.*;
import java.util.*;
public class SettingsDialog
{
/**
* Selectors to be used for finding WebElements within the
* {@link SettingsDialog}. While most are CSS selectors, some are XPath
* selectors, and prefixed as such, due to the extra functionality XPath
* provides.
*/
private final static String DISPLAY_NAME_FIELD
= "#setDisplayName";
private final static String EMAIL_FIELD = "#setEmail";
private final static String FOLLOW_ME_CHECKBOX = "[name='follow-me']";
private final static String MORE_TAB_CONTENT = ".more-tab";
private final static String SETTINGS_DIALOG = ".settings-dialog";
private final static String SETTINGS_DIALOG_CONTENT = ".settings-pane";
private final static String START_AUDIO_MUTED_CHECKBOX
= "[name='start-audio-muted']";
private final static String START_VIDEO_MUTED_CHECKBOX
= "[name='start-video-muted']";
private final static String X_PATH_MORE_TAB
= "//div[contains(@class, 'settings-dialog')]//*[text()='More']";
private final static String X_PATH_PROFILE_TAB
= "//div[contains(@class, 'settings-dialog')]//*[text()='Profile']";
/**
* The participant.
*/
private final WebParticipant participant;
/**
* Initializes a new {@link SettingsDialog} instance.
* @param participant the participant for this {@link SettingsDialog}.
*/
public SettingsDialog(WebParticipant participant)
{
this.participant = Objects.requireNonNull(participant, "participant");
}
/**
* Clicks the cancel button on the settings dialog to close the dialog
* without saving any changes.
*/
public void close()
{
ModalDialogHelper.clickCancelButton(participant.getDriver());
}
/**
* Returns the participant's display name displayed in the settings dialog.
*
* @return {@code string} The display name displayed in the settings dialog.
*/
public String getDisplayName()
{
openProfileTab();
return participant.getDriver()
.findElement(By.cssSelector(DISPLAY_NAME_FIELD))
.getAttribute("value");
}
/**
* Returns the participant's email displayed in the settings dialog.
*
* @return {@code string} The email displayed in the settings dialog.
*/
public String getEmail()
{
openProfileTab();
return participant.getDriver()
.findElement(By.cssSelector(EMAIL_FIELD))
.getAttribute("value");
}
/**
* Returns whether or not the Follow Me checkbox is visible to the user in
* the settings dialog.
*
* @return {@code boolean} True if the Follow Me checkbox is visible to the
* user.
*/
public boolean isFollowMeDisplayed()
{
openMoreTab();
WebDriver driver = participant.getDriver();
List<WebElement> followMeCheckboxes
= driver.findElements(By.cssSelector(FOLLOW_ME_CHECKBOX));
return followMeCheckboxes.size() > 0;
}
/**
* Selects the More tab to be displayed.
*/
public void openMoreTab()
{
openTab(X_PATH_MORE_TAB);
TestUtils.waitForElementBy(
participant.getDriver(),
By.cssSelector(MORE_TAB_CONTENT),
5);
}
/**
* Selects the Profile tab to be displayed.
*/
public void openProfileTab()
{
openTab(X_PATH_PROFILE_TAB);
}
/**
* Enters the passed in email into the email field.
*/
public void setEmail(String email)
{
openProfileTab();
WebDriver driver = participant.getDriver();
driver.findElement(By.cssSelector(EMAIL_FIELD)).sendKeys(email);
}
/**
* Sets the option for having other participants automatically perform the
* actions performed by the local participant.
*/
public void setFollowMe(boolean enable)
{
openMoreTab();
setCheckbox(FOLLOW_ME_CHECKBOX, enable);
}
/**
* Sets the option for having participants join as audio muted.
*/
public void setStartAudioMuted(boolean enable)
{
openMoreTab();
setCheckbox(START_AUDIO_MUTED_CHECKBOX, enable);
}
/**
* Sets the option for having participants join as video muted.
*/
public void setStartVideoMuted(boolean enable)
{
openMoreTab();
setCheckbox(START_VIDEO_MUTED_CHECKBOX, enable);
}
/**
* Clicks the OK button on the settings dialog to close the dialog
* and save any changes made.
*/
public void submit()
{
ModalDialogHelper.clickOKButton(participant.getDriver());
}
/**
* Waits for the settings dialog to be visible.
*/
public void waitForDisplay()
{
TestUtils.waitForElementBy(
participant.getDriver(),
By.cssSelector(SETTINGS_DIALOG),
5);
TestUtils.waitForElementBy(
participant.getDriver(),
By.cssSelector(SETTINGS_DIALOG_CONTENT),
5);
}
/**
* Displays a specific tab in the settings dialog.
*/
private void openTab(String xPathSelectorForTab)
{
WebDriver driver = participant.getDriver();
TestUtils.waitForElementBy(driver, By.xpath(xPathSelectorForTab), 5);
WebDriverWait wait = new WebDriverWait(driver, 10);
WebElement element = wait.until(ExpectedConditions.elementToBeClickable(
By.xpath(xPathSelectorForTab)));
element.click();
}
/**
* Sets the state checked/selected of a checkbox in the settings dialog.
*/
private void setCheckbox(String cssSelector, boolean check)
{
WebDriver driver = participant.getDriver();
TestUtils.waitForElementBy(driver, By.cssSelector(cssSelector), 5);
WebElement checkbox = driver.findElement(By.cssSelector(cssSelector));
boolean isChecked = checkbox.isSelected();
if (check != isChecked) {
checkbox.click();
}
}
}
|
92331569c6baa50b6f4ea9239117e308274ee5e3 | 317 | java | Java | aws-cdk-maven-plugin/src/it/synth-deploy-lambda-function/cdk-stack/src/main/java/io/linguarobot/aws/cdk/maven/it/DeployLambdaFunctionTestApp.java | maciejwalkowiak/aws-cdk-maven-plugin | 4be1c79a30390cbdcba39a882d0ff2d2ca0f990b | [
"Apache-2.0"
] | 14 | 2020-06-17T13:38:27.000Z | 2022-03-17T06:43:31.000Z | aws-cdk-maven-plugin/src/it/synth-deploy-lambda-function/cdk-stack/src/main/java/io/linguarobot/aws/cdk/maven/it/DeployLambdaFunctionTestApp.java | maciejwalkowiak/aws-cdk-maven-plugin | 4be1c79a30390cbdcba39a882d0ff2d2ca0f990b | [
"Apache-2.0"
] | 523 | 2020-06-15T08:32:11.000Z | 2022-03-31T07:03:24.000Z | aws-cdk-maven-plugin/src/it/synth-deploy-lambda-function/cdk-stack/src/main/java/io/linguarobot/aws/cdk/maven/it/DeployLambdaFunctionTestApp.java | sullis/aws-cdk-maven-plugin | 4be1c79a30390cbdcba39a882d0ff2d2ca0f990b | [
"Apache-2.0"
] | 2 | 2020-08-03T02:24:25.000Z | 2021-02-08T23:56:09.000Z | 21.133333 | 84 | 0.687697 | 996,458 | package io.linguarobot.aws.cdk.maven.it;
import software.amazon.awscdk.core.App;
public class DeployLambdaFunctionTestApp {
public static void main(String[] args) {
App app = new App();
new DeployLambdaFunctionTestStack(app, "deploy-lambda-function-test-stack");
app.synth();
}
}
|
923315741133c43a8537faa30ce706620f26df2f | 1,373 | java | Java | src/main/java/com/fuckmyclassic/rsync/RsyncOutputProcessor.java | skogaby/fuckmyclassic | ae85cfc4b80afc34580aa66f47839b8bebbc20bb | [
"Apache-2.0"
] | 3 | 2018-04-27T02:02:55.000Z | 2021-02-15T17:37:16.000Z | src/main/java/com/fuckmyclassic/rsync/RsyncOutputProcessor.java | skogaby/fuckmyclassic | ae85cfc4b80afc34580aa66f47839b8bebbc20bb | [
"Apache-2.0"
] | null | null | null | src/main/java/com/fuckmyclassic/rsync/RsyncOutputProcessor.java | skogaby/fuckmyclassic | ae85cfc4b80afc34580aa66f47839b8bebbc20bb | [
"Apache-2.0"
] | null | null | null | 28.75 | 104 | 0.728261 | 996,459 | package com.fuckmyclassic.rsync;
import com.github.fracpete.processoutput4j.core.StreamingProcessOutputType;
import com.github.fracpete.processoutput4j.core.StreamingProcessOwner;
/**
* Implementation of StreamingProcessOwner, so we can process the output of rsync in realtime and update
* the UI appropriately.
* @author skogaby (dycjh@example.com)
*/
public class RsyncOutputProcessor implements StreamingProcessOwner {
private RsyncOutputCallback stdoutCallback;
private RsyncOutputCallback stderrCallback;
@Override
public StreamingProcessOutputType getOutputType() {
return StreamingProcessOutputType.BOTH;
}
@Override
public void processOutput(String line, boolean stdout) {
if (stdout) {
stdoutCallback.process(line);
} else {
stderrCallback.process(line);
}
}
public RsyncOutputCallback getStdoutCallback() {
return stdoutCallback;
}
public RsyncOutputProcessor setStdoutCallback(RsyncOutputCallback stdoutCallback) {
this.stdoutCallback = stdoutCallback;
return this;
}
public RsyncOutputCallback getStderrCallback() {
return stderrCallback;
}
public RsyncOutputProcessor setStderrCallback(RsyncOutputCallback stderrCallback) {
this.stderrCallback = stderrCallback;
return this;
}
}
|
923315b6a081f27d4d6b2d2bc76fa0d538d840bf | 4,010 | java | Java | httpserver/src/main/java/io/esastack/httpserver/impl/MultipartHandle.java | alalag1/esa-httpserver | 1fc3cf82ce50cbf4af8a0838c87c382764a173eb | [
"Apache-2.0"
] | 79 | 2020-12-03T09:49:10.000Z | 2022-03-27T12:09:50.000Z | httpserver/src/main/java/io/esastack/httpserver/impl/MultipartHandle.java | alalag1/esa-httpserver | 1fc3cf82ce50cbf4af8a0838c87c382764a173eb | [
"Apache-2.0"
] | 11 | 2020-12-03T08:46:17.000Z | 2021-11-26T02:58:45.000Z | httpserver/src/main/java/io/esastack/httpserver/impl/MultipartHandle.java | alalag1/esa-httpserver | 1fc3cf82ce50cbf4af8a0838c87c382764a173eb | [
"Apache-2.0"
] | 14 | 2020-12-06T08:07:46.000Z | 2022-03-07T08:52:00.000Z | 32.33871 | 102 | 0.630923 | 996,460 | /*
* Copyright 2020 OPPO ESA Stack Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.esastack.httpserver.impl;
import esa.commons.ExceptionUtils;
import esa.commons.collection.LinkedMultiValueMap;
import esa.commons.collection.MultiMaps;
import esa.commons.collection.MultiValueMap;
import io.esastack.httpserver.core.MultiPart;
import io.esastack.httpserver.core.MultipartFile;
import io.esastack.httpserver.utils.Loggers;
import io.netty.buffer.ByteBuf;
import io.netty.handler.codec.http.DefaultHttpContent;
import io.netty.handler.codec.http.LastHttpContent;
import io.netty.handler.codec.http.multipart.Attribute;
import io.netty.handler.codec.http.multipart.FileUpload;
import io.netty.handler.codec.http.multipart.HttpPostRequestDecoder;
import io.netty.handler.codec.http.multipart.InterfaceHttpData;
import java.io.IOException;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
final class MultipartHandle implements MultiPart {
static final Empty EMPTY = new Empty();
private final HttpPostRequestDecoder decoder;
private List<MultipartFile> files;
private MultiValueMap<String, String> attrs;
MultipartHandle(HttpPostRequestDecoder decoder) {
this.decoder = decoder;
}
@Override
public List<MultipartFile> uploadFiles() {
if (files == null) {
return EMPTY.uploadFiles();
}
return files;
}
@Override
public MultiValueMap<String, String> attributes() {
if (attrs == null) {
return EMPTY.attributes();
}
return attrs;
}
void onData(ByteBuf buf) {
decoder.offer(new DefaultHttpContent(buf));
}
void end() {
List<MultipartFile> files = null;
MultiValueMap<String, String> attrs = null;
try {
decoder.offer(LastHttpContent.EMPTY_LAST_CONTENT);
List<InterfaceHttpData> decoded = decoder.getBodyHttpDatas();
for (InterfaceHttpData data : decoded) {
if (InterfaceHttpData.HttpDataType.Attribute.equals(data.getHttpDataType())) {
Attribute attr = (Attribute) data;
if (attrs == null) {
attrs = new LinkedMultiValueMap<>();
}
attrs.add(attr.getName(), attr.getValue());
} else if (InterfaceHttpData.HttpDataType.FileUpload.equals(data.getHttpDataType())) {
if (files == null) {
files = new LinkedList<>();
}
files.add(new MultipartFileImpl((FileUpload) data));
}
}
if (files != null) {
this.files = files;
}
if (attrs != null) {
this.attrs = attrs;
}
} catch (IOException e) {
ExceptionUtils.throwException(e);
}
}
void release() {
try {
decoder.destroy();
} catch (Exception e) {
Loggers.logger().warn(
"Unexpected error while releasing multipart resources", e);
}
}
private static class Empty implements MultiPart {
@Override
public List<MultipartFile> uploadFiles() {
return Collections.emptyList();
}
@Override
public MultiValueMap<String, String> attributes() {
return MultiMaps.emptyMultiMap();
}
}
}
|
923315bbbe96b850503f92372e34d5d7f6cede28 | 656 | java | Java | hw4-spring-boot-init-quiz/src/main/java/ru/otus/hw4springbootinitquiz/service/IOServiceStreams.java | Etoneon/ot-spring-2022 | 3c6827973198d5efa4e9aab766aec84bd808e1b9 | [
"MIT"
] | null | null | null | hw4-spring-boot-init-quiz/src/main/java/ru/otus/hw4springbootinitquiz/service/IOServiceStreams.java | Etoneon/ot-spring-2022 | 3c6827973198d5efa4e9aab766aec84bd808e1b9 | [
"MIT"
] | null | null | null | hw4-spring-boot-init-quiz/src/main/java/ru/otus/hw4springbootinitquiz/service/IOServiceStreams.java | Etoneon/ot-spring-2022 | 3c6827973198d5efa4e9aab766aec84bd808e1b9 | [
"MIT"
] | null | null | null | 23.428571 | 81 | 0.705793 | 996,461 | package ru.otus.hw4springbootinitquiz.service;
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Scanner;
public class IOServiceStreams implements IOService {
private final PrintStream output;
private final Scanner input;
public IOServiceStreams( PrintStream outputStream, InputStream inputStream) {
output = outputStream;
input = new Scanner(inputStream, "Cp866");
}
@Override
public void outputString(String s){
output.println(s);
}
@Override
public String readStringWithPrompt(String prompt){
outputString(prompt);
return input.nextLine();
}
}
|
9233173d1cc2a14e8e20c95592b29c7f17340a31 | 4,718 | java | Java | src/main/java/lintcode/bfs/_258_Map_Jump.java | lveay2/algorithm-solutions | 249d8f3a89971bca4ff21f6e6845a4035e8e3c90 | [
"Apache-2.0"
] | null | null | null | src/main/java/lintcode/bfs/_258_Map_Jump.java | lveay2/algorithm-solutions | 249d8f3a89971bca4ff21f6e6845a4035e8e3c90 | [
"Apache-2.0"
] | null | null | null | src/main/java/lintcode/bfs/_258_Map_Jump.java | lveay2/algorithm-solutions | 249d8f3a89971bca4ff21f6e6845a4035e8e3c90 | [
"Apache-2.0"
] | null | null | null | 43.284404 | 112 | 0.429419 | 996,462 | package lintcode.bfs;
import java.util.Arrays;
import java.util.Comparator;
import java.util.PriorityQueue;
import java.util.Queue;
public class _258_Map_Jump {
public static int mapJump(int[][] arr) {
int[] dx = {0, 0, 1, -1};
int[] dy = {1, -1, 0, 0};
int n = arr.length;
int m = arr[0].length;
int[][] result = new int[n][m];
for (int[] row : result) {
Arrays.fill(row, Integer.MAX_VALUE);
}
Queue<Point> queue = new PriorityQueue<>(Comparator.comparingInt(a -> a.target));
queue.offer(new Point(0, 0, 0));
while (!queue.isEmpty()) {
Point cp = queue.poll();
result[cp.x][cp.y] = cp.target;
if (cp.x == n - 1 && cp.y == m - 1) {
return cp.target;
}
// System.out.println("cp [" + cp.x + ", " + cp.y + "]: " + arr[cp.x][cp.y]);
for (int i = 0; i < 4; i++) {
int x = cp.x + dx[i];
int y = cp.y + dy[i];
if (0 <= x && x < n && 0 <= y && y < m) {
// System.out.println("[" + x + ", " + y + "]: " + arr[x][y]);
int currentTarget = Math.max(cp.target, Math.abs(arr[x][y] - arr[cp.x][cp.y]));
if (currentTarget >= result[x][y]) {
continue;
}
queue.offer(new Point(x, y, currentTarget));
}
}
}
return -1;
}
static class Point {
int x;
int y;
int target;
Point(int x, int y, int target) {
this.x = x;
this.y = y;
this.target = target;
}
}
public static void main(String[] args) {
System.out.println(mapJump(new int[][]{
{1, 5}, {6, 2}
}));
System.out.println(mapJump(new int[][]{
{0, 26, 79, 85, 85, 22, 20, 24, 37, 87},
{76, 89, 79, 22, 14, 55, 58, 89, 6, 77},
{29, 38, 98, 24, 14, 26, 48, 96, 32, 16},
{76, 84, 75, 20, 7, 94, 48, 67, 40, 22},
{59, 4, 49, 53, 61, 40, 66, 33, 61, 6},
{10, 55, 25, 96, 10, 10, 17, 34, 90, 70},
{84, 53, 61, 67, 53, 50, 56, 46, 48, 56},
{62, 25, 9, 74, 26, 27, 37, 97, 53, 94},
{12, 54, 95, 29, 14, 27, 60, 56, 92, 32},
{47, 86, 82, 32, 49, 57, 50, 63, 11, 20}
}));
System.out.println(mapJump(new int[][]{
{61, 15, 12, 150, 121, 145, 179, 80, 166, 67, 66, 180, 119, 110, 94, 71, 81, 91, 126, 9},
{185, 35, 110, 132, 23, 175, 99, 155, 137, 113, 53, 173, 11, 107, 76, 2, 198, 190, 92, 141},
{198, 190, 43, 154, 89, 108, 109, 171, 181, 68, 77, 62, 57, 65, 143, 17, 158, 69, 83, 136},
{159, 45, 197, 54, 95, 124, 11, 130, 186, 150, 127, 4, 175, 24, 54, 121, 164, 183, 48, 131},
{91, 46, 184, 140, 139, 196, 14, 124, 186, 62, 155, 81, 10, 176, 13, 15, 105, 49, 188, 129},
{62, 80, 76, 190, 160, 2, 28, 15, 193, 182, 62, 95, 171, 194, 32, 148, 146, 94, 155, 14},
{58, 18, 178, 158, 154, 76, 44, 89, 10, 4, 174, 181, 0, 52, 83, 26, 129, 186, 133, 132},
{119, 0, 121, 49, 30, 46, 109, 182, 11, 38, 53, 183, 7, 33, 151, 54, 48, 168, 20, 12},
{56, 173, 40, 94, 3, 186, 43, 81, 171, 42, 137, 89, 78, 151, 111, 79, 155, 36, 71, 161},
{168, 156, 182, 70, 176, 171, 147, 18, 43, 188, 123, 127, 102, 170, 131, 69, 132, 18, 174, 163},
{149, 96, 112, 62, 71, 162, 145, 153, 42, 131, 46, 62, 144, 192, 100, 20, 53, 192, 38, 186},
{51, 119, 154, 154, 185, 12, 23, 26, 45, 132, 178, 55, 175, 110, 33, 82, 24, 9, 15, 8},
{68, 26, 129, 188, 28, 139, 88, 120, 102, 24, 136, 85, 48, 131, 137, 151, 19, 147, 100, 44},
{29, 32, 144, 13, 138, 11, 13, 142, 28, 84, 72, 91, 152, 123, 121, 28, 34, 139, 146, 163},
{36, 27, 153, 67, 171, 7, 79, 51, 163, 55, 146, 195, 164, 199, 15, 103, 101, 191, 164, 185},
{96, 195, 118, 156, 126, 181, 94, 134, 76, 81, 25, 117, 110, 26, 72, 109, 83, 11, 109, 97},
{89, 81, 48, 41, 91, 31, 89, 26, 112, 42, 174, 20, 110, 166, 71, 160, 134, 96, 184, 9},
{26, 141, 31, 125, 124, 11, 47, 11, 177, 127, 108, 199, 46, 103, 31, 131, 49, 9, 12, 97},
{60, 51, 163, 39, 173, 69, 76, 41, 65, 164, 71, 85, 18, 8, 90, 99, 23, 72, 132, 28},
{172, 116, 178, 13, 193, 99, 191, 76, 103, 198, 154, 34, 143, 12, 154, 161, 189, 24, 93, 175}
}));
}
}
|
923317e3dd5cd7ff64e642bc2d07932807ebf65f | 1,667 | java | Java | src/main/java/org/nightcrawler/domain/crawler/strategy/HandlingStrategy.java | adampolomski/crawler | 7e445b40dae429646655516bf80cf53ff5725cd8 | [
"Apache-2.0"
] | null | null | null | src/main/java/org/nightcrawler/domain/crawler/strategy/HandlingStrategy.java | adampolomski/crawler | 7e445b40dae429646655516bf80cf53ff5725cd8 | [
"Apache-2.0"
] | null | null | null | src/main/java/org/nightcrawler/domain/crawler/strategy/HandlingStrategy.java | adampolomski/crawler | 7e445b40dae429646655516bf80cf53ff5725cd8 | [
"Apache-2.0"
] | null | null | null | 28.741379 | 117 | 0.739652 | 996,463 | package org.nightcrawler.domain.crawler.strategy;
import java.net.URI;
import java.net.URL;
import java.util.function.Consumer;
import java.util.function.Function;
import com.google.common.collect.ImmutableSet;
/**
* Defines what to do with data parsed out of HTTP responses.
*
* @author Adam Polomski
*
*/
public abstract class HandlingStrategy {
public HandlingStrategy link(final URL link) { return this; };
public HandlingStrategy resource(final URI link) { return this; };
public abstract <T> T forAddress(final Function<URL, T> transformation);
public void process() {};
public static <P> HandlingStrategyBuilder<P> builder(final URL address) {
return new BaseBuilder<>(new BaseStrategy(address), ImmutableSet.builder());
}
private static class BaseBuilder<P> implements HandlingStrategyBuilder<P> {
private final BaseStrategy base;
private final ImmutableSet.Builder<Consumer<P>> handlers;
BaseBuilder(final BaseStrategy base, ImmutableSet.Builder<Consumer<P>> handlers) {
this.base = base;
this.handlers = handlers;
}
@Override
public HandlingStrategy build(final PageBuilder<P> pageBuilder) {
final Consumer<P> combinedHandler = handlers.build().stream().reduce(p -> {}, (a, b)->a.andThen(b));
return new BuildingStrategy<>(base, pageBuilder, combinedHandler);
}
@Override
public HandlingStrategyBuilder<P> copy(final URL address) {
return new BaseBuilder<>(new BaseStrategy(address), ImmutableSet.<Consumer<P>>builder().addAll(handlers.build()));
}
@Override
public HandlingStrategyBuilder<P> handler(final Consumer<P> handler) {
handlers.add(handler);
return this;
}
}
}
|
92331c3bd747be1e55687c88c83641fbe2d42dd5 | 2,632 | java | Java | text/src/main/java/org/solovyev/common/text/ListMapper.java | serso/common | 46a2a672dec426643137e7dc85a3ebf3728c1559 | [
"Apache-2.0"
] | 7 | 2015-01-26T16:00:20.000Z | 2019-06-15T01:51:51.000Z | text/src/main/java/org/solovyev/common/text/ListMapper.java | serso/common | 46a2a672dec426643137e7dc85a3ebf3728c1559 | [
"Apache-2.0"
] | 1 | 2016-08-02T03:34:44.000Z | 2016-08-02T03:34:44.000Z | text/src/main/java/org/solovyev/common/text/ListMapper.java | serso/common | 46a2a672dec426643137e7dc85a3ebf3728c1559 | [
"Apache-2.0"
] | 2 | 2016-06-28T02:21:32.000Z | 2019-04-23T02:37:36.000Z | 29.617978 | 134 | 0.584598 | 996,464 | /*
* Copyright 2013 serso aka se.solovyev
*
* 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.
*
* ---------------------------------------------------------------------
* Contact details
*
* Email: efpyi@example.com
* Site: http://se.solovyev.org
*/
package org.solovyev.common.text;
import javax.annotation.Nonnull;
import java.util.ArrayList;
import java.util.List;
public class ListMapper<E> extends CollectionMapper<List<E>, E> {
/*
**********************************************************************
*
* CONSTRUCTORS
*
**********************************************************************
*/
private ListMapper(@Nonnull Parser<E> parser, @Nonnull Formatter<E> formatter, @Nonnull String delimiter) {
super(parser, formatter, delimiter);
}
private ListMapper(@Nonnull Parser<E> parser, @Nonnull Formatter<E> formatter) {
super(parser, formatter);
}
private ListMapper(@Nonnull Mapper<E> mapper, @Nonnull String delimiter) {
super(mapper, delimiter);
}
private ListMapper(@Nonnull Mapper<E> mapper) {
super(mapper);
}
@Nonnull
public static <E> ListMapper<E> newInstance(@Nonnull Parser<E> parser, @Nonnull Formatter<E> formatter, @Nonnull String delimiter) {
return new ListMapper<E>(parser, formatter, delimiter);
}
@Nonnull
public static <E> ListMapper<E> newInstance(@Nonnull Parser<E> parser, @Nonnull Formatter<E> formatter) {
return new ListMapper<E>(parser, formatter);
}
@Nonnull
public static <E> ListMapper<E> newInstance(@Nonnull Mapper<E> mapper, @Nonnull String delimiter) {
return new ListMapper<E>(mapper, delimiter);
}
@Nonnull
public static <E> ListMapper<E> newInstance(@Nonnull Mapper<E> mapper) {
return new ListMapper<E>(mapper);
}
/*
**********************************************************************
*
* METHODS
*
**********************************************************************
*/
@Nonnull
@Override
protected List<E> newCollection() {
return new ArrayList<E>();
}
}
|
923320275a95eb37e9c8309534de3a30d4c4fd05 | 90 | java | Java | PlayFabClientSDK/src/com/playfab/MatchmakeStatus.java | nathancassano/PlayFabJavaAndroidSDK | bd9253fc66f17d40960e1ade9063ce7aef178a2d | [
"Apache-2.0"
] | null | null | null | PlayFabClientSDK/src/com/playfab/MatchmakeStatus.java | nathancassano/PlayFabJavaAndroidSDK | bd9253fc66f17d40960e1ade9063ce7aef178a2d | [
"Apache-2.0"
] | null | null | null | PlayFabClientSDK/src/com/playfab/MatchmakeStatus.java | nathancassano/PlayFabJavaAndroidSDK | bd9253fc66f17d40960e1ade9063ce7aef178a2d | [
"Apache-2.0"
] | null | null | null | 9 | 27 | 0.766667 | 996,465 | package com.playfab;
public enum MatchmakeStatus
{
Complete,
Waiting,
GameNotFound
}
|
9233217a6c96d959a3ab0e6bffe60e857d93694a | 2,152 | java | Java | platform/api.annotations.common/src/org/netbeans/api/annotations/common/StaticResource.java | tusharvjoshi/incubator-netbeans | a61bd21f4324f7e73414633712522811cb20ac93 | [
"Apache-2.0"
] | 1,056 | 2019-04-25T20:00:35.000Z | 2022-03-30T04:46:14.000Z | platform/api.annotations.common/src/org/netbeans/api/annotations/common/StaticResource.java | tusharvjoshi/incubator-netbeans | a61bd21f4324f7e73414633712522811cb20ac93 | [
"Apache-2.0"
] | 1,846 | 2019-04-25T20:50:05.000Z | 2022-03-31T23:40:41.000Z | platform/api.annotations.common/src/org/netbeans/api/annotations/common/StaticResource.java | tusharvjoshi/incubator-netbeans | a61bd21f4324f7e73414633712522811cb20ac93 | [
"Apache-2.0"
] | 550 | 2019-04-25T20:04:33.000Z | 2022-03-25T17:43:01.000Z | 38.428571 | 106 | 0.741171 | 996,466 | /*
* 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.netbeans.api.annotations.common;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Marker for a constant representing a static resource.
* The annotated field must be a compile-time {@code String} constant whose value denotes a resource path.
* For example, the resource might be an icon path intended for {@code ImageUtilities.loadImage}.
* The primary purpose of the annotation is for its processor, which will signal a compile-time error
* if the resource does not in fact exist - ensuring that at least this usage will not be accidentally
* broken by moving, renaming, or deleting the resource.
* @since 1.13
*/
@Target(ElementType.FIELD)
@Retention(RetentionPolicy.SOURCE)
@Documented
public @interface StaticResource {
/**
* If true, permit the resource to be in the classpath.
* By default, it may only be in the sourcepath.
*/
boolean searchClasspath() default false;
/**
* If true, consider the resource path to be relative to the current package.
* ({@code ../} sequences are permitted.)
* By default, it must be an absolute path (not starting with {@code /}).
*/
boolean relative() default false;
}
|
923321a338e17d8c6d6841dc8c818684ad7236f0 | 789 | java | Java | src/javase/util/mail/Mail.java | liuyangspace/java-test | 67a3d18fae1854aff4f38dff40dca75fda204933 | [
"MIT"
] | null | null | null | src/javase/util/mail/Mail.java | liuyangspace/java-test | 67a3d18fae1854aff4f38dff40dca75fda204933 | [
"MIT"
] | null | null | null | src/javase/util/mail/Mail.java | liuyangspace/java-test | 67a3d18fae1854aff4f38dff40dca75fda204933 | [
"MIT"
] | null | null | null | 24.090909 | 63 | 0.539623 | 996,467 | package javase.util.mail;
/**
* 邮件协议:
* SMTP (Simple Mail Transport Protocol) // 发邮件
* [telnet smtp.qq.com 25]
* Ehlo(SP)<域名>(CRLF) // 与服务器通讯
* Auth(SP>Login(CRLF) // 请求登录
* (base64(username))(CRLF)
* (base64(password))(CRLF)
* Mail(SP)From:(everse-path)(CRLF) upchh@example.com
* Rcpt(SP)To:(forword-path)(CRLF) dycjh@example.com
* Data(CRLF) //以下是数据
* from:<(reverse-path)>(CRLF)
* to:<(forword-path)>(CRLF)
* subject:(forword-path)(CRLF)
* (CRLF)
* ...
* .
* Quit(CRLF) //退出
* pop3 (Post Office Protocol 3) // 收邮件
* [telnet pop3.qq.com 110]
*
* IMAP // 新协议 发邮件也可以收邮件
*
* @see javax.mail
* @see javax.activation
* @see com.sun.mail
*/
public class Mail {
}
|
923321e5b2055274dcff6660e530e4e4b0730fde | 2,364 | java | Java | src/java/main/esg/security/attr/service/api/exceptions/SAMLAttributeServiceClientException.java | alaniwi/esgf-security | 9459e47802dbb09675a02f267055edafa3e225e7 | [
"BSD-3-Clause"
] | null | null | null | src/java/main/esg/security/attr/service/api/exceptions/SAMLAttributeServiceClientException.java | alaniwi/esgf-security | 9459e47802dbb09675a02f267055edafa3e225e7 | [
"BSD-3-Clause"
] | 10 | 2015-11-19T13:47:11.000Z | 2019-05-20T16:52:15.000Z | src/java/main/esg/security/attr/service/api/exceptions/SAMLAttributeServiceClientException.java | alaniwi/esgf-security | 9459e47802dbb09675a02f267055edafa3e225e7 | [
"BSD-3-Clause"
] | 3 | 2015-02-20T14:09:25.000Z | 2018-10-22T22:14:01.000Z | 49.25 | 244 | 0.725888 | 996,468 | /*******************************************************************************
* Copyright (c) 2011 Earth System Grid Federation
* ALL RIGHTS RESERVED.
* U.S. Government sponsorship acknowledged.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* Neither the name of the <ORGANIZATION> nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
******************************************************************************/
/**
* Earth System Grid/CMIP5
*
* Date: 15/10/10
*
* Copyright: (C) 2010 Science and Technology Facilities Council
*
* Licence: BSD
*
* @author pjkersha
*/
package esg.security.attr.service.api.exceptions;
public class SAMLAttributeServiceClientException extends Exception {
/**
* Exception type for SAMLAttributeServiceClient interface
*/
private static final long serialVersionUID = -5202255233461601883L;
public SAMLAttributeServiceClientException(String message,
Exception e) {
super(message, e);
}
public SAMLAttributeServiceClientException(String message) {
super(message);
}
}
|
923321f47d35c9b4c77ce1418904fdaad8dd9180 | 742 | java | Java | gmall-pms-interface/src/main/java/com/atguigu/gmall/pms/entity/BrandEntity.java | whalse-su/gmall | 6527efb89e143e824a3707272edfc1f9e5c79648 | [
"Apache-2.0"
] | null | null | null | gmall-pms-interface/src/main/java/com/atguigu/gmall/pms/entity/BrandEntity.java | whalse-su/gmall | 6527efb89e143e824a3707272edfc1f9e5c79648 | [
"Apache-2.0"
] | null | null | null | gmall-pms-interface/src/main/java/com/atguigu/gmall/pms/entity/BrandEntity.java | whalse-su/gmall | 6527efb89e143e824a3707272edfc1f9e5c79648 | [
"Apache-2.0"
] | null | null | null | 14.269231 | 53 | 0.661725 | 996,469 | package com.atguigu.gmall.pms.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serializable;
/**
* 品牌
*
* @author Whale_Su
* @email envkt@example.com
* @date 2020-10-28 16:54:26
*/
@Data
@TableName("pms_brand")
public class BrandEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 品牌id
*/
@TableId
private Long id;
/**
* 品牌名
*/
private String name;
/**
* 品牌logo
*/
private String logo;
/**
* 显示状态[0-不显示;1-显示]
*/
private Integer status;
/**
* 检索首字母
*/
private String firstLetter;
/**
* 排序
*/
private Integer sort;
/**
* 备注
*/
private String remark;
}
|
923322b7e9b62081e15075080981f4255bf758f3 | 8,728 | java | Java | plugins/mps-vcs/vcs-core/modules/jetbrains.mps.ide.vcs.core/source_gen/jetbrains/mps/vcs/diff/changes/HierarchicalNodeGroupChange.java | trespasserw/MPS | dbc5c76496e8ccef46dd420eefcd5089b1bc234b | [
"Apache-2.0"
] | null | null | null | plugins/mps-vcs/vcs-core/modules/jetbrains.mps.ide.vcs.core/source_gen/jetbrains/mps/vcs/diff/changes/HierarchicalNodeGroupChange.java | trespasserw/MPS | dbc5c76496e8ccef46dd420eefcd5089b1bc234b | [
"Apache-2.0"
] | null | null | null | plugins/mps-vcs/vcs-core/modules/jetbrains.mps.ide.vcs.core/source_gen/jetbrains/mps/vcs/diff/changes/HierarchicalNodeGroupChange.java | trespasserw/MPS | dbc5c76496e8ccef46dd420eefcd5089b1bc234b | [
"Apache-2.0"
] | null | null | null | 39.672727 | 235 | 0.726627 | 996,470 | package jetbrains.mps.vcs.diff.changes;
/*Generated by MPS */
import jetbrains.mps.annotations.GeneratedClass;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import jetbrains.mps.vcs.util.MergeStrategy;
import jetbrains.mps.vcs.diff.ChangeSet;
import org.jetbrains.mps.openapi.model.SNodeId;
import jetbrains.mps.internal.collections.runtime.ListSequence;
import java.util.List;
import org.jetbrains.mps.openapi.language.SContainmentLink;
import org.jetbrains.mps.openapi.model.SModel;
import jetbrains.mps.internal.collections.runtime.Sequence;
import jetbrains.mps.internal.collections.runtime.IWhereFilter;
import jetbrains.mps.internal.collections.runtime.IVisitor;
import java.util.Collection;
import jetbrains.mps.internal.collections.runtime.CollectionSequence;
import jetbrains.mps.internal.collections.runtime.ISelector;
import jetbrains.mps.baseLanguage.tuples.runtime.Tuples;
import jetbrains.mps.errors.messageTargets.MessageTarget;
import java.util.LinkedList;
import jetbrains.mps.baseLanguage.tuples.runtime.MultiTuple;
import jetbrains.mps.errors.messageTargets.DeletedNodeMessageTarget;
import java.util.ArrayList;
import org.jetbrains.mps.openapi.model.SNode;
import jetbrains.mps.errors.messageTargets.NodeMessageTarget;
import jetbrains.mps.lang.smodel.generator.smodelAdapter.AttributeOperations;
import jetbrains.mps.vcs.mergehints.runtime.VCSAspectUtil;
import jetbrains.mps.lang.smodel.generator.smodelAdapter.SNodeOperations;
import java.util.Map;
@GeneratedClass(node = "r:9b4a89e1-ec38-42c4-b1bd-96ab47ffcb3f(jetbrains.mps.vcs.diff.changes)/8998650098108147555", model = "r:9b4a89e1-ec38-42c4-b1bd-96ab47ffcb3f(jetbrains.mps.vcs.diff.changes)")
public abstract class HierarchicalNodeGroupChange extends StructureChange {
@NotNull
private final ModifiedNodesGroup myOldGroup;
@NotNull
private final ModifiedNodesGroup myNewGroup;
@Nullable
private final MergeStrategy myMergeHint;
protected HierarchicalNodeGroupChange(@NotNull ChangeSet changeSet, @NotNull ModifiedNodesGroup oldGroup, @NotNull ModifiedNodesGroup newGroup) {
super(changeSet, calcRootId(oldGroup, newGroup));
myOldGroup = oldGroup;
myNewGroup = newGroup;
myMergeHint = createMergeHint();
}
@Nullable
private static SNodeId calcRootId(ModifiedNodesGroup oldGroup, ModifiedNodesGroup newGroup) {
assert oldGroup.isNotEmpty() || newGroup.isNotEmpty();
if (oldGroup.isNotEmpty()) {
return ListSequence.fromList(oldGroup.getModifiedNodes()).first().getNode().getContainingRoot().getNodeId();
} else {
return ListSequence.fromList(newGroup.getModifiedNodes()).first().getNode().getContainingRoot().getNodeId();
}
}
@NotNull
public ModifiedNodesGroup getGroup(boolean isNew) {
return (isNew ? myNewGroup : myOldGroup);
}
@NotNull
public List<SNodeId> getIds(boolean isNew) {
return getGroup(isNew).getIds();
}
public SNodeId getParentId(boolean isNew) {
return getGroup(isNew).getParentId();
}
public SContainmentLink getLink(boolean isNew) {
return getGroup(isNew).getLink();
}
private int getEnd(boolean isNew) {
return getGroup(isNew).getEnd();
}
public boolean isEmpty(boolean isNew) {
return getGroup(isNew).isEmpty();
}
/*package*/ static void applyChanges(Iterable<HierarchicalNodeGroupChange> changes, final SModel model, final NodeCopier nodeCopier) {
Sequence.fromIterable(changes).ofType(NodeGroupWrapChange.class).where(new IWhereFilter<NodeGroupWrapChange>() {
public boolean accept(NodeGroupWrapChange it) {
return it.isWrap();
}
}).visitAll(new IVisitor<NodeGroupWrapChange>() {
public void visit(NodeGroupWrapChange it) {
it.apply(model, nodeCopier);
}
});
Collection<NodeGroupNotMoveChange> notMoveChanges = Sequence.fromIterable(changes).ofType(NodeGroupNotMoveChange.class).toListSequence();
CollectionSequence.fromCollection(notMoveChanges).select(new ISelector<NodeGroupNotMoveChange, ModifiedNodesGroup>() {
public ModifiedNodesGroup select(NodeGroupNotMoveChange it) {
return it.getGroup(true);
}
}).visitAll(new IVisitor<ModifiedNodesGroup>() {
public void visit(ModifiedNodesGroup it) {
if (it.isEmpty() || it.isApplied(model)) {
return;
}
it.insertCopyIntoModel(model, nodeCopier);
it.setIsApplied(model);
}
});
Sequence.fromIterable(changes).ofType(NodeGroupMoveChange.class).visitAll(new IVisitor<NodeGroupMoveChange>() {
public void visit(NodeGroupMoveChange it) {
it.apply(model, nodeCopier);
}
});
CollectionSequence.fromCollection(notMoveChanges).select(new ISelector<NodeGroupNotMoveChange, ModifiedNodesGroup>() {
public ModifiedNodesGroup select(NodeGroupNotMoveChange it) {
return it.getGroup(false);
}
}).visitAll(new IVisitor<ModifiedNodesGroup>() {
public void visit(ModifiedNodesGroup it) {
if (it.isEmpty() || it.isApplied(model)) {
return;
}
it.deleteFromModel(model);
it.setIsApplied(model);
}
});
Sequence.fromIterable(changes).ofType(NodeGroupWrapChange.class).where(new IWhereFilter<NodeGroupWrapChange>() {
public boolean accept(NodeGroupWrapChange it) {
return !(it.isWrap());
}
}).visitAll(new IVisitor<NodeGroupWrapChange>() {
public void visit(NodeGroupWrapChange it) {
it.apply(model, nodeCopier);
}
});
}
@Override
public List<Tuples._2<SNodeId, MessageTarget>> createMessageTargetsWithIds(boolean isNew) {
if (isEmpty(isNew)) {
return ListSequence.fromListAndArray(new LinkedList<Tuples._2<SNodeId, MessageTarget>>(), MultiTuple.<SNodeId,MessageTarget>from(getParentId(isNew), ((MessageTarget) new DeletedNodeMessageTarget(getLink(isNew), getEnd(isNew)))));
}
final List<Tuples._2<SNodeId, MessageTarget>> result = ListSequence.fromList(new ArrayList<Tuples._2<SNodeId, MessageTarget>>());
ListSequence.fromList(getGroup(isNew).getModifiedNodes()).visitAll(new IVisitor<ModifiedNode>() {
public void visit(ModifiedNode it) {
SNode child = it.getNode();
if (child == null) {
return;
}
ListSequence.fromList(result).addElement(MultiTuple.<SNodeId,MessageTarget>from(child.getNodeId(), ((MessageTarget) new NodeMessageTarget())));
ListSequence.fromList(AttributeOperations.getAllAttributes(child)).where(new IWhereFilter<SNode>() {
public boolean accept(SNode attr) {
return !(AttributeOperations.isChildAttribute(attr));
}
}).visitAll(new IVisitor<SNode>() {
public void visit(SNode attr) {
ListSequence.fromList(result).addElement(MultiTuple.<SNodeId,MessageTarget>from(attr.getNodeId(), ((MessageTarget) new NodeMessageTarget())));
}
});
}
});
return result;
}
protected String getMultiLineIdsString(boolean isNew) {
List<String> allIds = ListSequence.fromList(getIds(isNew)).select(new ISelector<SNodeId, String>() {
public String select(SNodeId id) {
return "#" + id;
}
}).toListSequence();
int size = ListSequence.fromList(allIds).count();
if (size == 1) {
return ListSequence.fromList(allIds).getElement(0);
}
StringBuilder sb = new StringBuilder("\n");
int idsPerLine = 0;
final int maxIdsPerLine = 3;
for (int i = 0; i < size; i++) {
sb.append(ListSequence.fromList(allIds).getElement(i));
if (i != size - 1) {
sb.append(", ");
idsPerLine++;
if (idsPerLine == maxIdsPerLine) {
sb.append("\n");
idsPerLine = 0;
}
}
}
return sb.toString();
}
@Nullable
@Override
public MergeStrategy getMergeHint() {
return myMergeHint;
}
private MergeStrategy createMergeHint() {
// get "nonconflicting" attribute in metamodel
SNode n = getGroup(false).getParentNode();
MergeStrategy hint = VCSAspectUtil.getDefaultMergeStrategy(getLink(false));
if (hint != null) {
return hint;
}
return VCSAspectUtil.getDefaultMergeStrategy(SNodeOperations.getConcept(n));
}
/*package*/ boolean hasIntersectingSourceWith(@NotNull HierarchicalNodeGroupChange otherChange) {
return this.getGroup(false).intersectsWith(otherChange.getGroup(false));
}
public abstract boolean conflictsWith(@NotNull HierarchicalNodeGroupChange otherChange, Map<SNodeId, SNodeId> symmetricIds, boolean wrapConflictsWithInternalChanges);
public abstract boolean isSymmetricWith(@NotNull HierarchicalNodeGroupChange otherChange, Map<SNodeId, SNodeId> symmetricIds);
}
|
923323b93bb378d91bfec2a598b2814ed4ff0ddf | 28,526 | java | Java | org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/resources30_50/CodeSystem30_50.java | DBCG/org.hl7.fhir.core | 6f32a85d6610d1b401377d28e561a7830281d691 | [
"Apache-2.0"
] | 98 | 2019-03-01T21:59:41.000Z | 2022-03-23T15:52:06.000Z | org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/resources30_50/CodeSystem30_50.java | DBCG/org.hl7.fhir.core | 6f32a85d6610d1b401377d28e561a7830281d691 | [
"Apache-2.0"
] | 573 | 2019-02-27T17:51:31.000Z | 2022-03-31T21:18:44.000Z | org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/resources30_50/CodeSystem30_50.java | DBCG/org.hl7.fhir.core | 6f32a85d6610d1b401377d28e561a7830281d691 | [
"Apache-2.0"
] | 112 | 2019-01-31T10:50:26.000Z | 2022-03-21T09:55:06.000Z | 53.419476 | 273 | 0.743707 | 996,471 | package org.hl7.fhir.convertors.conv30_50.resources30_50;
import org.hl7.fhir.convertors.context.ConversionContext30_50;
import org.hl7.fhir.convertors.conv30_50.datatypes30_50.ContactDetail30_50;
import org.hl7.fhir.convertors.conv30_50.datatypes30_50.UsageContext30_50;
import org.hl7.fhir.convertors.conv30_50.datatypes30_50.complextypes30_50.CodeableConcept30_50;
import org.hl7.fhir.convertors.conv30_50.datatypes30_50.complextypes30_50.Coding30_50;
import org.hl7.fhir.convertors.conv30_50.datatypes30_50.complextypes30_50.Identifier30_50;
import org.hl7.fhir.convertors.conv30_50.datatypes30_50.primitivetypes30_50.*;
import org.hl7.fhir.exceptions.FHIRException;
import java.util.stream.Collectors;
public class CodeSystem30_50 {
public static org.hl7.fhir.dstu3.model.CodeSystem convertCodeSystem(org.hl7.fhir.r5.model.CodeSystem src) throws FHIRException {
if (src == null)
return null;
org.hl7.fhir.dstu3.model.CodeSystem tgt = new org.hl7.fhir.dstu3.model.CodeSystem();
ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyDomainResource(src, tgt);
if (src.hasUrl())
tgt.setUrlElement(Uri30_50.convertUri(src.getUrlElement()));
if (src.hasIdentifier())
tgt.setIdentifier(Identifier30_50.convertIdentifier(src.getIdentifierFirstRep()));
if (src.hasVersion())
tgt.setVersionElement(String30_50.convertString(src.getVersionElement()));
if (src.hasName())
tgt.setNameElement(String30_50.convertString(src.getNameElement()));
if (src.hasTitle())
tgt.setTitleElement(String30_50.convertString(src.getTitleElement()));
if (src.hasStatus())
tgt.setStatusElement(Enumerations30_50.convertPublicationStatus(src.getStatusElement()));
if (src.hasExperimental())
tgt.setExperimentalElement(Boolean30_50.convertBoolean(src.getExperimentalElement()));
if (src.hasDate())
tgt.setDateElement(DateTime30_50.convertDateTime(src.getDateElement()));
if (src.hasPublisher())
tgt.setPublisherElement(String30_50.convertString(src.getPublisherElement()));
for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact())
tgt.addContact(ContactDetail30_50.convertContactDetail(t));
if (src.hasDescription())
tgt.setDescriptionElement(MarkDown30_50.convertMarkdown(src.getDescriptionElement()));
for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext())
tgt.addUseContext(UsageContext30_50.convertUsageContext(t));
for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction())
tgt.addJurisdiction(CodeableConcept30_50.convertCodeableConcept(t));
if (src.hasPurpose())
tgt.setPurposeElement(MarkDown30_50.convertMarkdown(src.getPurposeElement()));
if (src.hasCopyright())
tgt.setCopyrightElement(MarkDown30_50.convertMarkdown(src.getCopyrightElement()));
if (src.hasCaseSensitive())
tgt.setCaseSensitiveElement(Boolean30_50.convertBoolean(src.getCaseSensitiveElement()));
if (src.hasValueSet())
tgt.setValueSet(src.getValueSet());
if (src.hasHierarchyMeaning())
tgt.setHierarchyMeaningElement(convertCodeSystemHierarchyMeaning(src.getHierarchyMeaningElement()));
if (src.hasCompositional())
tgt.setCompositionalElement(Boolean30_50.convertBoolean(src.getCompositionalElement()));
if (src.hasVersionNeeded())
tgt.setVersionNeededElement(Boolean30_50.convertBoolean(src.getVersionNeededElement()));
if (src.hasContent())
tgt.setContentElement(convertCodeSystemContentMode(src.getContentElement()));
if (src.hasCount())
tgt.setCountElement(UnsignedInt30_50.convertUnsignedInt(src.getCountElement()));
for (org.hl7.fhir.r5.model.CodeSystem.CodeSystemFilterComponent t : src.getFilter())
tgt.addFilter(convertCodeSystemFilterComponent(t));
for (org.hl7.fhir.r5.model.CodeSystem.PropertyComponent t : src.getProperty())
tgt.addProperty(convertPropertyComponent(t));
for (org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent t : src.getConcept())
tgt.addConcept(convertConceptDefinitionComponent(t));
return tgt;
}
public static org.hl7.fhir.r5.model.CodeSystem convertCodeSystem(org.hl7.fhir.dstu3.model.CodeSystem src) throws FHIRException {
if (src == null)
return null;
org.hl7.fhir.r5.model.CodeSystem tgt = new org.hl7.fhir.r5.model.CodeSystem();
ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyDomainResource(src, tgt);
if (src.hasUrl())
tgt.setUrlElement(Uri30_50.convertUri(src.getUrlElement()));
if (src.hasIdentifier())
tgt.addIdentifier(Identifier30_50.convertIdentifier(src.getIdentifier()));
if (src.hasVersion())
tgt.setVersionElement(String30_50.convertString(src.getVersionElement()));
if (src.hasName())
tgt.setNameElement(String30_50.convertString(src.getNameElement()));
if (src.hasTitle())
tgt.setTitleElement(String30_50.convertString(src.getTitleElement()));
if (src.hasStatus())
tgt.setStatusElement(Enumerations30_50.convertPublicationStatus(src.getStatusElement()));
if (src.hasExperimental())
tgt.setExperimentalElement(Boolean30_50.convertBoolean(src.getExperimentalElement()));
if (src.hasDate())
tgt.setDateElement(DateTime30_50.convertDateTime(src.getDateElement()));
if (src.hasPublisher())
tgt.setPublisherElement(String30_50.convertString(src.getPublisherElement()));
for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact())
tgt.addContact(ContactDetail30_50.convertContactDetail(t));
if (src.hasDescription())
tgt.setDescriptionElement(MarkDown30_50.convertMarkdown(src.getDescriptionElement()));
for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext())
tgt.addUseContext(UsageContext30_50.convertUsageContext(t));
for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction())
tgt.addJurisdiction(CodeableConcept30_50.convertCodeableConcept(t));
if (src.hasPurpose())
tgt.setPurposeElement(MarkDown30_50.convertMarkdown(src.getPurposeElement()));
if (src.hasCopyright())
tgt.setCopyrightElement(MarkDown30_50.convertMarkdown(src.getCopyrightElement()));
if (src.hasCaseSensitive())
tgt.setCaseSensitiveElement(Boolean30_50.convertBoolean(src.getCaseSensitiveElement()));
if (src.hasValueSet())
tgt.setValueSet(src.getValueSet());
if (src.hasHierarchyMeaning())
tgt.setHierarchyMeaningElement(convertCodeSystemHierarchyMeaning(src.getHierarchyMeaningElement()));
if (src.hasCompositional())
tgt.setCompositionalElement(Boolean30_50.convertBoolean(src.getCompositionalElement()));
if (src.hasVersionNeeded())
tgt.setVersionNeededElement(Boolean30_50.convertBoolean(src.getVersionNeededElement()));
if (src.hasContent())
tgt.setContentElement(convertCodeSystemContentMode(src.getContentElement()));
if (src.hasCount())
tgt.setCountElement(UnsignedInt30_50.convertUnsignedInt(src.getCountElement()));
for (org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemFilterComponent t : src.getFilter())
tgt.addFilter(convertCodeSystemFilterComponent(t));
for (org.hl7.fhir.dstu3.model.CodeSystem.PropertyComponent t : src.getProperty())
tgt.addProperty(convertPropertyComponent(t));
for (org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent t : src.getConcept())
tgt.addConcept(convertConceptDefinitionComponent(t));
return tgt;
}
static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.CodeSystem.CodeSystemContentMode> convertCodeSystemContentMode(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode> src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.CodeSystem.CodeSystemContentMode> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.CodeSystem.CodeSystemContentModeEnumFactory());
ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt);
switch (src.getValue()) {
case NOTPRESENT:
tgt.setValue(org.hl7.fhir.r5.model.CodeSystem.CodeSystemContentMode.NOTPRESENT);
break;
case EXAMPLE:
tgt.setValue(org.hl7.fhir.r5.model.CodeSystem.CodeSystemContentMode.EXAMPLE);
break;
case FRAGMENT:
tgt.setValue(org.hl7.fhir.r5.model.CodeSystem.CodeSystemContentMode.FRAGMENT);
break;
case COMPLETE:
tgt.setValue(org.hl7.fhir.r5.model.CodeSystem.CodeSystemContentMode.COMPLETE);
break;
default:
tgt.setValue(org.hl7.fhir.r5.model.CodeSystem.CodeSystemContentMode.NULL);
break;
}
return tgt;
}
static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode> convertCodeSystemContentMode(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.CodeSystem.CodeSystemContentMode> src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode> tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentModeEnumFactory());
ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt);
switch (src.getValue()) {
case NOTPRESENT:
tgt.setValue(org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode.NOTPRESENT);
break;
case EXAMPLE:
tgt.setValue(org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode.EXAMPLE);
break;
case FRAGMENT:
tgt.setValue(org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode.FRAGMENT);
break;
case COMPLETE:
tgt.setValue(org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode.COMPLETE);
break;
default:
tgt.setValue(org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode.NULL);
break;
}
return tgt;
}
public static org.hl7.fhir.r5.model.CodeSystem.CodeSystemFilterComponent convertCodeSystemFilterComponent(org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemFilterComponent src) throws FHIRException {
if (src == null)
return null;
org.hl7.fhir.r5.model.CodeSystem.CodeSystemFilterComponent tgt = new org.hl7.fhir.r5.model.CodeSystem.CodeSystemFilterComponent();
ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt);
if (src.hasCode())
tgt.setCodeElement(Code30_50.convertCode(src.getCodeElement()));
if (src.hasDescription())
tgt.setDescriptionElement(String30_50.convertString(src.getDescriptionElement()));
tgt.setOperator(src.getOperator().stream()
.map(o -> convertFilterOperator(o))
.collect(Collectors.toList()));
if (src.hasValue())
tgt.setValueElement(String30_50.convertString(src.getValueElement()));
return tgt;
}
public static org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemFilterComponent convertCodeSystemFilterComponent(org.hl7.fhir.r5.model.CodeSystem.CodeSystemFilterComponent src) throws FHIRException {
if (src == null)
return null;
org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemFilterComponent tgt = new org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemFilterComponent();
ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt);
if (src.hasCode())
tgt.setCodeElement(Code30_50.convertCode(src.getCodeElement()));
if (src.hasDescription())
tgt.setDescriptionElement(String30_50.convertString(src.getDescriptionElement()));
tgt.setOperator(src.getOperator().stream()
.map(o -> convertFilterOperator(o))
.collect(Collectors.toList()));
if (src.hasValue())
tgt.setValueElement(String30_50.convertString(src.getValueElement()));
return tgt;
}
static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemHierarchyMeaning> convertCodeSystemHierarchyMeaning(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.CodeSystem.CodeSystemHierarchyMeaning> src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemHierarchyMeaning> tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemHierarchyMeaningEnumFactory());
ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt);
switch (src.getValue()) {
case GROUPEDBY:
tgt.setValue(org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemHierarchyMeaning.GROUPEDBY);
break;
case ISA:
tgt.setValue(org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemHierarchyMeaning.ISA);
break;
case PARTOF:
tgt.setValue(org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemHierarchyMeaning.PARTOF);
break;
case CLASSIFIEDWITH:
tgt.setValue(org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemHierarchyMeaning.CLASSIFIEDWITH);
break;
default:
tgt.setValue(org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemHierarchyMeaning.NULL);
break;
}
return tgt;
}
static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.CodeSystem.CodeSystemHierarchyMeaning> convertCodeSystemHierarchyMeaning(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemHierarchyMeaning> src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.CodeSystem.CodeSystemHierarchyMeaning> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.CodeSystem.CodeSystemHierarchyMeaningEnumFactory());
ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt);
switch (src.getValue()) {
case GROUPEDBY:
tgt.setValue(org.hl7.fhir.r5.model.CodeSystem.CodeSystemHierarchyMeaning.GROUPEDBY);
break;
case ISA:
tgt.setValue(org.hl7.fhir.r5.model.CodeSystem.CodeSystemHierarchyMeaning.ISA);
break;
case PARTOF:
tgt.setValue(org.hl7.fhir.r5.model.CodeSystem.CodeSystemHierarchyMeaning.PARTOF);
break;
case CLASSIFIEDWITH:
tgt.setValue(org.hl7.fhir.r5.model.CodeSystem.CodeSystemHierarchyMeaning.CLASSIFIEDWITH);
break;
default:
tgt.setValue(org.hl7.fhir.r5.model.CodeSystem.CodeSystemHierarchyMeaning.NULL);
break;
}
return tgt;
}
public static org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent convertConceptDefinitionComponent(org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent src) throws FHIRException {
if (src == null)
return null;
org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent tgt = new org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent();
ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt);
if (src.hasCode())
tgt.setCodeElement(Code30_50.convertCode(src.getCodeElement()));
if (src.hasDisplay())
tgt.setDisplayElement(String30_50.convertString(src.getDisplayElement()));
if (src.hasDefinition())
tgt.setDefinitionElement(String30_50.convertString(src.getDefinitionElement()));
for (org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionDesignationComponent t : src.getDesignation())
tgt.addDesignation(convertConceptDefinitionDesignationComponent(t));
for (org.hl7.fhir.r5.model.CodeSystem.ConceptPropertyComponent t : src.getProperty())
tgt.addProperty(convertConceptPropertyComponent(t));
for (org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent t : src.getConcept())
tgt.addConcept(convertConceptDefinitionComponent(t));
return tgt;
}
public static org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent convertConceptDefinitionComponent(org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent src) throws FHIRException {
if (src == null)
return null;
org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent tgt = new org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent();
ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt);
if (src.hasCode())
tgt.setCodeElement(Code30_50.convertCode(src.getCodeElement()));
if (src.hasDisplay())
tgt.setDisplayElement(String30_50.convertString(src.getDisplayElement()));
if (src.hasDefinition())
tgt.setDefinitionElement(String30_50.convertString(src.getDefinitionElement()));
for (org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionDesignationComponent t : src.getDesignation())
tgt.addDesignation(convertConceptDefinitionDesignationComponent(t));
for (org.hl7.fhir.dstu3.model.CodeSystem.ConceptPropertyComponent t : src.getProperty())
tgt.addProperty(convertConceptPropertyComponent(t));
for (org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent t : src.getConcept())
tgt.addConcept(convertConceptDefinitionComponent(t));
return tgt;
}
public static org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionDesignationComponent convertConceptDefinitionDesignationComponent(org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionDesignationComponent src) throws FHIRException {
if (src == null)
return null;
org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionDesignationComponent tgt = new org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionDesignationComponent();
ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt);
if (src.hasLanguage())
tgt.setLanguageElement(Code30_50.convertCode(src.getLanguageElement()));
if (src.hasUse())
tgt.setUse(Coding30_50.convertCoding(src.getUse()));
if (src.hasValue())
tgt.setValueElement(String30_50.convertString(src.getValueElement()));
return tgt;
}
public static org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionDesignationComponent convertConceptDefinitionDesignationComponent(org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionDesignationComponent src) throws FHIRException {
if (src == null)
return null;
org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionDesignationComponent tgt = new org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionDesignationComponent();
ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt);
if (src.hasLanguage())
tgt.setLanguageElement(Code30_50.convertCode(src.getLanguageElement()));
if (src.hasUse())
tgt.setUse(Coding30_50.convertCoding(src.getUse()));
if (src.hasValue())
tgt.setValueElement(String30_50.convertString(src.getValueElement()));
return tgt;
}
public static org.hl7.fhir.r5.model.CodeSystem.ConceptPropertyComponent convertConceptPropertyComponent(org.hl7.fhir.dstu3.model.CodeSystem.ConceptPropertyComponent src) throws FHIRException {
if (src == null)
return null;
org.hl7.fhir.r5.model.CodeSystem.ConceptPropertyComponent tgt = new org.hl7.fhir.r5.model.CodeSystem.ConceptPropertyComponent();
ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt);
if (src.hasCode())
tgt.setCodeElement(Code30_50.convertCode(src.getCodeElement()));
if (src.hasValue())
tgt.setValue(ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().convertType(src.getValue()));
return tgt;
}
public static org.hl7.fhir.dstu3.model.CodeSystem.ConceptPropertyComponent convertConceptPropertyComponent(org.hl7.fhir.r5.model.CodeSystem.ConceptPropertyComponent src) throws FHIRException {
if (src == null)
return null;
org.hl7.fhir.dstu3.model.CodeSystem.ConceptPropertyComponent tgt = new org.hl7.fhir.dstu3.model.CodeSystem.ConceptPropertyComponent();
ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt);
if (src.hasCode())
tgt.setCodeElement(Code30_50.convertCode(src.getCodeElement()));
if (src.hasValue())
tgt.setValue(ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().convertType(src.getValue()));
return tgt;
}
public static org.hl7.fhir.r5.model.CodeSystem.PropertyComponent convertPropertyComponent(org.hl7.fhir.dstu3.model.CodeSystem.PropertyComponent src) throws FHIRException {
if (src == null)
return null;
org.hl7.fhir.r5.model.CodeSystem.PropertyComponent tgt = new org.hl7.fhir.r5.model.CodeSystem.PropertyComponent();
ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt);
if (src.hasCode())
tgt.setCodeElement(Code30_50.convertCode(src.getCodeElement()));
if (src.hasUri())
tgt.setUriElement(Uri30_50.convertUri(src.getUriElement()));
if (src.hasDescription())
tgt.setDescriptionElement(String30_50.convertString(src.getDescriptionElement()));
if (src.hasType())
tgt.setTypeElement(convertPropertyType(src.getTypeElement()));
return tgt;
}
public static org.hl7.fhir.dstu3.model.CodeSystem.PropertyComponent convertPropertyComponent(org.hl7.fhir.r5.model.CodeSystem.PropertyComponent src) throws FHIRException {
if (src == null)
return null;
org.hl7.fhir.dstu3.model.CodeSystem.PropertyComponent tgt = new org.hl7.fhir.dstu3.model.CodeSystem.PropertyComponent();
ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt);
if (src.hasCode())
tgt.setCodeElement(Code30_50.convertCode(src.getCodeElement()));
if (src.hasUri())
tgt.setUriElement(Uri30_50.convertUri(src.getUriElement()));
if (src.hasDescription())
tgt.setDescriptionElement(String30_50.convertString(src.getDescriptionElement()));
if (src.hasType())
tgt.setTypeElement(convertPropertyType(src.getTypeElement()));
return tgt;
}
static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.CodeSystem.PropertyType> convertPropertyType(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.CodeSystem.PropertyType> src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.CodeSystem.PropertyType> tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.CodeSystem.PropertyTypeEnumFactory());
ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt);
switch (src.getValue()) {
case CODE:
tgt.setValue(org.hl7.fhir.dstu3.model.CodeSystem.PropertyType.CODE);
break;
case CODING:
tgt.setValue(org.hl7.fhir.dstu3.model.CodeSystem.PropertyType.CODING);
break;
case STRING:
tgt.setValue(org.hl7.fhir.dstu3.model.CodeSystem.PropertyType.STRING);
break;
case INTEGER:
tgt.setValue(org.hl7.fhir.dstu3.model.CodeSystem.PropertyType.INTEGER);
break;
case BOOLEAN:
tgt.setValue(org.hl7.fhir.dstu3.model.CodeSystem.PropertyType.BOOLEAN);
break;
case DATETIME:
tgt.setValue(org.hl7.fhir.dstu3.model.CodeSystem.PropertyType.DATETIME);
break;
default:
tgt.setValue(org.hl7.fhir.dstu3.model.CodeSystem.PropertyType.NULL);
break;
}
return tgt;
}
static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.CodeSystem.PropertyType> convertPropertyType(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.CodeSystem.PropertyType> src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.CodeSystem.PropertyType> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.CodeSystem.PropertyTypeEnumFactory());
ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt);
switch (src.getValue()) {
case CODE:
tgt.setValue(org.hl7.fhir.r5.model.CodeSystem.PropertyType.CODE);
break;
case CODING:
tgt.setValue(org.hl7.fhir.r5.model.CodeSystem.PropertyType.CODING);
break;
case STRING:
tgt.setValue(org.hl7.fhir.r5.model.CodeSystem.PropertyType.STRING);
break;
case INTEGER:
tgt.setValue(org.hl7.fhir.r5.model.CodeSystem.PropertyType.INTEGER);
break;
case BOOLEAN:
tgt.setValue(org.hl7.fhir.r5.model.CodeSystem.PropertyType.BOOLEAN);
break;
case DATETIME:
tgt.setValue(org.hl7.fhir.r5.model.CodeSystem.PropertyType.DATETIME);
break;
default:
tgt.setValue(org.hl7.fhir.r5.model.CodeSystem.PropertyType.NULL);
break;
}
return tgt;
}
static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.FilterOperator> convertFilterOperator(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.CodeSystem.FilterOperator> src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.FilterOperator> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.Enumerations.FilterOperatorEnumFactory());
ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt);
switch (src.getValue()) {
case EQUAL:
tgt.setValue(org.hl7.fhir.r5.model.Enumerations.FilterOperator.EQUAL);
break;
case ISA:
tgt.setValue(org.hl7.fhir.r5.model.Enumerations.FilterOperator.ISA);
break;
case DESCENDENTOF:
tgt.setValue(org.hl7.fhir.r5.model.Enumerations.FilterOperator.DESCENDENTOF);
break;
case ISNOTA:
tgt.setValue(org.hl7.fhir.r5.model.Enumerations.FilterOperator.ISNOTA);
break;
case REGEX:
tgt.setValue(org.hl7.fhir.r5.model.Enumerations.FilterOperator.REGEX);
break;
case IN:
tgt.setValue(org.hl7.fhir.r5.model.Enumerations.FilterOperator.IN);
break;
case NOTIN:
tgt.setValue(org.hl7.fhir.r5.model.Enumerations.FilterOperator.NOTIN);
break;
case GENERALIZES:
tgt.setValue(org.hl7.fhir.r5.model.Enumerations.FilterOperator.GENERALIZES);
break;
case EXISTS:
tgt.setValue(org.hl7.fhir.r5.model.Enumerations.FilterOperator.EXISTS);
break;
default:
tgt.setValue(org.hl7.fhir.r5.model.Enumerations.FilterOperator.NULL);
break;
}
return tgt;
}
static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.CodeSystem.FilterOperator> convertFilterOperator(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.FilterOperator> src) throws FHIRException {
if (src == null || src.isEmpty()) return null;
org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.CodeSystem.FilterOperator> tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.CodeSystem.FilterOperatorEnumFactory());
ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt);
if (src.getValue() == null) {
tgt.setValue(org.hl7.fhir.dstu3.model.CodeSystem.FilterOperator.NULL);
} else {
switch (src.getValue()) {
case EQUAL:
tgt.setValue(org.hl7.fhir.dstu3.model.CodeSystem.FilterOperator.EQUAL);
break;
case ISA:
tgt.setValue(org.hl7.fhir.dstu3.model.CodeSystem.FilterOperator.ISA);
break;
case DESCENDENTOF:
tgt.setValue(org.hl7.fhir.dstu3.model.CodeSystem.FilterOperator.DESCENDENTOF);
break;
case ISNOTA:
tgt.setValue(org.hl7.fhir.dstu3.model.CodeSystem.FilterOperator.ISNOTA);
break;
case REGEX:
tgt.setValue(org.hl7.fhir.dstu3.model.CodeSystem.FilterOperator.REGEX);
break;
case IN:
tgt.setValue(org.hl7.fhir.dstu3.model.CodeSystem.FilterOperator.IN);
break;
case NOTIN:
tgt.setValue(org.hl7.fhir.dstu3.model.CodeSystem.FilterOperator.NOTIN);
break;
case GENERALIZES:
tgt.setValue(org.hl7.fhir.dstu3.model.CodeSystem.FilterOperator.GENERALIZES);
break;
case EXISTS:
tgt.setValue(org.hl7.fhir.dstu3.model.CodeSystem.FilterOperator.EXISTS);
break;
default:
tgt.setValue(org.hl7.fhir.dstu3.model.CodeSystem.FilterOperator.NULL);
break;
}
}
return tgt;
}
} |
923323beb75dea6d53c9bb129e9ba5f0ab8b16fa | 1,468 | java | Java | test/hotspot/jtreg/compiler/c2/TestStressRecompilation.java | 1690296356/jdk | eaf668d1510c28d51e26c397b582b66ebdf7e263 | [
"Apache-2.0"
] | null | null | null | test/hotspot/jtreg/compiler/c2/TestStressRecompilation.java | 1690296356/jdk | eaf668d1510c28d51e26c397b582b66ebdf7e263 | [
"Apache-2.0"
] | null | null | null | test/hotspot/jtreg/compiler/c2/TestStressRecompilation.java | 1690296356/jdk | eaf668d1510c28d51e26c397b582b66ebdf7e263 | [
"Apache-2.0"
] | null | null | null | 35.804878 | 85 | 0.730926 | 996,472 | /*
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 8245801
* @requires vm.debug
* @summary Test running with StressRecompilation enabled.
* @run main/othervm -Xcomp -XX:+IgnoreUnrecognizedVMOptions -XX:+StressRecompilation
* compiler.c2.TestStressRecompilation
*/
package compiler.c2;
public class TestStressRecompilation {
public static void main(String[] args) {
System.out.println("Test passed.");
}
}
|
923323bf6ca4151076d5fdf55924cc9f5cd63e8a | 9,201 | java | Java | src/net/nasepismo/ime/CandidateView.java | filmil/android-serbian-ime | 343a364a02b56951c6d42c7486ed634fdc51d460 | [
"Apache-2.0"
] | null | null | null | src/net/nasepismo/ime/CandidateView.java | filmil/android-serbian-ime | 343a364a02b56951c6d42c7486ed634fdc51d460 | [
"Apache-2.0"
] | null | null | null | src/net/nasepismo/ime/CandidateView.java | filmil/android-serbian-ime | 343a364a02b56951c6d42c7486ed634fdc51d460 | [
"Apache-2.0"
] | null | null | null | 28.220859 | 98 | 0.656196 | 996,473 | /*
* Copyright (C) 2008-2009 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package net.nasepismo.ime;
import java.util.ArrayList;
import java.util.List;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.view.GestureDetector;
import android.view.MotionEvent;
import android.view.View;
import com.google.inject.internal.Lists;
import com.google.inject.internal.Nullable;
/**
* Manages the display of the typed-in suggestions.
*
* @author nnheo@example.com (Filip Miletic)
*/
public class CandidateView extends View {
private static final int OUT_OF_BOUNDS = -1;
private SoftKeyboard softKeyboard;
private List<String> suggestionList;
private int selectedIndex;
private int touchX = OUT_OF_BOUNDS;
private Drawable selectionHighlight;
private boolean isWordValid;
private Rect padding;
private static final int MAX_SUGGESTIONS = 32;
private static final int SCROLL_PIXELS = 20;
private int[] wordWidths = new int[MAX_SUGGESTIONS];
private int[] wordX = new int[MAX_SUGGESTIONS];
private static final int X_GAP = 10;
private static final List<String> EMPTY_LIST = Lists.newArrayList();
private int normalColor;
private int recommendedColor;
private int otherColor;
private int verticalPadding;
private Paint paint;
private boolean isScrolled;
private int targetScrollX;
private int totalWidth;
private GestureDetector gestureDetector;
/**
* Construct a CandidateView for showing suggested words for completion.
*/
public CandidateView(Context context) {
super(context);
selectionHighlight = context.getResources().getDrawable(
android.R.drawable.list_selector_background);
selectionHighlight.setState(new int[] {
android.R.attr.state_enabled,
android.R.attr.state_focused,
android.R.attr.state_window_focused,
android.R.attr.state_pressed
});
Resources r = context.getResources();
setBackgroundColor(r.getColor(R.color.candidate_background));
normalColor = r.getColor(R.color.candidate_normal);
recommendedColor = r.getColor(R.color.candidate_recommended);
otherColor = r.getColor(R.color.candidate_other);
verticalPadding = r.getDimensionPixelSize(R.dimen.candidate_vertical_padding);
paint = new Paint();
paint.setColor(normalColor);
paint.setAntiAlias(true);
paint.setTextSize(r.getDimensionPixelSize(R.dimen.candidate_font_height));
paint.setStrokeWidth(0);
gestureDetector = new GestureDetector(new GestureDetector.SimpleOnGestureListener() {
@Override
public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {
isScrolled = true;
int sx = getScrollX();
sx += distanceX;
if (sx < 0) {
sx = 0;
}
if (sx + getWidth() > totalWidth) {
sx -= distanceX;
}
targetScrollX = sx;
scrollTo(sx, getScrollY());
invalidate();
return true;
}
});
setHorizontalFadingEdgeEnabled(true);
setWillNotDraw(false);
setHorizontalScrollBarEnabled(false);
setVerticalScrollBarEnabled(false);
}
/**
* A connection back to the service to communicate with the text field
* @param listener
*/
public void setService(SoftKeyboard listener) {
softKeyboard = listener;
}
@Override
public int computeHorizontalScrollRange() {
return totalWidth;
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int measuredWidth = resolveSize(50, widthMeasureSpec);
// Get the desired height of the icon menu view (last row of items does
// not have a divider below)
Rect padding = new Rect();
selectionHighlight.getPadding(padding);
final int desiredHeight =
((int)paint.getTextSize()) + verticalPadding + padding.top + padding.bottom;
// Maximum possible width and desired height
setMeasuredDimension(measuredWidth,
resolveSize(desiredHeight, heightMeasureSpec));
}
/**
* If the canvas is null, then only touch calculations are performed to pick the target
* candidate.
*/
@Override
protected void onDraw(@Nullable Canvas canvas) {
if (canvas != null) {
super.onDraw(canvas);
}
totalWidth = 0;
if (suggestionList == null) return;
if (padding == null) {
padding = new Rect(0, 0, 0, 0);
if (getBackground() != null) {
getBackground().getPadding(padding);
}
}
int x = 0;
final int count = suggestionList.size();
final int height = getHeight();
final Rect paddingConst = padding;
final Paint paintConst = paint;
final int touchXConst = touchX;
final int scrollX = getScrollX();
final boolean scrolled = isScrolled;
final boolean typedWordValid = isWordValid;
final int y = (int) (((height - paint.getTextSize()) / 2) - paint.ascent());
for (int i = 0; i < count; i++) {
String suggestion = suggestionList.get(i);
float textWidth = paintConst.measureText(suggestion);
final int wordWidth = (int) textWidth + X_GAP * 2;
wordX[i] = x;
wordWidths[i] = wordWidth;
paintConst.setColor(normalColor);
if (touchXConst + scrollX >= x && touchXConst + scrollX < x + wordWidth && !scrolled) {
if (canvas != null) {
canvas.translate(x, 0);
selectionHighlight.setBounds(0, paddingConst.top, wordWidth, height);
selectionHighlight.draw(canvas);
canvas.translate(-x, 0);
}
selectedIndex = i;
}
if (canvas != null) {
if ((i == 1 && !typedWordValid) || (i == 0 && typedWordValid)) {
paintConst.setFakeBoldText(true);
paintConst.setColor(recommendedColor);
} else if (i != 0) {
paintConst.setColor(otherColor);
}
canvas.drawText(suggestion, x + X_GAP, y, paintConst);
paintConst.setColor(otherColor);
canvas.drawLine(
x + wordWidth + 0.5f, paddingConst.top, x + wordWidth + 0.5f, height + 1, paintConst);
paintConst.setFakeBoldText(false);
}
x += wordWidth;
}
totalWidth = x;
if (targetScrollX != getScrollX()) {
scrollToTarget();
}
}
private void scrollToTarget() {
int sx = getScrollX();
if (targetScrollX > sx) {
sx += SCROLL_PIXELS;
if (sx >= targetScrollX) {
sx = targetScrollX;
requestLayout();
}
} else {
sx -= SCROLL_PIXELS;
if (sx <= targetScrollX) {
sx = targetScrollX;
requestLayout();
}
}
scrollTo(sx, getScrollY());
invalidate();
}
public void setSuggestions(List<String> suggestions, boolean completions,
boolean typedWordValid) {
clear();
if (suggestions != null) {
suggestionList = new ArrayList<String>(suggestions);
}
isWordValid = typedWordValid;
scrollTo(0, 0);
targetScrollX = 0;
// Compute the total width
onDraw(null);
invalidate();
requestLayout();
}
public void clear() {
suggestionList = EMPTY_LIST;
touchX = OUT_OF_BOUNDS;
selectedIndex = -1;
invalidate();
}
@Override
public boolean onTouchEvent(MotionEvent event) {
if (gestureDetector.onTouchEvent(event)) {
return true;
}
int action = event.getAction();
int x = (int) event.getX();
int y = (int) event.getY();
touchX = x;
switch (action) {
case MotionEvent.ACTION_DOWN:
isScrolled = false;
invalidate();
break;
case MotionEvent.ACTION_MOVE:
if (y <= 0) {
// Fling up!?
if (selectedIndex >= 0) {
softKeyboard.pickSuggestionManually(selectedIndex);
selectedIndex = -1;
}
}
invalidate();
break;
case MotionEvent.ACTION_UP:
if (!isScrolled) {
if (selectedIndex >= 0) {
softKeyboard.pickSuggestionManually(selectedIndex);
}
}
selectedIndex = -1;
removeHighlight();
requestLayout();
break;
}
return true;
}
/**
* For flick through from keyboard, call this method with the x coordinate of the flick
* gesture.
*/
public void takeSuggestionAt(float x) {
touchX = (int) x;
// To detect candidate
onDraw(null);
if (selectedIndex >= 0) {
softKeyboard.pickSuggestionManually(selectedIndex);
}
invalidate();
}
private void removeHighlight() {
touchX = OUT_OF_BOUNDS;
invalidate();
}
}
|
92332419c6d9a34a5ddcc5b06bed54b7015dbbd9 | 581 | java | Java | android-sdk/src/main/java/com/sensorberg/sdk/scanner/ScannerEvent.java | sensorberg/android-sdk | 2cd1f5085a23d5daf8adda3f8b98e24449ac6074 | [
"MIT"
] | 21 | 2015-05-27T01:25:05.000Z | 2018-03-05T13:11:47.000Z | android-sdk/src/main/java/com/sensorberg/sdk/scanner/ScannerEvent.java | sensorberg/android-sdk | 2cd1f5085a23d5daf8adda3f8b98e24449ac6074 | [
"MIT"
] | 37 | 2015-11-03T12:50:55.000Z | 2018-01-06T13:27:27.000Z | android-sdk/src/main/java/com/sensorberg/sdk/scanner/ScannerEvent.java | sensorberg-dev/android-sdk | 2cd1f5085a23d5daf8adda3f8b98e24449ac6074 | [
"MIT"
] | 17 | 2015-01-13T15:47:46.000Z | 2017-06-13T23:05:29.000Z | 20.034483 | 61 | 0.686747 | 996,474 | package com.sensorberg.sdk.scanner;
import lombok.Getter;
public class ScannerEvent {
@Getter
private final int type;
@Getter
private final Object data;
public static final int LOGICAL_SCAN_START_REQUESTED = 1;
public static final int SCAN_STOP_REQUESTED = 2;
public static final int EVENT_DETECTED = 3;
public static final int PAUSE_SCAN = 4;
public static final int UN_PAUSE_SCAN = 5;
public static final int RSSI_UPDATED = 6;
ScannerEvent(int type, Object data) {
this.type = type;
this.data = data;
}
} |
923328c5751332f256b36085b6ba26375ac17269 | 1,544 | java | Java | Mage.Sets/src/mage/cards/s/SpectersShroud.java | dsenginr/mage | 94e9aeedc20dcb74264e58fd198f46215828ef5c | [
"MIT"
] | 1,444 | 2015-01-02T00:25:38.000Z | 2022-03-31T13:57:18.000Z | Mage.Sets/src/mage/cards/s/SpectersShroud.java | dsenginr/mage | 94e9aeedc20dcb74264e58fd198f46215828ef5c | [
"MIT"
] | 6,180 | 2015-01-02T19:10:09.000Z | 2022-03-31T21:10:44.000Z | Mage.Sets/src/mage/cards/s/SpectersShroud.java | dsenginr/mage | 94e9aeedc20dcb74264e58fd198f46215828ef5c | [
"MIT"
] | 1,001 | 2015-01-01T01:15:20.000Z | 2022-03-30T20:23:04.000Z | 32.851064 | 142 | 0.745466 | 996,475 |
package mage.cards.s;
import java.util.UUID;
import mage.abilities.common.DealsDamageToAPlayerAttachedTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.effects.common.continuous.BoostEquippedEffect;
import mage.abilities.effects.common.discard.DiscardTargetEffect;
import mage.abilities.keyword.EquipAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Outcome;
import mage.constants.Zone;
/**
*
* @author Pete Rossi
*/
public final class SpectersShroud extends CardImpl {
public SpectersShroud(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{2}");
this.subtype.add(SubType.EQUIPMENT);
// Equipped creature gets +1/+0.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostEquippedEffect(1, 0)));
// Whenever equipped creature deals combat damage to a player, that player discards a card.
this.addAbility(new DealsDamageToAPlayerAttachedTriggeredAbility(new DiscardTargetEffect(1), "equipped creature", false, true, true));
// Equip {1}
this.addAbility(new EquipAbility(Outcome.AddAbility, new GenericManaCost(1)));
}
private SpectersShroud(final SpectersShroud card) {
super(card);
}
@Override
public SpectersShroud copy() {
return new SpectersShroud(this);
}
}
|
923328e383f715d6c4db9444c32d70b656df2bda | 3,228 | java | Java | src/main/java/de/maggu2810/playground/ftpserver/programmatic/internal/net/ConnectionInfo.java | maggu2810/ftpserver-programmatic | f46b3e83b9e81f55a993a2ca8a0139b6b1dfad00 | [
"Apache-2.0"
] | null | null | null | src/main/java/de/maggu2810/playground/ftpserver/programmatic/internal/net/ConnectionInfo.java | maggu2810/ftpserver-programmatic | f46b3e83b9e81f55a993a2ca8a0139b6b1dfad00 | [
"Apache-2.0"
] | null | null | null | src/main/java/de/maggu2810/playground/ftpserver/programmatic/internal/net/ConnectionInfo.java | maggu2810/ftpserver-programmatic | f46b3e83b9e81f55a993a2ca8a0139b6b1dfad00 | [
"Apache-2.0"
] | null | null | null | 30.45283 | 105 | 0.673172 | 996,476 | /*-
* #%L
* ftpserver-programmatic
* %%
* Copyright (C) 2018 maggu2810
* %%
* 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.
* #L%
*/
package de.maggu2810.playground.ftpserver.programmatic.internal.net;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.SocketAddress;
import org.apache.mina.core.session.IoSession;
import org.checkerframework.checker.nullness.qual.Nullable;
/**
* An information about a connection (a pair of {@link AddressPlusPort}).
*/
public class ConnectionInfo {
/** The local address plus port. */
public final AddressPlusPort local;
/** The remote address plus port. */
public final AddressPlusPort remote;
/**
* Constructor.
*
* @param local the local
* @param remote the remote
*/
public ConnectionInfo(final InetSocketAddress local, final InetSocketAddress remote) {
this(new AddressPlusPort(local), new AddressPlusPort(remote));
}
/**
* Constructor.
*
* @param localAddr local address
* @param localPort local port
* @param remoteAddr remote address
* @param remotePort remote port
*/
public ConnectionInfo(final InetAddress localAddr, final int localPort, final InetAddress remoteAddr,
final int remotePort) {
this(new AddressPlusPort(localAddr, localPort), new AddressPlusPort(remoteAddr, remotePort));
}
/**
* Constructor.
*
* @param local local
* @param remote remote
*/
public ConnectionInfo(final AddressPlusPort local, final AddressPlusPort remote) {
this.local = local;
this.remote = remote;
}
/**
* Create a connection information from an I/O session.
*
* @param session the session
* @return a new connection information on success, null on error.
*/
public static @Nullable ConnectionInfo create(final IoSession session) {
final SocketAddress saLocal = session.getLocalAddress();
final SocketAddress saRemote = session.getRemoteAddress();
if (saLocal instanceof InetSocketAddress && saRemote instanceof InetSocketAddress) {
return new ConnectionInfo((InetSocketAddress) saLocal, (InetSocketAddress) saRemote);
} else {
return null;
}
}
/**
* Check for a match.
*
* @param other the other connection information
* @return true on match, otherwise false
*/
public boolean match(final ConnectionInfo other) {
return local.match(other.local) && remote.match(other.remote);
}
@Override
public String toString() {
return "ConnectionInfo [local=" + local + ", remote=" + remote + "]";
}
}
|
92332939b18ae30e0a7bfa96abbd9364fce62fbc | 4,442 | java | Java | java/src/main/java/com/aliyun/iot/api/sdk/openapi/MessageBrokerManager.java | aliyun/iot-api-demo | 09439d7f616d9a3f04a958353fba3e986b026915 | [
"Apache-2.0"
] | 86 | 2017-12-07T13:28:59.000Z | 2022-01-26T01:24:18.000Z | java/src/main/java/com/aliyun/iot/api/sdk/openapi/MessageBrokerManager.java | aliyun/iot-api-demo | 09439d7f616d9a3f04a958353fba3e986b026915 | [
"Apache-2.0"
] | 11 | 2017-12-28T11:23:01.000Z | 2022-03-29T23:03:27.000Z | java/src/main/java/com/aliyun/iot/api/sdk/openapi/MessageBrokerManager.java | aliyun/iot-api-demo | 09439d7f616d9a3f04a958353fba3e986b026915 | [
"Apache-2.0"
] | 54 | 2017-12-13T06:46:58.000Z | 2022-03-15T07:59:42.000Z | 34.976378 | 117 | 0.616164 | 996,477 | package com.aliyun.iot.api.sdk.openapi;
import com.alibaba.fastjson.JSON;
import com.aliyun.iot.util.LogUtil;
import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.exceptions.ClientException;
import com.aliyuncs.iot.model.v20180120.*;
public class MessageBrokerManager {
private static DefaultAcsClient client = AbstractManager.getClient();
/**
* 调用该接口向指定Topic发布消息
*
* @param productKey 产品名称 要发送消息产品Key。
* @param topicFullName 要接收消息的Topic全称。可以是用户Topic类和您自定义的Topic类
* @param messageContent 要发送的消息主体。您需要将消息原文转换成二进制数据,并进行Base64编码,从而生成消息主体。
* @param qos 指定消息的发送方式。取值: 0:最多发送一次。1:最少发送一次。
*/
public static PubResponse pub(String productKey, String topicFullName, String messageContent,
Integer qos) {
PubResponse response = null;
PubRequest request = new PubRequest();
request.setProductKey(productKey);
request.setMessageContent(messageContent);
request.setTopicFullName(topicFullName);
request.setQos(qos);
try {
response = client.getAcsResponse(request);
if (response.getSuccess() != null && response.getSuccess()) {
LogUtil.print("发布消息成功");
LogUtil.print(JSON.toJSONString(response));
} else {
LogUtil.print("发布消息失败");
LogUtil.error(JSON.toJSONString(response));
}
return response;
} catch (ClientException e) {
e.printStackTrace();
LogUtil.error("发布消息失败!" + JSON.toJSONString(response));
}
return null;
}
/**
* 调用该接口向订阅了指定Topic的所有设备发布广播消息
*
* @param productKey 要发送广播消息的产品Key。
* @param topicFullName 要接收广播消息的Topic全称。格式为:/broadcast/${productKey}/自定义字段。其中,${productKey}是要接收广播消息的具体产品Key
* ;自定义字段中您可以指定任意字段。
* @param messageContent 要发送的消息主体。您需要将消息原文转换成二进制数据,并进行Base64编码,从而生成消息主体。
*/
public static PubBroadcastResponse pubBroadcast(String productKey, String topicFullName, String messageContent) {
PubBroadcastResponse response = null;
PubBroadcastRequest request = new PubBroadcastRequest();
request.setMessageContent(messageContent);
request.setTopicFullName(topicFullName);
request.setProductKey(productKey);
try {
response = client.getAcsResponse(request);
if (response.getSuccess() != null && response.getSuccess()) {
LogUtil.print("发布广播消息成功");
LogUtil.print(JSON.toJSONString(response));
} else {
LogUtil.print("发布广播消息失败");
LogUtil.error(JSON.toJSONString(response));
}
return response;
} catch (ClientException e) {
e.printStackTrace();
LogUtil.error("发布广播消息失败!" + JSON.toJSONString(response));
}
return null;
}
/**
* 调用该接口向指定设备发送请求消息,并同步返回响应。
*
* @param productKey 要发送消息的产品Key
* @param deviceName 要接收消息的设备名称。
* @param requestBase64Byte 要发送的请求消息内容经过Base64编码得到的字符串格式数据
* @param timeout 等待设备回复消息的时间,单位是毫秒,取值范围是1,000 ~5,000。
* @param topic 使用自定义的RRPC相关Topic。需要设备端配合使用,请参见设备端开发自定义Topic。不传入此参数,则使用系统默认的RRPC Topic。
*/
public static RRpcResponse rrpc(String productKey, String deviceName, String requestBase64Byte, Integer timeout,
String topic) {
RRpcResponse response = null;
RRpcRequest request = new RRpcRequest();
request.setProductKey(productKey);
request.setDeviceName(deviceName);
request.setRequestBase64Byte(requestBase64Byte);
request.setTimeout(timeout);
request.setTopic(topic);
try {
response = client.getAcsResponse(request);
if (response.getSuccess() != null && response.getSuccess()) {
LogUtil.print("向指定设备发送请求消息,并同步返回响应成功");
LogUtil.print(JSON.toJSONString(response));
} else {
LogUtil.print("向指定设备发送请求消息,并同步返回响应失败");
LogUtil.error(JSON.toJSONString(response));
}
return response;
} catch (ClientException e) {
e.printStackTrace();
LogUtil.error("向指定设备发送请求消息,并同步返回响应失败!" + JSON.toJSONString(response));
}
return null;
}
}
|
923329b0e0abfe720fbd8df8814f1a60f5309d6f | 12,858 | java | Java | MyNotePad.java | muyangren907/Java-NotePad | f02e26b77916aa87e4f8a37d5d6a43a6ef456238 | [
"MIT"
] | null | null | null | MyNotePad.java | muyangren907/Java-NotePad | f02e26b77916aa87e4f8a37d5d6a43a6ef456238 | [
"MIT"
] | null | null | null | MyNotePad.java | muyangren907/Java-NotePad | f02e26b77916aa87e4f8a37d5d6a43a6ef456238 | [
"MIT"
] | null | null | null | 33.224806 | 112 | 0.669466 | 996,478 | import java.awt.*;
import java.io.*;
import javax.swing.*;
import javax.swing.filechooser.*;
import java.awt.event.*;
import java.net.*;
public class MyNotePad {
private JFrame frame;
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
MyNotePad window = new MyNotePad();
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
public MyNotePad() {
initialize();
}
private void initialize() {
String jarFilePath = this.getClass().getProtectionDomain().getCodeSource().getLocation().getPath();
String[] jarFilePathtemp = jarFilePath.split("/");
jarFilePath = "/";
for (int i = 1; i < jarFilePathtemp.length - 1; i++) {
jarFilePath += jarFilePathtemp[i] + "/";
}
// URL Decoding
try {
jarFilePath = java.net.URLDecoder.decode(jarFilePath, "UTF-8");
} catch (UnsupportedEncodingException e2) {
e2.printStackTrace();
}
File f = new File(jarFilePath + "新建文本文档.txt");
int i = 1;
while (f.exists()) {
f = new File(jarFilePath + "新建文本文档" + String.valueOf(i) + ".txt");
i++;
}
final File path = f.getParentFile();
Toolkit tool = Toolkit.getDefaultToolkit();
Image tubiao = tool.getImage(this.getClass().getResource("/image/jishibentubiao.jpg"));
frame = new JFrame(f.getName() + " - 记事本");
frame.setBounds(100, 100, 800, 800);
frame.setIconImage(tubiao);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().setLayout(new BorderLayout(0, 0));
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); // 系统风格
} catch (Throwable e) {
e.printStackTrace();
}
JScrollPane scrollPane = new JScrollPane();
frame.getContentPane().add(scrollPane, BorderLayout.CENTER);
JScrollBar gdtheng = scrollPane.getHorizontalScrollBar(); // 获取横向滚动条
gdtheng.setBackground(Color.WHITE);
gdtheng.setForeground(Color.LIGHT_GRAY);
JScrollBar gdtshu = scrollPane.getVerticalScrollBar();// 获取竖向滚动条
gdtshu.setBackground(Color.WHITE);
gdtshu.setForeground(Color.LIGHT_GRAY);
JTextArea textArea = new JTextArea();
textArea.setLineWrap(true);
textArea.setFont(new Font("宋体", Font.PLAIN, 19));
scrollPane.setViewportView(textArea);
JMenuBar menuBar = new JMenuBar();
menuBar.setBackground(Color.WHITE);
menuBar.setFont(new Font("宋体", Font.PLAIN, 20));
frame.setJMenuBar(menuBar);
JMenu mnNewMenu = new JMenu("\u6587\u4EF6(F)");
mnNewMenu.setForeground(Color.BLACK);
mnNewMenu.setFont(new Font("微软雅黑", Font.PLAIN, 15));
menuBar.add(mnNewMenu);
mnNewMenu.setMnemonic(KeyEvent.VK_F);
JMenuItem mntmNewMenuItem = new JMenuItem("\u4FDD\u5B58(S)");// save
mntmNewMenuItem.setForeground(Color.BLACK);
mntmNewMenuItem.setFont(new Font("微软雅黑", Font.PLAIN, 15));
mntmNewMenuItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
String jarFilePath = this.getClass().getProtectionDomain().getCodeSource().getLocation().getPath();
String[] jarFilePathtemp = jarFilePath.split("/");
jarFilePath = "/";
for (int i = 1; i < jarFilePathtemp.length - 1; i++) {
jarFilePath += jarFilePathtemp[i] + "/";
}
String temp = jarFilePath + frame.getTitle();
String[] temp2 = temp.split(" ");
if (temp2[0].equals(jarFilePath + "无标题")) {
JFileChooser fileChooser = new JFileChooser(); // 选择文件
FileSystemView fsv = FileSystemView.getFileSystemView();
fileChooser.setCurrentDirectory(path); // 设置为当前目录
fileChooser.showOpenDialog(frame); // 显示文件选择框,以frame为容器
File out = fileChooser.getSelectedFile();
if (!out.exists()) {
try {
out.createNewFile();
} catch (IOException e) {
e.printStackTrace();
}
}
try {
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(out)));
String text = textArea.getText();
String[] textout = text.split("\n");
for (int i = 0; i < textout.length; i++) {
bw.write(textout[i]);
bw.newLine();
}
frame.setTitle(out.getName());
bw.close();
} catch (Exception e) {
e.printStackTrace();
}
} else {
File out;
try {
out = new File(URLDecoder.decode(temp2[0], "UTF-8"));// URL解码
if (!out.exists()) {
try {
out.createNewFile();
} catch (IOException e) {
e.printStackTrace();
}
}
try {
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(out)));
String text = textArea.getText();
String[] textout = text.split("\n");
for (int i = 0; i < textout.length; i++) {
bw.write(textout[i]);
bw.newLine();
}
bw.close();
} catch (Exception e) {
e.printStackTrace();
}
} catch (UnsupportedEncodingException e1) {
e1.printStackTrace();
}
}
}
});
JMenuItem mntmn = new JMenuItem("\u65B0\u5EFA(N)");// new
mntmn.setForeground(Color.BLACK);
mntmn.setFont(new Font("微软雅黑", Font.PLAIN, 15));
mnNewMenu.add(mntmn);
mntmn.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
frame.setTitle("无标题 - 记事本");
textArea.setText(null);
}
});
JMenuItem mntmo = new JMenuItem("\u6253\u5F00(O)...");// open
mntmo.setForeground(Color.BLACK);
mntmo.setFont(new Font("微软雅黑", Font.PLAIN, 15));
mntmo.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
JFileChooser fileChooser = new JFileChooser(); // 选择文件
FileSystemView fsv = FileSystemView.getFileSystemView();
fileChooser.setCurrentDirectory(path); // 设置为当前目录
fileChooser.showOpenDialog(frame); // 显示文件选择框,以frame为容器
File fin = fileChooser.getSelectedFile();
BufferedReader br;
try {
frame.setTitle(fin.getName() + " - 记事本");
br = new BufferedReader(new InputStreamReader(new FileInputStream(fin), "utf-8"));
String temp = null, textin = "";
while ((temp = br.readLine()) != null) {
textin += temp;
textin += "\n";
}
textArea.setText(textin);
} catch (UnsupportedEncodingException | FileNotFoundException e1) {
e1.printStackTrace();
} catch (IOException e1) {
e1.printStackTrace();
}
}
});
mnNewMenu.add(mntmo);
mnNewMenu.add(mntmNewMenuItem);
JMenuItem mntma = new JMenuItem("\u53E6\u5B58\u4E3A(A)...");// save
// otherpath
mntma.setForeground(Color.BLACK);
mntma.setFont(new Font("微软雅黑", Font.PLAIN, 15));
mnNewMenu.add(mntma);
mntma.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
JFileChooser fileChooser = new JFileChooser(); // 选择文件
FileSystemView fsv = FileSystemView.getFileSystemView();
fileChooser.setCurrentDirectory(path); // 设置为当前目录
fileChooser.showOpenDialog(frame); // 显示文件选择框,以frame为容器
File out = fileChooser.getSelectedFile();
if (!out.exists()) {
try {
out.createNewFile();
} catch (IOException e) {
e.printStackTrace();
}
}
try {
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(out)));
String text = textArea.getText();
String[] textout = text.split("\n");
for (int i = 0; i < textout.length; i++) {
bw.write(textout[i]);
bw.newLine();
}
frame.setTitle(out.getName());
bw.close();
} catch (Exception e) {
e.printStackTrace();
}
}
});
JMenuItem mntmx = new JMenuItem("\u9000\u51FA(X)");// exit
mntmx.setForeground(Color.BLACK);
mntmx.setFont(new Font("微软雅黑", Font.PLAIN, 15));
mntmx.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Object[] options = { "确定", "取消" };
int response = JOptionPane.showOptionDialog(frame, "确定退出?", "记事本", JOptionPane.YES_OPTION,
JOptionPane.DEFAULT_OPTION, null, options, options[0]);
if (response == 0) {
System.exit(0);
} else if (response == 1) {
}
}
});
mnNewMenu.add(mntmx);
JMenu mno = new JMenu("\u683C\u5F0F(O)");
mno.setForeground(Color.BLACK);
mno.setFont(new Font("微软雅黑", Font.PLAIN, 15));
menuBar.add(mno);
mno.setMnemonic(KeyEvent.VK_O);
JMenu mnNewMenu_1 = new JMenu("\u5E2E\u52A9(H)");
mnNewMenu_1.setForeground(Color.BLACK);
mnNewMenu_1.setFont(new Font("微软雅黑", Font.PLAIN, 15));
menuBar.add(mnNewMenu_1);
mnNewMenu_1.setMnemonic(KeyEvent.VK_H);
JMenuItem mntmNewMenuItem_1 = new JMenuItem("\u5173\u4E8E\u8BB0\u4E8B\u672C(A)");
mntmNewMenuItem_1.setForeground(Color.BLACK);
mntmNewMenuItem_1.setFont(new Font("微软雅黑", Font.PLAIN, 15));
mntmNewMenuItem_1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
JOptionPane.showMessageDialog(frame, "软件名:记事本\n制作时间:2017年5月29日\n制作人:muyangren907", "关于“记事本”",
JOptionPane.PLAIN_MESSAGE);
}
});
mntmNewMenuItem_1.setMnemonic('A');
mnNewMenu_1.add(mntmNewMenuItem_1);
JMenuItem menuItem = new JMenuItem("\u8BF4\u660E(S)");
menuItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
JOptionPane.showMessageDialog(frame,
"Ⅰ、该款记事本由Java编写,支持跨平台使用(实测支持Windows 10、Centos 7)\nⅡ、支持快捷键操作,界面较为美观,功能比较完善\nⅢ、由于开发周期短,难免存在Bug,有任何问题请与作者交流",
"“记事本”说明", JOptionPane.PLAIN_MESSAGE);
}
});
menuItem.setForeground(Color.BLACK);
menuItem.setFont(new Font("微软雅黑", Font.PLAIN, 15));
menuItem.setMnemonic('S');
mnNewMenu_1.add(menuItem);
JCheckBoxMenuItem chckbxw = new JCheckBoxMenuItem("\u81EA\u52A8\u6362\u884C(W)");
chckbxw.setSelected(true);
chckbxw.setForeground(Color.BLACK);
chckbxw.setFont(new Font("微软雅黑", Font.PLAIN, 15));
// 自动换行
chckbxw.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
textArea.setLineWrap(chckbxw.isSelected());
}
});
chckbxw.setMnemonic('W');
chckbxw.setHorizontalAlignment(SwingConstants.LEFT);
mno.add(chckbxw);
JMenuItem mntmf = new JMenuItem("\u5B57\u4F53(F)...");
mntmf.setForeground(Color.BLACK);
mntmf.setFont(new Font("微软雅黑", Font.PLAIN, 15));
mntmf.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
JFrame tanchu = new JFrame("字体选择");
JComboBox fontList = new JComboBox();
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
String[] fonts = ge.getAvailableFontFamilyNames();
DefaultComboBoxModel fontModel = new DefaultComboBoxModel(fonts);
fontList.setModel(fontModel);
fontList.setVisible(true);
tanchu.setBounds(frame.getBounds().x, frame.getBounds().y, 400, 300);
tanchu.getContentPane().setLayout(null);
tanchu.getContentPane().add(fontList);
fontList.setBounds(20, 50, 220, 25);
JLabel label = new JLabel("\u5B57\u4F53");
label.setBounds(20, 25, 50, 25);
tanchu.getContentPane().add(label);
JLabel label_1 = new JLabel("\u98CE\u683C");
label_1.setBounds(20, 75, 72, 25);
tanchu.getContentPane().add(label_1);
JLabel label_2 = new JLabel("\u5B57\u53F7");
label_2.setBounds(20, 125, 72, 25);
tanchu.getContentPane().add(label_2);
JComboBox comboBox = new JComboBox();
comboBox.setModel(new DefaultComboBoxModel(
new String[] { "\u5E38\u89C4", "\u503E\u659C", "\u7C97\u4F53", "\u7C97\u504F\u659C\u4F53" }));
comboBox.setBounds(20, 100, 80, 25);
tanchu.getContentPane().add(comboBox);
Object[] FontSize = new Object[71];
for (int i = 0; i < 71; i++) {
FontSize[i] = i + 1;
}
JComboBox comboBox_1 = new JComboBox();
comboBox_1.setBounds(20, 150, 60, 25);
comboBox_1.setModel(new DefaultComboBoxModel(FontSize));
tanchu.getContentPane().add(comboBox_1);
comboBox_1.setSelectedIndex(17);
JButton btnNewButton = new JButton("\u786E\u5B9A");
btnNewButton.setBounds(100, 175, 75, 25);
tanchu.getContentPane().add(btnNewButton);
btnNewButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
String Fontname = fontList.getSelectedItem().toString();
int FontStyle = comboBox.getSelectedIndex();
int FontSize = comboBox_1.getSelectedIndex() + 1;
textArea.setFont(new Font(Fontname, FontStyle, FontSize));
tanchu.dispose();
}
});
JButton btnNewButton_1 = new JButton("\u6062\u590D\u9ED8\u8BA4\u503C");
btnNewButton_1.setBounds(190, 175, 113, 25);
tanchu.getContentPane().add(btnNewButton_1);
btnNewButton_1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
textArea.setFont(new Font("宋体", 0, 19));
tanchu.dispose();
}
});
tanchu.setVisible(true);
tanchu.setDefaultCloseOperation(1);
}
});
mno.add(mntmf);
}
} |
92332a35a55fb3746470875f9b901ee92c523fe6 | 1,298 | java | Java | src/test/java/br/com/labuonapasta/TesteWeb.java | deividr/pedidos | 57c9a32a4cb3ad03cc9fba4b133d4879cc627394 | [
"MIT"
] | null | null | null | src/test/java/br/com/labuonapasta/TesteWeb.java | deividr/pedidos | 57c9a32a4cb3ad03cc9fba4b133d4879cc627394 | [
"MIT"
] | 2 | 2020-06-09T20:53:13.000Z | 2020-09-09T19:22:57.000Z | src/test/java/br/com/labuonapasta/TesteWeb.java | deividr/pedidos | 57c9a32a4cb3ad03cc9fba4b133d4879cc627394 | [
"MIT"
] | null | null | null | 24.037037 | 80 | 0.770416 | 996,479 | package br.com.labuonapasta;
import java.io.IOException;
import javax.xml.bind.JAXBException;
import com.jintegrity.helper.JPAHelper;
import org.junit.After;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import br.com.labuonapasta.banco.ClienteDao;
import br.com.labuonapasta.banco.PedidoDao;
public class TesteWeb {
private static PedidoDao pedidoDao;
private static ClienteDao clienteDao;
private boolean commitarTransacao = false;
@BeforeClass
public static void iniciarDB() throws Exception {
JPAHelper.entityManagerFactory("labuonapasta");
pedidoDao = new PedidoDao();
pedidoDao.setEntityManager(JPAHelper.currentEntityManager());
clienteDao = new ClienteDao();
clienteDao.setEntityManager(JPAHelper.currentEntityManager());
}
@Before
public void iniciarTransacao() {
// JPAHelper.currentEntityManager().getTransaction().begin();
commitarTransacao = false;
}
@After
public void finalizarTransacao() {
// Se o método finalizou com sucesso efetua o commit, senão efetua o rollback.
if (commitarTransacao) {
JPAHelper.currentEntityManager().getTransaction().commit();
} else {
JPAHelper.currentEntityManager().getTransaction().rollback();
}
}
@Test
public void main() throws IOException, JAXBException {
}
}
|
92332acfd7b7f41a55eec5e212abb51e24bdb171 | 1,446 | java | Java | src/StockIT-v1-release_source_from_JADX/sources/com/google/android/gms/internal/ads/zztl.java | atul-vyshnav/2021_IBM_Code_Challenge_StockIT | 25c26a4cc59a3f3e575f617b59acc202ee6ee48a | [
"Apache-2.0"
] | 1 | 2021-11-23T10:12:35.000Z | 2021-11-23T10:12:35.000Z | src/StockIT-v1-release_source_from_JADX/sources/com/google/android/gms/internal/ads/zztl.java | atul-vyshnav/2021_IBM_Code_Challenge_StockIT | 25c26a4cc59a3f3e575f617b59acc202ee6ee48a | [
"Apache-2.0"
] | null | null | null | src/StockIT-v1-release_source_from_JADX/sources/com/google/android/gms/internal/ads/zztl.java | atul-vyshnav/2021_IBM_Code_Challenge_StockIT | 25c26a4cc59a3f3e575f617b59acc202ee6ee48a | [
"Apache-2.0"
] | 1 | 2021-10-01T13:14:19.000Z | 2021-10-01T13:14:19.000Z | 30.765957 | 79 | 0.545643 | 996,480 | package com.google.android.gms.internal.ads;
import android.os.RemoteException;
import java.io.IOException;
/* compiled from: com.google.android.gms:play-services-ads@@19.4.0 */
final /* synthetic */ class zztl implements Runnable {
private final zztm zzbvn;
private final zztb zzbvo;
private final zzte zzbvp;
private final zzbcg zzbvq;
zztl(zztm zztm, zztb zztb, zzte zzte, zzbcg zzbcg) {
this.zzbvn = zztm;
this.zzbvo = zztb;
this.zzbvp = zzte;
this.zzbvq = zzbcg;
}
public final void run() {
zztm zztm = this.zzbvn;
zztb zztb = this.zzbvo;
zzte zzte = this.zzbvp;
zzbcg zzbcg = this.zzbvq;
try {
zzsz zza = zztb.zzmz().zza(zzte);
if (!zza.zzmw()) {
zzbcg.setException(new RuntimeException("No entry contents."));
zztm.zzbvl.disconnect();
return;
}
zztn zztn = new zztn(zztm, zza.zzmx(), 1);
int read = zztn.read();
if (read != -1) {
zztn.unread(read);
zzbcg.set(zztn);
return;
}
throw new IOException("Unable to read from cache.");
} catch (RemoteException | IOException e) {
zzayp.zzc("Unable to obtain a cache service instance.", e);
zzbcg.setException(e);
zztm.zzbvl.disconnect();
}
}
}
|
92332b758f3771486e4167b1bcf234e6244e8252 | 3,593 | java | Java | butterfly/producer/src/main/java/it/unipd/dstack/butterfly/producer/producer/ProducerImpl.java | dstack-group/Butterfly | 87952e4222e52db8511ef5f1ee4b6c0cd01a4ec5 | [
"MIT"
] | 8 | 2019-05-17T21:18:58.000Z | 2020-08-30T18:15:15.000Z | butterfly/producer/src/main/java/it/unipd/dstack/butterfly/producer/producer/ProducerImpl.java | dstack-group/Butterfly | 87952e4222e52db8511ef5f1ee4b6c0cd01a4ec5 | [
"MIT"
] | 4 | 2020-10-02T14:03:34.000Z | 2022-02-26T02:23:32.000Z | butterfly/producer/src/main/java/it/unipd/dstack/butterfly/producer/producer/ProducerImpl.java | dstack-group/Butterfly | 87952e4222e52db8511ef5f1ee4b6c0cd01a4ec5 | [
"MIT"
] | 2 | 2019-04-13T15:25:07.000Z | 2020-05-17T15:57:53.000Z | 35.22549 | 104 | 0.637907 | 996,481 | /**
* @project: Butterfly
* @author: DStack Group
* @module: producer
* @fileName: ProducerImpl.java
* @created: 2019-03-07
*
* --------------------------------------------------------------------------------------------
* Copyright (c) 2019 DStack Group.
* Licensed under the MIT License. See License.txt in the project root for license information.
* --------------------------------------------------------------------------------------------
*
* @description:
*/
package it.unipd.dstack.butterfly.producer.producer;
import it.unipd.dstack.butterfly.config.AbstractConfigManager;
import it.unipd.dstack.butterfly.controller.record.Record;
import it.unipd.dstack.butterfly.producer.utils.ProducerUtils;
import org.apache.kafka.clients.producer.KafkaProducer;
import org.apache.kafka.clients.producer.ProducerRecord;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Properties;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CountDownLatch;
import java.util.function.Consumer;
public class ProducerImpl<V> implements Producer<V> {
private static final Logger logger = LoggerFactory.getLogger(ProducerImpl.class);
private KafkaProducer<String, V> kafkaProducer;
private CountDownLatch latch = new CountDownLatch(1);
public ProducerImpl(AbstractConfigManager configManager) {
this.kafkaProducer = createKafkaProducer(configManager);
}
/**
* Provides the default property configuration for Apache Kafka.
* See https://docs.confluent.io/current/installation/configuration/producer-configs.html
*/
private static <K, V> KafkaProducer<K, V> createKafkaProducer(AbstractConfigManager configManager) {
Properties properties = KafkaProducerProperties.getProducerProperties(configManager);
return new KafkaProducer<>(properties);
}
/**
* Asynchronously produce a Record element
*
* @param record
* @return
*/
@Override
public CompletableFuture<Void> send(Record<V> record) {
return ProducerUtils.getCompletableFuture(callback -> {
var kafkaRecord = new ProducerRecord<String, V>(record.getTopic(), record.getData());
if (logger.isInfoEnabled()) {
logger.info(String.format("KafkaRecord being sent to topic %s", kafkaRecord.topic()));
}
this.kafkaProducer.send(kafkaRecord, callback);
});
}
/**
* Releases any system resources associated with the current object.
*/
@Override
public void close() {
this.latch.countDown();
logger.info("Closing Kafka kafkaProducer connection...");
kafkaProducer.flush();
kafkaProducer.close();
}
/**
* Blocks the current thread until an error is thrown or until the close() method is called.
* @param onError action to be run when an error is thrown
*/
@Override
public void awaitUntilError(Consumer<Exception> onError) {
Exception error = null;
try {
logger.info("Awaiting on latch");
this.latch.await();
} catch (InterruptedException e) {
Thread.currentThread().interrupt(); // set interrupt flag
logger.error(String.format("InterruptingException error: %s", e));
error = e;
} catch (RuntimeException e) {
logger.error(String.format("RuntimeException error: %s", e));
error = e;
} finally {
this.latch.countDown();
onError.accept(error);
}
}
}
|
92332db870a29c852ccdadb0c9d98d90b5730d49 | 2,813 | java | Java | src/gui/HomeController.java | ShoroukAziz/The-Portal | b64a8bbe6dce3d6d7f8f3056e44aa94145f3323e | [
"MIT"
] | null | null | null | src/gui/HomeController.java | ShoroukAziz/The-Portal | b64a8bbe6dce3d6d7f8f3056e44aa94145f3323e | [
"MIT"
] | null | null | null | src/gui/HomeController.java | ShoroukAziz/The-Portal | b64a8bbe6dce3d6d7f8f3056e44aa94145f3323e | [
"MIT"
] | null | null | null | 27.851485 | 133 | 0.610736 | 996,482 |
package gui;
import functionality.ProfilesRelated;
import java.io.IOException;
import java.net.URL;
import java.sql.ResultSet;
import java.sql.SQLException;
import db.DatabaseConnection;
import java.sql.Statement;
import java.util.ResourceBundle;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.fxml.Initializable;
import javafx.scene.control.PasswordField;
import javafx.scene.control.TextField;
import javafx.scene.layout.AnchorPane;
import javax.swing.JOptionPane;
/**
*
* @author shorouk
*/
public class HomeController implements Initializable {
static int id;
@FXML
private PasswordField passwordField;
@FXML
private TextField userNameField;
@FXML
private AnchorPane homeRoot ;
@FXML
private void loadStudentDashBoard (ActionEvent event) throws IOException {
AnchorPane pane = FXMLLoader.load(getClass().getResource("student/StudentDashBoard.fxml"));
homeRoot.getChildren().setAll(pane);
}
@FXML
private void loadInstructorDashBoard (ActionEvent event) throws IOException {
AnchorPane pane = FXMLLoader.load(getClass().getResource("instructor/InstructorDashBoard.fxml"));
homeRoot.getChildren().setAll(pane);
}
@FXML
private void login(ActionEvent event) throws SQLException, IOException, InterruptedException {
String usr = userNameField.getText();
String pass = passwordField.getText();
Statement statement = DatabaseConnection.connection.createStatement();
ResultSet resultSet = statement.executeQuery("SELECT id FROM profiles WHERE userName ='" +usr+"' AND password='"+pass+"';");
String theid="";
while (resultSet.next())
{
theid = resultSet.getString(1);
}
if(theid.startsWith("22")) // Student
{
id = Integer.parseInt(theid);
ProfilesRelated.filltheProfile(id);
loadStudentDashBoard(event);
}
else if (theid.startsWith("11")) //instructor
{
id = Integer.parseInt(theid);
System.out.println(id);
ProfilesRelated.filltheProfile(id);
loadInstructorDashBoard(event);
}
else
{
JOptionPane.showMessageDialog(null,"Please Enter a valid user name and password");
}
}
@Override
public void initialize(URL url, ResourceBundle rb) {
// TODO
RegistrationSystemProject.stage.setResizable(false);
}
}
|
92332de4bacc16b529e96af0e898ecf01fecae08 | 1,017 | java | Java | prov/src/test/java/org/bouncycastle/pqc/jcajce/provider/test/AllTests.java | patriotemeritus/bc-java | ec18882158f78f2d691a98f24b32d52192e69353 | [
"MIT"
] | 34 | 2015-02-04T18:03:14.000Z | 2020-11-10T06:45:28.000Z | test/src/org/bouncycastle/pqc/jcajce/provider/test/AllTests.java | sake/bouncycastle-java | cd620fe014569fd27ba1545e7996d6090d0c8c2f | [
"MIT"
] | 5 | 2015-06-30T21:17:00.000Z | 2016-06-14T22:31:51.000Z | test/src/org/bouncycastle/pqc/jcajce/provider/test/AllTests.java | sake/bouncycastle-java | cd620fe014569fd27ba1545e7996d6090d0c8c2f | [
"MIT"
] | 15 | 2015-10-29T14:21:58.000Z | 2022-01-19T07:33:14.000Z | 28.25 | 80 | 0.702065 | 996,483 | package org.bouncycastle.pqc.jcajce.provider.test;
import java.security.Security;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
import org.bouncycastle.pqc.jcajce.provider.BouncyCastlePQCProvider;
public class AllTests
extends TestCase
{
public static void main (String[] args)
{
junit.textui.TestRunner.run(suite());
}
public static Test suite()
{
TestSuite suite = new TestSuite("PQC JCE Tests");
if (Security.getProvider(BouncyCastlePQCProvider.PROVIDER_NAME) == null)
{
Security.addProvider(new BouncyCastlePQCProvider());
}
suite.addTestSuite(RainbowSignatureTest.class);
suite.addTestSuite(McElieceFujisakiCipherTest.class);
suite.addTestSuite(McElieceKobaraImaiCipherTest.class);
suite.addTestSuite(McEliecePointchevalCipherTest.class);
suite.addTestSuite(McEliecePKCSCipherTest.class);
return suite;
}
}
|
92332dfc6a5fd28587b49477dad2c40731d40eb2 | 1,693 | java | Java | src/de/inetsoftware/jwebassembly/binary/TypeEntry.java | MrHate/JWebAssembly | 3d328c688e8782c08ca663ba1b97e975ae08f8db | [
"Apache-2.0"
] | 635 | 2017-03-20T19:12:48.000Z | 2022-03-26T05:23:38.000Z | src/de/inetsoftware/jwebassembly/binary/TypeEntry.java | MrHate/JWebAssembly | 3d328c688e8782c08ca663ba1b97e975ae08f8db | [
"Apache-2.0"
] | 31 | 2017-04-07T15:18:50.000Z | 2022-03-31T09:22:36.000Z | src/de/inetsoftware/jwebassembly/binary/TypeEntry.java | MrHate/JWebAssembly | 3d328c688e8782c08ca663ba1b97e975ae08f8db | [
"Apache-2.0"
] | 62 | 2017-06-06T13:31:11.000Z | 2022-03-12T02:25:02.000Z | 25.651515 | 89 | 0.660366 | 996,484 | /*
* Copyright 2019 Volker Berlin (i-net software)
*
* 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 de.inetsoftware.jwebassembly.binary;
import java.io.IOException;
import de.inetsoftware.jwebassembly.wasm.ValueType;
/**
* An entry in the type section of the WebAssembly.
*
* @author Volker Berlin
*/
abstract class TypeEntry extends SectionEntry {
/**
* {@inheritDoc}
*/
@Override
final void writeSectionEntry( WasmOutputStream stream ) throws IOException {
stream.writeValueType( getTypeForm() );
writeSectionEntryDetails( stream );
}
/**
* Get the form of the type.
* @return the form
*/
abstract ValueType getTypeForm();
/**
* Write this single entry to a section
*
* @param stream
* the target
* @throws IOException
* if any I/O error occur
*/
abstract void writeSectionEntryDetails( WasmOutputStream stream ) throws IOException;
/**
* {@inheritDoc}
*/
@Override
public abstract int hashCode();
/**
* {@inheritDoc}
*/
@Override
public abstract boolean equals( Object obj );
}
|
92332e1c8d551305e12fa4f8eea979ba292130fa | 1,847 | java | Java | src/main/java/ru/xezard/rules/punishments/data/AbstractPunishmentManager.java | Xezard/XRulesPunishments | efaf9a15965c11bf7b31eedb8d8e654cc301531a | [
"Apache-2.0"
] | null | null | null | src/main/java/ru/xezard/rules/punishments/data/AbstractPunishmentManager.java | Xezard/XRulesPunishments | efaf9a15965c11bf7b31eedb8d8e654cc301531a | [
"Apache-2.0"
] | null | null | null | src/main/java/ru/xezard/rules/punishments/data/AbstractPunishmentManager.java | Xezard/XRulesPunishments | efaf9a15965c11bf7b31eedb8d8e654cc301531a | [
"Apache-2.0"
] | null | null | null | 29.790323 | 89 | 0.715755 | 996,485 | /*
* This file is part of XRulesPunishments,
* licensed under the Apache License, Version 2.0.
*
* Copyright (c) Xezard (Zotov Ivan)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package ru.xezard.rules.punishments.data;
import lombok.Getter;
import ru.xezard.rules.punishments.data.repository.PunishmentsRepository;
import ru.xezard.rules.punishments.data.rule.Rule;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.function.Function;
import java.util.logging.Logger;
import java.util.stream.Collectors;
public abstract class AbstractPunishmentManager
implements IPunishmentsManager
{
@Getter
protected final PunishmentsRepository repository = new PunishmentsRepository();
protected Map<String, Rule> rules = new HashMap<> ();
protected Logger logger;
public AbstractPunishmentManager(Logger logger)
{
this.logger = logger;
}
@Override
public void loadRules(List<Rule> rules)
{
this.rules.putAll
(
rules.stream()
.collect(Collectors.toMap(Rule::getIdentifier, Function.identity()))
);
}
public Optional<Rule> getRuleByIdentifier(String identifier)
{
return Optional.ofNullable(this.rules.get(identifier));
}
} |
92332e9bf6b1d593f880e289de32c2546122a0ec | 2,593 | java | Java | src/LambdaVisitor.java | Tirke/Lambda-Interpreter | d997b4c54e0b5edc5a3eda681608654c5c85806a | [
"MIT"
] | 4 | 2016-12-21T12:12:37.000Z | 2020-07-17T22:22:51.000Z | src/LambdaVisitor.java | Tirke/Lambda-Interpreter | d997b4c54e0b5edc5a3eda681608654c5c85806a | [
"MIT"
] | null | null | null | src/LambdaVisitor.java | Tirke/Lambda-Interpreter | d997b4c54e0b5edc5a3eda681608654c5c85806a | [
"MIT"
] | 1 | 2020-11-11T20:52:10.000Z | 2020-11-11T20:52:10.000Z | 34.573333 | 96 | 0.725415 | 996,486 | // Generated from /Users/Tirke/Downloads/The Lambda Interpreter/Sources/Lambda.g4 by ANTLR 4.5.1
import org.antlr.v4.runtime.tree.ParseTreeVisitor;
/**
* This interface defines a complete generic visitor for a parse tree produced
* by {@link LambdaParser}.
*
* @param <T> The return type of the visit operation. Use {@link Void} for
* operations with no return type.
*/
public interface LambdaVisitor<T> extends ParseTreeVisitor<T> {
/**
* Visit a parse tree produced by the {@code add}
* labeled alternative in {@link LambdaParser#expression}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitAdd(LambdaParser.AddContext ctx);
/**
* Visit a parse tree produced by the {@code mult}
* labeled alternative in {@link LambdaParser#expression}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitMult(LambdaParser.MultContext ctx);
/**
* Visit a parse tree produced by the {@code application}
* labeled alternative in {@link LambdaParser#expression}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitApplication(LambdaParser.ApplicationContext ctx);
/**
* Visit a parse tree produced by the {@code recRule}
* labeled alternative in {@link LambdaParser#expression}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitRecRule(LambdaParser.RecRuleContext ctx);
/**
* Visit a parse tree produced by the {@code abstraction}
* labeled alternative in {@link LambdaParser#expression}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitAbstraction(LambdaParser.AbstractionContext ctx);
/**
* Visit a parse tree produced by the {@code variable}
* labeled alternative in {@link LambdaParser#expression}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitVariable(LambdaParser.VariableContext ctx);
/**
* Visit a parse tree produced by the {@code ifRule}
* labeled alternative in {@link LambdaParser#expression}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitIfRule(LambdaParser.IfRuleContext ctx);
/**
* Visit a parse tree produced by the {@code parenExpression}
* labeled alternative in {@link LambdaParser#expression}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitParenExpression(LambdaParser.ParenExpressionContext ctx);
/**
* Visit a parse tree produced by the {@code integer}
* labeled alternative in {@link LambdaParser#expression}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitInteger(LambdaParser.IntegerContext ctx);
} |
923330b6f1ec5d28e13fdb6a40c9e5171787e789 | 650 | java | Java | lwjgl3-swt-common/src/main/java/org/lwjgl/opengl/swt/PlatformGLCanvas.java | Renanse/lwjgl3-swt | 415cae2396ae11eb54f89643d458ed2560f858c1 | [
"MIT"
] | 23 | 2018-05-23T18:27:12.000Z | 2022-02-10T12:45:05.000Z | lwjgl3-swt-common/src/main/java/org/lwjgl/opengl/swt/PlatformGLCanvas.java | Renanse/lwjgl3-swt | 415cae2396ae11eb54f89643d458ed2560f858c1 | [
"MIT"
] | 13 | 2018-07-09T18:35:21.000Z | 2022-03-14T00:28:31.000Z | lwjgl3-swt-common/src/main/java/org/lwjgl/opengl/swt/PlatformGLCanvas.java | Renanse/lwjgl3-swt | 415cae2396ae11eb54f89643d458ed2560f858c1 | [
"MIT"
] | 9 | 2019-02-04T19:48:10.000Z | 2021-02-25T01:04:02.000Z | 22.413793 | 68 | 0.713846 | 996,487 | package org.lwjgl.opengl.swt;
import org.eclipse.swt.widgets.Composite;
/**
* Interface of platform-specific GLCanvas delegate classes.
*
* @author Kai Burjack
*/
interface PlatformGLCanvas {
long create(GLCanvas canvas, GLData attribs, GLData effective);
boolean isCurrent(long context);
boolean makeCurrent(GLCanvas canvas, long context);
boolean deleteContext(GLCanvas canvas, long context);
boolean swapBuffers(GLCanvas canvas);
boolean delayBeforeSwapNV(GLCanvas canvas, float seconds);
int checkStyle(Composite parent, int style);
void resetStyle(Composite parent);
}
|
9233315a69b67c2a68e964f03281da496f0731d3 | 1,056 | java | Java | extensions/cli/debug/src/main/java/mil/nga/giat/geowave/cli/debug/DebugOperationsProvider.java | cjw5db/geowave | 3cf39ecb94263f60021641bc91f95f9a9d9c3c16 | [
"Apache-2.0"
] | null | null | null | extensions/cli/debug/src/main/java/mil/nga/giat/geowave/cli/debug/DebugOperationsProvider.java | cjw5db/geowave | 3cf39ecb94263f60021641bc91f95f9a9d9c3c16 | [
"Apache-2.0"
] | null | null | null | extensions/cli/debug/src/main/java/mil/nga/giat/geowave/cli/debug/DebugOperationsProvider.java | cjw5db/geowave | 3cf39ecb94263f60021641bc91f95f9a9d9c3c16 | [
"Apache-2.0"
] | 1 | 2021-09-01T08:48:07.000Z | 2021-09-01T08:48:07.000Z | 31.058824 | 80 | 0.650568 | 996,488 | /*******************************************************************************
* Copyright (c) 2013-2017 Contributors to the Eclipse Foundation
*
* See the NOTICE file distributed with this work for additional
* information regarding copyright ownership.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Apache License,
* Version 2.0 which accompanies this distribution and is available at
* http://www.apache.org/licenses/LICENSE-2.0.txt
******************************************************************************/
package mil.nga.giat.geowave.cli.debug;
import mil.nga.giat.geowave.core.cli.spi.CLIOperationProviderSpi;
public class DebugOperationsProvider implements
CLIOperationProviderSpi
{
private static final Class<?>[] OPERATIONS = new Class<?>[] {
DebugSection.class,
BBOXQuery.class,
ClientSideCQLQuery.class,
CQLQuery.class,
FullTableScan.class,
MinimalFullTable.class
};
@Override
public Class<?>[] getOperations() {
return OPERATIONS;
}
}
|
92333291216f5e34b32b67ec4532f926391876ba | 9,573 | java | Java | site-toolkit/components/core/src/main/java/org/hippoecm/hst/container/CmsSSOAuthenticationHandler.java | athenagroup/brxm | 58d3c299f2b925a857e55d689e0cb4ee0258d82c | [
"Apache-2.0"
] | null | null | null | site-toolkit/components/core/src/main/java/org/hippoecm/hst/container/CmsSSOAuthenticationHandler.java | athenagroup/brxm | 58d3c299f2b925a857e55d689e0cb4ee0258d82c | [
"Apache-2.0"
] | 28 | 2020-10-29T15:59:43.000Z | 2022-03-02T12:50:38.000Z | site-toolkit/components/core/src/main/java/org/hippoecm/hst/container/CmsSSOAuthenticationHandler.java | ajbanck/brxm | 79d55e2d88a320719a78e3b4534799495336b572 | [
"Apache-2.0"
] | null | null | null | 50.384211 | 158 | 0.712003 | 996,489 | /*
* Copyright 2018-2020 Hippo B.V. (http://www.onehippo.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.hippoecm.hst.container;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.hippoecm.hst.configuration.model.HstManager;
import org.hippoecm.hst.core.container.ContainerException;
import org.hippoecm.hst.container.security.AccessToken;
import org.hippoecm.hst.site.HstServices;
import org.onehippo.cms7.services.HippoServiceRegistry;
import org.onehippo.cms7.services.cmscontext.CmsContextService;
import org.onehippo.cms7.services.cmscontext.CmsSessionContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import static org.hippoecm.hst.core.container.ContainerConstants.PREVIEW_ACCESS_TOKEN_REQUEST_ATTRIBUTE;
import static org.hippoecm.hst.core.container.ContainerConstants.CMS_REQUEST_USER_ID_ATTR;
import static org.hippoecm.hst.util.HstRequestUtils.getCmsBaseURL;
public class CmsSSOAuthenticationHandler {
private final static Logger log = LoggerFactory.getLogger(CmsSSOAuthenticationHandler.class);
static boolean isAuthenticated(final HstContainerRequest containerRequest) {
if (containerRequest.getAttribute(PREVIEW_ACCESS_TOKEN_REQUEST_ATTRIBUTE) != null) {
log.debug("Request '{}' is invoked with an authorization token.", containerRequest.getRequestURL());
final AccessToken accessToken = (AccessToken)containerRequest.getAttribute(PREVIEW_ACCESS_TOKEN_REQUEST_ATTRIBUTE);
containerRequest.setAttribute(CMS_REQUEST_USER_ID_ATTR, accessToken.getCmsSessionContext().getRepositoryCredentials().getUserID());
return true;
}
log.debug("Request '{}' is invoked from CMS context. Check whether the SSO handshake is done.", containerRequest.getRequestURL());
final HttpSession httpSession = containerRequest.getSession(false);
CmsSessionContext cmsSessionContext = httpSession != null ? CmsSessionContext.getContext(httpSession) : null;
if (httpSession == null || cmsSessionContext == null) {
return false;
}
containerRequest.setAttribute(CMS_REQUEST_USER_ID_ATTR, cmsSessionContext.getRepositoryCredentials().getUserID());
return true;
}
/**
* If the {@code containerRequest} contains the right information to exchange the site http session
* information with the CMS session context the response gets committed with a {@link HttpServletResponse#SC_NO_CONTENT}
* status and if the {@code containerRequest} does not contain the required info the {@code servletResponse} gets
* committed already with a redirect or an error
*/
static boolean authenticate(final HstContainerRequest containerRequest,
final HttpServletResponse servletResponse) throws ContainerException {
log.debug("Request '{}' is invoked from CMS context. Check whether the SSO handshake is done.", containerRequest.getRequestURL());
CmsContextService cmsContextService = HippoServiceRegistry.getService(CmsContextService.class);
if (cmsContextService == null) {
log.debug("No CmsContextService available");
sendError(servletResponse, HttpServletResponse.SC_BAD_REQUEST);
return false;
}
final String cmsContextServiceId = containerRequest.getParameter("cmsCSID");
final String cmsSessionContextId = containerRequest.getParameter("cmsSCID");
if (cmsContextServiceId == null || cmsSessionContextId == null) {
// no CmsSessionContext and/or CmsContextService IDs provided: if possible, request these by redirecting back to CMS
final String method = containerRequest.getMethod();
if (!"GET".equals(method) && !"HEAD".equals(method)) {
log.warn("Invalid request to redirect for authentication because request method is '{}' and only" +
" 'GET' or 'HEAD' are allowed", method);
sendError(servletResponse, HttpServletResponse.SC_UNAUTHORIZED);
return false;
}
log.debug("No CmsSessionContext and/or CmsContextService IDs found. Redirect to the CMS");
redirectToCms(containerRequest, servletResponse, cmsContextService.getId());
return false;
}
if (!cmsContextServiceId.equals(cmsContextService.getId())) {
log.warn("Cannot authorize request: not coming from this CMS HOST. Redirecting to cms authentication URL to retry.");
redirectToCms(containerRequest, servletResponse, cmsContextService.getId());
return false;
}
final HttpSession httpSession = containerRequest.getSession();
final CmsSessionContext cmsSessionContext = cmsContextService.attachSessionContext(cmsSessionContextId, httpSession);
if (cmsSessionContext == null) {
httpSession.invalidate();
log.warn("Cannot authorize request: CmsSessionContext not found");
sendError(servletResponse, HttpServletResponse.SC_UNAUTHORIZED);
return false;
}
log.debug("Authenticated '{}' successfully", cmsSessionContext.getRepositoryCredentials().getUserID());
containerRequest.setAttribute(CMS_REQUEST_USER_ID_ATTR, cmsSessionContext.getRepositoryCredentials().getUserID());
return true;
}
private static void sendError(final HttpServletResponse servletResponse, final int errorCode) throws ContainerException {
try {
servletResponse.sendError(errorCode);
} catch (IOException e) {
throw new ContainerException(String.format("Unable to send unauthorized (%s) response to client", errorCode) , e);
}
}
private static void redirectToCms(final HstContainerRequest containerRequest, final HttpServletResponse servletResponse,
final String cmsContextServiceId) throws ContainerException {
if (containerRequest.getParameterMap().containsKey("retry")) {
// endless redirect loop protection
// in case the loadbalancer keeps skewing the CMS and HST application from different container instances
sendError(servletResponse, HttpServletResponse.SC_CONFLICT);
return;
}
try {
final String cmsAuthUrl = createCmsAuthenticationUrl(containerRequest, cmsContextServiceId);
servletResponse.sendRedirect(cmsAuthUrl);
} catch (UnsupportedEncodingException e) {
log.error("Unable to encode the destination url with UTF8 encoding " + e.getMessage(), e);
sendError(servletResponse, HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
} catch (IOException e) {
log.error("Something gone wrong so stopping valve invocation fall through: " + e.getMessage(), e);
sendError(servletResponse, HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
}
}
private static String createCmsAuthenticationUrl(final HstContainerRequest containerRequest, final String cmsContextServiceId) throws ContainerException {
// we need to find out whether the cms URL looks like http(s)://host/cms or http(s)://host (without context path)
// we know that the current request is over the current cms host. We need to match the current host to the
// platform hst model to find out whether to include the platform context path or not
final String cmsLocation = getCmsBaseURL(containerRequest);
final String destinationPath = createDestinationPath(containerRequest);
final StringBuilder authUrl = new StringBuilder(cmsLocation);
if (!cmsLocation.endsWith("/")) {
authUrl.append("/");
}
authUrl.append("auth?destinationPath=").append(destinationPath);
if (cmsContextServiceId != null) {
authUrl.append("&cmsCSID=").append(cmsContextServiceId);
}
return authUrl.toString();
}
private static String createDestinationPath(final HstContainerRequest containerRequest) {
final StringBuilder destinationPath = new StringBuilder();
// we start with the request uri including the context path (normally this is /site/...)
destinationPath.append(containerRequest.getRequestURI());
if (containerRequest.getPathSuffix() != null) {
final HstManager hstManager = HstServices.getComponentManager().getComponent(HstManager.class.getName());
final String subPathDelimiter = hstManager.getPathSuffixDelimiter();
destinationPath.append(subPathDelimiter).append(containerRequest.getPathSuffix());
}
final String queryString = containerRequest.getQueryString();
if (queryString != null) {
destinationPath.append("?").append(queryString);
}
return destinationPath.toString();
}
}
|
92333368c7d017253ec53526854851ef6560f8f5 | 153 | java | Java | net-url/src/main/java/org/xbib/net/scheme/SftpScheme.java | xbib/net | e594368469b358160b2e4d9bc6e3e0141f0c80db | [
"Apache-2.0"
] | 3 | 2019-10-08T08:31:54.000Z | 2021-01-24T02:24:23.000Z | net-url/src/main/java/org/xbib/net/scheme/SftpScheme.java | xbib/net | e594368469b358160b2e4d9bc6e3e0141f0c80db | [
"Apache-2.0"
] | 1 | 2019-08-16T16:38:18.000Z | 2019-08-16T17:43:05.000Z | net-url/src/main/java/org/xbib/net/scheme/SftpScheme.java | xbib/net | e594368469b358160b2e4d9bc6e3e0141f0c80db | [
"Apache-2.0"
] | null | null | null | 11.769231 | 36 | 0.588235 | 996,490 | package org.xbib.net.scheme;
/**
* Secure FTP scheme.
*/
class SftpScheme extends SshScheme {
SftpScheme() {
super("sftp", 22);
}
}
|
92333419a7db03fbb4b7e19a04271e8188b80200 | 3,434 | java | Java | spring-boot/admin/src/main/java/eu/coatrack/admin/controllers/CoverController.java | TomWolffATB/coatrack | 442a5b1e270a638c654d0d5db1df164c5e52de50 | [
"Apache-2.0"
] | 7 | 2020-04-11T20:07:44.000Z | 2021-09-20T13:08:52.000Z | spring-boot/admin/src/main/java/eu/coatrack/admin/controllers/CoverController.java | TomWolffATB/coatrack | 442a5b1e270a638c654d0d5db1df164c5e52de50 | [
"Apache-2.0"
] | 139 | 2020-04-15T10:55:53.000Z | 2022-03-24T10:58:21.000Z | spring-boot/admin/src/main/java/eu/coatrack/admin/controllers/CoverController.java | TomWolffATB/coatrack | 442a5b1e270a638c654d0d5db1df164c5e52de50 | [
"Apache-2.0"
] | 10 | 2020-04-11T20:14:14.000Z | 2022-03-15T08:06:26.000Z | 36.531915 | 196 | 0.765288 | 996,491 | package eu.coatrack.admin.controllers;
/*-
* #%L
* coatrack-admin
* %%
* Copyright (C) 2013 - 2020 Corizon | Institut für angewandte Systemtechnik Bremen GmbH (ATB)
* %%
* 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.
* #L%
*/
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.IOException;
import java.text.ParseException;
import java.util.UUID;
import eu.coatrack.admin.model.repository.CoverRepository;
import eu.coatrack.admin.model.repository.ServiceApiRepository;
import eu.coatrack.admin.service.CoverImageReadService;
import eu.coatrack.api.ServiceApi;
import eu.coatrack.api.ServiceCover;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.security.core.Authentication;
import org.springframework.stereotype.Controller;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.ModelAndView;
@Controller
@RequestMapping(value = "/admin/covers")
public class CoverController {
private static final Logger log = LoggerFactory.getLogger(CoverController.class);
@Autowired
private CoverRepository coverRepository;
@Autowired
private ServiceApiRepository serviceRepository;
@Autowired
private CoverImageReadService coverImageReadService;
@Autowired
AdminServicesController adminServicesController;
@Value("${ygg.admin.servicecovers.path}")
private String serviceCoversPath;
@Value("${ygg.admin.servicecovers.url}")
private String serviceCoversUrl;
@RequestMapping(value = "/{id}/upload")
public ModelAndView fileUpload(Authentication auth, @PathVariable("id") Long serviceId, @RequestParam("file") MultipartFile file) throws IOException, ParseException, java.text.ParseException {
ServiceApi service = serviceRepository.findOne(serviceId);
String coverFilename = UUID.randomUUID().toString();
ServiceCover cover = new ServiceCover();
cover.setService(service);
cover.setOriginalFileName(StringUtils.cleanPath(file.getOriginalFilename()));
cover.setFileName(coverFilename);
cover.setFileType(file.getContentType());
cover.setSize(file.getSize());
cover.setLocalPath(serviceCoversPath + File.separator + coverFilename);
cover.setUrl(serviceCoversUrl + coverFilename);
coverImageReadService.readExcelInputStream(new ByteArrayInputStream(file.getBytes()),
new File(cover.getLocalPath()));
coverRepository.save(cover);
return adminServicesController.serviceListPage();
}
}
|
923334a4ec2776d06a60649fa80e2bc59aeed642 | 1,208 | java | Java | src/main/java/edu/file/protocol/component/FileSender.java | stasgora/file-protocol-component | f4496e01d274b7e99d4baccc37bf91d55f4a86e1 | [
"MIT"
] | null | null | null | src/main/java/edu/file/protocol/component/FileSender.java | stasgora/file-protocol-component | f4496e01d274b7e99d4baccc37bf91d55f4a86e1 | [
"MIT"
] | 1 | 2020-06-02T16:24:32.000Z | 2020-06-02T16:24:32.000Z | src/main/java/edu/file/protocol/component/FileSender.java | stasgora/file-protocol-component | f4496e01d274b7e99d4baccc37bf91d55f4a86e1 | [
"MIT"
] | null | null | null | 34.514286 | 141 | 0.827815 | 996,492 | package edu.file.protocol.component;
import edu.file.encryption.component.enums.CipherAlgorithmMode;
import edu.file.encryption.component.interfaces.ICryptoComponent;
import edu.file.protocol.component.interfaces.ConnectionEventHandler;
import edu.file.protocol.component.interfaces.FileSentEvent;
import edu.file.protocol.component.sockets.SenderSocket;
import java.io.File;
import java.net.InetAddress;
public class FileSender {
private Thread socketThread;
private FileSentEvent fileSentEvent;
private ICryptoComponent cryptoComponent;
private final InetAddress address;
private final ConnectionEventHandler eventHandler;
public FileSender(ConnectionEventHandler eventHandler, FileSentEvent fileSentEvent, ICryptoComponent cryptoComponent, InetAddress address) {
this.eventHandler = eventHandler;
this.fileSentEvent = fileSentEvent;
this.cryptoComponent = cryptoComponent;
this.address = address;
}
public void sendFile(File file, CipherAlgorithmMode algorithmMode, String recipient) {
SenderSocket socket = new SenderSocket(eventHandler, cryptoComponent, fileSentEvent, address, file, algorithmMode, recipient);
socketThread = new Thread(socket);
socketThread.start();
}
}
|
923334e78797598e2d69f8de54ec72e8b6ac6998 | 5,209 | java | Java | src/main/java/com/qst/controller/AQstStuRecognitionController.java | cdszddcyl/jeesite | 1538ba5bc49a12a54a3bacae1e6ba3acc717198e | [
"Apache-2.0"
] | null | null | null | src/main/java/com/qst/controller/AQstStuRecognitionController.java | cdszddcyl/jeesite | 1538ba5bc49a12a54a3bacae1e6ba3acc717198e | [
"Apache-2.0"
] | null | null | null | src/main/java/com/qst/controller/AQstStuRecognitionController.java | cdszddcyl/jeesite | 1538ba5bc49a12a54a3bacae1e6ba3acc717198e | [
"Apache-2.0"
] | null | null | null | 33.824675 | 135 | 0.634479 | 996,493 | package com.qst.controller;
import com.qst.dao.PageBean;
import com.qst.entity.EliteEntity;
import com.qst.entity.StuRecognitionEntity;
import com.qst.entity.StudentEntity;
import com.qst.service.QstStuRecognitionService;
import com.qst.service.QstStudentService;
import com.thinkgem.jeesite.common.web.BaseController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
import java.util.List;
/**
* 类功能描述:
* 学生认可
* @author wangfeng
* @date 2016/05/17/10:53
*/
@Controller
@RequestMapping("${adminPath}")
public class AQstStuRecognitionController extends BaseController {
@Autowired
private QstStuRecognitionService service;
/**
* 列表页面
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/stuRecognitionList")
public String stuRecognitionList(HttpServletRequest request, HttpServletResponse response){
return "background/stuRecognitionList";
}
/**
* 获取所有列表
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/getStuRecognitionList")
public String getStuRecognitionList(Integer currentpage,HttpServletRequest request, HttpServletResponse response){
try {
if(currentpage == null){
currentpage = 1;
}
List<StuRecognitionEntity> lists = service.getPageList((currentpage-1)*10);
long count = service.getCounts(new HashMap<String, Object>());
PageBean bean = new PageBean();
bean.setPageSize(10);
bean.setCurrentPage(currentpage);
bean.setList(lists);
bean.setTotalPage((int)Math.ceil((double) count/10));
bean.setTotal(service.getCounts(new HashMap<String, Object>()));
return resultSuccessData(response,"查询学生认可数据成功", bean);
} catch (Exception e) {
return resultErrorData(response,"查询学生认可数据异常", null);
}
}
/**
* 添加、编辑页面
* @param id
* @param model
* @return
*/
@RequestMapping(value = "/addStuRecognition",method = RequestMethod.GET)
public String addStuRecognition(int id,ModelMap model){
model.addAttribute("id",id);
return "background/addStuRecognition";
}
/**
* 添加、编辑的方法
*/
@RequestMapping(value = "/addStuRecognition",method = RequestMethod.POST)
public String addStuRecognition(HttpServletRequest request,HttpServletResponse response,StuRecognitionEntity entity){
try {
/* //String save = new File(System.getProperty("user.dir")).getParent();
String save = request.getSession().getServletContext()
.getRealPath("upload");
String newpathsub = new Date().getTime()+".png";
String newpath = save+"/"+newpathsub;
File path = new File(newpath);
FileUtils.copyInputStreamToFile(file.getInputStream(),path);
//entity.setPicture("/upload/"+newpathsub);*/
String id = entity.getId()+"";
int data = 0;
if(id.equals("0")||id==null&&id.equals("")&&id.equals("undefined")){
data = service.save(entity);
}else{
data = service.update(entity);
}
if(data>0){
return resultSuccessData(response,"插入成功", "true");
}else{
return resultErrorData(response,"插入失败","false");
}
} catch (Exception e) {
return resultErrorData(response,"学生认可插入异常", null);
}
}
/**
* 查询某条记录
* @param entity
* @param response
* @return
*/
@RequestMapping(value = "/showStuRecognition")
public String showStuRecognition(StudentEntity entity, HttpServletResponse response){
try {
StuRecognitionEntity model = service.getModelById(entity.getId());
return resultSuccessData(response,"查询某学生认可数据成功", model);
} catch (Exception e) {
return resultErrorData(response,"查询某学生认可数据异常", null);
}
}
/**
* 删除
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/deleteStuRecognition",method = RequestMethod.GET)
public String deleteStuRecognition(HttpServletRequest request, HttpServletResponse response, @ModelAttribute StudentEntity entity){
List<StuRecognitionEntity> entities = service.getAllList();
try {
int data = service.delete(entity.getId());
if(data>0){
return resultSuccessData(response,"删除成功", "true");
}else{
return resultErrorData(response,"删除失败","false");
}
} catch (Exception e) {
return resultErrorData(response,"学生认可删除异常", null);
}
}
}
|
923335e3d247ac6854f858d8c49df005ff9d29b2 | 7,414 | java | Java | zuihou-backend/zuihou-authority/zuihou-authority-biz/src/main/java/com/github/zuihou/authority/service/auth/impl/AuthManager.java | xbxbslt/zuihou-admin-cloud | a6b4f8f152886c21567e58f2b95260419e8583e1 | [
"Apache-2.0"
] | 3 | 2019-11-21T03:22:03.000Z | 2020-03-19T03:53:29.000Z | zuihou-backend/zuihou-authority/zuihou-authority-biz/src/main/java/com/github/zuihou/authority/service/auth/impl/AuthManager.java | xbxbslt/zuihou-admin-cloud | a6b4f8f152886c21567e58f2b95260419e8583e1 | [
"Apache-2.0"
] | null | null | null | zuihou-backend/zuihou-authority/zuihou-authority-biz/src/main/java/com/github/zuihou/authority/service/auth/impl/AuthManager.java | xbxbslt/zuihou-admin-cloud | a6b4f8f152886c21567e58f2b95260419e8583e1 | [
"Apache-2.0"
] | 1 | 2021-07-10T08:15:29.000Z | 2021-07-10T08:15:29.000Z | 39.021053 | 136 | 0.699892 | 996,494 | package com.github.zuihou.authority.service.auth.impl;
import java.time.LocalDateTime;
import java.util.List;
import java.util.stream.Collectors;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.github.zuihou.auth.server.utils.JwtTokenServerUtils;
import com.github.zuihou.auth.utils.JwtUserInfo;
import com.github.zuihou.auth.utils.Token;
import com.github.zuihou.authority.dto.auth.LoginDTO;
import com.github.zuihou.authority.dto.auth.ResourceQueryDTO;
import com.github.zuihou.authority.dto.auth.UserDTO;
import com.github.zuihou.authority.entity.auth.Resource;
import com.github.zuihou.authority.entity.auth.User;
import com.github.zuihou.authority.entity.defaults.GlobalUser;
import com.github.zuihou.authority.entity.defaults.Tenant;
import com.github.zuihou.authority.enumeration.auth.Sex;
import com.github.zuihou.authority.enumeration.defaults.TenantStatusEnum;
import com.github.zuihou.authority.service.auth.ResourceService;
import com.github.zuihou.authority.service.auth.UserService;
import com.github.zuihou.authority.service.defaults.GlobalUserService;
import com.github.zuihou.authority.service.defaults.TenantService;
import com.github.zuihou.authority.utils.TimeUtils;
import com.github.zuihou.base.R;
import com.github.zuihou.context.BaseContextHandler;
import com.github.zuihou.database.mybatis.conditions.Wraps;
import com.github.zuihou.dozer.DozerUtils;
import com.github.zuihou.exception.BizException;
import com.github.zuihou.exception.code.ExceptionCode;
import com.github.zuihou.utils.BizAssert;
import com.github.zuihou.utils.NumberHelper;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.codec.digest.DigestUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import static com.github.zuihou.utils.BizAssert.gt;
import static com.github.zuihou.utils.BizAssert.isTrue;
import static com.github.zuihou.utils.BizAssert.notNull;
/**
* @author zuihou
* @createTime 2017-12-15 13:42
*/
@Service
@Slf4j
public class AuthManager {
@Autowired
private JwtTokenServerUtils jwtTokenServerUtils;
@Autowired
private UserService userService;
@Autowired
private GlobalUserService globalUserService;
@Autowired
private ResourceService resourceService;
@Autowired
private TenantService tenantService;
@Autowired
private DozerUtils dozer;
private static final String SUPER_TENANT = "admin";
private static final String[] SUPER_ACCOUNT = new String[]{"admin", "superAdmin"};
/**
* 超管账号登录
*
* @param account
* @param password
* @return
*/
public R<LoginDTO> adminLogin(String account, String password) {
GlobalUser user = globalUserService.getOne(Wrappers.<GlobalUser>lambdaQuery()
.eq(GlobalUser::getAccount, account).eq(GlobalUser::getTenantCode, SUPER_TENANT));
// 密码错误
if (user == null) {
throw new BizException(ExceptionCode.JWT_USER_INVALID.getCode(), ExceptionCode.JWT_USER_INVALID.getMsg());
}
String passwordMd5 = DigestUtils.md5Hex(password);
if (!user.getPassword().equalsIgnoreCase(passwordMd5)) {
userService.updatePasswordErrorNumById(user.getId());
return R.fail("用户名或密码错误!");
}
JwtUserInfo userInfo = new JwtUserInfo(user.getId(), user.getAccount(), user.getName(), 0L, 0L);
Token token = jwtTokenServerUtils.generateUserToken(userInfo, null);
log.info("token={}", token.getToken());
UserDTO dto = dozer.map(user, UserDTO.class);
dto.setStatus(true).setOrgId(0L).setStationId(0L).setAvatar("").setSex(Sex.M).setWorkDescribe("心情很美丽");
return R.success(LoginDTO.builder().user(dto).token(token).build());
}
/**
* 租户账号登录
*
* @param tenantCode
* @param account
* @param password
* @return
*/
public R<LoginDTO> login(String tenantCode, String account, String password) {
// 1,检测租户是否可用
Tenant tenant = tenantService.getByCode(tenantCode);
notNull(tenant, "企业不存在");
BizAssert.equals(TenantStatusEnum.NORMAL, tenant.getStatus(), "企业不可用~");
if (tenant.getExpirationTime() != null) {
gt(LocalDateTime.now(), tenant.getExpirationTime(), "企业服务已到期~");
}
BaseContextHandler.setTenant(tenant.getCode());
// 2. 验证登录
R<User> result = getUser(tenant, account, password);
if (result.getIsError()) {
return R.fail(result.getCode(), result.getMsg());
}
User user = result.getData();
// 3, token
Token token = getToken(user);
List<Resource> resourceList = resourceService.findVisibleResource(ResourceQueryDTO.builder().userId(user.getId()).build());
List<String> permissionsList = resourceList.stream().map(Resource::getCode).collect(Collectors.toList());
log.info("account={}", account);
return R.success(LoginDTO.builder().user(dozer.map(user, UserDTO.class)).permissionsList(permissionsList).token(token).build());
}
private Token getToken(User user) {
JwtUserInfo userInfo = new JwtUserInfo(user.getId(), user.getAccount(), user.getName(), user.getOrgId(), user.getStationId());
Token token = jwtTokenServerUtils.generateUserToken(userInfo, null);
log.info("token={}", token.getToken());
return token;
}
private R<User> getUser(Tenant tenant, String account, String password) {
User user = userService.getOne(Wrappers.<User>lambdaQuery()
.eq(User::getAccount, account));
// 密码错误
String passwordMd5 = DigestUtils.md5Hex(password);
if (user == null) {
throw new BizException(ExceptionCode.JWT_USER_INVALID.getCode(), ExceptionCode.JWT_USER_INVALID.getMsg());
}
if (!user.getPassword().equalsIgnoreCase(passwordMd5)) {
userService.updatePasswordErrorNumById(user.getId());
return R.fail("用户名或密码错误!");
}
// 密码过期
if (user.getPasswordExpireTime() != null) {
gt(LocalDateTime.now(), user.getPasswordExpireTime(), "用户密码已过期,请修改密码或者联系管理员重置!");
}
// 用户禁用
isTrue(user.getStatus(), "用户被禁用,请联系管理员!");
// 用户锁定
Integer maxPasswordErrorNum = NumberHelper.getOrDef(tenant.getPasswordErrorNum(), 0);
Integer passwordErrorNum = NumberHelper.getOrDef(user.getPasswordErrorNum(), 0);
if (maxPasswordErrorNum > 0 && passwordErrorNum > maxPasswordErrorNum) {
log.info("当前错误次数{}, 最大次数:{}", passwordErrorNum, maxPasswordErrorNum);
LocalDateTime passwordErrorLockTime = TimeUtils.getPasswordErrorLockTime(tenant.getPasswordErrorLockTime());
log.info("passwordErrorLockTime={}", passwordErrorLockTime);
if (passwordErrorLockTime.isAfter(user.getPasswordErrorLastTime())) {
return R.fail("密码连续输错次数已达到%s次,用户已被锁定~", maxPasswordErrorNum);
}
}
// 错误次数清空
userService.update(Wraps.<User>lbU().set(User::getPasswordErrorNum, 0).eq(User::getId, user.getId()));
return R.success(user);
}
public JwtUserInfo validateUserToken(String token) throws BizException {
return jwtTokenServerUtils.getUserInfo(token);
}
public void invalidUserToken(String token) throws BizException {
}
}
|
9233363a23642b4deb701bc0a2e0348ec6e72d6e | 1,127 | java | Java | java/jdk/jdk_14/jdk_code_view/src/com/company/source/jdk.hotspot.agent/sun/jvm/hotspot/ui/HistoryComboBox.java | jaylinjiehong/- | 591834e6d90ec8fbfd6c1d2a0913631f9f723a0a | [
"MIT"
] | null | null | null | java/jdk/jdk_14/jdk_code_view/src/com/company/source/jdk.hotspot.agent/sun/jvm/hotspot/ui/HistoryComboBox.java | jaylinjiehong/- | 591834e6d90ec8fbfd6c1d2a0913631f9f723a0a | [
"MIT"
] | null | null | null | java/jdk/jdk_14/jdk_code_view/src/com/company/source/jdk.hotspot.agent/sun/jvm/hotspot/ui/HistoryComboBox.java | jaylinjiehong/- | 591834e6d90ec8fbfd6c1d2a0913631f9f723a0a | [
"MIT"
] | null | null | null | 16.820896 | 73 | 0.599823 | 996,495 | /*
* Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*/
package sun.jvm.hotspot.ui;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
/** Provides an editable text field with history. */
public class HistoryComboBox extends JComboBox {
static final int HISTORY_LENGTH = 15;
public HistoryComboBox() {
setEditable(true);
addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Object text = getSelectedItem();
if (text != null) {
setText((String)text);
}
}
});
}
public String getText() {
Object text = getSelectedItem();
if (text == null) {
return "";
}
return (String)text;
}
public void setText(String text) {
removeItem(text);
insertItemAt(text, 0);
setSelectedItem(text);
int length = getModel().getSize();
while (length > HISTORY_LENGTH) {
removeItemAt(--length);
}
}
}
|
923336ca92b044e34e7b1ef5248b4c22239850d9 | 2,240 | java | Java | src/main/java/dk/ange/octave/exec/OctaveReaderCallable.java | subes/javaoctave | 30aefb30c7c7adf11c2288f29e0d13285e854f7c | [
"Apache-2.0"
] | null | null | null | src/main/java/dk/ange/octave/exec/OctaveReaderCallable.java | subes/javaoctave | 30aefb30c7c7adf11c2288f29e0d13285e854f7c | [
"Apache-2.0"
] | null | null | null | src/main/java/dk/ange/octave/exec/OctaveReaderCallable.java | subes/javaoctave | 30aefb30c7c7adf11c2288f29e0d13285e854f7c | [
"Apache-2.0"
] | null | null | null | 31.111111 | 121 | 0.66875 | 996,496 | /*
* Copyright 2008, 2009 Ange Optimization ApS
*
* 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 dk.ange.octave.exec;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.Reader;
import java.util.concurrent.Callable;
import dk.ange.octave.exception.OctaveIOException;
/**
* Callable that reads from the octave process
*/
final class OctaveReaderCallable implements Callable<Void> {
private static final org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory
.getLog(OctaveReaderCallable.class);
private final BufferedReader processReader;
private final ReadFunctor readFunctor;
private final String spacer;
/**
* @param processReader
* @param readFunctor
* @param spacer
*/
public OctaveReaderCallable(final BufferedReader processReader, final ReadFunctor readFunctor, final String spacer) {
this.processReader = processReader;
this.readFunctor = readFunctor;
this.spacer = spacer;
}
@Override
public Void call() {
final Reader reader = new OctaveExecuteReader(processReader, spacer);
try {
readFunctor.doReads(reader);
} catch (final IOException e) {
final String message = "IOException from ReadFunctor";
log.debug(message, e);
throw new OctaveIOException(message, e);
} finally {
try {
reader.close();
} catch (final IOException e) {
final String message = "IOException during close";
log.debug(message, e);
throw new OctaveIOException(message, e);
}
}
return null;
}
}
|
9233395a705591543f4fbb4697d791cada724cb4 | 2,395 | java | Java | Demo-Project/atguigu-Advanced/gmail-zookeeper-demo/src/main/java/com/atguigu/gmail/gmailzookeeperdemo/HelloZK.java | juyss/workspace | 6005307287200ce5c208f02ff307409d0d34a5e5 | [
"MulanPSL-1.0"
] | null | null | null | Demo-Project/atguigu-Advanced/gmail-zookeeper-demo/src/main/java/com/atguigu/gmail/gmailzookeeperdemo/HelloZK.java | juyss/workspace | 6005307287200ce5c208f02ff307409d0d34a5e5 | [
"MulanPSL-1.0"
] | 1 | 2020-09-14T07:46:05.000Z | 2020-09-14T07:46:05.000Z | Demo-Project/atguigu-Advanced/gmail-zookeeper-demo/src/main/java/com/atguigu/gmail/gmailzookeeperdemo/HelloZK.java | juyss/workspace | 6005307287200ce5c208f02ff307409d0d34a5e5 | [
"MulanPSL-1.0"
] | null | null | null | 25.752688 | 112 | 0.620459 | 996,497 | package com.atguigu.gmail.gmailzookeeperdemo;
import org.apache.zookeeper.*;
import org.apache.zookeeper.data.Stat;
import java.io.IOException;
/**
*
* 此处为Client端,CentOS为ZooKeeper的Server端
*
* 1 通过java程序,新建链接zk,类似jdbc的connection,open.session
* 2 新建一个znode节点/atguigu并设置为 等同于create /atguigu hello0925 Ids.OPEN_ACL_UNSAFE
* 3 获得当前节点/atguigu的最新值 get /atguigu
* 4 关闭链接
* xialei
*
*/
public class HelloZK {
private static final String CONNECTSTRING = "192.168.140.130:2181";
private static final String PATH = "/atguigu";
private static final int SESSION_TIMEOUT = 20 * 1000;
/**
* 通过java程序,新建链接zk
* @return
* @throws IOException
*/
public ZooKeeper startZK() throws IOException {
return new ZooKeeper(CONNECTSTRING, SESSION_TIMEOUT, new Watcher() {
@Override
public void process(WatchedEvent watchedEvent) {
}
});
}
/**
* 新建一个znode节点
* @param zk
* @param path
* @param data
* @throws KeeperException
* @throws InterruptedException
*/
public void createZNode(ZooKeeper zk,String path,String data) throws KeeperException, InterruptedException {
zk.create(path,data.getBytes(), ZooDefs.Ids.OPEN_ACL_UNSAFE,CreateMode.PERSISTENT);
}
/**
* 获得当前节点/atguigu的最新值
* @param zk
* @param path
* @return
* @throws KeeperException
* @throws InterruptedException
*/
public String getZNode(ZooKeeper zk,String path) throws KeeperException, InterruptedException {
String result = "";
byte[] data = zk.getData(path, false, new Stat());
result = new String(data);
return result;
}
/**
* 关闭链接
* @param zk
* @throws InterruptedException
*/
public void stopZK(ZooKeeper zk) throws InterruptedException {
if(zk != null){
zk.close();
}
}
public static void main(String[] args) throws Exception
{
HelloZK helloZK = new HelloZK();
ZooKeeper zk = helloZK.startZK();
if(zk.exists(PATH,false)==null){
helloZK.createZNode(zk,PATH,"java190401");
String zNode = helloZK.getZNode(zk, PATH);
System.out.println(" zNode ="+ zNode);
}else {
System.out.println("this zNode is created ");
}
helloZK.stopZK(zk);
}
}
|
923339fbffdc5c229588f13c4c97768ad120c0e9 | 389 | java | Java | services/src/main/java/com/iba/iot/datasimulator/common/model/schema/property/SessionSchemaProperty.java | fordlarman/ICT9004-ARP-Project | cf42d132d02d964b99f7a981ca5753e4d49dc86f | [
"Apache-2.0"
] | 57 | 2018-04-20T10:24:46.000Z | 2022-03-25T18:39:06.000Z | services/src/main/java/com/iba/iot/datasimulator/common/model/schema/property/SessionSchemaProperty.java | fordlarman/ICT9004-ARP-Project | cf42d132d02d964b99f7a981ca5753e4d49dc86f | [
"Apache-2.0"
] | 16 | 2018-04-20T08:34:48.000Z | 2022-01-07T12:00:28.000Z | services/src/main/java/com/iba/iot/datasimulator/common/model/schema/property/SessionSchemaProperty.java | fordlarman/ICT9004-ARP-Project | cf42d132d02d964b99f7a981ca5753e4d49dc86f | [
"Apache-2.0"
] | 30 | 2018-04-09T15:15:49.000Z | 2022-03-14T14:16:22.000Z | 17.681818 | 86 | 0.66581 | 996,498 | package com.iba.iot.datasimulator.common.model.schema.property;
import com.iba.iot.datasimulator.common.model.schema.property.rule.SchemaPropertyRule;
/**
*
*/
public interface SessionSchemaProperty extends SchemaProperty {
/**
*
* @return
*/
SchemaPropertyRule getRule();
/**
*
* @param rule
*/
void setRule(SchemaPropertyRule rule);
}
|
92333ba5220d5cb2c8f8161c0adaa7db0235daa9 | 1,636 | java | Java | imooc-c5-spring-cloud/user/src/main/java/com/imooc/example/order/web/CustomerResource.java | sunkun1210/cloud | fd7a6f097e62b8cc3cdd2736a757326cdef4a03d | [
"Apache-2.0"
] | 1 | 2020-06-19T08:29:11.000Z | 2020-06-19T08:29:11.000Z | imooc-c5-spring-cloud/user/src/main/java/com/imooc/example/order/web/CustomerResource.java | sunkun1210/cloud | fd7a6f097e62b8cc3cdd2736a757326cdef4a03d | [
"Apache-2.0"
] | null | null | null | imooc-c5-spring-cloud/user/src/main/java/com/imooc/example/order/web/CustomerResource.java | sunkun1210/cloud | fd7a6f097e62b8cc3cdd2736a757326cdef4a03d | [
"Apache-2.0"
] | null | null | null | 27.266667 | 74 | 0.706601 | 996,499 | package com.imooc.example.order.web;
import com.imooc.example.dto.OrderDTO;
import com.imooc.example.order.dao.CustomerRepository;
import com.imooc.example.order.domain.Customer;
import com.imooc.example.order.feign.OrderClient;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.annotation.PostConstruct;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Created by mavlarn on 2018/1/20.
*/
@RestController
@RequestMapping("/api/customer")
public class CustomerResource {
@PostConstruct
public void init() {
Customer customer = new Customer();
customer.setUsername("imooc");
customer.setPassword("111111");
customer.setRole("User");
customerRepository.save(customer);
}
@Autowired
private CustomerRepository customerRepository;
@Autowired
private OrderClient orderClient;
@PostMapping("")
public Customer create(@RequestBody Customer customer) {
return customerRepository.save(customer);
}
@GetMapping("")
@HystrixCommand
public List<Customer> getAll() {
return customerRepository.findAll();
}
@GetMapping("/my")
@HystrixCommand
public Map getMyInfo() {
Customer customer = customerRepository.findOneByUsername("imooc");
OrderDTO order = orderClient.getMyOrder(1l);
Map result = new HashMap();
result.put("customer", customer);
result.put("order", order);
return result;
}
}
|
92333cd101de41f29dd851dc001f2a8e0b7d0b3c | 1,572 | java | Java | rxjava-contrib/rxjava-apache-http/src/main/java/rx/apache/http/consumers/ResponseDelegate.java | tomrozb/RxJava | fc86f8c340c3fc9d1ba983013383c3cac4c30c17 | [
"Apache-2.0"
] | 121 | 2015-01-02T22:34:32.000Z | 2021-06-14T19:40:13.000Z | rxjava-contrib/rxjava-apache-http/src/main/java/rx/apache/http/consumers/ResponseDelegate.java | tomrozb/RxJava | fc86f8c340c3fc9d1ba983013383c3cac4c30c17 | [
"Apache-2.0"
] | 5 | 2015-02-18T16:33:33.000Z | 2017-08-29T17:42:10.000Z | rxjava-contrib/rxjava-apache-http/src/main/java/rx/apache/http/consumers/ResponseDelegate.java | tomrozb/RxJava | fc86f8c340c3fc9d1ba983013383c3cac4c30c17 | [
"Apache-2.0"
] | 31 | 2015-05-26T17:44:12.000Z | 2022-03-18T05:48:41.000Z | 35.727273 | 97 | 0.78626 | 996,500 | /**
* Copyright 2014 Netflix, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package rx.apache.http.consumers;
import java.io.IOException;
import org.apache.http.HttpEntity;
import org.apache.http.HttpException;
import org.apache.http.HttpResponse;
import org.apache.http.entity.ContentType;
import org.apache.http.nio.ContentDecoder;
import org.apache.http.nio.IOControl;
import org.apache.http.nio.protocol.HttpAsyncResponseConsumer;
import org.apache.http.protocol.HttpContext;
/**
* Delegate methods for getting access to protected methods.
*/
abstract interface ResponseDelegate extends HttpAsyncResponseConsumer<HttpResponse> {
public void _onResponseReceived(HttpResponse response) throws HttpException, IOException;
public void _onContentReceived(ContentDecoder decoder, IOControl ioctrl) throws IOException;
public void _onEntityEnclosed(HttpEntity entity, ContentType contentType) throws IOException;
public HttpResponse _buildResult(HttpContext context) throws Exception;
public void _releaseResources();
}
|
92333cf73bf5250cded1735ac02a81239956c61d | 3,809 | java | Java | dl-manager/dl-manager-core/src/main/java/com/ucar/datalink/manager/core/web/controller/menu/MenuController.java | Diffblue-benchmarks/DataLink | 51279288914d6b1d5158cc020bb07744de6eecd7 | [
"Apache-2.0"
] | 4 | 2019-05-10T04:58:16.000Z | 2021-02-26T11:17:30.000Z | dl-manager/dl-manager-core/src/main/java/com/ucar/datalink/manager/core/web/controller/menu/MenuController.java | Diffblue-benchmarks/DataLink | 51279288914d6b1d5158cc020bb07744de6eecd7 | [
"Apache-2.0"
] | 6 | 2020-03-04T21:55:55.000Z | 2021-01-21T00:05:06.000Z | dl-manager/dl-manager-core/src/main/java/com/ucar/datalink/manager/core/web/controller/menu/MenuController.java | Diffblue-benchmarks/DataLink | 51279288914d6b1d5158cc020bb07744de6eecd7 | [
"Apache-2.0"
] | 2 | 2019-09-10T15:56:22.000Z | 2020-01-19T12:45:28.000Z | 32.836207 | 73 | 0.648464 | 996,501 | package com.ucar.datalink.manager.core.web.controller.menu;
import com.ucar.datalink.biz.service.MenuService;
import com.ucar.datalink.domain.menu.MenuInfo;
import com.ucar.datalink.domain.menu.MenuType;
import com.ucar.datalink.manager.core.web.dto.menu.MenuView;
import com.ucar.datalink.manager.core.web.util.Page;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.stream.Collectors;
/**
* Created by sqq on 2017/4/25.
*/
@Controller
@RequestMapping(value = "/menu/")
public class MenuController {
@Autowired
MenuService menuService;
@RequestMapping(value = "/menuList")
public ModelAndView menuList() {
ModelAndView mav = new ModelAndView("menu/list");
return mav;
}
@RequestMapping(value = "/initMenu")
@ResponseBody
public Page<MenuView> initMenu() {
List<MenuInfo> menuInfos = menuService.getList();
List<MenuView> menuViews = menuInfos.stream().map(i -> {
MenuView menuView = new MenuView();
menuView.setId(i.getId());
menuView.setCode(i.getCode());
menuView.setName(i.getName());
menuView.setParentCode(i.getParentCode());
menuView.setType(i.getType());
menuView.setUrl(i.getUrl());
menuView.setIcon(i.getIcon());
return menuView;
}).collect(Collectors.toList());
return new Page<MenuView>(menuViews);
}
@RequestMapping(value = "/toAdd")
public ModelAndView toAdd() {
ModelAndView mav = new ModelAndView("menu/add");
List<MenuInfo> menuList = menuService.getList();
mav.addObject("menuList", menuList);
mav.addObject("menuTypeList", MenuType.getAllMenuTypes());
return mav;
}
@RequestMapping(value = "/doAdd")
@ResponseBody
public String doAdd(@ModelAttribute("menuInfo") MenuInfo menuInfo) {
Boolean isSuccess = menuService.insert(menuInfo);
if (isSuccess) {
return "success";
} else {
return "fail";
}
}
@RequestMapping(value = "/toEdit")
public ModelAndView toEdit(HttpServletRequest request) {
String id = request.getParameter("id");
MenuInfo menuInfo = new MenuInfo();
ModelAndView mav = new ModelAndView("menu/edit");
List<MenuInfo> menuList = menuService.getList();
if (StringUtils.isNotBlank(id)) {
menuInfo = menuService.getById(Long.valueOf(id));
}
mav.addObject("menuInfo", menuInfo);
mav.addObject("menuList", menuList);
mav.addObject("menuTypeList", MenuType.getAllMenuTypes());
return mav;
}
@RequestMapping(value = "/doEdit")
@ResponseBody
public String doEdit(@ModelAttribute("menuInfo") MenuInfo menuInfo) {
Boolean isSuccess = menuService.update(menuInfo);
if (isSuccess) {
return "success";
} else {
return "fail";
}
}
@RequestMapping(value = "/doDelete")
@ResponseBody
public String doDelete(HttpServletRequest request) {
String id = request.getParameter("id");
if (StringUtils.isBlank(id)) {
return "fail";
}
Boolean isSuccess = menuService.delete(Long.valueOf(id));
if (isSuccess) {
return "success";
} else {
return "fail";
}
}
}
|
92333daaca307ff75eff77e23337d13b9a06ea62 | 229 | java | Java | app/src/main/java/com/xrbpowered/android/gembattle/effects/Effect.java | AshurAxelR/GemBattle | 96ce51893a64508b072af8d885ad6f2bfca63799 | [
"MIT"
] | 2 | 2020-07-10T07:36:05.000Z | 2021-02-26T02:08:50.000Z | app/src/main/java/com/xrbpowered/android/gembattle/effects/Effect.java | ashurrafiev/GemBattle | 96ce51893a64508b072af8d885ad6f2bfca63799 | [
"MIT"
] | null | null | null | app/src/main/java/com/xrbpowered/android/gembattle/effects/Effect.java | ashurrafiev/GemBattle | 96ce51893a64508b072af8d885ad6f2bfca63799 | [
"MIT"
] | null | null | null | 17.615385 | 49 | 0.777293 | 996,502 | package com.xrbpowered.android.gembattle.effects;
import android.graphics.Canvas;
import android.graphics.Paint;
public interface Effect {
Effect update(float dt);
Effect finish();
void draw(Canvas canvas, Paint paint);
}
|
92333e201043679a81f9c5fa7ea424aa004c4905 | 4,699 | java | Java | src/main/java/com/minestellar/core/perlin/FishyNoise.java | Jorch72/Minestellar | aaf2d28f7ecc610456336ad661dea7b9dc4495a5 | [
"CC-BY-4.0"
] | 5 | 2015-02-25T15:44:49.000Z | 2017-09-10T13:50:49.000Z | src/main/java/com/minestellar/core/perlin/FishyNoise.java | Jorch72/Minestellar | aaf2d28f7ecc610456336ad661dea7b9dc4495a5 | [
"CC-BY-4.0"
] | 9 | 2015-02-23T12:45:45.000Z | 2015-05-03T01:09:28.000Z | src/main/java/com/minestellar/core/perlin/FishyNoise.java | Jorch72/Minestellar | aaf2d28f7ecc610456336ad661dea7b9dc4495a5 | [
"CC-BY-4.0"
] | 2 | 2015-05-10T17:36:35.000Z | 2015-08-12T17:08:49.000Z | 37.895161 | 358 | 0.540966 | 996,503 | package com.minestellar.core.perlin;
import java.util.Random;
public class FishyNoise {
int[] perm = new int[512];
public float[][] grad2d = new float[][] { { 1, 0 }, { .9239F, .3827F }, { .707107F, 0.707107F }, { .3827F, .9239F }, { 0, 1 }, { -.3827F, .9239F }, { -.707107F, 0.707107F }, { -.9239F, .3827F }, { -1, 0 }, { -.9239F, -.3827F }, { -.707107F, -0.707107F }, { -.3827F, -.9239F }, { 0, -1 }, { .3827F, -.9239F }, { .707107F, -0.707107F }, { .9239F, -.3827F } };
public int[][] grad3d = new int[][] { { 1, 1, 0 }, { -1, 1, 0 }, { 1, -1, 0 }, { -1, -1, 0 }, { 1, 0, 1 }, { -1, 0, 1 }, { 1, 0, -1 }, { -1, 0, -1 }, { 0, 1, 1 }, { 0, -1, 1 }, { 0, 1, -1 }, { 0, -1, -1 }, { 1, 1, 0 }, { -1, 1, 0 }, { 0, -1, 1 }, { 0, -1, -1 } };
public FishyNoise(long seed) {
final Random rand = new Random(seed);
for (int i = 0; i < 256; i++) {
this.perm[i] = i; // Fill up the random array with numbers 0-256
}
for (int i = 0; i < 256; i++) { // Shuffle those numbers for the random effect
final int j = rand.nextInt(256);
this.perm[i] = this.perm[i] ^ this.perm[j];
this.perm[j] = this.perm[i] ^ this.perm[j];
this.perm[i] = this.perm[i] ^ this.perm[j];
}
System.arraycopy(this.perm, 0, this.perm, 256, 256);
}
private static float lerp(float x, float y, float n) {
return x + n * (y - x);
}
private static int fastFloor(float x) {
return x > 0 ? (int) x : (int) x - 1;
}
private static float fade(float n) {
return n * n * n * (n * (n * 6 - 15) + 10);
}
private static float dot2(float[] grad2, float x, float y) {
return grad2[0] * x + grad2[1] * y;
}
private static float dot3(int[] grad3, float x, float y, float z) {
return grad3[0] * x + grad3[1] * y + grad3[2] * z;
}
public float noise2d(float x, float y) {
int largeX = x > 0 ? (int) x : (int) x - 1;
int largeY = y > 0 ? (int) y : (int) y - 1;
x -= largeX;
y -= largeY;
largeX &= 255;
largeY &= 255;
final float u = x * x * x * (x * (x * 6 - 15) + 10);
final float v = y * y * y * (y * (y * 6 - 15) + 10);
int randY = this.perm[largeY] + largeX;
int randY1 = this.perm[largeY + 1] + largeX;
float[] grad2 = this.grad2d[this.perm[randY] & 15];
final float grad00 = grad2[0] * x + grad2[1] * y;
grad2 = this.grad2d[this.perm[randY1] & 15];
final float grad01 = grad2[0] * x + grad2[1] * (y - 1);
grad2 = this.grad2d[this.perm[1 + randY1] & 15];
final float grad11 = grad2[0] * (x - 1) + grad2[1] * (y - 1);
grad2 = this.grad2d[this.perm[1 + randY] & 15];
final float grad10 = grad2[0] * (x - 1) + grad2[1] * y;
final float lerpX0 = grad00 + u * (grad10 - grad00);
return lerpX0 + v * (grad01 + u * (grad11 - grad01) - lerpX0);
}
public float noise3d(float x, float y, float z) {
int unitX = x > 0 ? (int) x : (int) x - 1;
int unitY = y > 0 ? (int) y : (int) y - 1;
int unitZ = z > 0 ? (int) z : (int) z - 1;
x -= unitX;
y -= unitY;
z -= unitZ;
unitX &= 255;
unitY &= 255;
unitZ &= 255;
final float u = x * x * x * (x * (x * 6 - 15) + 10);
final float v = y * y * y * (y * (y * 6 - 15) + 10);
final float w = z * z * z * (z * (z * 6 - 15) + 10);
int randZ = this.perm[unitZ] + unitY;
int randZ1 = this.perm[unitZ + 1] + unitY;
int randYZ = this.perm[randZ] + unitX;
int randY1Z = this.perm[1 + randZ] + unitX;
int randYZ1 = this.perm[randZ1] + unitX;
int randY1Z1 = this.perm[1 + randZ1] + unitX;
int[] grad3 = this.grad3d[this.perm[randYZ] & 15];
final float grad000 = grad3[0] * x + grad3[1] * y + grad3[2] * z;
grad3 = this.grad3d[this.perm[1 + randYZ] & 15];
final float grad100 = grad3[0] * (x - 1) + grad3[1] * y + grad3[2] * z;
grad3 = this.grad3d[this.perm[randY1Z] & 15];
final float grad010 = grad3[0] * x + grad3[1] * (y - 1) + grad3[2] * z;
grad3 = this.grad3d[this.perm[1 + randY1Z] & 15];
final float grad110 = grad3[0] * (x - 1) + grad3[1] * (y - 1) + grad3[2] * z;
z--;
grad3 = this.grad3d[this.perm[randYZ1] & 15];
final float grad001 = grad3[0] * x + grad3[1] * y + grad3[2] * z;
grad3 = this.grad3d[this.perm[1 + randYZ1] & 15];
final float grad101 = grad3[0] * (x - 1) + grad3[1] * y + grad3[2] * z;
grad3 = this.grad3d[this.perm[randY1Z1] & 15];
final float grad011 = grad3[0] * x + grad3[1] * (y - 1) + grad3[2] * z;
grad3 = this.grad3d[this.perm[1 + randY1Z1] & 15];
final float grad111 = grad3[0] * (x - 1) + grad3[1] * (y - 1) + grad3[2] * z;
float f1 = grad000 + u * (grad100 - grad000);
float f2 = grad010 + u * (grad110 - grad010);
float f3 = grad001 + u * (grad101 - grad001);
float f4 = grad011 + u * (grad111 - grad011);
float lerp1 = f1 + v * (f2 - f1);
return lerp1 + w * (f3 + v * (f4 - f3) - lerp1);
}
}
|
92333e8f33bfad41968e1a7caf18919746a9b8f5 | 4,464 | java | Java | src/team/background/couchDB/testCloudantClient.java | HenryWan16/Intelligent-Picture-Recommending-system | 91027c89218b911c0fc72b3e0a1254f4c3095341 | [
"Apache-2.0"
] | null | null | null | src/team/background/couchDB/testCloudantClient.java | HenryWan16/Intelligent-Picture-Recommending-system | 91027c89218b911c0fc72b3e0a1254f4c3095341 | [
"Apache-2.0"
] | null | null | null | src/team/background/couchDB/testCloudantClient.java | HenryWan16/Intelligent-Picture-Recommending-system | 91027c89218b911c0fc72b3e0a1254f4c3095341 | [
"Apache-2.0"
] | null | null | null | 37.512605 | 112 | 0.586246 | 996,504 | package com.smart.cloudantDB;
import static org.junit.Assert.*;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import org.junit.Test;
import com.cloudant.client.api.ClientBuilder;
import com.cloudant.client.api.CloudantClient;
import com.cloudant.client.api.Database;
import com.cloudant.client.api.model.FindByIndexOptions;
import com.cloudant.client.api.model.IndexField;
import com.cloudant.client.api.model.IndexField.SortOrder;
public class testCloudantClient {
@Test
public void test() {
String account = "aca81918-9362-42f5-b167-48ea5023836b-bluemix";
String username = "thelfitheartakedallamete";
String password = "73c0a8271a374b63e89245c4e853c80480c9a0e1";
CloudantClient client = ClientBuilder.account(account)
.username(username)
.password(password)
.build();
System.out.println("Server Version: " + client.serverVersion());
//System.out.println("Server Version: ");
// List<String> databases = client.getAllDbs();
// System.out.println("All my databases : ");
// for ( String db : databases ) {
// System.out.println(db);
// }
// client.createDB("smart-cloudant-db");
ArrayList<Customer_Information> customer_array = new ArrayList<Customer_Information>();
Database db = client.database("user-info-database", false);
Customer_Information cf0 = new Customer_Information("John Brown", "95123", "657 Okland Road", 100000);
Customer_Information cf1 = new Customer_Information("Henry White", "95115", "364 Brow Road", 300000);
Customer_Information cf2 = new Customer_Information("Kite Green", "95178", "7869 Red Road", 809872);
Customer_Information cf3 = new Customer_Information("John Brown", "95178", "2031 Green Road", 768903);
Customer_Information cf4 = new Customer_Information("Jerry White", "95123", "482 King Street", 200000);
db.save(cf0);
db.save(cf1);
db.save(cf2);
db.save(cf3);
db.save(cf4);
System.out.println("You have inserted the document");
String search_zipcode = "95178";
String indexString = "{\n" +
" \"index\": {\n" +
" \"fields\": [\n" +
" \"zipcode\"\n" +
" ]\n" +
" },\n" +
" \"type\": \"json\"\n" +
"}";
db.createIndex(indexString);
// String selectorJson = "{\n" +
// " \"selector\": {\n" +
// " \"zipcode\": {\n" +
// " \"$eq\": " + search_zipcode + "\n" +
// " }\n" +
// " },\n" +
// " \"fields\": [\n" +
// " \"zipcode\",\n" +
// " \"income\",\n" +
// " \"name\"\n" +
// " ],\n" +
// " \"sort\": [\n" +
// " {\n" +
// " \"zipcode\": \"asc\"\n" +
// " }\n" +
// " ]\n" +
// "}\n";
String selectorJson = "\"selector\": { \"zipcode\": {\"$eq\": \"" + search_zipcode + "\"}}";
// FindByIndexOptions findOptions = new FindByIndexOptions();
// findOptions.sort(new IndexField("zipcode", SortOrder.asc));
String field0 = "name";
String field1 = "zipcode";
String field2 = "address";
String field3 = "income";
String id = "_id";
// String selectorJson = " \"selector\": { \"zipcode\": \"" + search_zipcode + "\"}";
List<Customer_Information> resultCustomer =
db.findByIndex(selectorJson, Customer_Information.class, new FindByIndexOptions()
.sort(new IndexField("zipcode", SortOrder.asc))
.fields(id).fields(field0).fields(field1).fields(field2).fields(field3));
// List<Customer_Information> resultCustomerTemp =
// db.findByIndex(selectorJson, Customer_Information.class);
// assert(resultCustomer.size() > 0);
System.out.println("Selecting results: ");
for(Customer_Information c : resultCustomer) {
System.out.println(c);
}
// CloudantClient client;
// try {
// client = ClientBuilder.url(new URL("http://127.0.0.1:5984.smart-ads-database"))
// .username("henrywan16")
// .password("76543210")
// .build();
// System.out.println("Server Version: " + client.serverVersion());
// } catch (MalformedURLException e) {
// // TODO Auto-generated catch block
// e.printStackTrace();
// }
}
}
|
92333ff30333cb7c0d2adc70053c426762ab5c28 | 1,355 | java | Java | 6644/src/main/java/frc/robot/commands/AimLimelight.java | aaaa-trsh/6644-Offseason-Code | 136f2bca3a69e7344acebdbd83361d0f4a8d1879 | [
"MIT"
] | null | null | null | 6644/src/main/java/frc/robot/commands/AimLimelight.java | aaaa-trsh/6644-Offseason-Code | 136f2bca3a69e7344acebdbd83361d0f4a8d1879 | [
"MIT"
] | null | null | null | 6644/src/main/java/frc/robot/commands/AimLimelight.java | aaaa-trsh/6644-Offseason-Code | 136f2bca3a69e7344acebdbd83361d0f4a8d1879 | [
"MIT"
] | null | null | null | 28.229167 | 136 | 0.728413 | 996,505 | package frc.robot.commands;
import edu.wpi.first.wpilibj2.command.CommandBase;
import frc.robot.Constants.ShooterConstants;
import frc.robot.subsystems.DriveSubsystem;
import frc.robot.subsystems.ShooterSubsystem;
public class AimLimelight extends CommandBase {
private DriveSubsystem m_drive;
private ShooterSubsystem m_shooter;
private double m_errorX = 0;
private double m_errorY = 0;
private boolean m_validTarget;
/**
* Creates a new AimLimelight.
*/
public AimLimelight(DriveSubsystem drive, ShooterSubsystem shooter) {
m_drive = drive;
m_shooter = shooter;
}
@Override
public void execute() {
var target = m_shooter.getLimelightTarget();
m_validTarget = target[0] == 1;
m_errorX = -target[1];
m_errorY = -target[2];
double steering_adjust = 0;
steering_adjust = ShooterConstants.kAimXP * m_errorX + (ShooterConstants.kMinAimGain * target[1] > 1 ? -1 : target[1] < 1 ? 1 : 0);
double distance_adjust = ShooterConstants.kAimYP * m_errorY;
m_drive.arcadeDrive(distance_adjust, steering_adjust);
}
@Override
public void end(boolean interrupted) {
m_drive.arcadeDrive(0, 0);
}
@Override
public boolean isFinished() {
return !m_validTarget || Math.abs(m_errorX) > ShooterConstants.kAimTolerance || Math.abs(m_errorY) > ShooterConstants.kAimTolerance;
}
}
|
9233404da4974b8bbd2df1af7b4c0962ac1bd3a0 | 1,042 | java | Java | quantumdb-cli/src/main/java/io/quantumdb/cli/xml/XmlCopyTable.java | beperev/quantumDBAspectj | 60d7bda3e4effc05ee5fef0330e9a8a9185460be | [
"Apache-2.0"
] | 60 | 2015-02-12T21:33:13.000Z | 2022-03-27T20:38:12.000Z | quantumdb-cli/src/main/java/io/quantumdb/cli/xml/XmlCopyTable.java | beperev/quantumDBAspectj | 60d7bda3e4effc05ee5fef0330e9a8a9185460be | [
"Apache-2.0"
] | 34 | 2015-05-27T22:22:27.000Z | 2022-02-16T00:55:08.000Z | quantumdb-cli/src/main/java/io/quantumdb/cli/xml/XmlCopyTable.java | beperev/quantumDBAspectj | 60d7bda3e4effc05ee5fef0330e9a8a9185460be | [
"Apache-2.0"
] | 9 | 2016-01-28T09:54:20.000Z | 2021-04-28T12:17:12.000Z | 28.162162 | 112 | 0.78119 | 996,506 | package io.quantumdb.cli.xml;
import static com.google.common.base.Preconditions.checkArgument;
import io.quantumdb.core.schema.operations.CopyTable;
import io.quantumdb.core.schema.operations.SchemaOperations;
import lombok.Data;
@Data
public class XmlCopyTable implements XmlOperation<CopyTable> {
static final String TAG = "copyTable";
static XmlOperation convert(XmlElement element) {
checkArgument(element.getTag().equals(TAG));
XmlCopyTable operation = new XmlCopyTable();
operation.setSourceTableName(element.getAttributes().remove("sourceTableName"));
operation.setTargetTableName(element.getAttributes().remove("targetTableName"));
if (!element.getAttributes().keySet().isEmpty()) {
throw new IllegalArgumentException("Attributes: " + element.getAttributes().keySet() + " is/are not valid!");
}
return operation;
}
private String sourceTableName;
private String targetTableName;
@Override
public CopyTable toOperation() {
return SchemaOperations.copyTable(sourceTableName, targetTableName);
}
}
|
923341d70f2466f1f2543ffa5309d8fa52283e13 | 181 | java | Java | src/main/java/cn/stylefeng/guns/core/weixin/handler/ScanHandler.java | zhuhong0602/962jy | c99f3b30f2e1bf1e8b121825172fa4d28043b349 | [
"Apache-2.0"
] | null | null | null | src/main/java/cn/stylefeng/guns/core/weixin/handler/ScanHandler.java | zhuhong0602/962jy | c99f3b30f2e1bf1e8b121825172fa4d28043b349 | [
"Apache-2.0"
] | null | null | null | src/main/java/cn/stylefeng/guns/core/weixin/handler/ScanHandler.java | zhuhong0602/962jy | c99f3b30f2e1bf1e8b121825172fa4d28043b349 | [
"Apache-2.0"
] | null | null | null | 20.111111 | 60 | 0.723757 | 996,507 | package cn.stylefeng.guns.core.weixin.handler;
/**
* @author Binary Wang(https://github.com/binarywang)
*/
public abstract class ScanHandler extends AbstractHandler {
}
|
923342afaed304a44cb5de9cbb17a67ecc9170a9 | 593 | java | Java | app/src/main/java/com/example/administrator/coolweather/gson/Suggestion.java | zhangwenkai1/coolweather | 7f33d70ff0a84cdd336452fa4ac09549a46f2fdf | [
"Apache-2.0"
] | null | null | null | app/src/main/java/com/example/administrator/coolweather/gson/Suggestion.java | zhangwenkai1/coolweather | 7f33d70ff0a84cdd336452fa4ac09549a46f2fdf | [
"Apache-2.0"
] | null | null | null | app/src/main/java/com/example/administrator/coolweather/gson/Suggestion.java | zhangwenkai1/coolweather | 7f33d70ff0a84cdd336452fa4ac09549a46f2fdf | [
"Apache-2.0"
] | null | null | null | 17.969697 | 51 | 0.642496 | 996,508 | package com.example.administrator.coolweather.gson;
import com.google.gson.annotations.SerializedName;
/**
* Created by Administrator on 2017/3/5.
*/
public class Suggestion {
@SerializedName("comf")
public Comfort comfort;
@SerializedName("cw")
public CarWash carWash;
public Sport sport;
public class Comfort{
@SerializedName("txt")
public String info;
}
public class CarWash{
@SerializedName("txt")
public String info;
}
public class Sport{
@SerializedName("txt")
public String info;
}
}
|
92334374455cc256163b11f8f3f46da4117be068 | 17,111 | java | Java | src/test/java/pageObjects/pages/DealerDeskOrders.java | StarodubOleksiy/Java-Framework-for-automation-tests | 6e94cadcb827cd0ad229c79be315907e36f427e3 | [
"Apache-2.0"
] | null | null | null | src/test/java/pageObjects/pages/DealerDeskOrders.java | StarodubOleksiy/Java-Framework-for-automation-tests | 6e94cadcb827cd0ad229c79be315907e36f427e3 | [
"Apache-2.0"
] | null | null | null | src/test/java/pageObjects/pages/DealerDeskOrders.java | StarodubOleksiy/Java-Framework-for-automation-tests | 6e94cadcb827cd0ad229c79be315907e36f427e3 | [
"Apache-2.0"
] | null | null | null | 37.772627 | 149 | 0.668517 | 996,509 | package pageObjects.pages;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.testng.Assert;
import pageObjects.initializePageObjects.PageFactoryInitializer;
import ru.yandex.qatools.allure.annotations.Step;
import java.util.Arrays;
import java.util.List;
public class DealerDeskOrders extends PageFactoryInitializer {
@FindBy(xpath = "//span[contains(text(),'Orders')]")
private WebElement ordersLink;
@FindBy(xpath = "//a[contains(text(),'Own')]")
private WebElement ownTab;
@FindBy(xpath = "//div[contains(text(),'Order type...')]")
private WebElement orderTypeList;
@FindBy(xpath = "//div[contains(text(),'Market')]")
private WebElement marketType;
@FindBy(xpath = "//div[contains(text(),'Limit')]")
private WebElement limitType;
@FindBy(xpath = "//div[contains(text(),'Stop')]")
private WebElement stopType;
@FindBy(xpath = "//div[contains(text(),'Stop-Limit')]")
private WebElement stopLimitType;
@FindBy(xpath = "//div[contains(text(),'Side...')]")
private WebElement sideTypeList;
@FindBy(xpath = "//div[contains(text(),'Buy')]")
private WebElement buyType;
@FindBy(xpath = "//div[contains(text(),'Sell')]")
private WebElement sellType;
@FindBy(xpath = "//div[contains(text(),'Status...')]")
private WebElement statusTypeList;
@FindBy(xpath = "//div[contains(text(),'Time in force...')]")
private WebElement timeInForceList;
@FindBy(xpath = "//div[contains(text(),'Fill or kill')]")
private WebElement fillOrKillType;
@FindBy(xpath = "//div[contains(text(),'G.T.C.')]")
private WebElement gtcType;
@FindBy(xpath = "//div[contains(text(),'Day')]")
private WebElement dayType;
@FindBy(xpath = "//div[contains(text(),'I.O.C.')]")
private WebElement iocType;
@FindBy(xpath = "//div[contains(text(),'Columns')]")
private WebElement columnsSwitcher;
@FindBy(xpath = "//button[contains(text(),'Apply changes')]")
private WebElement applyChangesButton;
@FindBy(xpath = "//button[contains(text(),'Cancel')]")
private List<WebElement> cancelOrderButton;
@FindBy(xpath = "//div[@id='modal-windows-container']//span[contains(text(),'Cancel')]")
private WebElement cancelButton;
@FindBy(xpath = "//label[@id='linstrument']")
private WebElement instrumentTypeCheckbox;
@FindBy(xpath = "//label[@id='laccountId']")
private WebElement accountIDTypeCheckbox;
@FindBy(xpath = "//label[@id='lorderQty']")
private WebElement orderQtyTypeCheckbox;
@FindBy(xpath = "//label[@id='lleavesQty']")
private WebElement leavesQtyTypeCheckbox;
@FindBy(xpath = "//label[@id='lcumQty']")
private WebElement cumQtyTypeCheckbox;
@FindBy(xpath = "//label[@id='lorderPx']")
private WebElement orderPriceTypeCheckbox;
@FindBy(xpath = "//label[@id='lavgPx']")
private WebElement avgPriceTypeCheckbox;
@FindBy(xpath = "//label[@id='lstopPx']")
private WebElement stopPriceTypeCheckbox;
@FindBy(xpath = "//label[@id='lcreated']")
private WebElement createdTypeCheckbox;
@FindBy(xpath = "//label[@id='lupdated']")
private WebElement updatedTypeCheckbox;
@FindBy(xpath = "//label[@id='lcomment']")
private WebElement commentTypeCheckbox;
@FindBy(xpath = "//label[@id='lorigOrderId']")
private WebElement origOrderIdCheckbox;
@FindBy(xpath = "//label[@id='lworkingIndicator']")
private WebElement stopTrigeredTypeCheckbox;
@FindBy(xpath = "//label[@id='lhandlInst']")
private WebElement executiveTypeCheckbox;
@FindBy(xpath = "//label[@id='lside']")
private WebElement sideTypeCheckbox;
@FindBy(xpath = "//label[@id='lstatus']")
private WebElement statusTypeCheckbox;
@FindBy(xpath = "//label[@id='ltimeInForce']")
private WebElement timeInForceTypeCheckbox;
@FindBy(xpath = "//label[@id='lorderType']")
private WebElement orderTypeCheckbox;
@FindBy(xpath = "//div[contains(@class,'SortArrows')][contains(text(),'Instrument')]")
private WebElement instrumentTypeColumn;
@FindBy(xpath = "//div[contains(@class,'SortArrows')][contains(text(),'Account ID')]")
private WebElement accountIDTypeColumn;
@FindBy(xpath = "//div[contains(@class,'SortArrows')][contains(text(),'Order QTY')]")
private WebElement orderQTYTypeColumn;
@FindBy(xpath = "//div[contains(@class,'SortArrows')][contains(text(),'Leaves QTY')]")
private WebElement leavesQTYColumn;
@FindBy(xpath = "//div[contains(@class,'SortArrows')][contains(text(),'Cum QTY')]")
private WebElement cumQTYTypeColumn;
@FindBy(xpath = "//div[contains(@class,'SortArrows')][contains(text(),'Order price')]")
private WebElement orderPriceTypeColumn;
@FindBy(xpath = "//div[contains(@class,'SortArrows')][contains(text(),'Avg. price')]")
private WebElement avgPriceTypeColumn;
@FindBy(xpath = "//div[contains(@class,'SortArrows')][contains(text(),'Stop price')]")
private WebElement stopPriceTypeColumn;
@FindBy(xpath = "//div[contains(@class,'SortArrows')][contains(text(),'Created')]")
private WebElement createdTypeColumn;
@FindBy(xpath = "//div[contains(@class,'SortArrows')][contains(text(),'Updated')]")
private WebElement updatedTypeColumn;
@FindBy(xpath = "//div[contains(@class,'SortArrows')][contains(text(),'Comment')]")
private WebElement commentTypeColumn;
@FindBy(xpath = "//div[contains(@class,'SortArrows')][contains(text(),'Orig. order ID')]")
private WebElement origOrderIDColumn;
@FindBy(xpath = "//div[contains(@class,'SortArrows')][contains(text(),'Stop triggered')]")
private WebElement stopTriggeredTypeColumn;
@FindBy(xpath = "//div[contains(@class,'SortArrows')][contains(text(),'Execution type')]")
private WebElement executionTypeColumn;
@FindBy(xpath = "//div[contains(@class,'SortArrows')][contains(text(),'Side')]")
private WebElement sideTypeColumn;
@FindBy(xpath = "//div[contains(@class,'SortArrows')][contains(text(),'Status')]")
private WebElement statusTypeColumn;
@FindBy(xpath = "//div[contains(@class,'SortArrows')][contains(text(),'Time in force')]")
private WebElement timeInForceTypeColumn;
@FindBy(xpath = "//div[contains(@class,'SortArrows')][contains(text(),'Type')]")
private WebElement typeColumn;
@FindBy(xpath = "//div[contains(@class,'react-select__multi-value__remove')]")
private WebElement closeType;
@FindBy(xpath = "//tr[contains(@class,'Components-Table-___style__tr')]")
private List<WebElement> ordersList;
@FindBy(xpath = "//li[contains(@class,'style__pagination-page___2rNBi')]//a[@role='button']")
private List<WebElement> pages;
@Step("Click on <<Orders>> link")
public DealerDeskOrders clickOnOrdersLink() {
ordersLink.click();
return this;
}
@Step("Click on order type list")
public DealerDeskOrders clickOrderTypeList() {
orderTypeList.click();
return this;
}
@Step("Click on <<Market>> type")
public DealerDeskOrders clickOnMarketType() {
marketType.click();
return this;
}
@Step("Click on <<Limit>> type")
public DealerDeskOrders clickOnLimitType() {
limitType.click();
return this;
}
@Step("Click on <<Stop>> type")
public DealerDeskOrders clickOnStopType() {
stopType.click();
return this;
}
@Step("Click on <<Stop-Limit>> type")
public DealerDeskOrders clickOnStopLimitType() {
stopLimitType.click();
return this;
}
@Step("Click on side type list")
public DealerDeskOrders clickSideTypeList() {
sideTypeList.click();
return this;
}
@Step("Click on <<Buy>> type")
public DealerDeskOrders clickOnBuyType() {
buyType.click();
return this;
}
@Step("Click on <<Sell>> type")
public DealerDeskOrders clickOnSellType() {
sellType.click();
return this;
}
@Step("Click on status type list")
public DealerDeskOrders clickStatusTypeList() {
statusTypeList.click();
return this;
}
@Step("Click on time in force type list")
public DealerDeskOrders clickTimeInForceTypeList() {
timeInForceList.click();
return this;
}
@Step("Click on <<Fill or kill>> type")
public DealerDeskOrders clickOnFillOrKillType() {
fillOrKillType.click();
return this;
}
@Step("Click on <<G.T.C.>> type")
public DealerDeskOrders clickOnGTCType() {
gtcType.click();
return this;
}
@Step("Click on <<Day>> type")
public DealerDeskOrders clickOnDayType() {
dayType.click();
return this;
}
@Step("Click on <<I.O.C>> type")
public DealerDeskOrders clickOnIOCType() {
iocType.click();
return this;
}
@Step("Click on <<Apply changes>> button")
public DealerDeskOrders clickOnApplyChangesButton() {
applyChangesButton.click();
return this;
}
@Step("verify column switcher on delearDesk tab Orders")
public DealerDeskOrders verifyColumnSwitcher() {
String[] configurableHeaders = {"Instrument", "Account ID", "Order QTY", "Leaves QTY", "Cum QTY", "Order price",
"Avg. price", "Created", "Updated", "Comment", "Orig. order ID", "Stop triggered", "Execution type", "Side",
"Status", "Time in force", "Type"};
scrollIntoView(columnsSwitcher);
columnsSwitcher.click();
scrollIntoView(instrumentTypeCheckbox);
instrumentTypeCheckbox.click();
scrollIntoView(accountIDTypeCheckbox);
accountIDTypeCheckbox.click();
scrollIntoView(orderQtyTypeCheckbox);
orderQtyTypeCheckbox.click();
scrollIntoView(leavesQtyTypeCheckbox);
leavesQtyTypeCheckbox.click();
scrollIntoView(cumQtyTypeCheckbox);
cumQtyTypeCheckbox.click();
scrollIntoView(avgPriceTypeCheckbox);
avgPriceTypeCheckbox.click();
scrollIntoView(orderPriceTypeCheckbox);
orderPriceTypeCheckbox.click();
scrollIntoView(stopPriceTypeCheckbox);
stopPriceTypeCheckbox.click();
scrollIntoView(createdTypeCheckbox);
createdTypeCheckbox.click();
scrollIntoView(updatedTypeCheckbox);
updatedTypeCheckbox.click();
scrollIntoView(commentTypeCheckbox);
commentTypeCheckbox.click();
scrollIntoView(origOrderIdCheckbox);
origOrderIdCheckbox.click();
scrollIntoView(stopTrigeredTypeCheckbox);
stopTrigeredTypeCheckbox.click();
scrollIntoView(executiveTypeCheckbox);
executiveTypeCheckbox.click();
scrollIntoView(sideTypeCheckbox);
sideTypeCheckbox.click();
scrollIntoView(statusTypeCheckbox);
statusTypeCheckbox.click();
scrollIntoView(timeInForceTypeCheckbox);
timeInForceTypeCheckbox.click();
scrollIntoView(orderTypeCheckbox);
orderTypeCheckbox.click();
scrollIntoView(applyChangesButton);
applyChangesButton.click();
for (String header : configurableHeaders) {
Assert.assertFalse(isElementPresent(String.format("div[contains(@class,'SortArrows-___style__label')][contains(text(),'%s')]", header)));
}
scrollIntoView(columnsSwitcher);
columnsSwitcher.click();
scrollIntoView(instrumentTypeCheckbox);
instrumentTypeCheckbox.click();
scrollIntoView(accountIDTypeCheckbox);
accountIDTypeCheckbox.click();
scrollIntoView(orderQtyTypeCheckbox);
orderQtyTypeCheckbox.click();
scrollIntoView(leavesQtyTypeCheckbox);
leavesQtyTypeCheckbox.click();
scrollIntoView(cumQtyTypeCheckbox);
cumQtyTypeCheckbox.click();
scrollIntoView(avgPriceTypeCheckbox);
avgPriceTypeCheckbox.click();
scrollIntoView(orderPriceTypeCheckbox);
orderPriceTypeCheckbox.click();
scrollIntoView(stopPriceTypeCheckbox);
stopPriceTypeCheckbox.click();
scrollIntoView(createdTypeCheckbox);
createdTypeCheckbox.click();
scrollIntoView(updatedTypeCheckbox);
updatedTypeCheckbox.click();
scrollIntoView(commentTypeCheckbox);
commentTypeCheckbox.click();
scrollIntoView(origOrderIdCheckbox);
origOrderIdCheckbox.click();
scrollIntoView(stopTrigeredTypeCheckbox);
stopTrigeredTypeCheckbox.click();
scrollIntoView(executiveTypeCheckbox);
executiveTypeCheckbox.click();
scrollIntoView(sideTypeCheckbox);
sideTypeCheckbox.click();
scrollIntoView(statusTypeCheckbox);
statusTypeCheckbox.click();
scrollIntoView(timeInForceTypeCheckbox);
timeInForceTypeCheckbox.click();
scrollIntoView(orderTypeCheckbox);
orderTypeCheckbox.click();
scrollIntoView(applyChangesButton);
applyChangesButton.click();
scrollIntoView(instrumentTypeColumn);
Assert.assertTrue(isElementPresent("//div[contains(@class,'SortArrows')][contains(text(),'Instrument')]"));
scrollIntoView(accountIDTypeColumn);
Assert.assertTrue(isElementPresent("//div[contains(@class,'SortArrows')][contains(text(),'Account ID')]"));
scrollIntoView(orderQTYTypeColumn);
Assert.assertTrue(isElementPresent("//div[contains(@class,'SortArrows')][contains(text(),'Order QTY')]"));
scrollIntoView(leavesQTYColumn);
Assert.assertTrue(isElementPresent("//div[contains(@class,'SortArrows')][contains(text(),'Leaves QTY')]"));
scrollIntoView(cumQTYTypeColumn);
Assert.assertTrue(isElementPresent("//div[contains(@class,'SortArrows')][contains(text(),'Cum QTY')]"));
scrollIntoView(avgPriceTypeColumn);
Assert.assertTrue(isElementPresent("//div[contains(@class,'SortArrows')][contains(text(),'Avg. price')]"));
scrollIntoView(orderPriceTypeColumn);
Assert.assertTrue(isElementPresent("//div[contains(@class,'SortArrows')][contains(text(),'Order price')]"));
scrollIntoView(stopPriceTypeColumn);
Assert.assertTrue(isElementPresent("//div[contains(@class,'SortArrows')][contains(text(),'Stop price')]"));
scrollIntoView(createdTypeColumn);
Assert.assertTrue(isElementPresent("//div[contains(@class,'SortArrows')][contains(text(),'Created')]"));
scrollIntoView(updatedTypeColumn);
Assert.assertTrue(isElementPresent("//div[contains(@class,'SortArrows')][contains(text(),'Updated')]"));
scrollIntoView(commentTypeColumn);
Assert.assertTrue(isElementPresent("//div[contains(@class,'SortArrows')][contains(text(),'Comment')]"));
scrollIntoView(origOrderIDColumn);
Assert.assertTrue(isElementPresent("//div[contains(@class,'SortArrows')][contains(text(),'Orig. order ID')]"));
scrollIntoView(stopTriggeredTypeColumn);
Assert.assertTrue(isElementPresent("//div[contains(@class,'SortArrows')][contains(text(),'Stop triggered')]"));
scrollIntoView(executionTypeColumn);
Assert.assertTrue(isElementPresent("//div[contains(@class,'SortArrows')][contains(text(),'Execution type')]"));
scrollIntoView(sideTypeColumn);
Assert.assertTrue(isElementPresent("//div[contains(@class,'SortArrows')][contains(text(),'Side')]"));
scrollIntoView(statusTypeColumn);
Assert.assertTrue(isElementPresent("//div[contains(@class,'SortArrows')][contains(text(),'Status')]"));
scrollIntoView(timeInForceTypeColumn);
Assert.assertTrue(isElementPresent("//div[contains(@class,'SortArrows')][contains(text(),'Time in force')]"));
scrollIntoView(typeColumn);
Assert.assertTrue(isElementPresent("//div[contains(@class,'SortArrows')][contains(text(),'Type')]"));
return this;
}
@Step("Click to close current type")
public DealerDeskOrders clickCloseType() {
closeType.click();
return this;
}
@Step("Click on <<Own>> tab")
public DealerDeskOrders clickOnOwnTab() {
ownTab.click();
return this;
}
@Step("Click on <<Cancel>> order button")
public DealerDeskOrders clickCancelOrderButton() {
cancelOrderButton.get(0).click();
return this;
}
@Step("Click on <<Cancel>> button on Pop-Up window")
public DealerDeskOrders clickCancelPopupButton() {
cancelButton.click();
return this;
}
@Step("Verify pages on dealer desk accounts")
public DealerDeskOrders verifyPagination() {
int index;
for (index = 0; index < pages.size(); ++index)
pages.get(index).click();
index++;
Assert.assertTrue(pages.get(pages.size() - 1).getAttribute("aria-label").contains(Integer.toString(index)));
pages.get(0).click();
Assert.assertTrue(pages.get(0).getAttribute("aria-label").contains(Integer.toString(1)));
return this;
}
}
|
92334394fb6198470f1011d1f422192a63158ca2 | 4,809 | java | Java | uPortal-events/src/main/java/org/apereo/portal/events/aggr/tabrender/TabRenderAggregator.java | colorstheforce/uPortal | a885243f17450d401d89fd21785877cc0c8835f1 | [
"Apache-2.0"
] | 158 | 2015-01-02T22:04:11.000Z | 2021-02-08T16:23:24.000Z | uPortal-events/src/main/java/org/apereo/portal/events/aggr/tabrender/TabRenderAggregator.java | colorstheforce/uPortal | a885243f17450d401d89fd21785877cc0c8835f1 | [
"Apache-2.0"
] | 881 | 2015-01-02T13:21:56.000Z | 2021-02-15T13:34:35.000Z | uPortal-events/src/main/java/org/apereo/portal/events/aggr/tabrender/TabRenderAggregator.java | colorstheforce/uPortal | a885243f17450d401d89fd21785877cc0c8835f1 | [
"Apache-2.0"
] | 196 | 2015-01-02T09:38:24.000Z | 2021-02-07T11:23:50.000Z | 44.943925 | 100 | 0.762321 | 996,510 | /**
* Licensed to Apereo under one or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information regarding copyright ownership. Apereo
* 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 the
* following location:
*
* <p>http://www.apache.org/licenses/LICENSE-2.0
*
* <p>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.apereo.portal.events.aggr.tabrender;
import java.util.HashMap;
import java.util.Map;
import org.apereo.portal.events.PortalEvent;
import org.apereo.portal.events.PortalRenderEvent;
import org.apereo.portal.events.aggr.AggregationInterval;
import org.apereo.portal.events.aggr.AggregationIntervalInfo;
import org.apereo.portal.events.aggr.BaseAggregationPrivateDao;
import org.apereo.portal.events.aggr.BaseIntervalAwarePortalEventAggregator;
import org.apereo.portal.events.aggr.DateDimension;
import org.apereo.portal.events.aggr.EventAggregationContext;
import org.apereo.portal.events.aggr.TimeDimension;
import org.apereo.portal.events.aggr.groups.AggregatedGroupMapping;
import org.apereo.portal.events.aggr.tabs.AggregatedTabLookupDao;
import org.apereo.portal.events.aggr.tabs.AggregatedTabMapping;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/** Event aggregator that uses {@link TabRenderAggregationPrivateDao} to aggregate tab renders */
@Component
public class TabRenderAggregator
extends BaseIntervalAwarePortalEventAggregator<
PortalRenderEvent, TabRenderAggregationImpl, TabRenderAggregationKey> {
private static final String MAPPED_TABS_CACHE_KEY =
TabRenderAggregator.class.getName() + "_MAPPED_TABS";
private TabRenderAggregationPrivateDao tabRenderAggregationDao;
private AggregatedTabLookupDao aggregatedTabLookupDao;
@Autowired
public void setAggregatedTabLookupDao(AggregatedTabLookupDao aggregatedTabLookupDao) {
this.aggregatedTabLookupDao = aggregatedTabLookupDao;
}
@Autowired
public void setTabRenderAggregationDao(TabRenderAggregationPrivateDao tabRenderAggregationDao) {
this.tabRenderAggregationDao = tabRenderAggregationDao;
}
@Override
public boolean supports(Class<? extends PortalEvent> type) {
return PortalRenderEvent.class.isAssignableFrom(type);
}
@Override
protected BaseAggregationPrivateDao<TabRenderAggregationImpl, TabRenderAggregationKey>
getAggregationDao() {
return this.tabRenderAggregationDao;
}
@Override
protected void updateAggregation(
PortalRenderEvent e,
EventAggregationContext eventAggregationContext,
AggregationIntervalInfo intervalInfo,
TabRenderAggregationImpl aggregation) {
final long executionTime = e.getExecutionTimeNano();
final int duration = intervalInfo.getDurationTo(e.getTimestampAsDate());
aggregation.setDuration(duration);
aggregation.addValue(executionTime);
}
@Override
protected TabRenderAggregationKey createAggregationKey(
PortalRenderEvent e,
EventAggregationContext eventAggregationContext,
AggregationIntervalInfo intervalInfo,
AggregatedGroupMapping aggregatedGroup) {
final TimeDimension timeDimension = intervalInfo.getTimeDimension();
final DateDimension dateDimension = intervalInfo.getDateDimension();
final AggregationInterval aggregationInterval = intervalInfo.getAggregationInterval();
Map<String, AggregatedTabMapping> mappedTabs =
eventAggregationContext.getAttribute(MAPPED_TABS_CACHE_KEY);
if (mappedTabs == null) {
mappedTabs = new HashMap<String, AggregatedTabMapping>();
eventAggregationContext.setAttribute(MAPPED_TABS_CACHE_KEY, mappedTabs);
}
final String targetedLayoutNodeId = e.getTargetedLayoutNodeId();
AggregatedTabMapping mappedTab = mappedTabs.get(targetedLayoutNodeId);
if (mappedTab == null) {
mappedTab = this.aggregatedTabLookupDao.getMappedTabForLayoutId(targetedLayoutNodeId);
mappedTabs.put(targetedLayoutNodeId, mappedTab);
}
return new TabRenderAggregationKeyImpl(
dateDimension, timeDimension, aggregationInterval, aggregatedGroup, mappedTab);
}
}
|
9233446b759e974dbdc4ba0500dd0ce2ea179b48 | 878 | java | Java | src/main/java/com/seciii/irbl/vo/UserForm.java | NIL-zhuang/IRBL | 4f787e2bf065f728f086dfad07d71ef6210dd159 | [
"MIT"
] | null | null | null | src/main/java/com/seciii/irbl/vo/UserForm.java | NIL-zhuang/IRBL | 4f787e2bf065f728f086dfad07d71ef6210dd159 | [
"MIT"
] | null | null | null | src/main/java/com/seciii/irbl/vo/UserForm.java | NIL-zhuang/IRBL | 4f787e2bf065f728f086dfad07d71ef6210dd159 | [
"MIT"
] | null | null | null | 17.918367 | 86 | 0.582005 | 996,511 | package com.seciii.irbl.vo;
public class UserForm {
/**
* 用户邮箱,不可重复
*/
private String email;
/**
* 用户密码
*/
private String password;
/**
* 用户名
*/
private String userName;
/**
* 手机号
*/
private String phoneNumber;
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getPhoneNumber() { return phoneNumber; }
public void setPhoneNumber(String phoneNumber) { this.phoneNumber = phoneNumber; }
}
|
9233451ac1e3464bec9c900007823bc98897fc2b | 1,263 | java | Java | cola-cloud-platform/cola-cloud-organization/cola-cloud-organization-service/src/main/java/com/honvay/cola/cloud/organization/service/SysEmployeeService.java | 18722599563/tortoiseGit | 40efe9683900d972f75ba9af153170701cea1bcb | [
"MIT"
] | 327 | 2018-04-03T02:48:29.000Z | 2022-02-22T05:57:07.000Z | cola-cloud-platform/cola-cloud-organization/cola-cloud-organization-service/src/main/java/com/honvay/cola/cloud/organization/service/SysEmployeeService.java | shisanchanggong/cola-cloud | fbe5ad931b3328825c8630d9b943d5508990382f | [
"MIT"
] | 5 | 2018-05-06T10:08:37.000Z | 2021-08-12T21:14:18.000Z | cola-cloud-platform/cola-cloud-organization/cola-cloud-organization-service/src/main/java/com/honvay/cola/cloud/organization/service/SysEmployeeService.java | shisanchanggong/cola-cloud | fbe5ad931b3328825c8630d9b943d5508990382f | [
"MIT"
] | 182 | 2018-04-08T11:32:10.000Z | 2022-03-13T01:05:26.000Z | 22.157895 | 104 | 0.677751 | 996,512 | package com.honvay.cola.cloud.organization.service;
import com.baomidou.mybatisplus.plugins.Page;
import com.honvay.cola.cloud.framework.base.service.BaseService;
import com.honvay.cola.cloud.organization.entity.SysEmployee;
import com.honvay.cola.cloud.organization.model.SysEmployeeAddDTO;
import com.honvay.cola.cloud.organization.model.SysEmployeeDTO;
import com.honvay.cola.cloud.organization.model.SysEmployeeVO;
import java.util.List;
/**
* <p>
* 服务类
* </p>
*
* @author liqiu
* @date 2018-01-04
*/
public interface SysEmployeeService extends BaseService<SysEmployee> {
/**
* 添加员工
* @param sysEmployeeAddDTO
*/
void add(SysEmployeeAddDTO sysEmployeeAddDTO);
/**
* 创建员工
* @param sysEmployeeDTO
*/
void create(SysEmployeeDTO sysEmployeeDTO);
/**
* 修改员工信息
* @param sysEmployeeDTO
*/
void update(SysEmployeeDTO sysEmployeeDTO);
/**
* 获取员工详细信息
* @param id
* @return
*/
SysEmployeeVO getEmployeeById(Long id);
/**
* 通过部门ID获取员工列表
* @param page
* @param name
* @param username
* @param status
* @return
*/
Page<SysEmployeeVO> getEmployeeListByOrgId(Page page, String name, String username, Integer status);
}
|
92334896a0aa626bea12c8967905ea13e2412f7b | 158 | java | Java | remote_control/CellServ/src/com/cellbots/cellserv/client/JoyPad.java | NGONIDZASHEMWEDZI/cellbots | 2e4635beab0cabef7a75e9d863d588b51db0e74d | [
"Apache-2.0"
] | 2 | 2018-10-11T16:11:11.000Z | 2018-10-11T16:15:53.000Z | remote_control/CellServ/src/com/cellbots/cellserv/client/JoyPad.java | NGONIDZASHEMWEDZI/cellbots | 2e4635beab0cabef7a75e9d863d588b51db0e74d | [
"Apache-2.0"
] | 38 | 2015-03-03T22:32:20.000Z | 2015-03-03T22:32:47.000Z | remote_control/CellServ/src/com/cellbots/cellserv/client/JoyPad.java | NGONIDZASHEMWEDZI/cellbots | 2e4635beab0cabef7a75e9d863d588b51db0e74d | [
"Apache-2.0"
] | null | null | null | 12.153846 | 47 | 0.734177 | 996,513 | package com.cellbots.cellserv.client;
import com.google.gwt.user.client.ui.Composite;
public class JoyPad extends Composite
{
public JoyPad()
{
}
}
|
92334a8f1a1508674d7754aa68f05f0b225a1002 | 573 | java | Java | src/test/java/BeehiveTest/TestParameters.java | Kristofvdw/BeehiveTest | 9a55c980bc09c3e09b6568e1eed8af4a85a0d9ee | [
"MIT"
] | null | null | null | src/test/java/BeehiveTest/TestParameters.java | Kristofvdw/BeehiveTest | 9a55c980bc09c3e09b6568e1eed8af4a85a0d9ee | [
"MIT"
] | null | null | null | src/test/java/BeehiveTest/TestParameters.java | Kristofvdw/BeehiveTest | 9a55c980bc09c3e09b6568e1eed8af4a85a0d9ee | [
"MIT"
] | null | null | null | 28.65 | 79 | 0.671902 | 996,514 | package BeehiveTest;
import org.testng.annotations.Parameters;
import org.testng.annotations.Test;
public class TestParameters {
@Parameters({ "browser" })
@Test
public void testCaseOne(String browser) {
System.out.println("browser passed as :- " + browser);
}
@Parameters({ "username", "password" })
@Test
public void testCaseTwo(String username, String password) {
System.out.println("Parameter for User Name passed as :- " + username);
System.out.println("Parameter for Password passed as :- " + password);
}
} |
92334b154e9b7aa1efbc1785a6893bdef69d2ca3 | 3,320 | java | Java | streaming/storm/src/main/java/com/mitosis/spout/KafkaSpoutTopology.java | Chabane/bigdata-spark-kafka-complete-app | 6838b5e33fefe81b7e1514c057dad5ebc48f4132 | [
"Apache-2.0"
] | 178 | 2018-03-18T23:17:24.000Z | 2022-03-12T19:06:35.000Z | streaming/storm/src/main/java/com/mitosis/spout/KafkaSpoutTopology.java | Chabane/bigdata-app | 6838b5e33fefe81b7e1514c057dad5ebc48f4132 | [
"Apache-2.0"
] | 11 | 2018-06-06T07:20:36.000Z | 2020-08-07T07:38:52.000Z | streaming/storm/src/main/java/com/mitosis/spout/KafkaSpoutTopology.java | Chabane/bigdata-app | 6838b5e33fefe81b7e1514c057dad5ebc48f4132 | [
"Apache-2.0"
] | 65 | 2018-03-19T01:16:11.000Z | 2022-01-16T15:07:59.000Z | 41.5 | 174 | 0.683434 | 996,515 | package com.mitosis.spout;
import com.typesafe.config.ConfigFactory;
import org.apache.storm.hbase.bolt.HBaseBolt;
import org.apache.storm.hbase.bolt.mapper.SimpleHBaseMapper;
import org.apache.storm.kafka.spout.*;
import org.apache.storm.Config;
import org.apache.storm.generated.StormTopology;
import org.apache.storm.kafka.spout.KafkaSpoutRetryExponentialBackoff.TimeInterval;
import org.apache.storm.topology.TopologyBuilder;
import org.apache.storm.tuple.Fields;
import java.util.HashMap;
import java.util.Map;
public class KafkaSpoutTopology {
public Config getConfig() {
Config config = new Config();
config.setDebug(true);
Map<String, Object> hbConf = new HashMap<>();
hbConf.put("hbase.rootdir", "hdfs://namenode-1:8020/hbase");
hbConf.put("hbase.zookeeper.quorum","zoo1");
hbConf.put("hbase.master.port","16020");
hbConf.put("zookeeper.znode.parent","/hbase");
hbConf.put("hbase.zookeeper.property.clientPort","2181");
hbConf.put("hbase.cluster.distributed","true");
hbConf.put("hbase.rest.ssl.enabled","false");
config.put("hbase.conf", hbConf);
return config;
}
public StormTopology getTopology(KafkaSpoutConfig<String, String> spoutConfig) {
final TopologyBuilder tp = new TopologyBuilder();
tp.setSpout("kafka_spout", new KafkaSpout<>(spoutConfig), 1);
KafkaFlightInfoBolt kafkaBolt = new KafkaFlightInfoBolt();
SimpleHBaseMapper mapper = new SimpleHBaseMapper()
.withRowKeyField("rowKey")
.withColumnFields(new Fields("rowKey", "departingId", "arrivingId", "tripType", "departureDate", "arrivalDate", "passengerNumber", "cabinClass"))
.withColumnFamily("searchFlightInfo");
HBaseBolt hbaseBolt = new HBaseBolt("flightInfo", mapper)
.withConfigKey("hbase.conf");
tp.setBolt("kafka_bolt", kafkaBolt)
.shuffleGrouping("kafka_spout");
tp.setBolt("hbase_bolt", hbaseBolt, 1)
.fieldsGrouping("kafka_bolt", new Fields("rowKey", "departingId", "arrivingId", "tripType", "departureDate", "arrivalDate", "passengerNumber", "cabinClass"));
return tp.createTopology();
}
public KafkaSpoutConfig<String, String> getSpoutConfig(String bootstrapServers) {
// topic names which will be read
com.typesafe.config.Config config = ConfigFactory.parseResources("app.conf");
String topic = config.getString("producer.topic");
return KafkaSpoutConfig.builder(bootstrapServers, topic)
.setRetry(getRetryService())
.setOffsetCommitPeriodMs(10_000)
.setFirstPollOffsetStrategy(KafkaSpoutConfig.FirstPollOffsetStrategy.LATEST)
.setMaxUncommittedOffsets(250)
.setProp("key.deserializer",
"org.apache.kafka.common.serialization.StringDeserializer")
.setProp("value.deserializer",
"org.apache.kafka.common.serialization.ByteArrayDeserializer")
.build();
}
public KafkaSpoutRetryService getRetryService() {
return new KafkaSpoutRetryExponentialBackoff(TimeInterval.microSeconds(500),
TimeInterval.milliSeconds(2), Integer.MAX_VALUE, TimeInterval.seconds(10));
}
}
|
92334b736d33270faffb1831520eb4f758744497 | 12,360 | java | Java | incubator/viewers/javafx/model/src/main/java/org/apache/isis/incubator/viewer/javafx/model/util/_fx.java | ecpnv-devops/isis | aeda00974e293e2792783090360b155a9d1a6624 | [
"Apache-2.0"
] | 665 | 2015-01-01T06:06:28.000Z | 2022-03-27T01:11:56.000Z | incubator/viewers/javafx/model/src/main/java/org/apache/isis/incubator/viewer/javafx/model/util/_fx.java | jalexmelendez/isis | ddf3bd186cad585b959b7f20d8c9ac5e3f33263d | [
"Apache-2.0"
] | 176 | 2015-02-07T11:29:36.000Z | 2022-03-25T04:43:12.000Z | incubator/viewers/javafx/model/src/main/java/org/apache/isis/incubator/viewer/javafx/model/util/_fx.java | jalexmelendez/isis | ddf3bd186cad585b959b7f20d8c9ac5e3f33263d | [
"Apache-2.0"
] | 337 | 2015-01-02T03:01:34.000Z | 2022-03-21T15:56:28.000Z | 32.526316 | 119 | 0.654207 | 996,516 | /*
* 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.isis.incubator.viewer.javafx.model.util;
import java.util.function.Predicate;
import org.springframework.lang.Nullable;
import javafx.beans.property.ReadOnlyObjectWrapper;
import javafx.beans.property.ReadOnlyStringWrapper;
import javafx.beans.value.ObservableValue;
import javafx.collections.ListChangeListener.Change;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.geometry.Insets;
import javafx.scene.Node;
import javafx.scene.control.Accordion;
import javafx.scene.control.Button;
import javafx.scene.control.ContentDisplay;
import javafx.scene.control.Label;
import javafx.scene.control.Labeled;
import javafx.scene.control.Menu;
import javafx.scene.control.MenuBar;
import javafx.scene.control.MenuItem;
import javafx.scene.control.Tab;
import javafx.scene.control.TabPane;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.control.TitledPane;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.Background;
import javafx.scene.layout.BackgroundFill;
import javafx.scene.layout.Border;
import javafx.scene.layout.BorderStroke;
import javafx.scene.layout.BorderStrokeStyle;
import javafx.scene.layout.BorderWidths;
import javafx.scene.layout.CornerRadii;
import javafx.scene.layout.FlowPane;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Pane;
import javafx.scene.layout.Region;
import javafx.scene.layout.VBox;
import javafx.scene.paint.Color;
import javafx.scene.text.Font;
import javafx.scene.text.FontWeight;
import lombok.NonNull;
import lombok.val;
import lombok.experimental.UtilityClass;
@UtilityClass
public final class _fx {
// -- OBSERVABLES
public static ObservableValue<String> newStringReadonly(String value) {
return new ReadOnlyStringWrapper(value);
}
public static <T> ObservableValue<T> newObjectReadonly(T value) {
return new ReadOnlyObjectWrapper<T>(value);
}
// -- COMPONENT FACTORIES
public static <T extends Node> T add(Pane container, T component) {
container.getChildren().add(component);
return component;
}
public static Label newLabel(Pane container, String label) {
val component = new Label(label);
container.getChildren().add(component);
return component;
}
public static Label newValidationFeedback(Pane container) {
val component = new Label();
container.getChildren().add(component);
visibilityLayoutFix(component);
component.setStyle("-fx-color: red");
component.visibleProperty().addListener((e, o, visible)->{
if(visible) {
borderDashed(container, Color.RED);
} else {
container.setBorder(null);
}
});
return component;
}
public static Button newButton(Pane container, String label, EventHandler<ActionEvent> eventHandler) {
val component = new Button(label);
container.getChildren().add(component);
component.setOnAction(eventHandler);
return component;
}
public static HBox newHBox(Pane container) {
val component = new HBox();
container.getChildren().add(component);
_fx.padding(component, 4, 8);
_fx.borderDashed(component, Color.BLUE); // debug
return component;
}
public static VBox newVBox(Pane container) {
val component = new VBox();
container.getChildren().add(component);
_fx.padding(component, 4, 8);
_fx.borderDashed(component, Color.GREEN); // debug
return component;
}
public static VBox newVBox(TitledPane container) {
val component = new VBox();
container.setContent(component);
return component;
}
public static FlowPane newFlowPane(@Nullable Pane container) {
val component = new FlowPane();
if(container!=null) {
container.getChildren().add(component);
}
_fx.padding(component, 4, 8);
_fx.hideUntilPopulated(component);
return component;
}
public static GridPane newGrid(Pane container) {
val component = new GridPane();
container.getChildren().add(component);
return component;
}
public static GridPane newGrid(TitledPane container) {
val component = new GridPane();
container.setContent(component);
return component;
}
public static <T extends Node> T addGridCell(GridPane container, T cellNode, int column, int row) {
container.add(cellNode, column, row);
return cellNode;
}
public static TabPane newTabGroup(Pane container) {
val component = new TabPane();
container.getChildren().add(component);
return component;
}
public static Tab newTab(TabPane container, String label) {
val component = new Tab(label);
container.getTabs().add(component);
return component;
}
public static Accordion newAccordion(Pane container) {
val component = new Accordion();
container.getChildren().add(component);
return component;
}
public static Menu newMenu(MenuBar container, String label) {
val component = new Menu(label);
container.getMenus().add(component);
return component;
}
public static MenuItem newMenuItem(Menu container, String label) {
val component = new MenuItem(label);
container.getItems().add(component);
return component;
}
public static TitledPane newTitledPane(Accordion container, String label) {
val component = new TitledPane();
container.getPanes().add(component);
component.setText(label);
component.setAnimated(true);
return component;
}
/**
* @param <S> The type of the TableView generic type (i.e. S == TableView<S>)
* @param <T> The type of the content in all cells in this TableColumn.
* @param tableView
* @param columnLabel
* @param columnType
* @return a new column as added to the {@code tableView}
*/
public static <S, T> TableColumn<S, T> newColumn(TableView<S> tableView, String columnLabel, Class<T> columnType) {
val column = new TableColumn<S, T>(columnLabel);
tableView.getColumns().add(column);
return column;
}
// -- VISIBILITY
/**
* Do not consider node for layout calculations, when not visible
* @param node
*/
public static Node visibilityLayoutFix(Node node) {
node.managedProperty().bind(node.visibleProperty());
return node;
}
// -- ICONS
public static Image imageFromClassPath(@NonNull Class<?> cls, String resourceName) {
return new Image(cls.getResourceAsStream(resourceName));
}
public static ImageView iconForImage(Image image, int width, int height) {
val icon = new ImageView(image);
icon.setFitWidth(width);
icon.setFitHeight(height);
return icon;
}
public static Button bottonForImage(Image image, int width, int height) {
val icon = new ImageView(image);
icon.setPreserveRatio(true);
icon.setFitWidth(width-2);
icon.setFitHeight(height-2);
val btn = new Button();
btn.setGraphic(icon);
btn.setMaxSize(width, height);
btn.setMinSize(width, height);
btn.setContentDisplay(ContentDisplay.GRAPHIC_ONLY);
return btn;
}
// -- LAYOUTS
public static void padding(Region region, int hPadding, int vPadding) {
region.setPadding(new Insets(vPadding, hPadding, vPadding, hPadding));
}
public static void toolbarLayoutPropertyAssociated(FlowPane component) {
component.setPadding(new Insets(0, 12, 0, 12));
component.setHgap(10);
component.setVgap(10);
}
public static void toolbarLayout(FlowPane component) {
component.setPadding(new Insets(15, 12, 15, 12));
component.setHgap(10);
component.setVgap(10);
_fx.borderDashed(component, Color.RED); // debug
_fx.backround(component, Color.FLORALWHITE);
}
public static void visistDepthFirst(Node component, Predicate<Node> onNode) {
val doContinue = onNode.test(component);
if(doContinue && (component instanceof Pane)) {
((Pane) component).getChildrenUnmodifiable()
.forEach(child->visistDepthFirst(child, onNode));
}
}
//XXX Superseded by visibilityLayoutFix(Node node)
// private static boolean isEmptyOrHidden(Node component) {
// if(component instanceof Pane) {
// val children = ((Pane) component).getChildrenUnmodifiable();
// if(children.isEmpty()) {
// return true; // empty
// }
// //return true only if all children are empty or hidden
// val atLeastOneIsNonEmptyOrVisible = children.stream()
// .anyMatch(child->!isEmptyOrHidden(child));
// return !atLeastOneIsNonEmptyOrVisible;
// }
// return !component.isVisible();
// }
public static void hideUntilPopulated(Pane component) {
component.setVisible(false);
component.getChildren().addListener((Change<? extends Node> change) -> {
if(change.next() && change.wasAdded()) {
// change.getAddedSubList().stream()
// .filter(_Predicates.instanceOf(Pane.class))
// .map(Pane.class::cast)
// .forEach(newPane->{
// _Probe.errOut("newPane %s", ""+newPane);
// });
component.setVisible(true);
}
});
// component.setOnMouseClicked(e->{
//
// _Probe.errOut("event %s", ""+e);
//
// visistDepthFirst(component, node->{
// _Probe.errOut("node %s", ""+node);
// return true;
// });
//
// });
}
// -- STYLES
public static <T extends Labeled> T h1(T component) {
component.setFont(Font.font("Verdana", FontWeight.BOLD, 20));
return component;
}
public static <T extends Labeled> T h2(T component) {
component.setFont(Font.font("Verdana", FontWeight.BOLD, 18));
return component;
}
public static <T extends Labeled> T h3(T component) {
component.setFont(Font.font("Verdana", FontWeight.NORMAL, 17));
return component;
}
public static <T extends Region> T backround(T region, Color color) {
region.setBackground(new Background(new BackgroundFill(color, CornerRadii.EMPTY, Insets.EMPTY)));
return region;
}
public static <T extends Region> T borderDashed(T region, Color color) {
region.setBorder(new Border(new BorderStroke(
color,
BorderStrokeStyle.DASHED,
new CornerRadii(3),
new BorderWidths(1))));
return region;
}
// -- HACKS
/**
* {@code menu.setOnAction(action)} does nothing if the menu has no menu items
*/
public static void setMenuOnAction(Menu menu, EventHandler<ActionEvent> action) {
_fx.newMenuItem(menu, "dummy");
menu.addEventHandler(Menu.ON_SHOWN, event -> menu.hide());
menu.addEventHandler(Menu.ON_SHOWING, event -> menu.fire());
menu.setOnAction(action);
}
}
|
92334b818dc0225671978e7c0d7b1ff0957309e0 | 7,559 | java | Java | src/main/java/code/ponfee/commons/limit/request/RequestLimiter.java | ponfee/commons-core | 412c72e113f9e58ae3a9f5a3537acac15c35c7c6 | [
"MIT"
] | 2 | 2019-07-04T05:45:33.000Z | 2020-07-20T15:26:01.000Z | src/main/java/code/ponfee/commons/limit/request/RequestLimiter.java | ponfee/commons-core | 412c72e113f9e58ae3a9f5a3537acac15c35c7c6 | [
"MIT"
] | null | null | null | src/main/java/code/ponfee/commons/limit/request/RequestLimiter.java | ponfee/commons-core | 412c72e113f9e58ae3a9f5a3537acac15c35c7c6 | [
"MIT"
] | null | null | null | 28.961686 | 98 | 0.56436 | 996,517 | package code.ponfee.commons.limit.request;
import java.io.Serializable;
import java.util.concurrent.atomic.AtomicInteger;
import javax.crypto.Mac;
import org.apache.commons.codec.binary.Hex;
import org.apache.commons.lang3.StringUtils;
import code.ponfee.commons.jce.HmacAlgorithms;
import code.ponfee.commons.jce.digest.HmacUtils;
/**
* Request limiter, like as send sms and so on
*
* @author Ponfee
*/
public abstract class RequestLimiter {
private static final byte[] SALT_PREFIX = "{;a*9)p<?T".getBytes();
/** limit operation key */
public static final String CHECK_FREQ_KEY = "req:lmt:fre:";
public static final String CHECK_THRE_KEY = "req:lmt:thr:";
/** validation code verify key */
public static final String CACHE_CODE_KEY = "req:cah:code:";
public static final String CHECK_CODE_KEY = "req:chk:code:";
/** image captcha code verify key */
public static final String CACHE_CAPTCHA_KEY = "req:cah:cap:";
/** count operation action key */
public static final String TRACE_ACTION_KEY = "req:cnt:act:";
// ----------------------------------------------------------------用于请求限制
public final RequestLimiter limitFrequency(String key, int period)
throws RequestLimitException {
return limitFrequency(key, period, "请求频繁,请" + format(period) + "后再试!");
}
/**
* 访问频率限制:一个周期内最多允许访问1次<p>
* 比如短信60秒内只能发送一次
*
* @param key the key
* @param period the period
* @param message the message
*
* @return the caller, chain program
*
* @throws RequestLimitException if over limit occurs
*/
public abstract RequestLimiter limitFrequency(String key, int period, String message)
throws RequestLimitException;
public final RequestLimiter limitThreshold(String key, int period, int limit)
throws RequestLimitException {
return limitThreshold(key, period, limit,
"请求超限,请" + RequestLimiter.format(period) + "后再试!");
}
/**
* 访问次数限制:一个周期内最多允许访问limit次
* 比如一个手机号一天只能发10次
*
* @param key the key
* @param period the period
* @param limit the limit
* @param message the message
*
* @return the caller, chain program
*
* @throws RequestLimitException if over limit occurs
*/
public abstract RequestLimiter limitThreshold(String key, int period,
int limit, String message)
throws RequestLimitException;
// ----------------------------------------------------------------用于验证码校验(如手机验证码)
/**
* cache for the server generate validation code
*
* @param key the cache key
* @param code the validation code of server generate
* @param ttl the expire time
*/
public abstract void cacheCode(String key, String code, int ttl);
/**
* check the validation code of user input is equals server cache
*
* @param key the cache key
* @param code the validation code of user input
* @param limit the maximum fail input times
*
* @return the caller, chain program
*
* @throws RequestLimitException if over limit occurs
*/
public abstract RequestLimiter checkCode(String key, String code, int limit)
throws RequestLimitException;
// ----------------------------------------------------------------用于缓存图片验证码
/**
* cache captcha of server generate
*
* @param key
* @param captcha the image captcha code of server generate
* @param expire 缓存有效时间
*/
public abstract void cacheCaptcha(String key, String captcha, int expire);
public final boolean checkCaptcha(String key, String captcha) {
return this.checkCaptcha(key, captcha, false);
}
/**
* check captcha of user input
*
* @param key the cache key
* @param captcha the captcha
* @param caseSensitive is case sensitive
*
* @return true|false
*/
public abstract boolean checkCaptcha(String key, String captcha,
boolean caseSensitive);
// ------------------------------------------------------------------------行为计数(用于登录失败限制)
/**
* 计数周期内的行为<p>
* 用于登录失败达到一定次数后锁定账户等场景<p>
*
* @param key
* @param period
*/
public abstract void recordAction(String key, int period);
/**
* 统计周期内的行为量<p>
* 用于登录失败达到一定次数后锁定账户等场景<p>
*
* @param key the key
* @return action count number
*/
public abstract long countAction(String key);
/**
* 重置行为
*
* @param key the key
*/
public abstract void resetAction(String key);
// ----------------------------------------------------------------用于验证码校验
/**
* 生成nonce校验码(返回到用户端)
*
* @param code a string like as captcha code
* @param salt a string like as mobile phone
*
* @return a check code
*/
public static String buildNonce(String code, String salt) {
//byte[] key = Bytes.fromLong(new Random(code.hashCode()).nextLong()); // 第一个nextLong值是固定的
byte[] key = code.getBytes();
Mac mac = HmacUtils.getInitializedMac(HmacAlgorithms.HmacMD5, key);
mac.update(SALT_PREFIX);
return Hex.encodeHexString(mac.doFinal(salt.getBytes()));
}
/**
* 校验nonce
*
* @param nonce the nonce
* @param code the code
* @param salt the salt
*
* @return {@code true} is verify success
*/
public static boolean verifyNonce(String nonce, String code, String salt) {
return StringUtils.isNotEmpty(nonce) && nonce.equals(buildNonce(code, salt));
}
/**
* 时间格式化,5/6 rate
*
* @param seconds
* @return
*/
public static String format(int seconds) {
int days = seconds / 86400;
if (days > 365) { // 年
return (days / 365 + ((days % 365) / 30 + 10) / 12) + "年";
}
if (days > 30) { // 月
return (days / 30 + (days % 30 + 25) / 30) + "个月";
}
seconds %= 86400;
int hours = seconds / 3600;
if (days > 0) { // 日
return (days + (hours + 20) / 24) + "天";
}
seconds %= 3600;
int minutes = seconds / 60;
if (hours > 0) { // 时
return (hours + (minutes + 50) / 60) + "小时";
}
seconds %= 60;
if (minutes > 0) { // 分
return (minutes + (seconds + 50) / 60) + "分钟";
}
return seconds + "秒"; // 秒
}
static long expire(int ttl) {
return System.currentTimeMillis() + ttl * 1000;
}
static class CacheValue<T> implements Serializable {
private static final long serialVersionUID = 8615157453929878610L;
final T value;
final long expireTimeMillis;
final AtomicInteger count;
public CacheValue(T value, long expireTimeMillis) {
this.value = value;
this.expireTimeMillis = expireTimeMillis;
this.count = new AtomicInteger(1);
}
int increment() {
return count.incrementAndGet();
}
int count() {
return count.get();
}
T get() {
return value;
}
boolean isExpire() {
return expireTimeMillis < System.currentTimeMillis();
}
boolean isExpire(long timeMillis) {
return expireTimeMillis < timeMillis;
}
}
}
|
92334bbe42b56f1c86450d06fbcf7d480c76e670 | 924 | java | Java | src/main/java/pl/apso/tests/invest/FundType.java | damian0o/investment-funds-calculator | fec12558eaa4a0255da70d59c81c840cd2a8b11a | [
"Apache-2.0"
] | null | null | null | src/main/java/pl/apso/tests/invest/FundType.java | damian0o/investment-funds-calculator | fec12558eaa4a0255da70d59c81c840cd2a8b11a | [
"Apache-2.0"
] | null | null | null | src/main/java/pl/apso/tests/invest/FundType.java | damian0o/investment-funds-calculator | fec12558eaa4a0255da70d59c81c840cd2a8b11a | [
"Apache-2.0"
] | null | null | null | 23.1 | 93 | 0.66342 | 996,518 | package pl.apso.tests.invest;
import jdk.nashorn.internal.runtime.ParserException;
import sun.reflect.generics.reflectiveObjects.NotImplementedException;
/**
* Represent one of three investment fund type.
* Contains method responsible for serialization and deserialization of class for simplicity.
*/
public enum FundType {
POLISH,
FOREIGN,
MONEY;
public static FundType parse(String val) {
switch (val) {
case "Polskie":
return POLISH;
case "Zagraniczne":
return FOREIGN;
case "Pieniężne":
return MONEY;
}
throw new ParserException(String.format("Could not parse to FundType [val='%s']", val));
}
@Override
public String toString() {
switch (this) {
case POLISH:
return "Polskie";
case FOREIGN:
return "Zagraniczne";
case MONEY:
return "Pienieżne";
}
throw new NotImplementedException();
}
}
|
92334c6ec95a51d3451a4a68bc1649acb40922d0 | 30,198 | java | Java | out/artifacts/BoardTest_jar2/javafx.graphics/com/sun/glass/ui/monocle/EPDFrameBuffer.java | wappints/Game-Of-Life | a331201aee743698175e3323284f5da84f6c4592 | [
"MIT"
] | null | null | null | out/artifacts/BoardTest_jar2/javafx.graphics/com/sun/glass/ui/monocle/EPDFrameBuffer.java | wappints/Game-Of-Life | a331201aee743698175e3323284f5da84f6c4592 | [
"MIT"
] | null | null | null | out/artifacts/BoardTest_jar2/javafx.graphics/com/sun/glass/ui/monocle/EPDFrameBuffer.java | wappints/Game-Of-Life | a331201aee743698175e3323284f5da84f6c4592 | [
"MIT"
] | null | null | null | 42.234965 | 109 | 0.644248 | 996,519 | /*
* Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.glass.ui.monocle;
import com.sun.glass.ui.monocle.EPDSystem.FbVarScreenInfo;
import com.sun.glass.ui.monocle.EPDSystem.IntStructure;
import com.sun.glass.ui.monocle.EPDSystem.MxcfbUpdateData;
import com.sun.glass.ui.monocle.EPDSystem.MxcfbWaveformModes;
import com.sun.javafx.logging.PlatformLogger;
import com.sun.javafx.logging.PlatformLogger.Level;
import com.sun.javafx.util.Logging;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.text.MessageFormat;
/**
* Represents the standard Linux frame buffer device interface plus the custom
* extensions to that interface provided by the Electrophoretic Display
* Controller (EPDC) frame buffer driver.
* <p>
* The Linux frame buffer device interface is documented in <cite>The Frame
* Buffer Device API</cite> found in the Ubuntu package called <i>linux-doc</i>
* (see <i>/usr/share/doc/linux-doc/fb/api.txt.gz</i>).</p>
* <p>
* The EPDC frame buffer driver extensions are documented in the <cite>i.MX
* Linux Reference Manual</cite> available on the
* <a href="https://www.nxp.com/">NXP website</a> (registration required). On
* the NXP home page, click Products, ARM Processors, i.MX Application
* Processors, and then i.MX 6 Processors, for example. Select the i.MX6SLL
* Product in the chart; then click the Documentation tab. Look for a download
* with a label for Linux documents, like L4.1.15_2.1.0_LINUX_DOCS, under the
* Supporting Information section. After downloading and expanding the archive,
* the reference manual is found in the <i>doc</i> directory as the file
* <i>i.MX_Linux_Reference_Manual.pdf</i>.</p>
*/
class EPDFrameBuffer {
/**
* The arithmetic right shift value to convert a bit depth to a byte depth.
*/
private static final int BITS_TO_BYTES = 3;
/**
* The delay in milliseconds between the completion of all updates in the
* EPDC driver and when the driver powers down the EPDC and display power
* supplies.
*/
private static final int POWERDOWN_DELAY = 1_000;
/**
* Linux system error: ENOTTY 25 Inappropriate ioctl for device.
*/
private static final int ENOTTY = 25;
private final PlatformLogger logger = Logging.getJavaFXLogger();
private final EPDSettings settings;
private final LinuxSystem system;
private final EPDSystem driver;
private final long fd;
private final int xres;
private final int yres;
private final int xresVirtual;
private final int yresVirtual;
private final int xoffset;
private final int yoffset;
private final int bitsPerPixel;
private final int bytesPerPixel;
private final int byteOffset;
private final MxcfbUpdateData updateData;
private final MxcfbUpdateData syncUpdate;
private int updateMarker;
private int lastMarker;
/**
* Creates a new {@code EPDFrameBuffer} for the given frame buffer device.
* The geometry of the Linux frame buffer is shown below for various color
* depths and rotations on a sample system, as printed by the <i>fbset</i>
* command. The first three are for landscape mode, while the last three are
* for portrait.
* <pre>{@code
* geometry 800 600 800 640 32 (line length: 3200)
* geometry 800 600 800 1280 16 (line length: 1600)
* geometry 800 600 800 1280 8 (line length: 800)
*
* geometry 600 800 608 896 32 (line length: 2432)
* geometry 600 800 608 1792 16 (line length: 1216)
* geometry 600 800 608 1792 8 (line length: 608)
* }</pre>
*
* @implNote {@code MonocleApplication} creates a {@code Screen} which
* requires that the width be set to {@link #xresVirtual} even though only
* the first {@link #xres} pixels of each row are visible. The EPDC driver
* supports panning only in the y-direction, so it is not possible to center
* the visible resolution horizontally when these values differ. The JavaFX
* application should be left-aligned in this case and ignore the few extra
* pixels on the right of its screen.
*
* @param fbPath the frame buffer device path, such as <i>/dev/fb0</i>
* @throws IOException if an error occurs when opening the frame buffer
* device or when getting or setting the frame buffer configuration
* @throws IllegalArgumentException if the EPD settings specify an
* unsupported color depth
*/
EPDFrameBuffer(String fbPath) throws IOException {
settings = EPDSettings.newInstance();
system = LinuxSystem.getLinuxSystem();
driver = EPDSystem.getEPDSystem();
fd = system.open(fbPath, LinuxSystem.O_RDWR);
if (fd == -1) {
throw new IOException(system.getErrorMessage());
}
/*
* Gets the current settings of the frame buffer device.
*/
var screen = new FbVarScreenInfo();
getScreenInfo(screen);
/*
* Changes the settings of the frame buffer from the system properties.
*
* See the section, "Format configuration," in "The Frame Buffer Device
* API" for details. Note that xoffset is always zero, and yoffset can
* be modified only by panning in the y-direction with the IOCTL call to
* LinuxSystem.FBIOPAN_DISPLAY.
*/
screen.setBitsPerPixel(screen.p, settings.bitsPerPixel);
screen.setGrayscale(screen.p, settings.grayscale);
switch (settings.bitsPerPixel) {
case Byte.SIZE:
// rgba 8/0,8/0,8/0,0/0 (set by driver when grayscale > 0)
screen.setRed(screen.p, 0, 0);
screen.setGreen(screen.p, 0, 0);
screen.setBlue(screen.p, 0, 0);
screen.setTransp(screen.p, 0, 0);
break;
case Short.SIZE:
// rgba 5/11,6/5,5/0,0/0
screen.setRed(screen.p, 5, 11);
screen.setGreen(screen.p, 6, 5);
screen.setBlue(screen.p, 5, 0);
screen.setTransp(screen.p, 0, 0);
break;
case Integer.SIZE:
// rgba 8/16,8/8,8/0,8/24
screen.setRed(screen.p, 8, 16);
screen.setGreen(screen.p, 8, 8);
screen.setBlue(screen.p, 8, 0);
screen.setTransp(screen.p, 8, 24);
break;
default:
String msg = MessageFormat.format("Unsupported color depth: {0} bpp", settings.bitsPerPixel);
logger.severe(msg);
throw new IllegalArgumentException(msg);
}
screen.setActivate(screen.p, EPDSystem.FB_ACTIVATE_FORCE);
screen.setRotate(screen.p, settings.rotate);
setScreenInfo(screen);
/*
* Gets and logs the new settings of the frame buffer device.
*/
getScreenInfo(screen);
logScreenInfo(screen);
xres = screen.getXRes(screen.p);
yres = screen.getYRes(screen.p);
xresVirtual = screen.getXResVirtual(screen.p);
yresVirtual = screen.getYResVirtual(screen.p);
xoffset = screen.getOffsetX(screen.p);
yoffset = screen.getOffsetY(screen.p);
bitsPerPixel = screen.getBitsPerPixel(screen.p);
bytesPerPixel = bitsPerPixel >>> BITS_TO_BYTES;
byteOffset = (xoffset + yoffset * xresVirtual) * bytesPerPixel;
/*
* Allocates objects for reuse to avoid creating new direct byte buffers
* outside of the Java heap on each display update.
*/
updateData = new MxcfbUpdateData();
syncUpdate = createDefaultUpdate(xres, yres);
}
/**
* Gets the variable screen information of the frame buffer. Run the
* <i>fbset</i> command as <i>root</i> to print the screen information.
*
* @param screen the object representing the variable screen information
* @throws IOException if an error occurs getting the information
*/
private void getScreenInfo(FbVarScreenInfo screen) throws IOException {
int rc = system.ioctl(fd, LinuxSystem.FBIOGET_VSCREENINFO, screen.p);
if (rc != 0) {
system.close(fd);
throw new IOException(system.getErrorMessage());
}
}
/**
* Sets the variable screen information of the frame buffer.
* <p>
* "To ensure that the EPDC driver receives the initialization request, the
* {@code activate} field of the {@code fb_var_screeninfo} parameter should
* be set to {@code FB_ACTIVATE_FORCE}." [EPDC Panel Initialization,
* <cite>i.MX Linux Reference Manual</cite>]</p>
* <p>
* To request a change to 8-bit grayscale format, the bits per pixel must be
* set to 8 and the grayscale value must be set to one of the two valid
* grayscale format values: {@code GRAYSCALE_8BIT} or
* {@code GRAYSCALE_8BIT_INVERTED}. [Grayscale Framebuffer Selection,
* <cite>i.MX Linux Reference Manual</cite>]</p>
*
* @param screen the object representing the variable screen information
* @throws IOException if an error occurs setting the information
*/
private void setScreenInfo(FbVarScreenInfo screen) throws IOException {
int rc = system.ioctl(fd, LinuxSystem.FBIOPUT_VSCREENINFO, screen.p);
if (rc != 0) {
system.close(fd);
throw new IOException(system.getErrorMessage());
}
}
/**
* Logs the variable screen information of the frame buffer, depending on
* the logging level.
*
* @param screen the object representing the variable screen information
*/
private void logScreenInfo(FbVarScreenInfo screen) {
if (logger.isLoggable(Level.FINE)) {
logger.fine("Frame buffer geometry: {0} {1} {2} {3} {4}",
screen.getXRes(screen.p), screen.getYRes(screen.p),
screen.getXResVirtual(screen.p), screen.getYResVirtual(screen.p),
screen.getBitsPerPixel(screen.p));
logger.fine("Frame buffer rgba: {0}/{1},{2}/{3},{4}/{5},{6}/{7}",
screen.getRedLength(screen.p), screen.getRedOffset(screen.p),
screen.getGreenLength(screen.p), screen.getGreenOffset(screen.p),
screen.getBlueLength(screen.p), screen.getBlueOffset(screen.p),
screen.getTranspLength(screen.p), screen.getTranspOffset(screen.p));
logger.fine("Frame buffer grayscale: {0}", screen.getGrayscale(screen.p));
}
}
/**
* Creates the default update data with values from the EPD system
* properties, setting all fields except for the update marker. Reusing the
* update data object avoids creating a new one for each update request.
*
* @implNote An update mode of {@link EPDSystem#UPDATE_MODE_FULL} would make
* the {@link EPDSettings#NO_WAIT} system property useless by changing all
* non-colliding updates into colliding ones, so this method sets the
* default update mode to {@link EPDSystem#UPDATE_MODE_PARTIAL}.
*
* @param width the width of the update region
* @param height the height of the update region
* @return the default update data with all fields set but the update marker
*/
private MxcfbUpdateData createDefaultUpdate(int width, int height) {
var update = new MxcfbUpdateData();
update.setUpdateRegion(update.p, 0, 0, width, height);
update.setWaveformMode(update.p, settings.waveformMode);
update.setUpdateMode(update.p, EPDSystem.UPDATE_MODE_PARTIAL);
update.setTemp(update.p, EPDSystem.TEMP_USE_AMBIENT);
update.setFlags(update.p, settings.flags);
return update;
}
/**
* Defines a mapping for common waveform modes. This mapping must be
* configured for the automatic waveform mode selection to function
* properly. Each of the parameters should be set to one of the following:
* <ul>
* <li>{@link EPDSystem#WAVEFORM_MODE_INIT}</li>
* <li>{@link EPDSystem#WAVEFORM_MODE_DU}</li>
* <li>{@link EPDSystem#WAVEFORM_MODE_GC16}</li>
* <li>{@link EPDSystem#WAVEFORM_MODE_GC4}</li>
* <li>{@link EPDSystem#WAVEFORM_MODE_A2}</li>
* </ul>
*
* @implNote This method fails on the Kobo Glo HD Model N437 with the error
* ENOTTY (25), "Inappropriate ioctl for device." The driver on that device
* uses an extended structure with four additional integers, changing its
* size and its corresponding request code. This method could use the
* extended structure, but the driver on the Kobo Glo HD ignores it and
* returns immediately, anyway. Furthermore, newer devices support both the
* current structure and the extended one, but define the extra fields in a
* different order. Therefore, simply use the current structure and ignore
* an error of ENOTTY, picking up the default values for any extra fields.
*
* @param init the initialization mode for clearing the screen to all white
* @param du the direct update mode for changing any gray values to either
* all black or all white
* @param gc4 the mode for 4-level (2-bit) grayscale images and text
* @param gc8 the mode for 8-level (3-bit) grayscale images and text
* @param gc16 the mode for 16-level (4-bit) grayscale images and text
* @param gc32 the mode for 32-level (5-bit) grayscale images and text
*/
private void setWaveformModes(int init, int du, int gc4, int gc8, int gc16, int gc32) {
var modes = new MxcfbWaveformModes();
modes.setModes(modes.p, init, du, gc4, gc8, gc16, gc32);
int rc = system.ioctl(fd, driver.MXCFB_SET_WAVEFORM_MODES, modes.p);
if (rc != 0 && system.errno() != ENOTTY) {
logger.severe("Failed setting waveform modes: {0} ({1})",
system.getErrorMessage(), system.errno());
}
}
/**
* Sets the temperature to be used by the EPDC driver in subsequent panel
* updates. Note that this temperature setting may be overridden by setting
* the temperature in a specific update to anything other than
* {@link EPDSystem#TEMP_USE_AMBIENT}.
*
* @param temp the temperature in degrees Celsius
*/
private void setTemperature(int temp) {
int rc = driver.ioctl(fd, driver.MXCFB_SET_TEMPERATURE, temp);
if (rc != 0) {
logger.severe("Failed setting temperature to {2} degrees Celsius: {0} ({1})",
system.getErrorMessage(), system.errno(), temp);
}
}
/**
* Selects between automatic and region update mode. In region update mode,
* updates must be submitted with an IOCTL call to
* {@link EPDSystem#MXCFB_SEND_UPDATE}. In automatic mode, updates are
* generated by the driver when it detects that pages in a frame buffer
* memory region have been modified.
* <p>
* Automatic mode is available only when it has been enabled in the Linux
* kernel by the option CONFIG_FB_MXC_EINK_AUTO_UPDATE_MODE. You can find
* the configuration options used to build the kernel in a file under
* <i>/proc</i> or <i>/boot</i>, such as <i>/proc/config.gz</i>.</p>
*
* @param mode the automatic update mode, one of:
* <ul>
* <li>{@link EPDSystem#AUTO_UPDATE_MODE_REGION_MODE}</li>
* <li>{@link EPDSystem#AUTO_UPDATE_MODE_AUTOMATIC_MODE}</li>
* </ul>
*/
private void setAutoUpdateMode(int mode) {
int rc = driver.ioctl(fd, driver.MXCFB_SET_AUTO_UPDATE_MODE, mode);
if (rc != 0) {
logger.severe("Failed setting auto-update mode to {2}: {0} ({1})",
system.getErrorMessage(), system.errno(), mode);
}
}
/**
* Requests the entire visible region of the frame buffer to be updated to
* the display.
*
* @param updateMode the update mode, one of:
* <ul>
* <li>{@link EPDSystem#UPDATE_MODE_PARTIAL}</li>
* <li>{@link EPDSystem#UPDATE_MODE_FULL}</li>
* </ul>
* @param waveformMode the waveform mode, one of:
* <ul>
* <li>{@link EPDSystem#WAVEFORM_MODE_INIT}</li>
* <li>{@link EPDSystem#WAVEFORM_MODE_DU}</li>
* <li>{@link EPDSystem#WAVEFORM_MODE_GC16}</li>
* <li>{@link EPDSystem#WAVEFORM_MODE_GC4}</li>
* <li>{@link EPDSystem#WAVEFORM_MODE_A2}</li>
* <li>{@link EPDSystem#WAVEFORM_MODE_AUTO}</li>
* </ul>
* @param flags a bit mask composed of the following flag values:
* <ul>
* <li>{@link EPDSystem#EPDC_FLAG_ENABLE_INVERSION}</li>
* <li>{@link EPDSystem#EPDC_FLAG_FORCE_MONOCHROME}</li>
* <li>{@link EPDSystem#EPDC_FLAG_USE_DITHERING_Y1}</li>
* <li>{@link EPDSystem#EPDC_FLAG_USE_DITHERING_Y4}</li>
* </ul>
* @return the marker to identify this update in a subsequence call to
* {@link #waitForUpdateComplete}
*/
private int sendUpdate(int updateMode, int waveformMode, int flags) {
updateData.setUpdateRegion(updateData.p, 0, 0, xres, yres);
updateData.setUpdateMode(updateData.p, updateMode);
updateData.setTemp(updateData.p, EPDSystem.TEMP_USE_AMBIENT);
updateData.setFlags(updateData.p, flags);
return sendUpdate(updateData, waveformMode);
}
/**
* Requests an update to the display, allowing for the reuse of the update
* data object. The waveform mode is reset because the update data could
* have been used in a previous update. In that case, the waveform mode may
* have been modified by the EPDC driver with the actual mode selected. The
* update marker is overwritten with the next sequential marker.
*
* @param update the data describing the update; the waveform mode and
* update marker are overwritten
* @param waveformMode the waveform mode for this update
* @return the marker to identify this update in a subsequence call to
* {@link #waitForUpdateComplete}
*/
private int sendUpdate(MxcfbUpdateData update, int waveformMode) {
/*
* The IOCTL call to MXCFB_WAIT_FOR_UPDATE_COMPLETE returns the error
* "Invalid argument (22)" when passed an update marker of zero.
*/
updateMarker++;
if (updateMarker == 0) {
updateMarker++;
}
update.setWaveformMode(update.p, waveformMode);
update.setUpdateMarker(update.p, updateMarker);
int rc = system.ioctl(fd, driver.MXCFB_SEND_UPDATE, update.p);
if (rc != 0) {
logger.severe("Failed sending update {2}: {0} ({1})",
system.getErrorMessage(), system.errno(), Integer.toUnsignedLong(updateMarker));
} else if (logger.isLoggable(Level.FINER)) {
logger.finer("Sent update: {0} x {1}, waveform {2}, selected {3}, flags 0x{4}, marker {5}",
update.getUpdateRegionWidth(update.p), update.getUpdateRegionHeight(update.p),
waveformMode, update.getWaveformMode(update.p),
Integer.toHexString(update.getFlags(update.p)).toUpperCase(),
Integer.toUnsignedLong(updateMarker));
}
return updateMarker;
}
/**
* Blocks and waits for a previous update request to complete.
*
* @param marker the marker to identify a particular update, returned by
* {@link #sendUpdate(MxcfbUpdateData, int)}
*/
private void waitForUpdateComplete(int marker) {
/*
* This IOCTL call returns: 0 if the marker was not found because the
* update already completed or failed, negative (-1) with the error
* "Connection timed out (110)" if the wait timed out after 5 seconds,
* or positive if the wait occurred and completed (see
* "wait_for_completion_timeout" in "kernel/sched/completion.c").
*/
int rc = driver.ioctl(fd, driver.MXCFB_WAIT_FOR_UPDATE_COMPLETE, marker);
if (rc < 0) {
logger.severe("Failed waiting for update {2}: {0} ({1})",
system.getErrorMessage(), system.errno(), Integer.toUnsignedLong(marker));
} else if (rc == 0 && logger.isLoggable(Level.FINER)) {
logger.finer("Update completed before wait: marker {0}",
Integer.toUnsignedLong(marker));
}
}
/**
* Sets the delay between the completion of all updates in the driver and
* when the driver should power down the EPDC and display power supplies. To
* disable powering down entirely, use the delay value
* {@link EPDSystem#FB_POWERDOWN_DISABLE}.
*
* @param delay the delay in milliseconds
*/
private void setPowerdownDelay(int delay) {
int rc = driver.ioctl(fd, driver.MXCFB_SET_PWRDOWN_DELAY, delay);
if (rc != 0) {
logger.severe("Failed setting power-down delay to {2}: {0} ({1})",
system.getErrorMessage(), system.errno(), delay);
}
}
/**
* Gets the current power-down delay from the EPDC driver.
*
* @return the delay in milliseconds
*/
private int getPowerdownDelay() {
var integer = new IntStructure();
int rc = system.ioctl(fd, driver.MXCFB_GET_PWRDOWN_DELAY, integer.p);
if (rc != 0) {
logger.severe("Failed getting power-down delay: {0} ({1})",
system.getErrorMessage(), system.errno());
}
return integer.get(integer.p);
}
/**
* Selects a scheme for the flow of updates within the driver.
*
* @param scheme the update scheme, one of:
* <ul>
* <li>{@link EPDSystem#UPDATE_SCHEME_SNAPSHOT}</li>
* <li>{@link EPDSystem#UPDATE_SCHEME_QUEUE}</li>
* <li>{@link EPDSystem#UPDATE_SCHEME_QUEUE_AND_MERGE}</li>
* </ul>
*/
private void setUpdateScheme(int scheme) {
int rc = driver.ioctl(fd, driver.MXCFB_SET_UPDATE_SCHEME, scheme);
if (rc != 0) {
logger.severe("Failed setting update scheme to {2}: {0} ({1})",
system.getErrorMessage(), system.errno(), scheme);
}
}
/**
* Initializes the EPDC frame buffer device, setting the update scheme to
* {@link EPDSystem#UPDATE_SCHEME_SNAPSHOT}.
*/
void init() {
setWaveformModes(EPDSystem.WAVEFORM_MODE_INIT, EPDSystem.WAVEFORM_MODE_DU,
EPDSystem.WAVEFORM_MODE_GC4, EPDSystem.WAVEFORM_MODE_GC16,
EPDSystem.WAVEFORM_MODE_GC16, EPDSystem.WAVEFORM_MODE_GC16);
setTemperature(EPDSystem.TEMP_USE_AMBIENT);
setAutoUpdateMode(EPDSystem.AUTO_UPDATE_MODE_REGION_MODE);
setPowerdownDelay(POWERDOWN_DELAY);
setUpdateScheme(EPDSystem.UPDATE_SCHEME_SNAPSHOT);
}
/**
* Clears the display panel. The visible frame buffer should be cleared with
* zeros when called. This method sends two direct updates (all black
* followed by all white) to refresh the screen and clear any ghosting
* effects, and returns when both updates are complete.
* <p>
* <strong>This method is not thread safe</strong>, but it is invoked only
* once from the Event Thread during initialization.</p>
*/
void clear() {
lastMarker = sendUpdate(EPDSystem.UPDATE_MODE_FULL,
EPDSystem.WAVEFORM_MODE_DU, 0);
lastMarker = sendUpdate(EPDSystem.UPDATE_MODE_FULL,
EPDSystem.WAVEFORM_MODE_DU, EPDSystem.EPDC_FLAG_ENABLE_INVERSION);
waitForUpdateComplete(lastMarker);
}
/**
* Sends the updated contents of the Linux frame buffer to the EPDC driver,
* optionally synchronizing with the driver by first waiting for the
* previous update to complete.
* <p>
* <strong>This method is not thread safe</strong>, but it is invoked only
* from the JavaFX Application Thread.</p>
*/
void sync() {
if (!settings.noWait) {
waitForUpdateComplete(lastMarker);
}
lastMarker = sendUpdate(syncUpdate, settings.waveformMode);
}
/**
* Gets the number of bytes from the beginning of the frame buffer to the
* start of its visible resolution.
*
* @return the offset in bytes
*/
int getByteOffset() {
return byteOffset;
}
/**
* Creates an off-screen byte buffer equal in resolution to the virtual
* resolution of the frame buffer, but with 32 bits per pixel.
*
* @return a 32-bit pixel buffer matching the resolution of the frame buffer
*/
ByteBuffer getOffscreenBuffer() {
/*
* In this case, a direct byte buffer outside of the normal heap is
* faster than a non-direct byte buffer on the heap. The frame rate is
* roughly 10 to 40 percent faster for a framebuffer with 8 bits per
* pixel and 40 to 60 percent faster for a framebuffer with 16 bits per
* pixel, depending on the device processor and screen size.
*/
int size = xresVirtual * yres * Integer.BYTES;
return ByteBuffer.allocateDirect(size);
}
/**
* Creates a new mapping of the Linux frame buffer device into memory.
*
* @implNote The virtual y-resolution reported by the device driver can be
* wrong, as shown by the following example on the Kobo Glo HD Model N437
* which reports 2,304 pixels when the correct value is 1,152 pixels
* (6,782,976 / 5,888). Therefore, this method cannot use the frame buffer
* virtual resolution to calculate its size.
*
* <pre>{@code
* $ sudo fbset -i
*
* mode "1448x1072-46"
* # D: 80.000 MHz, H: 50.188 kHz, V: 46.385 Hz
* geometry 1448 1072 1472 2304 32
* timings 12500 16 102 4 4 28 2
* rgba 8/16,8/8,8/0,8/24
* endmode
*
* Frame buffer device information:
* Name : mxc_epdc_fb
* Address : 0x88000000
* Size : 6782976
* Type : PACKED PIXELS
* Visual : TRUECOLOR
* XPanStep : 1
* YPanStep : 1
* YWrapStep : 0
* LineLength : 5888
* Accelerator : No
* }</pre>
*
* @return a byte buffer containing the mapping of the Linux frame buffer
* device if successful; otherwise {@code null}
*/
ByteBuffer getMappedBuffer() {
ByteBuffer buffer = null;
int size = xresVirtual * yres * bytesPerPixel;
logger.fine("Mapping frame buffer: {0} bytes", size);
long addr = system.mmap(0l, size, LinuxSystem.PROT_WRITE, LinuxSystem.MAP_SHARED, fd, 0);
if (addr == LinuxSystem.MAP_FAILED) {
logger.severe("Failed mapping {2} bytes of frame buffer: {0} ({1})",
system.getErrorMessage(), system.errno(), size);
} else {
buffer = C.getC().NewDirectByteBuffer(addr, size);
}
return buffer;
}
/**
* Deletes the mapping of the Linux frame buffer device.
*
* @param buffer the byte buffer containing the mapping of the Linux frame
* buffer device
*/
void releaseMappedBuffer(ByteBuffer buffer) {
int size = buffer.capacity();
logger.fine("Unmapping frame buffer: {0} bytes", size);
int rc = system.munmap(C.getC().GetDirectBufferAddress(buffer), size);
if (rc != 0) {
logger.severe("Failed unmapping {2} bytes of frame buffer: {0} ({1})",
system.getErrorMessage(), system.errno(), size);
}
}
/**
* Closes the Linux frame buffer device.
*/
void close() {
system.close(fd);
}
/**
* Gets the native handle to the Linux frame buffer device.
*
* @return the frame buffer device file descriptor
*/
long getNativeHandle() {
return fd;
}
/**
* Gets the frame buffer width in pixels. See the notes for the
* {@linkplain EPDFrameBuffer#EPDFrameBuffer constructor} above.
*
* @implNote When using an 8-bit, unrotated, and uninverted frame buffer in
* the Y8 pixel format, the Kobo Clara HD Model N249 works only when this
* method returns the visible x-resolution ({@code xres}) instead of the
* normal virtual x-resolution ({@code xresVirtual}).
*
* @return the width in pixels
*/
int getWidth() {
return settings.getWidthVisible ? xres : xresVirtual;
}
/**
* Gets the frame buffer height in pixels.
*
* @return the height in pixels
*/
int getHeight() {
return yres;
}
/**
* Gets the frame buffer color depth in bits per pixel.
*
* @return the color depth in bits per pixel
*/
int getBitDepth() {
return bitsPerPixel;
}
@Override
public String toString() {
return MessageFormat.format("{0}[width={1} height={2} bitDepth={3}]",
getClass().getName(), getWidth(), getHeight(), getBitDepth());
}
}
|
92334d6aefec4b79e5192d41a8016c5212ba2b94 | 3,328 | java | Java | src/main/java/api/equinix/javasdk/core/http/response/PaginatedList.java | iantjones/equinix-java-sdk | e74e88741db4b53de85828f9845c9e2aab1d51c5 | [
"Apache-2.0"
] | null | null | null | src/main/java/api/equinix/javasdk/core/http/response/PaginatedList.java | iantjones/equinix-java-sdk | e74e88741db4b53de85828f9845c9e2aab1d51c5 | [
"Apache-2.0"
] | null | null | null | src/main/java/api/equinix/javasdk/core/http/response/PaginatedList.java | iantjones/equinix-java-sdk | e74e88741db4b53de85828f9845c9e2aab1d51c5 | [
"Apache-2.0"
] | null | null | null | 31.396226 | 119 | 0.682392 | 996,520 | /*
* Copyright 2021 Ian Jones. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
* file except in compliance with the License.
*
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
package api.equinix.javasdk.core.http.response;
import api.equinix.javasdk.core.http.request.EquinixRequest;
import api.equinix.javasdk.core.http.request.PaginatedRequest;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import java.util.ArrayList;
/**
* <p>PaginatedList class.</p>
*
* @author ianjones
* @version $Id: $Id
*/
@Getter
@Setter
@NoArgsConstructor
public class PaginatedList<T> extends ArrayList<T> {
private Pageable<T> pageableClient;
private EquinixRequest<T> equinixRequest;
private EquinixResponse<T> equinixResponse;
private Pagination pagination;
/**
* <p>Constructor for PaginatedList.</p>
*
* @param initialItems a {@link api.equinix.javasdk.core.http.response.PaginatedList} object.
* @param pageableClient a {@link api.equinix.javasdk.core.http.response.Pageable} object.
* @param equinixRequest a {@link api.equinix.javasdk.core.http.request.EquinixRequest} object.
* @param equinixResponse a {@link api.equinix.javasdk.core.http.response.EquinixResponse} object.
* @param pagination a {@link api.equinix.javasdk.core.http.response.Pagination} object.
*/
public PaginatedList(PaginatedList<T> initialItems, Pageable<T> pageableClient,
EquinixRequest<T> equinixRequest, EquinixResponse<T> equinixResponse, Pagination pagination) {
this.addAll(initialItems);
this.pageableClient = pageableClient;
this.equinixRequest = equinixRequest;
this.equinixResponse = equinixResponse;
this.pagination = pagination;
}
private PaginatedList<T> fetchNextPage() {
((PaginatedRequest<T>)equinixRequest).nextPage();
return this.pageableClient.nextPage((PaginatedRequest<T>)equinixRequest);
}
private void loadNextPage() {
PaginatedList<T> primaryObjectList = fetchNextPage();
this.addAll(primaryObjectList);
this.equinixRequest = primaryObjectList.getEquinixRequest();
this.equinixResponse = primaryObjectList.getEquinixResponse();
this.pagination = primaryObjectList.getPagination();
}
/**
* <p>hasNextPage.</p>
*
* @return a boolean.
*/
public boolean hasNextPage() {
return !this.pagination.getIsLastPage();
}
/**
* <p>next.</p>
*/
public void next() {
if (hasNextPage()) {
loadNextPage();
}
}
/**
* <p>loadAll.</p>
*
* @return a {@link api.equinix.javasdk.core.http.response.PaginatedList} object.
*/
public PaginatedList<T> loadAll() {
while (hasNextPage()) {
loadNextPage();
}
return this;
}
}
|
92334fdf68dcc811855dc30287e79699de649cc2 | 3,394 | java | Java | suggestions/src/androidTest/java/in/arunkumarsampath/suggestions/RxSuggestionsTest.java | jyotid/rxSuggestions | da4c108bc82c587cd660234cff5bf764dde38229 | [
"Apache-2.0"
] | null | null | null | suggestions/src/androidTest/java/in/arunkumarsampath/suggestions/RxSuggestionsTest.java | jyotid/rxSuggestions | da4c108bc82c587cd660234cff5bf764dde38229 | [
"Apache-2.0"
] | null | null | null | suggestions/src/androidTest/java/in/arunkumarsampath/suggestions/RxSuggestionsTest.java | jyotid/rxSuggestions | da4c108bc82c587cd660234cff5bf764dde38229 | [
"Apache-2.0"
] | null | null | null | 34.282828 | 97 | 0.680613 | 996,521 | /*
* Copyright 2018 Arunkumar
*
* 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 in.arunkumarsampath.suggestions;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import java.net.UnknownHostException;
import java.util.List;
import rx.observers.TestSubscriber;
import static org.junit.Assert.assertTrue;
@RunWith(AndroidJUnit4.class)
public class RxSuggestionsTest {
public RxSuggestionsTest() {
}
@Test
public void fetchSuggestionsCountTest() {
final TestSubscriber<List<String>> testSubscriber = TestSubscriber.create();
int maxSuggestions = 1;
RxSuggestions.fetch("a", maxSuggestions).subscribe(testSubscriber);
final List<List<String>> nextEvents = testSubscriber.getOnNextEvents();
if (Util.isOnline()) {
testSubscriber.assertValueCount(1);
testSubscriber.assertCompleted();
testSubscriber.assertNoErrors();
assertTrue(!nextEvents.isEmpty() && nextEvents.size() == 1);
assertTrue(nextEvents.get(0).size() == maxSuggestions);
} else {
testSubscriber.assertNoValues();
assertTrue(testSubscriber.getOnErrorEvents().get(0) instanceof UnknownHostException);
}
}
@Test
public void fetchSuggestionsNoErrorTest() {
final TestSubscriber<List<String>> testSubscriber = TestSubscriber.create();
RxSuggestions.fetch("Something").subscribe(testSubscriber);
if (Util.isOnline()) {
testSubscriber.assertNoErrors();
testSubscriber.assertValueCount(1);
} else {
assertNoValuesAndOneError(testSubscriber);
}
}
public void fetchSuggestionValueReceivedTest() {
final TestSubscriber<List<String>> testSubscriber = TestSubscriber.create();
RxSuggestions.fetch("a").subscribe(testSubscriber);
if (Util.isOnline()) {
testSubscriber.assertCompleted();
testSubscriber.assertNoErrors();
final List<List<String>> nextEvents = testSubscriber.getOnNextEvents();
for (String suggestion : nextEvents.get(0)) {
assertTrue(!suggestion.isEmpty());
}
} else {
assertNoValuesAndOneError(testSubscriber);
}
}
@Test
public void fetchSuggestionsForEmptyString() {
String searchTerm = " ";
final TestSubscriber<List<String>> testSubscriber = TestSubscriber.create();
RxSuggestions.fetch(searchTerm).subscribe(testSubscriber);
testSubscriber.assertNoErrors();
testSubscriber.assertNoValues();
}
private void assertNoValuesAndOneError(TestSubscriber<List<String>> testSubscriber) {
testSubscriber.assertNoValues();
assertTrue(!testSubscriber.getOnErrorEvents().isEmpty());
}
}
|
9233509ab34e244b67b6c459fbc918224a61367c | 1,076 | java | Java | core/src/test/java/com/sequenceiq/cloudbreak/converter/AzureCredentialToJsonConverterTest.java | doktoric/test123 | dcd095962a55a2b0f4bab747de0586ddf48a6670 | [
"Apache-2.0"
] | null | null | null | core/src/test/java/com/sequenceiq/cloudbreak/converter/AzureCredentialToJsonConverterTest.java | doktoric/test123 | dcd095962a55a2b0f4bab747de0586ddf48a6670 | [
"Apache-2.0"
] | null | null | null | core/src/test/java/com/sequenceiq/cloudbreak/converter/AzureCredentialToJsonConverterTest.java | doktoric/test123 | dcd095962a55a2b0f4bab747de0586ddf48a6670 | [
"Apache-2.0"
] | null | null | null | 29.888889 | 124 | 0.755576 | 996,522 | package com.sequenceiq.cloudbreak.converter;
import static org.junit.Assert.assertEquals;
import org.junit.Before;
import org.junit.Test;
import com.sequenceiq.cloudbreak.TestUtil;
import com.sequenceiq.cloudbreak.controller.json.CredentialResponse;
import com.sequenceiq.cloudbreak.controller.validation.RequiredAzureCredentialParam;
import com.sequenceiq.cloudbreak.domain.AzureCredential;
public class AzureCredentialToJsonConverterTest extends AbstractEntityConverterTest<AzureCredential> {
private AzureCredentialToJsonConverter underTest;
@Before
public void setUp() {
underTest = new AzureCredentialToJsonConverter();
}
@Test
public void testConvert() {
// GIVEN
// WHEN
CredentialResponse result = underTest.convert(getSource());
// THEN
assertEquals("subscription-id", result.getParameters().get(RequiredAzureCredentialParam.SUBSCRIPTION_ID.getName()));
}
@Override
public AzureCredential createSource() {
return (AzureCredential) TestUtil.azureCredential();
}
}
|
9233510ba99680b2e6a291405dcfc46b187fe44e | 331 | java | Java | Implementation/Task 3/src/suffixtree/exceptions/NoEdgeOutException.java | migueldingli1997/CPS2004-Object-Oriented-Programming-Assignment | 8dfc9a43e073b5ad55f1021717657dc87b8bbdbb | [
"MIT"
] | 1 | 2022-01-19T09:41:56.000Z | 2022-01-19T09:41:56.000Z | Implementation/Task 3/src/suffixtree/exceptions/NoEdgeOutException.java | migueldingli1997/CPS2004-Object-Oriented-Programming-Assignment | 8dfc9a43e073b5ad55f1021717657dc87b8bbdbb | [
"MIT"
] | null | null | null | Implementation/Task 3/src/suffixtree/exceptions/NoEdgeOutException.java | migueldingli1997/CPS2004-Object-Oriented-Programming-Assignment | 8dfc9a43e073b5ad55f1021717657dc87b8bbdbb | [
"MIT"
] | null | null | null | 25.461538 | 71 | 0.734139 | 996,523 | package suffixtree.exceptions;
/**
* Thrown in cases where a node does not have a particular outward edge
* but an attempt is made to obtain an edge with the edge's label.
*/
public final class NoEdgeOutException extends RuntimeException {
public NoEdgeOutException(final String message) {
super(message);
}
}
|
923351a816104c03e93e48171f80cd47608d38c1 | 3,890 | java | Java | aws-java-sdk-elasticloadbalancing/src/main/java/com/amazonaws/services/elasticloadbalancing/model/DescribeLoadBalancerAttributesRequest.java | pgoranss/aws-sdk-java | 041ffc4197309c98c4be534b43ca2bda146e4f7c | [
"Apache-2.0"
] | 1 | 2019-04-21T21:56:44.000Z | 2019-04-21T21:56:44.000Z | aws-java-sdk-elasticloadbalancing/src/main/java/com/amazonaws/services/elasticloadbalancing/model/DescribeLoadBalancerAttributesRequest.java | pgoranss/aws-sdk-java | 041ffc4197309c98c4be534b43ca2bda146e4f7c | [
"Apache-2.0"
] | 110 | 2019-11-11T19:37:58.000Z | 2021-07-16T18:23:58.000Z | aws-java-sdk-elasticloadbalancing/src/main/java/com/amazonaws/services/elasticloadbalancing/model/DescribeLoadBalancerAttributesRequest.java | pgoranss/aws-sdk-java | 041ffc4197309c98c4be534b43ca2bda146e4f7c | [
"Apache-2.0"
] | 1 | 2019-07-22T16:24:05.000Z | 2019-07-22T16:24:05.000Z | 30.390625 | 133 | 0.652185 | 996,524 | /*
* Copyright 2014-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.amazonaws.services.elasticloadbalancing.model;
import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.AmazonWebServiceRequest;
/**
* <p>
* Contains the parameters for DescribeLoadBalancerAttributes.
* </p>
*
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancing-2012-06-01/DescribeLoadBalancerAttributes"
* target="_top">AWS API Documentation</a>
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class DescribeLoadBalancerAttributesRequest extends com.amazonaws.AmazonWebServiceRequest implements Serializable, Cloneable {
/**
* <p>
* The name of the load balancer.
* </p>
*/
private String loadBalancerName;
/**
* <p>
* The name of the load balancer.
* </p>
*
* @param loadBalancerName
* The name of the load balancer.
*/
public void setLoadBalancerName(String loadBalancerName) {
this.loadBalancerName = loadBalancerName;
}
/**
* <p>
* The name of the load balancer.
* </p>
*
* @return The name of the load balancer.
*/
public String getLoadBalancerName() {
return this.loadBalancerName;
}
/**
* <p>
* The name of the load balancer.
* </p>
*
* @param loadBalancerName
* The name of the load balancer.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public DescribeLoadBalancerAttributesRequest withLoadBalancerName(String loadBalancerName) {
setLoadBalancerName(loadBalancerName);
return this;
}
/**
* Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
* redacted from this string using a placeholder value.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getLoadBalancerName() != null)
sb.append("LoadBalancerName: ").append(getLoadBalancerName());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof DescribeLoadBalancerAttributesRequest == false)
return false;
DescribeLoadBalancerAttributesRequest other = (DescribeLoadBalancerAttributesRequest) obj;
if (other.getLoadBalancerName() == null ^ this.getLoadBalancerName() == null)
return false;
if (other.getLoadBalancerName() != null && other.getLoadBalancerName().equals(this.getLoadBalancerName()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getLoadBalancerName() == null) ? 0 : getLoadBalancerName().hashCode());
return hashCode;
}
@Override
public DescribeLoadBalancerAttributesRequest clone() {
return (DescribeLoadBalancerAttributesRequest) super.clone();
}
}
|
923351f14aa67c90e75109b4f8883a39b6c0493b | 137 | java | Java | src/org.codefx.demo.cyclic.triple.three/module-info.java | CodeFX-org/lab-jigsaw-cyclic-dependencies | 70e2ddf523959742b7455f332e0c19daaaecd659 | [
"CC0-1.0"
] | null | null | null | src/org.codefx.demo.cyclic.triple.three/module-info.java | CodeFX-org/lab-jigsaw-cyclic-dependencies | 70e2ddf523959742b7455f332e0c19daaaecd659 | [
"CC0-1.0"
] | null | null | null | src/org.codefx.demo.cyclic.triple.three/module-info.java | CodeFX-org/lab-jigsaw-cyclic-dependencies | 70e2ddf523959742b7455f332e0c19daaaecd659 | [
"CC0-1.0"
] | null | null | null | 34.25 | 45 | 0.79562 | 996,525 | module org.codefx.demo.cyclic.triple.three {
requires org.codefx.demo.cyclic.triple.two;
exports org.codefx.demo.cyclic.triple.three;
} |
9233523b905339813077f2622ea2c68cceaa3070 | 1,088 | java | Java | java/core/libjoynr/src/test/java/io/joynr/integration/util/DummyJoynrApplicationModule.java | emundo/joynr | 7f98e541da2ef4bbe12ba3cfcf36da7ed361e86a | [
"Apache-2.0"
] | 151 | 2015-02-12T16:08:35.000Z | 2022-03-10T06:58:22.000Z | java/core/libjoynr/src/test/java/io/joynr/integration/util/DummyJoynrApplicationModule.java | emundo/joynr | 7f98e541da2ef4bbe12ba3cfcf36da7ed361e86a | [
"Apache-2.0"
] | 78 | 2015-09-28T05:53:22.000Z | 2022-03-18T14:40:30.000Z | java/core/libjoynr/src/test/java/io/joynr/integration/util/DummyJoynrApplicationModule.java | bmwcarit/joynr | d0a1399314489b840eda11d0c5e6023be1b97102 | [
"Apache-2.0"
] | 60 | 2015-06-19T14:07:45.000Z | 2022-03-13T07:58:39.000Z | 29.405405 | 79 | 0.72886 | 996,526 | /*
* #%L
* JOYn::java::core::libjoyn
* %%
* Copyright (C) 2011 - 2017 BMW Car IT GmbH
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
package io.joynr.integration.util;
import java.util.Properties;
import io.joynr.runtime.JoynrApplicationModule;
public class DummyJoynrApplicationModule extends JoynrApplicationModule {
public DummyJoynrApplicationModule() {
this(new Properties());
}
public DummyJoynrApplicationModule(Properties properties) {
super("dummyjoynapplication", DummyJoynrApplication.class, properties);
}
}
|
9233528c18d8fa80a9fd194658a5cc90d72cf72f | 1,025 | java | Java | src/main/java/com/pump/image/gif/block/GifLocalColorTable.java | uwx/pumpernickel | 89aa594d4fbb3f44af6aa91a49fa7272b75905d1 | [
"MIT"
] | 45 | 2017-01-13T03:08:04.000Z | 2022-03-30T07:17:58.000Z | src/main/java/com/pump/image/gif/block/GifLocalColorTable.java | uwx/pumpernickel | 89aa594d4fbb3f44af6aa91a49fa7272b75905d1 | [
"MIT"
] | 72 | 2016-12-31T23:24:41.000Z | 2022-03-25T09:13:23.000Z | src/main/java/com/pump/image/gif/block/GifLocalColorTable.java | uwx/pumpernickel | 89aa594d4fbb3f44af6aa91a49fa7272b75905d1 | [
"MIT"
] | 14 | 2017-04-04T04:20:08.000Z | 2022-03-20T22:53:39.000Z | 31.060606 | 80 | 0.748293 | 996,527 | /**
* This software is released as part of the Pumpernickel project.
*
* All com.pump resources in the Pumpernickel project are distributed under the
* MIT License:
* https://raw.githubusercontent.com/mickleness/pumpernickel/master/License.txt
*
* More information about the Pumpernickel project is available here:
* https://mickleness.github.io/pumpernickel/
*/
package com.pump.image.gif.block;
import java.awt.image.IndexColorModel;
/**
* This immediately follows a
* {@link com.pump.image.gif.block.GifImageDescriptor} block if its
* <code>hasLocalColorTable()</code> method returns <code>true</code>. The GIF
* file format specification points out:
* <P>
* "...at most one Local Color Table may be present per Image Descriptor and its
* scope is the single image associated with the Image Descriptor that precedes
* it.
*/
public class GifLocalColorTable extends GifColorTable {
public GifLocalColorTable(byte[] b) {
super(b);
}
public GifLocalColorTable(IndexColorModel i) {
super(i);
}
} |
92335345f8c8d1cc555533f4daa0bdd7e89f75a3 | 1,147 | java | Java | src/main/java/io/r2dbc/proxy/core/Binding.java | spring-operator/r2dbc-proxy | 3bd937b286183c777fc9baf81e9f2dc2809989d8 | [
"Apache-2.0"
] | null | null | null | src/main/java/io/r2dbc/proxy/core/Binding.java | spring-operator/r2dbc-proxy | 3bd937b286183c777fc9baf81e9f2dc2809989d8 | [
"Apache-2.0"
] | null | null | null | src/main/java/io/r2dbc/proxy/core/Binding.java | spring-operator/r2dbc-proxy | 3bd937b286183c777fc9baf81e9f2dc2809989d8 | [
"Apache-2.0"
] | null | null | null | 26.674419 | 109 | 0.687881 | 996,528 | /*
* Copyright 2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* 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.r2dbc.proxy.core;
/**
* Represent an operation of {@link io.r2dbc.spi.Statement#bind} and {@link io.r2dbc.spi.Statement#bindNull}.
*
* @author Tadaya Tsuyukubo
* @see Bindings.IndexBinding
* @see Bindings.IdentifierBinding
*/
public interface Binding {
/**
* Get a key which represents index or identifier.
*
* @return an index or identifier
*/
Object getKey();
/**
* Get a {@link BoundValue}.
*
* @return a bound value
*/
BoundValue getBoundValue();
}
|
923353d51bedf574377ccdcf188f1c5338592824 | 3,452 | java | Java | frontend/mobile/web/src/com/google/mobile/trippy/web/client/view/DayPopUpView.java | rajesh1702/gulliver | 072a8b9b8dc8ef63bbd5dc4de1254e0eb7cb368f | [
"Apache-2.0"
] | null | null | null | frontend/mobile/web/src/com/google/mobile/trippy/web/client/view/DayPopUpView.java | rajesh1702/gulliver | 072a8b9b8dc8ef63bbd5dc4de1254e0eb7cb368f | [
"Apache-2.0"
] | null | null | null | frontend/mobile/web/src/com/google/mobile/trippy/web/client/view/DayPopUpView.java | rajesh1702/gulliver | 072a8b9b8dc8ef63bbd5dc4de1254e0eb7cb368f | [
"Apache-2.0"
] | null | null | null | 28.766667 | 81 | 0.709154 | 996,529 | /*
* Copyright 2010 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.mobile.trippy.web.client.view;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.HasClickHandlers;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.uibinder.client.UiTemplate;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.DecoratedPopupPanel;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.FocusPanel;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.Widget;
import com.google.mobile.trippy.web.client.i18n.Message;
import com.google.mobile.trippy.web.client.presenter.DayPopupPresenter;
import java.util.ArrayList;
/**
* This Class is responsible to create and show the popup to select the day.
*
*
*/
public class DayPopUpView extends Composite implements DayPopupPresenter.Display{
/** UI Binder. */
@UiTemplate("DayPopUpView.ui.xml")
interface Binder extends UiBinder<Widget, DayPopUpView> {
}
@UiField DecoratedPopupPanel dayPopUp;
@UiField FocusPanel cancel;
@UiField FlowPanel content;
@UiField Label selectDaysLabel;
private static Binder uiBinder = GWT.create(Binder.class);
private final DayPopUpStyle dayStyle = new DayPopUpStyle();
private ArrayList<HasClickHandlers> dayHandlers;
public DayPopUpView() {
initWidget(uiBinder.createAndBindUi(this));
dayPopUp.setStyleName(dayStyle.style.base());
dayPopUp.setGlassEnabled(true);
dayPopUp.setModal(true);
}
/**
* Sets the content of Pop up Panel.
*
*/
@Override
public void createPopUp(final int daysCount) {
if (dayHandlers == null) {
dayHandlers = new ArrayList<HasClickHandlers>();
} else {
dayHandlers.clear();
}
content.clear();
final FlowPanel daysMenu = new FlowPanel();
selectDaysLabel.addStyleName(dayStyle.style.titleBaseOriginal());
for (int i = 0; i <= daysCount; i++) {
Label dayLabel = new Label("Day " + i);
dayLabel.setStyleName(dayStyle.style.dayLabel());
if (i == 0) {
final Message messages = GWT.create(Message.class);
dayLabel.setText(messages.unscheduled());
}
daysMenu.add(dayLabel);
dayHandlers.add(dayLabel);
}
content.add(daysMenu);
dayPopUp.hide();
}
@Override
public ArrayList<HasClickHandlers> getDayHandlers() {
if (dayHandlers == null) {
dayHandlers = new ArrayList<HasClickHandlers>();
}
return dayHandlers;
}
@Override
public HasClickHandlers getCancel() {
return cancel;
}
@Override
public void setPopupVisible(boolean visible) {
if (visible) {
dayPopUp.center();
dayPopUp.show();
} else {
dayPopUp.hide();
}
}
@Override
public Widget asWidget() {
return this;
}
}
|
9233545e1fccfa868b0e68b38d188762ef56f7ab | 9,226 | java | Java | src/org/sosy_lab/cpachecker/cpa/smg/refiner/SMGFeasibilityChecker.java | 45258E9F/IntPTI | e5dda55aafa2da3d977a9a62ad0857746dae3fe1 | [
"Apache-2.0"
] | 2 | 2017-08-28T09:14:11.000Z | 2020-12-04T06:00:23.000Z | src/org/sosy_lab/cpachecker/cpa/smg/refiner/SMGFeasibilityChecker.java | 45258E9F/IntPTI | e5dda55aafa2da3d977a9a62ad0857746dae3fe1 | [
"Apache-2.0"
] | null | null | null | src/org/sosy_lab/cpachecker/cpa/smg/refiner/SMGFeasibilityChecker.java | 45258E9F/IntPTI | e5dda55aafa2da3d977a9a62ad0857746dae3fe1 | [
"Apache-2.0"
] | 6 | 2017-08-03T13:06:55.000Z | 2020-12-04T06:00:26.000Z | 33.671533 | 100 | 0.732495 | 996,530 | /*
* IntPTI: integer error fixing by proper-type inference
* Copyright (c) 2017.
*
* Open-source component:
*
* CPAchecker
* Copyright (C) 2007-2014 Dirk Beyer
*
* Guava: Google Core Libraries for Java
* Copyright (C) 2010-2006 Google
*
*
*/
package org.sosy_lab.cpachecker.cpa.smg.refiner;
import com.google.common.base.Optional;
import com.google.common.collect.Lists;
import org.sosy_lab.common.configuration.Configuration;
import org.sosy_lab.common.configuration.InvalidConfigurationException;
import org.sosy_lab.common.log.LogManager;
import org.sosy_lab.cpachecker.cfa.CFA;
import org.sosy_lab.cpachecker.cfa.model.CFAEdge;
import org.sosy_lab.cpachecker.cfa.model.CFAEdgeType;
import org.sosy_lab.cpachecker.cfa.model.CFANode;
import org.sosy_lab.cpachecker.core.defaults.VariableTrackingPrecision;
import org.sosy_lab.cpachecker.core.interfaces.AbstractState;
import org.sosy_lab.cpachecker.core.interfaces.Precision;
import org.sosy_lab.cpachecker.core.interfaces.StateSpacePartition;
import org.sosy_lab.cpachecker.core.interfaces.Targetable;
import org.sosy_lab.cpachecker.core.interfaces.TransferRelation;
import org.sosy_lab.cpachecker.cpa.arg.ARGPath;
import org.sosy_lab.cpachecker.cpa.arg.ARGPath.PathIterator;
import org.sosy_lab.cpachecker.cpa.automaton.ControlAutomatonCPA;
import org.sosy_lab.cpachecker.cpa.smg.SMGCPA;
import org.sosy_lab.cpachecker.cpa.smg.SMGState;
import org.sosy_lab.cpachecker.exceptions.CPAException;
import org.sosy_lab.cpachecker.exceptions.CPATransferException;
import org.sosy_lab.cpachecker.util.refinement.FeasibilityChecker;
import org.sosy_lab.cpachecker.util.refinement.StrongestPostOperator;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Deque;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.logging.Level;
public class SMGFeasibilityChecker implements FeasibilityChecker<SMGState> {
private final LogManager logger;
private final StrongestPostOperator<SMGState> strongestPostOp;
private final SMGState initialState;
private final VariableTrackingPrecision precision;
private final CFANode mainFunction;
public SMGFeasibilityChecker(
StrongestPostOperator<SMGState> pStrongestPostOp, LogManager pLogger, CFA pCfa,
Configuration pConfig, SMGState pInitialState) throws InvalidConfigurationException {
strongestPostOp = pStrongestPostOp;
initialState = pInitialState;
logger = pLogger;
precision = VariableTrackingPrecision.createStaticPrecision(
pConfig, pCfa.getVarClassification(), SMGCPA.class);
mainFunction = pCfa.getMainFunction();
}
@Override
public boolean isFeasible(ARGPath path) throws CPAException, InterruptedException {
return isFeasible(path, initialState);
}
@Override
public boolean isFeasible(
final ARGPath pPath,
final SMGState pStartingPoint) throws CPAException, InterruptedException {
return isFeasible(pPath, pStartingPoint, new ArrayDeque<SMGState>());
}
@Override
public boolean isFeasible(
final ARGPath pPath,
final SMGState pStartingPoint,
final Deque<SMGState> pCallstack) throws CPAException, InterruptedException {
return isReachable(pPath, pStartingPoint, pCallstack).isReachable();
}
private ReachabilityResult isReachable(
final ARGPath pPath,
final SMGState pStartingPoint,
final Deque<SMGState> pCallstack) throws CPAException, InterruptedException {
try {
//TODO ugly, copying SMGState
// We don't want sideffects of smg transfer relation propagating.
SMGState next = new SMGState(pStartingPoint);
CFAEdge edge = null;
PathIterator iterator = pPath.fullPathIterator();
if (!iterator.hasNext()) {
return ReachabilityResult.isReachable(pStartingPoint, null);
}
while (iterator.hasNext()) {
edge = iterator.getOutgoingEdge();
if (edge.getEdgeType() == CFAEdgeType.FunctionCallEdge) {
next = strongestPostOp.handleFunctionCall(next, edge, pCallstack);
}
// we leave a function, so rebuild return-state before assigning the return-value.
if (!pCallstack.isEmpty() && edge.getEdgeType() == CFAEdgeType.FunctionReturnEdge) {
next = strongestPostOp.handleFunctionReturn(next, edge, pCallstack);
}
Optional<SMGState> successors =
strongestPostOp.getStrongestPost(next, precision, edge);
// no successors => path is infeasible
if (!successors.isPresent()) {
logger.log(Level.FINE, "found path to be infeasible: ", iterator.getOutgoingEdge(),
" did not yield a successor");
return ReachabilityResult.isNotReachable();
}
// extract singleton successor state
next = successors.get();
// some variables might be blacklisted or tracked by BDDs
// so perform abstraction computation here
next = strongestPostOp
.performAbstraction(next, iterator.getOutgoingEdge().getSuccessor(), pPath, precision);
iterator.advance();
}
return ReachabilityResult.isReachable(next, edge);
} catch (CPATransferException e) {
throw new CPAException("Computation of successor failed for checking path: " + e.getMessage(),
e);
}
}
private boolean isTarget(
SMGState pLastState,
CFAEdge pLastEdge,
Set<ControlAutomatonCPA> pAutomaton)
throws CPATransferException, InterruptedException {
// prune unreachable to detect memory leak that was detected by abstraction
pLastState.pruneUnreachable();
for (ControlAutomatonCPA automaton : pAutomaton) {
if (isTarget(pLastState, pLastEdge, automaton)) {
return true;
}
}
return false;
}
private boolean isTarget(SMGState pLastState, CFAEdge pLastEdge, ControlAutomatonCPA pAutomaton)
throws CPATransferException, InterruptedException {
if (pAutomaton == null) {
return true;
}
StateSpacePartition defaultPartition = StateSpacePartition.getDefaultPartition();
AbstractState initialAutomatonState =
pAutomaton.getInitialState(mainFunction, defaultPartition);
TransferRelation transferRelation = pAutomaton.getTransferRelation();
Precision automatonPrecision = pAutomaton.getInitialPrecision(mainFunction, defaultPartition);
Collection<? extends AbstractState> successors =
transferRelation.getAbstractSuccessorsForEdge(initialAutomatonState,
Lists.<AbstractState>newArrayList(), automatonPrecision, pLastEdge);
Collection<AbstractState> strengthenResult = new HashSet<>();
List<AbstractState> lastStateSingelton = new ArrayList<>(1);
lastStateSingelton.add(pLastState);
for (AbstractState successor : successors) {
Collection<? extends AbstractState> strengthenResultForSuccessor =
transferRelation.strengthen(successor, lastStateSingelton, pLastEdge, automatonPrecision);
if (strengthenResultForSuccessor == null) {
strengthenResult.add(successor);
} else {
strengthenResult.addAll(strengthenResultForSuccessor);
}
}
for (AbstractState state : strengthenResult) {
if (state instanceof Targetable && ((Targetable) state).isTarget()) {
return true;
}
}
return false;
}
@Override
public boolean isFeasible(ARGPath pPath, Set<ControlAutomatonCPA> pAutomaton)
throws CPAException, InterruptedException {
return isFeasible(pPath, initialState, pAutomaton);
}
@Override
public boolean isFeasible(
ARGPath pPath,
SMGState pStartingPoint,
Set<ControlAutomatonCPA> pAutomaton)
throws CPAException, InterruptedException {
ReachabilityResult result = isReachable(pPath, pStartingPoint, new ArrayDeque<SMGState>());
if (result.isReachable()) {
return isTarget(result.getLastState(), result.getLastEdge(), pAutomaton);
} else {
return false;
}
}
private static class ReachabilityResult {
private static final ReachabilityResult NOT_REACHABLE =
new ReachabilityResult(false, null, null);
private final boolean isReachable;
private final SMGState lastState;
private final CFAEdge lastEdge;
private ReachabilityResult(boolean pIsReachable, SMGState pLastState, CFAEdge pLastEdge) {
isReachable = pIsReachable;
lastState = pLastState;
lastEdge = pLastEdge;
}
public boolean isReachable() {
return isReachable;
}
public SMGState getLastState() {
assert isReachable == true
: "Getting the last state of the path is only supported if the last state is reachable.";
return lastState;
}
public CFAEdge getLastEdge() {
assert isReachable == true
: "Getting the last edge of the path is only supported if the last state is reachable.";
return lastEdge;
}
public static ReachabilityResult isReachable(SMGState lastState, CFAEdge lastEdge) {
return new ReachabilityResult(true, lastState, lastEdge);
}
public static ReachabilityResult isNotReachable() {
return NOT_REACHABLE;
}
}
} |
92335500d9591fb66e808d244302bb4978028e5a | 581 | java | Java | G-Earth/src/main/java/gearth/protocol/connection/proxy/SocksConfiguration.java | dosier/G-Earth | 8a80248e24dbc19152e9606c0a04676fc05776f6 | [
"MIT"
] | 64 | 2018-07-19T21:53:16.000Z | 2022-03-20T18:34:31.000Z | G-Earth/src/main/java/gearth/protocol/connection/proxy/SocksConfiguration.java | dosier/G-Earth | 8a80248e24dbc19152e9606c0a04676fc05776f6 | [
"MIT"
] | 89 | 2018-07-21T13:39:16.000Z | 2022-03-30T14:42:06.000Z | G-Earth/src/main/java/gearth/protocol/connection/proxy/SocksConfiguration.java | dosier/G-Earth | 8a80248e24dbc19152e9606c0a04676fc05776f6 | [
"MIT"
] | 53 | 2018-09-21T22:31:47.000Z | 2022-03-16T00:21:45.000Z | 24.208333 | 105 | 0.716007 | 996,531 | package gearth.protocol.connection.proxy;
import java.net.InetSocketAddress;
import java.net.Proxy;
import java.net.Socket;
import java.net.SocketException;
public interface SocksConfiguration {
boolean useSocks();
int getSocksPort();
String getSocksHost();
boolean onlyUseIfNeeded();
default Socket createSocket() throws SocketException {
Proxy socks = new Proxy(Proxy.Type.SOCKS, new InetSocketAddress(getSocksHost(), getSocksPort()));
Socket server = new Socket(socks);
server.setSoTimeout(5000);
return server;
}
}
|
9233560755a3335b56ca4376eda5f610fcef7423 | 11,975 | java | Java | client/src/main/java/com/humanharvest/organz/controller/spiderweb/SpiderWebController.java | DiagonalCorgi/OrgaNZ | deb58ec60427ba36921bf5e397b0c19845beef58 | [
"Apache-2.0"
] | 5 | 2018-10-11T09:45:26.000Z | 2018-11-11T22:11:51.000Z | client/src/main/java/com/humanharvest/organz/controller/spiderweb/SpiderWebController.java | MatthewSmit/Donaco | 17ca55f9c097aa381b5ecda019ba7fad92f05d32 | [
"Apache-2.0"
] | 4 | 2020-04-23T18:23:46.000Z | 2021-12-09T21:20:21.000Z | client/src/main/java/com/humanharvest/organz/controller/spiderweb/SpiderWebController.java | MatthewSmit/Donaco | 17ca55f9c097aa381b5ecda019ba7fad92f05d32 | [
"Apache-2.0"
] | 2 | 2019-12-15T22:21:34.000Z | 2021-06-03T07:12:08.000Z | 40.319865 | 112 | 0.683674 | 996,532 | package com.humanharvest.organz.controller.spiderweb;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Optional;
import java.util.logging.Level;
import java.util.logging.Logger;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.geometry.Bounds;
import javafx.geometry.Point2D;
import javafx.scene.CacheHint;
import javafx.scene.Node;
import javafx.scene.control.Button;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Pane;
import javafx.scene.transform.Affine;
import javafx.scene.transform.Rotate;
import javafx.scene.transform.Scale;
import javafx.scene.transform.Translate;
import javafx.stage.Screen;
import javafx.stage.Stage;
import org.controlsfx.control.Notifications;
import com.humanharvest.organz.Client;
import com.humanharvest.organz.DonatedOrgan;
import com.humanharvest.organz.controller.MainController;
import com.humanharvest.organz.controller.ProjectionHelper;
import com.humanharvest.organz.controller.SubController;
import com.humanharvest.organz.controller.client.DeceasedDonorOverviewController;
import com.humanharvest.organz.state.State;
import com.humanharvest.organz.touch.FocusArea;
import com.humanharvest.organz.touch.MultitouchHandler;
import com.humanharvest.organz.touch.PhysicsHandler;
import com.humanharvest.organz.touch.PointUtils;
import com.humanharvest.organz.utilities.view.Page;
import com.humanharvest.organz.utilities.view.PageNavigator;
import com.humanharvest.organz.utilities.view.PageNavigatorTouch;
import com.humanharvest.organz.utilities.view.WindowContext;
/**
* The Spider web controller which handles everything to do with displaying panes in the spider web stage.
*/
public class SpiderWebController extends SubController {
private static final Logger LOGGER = Logger.getLogger(SpiderWebController.class.getName());
private static final double RADIUS = 300;
private Client client;
private final List<MainController> previouslyOpenWindows = new ArrayList<>();
private final List<OrganWithRecipients> organWithRecipientsList = new ArrayList<>();
private final Pane rootPane;
private final Pane canvas;
private Pane deceasedDonorPane;
private DeceasedDonorOverviewController donorOverviewController;
public SpiderWebController(Client viewedClient) {
client = viewedClient;
client.setDonatedOrgans(State.getClientResolver().getDonatedOrgans(client));
State.setSpiderwebDonor(client);
rootPane = MultitouchHandler.getRootPane();
rootPane.getChildren().clear();
canvas = new Pane();
rootPane.getChildren().add(canvas);
// Close any current projection
ProjectionHelper.stageClosing();
// Close existing windows, but save them for later
// Copy to a new list to prevent concurrent modification
Iterable<MainController> toClose = new ArrayList<>(State.getMainControllers());
for (MainController mainController : toClose) {
mainController.closeWindow();
if (!mainController.isAProjection()) {
previouslyOpenWindows.add(mainController);
}
}
// Need to do this to be able to refresh the spider web
mainController = new MainController();
mainController.setStage(new Stage());
mainController.setPane(new Pane());
mainController.setSubController(this);
mainController.setWindowContext(WindowContext.defaultContext());
State.addMainController(mainController);
// Setup spider web physics
MultitouchHandler.setPhysicsHandler(new SpiderPhysicsHandler(MultitouchHandler.getRootPane()));
// Setup page
setupButtons();
displayDonatingClient();
displayOrgans();
}
/**
* Sets a node's position using an {@link Affine} transform. The node must have an {@link FocusArea} for its
* {@link Node#getUserData()}.
*
* @param node The node to apply the transform to. Must have a focusArea
* @param x The x translation
* @param y The y translation
* @param angle The angle to rotate (degrees)
* @param scale The scale to apply to both x and y
*/
private static void setPositionUsingTransform(Node node, double x, double y, double angle, double scale) {
FocusArea focusArea = (FocusArea) node.getUserData();
Point2D centre = PointUtils.getCentreOfNode(node);
Affine transform = new Affine();
transform.append(new Translate(x, y));
transform.append(new Scale(scale, scale));
transform.append(new Rotate(angle, centre.getX(), centre.getY()));
focusArea.setTransform(transform);
node.setCacheHint(CacheHint.QUALITY);
}
private static void killVelocity(Node node) {
((FocusArea) node.getUserData()).setVelocity(Point2D.ZERO);
}
/**
* Setup the basic buttons in the top left corner
*/
private void setupButtons() {
Button exitButton = new Button("Exit Spider Web");
exitButton.setOnAction(__ -> {
closeSpiderWeb();
openPreviouslyOpenWindows();
});
Button homeButton = new Button("Dashboard");
homeButton.setOnAction(__ -> goToDashboard());
Button resetButton = new Button("Reset");
resetButton.setOnAction(__ -> resetLayout());
HBox buttons = new HBox();
buttons.setSpacing(10);
buttons.getChildren().addAll(exitButton, homeButton, resetButton);
MainController buttonsMain = PageNavigator.openNewWindow(300, 25);
buttonsMain.getStyles().clear();
buttonsMain.setPage(Page.BACKDROP, buttons);
FocusArea buttonsFocusArea = (FocusArea) buttonsMain.getPane().getUserData();
buttonsFocusArea.setTranslatable(false);
buttonsFocusArea.setRotatable(false);
buttonsFocusArea.setScalable(false);
buttonsFocusArea.setCollidable(false);
}
/**
* Loads a window for each non expired organ.
*/
private void displayOrgans() {
List<DonatedOrgan> donatedOrgans = client.getDonatedOrgans();
Bounds donorBounds = deceasedDonorPane.getBoundsInParent();
double centreX = donorBounds.getMinX() + donorBounds.getWidth() / 2;
double centreY = donorBounds.getMinY() + donorBounds.getHeight() / 2;
double angleSize = (Math.PI * 2) / donatedOrgans.size();
for (int i = 0; i < donatedOrgans.size(); i++) {
DonatedOrgan donatedOrgan = donatedOrgans.get(i);
double xPos = centreX + RADIUS * Math.sin(angleSize * i);
double yPos = centreY + RADIUS * Math.cos(angleSize * i);
double angle = 360.01 - Math.toDegrees(angleSize * i);
addOrganNode(donatedOrgan, xPos, yPos, angle);
}
}
private void addOrganNode(DonatedOrgan organ, double xPos, double yPos, double rotation) {
OrganWithRecipients organWithRecipients = new OrganWithRecipients(organ, donorOverviewController,
canvas);
organWithRecipientsList.add(organWithRecipients);
setPositionUsingTransform(organWithRecipients.getOrganPane(), xPos, yPos, rotation, 1);
}
private void displayDonatingClient() {
MainController newMain = PageNavigator.openNewWindow(200, 320);
donorOverviewController = (DeceasedDonorOverviewController)
PageNavigator.loadPage(Page.DECEASED_DONOR_OVERVIEW, newMain);
deceasedDonorPane = newMain.getPane();
FocusArea deceasedDonorFocus = (FocusArea) deceasedDonorPane.getUserData();
deceasedDonorFocus.setTranslatable(false);
deceasedDonorFocus.setCollidable(true);
Bounds bounds = deceasedDonorPane.getBoundsInParent();
double centerX = (Screen.getPrimary().getVisualBounds().getWidth() - bounds.getWidth()) / 2;
double centerY = (Screen.getPrimary().getVisualBounds().getHeight() - bounds.getHeight()) / 2;
setPositionUsingTransform(deceasedDonorPane, centerX, centerY, 0, 0.6);
// We need to register this so when the deceasedDonorPane gets properly positioned it updates the lines
deceasedDonorPane.boundsInLocalProperty().addListener(
(__, ___, ____) -> organWithRecipientsList.forEach(
organ -> organ.setDonorConnectorStart(deceasedDonorPane.getBoundsInParent())));
}
private void resetLayout() {
Bounds donorBounds = deceasedDonorPane.getBoundsInParent();
double centreX = donorBounds.getMinX() + donorBounds.getWidth() / 2;
double centreY = donorBounds.getMinY() + donorBounds.getHeight() / 2;
double angleSize = (Math.PI * 2) / organWithRecipientsList.size();
for (int i = 0; i < organWithRecipientsList.size(); i++) {
OrganWithRecipients organWithRecipients = organWithRecipientsList.get(i);
double xPos = centreX + RADIUS * Math.sin(angleSize * i);
double yPos = centreY + RADIUS * Math.cos(angleSize * i);
double angle = 360.01 - Math.toDegrees(angleSize * i);
setPositionUsingTransform(organWithRecipients.getOrganPane(), 0, 0, 0, 0);
setPositionUsingTransform(organWithRecipients.getOrganPane(), xPos, yPos, angle, 1);
killVelocity(organWithRecipients.getOrganPane());
}
}
@FXML
private void closeSpiderWeb() {
MultitouchHandler.setPhysicsHandler(new PhysicsHandler(MultitouchHandler.getRootPane()));
// Close all windows for the spider web and clear
// Copy to a new list to prevent concurrent modification
List<MainController> toClose = new ArrayList<>(State.getMainControllers());
toClose.forEach(MainController::closeWindow);
rootPane.getChildren().clear();
try {
FXMLLoader loader = new FXMLLoader();
Pane backPane = loader.load(PageNavigatorTouch.class.getResourceAsStream(Page.BACKDROP.getPath()));
rootPane.getChildren().add(backPane);
backPane.resize(rootPane.getWidth(), rootPane.getHeight());
} catch (IOException exc) {
LOGGER.log(Level.SEVERE, exc.getMessage(), exc);
}
// We need to close the Timeline to clear resources
organWithRecipientsList.forEach(OrganWithRecipients::closeRefresher);
State.setSpiderwebDonor(null);
}
private void openPreviouslyOpenWindows() {
// Open all the previously open windows again
for (MainController mainController : previouslyOpenWindows) {
mainController.showWindow();
if (mainController.isProjecting()) {
ProjectionHelper.createNewProjection(mainController);
}
}
}
@Override
public void refresh() {
Collection<DonatedOrgan> donatedOrgans = State.getClientResolver().getDonatedOrgans(client);
client = donatedOrgans.iterator().next().getDonor();
client.setDonatedOrgans(donatedOrgans);
for (OrganWithRecipients page : organWithRecipientsList) {
Optional<DonatedOrgan> newOrgan = client.getDonatedOrgans().stream()
.filter(organ -> organ.getOrganType() == page.getOrgan().getOrganType())
.findFirst();
if (!newOrgan.isPresent()) {
Notifications.create()
.title("Server Error")
.text("An error occurred when trying to schedule the transplant.")
.showError();
} else {
page.refresh(newOrgan.get());
}
}
}
@FXML
private void goToDashboard() {
closeSpiderWeb();
MainController newMain = PageNavigator.openNewWindow();
newMain.setWindowContext(WindowContext.defaultContext());
PageNavigator.loadPage(Page.DASHBOARD, newMain);
}
}
|
923357290f2d0e984ca12eac97826010bbcab7e2 | 2,400 | java | Java | main/plugins/org.talend.designer.runtime.visualization/src/org/talend/designer/runtime/visualization/internal/ui/editors/Messages.java | bgunics-talend/tdi-studio-se | 3f54f55acb4d214f2d02532667bae98420068170 | [
"Apache-2.0"
] | 114 | 2015-03-05T15:34:59.000Z | 2022-02-22T03:48:44.000Z | main/plugins/org.talend.designer.runtime.visualization/src/org/talend/designer/runtime/visualization/internal/ui/editors/Messages.java | bgunics-talend/tdi-studio-se | 3f54f55acb4d214f2d02532667bae98420068170 | [
"Apache-2.0"
] | 1,137 | 2015-03-04T01:35:42.000Z | 2022-03-29T06:03:17.000Z | main/plugins/org.talend.designer.runtime.visualization/src/org/talend/designer/runtime/visualization/internal/ui/editors/Messages.java | bgunics-talend/tdi-studio-se | 3f54f55acb4d214f2d02532667bae98420068170 | [
"Apache-2.0"
] | 219 | 2015-01-21T10:42:18.000Z | 2022-02-17T07:57:20.000Z | 22.222222 | 133 | 0.572083 | 996,533 | /*******************************************************************************
* Copyright (c) 2010 JVM Monitor project. All rights reserved.
*
* This code is distributed under the terms of the Eclipse Public License v1.0 which is available at
* http://www.eclipse.org/legal/epl-v10.html
*******************************************************************************/
package org.talend.designer.runtime.visualization.internal.ui.editors;
import org.eclipse.osgi.util.NLS;
/**
* The messages.
*/
public final class Messages extends NLS {
/** The bundle name. */
private static final String BUNDLE_NAME = "org.talend.designer.runtime.visualization.internal.ui.editors.messages";//$NON-NLS-1$
static {
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
}
/**
* The constructor.
*/
private Messages() {
// do not instantiate
}
// info page on editor
/** */
public static String runtimeSectionLabel;
/** */
public static String hostnameLabel;
/** */
public static String pidLabel;
/** */
public static String mainClassLabel;
/** */
public static String argumentsLabel;
/** */
public static String snapshotSectionLabel;
/** */
public static String dateLabel;
/** */
public static String commentsLabel;
// dump editor
/** */
public static String infoTabLabel;
// heap dump editor
/** */
public static String memoryTabLabel;
/** */
public static String parseHeapDumpFileJobLabel;
// thread dump editor
/** */
public static String threadsTabLabel;
// CPU dump editor
/** */
public static String callTreePageLabel;
/** */
public static String hotSpotsPageLabel;
/** */
public static String callerCalleePageLabel;
/** */
public static String parseCpuDumpFileJobLabel;
/** */
public static String noCallersCalleesMessage;
/** */
public static String callersCalleesTargetIndicator;
/** */
public static String focusTargetIndicator;
/** */
public static String threadIndicator;
// error log messages
/** */
public static String saveFileFailedMsg;
/** */
public static String parseThreadDumpFileJobLabel;
}
|
9233584b791b5ad8cb2d279b5fe7cd82da2b42e4 | 1,203 | java | Java | src/main/java/com/spring/microservices/dairyfactory/config/JmsConfig.java | mhnvelu/dairy-factory | caa070610921e517fc6729d01c15251d919d6f35 | [
"Apache-2.0"
] | null | null | null | src/main/java/com/spring/microservices/dairyfactory/config/JmsConfig.java | mhnvelu/dairy-factory | caa070610921e517fc6729d01c15251d919d6f35 | [
"Apache-2.0"
] | null | null | null | src/main/java/com/spring/microservices/dairyfactory/config/JmsConfig.java | mhnvelu/dairy-factory | caa070610921e517fc6729d01c15251d919d6f35 | [
"Apache-2.0"
] | null | null | null | 41.482759 | 102 | 0.80798 | 996,534 | package com.spring.microservices.dairyfactory.config;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.jms.support.converter.MappingJackson2MessageConverter;
import org.springframework.jms.support.converter.MessageConverter;
import org.springframework.jms.support.converter.MessageType;
@Configuration
public class JmsConfig {
public static final String BUTTER_PRODUCE_QUEUE = "butter-produce-queue";
public static final String NEW_INVENTORY_QUEUE = "new-inventory-queue";
public static final String BUTTER_ORDER_VALIDATE_REQUEST_QUEUE = "validate-order-request-queue";
public static final String BUTTER_ORDER_VALIDATE_RESPONSE_QUEUE = "validate-order-response-queue";
@Bean
public MessageConverter jacksonJmsMessageConverter(ObjectMapper objectMapper) {
MappingJackson2MessageConverter converter = new MappingJackson2MessageConverter();
converter.setTargetType(MessageType.TEXT);
converter.setTypeIdPropertyName("_type");
converter.setObjectMapper(objectMapper);
return converter;
}
}
|
9233588ed6f593140661b23b072142feb848bd33 | 128 | java | Java | lua-commons-2-base-level/src/main/java/org/lua/commons/baseapi/extensions/LuaExtension.java | mrkosterix/lua-commons | 20b573728562d24c1b1904e9d07b963aafc0789c | [
"MIT"
] | 1 | 2020-07-31T06:40:24.000Z | 2020-07-31T06:40:24.000Z | lua-commons-2-base-level/src/main/java/org/lua/commons/baseapi/extensions/LuaExtension.java | mrkosterix/lua-commons | 20b573728562d24c1b1904e9d07b963aafc0789c | [
"MIT"
] | null | null | null | lua-commons-2-base-level/src/main/java/org/lua/commons/baseapi/extensions/LuaExtension.java | mrkosterix/lua-commons | 20b573728562d24c1b1904e9d07b963aafc0789c | [
"MIT"
] | null | null | null | 12.8 | 43 | 0.734375 | 996,535 | package org.lua.commons.baseapi.extensions;
public interface LuaExtension {
public void start();
public void close();
}
|
9233593bebab34d6c212bec9672b2ba1b4d2e43b | 2,055 | java | Java | orchestrator-client/src/main/java/de/fau/clients/orchestrator/queue/TableColumnHider.java | FlorianBauer/sila-orchestrator | 250097eda6280f095d3d6d44b5115eedcaca426b | [
"Apache-2.0"
] | 10 | 2021-04-13T05:17:26.000Z | 2022-01-15T18:17:17.000Z | orchestrator-client/src/main/java/de/fau/clients/orchestrator/queue/TableColumnHider.java | FlorianBauer/sila-orchestrator | 250097eda6280f095d3d6d44b5115eedcaca426b | [
"Apache-2.0"
] | 2 | 2022-01-11T16:34:42.000Z | 2022-01-17T20:19:27.000Z | orchestrator-client/src/main/java/de/fau/clients/orchestrator/queue/TableColumnHider.java | FlorianBauer/sila-orchestrator | 250097eda6280f095d3d6d44b5115eedcaca426b | [
"Apache-2.0"
] | 2 | 2021-04-16T09:53:24.000Z | 2022-01-13T23:33:46.000Z | 33.145161 | 99 | 0.645742 | 996,536 | package de.fau.clients.orchestrator.queue;
import javax.swing.table.TableColumn;
import javax.swing.table.TableColumnModel;
/**
* Handles the visibility of the columns in a <code>TableColumnModel</code> of an
* <code>JTable</code>. The indices of the shown/hidden columns and the defined column-enums are
* different and the actual mapping has to be resolved by using the internal look-up table (LUT).
*/
final class TableColumnHider {
private final TableColumnModel columnModel;
private final TableColumn[] hiddenColumnLut = new TableColumn[Column.size()];
/**
* Constructor. Sets the column model and hides the flagged entries. Ensure the column model is
* completely initialized before constructing this class.
*
* @param columnModel The fully initialized column model of an table.
*/
public TableColumnHider(final TableColumnModel columnModel) {
this.columnModel = columnModel;
for (final Column col : Column.values()) {
if (col.isHiddenOnDefault) {
this.hideColumn(col);
}
}
}
/**
* Makes the given column invisible in the table.
*
* @param col The column to hide.
*/
public void hideColumn(final Column col) {
final int modelIdx = columnModel.getColumnIndex(col.title);
final TableColumn column = columnModel.getColumn(modelIdx);
hiddenColumnLut[col.ordinal()] = column;
columnModel.removeColumn(column);
}
/**
* Makes the given column visible in the table.
*
* @param col The column to show.
*/
public void showColumn(final Column col) {
final int idx = col.ordinal();
final TableColumn column = hiddenColumnLut[idx];
if (column != null) {
columnModel.addColumn(column);
hiddenColumnLut[idx] = null;
int lastColumn = columnModel.getColumnCount() - 1;
if (idx < lastColumn) {
columnModel.moveColumn(lastColumn, idx);
}
}
}
}
|
92335a15386b9cb5575e6b3059e8a10c947bd240 | 1,931 | java | Java | xmodule-master4j-java/src/main/java/com/penglecode/xmodule/master4j/java/io/serializable/User2.java | penggle/xmodule | 98210aa53d5958cda86f13b8b8f6eabd4ac4b93f | [
"Apache-2.0"
] | 24 | 2019-07-16T10:57:33.000Z | 2022-01-26T03:43:59.000Z | xmodule-master4j-java/src/main/java/com/penglecode/xmodule/master4j/java/io/serializable/User2.java | lvscxl/xmodule | e9f985bb45f64b21d7c63bdad9e7ce9f8185951c | [
"Apache-2.0"
] | 2 | 2020-08-27T10:07:22.000Z | 2020-09-11T06:28:30.000Z | xmodule-master4j-java/src/main/java/com/penglecode/xmodule/master4j/java/io/serializable/User2.java | lvscxl/xmodule | e9f985bb45f64b21d7c63bdad9e7ce9f8185951c | [
"Apache-2.0"
] | 20 | 2019-06-30T15:17:10.000Z | 2021-11-20T05:43:53.000Z | 24.1375 | 96 | 0.65044 | 996,537 | package com.penglecode.xmodule.master4j.java.io.serializable;
import java.io.*;
/**
* 对象序列化测试数据模型
*
* 区别于Serializable接口,Externalizable继承了Serializable,该接口中定义了两个抽象方法:writeExternal()与readExternal()。
* 当使用Externalizable接口来进行序列化与反序列化的时候需要开发人员重写writeExternal()与readExternal()方法才能实现序列化与反序列化。
*
* 还有一点值得注意:在使用Externalizable进行序列化的时候,在读取对象时,会调用被序列化类的无参构造器去创建一个新的对象,
* 然后再将被保存对象的字段的值分别填充到新对象中。所以,实现Externalizable接口的类必须要提供一个public的无参的构造器。
*
* @author pengpeng
* @version 1.0
* @date 2020/8/24 21:47
*/
public class User2 implements Externalizable {
/**
* 一定要显示指定serialVersionUID的值,不指定即用默认自动生成的
* 如果User1.java哪怕被改动一点点,都会导致serialVersionUID自动重新生成的,
* 这样在反序列化时会遇到serialVersionUID不匹配的问题
*/
private static final long serialVersionUID = 1L;
private Long userId;
private String userName;
private String password;
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
@Override
public void writeExternal(ObjectOutput out) throws IOException {
out.writeLong(userId);
out.writeUTF(userName);
out.writeUTF(password);
}
@Override
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
userId = in.readLong();
userName = in.readUTF();
password = in.readUTF();
}
@Override
public String toString() {
return "User2{" +
"userId=" + userId +
", userName='" + userName + '\'' +
", password='" + password + '\'' +
'}';
}
}
|
92335c15fd23b304bfcd826bcbafdc872f7bae42 | 2,914 | java | Java | library/data/tags/src/main/java/org/quiltmc/qsl/tag/impl/client/ClientDefaultTagManagerReloader.java | Undercoverer/quilt-standard-libraries | c20c480e974e0536f35ea88a05c1e55de8eda999 | [
"Apache-2.0"
] | 35 | 2021-05-09T21:12:15.000Z | 2022-03-28T22:13:47.000Z | library/data/tags/src/main/java/org/quiltmc/qsl/tag/impl/client/ClientDefaultTagManagerReloader.java | Undercoverer/quilt-standard-libraries | c20c480e974e0536f35ea88a05c1e55de8eda999 | [
"Apache-2.0"
] | 71 | 2021-05-28T03:43:27.000Z | 2022-03-31T19:31:30.000Z | library/data/tags/src/main/java/org/quiltmc/qsl/tag/impl/client/ClientDefaultTagManagerReloader.java | Undercoverer/quilt-standard-libraries | c20c480e974e0536f35ea88a05c1e55de8eda999 | [
"Apache-2.0"
] | 36 | 2021-05-09T23:31:47.000Z | 2022-03-28T00:42:38.000Z | 39.378378 | 166 | 0.784489 | 996,538 | /*
* Copyright 2021 QuiltMC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.quiltmc.qsl.tag.impl.client;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.Executor;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import org.jetbrains.annotations.ApiStatus;
import net.minecraft.resource.ReloadableResourceManagerImpl;
import net.minecraft.resource.ResourceManager;
import net.minecraft.resource.ResourceType;
import net.minecraft.util.Identifier;
import net.minecraft.util.profiler.Profiler;
@Environment(EnvType.CLIENT)
@ApiStatus.Internal
final class ClientDefaultTagManagerReloader extends ClientOnlyTagManagerReloader {
private static final Identifier ID = new Identifier(ClientQuiltTagsMod.NAMESPACE, "client_default_tags");
@Override
public Identifier getQuiltId() {
return ID;
}
/**
* Returns a resource manager with a modified resource type but with the same resource packs as the client.
* <p>
* Flaw: if a resource pack which can be loaded by client but only has server data won't be added to this resource manager as not present in client resource manager.
*
* @param base the client vanilla resource manager
* @return the modified resource manager
*/
private static ResourceManager getServerDataResourceManager(ResourceManager base) {
var serverDataResourceManager = new ReloadableResourceManagerImpl(ResourceType.SERVER_DATA);
base.streamResourcePacks()
.filter(resourcePack -> !resourcePack.getNamespaces(ResourceType.SERVER_DATA).isEmpty())
.forEach(serverDataResourceManager::addPack);
return serverDataResourceManager;
}
@Override
public CompletableFuture<List<Entry>> load(ResourceManager manager, Profiler profiler, Executor executor) {
// First we need to transform the resource manager into one with the type SERVER_DATA,
// then we can continue as normal.
return CompletableFuture.supplyAsync(() -> getServerDataResourceManager(manager), executor)
.thenComposeAsync(resourceManager -> super.load(resourceManager, profiler, executor), executor);
}
@Override
public CompletableFuture<Void> apply(List<Entry> data, ResourceManager manager, Profiler profiler, Executor executor) {
return CompletableFuture.runAsync(() -> {
data.forEach(entry -> entry.manager().setDefaultSerializedTags(entry.serializedTags()));
}, executor);
}
}
|
92335ca8dd34d9c4fc2f18c45c83ada80dcd1032 | 183 | java | Java | src/main/java/work/yanghao/service/UserService.java | dlyanghao/ShrioDemo | f5d60b1f5facd0b1756692e376c03865b06b06ec | [
"Apache-2.0"
] | null | null | null | src/main/java/work/yanghao/service/UserService.java | dlyanghao/ShrioDemo | f5d60b1f5facd0b1756692e376c03865b06b06ec | [
"Apache-2.0"
] | null | null | null | src/main/java/work/yanghao/service/UserService.java | dlyanghao/ShrioDemo | f5d60b1f5facd0b1756692e376c03865b06b06ec | [
"Apache-2.0"
] | null | null | null | 13.071429 | 55 | 0.704918 | 996,539 | package work.yanghao.service;
import work.yanghao.pojo.User;
/**
* 用户服务接口
*/
public interface UserService {
//用户登录
public User login(String username,String password);
}
|
92335cf0c3f2901deae262d4eb86a22cb3f151e6 | 7,893 | java | Java | code/java/RecommendationListAPIforDigitalPortals/v2/src/main/java/com/factset/sdk/RecommendationListAPIforDigitalPortals/models/InlineResponse2005NotationInstrument.java | factset/enterprise-sdk | 3fd4d1360756c515c9737a0c9a992c7451d7de7e | [
"Apache-2.0"
] | 6 | 2022-02-07T16:34:18.000Z | 2022-03-30T08:04:57.000Z | code/java/RecommendationListAPIforDigitalPortals/v2/src/main/java/com/factset/sdk/RecommendationListAPIforDigitalPortals/models/InlineResponse2005NotationInstrument.java | factset/enterprise-sdk | 3fd4d1360756c515c9737a0c9a992c7451d7de7e | [
"Apache-2.0"
] | 2 | 2022-02-07T05:25:57.000Z | 2022-03-07T14:18:04.000Z | code/java/RecommendationListAPIforDigitalPortals/v2/src/main/java/com/factset/sdk/RecommendationListAPIforDigitalPortals/models/InlineResponse2005NotationInstrument.java | factset/enterprise-sdk | 3fd4d1360756c515c9737a0c9a992c7451d7de7e | [
"Apache-2.0"
] | null | null | null | 31.074803 | 274 | 0.746864 | 996,540 | /*
* Prime Developer Trial
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: v1
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package com.factset.sdk.RecommendationListAPIforDigitalPortals.models;
import java.util.Objects;
import java.util.Arrays;
import java.util.Map;
import java.util.HashMap;
import com.factset.sdk.RecommendationListAPIforDigitalPortals.models.InlineResponse2005NotationInstrumentType;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.factset.sdk.RecommendationListAPIforDigitalPortals.JSON;
/**
* Instrument data of the notation.
*/
@ApiModel(description = "Instrument data of the notation.")
@JsonPropertyOrder({
InlineResponse2005NotationInstrument.JSON_PROPERTY_ID,
InlineResponse2005NotationInstrument.JSON_PROPERTY_ISIN,
InlineResponse2005NotationInstrument.JSON_PROPERTY_NAME,
InlineResponse2005NotationInstrument.JSON_PROPERTY_CUSTOM_NAME,
InlineResponse2005NotationInstrument.JSON_PROPERTY_TYPE
})
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class InlineResponse2005NotationInstrument implements Serializable {
private static final long serialVersionUID = 1L;
public static final String JSON_PROPERTY_ID = "id";
private String id;
public static final String JSON_PROPERTY_ISIN = "isin";
private String isin;
public static final String JSON_PROPERTY_NAME = "name";
private String name;
public static final String JSON_PROPERTY_CUSTOM_NAME = "customName";
private String customName;
public static final String JSON_PROPERTY_TYPE = "type";
private java.util.List<InlineResponse2005NotationInstrumentType> type = null;
public InlineResponse2005NotationInstrument() {
}
public InlineResponse2005NotationInstrument id(String id) {
this.id = id;
return this;
}
/**
* Identifier of the instrument.
* @return id
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "Identifier of the instrument.")
@JsonProperty(JSON_PROPERTY_ID)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public String getId() {
return id;
}
@JsonProperty(JSON_PROPERTY_ID)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setId(String id) {
this.id = id;
}
public InlineResponse2005NotationInstrument isin(String isin) {
this.isin = isin;
return this;
}
/**
* International Securities Identification Number of the instrument.
* @return isin
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "International Securities Identification Number of the instrument.")
@JsonProperty(JSON_PROPERTY_ISIN)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public String getIsin() {
return isin;
}
@JsonProperty(JSON_PROPERTY_ISIN)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setIsin(String isin) {
this.isin = isin;
}
public InlineResponse2005NotationInstrument name(String name) {
this.name = name;
return this;
}
/**
* Name of the instrument.
* @return name
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "Name of the instrument.")
@JsonProperty(JSON_PROPERTY_NAME)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public String getName() {
return name;
}
@JsonProperty(JSON_PROPERTY_NAME)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setName(String name) {
this.name = name;
}
public InlineResponse2005NotationInstrument customName(String customName) {
this.customName = customName;
return this;
}
/**
* Customer specific name of the instrument.
* @return customName
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "Customer specific name of the instrument.")
@JsonProperty(JSON_PROPERTY_CUSTOM_NAME)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public String getCustomName() {
return customName;
}
@JsonProperty(JSON_PROPERTY_CUSTOM_NAME)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setCustomName(String customName) {
this.customName = customName;
}
public InlineResponse2005NotationInstrument type(java.util.List<InlineResponse2005NotationInstrumentType> type) {
this.type = type;
return this;
}
public InlineResponse2005NotationInstrument addTypeItem(InlineResponse2005NotationInstrumentType typeItem) {
if (this.type == null) {
this.type = new java.util.ArrayList<>();
}
this.type.add(typeItem);
return this;
}
/**
* Instrument type as defined by FactSet Digital Solutions. Instrument types are arranged in a hierarchy, with level 1 representing the most coarse granularity and further levels successively refining the granularity (see MDG category system 18).
* @return type
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "Instrument type as defined by FactSet Digital Solutions. Instrument types are arranged in a hierarchy, with level 1 representing the most coarse granularity and further levels successively refining the granularity (see MDG category system 18).")
@JsonProperty(JSON_PROPERTY_TYPE)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public java.util.List<InlineResponse2005NotationInstrumentType> getType() {
return type;
}
@JsonProperty(JSON_PROPERTY_TYPE)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setType(java.util.List<InlineResponse2005NotationInstrumentType> type) {
this.type = type;
}
/**
* Return true if this inline_response_200_5_notation_instrument object is equal to o.
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
InlineResponse2005NotationInstrument inlineResponse2005NotationInstrument = (InlineResponse2005NotationInstrument) o;
return Objects.equals(this.id, inlineResponse2005NotationInstrument.id) &&
Objects.equals(this.isin, inlineResponse2005NotationInstrument.isin) &&
Objects.equals(this.name, inlineResponse2005NotationInstrument.name) &&
Objects.equals(this.customName, inlineResponse2005NotationInstrument.customName) &&
Objects.equals(this.type, inlineResponse2005NotationInstrument.type);
}
@Override
public int hashCode() {
return Objects.hash(id, isin, name, customName, type);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class InlineResponse2005NotationInstrument {\n");
sb.append(" id: ").append(toIndentedString(id)).append("\n");
sb.append(" isin: ").append(toIndentedString(isin)).append("\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append(" customName: ").append(toIndentedString(customName)).append("\n");
sb.append(" type: ").append(toIndentedString(type)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}
|
92335da79d2167f207aa841e9a4537f8bf5dacda | 1,645 | java | Java | java/com/brtt/antelope/DatabaseRow.java | tmulder/antelope_contrib | 30aada1177c31076823ffd4e2c8167844d15f851 | [
"BSD-2-Clause",
"MIT"
] | 30 | 2015-02-20T21:44:29.000Z | 2021-09-27T02:53:14.000Z | java/com/brtt/antelope/DatabaseRow.java | tmulder/antelope_contrib | 30aada1177c31076823ffd4e2c8167844d15f851 | [
"BSD-2-Clause",
"MIT"
] | 14 | 2015-07-07T19:17:24.000Z | 2020-12-19T19:18:53.000Z | java/com/brtt/antelope/DatabaseRow.java | tmulder/antelope_contrib | 30aada1177c31076823ffd4e2c8167844d15f851 | [
"BSD-2-Clause",
"MIT"
] | 46 | 2015-02-06T16:22:41.000Z | 2022-03-30T11:46:37.000Z | 30.444444 | 82 | 0.687956 | 996,541 | /* Java class representing a Datascope database row
*
* Copyright (c) 2004 by the Regents of the University of California
*
* Created by Tobin Fricke <kenaa@example.com> on 2004-07-15
*/
package com.brtt.antelope;
import java.io.*;
import java.util.*;
/**
* This class represents a row in a Datascope table. Note: we have to
* decide whether to return the String representation of a field, or
* parsed datatypes like ints, doubles, etc. In a sense a DatabaseRow
* is an instantiation of a DatabaseRelation.
*
* @author Tobin Fricke, University of California
*/
class DatabaseRow {
/** Construct a DatabaseRow given the defining Relation and the textual
* representation of the row. Note: this is an inefficient way to do
* this. For efficiency we should use memory-mapped I/O via FileChannel.
* If we did that, then we would have two types of DatabaseRow objects --
* those that are mutable and mapped to the on-disk storage, and those
* that are free-floating.
*/
public DatabaseRow(DatabaseRelation relation, String str) {
for (Iterator i = relation.fields.iterator(); i.hasNext(); ) {
DatabaseAttribute attribute = (DatabaseAttribute)(i.getNext());
/* It seems that we might want to defer parsing to the
DatabaseAttribute class. But we'll do it here for now. */
}
}
/** Retrieve the ith field from this row. Note: we might want to implement
* a collection interface (list List or Dictionary), since that's pretty much
* what a record is. */
Object get(int i) {
return fields.get(i);
}
public List fields;
}
|
92335dbc938245af9d83173afc127133c5d8509c | 1,336 | java | Java | flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/littemplate/SetInitialTextLitView.java | mortensen/flow | c0b2ffb0c5d35df46cf416e195201450c1de9e8a | [
"Apache-2.0"
] | 402 | 2017-10-02T09:00:34.000Z | 2022-03-30T06:09:40.000Z | flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/littemplate/SetInitialTextLitView.java | mortensen/flow | c0b2ffb0c5d35df46cf416e195201450c1de9e8a | [
"Apache-2.0"
] | 9,144 | 2017-10-02T07:12:23.000Z | 2022-03-31T19:16:56.000Z | flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/littemplate/SetInitialTextLitView.java | flyzoner/flow | 3f00a72127a2191eb9b9d884370ca6c1cb2f80bf | [
"Apache-2.0"
] | 167 | 2017-10-11T13:07:29.000Z | 2022-03-22T09:02:42.000Z | 31.069767 | 108 | 0.69985 | 996,542 | package com.vaadin.flow.uitest.ui.littemplate;
import com.vaadin.flow.component.HasComponents;
import com.vaadin.flow.component.Tag;
import com.vaadin.flow.component.dependency.JsModule;
import com.vaadin.flow.component.html.Div;
import com.vaadin.flow.component.html.NativeButton;
import com.vaadin.flow.component.littemplate.LitTemplate;
import com.vaadin.flow.component.polymertemplate.Id;
import com.vaadin.flow.router.Route;
import com.vaadin.flow.uitest.servlet.ViewTestLayout;
@Route(value = "com.vaadin.flow.uitest.ui.littemplate.SetInitialTextLitView", layout = ViewTestLayout.class)
@Tag("set-initial-text-lit")
@JsModule("lit-templates/SetInitialText.js")
public class SetInitialTextLitView extends LitTemplate
implements HasComponents {
@Id("child")
private Div child;
public SetInitialTextLitView() {
// this is no-op since the text is an empty string by default but it
// removes all children
child.setText("");
setId("set-initial-text");
NativeButton button = new NativeButton("Add a new child",
event -> addChild());
button.setId("add-child");
add(button);
}
private void addChild() {
Div div = new Div();
div.setId("new-child");
div.setText("New child");
child.add(div);
}
}
|
92335f0400797e2376ba148c830ab8188e9c7990 | 408 | java | Java | src/main/java/me/nunum/whereami/model/persistance/LocalizationSpamRepository.java | NunuM/where-am-i-server | 8bedc4482a7d798b7d7aafa80f826fa3e8eeae5a | [
"MIT"
] | 9 | 2019-06-28T21:47:21.000Z | 2022-03-16T16:51:20.000Z | src/main/java/me/nunum/whereami/model/persistance/LocalizationSpamRepository.java | NunuM/where-am-i-server | 8bedc4482a7d798b7d7aafa80f826fa3e8eeae5a | [
"MIT"
] | null | null | null | src/main/java/me/nunum/whereami/model/persistance/LocalizationSpamRepository.java | NunuM/where-am-i-server | 8bedc4482a7d798b7d7aafa80f826fa3e8eeae5a | [
"MIT"
] | 2 | 2020-04-26T15:39:54.000Z | 2021-05-11T09:50:23.000Z | 31.384615 | 81 | 0.840686 | 996,543 | package me.nunum.whereami.model.persistance;
import me.nunum.whereami.framework.persistence.repositories.Repository;
import me.nunum.whereami.model.Localization;
import me.nunum.whereami.model.LocalizationSpamReport;
public interface LocalizationSpamRepository
extends Repository<LocalizationSpamReport, Long> {
LocalizationSpamReport findOrCreateByLocalization(Localization localization);
}
|
92335f83dcc4feb14ecb8d9e2053012bc86a30ec | 1,055 | java | Java | critter/src/main/java/com/udacity/jdnd/course3/critter/config/ApplicationConfig.java | chrillen/CritterChronologer | 3401707913f863056b3afe1629159d71b0aa2a0d | [
"MIT"
] | null | null | null | critter/src/main/java/com/udacity/jdnd/course3/critter/config/ApplicationConfig.java | chrillen/CritterChronologer | 3401707913f863056b3afe1629159d71b0aa2a0d | [
"MIT"
] | null | null | null | critter/src/main/java/com/udacity/jdnd/course3/critter/config/ApplicationConfig.java | chrillen/CritterChronologer | 3401707913f863056b3afe1629159d71b0aa2a0d | [
"MIT"
] | null | null | null | 36.37931 | 85 | 0.816114 | 996,544 | package com.udacity.jdnd.course3.critter.config;
import com.udacity.jdnd.course3.critter.entities.Customer;
import com.udacity.jdnd.course3.critter.entities.Pet;
import com.udacity.jdnd.course3.critter.entities.Schedule;
import com.udacity.jdnd.course3.critter.pet.PetDTO;
import com.udacity.jdnd.course3.critter.schedule.ScheduleDTO;
import com.udacity.jdnd.course3.critter.user.CustomerDTO;
import org.modelmapper.ModelMapper;
import org.modelmapper.PropertyMap;
import org.modelmapper.TypeMap;
import org.modelmapper.convention.MatchingStrategies;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import java.security.cert.CollectionCertStoreParameters;
import java.util.List;
import java.util.stream.Collectors;
@Configuration
public class ApplicationConfig {
@Bean
public ModelMapper modelMapper() {
ModelMapper modelMapper = new ModelMapper();
modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.LOOSE);
return modelMapper;
}
}
|
923360b0ac72316b04fa63e00c6594f76fcec700 | 6,066 | java | Java | src/main/java/org/bcos/channel/handler/ChannelHandler.java | shijiaxing-cm/web3sdk | 67279cd6b77f114cb46c93c671cc27824b17bf62 | [
"Apache-2.0"
] | null | null | null | src/main/java/org/bcos/channel/handler/ChannelHandler.java | shijiaxing-cm/web3sdk | 67279cd6b77f114cb46c93c671cc27824b17bf62 | [
"Apache-2.0"
] | null | null | null | src/main/java/org/bcos/channel/handler/ChannelHandler.java | shijiaxing-cm/web3sdk | 67279cd6b77f114cb46c93c671cc27824b17bf62 | [
"Apache-2.0"
] | null | null | null | 29.446602 | 126 | 0.696175 | 996,545 | package org.bcos.channel.handler;
import java.util.concurrent.RejectedExecutionException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;
import io.netty.channel.socket.SocketChannel;
import io.netty.handler.timeout.IdleStateEvent;
public class ChannelHandler extends SimpleChannelInboundHandler<ByteBuf> {
private static Logger logger = LoggerFactory.getLogger(ChannelHandler.class);
@Override
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {
String host = ((SocketChannel) ctx.channel()).remoteAddress().getAddress().getHostAddress();
Integer port = ((SocketChannel) ctx.channel()).remoteAddress().getPort();
if (evt instanceof IdleStateEvent) {
IdleStateEvent e = (IdleStateEvent) evt;
switch (e.state()) {
case READER_IDLE:
case WRITER_IDLE:
case ALL_IDLE:
logger.error("event:{} connect{}:{} long time Inactive,disconnect", e.state(), host, port);
channelInactive(ctx);
ctx.disconnect();
ctx.close();
break;
default:
break;
}
}
}
@Override
public void channelActive(ChannelHandlerContext ctx) throws Exception {
try {
//已连上,获取ip信息
String host = ((SocketChannel)ctx.channel()).remoteAddress().getAddress().getHostAddress();
Integer port = ((SocketChannel)ctx.channel()).remoteAddress().getPort();
logger.debug("success,connected[" + host + "]:[" + String.valueOf(port) + "]," + String.valueOf(ctx.channel().isActive()));
if(isServer) {
logger.debug("server accept new connect: {}:{}", host, port);
//将此新连接增加到connections
ConnectionInfo info = new ConnectionInfo();
info.setHost(host);
info.setPort(port);
connections.getConnections().add(info);
connections.setNetworkConnectionByHost(info.getHost(), info.getPort(), ctx);
connections.getCallback().onConnect(ctx);
}
else {
//更新ctx信息
ChannelHandlerContext connection = connections.getNetworkConnectionByHost(host, port);
if(connection != null && connection.channel().isActive()) {
logger.debug("connect available, close reconnect: {}:{}", host, port);
ctx.channel().disconnect();
ctx.channel().close();
}
else {
logger.debug("client connect success {}:{}", host, port);
connections.setNetworkConnectionByHost(host, port, ctx);
connections.getCallback().onConnect(ctx);
}
}
}
catch(Exception e) {
logger.error("error", e);
}
}
@Override
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
try {
logger.debug("disconnect");
//已断连,获取ip信息
String host = ((SocketChannel)ctx.channel()).remoteAddress().getAddress().getHostAddress();
Integer port = ((SocketChannel)ctx.channel()).remoteAddress().getPort();
logger.debug("disconnect " + host + ":" + String.valueOf(port) + " ," + String.valueOf(ctx.channel().isActive()));
if(isServer) {
//server模式下,移除该connectionInfo
for(Integer i=0; i<connections.getConnections().size(); ++i) {
ConnectionInfo info = connections.getConnections().get(i);
if(info.getHost().equals(host) && info.getPort().equals(port)) {
connections.getConnections().remove(i);
}
}
//移除该networkConnection
connections.removeNetworkConnectionByHost(host, port);
}
else {
//无需将连接置为null
//connections.setNetworkConnection(host, port, null);
}
connections.getCallback().onDisconnect(ctx);
}
catch(Exception e) {
logger.error("error ", e);
}
}
@Override
public void channelRead(ChannelHandlerContext ctx, Object msg) {
String host = ((SocketChannel)ctx.channel()).remoteAddress().getAddress().getHostAddress();
Integer port = ((SocketChannel)ctx.channel()).remoteAddress().getPort();
final ChannelHandlerContext ctxF = ctx;
final ByteBuf in = (ByteBuf)msg;
logger.trace("receive,from" + host + ":" + port + " in:" + in.readableBytes());
logger.trace("threadPool:{}", threadPool == null);
try {
if(threadPool == null) {
connections.onReceiveMessage(ctx, in);
}
else {
threadPool.execute(new Runnable() {
@Override
public void run() {
connections.onReceiveMessage(ctxF, in);
}
});
}
}
catch(RejectedExecutionException e) {
logger.error("threadPool is full,reject to request", e);
}
}
@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
logger.error("network error ", cause);
//已断连,获取ip信息
String host = ((SocketChannel)ctx.channel()).remoteAddress().getAddress().getHostAddress();
Integer port = ((SocketChannel)ctx.channel()).remoteAddress().getPort();
logger.debug("disconnect " + host + ":" + String.valueOf(port) + " ," + String.valueOf(ctx.channel().isActive()));
if(isServer) {
//server模式下,移除该connection
connections.removeNetworkConnectionByHost(host, port);
}
else {
//将该连接置为不可用
//connections.setNetworkConnection(host, port, null);
}
ctx.disconnect();
ctx.close();
}
@Override
protected void channelRead0(ChannelHandlerContext ctx, ByteBuf in) throws Exception {
channelRead(ctx, in);
}
public void checkAvailable(ChannelHandlerContext ctx) {
}
public ChannelConnections getConnections() {
return connections;
}
public void setConnections(ChannelConnections connections) {
this.connections = connections;
}
public Boolean getIsServer() {
return isServer;
}
public void setIsServer(Boolean isServer) {
this.isServer = isServer;
}
public ThreadPoolTaskExecutor getThreadPool() {
return threadPool;
}
public void setThreadPool(ThreadPoolTaskExecutor threadPool) {
this.threadPool = threadPool;
logger.debug("set threadPool:{}", threadPool == null);
}
private ChannelConnections connections;
private Boolean isServer = false;
private ThreadPoolTaskExecutor threadPool;
}
|
92336249f015c37099ef61461f92e12b28c443ff | 467 | java | Java | Home/homelibrary/src/main/java/de/fimatas/home/library/homematic/model/HomematicProtocol.java | mfis/Home | 7cbf3d07fc24611da9b229b0e48fe9633b52be09 | [
"MIT"
] | null | null | null | Home/homelibrary/src/main/java/de/fimatas/home/library/homematic/model/HomematicProtocol.java | mfis/Home | 7cbf3d07fc24611da9b229b0e48fe9633b52be09 | [
"MIT"
] | 15 | 2020-05-22T17:05:45.000Z | 2020-09-27T17:09:31.000Z | Home/homelibrary/src/main/java/de/fimatas/home/library/homematic/model/HomematicProtocol.java | mfis/Home | 7cbf3d07fc24611da9b229b0e48fe9633b52be09 | [
"MIT"
] | null | null | null | 21.227273 | 76 | 0.618844 | 996,546 | package de.fimatas.home.library.homematic.model;
public enum HomematicProtocol {
HM("BidCos"), HMIP("HmIP"), SYSVAR("SysVar");
private String key;
public static final String RF = "RF";
private HomematicProtocol(String protocol) {
this.key = protocol;
}
public String toHistorianString() {
return key.toUpperCase() + (key.equals(SYSVAR.key) ? "" : "_" + RF);
}
public String getKey() {
return key;
}
} |
923363156b943cb825c5bc821a05820f428bcc2c | 1,630 | java | Java | src/test/java/adrninistrator/test/testmock/other/TestSetPrivateField.java | Adrninistrator/UnitTest | e93081fe50fa9bdbd0602e7f8ada150c4c4a2f3f | [
"Apache-2.0"
] | 5 | 2020-10-26T12:38:25.000Z | 2021-12-17T08:30:04.000Z | src/test/java/adrninistrator/test/testmock/other/TestSetPrivateField.java | Adrninistrator/UnitTest | e93081fe50fa9bdbd0602e7f8ada150c4c4a2f3f | [
"Apache-2.0"
] | null | null | null | src/test/java/adrninistrator/test/testmock/other/TestSetPrivateField.java | Adrninistrator/UnitTest | e93081fe50fa9bdbd0602e7f8ada150c4c4a2f3f | [
"Apache-2.0"
] | null | null | null | 33.265306 | 99 | 0.727607 | 996,547 | package adrninistrator.test.testmock.other;
import adrninistrator.test.testmock.base.TestMockNoSpBase;
import com.adrninistrator.common.constants.TestConstants;
import com.adrninistrator.non_static.TestNonStatic1;
import com.adrninistrator.non_static.TestNonStatic2;
import org.junit.Test;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.reflect.Whitebox;
import static org.junit.Assert.assertEquals;
// 替换私有成员变量
public class TestSetPrivateField extends TestMockNoSpBase {
@Test
public void test1() throws IllegalAccessException {
TestNonStatic2 testNonStatic2 = new TestNonStatic2();
PowerMockito.field(TestNonStatic2.class, "flag").set(testNonStatic2, TestConstants.FLAG1);
assertEquals(TestConstants.FLAG1, testNonStatic2.getFlag());
// 指定变量类型进行替换
Whitebox.setInternalState(testNonStatic2, String.class, TestConstants.FLAG2);
assertEquals(TestConstants.FLAG2, testNonStatic2.getFlag());
// 直接指定变量进行替换
Whitebox.setInternalState(testNonStatic2, TestConstants.FLAG3);
assertEquals(TestConstants.FLAG3, testNonStatic2.getFlag());
}
@Test
public void test2() {
TestNonStatic1 testNonStatic1 = new TestNonStatic1();
// 指定变量名称进行替换
Whitebox.setInternalState(testNonStatic1, "str1", TestConstants.FLAG1);
Whitebox.setInternalState(testNonStatic1, "str2", TestConstants.FLAG2);
String value = testNonStatic1.getValue();
assertEquals(TestConstants.FLAG1 + TestConstants.MINUS + TestConstants.FLAG2, value);
}
}
|
9233636dedd50b0c0ae40f4066a0123810112de9 | 229 | java | Java | JavaDesignPattern/src/StrategyPattern1/Main.java | ParkHyeokJin/HelloJavaWorld | 5df76d4958bd2a30ca200635943ee6adb5eabac7 | [
"MIT"
] | null | null | null | JavaDesignPattern/src/StrategyPattern1/Main.java | ParkHyeokJin/HelloJavaWorld | 5df76d4958bd2a30ca200635943ee6adb5eabac7 | [
"MIT"
] | null | null | null | JavaDesignPattern/src/StrategyPattern1/Main.java | ParkHyeokJin/HelloJavaWorld | 5df76d4958bd2a30ca200635943ee6adb5eabac7 | [
"MIT"
] | null | null | null | 13.470588 | 47 | 0.641921 | 996,548 | package StrategyPattern1;
public class Main {
public static void main(String[] args) {
Ainterface ainterface = new AinterfaceImpl();
//통로
//ainterface.funcA();
AObj aObj = new AObj();
aObj.funcAA();
}
}
|
923363b446d01149cf11c3f44fc7c1db71c914bf | 5,600 | java | Java | aliyun-java-sdk-trademark-inner/src/main/java/com/aliyuncs/trademark_inner/model/v20180801/TrademarkSearchResponse.java | sjj3086786/aliyun-openapi-java-sdk | fd2d79bd1b5cca35ef789f7090861b3bf2e7debe | [
"Apache-2.0"
] | 2 | 2021-05-04T07:01:43.000Z | 2021-05-04T07:01:49.000Z | aliyun-java-sdk-trademark-inner/src/main/java/com/aliyuncs/trademark_inner/model/v20180801/TrademarkSearchResponse.java | sjj3086786/aliyun-openapi-java-sdk | fd2d79bd1b5cca35ef789f7090861b3bf2e7debe | [
"Apache-2.0"
] | null | null | null | aliyun-java-sdk-trademark-inner/src/main/java/com/aliyuncs/trademark_inner/model/v20180801/TrademarkSearchResponse.java | sjj3086786/aliyun-openapi-java-sdk | fd2d79bd1b5cca35ef789f7090861b3bf2e7debe | [
"Apache-2.0"
] | null | null | null | 20.289855 | 92 | 0.698036 | 996,549 | /*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.aliyuncs.trademark_inner.model.v20180801;
import java.util.List;
import com.aliyuncs.AcsResponse;
import com.aliyuncs.trademark_inner.transform.v20180801.TrademarkSearchResponseUnmarshaller;
import com.aliyuncs.transform.UnmarshallerContext;
/**
* @author auto create
* @version
*/
public class TrademarkSearchResponse extends AcsResponse {
private String requestId;
private Integer totalItemNum;
private Integer currentPageNum;
private Integer pageSize;
private Integer totalPageNum;
private Boolean prePage;
private Boolean nextPage;
private List<Trademark> data;
public String getRequestId() {
return this.requestId;
}
public void setRequestId(String requestId) {
this.requestId = requestId;
}
public Integer getTotalItemNum() {
return this.totalItemNum;
}
public void setTotalItemNum(Integer totalItemNum) {
this.totalItemNum = totalItemNum;
}
public Integer getCurrentPageNum() {
return this.currentPageNum;
}
public void setCurrentPageNum(Integer currentPageNum) {
this.currentPageNum = currentPageNum;
}
public Integer getPageSize() {
return this.pageSize;
}
public void setPageSize(Integer pageSize) {
this.pageSize = pageSize;
}
public Integer getTotalPageNum() {
return this.totalPageNum;
}
public void setTotalPageNum(Integer totalPageNum) {
this.totalPageNum = totalPageNum;
}
public Boolean getPrePage() {
return this.prePage;
}
public void setPrePage(Boolean prePage) {
this.prePage = prePage;
}
public Boolean getNextPage() {
return this.nextPage;
}
public void setNextPage(Boolean nextPage) {
this.nextPage = nextPage;
}
public List<Trademark> getData() {
return this.data;
}
public void setData(List<Trademark> data) {
this.data = data;
}
public static class Trademark {
private Long id;
private String uid;
private String name;
private String registrationNumber;
private String classification;
private String applyDate;
private String ownerName;
private String ownerEnName;
private String image;
private String product;
private String preAnnNum;
private String regAnnNum;
private String preAnnDate;
private String regAnnDate;
private Integer status;
private String lastProcedureStatus;
public Long getId() {
return this.id;
}
public void setId(Long id) {
this.id = id;
}
public String getUid() {
return this.uid;
}
public void setUid(String uid) {
this.uid = uid;
}
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
}
public String getRegistrationNumber() {
return this.registrationNumber;
}
public void setRegistrationNumber(String registrationNumber) {
this.registrationNumber = registrationNumber;
}
public String getClassification() {
return this.classification;
}
public void setClassification(String classification) {
this.classification = classification;
}
public String getApplyDate() {
return this.applyDate;
}
public void setApplyDate(String applyDate) {
this.applyDate = applyDate;
}
public String getOwnerName() {
return this.ownerName;
}
public void setOwnerName(String ownerName) {
this.ownerName = ownerName;
}
public String getOwnerEnName() {
return this.ownerEnName;
}
public void setOwnerEnName(String ownerEnName) {
this.ownerEnName = ownerEnName;
}
public String getImage() {
return this.image;
}
public void setImage(String image) {
this.image = image;
}
public String getProduct() {
return this.product;
}
public void setProduct(String product) {
this.product = product;
}
public String getPreAnnNum() {
return this.preAnnNum;
}
public void setPreAnnNum(String preAnnNum) {
this.preAnnNum = preAnnNum;
}
public String getRegAnnNum() {
return this.regAnnNum;
}
public void setRegAnnNum(String regAnnNum) {
this.regAnnNum = regAnnNum;
}
public String getPreAnnDate() {
return this.preAnnDate;
}
public void setPreAnnDate(String preAnnDate) {
this.preAnnDate = preAnnDate;
}
public String getRegAnnDate() {
return this.regAnnDate;
}
public void setRegAnnDate(String regAnnDate) {
this.regAnnDate = regAnnDate;
}
public Integer getStatus() {
return this.status;
}
public void setStatus(Integer status) {
this.status = status;
}
public String getLastProcedureStatus() {
return this.lastProcedureStatus;
}
public void setLastProcedureStatus(String lastProcedureStatus) {
this.lastProcedureStatus = lastProcedureStatus;
}
}
@Override
public TrademarkSearchResponse getInstance(UnmarshallerContext context) {
return TrademarkSearchResponseUnmarshaller.unmarshall(this, context);
}
}
|
923363ef8edf0d6b530d913c443aa9f0d60b8bab | 1,608 | java | Java | src/main/java/logbook/plugin/apiviewer/data/APIContainerWrapper.java | sanaehirotaka/logbook-api-viewer-plugin | 6e48457855c5e2ff110e4cd202f04fa76114c68b | [
"MIT"
] | 2 | 2017-11-11T11:41:21.000Z | 2020-03-02T09:28:49.000Z | src/main/java/logbook/plugin/apiviewer/data/APIContainerWrapper.java | sanaehirotaka/logbook-api-viewer-plugin | 6e48457855c5e2ff110e4cd202f04fa76114c68b | [
"MIT"
] | null | null | null | src/main/java/logbook/plugin/apiviewer/data/APIContainerWrapper.java | sanaehirotaka/logbook-api-viewer-plugin | 6e48457855c5e2ff110e4cd202f04fa76114c68b | [
"MIT"
] | null | null | null | 27.724138 | 77 | 0.645522 | 996,550 | package logbook.plugin.apiviewer.data;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.zip.DeflaterOutputStream;
import java.util.zip.InflaterInputStream;
import logbook.plugin.apiviewer.bean.APIContainer;
import lombok.Getter;
public class APIContainerWrapper {
@Getter
private String date;
@Getter
private String time;
@Getter
private String uri;
private byte[] container;
public APIContainerWrapper(APIContainer container) {
this.date = container.getDate();
this.time = container.getTime();
this.uri = container.getUri();
ByteArrayOutputStream base = new ByteArrayOutputStream();
try (DeflaterOutputStream zout = new DeflaterOutputStream(base)) {
try (ObjectOutputStream oout = new ObjectOutputStream(zout)) {
oout.writeObject(container);
}
} catch (Exception e) {
// NOP
}
this.container = base.toByteArray();
}
public APIContainer unwrap() {
ByteArrayInputStream base = new ByteArrayInputStream(this.container);
try (InflaterInputStream zin = new InflaterInputStream(base)) {
try (ObjectInputStream oin = new ObjectInputStream(zin)) {
return (APIContainer) oin.readObject();
}
} catch (Exception e) {
// NOP
}
return null;
}
@Override
public String toString() {
return "[" + this.time + "] " + this.uri;
}
}
|
9233641de92c68a76592bd335002f095ddb11833 | 1,316 | java | Java | src/main/java/guru/springframework/Money.java | stujar/tdd-by-example | cf0ff0e9842a21195dc1671479d63079b68483bd | [
"Apache-2.0"
] | null | null | null | src/main/java/guru/springframework/Money.java | stujar/tdd-by-example | cf0ff0e9842a21195dc1671479d63079b68483bd | [
"Apache-2.0"
] | null | null | null | src/main/java/guru/springframework/Money.java | stujar/tdd-by-example | cf0ff0e9842a21195dc1671479d63079b68483bd | [
"Apache-2.0"
] | null | null | null | 22.689655 | 78 | 0.591185 | 996,551 | package guru.springframework;
/*
Author: jalnor
Date: 7/5/2021 8:06 AM
Project: guru.springframework
*/
public class Money implements Expression {
protected final int amount;
protected final String currency;
public Money(int amount, String currency) {
this.amount = amount;
this.currency = currency;
}
protected String currency() {
return currency;
}
static Money dollar(int amount) {
return new Money(amount, "USD");
}
static Money franc(int amount) {
return new Money(amount, "CHF");
}
public boolean equals(Object object) {
Money money = (Money) object;
return amount == money.amount && this.currency.equals(money.currency);
}
@Override
public Money reduce(Bank bank, String to) {
return new Money(amount / bank.rate(this.currency, to), to);
}
@Override
public String toString() {
return "Money{" +
"amount=" + amount +
", currency='" + currency + '\'' +
'}';
}
@Override
public Expression times(int multiplier) {
return new Money(amount * multiplier, this.currency);
}
@Override
public Expression plus(Expression addend) {
return new Sum(this, addend);
}
}
|
9233642642c9bda172f527c20e32edfc8176c05b | 973 | java | Java | wint-framework/src/main/java/wint/lang/magic/cglib/CglibUtil.java | pister/wint | a06eb7ddaac85ce0474ead87b3e8d8ed2cb8e637 | [
"Apache-2.0"
] | 24 | 2015-01-08T14:25:11.000Z | 2019-12-06T06:43:33.000Z | wint-framework/src/main/java/wint/lang/magic/cglib/CglibUtil.java | pister/wint | a06eb7ddaac85ce0474ead87b3e8d8ed2cb8e637 | [
"Apache-2.0"
] | 5 | 2016-01-14T09:14:43.000Z | 2020-03-09T16:17:15.000Z | wint-framework/src/main/java/wint/lang/magic/cglib/CglibUtil.java | pister/wint | a06eb7ddaac85ce0474ead87b3e8d8ed2cb8e637 | [
"Apache-2.0"
] | 16 | 2015-07-03T02:55:14.000Z | 2020-02-11T14:43:27.000Z | 28.617647 | 107 | 0.716341 | 996,552 | package wint.lang.magic.cglib;
import wint.lang.utils.ClassUtil;
public class CglibUtil {
private static final String CGLIB_TOKEN = "$$EnhancerByCGLIB$$";
public static Class<?> getJavaClass(String cglibProxyClassName) {
String className = cglibProxyClassName;
int pos = className.indexOf(CGLIB_TOKEN);
if (pos < 0) {
return ClassUtil.forName(className);
}
String javaClassName = className.substring(0, pos);
return ClassUtil.forName(javaClassName);
}
public static Class<?> getJavaClass(Class<?> cglibProxyClass) {
String className = cglibProxyClass.getName();
int pos = className.indexOf(CGLIB_TOKEN);
if (pos < 0) {
return cglibProxyClass;
}
String javaClassName = className.substring(0, pos);
return ClassUtil.forName(javaClassName);
}
public static void main(String[] args) {
System.out.println(getJavaClass("wint.mvc.pipeline.DefaultPipelineService$$EnhancerByCGLIB$$960649a7"));
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.