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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
3e1128fdbbf1f3c74d7d00ad673b28af7d14a6ac | 1,665 | java | Java | app/src/main/java/kale/selectorinjection/MainActivity.java | tianzhijiexian/SelectorInjection | c875ab99cb0f9dca17975676147b986a4a6b0ab4 | [
"Apache-2.0"
] | 712 | 2015-05-27T14:57:49.000Z | 2021-12-21T16:02:44.000Z | app/src/main/java/kale/selectorinjection/MainActivity.java | tianzhijiexian/SelectorInjection | c875ab99cb0f9dca17975676147b986a4a6b0ab4 | [
"Apache-2.0"
] | 11 | 2016-04-21T11:07:19.000Z | 2018-10-11T06:03:57.000Z | app/src/main/java/kale/selectorinjection/MainActivity.java | tianzhijiexian/SelectorInjection | c875ab99cb0f9dca17975676147b986a4a6b0ab4 | [
"Apache-2.0"
] | 86 | 2015-05-28T02:21:07.000Z | 2022-03-01T08:34:56.000Z | 29.732143 | 89 | 0.637237 | 7,233 | package kale.selectorinjection;
import java.util.Arrays;
import java.util.List;
import android.graphics.Color;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentStatePagerAdapter;
import android.support.v4.view.PagerTitleStrip;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
PagerTitleStrip pagerTitleStrip = findViewById(R.id.pager_strip);
pagerTitleStrip.setTextColor(Color.WHITE);
ViewPager viewPager = findViewById(R.id.viewpager);
final List<BaseFragment> fragments = Arrays.asList(
new ImageFragment(),
new RadioFragment(),
new ButtonActivity(),
new TextFragment(),
new RippleFragment(),
new SvgFragment()
);
viewPager.setAdapter(new FragmentStatePagerAdapter(getSupportFragmentManager()) {
@Override
public Fragment getItem(int position) {
return fragments.get(position);
}
@Nullable
@Override
public CharSequence getPageTitle(int position) {
return fragments.get(position).getName();
}
@Override
public int getCount() {
return fragments.size();
}
});
}
}
|
3e1129876fb0bc6544e03ff3217920f1b15941ae | 799 | java | Java | nm-demo/springCloudAlibaba/spring-cloud-gateway/spring-cloud-gateway8001/src/main/java/com/demo/gateway8001/controller/DemoController.java | gl-stars/small-study-case | 9456b7aa459bc945f254d7b54093e1301e0948fa | [
"Apache-2.0"
] | 1 | 2022-02-06T04:37:22.000Z | 2022-02-06T04:37:22.000Z | nm-demo/springCloudAlibaba/spring-cloud-gateway/spring-cloud-gateway8001/src/main/java/com/demo/gateway8001/controller/DemoController.java | gl-stars/small-study-case | 9456b7aa459bc945f254d7b54093e1301e0948fa | [
"Apache-2.0"
] | null | null | null | nm-demo/springCloudAlibaba/spring-cloud-gateway/spring-cloud-gateway8001/src/main/java/com/demo/gateway8001/controller/DemoController.java | gl-stars/small-study-case | 9456b7aa459bc945f254d7b54093e1301e0948fa | [
"Apache-2.0"
] | 2 | 2021-01-28T09:15:17.000Z | 2022-02-11T02:58:06.000Z | 22.194444 | 62 | 0.685857 | 7,234 | package com.demo.gateway8001.controller;
import com.demo.gateway8001.service.PaymentFeignService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @author: gl_stars
* @data: 2020年 10月 14日 13:49
**/
@RestController
public class DemoController {
@Autowired
private PaymentFeignService paymentFeignService ;
@GetMapping("/find")
public String find(){
return "可以访问到了吗?8001";
}
@GetMapping("/list")
public String list(){
return "这里应该是没有问题的吧8001";
}
/***
* 测试 OpenFeign 调用
* @return
*/
@GetMapping("/user")
public String user(){
return paymentFeignService.user();
}
}
|
3e1129d2acc5820f59f508649ced13962544e111 | 12,064 | java | Java | openjdk11/test/jaxp/javax/xml/jaxp/unittest/datatype/Bug6937964Test.java | iootclab/openjdk | b01fc962705eadfa96def6ecff46c44d522e0055 | [
"Apache-2.0"
] | 2 | 2018-06-19T05:43:32.000Z | 2018-06-23T10:04:56.000Z | test/jaxp/javax/xml/jaxp/unittest/datatype/Bug6937964Test.java | desiyonan/OpenJDK8 | 74d4f56b6312c303642e053e5d428b44cc8326c5 | [
"MIT"
] | null | null | null | test/jaxp/javax/xml/jaxp/unittest/datatype/Bug6937964Test.java | desiyonan/OpenJDK8 | 74d4f56b6312c303642e053e5d428b44cc8326c5 | [
"MIT"
] | null | null | null | 44.190476 | 161 | 0.611986 | 7,235 | /*
* Copyright (c) 2014, 2016, 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.
*/
package datatype;
import java.math.BigDecimal;
import java.math.BigInteger;
import javax.xml.datatype.DatatypeConfigurationException;
import javax.xml.datatype.DatatypeConstants;
import javax.xml.datatype.DatatypeFactory;
import javax.xml.datatype.Duration;
import javax.xml.namespace.QName;
import org.testng.Assert;
import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
* @test
* @bug 6937964
* @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
* @run testng/othervm -DrunSecMngr=true datatype.Bug6937964Test
* @run testng/othervm datatype.Bug6937964Test
* @summary Test Duration is normalized.
*/
@Listeners({jaxp.library.BasePolicy.class})
public class Bug6937964Test {
/**
* Print debugging to System.err.
*/
private static final boolean DEBUG = false;
/**
* Constant to indicate expected lexical test failure.
*/
private static final String TEST_VALUE_FAIL = "*FAIL*";
private static final String FIELD_UNDEFINED = "FIELD_UNDEFINED";
static final DatatypeConstants.Field[] fields = { DatatypeConstants.YEARS, DatatypeConstants.MONTHS, DatatypeConstants.DAYS, DatatypeConstants.HOURS,
DatatypeConstants.MINUTES, DatatypeConstants.SECONDS };
@Test
public void test() throws DatatypeConfigurationException {
DatatypeFactory dtf = DatatypeFactory.newInstance();
Duration d = dtf.newDurationYearMonth("P20Y15M");
int years = d.getYears();
System.out.println(d.getYears() == 21 ? "pass" : "fail");
}
@Test
public void testNewDurationYearMonthLexicalRepresentation() throws DatatypeConfigurationException {
DatatypeFactory dtf = DatatypeFactory.newInstance();
Duration d = dtf.newDurationYearMonth("P20Y15M");
int years = d.getYears();
Assert.assertTrue(years == 21, "Return value should be normalized");
}
@Test
public void testNewDurationYearMonthMilliseconds() throws DatatypeConfigurationException {
DatatypeFactory dtf = DatatypeFactory.newInstance();
Duration d = dtf.newDurationYearMonth(671976000000L);
int years = d.getYears();
System.out.println("Years: " + years);
Assert.assertTrue(years == 21, "Return value should be normalized");
}
@Test
public void testNewDurationYearMonthBigInteger() throws DatatypeConfigurationException {
DatatypeFactory dtf = DatatypeFactory.newInstance();
BigInteger year = new BigInteger("20");
BigInteger mon = new BigInteger("15");
Duration d = dtf.newDurationYearMonth(true, year, mon);
int years = d.getYears();
Assert.assertTrue(years == 21, "Return value should be normalized");
}
@Test
public void testNewDurationYearMonthInt() throws DatatypeConfigurationException {
DatatypeFactory dtf = DatatypeFactory.newInstance();
Duration d = dtf.newDurationYearMonth(true, 20, 15);
int years = d.getYears();
Assert.assertTrue(years == 21, "Return value should be normalized");
}
@Test
public void testNewDurationDayTimeLexicalRepresentation() throws DatatypeConfigurationException {
DatatypeFactory dtf = DatatypeFactory.newInstance();
Duration d = dtf.newDurationDayTime("P1DT23H59M65S");
int days = d.getDays();
Assert.assertTrue(days == 2, "Return value should be normalized");
}
@Test
public void testNewDurationDayTimeMilliseconds() throws DatatypeConfigurationException {
DatatypeFactory dtf = DatatypeFactory.newInstance();
Duration d = dtf.newDurationDayTime(172805000L);
int days = d.getDays();
Assert.assertTrue(days == 2, "Return value should be normalized");
}
@Test
public void testNewDurationDayTimeBigInteger() throws DatatypeConfigurationException {
DatatypeFactory dtf = DatatypeFactory.newInstance();
BigInteger day = new BigInteger("1");
BigInteger hour = new BigInteger("23");
BigInteger min = new BigInteger("59");
BigInteger sec = new BigInteger("65");
Duration d = dtf.newDurationDayTime(true, day, hour, min, sec);
int days = d.getDays();
System.out.println("Days: " + days);
Assert.assertTrue(days == 2, "Return value should be normalized");
}
@Test
public void testNewDurationDayTimeInt() throws DatatypeConfigurationException {
DatatypeFactory dtf = DatatypeFactory.newInstance();
Duration d = dtf.newDurationDayTime(true, 1, 23, 59, 65);
int days = d.getDays();
System.out.println("Days: " + days);
Assert.assertTrue(days == 2, "Return value should be normalized");
}
@Test
public final void testNewDurationYearMonthLexicalRepresentation1() {
/**
* Lexical test values to test.
*/
final String[] TEST_VALUES_LEXICAL = { "P13M", "P1Y1M", "-P13M", "-P1Y1M", "P1Y", "P1Y", "-P1Y", "-P1Y", "P1Y25M", "P3Y1M", "-P1Y25M", "-P3Y1M" };
DatatypeFactory datatypeFactory = null;
try {
datatypeFactory = DatatypeFactory.newInstance();
} catch (DatatypeConfigurationException datatypeConfigurationException) {
Assert.fail(datatypeConfigurationException.toString());
}
if (DEBUG) {
System.err.println("DatatypeFactory created: " + datatypeFactory.toString());
}
// test each value
for (int onTestValue = 0; onTestValue < TEST_VALUES_LEXICAL.length; onTestValue = onTestValue + 2) {
if (DEBUG) {
System.err.println("testing value: \"" + TEST_VALUES_LEXICAL[onTestValue] + "\", expecting: \"" + TEST_VALUES_LEXICAL[onTestValue + 1] + "\"");
}
try {
Duration duration = datatypeFactory.newDurationYearMonth(TEST_VALUES_LEXICAL[onTestValue]);
if (DEBUG) {
System.err.println("Duration created: \"" + duration.toString() + "\"");
}
// was this expected to fail?
if (TEST_VALUES_LEXICAL[onTestValue + 1].equals(TEST_VALUE_FAIL)) {
Assert.fail("the value \"" + TEST_VALUES_LEXICAL[onTestValue] + "\" is invalid yet it created the Duration \"" + duration.toString() + "\"");
}
// right XMLSchemaType?
// TODO: enable test, it should pass, it fails with Exception(s)
// for now due to a bug
try {
QName xmlSchemaType = duration.getXMLSchemaType();
if (!xmlSchemaType.equals(DatatypeConstants.DURATION_YEARMONTH)) {
Assert.fail("Duration created with XMLSchemaType of\"" + xmlSchemaType + "\" was expected to be \""
+ DatatypeConstants.DURATION_YEARMONTH + "\" and has the value \"" + duration.toString() + "\"");
}
} catch (IllegalStateException illegalStateException) {
// TODO; this test really should pass
System.err.println("Please fix this bug that is being ignored, for now: " + illegalStateException.getMessage());
}
// does it have the right value?
if (!TEST_VALUES_LEXICAL[onTestValue + 1].equals(duration.toString())) {
Assert.fail("Duration created with \"" + TEST_VALUES_LEXICAL[onTestValue] + "\" was expected to be \""
+ TEST_VALUES_LEXICAL[onTestValue + 1] + "\" and has the value \"" + duration.toString() + "\"");
}
// Duration created with correct value
} catch (Exception exception) {
if (DEBUG) {
System.err.println("Exception in creating duration: \"" + exception.toString() + "\"");
}
// was this expected to succed?
if (!TEST_VALUES_LEXICAL[onTestValue + 1].equals(TEST_VALUE_FAIL)) {
Assert.fail("the value \"" + TEST_VALUES_LEXICAL[onTestValue] + "\" is valid yet it failed with \"" + exception.toString() + "\"");
}
// expected failure
}
}
}
/**
* TCK test failure
*/
@Test
public void testNewDurationDayTime005() {
BigInteger one = new BigInteger("1");
BigInteger zero = new BigInteger("0");
BigDecimal bdZero = new BigDecimal("0");
BigDecimal bdOne = new BigDecimal("1");
Object[][] values = {
// lex, isPositive, years, month, days, hours, minutes, seconds
{ "P1D", Boolean.TRUE, null, null, one, zero, zero, bdZero }, { "PT1H", Boolean.TRUE, null, null, zero, one, zero, bdZero },
{ "PT1M", Boolean.TRUE, null, null, zero, zero, one, bdZero }, { "PT1.1S", Boolean.TRUE, null, null, zero, zero, zero, bdOne },
{ "-PT1H1.1S", Boolean.FALSE, null, null, zero, one, zero, bdOne }, };
StringBuffer result = new StringBuffer();
DatatypeFactory df = null;
try {
df = DatatypeFactory.newInstance();
} catch (DatatypeConfigurationException e) {
Assert.fail(e.toString());
}
for (int valueIndex = 0; valueIndex < values.length; ++valueIndex) {
Duration duration = null;
try {
duration = df.newDurationDayTime(values[valueIndex][1].equals(Boolean.TRUE), ((BigInteger) values[valueIndex][4]).intValue(),
((BigInteger) values[valueIndex][5]).intValue(), ((BigInteger) values[valueIndex][6]).intValue(),
((BigDecimal) values[valueIndex][7]).intValue());
} catch (IllegalArgumentException e) {
result.append("; unexpected " + e + " trying to create duration \'" + values[valueIndex][0] + "\'");
}
if (duration != null) {
if ((duration.getSign() == 1) != values[valueIndex][1].equals(Boolean.TRUE)) {
result.append("; " + values[valueIndex][0] + ": wrong sign " + duration.getSign() + ", expected " + values[valueIndex][1]);
}
for (int i = 0; i < fields.length; ++i) {
Number value = duration.getField(fields[i]);
if ((value != null && values[valueIndex][2 + i] == null) || (value == null && values[valueIndex][2 + i] != null)
|| (value != null && !value.equals(values[valueIndex][2 + i]))) {
result.append("; " + values[valueIndex][0] + ": wrong value of the field " + fields[i] + ": \'" + value + "\'" + ", expected \'"
+ values[valueIndex][2 + i] + "\'");
}
}
}
}
if (result.length() > 0) {
Assert.fail(result.substring(2));
}
System.out.println("OK");
}
}
|
3e112a2894094189f61b94ba6c62e5151424601f | 2,304 | java | Java | app/src/main/java/com/example/vroch/hubuece/activities/WeekDayMenuActivity.java | hubuece/hubuece | 47ca01c9e475c9981b82447128c5b5f99d144acf | [
"MIT"
] | null | null | null | app/src/main/java/com/example/vroch/hubuece/activities/WeekDayMenuActivity.java | hubuece/hubuece | 47ca01c9e475c9981b82447128c5b5f99d144acf | [
"MIT"
] | null | null | null | app/src/main/java/com/example/vroch/hubuece/activities/WeekDayMenuActivity.java | hubuece/hubuece | 47ca01c9e475c9981b82447128c5b5f99d144acf | [
"MIT"
] | null | null | null | 30.72 | 111 | 0.705729 | 7,236 | package com.example.vroch.hubuece.activities;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.ListView;
import com.example.vroch.hubuece.R;
import com.example.vroch.hubuece.adapters.ListViewMenuDayAdapter;
import com.example.vroch.hubuece.data.model.WeekDay;
import com.example.vroch.hubuece.dialogs.RateDialog;
import java.io.Serializable;
public class WeekDayMenuActivity extends AppCompatActivity implements RateDialog.OnRateDialogFinishedListener {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_week_day_menu);
WeekDay itemClicked = (WeekDay) getIntent().getSerializableExtra("itemClicked");
ListViewMenuDayAdapter listViewMenuDayAdapter = new ListViewMenuDayAdapter(this,itemClicked.menu);
ListView listView = (ListView) findViewById(R.id.list_view_menu_day);
listView.setAdapter(listViewMenuDayAdapter);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setTitle(itemClicked.dayName+" "+itemClicked.date);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.activity_menu_day,menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
this.finish();
break;
case R.id.item_rate:
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
Fragment prev = getSupportFragmentManager().findFragmentByTag("dialog");
RateDialog rateDialog = new RateDialog();
rateDialog.setOnRateDialogFinishedListener(this);
rateDialog.show(ft,"dialog");
break;
}
return super.onOptionsItemSelected(item);
}
@Override
public void onRateDialogSave(String comment, float rating) {
Log.i("Comment: ",comment);
}
}
|
3e112b09ace78cfc1e7a41a0cd06155340bb4ace | 596 | java | Java | tally-web/src/main/java/org/ringr/tally/dto/UserDetail.java | ptzhuf/tally-platform | eb803b16961ad4e49750d9862c897d3b62bef904 | [
"MIT"
] | null | null | null | tally-web/src/main/java/org/ringr/tally/dto/UserDetail.java | ptzhuf/tally-platform | eb803b16961ad4e49750d9862c897d3b62bef904 | [
"MIT"
] | null | null | null | tally-web/src/main/java/org/ringr/tally/dto/UserDetail.java | ptzhuf/tally-platform | eb803b16961ad4e49750d9862c897d3b62bef904 | [
"MIT"
] | null | null | null | 14.190476 | 46 | 0.644295 | 7,237 | /**
*
*/
package org.ringr.tally.dto;
/**
* @author ptzhuf
*
*/
public class UserDetail {
private String id;
private String name;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("UserDetail [id=");
builder.append(id);
builder.append(", name=");
builder.append(name);
builder.append("]");
return builder.toString();
}
}
|
3e112b8709c49b4b7a11e79e8787b5abe37674ee | 2,804 | java | Java | cdt-java-client/src/main/java/com/github/kklisura/cdt/protocol/types/runtime/ExecutionContextDescription.java | sinaa/chrome-devtools-java-client | 5123704e373059460314e8411cfe22686ce4ed45 | [
"Apache-2.0"
] | 165 | 2018-04-22T09:09:53.000Z | 2022-03-22T13:01:37.000Z | cdt-java-client/src/main/java/com/github/kklisura/cdt/protocol/types/runtime/ExecutionContextDescription.java | sinaa/chrome-devtools-java-client | 5123704e373059460314e8411cfe22686ce4ed45 | [
"Apache-2.0"
] | 58 | 2018-07-03T08:06:38.000Z | 2022-03-30T05:13:34.000Z | cdt-java-client/src/main/java/com/github/kklisura/cdt/protocol/types/runtime/ExecutionContextDescription.java | sinaa/chrome-devtools-java-client | 5123704e373059460314e8411cfe22686ce4ed45 | [
"Apache-2.0"
] | 52 | 2018-07-03T07:43:57.000Z | 2022-03-24T02:57:13.000Z | 26.961538 | 100 | 0.704351 | 7,238 | package com.github.kklisura.cdt.protocol.types.runtime;
/*-
* #%L
* cdt-java-client
* %%
* Copyright (C) 2018 - 2021 Kenan Klisura
* %%
* 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 com.github.kklisura.cdt.protocol.support.annotations.Experimental;
import com.github.kklisura.cdt.protocol.support.annotations.Optional;
import java.util.Map;
/** Description of an isolated world. */
public class ExecutionContextDescription {
private Integer id;
private String origin;
private String name;
@Experimental private String uniqueId;
@Optional private Map<String, Object> auxData;
/**
* Unique id of the execution context. It can be used to specify in which execution context script
* evaluation should be performed.
*/
public Integer getId() {
return id;
}
/**
* Unique id of the execution context. It can be used to specify in which execution context script
* evaluation should be performed.
*/
public void setId(Integer id) {
this.id = id;
}
/** Execution context origin. */
public String getOrigin() {
return origin;
}
/** Execution context origin. */
public void setOrigin(String origin) {
this.origin = origin;
}
/** Human readable name describing given context. */
public String getName() {
return name;
}
/** Human readable name describing given context. */
public void setName(String name) {
this.name = name;
}
/**
* A system-unique execution context identifier. Unlike the id, this is unique accross multiple
* processes, so can be reliably used to identify specific context while backend performs a
* cross-process navigation.
*/
public String getUniqueId() {
return uniqueId;
}
/**
* A system-unique execution context identifier. Unlike the id, this is unique accross multiple
* processes, so can be reliably used to identify specific context while backend performs a
* cross-process navigation.
*/
public void setUniqueId(String uniqueId) {
this.uniqueId = uniqueId;
}
/** Embedder-specific auxiliary data. */
public Map<String, Object> getAuxData() {
return auxData;
}
/** Embedder-specific auxiliary data. */
public void setAuxData(Map<String, Object> auxData) {
this.auxData = auxData;
}
}
|
3e112c83b1ce1dbcd5bf9f72802bdf9d3f864150 | 1,192 | java | Java | src/main/java/io/github/yantrashala/sc/client/ssl/TrustedHostnameVerifier.java | abdelmouheimen/genericfeignclientspringboot | c48574c079d4db4c8cb1afe721e98d8b0cf536a2 | [
"MIT"
] | 1 | 2020-12-12T15:14:19.000Z | 2020-12-12T15:14:19.000Z | src/main/java/io/github/yantrashala/sc/client/ssl/TrustedHostnameVerifier.java | yantrashala/generic-feign-client | 1b18b0bced6e7bc0c352100cded91be1d1e1327f | [
"MIT"
] | null | null | null | src/main/java/io/github/yantrashala/sc/client/ssl/TrustedHostnameVerifier.java | yantrashala/generic-feign-client | 1b18b0bced6e7bc0c352100cded91be1d1e1327f | [
"MIT"
] | null | null | null | 36.121212 | 99 | 0.791107 | 7,239 | package io.github.yantrashala.sc.client.ssl;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLSession;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class TrustedHostnameVerifier implements HostnameVerifier {
private static final Logger log = LoggerFactory.getLogger(TrustedHostnameVerifier.class);
private final Set<String> trustedHostnames;
private final HostnameVerifier hostnameVerifier = HttpsURLConnection.getDefaultHostnameVerifier();
public TrustedHostnameVerifier(String... trustedHostnames) {
this.trustedHostnames = trustedHostnames == null ? Collections.EMPTY_SET
: Collections.unmodifiableSet(new HashSet<>(Arrays.asList(trustedHostnames)));
}
@Override
public boolean verify(String hostname, SSLSession session) {
boolean valid = trustedHostnames.stream()
.anyMatch(trusted -> trusted.equals(hostname) || trusted.endsWith("." + hostname))
|| hostnameVerifier.verify(hostname, session);
log.debug("Hostname {} was forced trusted {}", hostname, valid);
return valid;
}
} |
3e112cb30f19e87a6b83cd3594848b04aba7785a | 3,008 | java | Java | Mage.Sets/src/mage/cards/p/PowerOfPersuasion.java | zeffirojoe/mage | 71260c382a4e3afef5cdf79adaa00855b963c166 | [
"MIT"
] | 1,444 | 2015-01-02T00:25:38.000Z | 2022-03-31T13:57:18.000Z | Mage.Sets/src/mage/cards/p/PowerOfPersuasion.java | zeffirojoe/mage | 71260c382a4e3afef5cdf79adaa00855b963c166 | [
"MIT"
] | 6,180 | 2015-01-02T19:10:09.000Z | 2022-03-31T21:10:44.000Z | Mage.Sets/src/mage/cards/p/PowerOfPersuasion.java | zeffirojoe/mage | 71260c382a4e3afef5cdf79adaa00855b963c166 | [
"MIT"
] | 1,001 | 2015-01-01T01:15:20.000Z | 2022-03-30T20:23:04.000Z | 34.976744 | 112 | 0.702793 | 7,240 | package mage.cards.p;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.PutOnLibraryTargetEffect;
import mage.abilities.effects.common.ReturnToHandTargetEffect;
import mage.abilities.effects.common.RollDieWithResultTableEffect;
import mage.abilities.effects.common.continuous.GainControlTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.game.Game;
import mage.players.Player;
import mage.target.common.TargetOpponentsCreaturePermanent;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class PowerOfPersuasion extends CardImpl {
public PowerOfPersuasion(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{U}");
// Choose target creature an opponent controls, then roll a d20.
RollDieWithResultTableEffect effect = new RollDieWithResultTableEffect(
20, "choose target creature an opponent controls, then roll a d20"
);
this.getSpellAbility().addEffect(effect);
this.getSpellAbility().addTarget(new TargetOpponentsCreaturePermanent());
// 1-9 | Return it to its owner's hand.
effect.addTableEntry(1, 9, new ReturnToHandTargetEffect().setText("return it to its owner's hand"));
// 10-19 | Its owner puts it on the top of bottom of their library.
effect.addTableEntry(10, 19, new PowerOfPersuasionEffect());
// 20 | Gain control of it until the end of your next turn.
effect.addTableEntry(20, 20, new GainControlTargetEffect(
Duration.UntilEndOfYourNextTurn, true
).setText("gain control of it until the end of your next turn"));
}
private PowerOfPersuasion(final PowerOfPersuasion card) {
super(card);
}
@Override
public PowerOfPersuasion copy() {
return new PowerOfPersuasion(this);
}
}
class PowerOfPersuasionEffect extends OneShotEffect {
PowerOfPersuasionEffect() {
super(Outcome.Benefit);
staticText = "its owner puts it on the top or bottom of their library";
}
private PowerOfPersuasionEffect(final PowerOfPersuasionEffect effect) {
super(effect);
}
@Override
public PowerOfPersuasionEffect copy() {
return new PowerOfPersuasionEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(game.getOwnerId(source.getFirstTarget()));
if (player == null) {
return false;
}
if (player.chooseUse(Outcome.Detriment, "Put the targeted object on the top or bottom of your library?",
"", "Top", "Bottom", source, game)) {
return new PutOnLibraryTargetEffect(true).apply(game, source);
}
return new PutOnLibraryTargetEffect(false).apply(game, source);
}
}
|
3e112d27d35f37ff216e17bc97f1e89bca90044a | 1,005 | java | Java | spring-api/src/main/java/com/aurelius/spring/facade/impl/MockPersonFacadeImpl.java | aurelius0523/kubernetes-demo | 5d50200659d156539fae99bbda24ffa2ccf71b3d | [
"MIT"
] | null | null | null | spring-api/src/main/java/com/aurelius/spring/facade/impl/MockPersonFacadeImpl.java | aurelius0523/kubernetes-demo | 5d50200659d156539fae99bbda24ffa2ccf71b3d | [
"MIT"
] | null | null | null | spring-api/src/main/java/com/aurelius/spring/facade/impl/MockPersonFacadeImpl.java | aurelius0523/kubernetes-demo | 5d50200659d156539fae99bbda24ffa2ccf71b3d | [
"MIT"
] | null | null | null | 22.840909 | 79 | 0.756219 | 7,241 | package com.aurelius.spring.facade.impl;
import java.util.List;
import org.springframework.context.annotation.Primary;
import org.springframework.context.annotation.Profile;
import org.springframework.stereotype.Component;
import com.aurelius.spring.facade.PersonFacade;
import com.aurelius.spring.facade.model.PersonModel;
@Component
@Primary
@Profile("facade-mock")
public class MockPersonFacadeImpl implements PersonFacade {
@Override
public PersonModel getPerson() {
PersonModel person = new PersonModel();
person.setId("1");
person.setName("mocked name");
return person;
}
@Override
public List<PersonModel> getPersonList() {
// TODO Auto-generated method stub
return null;
}
@Override
public PersonModel createPerson(PersonModel personModel) {
// TODO Auto-generated method stub
return null;
}
@Override
public PersonModel updatePerson(String personId, PersonModel personModel) {
// TODO Auto-generated method stub
return null;
}
}
|
3e112e1241f85f00cafc50885a4cfa939dc86281 | 337 | java | Java | data/src/main/java/com/talkao/lopezcorominas/data/net/utils/NetKeys.java | jesuslcorominas/iTunesPlayer | 546c5e2182369a83501c7499a002446a7fa8cb59 | [
"Apache-2.0"
] | null | null | null | data/src/main/java/com/talkao/lopezcorominas/data/net/utils/NetKeys.java | jesuslcorominas/iTunesPlayer | 546c5e2182369a83501c7499a002446a7fa8cb59 | [
"Apache-2.0"
] | null | null | null | data/src/main/java/com/talkao/lopezcorominas/data/net/utils/NetKeys.java | jesuslcorominas/iTunesPlayer | 546c5e2182369a83501c7499a002446a7fa8cb59 | [
"Apache-2.0"
] | null | null | null | 25.923077 | 57 | 0.724036 | 7,242 | package com.talkao.lopezcorominas.data.net.utils;
/**
* @author Jesús López Corominas
*/
public class NetKeys {
public static final String SEARCH_PATH = "search";
public static final String QUERY_TERM = "term";
public static final String QUERY_COUNTRY = "country";
public static final String QUERY_MEDIA = "music";
}
|
3e112f100596b56756f23e49551aad554f598769 | 644 | java | Java | src/main/java/com/thanple/thinking/springboot/web/HelloViewController.java | thanple/ThinkingInTechnology | bbc7d21926c8ab27f7681f63b136934c176c3bee | [
"MIT"
] | null | null | null | src/main/java/com/thanple/thinking/springboot/web/HelloViewController.java | thanple/ThinkingInTechnology | bbc7d21926c8ab27f7681f63b136934c176c3bee | [
"MIT"
] | null | null | null | src/main/java/com/thanple/thinking/springboot/web/HelloViewController.java | thanple/ThinkingInTechnology | bbc7d21926c8ab27f7681f63b136934c176c3bee | [
"MIT"
] | null | null | null | 26.833333 | 120 | 0.742236 | 7,243 | package com.thanple.thinking.springboot.web;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
/**
* Created by Thanple on 2017/2/24.
*/
@Controller
@RequestMapping("/view")
public class HelloViewController {
// localhost:8080/view/gretting
@RequestMapping("/greeting")
public String greeting(@RequestParam(value="name", required=false, defaultValue="World") String name, Model model) {
model.addAttribute("name", name);
return "hello";
}
}
|
3e112f7637c2231f267eac6c37eb0a22b3496b7a | 379 | java | Java | IO/src/com/haibowen/Echo.java | haibowen/TestJava | 9728b60eb0dce50ce717750e905bc5c71d7445d0 | [
"Apache-2.0"
] | null | null | null | IO/src/com/haibowen/Echo.java | haibowen/TestJava | 9728b60eb0dce50ce717750e905bc5c71d7445d0 | [
"Apache-2.0"
] | null | null | null | IO/src/com/haibowen/Echo.java | haibowen/TestJava | 9728b60eb0dce50ce717750e905bc5c71d7445d0 | [
"Apache-2.0"
] | null | null | null | 17.227273 | 43 | 0.704485 | 7,244 | package com.haibowen;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Echo {
public static void main(String [] arges)
throws IOException{
BufferedReader in=
new BufferedReader(
new InputStreamReader(System.in));
String s;
while ((s=in.readLine()).length()!=0) {
System.out.println(s);
}
}
}
|
3e112f85e2ef720459b69761275dd04d1773f47a | 1,491 | java | Java | hazelcast/src/main/java/com/hazelcast/function/SupplierEx.java | ldziedziul-gh-tests/hazelcast | 3a7382ac8164bc17836fc9b1f852b2667e7bef96 | [
"ECL-2.0",
"Apache-2.0"
] | 4,283 | 2015-01-02T03:56:10.000Z | 2022-03-29T23:07:45.000Z | hazelcast/src/main/java/com/hazelcast/function/SupplierEx.java | ldziedziul-gh-tests/hazelcast | 3a7382ac8164bc17836fc9b1f852b2667e7bef96 | [
"ECL-2.0",
"Apache-2.0"
] | 14,014 | 2015-01-01T04:29:38.000Z | 2022-03-31T21:47:55.000Z | hazelcast/src/main/java/com/hazelcast/function/SupplierEx.java | ldziedziul-gh-tests/hazelcast | 3a7382ac8164bc17836fc9b1f852b2667e7bef96 | [
"ECL-2.0",
"Apache-2.0"
] | 1,608 | 2015-01-04T09:57:08.000Z | 2022-03-31T12:05:26.000Z | 29.235294 | 83 | 0.704896 | 7,245 | /*
* Copyright (c) 2008-2021, Hazelcast, Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.hazelcast.function;
import com.hazelcast.internal.util.ExceptionUtil;
import com.hazelcast.security.impl.function.SecuredFunction;
import java.io.Serializable;
import java.util.function.Supplier;
/**
* {@code Serializable} variant of {@link Supplier java.util.function.Supplier}
* which declares checked exception.
*
* @param <T> the type of results supplied by this supplier
*
* @since 4.0
*/
@FunctionalInterface
public interface SupplierEx<T> extends Supplier<T>, Serializable, SecuredFunction {
/**
* Exception-declaring version of {@link Supplier#get}.
* @throws Exception in case of any exceptional case
*/
T getEx() throws Exception;
@Override
default T get() {
try {
return getEx();
} catch (Exception e) {
throw ExceptionUtil.sneakyThrow(e);
}
}
}
|
3e112fdf29d9f61faf4bfae0b7c6e7403603f993 | 192 | java | Java | app/src/main/java/com/example/xupeng/xunji/imp/OnRecyclerSettingsSwitchClickListener.java | xupeng9896/XunJi | f05db661017715beeea85bb137e4fc17faa8348b | [
"Apache-2.0"
] | null | null | null | app/src/main/java/com/example/xupeng/xunji/imp/OnRecyclerSettingsSwitchClickListener.java | xupeng9896/XunJi | f05db661017715beeea85bb137e4fc17faa8348b | [
"Apache-2.0"
] | null | null | null | app/src/main/java/com/example/xupeng/xunji/imp/OnRecyclerSettingsSwitchClickListener.java | xupeng9896/XunJi | f05db661017715beeea85bb137e4fc17faa8348b | [
"Apache-2.0"
] | null | null | null | 19.2 | 56 | 0.765625 | 7,246 | package com.example.xupeng.xunji.imp;
/**
* Created by xupeng on 2018/4/6.
*/
public interface OnRecyclerSettingsSwitchClickListener {
void onSwitchClickListener(boolean isChecked);
}
|
3e1130735bf2b1c8fc64c6f73d815f79aace5db5 | 148 | java | Java | extension/core/fabric3-bytecode-proxy/src/test/java/org/fabric3/implementation/bytecode/proxy/common/ProxyReturnInterface.java | chrisphe/fabric3-core | 3a29d2cb19fcce33678e3f81f3f7c09271ca7b84 | [
"Apache-2.0"
] | null | null | null | extension/core/fabric3-bytecode-proxy/src/test/java/org/fabric3/implementation/bytecode/proxy/common/ProxyReturnInterface.java | chrisphe/fabric3-core | 3a29d2cb19fcce33678e3f81f3f7c09271ca7b84 | [
"Apache-2.0"
] | null | null | null | extension/core/fabric3-bytecode-proxy/src/test/java/org/fabric3/implementation/bytecode/proxy/common/ProxyReturnInterface.java | chrisphe/fabric3-core | 3a29d2cb19fcce33678e3f81f3f7c09271ca7b84 | [
"Apache-2.0"
] | null | null | null | 12.333333 | 57 | 0.72973 | 7,247 | package org.fabric3.implementation.bytecode.proxy.common;
/**
*
*/
public interface ProxyReturnInterface {
String handle(String event);
}
|
3e1130d09ef2ce072db2da09f2be112565d4a75e | 2,076 | java | Java | src/main/java/org/trellisldp/id/UUIDGenerator.java | acoburn/trellis-id | 3ef4781efa8dd0160545f17546150990a8eae121 | [
"Apache-2.0"
] | 1 | 2017-01-02T20:06:34.000Z | 2017-01-02T20:06:34.000Z | src/main/java/org/trellisldp/id/UUIDGenerator.java | acoburn/trellis-service-id | 3ef4781efa8dd0160545f17546150990a8eae121 | [
"Apache-2.0"
] | null | null | null | src/main/java/org/trellisldp/id/UUIDGenerator.java | acoburn/trellis-service-id | 3ef4781efa8dd0160545f17546150990a8eae121 | [
"Apache-2.0"
] | null | null | null | 34.032787 | 111 | 0.704239 | 7,248 | /*
* 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.trellisldp.id;
import static java.util.Objects.requireNonNull;
import static java.util.UUID.randomUUID;
import static java.util.stream.IntStream.rangeClosed;
import java.util.StringJoiner;
import java.util.function.Supplier;
import org.trellisldp.api.IdentifierService;
/**
* The IdentifierService provides a mechanism for creating new identifiers.
*
* @author acoburn
*/
public class UUIDGenerator implements IdentifierService {
@Override
public Supplier<String> getSupplier(final String prefix, final Integer hierarchy, final Integer length) {
requireNonNull(prefix, "The Id prefix may not be null!");
requireNonNull(hierarchy, "The hierarchy value may not be null!");
requireNonNull(length, "The length value may not be null!");
return () -> getId(prefix, hierarchy, length);
}
@Override
public Supplier<String> getSupplier(final String prefix) {
return getSupplier(prefix, 0, 0);
}
@Override
public Supplier<String> getSupplier() {
return getSupplier("");
}
private static String getId(final String prefix, final Integer hierarchy, final Integer length) {
final String id = randomUUID().toString();
final String nodash = id.replaceAll("-", "");
final StringJoiner joiner = new StringJoiner("/");
rangeClosed(0, hierarchy - 1).forEach(x -> joiner.add(nodash.substring(x * length, (x + 1) * length)));
joiner.add(id);
return prefix + joiner;
}
}
|
3e113108dcd771e74f98249f1e7d61699b05af20 | 2,654 | java | Java | Page_Replacement/optimal.java | Infernolia/SPOSL_Laboratory | 2b7e4e808132309670e6d272c94e97d0e501bb32 | [
"MIT"
] | null | null | null | Page_Replacement/optimal.java | Infernolia/SPOSL_Laboratory | 2b7e4e808132309670e6d272c94e97d0e501bb32 | [
"MIT"
] | null | null | null | Page_Replacement/optimal.java | Infernolia/SPOSL_Laboratory | 2b7e4e808132309670e6d272c94e97d0e501bb32 | [
"MIT"
] | null | null | null | 31.223529 | 87 | 0.418613 | 7,249 | import java.util.Scanner;
import java.util.HashSet;
import java.util.HashMap;
import java.util.Iterator;
public class optimal{
public static int nextIndex(int pages[],int currIndex){
for(int i=currIndex+1;i<pages.length;i++){
if(pages[i]==pages[currIndex]){
return i;
}
}
return Integer.MAX_VALUE;
}
public static void main(String args[]){
Scanner reader = new Scanner(System.in);
int page_hits=0, page_faults=0, pages[], capacity, npages;
HashMap<Integer,Integer> indexes = new HashMap<>();
System.out.print("Capacity of frame window: ");
capacity = reader.nextInt();
System.out.print("Number of pages in the sequence: ");
npages = reader.nextInt();
pages = new int[npages];
for(int i=0;i<npages;i++){
int data;
System.out.print("Enter the frame value: ");
data = reader.nextInt();
pages[i] = data;
}
HashSet<Integer> s = new HashSet<>(capacity);
for(int i=0;i<npages;i++){
int element = pages[i];
if(s.size() < capacity){
if(!s.contains(element)){
page_faults++;
s.add(element);
}
else{
page_hits++;
}
indexes.put(element,nextIndex(pages,i));
}
else{
if(!s.contains(element)){
int opt = Integer.MIN_VALUE, val = 0;
Iterator<Integer> it = s.iterator();
while(it.hasNext()){
int temp = it.next();
if(indexes.get(temp) > opt){
opt = indexes.get(temp);
val = temp;
}
}
s.remove(val);
s.add(element);
page_faults++;
}
else{
page_hits++;
}
indexes.put(element,nextIndex(pages,i));
}
}
System.out.println("\nNumber of page faults: "+ page_faults);
System.out.println("Number of page hits: "+ page_hits);
System.out.println("Hit ratio: "+((double)page_faults)/(double)npages);
}
}
|
3e1131190d4047ba9ce09fbd0a45a640af6eb59c | 2,204 | java | Java | src/main/java/org/cyclops/integratedtunnels/part/PartTypeImporterWorldItem.java | Trainerredstone7/IntegratedTunnels | 22dc90f5bdedb26ed06111e0c2f12cd2b1fffb5f | [
"MIT"
] | 25 | 2016-10-09T20:03:56.000Z | 2021-12-07T04:10:45.000Z | src/main/java/org/cyclops/integratedtunnels/part/PartTypeImporterWorldItem.java | Trainerredstone7/IntegratedTunnels | 22dc90f5bdedb26ed06111e0c2f12cd2b1fffb5f | [
"MIT"
] | 236 | 2016-11-26T05:03:35.000Z | 2021-12-07T06:45:05.000Z | src/main/java/org/cyclops/integratedtunnels/part/PartTypeImporterWorldItem.java | Trainerredstone7/IntegratedTunnels | 22dc90f5bdedb26ed06111e0c2f12cd2b1fffb5f | [
"MIT"
] | 20 | 2016-12-30T21:06:12.000Z | 2021-12-07T04:04:07.000Z | 48.977778 | 148 | 0.764065 | 7,250 | package org.cyclops.integratedtunnels.part;
import com.google.common.collect.Lists;
import org.cyclops.integrateddynamics.api.part.aspect.IAspect;
import org.cyclops.integrateddynamics.core.part.aspect.AspectRegistry;
import org.cyclops.integrateddynamics.part.aspect.Aspects;
import org.cyclops.integratedtunnels.GeneralConfig;
import org.cyclops.integratedtunnels.core.part.PartTypeTunnelAspectsWorld;
import org.cyclops.integratedtunnels.part.aspect.TunnelAspects;
/**
* A part that can import items from the world.
* @author rubensworks
*/
public class PartTypeImporterWorldItem extends PartTypeTunnelAspectsWorld<PartTypeImporterWorldItem, PartStateWorld<PartTypeImporterWorldItem>> {
public PartTypeImporterWorldItem(String name) {
super(name);
AspectRegistry.getInstance().register(this, Lists.<IAspect>newArrayList(
TunnelAspects.Write.World.ENTITYITEM_BOOLEAN_IMPORT,
TunnelAspects.Write.World.ENTITYITEM_INTEGER_IMPORT,
TunnelAspects.Write.World.ENTITYITEM_ITEMSTACK_IMPORT,
TunnelAspects.Write.World.ENTITYITEM_LISTITEMSTACK_IMPORT,
TunnelAspects.Write.World.ENTITYITEM_PREDICATEITEMSTACK_IMPORT,
TunnelAspects.Write.World.ENTITYITEM_NBT_IMPORT,
TunnelAspects.Write.World.ENTITY_ITEM_BOOLEAN_IMPORT,
TunnelAspects.Write.World.ENTITY_ITEM_INTEGER_IMPORT,
TunnelAspects.Write.World.ENTITY_ITEM_ITEMSTACK_IMPORT,
TunnelAspects.Write.World.ENTITY_ITEM_LISTITEMSTACK_IMPORT,
TunnelAspects.Write.World.ENTITY_ITEM_PREDICATEITEMSTACK_IMPORT,
TunnelAspects.Write.World.ENTITY_ITEM_NBT_IMPORT
));
}
@Override
protected PartStateWorld<PartTypeImporterWorldItem> constructDefaultState() {
return new PartStateWorld<PartTypeImporterWorldItem>(Aspects.REGISTRY.getWriteAspects(this).size());
}
@Override
public int getConsumptionRate(PartStateWorld<PartTypeImporterWorldItem> state) {
return state.hasVariable() ? GeneralConfig.importerWorldItemBaseConsumptionEnabled : GeneralConfig.importerWorldItemBaseConsumptionDisabled;
}
}
|
3e113128ef8b994cd273e850e1a0c2827a583feb | 4,558 | java | Java | first-test/src/test/java/com/gmail/okostina74/AddToCart.java | olgakostina/sel22_rep | 62ed781f8172587b88907a8743948a0670d84927 | [
"Apache-2.0"
] | null | null | null | first-test/src/test/java/com/gmail/okostina74/AddToCart.java | olgakostina/sel22_rep | 62ed781f8172587b88907a8743948a0670d84927 | [
"Apache-2.0"
] | null | null | null | first-test/src/test/java/com/gmail/okostina74/AddToCart.java | olgakostina/sel22_rep | 62ed781f8172587b88907a8743948a0670d84927 | [
"Apache-2.0"
] | null | null | null | 40.336283 | 112 | 0.600263 | 7,251 | package com.gmail.okostina74;
import org.junit.After;
import org.junit.Test;
import org.openqa.selenium.*;
import org.openqa.selenium.support.ui.Select;
import org.openqa.selenium.support.ui.WebDriverWait;
import java.util.List;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import static junit.framework.TestCase.assertTrue;
import static org.openqa.selenium.support.ui.ExpectedConditions.stalenessOf;
import static junit.framework.TestCase.fail;
public class AddToCart {
WebDriver driverC;
WebDriver driverF;
WebDriver driverI;
private DriverBase driverCh = new DriverBase(driverC, DriverBase.CHROME);
private DriverBase driverFF = new DriverBase(driverF,DriverBase.FF);
private DriverBase driverIE = new DriverBase(driverI,DriverBase.IE);
public void addToCart(DriverBase driver) throws TimeoutException{
//Add three products to a cart
WebElement webElement;
WebDriverWait wait;
for (int i = 0; i<3; i++) {
webElement = driver.getDriver().findElement(By.cssSelector(".product .link"));
Helpers.click(webElement, driver);
if (Helpers.isElementPresent(driver.getDriver(), By.cssSelector("td.options"))){
Select select = new Select(driver.getDriver().findElement(By.cssSelector("td.options select")));
select.selectByValue("Small");
}
webElement = driver.getDriver().findElement(By.cssSelector("button[name=add_cart_product]"));
Helpers.click(webElement, driver);
for (int j = 0; j < 11; j++) {
if (j>10) throw new TimeoutException();
else{
try {
Integer itemCount = Integer.parseInt(
driver.getDriver().findElement(By.cssSelector("span.quantity")).getText());
if (itemCount > i ) {
break;
}
Thread.sleep(1000);
} catch (InterruptedException e) { }
}
}
driver.getDriver().navigate().back();
}
//Open the cart from main page
// JavascriptExecutor jse = (JavascriptExecutor)driver.getDriver();
// jse.executeScript("window.scrollTop", "");
webElement =driver.getDriver().findElement(By.cssSelector("div#cart .link"));
Helpers.click(webElement, driver);
//Remove all product
List<WebElement> products = driver.getDriver().findElements(By.cssSelector(".shortcut a"));
while (true) {
if (Helpers.isElementPresent(driver.getDriver(), By.cssSelector(".shortcut a")))
Helpers.click(products.get(0),driver);
//Remember tab row which must be hide
WebElement tableRow = driver.getDriver().findElement(By.cssSelector("td.item"));
webElement = driver.getDriver().findElement(By.cssSelector("button[name=remove_cart_item]"));
Helpers.click(webElement,driver);
wait = new WebDriverWait(driver.getDriver(), 10);
wait.until(stalenessOf(tableRow));
if (Helpers.isElementPresent(driver.getDriver(), By.cssSelector(".shortcut a")))
products = driver.getDriver().findElements(By.cssSelector(".shortcut a"));
if (!Helpers.isElementPresent(driver.getDriver(), By.cssSelector("form"))) {
driver.getDriver().navigate().back();
break;
}
}
String text = driver.getDriver().findElement(By.cssSelector("span.quantity")).getText();
if (!text.equals("0"))
fail("Not all products are deleted from the Cart in Browser: " + driver.getName());
}
@Test
public void productTest() {
try {
driverCh.initDriver();
driverCh.getPage("http://localhost/litecart/");
addToCart(driverCh);
driverFF.initDriver();
driverFF.getPage("http://localhost/litecart/");
addToCart(driverFF);
driverIE.initDriver();
driverIE.getPage("http://localhost/litecart/");
addToCart(driverIE);
}
catch (WebDriverException ex) {
fail("Warning, exception: " + ex);
}
catch (TimeoutException ex){
fail("ex");
}
}
@After
public void stop(){
driverIE.stopDriver();
driverCh.stopDriver();
driverFF.stopDriver();
}
}
|
3e11318763dc997be9ac15d84678b7ec22ce6eb4 | 1,343 | java | Java | src/test/groovy/com/themodernway/logback/json/gson/test/util/TestPOJO.java | themodernway/logback-json-gson | 79005ae4433ccb300471958f3708a1ca97a919aa | [
"Apache-2.0"
] | null | null | null | src/test/groovy/com/themodernway/logback/json/gson/test/util/TestPOJO.java | themodernway/logback-json-gson | 79005ae4433ccb300471958f3708a1ca97a919aa | [
"Apache-2.0"
] | null | null | null | src/test/groovy/com/themodernway/logback/json/gson/test/util/TestPOJO.java | themodernway/logback-json-gson | 79005ae4433ccb300471958f3708a1ca97a919aa | [
"Apache-2.0"
] | null | null | null | 23.982143 | 75 | 0.678332 | 7,252 | /*
* Copyright (c) 2018, The Modern Way. 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 com.themodernway.logback.json.gson.test.util;
import java.util.Date;
import java.util.Objects;
import com.google.gson.annotations.SerializedName;
public class TestPOJO
{
@SerializedName("date")
private Date m_date = new Date();
@SerializedName("name")
private String m_name = "TestPOJO";
public TestPOJO()
{
}
public void setDate(final Date date)
{
m_date = Objects.requireNonNull(date, "date is null");
}
public Date getDate()
{
return m_date;
}
public void setName(final String name)
{
m_name = Objects.requireNonNull(name, "name is null");
}
public String getName()
{
return m_name;
}
}
|
3e11349f408d768b3e73aa30922146dc57690805 | 536 | java | Java | src/main/java/com/bootdo/work/service/MyWorkOvertimeService.java | manmanhensha/ContentProhibited | b22aebd2bbd7fba33b55ff5fda49a160289a5fab | [
"MIT"
] | 11 | 2020-02-08T02:27:39.000Z | 2020-06-30T08:05:33.000Z | src/main/java/com/bootdo/work/service/MyWorkOvertimeService.java | manmanhensha/ContentProhibited | b22aebd2bbd7fba33b55ff5fda49a160289a5fab | [
"MIT"
] | 8 | 2021-05-08T17:59:33.000Z | 2022-01-14T03:37:01.000Z | src/main/java/com/bootdo/work/service/MyWorkOvertimeService.java | manmanhensha/ContentProhibited | b22aebd2bbd7fba33b55ff5fda49a160289a5fab | [
"MIT"
] | null | null | null | 20.615385 | 54 | 0.744403 | 7,253 | package com.bootdo.work.service;
import com.bootdo.common.utils.Query;
import com.bootdo.system.domain.UserDO;
import com.bootdo.work.domain.WorkAddDO;
import java.util.List;
public interface MyWorkOvertimeService {
List<WorkAddDO> list(Query query);
int count(Query query);
UserDO getUserByUsername(String username);
boolean save(WorkAddDO workAddDO,String username);
WorkAddDO get(Long id);
int update(WorkAddDO workAddDO,String username);
int remove(Long id);
int batchRemove(Long[] ids);
}
|
3e1135bc8d6ceea65998c259aec2eb3794d1c16e | 236 | java | Java | observer/Demo/src/test1/Observerable.java | sunywhehe/JavaDesignModeTest | f33a3df02e1b3a501be71b69311fb5092afe1dc3 | [
"Apache-2.0"
] | 1 | 2019-08-26T08:30:13.000Z | 2019-08-26T08:30:13.000Z | observer/Demo/src/test1/Observerable.java | sunywhehe/JavaDesignModeTest | f33a3df02e1b3a501be71b69311fb5092afe1dc3 | [
"Apache-2.0"
] | null | null | null | observer/Demo/src/test1/Observerable.java | sunywhehe/JavaDesignModeTest | f33a3df02e1b3a501be71b69311fb5092afe1dc3 | [
"Apache-2.0"
] | null | null | null | 15.733333 | 45 | 0.694915 | 7,254 | package test1;
/***
* 抽象被观察者接口
* 声明了添加、删除、通知观察者方法
* @author jstao
*
*/
public interface Observerable {
public void registerObserver(Observer o);
public void removeObserver(Observer o);
public void notifyObserver();
} |
3e1135d04d833c12f3437369260103f2e7cb038f | 2,913 | java | Java | app/src/main/java/com/example/jingbin/cloudreader/adapter/FilmDetailImageAdapter.java | shamujier/CloudReader | 03ab84f39c5f3eac3ca71b742c1ce2b81f560746 | [
"Apache-2.0"
] | 1 | 2021-03-08T02:29:16.000Z | 2021-03-08T02:29:16.000Z | app/src/main/java/com/example/jingbin/cloudreader/adapter/FilmDetailImageAdapter.java | shamujier/CloudReader | 03ab84f39c5f3eac3ca71b742c1ce2b81f560746 | [
"Apache-2.0"
] | null | null | null | app/src/main/java/com/example/jingbin/cloudreader/adapter/FilmDetailImageAdapter.java | shamujier/CloudReader | 03ab84f39c5f3eac3ca71b742c1ce2b81f560746 | [
"Apache-2.0"
] | null | null | null | 39.364865 | 119 | 0.682115 | 7,255 | package com.example.jingbin.cloudreader.adapter;
import android.app.Activity;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.view.ViewGroup;
import com.example.jingbin.cloudreader.R;
import com.example.jingbin.cloudreader.base.baseadapter.BaseRecyclerViewAdapter;
import com.example.jingbin.cloudreader.base.baseadapter.BaseRecyclerViewHolder;
import com.example.jingbin.cloudreader.bean.FilmDetailBasicBean;
import com.example.jingbin.cloudreader.bean.FilmDetailBean;
import com.example.jingbin.cloudreader.databinding.ItemFilmDetailActorBinding;
import com.example.jingbin.cloudreader.databinding.ItemFilmDetailImageBinding;
import com.example.jingbin.cloudreader.ui.film.child.FilmDetailActivity;
import com.example.jingbin.cloudreader.view.bigimage.BigImagePagerActivity;
import com.example.jingbin.cloudreader.view.viewbigimage.ViewBigImageActivity;
import java.util.ArrayList;
import java.util.List;
/**
* @author jingbin
*/
public class FilmDetailImageAdapter extends BaseRecyclerViewAdapter<FilmDetailBean.ImageListBean> {
private ArrayList<String> imgUrls = null;
private ArrayList<String> titles = null;
private List<View> mViews = new ArrayList<>();
private Activity activity;
public FilmDetailImageAdapter(Activity activity, List<FilmDetailBean.ImageListBean> listBeans) {
this.activity = activity;
mViews.clear();
for (Object object : listBeans) {
mViews.add(null);
}
}
@Override
public BaseRecyclerViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
return new ViewHolder(parent, R.layout.item_film_detail_image);
}
private class ViewHolder extends BaseRecyclerViewHolder<FilmDetailBean.ImageListBean, ItemFilmDetailImageBinding> {
ViewHolder(ViewGroup parent, int layout) {
super(parent, layout);
}
@Override
public void onBindViewHolder(final FilmDetailBean.ImageListBean bean, int position) {
mViews.set(position, binding.ivImage);
binding.setBean(bean);
binding.ivImage.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (imgUrls == null) {
imgUrls = new ArrayList<>();
titles = new ArrayList<>();
for (FilmDetailBean.ImageListBean bean : getData()) {
imgUrls.add(bean.getImgUrl());
titles.add(bean.getImgId() + "");
}
}
// ViewBigImageActivity.startImageList(view.getContext(), position, imgUrls, titles);
BigImagePagerActivity.startThis((AppCompatActivity) activity, mViews, imgUrls, position);
}
});
}
}
}
|
3e1137d41b1a9d695bc13188dc9407b7392a6c87 | 450 | java | Java | emall-ware/src/main/java/com/emall/ware/service/WareOrderTaskDetailService.java | Jimnywen/mall | efb1866d5b46a1a5aa615f6ce6fd1f9dd2e5131f | [
"Apache-2.0"
] | 3 | 2021-01-08T09:09:00.000Z | 2022-02-02T05:35:10.000Z | emall-ware/src/main/java/com/emall/ware/service/WareOrderTaskDetailService.java | Jimnywen/mall | efb1866d5b46a1a5aa615f6ce6fd1f9dd2e5131f | [
"Apache-2.0"
] | null | null | null | emall-ware/src/main/java/com/emall/ware/service/WareOrderTaskDetailService.java | Jimnywen/mall | efb1866d5b46a1a5aa615f6ce6fd1f9dd2e5131f | [
"Apache-2.0"
] | null | null | null | 21.47619 | 89 | 0.773836 | 7,256 | package com.emall.ware.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.common.utils.PageUtils;
import com.emall.ware.entity.WareOrderTaskDetailEntity;
import java.util.Map;
/**
* 库存工作单
*
* @author jayden
* @email efpyi@example.com
* @date 2021-01-05 20:01:52
*/
public interface WareOrderTaskDetailService extends IService<WareOrderTaskDetailEntity> {
PageUtils queryPage(Map<String, Object> params);
}
|
3e113847dcfe8190e099a40bd504c176eefc8ee9 | 1,690 | java | Java | connect-windows/src/main/java/com/lbynet/connect/backend/SAL.java | LBYPatrick/Connect | c835a713c8e44f6d37c9877035fb48c26bd3fcb3 | [
"MIT"
] | 1 | 2021-04-19T16:39:41.000Z | 2021-04-19T16:39:41.000Z | connect-windows/src/main/java/com/lbynet/connect/backend/SAL.java | LBYPatrick/Connect | c835a713c8e44f6d37c9877035fb48c26bd3fcb3 | [
"MIT"
] | null | null | null | connect-windows/src/main/java/com/lbynet/connect/backend/SAL.java | LBYPatrick/Connect | c835a713c8e44f6d37c9877035fb48c26bd3fcb3 | [
"MIT"
] | null | null | null | 23.802817 | 109 | 0.431361 | 7,257 | package com.lbynet.connect.backend;
import java.net.InetAddress;
//This is a stub class that simluates whatever that is happening on Android devices
public class SAL {
public enum MsgType {
ERROR,
DEBUG,
VERBOSE,
INFO,
WARN,
ASSERT
}
public static void print(String msg) {
print(MsgType.VERBOSE,"DefaultTag",msg);
}
public static void print(MsgType type, String tag, String msg) {
String s = "";
switch(type) {
case ERROR:
s += "E/";
break;
case VERBOSE:
s += "V/";
break;
case DEBUG:
s += "D/";
break;
case INFO:
s += "I/";
break;
case WARN:
s += "W/";
break;
}
s += tag + ": " + msg;
System.out.println(s);
}
public static String getDeviceName() {
try {
return InetAddress.getLocalHost().getHostName();
} catch (Exception e) {
SAL.print(e);
}
return null;
}
public static void print(Exception e) {
String msg = "";
msg += "Exception: " + e.toString() + "\n"
+ "Message: " + e.getMessage() + "\n"
+ "Location: " + "\n";
for(StackTraceElement i : e.getStackTrace()) {
msg += "\t" + i.getClassName() + "." + i.getMethodName() + "(Line " + i.getLineNumber() + ")\n";
}
print(MsgType.ERROR,"Exception", msg);
}
}
|
3e113950f9f558d2ca34e41a4cb8eec8f67dfa41 | 328 | java | Java | app/src/main/java/org/blackdev/bloodbank_college/URLs.java | Badri2107P/bloodbank | 94b71db2d3a2c6cf1ae49184eab2f8bcd27509c3 | [
"MIT"
] | null | null | null | app/src/main/java/org/blackdev/bloodbank_college/URLs.java | Badri2107P/bloodbank | 94b71db2d3a2c6cf1ae49184eab2f8bcd27509c3 | [
"MIT"
] | null | null | null | app/src/main/java/org/blackdev/bloodbank_college/URLs.java | Badri2107P/bloodbank | 94b71db2d3a2c6cf1ae49184eab2f8bcd27509c3 | [
"MIT"
] | null | null | null | 21.866667 | 82 | 0.713415 | 7,258 | package org.blackdev.bloodbank_college;
/**
* Created by Belal on 9/5/2017.
*/
public class URLs {
private static final String ROOT_URL = "http://blackdev.org/Api.php?apicall=";
public static final String URL_REGISTER = ROOT_URL + "signup";
public static final String URL_GETDONORS= ROOT_URL + "getdonors";
}
|
3e1139b997e8d6f2254a4ad0fe9b58bb2cc715bb | 1,103 | java | Java | Lezione 08/TestInitArray.java | cipst/lab_prog1 | 168a35fd8afc122f9139f126092b99e28a07964d | [
"MIT"
] | null | null | null | Lezione 08/TestInitArray.java | cipst/lab_prog1 | 168a35fd8afc122f9139f126092b99e28a07964d | [
"MIT"
] | null | null | null | Lezione 08/TestInitArray.java | cipst/lab_prog1 | 168a35fd8afc122f9139f126092b99e28a07964d | [
"MIT"
] | 2 | 2020-11-19T13:15:12.000Z | 2020-11-25T11:09:07.000Z | 40.851852 | 105 | 0.644606 | 7,259 | public class TestInitArray {
public static void main(String[] args) {
// ESERCIZIO 1
int[] a = MetodiSuArray.initArrayInt();
MetodiSuArray.stampaArrayInt(a);
// ESERCIZIO 2
int[] b = MetodiSuArray.clonaArray(a);
System.out.println("Clone di array a:");
MetodiSuArray.stampaArrayInt(b);
// ESERCIZIO 3
System.out.print("Inserisci un limite: ");
int limiteSuperiore = SIn.readInt();
MetodiSuArray.stampaArrayInt(MetodiSuArray.filtroMinoriDi(a, limiteSuperiore));
System.out.print("Inserisci un minimo: ");
int min = SIn.readInt();
System.out.print("Inserisci un massimo: ");
int max = SIn.readInt();
System.out.println("Numeri dispari compresi tra " + min + " e " + max);
MetodiSuArray.stampaArrayInt(MetodiSuArray.filtroIntervalloDisp(a, min, max));
System.out.println("Array di boolean degli elementi di a che sono minori di " + limiteSuperiore);
MetodiSuArray.stampaArrayBoolean(MetodiSuArray.trasduttore(a, limiteSuperiore));
}
} |
3e1139c8a44ce253af61e129c38b228726d25264 | 289 | java | Java | src/main/java/org/larrieulacoste/noe/al/trademe/features/invoices/application/query/RetrieveInvoiceById.java | Nouuu/AL-TradeMe | c0bd578242306c4d334ad58d441924abb27ffe5e | [
"MIT"
] | 3 | 2022-03-07T21:06:51.000Z | 2022-03-13T21:27:06.000Z | src/main/java/org/larrieulacoste/noe/al/trademe/features/invoices/application/query/RetrieveInvoiceById.java | Nouuu/AL-TradeMe | c0bd578242306c4d334ad58d441924abb27ffe5e | [
"MIT"
] | null | null | null | src/main/java/org/larrieulacoste/noe/al/trademe/features/invoices/application/query/RetrieveInvoiceById.java | Nouuu/AL-TradeMe | c0bd578242306c4d334ad58d441924abb27ffe5e | [
"MIT"
] | null | null | null | 32.111111 | 78 | 0.84083 | 7,260 | package org.larrieulacoste.noe.al.trademe.features.invoices.application.query;
import org.larrieulacoste.noe.al.trademe.kernel.query.Query;
import org.larrieulacoste.noe.al.trademe.shared_kernel.model.EntityId;
public record RetrieveInvoiceById(EntityId invoiceId) implements Query {
}
|
3e113a8afd392f677f89f1124a0fe521a3f54baf | 918 | java | Java | sitewhere-java-model/src/main/java/com/sitewhere/spi/search/device/IZoneSearchCriteria.java | sitewhere/sitewhere-java-api | e6545f48ad0359dc0ba86344587cbdf367bb6b12 | [
"Apache-2.0"
] | 7 | 2018-12-01T16:38:40.000Z | 2021-04-22T11:04:03.000Z | sitewhere-java-model/src/main/java/com/sitewhere/spi/search/device/IZoneSearchCriteria.java | sitewhere/sitewhere-java-api | e6545f48ad0359dc0ba86344587cbdf367bb6b12 | [
"Apache-2.0"
] | 5 | 2019-07-05T14:16:51.000Z | 2020-09-13T06:10:00.000Z | sitewhere-java-model/src/main/java/com/sitewhere/spi/search/device/IZoneSearchCriteria.java | sitewhere/sitewhere-java-api | e6545f48ad0359dc0ba86344587cbdf367bb6b12 | [
"Apache-2.0"
] | 7 | 2019-12-31T06:41:15.000Z | 2021-12-08T07:56:35.000Z | 28.6875 | 75 | 0.716776 | 7,261 | /**
* Copyright © 2014-2021 The SiteWhere 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 com.sitewhere.spi.search.device;
import com.sitewhere.spi.search.ISearchCriteria;
/**
* Criteria for searching zones.
*/
public interface IZoneSearchCriteria extends ISearchCriteria {
/**
* Get id for area zone belongs to.
*
* @return
*/
String getAreaToken();
}
|
3e113afe5e01bdc9bd663595dad7cc1f61a50b9d | 1,525 | java | Java | src/main/java/com/yyp/mvc/controller/EbookDomailCtl.java | cycman/libooc | 350abc6ac329612187460d1914654b7db50fed01 | [
"Apache-2.0"
] | 4 | 2017-03-27T09:54:12.000Z | 2019-06-09T03:57:18.000Z | src/main/java/com/yyp/mvc/controller/EbookDomailCtl.java | cycman/libooc | 350abc6ac329612187460d1914654b7db50fed01 | [
"Apache-2.0"
] | null | null | null | src/main/java/com/yyp/mvc/controller/EbookDomailCtl.java | cycman/libooc | 350abc6ac329612187460d1914654b7db50fed01 | [
"Apache-2.0"
] | 1 | 2021-07-23T03:14:46.000Z | 2021-07-23T03:14:46.000Z | 24.596774 | 72 | 0.729836 | 7,262 | package com.yyp.mvc.controller;
import javax.json.Json;
import org.apache.commons.logging.Log;
import org.aspectj.weaver.patterns.ThisOrTargetAnnotationPointcut;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.alibaba.fastjson.JSON;
import com.cyc.domain.EbookDomain;
import com.cyc.exception.MyException;
import com.cyc.hibernate.EbookHibernateImp;
import com.cyc.service.EbookService;
import com.cyc.util.log.ControlLog;
import com.cyc.view.BaseView;
import com.cyc.view.EbookView;
import com.cyc.view.ErrorView;
@Controller
@RequestMapping("/ebook")
public class EbookDomailCtl extends BaseHandleExceptionControl {
@Autowired
private EbookService ebookService;
private Log ebLog= new ControlLog(EbookService.class);
@RequestMapping(value="/detail",produces="text/html;charset=gbk")
@ResponseBody
public String findebook(String ebid) throws Exception
{
ebLog.info("ebid>>>>>>>"+ebid);
EbookDomain ebookDomain;
EbookView ebookView = null;
try {
ebookDomain = ebookService.findbyEid(ebid);
ebookView = new EbookView(ebookDomain);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
throw e;
}
return JSON.toJSONString(ebookView);
}
}
|
3e113bc8fcc40f050cf0e191cdf1839e17b8f232 | 3,219 | java | Java | common-ui/src/main/java/com/github/liaoheng/common/ui/core/ToolBarHelper.java | liaoheng/Common | 38cc2ff6f1951173140dd8e19aac797f67ab2089 | [
"Apache-2.0"
] | 3 | 2016-08-18T22:49:30.000Z | 2020-04-29T14:17:57.000Z | common-ui/src/main/java/com/github/liaoheng/common/ui/core/ToolBarHelper.java | liaoheng/Common | 38cc2ff6f1951173140dd8e19aac797f67ab2089 | [
"Apache-2.0"
] | null | null | null | common-ui/src/main/java/com/github/liaoheng/common/ui/core/ToolBarHelper.java | liaoheng/Common | 38cc2ff6f1951173140dd8e19aac797f67ab2089 | [
"Apache-2.0"
] | 1 | 2021-09-23T06:16:26.000Z | 2021-09-23T06:16:26.000Z | 30.657143 | 94 | 0.692762 | 7,263 | package com.github.liaoheng.common.ui.core;
import android.util.AndroidRuntimeException;
import android.view.View;
import android.widget.ImageButton;
import android.widget.TextView;
import com.github.liaoheng.common.ui.R;
import com.github.liaoheng.common.util.UIUtils;
import androidx.annotation.NonNull;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
/**
* may use {@link R.layout#lcu_view_toolbar_dark} || {@link R.layout#lcu_view_toolbar_light}
* @author liaoheng
* @version 2015年9月22日
*/
public class ToolBarHelper {
private Toolbar mToolbar;
private TextView mToolbarTitle;
private View mToolbarRight;
private View mToolbarLeft;
public static ToolBarHelper custom(@NonNull AppCompatActivity activity) {
Toolbar toolbar = UIUtils.findViewById(activity, R.id.lcu_toolbar);
activity.setSupportActionBar(toolbar);
ActionBar actionBar = activity.getSupportActionBar();
if (actionBar == null) {
throw new AndroidRuntimeException("SupportActionBar is null");
}
actionBar.setDisplayShowTitleEnabled(false);
return new ToolBarHelper(toolbar);
}
public static ToolBarHelper with(@NonNull AppCompatActivity activity) {
Toolbar toolbar = UIUtils.findViewById(activity, R.id.lcu_toolbar);
activity.setSupportActionBar(toolbar);
ActionBar actionBar = activity.getSupportActionBar();
if (actionBar == null) {
throw new AndroidRuntimeException("SupportActionBar is null");
}
actionBar.setDisplayShowTitleEnabled(true);
actionBar.setDisplayHomeAsUpEnabled(true);
return new ToolBarHelper(toolbar);
}
public static ToolBarHelper with(@NonNull View view) {
return new ToolBarHelper((Toolbar) UIUtils.findViewById(view, R.id.lcu_toolbar));
}
public ToolBarHelper(Toolbar toolbar) {
if (toolbar == null) {
throw new IllegalArgumentException("Toolbar is null");
}
mToolbar = toolbar;
mToolbarTitle = (TextView) toolbar.findViewById(R.id.lcu_toolbar_title);
mToolbarRight = toolbar.findViewById(R.id.lcu_toolbar_right);
mToolbarLeft = toolbar.findViewById(R.id.lcu_toolbar_left);
}
public void toggleVisibilityToolbarTitle() {
UIUtils.toggleVisibility(mToolbarTitle);
}
public void toggleVisibilityToolbarRight() {
UIUtils.toggleVisibility(mToolbarRight);
}
public void toggleVisibilityToolbarLeft() {
UIUtils.toggleVisibility(mToolbarLeft);
}
public Toolbar getToolbar() {
return mToolbar;
}
public TextView getToolbarTitle() {
return mToolbarTitle;
}
/**
* def {@link ImageButton}
*/
public View getToolbarRight() {
return mToolbarRight;
}
public ImageButton getToolbarRightDef() {
return (ImageButton) mToolbarRight;
}
/**
* def {@link ImageButton}
*/
public View getToolbarLeft() {
return mToolbarLeft;
}
public ImageButton getToolbarLeftDef() {
return (ImageButton) mToolbarLeft;
}
}
|
3e113c106b2cd65d95d7e102f5ec940c65f720bf | 541 | java | Java | thor-rpc/src/main/java/com/mob/thor/rpc/remoting/api/transport/dispatcher/message/MessageOnlyDispatcher.java | MOBX/Thor | 68b650d7ee05efe67dc1fca8dd0194a47d683f72 | [
"Apache-2.0"
] | 2 | 2015-12-24T10:29:54.000Z | 2017-05-03T13:14:37.000Z | thor-rpc/src/main/java/com/mob/thor/rpc/remoting/api/transport/dispatcher/message/MessageOnlyDispatcher.java | MOBX/Thor | 68b650d7ee05efe67dc1fca8dd0194a47d683f72 | [
"Apache-2.0"
] | null | null | null | thor-rpc/src/main/java/com/mob/thor/rpc/remoting/api/transport/dispatcher/message/MessageOnlyDispatcher.java | MOBX/Thor | 68b650d7ee05efe67dc1fca8dd0194a47d683f72 | [
"Apache-2.0"
] | null | null | null | 27.05 | 78 | 0.731978 | 7,264 | package com.mob.thor.rpc.remoting.api.transport.dispatcher.message;
import com.mob.thor.rpc.common.URL;
import com.mob.thor.rpc.remoting.api.Dispatcher;
import com.mob.thor.rpc.remoting.api.ThorChannelHandler;
/**
* 只有message receive使用线程池.
*
* @author zxc
*/
public class MessageOnlyDispatcher implements Dispatcher {
public static final String NAME = "message";
public ThorChannelHandler dispatch(ThorChannelHandler handler, URL url) {
return new MessageOnlyChannelHandler(handler, url);
}
}
|
3e113e522f312e201ae7f2b8301de6778045df55 | 3,009 | java | Java | src/test/java/com/shippo/model/RefundTest.java | serioussam/shippo-java-client | 83e14946919790ffa616c5287b01401ca0568cab | [
"MIT"
] | 54 | 2015-04-01T05:25:19.000Z | 2022-02-27T17:27:09.000Z | src/test/java/com/shippo/model/RefundTest.java | serioussam/shippo-java-client | 83e14946919790ffa616c5287b01401ca0568cab | [
"MIT"
] | 22 | 2015-08-20T17:05:15.000Z | 2021-04-09T20:09:46.000Z | src/test/java/com/shippo/model/RefundTest.java | serioussam/shippo-java-client | 83e14946919790ffa616c5287b01401ca0568cab | [
"MIT"
] | 38 | 2015-03-23T23:21:44.000Z | 2022-03-28T15:44:57.000Z | 35.4 | 118 | 0.696577 | 7,265 | package com.shippo.model;
import static org.junit.Assert.*;
import java.util.HashMap;
import java.util.Map;
import org.junit.Test;
import com.shippo.exception.APIConnectionException;
import com.shippo.exception.APIException;
import com.shippo.exception.AuthenticationException;
import com.shippo.exception.InvalidRequestException;
import com.shippo.exception.ShippoException;
// Test is affected by inability of API to make test purchases
public class RefundTest extends ShippoTest {
// Not testable with the current API
// @Test
// public void testValidCreate() {
// Refund testObject = (Refund) getDefaultObject();
// assertEquals("QUEUED", testObject.getObject_status());
// }
@Test(expected = InvalidRequestException.class)
public void testInvalidCreate() throws AuthenticationException, InvalidRequestException, APIConnectionException,
APIException {
Refund.create(getInvalidObjectMap());
}
// Not testable with the current API
// @Test
// public void testRetrieve() throws AuthenticationException,
// InvalidRequestException, APIConnectionException,
// APIException {
// Refund testObject = (Refund) getDefaultObject();
// Refund retrievedObject;
//
// retrievedObject = Refund.retrieve((String) testObject.object_id);
// assertEquals(testObject.object_id, retrievedObject.object_id);
//
// }
@Test(expected = InvalidRequestException.class)
public void testInvalidRetrieve() throws AuthenticationException, InvalidRequestException, APIConnectionException,
APIException {
Refund.retrieve("invalid_id");
}
@Test
public void testListAll() throws AuthenticationException, InvalidRequestException, APIConnectionException,
APIException {
RefundCollection objectCollection = Refund.all(null);
assertNotNull(objectCollection.getData());
}
// Not testable with the current API (requires test refunds to exist)
// @Test
// public void testListPageSize() throws AuthenticationException,
// InvalidRequestException, APIConnectionException,
// APIException {
// Map<String, Object> objectMap = new HashMap<String, Object>();
// objectMap.put("results", "1"); // one result per page
// objectMap.put("page", "1"); // the first page of results
// RefundCollection RefundCollection = Refund.all(objectMap);
// assertEquals(RefundCollection.getData().size(), 1);
// }
public static Object getDefaultObject() {
Map<String, Object> objectMap = new HashMap<String, Object>();
// A test transaction ID does not exist in the current API, making it
// impossible to test without purchases
objectMap.put("transaction", "a test transaction ID");
try {
Refund testObject = Refund.create(objectMap);
return testObject;
} catch (ShippoException e) {
e.printStackTrace();
}
return null;
}
}
|
3e113ec37f7efa9cde6a2d4f9ba562d643582412 | 2,007 | java | Java | yumall-member/src/main/java/com/wyx/yumall/member/controller/MemberLoginLogController.java | wangyuxiang985/xiaoyu_mall | adb4412ee2f4818236651d7183279df0f4213314 | [
"Apache-2.0"
] | null | null | null | yumall-member/src/main/java/com/wyx/yumall/member/controller/MemberLoginLogController.java | wangyuxiang985/xiaoyu_mall | adb4412ee2f4818236651d7183279df0f4213314 | [
"Apache-2.0"
] | null | null | null | yumall-member/src/main/java/com/wyx/yumall/member/controller/MemberLoginLogController.java | wangyuxiang985/xiaoyu_mall | adb4412ee2f4818236651d7183279df0f4213314 | [
"Apache-2.0"
] | null | null | null | 23.383721 | 74 | 0.700149 | 7,266 | package com.wyx.yumall.member.controller;
import java.util.Arrays;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.wyx.yumall.member.entity.MemberLoginLogEntity;
import com.wyx.yumall.member.service.MemberLoginLogService;
import com.wyx.common.utils.PageUtils;
import com.wyx.common.utils.R;
/**
* 会员登录记录
*
* @author wyx
* @email lyhxr@example.com
* @date 2021-12-09 23:22:33
*/
@RestController
@RequestMapping("member/memberloginlog")
public class MemberLoginLogController {
@Autowired
private MemberLoginLogService memberLoginLogService;
/**
* 列表
*/
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params){
PageUtils page = memberLoginLogService.queryPage(params);
return R.ok().put("page", page);
}
/**
* 信息
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id){
MemberLoginLogEntity memberLoginLog = memberLoginLogService.getById(id);
return R.ok().put("memberLoginLog", memberLoginLog);
}
/**
* 保存
*/
@RequestMapping("/save")
public R save(@RequestBody MemberLoginLogEntity memberLoginLog){
memberLoginLogService.save(memberLoginLog);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
public R update(@RequestBody MemberLoginLogEntity memberLoginLog){
memberLoginLogService.updateById(memberLoginLog);
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Long[] ids){
memberLoginLogService.removeByIds(Arrays.asList(ids));
return R.ok();
}
}
|
3e113ec5414b00bd98d15452192c77b3f04ac4db | 1,282 | java | Java | px-checkout/src/test/java/com/mercadopago/android/px/internal/features/review_and_confirm/components/payment_method/MethodCardTest.java | tomascorchonML/px-android | c05ca6a09c7f11593b8572db4da55383d5330b69 | [
"MIT"
] | 1 | 2018-09-12T05:39:00.000Z | 2018-09-12T05:39:00.000Z | px-checkout/src/test/java/com/mercadopago/android/px/internal/features/review_and_confirm/components/payment_method/MethodCardTest.java | tomascorchonML/px-android | c05ca6a09c7f11593b8572db4da55383d5330b69 | [
"MIT"
] | null | null | null | px-checkout/src/test/java/com/mercadopago/android/px/internal/features/review_and_confirm/components/payment_method/MethodCardTest.java | tomascorchonML/px-android | c05ca6a09c7f11593b8572db4da55383d5330b69 | [
"MIT"
] | null | null | null | 38.848485 | 98 | 0.74259 | 7,267 | package com.mercadopago.android.px.internal.features.review_and_confirm.components.payment_method;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.junit.MockitoJUnitRunner;
import static junit.framework.Assert.assertTrue;
import static org.junit.Assert.assertFalse;
@RunWith(MockitoJUnitRunner.class)
public class MethodCardTest {
@Test
public void when_issuer_name_equals_card_name_then_should_show_is_false() throws Exception {
MethodCard.Props props = new MethodCard.Props("1234", "visa", "1235", "visa");
MethodCard methodCard = new MethodCard(props);
assertFalse(methodCard.shouldShowSubtitle());
}
@Test
public void when_issuer_is_empty_then_should_show_is_false() throws Exception {
MethodCard.Props props = new MethodCard.Props("1234", "visa", "1235", "");
MethodCard methodCard = new MethodCard(props);
assertFalse(methodCard.shouldShowSubtitle());
}
@Test
public void when_issuer_different_than_card_name_then_should_show_is_true() throws Exception {
MethodCard.Props props = new MethodCard.Props("1234", "visa", "1235", "banco visa");
MethodCard methodCard = new MethodCard(props);
assertTrue(methodCard.shouldShowSubtitle());
}
} |
3e1140510107e4abaf10d0dd881649053cc5982b | 1,359 | java | Java | dcae-analytics/dcae-analytics-tca-core/src/test/java/org/onap/dcae/analytics/tca/core/domain/TestTcaAbatementEntity.java | onap/dcaegen2-analytics-tca-gen2 | 49bdb367776877797cfa4d8dc346049e74b9f526 | [
"Apache-2.0",
"CC-BY-4.0"
] | 2 | 2019-09-24T11:10:40.000Z | 2020-12-04T00:27:04.000Z | dcae-analytics/dcae-analytics-tca-core/src/test/java/org/onap/dcae/analytics/tca/core/domain/TestTcaAbatementEntity.java | onap/dcaegen2-analytics-tca-gen2 | 49bdb367776877797cfa4d8dc346049e74b9f526 | [
"Apache-2.0",
"CC-BY-4.0"
] | null | null | null | dcae-analytics/dcae-analytics-tca-core/src/test/java/org/onap/dcae/analytics/tca/core/domain/TestTcaAbatementEntity.java | onap/dcaegen2-analytics-tca-gen2 | 49bdb367776877797cfa4d8dc346049e74b9f526 | [
"Apache-2.0",
"CC-BY-4.0"
] | 1 | 2020-12-04T00:25:50.000Z | 2020-12-04T00:25:50.000Z | 32.357143 | 83 | 0.626932 | 7,268 | /*
* ================================================================================
* Copyright (c) 2018 AT&T Intellectual Property. 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.
* ============LICENSE_END=========================================================
*
*/
package org.onap.dcae.analytics.tca.core.domain;
import lombok.AllArgsConstructor;
import lombok.Data;
import java.util.Date;
import org.onap.dcae.analytics.tca.core.service.TcaAbatementEntity;
/**
* @author Rajiv Singla
*/
@Data
@AllArgsConstructor
public class TestTcaAbatementEntity implements TcaAbatementEntity {
private Date lastModificationDate;
private String lookupKey;
private String requestId;
private boolean isAbatementAlertSent;
}
|
3e114087ec7a504ee385409e1cad3779dbfee04b | 5,303 | java | Java | cdap-explore/src/main/java/io/cdap/cdap/explore/executor/NamespacedExploreQueryExecutorHttpHandler.java | neelesh-nirmal/cdap | ac80b367554eed063690844a86d2bb427e13663c | [
"Apache-2.0"
] | 369 | 2018-12-11T08:30:05.000Z | 2022-03-30T09:32:53.000Z | cdap-explore/src/main/java/io/cdap/cdap/explore/executor/NamespacedExploreQueryExecutorHttpHandler.java | neelesh-nirmal/cdap | ac80b367554eed063690844a86d2bb427e13663c | [
"Apache-2.0"
] | 8,921 | 2015-01-01T16:40:44.000Z | 2018-11-29T21:58:11.000Z | cdap-explore/src/main/java/io/cdap/cdap/explore/executor/NamespacedExploreQueryExecutorHttpHandler.java | neelesh-nirmal/cdap | ac80b367554eed063690844a86d2bb427e13663c | [
"Apache-2.0"
] | 189 | 2018-11-30T20:11:08.000Z | 2022-03-25T02:55:39.000Z | 43.826446 | 110 | 0.728078 | 7,269 | /*
* Copyright © 2014-2019 Cask Data, 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 io.cdap.cdap.explore.executor;
import com.google.gson.Gson;
import com.google.inject.Inject;
import io.cdap.cdap.common.conf.Constants;
import io.cdap.cdap.common.security.AuditDetail;
import io.cdap.cdap.common.security.AuditPolicy;
import io.cdap.cdap.explore.service.ExploreException;
import io.cdap.cdap.explore.service.ExploreService;
import io.cdap.cdap.proto.QueryHandle;
import io.cdap.cdap.proto.QueryInfo;
import io.cdap.cdap.proto.id.NamespaceId;
import io.cdap.cdap.security.impersonation.ImpersonatedOpType;
import io.cdap.cdap.security.impersonation.Impersonator;
import io.cdap.http.HttpResponder;
import io.netty.handler.codec.http.FullHttpRequest;
import io.netty.handler.codec.http.HttpRequest;
import io.netty.handler.codec.http.HttpResponseStatus;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.SQLException;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.Callable;
import javax.ws.rs.DefaultValue;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.QueryParam;
/**
* Provides REST endpoints for {@link ExploreService} operations.
*/
@Path(Constants.Gateway.API_VERSION_3 + "/namespaces/{namespace-id}")
public class NamespacedExploreQueryExecutorHttpHandler extends AbstractExploreQueryExecutorHttpHandler {
private static final Logger LOG = LoggerFactory.getLogger(NamespacedExploreQueryExecutorHttpHandler.class);
private static final Gson GSON = new Gson();
private final ExploreService exploreService;
private final Impersonator impersonator;
@Inject
public NamespacedExploreQueryExecutorHttpHandler(ExploreService exploreService, Impersonator impersonator) {
this.exploreService = exploreService;
this.impersonator = impersonator;
}
@POST
@Path("data/explore/queries")
@AuditPolicy(AuditDetail.REQUEST_BODY)
public void query(FullHttpRequest request, HttpResponder responder,
@PathParam("namespace-id") final String namespaceId) throws Exception {
try {
Map<String, String> args = decodeArguments(request);
final String query = args.get("query");
final Map<String, String> additionalSessionConf = new HashMap<>(args);
additionalSessionConf.remove("query");
LOG.trace("Received query: {}", query);
QueryHandle queryHandle = impersonator.doAs(new NamespaceId(namespaceId), new Callable<QueryHandle>() {
@Override
public QueryHandle call() throws Exception {
return exploreService.execute(new NamespaceId(namespaceId), query, additionalSessionConf);
}
}, ImpersonatedOpType.EXPLORE);
responder.sendJson(HttpResponseStatus.OK, GSON.toJson(queryHandle));
} catch (IllegalArgumentException e) {
LOG.debug("Got exception:", e);
responder.sendString(HttpResponseStatus.BAD_REQUEST, e.getMessage());
} catch (SQLException e) {
LOG.debug("Got exception:", e);
responder.sendString(HttpResponseStatus.BAD_REQUEST, String.format("[SQLState %s] %s",
e.getSQLState(), e.getMessage()));
}
}
@GET
@Path("data/explore/queries")
public void getQueryLiveHandles(HttpRequest request, HttpResponder responder,
@PathParam("namespace-id") String namespaceId,
@QueryParam("offset") @DefaultValue("9223372036854775807") long offset,
@QueryParam("cursor") @DefaultValue("next") String cursor,
@QueryParam("limit") @DefaultValue("50") int limit)
throws ExploreException, SQLException {
boolean isForward = "next".equals(cursor);
// this operation doesn't interact with hive, so doesn't require impersonation
List<QueryInfo> queries = exploreService.getQueries(new NamespaceId(namespaceId));
// return the queries by after filtering (> offset) and limiting number of queries
responder.sendJson(HttpResponseStatus.OK, GSON.toJson(filterQueries(queries, offset, isForward, limit)));
}
@GET
@Path("data/explore/queries/count")
public void getActiveQueryCount(HttpRequest request, HttpResponder responder,
@PathParam("namespace-id") String namespaceId) throws ExploreException {
// this operation doesn't interact with hive, so doesn't require impersonation
int count = exploreService.getActiveQueryCount(new NamespaceId(namespaceId));
responder.sendJson(HttpResponseStatus.OK, GSON.toJson(Collections.singletonMap("count", count)));
}
}
|
3e1141569d6444e54f98fc91f96de4c341db5cd0 | 1,394 | java | Java | storemusic/src/main/java/com/xinshang/store/comment/CommentContract.java | komamj/Audient | c1f2e4a7b569a310403b950c15a8956901829b78 | [
"Apache-2.0"
] | 4 | 2018-01-03T11:45:13.000Z | 2018-03-27T06:55:29.000Z | storemusic/src/main/java/com/xinshang/store/comment/CommentContract.java | komamj/Audient | c1f2e4a7b569a310403b950c15a8956901829b78 | [
"Apache-2.0"
] | null | null | null | storemusic/src/main/java/com/xinshang/store/comment/CommentContract.java | komamj/Audient | c1f2e4a7b569a310403b950c15a8956901829b78 | [
"Apache-2.0"
] | null | null | null | 29.659574 | 75 | 0.736729 | 7,270 | /*
* Copyright 2017 Koma
*
* 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.xinshang.store.comment;
import com.xinshang.store.base.BasePresenter;
import com.xinshang.store.base.BaseView;
import com.xinshang.store.data.entities.Comment;
import com.xinshang.store.data.entities.CommentDataBean;
import com.xinshang.store.data.entities.Song;
import java.util.List;
public interface CommentContract {
interface View extends BaseView<Presenter> {
void showComments(List<Comment> comments);
void showCommentDataBean(CommentDataBean commentDataBean);
boolean isActive();
void showLoadingError();
void showSuccessfulMessage();
void showEmpty(boolean forceShow);
void setLoadingIncator(boolean isActive);
}
interface Presenter extends BasePresenter {
void loadComments(Song audient);
}
}
|
3e1141b002cfe34596b8986b9e17659ef48d1c9c | 360 | java | Java | TeamCode/src/main/java/org/firstinspires/ftc/teamcode/Commands/CommandLib/CommandState.java | Meschdog18/khs-robotics-2022 | 959b17a8ff19b8386014125373f1f64822b3f678 | [
"MIT"
] | null | null | null | TeamCode/src/main/java/org/firstinspires/ftc/teamcode/Commands/CommandLib/CommandState.java | Meschdog18/khs-robotics-2022 | 959b17a8ff19b8386014125373f1f64822b3f678 | [
"MIT"
] | null | null | null | TeamCode/src/main/java/org/firstinspires/ftc/teamcode/Commands/CommandLib/CommandState.java | Meschdog18/khs-robotics-2022 | 959b17a8ff19b8386014125373f1f64822b3f678 | [
"MIT"
] | null | null | null | 25.714286 | 62 | 0.730556 | 7,271 | package org.firstinspires.ftc.teamcode.Commands.CommandLib;
public class CommandState{
private final boolean interruptible;
public CommandState(boolean interruptible){
this.interruptible = interruptible;
}
boolean isInterruptible(){
return interruptible;
}
// add interuptable state, plus look at frc implementation
} |
3e1142e0a321fe8426ec2d54e5d86bfb301f427a | 1,399 | java | Java | framework-core/src/main/java/com/ubsoft/framework/core/dal/model/QueryModel.java | chenkuangfeng/framework | b679b105305f1373211e90996c33922f3c1c4467 | [
"MIT"
] | null | null | null | framework-core/src/main/java/com/ubsoft/framework/core/dal/model/QueryModel.java | chenkuangfeng/framework | b679b105305f1373211e90996c33922f3c1c4467 | [
"MIT"
] | null | null | null | framework-core/src/main/java/com/ubsoft/framework/core/dal/model/QueryModel.java | chenkuangfeng/framework | b679b105305f1373211e90996c33922f3c1c4467 | [
"MIT"
] | null | null | null | 15.373626 | 60 | 0.711222 | 7,272 | package com.ubsoft.framework.core.dal.model;
import java.io.Serializable;
public class QueryModel implements Serializable {
private static final long serialVersionUID = 1L;
private boolean page;// 是否分页
private int pageSize;// 页数据
private int pageNo;//
private String orderBy;
private ConditionTree conditionTree;
private int limit;
private String unitName;
private String fdmId;
public boolean isPage() {
return page;
}
public void setPage(boolean page) {
this.page = page;
}
public int getPageSize() {
return pageSize;
}
public void setPageSize(int pageSize) {
this.pageSize = pageSize;
}
public int getPageNo() {
return pageNo;
}
public void setPageNo(int pageNo) {
this.pageNo = pageNo;
}
public String getOrderBy() {
return orderBy;
}
public void setOrderBy(String orderBy) {
this.orderBy = orderBy;
}
public ConditionTree getConditionTree() {
return conditionTree;
}
public void setConditionTree(ConditionTree conditionTree) {
this.conditionTree = conditionTree;
}
public int getLimit() {
return limit;
}
public void setLimit(int limit) {
this.limit = limit;
}
public String getFdmId() {
return fdmId;
}
public void setFdmId(String fdmId) {
this.fdmId = fdmId;
}
public String getUnitName() {
return unitName;
}
public void setUnitName(String unitName) {
this.unitName = unitName;
}
}
|
3e11432bf011b5def1b2d4b7bc8da6e97deb8e99 | 1,203 | java | Java | src/main/java/com/codebrig/journey/proxy/callback/CefNativeProxy.java | shuzijun/Journey | bbba94f0f870bd4e30826f31a38cef1460a801fa | [
"Apache-2.0"
] | 87 | 2019-05-21T05:28:27.000Z | 2021-09-22T03:02:36.000Z | src/main/java/com/codebrig/journey/proxy/callback/CefNativeProxy.java | shuzijun/Journey | bbba94f0f870bd4e30826f31a38cef1460a801fa | [
"Apache-2.0"
] | 32 | 2019-05-17T22:25:53.000Z | 2021-06-15T16:27:24.000Z | src/main/java/com/codebrig/journey/proxy/callback/CefNativeProxy.java | shuzijun/Journey | bbba94f0f870bd4e30826f31a38cef1460a801fa | [
"Apache-2.0"
] | 24 | 2019-05-27T09:19:51.000Z | 2021-05-20T21:19:20.000Z | 31.921053 | 97 | 0.701566 | 7,273 | package com.codebrig.journey.proxy.callback;
import org.joor.Reflect;
/**
* Journey local proxy for CefNative.
* <p>
* Javadoc taken from: https://bitbucket.org/chromiumembedded/java-cef
*
* @author <a href="mailto:ychag@example.com">Dhruvit Raithatha</a>
* @version 0.4.0
* @since 0.4.0
*/
public interface CefNativeProxy extends Reflect.ProxyObject {
Reflect.ProxyArgumentsConverter PROXY_ARGUMENTS_CONVERTER = (methodName, args) -> {
};
Reflect.ProxyValueConverter PROXY_VALUE_CONVERTER = (methodName, returnValue) -> returnValue;
/**
* Method is called by the native code to store a reference
* to an implemented native JNI counterpart.
*
* @param identifer The name of the interface class (e.g. CefFocusHandler).
* @param nativeRef The reference to the native code.
*/
void setNativeRef(String identifer, long nativeRef);
/**
* Method is called by the native code to get the reference
* to an previous stored identifier.
*
* @param identifer The name of the interface class (e.g. CefFocusHandler).
* @return The stored reference value of the native code.
*/
long getNativeRef(String identifer);
} |
3e114399a44099536ac83a25e9bdf63135e096e3 | 7,475 | java | Java | Ftc3543Lib/src/main/java/ftclib/FtcAccelerometer.java | goncalvesm1/Robot_Project | 9945435d2e3cc37a953f91dd4dbb3869064bc3b2 | [
"MIT"
] | 21 | 2016-09-03T19:32:01.000Z | 2022-01-18T03:00:03.000Z | Ftc3543Lib/src/main/java/ftclib/FtcAccelerometer.java | goncalvesm1/Robot_Project | 9945435d2e3cc37a953f91dd4dbb3869064bc3b2 | [
"MIT"
] | 6 | 2017-11-15T01:15:26.000Z | 2020-12-23T03:46:49.000Z | Ftc3543Lib/src/main/java/ftclib/FtcAccelerometer.java | goncalvesm1/Robot_Project | 9945435d2e3cc37a953f91dd4dbb3869064bc3b2 | [
"MIT"
] | 21 | 2016-10-06T04:14:54.000Z | 2021-12-09T22:25:05.000Z | 36.642157 | 120 | 0.668227 | 7,274 | /*
* Copyright (c) 2015 Titan Robotics Club (http://www.titanrobotics.com)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package ftclib;
import com.qualcomm.robotcore.hardware.AccelerationSensor;
import com.qualcomm.robotcore.hardware.HardwareMap;
import org.firstinspires.ftc.robotcore.external.navigation.Acceleration;
import trclib.TrcAccelerometer;
import trclib.TrcDbgTrace;
import trclib.TrcFilter;
import trclib.TrcUtil;
/**
* This class implements the platform dependent accelerometer extending TrcAccelerometer. It provides implementation
* of the abstract methods in TrcAccelerometer. It supports 3 axes: x, y and z. It provides acceleration data for all
* 3 axes. However, it doesn't provide any velocity or distance data.
*/
public class FtcAccelerometer extends TrcAccelerometer
{
private static final String moduleName = "FtcAccelerometer";
private static final boolean debugEnabled = false;
private static final boolean tracingEnabled = false;
private static final TrcDbgTrace.TraceLevel traceLevel = TrcDbgTrace.TraceLevel.API;
private static final TrcDbgTrace.MsgLevel msgLevel = TrcDbgTrace.MsgLevel.INFO;
private TrcDbgTrace dbgTrace = null;
private AccelerationSensor accel;
/**
* Constructor: Creates an instance of the object.
*
* @param hardwareMap specifies the global hardware map.
* @param instanceName specifies the instance name.
* @param filters specifies an array of filters to use for filtering sensor noise, one for each axis. Since we
* have 3 axes, the array should have 3 elements. If no filters are used, it can be set to null.
*/
public FtcAccelerometer(HardwareMap hardwareMap, String instanceName, TrcFilter[] filters)
{
super(instanceName, 3,
ACCEL_HAS_X_AXIS | ACCEL_HAS_Y_AXIS | ACCEL_HAS_Z_AXIS | ACCEL_INTEGRATE | ACCEL_DOUBLE_INTEGRATE,
filters);
if (debugEnabled)
{
dbgTrace = new TrcDbgTrace(moduleName + "." + instanceName, tracingEnabled, traceLevel, msgLevel);
}
accel = hardwareMap.accelerationSensor.get(instanceName);
} //FtcAccelerometer
/**
* Constructor: Creates an instance of the object.
*
* @param instanceName specifies the instance name.
* @param filters specifies an array of filters to use for filtering sensor noise, one for each axis. Since we
* have 3 axes, the array should have 3 elements. If no filters are used, it can be set to null.
*/
public FtcAccelerometer(String instanceName, TrcFilter[] filters)
{
this(FtcOpMode.getInstance().hardwareMap, instanceName, filters);
} //FtcAccelerometer
/**
* Constructor: Creates an instance of the object.
*
* @param instanceName specifies the instance name.
*/
public FtcAccelerometer(String instanceName)
{
this(instanceName, null);
} //FtcAccelerometer
/**
* This method calibrates the sensor.
*/
public void calibrate()
{
calibrate(DataType.ACCELERATION);
} //calibrate
//
// Implements TrcAccelerometer abstract methods.
//
/**
* This method returns the raw data of the specified type for the x-axis.
*
* @param dataType specifies the data type.
* @return raw data of the specified type for the x-axis.
*/
@Override
public synchronized SensorData<Double> getRawXData(DataType dataType)
{
final String funcName = "getRawXData";
SensorData<Double> data;
if (dataType == DataType.ACCELERATION)
{
Acceleration accelData = accel.getAcceleration();
data = new SensorData<>(TrcUtil.getCurrentTime(), accelData.xAccel);
}
else
{
throw new UnsupportedOperationException("Accelerometer sensor does not provide velocity or distance data.");
}
if (debugEnabled)
{
dbgTrace.traceEnter(funcName, TrcDbgTrace.TraceLevel.API);
dbgTrace.traceExit(funcName, TrcDbgTrace.TraceLevel.API,
"=(timestamp:%.3f,value:%f", data.timestamp, data.value);
}
return data;
} //getRawXData
/**
* This method returns the raw data of the specified type for the y-axis.
*
* @param dataType specifies the data type.
* @return raw data of the specified type for the y-axis.
*/
@Override
public synchronized SensorData<Double> getRawYData(DataType dataType)
{
final String funcName = "getRawYData";
SensorData<Double> data;
if (dataType == DataType.ACCELERATION)
{
Acceleration accelData = accel.getAcceleration();
data = new SensorData<>(TrcUtil.getCurrentTime(), accelData.yAccel);
}
else
{
throw new UnsupportedOperationException("Accelerometer sensor does not provide velocity or distance data.");
}
if (debugEnabled)
{
dbgTrace.traceEnter(funcName, TrcDbgTrace.TraceLevel.API);
dbgTrace.traceExit(funcName, TrcDbgTrace.TraceLevel.API,
"=(timestamp:%.3f,value:%f", data.timestamp, data.value);
}
return data;
} //getRawYData
/**
* This method returns the raw data of the specified type for the z-axis.
*
* @param dataType specifies the data type.
* @return raw data of the specified type for the z-axis.
*/
@Override
public synchronized SensorData<Double> getRawZData(DataType dataType)
{
final String funcName = "getRawZData";
SensorData<Double> data;
if (dataType == DataType.ACCELERATION)
{
Acceleration accelData = accel.getAcceleration();
data = new SensorData<>(TrcUtil.getCurrentTime(), accelData.zAccel);
}
else
{
throw new UnsupportedOperationException("Accelerometer sensor does not provide velocity or distance data.");
}
if (debugEnabled)
{
dbgTrace.traceEnter(funcName, TrcDbgTrace.TraceLevel.API);
dbgTrace.traceExit(funcName, TrcDbgTrace.TraceLevel.API,
"=(timestamp:%.3f,value:%f", data.timestamp, data.value);
}
return data;
} //getRawZData
} //class FtcAccelerometer
|
3e1143a53ac2084c1398aeecc9c5b6e3cf3066f1 | 1,822 | java | Java | eclipse/nsfs/nsf-jakartaee-example/odp/Code/Java/bean/ApplicationGuy.java | perlausten/org.openntf.xsp.jakartaee | 37868a40d6c76c12f47fb5685fd21445302af7e9 | [
"Apache-2.0"
] | null | null | null | eclipse/nsfs/nsf-jakartaee-example/odp/Code/Java/bean/ApplicationGuy.java | perlausten/org.openntf.xsp.jakartaee | 37868a40d6c76c12f47fb5685fd21445302af7e9 | [
"Apache-2.0"
] | null | null | null | eclipse/nsfs/nsf-jakartaee-example/odp/Code/Java/bean/ApplicationGuy.java | perlausten/org.openntf.xsp.jakartaee | 37868a40d6c76c12f47fb5685fd21445302af7e9 | [
"Apache-2.0"
] | null | null | null | 30.366667 | 80 | 0.763996 | 7,275 | /**
* Copyright © 2018-2022 Contributors to the XPages Jakarta EE Support 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 bean;
import jakarta.annotation.PostConstruct;
import jakarta.annotation.PreDestroy;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Named;
import jakarta.json.bind.annotation.JsonbProperty;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlRootElement;
@ApplicationScoped
@Named("applicationGuy")
@XmlRootElement(name="application-guy")
public class ApplicationGuy {
@XmlElement(name="time")
private final long time = System.currentTimeMillis();
@XmlElement(name="postConstructSet")
private String postConstructSet;
private String beanProperty;
public String getBeanProperty() {
return beanProperty;
}
public void setBeanProperty(String beanProperty) {
this.beanProperty = beanProperty;
}
@JsonbProperty(value="jsonMessage")
public String getMessage() {
return "I'm application guy at " + time;
}
public String getMessageWithArg(String arg) {
return "I've been told " + arg;
}
@PostConstruct
public void postConstruct() {
System.out.println("Created applicationGuy!");
}
@PreDestroy
public void preDestroy() { System.out.println("Destroying applicationGuy!"); }
}
|
3e114418528038d267a21563ba6ab8ff115be25b | 1,049 | java | Java | bundle/edu.gemini.obslog/src/main/java/edu/gemini/obslog/transfer/TransferBase.java | jocelynferrara/ocs | 446c8a8e03d86bd341ac024fae6811ecb643e185 | [
"BSD-3-Clause"
] | 13 | 2015-02-04T21:33:56.000Z | 2020-04-10T01:37:41.000Z | bundle/edu.gemini.obslog/src/main/java/edu/gemini/obslog/transfer/TransferBase.java | jocelynferrara/ocs | 446c8a8e03d86bd341ac024fae6811ecb643e185 | [
"BSD-3-Clause"
] | 1,169 | 2015-01-02T13:20:50.000Z | 2022-03-21T12:01:59.000Z | bundle/edu.gemini.obslog/src/main/java/edu/gemini/obslog/transfer/TransferBase.java | jocelynferrara/ocs | 446c8a8e03d86bd341ac024fae6811ecb643e185 | [
"BSD-3-Clause"
] | 13 | 2015-04-07T18:01:55.000Z | 2021-02-03T12:57:58.000Z | 29.138889 | 119 | 0.70448 | 7,276 | package edu.gemini.obslog.transfer;
import edu.gemini.obslog.core.OlSegmentType;
import edu.gemini.pot.sp.SPComponentType;
import java.io.Serializable;
//
// Gemini Observatory/AURA
// $Id: TransferBase.java,v 1.1 2005/12/11 15:54:15 gillies Exp $
//
abstract class TransferBase implements Serializable {
private static final long serialVersionUID = 1;
private OlSegmentType _instType;
/**
* The low-level data structure is a unique configuration of parameters from the database and one or more datasets.
* For instance the parameter programID in system "ocs" is ocs.programID.
*/
public TransferBase(SPComponentType instType) {
_instType = new OlSegmentType(instType);
}
/**
* Return the segment type for this observation. The segment type is used to tell one segment from another.
* instrument that is used to
*
* @return the {@link edu.gemini.obslog.core.OlSegmentType} for this segment.
*/
public OlSegmentType getType() {
return _instType;
}
}
|
3e114455ed3bbcec22b7237b7540c3a84f2bfb97 | 410 | java | Java | app/src/main/java/com/voador/guardeiro/flightclub/infrastructure/repositories/GraduacaoRepository.java | Jean1dev/FightClub | da9bcea50a687ddf1dfc9cd5f71e438dbe65ec07 | [
"MIT"
] | null | null | null | app/src/main/java/com/voador/guardeiro/flightclub/infrastructure/repositories/GraduacaoRepository.java | Jean1dev/FightClub | da9bcea50a687ddf1dfc9cd5f71e438dbe65ec07 | [
"MIT"
] | null | null | null | app/src/main/java/com/voador/guardeiro/flightclub/infrastructure/repositories/GraduacaoRepository.java | Jean1dev/FightClub | da9bcea50a687ddf1dfc9cd5f71e438dbe65ec07 | [
"MIT"
] | null | null | null | 27.333333 | 75 | 0.804878 | 7,277 | package com.voador.guardeiro.flightclub.infrastructure.repositories;
import android.content.Context;
import com.voador.guardeiro.flightclub.infrastructure.database.AbstractDAO;
import com.voador.guardeiro.flightclub.models.Graduacao;
public class GraduacaoRepository extends AbstractDAO<Graduacao, Long> {
public GraduacaoRepository(Context context) {
super(context, Graduacao.class);
}
}
|
3e11462400511fd3d1914457ef6870e8e63843de | 2,615 | java | Java | ProblemsAndSolutions/src/com/java/solutions/MostPopularWord.java | heliosnarcissus/CodingChallenges | 4e84512d45f6beb9a89bed4b61719f7d32386dd4 | [
"MIT"
] | 1 | 2020-10-02T15:41:09.000Z | 2020-10-02T15:41:09.000Z | ProblemsAndSolutions/src/com/java/solutions/MostPopularWord.java | heliosnarcissus/CodingChallenges | 4e84512d45f6beb9a89bed4b61719f7d32386dd4 | [
"MIT"
] | null | null | null | ProblemsAndSolutions/src/com/java/solutions/MostPopularWord.java | heliosnarcissus/CodingChallenges | 4e84512d45f6beb9a89bed4b61719f7d32386dd4 | [
"MIT"
] | null | null | null | 42.177419 | 155 | 0.686424 | 7,278 | package com.java.solutions;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class MostPopularWord {
public static void main(String[] args) {
// TODO Auto-generated method stub
String sentence = "1st day of F##king Christma$ red red red blue blue";
String celebrity = getPopularWord(sentence);
System.out.println("the popular word is:" + celebrity);
}
private static String getPopularWord(String str) {
/** 1.use String split() to convert sentence into an array which contains words by using 'white spaces' to define 'what a word is',
\\s+ is regex for 'white space'. Here we say, anything between a 'white space' is a word. **/
String[] words = str.split("\\s+");
/** 2. String[] 'words' now contains an array of words. Now we dont want any word that contains 'special characters' and 'numbers'
* So, we create a boolean function to enforce that. We'll call it isValidWord(String str) **/
List<String> validWords = new ArrayList<>();
for (int i = 0; i < words.length; i++) {
if(isValidWord(words[i])) {
validWords.add(words[i]);
}
}
/** 3. Time to count the number of occurrences to determine the most popular word. For this, we use HashMaps. The map get(key) function
* asks you to provide the key, so it can return the value. If there is no current mapping for the 'key', it returns NULL.
* Also, duplicate keys are not allowed in Java Maps, hence perfect for counting number of occurrences (thru values).**/
Map<String, Integer> occurrences = new HashMap<>();
for(String word: validWords) {
Integer ctr = occurrences.get(word);
if(ctr == null) {
ctr = 0;
}
occurrences.put(word, ++ctr);
}
System.out.println(occurrences);
/** 4. Now, our map named 'occurrences' contains the words (key) and the number of times they were used (value) in a format like 'Key = red, Value = 10'.
* Time to fetch the most popular word by comparing the keys and their corresponding values. To do this, we need to traverse the Java Map.
* The easiest way to do this is to use entrySet().**/
Integer maxCount = 0;
Integer valueOfKey = 0;
String popularWord = "";
for(Map.Entry<String, Integer> entry: occurrences.entrySet()) {
valueOfKey = occurrences.get(entry.getKey());
if(valueOfKey > maxCount){
maxCount = valueOfKey;
popularWord = entry.getKey();
}
}
return popularWord;
}
//We only want word with lowercase or uppercase letters
private static boolean isValidWord(String str) {
return str.matches("^[a-zA-Z]*$");
}
}
|
3e11467ba1d91820a363f7660792cedc186ca2db | 753 | java | Java | game-engine/src/main/java/engine/client/asset/source/ModAssetSource.java | SkyFoundation/PanguEngine | a4335375406e79fa78d0877f0b7f244f3ee99f44 | [
"Apache-2.0"
] | 59 | 2020-08-05T02:22:39.000Z | 2022-03-13T12:45:42.000Z | game-engine/src/main/java/engine/client/asset/source/ModAssetSource.java | SkyFoundation/PanguEngine | a4335375406e79fa78d0877f0b7f244f3ee99f44 | [
"Apache-2.0"
] | 37 | 2019-05-14T04:42:50.000Z | 2020-01-07T12:48:56.000Z | game-engine/src/main/java/engine/client/asset/source/ModAssetSource.java | SkyFoundation/PanguEngine | a4335375406e79fa78d0877f0b7f244f3ee99f44 | [
"Apache-2.0"
] | 16 | 2019-05-26T07:22:35.000Z | 2019-12-16T05:00:23.000Z | 27.888889 | 96 | 0.756972 | 7,279 | package engine.client.asset.source;
import engine.mod.ModContainer;
import javax.annotation.Nonnull;
import java.io.IOException;
import static java.util.Objects.requireNonNull;
public class ModAssetSource extends CompositeAssetSource {
public static ModAssetSource create(@Nonnull ModContainer modContainer) throws IOException {
return new ModAssetSource(requireNonNull(modContainer), "asset");
}
private final ModContainer modContainer;
private ModAssetSource(ModContainer modContainer, String root) throws IOException {
super(modContainer.getSources(), root, modContainer.getClassLoader());
this.modContainer = modContainer;
}
public ModContainer getMod() {
return modContainer;
}
}
|
3e1146c98b8916b431f0c0003e326413de3fd111 | 1,819 | java | Java | QuickParked/src/main/java/org/devscite/Model/Car.java | dani09barreto/QuickParked | 9664b15853a6c958747ee06d4326fa50930a703d | [
"MIT"
] | 1 | 2022-03-29T01:32:01.000Z | 2022-03-29T01:32:01.000Z | QuickParked/src/main/java/org/devscite/Model/Car.java | dani09barreto/QuickParked | 9664b15853a6c958747ee06d4326fa50930a703d | [
"MIT"
] | null | null | null | QuickParked/src/main/java/org/devscite/Model/Car.java | dani09barreto/QuickParked | 9664b15853a6c958747ee06d4326fa50930a703d | [
"MIT"
] | 1 | 2022-03-25T12:40:43.000Z | 2022-03-25T12:40:43.000Z | 26.75 | 101 | 0.5558 | 7,280 | package org.devscite.Model;
import org.devscite.Utils.Exeptions.InvalidLicensePlate;
import java.text.SimpleDateFormat;
import java.util.Calendar;
public class Car extends Vehicle {
private static final String plateFormat = "[a-zA-Z]{3}[0-9]{3}";
private CarModel carModel;
public Car(String licensePlate, Calendar checkin, CarModel carModel) throws InvalidLicensePlate {
super(licensePlate, checkin);
this.carModel = carModel;
if (this.carModel == CarModel.Automovil) {
this.rate = 40;
}
if (this.carModel == CarModel.Camioneta) {
this.rate = 60;
}
if (this.carModel == CarModel.Furgon) {
this.rate = 75;
}
if (this.carModel == CarModel.Electrico) {
this.rate = 80;
}
}
@Override
public boolean invalidPlate(String licensePlate) {
return !licensePlate.matches(plateFormat);
}
@Override
public String getModel() {
return carModel.name();
}
public CarModel getCarModel() {
return carModel;
}
public void setCarModel(CarModel carModel) {
this.carModel = carModel;
}
@Override
public String toString() {
SimpleDateFormat time = new SimpleDateFormat("hh:mm:ss");
return "Vehicle : Car\n" +
"Rate: " + rate + "\n" +
"Car model: " + carModel + "\n" +
"License plate: " + licensePlate + "\n" +
"Checkin hour: " + time.format(checkin.getTime()) + "\n" +
"Checkout hour: " + time.format(checkout.getTime()) + '\n' +
"Price: " + this.price + '\n';
}
@Override
public String getTypeVehicle() {
return "Carro";
}
}
|
3e1146e93a6a0291e6123d0e0f1660651f4b381b | 464 | java | Java | app/src/processing/app/windows/WINERROR.java | anupam19/mididuino | 27c30f586a8d61381309434ed05b4958c7727402 | [
"BSD-3-Clause"
] | 19 | 2015-03-06T06:37:16.000Z | 2021-11-08T12:19:59.000Z | app/src/processing/app/windows/WINERROR.java | anupam19/mididuino | 27c30f586a8d61381309434ed05b4958c7727402 | [
"BSD-3-Clause"
] | 2 | 2015-01-18T21:11:17.000Z | 2017-04-26T01:10:51.000Z | app/src/processing/app/windows/WINERROR.java | anupam19/mididuino | 27c30f586a8d61381309434ed05b4958c7727402 | [
"BSD-3-Clause"
] | 19 | 2015-05-02T05:49:06.000Z | 2021-01-31T04:03:21.000Z | 20.173913 | 60 | 0.670259 | 7,281 | /*
* WINERROR.java
*
* Created on 7. August 2007, 08:09
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package processing.app.windows;
/**
*
* @author TB
*/
public interface WINERROR {
public final static int ERROR_SUCCESS = 0;
public final static int NO_ERROR = 0;
public final static int ERROR_FILE_NOT_FOUND = 2;
public final static int ERROR_MORE_DATA = 234;
}
|
3e11482b85acf50ee5441ff5d5d2c38ee282f0e1 | 4,183 | java | Java | reformcloud2-applications/reformcloud2-default-application-commands/src/main/java/systems/reformcloud/reformcloud2/commands/plugin/bungeecord/commands/CommandLeave.java | JanDragon/reformcloud2 | 48b93877c60b27243484260b691713be1790be5d | [
"MIT"
] | null | null | null | reformcloud2-applications/reformcloud2-default-application-commands/src/main/java/systems/reformcloud/reformcloud2/commands/plugin/bungeecord/commands/CommandLeave.java | JanDragon/reformcloud2 | 48b93877c60b27243484260b691713be1790be5d | [
"MIT"
] | null | null | null | reformcloud2-applications/reformcloud2-default-application-commands/src/main/java/systems/reformcloud/reformcloud2/commands/plugin/bungeecord/commands/CommandLeave.java | JanDragon/reformcloud2 | 48b93877c60b27243484260b691713be1790be5d | [
"MIT"
] | null | null | null | 46.477778 | 132 | 0.708821 | 7,282 | /*
* MIT License
*
* Copyright (c) ReformCloud-Team
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package systems.reformcloud.reformcloud2.commands.plugin.bungeecord.commands;
import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.chat.TextComponent;
import net.md_5.bungee.api.config.ServerInfo;
import net.md_5.bungee.api.connection.ProxiedPlayer;
import net.md_5.bungee.api.plugin.Command;
import org.jetbrains.annotations.NotNull;
import systems.reformcloud.reformcloud2.executor.api.bungee.BungeeExecutor;
import systems.reformcloud.reformcloud2.executor.api.bungee.fallback.BungeeFallbackExtraFilter;
import systems.reformcloud.reformcloud2.executor.api.shared.SharedPlayerFallbackFilter;
import java.util.List;
public class CommandLeave extends Command {
public CommandLeave(@NotNull String name, @NotNull List<String> aliases) {
super(name, null, aliases.toArray(new String[0]));
}
@Override
public void execute(CommandSender commandSender, String[] strings) {
if (!(commandSender instanceof ProxiedPlayer)) {
return;
}
final ProxiedPlayer proxiedPlayer = (ProxiedPlayer) commandSender;
if (proxiedPlayer.getServer() == null) {
return;
}
if (BungeeExecutor.getInstance().getCachedLobbyServices().stream().anyMatch(
e -> e.getProcessDetail().getName().equals(proxiedPlayer.getServer().getInfo().getName()))
) {
proxiedPlayer.sendMessage(TextComponent.fromLegacyText(BungeeExecutor.getInstance().getMessages().format(
BungeeExecutor.getInstance().getMessages().getAlreadyConnectedToHub()
)));
return;
}
SharedPlayerFallbackFilter.filterFallback(
proxiedPlayer.getUniqueId(),
BungeeExecutor.getInstance().getCachedLobbyServices(),
proxiedPlayer::hasPermission,
BungeeFallbackExtraFilter.INSTANCE,
proxiedPlayer.getServer().getInfo().getName()
).ifPresent(processInformation -> {
ServerInfo serverInfo = ProxyServer.getInstance().getServerInfo(processInformation.getProcessDetail().getName());
if (serverInfo == null) {
proxiedPlayer.sendMessage(TextComponent.fromLegacyText(BungeeExecutor.getInstance().getMessages().format(
BungeeExecutor.getInstance().getMessages().getNoHubServerAvailable()
)));
return;
}
proxiedPlayer.sendMessage(TextComponent.fromLegacyText(BungeeExecutor.getInstance().getMessages().format(
BungeeExecutor.getInstance().getMessages().getConnectingToHub(), processInformation.getProcessDetail().getName()
)));
proxiedPlayer.connect(serverInfo);
}).ifEmpty(v -> proxiedPlayer.sendMessage(TextComponent.fromLegacyText(BungeeExecutor.getInstance().getMessages().format(
BungeeExecutor.getInstance().getMessages().getNoHubServerAvailable()
))));
}
}
|
3e11482fe2221f10c2b5d02650d066475f825601 | 1,921 | java | Java | src/main/java/global/skymind/solution/fundamental/ex5/Ex5_RelationalOps.java | amrnumenor/java-traininglabs | a93268f60e6a8491b1d156fae183a108ff0d9243 | [
"Apache-2.0"
] | null | null | null | src/main/java/global/skymind/solution/fundamental/ex5/Ex5_RelationalOps.java | amrnumenor/java-traininglabs | a93268f60e6a8491b1d156fae183a108ff0d9243 | [
"Apache-2.0"
] | 9 | 2021-04-09T06:26:18.000Z | 2021-09-29T10:06:25.000Z | src/main/java/global/skymind/solution/fundamental/ex5/Ex5_RelationalOps.java | amrnumenor/java-traininglabs | a93268f60e6a8491b1d156fae183a108ff0d9243 | [
"Apache-2.0"
] | 16 | 2021-06-15T01:45:23.000Z | 2021-11-09T10:20:50.000Z | 34.303571 | 96 | 0.608017 | 7,283 | /*
* Copyright (c) 2020-2021 Skymind Education Group Sdn. Bhd.
*
* 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.
* SPDX-License-Identifier: Apache-2.0
*/
package global.skymind.solution.fundamental.ex5;
public class Ex5_RelationalOps {
public static void main(String[] args) {
/*
In Java, the relationship between two operands can be checked using relational
operators. Here, we demonstrate relational operators like "==", "!=", "<",
">", ">=" and "<=".
*/
double var1 = 1;
double var2 = 1;
System.out.println("\n******************** Relational Operations ********************");
System.out.println("var1 = " + var1 + ", var2 = " + var2);
// demonstrating "==" aka equal
System.out.println("var1 == var2 is " + (var1 == var2));
// demonstrating "!=" aka not equal
System.out.println("var1 != var2 is " + (var1 != var2));
// demonstrating "<" aka less than
System.out.println("var1 < var2 is " + (var1 < var2));
// demonstrating ">" aka greater than
System.out.println("var1 > var2 is " + (var1 > var2));
// demonstrating "<=" aka less than or equal to
System.out.println("var1 <= var2 is " + (var1 <= var2));
// demonstrating ">=" aka greater than or equal to
System.out.println("var1 >= var2 is " + (var1 >= var2));
}
}
|
3e114841f2836ea903222ec0493c44f3fe47c5d6 | 170 | java | Java | mybatis/src/main/java/com/nydia/modules/service/master/IUserService.java | nydia/JavaAdvancedTrain | 48775fde6201f4fa5928d47431bf5cf25f199b1e | [
"Apache-2.0"
] | null | null | null | mybatis/src/main/java/com/nydia/modules/service/master/IUserService.java | nydia/JavaAdvancedTrain | 48775fde6201f4fa5928d47431bf5cf25f199b1e | [
"Apache-2.0"
] | null | null | null | mybatis/src/main/java/com/nydia/modules/service/master/IUserService.java | nydia/JavaAdvancedTrain | 48775fde6201f4fa5928d47431bf5cf25f199b1e | [
"Apache-2.0"
] | 1 | 2021-08-31T10:46:43.000Z | 2021-08-31T10:46:43.000Z | 14.166667 | 44 | 0.717647 | 7,284 | package com.nydia.modules.service.master;
import com.nydia.modules.entity.master.User;
/**
* 接口
*/
public interface IUserService {
int insertUser(User user);
}
|
3e114866cf06e07f459e4397cf44c16c685dcfe4 | 1,867 | java | Java | seltzer-parent/seltzer-cr/src/main/java/tech/seltzer/objects/command/wait/visibility/VisibilityWaitCommandData.java | MrNakaan/Seltzer | cf3f8e641f399fe5b22f893273a0aec805f94b11 | [
"MIT"
] | 2 | 2017-08-28T17:33:22.000Z | 2017-10-10T14:52:40.000Z | seltzer-parent/seltzer-cr/src/main/java/tech/seltzer/objects/command/wait/visibility/VisibilityWaitCommandData.java | MrNakaan/Seltzer | cf3f8e641f399fe5b22f893273a0aec805f94b11 | [
"MIT"
] | 4 | 2017-06-27T05:00:34.000Z | 2017-06-27T05:01:33.000Z | seltzer-parent/seltzer-cr/src/main/java/tech/seltzer/objects/command/wait/visibility/VisibilityWaitCommandData.java | MrNakaan/Seltzer | cf3f8e641f399fe5b22f893273a0aec805f94b11 | [
"MIT"
] | null | null | null | 27.057971 | 105 | 0.726299 | 7,285 | package tech.seltzer.objects.command.wait.visibility;
import java.util.UUID;
import tech.seltzer.enums.CommandType;
import tech.seltzer.enums.SelectorType;
import tech.seltzer.objects.command.Selector;
import tech.seltzer.objects.command.wait.WaitCommandData;
public class VisibilityWaitCommandData extends WaitCommandData {
protected Selector selector = new Selector();
public VisibilityWaitCommandData(Integer seconds) {
super(seconds);
}
public VisibilityWaitCommandData(Integer seconds, CommandType waitType) {
super(seconds, waitType);
}
public VisibilityWaitCommandData(Integer seconds, CommandType waitType, UUID id) {
super(seconds, waitType, id);
}
public void setSelector(String selector, SelectorType selectorType) {
this.selector.setSelector(selectorType, selector);
}
@Override
public String toString() {
return "VisibilityWaitCommandData [selector=" + selector + ", seconds=" + seconds + ", hasCommandList="
+ hasCommandList + ", takeScreenshotBefore=" + takeScreenshotBefore + ", takeScreenshotAfter="
+ takeScreenshotAfter + ", commandType=" + commandType + ", id=" + id + "]";
}
@Override
public int hashCode() {
final int prime = 31;
int result = super.hashCode();
result = prime * result + ((selector == null) ? 0 : selector.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (!super.equals(obj))
return false;
if (getClass() != obj.getClass())
return false;
VisibilityWaitCommandData other = (VisibilityWaitCommandData) obj;
if (selector == null) {
if (other.selector != null)
return false;
} else if (!selector.equals(other.selector))
return false;
return true;
}
public Selector getSelector() {
return selector;
}
public void setSelector(Selector selector) {
this.selector = selector;
}
}
|
3e11494e6438d5c9afcf33c8fa5bd471c7c0fd62 | 2,866 | java | Java | app/src/main/java/dev/iotarho/artplace/app/model/genes/GeneContent.java | fireflyfif/art-place-app | 97d9f08dc72d867c5536ede6ad93eeeb4cd8042a | [
"Unlicense"
] | 7 | 2018-08-29T14:00:34.000Z | 2022-03-19T14:06:22.000Z | app/src/main/java/dev/iotarho/artplace/app/model/genes/GeneContent.java | fireflyfif/art-place-app | 97d9f08dc72d867c5536ede6ad93eeeb4cd8042a | [
"Unlicense"
] | null | null | null | app/src/main/java/dev/iotarho/artplace/app/model/genes/GeneContent.java | fireflyfif/art-place-app | 97d9f08dc72d867c5536ede6ad93eeeb4cd8042a | [
"Unlicense"
] | 1 | 2019-09-10T10:16:28.000Z | 2019-09-10T10:16:28.000Z | 25.589286 | 94 | 0.649686 | 7,286 | package dev.iotarho.artplace.app.model.genes;
import android.os.Parcel;
import android.os.Parcelable;
import com.google.gson.annotations.SerializedName;
import java.util.List;
import dev.iotarho.artplace.app.model.ImageLinks;
public class GeneContent implements Parcelable {
@SerializedName("id")
private String id;
@SerializedName("created_at")
private String createdAt;
@SerializedName("updated_at")
private String updatedAt;
@SerializedName("name")
private String name;
@SerializedName("display_name")
private String displayName;
@SerializedName("description")
private String description;
@SerializedName("image_versions")
private List<String> imageVersions = null;
@SerializedName("_links")
private ImageLinks links;
public final static Parcelable.Creator<GeneContent> CREATOR = new Creator<GeneContent>() {
@SuppressWarnings({"unchecked"})
public GeneContent createFromParcel(Parcel in) {
return new GeneContent(in);
}
public GeneContent[] newArray(int size) {
return (new GeneContent[size]);
}
};
protected GeneContent(Parcel in) {
this.id = ((String) in.readValue((String.class.getClassLoader())));
this.createdAt = ((String) in.readValue((String.class.getClassLoader())));
this.updatedAt = ((String) in.readValue((String.class.getClassLoader())));
this.name = ((String) in.readValue((String.class.getClassLoader())));
this.displayName = ((String) in.readValue((String.class.getClassLoader())));
this.description = ((String) in.readValue((String.class.getClassLoader())));
in.readList(this.imageVersions, (java.lang.String.class.getClassLoader()));
this.links = ((ImageLinks) in.readValue((ImageLinks.class.getClassLoader())));
}
public GeneContent() {
}
public String getId() {
return id;
}
public String getCreatedAt() {
return createdAt;
}
public String getUpdatedAt() {
return updatedAt;
}
public String getName() {
return name;
}
public String getDisplayName() {
return displayName;
}
public String getDescription() {
return description;
}
public List<String> getImageVersions() {
return imageVersions;
}
public ImageLinks getLinks() {
return links;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeValue(id);
dest.writeValue(createdAt);
dest.writeValue(updatedAt);
dest.writeValue(name);
dest.writeValue(displayName);
dest.writeValue(description);
dest.writeList(imageVersions);
dest.writeValue(links);
}
@Override
public int describeContents() {
return 0;
}
}
|
3e114a05fde81b4ddc72c73cdc9de02eb7420b8d | 5,481 | java | Java | utilities/src/main/java/io/syndesis/qe/bdd/utils/GoogleCalendarSteps.java | mmuzikar/syndesis-qe | 02070b3ee915743fa5d6efc13e9a691f48c3b38f | [
"Apache-2.0"
] | 1 | 2020-07-16T08:21:43.000Z | 2020-07-16T08:21:43.000Z | utilities/src/main/java/io/syndesis/qe/bdd/utils/GoogleCalendarSteps.java | mmuzikar/syndesis-qe | 02070b3ee915743fa5d6efc13e9a691f48c3b38f | [
"Apache-2.0"
] | null | null | null | utilities/src/main/java/io/syndesis/qe/bdd/utils/GoogleCalendarSteps.java | mmuzikar/syndesis-qe | 02070b3ee915743fa5d6efc13e9a691f48c3b38f | [
"Apache-2.0"
] | null | null | null | 46.058824 | 153 | 0.631637 | 7,287 | package io.syndesis.qe.bdd.utils;
import org.springframework.beans.factory.annotation.Autowired;
import com.google.api.client.util.DateTime;
import com.google.api.services.calendar.model.Calendar;
import com.google.api.services.calendar.model.Event;
import com.google.api.services.calendar.model.EventAttendee;
import com.google.api.services.calendar.model.EventDateTime;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import cucumber.api.java.en.When;
import io.cucumber.datatable.DataTable;
import io.syndesis.qe.utils.GoogleCalendarUtils;
import lombok.extern.slf4j.Slf4j;
@Slf4j
public class GoogleCalendarSteps {
@Autowired
private GoogleCalendarUtils gcu;
@When("^create calendars$")
public void createCalendar(DataTable calendarsData) throws IOException {
List<Map<String, String>> valueRows = calendarsData.asMaps(String.class, String.class);
for (Map<String, String> row : valueRows) {
String testAccount = row.get("google_account");
String calendar_summary = row.get("calendar_summary");
Calendar c = gcu.getPreviouslyCreatedCalendar(testAccount, calendar_summary);
// remove a previously created calendar with matching summary (aka title)
if (c != null) {
gcu.deleteCalendar(testAccount, c.getId());
}
c = new Calendar();
c.setSummary(calendar_summary);
c.setDescription(row.get("calendar_description"));
c = gcu.insertCalendar(testAccount, c);
}
}
@When("^create following \"([^\"]*)\" events in calendar \"([^\"]*)\" with account \"([^\"]*)\"$")
public void createFollowingEventsInCalendarWithAccount(String eventTime, String calendarName, String account, DataTable events) throws IOException {
List<Map<String, String>> valueRows = events.asMaps(String.class, String.class);
String prefix = ((eventTime.equalsIgnoreCase("all")) ? "" : eventTime).trim();
for (Map<String, String> row : valueRows) {
String eventName = row.get("summary").trim();
if (!eventName.startsWith(prefix)) {
continue;
}
String eventDescription = row.get("description");
String attendeesString = row.get("attendees");
Event e = new Event();
e.setSummary(eventName);
e.setStart(getDateOrDateTime("start", row));
e.setEnd(getDateOrDateTime("end", row));
e.setDescription(eventDescription);
if (attendeesString != null) {
List<EventAttendee> attendees = new ArrayList<>();
for (String s : attendeesString.split(",")) {
EventAttendee eA = new EventAttendee();
eA.setEmail(s.trim());
attendees.add(eA);
}
e.setAttendees(attendees);
}
gcu.insertEvent(account, gcu.getPreviouslyCreatedCalendar(account, calendarName).getId(), e);
}
}
/**
* Method that returns EventDateTime instance based on the row defined in table for the step.
*
* @param prefix either "start" or "end"
* @param row the row with data (expecting presence of either prefix+"_date" or prefix+"_time"),
* if none provided, time is defined as now()+24h for "start" and now()+25h for "end" times
* @return EventDateTime instance with either prefix+"_date" or prefix+"_time" fields set
*/
private EventDateTime getDateOrDateTime(String prefix, Map<String, String> row) {
EventDateTime edt = new EventDateTime();
String dateValueIdentifier = prefix + "_date";
String timeValueIdentifier = prefix + "_time";
String dateValue = row.get(dateValueIdentifier);
String timeValue = row.get(timeValueIdentifier);
if (dateValue != null && !dateValue.isEmpty()) { // if date value are provided set it
if (timeValue != null && !timeValue.isEmpty()) {
edt.setDateTime(DateTime.parseRfc3339(dateValue + "T" + timeValue));
} else {
edt.setDate(DateTime.parseRfc3339(dateValue));
}
} else { // if date value not provided set time in future
// offset of 24 or 25 hours to future: start time now()+24, end time now()+25
long millisToFuture = ((prefix.equalsIgnoreCase("start") ? 0 : 1) + 24) * 60 * 60 * 1000;
edt.setDateTime(new DateTime(System.currentTimeMillis() + millisToFuture));
}
return edt;
}
@When("^update event \"([^\"]*)\" in calendar \"([^\"]*)\" for user \"([^\"]*)\" with values$")
public void updateEventInCalendarForUserWithValues(String eventSummary, String calendarName, String account, DataTable properties) throws Throwable {
String calendarId = gcu.getPreviouslyCreatedCalendar(account, calendarName).getId();
Event e = gcu.getEventBySummary(account, calendarId, eventSummary);
if (e == null) {
throw new IllegalStateException(String.format("Looking for non-existent event %s in calendar %s", eventSummary, calendarName));
}
for (List<String> list : properties.cells()) {
String key = list.get(0);
String value = list.get(1);
e.set(key, value);
}
gcu.updateEvent(account, calendarId, e);
}
}
|
3e114b12534af545484f5eccc51635c3c52b8e83 | 476 | java | Java | serenity-screenplay-webdriver/src/main/java/net/serenitybdd/screenplay/actions/HoverOverElement.java | ricardorlg-aval/serenity-core | 97ee446aa544545a642a21c36090015d1bc733c1 | [
"Apache-2.0"
] | 649 | 2015-01-14T13:07:04.000Z | 2022-03-27T15:06:48.000Z | serenity-screenplay-webdriver/src/main/java/net/serenitybdd/screenplay/actions/HoverOverElement.java | timai89/serenity-core | f561ab70fa8d651fb171e332543d727701269dbd | [
"Apache-2.0"
] | 2,344 | 2015-01-06T16:21:46.000Z | 2022-03-31T13:44:14.000Z | serenity-screenplay-webdriver/src/main/java/net/serenitybdd/screenplay/actions/HoverOverElement.java | timai89/serenity-core | f561ab70fa8d651fb171e332543d727701269dbd | [
"Apache-2.0"
] | 571 | 2015-01-19T02:25:31.000Z | 2022-03-29T15:46:13.000Z | 20.695652 | 57 | 0.707983 | 7,288 | package net.serenitybdd.screenplay.actions;
import net.serenitybdd.screenplay.Actor;
import org.openqa.selenium.WebElement;
public class HoverOverElement extends Hover {
private final WebElement target;
public HoverOverElement(WebElement target) {
this.target = target;
}
protected WebElement resolveElementFor(Actor actor) {
return target;
}
@Override
protected String getTarget() {
return target.toString();
}
}
|
3e114b42522693fef954767937f5886861366a22 | 2,132 | java | Java | src/visao/jasperreports-6.15.0/src/net/sf/jasperreports/engine/json/expression/member/ObjectConstructionExpression.java | EuKaique/Projeto-Diagnostico-Medico | cf7cc535ff31992b7568dba777c8faafafa6920c | [
"MIT"
] | null | null | null | src/visao/jasperreports-6.15.0/src/net/sf/jasperreports/engine/json/expression/member/ObjectConstructionExpression.java | EuKaique/Projeto-Diagnostico-Medico | cf7cc535ff31992b7568dba777c8faafafa6920c | [
"MIT"
] | null | null | null | src/visao/jasperreports-6.15.0/src/net/sf/jasperreports/engine/json/expression/member/ObjectConstructionExpression.java | EuKaique/Projeto-Diagnostico-Medico | cf7cc535ff31992b7568dba777c8faafafa6920c | [
"MIT"
] | null | null | null | 32.484848 | 116 | 0.723414 | 7,289 | /*
* JasperReports - Free Java Reporting Library.
* Copyright (C) 2001 - 2019 TIBCO Software Inc. All rights reserved.
* http://www.jaspersoft.com
*
* Unless you have purchased a commercial license agreement from Jaspersoft,
* the following license terms apply:
*
* This program is part of JasperReports.
*
* JasperReports is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* JasperReports 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with JasperReports. If not, see <http://www.gnu.org/licenses/>.
*/
package net.sf.jasperreports.engine.json.expression.member;
import java.util.ArrayList;
import java.util.List;
import net.sf.jasperreports.engine.json.JsonNodeContainer;
import net.sf.jasperreports.engine.json.expression.member.evaluation.MemberExpressionEvaluatorVisitor;
/**
* @author Narcis Marcu (upchh@example.com)
*/
public class ObjectConstructionExpression extends AbstractMemberExpression {
private List<String> objectKeys;
public ObjectConstructionExpression() {
objectKeys = new ArrayList<>();
}
@Override
public JsonNodeContainer evaluate(JsonNodeContainer nodeContainer, MemberExpressionEvaluatorVisitor evaluator) {
return evaluator.evaluateObjectConstruction(this, nodeContainer);
}
public void addKey(String key) {
objectKeys.add(key);
}
public List<String> getObjectKeys() {
return objectKeys;
}
@Override
public String toString() {
String result = getDirection() + " " + objectKeys;
if (getFilterExpression() != null) {
result += "(" + getFilterExpression() + ")";
}
return result;
}
}
|
3e114b4446647b12633f4023965c993c934973b0 | 12,257 | java | Java | src/test/java/com/commercetools/sync/products/ProductSyncTest.java | heshamMassoud/commercetools-sync-java | bdc0553cd6b9f24bd7fdbbd976d9d55561930042 | [
"Apache-2.0"
] | null | null | null | src/test/java/com/commercetools/sync/products/ProductSyncTest.java | heshamMassoud/commercetools-sync-java | bdc0553cd6b9f24bd7fdbbd976d9d55561930042 | [
"Apache-2.0"
] | null | null | null | src/test/java/com/commercetools/sync/products/ProductSyncTest.java | heshamMassoud/commercetools-sync-java | bdc0553cd6b9f24bd7fdbbd976d9d55561930042 | [
"Apache-2.0"
] | null | null | null | 46.25283 | 109 | 0.712246 | 7,290 | package com.commercetools.sync.products;
import com.commercetools.sync.products.helpers.ProductSyncStatistics;
import com.commercetools.sync.services.CategoryService;
import com.commercetools.sync.services.ChannelService;
import com.commercetools.sync.services.CustomerGroupService;
import com.commercetools.sync.services.ProductService;
import com.commercetools.sync.services.ProductTypeService;
import com.commercetools.sync.services.StateService;
import com.commercetools.sync.services.TaxCategoryService;
import com.commercetools.sync.services.TypeService;
import com.commercetools.sync.services.impl.ProductServiceImpl;
import io.sphere.sdk.client.SphereClient;
import io.sphere.sdk.models.SphereException;
import io.sphere.sdk.products.Product;
import io.sphere.sdk.products.ProductDraft;
import io.sphere.sdk.products.queries.ProductQuery;
import io.sphere.sdk.producttypes.ProductType;
import org.junit.jupiter.api.Test;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.UUID;
import java.util.concurrent.CompletionException;
import static com.commercetools.sync.commons.asserts.statistics.AssertionsForStatistics.assertThat;
import static com.commercetools.sync.products.ProductSyncMockUtils.PRODUCT_KEY_1_WITH_PRICES_RESOURCE_PATH;
import static com.commercetools.sync.products.ProductSyncMockUtils.PRODUCT_KEY_2_RESOURCE_PATH;
import static com.commercetools.sync.products.ProductSyncMockUtils.createProductDraftBuilder;
import static io.sphere.sdk.json.SphereJsonUtils.readObjectFromResource;
import static java.util.Collections.emptyMap;
import static java.util.Collections.emptySet;
import static java.util.Collections.singleton;
import static java.util.Collections.singletonList;
import static java.util.concurrent.CompletableFuture.completedFuture;
import static java.util.concurrent.CompletableFuture.supplyAsync;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anySet;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
class ProductSyncTest {
@Test
void sync_WithErrorCachingKeys_ShouldExecuteCallbackOnErrorAndIncreaseFailedCounter() {
// preparation
final ProductDraft productDraft = createProductDraftBuilder(PRODUCT_KEY_2_RESOURCE_PATH,
ProductType.referenceOfId("productTypeKey"))
.taxCategory(null)
.state(null)
.build();
final List<String> errorMessages = new ArrayList<>();
final List<Throwable> exceptions = new ArrayList<>();
final SphereClient mockClient = mock(SphereClient.class);
when(mockClient.execute(any(ProductQuery.class)))
.thenReturn(supplyAsync(() -> { throw new SphereException(); }));
final ProductSyncOptions syncOptions = ProductSyncOptionsBuilder
.of(mockClient)
.errorCallback((errorMessage, exception) -> {
errorMessages.add(errorMessage);
exceptions.add(exception);
})
.build();
final ProductService productService = spy(new ProductServiceImpl(syncOptions));
final ProductTypeService productTypeService = mock(ProductTypeService.class);
when(productTypeService.fetchCachedProductTypeId(any()))
.thenReturn(completedFuture(Optional.of(UUID.randomUUID().toString())));
final CategoryService categoryService = mock(CategoryService.class);
when(categoryService.fetchMatchingCategoriesByKeys(any())).thenReturn(completedFuture(emptySet()));
final ProductSync productSync = new ProductSync(syncOptions, productService,
productTypeService, categoryService, mock(TypeService.class),
mock(ChannelService.class), mock(CustomerGroupService.class), mock(TaxCategoryService.class),
mock(StateService.class));
// test
final ProductSyncStatistics productSyncStatistics = productSync
.sync(singletonList(productDraft))
.toCompletableFuture().join();
// assertions
assertThat(errorMessages)
.hasSize(1)
.hasOnlyOneElementSatisfying(message ->
assertThat(message).contains("Failed to build a cache of keys to ids.")
);
assertThat(exceptions)
.hasSize(1)
.hasOnlyOneElementSatisfying(throwable -> {
assertThat(throwable).isExactlyInstanceOf(CompletionException.class);
assertThat(throwable).hasCauseExactlyInstanceOf(SphereException.class);
});
assertThat(productSyncStatistics).hasValues(1, 0, 0, 1);
}
@Test
void sync_WithErrorFetchingExistingKeys_ShouldExecuteCallbackOnErrorAndIncreaseFailedCounter() {
// preparation
final ProductDraft productDraft = createProductDraftBuilder(PRODUCT_KEY_2_RESOURCE_PATH,
ProductType.referenceOfId("productTypeKey"))
.taxCategory(null)
.state(null)
.build();
final List<String> errorMessages = new ArrayList<>();
final List<Throwable> exceptions = new ArrayList<>();
final SphereClient mockClient = mock(SphereClient.class);
when(mockClient.execute(any(ProductQuery.class)))
.thenReturn(supplyAsync(() -> { throw new SphereException(); }));
final ProductSyncOptions syncOptions = ProductSyncOptionsBuilder
.of(mockClient)
.errorCallback((errorMessage, exception) -> {
errorMessages.add(errorMessage);
exceptions.add(exception);
})
.build();
final ProductService productService = spy(new ProductServiceImpl(syncOptions));
final Map<String, String> keyToIds = new HashMap<>();
keyToIds.put(productDraft.getKey(), UUID.randomUUID().toString());
when(productService.cacheKeysToIds(anySet())).thenReturn(completedFuture(keyToIds));
final ProductTypeService productTypeService = mock(ProductTypeService.class);
when(productTypeService.fetchCachedProductTypeId(any()))
.thenReturn(completedFuture(Optional.of(UUID.randomUUID().toString())));
final CategoryService categoryService = mock(CategoryService.class);
when(categoryService.fetchMatchingCategoriesByKeys(any())).thenReturn(completedFuture(emptySet()));
final ProductSync productSync = new ProductSync(syncOptions, productService,
productTypeService, categoryService, mock(TypeService.class),
mock(ChannelService.class), mock(CustomerGroupService.class), mock(TaxCategoryService.class),
mock(StateService.class));
// test
final ProductSyncStatistics productSyncStatistics = productSync
.sync(singletonList(productDraft))
.toCompletableFuture().join();
// assertions
assertThat(errorMessages)
.hasSize(1)
.hasOnlyOneElementSatisfying(message ->
assertThat(message).contains("Failed to fetch existing products")
);
assertThat(exceptions)
.hasSize(1)
.hasOnlyOneElementSatisfying(throwable -> {
assertThat(throwable).isExactlyInstanceOf(CompletionException.class);
assertThat(throwable).hasCauseExactlyInstanceOf(SphereException.class);
});
assertThat(productSyncStatistics).hasValues(1, 0, 0, 1);
}
@Test
void sync_WithOnlyDraftsToCreate_ShouldCallBeforeCreateCallback() {
// preparation
final ProductDraft productDraft = createProductDraftBuilder(PRODUCT_KEY_2_RESOURCE_PATH,
ProductType.referenceOfId("productTypeKey"))
.taxCategory(null)
.state(null)
.build();
final ProductSyncOptions productSyncOptions = ProductSyncOptionsBuilder
.of(mock(SphereClient.class))
.build();
final ProductService productService = mock(ProductService.class);
when(productService.cacheKeysToIds(anySet())).thenReturn(completedFuture(emptyMap()));
when(productService.fetchMatchingProductsByKeys(anySet())).thenReturn(completedFuture(emptySet()));
when(productService.createProduct(any())).thenReturn(completedFuture(Optional.empty()));
final ProductTypeService productTypeService = mock(ProductTypeService.class);
when(productTypeService.fetchCachedProductTypeId(any()))
.thenReturn(completedFuture(Optional.of(UUID.randomUUID().toString())));
final CategoryService categoryService = mock(CategoryService.class);
when(categoryService.fetchMatchingCategoriesByKeys(any())).thenReturn(completedFuture(emptySet()));
final ProductSyncOptions spyProductSyncOptions = spy(productSyncOptions);
final ProductSync productSync = new ProductSync(spyProductSyncOptions, productService,
productTypeService, categoryService, mock(TypeService.class),
mock(ChannelService.class), mock(CustomerGroupService.class), mock(TaxCategoryService.class),
mock(StateService.class));
// test
productSync.sync(singletonList(productDraft)).toCompletableFuture().join();
// assertion
verify(spyProductSyncOptions).applyBeforeCreateCallBack(any());
verify(spyProductSyncOptions, never()).applyBeforeUpdateCallBack(any(), any(), any());
}
@Test
void sync_WithOnlyDraftsToUpdate_ShouldOnlyCallBeforeUpdateCallback() {
// preparation
final ProductDraft productDraft = createProductDraftBuilder(PRODUCT_KEY_1_WITH_PRICES_RESOURCE_PATH,
ProductType.referenceOfId("productTypeKey"))
.taxCategory(null)
.state(null)
.build();
final Product mockedExistingProduct =
readObjectFromResource(PRODUCT_KEY_1_WITH_PRICES_RESOURCE_PATH, Product.class);
final ProductSyncOptions productSyncOptions = ProductSyncOptionsBuilder
.of(mock(SphereClient.class))
.build();
final ProductService productService = mock(ProductService.class);
final Map<String, String> keyToIds = new HashMap<>();
keyToIds.put(productDraft.getKey(), UUID.randomUUID().toString());
when(productService.cacheKeysToIds(anySet())).thenReturn(completedFuture(keyToIds));
when(productService.fetchMatchingProductsByKeys(anySet()))
.thenReturn(completedFuture(singleton(mockedExistingProduct)));
when(productService.updateProduct(any(), any())).thenReturn(completedFuture(mockedExistingProduct));
final ProductTypeService productTypeService = mock(ProductTypeService.class);
when(productTypeService.fetchCachedProductTypeId(any()))
.thenReturn(completedFuture(Optional.of(UUID.randomUUID().toString())));
when(productTypeService.fetchCachedProductAttributeMetaDataMap(any()))
.thenReturn(completedFuture(Optional.of(new HashMap<>())));
final CategoryService categoryService = mock(CategoryService.class);
when(categoryService.fetchMatchingCategoriesByKeys(any())).thenReturn(completedFuture(emptySet()));
final ProductSyncOptions spyProductSyncOptions = spy(productSyncOptions);
final ProductSync productSync = new ProductSync(spyProductSyncOptions, productService,
productTypeService, categoryService, mock(TypeService.class),
mock(ChannelService.class), mock(CustomerGroupService.class), mock(TaxCategoryService.class),
mock(StateService.class));
// test
productSync.sync(singletonList(productDraft)).toCompletableFuture().join();
// assertion
verify(spyProductSyncOptions).applyBeforeUpdateCallBack(any(), any(), any());
verify(spyProductSyncOptions, never()).applyBeforeCreateCallBack(any());
}
}
|
3e114b5e0c72bdf0c8dbe396700c784c629b1eda | 11,288 | java | Java | modules/web-toolkit/src/com/haulmont/cuba/web/widgets/client/tooltip/CubaTooltip.java | tausendschoen/cuba | e4342d4e840b54b85ff3851e76c2c01b7987b33a | [
"Apache-2.0"
] | 1,337 | 2016-03-24T09:32:00.000Z | 2022-03-31T16:46:59.000Z | modules/web-toolkit/src/com/haulmont/cuba/web/widgets/client/tooltip/CubaTooltip.java | tausendschoen/cuba | e4342d4e840b54b85ff3851e76c2c01b7987b33a | [
"Apache-2.0"
] | 2,911 | 2016-04-28T14:36:19.000Z | 2022-03-22T06:09:57.000Z | modules/web-toolkit/src/com/haulmont/cuba/web/widgets/client/tooltip/CubaTooltip.java | tausendschoen/cuba | e4342d4e840b54b85ff3851e76c2c01b7987b33a | [
"Apache-2.0"
] | 271 | 2016-04-15T03:29:20.000Z | 2022-03-27T01:05:43.000Z | 37.879195 | 119 | 0.603738 | 7,291 | /*
* Copyright (c) 2008-2016 Haulmont.
*
* 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.haulmont.cuba.web.widgets.client.tooltip;
import com.google.gwt.core.client.Scheduler;
import com.google.gwt.dom.client.Document;
import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.Style;
import com.google.gwt.event.dom.client.*;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Event;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.Widget;
import com.haulmont.cuba.web.widgets.client.checkbox.CubaCheckBoxWidget;
import com.haulmont.cuba.web.widgets.client.resizabletextarea.CubaResizableTextAreaWrapperWidget;
import com.vaadin.client.*;
import com.vaadin.client.ui.VLabel;
import static com.haulmont.cuba.web.widgets.client.caption.CubaCaptionWidget.CONTEXT_HELP_CLASSNAME;
public class CubaTooltip extends VTooltip {
public static final String REQUIRED_INDICATOR = "v-required-field-indicator";
public static final String ERROR_INDICATOR = "v-errorindicator";
// If required indicators are not visible we show tooltip on mouse hover otherwise only by mouse click
protected static Boolean requiredIndicatorVisible = null;
protected Element contextHelpElement = DOM.createDiv();
public CubaTooltip() {
contextHelpElement.setClassName("c-tooltip-context-help");
DOM.appendChild(getWidget().getElement(), contextHelpElement);
tooltipEventHandler = new CubaTooltipEventHandler();
}
protected void showTooltip(boolean forceShow) {
// Schedule timer for showing the tooltip according to if it
// was recently closed or not.
int timeout = 0;
if (!forceShow) {
timeout = justClosed ? getQuickOpenDelay() : getOpenDelay();
}
if (timeout == 0) {
Scheduler.get().scheduleDeferred(this::showTooltip);
} else {
showTimer.schedule(timeout);
opening = true;
}
}
public static void checkRequiredIndicatorMode() {
requiredIndicatorVisible = null;
}
@Override
public void connectHandlersToWidget(Widget widget) {
Profiler.enter("VTooltip.connectHandlersToWidget");
widget.addDomHandler(tooltipEventHandler, MouseOutEvent.getType());
widget.addDomHandler(tooltipEventHandler, MouseDownEvent.getType());
widget.addDomHandler(tooltipEventHandler, KeyDownEvent.getType());
if (!BrowserInfo.get().isIOS()) {
widget.addDomHandler(tooltipEventHandler, MouseMoveEvent.getType());
widget.addDomHandler(tooltipEventHandler, FocusEvent.getType());
widget.addDomHandler(tooltipEventHandler, BlurEvent.getType());
}
Profiler.leave("VTooltip.connectHandlersToWidget");
}
@Override
protected void setTooltipText(TooltipInfo info) {
super.setTooltipText(info);
if (info.getTitle() != null && !info.getTitle().isEmpty()) {
description.getElement().removeAttribute("aria-hidden");
} else {
description.getElement().setAttribute("aria-hidden", "true");
}
String contextHelp = info.getContextHelp();
if (contextHelp != null && !contextHelp.isEmpty()) {
if (info.isContextHelpHtmlEnabled()) {
contextHelpElement.setInnerHTML(contextHelp);
} else {
if (contextHelp.contains("\n")) {
contextHelp = WidgetUtil.escapeHTML(contextHelp).replace("\n", "<br/>");
contextHelpElement.setInnerHTML(contextHelp);
} else {
contextHelpElement.setInnerText(contextHelp);
}
}
contextHelpElement.getStyle().clearDisplay();
} else {
contextHelpElement.setInnerHTML("");
contextHelpElement.getStyle().setDisplay(Style.Display.NONE);
}
}
@Override
public void hide() {
contextHelpElement.setInnerHTML("");
super.hide();
}
public class CubaTooltipEventHandler extends TooltipEventHandler {
protected ComponentConnector currentConnector = null;
protected boolean isTooltipElement(Element element) {
return (isRequiredIndicator(element)
|| isContextHelpElement(element));
}
protected boolean isRequiredIndicator(Element element) {
return REQUIRED_INDICATOR.equals(element.getClassName())
|| ERROR_INDICATOR.equals(element.getClassName());
}
protected boolean isContextHelpElement(Element element) {
return CONTEXT_HELP_CLASSNAME.equals(element.getClassName());
}
protected void checkRequiredIndicatorVisible() {
if (requiredIndicatorVisible == null) {
Element requiredIndicatorFake = DOM.createDiv();
requiredIndicatorFake.setClassName(REQUIRED_INDICATOR);
requiredIndicatorFake.getStyle().setPosition(Style.Position.ABSOLUTE);
String rootPanelId = ac.getConfiguration().getRootPanelId();
Element rootPanel = Document.get().getElementById(rootPanelId);
rootPanel.appendChild(requiredIndicatorFake);
String display = new ComputedStyle(requiredIndicatorFake).getProperty("display");
requiredIndicatorVisible = !"none".equals(display);
rootPanel.removeChild(requiredIndicatorFake);
}
}
protected boolean isClassNameExcluded(String className) {
return CubaResizableTextAreaWrapperWidget.RESIZE_ELEMENT.equals(className);
}
@Override
protected TooltipInfo getTooltipFor(Element element) {
Element originalElement = element;
if (isClassNameExcluded(element.getClassName())) {
return null;
}
if (isTooltipElement(element)) {
element = element.getParentElement().cast();
Widget widget = WidgetUtil.findWidget(element);
if (!(widget instanceof CubaCheckBoxWidget)
&& !(widget instanceof VLabel)) {
int index = DOM.getChildIndex(element.getParentElement().cast(), element);
int indexOfComponent = index == 0 ? index + 1 : index - 1;
element = DOM.getChild(element.getParentElement().cast(), indexOfComponent);
}
}
ApplicationConnection ac = getApplicationConnection();
ComponentConnector connector = Util.getConnectorForElement(ac,
RootPanel.get(), element);
// Try to find first connector with proper tooltip info
TooltipInfo info = null;
while (connector != null) {
info = connector.getTooltipInfo(element);
if (info != null && info.hasMessage()) {
break;
}
if (!(connector.getParent() instanceof ComponentConnector)) {
connector = null;
info = null;
break;
}
connector = (ComponentConnector) connector.getParent();
}
if (connector != null) {
assert connector.hasTooltip() : "getTooltipInfo for "
+ Util.getConnectorString(connector)
+ " returned a tooltip even though hasTooltip claims there are no tooltips for the connector.";
currentConnector = connector;
return updateTooltip(info, originalElement);
}
return null;
}
protected TooltipInfo updateTooltip(TooltipInfo info, Element element) {
if (isContextHelpElement(element)) {
info.setTitle(null);
info.setErrorMessage(null);
} else {
info.setContextHelp(null);
checkRequiredIndicatorVisible();
if (requiredIndicatorVisible && isRequiredIndicator(element)) {
info.setTitle(null);
}
}
return info;
}
@Override
public void onMouseDown(MouseDownEvent event) {
Element element = event.getNativeEvent().getEventTarget().cast();
if (isTooltipElement(element)) {
closeNow();
handleShowHide(event, false);
} else {
hideTooltip();
}
}
@Override
protected void handleShowHide(DomEvent domEvent, boolean isFocused) {
// CAUTION copied from parent with changes
Event event = Event.as(domEvent.getNativeEvent());
Element element = Element.as(event.getEventTarget());
// We can ignore move event if it's handled by move or over already
if (currentElement == element && handledByFocus) {
return;
}
// If the parent (sub)component already has a tooltip open and it
// hasn't changed, we ignore the event.
// TooltipInfo contains a reference to the parent component that is
// checked in it's equals-method.
if (currentElement != null && isTooltipOpen()) {
TooltipInfo currentTooltip = getTooltipFor(currentElement);
TooltipInfo newTooltip = getTooltipFor(element);
if (currentTooltip != null && currentTooltip.equals(newTooltip)) {
return;
}
}
TooltipInfo info = getTooltipFor(element);
if (info == null) {
handleHideEvent();
currentConnector = null;
} else {
boolean elementIsIndicator = elementIsIndicator(element);
if (closing) {
closeTimer.cancel();
closing = false;
}
if (isTooltipOpen()) {
closeNow();
}
setTooltipText(info);
updatePosition(event, isFocused);
if (BrowserInfo.get().isIOS()) {
element.focus();
}
showTooltip(domEvent instanceof MouseDownEvent && elementIsIndicator);
}
handledByFocus = isFocused;
currentElement = element;
}
protected boolean elementIsIndicator(Element relativeElement) {
return relativeElement != null
&& isTooltipElement(relativeElement);
}
}
} |
3e114b97e42df9c5a6167e998b1b51b8b7ee55f6 | 3,010 | java | Java | compiler/tests/org/jetbrains/jet/codegen/TopLevelMembersInvocationTestGenerated.java | develar/kotlin | bf5b387580265cba01efc8fd30d1d0c0b41ac5a9 | [
"Apache-2.0"
] | 5 | 2015-08-01T10:35:57.000Z | 2021-02-11T16:25:41.000Z | compiler/tests/org/jetbrains/jet/codegen/TopLevelMembersInvocationTestGenerated.java | develar/kotlin | bf5b387580265cba01efc8fd30d1d0c0b41ac5a9 | [
"Apache-2.0"
] | null | null | null | compiler/tests/org/jetbrains/jet/codegen/TopLevelMembersInvocationTestGenerated.java | develar/kotlin | bf5b387580265cba01efc8fd30d1d0c0b41ac5a9 | [
"Apache-2.0"
] | 1 | 2017-04-21T06:19:05.000Z | 2017-04-21T06:19:05.000Z | 40.133333 | 220 | 0.764452 | 7,292 | /*
* Copyright 2010-2013 JetBrains s.r.o.
*
* 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.jetbrains.jet.codegen;
import junit.framework.Assert;
import junit.framework.Test;
import junit.framework.TestSuite;
import java.io.File;
import java.util.regex.Pattern;
import org.jetbrains.jet.JetTestUtils;
import org.jetbrains.jet.test.InnerTestClasses;
import org.jetbrains.jet.test.TestMetadata;
import org.jetbrains.jet.codegen.AbstractTopLevelMembersInvocationTest;
/** This class is generated by {@link org.jetbrains.jet.generators.tests.GenerateTests}. DO NOT MODIFY MANUALLY */
@SuppressWarnings("all")
@TestMetadata("compiler/testData/codegen/topLevelMemberInvocation")
public class TopLevelMembersInvocationTestGenerated extends AbstractTopLevelMembersInvocationTest {
public void testAllFilesPresentInTopLevelMemberInvocation() throws Exception {
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("compiler/testData/codegen/topLevelMemberInvocation"), Pattern.compile("^(.+)$"), false);
}
@TestMetadata("extensionFunction")
public void testExtensionFunction() throws Exception {
doTest("compiler/testData/codegen/topLevelMemberInvocation/extensionFunction");
}
@TestMetadata("functionDifferentPackage")
public void testFunctionDifferentPackage() throws Exception {
doTest("compiler/testData/codegen/topLevelMemberInvocation/functionDifferentPackage");
}
@TestMetadata("functionInMultiFileNamespace")
public void testFunctionInMultiFileNamespace() throws Exception {
doTest("compiler/testData/codegen/topLevelMemberInvocation/functionInMultiFileNamespace");
}
@TestMetadata("functionSamePackage")
public void testFunctionSamePackage() throws Exception {
doTest("compiler/testData/codegen/topLevelMemberInvocation/functionSamePackage");
}
@TestMetadata("property")
public void testProperty() throws Exception {
doTest("compiler/testData/codegen/topLevelMemberInvocation/property");
}
@TestMetadata("propertyWithGetter")
public void testPropertyWithGetter() throws Exception {
doTest("compiler/testData/codegen/topLevelMemberInvocation/propertyWithGetter");
}
@TestMetadata("twoModules")
public void testTwoModules() throws Exception {
doTest("compiler/testData/codegen/topLevelMemberInvocation/twoModules");
}
}
|
3e114c4262a6ad0e283d27188d56c3b5ad278693 | 345 | java | Java | myPracticeCourseWork/week1/revisionCOM405/src/main/java/solent/ac/uk/ood/examples/week10/model/Lorry.java | emma12812/solent2Public | 3566f948bb8eb64ba971a1f1d03e89a4ff2f7a94 | [
"Apache-2.0"
] | null | null | null | myPracticeCourseWork/week1/revisionCOM405/src/main/java/solent/ac/uk/ood/examples/week10/model/Lorry.java | emma12812/solent2Public | 3566f948bb8eb64ba971a1f1d03e89a4ff2f7a94 | [
"Apache-2.0"
] | null | null | null | myPracticeCourseWork/week1/revisionCOM405/src/main/java/solent/ac/uk/ood/examples/week10/model/Lorry.java | emma12812/solent2Public | 3566f948bb8eb64ba971a1f1d03e89a4ff2f7a94 | [
"Apache-2.0"
] | null | null | null | 18.157895 | 47 | 0.492754 | 7,293 | package solent.ac.uk.ood.examples.week10.model;
public class Lorry extends Vehicle {
@Override
public Double calculateFee() {
double fee;
double weight = getWeight();
if (weight <= 8000){
fee = 10.00;
}
else{
fee = 15.00;
}
return fee;
}
}
|
3e114ccd7dd75dec5bf4ace89d92f4d38a5115aa | 2,547 | java | Java | samples-gateway/src/main/java/com/upcwangying/cloud/samples/gateway/filters/GwSwaggerHeaderFilter.java | upcwangying/spring-cloud-samples | 869beb41203eb91e69c9cb982f27bed704adf353 | [
"MIT"
] | null | null | null | samples-gateway/src/main/java/com/upcwangying/cloud/samples/gateway/filters/GwSwaggerHeaderFilter.java | upcwangying/spring-cloud-samples | 869beb41203eb91e69c9cb982f27bed704adf353 | [
"MIT"
] | null | null | null | samples-gateway/src/main/java/com/upcwangying/cloud/samples/gateway/filters/GwSwaggerHeaderFilter.java | upcwangying/spring-cloud-samples | 869beb41203eb91e69c9cb982f27bed704adf353 | [
"MIT"
] | 2 | 2020-06-14T11:57:24.000Z | 2020-09-21T06:06:07.000Z | 43.913793 | 98 | 0.745976 | 7,294 | /*
*
* MIT License
*
* Copyright (c) 2020 cloud.upcwangying.com
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
package com.upcwangying.cloud.samples.gateway.filters;
import com.upcwangying.cloud.samples.gateway.config.GatewaySwaggerProvider;
import org.apache.commons.lang.StringUtils;
import org.springframework.cloud.gateway.filter.GatewayFilter;
import org.springframework.cloud.gateway.filter.factory.AbstractGatewayFilterFactory;
import org.springframework.http.server.reactive.ServerHttpRequest;
import org.springframework.stereotype.Component;
import org.springframework.web.server.ServerWebExchange;
/**
* @author WANGY
*/
@Component
public class GwSwaggerHeaderFilter extends AbstractGatewayFilterFactory {
private static final String HEADER_NAME = "X-Forwarded-Prefix";
@Override
public GatewayFilter apply(Object config) {
return (exchange, chain) -> {
ServerHttpRequest request = exchange.getRequest();
String path = request.getURI().getPath();
if (!StringUtils.endsWithIgnoreCase(path, GatewaySwaggerProvider.API_URI)) {
return chain.filter(exchange);
}
String basePath = path.substring(0, path.lastIndexOf(GatewaySwaggerProvider.API_URI));
ServerHttpRequest newRequest = request.mutate().header(HEADER_NAME, basePath).build();
ServerWebExchange newExchange = exchange.mutate().request(newRequest).build();
return chain.filter(newExchange);
};
}
}
|
3e114cee30e2db4a4e2d2fed8861597452c82a43 | 797 | java | Java | hw06-atm/src/main/java/pro/kuli4/otus/java/hw06/atm/OperationResult.java | kuli4/otus-java-homework | 0e20b67a643837a2b9c1c23d9ae40a4d7c124356 | [
"MIT"
] | null | null | null | hw06-atm/src/main/java/pro/kuli4/otus/java/hw06/atm/OperationResult.java | kuli4/otus-java-homework | 0e20b67a643837a2b9c1c23d9ae40a4d7c124356 | [
"MIT"
] | null | null | null | hw06-atm/src/main/java/pro/kuli4/otus/java/hw06/atm/OperationResult.java | kuli4/otus-java-homework | 0e20b67a643837a2b9c1c23d9ae40a4d7c124356 | [
"MIT"
] | 1 | 2020-11-16T12:34:14.000Z | 2020-11-16T12:34:14.000Z | 23.441176 | 87 | 0.643664 | 7,295 | package pro.kuli4.otus.java.hw06.atm;
public class OperationResult<T> {
private final OperationStatus operationStatus;
private final String comment;
private final T result;
public OperationResult(OperationStatus operationStatus, String comment, T result) {
this.operationStatus = operationStatus;
this.comment = comment;
this.result = result;
}
public OperationStatus getOperationStatus() {
return this.operationStatus;
}
public String getComment() {
return this.comment;
}
public T getResult() {
return this.result;
}
public String toString() {
if (operationStatus.equals(OperationStatus.ERROR))
{
return comment;
}
return result.toString();
}
}
|
3e114febc6f88dd367863e17a94752f8ae681ec7 | 331 | java | Java | java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/fuseStreamOperations/afterSetsNewHashSet.java | dunno99/intellij-community | aa656a5d874b947271b896b2105e4370827b9149 | [
"Apache-2.0"
] | 2 | 2019-04-28T07:48:50.000Z | 2020-12-11T14:18:08.000Z | java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/fuseStreamOperations/afterSetsNewHashSet.java | dunno99/intellij-community | aa656a5d874b947271b896b2105e4370827b9149 | [
"Apache-2.0"
] | 2 | 2022-02-19T09:45:05.000Z | 2022-02-27T20:32:55.000Z | java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/fuseStreamOperations/afterSetsNewHashSet.java | dunno99/intellij-community | aa656a5d874b947271b896b2105e4370827b9149 | [
"Apache-2.0"
] | 2 | 2020-03-15T08:57:37.000Z | 2020-04-07T04:48:14.000Z | 22.066667 | 77 | 0.691843 | 7,296 | // "Fuse newHashSet into the Stream API chain" "true"
package com.google.common.collect;
import java.util.*;
import java.util.stream.*;
class X {
void foo(Stream<String> s) {
Set<String> set = s.collect(Collectors.toSet());
}
}
class Sets {
public static native <E> HashSet<E> newHashSet(Iterable<? extends E> var0);
} |
3e11502030302f293d9d2de98dcbf25d223edeb0 | 4,639 | java | Java | modules/core/src/main/java/org/apache/ignite/internal/processors/service/ServiceSingleNodeDeploymentResultBatch.java | liyuj/gridgain | 9505c0cfd7235210993b2871b17f15acf7d3dcd4 | [
"CC0-1.0"
] | 218 | 2015-01-04T13:20:55.000Z | 2022-03-28T05:28:55.000Z | modules/core/src/main/java/org/apache/ignite/internal/processors/service/ServiceSingleNodeDeploymentResultBatch.java | liyuj/gridgain | 9505c0cfd7235210993b2871b17f15acf7d3dcd4 | [
"CC0-1.0"
] | 175 | 2015-02-04T23:16:56.000Z | 2022-03-28T18:34:24.000Z | modules/core/src/main/java/org/apache/ignite/internal/processors/service/ServiceSingleNodeDeploymentResultBatch.java | liyuj/gridgain | 9505c0cfd7235210993b2871b17f15acf7d3dcd4 | [
"CC0-1.0"
] | 93 | 2015-01-06T20:54:23.000Z | 2022-03-31T08:09:00.000Z | 29.929032 | 102 | 0.656176 | 7,297 | /*
* Copyright 2019 GridGain Systems, Inc. and Contributors.
*
* Licensed under the GridGain Community Edition License (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.gridgain.com/products/software/community-edition/gridgain-community-edition-license
*
* 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.ignite.internal.processors.service;
import java.nio.ByteBuffer;
import java.util.Map;
import org.apache.ignite.internal.util.tostring.GridToStringInclude;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.lang.IgniteUuid;
import org.apache.ignite.plugin.extensions.communication.Message;
import org.apache.ignite.plugin.extensions.communication.MessageReader;
import org.apache.ignite.plugin.extensions.communication.MessageWriter;
import org.jetbrains.annotations.NotNull;
import static org.apache.ignite.plugin.extensions.communication.MessageCollectionItemType.IGNITE_UUID;
import static org.apache.ignite.plugin.extensions.communication.MessageCollectionItemType.MSG;
/**
* Batch of service single node deployment result.
* <p/>
* Contains collection of {@link ServiceSingleNodeDeploymentResult} mapped services ids.
*/
public class ServiceSingleNodeDeploymentResultBatch implements Message {
/** */
private static final long serialVersionUID = 0L;
/** Deployment process id. */
@GridToStringInclude
private ServiceDeploymentProcessId depId;
/** Services deployments results. */
@GridToStringInclude
private Map<IgniteUuid, ServiceSingleNodeDeploymentResult> results;
/**
* Empty constructor for marshalling purposes.
*/
public ServiceSingleNodeDeploymentResultBatch() {
}
/**
* @param depId Deployment process id.
* @param results Services deployments results.
*/
public ServiceSingleNodeDeploymentResultBatch(@NotNull ServiceDeploymentProcessId depId,
@NotNull Map<IgniteUuid, ServiceSingleNodeDeploymentResult> results) {
this.depId = depId;
this.results = results;
}
/**
* @return Services deployments results.
*/
public Map<IgniteUuid, ServiceSingleNodeDeploymentResult> results() {
return results;
}
/**
* @return Deployment process id.
*/
public ServiceDeploymentProcessId deploymentId() {
return depId;
}
/** {@inheritDoc} */
@Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
writer.setBuffer(buf);
if (!writer.isHeaderWritten()) {
if (!writer.writeHeader(directType(), fieldsCount()))
return false;
writer.onHeaderWritten();
}
switch (writer.state()) {
case 0:
if (!writer.writeMessage("depId", depId))
return false;
writer.incrementState();
case 1:
if (!writer.writeMap("results", results, IGNITE_UUID, MSG))
return false;
writer.incrementState();
}
return true;
}
/** {@inheritDoc} */
@Override public boolean readFrom(ByteBuffer buf, MessageReader reader) {
reader.setBuffer(buf);
if (!reader.beforeMessageRead())
return false;
switch (reader.state()) {
case 0:
depId = reader.readMessage("depId");
if (!reader.isLastRead())
return false;
reader.incrementState();
case 1:
results = reader.readMap("results", IGNITE_UUID, MSG, false);
if (!reader.isLastRead())
return false;
reader.incrementState();
}
return reader.afterMessageRead(ServiceSingleNodeDeploymentResultBatch.class);
}
/** {@inheritDoc} */
@Override public short directType() {
return 168;
}
/** {@inheritDoc} */
@Override public byte fieldsCount() {
return 2;
}
/** {@inheritDoc} */
@Override public void onAckReceived() {
// No-op.
}
/** {@inheritDoc} */
@Override public String toString() {
return S.toString(ServiceSingleNodeDeploymentResultBatch.class, this);
}
}
|
3e11509aceceb63d12cdeb0e969924e1ef23239a | 376 | java | Java | DynmapCoreAPI/src/main/java/org/dynmap/markers/MarkerDescription.java | hammermaps/dynmap | 94eab3b6a842c0a3745c5173c578307fc9a5d0b1 | [
"Apache-2.0"
] | 1,403 | 2015-01-10T20:19:16.000Z | 2022-03-30T12:31:52.000Z | DynmapCoreAPI/src/main/java/org/dynmap/markers/MarkerDescription.java | hammermaps/dynmap | 94eab3b6a842c0a3745c5173c578307fc9a5d0b1 | [
"Apache-2.0"
] | 2,232 | 2015-01-01T11:47:21.000Z | 2022-03-31T18:54:18.000Z | DynmapCoreAPI/src/main/java/org/dynmap/markers/MarkerDescription.java | hammermaps/dynmap | 94eab3b6a842c0a3745c5173c578307fc9a5d0b1 | [
"Apache-2.0"
] | 477 | 2015-01-03T10:32:42.000Z | 2022-03-29T20:20:26.000Z | 25.066667 | 71 | 0.675532 | 7,298 | package org.dynmap.markers;
public interface MarkerDescription extends GenericMarker {
/**
* Set marker description (HTML markup shown in popup when clicked)
* @param desc - HTML markup description
*/
public void setDescription(String desc);
/**
* Get marker description
* @return descrption
*/
public String getDescription();
}
|
3e1151026903fb99eda142e247bab121c0a7cab2 | 1,707 | java | Java | hsweb-web-concurrent/hsweb-web-concurrent-cache/src/main/java/org/hsweb/concureent/cache/redis/FastJsonRedisTemplate.java | mingfly/hsweb-framework | 3eed9e3f6a4ec45f602c19eeae76cef88ae9aa44 | [
"Apache-2.0"
] | 1 | 2017-08-16T09:39:18.000Z | 2017-08-16T09:39:18.000Z | hsweb-web-concurrent/hsweb-web-concurrent-cache/src/main/java/org/hsweb/concureent/cache/redis/FastJsonRedisTemplate.java | mingfly/hsweb-framework | 3eed9e3f6a4ec45f602c19eeae76cef88ae9aa44 | [
"Apache-2.0"
] | null | null | null | hsweb-web-concurrent/hsweb-web-concurrent-cache/src/main/java/org/hsweb/concureent/cache/redis/FastJsonRedisTemplate.java | mingfly/hsweb-framework | 3eed9e3f6a4ec45f602c19eeae76cef88ae9aa44 | [
"Apache-2.0"
] | 1 | 2021-03-28T13:07:16.000Z | 2021-03-28T13:07:16.000Z | 39.697674 | 120 | 0.763327 | 7,299 | package org.hsweb.concureent.cache.redis;
import org.springframework.data.redis.connection.DefaultStringRedisConnection;
import org.springframework.data.redis.connection.RedisConnection;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.serializer.RedisSerializer;
import org.springframework.data.redis.serializer.StringRedisSerializer;
/**
* @author zhouhao
* @TODO
*/
public class FastJsonRedisTemplate extends RedisTemplate<String, Object> {
/**
* Constructs a new <code>StringRedisTemplate</code> instance. {@link #setConnectionFactory(RedisConnectionFactory)}
* and {@link #afterPropertiesSet()} still need to be called.
*/
public FastJsonRedisTemplate() {
RedisSerializer<String> stringSerializer = new StringRedisSerializer();
FastJsonRedisSerializer redisSerializer = new FastJsonRedisSerializer();
setKeySerializer(stringSerializer);
setValueSerializer(redisSerializer);
setHashKeySerializer(stringSerializer);
setHashValueSerializer(redisSerializer);
}
/**
* Constructs a new <code>StringRedisTemplate</code> instance ready to be used.
*
* @param connectionFactory connection factory for creating new connections
*/
public FastJsonRedisTemplate(RedisConnectionFactory connectionFactory) {
this();
setConnectionFactory(connectionFactory);
afterPropertiesSet();
}
protected RedisConnection preProcessConnection(RedisConnection connection, boolean existingConnection) {
return new DefaultStringRedisConnection(connection);
}
}
|
3e1151274c3707546fc00207e4b608f8517dd424 | 880 | java | Java | backend/src/main/java/com/chenym/pig/common/log/LogAutoConfiguration.java | a0953245782/pig-vue | d7a323fbb88a9d2c73a6d34a562eae36f675894f | [
"MIT"
] | 5 | 2019-08-26T08:03:23.000Z | 2021-11-17T16:32:28.000Z | backend/src/main/java/com/chenym/pig/common/log/LogAutoConfiguration.java | a0953245782/pig-vue | d7a323fbb88a9d2c73a6d34a562eae36f675894f | [
"MIT"
] | null | null | null | backend/src/main/java/com/chenym/pig/common/log/LogAutoConfiguration.java | a0953245782/pig-vue | d7a323fbb88a9d2c73a6d34a562eae36f675894f | [
"MIT"
] | 4 | 2019-04-26T09:10:12.000Z | 2021-04-28T15:24:30.000Z | 30.344828 | 85 | 0.778409 | 7,300 | package com.chenym.pig.common.log;
import com.chenym.pig.common.log.aspect.SysLogAspect;
import com.chenym.pig.common.log.event.SysLogListener;
import com.chenym.pig.service.SysLogService;
import lombok.AllArgsConstructor;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableAsync;
@EnableAsync
@Configuration
@AllArgsConstructor
@ConditionalOnWebApplication
public class LogAutoConfiguration {
private final SysLogService sysLogService;
@Bean
public SysLogListener sysLogListener() {
return new SysLogListener(sysLogService);
}
@Bean
public SysLogAspect sysLogAspect() {
return new SysLogAspect();
}
}
|
3e1151eb490bfb7dc5340aae1c302b00b2ea2a1a | 1,625 | java | Java | framework/src/main/java/net/hasor/rsf/container/ContextRsfBindBuilder.java | zycgit/rsf | f66499283ddfb9cf188de1cdd64291d632870dd0 | [
"Apache-2.0"
] | 93 | 2016-04-13T06:28:41.000Z | 2021-04-25T16:51:38.000Z | framework/src/main/java/net/hasor/rsf/container/ContextRsfBindBuilder.java | zycgit/rsf | f66499283ddfb9cf188de1cdd64291d632870dd0 | [
"Apache-2.0"
] | 1 | 2017-02-24T17:03:17.000Z | 2017-03-12T10:54:41.000Z | framework/src/main/java/net/hasor/rsf/container/ContextRsfBindBuilder.java | zycgit/rsf | f66499283ddfb9cf188de1cdd64291d632870dd0 | [
"Apache-2.0"
] | 40 | 2016-07-12T13:07:20.000Z | 2021-11-09T06:23:02.000Z | 36.022222 | 77 | 0.734732 | 7,301 | /*
* Copyright 2008-2009 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 net.hasor.rsf.container;
import net.hasor.core.AppContextAware;
import net.hasor.rsf.RsfBindInfo;
import net.hasor.rsf.RsfContext;
import net.hasor.rsf.RsfEnvironment;
/**
* 服务注册器
* @version : 2014年11月12日
* @author 赵永春(hzdkv@example.com)
*/
abstract class ContextRsfBindBuilder extends AbstractRsfBindBuilder {
protected abstract RsfBeanContainer getContainer();
protected abstract RsfContext getRsfContext();
public RsfEnvironment getEnvironment() {
return this.getRsfContext().getEnvironment();
}
protected <T> RsfBindInfo<T> addService(ServiceDefine<T> serviceDefine) {
getContainer().publishService(serviceDefine);
return serviceDefine;
}
protected void addShareFilter(FilterDefine filterDefine) {
this.getContainer().publishFilter(filterDefine);
}
@Override
protected <T extends AppContextAware> T makeSureAware(T aware) {
aware.setAppContext(getRsfContext().getAppContext());
return aware;
}
} |
3e11525313c98e3bdd516fd8b0182f11b9cc3241 | 283 | java | Java | integration-tests/hibernate-orm-panache/src/main/java/io/quarkus/it/panache/NamedQueryEntity.java | attiand/quarkus | 037850f48d9c40226bb74a886c7e398b2ea0df6b | [
"Apache-2.0"
] | 10,225 | 2019-03-07T11:55:54.000Z | 2022-03-31T21:16:53.000Z | integration-tests/hibernate-orm-panache/src/main/java/io/quarkus/it/panache/NamedQueryEntity.java | attiand/quarkus | 037850f48d9c40226bb74a886c7e398b2ea0df6b | [
"Apache-2.0"
] | 18,675 | 2019-03-07T11:56:33.000Z | 2022-03-31T22:25:22.000Z | integration-tests/hibernate-orm-panache/src/main/java/io/quarkus/it/panache/NamedQueryEntity.java | attiand/quarkus | 037850f48d9c40226bb74a886c7e398b2ea0df6b | [
"Apache-2.0"
] | 2,190 | 2019-03-07T12:07:18.000Z | 2022-03-30T05:41:35.000Z | 25.727273 | 78 | 0.805654 | 7,302 | package io.quarkus.it.panache;
import javax.persistence.Entity;
import javax.persistence.NamedQuery;
@Entity
@NamedQuery(name = "NamedQueryEntity.getAll", query = "from NamedQueryEntity")
public class NamedQueryEntity extends NamedQueryMappedSuperClass {
public String test;
}
|
3e1152f892ef730fd0d4e8a4555614df74debc4d | 1,309 | java | Java | src/test/java/walkingkooka/tree/patch/NodePatchNotEmptyRemoveNodePatchVisitorTest.java | mP1/walkingkooka-tree-patch | 3cb8dffa4fbe7fbe0ae517192d173236d45d0749 | [
"Apache-2.0"
] | null | null | null | src/test/java/walkingkooka/tree/patch/NodePatchNotEmptyRemoveNodePatchVisitorTest.java | mP1/walkingkooka-tree-patch | 3cb8dffa4fbe7fbe0ae517192d173236d45d0749 | [
"Apache-2.0"
] | 1 | 2020-03-10T08:19:49.000Z | 2020-03-10T08:19:49.000Z | src/test/java/walkingkooka/tree/patch/NodePatchNotEmptyRemoveNodePatchVisitorTest.java | mP1/walkingkooka-tree-patch | 3cb8dffa4fbe7fbe0ae517192d173236d45d0749 | [
"Apache-2.0"
] | null | null | null | 34.447368 | 155 | 0.763942 | 7,303 | /*
* Copyright 2019 Miroslav Pokorny (github.com/mP1)
*
* 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 walkingkooka.tree.patch;
import walkingkooka.tree.json.JsonObject;
public final class NodePatchNotEmptyRemoveNodePatchVisitorTest extends NodePatchNotEmptyNodePatchVisitorTestCase<NodePatchNotEmptyRemoveNodePatchVisitor> {
@Override
NodePatchNotEmptyRemoveNodePatchVisitor createVisitor(final JsonObject patch) {
return new NodePatchNotEmptyRemoveNodePatchVisitor(patch, null, null);
}
@Override
public String typeNamePrefix() {
return NodePatchNotEmptyRemove.class.getSimpleName();
}
@Override
public Class<NodePatchNotEmptyRemoveNodePatchVisitor> type() {
return NodePatchNotEmptyRemoveNodePatchVisitor.class;
}
}
|
3e1153b7847771103fa5fb1d274a9f64e6eb1b59 | 575 | java | Java | service/com/hys/exam/service/local/UserImageManage.java | 1224500506/NCME-Web | 3e7a90891185272570165e3fdc40e14830295903 | [
"Apache-2.0"
] | null | null | null | service/com/hys/exam/service/local/UserImageManage.java | 1224500506/NCME-Web | 3e7a90891185272570165e3fdc40e14830295903 | [
"Apache-2.0"
] | null | null | null | service/com/hys/exam/service/local/UserImageManage.java | 1224500506/NCME-Web | 3e7a90891185272570165e3fdc40e14830295903 | [
"Apache-2.0"
] | null | null | null | 21.296296 | 55 | 0.789565 | 7,304 | package com.hys.exam.service.local;
import java.util.List;
import com.hys.exam.model.PropUnit;
import com.hys.exam.model.UserImage;
import com.hys.framework.service.BaseService;
public interface UserImageManage extends BaseService {
List<UserImage> getUserImageList(UserImage userImage);
boolean addUserImage(UserImage userImage);
boolean deleteUserImage(UserImage userImage);
boolean updateUserImage(UserImage userImage);
List<PropUnit> getHospitalList();
List<PropUnit> getAreaList();
List<PropUnit> getDutyList();
List<PropUnit> getMajorList();
}
|
3e11543be395f6efaf0767585378749c75eb41ab | 1,161 | java | Java | src/main/java/com/colorado/jwt/models/AbstractDomain.java | ccoloradoc/spring-jwt | 0663a7a7398a49af1d71cf87e9bfe6325a7420d1 | [
"Unlicense"
] | null | null | null | src/main/java/com/colorado/jwt/models/AbstractDomain.java | ccoloradoc/spring-jwt | 0663a7a7398a49af1d71cf87e9bfe6325a7420d1 | [
"Unlicense"
] | null | null | null | src/main/java/com/colorado/jwt/models/AbstractDomain.java | ccoloradoc/spring-jwt | 0663a7a7398a49af1d71cf87e9bfe6325a7420d1 | [
"Unlicense"
] | null | null | null | 18.140625 | 51 | 0.614126 | 7,305 | package com.colorado.jwt.models;
import javax.persistence.*;
import java.util.Date;
/**
* Created by colorado on 28/03/17.
*/
@MappedSuperclass
public class AbstractDomain {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Integer id;
@Version
private Integer version;
private Date createdDate;
private Date updatedDate;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getVersion() {
return version;
}
public void setVersion(Integer version) {
this.version = version;
}
public Date getCreatedDate() {
return createdDate;
}
public void setCreatedDate(Date createdDate) {
this.createdDate = createdDate;
}
public Date getUpdatedDate() {
return updatedDate;
}
public void setUpdatedDate(Date updatedDate) {
this.updatedDate = updatedDate;
}
@PrePersist
@PreUpdate
public void timestamps() {
updatedDate = new Date();
if(createdDate == null) {
createdDate = new Date();
}
}
}
|
3e115470b950307ca852e90f566d70b85e2f438c | 355 | java | Java | src/main/java/com/magnarox/snds/model/repositories/TSsraaNnfbRepository.java | Magnarox/model | ef4ec590a10a57346e24b883e70f1980033cb496 | [
"Apache-2.0"
] | null | null | null | src/main/java/com/magnarox/snds/model/repositories/TSsraaNnfbRepository.java | Magnarox/model | ef4ec590a10a57346e24b883e70f1980033cb496 | [
"Apache-2.0"
] | null | null | null | src/main/java/com/magnarox/snds/model/repositories/TSsraaNnfbRepository.java | Magnarox/model | ef4ec590a10a57346e24b883e70f1980033cb496 | [
"Apache-2.0"
] | null | null | null | 39.444444 | 117 | 0.859155 | 7,306 | package com.magnarox.snds.model.repositories;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import com.magnarox.snds.model.entities.TSsraaNnfb;
public interface TSsraaNnfbRepository extends JpaRepository<TSsraaNnfb, Void>, JpaSpecificationExecutor<TSsraaNnfb> {
} |
3e1154946d3a4a3d53654d37cafba7735743a8cb | 1,297 | java | Java | src/main/java/com/github/kmpk/Main.java | kmpk/IpAddrCounter | 4d56af45852419bdffaa9c287b4f3d7b844aafcb | [
"Apache-2.0"
] | null | null | null | src/main/java/com/github/kmpk/Main.java | kmpk/IpAddrCounter | 4d56af45852419bdffaa9c287b4f3d7b844aafcb | [
"Apache-2.0"
] | null | null | null | src/main/java/com/github/kmpk/Main.java | kmpk/IpAddrCounter | 4d56af45852419bdffaa9c287b4f3d7b844aafcb | [
"Apache-2.0"
] | null | null | null | 30.880952 | 124 | 0.568234 | 7,307 | package com.github.kmpk;
import org.graalvm.nativeimage.ImageInfo;
import java.nio.file.Path;
public class Main {
private static final String HELP_FORMAT = "Pass file path as command-line argument, example: %s \"/path/to your/file\"";
private static Path path;
public static void main(String[] args) {
if (args.length != 1) {
printHelpAndExit();
}
path = Path.of(args[0]);
try {
FileIpCounter fileIpCounter = new FileIpCounter(path);
System.out.println(fileIpCounter.count());
} catch (Exception e) {
e.printStackTrace();
System.exit(1);
}
}
private static void printHelpAndExit() {
String programCommand = "java -jar IpAddrCounter.jar";
try {
Class.forName("org.graalvm.nativeimage.ImageInfo");
if (ImageInfo.inImageRuntimeCode()) {
if (System.getProperty("os.name").contains("Windows")) {
programCommand = "IpAddrCounter.exe";
} else {
programCommand = "IpAddrCounter";
}
}
} catch (ClassNotFoundException ignore) {
}
System.out.printf(HELP_FORMAT, programCommand);
System.exit(0);
}
} |
3e1154dec2cbdac3deb8ad94fd4269eb97126014 | 3,194 | java | Java | integration/sesame/src/main/java/de/dfki/km/json/jsonld/impl/SesameTripleCallback.java | clarkparsia/jsonld-java | 4129247d0246f4ee7e80680b1a6bad8016d0ed54 | [
"BSD-3-Clause"
] | 1 | 2015-02-06T05:43:45.000Z | 2015-02-06T05:43:45.000Z | integration/sesame/src/main/java/de/dfki/km/json/jsonld/impl/SesameTripleCallback.java | clarkparsia/jsonld-java | 4129247d0246f4ee7e80680b1a6bad8016d0ed54 | [
"BSD-3-Clause"
] | null | null | null | integration/sesame/src/main/java/de/dfki/km/json/jsonld/impl/SesameTripleCallback.java | clarkparsia/jsonld-java | 4129247d0246f4ee7e80680b1a6bad8016d0ed54 | [
"BSD-3-Clause"
] | null | null | null | 28.017544 | 122 | 0.624296 | 7,308 | package de.dfki.km.json.jsonld.impl;
import org.openrdf.model.Statement;
import org.openrdf.model.URI;
import org.openrdf.model.Value;
import org.openrdf.model.ValueFactory;
import org.openrdf.model.impl.LinkedHashModel;
import org.openrdf.model.impl.ValueFactoryImpl;
import org.openrdf.rio.RDFHandler;
import org.openrdf.rio.RDFHandlerException;
import org.openrdf.rio.helpers.StatementCollector;
import de.dfki.km.json.jsonld.JSONLDTripleCallback;
public class SesameTripleCallback extends JSONLDTripleCallback {
private ValueFactory vf = ValueFactoryImpl.getInstance();
private RDFHandler handler;
public SesameTripleCallback() {
this(new StatementCollector(new LinkedHashModel()));
}
public SesameTripleCallback(RDFHandler nextHandler) {
handler = nextHandler;
}
public SesameTripleCallback(RDFHandler nextHandler, ValueFactory vf) {
handler = nextHandler;
}
@Override
public void triple(String s, String p, String o, String graph) {
if (s == null || p == null || o == null) {
// TODO: i don't know what to do here!!!!
return;
}
// This method is always called with three URIs as subject predicate and
// object
if(graph == null) {
Statement result = vf.createStatement(vf.createURI(s), vf.createURI(p), vf.createURI(o));
try {
handler.handleStatement(result);
} catch (RDFHandlerException e) {
throw new RuntimeException(e);
}
} else {
Statement result = vf.createStatement(vf.createURI(s), vf.createURI(p), vf.createURI(o), vf.createURI(graph));
try {
handler.handleStatement(result);
} catch (RDFHandlerException e) {
throw new RuntimeException(e);
}
}
}
@Override
public void triple(String s, String p, String value, String datatype, String language, String graph) {
if (s == null || p == null || value == null) {
// TODO: i don't know what to do here!!!!
return;
}
URI subject = vf.createURI(s);
URI predicate = vf.createURI(p);
Value object;
if (language != null) {
object = vf.createLiteral(value, language);
} else if (datatype != null) {
object = vf.createLiteral(value, vf.createURI(datatype));
} else {
object = vf.createLiteral(value);
}
if(graph == null) {
Statement result = vf.createStatement(subject, predicate, object);
try {
handler.handleStatement(result);
} catch (RDFHandlerException e) {
throw new RuntimeException(e);
}
} else {
Statement result = vf.createStatement(subject, predicate, object, vf.createURI(graph));
try {
handler.handleStatement(result);
} catch (RDFHandlerException e) {
throw new RuntimeException(e);
}
}
}
/**
* @return the handler
*/
public RDFHandler getHandler() {
return handler;
}
/**
* @param handler the handler to set
*/
public void setHandler(RDFHandler handler) {
this.handler = handler;
}
}
|
3e1154f4a41e4cede4f433b68c3a613e22af6422 | 2,593 | java | Java | src/main/java/com/quasiris/qsf/pipeline/filter/ConditionFilter.java | quasiris/qsf-integration | 30bd8c3f82a74d382ca9af1834dea97bc086c49b | [
"MIT"
] | 2 | 2019-05-14T19:01:34.000Z | 2019-09-20T13:43:42.000Z | src/main/java/com/quasiris/qsf/pipeline/filter/ConditionFilter.java | quasiris/qsf-integration | 30bd8c3f82a74d382ca9af1834dea97bc086c49b | [
"MIT"
] | 4 | 2018-05-22T08:11:24.000Z | 2020-10-13T07:19:02.000Z | src/main/java/com/quasiris/qsf/pipeline/filter/ConditionFilter.java | quasiris/qsf-integration | 30bd8c3f82a74d382ca9af1834dea97bc086c49b | [
"MIT"
] | null | null | null | 26.459184 | 100 | 0.694562 | 7,309 | package com.quasiris.qsf.pipeline.filter;
import com.quasiris.qsf.pipeline.Pipeline;
import com.quasiris.qsf.pipeline.PipelineContainer;
import com.quasiris.qsf.pipeline.PipelineExecuterService;
import com.quasiris.qsf.pipeline.filter.conditions.FilterCondition;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.beans.Transient;
import java.util.function.Predicate;
/**
* Created by tbl on 18.04.20.
*/
public class ConditionFilter extends AbstractFilter {
private static Logger LOG = LoggerFactory.getLogger(ConditionFilter.class);
private String sourcePipelineId;
private FilterCondition condition;
@Deprecated // use condition
private Predicate<PipelineContainer> predicate;
private Pipeline pipeline;
public ConditionFilter() {
}
public ConditionFilter(String sourcePipelineId, FilterCondition condition) {
this.sourcePipelineId = sourcePipelineId;
this.setCondition(condition);
}
@Deprecated // use condition
public ConditionFilter(String sourcePipelineId, Predicate<PipelineContainer> predicate) {
this.sourcePipelineId = sourcePipelineId;
this.predicate = predicate;
}
public void setPipeline(Pipeline pipeline) {
this.pipeline = pipeline;
}
@Override
public void init() {
}
@Override
public PipelineContainer filter(PipelineContainer pipelineContainer) throws Exception {
if(predicate.test(pipelineContainer)) {
PipelineExecuterService pipelineExecuterService = new PipelineExecuterService(pipeline);
pipelineContainer = pipelineExecuterService.execute(pipelineContainer);
}
return pipelineContainer;
}
public FilterCondition getCondition() {
return condition;
}
public void setCondition(FilterCondition condition) {
this.condition = condition;
this.predicate = condition.predicate();
}
/**
* Getter for property 'predicate'.
*
* @return Value for property 'predicate'.
*/
@Transient
public Predicate<PipelineContainer> getPredicate() {
return predicate;
}
/**
* Setter for property 'predicate'.
*
* @param predicate Value to set for property 'predicate'.
*/
@Transient
public void setPredicate(Predicate<PipelineContainer> predicate) {
this.predicate = predicate;
}
/**
* Getter for property 'pipeline'.
*
* @return Value for property 'pipeline'.
*/
public Pipeline getPipeline() {
return pipeline;
}
}
|
3e115568e2941a60d9f219495fdc891e67bb9748 | 1,175 | java | Java | backend/apigateway/src/main/java/pt/ulisboa/tecnico/socialsoftware/apigateway/ScheduledTasks.java | jhmfreitas/QuizzesTutor-Microservices | b8ceee2bc9e40c27b7a292588d3751b94af19844 | [
"MIT"
] | null | null | null | backend/apigateway/src/main/java/pt/ulisboa/tecnico/socialsoftware/apigateway/ScheduledTasks.java | jhmfreitas/QuizzesTutor-Microservices | b8ceee2bc9e40c27b7a292588d3751b94af19844 | [
"MIT"
] | null | null | null | backend/apigateway/src/main/java/pt/ulisboa/tecnico/socialsoftware/apigateway/ScheduledTasks.java | jhmfreitas/QuizzesTutor-Microservices | b8ceee2bc9e40c27b7a292588d3751b94af19844 | [
"MIT"
] | null | null | null | 29.375 | 82 | 0.803404 | 7,310 | package pt.ulisboa.tecnico.socialsoftware.apigateway;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import pt.ulisboa.tecnico.socialsoftware.tournament.demoutils.TournamentDemoUtils;
import pt.ulisboa.tecnico.socialsoftware.tutor.answer.AnswerService;
import pt.ulisboa.tecnico.socialsoftware.tutor.demoutils.TutorDemoUtils;
import pt.ulisboa.tecnico.socialsoftware.tutor.impexp.ImpExpService;
@Component
public class ScheduledTasks {
@Autowired
private ImpExpService impExpService;
@Autowired
private TutorDemoUtils tutorDemoUtils;
@Autowired
private TournamentDemoUtils tournamentDemoUtils;
@Autowired
private AnswerService answerService;
@Scheduled(cron = "0 0 3,13 * * *")
public void exportAll() {
impExpService.exportAll();
}
@Scheduled(cron = "0 0 2 * * *")
public void writeQuizAnswersAndCalculateStatistics() {
answerService.writeQuizAnswersAndCalculateStatistics();
}
@Scheduled(cron = "0 0 1 * * *")
public void resetDemoInfo() {
tournamentDemoUtils.resetDemoInfo();
tutorDemoUtils.resetDemoInfo();
}
} |
3e1155e1e4e87dfc7d028e08698ce880826e9579 | 1,236 | java | Java | src/test/java/io/webfolder/curses4j/chapter03/Twinkle.java | webfolderio/pdcurses4j | f2b45a30c758fbd088a296f5cc5cf3ca8535c72a | [
"MIT"
] | 16 | 2020-05-20T07:43:48.000Z | 2022-01-28T04:11:34.000Z | src/test/java/io/webfolder/curses4j/chapter03/Twinkle.java | webfolderio/pdcurses4j | f2b45a30c758fbd088a296f5cc5cf3ca8535c72a | [
"MIT"
] | null | null | null | src/test/java/io/webfolder/curses4j/chapter03/Twinkle.java | webfolderio/pdcurses4j | f2b45a30c758fbd088a296f5cc5cf3ca8535c72a | [
"MIT"
] | 3 | 2019-02-11T06:30:33.000Z | 2021-09-13T17:54:04.000Z | 31.692308 | 71 | 0.700647 | 7,311 | package io.webfolder.curses4j.chapter03;
import static io.webfolder.curses4j.Curses.A_BLINK;
import static io.webfolder.curses4j.Curses.A_BOLD;
import static io.webfolder.curses4j.Curses.A_NORMAL;
import static io.webfolder.curses4j.Curses.addstr;
import static io.webfolder.curses4j.Curses.attroff;
import static io.webfolder.curses4j.Curses.attron;
import static io.webfolder.curses4j.Curses.attrset;
import static io.webfolder.curses4j.Curses.endwin;
import static io.webfolder.curses4j.Curses.getch;
import static io.webfolder.curses4j.Curses.initscr;
import static io.webfolder.curses4j.Curses.refresh;
/**
* @see https://c-for-dummies.com/ncurses/source_code/03-01_twinkle.php
*/
public class Twinkle {
public static void main(String[] args) {
initscr();
attron(A_BOLD);
addstr("Twinkle, twinkle little star\n");
attron(A_BLINK);
addstr("How I wonder what you are.\n");
attroff(A_BOLD);
addstr("Up above the world so high,\n");
addstr("Like a diamond in the sky.\n");
attrset(A_NORMAL);
addstr("Twinkle, twinkle little star\n");
addstr("How I wonder what you are.\n");
refresh();
getch();
endwin();
}
}
|
3e1155fe6ebe370ff7afe729eb6c338fd7661170 | 275 | java | Java | app/controllers/LoginController.java | shanakaperera/epacs_admin | b5b1624dbfb0786c033b2c47fdc1947124506e3a | [
"CC0-1.0"
] | null | null | null | app/controllers/LoginController.java | shanakaperera/epacs_admin | b5b1624dbfb0786c033b2c47fdc1947124506e3a | [
"CC0-1.0"
] | null | null | null | app/controllers/LoginController.java | shanakaperera/epacs_admin | b5b1624dbfb0786c033b2c47fdc1947124506e3a | [
"CC0-1.0"
] | null | null | null | 18.333333 | 61 | 0.701818 | 7,312 | package controllers;
import play.mvc.*;
import java.sql.SQLException;
public class LoginController extends Controller {
public Result login() throws SQLException {
String title = "Admin";
return ok(views.html.login_page.login.render(title));
}
}
|
3e1156be053b78a23293e2bc556cb1b0b458bd64 | 15,936 | java | Java | ProyectoMEIA/src/main/java/GUI/ManejoListaDistribucion.java | Deal-RP/Proyecto_MEIA | 420469f82cd55674cf0a4b47ef5dfa3dfbbec013 | [
"MIT"
] | 1 | 2020-09-14T05:00:22.000Z | 2020-09-14T05:00:22.000Z | ProyectoMEIA/src/main/java/GUI/ManejoListaDistribucion.java | Deal-RP/Proyecto_MEIA | 420469f82cd55674cf0a4b47ef5dfa3dfbbec013 | [
"MIT"
] | 20 | 2020-09-19T22:53:33.000Z | 2020-11-16T14:15:44.000Z | ProyectoMEIA/src/main/java/GUI/ManejoListaDistribucion.java | Deal-RP/Proyecto_MEIA | 420469f82cd55674cf0a4b47ef5dfa3dfbbec013 | [
"MIT"
] | 1 | 2020-11-26T16:48:20.000Z | 2020-11-26T16:48:20.000Z | 46.596491 | 169 | 0.618411 | 7,313 | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package GUI;
import Management.Data;
import Management.ManagmentList;
import Management.ManejoArchivo;
import java.awt.Image;
import java.io.File;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.regex.Pattern;
import javax.swing.DefaultListModel;
import javax.swing.ImageIcon;
import javax.swing.JOptionPane;
/**
*
* @author derly
*/
public class ManejoListaDistribucion extends javax.swing.JFrame {
/**
* Creates new form ManejoListaDistribucion
*/
public ManejoListaDistribucion() {
initComponents();
var dataUser = Data.getData();
var user = dataUser.getUser();
var strError = "";
var objManejoArchivo = new ManejoArchivo();
var listaMostrar = new DefaultListModel();
File Archivo = new File("C:/MEIA/lista.txt");
var lista = objManejoArchivo.LecturaCompleta(Archivo, strError);
for (int i = 0; i < lista.size(); i++) {
var splitAux = lista.get(i).split(Pattern.quote("|"));
if(splitAux[1].equals(user) && splitAux[5].equals("1")){
listaMostrar.addElement(splitAux[0] + "-" + splitAux[2]);
}
}
Archivo = new File("C:/MEIA/bitacora_lista.txt");
lista = objManejoArchivo.LecturaCompleta(Archivo, strError);
for (int i = 0; i < lista.size(); i++) {
var splitAux = lista.get(i).split(Pattern.quote("|"));
if(splitAux[1].equals(user) && splitAux[5].equals("1")){
listaMostrar.addElement(splitAux[0] + "-" + splitAux[2]);
}
}
lListas.setModel(listaMostrar);
listaMostrar = new DefaultListModel();
Archivo = new File("C:/MEIA/contactos.txt");
lista = objManejoArchivo.LecturaCompleta(Archivo, strError);
for (int i = 0; i < lista.size(); i++) {
var splitAux = lista.get(i).split(Pattern.quote("|"));
if(splitAux[0].equals(user) && splitAux[4].equals("1")){
listaMostrar.addElement(splitAux[1]);
}
}
Archivo = new File("C:/MEIA/bitacora_contactos.txt");
lista = objManejoArchivo.LecturaCompleta(Archivo, strError);
for (int i = 0; i < lista.size(); i++) {
var splitAux = lista.get(i).split(Pattern.quote("|"));
if(splitAux[0].equals(user) && splitAux[4].equals("1")){
listaMostrar.addElement(splitAux[1]);
}
}
lContactoTotal.setModel(listaMostrar);
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
jScrollPane1 = new javax.swing.JScrollPane();
lListas = new javax.swing.JList<>();
jLabel6 = new javax.swing.JLabel();
jScrollPane3 = new javax.swing.JScrollPane();
lContacto = new javax.swing.JList<>();
jScrollPane2 = new javax.swing.JScrollPane();
lContactoTotal = new javax.swing.JList<>();
jLabel3 = new javax.swing.JLabel();
jButton1 = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jLabel1.setText("Listas de distribucion:");
lListas.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
lListas.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
lListasMouseClicked(evt);
}
});
jScrollPane1.setViewportView(lListas);
jLabel6.setText("Contactos en lista seleccionada:");
lContacto.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
lContacto.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
lContactoMouseClicked(evt);
}
});
jScrollPane3.setViewportView(lContacto);
lContactoTotal.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
lContactoTotal.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
lContactoTotalMouseClicked(evt);
}
});
jScrollPane2.setViewportView(lContactoTotal);
jLabel3.setText("Contactos:");
jButton1.setText("Salir");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 195, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel1))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 192, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel6))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel3)
.addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 175, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(0, 0, Short.MAX_VALUE))
.addComponent(jButton1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1)
.addComponent(jLabel6)
.addComponent(jLabel3))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 214, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton1))
.addComponent(jScrollPane3)
.addComponent(jScrollPane1))
.addContainerGap())
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
File Archivo = new File("C:/MEIA/usuario.txt");
var objManejoArchivo = new ManejoArchivo();
var strError = "";
var dataUser = Data.getData();
var user = dataUser.getUser();
var ArchivoUser = objManejoArchivo.BuscarLinea(Archivo, user, strError, 0, 9);
var split = ArchivoUser.split(Pattern.quote("|"));
var sistema = new AplicacionMenu();
sistema.L_Bienvenida.setText("BIENVENIDO:" + split[0]);
sistema.Dato.setText(split[0]);
sistema.Dato.setVisible(false);
if(split[4].equals("1")){
sistema.L_Rol.setText("Rol: Administrador");
}else{
sistema.L_Rol.setText("Rol: Usuario");
}
try
{
Image img = new ImageIcon(split[8]).getImage();
Image newImg = img.getScaledInstance(120, 120, java.awt.Image.SCALE_SMOOTH);
sistema.L_Image.setIcon(new ImageIcon(newImg));
} catch(Exception ex){
strError = ex.getMessage();
}
sistema.setVisible(true);
this.dispose();
}//GEN-LAST:event_jButton1ActionPerformed
private void lListasMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lListasMouseClicked
var seleccion = lListas.getSelectedValue();
var dataUser = Data.getData();
var user = dataUser.getUser();
if (seleccion != null) {
var objManejo = new ManejoArchivo();
var split = seleccion.split(Pattern.quote("-"));
var listaMostrar = new DefaultListModel();
var lista = objManejo.lecturaCompleta("Lista_usuario", split[0], user);
for (int i = 0; i < lista.size(); i++) {
var splitAux = lista.get(i).split(Pattern.quote("|"));
listaMostrar.addElement(splitAux[3]);
}
lContacto.setModel(listaMostrar);
}
lContacto.clearSelection();
lContactoTotal.clearSelection();
}//GEN-LAST:event_lListasMouseClicked
private void lContactoTotalMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lContactoTotalMouseClicked
var seleccionLista = lListas.getSelectedValue();
var seleccionUsuario = lContactoTotal.getSelectedValue();
var strError = "";
var dataUser = Data.getData();
var user = dataUser.getUser();
if (seleccionLista != null && seleccionUsuario != null) {
int iRespuesta = JOptionPane.showConfirmDialog(null, "¿Desea agregar el contacto? ", "¿Insertar?", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
if (iRespuesta == 0) {
var objManejo = new ManejoArchivo();
DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
Date date = new Date();
var split = seleccionLista.split(Pattern.quote("-"));
var linea = split[0] + "|" + user + "|" + seleccionUsuario + "|" + split[1] + "|" + dateFormat.format(date) + "|1";
if(!objManejo.insertar("Lista_usuario", linea, strError)){
JOptionPane.showMessageDialog(null, "Registro ya existe", "FALLO", 1);
}
else{
var listaMostrar = new DefaultListModel();
var lista = objManejo.lecturaCompleta("Lista_usuario", split[0], user);
for (int i = 0; i < lista.size(); i++) {
var splitAux = lista.get(i).split(Pattern.quote("|"));
listaMostrar.addElement(splitAux[3]);
}
lContacto.setModel(listaMostrar);
var objManagment = new ManagmentList();
objManagment.ModifyQuantityFriends(split[0],1);
}
lContactoTotal.clearSelection();
}
}
}//GEN-LAST:event_lContactoTotalMouseClicked
private void lContactoMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lContactoMouseClicked
var seleccionLista = lListas.getSelectedValue();
var seleccionUsuario = lContacto.getSelectedValue();
var strError = "";
var dataUser = Data.getData();
var user = dataUser.getUser();
if (seleccionLista != null && seleccionUsuario != null) {
int iRespuesta = JOptionPane.showConfirmDialog(null, "¿Desea eliminar el contacto? ", "¿Eliminar?", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
if (iRespuesta == 0) {
var objManejo = new ManejoArchivo();
var split = seleccionLista.split(Pattern.quote("-"));
objManejo.darBaja("Lista_usuario", split[0], user, seleccionUsuario);
var listaMostrar = new DefaultListModel();
var lista = objManejo.lecturaCompleta("Lista_usuario", split[0], user);
for (int i = 0; i < lista.size(); i++) {
var splitAux = lista.get(i).split(Pattern.quote("|"));
listaMostrar.addElement(splitAux[3]);
}
lContacto.setModel(listaMostrar);
lContacto.clearSelection();
var objManagment = new ManagmentList();
objManagment.ModifyQuantityFriends(split[0],2);
}
}
}//GEN-LAST:event_lContactoMouseClicked
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(ManejoListaDistribucion.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(ManejoListaDistribucion.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(ManejoListaDistribucion.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(ManejoListaDistribucion.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new ManejoListaDistribucion().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButton1;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel6;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JScrollPane jScrollPane2;
private javax.swing.JScrollPane jScrollPane3;
private javax.swing.JList<String> lContacto;
private javax.swing.JList<String> lContactoTotal;
private javax.swing.JList<String> lListas;
// End of variables declaration//GEN-END:variables
}
|
3e1157d8b12bb04e724728d66e1fd24e41244187 | 3,093 | java | Java | src/tests/junit/org/apache/tools/ant/taskdefs/GetTest.java | sonyDeswal/GitProjectAnt | 0f110eac27c17cf3bdbcfee77bc5b9b4aead9f4e | [
"Apache-2.0"
] | 1 | 2022-01-25T03:48:11.000Z | 2022-01-25T03:48:11.000Z | src/tests/junit/org/apache/tools/ant/taskdefs/GetTest.java | changgengli/ant | f1930b0061d661e4b0a4072caacb19d35a61f370 | [
"Apache-2.0"
] | null | null | null | src/tests/junit/org/apache/tools/ant/taskdefs/GetTest.java | changgengli/ant | f1930b0061d661e4b0a4072caacb19d35a61f370 | [
"Apache-2.0"
] | null | null | null | 25.146341 | 76 | 0.606208 | 7,314 | /*
* 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.tools.ant.taskdefs;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.BuildFileRule;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import static org.junit.Assert.fail;
/**
*/
public class GetTest {
@Rule
public final BuildFileRule buildRule = new BuildFileRule();
@Before
public void setUp() {
buildRule.configureProject("src/etc/testcases/taskdefs/get.xml");
}
@After
public void tearDown() {
buildRule.executeTarget("cleanup");
}
@Test
public void test1() {
try {
buildRule.executeTarget("test1");
fail("required argument missing");
} catch (BuildException ex) {
//TODO assert value
}
}
@Test
public void test2() {
try {
buildRule.executeTarget("test2");
fail("required argument missing");
} catch (BuildException ex) {
//TODO assert value
}
}
@Test
public void test3() {
try {
buildRule.executeTarget("test3");
fail("required argument missing");
} catch (BuildException ex) {
//TODO assert value
}
}
@Test
public void test4() {
try {
buildRule.executeTarget("test4");
fail("src invalid");
} catch (BuildException ex) {
//TODO assert value
}
}
@Test
public void test5() {
try {
buildRule.executeTarget("test5");
fail("dest invalid (or no http-server on local machine");
} catch (BuildException ex) {
//TODO assert value
}
}
@Test
public void test6() {
buildRule.executeTarget("test6");
}
@Test
public void test7() {
try {
buildRule.executeTarget("test7");
fail("userAgent may not be null or empty");
} catch (BuildException ex) {
//TODO assert value
}
}
@Test
public void testUseTimestamp() {
buildRule.executeTarget("testUseTimestamp");
}
@Test
public void testUseTomorrow() {
buildRule.executeTarget("testUseTomorrow");
}
}
|
3e115860943ba313be913fc6e8097dca5da2e77a | 3,997 | java | Java | app/src/main/java/com/steven/download/download/DownloadRunnable.java | StevenYan88/MultiThreadDownload | 89593a26c50c79bb3f4ed53833584746f9710bb5 | [
"Apache-2.0"
] | 77 | 2018-04-26T05:35:58.000Z | 2022-01-02T04:50:02.000Z | app/src/main/java/com/steven/download/download/DownloadRunnable.java | StevenYan88/MultiThreadDownload | 89593a26c50c79bb3f4ed53833584746f9710bb5 | [
"Apache-2.0"
] | 2 | 2019-01-22T09:42:58.000Z | 2020-06-19T11:07:06.000Z | app/src/main/java/com/steven/download/download/DownloadRunnable.java | StevenYan88/MultiThreadDownload | 89593a26c50c79bb3f4ed53833584746f9710bb5 | [
"Apache-2.0"
] | 20 | 2018-05-09T10:56:41.000Z | 2021-11-13T14:00:10.000Z | 32.495935 | 110 | 0.605454 | 7,315 | package com.steven.download.download;
import android.os.Environment;
import android.util.Log;
import com.steven.download.download.db.DownloadEntity;
import com.steven.download.okhttp.OkHttpManager;
import com.steven.download.utils.Utils;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.RandomAccessFile;
import okhttp3.Response;
/**
* Description:
* Data:4/19/2018-1:45 PM
*
* @author: yanzhiwen
*/
public class DownloadRunnable implements Runnable {
private static final String TAG = "DownloadRunnable";
private static final int STATUS_DOWNLOADING = 1;
private static final int STATUS_STOP = 2;
//线程的状态
private int mStatus = STATUS_DOWNLOADING;
//文件下载的url
private String url;
//文件的名称
private String name;
//线程id
private int threadId;
//每个线程下载开始的位置
private long start;
//每个线程下载结束的位置
private long end;
//每个线程的下载进度
private long mProgress;
//文件的总大小 content-length
private long mCurrentLength;
private DownloadCallback downloadCallback;
private DownloadEntity mDownloadEntity;
public DownloadRunnable(String name, String url, long currentLength, int threadId, long start, long end,
long progress, DownloadEntity downloadEntity, DownloadCallback downloadCallback) {
this.name = name;
this.url = url;
this.mCurrentLength = currentLength;
this.threadId = threadId;
this.start = start;
this.end = end;
this.mProgress = progress;
this.mDownloadEntity = downloadEntity;
this.downloadCallback = downloadCallback;
}
@Override
public void run() {
InputStream inputStream = null;
RandomAccessFile randomAccessFile = null;
try {
Response response = OkHttpManager.getInstance().syncResponse(url, start, end);
inputStream = response.body().byteStream();
long contentLength = response.body().contentLength();
Log.d(TAG, "start:" + start + ",end:" + end + "contentLength:" + contentLength);
//保存文件的路径
File file = new File(Environment.getExternalStorageDirectory().getAbsolutePath(), name);
randomAccessFile = new RandomAccessFile(file, "rwd");
//seek从哪里开始
randomAccessFile.seek(start);
int length;
byte[] bytes = new byte[10 * 1024];
while ((length = inputStream.read(bytes)) != -1) {
if (mStatus == STATUS_STOP) {
downloadCallback.onPause(length, mCurrentLength);
break;
}
//写入
randomAccessFile.write(bytes, 0, length);
this.mProgress = this.mProgress + length;
//实时去更新下进度条
downloadCallback.onProgress(length, mCurrentLength);
if (this.mProgress == contentLength) {
Log.d(TAG, file.getName() + threadId + "下载成功");
downloadCallback.onSuccess(file);
}
}
// if (mStatus != STATUS_STOP) {
// downloadCallback.onSuccess(file);
// }
} catch (IOException e) {
e.printStackTrace();
downloadCallback.onFailure(e);
} finally {
Utils.close(inputStream);
Utils.close(randomAccessFile);
//保存到数据库
saveToDb();
}
}
public void stop() {
mStatus = STATUS_STOP;
}
private void saveToDb() {
Log.d(TAG, "**************保存到数据库*******************");
mDownloadEntity.setContentLength(mCurrentLength);
mDownloadEntity.setThreadId(threadId);
mDownloadEntity.setUrl(url);
mDownloadEntity.setStart(start);
mDownloadEntity.setEnd(end);
mDownloadEntity.setProgress(mProgress);
//保存到数据库
DaoManagerHelper.getManager().addEntity(mDownloadEntity);
}
}
|
3e11590c194035b6fa6b5f5805d7ca2b5c6233f8 | 2,971 | java | Java | src/main/java/com/theleapofcode/rxjava/observable/ObservableCreationExamples.java | theleapofcode/rxjava-demo | e83643ed3aa69afd8f8f1b8e4f8817ce7233f4dc | [
"MIT"
] | null | null | null | src/main/java/com/theleapofcode/rxjava/observable/ObservableCreationExamples.java | theleapofcode/rxjava-demo | e83643ed3aa69afd8f8f1b8e4f8817ce7233f4dc | [
"MIT"
] | null | null | null | src/main/java/com/theleapofcode/rxjava/observable/ObservableCreationExamples.java | theleapofcode/rxjava-demo | e83643ed3aa69afd8f8f1b8e4f8817ce7233f4dc | [
"MIT"
] | null | null | null | 33.761364 | 110 | 0.70414 | 7,316 | package com.theleapofcode.rxjava.observable;
import java.util.Arrays;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import rx.Observable;
public class ObservableCreationExamples {
private static void createObservableFromCreate() {
Observable<String> ob = Observable.<String>create(s -> {
s.onNext("IronMan");
s.onNext("CaptainAmerica");
s.onNext("Hulk");
s.onCompleted();
});
ob.subscribe((x) -> System.out.println(x), (t) -> t.printStackTrace(), () -> System.out.println("Done..."));
}
private static void createObservableFromFrom() {
Observable<String> ob = Observable.from(Arrays.asList("IronMan", "CaptainAmerica", "Hulk"));
ob.subscribe((x) -> System.out.println(x), (t) -> t.printStackTrace(), () -> System.out.println("Done..."));
}
private static void createObservableFromJust() {
Observable<String> ob = Observable.just("IronMan", "CaptainAmerica", "Hulk");
ob.subscribe((x) -> System.out.println(x), (t) -> t.printStackTrace(), () -> System.out.println("Done..."));
}
private static void createObservableFromRange() {
Observable<Integer> ob = Observable.range(3, 5);
ob.subscribe((x) -> System.out.println(x), (t) -> t.printStackTrace(), () -> System.out.println("Done..."));
}
private static void createObservableFromInterval() throws InterruptedException {
// interval is asynchronous. Hold the thread till observable yields
CountDownLatch latch = new CountDownLatch(1);
Observable<Long> ob = Observable.interval(1, TimeUnit.SECONDS).take(5);
ob.subscribe((x) -> System.out.println(x), (t) -> t.printStackTrace(), () -> {
latch.countDown();
System.out.println("Done...");
});
latch.await();
}
private static void createObservableFromTimer() throws InterruptedException {
// timer is asynchronous. Hold the thread till observable yields
CountDownLatch latch = new CountDownLatch(1);
Observable<Long> ob = Observable.timer(1, TimeUnit.SECONDS);
ob.subscribe((x) -> System.out.println(x), (t) -> t.printStackTrace(), () -> {
latch.countDown();
System.out.println("Done...");
});
latch.await();
}
private static void createObservableFromEmpty() throws InterruptedException {
Observable<Long> ob = Observable.empty();
ob.subscribe((x) -> System.out.println(x), (t) -> t.printStackTrace(), () -> System.out.println("Done..."));
}
private static void createObservableFromError() throws InterruptedException {
Observable<Long> ob = Observable.error(new RuntimeException("My error"));
ob.subscribe((x) -> System.out.println(x), (t) -> t.printStackTrace(), () -> System.out.println("Done..."));
}
public static void main(String[] args) throws InterruptedException {
createObservableFromCreate();
createObservableFromFrom();
createObservableFromJust();
createObservableFromRange();
createObservableFromInterval();
createObservableFromTimer();
createObservableFromEmpty();
createObservableFromError();
}
}
|
3e1159c0a89d02c967e22b53c9740e91e8b8068c | 10,000 | java | Java | aws-java-sdk-kinesisanalyticsv2/src/main/java/com/amazonaws/services/kinesisanalyticsv2/model/MonitoringConfiguration.java | s12v/aws-sdk-java | 3ad7cf9a0b75a4a9d3d0de9ac9c7fbde75dded46 | [
"Apache-2.0"
] | 1 | 2019-10-04T09:23:10.000Z | 2019-10-04T09:23:10.000Z | aws-java-sdk-kinesisanalyticsv2/src/main/java/com/amazonaws/services/kinesisanalyticsv2/model/MonitoringConfiguration.java | kawai-andfactory/aws-sdk-java | 456970159d6ef380ebbab2fd6070471447f8bc86 | [
"Apache-2.0"
] | null | null | null | aws-java-sdk-kinesisanalyticsv2/src/main/java/com/amazonaws/services/kinesisanalyticsv2/model/MonitoringConfiguration.java | kawai-andfactory/aws-sdk-java | 456970159d6ef380ebbab2fd6070471447f8bc86 | [
"Apache-2.0"
] | null | null | null | 33.222591 | 149 | 0.6485 | 7,317 | /*
* Copyright 2013-2018 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.kinesisanalyticsv2.model;
import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;
/**
* <p>
* Describes configuration parameters for Amazon CloudWatch logging for a Java-based Kinesis Data Analytics application.
* For more information about CloudWatch logging, see <a
* href="https://docs.aws.amazon.com/kinesisanalytics/latest/Java/monitoring-overview.html">Monitoring</a>.
* </p>
*
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/kinesisanalyticsv2-2018-05-23/MonitoringConfiguration"
* target="_top">AWS API Documentation</a>
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class MonitoringConfiguration implements Serializable, Cloneable, StructuredPojo {
/**
* <p>
* Describes whether to use the default CloudWatch logging configuration for an application.
* </p>
*/
private String configurationType;
/**
* <p>
* Describes the granularity of the CloudWatch Logs for an application.
* </p>
*/
private String metricsLevel;
/**
* <p>
* Describes the verbosity of the CloudWatch Logs for an application.
* </p>
*/
private String logLevel;
/**
* <p>
* Describes whether to use the default CloudWatch logging configuration for an application.
* </p>
*
* @param configurationType
* Describes whether to use the default CloudWatch logging configuration for an application.
* @see ConfigurationType
*/
public void setConfigurationType(String configurationType) {
this.configurationType = configurationType;
}
/**
* <p>
* Describes whether to use the default CloudWatch logging configuration for an application.
* </p>
*
* @return Describes whether to use the default CloudWatch logging configuration for an application.
* @see ConfigurationType
*/
public String getConfigurationType() {
return this.configurationType;
}
/**
* <p>
* Describes whether to use the default CloudWatch logging configuration for an application.
* </p>
*
* @param configurationType
* Describes whether to use the default CloudWatch logging configuration for an application.
* @return Returns a reference to this object so that method calls can be chained together.
* @see ConfigurationType
*/
public MonitoringConfiguration withConfigurationType(String configurationType) {
setConfigurationType(configurationType);
return this;
}
/**
* <p>
* Describes whether to use the default CloudWatch logging configuration for an application.
* </p>
*
* @param configurationType
* Describes whether to use the default CloudWatch logging configuration for an application.
* @return Returns a reference to this object so that method calls can be chained together.
* @see ConfigurationType
*/
public MonitoringConfiguration withConfigurationType(ConfigurationType configurationType) {
this.configurationType = configurationType.toString();
return this;
}
/**
* <p>
* Describes the granularity of the CloudWatch Logs for an application.
* </p>
*
* @param metricsLevel
* Describes the granularity of the CloudWatch Logs for an application.
* @see MetricsLevel
*/
public void setMetricsLevel(String metricsLevel) {
this.metricsLevel = metricsLevel;
}
/**
* <p>
* Describes the granularity of the CloudWatch Logs for an application.
* </p>
*
* @return Describes the granularity of the CloudWatch Logs for an application.
* @see MetricsLevel
*/
public String getMetricsLevel() {
return this.metricsLevel;
}
/**
* <p>
* Describes the granularity of the CloudWatch Logs for an application.
* </p>
*
* @param metricsLevel
* Describes the granularity of the CloudWatch Logs for an application.
* @return Returns a reference to this object so that method calls can be chained together.
* @see MetricsLevel
*/
public MonitoringConfiguration withMetricsLevel(String metricsLevel) {
setMetricsLevel(metricsLevel);
return this;
}
/**
* <p>
* Describes the granularity of the CloudWatch Logs for an application.
* </p>
*
* @param metricsLevel
* Describes the granularity of the CloudWatch Logs for an application.
* @return Returns a reference to this object so that method calls can be chained together.
* @see MetricsLevel
*/
public MonitoringConfiguration withMetricsLevel(MetricsLevel metricsLevel) {
this.metricsLevel = metricsLevel.toString();
return this;
}
/**
* <p>
* Describes the verbosity of the CloudWatch Logs for an application.
* </p>
*
* @param logLevel
* Describes the verbosity of the CloudWatch Logs for an application.
* @see LogLevel
*/
public void setLogLevel(String logLevel) {
this.logLevel = logLevel;
}
/**
* <p>
* Describes the verbosity of the CloudWatch Logs for an application.
* </p>
*
* @return Describes the verbosity of the CloudWatch Logs for an application.
* @see LogLevel
*/
public String getLogLevel() {
return this.logLevel;
}
/**
* <p>
* Describes the verbosity of the CloudWatch Logs for an application.
* </p>
*
* @param logLevel
* Describes the verbosity of the CloudWatch Logs for an application.
* @return Returns a reference to this object so that method calls can be chained together.
* @see LogLevel
*/
public MonitoringConfiguration withLogLevel(String logLevel) {
setLogLevel(logLevel);
return this;
}
/**
* <p>
* Describes the verbosity of the CloudWatch Logs for an application.
* </p>
*
* @param logLevel
* Describes the verbosity of the CloudWatch Logs for an application.
* @return Returns a reference to this object so that method calls can be chained together.
* @see LogLevel
*/
public MonitoringConfiguration withLogLevel(LogLevel logLevel) {
this.logLevel = logLevel.toString();
return this;
}
/**
* Returns a string representation of this object; useful for testing and debugging.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getConfigurationType() != null)
sb.append("ConfigurationType: ").append(getConfigurationType()).append(",");
if (getMetricsLevel() != null)
sb.append("MetricsLevel: ").append(getMetricsLevel()).append(",");
if (getLogLevel() != null)
sb.append("LogLevel: ").append(getLogLevel());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof MonitoringConfiguration == false)
return false;
MonitoringConfiguration other = (MonitoringConfiguration) obj;
if (other.getConfigurationType() == null ^ this.getConfigurationType() == null)
return false;
if (other.getConfigurationType() != null && other.getConfigurationType().equals(this.getConfigurationType()) == false)
return false;
if (other.getMetricsLevel() == null ^ this.getMetricsLevel() == null)
return false;
if (other.getMetricsLevel() != null && other.getMetricsLevel().equals(this.getMetricsLevel()) == false)
return false;
if (other.getLogLevel() == null ^ this.getLogLevel() == null)
return false;
if (other.getLogLevel() != null && other.getLogLevel().equals(this.getLogLevel()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getConfigurationType() == null) ? 0 : getConfigurationType().hashCode());
hashCode = prime * hashCode + ((getMetricsLevel() == null) ? 0 : getMetricsLevel().hashCode());
hashCode = prime * hashCode + ((getLogLevel() == null) ? 0 : getLogLevel().hashCode());
return hashCode;
}
@Override
public MonitoringConfiguration clone() {
try {
return (MonitoringConfiguration) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
}
}
@com.amazonaws.annotation.SdkInternalApi
@Override
public void marshall(ProtocolMarshaller protocolMarshaller) {
com.amazonaws.services.kinesisanalyticsv2.model.transform.MonitoringConfigurationMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}
|
3e1159e2ab95b836c504028f300797c73b64dd0c | 3,159 | java | Java | examples/v201311/reportservice/RunReachReportExample.java | hockeyprincess/google-api-dfp-java | f9ec49d46292ba510d6be67c68f59959d0495f06 | [
"Apache-2.0"
] | null | null | null | examples/v201311/reportservice/RunReachReportExample.java | hockeyprincess/google-api-dfp-java | f9ec49d46292ba510d6be67c68f59959d0495f06 | [
"Apache-2.0"
] | null | null | null | examples/v201311/reportservice/RunReachReportExample.java | hockeyprincess/google-api-dfp-java | f9ec49d46292ba510d6be67c68f59959d0495f06 | [
"Apache-2.0"
] | null | null | null | 38.096386 | 100 | 0.71284 | 7,318 | // Copyright 2013 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package v201311.reportservice;
import com.google.api.ads.dfp.lib.DfpService;
import com.google.api.ads.dfp.lib.DfpServiceLogger;
import com.google.api.ads.dfp.lib.DfpUser;
import com.google.api.ads.dfp.v201311.Column;
import com.google.api.ads.dfp.v201311.DateRangeType;
import com.google.api.ads.dfp.v201311.Dimension;
import com.google.api.ads.dfp.v201311.ReportJob;
import com.google.api.ads.dfp.v201311.ReportJobStatus;
import com.google.api.ads.dfp.v201311.ReportQuery;
import com.google.api.ads.dfp.v201311.ReportServiceInterface;
/**
* This example runs a reach report. To download the report see
* DownloadReportExample.java. To use the
* {@link com.google.api.ads.dfp.lib.utils.v201311.ReportUtils} class, see
* RunAndDownloadReport.java under /examples/v201311/utils.
*
* Tags: ReportService.runReportJob, ReportService.getReportJob
*
* @author ychag@example.com (Adam Rogal)
*/
public class RunReachReportExample {
public static void main(String[] args) {
try {
// Log SOAP XML request and response.
DfpServiceLogger.log();
// Get DfpUser from "~/dfp.properties".
DfpUser user = new DfpUser();
// Get the ReportService.
ReportServiceInterface reportService = user.getService(DfpService.V201311.REPORT_SERVICE);
// Create report job.
ReportJob reportJob = new ReportJob();
// Create report query.
ReportQuery reportQuery = new ReportQuery();
reportQuery.setDateRangeType(DateRangeType.REACH_LIFETIME);
reportQuery.setDimensions(new Dimension[] {Dimension.LINE_ITEM_ID, Dimension.LINE_ITEM_NAME});
reportQuery.setColumns(new Column[] {Column.REACH_FREQUENCY,
Column.REACH_AVERAGE_REVENUE, Column.REACH});
reportJob.setReportQuery(reportQuery);
// Run report job.
reportJob = reportService.runReportJob(reportJob);
do {
System.out.println("Report with ID '" + reportJob.getId() + "' is still running.");
Thread.sleep(30000);
// Get report job.
reportJob = reportService.getReportJob(reportJob.getId());
} while (reportJob.getReportJobStatus() == ReportJobStatus.IN_PROGRESS);
if (reportJob.getReportJobStatus() == ReportJobStatus.FAILED) {
System.out.println("Report job with ID '" + reportJob.getId()
+ "' failed to finish successfully.");
} else {
System.out.println("Report job with ID '" + reportJob.getId()
+ "' completed successfully.");
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
|
3e115a26974e0218acd29134051198aba9080bf2 | 2,035 | java | Java | LACCPlus/Hadoop/3114_2.java | sgholamian/log-aware-clone-detection | 9993cb081c420413c231d1807bfff342c39aa69a | [
"MIT"
] | null | null | null | LACCPlus/Hadoop/3114_2.java | sgholamian/log-aware-clone-detection | 9993cb081c420413c231d1807bfff342c39aa69a | [
"MIT"
] | null | null | null | LACCPlus/Hadoop/3114_2.java | sgholamian/log-aware-clone-detection | 9993cb081c420413c231d1807bfff342c39aa69a | [
"MIT"
] | null | null | null | 44.23913 | 101 | 0.661916 | 7,319 | //,temp,CGroupsCpuResourceHandlerImpl.java,205,246,temp,CGroupsMemoryResourceHandlerImpl.java,110,150
//,3
public class xxx {
@Override
public List<PrivilegedOperation> updateContainer(Container container)
throws ResourceHandlerException {
String cgroupId = container.getContainerId().toString();
File cgroup = new File(cGroupsHandler.getPathForCGroup(MEMORY, cgroupId));
if (cgroup.exists()) {
//memory is in MB
long containerSoftLimit =
(long) (container.getResource().getMemorySize() * this.softLimit);
long containerHardLimit = container.getResource().getMemorySize();
if (enforce) {
try {
cGroupsHandler.updateCGroupParam(MEMORY, cgroupId,
CGroupsHandler.CGROUP_PARAM_MEMORY_HARD_LIMIT_BYTES,
String.valueOf(containerHardLimit) + "M");
ContainerTokenIdentifier id = container.getContainerTokenIdentifier();
if (id != null && id.getExecutionType() ==
ExecutionType.OPPORTUNISTIC) {
cGroupsHandler.updateCGroupParam(MEMORY, cgroupId,
CGroupsHandler.CGROUP_PARAM_MEMORY_SOFT_LIMIT_BYTES,
String.valueOf(OPPORTUNISTIC_SOFT_LIMIT) + "M");
cGroupsHandler.updateCGroupParam(MEMORY, cgroupId,
CGroupsHandler.CGROUP_PARAM_MEMORY_SWAPPINESS,
String.valueOf(OPPORTUNISTIC_SWAPPINESS));
} else {
cGroupsHandler.updateCGroupParam(MEMORY, cgroupId,
CGroupsHandler.CGROUP_PARAM_MEMORY_SOFT_LIMIT_BYTES,
String.valueOf(containerSoftLimit) + "M");
cGroupsHandler.updateCGroupParam(MEMORY, cgroupId,
CGroupsHandler.CGROUP_PARAM_MEMORY_SWAPPINESS,
String.valueOf(swappiness));
}
} catch (ResourceHandlerException re) {
cGroupsHandler.deleteCGroup(MEMORY, cgroupId);
LOG.warn("Could not update cgroup for container", re);
throw re;
}
}
}
return null;
}
}; |
3e115a29a64213b1135a63d1855a2f6bdf0f7dea | 4,403 | java | Java | whois-endtoend/src/test/java/net/ripe/db/whois/compare/rest/RestExecutor.java | WEBZCC/whois | 5babbb0ef5456cfac96270789c320d226d26e9ee | [
"BSD-3-Clause"
] | 362 | 2015-01-21T16:20:23.000Z | 2022-03-29T08:25:37.000Z | whois-endtoend/src/test/java/net/ripe/db/whois/compare/rest/RestExecutor.java | WEBZCC/whois | 5babbb0ef5456cfac96270789c320d226d26e9ee | [
"BSD-3-Clause"
] | 370 | 2015-01-05T17:00:34.000Z | 2022-03-31T13:34:07.000Z | whois-endtoend/src/test/java/net/ripe/db/whois/compare/rest/RestExecutor.java | WEBZCC/whois | 5babbb0ef5456cfac96270789c320d226d26e9ee | [
"BSD-3-Clause"
] | 96 | 2015-05-01T15:57:45.000Z | 2022-02-15T08:21:22.000Z | 37.632479 | 121 | 0.691574 | 7,320 | package net.ripe.db.whois.compare.rest;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider;
import com.google.common.base.Stopwatch;
import net.ripe.db.whois.common.domain.ResponseObject;
import net.ripe.db.whois.common.support.QueryExecutorConfiguration;
import net.ripe.db.whois.compare.common.ComparisonExecutor;
import net.ripe.db.whois.compare.common.ComparisonExecutorConfig;
import org.apache.velocity.app.event.implement.EscapeXmlReference;
import org.glassfish.jersey.media.multipart.MultiPartFeature;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.ws.rs.ClientErrorException;
import javax.ws.rs.RedirectionException;
import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.MediaType;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.StringReader;
import java.net.UnknownHostException;
import java.util.Collections;
import java.util.List;
public class RestExecutor implements ComparisonExecutor {
private static final Logger LOGGER = LoggerFactory.getLogger(RestExecutor.class);
private final ComparisonExecutorConfig configuration;
public RestExecutor(final ComparisonExecutorConfig configuration) throws UnknownHostException {
this.configuration = configuration;
}
@Override
public List<ResponseObject> getResponse(final String query) throws IOException {
final RestQueryProperties props = new RestQueryProperties(query);
String response;
final Stopwatch stopWatch = Stopwatch.createStarted();
try {
response = RestCaller.target(configuration.getHost(), props.getPortFromConfiguration(configuration), query)
.request(props.getMediaType())
.get(String.class);
} catch (ClientErrorException e) {
response = e.getResponse().readEntity(String.class);
} catch (RedirectionException e) {
//need to add this as some route, autnum objects can be moved to RIR space once authorative file gets updated
response = e.getMessage();
} finally {
stopWatch.stop();
}
return Collections.<ResponseObject>singletonList(
new StringResponseObject(parseResponse(props, response)));
}
@Override
public QueryExecutorConfiguration getExecutorConfig() {
return configuration;
}
private String parseResponse(final RestQueryProperties props, final String response) {
final String parsedResponse = response.replaceAll("://.+?/", "://server/");
if (configuration.getResponseFormat() == ComparisonExecutorConfig.ResponseFormat.DEFAULT) {
return parsedResponse;
}
return props.getMediaType() == MediaType.APPLICATION_JSON_TYPE ?
compactJson(parsedResponse) : compactXmlNaive(parsedResponse);
}
public static String compactXmlNaive(final String response) {
final BufferedReader br = new BufferedReader(new StringReader(response));
final StringBuffer sb = new StringBuffer();
String line;
try {
while ((line = br.readLine()) != null) {
sb.append(line.trim());
}
return sb.toString();
} catch (IOException e) {
LOGGER.debug("Could not process XML response.", e);
return response;
}
}
public static String compactJson(final String response) {
return response.replaceAll("\\s+", "");
}
static private class RestCaller {
private static final Client client;
static {
final JacksonJaxbJsonProvider jsonProvider = new JacksonJaxbJsonProvider();
jsonProvider.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, false);
jsonProvider.configure(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true);
client = ClientBuilder.newBuilder()
.register(MultiPartFeature.class)
.register(jsonProvider)
.build();
}
private static final WebTarget target(final String host, final int port, final String path) {
return client.target(String.format("http://%s:%d/%s", host, port, path));
}
}
}
|
3e115a93ab0e34e454afa49b0499e885ac975d66 | 1,211 | java | Java | ironman/src/main/java/com/awesome/ironman/config/SwaggerConfig.java | Tobue/base-web | 6fd415fb36075c7bf4bbaf030bd543904fc7f957 | [
"MIT"
] | 21 | 2020-02-01T11:58:33.000Z | 2022-02-07T06:47:53.000Z | ironman/src/main/java/com/awesome/ironman/config/SwaggerConfig.java | Tobue/base-web | 6fd415fb36075c7bf4bbaf030bd543904fc7f957 | [
"MIT"
] | null | null | null | ironman/src/main/java/com/awesome/ironman/config/SwaggerConfig.java | Tobue/base-web | 6fd415fb36075c7bf4bbaf030bd543904fc7f957 | [
"MIT"
] | 4 | 2020-12-30T20:56:41.000Z | 2021-07-27T08:55:33.000Z | 31.868421 | 89 | 0.683732 | 7,321 | package com.awesome.ironman.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
/**
* @author zhangpengcheng
*/
@Configuration
@EnableSwagger2
public class SwaggerConfig {
@Bean
public Docket api() {
return new Docket(DocumentationType.SWAGGER_2)
.apiInfo(apiInfo())
.select()
// 自行修改为自己的包路径
.apis(RequestHandlerSelectors.basePackage("com.awesome.demo.controller"))
.paths(PathSelectors.any())
.build();
}
private ApiInfo apiInfo() {
return new ApiInfoBuilder()
.title("api文档")
.description("restful 风格接口")
.version("1.0")
.build();
}
}
|
3e115aae8847f116722641952497a39bf0361778 | 1,943 | java | Java | api/src/main/java/org/bf2/operator/resources/v1alpha1/ManagedKafkaAgentStatus.java | grdryn/kas-fleetshard | adadfcf366507e1e1522870eb380f07352aa3ef0 | [
"Apache-2.0"
] | null | null | null | api/src/main/java/org/bf2/operator/resources/v1alpha1/ManagedKafkaAgentStatus.java | grdryn/kas-fleetshard | adadfcf366507e1e1522870eb380f07352aa3ef0 | [
"Apache-2.0"
] | 16 | 2022-02-25T14:39:39.000Z | 2022-03-31T15:19:13.000Z | api/src/main/java/org/bf2/operator/resources/v1alpha1/ManagedKafkaAgentStatus.java | grdryn/kas-fleetshard | adadfcf366507e1e1522870eb380f07352aa3ef0 | [
"Apache-2.0"
] | 7 | 2022-02-25T14:11:15.000Z | 2022-03-04T15:25:11.000Z | 23.695122 | 71 | 0.709727 | 7,322 | package org.bf2.operator.resources.v1alpha1;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.sundr.builder.annotations.Buildable;
import java.util.List;
@Buildable(builderPackage = "io.fabric8.kubernetes.api.builder")
@JsonInclude(JsonInclude.Include.NON_NULL)
public class ManagedKafkaAgentStatus {
private List<ManagedKafkaCondition> conditions;
private ClusterCapacity total;
private ClusterCapacity remaining;
private NodeCounts nodeInfo;
private ClusterResizeInfo resizeInfo;
private String updatedTimestamp;
private List<StrimziVersionStatus> strimzi;
public List<ManagedKafkaCondition> getConditions() {
return conditions;
}
public void setConditions(List<ManagedKafkaCondition> conditions) {
this.conditions = conditions;
}
public ClusterCapacity getTotal() {
return total;
}
public void setTotal(ClusterCapacity totalCapacity) {
this.total = totalCapacity;
}
public ClusterCapacity getRemaining() {
return remaining;
}
public void setRemaining(ClusterCapacity remainingCapacity) {
this.remaining = remainingCapacity;
}
public NodeCounts getNodeInfo() {
return nodeInfo;
}
public void setNodeInfo(NodeCounts requiredNodeSizes) {
this.nodeInfo = requiredNodeSizes;
}
public ClusterResizeInfo getResizeInfo() {
return resizeInfo;
}
public void setResizeInfo(ClusterResizeInfo resizeInfo) {
this.resizeInfo = resizeInfo;
}
public String getUpdatedTimestamp() {
return updatedTimestamp;
}
public void setUpdatedTimestamp(String updatedTimestamp) {
this.updatedTimestamp = updatedTimestamp;
}
public List<StrimziVersionStatus> getStrimzi() {
return strimzi;
}
public void setStrimzi(List<StrimziVersionStatus> strimzi) {
this.strimzi = strimzi;
}
}
|
3e115ac59eb2bcc56b92fc6f3ac484ee28f8bf6f | 994 | java | Java | app/src/main/java/com/lwd/qjtv/mvp/ui/message/TextMsgView.java | 541660139/qjtv | a2aed5aca0e7a4211226e1a8a6f5e63c4f401fc5 | [
"Apache-2.0"
] | null | null | null | app/src/main/java/com/lwd/qjtv/mvp/ui/message/TextMsgView.java | 541660139/qjtv | a2aed5aca0e7a4211226e1a8a6f5e63c4f401fc5 | [
"Apache-2.0"
] | null | null | null | app/src/main/java/com/lwd/qjtv/mvp/ui/message/TextMsgView.java | 541660139/qjtv | a2aed5aca0e7a4211226e1a8a6f5e63c4f401fc5 | [
"Apache-2.0"
] | null | null | null | 30.121212 | 92 | 0.72334 | 7,323 | package com.lwd.qjtv.mvp.ui.message;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;
import com.lwd.qjtv.R;
import com.lwd.qjtv.app.utils.EmojiManager;
import io.rong.imlib.model.MessageContent;
import io.rong.message.TextMessage;
public class TextMsgView extends BaseMsgView {
private TextView username;
private TextView msgText;
public TextMsgView(Context context) {
super(context);
View view = LayoutInflater.from(getContext()).inflate(R.layout.msg_text_view, this);
username = (TextView) view.findViewById(R.id.username);
msgText = (TextView) view.findViewById(R.id.msg_text);
}
@Override
public void setContent(MessageContent msgContent) {
TextMessage msg = (TextMessage) msgContent;
username.setText(msg.getUserInfo().getName() + ": ");
msgText.setText(EmojiManager.parse(msg.getContent(), msgText.getTextSize()));
}
}
|
3e115bc20bcb07c9784d5271a4c2b7424596e272 | 4,650 | java | Java | references/bcb_chosen_clones/selected#1766408#108#184.java | cragkhit/elasticsearch | 05567b30c5bde08badcac1bf421454e5d995eb91 | [
"Apache-2.0"
] | 23 | 2018-10-03T15:02:53.000Z | 2021-09-16T11:07:36.000Z | references/bcb_chosen_clones/selected#1766408#108#184.java | cragkhit/elasticsearch | 05567b30c5bde08badcac1bf421454e5d995eb91 | [
"Apache-2.0"
] | 18 | 2019-02-10T04:52:54.000Z | 2022-01-25T02:14:40.000Z | references/bcb_chosen_clones/selected#1766408#108#184.java | cragkhit/Siamese | 05567b30c5bde08badcac1bf421454e5d995eb91 | [
"Apache-2.0"
] | 19 | 2018-11-16T13:39:05.000Z | 2021-09-05T23:59:30.000Z | 59.615385 | 237 | 0.444301 | 7,324 | private void importSources() {
InputOutput io = IOProvider.getDefault().getIO("Import Sources", false);
io.select();
PrintWriter pw = new PrintWriter(io.getOut());
pw.println("Beginning transaction....");
pw.println("Processing selected files:");
String[][] selectedFiles = getSelectedFiles(pw);
if (selectedFiles.length == 0) {
pw.println("There are no files to process.");
} else {
pw.println(new StringBuilder("Importing ").append(selectedFiles.length).append(" files to ").append(group.getDisplayName()).append(" within project ").append(ProjectUtils.getInformation(project).getDisplayName()).toString());
FileObject destFO = group.getRootFolder();
try {
String destRootDir = new File(destFO.getURL().toURI()).getAbsolutePath();
if (destFO.canWrite()) {
for (String[] s : selectedFiles) {
try {
File parentDir = new File(new StringBuilder(destRootDir).append(File.separator).append(s[0]).toString());
if (!parentDir.exists()) {
parentDir.mkdirs();
}
File f = new File(new StringBuilder(destRootDir).append(s[0]).append(File.separator).append(s[1]).toString());
if (!f.exists()) {
f.createNewFile();
}
FileInputStream fin = null;
FileOutputStream fout = null;
byte[] b = new byte[1024];
int read = -1;
try {
File inputFile = new File(new StringBuilder(rootDir).append(s[0]).append(File.separator).append(s[1]).toString());
pw.print(new StringBuilder("\tImporting file:").append(inputFile.getAbsolutePath()).toString());
fin = new FileInputStream(inputFile);
fout = new FileOutputStream(f);
while ((read = fin.read(b)) != -1) {
fout.write(b, 0, read);
}
pw.println(" ... done");
fin.close();
fout.close();
} catch (FileNotFoundException ex) {
DialogDisplayer.getDefault().notify(new NotifyDescriptor.Exception(ex, "Error while importing sources!"));
} catch (IOException ex) {
DialogDisplayer.getDefault().notify(new NotifyDescriptor.Exception(ex, "Error while importing sources!"));
} finally {
if (fin != null) {
try {
fin.close();
} catch (IOException ex) {
DialogDisplayer.getDefault().notify(new NotifyDescriptor.Exception(ex, "Error while importing sources!"));
}
}
if (fout != null) {
try {
fout.close();
} catch (IOException ex) {
}
}
}
} catch (IOException ex) {
DialogDisplayer.getDefault().notify(new NotifyDescriptor.Exception(ex, "Error while importing sources!"));
}
}
pw.println("Import sources completed successfully.");
} else {
pw.println("Cannot write to the destination directory." + " Please check the priviledges and try again.");
return;
}
} catch (FileStateInvalidException ex) {
DialogDisplayer.getDefault().notify(new NotifyDescriptor.Exception(ex, "Error while importing sources!"));
pw.println("Import failed!!");
} catch (URISyntaxException ex) {
DialogDisplayer.getDefault().notify(new NotifyDescriptor.Exception(ex, "Error while importing sources!"));
pw.println("Import failed!!");
}
}
}
|
3e115c250ff13acd6e76d77ef6b79c943e793a84 | 2,398 | java | Java | src/com/blunk/util/PropertiesBox.java | iamdroppy/NillusMobilesDiscoServer | a1f3d3a2798a237f04879fd810ef34d8f357b6d0 | [
"Net-SNMP",
"Xnet"
] | 1 | 2021-05-30T20:14:36.000Z | 2021-05-30T20:14:36.000Z | src/com/blunk/util/PropertiesBox.java | iamdroppy/NillusMobilesDiscoServer | a1f3d3a2798a237f04879fd810ef34d8f357b6d0 | [
"Net-SNMP",
"Xnet"
] | null | null | null | src/com/blunk/util/PropertiesBox.java | iamdroppy/NillusMobilesDiscoServer | a1f3d3a2798a237f04879fd810ef34d8f357b6d0 | [
"Net-SNMP",
"Xnet"
] | null | null | null | 24.979167 | 98 | 0.672644 | 7,325 | package com.blunk.util;
import java.util.Properties;
import java.io.FileInputStream;
/**
* PropertiesBox is a java.util.Properties utility that can load Properties from file and return
* them.
*
* @author Nillus
*/
public final class PropertiesBox
{
private Properties props;
public PropertiesBox()
{
this.props = new Properties();
}
public boolean load(String filePath)
{
try
{
this.props.load(new FileInputStream(filePath));
return true;
}
catch (Exception ex)
{
ex.printStackTrace();
return false;
}
}
/**
* Returns the value of a property of a given name.
*
* @param propName The name of the property to get the value of.
* @return The value of the requested property. Null is returned if the property is not defined.
*/
public String get(String propName)
{
return this.get(propName, null);
}
/**
* Returns the value of a property of a given name.
*
* @param propName The name of the property to get the value of.
* @param valDefault This value is returned if the property is not defined.
* @return The value of the requested property. valDefault is returned if the property is not
* defined.
*/
public String get(String propName, String valDefault)
{
return this.props.getProperty(propName, valDefault);
}
/**
* Returns the value of an property of a given name, after parsing it to an integer.
*
* @param propName The name of the property to get the value of.
* @return The value of the requested property. Null is returned if the property is not defined.
*/
public int getInt(String propName)
{
return this.getInt(propName, 0);
}
/**
* Returns the value of a property of a given name, after parsing it to an integer.
*
* @param propName The name of the property to get the value of.
* @param valDefault This value is returned if the property is not defined or is not parseable
* to integer.
* @return The value of the requested property. valDefault is returned if the property is not
* defined or is not parseable to integer.
*/
public int getInt(String propName, int valDefault)
{
try
{
return Integer.parseInt(this.get(propName));
}
catch (NumberFormatException ex)
{
return valDefault;
}
}
public int size()
{
return this.props.size();
}
}
|
3e115c3ea9068ae6aa22db7b370ea26a214165a3 | 285 | java | Java | sources/com/bumptech/glide/p100c/C5938k.java | tusharchoudhary0003/Custom-Football-Game | 47283462b2066ad5c53b3c901182e7ae62a34fc8 | [
"MIT"
] | 1 | 2019-10-01T11:34:10.000Z | 2019-10-01T11:34:10.000Z | sources/com/bumptech/glide/p100c/C5938k.java | tusharchoudhary0003/Custom-Football-Game | 47283462b2066ad5c53b3c901182e7ae62a34fc8 | [
"MIT"
] | null | null | null | sources/com/bumptech/glide/p100c/C5938k.java | tusharchoudhary0003/Custom-Football-Game | 47283462b2066ad5c53b3c901182e7ae62a34fc8 | [
"MIT"
] | 1 | 2020-05-26T05:10:33.000Z | 2020-05-26T05:10:33.000Z | 15.833333 | 44 | 0.621053 | 7,326 | package com.bumptech.glide.p100c;
/* renamed from: com.bumptech.glide.c.k */
/* compiled from: NullConnectivityMonitor */
class C5938k implements C5929c {
C5938k() {
}
public void onStart() {
}
public void onStop() {
}
public void onDestroy() {
}
}
|
3e115c4922c70fe6ba09e2f1fd13601a7def54bb | 1,412 | java | Java | src/comp/PingRequestHandlerPlugin/PingRequestHandlerPluginImp.java | xLineMapper/solr | dac23f5c15176d680b70b599001366a2ba7234c3 | [
"Apache-2.0"
] | null | null | null | src/comp/PingRequestHandlerPlugin/PingRequestHandlerPluginImp.java | xLineMapper/solr | dac23f5c15176d680b70b599001366a2ba7234c3 | [
"Apache-2.0"
] | null | null | null | src/comp/PingRequestHandlerPlugin/PingRequestHandlerPluginImp.java | xLineMapper/solr | dac23f5c15176d680b70b599001366a2ba7234c3 | [
"Apache-2.0"
] | null | null | null | 23.932203 | 117 | 0.735127 | 7,327 | package comp.PingRequestHandlerPlugin;
import edu.umkc.config.Bootstrapper;
import edu.umkc.solr.core.PluginInfo;
import java.util.Map;
import annotation.Feature;
import annotation.Optional;
@Optional(Feature.PING_REQUEST_HANDLER)
public class PingRequestHandlerPluginImp implements IPingRequestHandlerPluginImp
{
private PingRequestHandlerPluginArch _arch;
public PingRequestHandlerPluginImp (){
}
public void setArch(PingRequestHandlerPluginArch arch){
_arch = arch;
}
public PingRequestHandlerPluginArch getArch(){
return _arch;
}
/*
Myx Lifecycle Methods: these methods are called automatically by the framework
as the bricks are created, attached, detached, and destroyed respectively.
*/
public void init(){
Bootstrapper.incrInitCount();
}
public void begin(){
Bootstrapper.incrBeginCount();
}
public void end(){
//TODO Auto-generated method stub
}
public void destroy(){
//TODO Auto-generated method stub
}
/*
Implementation primitives required by the architecture
*/
private final String pluginName = "PingRequestHandler";
//To be imported: Map,PluginInfo
public boolean registerPingRequestHandlerPlugin (final PluginInfo info,final Map<String, PluginInfo> infoMap) {
if (info.className.contains(pluginName)) {
infoMap.put(info.name, info);
return true;
}
return false;
}
} |
3e115d67e29b0f49fe09de06a159ee29690d9658 | 2,601 | java | Java | src/main/java/ms/kevi/skyblock/game/stats/GameStats.java | KCodeYT/SkyBlockClone | e7a9cbb0d87769e4af5fbb9af823247ea2bf564d | [
"Apache-2.0"
] | 1 | 2022-03-17T22:07:51.000Z | 2022-03-17T22:07:51.000Z | src/main/java/ms/kevi/skyblock/game/stats/GameStats.java | KCodeYT/SkyBlockClone | e7a9cbb0d87769e4af5fbb9af823247ea2bf564d | [
"Apache-2.0"
] | 1 | 2022-01-27T19:43:20.000Z | 2022-01-29T18:05:53.000Z | src/main/java/ms/kevi/skyblock/game/stats/GameStats.java | KCodeYT/SkyBlockClone | e7a9cbb0d87769e4af5fbb9af823247ea2bf564d | [
"Apache-2.0"
] | null | null | null | 36.633803 | 162 | 0.668589 | 7,328 | /*
* Copyright 2022 KCodeYT
*
* 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 ms.kevi.skyblock.game.stats;
import lombok.AllArgsConstructor;
import lombok.Getter;
import ms.kevi.skyblock.util.MapUtil;
import java.util.HashMap;
import java.util.Map;
@Getter
@AllArgsConstructor
public enum GameStats {
HEALTH("Health", " HP", "§c", 100, -1, false, StatsType.SELF, 0),
DEFENSE("Defense", "", "§a", 0, -1, true, StatsType.SELF, 1),
STRENGTH("Strength", "", "§c", 0, -1, true, StatsType.DAMAGE, 1),
SPEED("Speed", "", "§f", 100, 400, true, StatsType.SELF, 2),
CRITICAL_CHANCE("Crit Chance", "%", "§9", 20, 100, true, StatsType.DAMAGE, 2),
CRITICAL_DAMAGE("Crit Damage", "%", "§9", 50, -1, true, StatsType.DAMAGE, 3),
ATTACK_SPEED("Bonus Attack Speed", "%", "§e", 50, -1, true, StatsType.DAMAGE, 4),
INTELLIGENCE("Intelligence", "", "§b", 100, -1, false, StatsType.SELF, 3),
DAMAGE("Damage", "", "§c", 100, -1, true, StatsType.DAMAGE, 0);
private final String displayName;
private final String suffix;
private final String colorCode;
private final int baseValue;
private final int maxValue;
private final boolean iStatic;
private final StatsType statsType;
private final int typeIndex;
public static GameStats[] sortValues() {
final Map<GameStats, Integer> gameStatsMap = new HashMap<>();
final GameStats[] values = values();
final int length = values.length;
for(GameStats gameStats : values)
gameStatsMap.put(gameStats, gameStats.statsType.ordinal() * length + gameStats.typeIndex);
return MapUtil.sortByValue(gameStatsMap).keySet().toArray(new GameStats[0]);
}
public String toString(boolean color, boolean suffix) {
return color && suffix ? this.colorCode + this.displayName + this.suffix : (color ? this.colorCode : "") + this.displayName + (suffix ? this.suffix : "");
}
@Getter
@AllArgsConstructor
public enum StatsType {
DAMAGE("§c"),
SELF("§a");
private final String colorCode;
}
}
|
3e115e7a1e0b98a1b6fbd049d6432a187ccb867c | 539 | java | Java | src/main/java/br/com/zup/casa_do_codigo/controllers/validation/ExistingId.java | i-gxr/orange-talents-09-template-casa-do-codigo | 1d4598ac79fba9ecb2af7c1d958ded870b898800 | [
"Apache-2.0"
] | null | null | null | src/main/java/br/com/zup/casa_do_codigo/controllers/validation/ExistingId.java | i-gxr/orange-talents-09-template-casa-do-codigo | 1d4598ac79fba9ecb2af7c1d958ded870b898800 | [
"Apache-2.0"
] | null | null | null | src/main/java/br/com/zup/casa_do_codigo/controllers/validation/ExistingId.java | i-gxr/orange-talents-09-template-casa-do-codigo | 1d4598ac79fba9ecb2af7c1d958ded870b898800 | [
"Apache-2.0"
] | null | null | null | 22.458333 | 66 | 0.734694 | 7,329 | package br.com.zup.casa_do_codigo.controllers.validation;
import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.*;
@Documented
@Constraint(validatedBy = {ExistingIdValidator.class})
@Target({ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
public @interface ExistingId {
String message() default "O id informado não foi encontrado!";
Class<?>[] groups() default {};
Class<? extends Payload>[] payload() default {};
String fieldName();
Class<?> domainClass();
}
|
3e115e87c9ea5ae3c036f989a7601bd1b3627913 | 2,654 | java | Java | bundles/specmate-connectors-api/src/com/specmate/connectors/api/IProjectConfigService.java | Qualicen/Specmate | 7a4411d14c6c7d4c9127eb64690c33121ac47a39 | [
"Apache-2.0"
] | 7 | 2019-10-17T10:53:40.000Z | 2022-03-02T12:43:30.000Z | bundles/specmate-connectors-api/src/com/specmate/connectors/api/IProjectConfigService.java | Qualicen/Specmate | 7a4411d14c6c7d4c9127eb64690c33121ac47a39 | [
"Apache-2.0"
] | 180 | 2019-09-30T11:23:47.000Z | 2022-03-03T18:38:32.000Z | bundles/specmate-connectors-api/src/com/specmate/connectors/api/IProjectConfigService.java | Qualicen/Specmate | 7a4411d14c6c7d4c9127eb64690c33121ac47a39 | [
"Apache-2.0"
] | 11 | 2019-12-07T12:46:38.000Z | 2021-02-08T14:11:45.000Z | 39.61194 | 114 | 0.77468 | 7,330 | package com.specmate.connectors.api;
import com.specmate.common.exception.SpecmateException;
public interface IProjectConfigService {
/** The prefix for project configuration keys */
public static final String PROJECT_PREFIX = "project.";
/** The prefix for multiproject configuration keys */
public static final String MULTIPROJECT_PREFIX = "multiproject.";
/** The PID of the project config factory */
public static final String PROJECT_CONFIG_FACTORY_PID = "com.specmate.connectors.projectconfigfactory";
/** The PID of the multi project config factory */
public static final String MULTIPROJECT_CONFIG_FACTORY_PID = "com.specmate.connectors.multiprojectconfigfactory";
/** The configuration key for the id of a connector */
public static final String KEY_CONNECTOR_ID = "connectorID";
/** The configuration key for the id of an exporter */
public static final String KEY_EXPORTER_ID = "exporterID";
/** the configuration key for the id of a project */
public static final String KEY_PROJECT_ID = "projectID";
/** the configuration key for the library folders of a project */
public static final String KEY_PROJECT_LIBRARY_FOLDERS = "libraryFolders";
/** The configuration key for the list of projects. */
public static final String KEY_PROJECT_IDS = PROJECT_PREFIX + "projects";
/** The configuration key for the list of multiprojects. */
public static final String KEY_MULTIPROJECT_IDS = MULTIPROJECT_PREFIX + "multiprojects";
/** The prefix for multiproject configuration keys */
public static final String KEY_MULTIPROJECT_PROJECTNAMEPATTERN = "projectnamepattern";
/** The key for max number of projects **/
public static final String KEY_MULTIPROJECT_MAXNUMBEROFPROJECTS = "maxprojects";
/** The prefix for multiproject configuration keys */
public static final String KEY_MULTIPROJECT_TEMPLATE= "template";
/** The configuration key for the list of top-level library folder ids. */
public static final String KEY_PROJECT_LIBRARY = ".library";
/** The configuration key for the library name */
public static final String KEY_PROJECT_LIBRARY_NAME = ".name";
/** The configuration key for the library description */
public static final String KEY_PROJECT_LIBRARY_DESCRIPTION = ".description";
/**
* Configures the given projects based on the configuration data from the
* configuration service.
*/
public void configureProjects(String[] projectIDs) throws SpecmateException;
/**
* Configures the given multiprojects based on the configuration data from the
* configuration service.
*/
public void configureMultiProjects(String[] multiProjectIDs) throws SpecmateException;
}
|
3e115ea7a0b5896c810ab7f2acdf973f509566c4 | 1,843 | java | Java | Application/src/main/java/com/example/android/wearable/geofencing/GeofenceReceiver.java | nijandhan/Attendance-Registration-System | 4ab92e874fb656fef1a0d9d4203034fdde02cba1 | [
"Apache-2.0"
] | null | null | null | Application/src/main/java/com/example/android/wearable/geofencing/GeofenceReceiver.java | nijandhan/Attendance-Registration-System | 4ab92e874fb656fef1a0d9d4203034fdde02cba1 | [
"Apache-2.0"
] | null | null | null | Application/src/main/java/com/example/android/wearable/geofencing/GeofenceReceiver.java | nijandhan/Attendance-Registration-System | 4ab92e874fb656fef1a0d9d4203034fdde02cba1 | [
"Apache-2.0"
] | null | null | null | 44.95122 | 114 | 0.646772 | 7,331 | package com.example.android.wearable.geofencing;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.support.v4.content.LocalBroadcastManager;
import android.util.Log;
import com.google.android.gms.location.Geofence;
import com.google.android.gms.location.GeofencingEvent;
public class GeofenceReceiver extends BroadcastReceiver {
Context context;
@Override
public void onReceive(Context context, Intent intent) {
this.context = context;
GeofencingEvent geoFenceEvent = GeofencingEvent.fromIntent(intent);
if (geoFenceEvent.hasError()) {
int errorCode = geoFenceEvent.getErrorCode();
//showToast(MainActivity.this, "Location Services error: " + errorCode);
//Log.e(TAG, "Location Services error: " + errorCode);
} else {
int transitionType = geoFenceEvent.getGeofenceTransition();
if (Geofence.GEOFENCE_TRANSITION_ENTER == transitionType) {
//showToast(MainActivity.this, R.string.entering_geofence);
Intent loginIntent = new Intent("ACTION_LOGIN");
loginIntent.putExtra("type", "login");
LocalBroadcastManager.getInstance(context.getApplicationContext()).sendBroadcast(loginIntent);
} else if (Geofence.GEOFENCE_TRANSITION_EXIT == transitionType) {
//showToast(MainActivity.this, R.string.exiting_geofence);
Intent loginIntent = new Intent("ACTION_LOGIN");
loginIntent.putExtra("type", "logout");
LocalBroadcastManager.getInstance(context.getApplicationContext()).sendBroadcast(loginIntent);
}
}
}
} |
3e115f25f5a7022b4d94f705f0d31be57ecd5fb6 | 1,355 | java | Java | implementation/v6/src/main/java/org/codemc/worldguardwrapper/implementation/v6/flag/WrappedPrimitiveFlag.java | JOO200/WorldGuardWrapper | e8466e28e3a08ed370ab4aedd82f0235ad8574ef | [
"MIT"
] | 22 | 2018-08-02T15:39:25.000Z | 2021-09-29T21:11:50.000Z | implementation/v6/src/main/java/org/codemc/worldguardwrapper/implementation/v6/flag/WrappedPrimitiveFlag.java | JOO200/WorldGuardWrapper | e8466e28e3a08ed370ab4aedd82f0235ad8574ef | [
"MIT"
] | 44 | 2018-09-08T10:26:00.000Z | 2022-03-11T17:02:07.000Z | implementation/v6/src/main/java/org/codemc/worldguardwrapper/implementation/v6/flag/WrappedPrimitiveFlag.java | MinetopiaPanel/WorldGuardWrapper | 084274067abc7a83f7c930c70d7d872f665a5122 | [
"MIT"
] | 12 | 2019-07-26T17:11:25.000Z | 2022-03-22T10:23:47.000Z | 35.657895 | 117 | 0.711439 | 7,332 | package org.codemc.worldguardwrapper.implementation.v6.flag;
import com.sk89q.worldguard.protection.flags.Flag;
import org.bukkit.Location;
import org.bukkit.util.Vector;
import org.codemc.worldguardwrapper.implementation.v6.utility.WorldGuardFlagUtilities;
import java.util.Optional;
public class WrappedPrimitiveFlag<T> extends AbstractWrappedFlag<T> {
public WrappedPrimitiveFlag(Flag<T> handle) {
super(handle);
}
@SuppressWarnings("unchecked")
@Override
public Optional<T> fromWGValue(Object value) {
if (value instanceof com.sk89q.worldedit.util.Location) {
return Optional.of((T) WorldGuardFlagUtilities.adaptLocation((com.sk89q.worldedit.util.Location) value));
} else if (value instanceof com.sk89q.worldedit.Vector) {
return Optional.of((T) WorldGuardFlagUtilities.adaptVector((com.sk89q.worldedit.Vector) value));
}
return Optional.ofNullable((T) value);
}
@Override
public Optional<Object> fromWrapperValue(T value) {
if (value instanceof Location) {
return Optional.of(WorldGuardFlagUtilities.adaptLocation((Location) value));
} else if (value instanceof Vector) {
return Optional.of(WorldGuardFlagUtilities.adaptVector((Vector) value));
}
return Optional.ofNullable(value);
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.