blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 4
410
| content_id
stringlengths 40
40
| detected_licenses
sequencelengths 0
51
| license_type
stringclasses 2
values | repo_name
stringlengths 5
132
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
80
| visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.85k
689M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 22
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 131
values | src_encoding
stringclasses 34
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 3
9.45M
| extension
stringclasses 32
values | content
stringlengths 3
9.45M
| authors
sequencelengths 1
1
| author_id
stringlengths 0
313
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
02f01e0ff5325877722cc748db9b0db215c21345 | 643ab004f98842a83cf1999ed30dd7df7a4ada60 | /sparke-module-order/src/main/java/cn/sparke/order/modules/v1/order/mapper/EvaluateMapper.java | a980029f72d443b4a40e4c6f40c1842af01b91b1 | [] | no_license | JohnVeZh/spark-english-api-release-1.0.x | 162130b1cedd90e09318077dc98a587fd03bccf3 | f1659ffa072e6a79baa62b7636cbe1a17631ed26 | refs/heads/master | 2020-03-21T07:16:09.505836 | 2018-06-22T07:44:45 | 2018-06-22T07:44:45 | 138,270,184 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 889 | java | package cn.sparke.order.modules.v1.order.mapper;
import cn.sparke.core.common.mybatis.base.BaseMapper;
import cn.sparke.order.modules.v1.order.entity.EvaluateEntity;
import cn.sparke.order.modules.v1.order.entity.OrderDetailsEntity;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* Created by zhangbowen on 2017/7/14.
*/
public interface EvaluateMapper extends BaseMapper<EvaluateEntity> {
List<Integer> findScoreByProduct(String productId);
void updateProductScore(@Param("productId") String productId, @Param("productScore") int productScore);
/**
* 根据用户获取订单详情
*
* @param userId
* @param orderDetailId
* @return
*/
OrderDetailsEntity getOrderDetailByUser(@Param("userId") String userId, @Param("orderDetailId") String orderDetailId);
List<String> findNotCommentList(String orderId);
}
| [
"[email protected]"
] | |
9c0123b28cee66d589ec174764f1fc7456ca5363 | ebc9c468653d0bc443747d03789857f454885c22 | /web/src/main/java/com/example/project/web/config/MvcConfig.java | d035e6d40859a98480cf986dfb0718e133eb79e7 | [] | no_license | Levon91/multimodule-template | 6b5c76c921a48c6ca63f18df587285163da3832d | 7ac67eb3dbf8da9cf2f0a14b6bc576987801e34c | refs/heads/master | 2021-01-12T12:06:54.691699 | 2016-10-28T21:26:37 | 2016-10-28T21:26:37 | 72,305,306 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,548 | java | package com.example.project.web.config;
import org.springframework.boot.context.embedded.EmbeddedServletContainerCustomizer;
import org.springframework.boot.context.embedded.ErrorPage;
import org.springframework.context.MessageSource;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.support.ReloadableResourceBundleMessageSource;
import org.springframework.http.HttpStatus;
import org.springframework.validation.Validator;
import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean;
import org.springframework.web.servlet.LocaleResolver;
import org.springframework.web.servlet.config.annotation.*;
import org.springframework.web.servlet.i18n.CookieLocaleResolver;
import org.springframework.web.servlet.i18n.LocaleChangeInterceptor;
@Configuration
@EnableWebMvc
@ComponentScan
public class MvcConfig extends WebMvcConfigurerAdapter {
/**
* Provides own message source
*/
@Bean
public MessageSource messageSource() {
ReloadableResourceBundleMessageSource messageSource =
new ReloadableResourceBundleMessageSource();
messageSource.setBasename("classpath:messages");
messageSource.setDefaultEncoding("UTF-8");
return messageSource;
}
/**
* Passing out message source to validators
*/
@Override
public Validator getValidator() {
LocalValidatorFactoryBean factory = new LocalValidatorFactoryBean();
factory.setValidationMessageSource(messageSource());
return factory;
}
/**
* Sets cookie as a locale resolver
*/
@Bean
public LocaleResolver localeResolver() {
return new CookieLocaleResolver();
}
/**
* Adding resource paths
*/
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/**")
.addResourceLocations(
"classpath:/META-INF/resources/",
"classpath:/resources/",
"classpath:/static/",
"classpath:/public/"
);
}
/**
* Adding static view/controller
*/
@Override
public void addViewControllers(ViewControllerRegistry registry) {
registry.addViewController("/").setViewName("index");
}
/**
* Adding custom interceptors
*/
@Override
public void addInterceptors(InterceptorRegistry registry) {
// adds the interceptor which manages switching locale
LocaleChangeInterceptor localeInterceptor = new LocaleChangeInterceptor();
localeInterceptor.setParamName("lang");
registry.addInterceptor(localeInterceptor);
// registry.addInterceptor(new LoggingInterceptor()).addPathPatterns("/404");
// registry.addInterceptor(new AdminRequiredInterceptor());
}
/**
* Forwards the request to appropriate controller in case of errors
*/
@Bean
public EmbeddedServletContainerCustomizer containerCustomizer() {
return container -> {
container.addErrorPages(new ErrorPage("/500"));
container.addErrorPages(new ErrorPage(HttpStatus.NOT_FOUND, "/404"));
container.addErrorPages(new ErrorPage(HttpStatus.FORBIDDEN, "/403"));
container.addErrorPages(new ErrorPage(HttpStatus.INTERNAL_SERVER_ERROR, "/500"));
};
}
}
| [
"[email protected]"
] | |
c5d8a455e27f0831f01c114bdf06d804cc0644b8 | 3771383f76b1c9c6a7555b739778a7153363708e | /src/main/java/one/digitalinnovation/experts/shoppingcart/config/RedisConfig.java | e24fe109f6bb03e539e281d2246f235b65da745c | [] | no_license | edvitor13/digitalinnovation-projeto3 | b9e73cb91c6c9b1ae6995c549e214cbf9ccaa5e0 | d29d0cf8840f6d9dcdbd3d82ad8d630ea57817df | refs/heads/main | 2023-08-18T09:48:43.289045 | 2021-09-07T00:26:26 | 2021-09-07T00:26:26 | 403,751,041 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 958 | java | package one.digitalinnovation.experts.shoppingcart.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.jedis.JedisConnectionFactory;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.repository.configuration.EnableRedisRepositories;
@Configuration
@EnableRedisRepositories
public class RedisConfig {
JedisConnectionFactory jedisConnectionFactory() {
JedisConnectionFactory jedisConFactory = new JedisConnectionFactory();
jedisConFactory.setHostName("localhost");
jedisConFactory.setPort(6379);
return jedisConFactory;
}
public RedisTemplate<String, Object> redisTemplate() {
RedisTemplate<String, Object> template = new RedisTemplate<>();
template.setConnectionFactory(jedisConnectionFactory());
return template;
}
} | [
"[email protected]"
] | |
143baa4600b9858bc1dc4328e2f518204d18dada | 507ae57b0939494c4529d9655fdb45e7ccbeeb8e | /src/main/java/com/wwq/juc01/SemaphoreDemo.java | 40e9dca799716a3a7452e5a91a8d93bed78a9c5e | [] | no_license | yeqqmatlab/JUC | 4ae419fa88990acdad638167568f9bef872ffd0e | 85f80c7591b9bc2878b43adf3e34ca7c5c7686b6 | refs/heads/master | 2022-11-13T07:35:23.182953 | 2020-07-07T08:53:31 | 2020-07-07T08:53:31 | 277,512,048 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 826 | java | package com.wwq.juc01;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.Semaphore;
import java.util.concurrent.TimeUnit;
/**
* @Auther: wwq
* @Date: 2020/6/28 12:04
* @Description:
*/
public class SemaphoreDemo {
static Semaphore semaphore = new Semaphore(2, true);
public static void main(String[] args) {
for (int i= 0; i< 10; i++){
new Thread(()->{
try {
semaphore.acquire();
System.out.println("线程:"+Thread.currentThread().getName());
TimeUnit.SECONDS.sleep(10);
semaphore.release();
} catch (InterruptedException e) {
e.printStackTrace();
}
}).start();
}
while (true);
}
}
| [
"[email protected]"
] | |
12aadf1c9cfb64b535e3d08f865289a1ef41e6bd | ad7b40175c319e0692e9c5a21084e073d3516082 | /src/se/kth/id2212/hangman/androidClient/ConnectActivity.java | 5e61218387e156a7c343096d16abd39bcd847ce3 | [] | no_license | klajmajk/androidHangmanClient | c5b63d7c69cb3725d70ffe59d688cc77d1d3be0b | 9ae2dfcb5dcf153e3c025240a5dd095fe54311cf | refs/heads/master | 2020-04-02T08:20:30.857657 | 2013-12-13T15:34:16 | 2013-12-13T15:34:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,659 | java | package se.kth.id2212.hangman.androidClient;
import java.util.concurrent.ExecutionException;
import se.kth.id2212.hangman.androidClient.client.Controller;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.annotation.TargetApi;
import android.app.Activity;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Log;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.View;
import android.view.inputmethod.EditorInfo;
import android.widget.EditText;
import android.widget.TextView;
/**
* Activity which displays a login screen to the user, offering registration as
* well.
*/
public class ConnectActivity extends Activity {
/**
* Keep track of the login task to ensure we can cancel it if requested.
*/
private ConnectTask mAuthTask = null;
// Values for email and password at the time of the login attempt.
private String mIp;
private String mPort;
// UI references.
private EditText mIpView;
private EditText mPortView;
private View mLoginFormView;
private View mLoginStatusView;
private TextView mLoginStatusMessageView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_connect);
// Set up the login form.
mIp = "";
mIpView = (EditText) findViewById(R.id.ip);
mIpView.setText(mIp);
mIpView.setText("192.168.100.101");
mPortView = (EditText) findViewById(R.id.port);
mPortView.setText("5555");
mPortView
.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView textView, int id,
KeyEvent keyEvent) {
if (id == R.id.login || id == EditorInfo.IME_NULL) {
attemptLogin();
return true;
}
return false;
}
});
mLoginFormView = findViewById(R.id.login_form);
mLoginStatusView = findViewById(R.id.login_status);
mLoginStatusMessageView = (TextView) findViewById(R.id.login_status_message);
findViewById(R.id.sign_in_button).setOnClickListener(
new View.OnClickListener() {
@Override
public void onClick(View view) {
attemptLogin();
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
super.onCreateOptionsMenu(menu);
getMenuInflater().inflate(R.menu.connect, menu);
return true;
}
/**
* Attempts to sign in or register the account specified by the login form.
* If there are form errors (invalid email, missing fields, etc.), the
* errors are presented and no actual login attempt is made.
*/
public void attemptLogin() {
if (mAuthTask != null) {
return;
}
// Reset errors.
mIpView.setError(null);
mPortView.setError(null);
// Store values at the time of the login attempt.
mIp = mIpView.getText().toString();
mPort = mPortView.getText().toString();
boolean cancel = false;
View focusView = null;
// Check for a valid port
if (TextUtils.isEmpty(mPort)) {
mPortView.setError(getString(R.string.error_field_required));
focusView = mPortView;
cancel = true;
}
if (TextUtils.isEmpty(mIp)) {
mIpView.setError(getString(R.string.error_field_required));
focusView = mPortView;
cancel = true;
}
if (cancel) {
// There was an error; don't attempt login and focus the first
// form field with an error.
focusView.requestFocus();
} else {
// Show a progress spinner, and kick off a background task to
// perform the user login attempt.
mLoginStatusMessageView.setText(R.string.login_progress_signing_in);
showProgress(true);
mAuthTask = new ConnectTask();
mAuthTask.execute((Void) null);
try {
if(mAuthTask.get()){
Intent connectIntent = new Intent(ConnectActivity.this, GameActivity.class);
startActivity(connectIntent);
}
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ExecutionException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
/**
* Shows the progress UI and hides the login form.
*/
@TargetApi(Build.VERSION_CODES.HONEYCOMB_MR2)
private void showProgress(final boolean show) {
// On Honeycomb MR2 we have the ViewPropertyAnimator APIs, which allow
// for very easy animations. If available, use these APIs to fade-in
// the progress spinner.
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) {
int shortAnimTime = getResources().getInteger(
android.R.integer.config_shortAnimTime);
mLoginStatusView.setVisibility(View.VISIBLE);
mLoginStatusView.animate().setDuration(shortAnimTime)
.alpha(show ? 1 : 0)
.setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
mLoginStatusView.setVisibility(show ? View.VISIBLE
: View.GONE);
}
});
mLoginFormView.setVisibility(View.VISIBLE);
mLoginFormView.animate().setDuration(shortAnimTime)
.alpha(show ? 0 : 1)
.setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
mLoginFormView.setVisibility(show ? View.GONE
: View.VISIBLE);
}
});
} else {
// The ViewPropertyAnimator APIs are not available, so simply show
// and hide the relevant UI components.
mLoginStatusView.setVisibility(show ? View.VISIBLE : View.GONE);
mLoginFormView.setVisibility(show ? View.GONE : View.VISIBLE);
}
}
/**
* Represents an asynchronous login/registration task used to authenticate
* the user.
*/
public class ConnectTask extends AsyncTask<Void, Void, Boolean> {
String tag = "Connect task";
@Override
protected Boolean doInBackground(Void... params) {
Log.i(tag, "before connect");
boolean toReturn = Controller.getInstance().connect(mIp, Integer.parseInt(mPort));
Log.i(tag, "after connect:"+toReturn);
return toReturn;
}
@Override
protected void onPostExecute(final Boolean success) {
mAuthTask = null;
showProgress(false);
if (success) {
finish();
} else {
mPortView
.setError(getString(R.string.error_incorrect_password));
mPortView.requestFocus();
}
}
@Override
protected void onCancelled() {
mAuthTask = null;
showProgress(false);
}
}
}
| [
"[email protected]"
] | |
a5ad7017633a0e2003099649ab4c3fec120d4177 | 44e7adc9a1c5c0a1116097ac99c2a51692d4c986 | /aws-java-sdk-cloudfront/src/main/java/com/amazonaws/services/cloudfront/model/UpdateCachePolicyRequest.java | 03e047f6fff88e9c356481aeb3fd0d5a7140ad10 | [
"Apache-2.0"
] | permissive | QiAnXinCodeSafe/aws-sdk-java | f93bc97c289984e41527ae5bba97bebd6554ddbe | 8251e0a3d910da4f63f1b102b171a3abf212099e | refs/heads/master | 2023-01-28T14:28:05.239019 | 2020-12-03T22:09:01 | 2020-12-03T22:09:01 | 318,460,751 | 1 | 0 | Apache-2.0 | 2020-12-04T10:06:51 | 2020-12-04T09:05:03 | null | UTF-8 | Java | false | false | 8,701 | java | /*
* Copyright 2015-2020 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.cloudfront.model;
import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.AmazonWebServiceRequest;
/**
*
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/cloudfront-2020-05-31/UpdateCachePolicy" target="_top">AWS API
* Documentation</a>
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class UpdateCachePolicyRequest extends com.amazonaws.AmazonWebServiceRequest implements Serializable, Cloneable {
/**
* <p>
* A cache policy configuration.
* </p>
*/
private CachePolicyConfig cachePolicyConfig;
/**
* <p>
* The unique identifier for the cache policy that you are updating. The identifier is returned in a cache
* behavior’s <code>CachePolicyId</code> field in the response to <code>GetDistributionConfig</code>.
* </p>
*/
private String id;
/**
* <p>
* The version of the cache policy that you are updating. The version is returned in the cache policy’s
* <code>ETag</code> field in the response to <code>GetCachePolicyConfig</code>.
* </p>
*/
private String ifMatch;
/**
* <p>
* A cache policy configuration.
* </p>
*
* @param cachePolicyConfig
* A cache policy configuration.
*/
public void setCachePolicyConfig(CachePolicyConfig cachePolicyConfig) {
this.cachePolicyConfig = cachePolicyConfig;
}
/**
* <p>
* A cache policy configuration.
* </p>
*
* @return A cache policy configuration.
*/
public CachePolicyConfig getCachePolicyConfig() {
return this.cachePolicyConfig;
}
/**
* <p>
* A cache policy configuration.
* </p>
*
* @param cachePolicyConfig
* A cache policy configuration.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public UpdateCachePolicyRequest withCachePolicyConfig(CachePolicyConfig cachePolicyConfig) {
setCachePolicyConfig(cachePolicyConfig);
return this;
}
/**
* <p>
* The unique identifier for the cache policy that you are updating. The identifier is returned in a cache
* behavior’s <code>CachePolicyId</code> field in the response to <code>GetDistributionConfig</code>.
* </p>
*
* @param id
* The unique identifier for the cache policy that you are updating. The identifier is returned in a cache
* behavior’s <code>CachePolicyId</code> field in the response to <code>GetDistributionConfig</code>.
*/
public void setId(String id) {
this.id = id;
}
/**
* <p>
* The unique identifier for the cache policy that you are updating. The identifier is returned in a cache
* behavior’s <code>CachePolicyId</code> field in the response to <code>GetDistributionConfig</code>.
* </p>
*
* @return The unique identifier for the cache policy that you are updating. The identifier is returned in a cache
* behavior’s <code>CachePolicyId</code> field in the response to <code>GetDistributionConfig</code>.
*/
public String getId() {
return this.id;
}
/**
* <p>
* The unique identifier for the cache policy that you are updating. The identifier is returned in a cache
* behavior’s <code>CachePolicyId</code> field in the response to <code>GetDistributionConfig</code>.
* </p>
*
* @param id
* The unique identifier for the cache policy that you are updating. The identifier is returned in a cache
* behavior’s <code>CachePolicyId</code> field in the response to <code>GetDistributionConfig</code>.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public UpdateCachePolicyRequest withId(String id) {
setId(id);
return this;
}
/**
* <p>
* The version of the cache policy that you are updating. The version is returned in the cache policy’s
* <code>ETag</code> field in the response to <code>GetCachePolicyConfig</code>.
* </p>
*
* @param ifMatch
* The version of the cache policy that you are updating. The version is returned in the cache policy’s
* <code>ETag</code> field in the response to <code>GetCachePolicyConfig</code>.
*/
public void setIfMatch(String ifMatch) {
this.ifMatch = ifMatch;
}
/**
* <p>
* The version of the cache policy that you are updating. The version is returned in the cache policy’s
* <code>ETag</code> field in the response to <code>GetCachePolicyConfig</code>.
* </p>
*
* @return The version of the cache policy that you are updating. The version is returned in the cache policy’s
* <code>ETag</code> field in the response to <code>GetCachePolicyConfig</code>.
*/
public String getIfMatch() {
return this.ifMatch;
}
/**
* <p>
* The version of the cache policy that you are updating. The version is returned in the cache policy’s
* <code>ETag</code> field in the response to <code>GetCachePolicyConfig</code>.
* </p>
*
* @param ifMatch
* The version of the cache policy that you are updating. The version is returned in the cache policy’s
* <code>ETag</code> field in the response to <code>GetCachePolicyConfig</code>.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public UpdateCachePolicyRequest withIfMatch(String ifMatch) {
setIfMatch(ifMatch);
return this;
}
/**
* Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
* redacted from this string using a placeholder value.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getCachePolicyConfig() != null)
sb.append("CachePolicyConfig: ").append(getCachePolicyConfig()).append(",");
if (getId() != null)
sb.append("Id: ").append(getId()).append(",");
if (getIfMatch() != null)
sb.append("IfMatch: ").append(getIfMatch());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof UpdateCachePolicyRequest == false)
return false;
UpdateCachePolicyRequest other = (UpdateCachePolicyRequest) obj;
if (other.getCachePolicyConfig() == null ^ this.getCachePolicyConfig() == null)
return false;
if (other.getCachePolicyConfig() != null && other.getCachePolicyConfig().equals(this.getCachePolicyConfig()) == false)
return false;
if (other.getId() == null ^ this.getId() == null)
return false;
if (other.getId() != null && other.getId().equals(this.getId()) == false)
return false;
if (other.getIfMatch() == null ^ this.getIfMatch() == null)
return false;
if (other.getIfMatch() != null && other.getIfMatch().equals(this.getIfMatch()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getCachePolicyConfig() == null) ? 0 : getCachePolicyConfig().hashCode());
hashCode = prime * hashCode + ((getId() == null) ? 0 : getId().hashCode());
hashCode = prime * hashCode + ((getIfMatch() == null) ? 0 : getIfMatch().hashCode());
return hashCode;
}
@Override
public UpdateCachePolicyRequest clone() {
return (UpdateCachePolicyRequest) super.clone();
}
}
| [
""
] | |
d3bff2fca68e01adfd89fc74fc3c6f57def22f2a | 34f8d4ba30242a7045c689768c3472b7af80909c | /JDK-18.0.2.1/src/jdk.localedata/sun/text/resources/cldr/ext/FormatData_en_FK.java | b0ded09621fe619b958ff1c56d910c6f979b6157 | [
"Apache-2.0"
] | permissive | lovelycheng/JDK | 5b4cc07546f0dbfad15c46d427cae06ef282ef79 | 19a6c71e52f3ecd74e4a66be5d0d552ce7175531 | refs/heads/master | 2023-04-08T11:36:22.073953 | 2022-09-04T01:53:09 | 2022-09-04T01:53:09 | 227,544,567 | 0 | 0 | null | 2019-12-12T07:18:30 | 2019-12-12T07:18:29 | null | UTF-8 | Java | false | false | 3,847 | java | /*
* Copyright (c) 2012, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* COPYRIGHT AND PERMISSION NOTICE
*
* Copyright (c) 1991-2020 Unicode, Inc. All rights reserved.
* Distributed under the Terms of Use in https://www.unicode.org/copyright.html.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of the Unicode data files and any associated documentation
* (the "Data Files") or Unicode software and any associated documentation
* (the "Software") to deal in the Data Files or Software
* without restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, and/or sell copies of
* the Data Files or Software, and to permit persons to whom the Data Files
* or Software are furnished to do so, provided that either
* (a) this copyright and permission notice appear with all copies
* of the Data Files or Software, or
* (b) this copyright and permission notice appear in associated
* Documentation.
*
* THE DATA FILES AND SOFTWARE ARE 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 OF THIRD PARTY RIGHTS.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS
* NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL
* DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THE DATA FILES OR SOFTWARE.
*
* Except as contained in this notice, the name of a copyright holder
* shall not be used in advertising or otherwise to promote the sale,
* use or other dealings in these Data Files or Software without prior
* written authorization of the copyright holder.
*/
package sun.text.resources.cldr.ext;
import java.util.ListResourceBundle;
public class FormatData_en_FK extends ListResourceBundle {
@Override
protected final Object[][] getContents() {
final String[] metaValue_TimePatterns = new String[] {
"HH:mm:ss zzzz",
"HH:mm:ss z",
"HH:mm:ss",
"HH:mm",
};
final Object[][] data = new Object[][] {
{ "buddhist.TimePatterns", metaValue_TimePatterns },
{ "japanese.TimePatterns", metaValue_TimePatterns },
{ "roc.TimePatterns", metaValue_TimePatterns },
{ "TimePatterns", metaValue_TimePatterns },
{ "islamic.TimePatterns", metaValue_TimePatterns },
};
return data;
}
}
| [
"[email protected]"
] | |
be5fc4509b6b0e32f44b64b88a65aad55476a2ea | dc1dbb7e5a4b95bf44170d2f51fd08b3814f2ac9 | /data_defect4j/preprossed_method_corpus/Time/24/org/joda/time/format/DateTimeFormatter_printTo_468.java | f272bc538e6a671e48446e48e24872d169d17e6b | [] | no_license | hvdthong/NetML | dca6cf4d34c5799b400d718e0a6cd2e0b167297d | 9bb103da21327912e5a29cbf9be9ff4d058731a5 | refs/heads/master | 2021-06-30T15:03:52.618255 | 2020-10-07T01:58:48 | 2020-10-07T01:58:48 | 150,383,588 | 1 | 1 | null | 2018-09-26T07:08:45 | 2018-09-26T07:08:44 | null | UTF-8 | Java | false | false | 2,620 | java |
org joda time format
control print pars datetim string
main api print pars applic
instanc creat factori class
link date time format datetimeformat format pattern style
link iso date time format isodatetimeformat iso8601 format
link date time formatt builder datetimeformatterbuild complex format creat method call
instanc hold refer intern printer
parser
formatt print pars check link printer isprint
link parser ispars method
underli printer parser alter behav requir
decor modifi
link local withlocal local return formatt local
link zone withzon date time zone datetimezon return formatt time zone
link chronolog withchronolog chronolog return formatt chronolog
link offset pars withoffsetpars return formatt return pars time zone offset
return formatt instanc immut
main method code print xxx printxxx code
code pars xxx parsexxx code method
pre
print default local chronolog zone datetim
string date str datestr formatt print
print french local
string date str datestr formatt local withlocal local french print
print utc zone
string date str datestr formatt zone withzon date time zone datetimezon utc print
pars pari zone
date time datetim date formatt zone withzon date time zone datetimezon forid europ pari pars date time parsedatetim str
pre
author brian neill o'neil
author stephen colebourn
author fredrik borgh
date time formatt datetimeformatt
print readabl instant readableinst chronolog suppli instant
param destin format
param instant instant format mean
print printto writer readabl instant readableinst instant except ioexcept
milli date time util datetimeutil instant milli getinstantmilli instant
chronolog chrono date time util datetimeutil instant chronolog getinstantchronolog instant
print printto milli chrono
| [
"[email protected]"
] | |
9074928abca05a880c13f7f77e86844ecc821e7f | b86ce1ea01053bd38a73c2c1474d97a47ff402fa | /src/main/java/com/github/rerorero/oleoleflake/field/BitSetField.java | ac7b6e81999957f9c5f3470e0ac9f2164491cbc9 | [
"MIT"
] | permissive | coolboy0961/oleoleflake | 6dc39da7dc05133e09ea51e27a3d8073dda62682 | d94d0bdf9f37e82d9aba8a9c1a38ccd41f98ae73 | refs/heads/master | 2020-03-11T23:55:54.031938 | 2018-07-08T11:57:51 | 2018-07-08T11:57:51 | 130,335,880 | 1 | 0 | MIT | 2018-04-20T08:49:16 | 2018-04-20T08:49:16 | null | UTF-8 | Java | false | false | 3,354 | java | package com.github.rerorero.oleoleflake.field;
import com.github.rerorero.oleoleflake.bitset.BitSetCodec;
import com.github.rerorero.oleoleflake.bitset.BitSetUtil;
import java.util.BitSet;
import java.util.Comparator;
public abstract class BitSetField<Entire, Field> extends FieldBase implements IBitSetField<Entire, Field> {
protected final int max;
protected final BitSetCodec<Entire> entireCodec;
protected final BitSetCodec<Field> fieldCodec;
protected final String detail;
protected final boolean invert;
protected final BitSet mask;
private final int bsStart;
public BitSetField(int start, int size, int entireSize, BitSetCodec<Entire> entireCodec, BitSetCodec<Field> fieldCodec, boolean invert) {
super(start,size,entireSize);
this.bsStart = entireSize - start - size;
this.entireCodec = entireCodec;
this.fieldCodec = fieldCodec;
this.invert = invert;
BitSet _mask = new BitSet(this.entireSize);
for (int i = 0; i < size; i++) {
_mask.set(entireSize - (start + i) - 1, true);
}
this.mask = _mask;
this.max = 2 ^ size;
detail = new StringBuilder()
.append(this.getClass().getSimpleName())
.append("(")
.append("start=" + start)
.append(",size=" + size)
.append(",bsStart=" + bsStart)
.append(",invert=" + invert)
.append(",entireSizes=" + entireSize)
.append(",Entire=" + entireCodec.getClass().getSimpleName())
.append(",Field=" + fieldCodec.getClass().getSimpleName())
.append(")")
.toString();
}
@Override
public String toString() {
return detail;
}
private BitSet invertIfRequired(BitSet bs) {
if (invert)
bs.flip(0, size);
return bs;
}
public Field getField(Entire entire) {
BitSet entireBs = entireCodec.toBitSet(entire);
BitSet field = getFieldAsBit(entireBs);
return fieldCodec.toValue(field);
}
protected BitSet getFieldAsBit(BitSet entire) {
entire.and(mask);
return invertIfRequired(BitSetUtil.shiftRight(entire, bsStart));
}
public Entire putField(Entire entire, Field value) {
BitSet entireBs = entireCodec.toBitSet(entire);
BitSet bs = fieldCodec.toBitSet(value);
putFieldAsBit(entireBs, invertIfRequired(bs));
return entireCodec.toValue(entireBs);
}
protected void putFieldAsBit(BitSet entire, BitSet value) {
BitSet shifted = BitSetUtil.shiftLeft(value, entireSize - size - start);
shifted.and(mask);
putZeroIntoField(entire);
entire.or(shifted);
}
protected void putZeroIntoField(BitSet entire) {
entire.set(bsStart, bsStart + size, false);
}
@Override
public Field zero() {
return fieldCodec.toValue(new BitSet());
}
@Override
public Field full() {
BitSet fullBitset = new BitSet();
fullBitset.set(0, size, true);
return fieldCodec.toValue(fullBitset);
}
@Override
public Comparator<Field> fieldComparator() {
return fieldCodec.comparator();
}
@Override
public Comparator<Entire> entireComparator() {
return entireCodec.comparator();
}
}
| [
"[email protected]"
] | |
b82bf7491698514e0f68f0df81c51ad5fecc4151 | 034c27b111a6fa06ac537c0d650c739088f21ba9 | /src/main/java/com/nostratech/project/controller/AbstractRequestPageHandler.java | add04729357de33ad587e94b7391c5cb73bc6167 | [] | no_license | Anindya12/BankingSystem | 45bfcc14ffc11f58755d314608c27a66846dc756 | fbbb6310e4fb4e945d89d9f2c9e81b00366450a2 | refs/heads/master | 2020-03-27T22:45:34.532900 | 2018-09-04T09:20:40 | 2018-09-04T09:20:40 | 147,257,723 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 968 | java | package com.nostratech.project.controller;
import com.nostratech.project.exception.NostraException;
import com.nostratech.project.persistence.vo.ResultPageVO;
import com.nostratech.project.util.RestUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.ResponseEntity;
/**
* Created by yukibuwana on 1/24/17.
*/
public abstract class AbstractRequestPageHandler {
private static final Logger log = LoggerFactory.getLogger(AbstractRequestPageHandler.class);
public ResponseEntity<ResultPageVO> getResult() {
ResultPageVO result = new ResultPageVO();
try {
return processRequest();
} catch (NostraException e) {
result.setMessage(e.getCode().name());
result.setResult(e.getMessage());
log.error("ERROR", e);
}
return RestUtil.getJsonResponse(result);
}
public abstract ResponseEntity<ResultPageVO> processRequest();
}
| [
"[email protected]"
] | |
c268535f3bfe23915b7eed00a114e7fe6790a475 | 83d56024094d15f64e07650dd2b606a38d7ec5f1 | /sicc_druida/fuentes/java/CccTipoErrorConectorQueryForm.java | eee9cf892f8838b53e9fa0015223d99cbe61eb34 | [] | no_license | cdiglesias/SICC | bdeba6af8f49e8d038ef30b61fcc6371c1083840 | 72fedb14a03cb4a77f62885bec3226dbbed6a5bb | refs/heads/master | 2021-01-19T19:45:14.788800 | 2016-04-07T16:20:51 | 2016-04-07T16:20:51 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,693 | java |
import org.w3c.dom.*;
import java.util.ArrayList;
public class CccTipoErrorConectorQueryForm implements es.indra.druida.base.ObjetoXML {
private ArrayList v = new ArrayList();
public Element getXML (Document doc){
getXML0(doc);
return (Element)v.get(0);
}
/* Primer nodo */
private void getXML0(Document doc) {
v.add(doc.createElement("CONECTOR"));
((Element)v.get(0)).setAttribute("TIPO","EJB" );
((Element)v.get(0)).setAttribute("NOMBRE","mare.mln.BusinessFacade" );
((Element)v.get(0)).setAttribute("METODO","execute" );
((Element)v.get(0)).setAttribute("REVISION","3.1" );
((Element)v.get(0)).setAttribute("OBSERVACIONES","Conector para la consulta sobre la entidad CccTipoError" );
/* Empieza nodo:1 / Elemento padre: 0 */
v.add(doc.createElement("ENTRADA"));
((Element)v.get(0)).appendChild((Element)v.get(1));
/* Empieza nodo:2 / Elemento padre: 1 */
v.add(doc.createElement("CAMPO"));
((Element)v.get(2)).setAttribute("NOMBRE","MMGCccTipoErrorQueryID" );
((Element)v.get(2)).setAttribute("TIPO","OBJETO" );
((Element)v.get(2)).setAttribute("LONGITUD","50" );
((Element)v.get(1)).appendChild((Element)v.get(2));
/* Termina nodo:2 */
/* Empieza nodo:3 / Elemento padre: 1 */
v.add(doc.createElement("CAMPO"));
((Element)v.get(3)).setAttribute("NOMBRE","MMGCccTipoErrorQueryDTO" );
((Element)v.get(3)).setAttribute("TIPO","OBJETO" );
((Element)v.get(3)).setAttribute("LONGITUD","50" );
((Element)v.get(1)).appendChild((Element)v.get(3));
/* Termina nodo:3 */
/* Termina nodo:1 */
/* Empieza nodo:4 / Elemento padre: 0 */
v.add(doc.createElement("SALIDA"));
((Element)v.get(0)).appendChild((Element)v.get(4));
/* Empieza nodo:5 / Elemento padre: 4 */
v.add(doc.createElement("ROWSET"));
((Element)v.get(5)).setAttribute("NOMBRE","result" );
((Element)v.get(5)).setAttribute("FORMATO","CccTipoErrorFormFormatter" );
((Element)v.get(5)).setAttribute("LONGITUD","50" );
((Element)v.get(4)).appendChild((Element)v.get(5));
/* Empieza nodo:6 / Elemento padre: 5 */
v.add(doc.createElement("CAMPO"));
((Element)v.get(6)).setAttribute("NOMBRE","id" );
((Element)v.get(6)).setAttribute("TIPO","STRING" );
((Element)v.get(6)).setAttribute("LONGITUD","12" );
((Element)v.get(5)).appendChild((Element)v.get(6));
/* Termina nodo:6 */
/* Empieza nodo:7 / Elemento padre: 5 */
v.add(doc.createElement("CAMPO"));
((Element)v.get(7)).setAttribute("NOMBRE","codErro" );
((Element)v.get(7)).setAttribute("TIPO","STRING" );
((Element)v.get(7)).setAttribute("LONGITUD","2" );
((Element)v.get(5)).appendChild((Element)v.get(7));
/* Termina nodo:7 */
/* Empieza nodo:8 / Elemento padre: 5 */
v.add(doc.createElement("CAMPO"));
((Element)v.get(8)).setAttribute("NOMBRE","Descripcion" );
((Element)v.get(8)).setAttribute("TIPO","STRING" );
((Element)v.get(8)).setAttribute("LONGITUD","30" );
((Element)v.get(5)).appendChild((Element)v.get(8));
/* Termina nodo:8 */
/* Empieza nodo:9 / Elemento padre: 5 */
v.add(doc.createElement("CAMPO"));
((Element)v.get(9)).setAttribute("NOMBRE","timestamp" );
((Element)v.get(9)).setAttribute("TIPO","STRING" );
((Element)v.get(9)).setAttribute("LONGITUD","30" );
((Element)v.get(5)).appendChild((Element)v.get(9));
/* Termina nodo:9 */
/* Termina nodo:5 */
/* Termina nodo:4 */
}
}
| [
"[email protected]"
] | |
74146405650efc3b56ea25eb989d75e93e989118 | 52622427625f75385caf72b9d22dde2db34d1983 | /HTTP/Retrofit/app/src/main/java/com/example/http/Retrofit/JsonPlaceHolderApi.java | 24f9ad850b49faea2df5603af3fc8b98338be09c | [] | no_license | gunjan768/Android-Api | b44587078a589a048a6e72d0d60bca2e291727dd | 4dd9f294b2c233b92f56c8008e9ce5db5337709b | refs/heads/master | 2023-02-19T05:52:16.702955 | 2021-01-23T16:10:59 | 2021-01-23T16:10:59 | 293,891,158 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,736 | java | package com.example.http.Retrofit;
import java.util.List;
import java.util.Map;
import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.DELETE;
import retrofit2.http.Field;
import retrofit2.http.FieldMap;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.Header;
import retrofit2.http.HeaderMap;
import retrofit2.http.Headers;
import retrofit2.http.PATCH;
import retrofit2.http.POST;
import retrofit2.http.PUT;
import retrofit2.http.Path;
import retrofit2.http.Query;
import retrofit2.http.QueryMap;
import retrofit2.http.Url;
public interface JsonPlaceHolderApi
{
// We will get back a list of post which is a json array of post json object. To tell retrofit what to do, we have to annotate this method. As
// this is a get request so we will annotate this method using GET annotation. In GET annotation we will pass the 'posts' which represents
// relative url as base url is handled in the RetrofitActivity.java. Instead of relative URL you can also pass the whole URl int GET() annotation
// and in this case it will replace the base URL defined while creating the instance of the Retrofit. // While defining the base URL, backslash (/)
// is temporary means if not defined here then it have to put at the start of each relative URL (i.e instead of "posts" write "/posts").
@GET("posts") // This is the relative URL.
Call<List<Post>> getPosts(); // To get all the posts.
// ******************************************************************************************************************************************************
// Query annotation is used for query params. Retrofit will automatically add the question mark (?) before the first query variable to indicate
// the start of the query params (url : "https://.....?userid=2&_sort=id...). Again Retrofit will add ampersand (&) sign b/w each query
// parameter variables.
@GET("posts")
Call<List<Post>> getPostPerUser(
// @Query("userId") Integer userId1, // We used wrapper class of int as int in non-nullable but it's wrapper class can have null value.
// @Query("userId") Integer userId2, // To get the post of another user.
// To get the posts of more than one user we can use above method and write down separate Query() for each user but instead we can approach
// an another method and pass an array of Integer.
@Query("userId") Integer[] userId,
@Query("_sort") String sort,
@Query("_order") String order
); // To get the post as per the user id(s).
// If you want to pass any combination of query parameters and don't to define them in the method declaration, use QueryMap.
@GET("posts")
Call<List<Post>> getPostPerUser(@QueryMap Map<String, String> parameters);
// ******************************************************************************************************************************************************
// @Path annotation will replace the variable string ( here it is post_id ) inside the curly braces with the one followed by it ( here by postId ). See
// that post_id is string type but postId is int type. Retrofit will automatically convert the string to integer.
@GET("posts/{post_id}/comments")
Call<List<Comment>> getComments(@Path("post_id") int postId);
// If whole query parameter string is passed is passed. Here you can the whole URL also and in this case it will replace the base URL defined while
// creating the instance of the Retrofit.
@GET
Call<List<Comment>> getComments(@Url String url);
// *****************************************************************************************************************************************************
// Since we use GSON as our converter Post will be automatically be serialized into JSON format before it is sent to the server.
@POST("posts")
Call<Post> createPost(@Body Post post);
// @FormUrlEncoded is just the another way of sending data to the server. It will encode the fields just like URL is encoded (like query parameters).
// userId, title, body : should be used with these names only as jsonPlaceHolder api has these names as keys.
@FormUrlEncoded
@POST("posts")
Call<Post> createPost(
@Field("userId") int userId,
@Field("title") String title,
@Field("body") String text
);
// If you don't want to define the parameters in the method declaration then in that case we can use FieldMap (similar to QueryMap used above).
@FormUrlEncoded
@POST("posts")
Call<Post> createPost(@FieldMap Map<String, String> fields);
// *****************************************************************************************************************************************************
// Put request will replace the whole post whose id is mentioned. Extra we can add header also as we did below.
@Headers({"Static-Header: 123", "Static-Header: 456"})
@PUT("posts/{id}")
Call<Post> putPost(@Header("Dynamic-Header") String header, @Path("id") int id, @Body Post post);
// Where as patch request will only update the those fields whose key-value is passed in the body (or whose value is passed but as null).
@PATCH("posts/{id}")
Call<Post> patchPost(@HeaderMap Map<String,String> headers, @Path("id") int id, @Body Post post);
// *****************************************************************************************************************************************************
@DELETE("posts/{id}")
Call<Void> deletePost(@Path("id") int id);
} | [
"[email protected]"
] | |
9638de231524992e862728f3830a0e9419c48c29 | b899c2934a02043cfbc2d13b544be6ee664422bb | /src/main/java/com/imooc/service/impl/BuyerServiceImpl.java | a60b1bc100aeb05b4db6fc107c58245f5518587a | [] | no_license | patience2013/sell | 791f841ae1cbe2e192dd6048e5e235f0a7b57902 | a04bbf89d9acffaa721f6aa0ba43b06baba6bf5e | refs/heads/master | 2023-05-25T08:43:58.170634 | 2018-05-11T02:38:58 | 2018-05-11T02:38:58 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,604 | java | package com.imooc.service.impl;
import com.imooc.dto.OrderDTO;
import com.imooc.enums.ResultEnum;
import com.imooc.exception.SellException;
import com.imooc.service.BuyerService;
import com.imooc.service.OrderService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* @author: Administrator
* @date: 2018/4/27/027
* @description:
*/
@Service
@Slf4j
public class BuyerServiceImpl implements BuyerService {
@Autowired
private OrderService orderService;
@Override
public OrderDTO findOrderOne(String openid, String orderId) {
return checkOrderOwner(openid,orderId);
}
@Override
public OrderDTO cancelOrder(String openid, String orderId) {
OrderDTO orderDTO =checkOrderOwner(openid,orderId);
if(orderDTO==null){
log.error("【取消订单】 查不到该订单,orderId={}",orderId);
throw new SellException(ResultEnum.ORDER_NOT_EXIST);
}
return orderService.cancel(orderDTO);
}
private OrderDTO checkOrderOwner(String openid, String orderId){
OrderDTO orderDTO =orderService.findOne(orderId);
if(orderDTO ==null){
return null;
}
//判断是否是自己的订单
if(!orderDTO.getBuyerOpenid().equalsIgnoreCase(openid)){
log.error("【查询订单】 订单的openid不一致 .openid={},orderDTO={}",openid,orderDTO.toString());
throw new SellException(ResultEnum.ORDER_OWNER_ERROR);
}
return orderDTO;
}
}
| [
"[email protected]"
] | |
8370f2086f6fc2d9e2fa579221351f959dc714d3 | b6ff19ee3884063fc0769fdb1b7610bbd4197d1e | /Lab4/src/sample/SwingBody.java | 552e76047377a5b6a9d34b4c1445a26e69ead6f9 | [] | no_license | Bodichelly/MAOKGlabs | e566e8d985277156f5392ce92dabf9f1d8ea223f | d47ec8db79d6d9223be8b9334f91ccf7da63ede6 | refs/heads/master | 2023-04-22T00:19:36.396384 | 2021-05-12T19:26:14 | 2021-05-12T19:26:14 | 340,754,282 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,985 | java | package sample;
import com.sun.j3d.utils.geometry.Primitive;
import com.sun.j3d.utils.geometry.Cylinder;
import com.sun.j3d.utils.geometry.Box;
import com.sun.j3d.utils.image.TextureLoader;
import javax.media.j3d.*;
import javax.vecmath.*;
import java.awt.*;
public class SwingBody {
private static String assetsDir = System.getProperty("user.dir") + "\\assets\\";
private static int primFlags = Primitive.GENERATE_NORMALS + Primitive.GENERATE_TEXTURE_COORDS;
public static TransformGroup getBody() {
TransformGroup transformGroup = new TransformGroup();
transformGroup.addChild(getSit(-0.5f));
transformGroup.addChild(getBack(-0.4f));
transformGroup.addChild(getArmrest(-0.42f, 0.2f));
transformGroup.addChild(getArmrest(-0.42f, -0.2f));
transformGroup.addChild(getRope(1.0f, 0f, 0.2f));
transformGroup.addChild(getRope(1.0f, 0f, -0.2f));
transformGroup.addChild(getTrunk(0.5f));
return transformGroup;
}
public static TransformGroup getTrunk(float y) {
Box trunk = new Box(0.4f, .1f, .1f, primFlags, getComponentAppearance("wood.jpg"));
Vector3f vectorTop = new Vector3f(.0f, y, .0f);
return getTGTemplate(trunk, vectorTop);
}
public static TransformGroup getRope(float h, float y, float xMove) {
Cylinder rope = new Cylinder(0.01f, h, primFlags, getComponentAppearance("rope.jpg"));
Vector3f vectorTop = new Vector3f(xMove, y, .0f);
return getTGTemplate(rope, vectorTop);
}
public static TransformGroup getArmrest (float y, float zMove) {
Box sit = new Box(0.01f, .08f, .1f, primFlags, getComponentAppearance("pillow.jpg"));
Vector3f vectorTop = new Vector3f(zMove, y, 0.0f);
return getTGTemplate(sit, vectorTop);
}
public static TransformGroup getBack(float y) {
Box sit = new Box(0.2f, .1f, .01f, primFlags, getComponentAppearance("pillow.jpg"));
Vector3f vectorTop = new Vector3f(.0f, y, .1f);
return getTGTemplate(sit, vectorTop);
}
public static TransformGroup getSit(float y) {
Box sit = new Box(0.2f, .03f, .1f, primFlags, getComponentAppearance("pillow.jpg"));
Vector3f vectorTop = new Vector3f(.0f, y, .0f);
return getTGTemplate(sit, vectorTop);
}
public static TransformGroup getTGTemplate(javax.media.j3d.Node node, Vector3f vector) {
TransformGroup tg = new TransformGroup();
Transform3D transformTop = new Transform3D();
transformTop.setTranslation(vector);
tg.setTransform(transformTop);
tg.addChild(node);
return tg;
}
private static Appearance getComponentAppearance(String resource) {
TextureLoader loader = new TextureLoader(assetsDir + resource, new Container());
Texture texture = loader.getTexture();
Appearance appearance = new Appearance();
appearance.setTexture(texture);
return appearance;
}
} | [
"[email protected]"
] | |
70044e319ceaeab203d78db58c7c70130bc934b8 | e9b035ecb710dc063544db0bb39cf0b6bee94c59 | /src/server/Message.java | ddabe76427f413cd8ec064d2395507f8d26a5d27 | [] | no_license | wenxuefeng3930/JavaChatRoom | b3eef091b40eb624ca8b3637190297fe46559144 | e47ef7b23ee01615e0e1b5a781fad36490bd8b64 | refs/heads/main | 2023-08-05T06:56:52.538743 | 2021-09-21T03:37:32 | 2021-09-21T03:37:32 | 437,572,823 | 1 | 0 | null | 2021-12-12T14:48:48 | 2021-12-12T14:48:48 | null | UTF-8 | Java | false | false | 701 | java | package server;
public class Message {
public static String LoginMsg = "LOGIN";
public static String LogoutMsg = "LOGOUT";
public static String UserListMsg = "USERLIST";
public static String UserExsistMsg = "USEREXSIST";
public static String PrivateMsg = "PRIMSG";
public static String NewGrChatMsg = "NEWGRCHAT";
public static String GroupExsistMsg = "GROUPEXSIST";
public static String GroupMsg = "GROMSG";
public static String UpdateGrLMsg = "UPDATEGL";
public static String ExitGroupChatMsg = "EXITGC";
public static String BroadcastMsg = "BRDCASTMSG";
public static String ChatroomMsg = "CHATRMSG";
public static String PastMsg = "PASTMSG";
}
| [
"[email protected]"
] | |
20d6c87004a23093fe159ef995694a5a47f8effb | a7150cbb93fbde7349b2867f02bbf74123cf8f1b | /src/test/java/org/assertj/core/api/longpredicate/LongPredicateAssert_rejects_Test.java | aa8916400b3165ef5d0daf66dafd7ad0930bc777 | [
"Apache-2.0"
] | permissive | jillesvangurp/assertj-core | 54dd553276239934e61b9c2f8b5b72b0e6c0836a | 87fb5872665ad8d1c72f7d76c278bd7e8af5e762 | refs/heads/master | 2021-01-11T00:10:45.845409 | 2016-10-09T05:32:48 | 2016-10-09T05:32:48 | 70,581,183 | 0 | 0 | null | 2016-10-11T10:12:51 | 2016-10-11T10:12:50 | null | UTF-8 | Java | false | false | 3,531 | java | /**
* 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.
*
* Copyright 2012-2016 the original author or authors.
*/
package org.assertj.core.api.longpredicate;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.error.NoElementsShouldMatch.noElementsShouldMatch;
import static org.assertj.core.error.ShouldNotAccept.shouldNotAccept;
import static org.assertj.core.util.FailureMessages.actualIsNull;
import static org.assertj.core.util.Lists.newArrayList;
import static org.mockito.Mockito.verify;
import java.util.List;
import java.util.function.LongPredicate;
import java.util.function.Predicate;
import java.util.stream.Collectors;
import java.util.stream.LongStream;
import org.assertj.core.api.LongPredicateAssert;
import org.assertj.core.api.LongPredicateAssertBaseTest;
import org.assertj.core.description.TextDescription;
import org.assertj.core.presentation.PredicateDescription;
import org.junit.Test;
/**
* @author Filip Hrisafov
*/
public class LongPredicateAssert_rejects_Test extends LongPredicateAssertBaseTest {
@Test
public void should_fail_when_predicate_is_null() {
thrown.expectAssertionError(actualIsNull());
assertThat((LongPredicate) null).rejects(1L, 2L, 3L);
}
@Test
public void should_pass_when_predicate_does_not_accept_value() {
LongPredicate predicate = val -> val <= 2;
assertThat(predicate).rejects(3);
}
@Test
public void should_fail_when_predicate_accepts_value() {
LongPredicate predicate = val -> val <= 2;
Predicate<Long> wrapPredicate = predicate::test;
long expectedValue = 2;
thrown.expectAssertionError(shouldNotAccept(wrapPredicate, expectedValue, PredicateDescription.GIVEN).create());
assertThat(predicate).rejects(expectedValue);
}
@Test
public void should_fail_when_predicate_accepts_value_with_description() {
LongPredicate predicate = val -> val <= 2;
Predicate<Long> wrapPredicate = predicate::test;
long expectedValue = 2;
thrown.expectAssertionError(shouldNotAccept(wrapPredicate, expectedValue, PredicateDescription.GIVEN).create());
assertThat(predicate).as(new TextDescription("test")).rejects(expectedValue);
}
@Test
public void should_fail_when_predicate_accepts_some_value() {
LongPredicate predicate = num -> num <= 2;
long[] matchValues = new long[] { 1L, 2L, 3L };
List<Long> matchValuesList = LongStream.of(matchValues).boxed().collect(Collectors.toList());
thrown.expectAssertionError(noElementsShouldMatch(matchValuesList, 1L).create());
assertThat(predicate).rejects(matchValues);
}
@Test
public void should_pass_when_predicate_accepts_no_value() {
LongPredicate predicate = num -> num <= 2;
assertThat(predicate).rejects(3L, 4L, 5L);
}
@Override
protected LongPredicateAssert invoke_api_method() {
return assertions.rejects(3L, 4L);
}
@Override
protected void verify_internal_effects() {
verify(iterables).assertNoneMatch(getInfo(assertions), newArrayList(3L, 4L), wrapped);
}
}
| [
"[email protected]"
] | |
d05f7e30ece15541ceba61037bce60786b2ef855 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/10/10_3f6f07b8178b000ec302f35156870f192e20e883/GZIPResponseWrapper/10_3f6f07b8178b000ec302f35156870f192e20e883_GZIPResponseWrapper_s.java | ccac614629c1e24af23715485a795b18732abb1b | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 3,022 | java | package org.appfuse.webapp.filter;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpServletResponseWrapper;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* Wraps Response for GZipFilter
*
* @author Matt Raible
* @version $Revision: 1.4 $ $Date: 2004/08/19 00:13:57 $
*/
public class GZIPResponseWrapper extends HttpServletResponseWrapper {
private transient final Log log = LogFactory.getLog(GZIPResponseWrapper.class);
protected HttpServletResponse origResponse = null;
protected ServletOutputStream stream = null;
protected PrintWriter writer = null;
protected int error = 0;
public GZIPResponseWrapper(HttpServletResponse response) {
super(response);
origResponse = response;
}
public ServletOutputStream createOutputStream() throws IOException {
return (new GZIPResponseStream(origResponse));
}
public void finishResponse() {
try {
if (writer != null) {
writer.close();
} else {
if (stream != null) {
stream.close();
}
}
} catch (IOException e) {
}
}
public void flushBuffer() throws IOException {
stream.flush();
}
public ServletOutputStream getOutputStream() throws IOException {
if (writer != null) {
throw new IllegalStateException("getWriter() has already been called!");
}
if (stream == null) {
stream = createOutputStream();
}
return (stream);
}
public PrintWriter getWriter() throws IOException {
// If access denied, don't create new stream or write because
// it causes the web.xml's 403 page to not render
if (this.error == HttpServletResponse.SC_FORBIDDEN) {
return super.getWriter();
}
if (writer != null) {
return (writer);
}
if (stream != null) {
throw new IllegalStateException("getOutputStream() has already been called!");
}
stream = createOutputStream();
writer =
new PrintWriter(new OutputStreamWriter(stream,
origResponse.getCharacterEncoding()));
return (writer);
}
public void setContentLength(int length) {
}
/**
* @see javax.servlet.http.HttpServletResponse#sendError(int, java.lang.String)
*/
public void sendError(int error, String message) throws IOException {
super.sendError(error, message);
this.error = error;
if (log.isDebugEnabled()) {
log.debug("sending error: " + error + " [" + message + "]");
}
}
}
| [
"[email protected]"
] | |
24bd7d1a363e94bcc8064a84f20d2e409893b286 | a8c94b9aa89b72026b7b1dba041aa944c3dfad2d | /elasticsearch-hadoop-6.8.1/mr/src/main/java/org/apache/commons/httpclient/fix/auth/HttpAuthRealm.java | f2b13407e37f382e3c078a954f6ffb28e4d8e4b2 | [
"Apache-2.0"
] | permissive | Magnarox/es-hadoop | 671384fd45644c05da3d4859263bbe43552667dc | 16fe061bc12b2adbc673eee91b46b0fa7450fe2a | refs/heads/master | 2020-12-09T00:02:30.428638 | 2020-01-12T20:48:06 | 2020-01-12T20:48:06 | 233,130,675 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,358 | java | /*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//httpclient/src/java/org/apache/commons/httpclient/auth/HttpAuthRealm.java,v 1.9 2004/06/12 22:47:23 olegk Exp $
* $Revision: 480424 $
* $Date: 2006-11-29 06:56:49 +0100 (Wed, 29 Nov 2006) $
*
* ====================================================================
*
* 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.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.commons.httpclient.fix.auth;
/** The key used to look up authentication credentials.
*
* @author <a href="mailto:[email protected]">Oleg Kalnichevski</a>
* @author <a href="mailto:[email protected]">Adrian Sutton</a>
*
* @deprecated no longer used
*/
public class HttpAuthRealm extends AuthScope {
/** Creates a new HttpAuthRealm for the given <tt>domain</tt> and
* <tt>realm</tt>.
*
* @param domain the domain the credentials apply to. May be set
* to <tt>null</tt> if credenticals are applicable to
* any domain.
* @param realm the realm the credentials apply to. May be set
* to <tt>null</tt> if credenticals are applicable to
* any realm.
*
*/
public HttpAuthRealm(final String domain, final String realm) {
super(domain, ANY_PORT, realm, ANY_SCHEME);
}
}
| [
"[email protected]"
] | |
b8417c74290e635c32337bea965aaa963825a941 | cd81f5246d9a6b8471454782cda01440990a2b6b | /igesture-tool/src/main/java/org/ximtec/igesture/tool/view/testset/ITestSetView.java | 908267046a47014fc4614aeabde0fb751b7665b3 | [
"Apache-2.0"
] | permissive | UeliKurmann/igesture | fd73a345347f60c96a6cf51a4c141abd0a4d4d3d | 95dd46fb321851c1e2a989e0c7c8328f57b43f4d | refs/heads/master | 2021-07-17T01:21:00.887072 | 2012-10-21T21:59:28 | 2012-10-21T21:59:28 | 219,012,943 | 0 | 0 | Apache-2.0 | 2020-10-13T17:09:58 | 2019-11-01T15:31:53 | Java | UTF-8 | Java | false | false | 19,398 | java | // automatically generated code
package org.ximtec.igesture.tool.view.testset;
import org.ximtec.igesture.tool.core.TabbedView;
import org.ximtec.igesture.tool.explorer.core.ExplorerTreeContainer;
public interface ITestSetView extends TabbedView,
ExplorerTreeContainer{
public java.lang.String getTabName();
public javax.swing.JComponent getPane();
public javax.swing.Icon getIcon();
public void setView(javax.swing.JComponent arg1);
public void setTree(org.ximtec.igesture.tool.explorer.ExplorerTree arg1);
public org.ximtec.igesture.tool.util.ComponentFactory getComponentFactory();
public org.ximtec.igesture.tool.core.Controller getController();
public void remove(java.awt.Component arg1);
public void remove(int arg1);
public void removeAll();
public javax.accessibility.AccessibleContext getAccessibleContext();
public int getOrientation();
public javax.swing.plaf.SplitPaneUI getUI();
public java.lang.String getUIClassID();
public void setUI(javax.swing.plaf.SplitPaneUI arg1);
public void updateUI();
public boolean isValidateRoot();
public void setOrientation(int arg1);
public java.awt.Component getBottomComponent();
public int getDividerLocation();
public int getDividerSize();
public int getLastDividerLocation();
public java.awt.Component getLeftComponent();
public int getMaximumDividerLocation();
public int getMinimumDividerLocation();
public double getResizeWeight();
public java.awt.Component getRightComponent();
public java.awt.Component getTopComponent();
public boolean isContinuousLayout();
public boolean isOneTouchExpandable();
public void resetToPreferredSizes();
public void setBottomComponent(java.awt.Component arg1);
public void setContinuousLayout(boolean arg1);
public void setDividerLocation(int arg1);
public void setDividerLocation(double arg1);
public void setDividerSize(int arg1);
public void setLastDividerLocation(int arg1);
public void setLeftComponent(java.awt.Component arg1);
public void setOneTouchExpandable(boolean arg1);
public void setResizeWeight(double arg1);
public void setRightComponent(java.awt.Component arg1);
public void setTopComponent(java.awt.Component arg1);
public boolean contains(int arg1, int arg2);
public java.awt.Point getLocation(java.awt.Point arg1);
public void print(java.awt.Graphics arg1);
public java.awt.Dimension getSize(java.awt.Dimension arg1);
public boolean isOpaque();
public void disable();
public void enable();
public void addNotify();
public void firePropertyChange(java.lang.String arg1, char arg2, char arg3);
public void firePropertyChange(java.lang.String arg1, boolean arg2, boolean arg3);
public void firePropertyChange(java.lang.String arg1, int arg2, int arg3);
public void removeNotify();
public void setOpaque(boolean arg1);
public java.awt.Rectangle getBounds(java.awt.Rectangle arg1);
public <T extends java.util.EventListener> T[] getListeners(java.lang.Class<T> arg1);
public java.awt.Dimension getMinimumSize();
public java.awt.Dimension getPreferredSize();
public javax.swing.JRootPane getRootPane();
public int getX();
public int getY();
public boolean requestFocus(boolean arg1);
public void requestFocus();
public void reshape(int arg1, int arg2, int arg3, int arg4);
public void setBackground(java.awt.Color arg1);
public void setDoubleBuffered(boolean arg1);
public void setMinimumSize(java.awt.Dimension arg1);
public void setVisible(boolean arg1);
public float getAlignmentX();
public float getAlignmentY();
public java.awt.Insets getInsets(java.awt.Insets arg1);
public java.awt.Insets getInsets();
public java.awt.Dimension getMaximumSize();
public void paint(java.awt.Graphics arg1);
public void setFocusTraversalKeys(int arg1, java.util.Set<? extends java.awt.AWTKeyStroke> arg2);
public void setFont(java.awt.Font arg1);
public void update(java.awt.Graphics arg1);
public int getBaseline(int arg1, int arg2);
public java.awt.Component.BaselineResizeBehavior getBaselineResizeBehavior();
public java.awt.FontMetrics getFontMetrics(java.awt.Font arg1);
public java.awt.Graphics getGraphics();
public int getHeight();
public int getWidth();
public boolean isDoubleBuffered();
public void printAll(java.awt.Graphics arg1);
public void repaint(java.awt.Rectangle arg1);
public void repaint(long arg1, int arg2, int arg3, int arg4, int arg5);
public boolean requestFocusInWindow();
public void setEnabled(boolean arg1);
public void setForeground(java.awt.Color arg1);
public void setMaximumSize(java.awt.Dimension arg1);
public void setPreferredSize(java.awt.Dimension arg1);
public void addVetoableChangeListener(java.beans.VetoableChangeListener arg1);
public java.beans.VetoableChangeListener[] getVetoableChangeListeners();
public void removeVetoableChangeListener(java.beans.VetoableChangeListener arg1);
public javax.swing.TransferHandler getTransferHandler();
public void setTransferHandler(javax.swing.TransferHandler arg1);
public void revalidate();
public void setAlignmentX(float arg1);
public void addAncestorListener(javax.swing.event.AncestorListener arg1);
public void computeVisibleRect(java.awt.Rectangle arg1);
public javax.swing.JToolTip createToolTip();
public java.awt.event.ActionListener getActionForKeyStroke(javax.swing.KeyStroke arg1);
public javax.swing.event.AncestorListener[] getAncestorListeners();
public boolean getAutoscrolls();
public javax.swing.border.Border getBorder();
public javax.swing.JPopupMenu getComponentPopupMenu();
public int getConditionForKeyStroke(javax.swing.KeyStroke arg1);
public int getDebugGraphicsOptions();
public boolean getInheritsPopupMenu();
public javax.swing.InputVerifier getInputVerifier();
public java.awt.Component getNextFocusableComponent();
public java.awt.Point getPopupLocation(java.awt.event.MouseEvent arg1);
public javax.swing.KeyStroke[] getRegisteredKeyStrokes();
public java.awt.Point getToolTipLocation(java.awt.event.MouseEvent arg1);
public java.lang.String getToolTipText(java.awt.event.MouseEvent arg1);
public java.lang.String getToolTipText();
public java.awt.Container getTopLevelAncestor();
public boolean getVerifyInputWhenFocusTarget();
public java.awt.Rectangle getVisibleRect();
public void grabFocus();
public boolean isManagingFocus();
public boolean isOptimizedDrawingEnabled();
public boolean isPaintingTile();
public boolean isRequestFocusEnabled();
public void paintImmediately(int arg1, int arg2, int arg3, int arg4);
public void paintImmediately(java.awt.Rectangle arg1);
public void registerKeyboardAction(java.awt.event.ActionListener arg1, javax.swing.KeyStroke arg2, int arg3);
public void registerKeyboardAction(java.awt.event.ActionListener arg1, java.lang.String arg2, javax.swing.KeyStroke arg3, int arg4);
public void removeAncestorListener(javax.swing.event.AncestorListener arg1);
public boolean requestDefaultFocus();
public void resetKeyboardActions();
public void scrollRectToVisible(java.awt.Rectangle arg1);
public void setAlignmentY(float arg1);
public void setAutoscrolls(boolean arg1);
public void setBorder(javax.swing.border.Border arg1);
public void setComponentPopupMenu(javax.swing.JPopupMenu arg1);
public void setDebugGraphicsOptions(int arg1);
public void setInheritsPopupMenu(boolean arg1);
public void setInputVerifier(javax.swing.InputVerifier arg1);
public void setNextFocusableComponent(java.awt.Component arg1);
public void setRequestFocusEnabled(boolean arg1);
public void setToolTipText(java.lang.String arg1);
public void setVerifyInputWhenFocusTarget(boolean arg1);
public void unregisterKeyboardAction(javax.swing.KeyStroke arg1);
public void add(java.awt.Component arg1, java.lang.Object arg2, int arg3);
public java.awt.Component add(java.awt.Component arg1, int arg2);
public java.awt.Component add(java.lang.String arg1, java.awt.Component arg2);
public java.awt.Component add(java.awt.Component arg1);
public void add(java.awt.Component arg1, java.lang.Object arg2);
public void list(java.io.PrintStream arg1, int arg2);
public void list(java.io.PrintWriter arg1, int arg2);
public void addPropertyChangeListener(java.beans.PropertyChangeListener arg1);
public void addPropertyChangeListener(java.lang.String arg1, java.beans.PropertyChangeListener arg2);
public void applyComponentOrientation(java.awt.ComponentOrientation arg1);
public java.awt.Component getComponent(int arg1);
public int getComponentCount();
public java.util.Set<java.awt.AWTKeyStroke> getFocusTraversalKeys(int arg1);
public java.awt.FocusTraversalPolicy getFocusTraversalPolicy();
public void invalidate();
public boolean isFocusCycleRoot();
public boolean isFocusCycleRoot(java.awt.Container arg1);
public void setFocusCycleRoot(boolean arg1);
public void setLayout(java.awt.LayoutManager arg1);
public void validate();
public void addContainerListener(java.awt.event.ContainerListener arg1);
public boolean areFocusTraversalKeysSet(int arg1);
public int countComponents();
public void deliverEvent(java.awt.Event arg1);
public void doLayout();
public java.awt.Component findComponentAt(int arg1, int arg2);
public java.awt.Component findComponentAt(java.awt.Point arg1);
public java.awt.Component getComponentAt(int arg1, int arg2);
public java.awt.Component getComponentAt(java.awt.Point arg1);
public int getComponentZOrder(java.awt.Component arg1);
public java.awt.Component[] getComponents();
public java.awt.event.ContainerListener[] getContainerListeners();
public java.awt.LayoutManager getLayout();
public java.awt.Point getMousePosition(boolean arg1) throws java.awt.HeadlessException;
public java.awt.Insets insets();
public boolean isAncestorOf(java.awt.Component arg1);
public boolean isFocusTraversalPolicySet();
public void layout();
public java.awt.Component locate(int arg1, int arg2);
public java.awt.Dimension minimumSize();
public void paintComponents(java.awt.Graphics arg1);
public java.awt.Dimension preferredSize();
public void printComponents(java.awt.Graphics arg1);
public void removeContainerListener(java.awt.event.ContainerListener arg1);
public void setComponentZOrder(java.awt.Component arg1, int arg2);
public void setFocusTraversalPolicy(java.awt.FocusTraversalPolicy arg1);
public void transferFocusBackward();
public void transferFocusDownCycle();
public void add(java.awt.PopupMenu arg1);
public java.lang.String toString();
public java.lang.String getName();
public boolean contains(java.awt.Point arg1);
public java.awt.Dimension size();
public java.awt.Point getLocation();
public java.awt.Container getParent();
public void remove(java.awt.MenuComponent arg1);
public void setName(java.lang.String arg1);
public void list();
public void list(java.io.PrintStream arg1);
public void list(java.io.PrintWriter arg1);
public java.awt.Dimension getSize();
public void setSize(java.awt.Dimension arg1);
public void setSize(int arg1, int arg2);
public void resize(java.awt.Dimension arg1);
public void resize(int arg1, int arg2);
public void enable(boolean arg1);
public java.awt.Point location();
public boolean action(java.awt.Event arg1, java.lang.Object arg2);
public void firePropertyChange(java.lang.String arg1, double arg2, double arg3);
public void firePropertyChange(java.lang.String arg1, byte arg2, byte arg3);
public void firePropertyChange(java.lang.String arg1, short arg2, short arg3);
public void firePropertyChange(java.lang.String arg1, float arg2, float arg3);
public void firePropertyChange(java.lang.String arg1, long arg2, long arg3);
public java.awt.Cursor getCursor();
public java.awt.Toolkit getToolkit();
public boolean isDisplayable();
public void setCursor(java.awt.Cursor arg1);
public java.awt.Font getFont();
public boolean postEvent(java.awt.Event arg1);
public java.awt.Color getBackground();
public java.awt.Rectangle getBounds();
public java.awt.Container getFocusCycleRootAncestor();
public java.awt.GraphicsConfiguration getGraphicsConfiguration();
public java.awt.im.InputContext getInputContext();
public java.util.Locale getLocale();
public java.awt.Point getLocationOnScreen();
public java.awt.peer.ComponentPeer getPeer();
public boolean handleEvent(java.awt.Event arg1);
public void hide();
public boolean isEnabled();
public boolean isFocusable();
public boolean isMinimumSizeSet();
public boolean isShowing();
public boolean isVisible();
public void setBounds(int arg1, int arg2, int arg3, int arg4);
public void setBounds(java.awt.Rectangle arg1);
public void setLocation(java.awt.Point arg1);
public void setLocation(int arg1, int arg2);
public void show();
public void show(boolean arg1);
public java.awt.Point getMousePosition() throws java.awt.HeadlessException;
public boolean isFocusOwner();
public boolean isLightweight();
public boolean isMaximumSizeSet();
public boolean isPreferredSizeSet();
public boolean isValid();
public void transferFocus();
public void addComponentListener(java.awt.event.ComponentListener arg1);
public void addFocusListener(java.awt.event.FocusListener arg1);
public void addHierarchyBoundsListener(java.awt.event.HierarchyBoundsListener arg1);
public void addHierarchyListener(java.awt.event.HierarchyListener arg1);
public void addInputMethodListener(java.awt.event.InputMethodListener arg1);
public void addKeyListener(java.awt.event.KeyListener arg1);
public void addMouseListener(java.awt.event.MouseListener arg1);
public void addMouseMotionListener(java.awt.event.MouseMotionListener arg1);
public void addMouseWheelListener(java.awt.event.MouseWheelListener arg1);
public java.awt.Rectangle bounds();
public int checkImage(java.awt.Image arg1, java.awt.image.ImageObserver arg2);
public int checkImage(java.awt.Image arg1, int arg2, int arg3, java.awt.image.ImageObserver arg4);
public java.awt.Image createImage(java.awt.image.ImageProducer arg1);
public java.awt.Image createImage(int arg1, int arg2);
public java.awt.image.VolatileImage createVolatileImage(int arg1, int arg2);
public java.awt.image.VolatileImage createVolatileImage(int arg1, int arg2, java.awt.ImageCapabilities arg3) throws java.awt.AWTException;
public void enableInputMethods(boolean arg1);
public java.awt.image.ColorModel getColorModel();
public java.awt.event.ComponentListener[] getComponentListeners();
public java.awt.ComponentOrientation getComponentOrientation();
public java.awt.dnd.DropTarget getDropTarget();
public java.awt.event.FocusListener[] getFocusListeners();
public boolean getFocusTraversalKeysEnabled();
public java.awt.Color getForeground();
public java.awt.event.HierarchyBoundsListener[] getHierarchyBoundsListeners();
public java.awt.event.HierarchyListener[] getHierarchyListeners();
public boolean getIgnoreRepaint();
public java.awt.event.InputMethodListener[] getInputMethodListeners();
public java.awt.im.InputMethodRequests getInputMethodRequests();
public java.awt.event.KeyListener[] getKeyListeners();
public java.awt.event.MouseListener[] getMouseListeners();
public java.awt.event.MouseMotionListener[] getMouseMotionListeners();
public java.awt.event.MouseWheelListener[] getMouseWheelListeners();
public java.beans.PropertyChangeListener[] getPropertyChangeListeners(java.lang.String arg1);
public java.beans.PropertyChangeListener[] getPropertyChangeListeners();
public boolean gotFocus(java.awt.Event arg1, java.lang.Object arg2);
public boolean hasFocus();
public boolean imageUpdate(java.awt.Image arg1, int arg2, int arg3, int arg4, int arg5, int arg6);
public boolean inside(int arg1, int arg2);
public boolean isBackgroundSet();
public boolean isCursorSet();
public boolean isFocusTraversable();
public boolean isFontSet();
public boolean isForegroundSet();
public boolean keyDown(java.awt.Event arg1, int arg2);
public boolean keyUp(java.awt.Event arg1, int arg2);
public boolean lostFocus(java.awt.Event arg1, java.lang.Object arg2);
public boolean mouseDown(java.awt.Event arg1, int arg2, int arg3);
public boolean mouseDrag(java.awt.Event arg1, int arg2, int arg3);
public boolean mouseEnter(java.awt.Event arg1, int arg2, int arg3);
public boolean mouseExit(java.awt.Event arg1, int arg2, int arg3);
public boolean mouseMove(java.awt.Event arg1, int arg2, int arg3);
public boolean mouseUp(java.awt.Event arg1, int arg2, int arg3);
public void move(int arg1, int arg2);
public void nextFocus();
public void paintAll(java.awt.Graphics arg1);
public boolean prepareImage(java.awt.Image arg1, int arg2, int arg3, java.awt.image.ImageObserver arg4);
public boolean prepareImage(java.awt.Image arg1, java.awt.image.ImageObserver arg2);
public void removeComponentListener(java.awt.event.ComponentListener arg1);
public void removeFocusListener(java.awt.event.FocusListener arg1);
public void removeHierarchyBoundsListener(java.awt.event.HierarchyBoundsListener arg1);
public void removeHierarchyListener(java.awt.event.HierarchyListener arg1);
public void removeInputMethodListener(java.awt.event.InputMethodListener arg1);
public void removeKeyListener(java.awt.event.KeyListener arg1);
public void removeMouseListener(java.awt.event.MouseListener arg1);
public void removeMouseMotionListener(java.awt.event.MouseMotionListener arg1);
public void removeMouseWheelListener(java.awt.event.MouseWheelListener arg1);
public void removePropertyChangeListener(java.beans.PropertyChangeListener arg1);
public void removePropertyChangeListener(java.lang.String arg1, java.beans.PropertyChangeListener arg2);
public void repaint();
public void repaint(long arg1);
public void repaint(int arg1, int arg2, int arg3, int arg4);
public void setComponentOrientation(java.awt.ComponentOrientation arg1);
public void setDropTarget(java.awt.dnd.DropTarget arg1);
public void setFocusTraversalKeysEnabled(boolean arg1);
public void setFocusable(boolean arg1);
public void setIgnoreRepaint(boolean arg1);
public void setLocale(java.util.Locale arg1);
public void transferFocusUpCycle();
public int hashCode();
public boolean equals(java.lang.Object arg1);
}
| [
"[email protected]"
] | |
5784c87bcc14a922a8e910395e03b77445080d8d | f3887ac0046d9407a52c7ee310ec87159fad8004 | /DMS/manage/com/junl/dms/mvc/choujian/ChouJianRelate.java | de655dc977b218d48af7526712da8dea16f6b862 | [] | no_license | chocoai/DMS | ab67fa3423ae558063efa6fe865a60ddaa450285 | 16fe1aa517bcc3b6ffeca24a1ddd3a95674e6884 | refs/heads/master | 2020-04-13T07:37:54.868610 | 2016-12-06T02:42:50 | 2016-12-06T02:42:50 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 867 | java | package com.junl.dms.mvc.choujian;
import java.sql.Timestamp;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.log4j.Logger;
import com.junl.dms.mvc.luxian.LuXian;
import com.junl.dms.mvc.weizhi.WeiZhi;
import com.platform.annotation.Table;
import com.platform.mvc.base.BaseModel;
import com.platform.mvc.base.BaseModelCache;
import com.platform.mvc.param.Param;
import com.platform.plugin.ParamInitPlugin;
import com.platform.tools.ToolCache;
import com.test.mvc.blog.Blog;
@SuppressWarnings("unused")
@Table(tableName = "DMS_CJ_chouJian_relate")
public class ChouJianRelate extends BaseModel<ChouJianRelate> {
private static final long serialVersionUID = 5979434062234466436L;
private static Logger log = Logger.getLogger(ChouJianRelate.class);
public static final ChouJianRelate dao = new ChouJianRelate();
}
| [
"[email protected]"
] | |
da6a29f1a31f0fd1cd8d5f66b5beedfadd90c3fb | 8c85b56cc769031fc2e9ed7e62e49eb9b693e4f4 | /flyme_android/app/src/main/java/me/smart/flyme/activity/menu/SquaredFrameLayout.java | 3f70849eb16d0377a00302d4b773b981b9122081 | [] | no_license | iceleeyo/FlyIM | 48a1e242bce6a30f95a20f554975846f38579a65 | adad01b7874678ed73d202da3ef306c46a0603be | refs/heads/master | 2020-06-22T10:57:32.003802 | 2016-09-07T13:11:29 | 2016-09-07T13:11:29 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 957 | java | package me.smart.flyme.activity.menu;
import android.annotation.TargetApi;
import android.content.Context;
import android.os.Build;
import android.util.AttributeSet;
import android.widget.FrameLayout;
public class SquaredFrameLayout extends FrameLayout {
public SquaredFrameLayout(Context context) {
super(context);
}
public SquaredFrameLayout(Context context, AttributeSet attrs) {
super(context, attrs);
}
public SquaredFrameLayout(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public SquaredFrameLayout(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, widthMeasureSpec);
}
}
| [
"[email protected]"
] | |
5841d6312aaeb4cc04f188a12a2711b973b9e652 | 3c1ede5bbf9d9f494c6b3e8b738d3e22b98957bb | /WSEJB/ejbModule/viewobject/personalcomputer/Psu.java | b0f1e40c9cfcd8ce74c5da1d5a9be3527252d704 | [] | no_license | lucasbussolin/webservice-deploy | bc3b399d544481ffebb0b32f7c99997b385d3c5e | 7c35e35fbf680958ea30b78fdbe06c46c49d4dc4 | refs/heads/master | 2021-08-23T20:44:10.356202 | 2017-12-05T03:21:59 | 2017-12-05T03:21:59 | 113,318,075 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,302 | java | package viewobject.personalcomputer;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType
public class Psu {
@XmlElement(name = "Nome")
private String nome;
@XmlElement(name = "Fabricante")
private String fabricante;
@XmlElement(name = "Potencia")
private Integer potencia;
@XmlElement(name = "Classificacao")
private String classificacao;
@XmlElement(name = "Valor")
private Double valor;
public String getNome() {
return nome;
}
public void setNome(String nome) {
this.nome = nome;
}
public String getFabricante() {
return fabricante;
}
public void setFabricante(String fabricante) {
this.fabricante = fabricante;
}
public Integer getPotencia() {
return potencia;
}
public void setPotencia(Integer potencia) {
this.potencia = potencia;
}
public String getClassficacao() {
return classificacao;
}
public void setClassficacao(String classficacao) {
this.classificacao = classficacao;
}
public Double getValor() {
return valor;
}
public void setValor(Double valor) {
this.valor = valor;
}
}
| [
"[email protected]"
] | |
9f4554193a0f835782b4827f9fa517faddbabbd5 | 70f7a06017ece67137586e1567726579206d71c7 | /alimama/src/main/java/alimama/com/unwviewbase/pullandrefrsh/views/recycler/accessories/RecyclerViewDetector.java | 046574cb18908f319e61950155061e2bff26eccf | [] | no_license | liepeiming/xposed_chatbot | 5a3842bd07250bafaffa9f468562021cfc38ca25 | 0be08fc3e1a95028f8c074f02ca9714dc3c4dc31 | refs/heads/master | 2022-12-20T16:48:21.747036 | 2020-10-14T02:37:49 | 2020-10-14T02:37:49 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,359 | java | package alimama.com.unwviewbase.pullandrefrsh.views.recycler.accessories;
import android.view.View;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.recyclerview.widget.StaggeredGridLayoutManager;
public class RecyclerViewDetector {
public static int getLayoutOrientation(RecyclerView recyclerView) {
if (recyclerView != null) {
RecyclerView.LayoutManager layoutManager = recyclerView.getLayoutManager();
if ((layoutManager instanceof GridLayoutManager) || (layoutManager instanceof LinearLayoutManager)) {
return ((LinearLayoutManager) layoutManager).getOrientation();
}
if (layoutManager instanceof StaggeredGridLayoutManager) {
return ((StaggeredGridLayoutManager) layoutManager).getOrientation();
}
}
return 1;
}
private static boolean isChildTopVisible(RecyclerView recyclerView, int i) {
View childAt;
if (recyclerView == null || (childAt = recyclerView.getChildAt(i)) == null || childAt.getTop() < 0) {
return false;
}
return true;
}
private static boolean isChildLeftVisible(RecyclerView recyclerView, int i) {
View childAt;
if (recyclerView == null || (childAt = recyclerView.getChildAt(i)) == null || childAt.getLeft() < 0) {
return false;
}
return true;
}
/* JADX WARNING: Code restructure failed: missing block: B:7:0x0013, code lost:
r5 = (androidx.recyclerview.widget.StaggeredGridLayoutManager) r5;
*/
/* Code decompiled incorrectly, please refer to instructions dump. */
public static int findFirstVisibleItemPosition(androidx.recyclerview.widget.RecyclerView r5) {
/*
if (r5 == 0) goto L_0x003d
androidx.recyclerview.widget.RecyclerView$LayoutManager r5 = r5.getLayoutManager()
boolean r0 = r5 instanceof androidx.recyclerview.widget.GridLayoutManager
if (r0 != 0) goto L_0x0036
boolean r0 = r5 instanceof androidx.recyclerview.widget.LinearLayoutManager
if (r0 == 0) goto L_0x000f
goto L_0x0036
L_0x000f:
boolean r0 = r5 instanceof androidx.recyclerview.widget.StaggeredGridLayoutManager
if (r0 == 0) goto L_0x003d
androidx.recyclerview.widget.StaggeredGridLayoutManager r5 = (androidx.recyclerview.widget.StaggeredGridLayoutManager) r5
int r0 = r5.getSpanCount()
if (r0 <= 0) goto L_0x003d
int[] r0 = new int[r0]
r5.findFirstVisibleItemPositions(r0)
r5 = 0
int r1 = r0.length
r2 = 2147483647(0x7fffffff, float:NaN)
r3 = 2147483647(0x7fffffff, float:NaN)
L_0x0028:
if (r5 >= r1) goto L_0x0033
r4 = r0[r5]
if (r4 >= r3) goto L_0x0030
r3 = r0[r5]
L_0x0030:
int r5 = r5 + 1
goto L_0x0028
L_0x0033:
if (r3 == r2) goto L_0x003d
goto L_0x003e
L_0x0036:
androidx.recyclerview.widget.LinearLayoutManager r5 = (androidx.recyclerview.widget.LinearLayoutManager) r5
int r3 = r5.findFirstVisibleItemPosition()
goto L_0x003e
L_0x003d:
r3 = -1
L_0x003e:
return r3
*/
throw new UnsupportedOperationException("Method not decompiled: alimama.com.unwviewbase.pullandrefrsh.views.recycler.accessories.RecyclerViewDetector.findFirstVisibleItemPosition(androidx.recyclerview.widget.RecyclerView):int");
}
public static boolean isFirstItemTotallyVisible(RecyclerView recyclerView) {
if (recyclerView != null) {
RecyclerView.Adapter adapter = recyclerView.getAdapter();
if (adapter == null || adapter.getItemCount() == 0) {
return true;
}
int findFirstVisibleItemPosition = findFirstVisibleItemPosition(recyclerView);
if (findFirstVisibleItemPosition != -1 && findFirstVisibleItemPosition <= 2) {
switch (getLayoutOrientation(recyclerView)) {
case 0:
return isChildLeftVisible(recyclerView, findFirstVisibleItemPosition);
case 1:
return isChildTopVisible(recyclerView, findFirstVisibleItemPosition);
}
}
}
return false;
}
private static boolean isChildBottomVisible(RecyclerView recyclerView, int i) {
View childAt;
if (recyclerView == null || (childAt = recyclerView.getChildAt(i)) == null || childAt.getBottom() > recyclerView.getHeight()) {
return false;
}
return true;
}
private static boolean isChildRightVisible(RecyclerView recyclerView, int i) {
View childAt;
if (recyclerView == null || (childAt = recyclerView.getChildAt(i)) == null || childAt.getRight() > recyclerView.getWidth()) {
return false;
}
return true;
}
/* JADX WARNING: Code restructure failed: missing block: B:8:0x0014, code lost:
r5 = (androidx.recyclerview.widget.StaggeredGridLayoutManager) r5;
*/
/* Code decompiled incorrectly, please refer to instructions dump. */
public static int findLastVisibleItemPosition(androidx.recyclerview.widget.RecyclerView r5) {
/*
r0 = -1
if (r5 == 0) goto L_0x0039
androidx.recyclerview.widget.RecyclerView$LayoutManager r5 = r5.getLayoutManager()
boolean r1 = r5 instanceof androidx.recyclerview.widget.GridLayoutManager
if (r1 != 0) goto L_0x0033
boolean r1 = r5 instanceof androidx.recyclerview.widget.LinearLayoutManager
if (r1 == 0) goto L_0x0010
goto L_0x0033
L_0x0010:
boolean r1 = r5 instanceof androidx.recyclerview.widget.StaggeredGridLayoutManager
if (r1 == 0) goto L_0x0039
androidx.recyclerview.widget.StaggeredGridLayoutManager r5 = (androidx.recyclerview.widget.StaggeredGridLayoutManager) r5
int r1 = r5.getSpanCount()
if (r1 <= 0) goto L_0x0039
int[] r1 = new int[r1]
r5.findLastVisibleItemPositions(r1)
r5 = 0
int r2 = r1.length
r3 = -1
L_0x0024:
if (r5 >= r2) goto L_0x002f
r4 = r1[r5]
if (r4 <= r3) goto L_0x002c
r3 = r1[r5]
L_0x002c:
int r5 = r5 + 1
goto L_0x0024
L_0x002f:
if (r3 == r0) goto L_0x0039
r0 = r3
goto L_0x0039
L_0x0033:
androidx.recyclerview.widget.LinearLayoutManager r5 = (androidx.recyclerview.widget.LinearLayoutManager) r5
int r0 = r5.findLastVisibleItemPosition()
L_0x0039:
return r0
*/
throw new UnsupportedOperationException("Method not decompiled: alimama.com.unwviewbase.pullandrefrsh.views.recycler.accessories.RecyclerViewDetector.findLastVisibleItemPosition(androidx.recyclerview.widget.RecyclerView):int");
}
public static boolean isLastItemTotallyVisible(RecyclerView recyclerView) {
if (recyclerView != null) {
RecyclerView.Adapter adapter = recyclerView.getAdapter();
if (adapter == null || adapter.getItemCount() == 0) {
return true;
}
int itemCount = adapter.getItemCount();
int findLastVisibleItemPosition = findLastVisibleItemPosition(recyclerView);
if (findLastVisibleItemPosition != -1 && findLastVisibleItemPosition >= itemCount) {
int findFirstVisibleItemPosition = findLastVisibleItemPosition - findFirstVisibleItemPosition(recyclerView);
switch (getLayoutOrientation(recyclerView)) {
case 0:
return isChildRightVisible(recyclerView, findFirstVisibleItemPosition);
case 1:
return isChildBottomVisible(recyclerView, findFirstVisibleItemPosition);
}
}
}
return false;
}
}
| [
"[email protected]"
] | |
a86ca90312cc11b6b37b0588afa34c0b85750ec0 | cb74d10e7726b3ac807443feb4d99c013f8098a6 | /src/com/internousdev/template/action/BuyItemConfirmAction.java | d798a7798e6d8dbad6a4e2c931595f1be4a7c4cf | [] | no_license | MitsuhashiRyota/template | 05480f769359b922381f1df564f609d9a30454ff | 2cacbe08f82a981a7cf0122ac62c2d97f3272f58 | refs/heads/master | 2021-07-14T03:10:30.826861 | 2017-10-19T02:07:31 | 2017-10-19T02:07:31 | 106,766,792 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,002 | java | package com.internousdev.template.action;
import java.sql.SQLException;
import java.util.Map;
import org.apache.struts2.interceptor.SessionAware;
import com.internousdev.template.dao.BuyItemComplateDAO;
import com.opensymphony.xwork2.ActionSupport;
public class BuyItemConfirmAction extends ActionSupport implements SessionAware{
public Map<String,Object> session;
public String result;
public BuyItemComplateDAO buyItemComplateDAO = new BuyItemComplateDAO();
/**
* 商品購入情報登録処理
*
* @author internous
*/
public String execute() throws SQLException {
buyItemComplateDAO.buyItemeInfo(
session.get("id").toString(),
session.get("login_user_id").toString(),
session.get("buyItem_price").toString(),
session.get("stock").toString(),
session.get("pay").toString());
result = SUCCESS;
return result;
}
@Override
public void setSession(Map<String, Object> session) {
this.session = session;
}
}
| [
"[email protected]"
] | |
a13a9d84a710793c490e5f559ec99a3675b57d27 | 2a0b5df31c675070761dca0d3d719733fc2ea187 | /java/oreilly/Java_practice/GUI1/SimpleAnimation2.java | 062f19d80a347ca7e9349784a2b07efb5e966198 | [] | no_license | oussamad-blip/bookcode-compile-lang | 55ff480d50f6101fd727bbfedb60587cb9930b60 | 87a959cf821624765df34eff506faf28ae429b4c | refs/heads/master | 2023-05-05T00:05:49.387277 | 2019-02-17T10:08:17 | 2019-02-17T10:08:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,593 | java | import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class SimpleAnimation2 implements ActionListener {
int x = 70;
int y = 70;
Animator a = new Animator();
MyDrawPanel3 drawPanel = new MyDrawPanel3();
public static void main (String[] args) {
SimpleAnimation2 gui = new SimpleAnimation2();
gui.go();
}
public void go() {
JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JButton button = new JButton("Animate");
button.addActionListener(this);
frame.getContentPane().add(BorderLayout.CENTER, drawPanel);
frame.getContentPane().add(BorderLayout.SOUTH, button);
frame.setSize(300,300);
frame.setVisible(true);
a.animate(drawPanel);
}
class Animator {
public void animate(MyDrawPanel3 drawPanel) {
for (int i = 0; i < 130; i++) {
x++;
y++;
drawPanel.repaint();
try {
Thread.sleep(50);
} catch(Exception ex) { }
}
}
}
class MyDrawPanel3 extends JPanel {
public void paintComponent(Graphics g) {
g.setColor(Color.white);
g.fillRect(0,0,this.getWidth(),this.getHeight());
g.setColor(Color.green);
g.fillOval(x,y,40,40);
}
}
public void actionPerformed(ActionEvent event) {
x = 70;
y = 70;
a.animate(drawPanel);
}
}
| [
"[email protected]"
] | |
dc39214c702a7b598ea8026039f27174a4bbdab2 | 44ebc2cbe58cc9a13e75c5d401a375eda6f8b7f0 | /app/src/androidTest/java/com/example/administrator/annotationapplication/ExampleInstrumentedTest.java | e6b6fe454cb2cc4b0c3c6bdf29640b2e03da30b6 | [] | no_license | ruichaoqun/AnnotationApplication | 0b3aaf71a3a8c30206a1bbb2fbfa959ed4c2fd30 | 98beb11736305d68e8b7bef7fb7d9d896ea26661 | refs/heads/master | 2020-03-09T06:09:52.940369 | 2018-04-08T11:00:59 | 2018-04-08T11:00:59 | 128,631,988 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 795 | java | package com.example.administrator.annotationapplication;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.example.administrator.annotationapplication", appContext.getPackageName());
}
}
| [
"[email protected]"
] | |
3cc9bdfc96a9792f2f62d1b9017c5de8ded7eddb | 14e041459d1589eca564dd1f6b76aa7eb624dad8 | /store/src/test/java/org/apache/rocketmq/store/timer/TimerMetricsTest.java | 4a0a40da075b84058f869208cdb00d4d7f85bfd0 | [
"LicenseRef-scancode-free-unknown",
"Apache-2.0",
"LicenseRef-scancode-unknown"
] | permissive | lizhimins/rocketmq | dc1988af406006c0eecab35a0597f79c61f8ca30 | 3129dc721844b2154bd04e08b7fd03be2ee5254b | refs/heads/master | 2023-09-05T15:59:23.507522 | 2023-01-13T03:38:47 | 2023-01-13T03:38:47 | 221,878,417 | 1 | 3 | Apache-2.0 | 2019-11-15T08:24:58 | 2019-11-15T08:24:55 | null | UTF-8 | Java | false | false | 2,909 | java | /*
* 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.rocketmq.store.timer;
import org.junit.Assert;
import org.junit.Test;
import java.util.ArrayList;
import java.util.List;
public class TimerMetricsTest {
@Test
public void testTimingCount() {
String baseDir = StoreTestUtils.createBaseDir();
TimerMetrics first = new TimerMetrics(baseDir);
Assert.assertTrue(first.load());
first.addAndGet("AAA", 1000);
first.addAndGet("BBB", 2000);
Assert.assertEquals(1000, first.getTimingCount("AAA"));
Assert.assertEquals(2000, first.getTimingCount("BBB"));
long curr = System.currentTimeMillis();
Assert.assertTrue(first.getTopicPair("AAA").getTimeStamp() > curr - 10);
Assert.assertTrue(first.getTopicPair("AAA").getTimeStamp() <= curr);
first.persist();
TimerMetrics second = new TimerMetrics(baseDir);
Assert.assertTrue(second.load());
Assert.assertEquals(1000, second.getTimingCount("AAA"));
Assert.assertEquals(2000, second.getTimingCount("BBB"));
Assert.assertTrue(second.getTopicPair("BBB").getTimeStamp() > curr - 100);
Assert.assertTrue(second.getTopicPair("BBB").getTimeStamp() <= curr);
second.persist();
StoreTestUtils.deleteFile(baseDir);
}
@Test
public void testTimingDistribution(){
String baseDir = StoreTestUtils.createBaseDir();
TimerMetrics first = new TimerMetrics(baseDir);
List<Integer> timerDist = new ArrayList<Integer>(){{
add(5);add(60);add(300); // 5s, 1min, 5min
add(900);add(3600);add(14400); // 15min, 1h, 4h
add(28800);add(86400); // 8h, 24h
}};
for(int period:timerDist){
first.updateDistPair(period,period);
}
int temp = 0;
for(int j=0;j<50;j++){
for(int period:timerDist){
Assert.assertEquals(first.getDistPair(period).getCount().get(),period+temp);
first.updateDistPair(period,j);
}
temp+=j;
}
StoreTestUtils.deleteFile(baseDir);
}
}
| [
"[email protected]"
] | |
f283795949420e0820aae39fe828af79b2ceb453 | 676144f10f0174316305411022caa91eb7d8377c | /weixin/src/main/java/com/weixin/util/HttpConnect.java | c41247747302ed6298fd146cba8b87ac1d4e6c72 | [] | no_license | pankesheng/weixin | f67aade14f840226d78e9211ca500ff2affef16b | 1736d6cf190d2502b5b120c03619bc7f36b5f2f8 | refs/heads/master | 2020-12-11T18:27:21.137322 | 2017-01-17T00:48:15 | 2017-01-17T00:48:15 | 48,680,785 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,881 | java | package com.weixin.util;
import java.io.IOException;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpException;
import org.apache.commons.httpclient.HttpMethod;
import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager;
import org.apache.commons.httpclient.methods.GetMethod;
import org.apache.commons.httpclient.params.HttpMethodParams;
public class HttpConnect {
private static HttpConnect httpConnect = new HttpConnect();
/**
* 工厂方法
*
* @return
*/
public static HttpConnect getInstance() {
return httpConnect;
}
MultiThreadedHttpConnectionManager connectionManager = new MultiThreadedHttpConnectionManager();
// 预定接口的返回处理,对特殊字符进行过滤
public HttpResponse doGetStr(String url) {
String CONTENT_CHARSET = "GBK";
// long time1 = System.currentTimeMillis();
HttpClient client = new HttpClient(connectionManager);
client.getHttpConnectionManager().getParams().setConnectionTimeout(30000);
client.getHttpConnectionManager().getParams().setSoTimeout(55000);
client.getParams().setParameter(HttpMethodParams.HTTP_CONTENT_CHARSET, CONTENT_CHARSET);
HttpMethod method = new GetMethod(url);
HttpResponse response = new HttpResponse();
try {
client.executeMethod(method);
// System.out.println("调接口返回的时间:"+(System.currentTimeMillis()-time1));
response.setStringResult(method.getResponseBodyAsString());
} catch (HttpException e) {
method.releaseConnection();
return null;
} catch (IOException e) {
method.releaseConnection();
return null;
}finally{
method.releaseConnection();
}
return response;
}
} | [
"admin@admin-PC"
] | admin@admin-PC |
a9f9aca3500fc6bf6237f45ae1065498bf776f36 | af7f640cb82f2fa31c36d8b8be31416fab106a05 | /src/main/java/fr/jador/web/rest/FournisseurResource.java | d512b766580b1bc14fe4cbb5dc8b84503ffae7a5 | [] | no_license | yodamad/jador | a0410dfd25827c6f429517e7fa791871e4ee8601 | 6716be376d2736972aab78377dfcb5a0fdd9a77e | refs/heads/master | 2021-05-06T11:28:31.585668 | 2018-01-27T20:45:03 | 2018-01-27T20:45:03 | 114,295,040 | 1 | 0 | null | 2021-02-11T06:17:28 | 2017-12-14T20:50:46 | Java | UTF-8 | Java | false | false | 5,356 | java | package fr.jador.web.rest;
import com.codahale.metrics.annotation.Timed;
import fr.jador.service.FournisseurService;
import fr.jador.web.rest.errors.BadRequestAlertException;
import fr.jador.web.rest.util.HeaderUtil;
import fr.jador.web.rest.util.PaginationUtil;
import fr.jador.service.dto.FournisseurDTO;
import io.github.jhipster.web.util.ResponseUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.List;
import java.util.Optional;
/**
* REST controller for managing Fournisseur.
*/
@RestController
@RequestMapping("/api")
public class FournisseurResource {
private final Logger log = LoggerFactory.getLogger(FournisseurResource.class);
private static final String ENTITY_NAME = "fournisseur";
private final FournisseurService fournisseurService;
public FournisseurResource(FournisseurService fournisseurService) {
this.fournisseurService = fournisseurService;
}
/**
* POST /fournisseurs : Create a new fournisseur.
*
* @param fournisseurDTO the fournisseurDTO to create
* @return the ResponseEntity with status 201 (Created) and with body the new fournisseurDTO, or with status 400 (Bad Request) if the fournisseur has already an ID
* @throws URISyntaxException if the Location URI syntax is incorrect
*/
@PostMapping("/fournisseurs")
@Timed
public ResponseEntity<FournisseurDTO> createFournisseur(@Valid @RequestBody FournisseurDTO fournisseurDTO) throws URISyntaxException {
log.debug("REST request to save Fournisseur : {}", fournisseurDTO);
if (fournisseurDTO.getId() != null) {
throw new BadRequestAlertException("A new fournisseur cannot already have an ID", ENTITY_NAME, "idexists");
}
FournisseurDTO result = fournisseurService.save(fournisseurDTO);
return ResponseEntity.created(new URI("/api/fournisseurs/" + result.getId()))
.headers(HeaderUtil.createEntityCreationAlert(ENTITY_NAME, result.getId().toString()))
.body(result);
}
/**
* PUT /fournisseurs : Updates an existing fournisseur.
*
* @param fournisseurDTO the fournisseurDTO to update
* @return the ResponseEntity with status 200 (OK) and with body the updated fournisseurDTO,
* or with status 400 (Bad Request) if the fournisseurDTO is not valid,
* or with status 500 (Internal Server Error) if the fournisseurDTO couldn't be updated
* @throws URISyntaxException if the Location URI syntax is incorrect
*/
@PutMapping("/fournisseurs")
@Timed
public ResponseEntity<FournisseurDTO> updateFournisseur(@Valid @RequestBody FournisseurDTO fournisseurDTO) throws URISyntaxException {
log.debug("REST request to update Fournisseur : {}", fournisseurDTO);
if (fournisseurDTO.getId() == null) {
return createFournisseur(fournisseurDTO);
}
FournisseurDTO result = fournisseurService.save(fournisseurDTO);
return ResponseEntity.ok()
.headers(HeaderUtil.createEntityUpdateAlert(ENTITY_NAME, fournisseurDTO.getId().toString()))
.body(result);
}
/**
* GET /fournisseurs : get all the fournisseurs.
*
* @param pageable the pagination information
* @return the ResponseEntity with status 200 (OK) and the list of fournisseurs in body
*/
@GetMapping("/fournisseurs")
@Timed
public ResponseEntity<List<FournisseurDTO>> getAllFournisseurs(Pageable pageable) {
log.debug("REST request to get a page of Fournisseurs");
Page<FournisseurDTO> page = fournisseurService.findAll(pageable);
HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(page, "/api/fournisseurs");
return new ResponseEntity<>(page.getContent(), headers, HttpStatus.OK);
}
/**
* GET /fournisseurs/:id : get the "id" fournisseur.
*
* @param id the id of the fournisseurDTO to retrieve
* @return the ResponseEntity with status 200 (OK) and with body the fournisseurDTO, or with status 404 (Not Found)
*/
@GetMapping("/fournisseurs/{id}")
@Timed
public ResponseEntity<FournisseurDTO> getFournisseur(@PathVariable Long id) {
log.debug("REST request to get Fournisseur : {}", id);
FournisseurDTO fournisseurDTO = fournisseurService.findOne(id);
return ResponseUtil.wrapOrNotFound(Optional.ofNullable(fournisseurDTO));
}
/**
* DELETE /fournisseurs/:id : delete the "id" fournisseur.
*
* @param id the id of the fournisseurDTO to delete
* @return the ResponseEntity with status 200 (OK)
*/
@DeleteMapping("/fournisseurs/{id}")
@Timed
public ResponseEntity<Void> deleteFournisseur(@PathVariable Long id) {
log.debug("REST request to delete Fournisseur : {}", id);
fournisseurService.delete(id);
return ResponseEntity.ok().headers(HeaderUtil.createEntityDeletionAlert(ENTITY_NAME, id.toString())).build();
}
}
| [
"[email protected]"
] | |
20c41f904256bbc2a673c8191179d33dea6f9c23 | 0bb6368ce02e5cf7a64e482b5775ff3a46b67895 | /lab3/src/main/java/com/chauncy/lab3/simpledb/StringAggregator.java | e4e4fbe4f78011adf2da17025fccf30901907177 | [] | no_license | zhiyu00/simpledb | 4d39d8fe0c781b53b8317ae1fe09fff359a045e9 | db8208892f8863596e2dd5882e6fb87ab56a1822 | refs/heads/master | 2022-12-20T03:03:38.745569 | 2020-04-08T07:48:34 | 2020-04-08T07:48:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,383 | java | package com.chauncy.lab3.simpledb;
import java.util.*;
/**
* Knows how to compute some aggregate over a set of StringFields.
*/
public class StringAggregator implements Aggregator {
private static final long serialVersionUID = 1L;
private final int gbfield;
private final Type gbfieldtype;
private final int afrield;
private final Op what;
private Object aggr;
/**
* Aggregate constructor
* @param gbfield the 0-based index of the group-by field in the tuple, or NO_GROUPING if there is no grouping
* @param gbfieldtype the type of the group by field (e.g., Type.INT_TYPE), or null if there is no grouping
* @param afield the 0-based index of the aggregate field in the tuple
* @param what aggregation operator to use -- only supports COUNT
* @throws IllegalArgumentException if what != COUNT
*/
public StringAggregator(int gbfield, Type gbfieldtype, int afield, Op what) {
// some code goes here
if (what != Op.COUNT) {
throw new IllegalArgumentException("StringAggregator only support COUNT");
}
this.what = what;
this.gbfield = gbfield;
this.gbfieldtype = gbfieldtype;
this.afrield = afield;
if (this.gbfield == Aggregator.NO_GROUPING) {
aggr = (Object) new Integer(0);
} else {
// grouping
assert gbfieldtype != null;
if (gbfieldtype == Type.INT_TYPE) {
aggr = (Object) new TreeMap<Integer, ArrayList<Integer>>();
} else {
aggr = (Object) new TreeMap<String, ArrayList<Integer>>();
}
}
}
/**
* Merge a new tuple into the aggregate, grouping as indicated in the constructor
* @param tup the Tuple containing an aggregate field and a group-by field
*/
public void mergeTupleIntoGroup(Tuple tup) {
// some code goes here
if (gbfield == Aggregator.NO_GROUPING) {
aggr = (((Integer) aggr) + 1);
} else {
if (gbfieldtype == Type.INT_TYPE) {
TreeMap<Integer, Integer> groupAggr = (TreeMap<Integer, Integer>) aggr;
Integer gbKey = ((IntField) tup.getField(gbfield)).getValue();
if (!groupAggr.containsKey(gbKey)) {
groupAggr.put(gbKey, 1);
} else {
groupAggr.replace(gbKey, groupAggr.get(gbKey) + 1);
}
} else {
TreeMap<String, Integer> groupAggr = (TreeMap<String, Integer>) aggr;
String gbKey = ((StringField) tup.getField(gbfield)).getValue();
if (!groupAggr.containsKey(gbKey)) {
groupAggr.put(gbKey, 1);
} else {
groupAggr.replace(gbKey, groupAggr.get(gbKey) + 1);
}
}
}
}
/**
* Create a DbIterator over group aggregate results.
*
* @return a DbIterator whose tuples are the pair (groupVal,
* aggregateVal) if using group, or a single (aggregateVal) if no
* grouping. The aggregateVal is determined by the type of
* aggregate specified in the constructor.
*/
public DbIterator iterator() {
// some code goes here
return new StringAggrDbIterator();
}
private class StringAggrDbIterator implements DbIterator {
private Iterator<Tuple> it;
private ArrayList<Tuple> res;
public StringAggrDbIterator() {
assert what == Op.COUNT;
this.it = null;
res = new ArrayList<Tuple>();
if (gbfield == Aggregator.NO_GROUPING) {
Tuple t = new Tuple(getTupleDesc());
Field aggregateVal = new IntField((Integer) aggr);
t.setField(0, aggregateVal);
res.add(t);
} else {
for (Map.Entry e : ((TreeMap<Integer, ArrayList<Integer>>) aggr).entrySet()) {
Tuple t = new Tuple(getTupleDesc());
Field groupVal = null;
if (gbfieldtype == Type.INT_TYPE) {
groupVal = new IntField((int) e.getKey());
} else {
String str = (String) e.getKey();
groupVal = new StringField(str, str.length());
}
Field aggregateVal = new IntField((Integer) e.getValue());
t.setField(0, groupVal);
t.setField(1, aggregateVal);
res.add(t);
}
}
}
/**
* Opens the iterator. This must be called before any of the other methods.
*
* @throws DbException when there are problems opening/accessing the database.
*/
@Override
public void open() throws DbException, TransactionAbortedException {
it = res.iterator();
}
/**
* Returns true if the iterator has more tuples.
*
* @return true f the iterator has more tuples.
* @throws IllegalStateException If the iterator has not been opened
*/
@Override
public boolean hasNext() throws DbException, TransactionAbortedException {
if (it == null) {
throw new IllegalStateException("IntegerAggregator not open");
}
return it.hasNext();
}
/**
* Returns the next tuple from the operator (typically implementing by reading
* from a child operator or an access method).
*
* @return the next tuple in the iteration.
* @throws NoSuchElementException if there are no more tuples.
* @throws IllegalStateException If the iterator has not been opened
*/
@Override
public Tuple next() throws DbException, TransactionAbortedException, NoSuchElementException {
if (it == null) {
throw new IllegalStateException("IntegerAggregator not open");
}
return it.next();
}
/**
* Resets the iterator to the start.
*
* @throws DbException when rewind is unsupported.
* @throws IllegalStateException If the iterator has not been opened
*/
@Override
public void rewind() throws DbException, TransactionAbortedException {
if (it == null) {
throw new IllegalStateException("IntegerAggregator not open");
}
it = res.iterator();
}
/**
* Returns the TupleDesc associated with this DbIterator.
*
* @return the TupleDesc associated with this DbIterator.
*/
@Override
public TupleDesc getTupleDesc() {
if (gbfield == Aggregator.NO_GROUPING) {
return new TupleDesc(new Type[]{Type.INT_TYPE});
} else {
return new TupleDesc(new Type[]{gbfieldtype, Type.INT_TYPE});
}
}
/**
* Closes the iterator. When the iterator is closed, calling next(),
* hasNext(), or rewind() should fail by throwing IllegalStateException.
*/
@Override
public void close() {
it = null;
}
}
}
| [
"[email protected]"
] | |
560f37e7a5b1fac69eed9981db9dc925afb517ed | 8a59dca2e7f583f6823f286ac53145f80aa6c4e2 | /commons-flex/src/main/java/flex/management/runtime/package-info.java | 260cb5fa582e995e25f9f133f5b32a64056afca5 | [] | no_license | IFGHou/Grendel-Scan | 702ea85fc9f16454f947114ae9d8139ca7ad41ad | 6c582c0bd3915222d2bcabf381c6a4c3b252937a | refs/heads/master | 2021-01-10T19:04:20.129142 | 2013-10-15T01:32:35 | 2013-10-15T01:32:35 | 23,448,801 | 25 | 9 | null | null | null | null | UTF-8 | Java | false | false | 914 | java | /*************************************************************************
*
* ADOBE CONFIDENTIAL __________________
*
* Copyright 2002 - 2007 Adobe Systems Incorporated All Rights Reserved.
*
* NOTICE: All information contained herein is, and remains the property of Adobe Systems Incorporated and its suppliers, if any. The intellectual and technical concepts contained herein are
* proprietary to Adobe Systems Incorporated and its suppliers and may be covered by U.S. and Foreign Patents, patents in process, and are protected by trade secret or copyright law. Dissemination of
* this information or reproduction of this material is strictly forbidden unless prior written permission is obtained from Adobe Systems Incorporated.
**************************************************************************/
/**
* Administration console classes.
*
* @exclude
*/
package flex.management.runtime;
| [
"[email protected]"
] | |
dce39803b5dce288a1cf836a57ca923898be8e0b | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/3/3_9de220e06931b729e7b058731af6e40988172bd7/MotechSchedulerIT/3_9de220e06931b729e7b058731af6e40988172bd7_MotechSchedulerIT_s.java | f94783bb77858b044d46e755cfcac16d445a4026 | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 25,895 | java | package org.motechproject.scheduler;
import org.joda.time.DateTime;
import org.joda.time.LocalDate;
import org.junit.*;
import org.junit.runner.RunWith;
import org.motechproject.model.DayOfWeek;
import org.motechproject.model.Time;
import org.motechproject.scheduler.domain.*;
import org.motechproject.scheduler.exception.MotechSchedulerException;
import org.motechproject.scheduler.impl.MotechSchedulerServiceImpl;
import org.motechproject.server.event.EventListenerRegistry;
import org.motechproject.server.event.annotations.MotechListenerEventProxy;
import org.motechproject.util.DateUtil;
import org.quartz.*;
import org.quartz.impl.matchers.GroupMatcher;
import org.quartz.spi.OperableTrigger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.quartz.SchedulerFactoryBean;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.util.ReflectionUtils;
import java.lang.reflect.Method;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import static java.util.Arrays.asList;
import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertTrue;
import static org.motechproject.testing.utils.TimeFaker.fakeNow;
import static org.motechproject.testing.utils.TimeFaker.fakeToday;
import static org.motechproject.testing.utils.TimeFaker.stopFakingTime;
import static org.motechproject.util.DateUtil.newDate;
import static org.motechproject.util.DateUtil.newDateTime;
import static org.quartz.JobKey.jobKey;
import static org.quartz.TriggerKey.triggerKey;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"/testSchedulerApplicationContext.xml"})
public class MotechSchedulerIT {
public static final String SUBJECT = "testEvent";
private static final int REPEAT_INTERVAL_IN_SECONDS = 5;
@Autowired
private MotechSchedulerService motechSchedulerService;
@Autowired
private EventListenerRegistry eventListenerRegistry;
@Autowired
private SchedulerFactoryBean schedulerFactoryBean;
@Autowired
private TestJobHandler testJobHandler;
private String uuidStr = UUID.randomUUID().toString();
private long scheduledHour;
private long scheduledMinute;
private long scheduledSecond;
private boolean executed;
@Before
public void setUp() {
Calendar cal = Calendar.getInstance();
cal.setTime(new Date());
cal.add(1, Calendar.MINUTE);
DateTime now = DateUtil.now();
scheduledHour = now.getHourOfDay();
scheduledMinute = now.getMinuteOfHour() + 1;
scheduledSecond = now.getSecondOfMinute();
if (scheduledMinute == 59) {
scheduledHour = (scheduledHour + 1) % 24;
scheduledMinute = 0;
}
}
@Test
@Ignore
public void scheduleCronJobTest() {
Map<String, Object> params = new HashMap<String, Object>();
params.put("JobID", UUID.randomUUID().toString());
String testSubject = "MotechSchedulerITScheduleTest";
MotechEvent motechEvent = new MotechEvent(testSubject, params);
Method handlerMethod = ReflectionUtils.findMethod(MotechSchedulerIT.class, "handleEvent", MotechEvent.class);
eventListenerRegistry.registerListener(new MotechListenerEventProxy("handleEvent", this, handlerMethod), testSubject);
CronSchedulableJob cronSchedulableJob = new CronSchedulableJob(motechEvent, String.format("%d %d %d * * ?", scheduledSecond, scheduledMinute, scheduledHour));
motechSchedulerService.scheduleJob(cronSchedulableJob);
//Thread.sleep(90000); // seems to pass without sleep
if (!executed) {
Assert.fail("scheduler job not handled ..........");
}
}
public void handleEvent(MotechEvent motechEvent) {
System.out.println(motechEvent.getSubject());
executed = true;
}
@Test
public void scheduleTest() throws Exception {
Map<String, Object> params = new HashMap<String, Object>();
params.put("JobID", uuidStr);
MotechEvent motechEvent = new MotechEvent("testEvent", params);
CronSchedulableJob cronSchedulableJob = new CronSchedulableJob(motechEvent, "0 0 12 * * ?");
int scheduledJobsNum = schedulerFactoryBean.getScheduler().getTriggerKeys(GroupMatcher.triggerGroupEquals(MotechSchedulerServiceImpl.JOB_GROUP_NAME)).size();
motechSchedulerService.scheduleJob(cronSchedulableJob);
assertEquals(scheduledJobsNum + 1, schedulerFactoryBean.getScheduler().getTriggerKeys(GroupMatcher.triggerGroupEquals(MotechSchedulerServiceImpl.JOB_GROUP_NAME)).size());
}
@Test
public void scheduleExistingJobTest() throws Exception {
Map<String, Object> params = new HashMap<String, Object>();
params.put("JobID", uuidStr);
MotechEvent motechEvent = new MotechEvent("testEvent", params);
CronSchedulableJob cronSchedulableJob = new CronSchedulableJob(motechEvent, "0 0 12 * * ?");
Map<String, Object> newParameters = new HashMap<String, Object>();
newParameters.put("param1", "value1");
newParameters.put("JobID", uuidStr);
String newCronExpression = "0 0 0 * * ?";
MotechEvent newMotechEvent = new MotechEvent("testEvent", newParameters);
CronSchedulableJob newCronSchedulableJob = new CronSchedulableJob(newMotechEvent, newCronExpression);
int scheduledJobsNum = schedulerFactoryBean.getScheduler().getTriggerKeys(GroupMatcher.triggerGroupEquals(MotechSchedulerServiceImpl.JOB_GROUP_NAME)).size();
motechSchedulerService.scheduleJob(cronSchedulableJob);
assertEquals(scheduledJobsNum + 1, schedulerFactoryBean.getScheduler().getTriggerKeys(GroupMatcher.triggerGroupEquals(MotechSchedulerServiceImpl.JOB_GROUP_NAME)).size());
motechSchedulerService.scheduleJob(newCronSchedulableJob);
assertEquals(scheduledJobsNum + 1, schedulerFactoryBean.getScheduler().getTriggerKeys(GroupMatcher.triggerGroupEquals(MotechSchedulerServiceImpl.JOB_GROUP_NAME)).size());
CronTrigger trigger = (CronTrigger) schedulerFactoryBean.getScheduler().getTrigger(triggerKey("testEvent-" + uuidStr, MotechSchedulerServiceImpl.JOB_GROUP_NAME));
JobDetail jobDetail = schedulerFactoryBean.getScheduler().getJobDetail(jobKey("testEvent-" + uuidStr, MotechSchedulerServiceImpl.JOB_GROUP_NAME));
JobDataMap jobDataMap = jobDetail.getJobDataMap();
assertEquals(newCronExpression, trigger.getCronExpression());
assertEquals(3, jobDataMap.size());
}
@Test(expected = MotechSchedulerException.class)
public void scheduleInvalidCronExprTest() throws Exception {
Map<String, Object> params = new HashMap<String, Object>();
params.put("JobID", uuidStr);
MotechEvent motechEvent = new MotechEvent("testEvent", params);
CronSchedulableJob cronSchedulableJob = new CronSchedulableJob(motechEvent, " ?");
motechSchedulerService.scheduleJob(cronSchedulableJob);
}
@Test(expected = IllegalArgumentException.class)
public void scheduleNullJobTest() throws Exception {
motechSchedulerService.scheduleJob(null);
}
@Test(expected = IllegalArgumentException.class)
public void scheduleNullRunOnceJobTest() throws Exception {
motechSchedulerService.scheduleRunOnceJob(null);
}
@Test(expected = IllegalArgumentException.class)
public void scheduleNullRepeatingJobTest() throws Exception {
motechSchedulerService.scheduleRepeatingJob(null);
}
@Test
public void updateScheduledJobHappyPathTest() throws Exception {
Map<String, Object> params = new HashMap<String, Object>();
params.put("JobID", uuidStr);
MotechEvent motechEvent = new MotechEvent("testEvent", params);
CronSchedulableJob cronSchedulableJob = new CronSchedulableJob(motechEvent, "0 0 12 * * ?");
motechSchedulerService.scheduleJob(cronSchedulableJob);
String patientIdKeyName = "patientId";
String patientId = "1";
params = new HashMap<String, Object>();
params.put(patientIdKeyName, patientId);
params.put("JobID", uuidStr);
motechEvent = new MotechEvent("testEvent", params);
motechSchedulerService.updateScheduledJob(motechEvent);
JobDataMap jobDataMap = schedulerFactoryBean.getScheduler().getJobDetail(jobKey("testEvent-" + uuidStr, MotechSchedulerServiceImpl.JOB_GROUP_NAME)).getJobDataMap();
assertEquals(patientId, jobDataMap.getString(patientIdKeyName));
}
@Test(expected = IllegalArgumentException.class)
public void updateScheduledJobNullTest() throws Exception {
motechSchedulerService.updateScheduledJob(null);
}
@Test
public void rescheduleJobHappyPathTest() throws Exception {
Map<String, Object> params = new HashMap<String, Object>();
params.put("JobID", uuidStr);
MotechEvent motechEvent = new MotechEvent("testEvent", params);
CronSchedulableJob cronSchedulableJob = new CronSchedulableJob(motechEvent, "0 0 12 * * ?");
motechSchedulerService.scheduleJob(cronSchedulableJob);
int scheduledJobsNum = schedulerFactoryBean.getScheduler().getTriggerKeys(GroupMatcher.triggerGroupEquals(MotechSchedulerServiceImpl.JOB_GROUP_NAME)).size();
String newCronExpression = "0 0 10 * * ?";
motechSchedulerService.rescheduleJob("testEvent", uuidStr, newCronExpression);
assertEquals(scheduledJobsNum, schedulerFactoryBean.getScheduler().getTriggerKeys(GroupMatcher.triggerGroupEquals(MotechSchedulerServiceImpl.JOB_GROUP_NAME)).size());
CronTrigger trigger = (CronTrigger) schedulerFactoryBean.getScheduler().getTrigger(triggerKey("testEvent-" + uuidStr, MotechSchedulerServiceImpl.JOB_GROUP_NAME));
String triggerCronExpression = trigger.getCronExpression();
assertEquals(newCronExpression, triggerCronExpression);
}
@Test(expected = IllegalArgumentException.class)
public void rescheduleJobNullJobIdTest() {
motechSchedulerService.rescheduleJob(null, null, "");
}
@Test(expected = IllegalArgumentException.class)
public void rescheduleJobNullCronExpressionTest() {
motechSchedulerService.rescheduleJob("", "", null);
}
@Test(expected = MotechSchedulerException.class)
public void rescheduleJobInvalidCronExpressionTest() {
Map<String, Object> params = new HashMap<String, Object>();
params.put("JobID", uuidStr);
MotechEvent motechEvent = new MotechEvent("testEvent", params);
CronSchedulableJob cronSchedulableJob = new CronSchedulableJob(motechEvent, "0 0 12 * * ?");
motechSchedulerService.scheduleJob(cronSchedulableJob);
motechSchedulerService.rescheduleJob("testEvent", uuidStr, "?");
}
@Test(expected = MotechSchedulerException.class)
public void rescheduleNotExistingJobTest() {
motechSchedulerService.rescheduleJob("", "0", "?");
}
@Test
public void scheduleRunOnceJobTest() throws Exception {
String uuidStr = UUID.randomUUID().toString();
Map<String, Object> params = new HashMap<String, Object>();
params.put("JobID", uuidStr);
MotechEvent motechEvent = new MotechEvent("TestEvent", params);
RunOnceSchedulableJob schedulableJob = new RunOnceSchedulableJob(motechEvent, new Date((new Date()).getTime() + 5000));
int scheduledJobsNum = schedulerFactoryBean.getScheduler().getTriggerKeys(GroupMatcher.triggerGroupEquals(MotechSchedulerServiceImpl.JOB_GROUP_NAME)).size();
motechSchedulerService.scheduleRunOnceJob(schedulableJob);
assertEquals(scheduledJobsNum + 1, schedulerFactoryBean.getScheduler().getTriggerKeys(GroupMatcher.triggerGroupEquals(MotechSchedulerServiceImpl.JOB_GROUP_NAME)).size());
}
@Test(expected = IllegalArgumentException.class)
public void scheduleRunOncePastJobTest() throws Exception {
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.DATE, -1);
MotechEvent motechEvent = new MotechEvent(null, null);
RunOnceSchedulableJob schedulableJob = new RunOnceSchedulableJob(motechEvent, calendar.getTime());
schedulerFactoryBean.getScheduler().getTriggerKeys(GroupMatcher.triggerGroupEquals(MotechSchedulerServiceImpl.JOB_GROUP_NAME));
motechSchedulerService.scheduleRunOnceJob(schedulableJob);
}
@Test
public void testScheduleRepeatingJob() throws Exception {
String uuidStr = UUID.randomUUID().toString();
Map<String, Object> params = new HashMap<String, Object>();
params.put("JobID", uuidStr);
MotechEvent motechEvent = new MotechEvent("TestEvent", params);
Calendar cal = Calendar.getInstance();
Date start = cal.getTime();
cal.add(Calendar.DATE, 1);
Date end = cal.getTime();
RepeatingSchedulableJob schedulableJob = new RepeatingSchedulableJob()
.setMotechEvent(motechEvent)
.setStartTime(start)
.setEndTime(end)
.setRepeatCount(5)
.setRepeatIntervalInMilliSeconds(5000L)
.setIgnorePastFiresAtStart(false);
int scheduledJobsNum = schedulerFactoryBean.getScheduler().getTriggerKeys(GroupMatcher.triggerGroupEquals(MotechSchedulerServiceImpl.JOB_GROUP_NAME)).size();
motechSchedulerService.scheduleRepeatingJob(schedulableJob);
GroupMatcher<TriggerKey> bar = GroupMatcher.triggerGroupEquals(MotechSchedulerServiceImpl.JOB_GROUP_NAME);
Set<TriggerKey> foo = schedulerFactoryBean.getScheduler().getTriggerKeys(bar);
final List<? extends Trigger> triggersOfJob = schedulerFactoryBean.getScheduler().getTriggersOfJob(JobKey.jobKey(new RepeatingJobId(motechEvent).value(), "default"));
assertEquals(new Date(start.getTime() + 5 * 5000), triggersOfJob.get(0).getFinalFireTime());
assertEquals(scheduledJobsNum + 1, foo.size());
}
@Test
public void testScheduleInterveningRepeatingJob() throws Exception {
try {
fakeNow(newDateTime(2020, 7, 15, 10, 10, 30));
String uuidStr = UUID.randomUUID().toString();
Map<String, Object> params = new HashMap<String, Object>();
params.put("JobID", uuidStr);
MotechEvent motechEvent = new MotechEvent("TestEvent", params);
Date start = newDateTime(2020, 7, 15, 10, 10, 22).toDate();
Date end = newDateTime(2020, 7, 15, 10, 11, 0).toDate();
RepeatingSchedulableJob schedulableJob = new RepeatingSchedulableJob()
.setMotechEvent(motechEvent)
.setStartTime(start)
.setEndTime(end)
.setRepeatCount(3)
.setRepeatIntervalInMilliSeconds(5000L)
.setIgnorePastFiresAtStart(true);
motechSchedulerService.scheduleRepeatingJob(schedulableJob);
Trigger trigger = schedulerFactoryBean.getScheduler().getTrigger(triggerKey(new RepeatingJobId(motechEvent).value(), "default"));
assertEquals(newDateTime(2020, 7, 15, 10, 10, 32).toDate(), trigger.getNextFireTime());
assertEquals(newDateTime(2020, 7, 15, 10, 10, 37).toDate(), trigger.getFireTimeAfter(newDateTime(2020, 7, 15, 10, 10, 32).toDate()));
assertEquals(null, trigger.getFireTimeAfter(newDateTime(2020, 7, 15, 10, 10, 37).toDate()));
} finally {
stopFakingTime();
}
}
@Test(expected = IllegalArgumentException.class)
public void testScheduleRepeatingJobTest_NoStartDate() throws Exception {
String uuidStr = UUID.randomUUID().toString();
Map<String, Object> params = new HashMap<String, Object>();
params.put("JobID", uuidStr);
MotechEvent motechEvent = new MotechEvent("TestEvent", params);
RepeatingSchedulableJob schedulableJob = new RepeatingSchedulableJob()
.setMotechEvent(motechEvent)
.setStartTime(null)
.setEndTime(new Date())
.setRepeatCount(5)
.setRepeatIntervalInMilliSeconds(5000L)
.setIgnorePastFiresAtStart(false);
schedulerFactoryBean.getScheduler().getTriggerKeys(GroupMatcher.triggerGroupEquals(MotechSchedulerServiceImpl.JOB_GROUP_NAME));
motechSchedulerService.scheduleRepeatingJob(schedulableJob);
}
@Test
public void testScheduleRepeatingJobTest_NoEndDate() throws Exception {
String uuidStr = UUID.randomUUID().toString();
Map<String, Object> params = new HashMap<String, Object>();
params.put("JobID", uuidStr);
MotechEvent motechEvent = new MotechEvent("TestEvent", params);
RepeatingSchedulableJob schedulableJob = new RepeatingSchedulableJob()
.setMotechEvent(motechEvent)
.setStartTime(new Date())
.setEndTime(null)
.setRepeatCount(5)
.setRepeatIntervalInMilliSeconds(5000L)
.setIgnorePastFiresAtStart(false);
schedulerFactoryBean.getScheduler().getTriggerKeys(GroupMatcher.triggerGroupEquals(MotechSchedulerServiceImpl.JOB_GROUP_NAME));
motechSchedulerService.scheduleRepeatingJob(schedulableJob);
}
@Test(expected = IllegalArgumentException.class)
public void testScheduleRepeatingJobTest_NullJob() throws Exception {
RepeatingSchedulableJob schedulableJob = null;
schedulerFactoryBean.getScheduler().getTriggerKeys(GroupMatcher.triggerGroupEquals(MotechSchedulerServiceImpl.JOB_GROUP_NAME));
motechSchedulerService.scheduleRepeatingJob(schedulableJob);
}
@Test(expected = IllegalArgumentException.class)
public void testScheduleRepeatingJobTest_NullEvent() throws Exception {
MotechEvent motechEvent = null;
RepeatingSchedulableJob schedulableJob = new RepeatingSchedulableJob()
.setMotechEvent(motechEvent)
.setStartTime(new Date())
.setEndTime(new Date())
.setRepeatCount(5)
.setRepeatIntervalInMilliSeconds(5000L)
.setIgnorePastFiresAtStart(false);
schedulerFactoryBean.getScheduler().getTriggerKeys(GroupMatcher.triggerGroupEquals(MotechSchedulerServiceImpl.JOB_GROUP_NAME));
motechSchedulerService.scheduleRepeatingJob(schedulableJob);
}
@Test
public void testScheduleDayOfWeekJob() throws Exception {
Map<String, Object> params = new HashMap<String, Object>();
params.put("JobID", UUID.randomUUID().toString());
MotechEvent motechEvent = new MotechEvent("TestEvent", params);
LocalDate start = newDate(2020, 7, 10); // friday
LocalDate end = start.plusDays(10);
DayOfWeekSchedulableJob schedulableJob = new DayOfWeekSchedulableJob(motechEvent, start, end, asList(DayOfWeek.Monday, DayOfWeek.Thursday), new Time(10, 10), executed);
motechSchedulerService.scheduleDayOfWeekJob(schedulableJob);
Trigger trigger = schedulerFactoryBean.getScheduler().getTrigger(triggerKey(new CronJobId(motechEvent).value(), "default"));
assertEquals(newDateTime(2020, 7, 13, 10, 10, 0).toDate(), trigger.getNextFireTime());
assertEquals(newDateTime(2020, 7, 16, 10, 10, 0).toDate(), trigger.getFireTimeAfter(newDateTime(2020, 7, 13, 10, 10, 0).toDate()));
assertEquals(null, trigger.getFireTimeAfter(newDateTime(2020, 7, 16, 10, 10, 0).toDate()));
}
@Test
public void testScheduleInterveningDayOfWeekJob() throws Exception {
try {
fakeToday(new LocalDate(2020, 7, 15));
Map<String, Object> params = new HashMap<String, Object>();
params.put("JobID", UUID.randomUUID().toString());
MotechEvent motechEvent = new MotechEvent("TestEvent", params);
LocalDate start = newDate(2020, 7, 10); // friday
LocalDate end = start.plusDays(10);
DayOfWeekSchedulableJob schedulableJob = new DayOfWeekSchedulableJob(motechEvent, start, end, asList(DayOfWeek.Monday, DayOfWeek.Thursday), new Time(10, 10), true);
motechSchedulerService.scheduleDayOfWeekJob(schedulableJob);
Trigger trigger = schedulerFactoryBean.getScheduler().getTrigger(triggerKey(new CronJobId(motechEvent).value(), "default"));
assertEquals(newDateTime(2020, 7, 16, 10, 10, 0).toDate(), trigger.getNextFireTime());
assertEquals(null, trigger.getFireTimeAfter(newDateTime(2020, 7, 16, 10, 10, 0).toDate()));
} finally {
stopFakingTime();
}
}
@Test
public void unscheduleJobTest() throws Exception {
Map<String, Object> params = new HashMap<String, Object>();
params.put("JobID", uuidStr);
MotechEvent motechEvent = new MotechEvent(SUBJECT, params);
CronSchedulableJob cronSchedulableJob = new CronSchedulableJob(motechEvent, "0 0 12 * * ?");
motechSchedulerService.scheduleJob(cronSchedulableJob);
int scheduledJobsNum = schedulerFactoryBean.getScheduler().getTriggerKeys(GroupMatcher.triggerGroupEquals(MotechSchedulerServiceImpl.JOB_GROUP_NAME)).size();
motechSchedulerService.unscheduleJob(SUBJECT, uuidStr);
assertEquals(scheduledJobsNum - 1, schedulerFactoryBean.getScheduler().getTriggerKeys(GroupMatcher.triggerGroupEquals(MotechSchedulerServiceImpl.JOB_GROUP_NAME)).size());
}
@Test
public void unscheduleJobsGivenAJobIdPrefix() throws Exception {
motechSchedulerService.scheduleJob(getJob("testJobId.1.1"));
motechSchedulerService.scheduleJob(getJob("testJobId.1.2"));
motechSchedulerService.scheduleJob(getJob("testJobId.1.3"));
int numOfScheduledJobs = schedulerFactoryBean.getScheduler().getTriggerKeys(GroupMatcher.triggerGroupEquals(MotechSchedulerServiceImpl.JOB_GROUP_NAME)).size();
motechSchedulerService.unscheduleAllJobs("testJobId");
assertEquals(numOfScheduledJobs - 3, schedulerFactoryBean.getScheduler().getTriggerKeys(GroupMatcher.triggerGroupEquals(MotechSchedulerServiceImpl.JOB_GROUP_NAME)).size());
}
@Test
public void shouldGetJobTimingsForJobId() {
String jobId = "testJob";
CronSchedulableJob job = getJob(jobId);
motechSchedulerService.scheduleJob(job);
List<Date> dateList = motechSchedulerService.getScheduledJobTimings(job.getMotechEvent().getSubject(),
jobId, DateTime.now().toDate(), DateTime.now().plusDays(10).toDate());
assertEquals(10, dateList.size());
}
@Test
public void shouldGetJobTimingsForJobIdPrefix() {
String jobId = "testJob-repeat";
CronSchedulableJob job = getJob(jobId);
motechSchedulerService.scheduleJob(job);
List<Date> dateList = motechSchedulerService.getScheduledJobTimingsWithPrefix(job.getMotechEvent().getSubject(),
jobId, DateTime.now().toDate(), DateTime.now().plusDays(10).toDate());
assertEquals(10, dateList.size());
}
@Test
public void shouldScheduleRepeatingJobAndVerifyPastMisfiresTriggeredOnce() throws Exception {
schedulerFactoryBean.getScheduler().clear();
final DateTime now = DateUtil.now().withMillisOfSecond(0);
final DateTime startDate = now.minusSeconds(12);
final Date endDate = startDate.plusDays(1).toDate();
final MotechEvent event = new MotechEvent("TestSubject");
final RepeatingSchedulableJob job = new RepeatingSchedulableJob()
.setMotechEvent(event)
.setStartTime(startDate.toDate())
.setEndTime(endDate)
.setRepeatCount(3)
.setRepeatIntervalInMilliSeconds(REPEAT_INTERVAL_IN_SECONDS * 1000L)
.setIgnorePastFiresAtStart(false);
job.setUseOriginalFireTimeAfterMisfire(true);
motechSchedulerService.safeScheduleRepeatingJob(job);
Trigger trigger = schedulerFactoryBean.getScheduler().getTrigger(triggerKey(new RepeatingJobId(event).value(), "default"));
final org.quartz.Calendar calendar = schedulerFactoryBean.getScheduler().getCalendar(trigger.getCalendarName());
final List<Date> fireTimes = TriggerUtils.computeFireTimes((OperableTrigger) trigger, calendar, 10);
Thread.sleep(6000); //let the scheduler call test job handler.
final List<DateTime> triggeredTime = testJobHandler.getTriggeredTime();
assertDateEqualsIgnoreMillis(now.toDate(), triggeredTime.get(0));
assertDateEqualsIgnoreMillis(startDate.plusSeconds(3 * REPEAT_INTERVAL_IN_SECONDS).toDate(), triggeredTime.get(1));
}
private void assertDateEqualsIgnoreMillis(Date date1, DateTime date2) {
assertTrue("" + date1 + "|" + date2, Math.abs(date1.getTime() - date2.getMillis()) <1000L);
}
private CronSchedulableJob getJob(String jobId) {
Map<String, Object> params = new HashMap<String, Object>();
params.put("JobID", jobId);
MotechEvent motechEvent = new MotechEvent("testEvent", params);
return new CronSchedulableJob(motechEvent, "0 0 12 * * ?");
}
}
| [
"[email protected]"
] | |
3e2882f4d7bd0a9da16951275bdbfdc9572443ec | 1ca4329a5471419dec8352ba4ec5cc8ee6ba72ef | /src/Misc/Cube.java | 604b5504904d6b3122353d1ccce9ed22380d80b1 | [] | no_license | ReeRaa/LearningJava | 7cc54aead100075f89d9a5a7a6dcfafdb16f1622 | 9dcf21d1178d523b6bf8b0b6bd38410ba4cf8e55 | refs/heads/master | 2020-04-22T09:17:24.526045 | 2019-04-23T19:35:34 | 2019-04-23T19:35:34 | 170,267,299 | 1 | 0 | null | 2019-02-15T10:54:16 | 2019-02-12T06:47:20 | Java | UTF-8 | Java | false | false | 392 | java | package Misc;
/**@author Reelyka*/
public class Cube {
static {System.out.println("Hello!");};
/**@return*/
static int calculate(int x){
return x*x*x;
}
public static void main(String[] args){
char a=1199;
char b='X';
int result=Cube.calculate(5);
System.out.println(result);
System.out.println(a+" "+b);
}
}
| [
"[email protected]"
] | |
a4e4d35db1740e0c5625e8930ebe7a2e1bb11698 | 8650dd623ce5f565fd3a629fb8de376e990b2403 | /app/src/main/java/com/example/sensorapp/ViewPagerAdaptor.java | a4b64b93973c55b18d1a7507929bcc50751cd18c | [] | no_license | zn-ansari/sensorapp | 66f1592e546e451ae63ad97dc5098d847eca6309 | 9a54b6b13d2632cc10f03e25c0a3029edb68b83a | refs/heads/master | 2020-05-29T20:57:43.756784 | 2019-05-30T07:00:03 | 2019-05-30T07:00:03 | 189,362,046 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,015 | java | package com.example.sensorapp;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import java.util.ArrayList;
import java.util.List;
public class ViewPagerAdaptor extends FragmentPagerAdapter {
private final List<Fragment> fragmentList = new ArrayList<>();
private final List<String> fragmentListTitles = new ArrayList<>();
public ViewPagerAdaptor(FragmentManager fm) {
super(fm);
}
@Override
public Fragment getItem(int i) {
return fragmentList.get(i);
}
@Override
public int getCount() {
return fragmentListTitles.size();
}
@Nullable
@Override
public CharSequence getPageTitle(int position) {
return fragmentListTitles.get(position);
}
public void AddFragment (Fragment fragment, String Title){
fragmentList.add(fragment);
fragmentListTitles.add(Title);
}
}
| [
"[email protected]"
] | |
43fc3546ef0aa8a10843fae74748e713420549ec | 3c1827ae0234f79918de9dc52fb3ad59a502813e | /wmcloud-gateway-server/src/main/java/com/wmcloud/gateway/filter/PermissionsFilter.java | 9a7b6e61531ba16ecff0e56b54aadbd7078b583c | [] | no_license | wm240918567/wm-cloud-parent | 81b238d3b9efa306a1e6c1550f9ed17de8acacfa | 9cce0b1c6b970e368e62cfd4e080b2ccba4f5556 | refs/heads/master | 2022-11-28T20:35:59.412505 | 2019-09-19T10:07:23 | 2019-09-19T10:07:23 | 203,528,890 | 0 | 0 | null | 2022-11-21T22:38:29 | 2019-08-21T07:18:01 | Java | UTF-8 | Java | false | false | 3,795 | java | package com.wmcloud.gateway.filter;
import com.alibaba.fastjson.JSONObject;
import com.wmcloud.gateway.entity.InterfaceDefinition;
import com.wmcloud.gateway.entity.PermissionRegister;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.gateway.filter.GatewayFilterChain;
import org.springframework.cloud.gateway.filter.GlobalFilter;
import org.springframework.core.Ordered;
import org.springframework.http.server.PathContainer;
import org.springframework.http.server.RequestPath;
import org.springframework.http.server.reactive.ServerHttpRequest;
import org.springframework.util.StringUtils;
import org.springframework.web.server.ServerWebExchange;
import org.wmframework.result.Resp;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
@Slf4j
public class PermissionsFilter implements GlobalFilter, Ordered {
public static Map<String, PermissionRegister> map = new ConcurrentHashMap<>();
@Value(value = "${spring.application.name}")
private String oneself;
@Override
public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) {
if (null == map || map.size() == 0) {
log.warn("permissions register is empty,skip");
return chain.filter(exchange);
}
String pathWithServiceName = getPathWithServiceName(exchange);
String[] split = pathWithServiceName.split("/");
String serviceName = getServiceName(pathWithServiceName, split);
if (!StringUtils.isEmpty(serviceName)) {
if (serviceName.equals(oneself)) {
return chain.filter(exchange);
}
//不存在请求的服务名不过滤
if (null == map.get(serviceName)) {
log.warn("permissionRegister don't have service:{}", serviceName);
return chain.filter(exchange);
}
}
String path = getPath(pathWithServiceName, split);
PermissionRegister permissionRegister = map.get(serviceName);
Map<String, InterfaceDefinition> permissionsMap = permissionRegister.getPermissionsMap();
if (null == permissionsMap) {
log.error("permissions register error,service:{}", serviceName);
return chain.filter(exchange);
}
InterfaceDefinition interfaceDefinition = permissionsMap.get(path);
if (null != interfaceDefinition) {
String res = "该请求被过滤";
log.info(res);
return exchange.getResponse().writeWith(Flux.just(exchange.getResponse().
bufferFactory().wrap(JSONObject.toJSONString(Resp.badReq(res)).getBytes())));
}
return chain.filter(exchange);
}
private String getPath(String pathWithServiceName, String[] split) {
StringBuilder pathWithoutServiceName = new StringBuilder("/");
for (int i = pathWithServiceName.startsWith("/") ? 2 : 1; i < split.length; i++) {
pathWithoutServiceName.append(split[i]).append("/");
}
return pathWithoutServiceName.substring(0, pathWithoutServiceName.length() - 1);
}
private String getServiceName(String pathWithServiceName, String[] split) {
return pathWithServiceName.startsWith("/") ? split[1] : split[0];
}
private String getPathWithServiceName(ServerWebExchange exchange) {
ServerHttpRequest request = exchange.getRequest();
RequestPath requestPath = request.getPath();
PathContainer pathContainer = requestPath.pathWithinApplication();
return pathContainer.value();
}
@Override
public int getOrder() {
return HIGHEST_PRECEDENCE;
}
}
| [
"[email protected]"
] | |
5a5f66afa9148cf9a030a3dbd41889072f8a1187 | 6ff0600e2387d777f430d5b9875a91d2e0f9f42b | /src/main/java/_3_java_proffessional/homework01/ex2/MyExtraCollection.java | 9f7d3406bd5333840587cc63c5a101f7b5954a18 | [] | no_license | Sinelife/MyJavaDeveloper | 13965154355888f4e420ff9abfaf28ff84db7a77 | 088a97131917af104150f50d7c0acb9421788d5d | refs/heads/master | 2023-05-25T23:31:23.309112 | 2021-06-03T16:06:26 | 2021-06-03T16:06:26 | 373,540,917 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 132 | java | package _3_java_proffessional.homework01.ex2;
public interface MyExtraCollection<E> extends MyCollection<E>, GroupOperation<E> { }
| [
"[email protected]"
] | |
cc817a937f1e347b2d68baae77fb4a9411a0b5fd | ba7d5ae16a046dca8659c56022291c72cc4c889e | /cql0410/app/src/main/java/com/bawei/cql0410/Mypath.java | 7de9ed1db3a17518f1f92d8691df67dea40b2a1d | [] | no_license | SmallYellowDuck/cql- | 0eb0be0d8b229f2a556b4155081d7be304ba8b7e | bd2e1e7cad7279f3470dabccf16d936f8ee14110 | refs/heads/master | 2021-01-19T08:59:04.346676 | 2017-04-10T13:04:06 | 2017-04-10T13:04:06 | 87,705,148 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,325 | java | package com.bawei.cql0410;
/**
* 作者:程千浪
* .时间:2017/4/10 19:02
* 类用途:
*/
public class Mypath {
public static final String gj="http://result.eolinker.com/k2BaduF2a6caa275f395919a66ab1dfe4b584cc60685573?uri=gj";
public static final String ss="http://result.eolinker.com/k2BaduF2a6caa275f395919a66ab1dfe4b584cc60685573?uri=ss";
public static final String cj="http://result.eolinker.com/k2BaduF2a6caa275f395919a66ab1dfe4b584cc60685573?uri=cj";
public static final String kj="http://result.eolinker.com/k2BaduF2a6caa275f395919a66ab1dfe4b584cc60685573?uri=kj";
public static final String js="http://result.eolinker.com/k2BaduF2a6caa275f395919a66ab1dfe4b584cc60685573?uri=js";
public static final String ty="http://result.eolinker.com/k2BaduF2a6caa275f395919a66ab1dfe4b584cc60685573?uri=ty";
public static final String yl="http://result.eolinker.com/k2BaduF2a6caa275f395919a66ab1dfe4b584cc60685573?uri=yl";
public static final String gn="http://result.eolinker.com/k2BaduF2a6caa275f395919a66ab1dfe4b584cc60685573?uri=gn";
public static final String shehui="http://result.eolinker.com/k2BaduF2a6caa275f395919a66ab1dfe4b584cc60685573?uri=shehui";
public static final String tt="http://result.eolinker.com/k2BaduF2a6caa275f395919a66ab1dfe4b584cc60685573?uri=tt";
}
| [
"[email protected]"
] | |
a2122df5d96830511f4ee9a1fa91d72d5ffcd368 | e6649b63da857b9b6a8acae8ca706487923d122c | /src/main/java/com/cyssxt/tomato/constant/ContentTypeConstant.java | 34242bb961d0fce539b39cd75496282d4aac3f49 | [] | no_license | cyssxt/tomato | b5ec0877a15f50955b1c3bb1a7d9358e9e159e81 | 315017d7b7bd718925c90648a7494515b4bb5f1e | refs/heads/master | 2020-08-08T09:33:57.040430 | 2019-10-09T03:04:24 | 2019-10-09T03:04:24 | 213,805,575 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 913 | java | package com.cyssxt.tomato.constant;
public enum ContentTypeConstant {
TODO((byte)0,"待办"),
PROJECT((byte)1,"项目"),
DUTY((byte)2,"责任"),
LOG((byte)3,"日志"),
INBOX((byte)-1,"收件箱"),
NOPARENT((byte)-2,"没有父待办"),
TAG((byte)4, "标签"), USRLOG((byte)5, "用户日志");
private Byte value;
private String msg;
ContentTypeConstant(Byte value, String msg) {
this.value = value;
this.msg = msg;
}
public Byte getValue() {
return value;
}
public void setValue(Byte value) {
this.value = value;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public boolean compare(Byte type) {
if(type!=null && type.byteValue()==this.getValue().byteValue()){
return true;
}
return false;
}
}
| [
"[email protected]"
] | |
bf34aba5970c77084d9396b0febb19e27b428434 | 366cfc1e71b2baf732f62fc134d04a503134cb62 | /app/src/main/java/footprint/baixing/com/footprint/api/BaseApi.java | 961750f9b680ad9ae805680b3b3332875f3f3323 | [] | no_license | tracyzmq/FootPrint | 4d9f92bd8ed894fef9b398f2da7c68ed10d5ba3f | d44f196e69bf7507119d30514a2dbb214744b2f1 | refs/heads/master | 2021-01-10T20:24:55.371419 | 2015-07-29T16:41:40 | 2015-07-29T16:41:40 | 39,698,699 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,509 | java | package footprint.baixing.com.footprint.api;
import android.content.Context;
import android.content.SharedPreferences;
import android.text.TextUtils;
import android.util.Log;
import com.android.volley.NetworkResponse;
import com.android.volley.ParseError;
import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.toolbox.HttpHeaderParser;
import com.android.volley.toolbox.RequestFuture;
import com.android.volley.toolbox.StringRequest;
import com.android.volley.toolbox.Volley;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ExecutionException;
public class BaseApi {
public static String hosturl = "http://120.25.151.196/footprint";
public static String COOKIES = "cookies";
public static boolean bShowlog = true;
public static String getHost() {return hosturl;}
public static void setHost(String url) {hosturl = url;}
private static String json;
public static String postCommand(final Context context, String apiname, final Map<String, String> params) {
RequestQueue mQueue = Volley.newRequestQueue(context);
RequestFuture<String> future = RequestFuture.newFuture();
StringRequest stringRequest = new StringRequest(Request.Method.POST, getHost() + apiname, future, future) {
@Override
protected Map<String, String> getParams() {
if(bShowlog) {
Log.e("footprint",params.toString());
}
return params;
}
@Override
protected Response<String> parseNetworkResponse(
NetworkResponse response) {
try {
Map<String, String> responseHeaders = response.headers;
String rawCookies = responseHeaders.get("Set-Cookie");
if(!TextUtils.isEmpty(rawCookies)) {
SharedPreferences sp = context.getSharedPreferences(COOKIES, 0);
SharedPreferences.Editor editor = sp.edit();
editor.putString(COOKIES, rawCookies);
editor.commit();
}
String dataString = new String(response.data, "UTF-8");
if(bShowlog) {
Log.e("footprint",(rawCookies==null)?"":rawCookies);
Log.e("footprint",(dataString==null)?"":dataString);
}
return Response.success(dataString, HttpHeaderParser.parseCacheHeaders(response));
} catch (UnsupportedEncodingException e) {
return Response.error(new ParseError(e));
}
}
public Map<String, String> getHeaders() {
HashMap localHashMap = new HashMap();
String cookies = context.getSharedPreferences(COOKIES, 0).getString(COOKIES,"");
localHashMap.put("Cookie", cookies);
if(bShowlog) {
Log.e("footprint", localHashMap.toString());
}
return localHashMap;
}
};
String result = "";
if(bShowlog) {
Log.e("footprint",stringRequest.toString());
}
mQueue.add(stringRequest);
try {
result = future.get(); // this will block
} catch (InterruptedException e) {
e.printStackTrace();
// exception handling
} catch (ExecutionException e) {
e.printStackTrace();
// exception handling
}
return result;
}
public static String getCommand(final Context context, String apiname, final Map<String,String> params) {
RequestQueue mQueue = Volley.newRequestQueue(context);
RequestFuture<String> future = RequestFuture.newFuture();
StringRequest stringRequest = new StringRequest(Request.Method.GET, getHost() + apiname + "?" + getFormatParams(params), future, future) {
@Override
protected Response<String> parseNetworkResponse(
NetworkResponse response) {
try {
Map<String, String> responseHeaders = response.headers;
String rawCookies = responseHeaders.get("Set-Cookie");
if(!TextUtils.isEmpty(rawCookies)) {
SharedPreferences sp = context.getSharedPreferences(COOKIES, 0);
SharedPreferences.Editor editor = sp.edit();
editor.putString(COOKIES, rawCookies);
editor.commit();
}
String dataString = new String(response.data, "UTF-8");
if(bShowlog) {
Log.e("footprint",rawCookies==null?"":rawCookies);
Log.e("footprint",dataString==null?"":dataString);
}
return Response.success(dataString, HttpHeaderParser.parseCacheHeaders(response));
} catch (UnsupportedEncodingException e) {
return Response.error(new ParseError(e));
}
}
public Map<String, String> getHeaders() {
HashMap localHashMap = new HashMap();
String cookies = context.getSharedPreferences(COOKIES, 0).getString(COOKIES,"");
localHashMap.put("Cookie", cookies);
if(bShowlog) {
Log.e("footprint", localHashMap.toString());
}
return localHashMap;
}
};
String result = "";
if(bShowlog) {
Log.e("footprint",stringRequest.toString());
}
mQueue.add(stringRequest);
try {
result = future.get(); // this will block
} catch (InterruptedException e) {
// exception handling
} catch (ExecutionException e) {
// exception handling
}
return result;
}
public static String getFormatParams(Map<String,String> parameters) {
Map<String, String> params = parameters;//.getParams();
if (params == null || params.isEmpty()) {
return null;
}
StringBuilder query = new StringBuilder();
boolean hasParam = false;
List<String> keyList = new ArrayList<String>(params.keySet());
Collections.sort(keyList);
for (String key : keyList) {
String name = key;
String value = params.get(key);
if (!TextUtils.isEmpty(name) && !TextUtils.isEmpty(value)) {
if (hasParam) {
query.append("&");
} else {
hasParam = true;
}
String encodedName = "";
String encodedValue = "";//URLEncoder.encode(value);
try {
encodedName = URLEncoder.encode(name);
encodedValue = URLEncoder.encode(value);//URLEncoder.encode(value, charset);//
} catch (Throwable e) {
}
query.append(encodedName).append("=").append(encodedValue);
}
}
return query.toString();
}
}
| [
"[email protected]"
] | |
92c92a7757284a7210ce5a2640511e8a5a936b0b | bda9ffc21f8af265212ab16fbd188d95884025bb | /05_QuickSort/QuickSort.java | 136e189de7da4aed24c7ad25d29eeed5f3c9bf35 | [] | no_license | yarncha/2019_Algorithm | eb02b641bcb0643394148cd131d666df7ac6b337 | e17218f9dacdf96a7e49168a703df2de3b034f1e | refs/heads/master | 2020-08-21T11:45:42.122263 | 2019-12-09T16:31:24 | 2019-12-09T16:31:24 | 216,152,626 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,261 | java | import java.io.*;
import java.util.ArrayList;
import java.util.Random;
public class QuickSort {
public static void main(String[] args) throws IOException {
String inputFileName = "data05.txt";
//입력 파일의 이름
BufferedReader reader = new BufferedReader(new FileReader(inputFileName));
ArrayList<Integer> array = new ArrayList<>();
String readLine = reader.readLine();
String[] temp = readLine.split(",");
for (int i = 0; i < temp.length; i++) {
array.add(Integer.parseInt(temp[i]));
}
//파일을 읽어 배열에 저장한다.
ArrayList<Integer> arrayForRandom = (ArrayList<Integer>) array.clone();
FileWriter fw = new FileWriter("hw05_05_201701992_data05_quick.txt");
quickSort(array, 0, array.size() - 1);
fw.write(trimmingArray(array));
fw.close();
//QuickSort
FileWriter fw2 = new FileWriter("hw05_05_201701992_data05_quickRandom.txt");
quickSort_withRandom(arrayForRandom, 0, arrayForRandom.size() - 1);
fw2.write(trimmingArray(arrayForRandom));
fw2.close();
//QuickSort_withRandom
}
//---출력값을 다듬어주는 메소드---
public static String trimmingArray(ArrayList<Integer> inputArray) {
String result = inputArray.toString();
result = result.replace(" ", "");
result = result.replace("[", "");
result = result.replace("]", "");
//공백 없애주고 앞뒤의 []없애줌.
return result;
}
//---배열에서 두 원소의 위치를 바꾸는 메소드---
private static void swap(ArrayList<Integer> inputArray, int target01, int target02) {
if (target01 != target02) {
int temp = inputArray.get(target01);
inputArray.set(target01, inputArray.get(target02));
inputArray.set(target02, temp);
}
}
//---기본적인 Partition 알고리즘을 사용한 QuickSort---
public static void quickSort(ArrayList<Integer> inputArray, int startIndex, int endIndex) {
if (startIndex < endIndex) {
//재귀의 종료 조건은 startIndex와 endIndex가 같은 경우이다.(즉 정렬하고자 하는 배열에 원소가 없을 경우)
int midIndex = partition(inputArray, startIndex, endIndex);
//전체 array에서 endIndex값 기준으로 작은 원소, 큰 원소로 나눈다. 그리고 그 값을 나눠진 가운데로 옮긴 다음 그 인덱스를 midIndex에 넣는다.
quickSort(inputArray, startIndex, midIndex - 1);
//작은 쪽(왼쪽)을 같은 방식으로 정렬한다.
quickSort(inputArray, midIndex + 1, endIndex);
//큰 쪽(오른쪽)을 같은 방식으로 정렬한다.
}
}
//---기본적인 partition 알고리즘. endIndex에 있는 값을 기준으로 작은 값과 큰 값을 구분하고 그 경계선에 endIndex값을 둔 뒤 그 위치를 리턴한다.---
private static int partition(ArrayList<Integer> inputArray, int startIndex, int endIndex) {
int i = startIndex - 1;
int j = startIndex;
for (; j < endIndex; j++) {
//j는 한 칸씩 진행한다.
if (inputArray.get(j) < inputArray.get(endIndex)) {
//endIndex에 위치한 값을 기준으로 정하고 이 값보다 j가 작을 경우
i++;
swap(inputArray, i, j);
//앞 부분부터 그 작은 값들을 채운다. i는 이 앞부분을 세는 인덱스
}
}
//그렇게 반복이 끝나고 나면 중간값을 기준으로 반반씩 작은 원소와 큰 원소로 정렬되어 있고
i++;
swap(inputArray, i, endIndex);
//작은 값들 끝에 그 중간값을 넣어주면 i를 기준으로 정렬이 완료된다. 이 i를 리턴한다.
return i;
}
//---partition부분이 random값을 3개 뽑아 정렬하는 quickSort---
public static void quickSort_withRandom(ArrayList<Integer> inputArray, int startIndex, int endIndex) {
if (startIndex < endIndex) {
//재귀의 종료 조건은 startIndex와 endIndex가 같은 경우이다.(즉 정렬하고자 하는 배열에 원소가 없을 경우)
int midIndex = randomizedPartition(inputArray, startIndex, endIndex);
//전체 array에서 endIndex값 기준으로 작은 원소, 큰 원소로 나눈다. 그리고 그 값을 나눠진 가운데로 옮긴 다음 그 인덱스를 midIndex에 넣는다.
quickSort(inputArray, startIndex, midIndex - 1);
//작은 쪽(왼쪽)을 같은 방식으로 정렬한다.
quickSort(inputArray, midIndex + 1, endIndex);
//큰 쪽(오른쪽)을 같은 방식으로 정렬한다.
}
}
//---랜덤 값을 뽑아 partition을 수행하는 메소드---
private static int randomizedPartition(ArrayList<Integer> inputArray, int startIndex, int endIndex) {
if ((endIndex - startIndex) > 1) {
//원소가 3개 이상일 때만 수행한다.
int randomMid = randomIndex(inputArray, startIndex, endIndex);
swap(inputArray, randomMid, endIndex);
}
//해당 범위에서 임의의 인덱스 3개를 뽑고 그 중 중간값을 구해서 그 중간값을 기준으로 나눌 수 있도록 endIndex에 둔다.
return partition(inputArray, startIndex, endIndex);
}
//---해당 범위 안에서 임의의 원소 3개를 뽑고 중간값을 구해 리턴하는 메소드---
private static int randomIndex(ArrayList<Integer> inputArray, int startIndex, int endIndex) {
Random random = new Random();
int value1 = random.nextInt(endIndex - startIndex + 1) + startIndex;
int value2 = random.nextInt(endIndex - startIndex + 1) + startIndex;
while (value1 == value2) {
value2 = random.nextInt(endIndex - startIndex + 1) + startIndex;
}
int value3 = random.nextInt(endIndex - startIndex + 1) + startIndex;
while (value1 == value3) {
value3 = random.nextInt(endIndex - startIndex + 1) + startIndex;
}
while (value2 == value3) {
value3 = random.nextInt(endIndex - startIndex + 1) + startIndex;
}
//랜덤으로 중복을 제외하고 3개의 인덱스를 뽑고
if (inputArray.get(value1) < inputArray.get(value2)) {
if (inputArray.get(value1) > inputArray.get(value3)) {
return value1;
} else {
if (inputArray.get(value2) < inputArray.get(value3)) {
return value2;
} else {
return value3;
}
}
} else {
if (inputArray.get(value1) < inputArray.get(value3)) {
return value1;
} else {
if (inputArray.get(value2) > inputArray.get(value3)) {
return value2;
} else {
return value3;
}
}
}
//그 중에서 가운데 값의 인덱스를 찾아 리턴한다.
}
}
| [
"[email protected]"
] | |
03da8ac3525f1f9374493607f0f8cc0162433049 | db71a157723b7734b12a680065827af80edb51c1 | /silubium-crypto/src/main/java/org/jhblockchain/crypto/bip39/MnemonicException.java | be74c9416c73563f0d16a12e3a751ecc67105b5a | [] | no_license | SilubiumProject/silubium-java-lib | 81936134f1a0668b2bf79b6acb9fb6df5ea0432f | 4c7270c9eb554df466bc1cbcfa203f1cf0e7a6ba | refs/heads/master | 2022-10-25T23:08:38.295257 | 2019-10-07T07:54:01 | 2019-10-07T07:54:01 | 160,816,796 | 2 | 1 | null | 2022-10-04T23:50:35 | 2018-12-07T11:46:02 | Java | UTF-8 | Java | false | false | 1,889 | java | /*
*
* * Copyright 2014 http://Bither.net
* *
* * 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.jhblockchain.crypto.bip39;
/**
* Exceptions thrown by the MnemonicCode module.
*/
@SuppressWarnings("serial")
public class MnemonicException extends Exception {
public MnemonicException() {
super();
}
public MnemonicException(String msg) {
super(msg);
}
/**
* Thrown when an argument to MnemonicCode is the wrong length.
*/
public static class MnemonicLengthException extends MnemonicException {
public MnemonicLengthException(String msg) {
super(msg);
}
}
/**
* Thrown when a list of MnemonicCode words fails the checksum check.
*/
public static class MnemonicChecksumException extends MnemonicException {
public MnemonicChecksumException() {
super();
}
}
/**
* Thrown when a word is encountered which is not in the MnemonicCode's word list.
*/
public static class MnemonicWordException extends MnemonicException {
/**
* Contains the word that was not found in the word list.
*/
public final String badWord;
public MnemonicWordException(String badWord) {
super();
this.badWord = badWord;
}
}
}
| [
"[email protected]"
] | |
cdebf0620a7f21a676f63649e1095ab67b403e81 | d486f3a537b9d5ba8709ac95ec2e06af8719feae | /app/src/main/java/com/gts/coordinator/Model/ContractorData/WalateRechage/PostRechargeWalateDetail.java | b258e406019c16ea1e69803ace588b8fcda2403d | [] | no_license | thisisdevesh/vendorApplication | 0fc0c98fd05003bbc8616fe7a60eba6bdca8222e | 4d6ff56c885ae8a30ed9e197084ebc6cae2fcb67 | refs/heads/main | 2023-07-07T07:39:38.187381 | 2021-08-10T16:06:45 | 2021-08-10T16:06:45 | 394,704,535 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 396 | java | package com.gts.coordinator.Model.ContractorData.WalateRechage;
import com.google.gson.annotations.SerializedName;
public class PostRechargeWalateDetail {
@SerializedName("cont_id")
long cont_id;
@SerializedName("amount")
double amount;
public PostRechargeWalateDetail(long cont_id, double amount) {
this.cont_id = cont_id;
this.amount = amount;
}
}
| [
"[email protected]"
] | |
44db2655bce5a932da05210d6b059196cdeea790 | 45718a814e6b0d325672916b1a8f9f3f33ccf573 | /app/src/test/java/com/example/rp/navigation/ExampleUnitTest.java | 3f037a13dc9a8b3908d8e21d28516bf99c44b756 | [] | no_license | rajacsp/energymobile11 | 1f0308b4ce04f984e1afcd0eacc606afd2426b57 | 7f44d9eb80875e06efc67e7527c339c1fda023f8 | refs/heads/master | 2021-01-23T21:22:19.932551 | 2016-09-18T00:58:59 | 2016-09-18T00:58:59 | 68,486,305 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 318 | java | package com.example.rp.navigation;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* To work on unit tests, switch the Test Artifact in the Build Variants view.
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"[email protected]"
] | |
a978f4eaeda244b9bddf1c53d9e8a038098099f4 | a440d8a3361d1a27d839a753e94fce20ceafeb8f | /Lab4/src/ch/zhaw/lab4/NearbyFragment.java | 76826f1d4d6e1f10922c7a74085db17cda79b8fd | [] | no_license | knobli/summerschool_2013 | 0fb9abb48fa24e894d7ea559b4a5f91bf238152c | 154ddd87685ed5961bf3d86c73afb5d7c4c5fa9c | refs/heads/master | 2020-05-19T16:54:21.633816 | 2013-07-22T13:51:17 | 2013-07-22T13:51:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,859 | java | package ch.zhaw.lab4;
import java.util.List;
import android.content.Context;
import android.location.Location;
import android.location.LocationManager;
import android.os.Bundle;
import android.support.v4.app.ListFragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;
import android.widget.Toast;
import ch.zhaw.lab4.adapters.VenueAdapter;
import ch.zhaw.lab4.model.Venue;
import ch.zhaw.lab4.tasks.FoursquareAPITask;
import ch.zhaw.lab4.tasks.FoursquareIconTask;
import com.google.android.gms.maps.model.LatLng;
public class NearbyFragment extends ListFragment {
static final LatLng MELBOURNE = new LatLng(-37.81319, 144.96298);
private List<Venue> venues;
private ListView venueList;
private LayoutInflater layoutInflater;
private FoursquareIconTask imgFetcher;
public NearbyFragment() {
super();
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.nearby,container, false);
this.layoutInflater = inflater;
this.venueList = (ListView) view.findViewById(android.R.id.list);
this.imgFetcher = new FoursquareIconTask(getActivity());
LocationManager lm = (LocationManager) getActivity().getSystemService(Context.LOCATION_SERVICE);
Location location = lm.getLastKnownLocation(LocationManager.GPS_PROVIDER);
LatLng coordinates;
if (location != null){
double lat = (double) location.getLatitude();
double lon = (double) location.getLongitude();
coordinates = new LatLng(lat, lon);
} else {
Toast.makeText(getActivity(), "No location found: Use default location", Toast.LENGTH_LONG).show();
coordinates = MELBOURNE;
}
FoursquareAPITask fsTask = new FoursquareAPITask(this);
try{
fsTask.execute(((Double)coordinates.latitude).toString() + "," + ((Double)coordinates.longitude).toString());
} catch (Exception e){
fsTask.cancel(true);
alert("No Tracks");
}
// final Object[] data = (Object[]) getLastNonConfigurationInstance();
// if(data != null){
// this.venues = (ArrayList<Venue>) data[0];
// this.imgFetcher = (FoursquareIconTask) data[1];
// venueList.setAdapter(new VenueAdapter(this,this.imgFetcher,this.layoutInflater,this.venues));
// }
return view;
}
public void createList(){
}
public void alert(String msg){
Toast.makeText(getActivity(), msg, Toast.LENGTH_LONG).show();
}
@Override
public void onListItemClick(ListView l, View v, int position, long id) {
// TODO Auto-generated method stub
super.onListItemClick(l, v, position, id);
}
public void setVenues(List<Venue> venues){
this.venues = venues;
VenueAdapter adapter = new VenueAdapter(this,this.imgFetcher,this.layoutInflater,this.venues);
this.venueList.setAdapter(adapter);
}
}
| [
"[email protected]"
] | |
415d2e15f1803c1a085378ef586d185510156b90 | 5741045375dcbbafcf7288d65a11c44de2e56484 | /reddit-decompilada/kotlin/reflect/jvm/internal/impl/util/Check.java | dc9ec51c5cb51f728b8ba909c3097f826d229be5 | [] | no_license | miarevalo10/ReporteReddit | 18dd19bcec46c42ff933bb330ba65280615c281c | a0db5538e85e9a081bf268cb1590f0eeb113ed77 | refs/heads/master | 2020-03-16T17:42:34.840154 | 2018-05-11T10:16:04 | 2018-05-11T10:16:04 | 132,843,706 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 727 | java | package kotlin.reflect.jvm.internal.impl.util;
import kotlin.jvm.internal.Intrinsics;
import kotlin.reflect.jvm.internal.impl.descriptors.FunctionDescriptor;
/* compiled from: modifierChecks.kt */
public interface Check {
/* compiled from: modifierChecks.kt */
public static final class DefaultImpls {
public static String m28076a(Check check, FunctionDescriptor functionDescriptor) {
Intrinsics.m26847b(functionDescriptor, "functionDescriptor");
return check.mo5944a(functionDescriptor) == null ? check.mo5943a() : null;
}
}
String mo5943a();
boolean mo5944a(FunctionDescriptor functionDescriptor);
String mo5945b(FunctionDescriptor functionDescriptor);
}
| [
"[email protected]"
] | |
877156015e3ffc1f2c9db49eeecda68fe7f56744 | 7a358470758be6ab8804d06fb2a0c027d8cfeadc | /engine/src/main/java/org/hibernate/validator/internal/engine/AbstractConfigurationImpl.java | cdb352f5575af826b4d2529c25ebe717b95cdb06 | [
"LicenseRef-scancode-dco-1.1",
"Apache-2.0"
] | permissive | roger-jm/hibernate-validator | 35a9542e02b236859ddde60125dfccb67ccad81d | db390aabe455727bd9397499192929c7ec8fcb0d | refs/heads/master | 2023-01-08T20:35:32.520188 | 2020-10-31T14:30:09 | 2020-11-09T15:59:59 | 308,893,895 | 0 | 0 | NOASSERTION | 2020-10-31T14:32:57 | 2020-10-31T13:58:28 | null | UTF-8 | Java | false | false | 29,015 | java | /*
* Hibernate Validator, declare and validate application constraints
*
* License: Apache License, Version 2.0
* See the license.txt file in the root directory or <http://www.apache.org/licenses/LICENSE-2.0>.
*/
package org.hibernate.validator.internal.engine;
import static org.hibernate.validator.internal.util.CollectionHelper.newHashSet;
import static org.hibernate.validator.internal.util.logging.Messages.MESSAGES;
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.lang.invoke.MethodHandles;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.time.Duration;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import jakarta.validation.BootstrapConfiguration;
import jakarta.validation.ClockProvider;
import jakarta.validation.ConstraintValidatorFactory;
import jakarta.validation.MessageInterpolator;
import jakarta.validation.ParameterNameProvider;
import jakarta.validation.TraversableResolver;
import jakarta.validation.ValidationProviderResolver;
import jakarta.validation.ValidatorFactory;
import jakarta.validation.spi.BootstrapState;
import jakarta.validation.spi.ConfigurationState;
import jakarta.validation.spi.ValidationProvider;
import jakarta.validation.valueextraction.ValueExtractor;
import org.hibernate.validator.BaseHibernateValidatorConfiguration;
import org.hibernate.validator.cfg.ConstraintMapping;
import org.hibernate.validator.internal.cfg.context.DefaultConstraintMapping;
import org.hibernate.validator.internal.engine.constraintvalidation.ConstraintValidatorFactoryImpl;
import org.hibernate.validator.internal.engine.resolver.TraversableResolvers;
import org.hibernate.validator.internal.engine.valueextraction.ValueExtractorDescriptor;
import org.hibernate.validator.internal.engine.valueextraction.ValueExtractorManager;
import org.hibernate.validator.internal.properties.DefaultGetterPropertySelectionStrategy;
import org.hibernate.validator.internal.properties.javabean.JavaBeanHelper;
import org.hibernate.validator.internal.util.CollectionHelper;
import org.hibernate.validator.internal.util.Contracts;
import org.hibernate.validator.internal.util.Version;
import org.hibernate.validator.internal.util.logging.Log;
import org.hibernate.validator.internal.util.logging.LoggerFactory;
import org.hibernate.validator.internal.util.privilegedactions.GetClassLoader;
import org.hibernate.validator.internal.util.privilegedactions.GetInstancesFromServiceLoader;
import org.hibernate.validator.internal.util.privilegedactions.SetContextClassLoader;
import org.hibernate.validator.internal.util.stereotypes.Lazy;
import org.hibernate.validator.internal.xml.config.ValidationBootstrapParameters;
import org.hibernate.validator.internal.xml.config.ValidationXmlParser;
import org.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator;
import org.hibernate.validator.metadata.BeanMetaDataClassNormalizer;
import org.hibernate.validator.resourceloading.PlatformResourceBundleLocator;
import org.hibernate.validator.spi.messageinterpolation.LocaleResolver;
import org.hibernate.validator.spi.nodenameprovider.PropertyNodeNameProvider;
import org.hibernate.validator.spi.properties.GetterPropertySelectionStrategy;
import org.hibernate.validator.spi.resourceloading.ResourceBundleLocator;
import org.hibernate.validator.spi.scripting.ScriptEvaluatorFactory;
/**
* Hibernate specific {@code Configuration} implementation.
*
* @author Emmanuel Bernard
* @author Hardy Ferentschik
* @author Gunnar Morling
* @author Kevin Pollet <[email protected]> (C) 2011 SERLI
* @author Chris Beckey <[email protected]>
* @author Guillaume Smet
*/
public abstract class AbstractConfigurationImpl<T extends BaseHibernateValidatorConfiguration<T>>
implements BaseHibernateValidatorConfiguration<T>, ConfigurationState {
static {
Version.touch();
}
private static final Log LOG = LoggerFactory.make( MethodHandles.lookup() );
/**
* Built lazily so RBMI and its dependency on EL is only initialized if actually needed
*/
@Lazy
private ResourceBundleLocator defaultResourceBundleLocator;
@Lazy
private MessageInterpolator defaultMessageInterpolator;
@Lazy
private MessageInterpolator messageInterpolator;
/**
* Created lazily to avoid fishing in the classpath if one has been defined.
*/
@Lazy
private TraversableResolver defaultTraversableResolver;
private final ConstraintValidatorFactory defaultConstraintValidatorFactory;
private final ParameterNameProvider defaultParameterNameProvider;
private final ClockProvider defaultClockProvider;
private final PropertyNodeNameProvider defaultPropertyNodeNameProvider;
private ValidationProviderResolver providerResolver;
private final ValidationBootstrapParameters validationBootstrapParameters;
private boolean ignoreXmlConfiguration = false;
private final Set<InputStream> configurationStreams = newHashSet();
private BootstrapConfiguration bootstrapConfiguration;
private final Map<ValueExtractorDescriptor.Key, ValueExtractorDescriptor> valueExtractorDescriptors = new HashMap<>();
// HV-specific options
private final Set<DefaultConstraintMapping> programmaticMappings = newHashSet();
private boolean failFast;
private ClassLoader externalClassLoader;
private final MethodValidationConfiguration.Builder methodValidationConfigurationBuilder = new MethodValidationConfiguration.Builder();
private boolean traversableResolverResultCacheEnabled = true;
private ScriptEvaluatorFactory scriptEvaluatorFactory;
private Duration temporalValidationTolerance;
private Object constraintValidatorPayload;
private GetterPropertySelectionStrategy getterPropertySelectionStrategy;
private Set<Locale> locales = Collections.emptySet();
private Locale defaultLocale = Locale.getDefault();
private LocaleResolver localeResolver;
private BeanMetaDataClassNormalizer beanMetaDataClassNormalizer;
protected AbstractConfigurationImpl(BootstrapState state) {
this();
if ( state.getValidationProviderResolver() == null ) {
this.providerResolver = state.getDefaultValidationProviderResolver();
}
else {
this.providerResolver = state.getValidationProviderResolver();
}
}
protected AbstractConfigurationImpl(ValidationProvider<?> provider) {
this();
if ( provider == null ) {
throw LOG.getInconsistentConfigurationException();
}
this.providerResolver = null;
validationBootstrapParameters.setProvider( provider );
}
private AbstractConfigurationImpl() {
this.validationBootstrapParameters = new ValidationBootstrapParameters();
this.defaultConstraintValidatorFactory = new ConstraintValidatorFactoryImpl();
this.defaultParameterNameProvider = new DefaultParameterNameProvider();
this.defaultClockProvider = DefaultClockProvider.INSTANCE;
this.defaultPropertyNodeNameProvider = new DefaultPropertyNodeNameProvider();
}
@Override
public final T ignoreXmlConfiguration() {
ignoreXmlConfiguration = true;
return thisAsT();
}
@Override
public final T messageInterpolator(MessageInterpolator interpolator) {
if ( LOG.isDebugEnabled() ) {
if ( interpolator != null ) {
LOG.debug( "Setting custom MessageInterpolator of type " + interpolator.getClass().getName() );
}
}
this.validationBootstrapParameters.setMessageInterpolator( interpolator );
return thisAsT();
}
@Override
public final T traversableResolver(TraversableResolver resolver) {
if ( LOG.isDebugEnabled() ) {
if ( resolver != null ) {
LOG.debug( "Setting custom TraversableResolver of type " + resolver.getClass().getName() );
}
}
this.validationBootstrapParameters.setTraversableResolver( resolver );
return thisAsT();
}
@Override
public final T enableTraversableResolverResultCache(boolean enabled) {
this.traversableResolverResultCacheEnabled = enabled;
return thisAsT();
}
public final boolean isTraversableResolverResultCacheEnabled() {
return traversableResolverResultCacheEnabled;
}
@Override
public final T constraintValidatorFactory(ConstraintValidatorFactory constraintValidatorFactory) {
if ( LOG.isDebugEnabled() ) {
if ( constraintValidatorFactory != null ) {
LOG.debug(
"Setting custom ConstraintValidatorFactory of type " + constraintValidatorFactory.getClass()
.getName()
);
}
}
this.validationBootstrapParameters.setConstraintValidatorFactory( constraintValidatorFactory );
return thisAsT();
}
@Override
public T parameterNameProvider(ParameterNameProvider parameterNameProvider) {
if ( LOG.isDebugEnabled() ) {
if ( parameterNameProvider != null ) {
LOG.debug(
"Setting custom ParameterNameProvider of type " + parameterNameProvider.getClass()
.getName()
);
}
}
this.validationBootstrapParameters.setParameterNameProvider( parameterNameProvider );
return thisAsT();
}
@Override
public T clockProvider(ClockProvider clockProvider) {
if ( LOG.isDebugEnabled() ) {
if ( clockProvider != null ) {
LOG.debug( "Setting custom ClockProvider of type " + clockProvider.getClass().getName() );
}
}
this.validationBootstrapParameters.setClockProvider( clockProvider );
return thisAsT();
}
@Override
public T propertyNodeNameProvider(PropertyNodeNameProvider propertyNodeNameProvider) {
if ( LOG.isDebugEnabled() ) {
if ( propertyNodeNameProvider != null ) {
LOG.debug( "Setting custom PropertyNodeNameProvider of type " + propertyNodeNameProvider.getClass()
.getName() );
}
}
this.validationBootstrapParameters.setPropertyNodeNameProvider( propertyNodeNameProvider );
return thisAsT();
}
@Override
public T localeResolver(LocaleResolver localeResolver) {
if ( LOG.isDebugEnabled() ) {
if ( localeResolver != null ) {
LOG.debug( "Setting custom LocaleResolver of type " + localeResolver.getClass()
.getName() );
}
}
this.localeResolver = localeResolver;
return thisAsT();
}
@Override
public T addValueExtractor(ValueExtractor<?> extractor) {
Contracts.assertNotNull( extractor, MESSAGES.parameterMustNotBeNull( "extractor" ) );
ValueExtractorDescriptor descriptor = new ValueExtractorDescriptor( extractor );
ValueExtractorDescriptor previous = valueExtractorDescriptors.put( descriptor.getKey(), descriptor );
if ( previous != null ) {
throw LOG.getValueExtractorForTypeAndTypeUseAlreadyPresentException( extractor, previous.getValueExtractor() );
}
if ( LOG.isDebugEnabled() ) {
LOG.debug( "Adding value extractor " + extractor );
}
return thisAsT();
}
@Override
public final T addMapping(InputStream stream) {
Contracts.assertNotNull( stream, MESSAGES.inputStreamCannotBeNull() );
validationBootstrapParameters.addMapping( stream.markSupported() ? stream : new BufferedInputStream( stream ) );
return thisAsT();
}
@Override
public final T failFast(boolean failFast) {
this.failFast = failFast;
return thisAsT();
}
@Override
public T allowOverridingMethodAlterParameterConstraint(boolean allow) {
this.methodValidationConfigurationBuilder.allowOverridingMethodAlterParameterConstraint( allow );
return thisAsT();
}
public boolean isAllowOverridingMethodAlterParameterConstraint() {
return this.methodValidationConfigurationBuilder.isAllowOverridingMethodAlterParameterConstraint();
}
@Override
public T allowMultipleCascadedValidationOnReturnValues(boolean allow) {
this.methodValidationConfigurationBuilder.allowMultipleCascadedValidationOnReturnValues( allow );
return thisAsT();
}
public boolean isAllowMultipleCascadedValidationOnReturnValues() {
return this.methodValidationConfigurationBuilder.isAllowMultipleCascadedValidationOnReturnValues();
}
@Override
public T allowParallelMethodsDefineParameterConstraints(boolean allow) {
this.methodValidationConfigurationBuilder.allowParallelMethodsDefineParameterConstraints( allow );
return thisAsT();
}
@Override
public T scriptEvaluatorFactory(ScriptEvaluatorFactory scriptEvaluatorFactory) {
Contracts.assertNotNull( scriptEvaluatorFactory, MESSAGES.parameterMustNotBeNull( "scriptEvaluatorFactory" ) );
this.scriptEvaluatorFactory = scriptEvaluatorFactory;
return thisAsT();
}
@Override
public T temporalValidationTolerance(Duration temporalValidationTolerance) {
Contracts.assertNotNull( temporalValidationTolerance, MESSAGES.parameterMustNotBeNull( "temporalValidationTolerance" ) );
this.temporalValidationTolerance = temporalValidationTolerance.abs();
return thisAsT();
}
@Override
public T constraintValidatorPayload(Object constraintValidatorPayload) {
Contracts.assertNotNull( constraintValidatorPayload, MESSAGES.parameterMustNotBeNull( "constraintValidatorPayload" ) );
this.constraintValidatorPayload = constraintValidatorPayload;
return thisAsT();
}
@Override
public T getterPropertySelectionStrategy(GetterPropertySelectionStrategy getterPropertySelectionStrategy) {
Contracts.assertNotNull( getterPropertySelectionStrategy, MESSAGES.parameterMustNotBeNull( "getterPropertySelectionStrategy" ) );
this.getterPropertySelectionStrategy = getterPropertySelectionStrategy;
return thisAsT();
}
@Override
public T locales(Set<Locale> locales) {
Contracts.assertNotNull( defaultLocale, MESSAGES.parameterMustNotBeNull( "locales" ) );
this.locales = locales;
return thisAsT();
}
@Override
public T defaultLocale(Locale defaultLocale) {
Contracts.assertNotNull( defaultLocale, MESSAGES.parameterMustNotBeNull( "defaultLocale" ) );
this.defaultLocale = defaultLocale;
return thisAsT();
}
public boolean isAllowParallelMethodsDefineParameterConstraints() {
return this.methodValidationConfigurationBuilder.isAllowParallelMethodsDefineParameterConstraints();
}
public MethodValidationConfiguration getMethodValidationConfiguration() {
return this.methodValidationConfigurationBuilder.build();
}
@Override
public final DefaultConstraintMapping createConstraintMapping() {
GetterPropertySelectionStrategy getterPropertySelectionStrategyToUse = null;
if ( getterPropertySelectionStrategy == null ) {
getterPropertySelectionStrategyToUse = new DefaultGetterPropertySelectionStrategy();
}
else {
getterPropertySelectionStrategyToUse = getterPropertySelectionStrategy;
}
return new DefaultConstraintMapping( new JavaBeanHelper( getterPropertySelectionStrategyToUse, defaultPropertyNodeNameProvider ) );
}
@Override
public final T addMapping(ConstraintMapping mapping) {
Contracts.assertNotNull( mapping, MESSAGES.parameterMustNotBeNull( "mapping" ) );
this.programmaticMappings.add( (DefaultConstraintMapping) mapping );
return thisAsT();
}
@Override
public final T addProperty(String name, String value) {
if ( value != null ) {
validationBootstrapParameters.addConfigProperty( name, value );
}
return thisAsT();
}
@Override
public T externalClassLoader(ClassLoader externalClassLoader) {
Contracts.assertNotNull( externalClassLoader, MESSAGES.parameterMustNotBeNull( "externalClassLoader" ) );
this.externalClassLoader = externalClassLoader;
// we need to reset the messageInterpolator field as it might vary depending on the class loader
this.messageInterpolator = null;
return thisAsT();
}
@Override
public final ValidatorFactory buildValidatorFactory() {
loadValueExtractorsFromServiceLoader();
parseValidationXml();
for ( ValueExtractorDescriptor valueExtractorDescriptor : valueExtractorDescriptors.values() ) {
validationBootstrapParameters.addValueExtractorDescriptor( valueExtractorDescriptor );
}
ValidatorFactory factory = null;
try {
if ( isSpecificProvider() ) {
factory = validationBootstrapParameters.getProvider().buildValidatorFactory( this );
}
else {
final Class<? extends ValidationProvider<?>> providerClass = validationBootstrapParameters.getProviderClass();
if ( providerClass != null ) {
for ( ValidationProvider<?> provider : providerResolver.getValidationProviders() ) {
if ( providerClass.isAssignableFrom( provider.getClass() ) ) {
factory = provider.buildValidatorFactory( this );
break;
}
}
if ( factory == null ) {
throw LOG.getUnableToFindProviderException( providerClass );
}
}
else {
List<ValidationProvider<?>> providers = providerResolver.getValidationProviders();
assert providers.size() != 0; // I run therefore I am
factory = providers.get( 0 ).buildValidatorFactory( this );
}
}
}
finally {
// close all input streams opened by this configuration
for ( InputStream in : configurationStreams ) {
try {
in.close();
}
catch (IOException io) {
LOG.unableToCloseInputStream();
}
}
}
return factory;
}
@Override
public final boolean isIgnoreXmlConfiguration() {
return ignoreXmlConfiguration;
}
@Override
public final MessageInterpolator getMessageInterpolator() {
// apply explicitly given MI, otherwise use default one
MessageInterpolator selectedInterpolator = validationBootstrapParameters.getMessageInterpolator();
if ( selectedInterpolator != null ) {
return selectedInterpolator;
}
if ( messageInterpolator == null ) {
messageInterpolator = getDefaultMessageInterpolatorConfiguredWithClassLoader();
}
return messageInterpolator;
}
@Override
public final Set<InputStream> getMappingStreams() {
return validationBootstrapParameters.getMappings();
}
public final boolean getFailFast() {
return failFast;
}
@Override
public final ConstraintValidatorFactory getConstraintValidatorFactory() {
return validationBootstrapParameters.getConstraintValidatorFactory();
}
@Override
public final TraversableResolver getTraversableResolver() {
return validationBootstrapParameters.getTraversableResolver();
}
@Override
public BootstrapConfiguration getBootstrapConfiguration() {
if ( bootstrapConfiguration == null ) {
bootstrapConfiguration = new ValidationXmlParser( externalClassLoader ).parseValidationXml();
}
return bootstrapConfiguration;
}
@Override
public ParameterNameProvider getParameterNameProvider() {
return validationBootstrapParameters.getParameterNameProvider();
}
@Override
public ClockProvider getClockProvider() {
return validationBootstrapParameters.getClockProvider();
}
public PropertyNodeNameProvider getPropertyNodeNameProvider() {
return validationBootstrapParameters.getPropertyNodeNameProvider();
}
public LocaleResolver getLocaleResolver() {
return localeResolver;
}
public ScriptEvaluatorFactory getScriptEvaluatorFactory() {
return scriptEvaluatorFactory;
}
public Duration getTemporalValidationTolerance() {
return temporalValidationTolerance;
}
public Object getConstraintValidatorPayload() {
return constraintValidatorPayload;
}
public GetterPropertySelectionStrategy getGetterPropertySelectionStrategy() {
return getterPropertySelectionStrategy;
}
@Override
public Set<ValueExtractor<?>> getValueExtractors() {
return validationBootstrapParameters.getValueExtractorDescriptors()
.values()
.stream()
.map( ValueExtractorDescriptor::getValueExtractor )
.collect( Collectors.toSet() );
}
@Override
public final Map<String, String> getProperties() {
return validationBootstrapParameters.getConfigProperties();
}
public ClassLoader getExternalClassLoader() {
return externalClassLoader;
}
@Override
public final MessageInterpolator getDefaultMessageInterpolator() {
if ( defaultMessageInterpolator == null ) {
defaultMessageInterpolator = new ResourceBundleMessageInterpolator( getDefaultResourceBundleLocator(), getAllSupportedLocales(),
defaultLocale, ValidatorFactoryConfigurationHelper.determineLocaleResolver( this, this.getProperties(), externalClassLoader ),
preloadResourceBundles() );
}
return defaultMessageInterpolator;
}
@Override
public final TraversableResolver getDefaultTraversableResolver() {
if ( defaultTraversableResolver == null ) {
defaultTraversableResolver = TraversableResolvers.getDefault();
}
return defaultTraversableResolver;
}
@Override
public final ConstraintValidatorFactory getDefaultConstraintValidatorFactory() {
return defaultConstraintValidatorFactory;
}
@Override
public final ResourceBundleLocator getDefaultResourceBundleLocator() {
if ( defaultResourceBundleLocator == null ) {
defaultResourceBundleLocator = new PlatformResourceBundleLocator(
ResourceBundleMessageInterpolator.USER_VALIDATION_MESSAGES, preloadResourceBundles() ? getAllSupportedLocales() : Collections.emptySet() );
}
return defaultResourceBundleLocator;
}
@Override
public ParameterNameProvider getDefaultParameterNameProvider() {
return defaultParameterNameProvider;
}
@Override
public ClockProvider getDefaultClockProvider() {
return defaultClockProvider;
}
@Override
public Set<ValueExtractor<?>> getDefaultValueExtractors() {
return ValueExtractorManager.getDefaultValueExtractors();
}
@Override
public T beanMetaDataClassNormalizer(BeanMetaDataClassNormalizer beanMetaDataClassNormalizer) {
if ( LOG.isDebugEnabled() ) {
if ( beanMetaDataClassNormalizer != null ) {
LOG.debug( "Setting custom BeanMetaDataClassNormalizer of type " + beanMetaDataClassNormalizer.getClass()
.getName() );
}
}
this.beanMetaDataClassNormalizer = beanMetaDataClassNormalizer;
return thisAsT();
}
public BeanMetaDataClassNormalizer getBeanMetaDataClassNormalizer() {
return beanMetaDataClassNormalizer;
}
public final Set<DefaultConstraintMapping> getProgrammaticMappings() {
return programmaticMappings;
}
private boolean isSpecificProvider() {
return validationBootstrapParameters.getProvider() != null;
}
/**
* Tries to check whether a validation.xml file exists and parses it
*/
private void parseValidationXml() {
if ( ignoreXmlConfiguration ) {
LOG.ignoringXmlConfiguration();
if ( validationBootstrapParameters.getTraversableResolver() == null ) {
validationBootstrapParameters.setTraversableResolver( getDefaultTraversableResolver() );
}
if ( validationBootstrapParameters.getConstraintValidatorFactory() == null ) {
validationBootstrapParameters.setConstraintValidatorFactory( defaultConstraintValidatorFactory );
}
if ( validationBootstrapParameters.getParameterNameProvider() == null ) {
validationBootstrapParameters.setParameterNameProvider( defaultParameterNameProvider );
}
if ( validationBootstrapParameters.getClockProvider() == null ) {
validationBootstrapParameters.setClockProvider( defaultClockProvider );
}
if ( validationBootstrapParameters.getPropertyNodeNameProvider() == null ) {
validationBootstrapParameters.setPropertyNodeNameProvider( defaultPropertyNodeNameProvider );
}
}
else {
ValidationBootstrapParameters xmlParameters = new ValidationBootstrapParameters(
getBootstrapConfiguration(), externalClassLoader
);
applyXmlSettings( xmlParameters );
}
}
@SuppressWarnings("rawtypes")
private void loadValueExtractorsFromServiceLoader() {
List<ValueExtractor> valueExtractors = run( GetInstancesFromServiceLoader.action(
externalClassLoader != null ? externalClassLoader : run( GetClassLoader.fromContext() ),
ValueExtractor.class
) );
for ( ValueExtractor<?> valueExtractor : valueExtractors ) {
validationBootstrapParameters.addValueExtractorDescriptor( new ValueExtractorDescriptor( valueExtractor ) );
}
}
private void applyXmlSettings(ValidationBootstrapParameters xmlParameters) {
validationBootstrapParameters.setProviderClass( xmlParameters.getProviderClass() );
if ( validationBootstrapParameters.getMessageInterpolator() == null ) {
if ( xmlParameters.getMessageInterpolator() != null ) {
validationBootstrapParameters.setMessageInterpolator( xmlParameters.getMessageInterpolator() );
}
}
if ( validationBootstrapParameters.getTraversableResolver() == null ) {
if ( xmlParameters.getTraversableResolver() != null ) {
validationBootstrapParameters.setTraversableResolver( xmlParameters.getTraversableResolver() );
}
else {
validationBootstrapParameters.setTraversableResolver( getDefaultTraversableResolver() );
}
}
if ( validationBootstrapParameters.getConstraintValidatorFactory() == null ) {
if ( xmlParameters.getConstraintValidatorFactory() != null ) {
validationBootstrapParameters.setConstraintValidatorFactory(
xmlParameters.getConstraintValidatorFactory()
);
}
else {
validationBootstrapParameters.setConstraintValidatorFactory( defaultConstraintValidatorFactory );
}
}
if ( validationBootstrapParameters.getParameterNameProvider() == null ) {
if ( xmlParameters.getParameterNameProvider() != null ) {
validationBootstrapParameters.setParameterNameProvider( xmlParameters.getParameterNameProvider() );
}
else {
validationBootstrapParameters.setParameterNameProvider( defaultParameterNameProvider );
}
}
if ( validationBootstrapParameters.getClockProvider() == null ) {
if ( xmlParameters.getClockProvider() != null ) {
validationBootstrapParameters.setClockProvider( xmlParameters.getClockProvider() );
}
else {
validationBootstrapParameters.setClockProvider( defaultClockProvider );
}
}
if ( validationBootstrapParameters.getPropertyNodeNameProvider() == null ) {
if ( xmlParameters.getPropertyNodeNameProvider() != null ) {
validationBootstrapParameters.setPropertyNodeNameProvider(
xmlParameters.getPropertyNodeNameProvider() );
}
else {
validationBootstrapParameters.setPropertyNodeNameProvider( defaultPropertyNodeNameProvider );
}
}
for ( ValueExtractorDescriptor valueExtractorDescriptor : xmlParameters.getValueExtractorDescriptors().values() ) {
validationBootstrapParameters.addValueExtractorDescriptor( valueExtractorDescriptor );
}
validationBootstrapParameters.addAllMappings( xmlParameters.getMappings() );
configurationStreams.addAll( xmlParameters.getMappings() );
for ( Map.Entry<String, String> entry : xmlParameters.getConfigProperties().entrySet() ) {
if ( validationBootstrapParameters.getConfigProperties().get( entry.getKey() ) == null ) {
validationBootstrapParameters.addConfigProperty( entry.getKey(), entry.getValue() );
}
}
}
/**
* Returns the default message interpolator, configured with the given user class loader, if present.
*/
private MessageInterpolator getDefaultMessageInterpolatorConfiguredWithClassLoader() {
if ( externalClassLoader != null ) {
PlatformResourceBundleLocator userResourceBundleLocator = new PlatformResourceBundleLocator(
ResourceBundleMessageInterpolator.USER_VALIDATION_MESSAGES,
preloadResourceBundles() ? getAllSupportedLocales() : Collections.emptySet(),
externalClassLoader
);
PlatformResourceBundleLocator contributorResourceBundleLocator = new PlatformResourceBundleLocator(
ResourceBundleMessageInterpolator.CONTRIBUTOR_VALIDATION_MESSAGES,
preloadResourceBundles() ? getAllSupportedLocales() : Collections.emptySet(),
externalClassLoader,
true
);
// Within RBMI, the expression factory implementation is loaded from the TCCL; thus we set the TCCL to the
// given external class loader for this call
final ClassLoader originalContextClassLoader = run( GetClassLoader.fromContext() );
try {
run( SetContextClassLoader.action( externalClassLoader ) );
return new ResourceBundleMessageInterpolator(
userResourceBundleLocator,
contributorResourceBundleLocator,
getAllSupportedLocales(),
defaultLocale,
ValidatorFactoryConfigurationHelper.determineLocaleResolver( this, this.getProperties(), externalClassLoader ),
preloadResourceBundles()
);
}
finally {
run( SetContextClassLoader.action( originalContextClassLoader ) );
}
}
else {
return getDefaultMessageInterpolator();
}
}
private Set<Locale> getAllSupportedLocales() {
if ( locales.isEmpty() ) {
return Collections.singleton( defaultLocale );
}
if ( locales.contains( defaultLocale ) ) {
return locales;
}
Set<Locale> allLocales = CollectionHelper.newHashSet( locales.size() + 1 );
allLocales.addAll( locales );
allLocales.add( defaultLocale );
return allLocales;
}
protected abstract boolean preloadResourceBundles();
@SuppressWarnings("unchecked")
protected T thisAsT() {
return (T) this;
}
/**
* Runs the given privileged action, using a privileged block if required.
* <p>
* <b>NOTE:</b> This must never be changed into a publicly available method to avoid execution of arbitrary
* privileged actions within HV's protection domain.
*/
private static <T> T run(PrivilegedAction<T> action) {
return System.getSecurityManager() != null ? AccessController.doPrivileged( action ) : action.run();
}
}
| [
"[email protected]"
] | |
40611bc6d1c76bb3e6632ea7dc24b79970462a3d | 10c83a199f151d9a54d04c9a5216b7a6fa7783c1 | /barebones/interpreter/CommandPatternLoader.java | 2770f322e38a3e486d3be67e717be3b6ae5800d9 | [] | no_license | jacksonofalltrades/BarebonesEngine | ba60ab69c48bafb69d191dfa9c3d0c491920898b | 4c1902754b52de28fe4a37e024aa9e981d2038db | refs/heads/master | 2020-05-18T16:28:23.812766 | 2010-10-30T02:08:17 | 2010-10-30T02:08:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,707 | java | package barebones.interpreter;
import java.util.AbstractMap;
import java.util.Vector;
import java.util.regex.Pattern;
import barebones.event.DropCommand;
import barebones.event.ExamineCommand;
import barebones.event.GetInventoryCommand;
import barebones.event.GetTimeCommand;
import barebones.event.GiveCommand;
import barebones.event.MoveCommand;
import barebones.event.OpenCommand;
import barebones.event.QuitCommand;
import barebones.event.RestoreCommand;
import barebones.event.SaveCommand;
import barebones.event.TakeCommand;
import barebones.event.UnlockCommand;
/**
* Represents a registry for mappings between patterns and commands
*
* Eventually, this should use some sort of database to retrieve mappings.
* @author dej
*
*/
public class CommandPatternLoader
{
protected String m_rootPath;
protected Vector<AbstractMap.SimpleEntry<PatternSequenceNode, Class<?>>> m_inputCommandList;
protected static AbstractMap.SimpleEntry<PatternSequenceNode, Class<?>> makePatternPair(PatternSequenceNode node, Class<?> c) {
return new AbstractMap.SimpleEntry<PatternSequenceNode, Class<?>>(node, c);
}
protected void addPatternPair(PatternSequenceNode node, Class<?> c) {
AbstractMap.SimpleEntry<PatternSequenceNode, Class<?>> pair =
makePatternPair(node, c);
m_inputCommandList.add(pair);
}
protected static AbstractMap.SimpleEntry<Integer, String> grp(int i, String s) {
return new AbstractMap.SimpleEntry<Integer, String>(i, s);
}
// makeVeryOptional
protected static String m(int minChars, String text)
{
StringBuffer sb = new StringBuffer();
int parenCount = 0;
for(int i = 0; i < text.length(); i++) {
char c = text.charAt(i);
if (i < minChars) {
sb.append(c);
}
else {
sb.append("(?:"+c);
parenCount++;
}
}
// Add ending parens
for(int i = 0; i < parenCount; i++) {
sb.append(")?");
}
return sb.toString();
}
protected static String d() {
return d(false, false);
}
// getOptionalDirections
protected static String d(boolean anchorLeft, boolean anchorRight)
{
String a = anchorLeft?"^":"";
String r = anchorRight?"$":"";
return ("("+a+m(1,"north")+r+"|"+a+
m(1,"east")+r+"|"+a+
m(1,"west")+r+"|"+a+
m(1,"south")+r+"|"+a+
m(1,"up")+r+"|"+a+
m(1,"down")+r+")");
}
public CommandPatternLoader(String rootPath) {
m_rootPath = rootPath;
m_inputCommandList = new Vector<AbstractMap.SimpleEntry<PatternSequenceNode, Class<?>>>();
}
@SuppressWarnings("unchecked")
public void load(String id) {
// Right now just manually register - eventually get from data file
addPatternPair(PatternSequenceNode.compile("go", Pattern.CASE_INSENSITIVE).
append(d(false,true), Pattern.CASE_INSENSITIVE, grp(1, MoveCommand.MOVE_DIR)), MoveCommand.class);
addPatternPair(PatternSequenceNode.compile(d(false,true), Pattern.CASE_INSENSITIVE, grp(1, MoveCommand.MOVE_DIR)), MoveCommand.class);
addPatternPair(PatternSequenceNode.compile(m(1, "quit"), Pattern.CASE_INSENSITIVE), QuitCommand.class);
addPatternPair(PatternSequenceNode.compile(m(2, "time"), Pattern.CASE_INSENSITIVE), GetTimeCommand.class);
addPatternPair(PatternSequenceNode.compile(m(1, "inventory"), Pattern.CASE_INSENSITIVE), GetInventoryCommand.class);
addPatternPair(PatternSequenceNode.compile(m(2, "save"), Pattern.CASE_INSENSITIVE).
append("([a-zA-Z]+)", Pattern.CASE_INSENSITIVE, grp(1, SaveCommand.SAVE_GAMEID)), SaveCommand.class);
addPatternPair(PatternSequenceNode.compile(m(1, "restore"), Pattern.CASE_INSENSITIVE).
append("([a-zA-Z]+)", Pattern.CASE_INSENSITIVE, grp(1, RestoreCommand.LOAD_GAMEID)), RestoreCommand.class);
addPatternPair(PatternSequenceNode.compile(m(2, "drop"), Pattern.CASE_INSENSITIVE).
append("([a-zA-Z]+)", Pattern.CASE_INSENSITIVE, grp(1, DropCommand.DROP_ITEM)), DropCommand.class);
addPatternPair(PatternSequenceNode.compile(m(1, "open"), Pattern.CASE_INSENSITIVE).
append(d(false,true), Pattern.CASE_INSENSITIVE, grp(1, OpenCommand.OPEN_DIR)), OpenCommand.class);
addPatternPair(PatternSequenceNode.compile(m(2, "take"), Pattern.CASE_INSENSITIVE).
append("([a-zA-Z]+)", Pattern.CASE_INSENSITIVE, grp(1, TakeCommand.TAKE_ITEM)), TakeCommand.class);
// Order matters - always order patterns from most specific to least specific
addPatternPair(PatternSequenceNode.compile(m(1, "give"), Pattern.CASE_INSENSITIVE).
append("([a-zA-Z]+)", Pattern.CASE_INSENSITIVE, grp(1, GiveCommand.GIVE_ITEM)).
append("to", Pattern.CASE_INSENSITIVE).
append("([a-zA-Z]+)", Pattern.CASE_INSENSITIVE, grp(1, GiveCommand.GIVE_RECIP)), GiveCommand.class);
/*
addPatternPair(PatternSequenceNode.compile(m(1, "give"), Pattern.CASE_INSENSITIVE).
append("([a-zA-Z]+)", Pattern.CASE_INSENSITIVE, grp(1, GiveCommand.GIVE_ITEM)).
append("([a-zA-Z]+)", Pattern.CASE_INSENSITIVE, grp(1, GiveCommand.GIVE_RECIP)), GiveCommand.class);
*/
addPatternPair(PatternSequenceNode.compile(m(2, "unlock"), Pattern.CASE_INSENSITIVE).
append(d(false,true), Pattern.CASE_INSENSITIVE, grp(1, UnlockCommand.UNLOCK_DIR)).
append("with", Pattern.CASE_INSENSITIVE).
append("([a-zA-Z]+)", Pattern.CASE_INSENSITIVE, grp(1, UnlockCommand.UNLOCK_ITEM)), UnlockCommand.class);
addPatternPair(PatternSequenceNode.compile(m(2, "examine"), Pattern.CASE_INSENSITIVE).
append("([a-zA-Z]+)", Pattern.CASE_INSENSITIVE, grp(1, ExamineCommand.EXAM_TARGET)), ExamineCommand.class);
//addPatternPair(PatternSequenceNode.compile(m(5, "intro"), Pattern.CASE_INSENSITIVE), GetIntroCommand.class);
}
public Vector<AbstractMap.SimpleEntry<PatternSequenceNode, Class<?>>> getCommandPatternList() {
return m_inputCommandList;
}
}
| [
"[email protected]"
] | |
2665eb5cca27c91403c2910310dfc7fb4d2117f7 | fb72f0c6ff27ae94b5b9cc770376c7f14acce620 | /unit15/program40/Main.java | 3575379e44c135480b839b6a81e44fd892727259 | [] | no_license | sofia-kustikava/java-learn | 951b4e81af5cd3905a5c157686b25de912f8273e | 286a9d67d5af67ebd30aa040377fd316fb430b9e | refs/heads/main | 2023-04-10T19:32:18.903631 | 2021-04-11T20:50:41 | 2021-04-11T20:50:41 | 352,795,728 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 954 | java | //Add a speak( ) method to all the pets in typeinfo.pets. Modify
//Apply.java to call the speak( ) method for a heterogeneous collection of Pet.
import java.util.*;
import java.lang.reflect.*;
import static com.java.second.package6.TypeInfoSpeak.*;
public class Main {
private static class Apply {
private static <T> void apply(Iterable<? extends T> collect, Method m, Object... args) {
try{
for (T t : collect) {
m.invoke(t,args);
}
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}
public static void main(String[] args) {
ForNameCreator creator = new ForNameCreator();
List<Pet> pets = creator.arrayList(10);
try {
Apply.apply(pets, Pet.class.getMethod("speak"));
} catch (NoSuchMethodException e) {
throw new RuntimeException(e);
}
}
}
| [
"[email protected]"
] | |
e82b0a3c3a0107dfbd6241dcd716e6592ea10d11 | cca87c4ade972a682c9bf0663ffdf21232c9b857 | /com/tencent/mm/ui/base/MMAutoSwitchEditText.java | 2a4e01e61c40b38ff34a8563784aaf9f65858fd1 | [] | no_license | ZoranLi/wechat_reversing | b246d43f7c2d7beb00a339e2f825fcb127e0d1a1 | 36b10ef49d2c75d69e3c8fdd5b1ea3baa2bba49a | refs/heads/master | 2021-07-05T01:17:20.533427 | 2017-09-25T09:07:33 | 2017-09-25T09:07:33 | 104,726,592 | 12 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,269 | java | package com.tencent.mm.ui.base;
import android.content.Context;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.AttributeSet;
import android.view.KeyEvent;
import android.view.View;
import android.view.View.OnKeyListener;
import android.widget.EditText;
public class MMAutoSwitchEditText extends EditText {
a viD = new a(this);
public static class a implements TextWatcher, OnKeyListener {
private String jqT;
private EditText kM;
int mIndex = 0;
c viE;
b viF;
d viG;
int viH = 4;
public a(EditText editText) {
this.kM = editText;
}
public final void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {
}
public final void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
}
public final void afterTextChanged(Editable editable) {
int i = 0;
this.jqT = editable.toString();
Object obj = "";
if (this.viG != null) {
this.viG.bRO();
}
int i2 = 0;
while (i < this.jqT.length()) {
i2++;
if (i2 > this.viH) {
break;
}
obj = obj + this.jqT.charAt(i);
i++;
}
if (i2 > this.viH) {
this.kM.setText(obj);
this.kM.setSelection(obj.length());
}
if (i2 >= this.viH && this.viE != null) {
this.viE.Ac(this.mIndex);
}
}
public final boolean onKey(View view, int i, KeyEvent keyEvent) {
if (i == 67 && this.kM.getText().toString().trim().length() == 0 && this.viF != null) {
this.viF.Ab(this.mIndex);
}
return false;
}
}
public interface b {
void Ab(int i);
}
public interface c {
void Ac(int i);
}
public interface d {
void bRO();
}
public MMAutoSwitchEditText(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
addTextChangedListener(this.viD);
setOnKeyListener(this.viD);
}
}
| [
"[email protected]"
] | |
d3fbdeed661fd8fec1e11d82386d8782d1fbd18a | 83a959500a7428a821da00a1ea37fb5c87940119 | /pasarela-web/src/main/java/com/udea/controller/TarjetaDeCreditoMBean.java | 7dd819bbe81de9d1fb3ec2734aada08a2a0af279 | [] | no_license | juanDev-47/pasarela-de-pagos | 2c966382c3e8435c09df60331bd6f9710368b335 | 17c49a3dffe7410c33a603b24d7c85de7b9ee519 | refs/heads/main | 2023-04-12T14:52:05.479271 | 2021-05-05T02:51:38 | 2021-05-05T02:51:38 | 356,624,502 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,042 | java | /*
* 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 com.udea.controller;
import com.udea.ejb.TarjetaDeCreditoManager;
import com.udea.ejb.TransaccionManagerLocal;
import com.udea.persistence.TarjetaDeCredito;
import com.udea.persistence.Transaccion;
import java.io.Serializable;
import java.sql.Date;
import java.sql.Timestamp;
import java.util.List;
import javax.ejb.EJB;
import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;
import javax.faces.model.SelectItem;
/**
*
* @author JUAN
*/
public class TarjetaDeCreditoMBean implements Serializable {
@EJB
private com.udea.ejb.TransaccionManagerLocal transaccionManager;
@EJB
private com.udea.ejb.TarjetaDeCreditoManagerLocal tarjetaDeCreditoManager;
// propiedades del modelo
private TarjetaDeCredito tarjeta = new TarjetaDeCredito(); //para el insert
private List<TarjetaDeCredito> tarjetas; // para mostrar la tabla
private Transaccion transaccion = new Transaccion();
private List<Transaccion> transacciones;
/**
* Creates a new instance of TarjetaDeCreditoMBean
*/
public TarjetaDeCreditoMBean() {
}
//retorna una lista de tarjetas para mostrar en el datatables
public List<TarjetaDeCredito> getTarjetas(){
if ((tarjetas == null)|| (tarjetas.isEmpty()))
refresh();
return tarjetas;
}
public List<Transaccion> getTransacciones(){
if ((transacciones == null)|| (transacciones.isEmpty()))
refresh();
return transacciones;
}
public TarjetaDeCredito getTarjeta() {
return tarjeta;
}
public void setTarjeta(TarjetaDeCredito tarjeta) {
this.tarjeta = tarjeta;
}
public Transaccion getTransaccion() {
return transaccion;
}
public void setTransaccion(Transaccion transaccion) {
this.transaccion = transaccion;
}
//retorno el detalle de cada tarjeta en el formulario
public TarjetaDeCredito getDetails(){
return tarjeta;
}
public Transaccion getDetailsTransaccion(){
return transaccion;
}
//Action Handler
public String showDetails(Transaccion transaccion){
this.transaccion = transaccion;
return "DETAILS";
}
public String showDetails2(Transaccion transaccion,TarjetaDeCredito tarjeta){
this.transaccion = transaccion;
this.tarjeta = tarjeta;
return "DETAILS";
}
//Action Handler - insertar los datos en la base
public String insertar(){
tarjetaDeCreditoManager.InsertTarjetaCredito(tarjeta);
return "SAVED";
// esto va antes del tarjetaDeCreditoManager OJO ---> tarjeta =
// organizar este metodo pronto
}
public String list(){
return "LISTADO"; //poner LIST
}
public String detalleCompra(){
return "DETAILS"; //poner LIST
}
public String back(){
// tarjeta = null;
return "BACK";
}
public void identificarTipo() {
String tipoTarjeta = tarjetaDeCreditoManager.identificarTipo(tarjeta.getNumeroTarjeta());
if ("No valido".equals(tipoTarjeta)) {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_WARN, "Nro tarjeta erroneo", ""));
return;
}
tarjeta.setTipoTarjeta(tipoTarjeta);
}
public String pagar() {
identificarTipo();
// if(tarjetaDeCreditoManager.comprobarTarjeta(tarjeta)){
// tarjetaDeCreditoManager.InsertTarjetaCredito(tarjeta);
// }else {
// TarjetaDeCredito tarjeta2 = tarjetaDeCreditoManager.BuscarTarjeta(tarjeta.getNumeroTarjeta());
// if (tarjeta2.getCvv() == tarjeta.getCvv()) {
// tarjeta = tarjeta2;
// }else{
// FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_WARN, "Nro tarjeta erroneo", ""));
// tarjeta = null;
// return "CVV";
// }
// }
tarjetaDeCreditoManager.InsertTarjetaCredito(tarjeta);
transaccion.setNumeroTarjeta(tarjeta);
Timestamp date = new Timestamp(System.currentTimeMillis());
transaccion.setFecha(date);
transaccionManager.insertarTransaccion(transaccion);
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, "TRANSACCIÓN EXITOSA", ""));
return "SAVED";
}
public void refresh(){
tarjetas = tarjetaDeCreditoManager.getAllTarjetaCredito();
transacciones = transaccionManager.getAllTransacciones();
}
}
| [
"[email protected]"
] | |
b464c10bee4a95e8f5972f1b12e98fefaa8d56fe | 700f4a4538c7c234971f8d49aceecbc7f97eae5f | /src/main/java/com/kingland/kata/TennisGame3.java | e521e7bf1fb8543ec535df622dde2dd34a94cd74 | [
"MIT"
] | permissive | tphif/Tennis-Refactoring-Kata | b545479b70ac5d111fa1c316960b9b918c4ae6f3 | be5b0742301dd608a1364a461ab749121d7472c7 | refs/heads/master | 2023-02-08T01:59:45.744356 | 2020-12-18T16:56:37 | 2020-12-18T16:56:37 | 322,456,687 | 0 | 0 | MIT | 2022-02-02T18:59:11 | 2020-12-18T01:32:15 | HTML | UTF-8 | Java | false | false | 916 | java | package com.kingland.kata;
public class TennisGame3 implements TennisGame {
private int p2;
private int p1;
private String p1N;
private String p2N;
public TennisGame3(String p1N, String p2N) {
this.p1N = p1N;
this.p2N = p2N;
}
public String getScore() {
String s;
if (p1 < 4 && p2 < 4 && !(p1 + p2 == 6)) {
String[] p = new String[]{"Love", "Fifteen", "Thirty", "Forty"};
s = p[p1];
return (p1 == p2) ? s + "-All" : s + "-" + p[p2];
} else {
if (p1 == p2)
return "Deuce";
s = p1 > p2 ? p1N : p2N;
return ((p1-p2)*(p1-p2) == 1) ? "Advantage " + s : "Win for " + s;
}
}
public void wonPoint(String playerName) {
if (playerName == "player1")
this.p1 += 1;
else
this.p2 += 1;
}
}
| [
"[email protected]"
] | |
23418e98c45e5b0995221c6ba8acccb0181bdda1 | 8782061b1e1223488a090f9f3f3b8dfe489e054a | /storeMongoDB/projects/ABCD/andrekeane_marenor/test/61Test.java | 17bd797718990421510677c48f3892c05421832f | [] | no_license | ryosuke-ku/TCS_init | 3cb79a46aa217e62d8fff13d600f2a9583df986c | e1207d68bdc9d2f1eed63ef44a672b5a37b45633 | refs/heads/master | 2020-08-08T18:40:17.929911 | 2019-10-18T01:06:32 | 2019-10-18T01:06:32 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 787 | java | public void testRestore_CustomDefaults()
{
AnnotationAttributes defaults = new AnnotationAttributes();
assignExampleValues(defaults);
AnnotationAttributes attrib = new AnnotationAttributes();
attrib.setDefaults(defaults);
String stateInXml = attrib.getRestorableState();
attrib = new AnnotationAttributes();
attrib.restoreState(stateInXml);
AnnotationAttributes expectedDefaults = new AnnotationAttributes();
assignExampleValues(expectedDefaults);
AnnotationAttributes expected = new AnnotationAttributes();
expected.setDefaults(expectedDefaults);
// "expected" and "attrib" will return values from their defaults.
assertEquals(expected, attrib);
}
| [
"[email protected]"
] | |
49c93ce21d78ce19744340c38943e17be3abc6fe | b1a3642430202d3a9736341c83591c7e0bd75bdb | /src/test/java/com/luo/service/UserServiceTest.java | c96a8f6a73397fdce2463084279b81e13eefa380 | [] | no_license | lyhcodemonkey/first_maven_project | 5c84222eb84800377734ca312eb6e2b641374e15 | 5ab70733a87999d1281372fc9f2eafa7cd357a96 | refs/heads/master | 2021-01-01T17:33:52.149383 | 2017-07-23T12:39:48 | 2017-07-23T12:39:48 | 98,096,973 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 669 | java | package com.luo.service;
import com.github.pagehelper.PageInfo;
import com.luo.baseTest.SpringTestCase;
import com.luo.domain.User;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
public class UserServiceTest extends SpringTestCase {
@Autowired
private UserService userService;
@Test
public void selectUserByIdTest() {
User user = userService.selectUserById(1);
System.out.println(user.getUserName() + ":" + user.getUserPassword());
}
@Test
public void queryByPageTest() {
PageInfo<User> page = userService.queryByPage(null, 1, 1);
System.out.println(page);
}
}
| [
"[email protected]"
] | |
4323418ab89afafde7c8a3f526bbf3729d337f92 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/14/14_8b18f1934b5118d6ac71b137afd3b4b71368e66a/UserService/14_8b18f1934b5118d6ac71b137afd3b4b71368e66a_UserService_s.java | 43173a3c2f88d84c032cf6caf7f6dbd1b2dca990 | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 7,348 | java | package org.siraya.rent.user.service;
import junit.framework.Assert;
import org.siraya.rent.pojo.User;
import org.siraya.rent.pojo.VerifyEvent;
import org.siraya.rent.user.dao.IUserDAO;
import org.siraya.rent.user.dao.IVerifyEventDao;
import org.siraya.rent.utils.EncodeUtility;
import org.siraya.rent.utils.IApplicationConfig;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.util.regex.Pattern;
import java.util.Map;
import java.util.Random;
import javax.ws.rs.GET;
import org.siraya.rent.pojo.Device;
import org.siraya.rent.user.dao.IDeviceDao;
@Service("userService")
public class UserService implements IUserService {
@Autowired
private IUserDAO userDao;
@Autowired
private IApplicationConfig applicationConfig;
@Autowired
private IDeviceDao deviceDao;
@Autowired
private IVerifyEventDao verifyEventDao;
private static Logger logger = LoggerFactory.getLogger(UserService.class);
/**
* new user mobile number
*
* @param cc country code
* @param moblie phone number
* @exception DuplicateKeyException duplicate mobile number
*/
@Transactional(value = "rentTxManager", propagation = Propagation.SUPPORTS, readOnly = false, rollbackFor = java.lang.Throwable.class)
public User newUserByMobileNumber(int cc,String mobilePhone) throws Exception {
//
// verify format
//
logger.debug("check cc code");
mobilePhone = mobilePhone.trim();
Map<String, Object> mobileCountryCode = applicationConfig.get("mobile_country_code");
Assert.assertTrue("cc not exist in mobile country code " + cc,
mobileCountryCode.containsKey(cc));
Assert.assertTrue("cc code not start with +"+cc,
mobilePhone.startsWith(Integer.toString(cc)));
//
// setup user object
//
Map<String, Object> map = (Map<String, Object>) mobileCountryCode
.get(cc);
User user = new User();
String id = java.util.UUID.randomUUID().toString();
user.setId(id);
user.setMobilePhone(mobilePhone);
user.setCc((String) map.get("country"));
user.setLang((String) map.get("lang"));
user.setTimezone((String) map.get("timezone"));
user.setStatus(UserStatus.Init.getStatus());
try{
//
// insert into database.
//
userDao.newUser(user);
logger.info("create new user id is " + id);
return user;
}catch(org.springframework.dao.DuplicateKeyException e){
logger.debug("phone number "+mobilePhone+" have been exist in database.");
return userDao.getUserByMobilePhone(mobilePhone);
}
}
/**
* create new device
*
* 1.check max device number.
* 2.create new record in database.
* 3.send auth code through mobile number.
*/
@Transactional(value = "rentTxManager", propagation = Propagation.SUPPORTS, readOnly = false, rollbackFor = java.lang.Throwable.class)
public void newDevice(Device device) throws Exception {
//
// check device count.
//
int count=deviceDao.getDeviceCountByUserId(device.getUserId());
int maxDevice = ((Integer)applicationConfig.get("general").get("max_device_count")).intValue();
logger.debug("user id is "+device.getUserId()+" device count is "+count+" max device is "+maxDevice);
if (count > maxDevice) {
throw new Exception("current user have too many device");
}
//
// check user status
//
if (device.getUser().getStatus() == UserStatus.Remove.getStatus()) {
throw new Exception("user status is removed");
}
String id = java.util.UUID.randomUUID().toString();
device.setId(id);
device.setStatus(DeviceStatus.Init.getStatus());
Random r = new Random();
device.setToken(String.valueOf(r.nextInt(9999)));
deviceDao.newDevice(device);
logger.debug("insert device");
}
/**
* set up email. only when email still not exist.
*
*/
@Transactional(value = "rentTxManager", propagation = Propagation.SUPPORTS, readOnly = false, rollbackFor = java.lang.Throwable.class)
public void setupEmail(User user) throws Exception {
String userId = user.getId();
String newEmail = user.getEmail();
logger.info("update email for user "+userId+ " new email "+newEmail);
VerifyEvent verifyEvent = null;
user = userDao.getUserByUserId(user.getId());
String oldEmail = user.getEmail();
if (oldEmail != null && !oldEmail.equals("")) {
logger.debug("old email exist");
if (oldEmail.equals(newEmail)) {
//
// same email.
//
throw new Exception("same email have been setted");
}
//
// if old email exist and already verified, then throw exception
// to prevent overwrite primary email
// change email must call by different process.
//
verifyEvent = verifyEventDao.getEventByVerifyDetailAndType(VerifyEvent.VerifyType.Email.getType(),
oldEmail);
if (verifyEvent != null
&& verifyEvent.getStatus() == VerifyEvent.VerifyStatus.Authed
.getStatus()) {
throw new Exception("old email have been verified. can't reset email");
}
}
user.setModified(new Long(0));
user.setEmail(newEmail);
logger.debug("insert verify event");
verifyEvent = new VerifyEvent();
verifyEvent.setUserId(userId);
verifyEvent.setStatus(VerifyEvent.VerifyStatus.Init.getStatus());
verifyEvent.setVerifyDetail(newEmail);
verifyEvent.setVerifyType(VerifyEvent.VerifyType.Email.getType());
verifyEventDao.newVerifyEvent(verifyEvent);
logger.debug("update email in database");
userDao.updateUserEmail(user);
}
/**
* update login id and password
*
*/
@Transactional(value = "rentTxManager", propagation = Propagation.SUPPORTS, readOnly = false, rollbackFor = java.lang.Throwable.class)
public void updateLoginIdAndPassowrd(User user) throws Exception{
String userId = user.getId();
User user2 = userDao.getUserByUserId(user.getId());
//
// check original login id must be null or empty
//
if (user2.getLoginId() != null && user2.getLoginId() != "") {
throw new Exception("can't reset login id");
}
user.setId(user2.getId());
//
// sha1
//
user.setPassword(EncodeUtility.sha1(user.getPassword()));
logger.debug("update login id and password in database");
int ret =userDao.updateUserLoginIdAndPassword(user);
if (ret == 0 ) {
throw new Exception("update cnt =0, only empty login id can be update");
}
}
@Override
public void verifyEmail(String userId, String authCode) {
// TODO Auto-generated method stub
}
@Override
public void updateUserInfo(User user) {
// TODO Auto-generated method stub
}
}
| [
"[email protected]"
] | |
55b82535941f81191c4a6849ea5e1e105b2ee68b | 2d01d145ce78531cd8091c4c0963c22bf7fb5a86 | /src/main/java/cn/chong/service/impl/UserServiceImpl.java | 82a442cbceb9087075bfb0518495c9d1988bb11f | [] | no_license | GaoChDemo/ssmdemo | 7878ea72718d426383d0c46400ddcf113740c5b6 | 985e46100a6c679e02b7ae97b0f017b277cb2055 | refs/heads/master | 2021-09-22T09:31:53.003692 | 2018-09-07T09:12:13 | 2018-09-07T09:12:13 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 531 | java | package cn.chong.service.impl;
import cn.chong.dao.UserMapper;
import cn.chong.model.User;
import cn.chong.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@Service
@Transactional
public class UserServiceImpl implements UserService {
@Autowired
private UserMapper userMapper;
public void insertSelective(User user) {
userMapper.insertSelective(user);
}
}
| [
"[email protected]"
] | |
f9e37d3ada7de173c1e5ce0c7b7352b4106b633b | a6c0dda8712055dcb58729cfbaa175fad73b2180 | /src/main/java/com/cmc/dp/pattern/singleton/SingletonPattern4.java | 3d80a4e8744cb9ab8362b4b33779a52d59dc81d9 | [] | no_license | zhizhao1990/framework-assembly-basis | 321de01dbbc642ee051dfdb12eb500bbb51a8686 | ce0780d5132998580fced0c11165b1aa7f83ad80 | refs/heads/develop | 2021-01-20T01:50:09.565056 | 2017-04-24T14:19:09 | 2017-04-24T14:19:09 | 89,330,328 | 1 | 0 | null | 2017-04-25T07:23:45 | 2017-04-25T07:23:45 | null | UTF-8 | Java | false | false | 1,126 | java | package com.cmc.dp.pattern.singleton;
/**
* 创建型模式:单例模式
* <p> 双检锁/双重校验锁(DCL,即 double-checked locking)
* <p> 这种方式采用双锁机制,安全且在多线程情况下能保持高性能。
* <ul>
* <li> 是否延迟初始化:是
* <li> 是否多线程安全:是
* </ul>
*
* @author Thomas Lee
* @version 2017年2月18日 下午2:23:44
* @version 2017年4月14日 下午4:35:52
*/
public class SingletonPattern4 {
public static void main(String[] args) {
System.out.println(SingletonPattern4.getInstance());
}
private static SingletonPattern4 instance;
// 为了只能拥有一个SingletonPattern4的实例,只允许通过提供的实例生成方法进行对象实例生成
private SingletonPattern4() {
}
public static SingletonPattern4 getInstance() {
if (null != instance) {
return instance;
}
synchronized (SingletonPattern4.class) {
if (null == instance) {
instance = new SingletonPattern4();
}
}
return instance;
}
} | [
"[email protected]"
] | |
a8385f7226a2df75e09e4c88f5de4bdc708782a9 | 034ba1bf123b511de0fe928b67cf8445de2d066a | /LoveDataStructureAndAlgorithm1/src/com/mj/map/file/Files.java | 7f4f61d50cc58271de2d455a16ce417a71fee29b | [] | no_license | tianzengyin/dataStructure1 | 5ea4b089fc9a53802d530100f2501c653d1f2548 | 915af80a220a2295bae1963029e4e108facdd3b3 | refs/heads/master | 2023-01-06T22:14:08.321437 | 2020-10-29T02:26:53 | 2020-10-29T02:26:53 | 274,522,959 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,819 | java | package com.mj.map.file;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileFilter;
import java.io.FileReader;
import java.io.IOException;
public class Files {
/**
* 读取文件内容
* @param file
* @return
*/
public static FileInfo read(String file) {
if (file == null) return null;
FileInfo info = new FileInfo();
StringBuilder sb = new StringBuilder();
try (FileReader reader = new FileReader(file);
BufferedReader br = new BufferedReader(reader)) {
String line;
while ((line = br.readLine()) != null) {
sb.append(line).append("\n");
info.setLines(info.getLines() + 1);
}
int len = sb.length();
if (len > 0) {
sb.deleteCharAt(len - 1);
}
} catch (IOException e) {
e.printStackTrace();
}
info.setFiles(info.getFiles() + 1);
info.setContent(sb.toString());
return info;
}
/**
* 读取文件夹下面的文件内容
* @param dir
* @param extensions
* @return
*/
public static FileInfo read(String dir, String[] extensions) {
if (dir == null) return null;
File dirFile = new File(dir);
if (!dirFile.exists()) return null;
FileInfo info = new FileInfo();
dirFile.listFiles(new FileFilter() {
public boolean accept(File subFile) {
String subFilepath = subFile.getAbsolutePath();
if (subFile.isDirectory()) {
info.append(read(subFilepath, extensions));
} else if (extensions != null && extensions.length > 0) {
for (String extension : extensions) {
if (subFilepath.endsWith("." + extension)) {
info.append(read(subFilepath));
break;
}
}
} else {
info.append(read(subFilepath));
}
return false;
}
});
return info;
}
}
| [
"[email protected]"
] | |
1c2e787deb858ce69812a82b59138702fc931b42 | 9e2c612bf7f450245ea0761a2bc2189cd9e35d4e | /app/src/main/java/com/recipeme/recipeme/fragment/SettingFragment.java | 5be08f058086978ec8f5cf52b6fbda257c95f788 | [] | no_license | yoavnoa1/recipeMe | d5175e9fce8e838864d3fd26c52eedf90e75330c | 9c0536e876a52dc42b8f1719e1bfefe2b6158a62 | refs/heads/master | 2016-09-06T07:42:01.529565 | 2016-01-12T13:30:56 | 2016-01-12T13:30:56 | 39,728,372 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 544 | java | package com.recipeme.recipeme.fragment;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.recipeme.recipeme.R;
public class SettingFragment extends Fragment
{
private View view = null;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
view = inflater.inflate(R.layout.fragment_setting, container, false);
return view;
}
}
| [
"yoav"
] | yoav |
491015af8f6ba700a94124afa54189ad0ba0fb05 | 0e4608aeeb210442bf3fffe5a8d1a1b7212090ff | /tests/src/org/rapla/mobile/android/test/utility/ExceptionDialogFactoryTest.java | 6968a8513eb23a00b14814bd947c4f2d91e73575 | [] | no_license | jackba/rapla.android-client | b1c9c3914509c8368287881565c3580a2e40acfa | 7a7d00e841ee62d4d2f170e64db8e09ba28ec89c | refs/heads/master | 2021-01-10T21:04:08.786343 | 2015-01-31T16:44:53 | 2015-01-31T16:46:09 | 33,372,548 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,248 | java | /*--------------------------------------------------------------------------*
| Copyright (C) 2012 Maximilian Lenkeit |
| |
| This program is free software; you can redistribute it and/or modify |
| it under the terms of the GNU General Public License as published by the |
| Free Software Foundation. A copy of the license has been included with |
| these distribution in the COPYING file, if not go to www.fsf.org |
| |
| As a special exception, you are granted the permissions to link this |
| program with every library, which license fulfills the Open Source |
| Definition as published by the Open Source Initiative (OSI). |
*--------------------------------------------------------------------------*/
package org.rapla.mobile.android.test.utility;
import org.rapla.mobile.android.RaplaMobileException;
import org.rapla.mobile.android.app.ExceptionDialog;
import org.rapla.mobile.android.utility.factory.ExceptionDialogFactory;
import android.content.Context;
import android.test.AndroidTestCase;
/**
* ExceptionDialogFactoryTest
*
* Unit test class for
* org.rapla.mobile.android.utilities.factory.ExceptionDialogFactory
*
* @see org.rapla.mobile.android.utility.factory.utilities.factory.ClientFacadeFactory
* @author Maximilian Lenkeit <[email protected]>
*/
public class ExceptionDialogFactoryTest extends AndroidTestCase {
public void testGetInstanceShouldAlwaysReturnTheSameInstance() {
ExceptionDialogFactory first = ExceptionDialogFactory.getInstance();
ExceptionDialogFactory second = ExceptionDialogFactory.getInstance();
assertEquals(first, second);
}
public void testCreateShouldAlwaysReturnNewInstance()
throws RaplaMobileException {
Context context = this.getContext();
String message = "test";
ExceptionDialog first = ExceptionDialogFactory.getInstance().create(
context, message);
ExceptionDialog second = ExceptionDialogFactory.getInstance().create(
context, message);
assertNotSame(first, second);
}
}
| [
"[email protected]@f78d5ace-84b9-81af-d60f-742a6fa3a8cb"
] | [email protected]@f78d5ace-84b9-81af-d60f-742a6fa3a8cb |
eba6124bcca5d868c014eeaff48d4ee8cc8808da | 6a17bb3ae5195a15419e65a580db1825e8fac8cd | /src/main/java/com/home911/httpchat/client/notif/HttpChatNotifHandler.java | 483d01cd1e9bcef4bfd254341cdba0fa515913ac | [
"Apache-2.0"
] | permissive | naz911/httpchat | 449b6251028c005021e9a06d5b92ef15577328a4 | fae1ad332b1cb36909f4a868c539c7cd34801a48 | refs/heads/master | 2020-06-02T11:59:05.034191 | 2014-03-13T15:12:47 | 2014-03-13T15:12:47 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 314 | java | package com.home911.httpchat.client.notif;
import java.util.Map;
public interface HttpChatNotifHandler {
public static final String TOKEN_PARAM = "user.token";
public static final String CHANNEL_TOKEN_PARAM = "channel.token";
public void start(Map<String, Object> params);
public void stop();
}
| [
"[email protected]"
] | |
2e758042937beefeb4bbae2d8133c264cc2ed866 | 706742bb4987cc8eb516f5ebef53651724fefadc | /src/ca/mcgill/sel/core/impl/COREImpactModelElementImpl.java | 2e6a538493d2cc9bd5aee279b0a276d0985b31eb | [] | no_license | nishanthtgwda/CORE | 01f2dbe1ea3ad4881650d98c38b4d1e710698a98 | 2d848fa8c472319f2197f9ff3a77c51b42c79602 | refs/heads/master | 2021-05-27T22:29:58.628269 | 2014-06-20T07:03:45 | 2014-06-20T07:03:45 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 872 | java | /**
*/
package ca.mcgill.sel.core.impl;
import ca.mcgill.sel.core.COREImpactModelElement;
import ca.mcgill.sel.core.CorePackage;
import org.eclipse.emf.ecore.EClass;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>CORE Impact Model Element</b></em>'.
* <!-- end-user-doc -->
* <p>
* </p>
*
* @generated
*/
public abstract class COREImpactModelElementImpl extends COREModelElementImpl implements COREImpactModelElement {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected COREImpactModelElementImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return CorePackage.Literals.CORE_IMPACT_MODEL_ELEMENT;
}
} //COREImpactModelElementImpl
| [
"[email protected]"
] | |
702f5a2145d373b54e529e43da2ada0b3aa2b2c7 | 15af8387981f4069db97712952c23e7f1dde70cd | /src/main/java/com/zabbix4j/item/ItemDeleteResponse.java | f7facc40051ea068bdb56db358dc2cabad7a4d39 | [] | no_license | abhinavsinha1991/Zabbix4Java | 329f8bf64d964cebe1366d056eb6f7b94d7512c9 | e043b4940a524c3a31ea71905596588f5bb16426 | refs/heads/master | 2021-06-15T17:23:45.193006 | 2021-06-05T06:41:33 | 2021-06-05T06:41:33 | 204,424,987 | 0 | 3 | null | 2021-06-05T06:41:34 | 2019-08-26T07:55:01 | Java | UTF-8 | Java | false | false | 1,874 | java | /*
* The MIT License (MIT)
*
* Copyright (c) 2014 Suguru Yajima
*
* 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.zabbix4j.item;
import java.util.List;
import com.zabbix4j.ZabbixApiResponse;
/**
* Created by Suguru Yajima on 2014/05/09.
*/
public class ItemDeleteResponse extends ZabbixApiResponse {
private Result result;
public ItemDeleteResponse() {
super();
}
public Result getResult() {
return result;
}
public void setResult(Result result) {
this.result = result;
}
public class Result {
private List<Integer> itemids;
public Result() {
}
public List<Integer> getItemids() {
return itemids;
}
public void setItemids(List<Integer> itemids) {
this.itemids = itemids;
}
}
}
| [
"[email protected]"
] | |
d66921400f1c73593649df870c164176b1222b0d | ca0c1c841cc3c569cfa8298e016949bb39a7416b | /mipagar-ubl-21/src/main/java/oasis/names/specification/ubl/schema/xsd/commonextensioncomponents_21/UBLExtensionType.java | aa48a4eee96740a8adb7f42f2f2328ddb6b343ac | [] | no_license | mipagar/mipagar-ubl | e912e18ea392aa6e4031112317af8a4e8221d9d3 | c365307ae523556a6183a92a0d2d6854d1a19057 | refs/heads/master | 2016-09-11T08:28:04.847756 | 2014-05-28T11:57:19 | 2014-05-28T11:57:19 | 7,356,505 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,576 | java |
package oasis.names.specification.ubl.schema.xsd.commonextensioncomponents_21;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
import oasis.names.specification.ubl.schema.xsd.commonbasiccomponents_21.IDType;
import oasis.names.specification.ubl.schema.xsd.commonbasiccomponents_21.NameType;
/**
*
* A single extension for private use.
*
*
* <p>Java class for UBLExtensionType complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="UBLExtensionType">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element ref="{urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2}ID" minOccurs="0"/>
* <element ref="{urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2}Name" minOccurs="0"/>
* <element ref="{urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2}ExtensionAgencyID" minOccurs="0"/>
* <element ref="{urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2}ExtensionAgencyName" minOccurs="0"/>
* <element ref="{urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2}ExtensionVersionID" minOccurs="0"/>
* <element ref="{urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2}ExtensionAgencyURI" minOccurs="0"/>
* <element ref="{urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2}ExtensionURI" minOccurs="0"/>
* <element ref="{urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2}ExtensionReasonCode" minOccurs="0"/>
* <element ref="{urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2}ExtensionReason" minOccurs="0"/>
* <element ref="{urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2}ExtensionContent"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "UBLExtensionType", propOrder = {
"id",
"name",
"extensionAgencyID",
"extensionAgencyName",
"extensionVersionID",
"extensionAgencyURI",
"extensionURI",
"extensionReasonCode",
"extensionReason",
"extensionContent"
})
public class UBLExtensionType {
@XmlElement(name = "ID", namespace = "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2")
protected IDType id;
@XmlElement(name = "Name", namespace = "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2")
protected NameType name;
@XmlElement(name = "ExtensionAgencyID")
protected ExtensionAgencyIDType extensionAgencyID;
@XmlElement(name = "ExtensionAgencyName")
protected ExtensionAgencyNameType extensionAgencyName;
@XmlElement(name = "ExtensionVersionID")
protected ExtensionVersionIDType extensionVersionID;
@XmlElement(name = "ExtensionAgencyURI")
protected ExtensionAgencyURIType extensionAgencyURI;
@XmlElement(name = "ExtensionURI")
protected ExtensionURIType extensionURI;
@XmlElement(name = "ExtensionReasonCode")
protected ExtensionReasonCodeType extensionReasonCode;
@XmlElement(name = "ExtensionReason")
protected ExtensionReasonType extensionReason;
@XmlElement(name = "ExtensionContent", required = true)
protected ExtensionContentType extensionContent;
/**
*
* An identifier for the Extension assigned by the creator of the extension.
*
*
* @return
* possible object is
* {@link IDType }
*
*/
public IDType getID() {
return id;
}
/**
* Sets the value of the id property.
*
* @param value
* allowed object is
* {@link IDType }
*
*/
public void setID(IDType value) {
this.id = value;
}
/**
*
* A name for the Extension assigned by the creator of the extension.
*
*
* @return
* possible object is
* {@link NameType }
*
*/
public NameType getName() {
return name;
}
/**
* Sets the value of the name property.
*
* @param value
* allowed object is
* {@link NameType }
*
*/
public void setName(NameType value) {
this.name = value;
}
/**
*
* An agency that maintains one or more Extensions.
*
*
* @return
* possible object is
* {@link ExtensionAgencyIDType }
*
*/
public ExtensionAgencyIDType getExtensionAgencyID() {
return extensionAgencyID;
}
/**
* Sets the value of the extensionAgencyID property.
*
* @param value
* allowed object is
* {@link ExtensionAgencyIDType }
*
*/
public void setExtensionAgencyID(ExtensionAgencyIDType value) {
this.extensionAgencyID = value;
}
/**
*
* The name of the agency that maintains the Extension.
*
*
* @return
* possible object is
* {@link ExtensionAgencyNameType }
*
*/
public ExtensionAgencyNameType getExtensionAgencyName() {
return extensionAgencyName;
}
/**
* Sets the value of the extensionAgencyName property.
*
* @param value
* allowed object is
* {@link ExtensionAgencyNameType }
*
*/
public void setExtensionAgencyName(ExtensionAgencyNameType value) {
this.extensionAgencyName = value;
}
/**
*
* The version of the Extension.
*
*
* @return
* possible object is
* {@link ExtensionVersionIDType }
*
*/
public ExtensionVersionIDType getExtensionVersionID() {
return extensionVersionID;
}
/**
* Sets the value of the extensionVersionID property.
*
* @param value
* allowed object is
* {@link ExtensionVersionIDType }
*
*/
public void setExtensionVersionID(ExtensionVersionIDType value) {
this.extensionVersionID = value;
}
/**
*
* A URI for the Agency that maintains the Extension.
*
*
* @return
* possible object is
* {@link ExtensionAgencyURIType }
*
*/
public ExtensionAgencyURIType getExtensionAgencyURI() {
return extensionAgencyURI;
}
/**
* Sets the value of the extensionAgencyURI property.
*
* @param value
* allowed object is
* {@link ExtensionAgencyURIType }
*
*/
public void setExtensionAgencyURI(ExtensionAgencyURIType value) {
this.extensionAgencyURI = value;
}
/**
*
* A URI for the Extension.
*
*
* @return
* possible object is
* {@link ExtensionURIType }
*
*/
public ExtensionURIType getExtensionURI() {
return extensionURI;
}
/**
* Sets the value of the extensionURI property.
*
* @param value
* allowed object is
* {@link ExtensionURIType }
*
*/
public void setExtensionURI(ExtensionURIType value) {
this.extensionURI = value;
}
/**
*
* A code for reason the Extension is being included.
*
*
* @return
* possible object is
* {@link ExtensionReasonCodeType }
*
*/
public ExtensionReasonCodeType getExtensionReasonCode() {
return extensionReasonCode;
}
/**
* Sets the value of the extensionReasonCode property.
*
* @param value
* allowed object is
* {@link ExtensionReasonCodeType }
*
*/
public void setExtensionReasonCode(ExtensionReasonCodeType value) {
this.extensionReasonCode = value;
}
/**
*
* A description of the reason for the Extension.
*
*
* @return
* possible object is
* {@link ExtensionReasonType }
*
*/
public ExtensionReasonType getExtensionReason() {
return extensionReason;
}
/**
* Sets the value of the extensionReason property.
*
* @param value
* allowed object is
* {@link ExtensionReasonType }
*
*/
public void setExtensionReason(ExtensionReasonType value) {
this.extensionReason = value;
}
/**
*
* The definition of the extension content.
*
*
* @return
* possible object is
* {@link ExtensionContentType }
*
*/
public ExtensionContentType getExtensionContent() {
return extensionContent;
}
/**
* Sets the value of the extensionContent property.
*
* @param value
* allowed object is
* {@link ExtensionContentType }
*
*/
public void setExtensionContent(ExtensionContentType value) {
this.extensionContent = value;
}
}
| [
"[email protected]"
] | |
90109cb5e6db7bcf0a2c6b641c4a09162b11a556 | 67e004758dece3e694aaf7b8be42551e12e6f7a9 | /backend/src/main/java/com/udacity/gradle/builditbigger/backend/MyEndpoint.java | fbc5ced673f7ff1166e96c606ee05724cea4653d | [] | no_license | ViolaTarek/Build-it-bigger | c0b7bad65ffc71f56b4b889cfafa4f8c5f13d4c0 | 754ebb276f1a52ca2e15190c97f5b200fdd14c21 | refs/heads/master | 2020-04-21T12:58:40.267309 | 2019-02-08T00:15:18 | 2019-02-08T00:15:18 | 169,438,326 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 842 | java | package com.udacity.gradle.builditbigger.backend;
import com.google.api.server.spi.config.Api;
import com.google.api.server.spi.config.ApiMethod;
import com.google.api.server.spi.config.ApiNamespace;
import javax.inject.Named;
/** An endpoint class we are exposing */
@Api(
name = "myApi",
version = "v1",
namespace = @ApiNamespace(
ownerDomain = "backend.builditbigger.gradle.udacity.com",
ownerName = "backend.builditbigger.gradle.udacity.com",
packagePath = ""
)
)
public class MyEndpoint {
/** A simple endpoint method that takes a name and says Hi back */
@ApiMethod(name = "getRandomJokeService")
public MyBean getRandomJokeService() {
MyBean response = new MyBean();
response.getData();
return response;
}
}
| [
"[email protected]"
] | |
afb137925c6b12fcd1557e3a0d18f9ad1eb78363 | 75239715d67b9c7556630cf9cb7dcc7b5c0456f6 | /src/main/java/br/com/domenicosf/aeron/BasicPublisher.java | cf97adde0fa8458dcc947b4ecd983cfa2eb7215f | [] | no_license | domenicosf/aeron-test | caaecc74a20058bcb17cff0ec919fc2a35fa2a91 | 4cda917b26867535abeb4564907dd0b24150a858 | refs/heads/master | 2022-12-01T07:39:36.687914 | 2020-08-14T19:46:51 | 2020-08-14T19:46:51 | 287,609,738 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,389 | java | /*
* Copyright 2014-2020 Real Logic Limited.
*
* 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
*
* https://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 br.com.domenicosf.aeron;
import io.aeron.Aeron;
import io.aeron.Publication;
import io.aeron.driver.MediaDriver;
import org.agrona.BufferUtil;
import org.agrona.CloseHelper;
import org.agrona.concurrent.UnsafeBuffer;
import java.util.concurrent.TimeUnit;
/**
* Basic Aeron publisher application.
* <p>
* This publisher sends a fixed number of messages on a channel and stream ID,
* then lingers to allow any consumers that may have experienced loss a chance to NAK for
* and recover any missing data.
* The default values for number of messages, channel, and stream ID are
* defined in {@link SampleConfiguration} and can be overridden by
* setting their corresponding properties via the command-line; e.g.:
* -Daeron.sample.channel=aeron:udp?endpoint=localhost:5555 -Daeron.sample.streamId=20
*/
public class BasicPublisher
{
private static final int STREAM_ID = SampleConfiguration.STREAM_ID;
private static final String CHANNEL = SampleConfiguration.CHANNEL;
private static final long NUMBER_OF_MESSAGES = SampleConfiguration.NUMBER_OF_MESSAGES;
private static final long LINGER_TIMEOUT_MS = SampleConfiguration.LINGER_TIMEOUT_MS;
private static final boolean EMBEDDED_MEDIA_DRIVER = SampleConfiguration.EMBEDDED_MEDIA_DRIVER;
private static final UnsafeBuffer BUFFER = new UnsafeBuffer(BufferUtil.allocateDirectAligned(256, 64));
public static void main(final String[] args) throws Exception
{
System.out.println("Publishing to " + CHANNEL + " on stream id " + STREAM_ID);
// If configured to do so, create an embedded media driver within this application rather
// than relying on an external one.
final MediaDriver driver = EMBEDDED_MEDIA_DRIVER ? MediaDriver.launchEmbedded() : null;
final Aeron.Context ctx = new Aeron.Context();
if (EMBEDDED_MEDIA_DRIVER)
{
ctx.aeronDirectoryName(driver.aeronDirectoryName());
}
// Connect a new Aeron instance to the media driver and create a publication on
// the given channel and stream ID.
// The Aeron and Publication classes implement "AutoCloseable" and will automatically
// clean up resources when this try block is finished
try (Aeron aeron = Aeron.connect(ctx);
Publication publication = aeron.addPublication(CHANNEL, STREAM_ID))
{
for (long i = 0; i < NUMBER_OF_MESSAGES; i++)
{
final String message = "Hello World! " + i;
final byte[] messageBytes = message.getBytes();
BUFFER.putBytes(0, messageBytes);
System.out.print("Offering " + i + "/" + NUMBER_OF_MESSAGES + " - ");
final long result = publication.offer(BUFFER, 0, messageBytes.length);
if (result < 0L)
{
if (result == Publication.BACK_PRESSURED)
{
System.out.println("Offer failed due to back pressure");
}
else if (result == Publication.NOT_CONNECTED)
{
System.out.println("Offer failed because publisher is not connected to subscriber");
}
else if (result == Publication.ADMIN_ACTION)
{
System.out.println("Offer failed because of an administration action in the system");
}
else if (result == Publication.CLOSED)
{
System.out.println("Offer failed publication is closed");
break;
}
else if (result == Publication.MAX_POSITION_EXCEEDED)
{
System.out.println("Offer failed due to publication reaching max position");
break;
}
else
{
System.out.println("Offer failed due to unknown reason: " + result);
}
}
else
{
System.out.println("yay!");
}
if (!publication.isConnected())
{
System.out.println("No active subscribers detected");
}
Thread.sleep(TimeUnit.SECONDS.toMillis(1));
}
System.out.println("Done sending.");
if (LINGER_TIMEOUT_MS > 0)
{
System.out.println("Lingering for " + LINGER_TIMEOUT_MS + " milliseconds...");
Thread.sleep(LINGER_TIMEOUT_MS);
}
}
CloseHelper.quietClose(driver);
}
}
| [
"[email protected]"
] | |
afb7e4ab795677515420b54d9da6fecfa493b899 | c16ff38932d142be8cf25de0f081bb6dce620142 | /jeuclid-core/src/main/java/net/sourceforge/jeuclid/context/StyleAttributeLayoutContext.java | 6c3a7e43ed744dc55fb23eb57a974a3146274af1 | [
"Apache-2.0",
"BSD-2-Clause"
] | permissive | rototor/jeuclid | 27f298be30ec76e862c08a650041271912739f7e | 859c5d4ca60822a2bca8dcf443867d30eb46a619 | refs/heads/master | 2023-06-14T08:22:17.910263 | 2022-07-14T18:51:07 | 2022-07-14T18:51:07 | 115,260,161 | 10 | 9 | Apache-2.0 | 2020-10-12T21:25:10 | 2017-12-24T12:01:55 | HTML | UTF-8 | Java | false | false | 2,180 | java | /*
* Copyright 2002 - 2007 JEuclid, http://jeuclid.sf.net
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* $Id$ */
package net.sourceforge.jeuclid.context;
import java.awt.Color;
import net.sourceforge.jeuclid.LayoutContext;
import net.sourceforge.jeuclid.elements.support.attributes.AttributesHelper;
/**
* @version $Revision$
*/
public class StyleAttributeLayoutContext implements LayoutContext {
private final LayoutContext parentLayoutContext;
private final String sizeString;
private final Color foregroundColor;
/**
* Default Constructor.
*
* @param parent
* LayoutContext of parent.
* @param msize
* msize String to apply to parent context.
* @param foreground
* Foreground color for new context.
*/
public StyleAttributeLayoutContext(final LayoutContext parent,
final String msize, final Color foreground) {
this.parentLayoutContext = parent;
this.sizeString = msize;
this.foregroundColor = foreground;
}
/** {@inheritDoc} */
public Object getParameter(final Parameter which) {
final Object retVal;
if (Parameter.MATHSIZE.equals(which) && (this.sizeString != null)) {
retVal = AttributesHelper.convertSizeToPt(this.sizeString,
this.parentLayoutContext, AttributesHelper.PT);
} else if (Parameter.MATHCOLOR.equals(which)
&& this.foregroundColor != null) {
retVal = this.foregroundColor;
} else {
retVal = this.parentLayoutContext.getParameter(which);
}
return retVal;
}
}
| [
"[email protected]"
] | |
fa03499f044fa8a5f7a946ff1b18baf370ac63f5 | 5a7b63e17817614d3a823ea92dde98510c1303e6 | /practical-spring-stream-publisher/src/test/java/com/example/practicalspringstreampublisher/PracticalSpringStreamPublisherApplicationTests.java | fae15319eafd9742b043f41b6ff5d67b39468f92 | [] | no_license | agredac/practical-spring-stream | 052751afb1a8ea03522eff70ec7d30488b0f31ac | 54aa1076fbdafa671d2bad6045a4e50e9d21ef50 | refs/heads/master | 2022-09-07T04:11:49.921981 | 2020-05-25T23:15:00 | 2020-05-25T23:15:00 | 266,421,705 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 258 | java | package com.example.practicalspringstreampublisher;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class PracticalSpringStreamPublisherApplicationTests {
@Test
void contextLoads() {
}
}
| [
"[email protected]"
] | |
037687ac0243b1b81e175241fa3c2d24076e751c | 825d41ccfe99f4f0a7553d6856125b0938ff1460 | /src/chapter2/Sample2_6.java | a99f233d125660176f46cda3360ff4f362b0b126 | [] | no_license | ueta19950829/jbasic | 587688092f6fc9ebbaa3adaab6086e0b8928274a | 1cde6d7b4387da976ecdf24d2ac9c4de44b27fb8 | refs/heads/master | 2021-09-15T10:59:05.735649 | 2018-05-31T07:45:48 | 2018-05-31T07:45:48 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 339 | java | package chapter2;
public class Sample2_6 {
public static void main(String[] args) {
for(int i = 0; i < 9; i++) {
for(int j = 0; j < 9; j++) {
int k = (i + 1)*(j + 1);
if(k < 10) {
System.out.print(" " + k);
}else {
System.out.print(" " + k);
}
}
System.out.println();
}
}
}
| [
"kanri@DESKTOP-M6D0HTA"
] | kanri@DESKTOP-M6D0HTA |
894bfad174845e8e83287afef56fd50ea77981e2 | 204de8622e749a1a36a2d05acf7a99467cc28a2b | /petmily/src/test/java/com/petmily/curation/Petmily0117ApplicationTests.java | aabcddc15010ebd0c3bdd058441ca898898964c2 | [] | no_license | sw0817/Petmily | 4d4f49bf25618040e61ef906d83c382f79a7f6db | e4c29b4beef004d3f52451be3c1e3ca46cc0928c | refs/heads/master | 2023-08-17T12:47:59.083155 | 2021-10-19T00:08:15 | 2021-10-19T00:08:15 | 328,923,667 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 217 | java | package com.petmily.curation;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class Petmily0117ApplicationTests {
@Test
void contextLoads() {
}
}
| [
"[email protected]"
] | |
30eeff9f742bfa0c1ec7318ca5fa25071116342b | 86c5be908970f11227b33b2789c7c73e8656cfe0 | /dt.workflow.model.tests/src/workflow/tests/StatementTest.java | 4ea188ee98a34288ddecd13084ed914a663e4490 | [] | no_license | Alexandra93/DT | e0b1268269b70370f60e65682dc0aa00c23a1fdc | 50acc081ed17c87105d6badd6bfdda24fd6fc6db | refs/heads/master | 2020-06-01T17:23:56.165882 | 2017-07-05T06:51:38 | 2017-07-05T06:51:38 | 94,080,834 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,122 | java | /**
*/
package workflow.tests;
import junit.framework.TestCase;
import workflow.Statement;
/**
* <!-- begin-user-doc -->
* A test case for the model object '<em><b>Statement</b></em>'.
* <!-- end-user-doc -->
* @generated
*/
public abstract class StatementTest extends TestCase {
/**
* The fixture for this Statement test case.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected Statement fixture = null;
/**
* Constructs a new Statement test case with the given name.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public StatementTest(String name) {
super(name);
}
/**
* Sets the fixture for this Statement test case.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void setFixture(Statement fixture) {
this.fixture = fixture;
}
/**
* Returns the fixture for this Statement test case.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected Statement getFixture() {
return fixture;
}
} //StatementTest
| [
"Ale@DESKTOP-MK66U22"
] | Ale@DESKTOP-MK66U22 |
e2c2f4b643620709889da1d56163d1ca8d50b7c8 | a993ca4cf0e84c86144c530e8972f4c4cabf9113 | /app/src/test/java/com/vudrag/hnbintegracija/ExampleUnitTest.java | f14a6d30cfd16f1ed1e3c7414b680e705eb9d744 | [] | no_license | VJosko/HNB-integracija | ed627c4cbca5de9f7ee8bef381c250146bf117db | 4cd161514bc0fa8ddbf45fc57b802d052bb327be | refs/heads/master | 2023-04-19T23:59:12.443263 | 2021-05-08T21:35:17 | 2021-05-08T21:35:17 | 365,612,921 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 386 | java | package com.vudrag.hnbintegracija;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | [
"[email protected]"
] | |
e54d0852f9f91713459bbe4ac383ae7a4cc734b0 | e2e250530c86f85c0ddfb22d87fcf11eb1da710e | /src/main/java/io/github/adrianulbona/kata/cc_08_recursion_dynamic/_06_HanoiSolver.java | c567916226d2d7e9f377b37e2fa0def325efe4fd | [] | no_license | adrianulbona/kata | d275f78343e88ac65cbf0065995cabf19783b7d5 | 354d775023b0356612cb21a02aef3c726f8908ab | refs/heads/master | 2020-04-26T09:59:59.029357 | 2020-04-05T06:31:38 | 2020-04-05T06:31:38 | 173,474,590 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 371 | java | package io.github.adrianulbona.kata.cc_08_recursion_dynamic;
import java.util.Stack;
class _06_HanoiSolver {
void move(int n, Stack<Integer> source, Stack<Integer> target, Stack<Integer> aux) {
if (n > 0) {
move(n - 1, source, aux, target);
target.push(source.pop());
move(n - 1, aux, target, source);
}
}
}
| [
"[email protected]"
] | |
c436122e4c3b45ce518db071c82d19e54278f0a6 | 518c0f6e7485442aed3d3c2393c842cb312b7b35 | /gen/com/gizwits/opensource/gokit/R.java | 9393f2ff5b9729a8ea15e14700f5f25788c07154 | [
"MIT"
] | permissive | zhuochuangkeji/Android_Smart_lights | 7b5f5178b04142564d3f2bec98ab7f22e8ba46b6 | 48a936d9965b194c414a50cfb2f790c35716d223 | refs/heads/master | 2021-05-12T09:32:55.113804 | 2018-01-13T07:29:40 | 2018-01-13T07:29:40 | 117,322,983 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 54,480 | java | /* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* aapt tool from the resource data it found. It
* should not be modified by hand.
*/
package com.gizwits.opensource.gokit;
public final class R {
public static final class array {
public static final int color=0x7f040000;
public static final int mode=0x7f040001;
}
public static final class attr {
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static final int gif=0x7f010000;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static final int gifViewStyle=0x7f010002;
/** <p>Must be an integer value, such as "<code>100</code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static final int max=0x7f010008;
/** <p>Must be a boolean value, either "<code>true</code>" or "<code>false</code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static final int paused=0x7f010001;
/** <p>Must be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>",
"<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static final int roundColor=0x7f010003;
/** <p>Must be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>",
"<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static final int roundProgressColor=0x7f010004;
/** <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static final int roundWidth=0x7f010005;
/** <p>Must be one of the following constant values.</p>
<table>
<colgroup align="left" />
<colgroup align="left" />
<colgroup align="left" />
<tr><th>Constant</th><th>Value</th><th>Description</th></tr>
<tr><td><code>STROKE</code></td><td>0</td><td></td></tr>
<tr><td><code>FILL</code></td><td>1</td><td></td></tr>
</table>
*/
public static final int style=0x7f01000a;
/** <p>Must be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>",
"<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static final int textColor=0x7f010006;
/** <p>Must be a boolean value, either "<code>true</code>" or "<code>false</code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static final int textIsDisplayable=0x7f010009;
/** <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static final int textSize=0x7f010007;
}
public static final class color {
public static final int alert_blue=0x7f05000e;
public static final int background_color=0x7f05000f;
public static final int black=0x7f050001;
public static final int config_progressview_color=0x7f05000a;
public static final int floralwhite=0x7f050009;
public static final int gifview_background=0x7f050004;
public static final int gray=0x7f050002;
public static final int image_background=0x7f050010;
public static final int line_gray=0x7f05000c;
public static final int text_blue=0x7f050005;
public static final int text_gray_light=0x7f050006;
public static final int title_gray=0x7f05000b;
public static final int tomato=0x7f050008;
public static final int transparent_half=0x7f050007;
public static final int value_bule=0x7f05000d;
public static final int white=0x7f050000;
public static final int yellow=0x7f050003;
}
public static final class dimen {
/** Default screen margins, per the Android Design guidelines.
Example customization of dimensions originally defined in res/values/dimens.xml
(such as screen margins) for screens with more than 820dp of available width. This
would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively).
*/
public static final int activity_horizontal_margin=0x7f060000;
public static final int activity_vertical_margin=0x7f060001;
public static final int item_deivce_height=0x7f060002;
public static final int item_title_height=0x7f060003;
}
public static final class drawable {
public static final int about_icon=0x7f020000;
public static final int add=0x7f020001;
public static final int airlink=0x7f020002;
public static final int alert_bottom_left_shape=0x7f020003;
public static final int alert_bottom_right_shape=0x7f020004;
public static final int alert_bottom_shape=0x7f020005;
public static final int alert_top_shape=0x7f020006;
public static final int arrow=0x7f020007;
public static final int back_bt=0x7f020008;
public static final int back_bt_=0x7f020009;
public static final int background=0x7f02000a;
public static final int barcode_frame=0x7f02000b;
public static final int barcode_laser_line=0x7f02000c;
public static final int border_layer_list=0x7f02000d;
public static final int btn_getcode_shape_gray=0x7f02000e;
public static final int btn_next_shape_gray=0x7f02000f;
public static final int btnok=0x7f020010;
public static final int button_back=0x7f020011;
public static final int button_blue_long=0x7f020012;
public static final int button_invisible=0x7f020013;
public static final int button_more=0x7f020014;
public static final int button_not_sure=0x7f020015;
public static final int button_refresh=0x7f020016;
public static final int button_setting=0x7f020017;
public static final int button_sure=0x7f020018;
public static final int button_visible=0x7f020019;
public static final int checkbox_hook_selector=0x7f02001a;
public static final int checkbox_laws_selector=0x7f02001b;
public static final int checkmark=0x7f02001c;
public static final int device_icon=0x7f02001d;
public static final int devicelist_item_selector=0x7f02001e;
public static final int failsoft=0x7f02001f;
public static final int gizwitslogo=0x7f020020;
public static final int ic_launcher=0x7f020021;
public static final int ic_richpush_actionbar_back=0x7f020022;
public static final int ic_richpush_actionbar_divider=0x7f020023;
public static final int img_bg_shape=0x7f020024;
public static final int login_password=0x7f020025;
public static final int logo3=0x7f020026;
public static final int mydefault=0x7f020027;
public static final int mymyshoft=0x7f020028;
public static final int nodevice=0x7f020029;
public static final int noselect=0x7f02002a;
public static final int phone=0x7f02002b;
public static final int qq=0x7f02002c;
public static final int resetsoftap=0x7f02002d;
public static final int richpush_btn_selector=0x7f02002e;
public static final int right_icon=0x7f02002f;
public static final int round_rect=0x7f020030;
public static final int select=0x7f020031;
public static final int shape=0x7f020032;
public static final int sms=0x7f020033;
public static final int splash=0x7f020034;
public static final int splashbackgroud=0x7f020035;
public static final int sub=0x7f020036;
public static final int wechat=0x7f020037;
public static final int wifi_icon=0x7f020038;
public static final int yuan=0x7f020039;
}
public static final class id {
public static final int FILL=0x7f07000c;
public static final int SSID_text=0x7f07005a;
public static final int STROKE=0x7f07000d;
public static final int action_QR_code=0x7f070095;
public static final int action_addDevice=0x7f070096;
public static final int action_change_user=0x7f070098;
public static final int action_getHardwareInfo=0x7f070094;
public static final int action_getStatu=0x7f070092;
public static final int action_setDeviceInfo=0x7f070093;
public static final int action_site=0x7f070097;
public static final int actionbarLayoutId=0x7f070086;
public static final int appCode=0x7f070011;
/** Messages IDs
*/
public static final int auto_focus=0x7f070000;
public static final int b=0x7f07006b;
public static final int bitmap_splash=0x7f070091;
public static final int blueadd=0x7f07003f;
public static final int bluesub=0x7f07003d;
public static final int btnAgain=0x7f07002f;
public static final int btnGetCode=0x7f070052;
public static final int btnLogin=0x7f07005d;
public static final int btnNext=0x7f07001c;
public static final int btnNoDevice=0x7f070049;
public static final int btnReset=0x7f070056;
public static final int btnRrgister=0x7f070058;
public static final int btn_cancel=0x7f070029;
public static final int but0=0x7f070064;
public static final int but1=0x7f070065;
public static final int but2=0x7f070067;
public static final int but3=0x7f070068;
public static final int capture_container=0x7f070021;
public static final int capture_crop_view=0x7f070023;
public static final int capture_preview=0x7f070020;
public static final int capture_scan_line=0x7f070024;
public static final int cbLaws=0x7f07001b;
public static final int cbSelect=0x7f07004f;
public static final int decode=0x7f070001;
public static final int decode_failed=0x7f070002;
public static final int decode_succeeded=0x7f070003;
public static final int delete2=0x7f070082;
public static final int dialog_name=0x7f070073;
public static final int diss=0x7f070074;
public static final int dotView1=0x7f070060;
public static final int eT=0x7f07006d;
public static final int eTbut=0x7f07006e;
public static final int eTly=0x7f07006c;
public static final int encode_failed=0x7f070004;
public static final int encode_succeeded=0x7f070005;
public static final int etAlias=0x7f070077;
public static final int etCode=0x7f070054;
public static final int etName=0x7f070051;
public static final int etPsw=0x7f07001a;
public static final int etRemark=0x7f070078;
public static final int etSSID=0x7f070017;
public static final int fullWebView=0x7f07008b;
public static final int greenadd=0x7f07003b;
public static final int greensub=0x7f070039;
public static final int icBoundDevices=0x7f07004b;
public static final int icFoundDevices=0x7f07004c;
public static final int icOfflineDevices=0x7f07004d;
public static final int imageView1=0x7f07000f;
public static final int imageView2=0x7f070016;
public static final int imageView3=0x7f070019;
public static final int imgLeft=0x7f07007d;
public static final int imgNoDevice=0x7f070048;
public static final int imgRichpushBtnBack=0x7f070088;
public static final int imgRight=0x7f070081;
public static final int imgView=0x7f070089;
public static final int imgWiFiList=0x7f070018;
public static final int ivBottom=0x7f070026;
public static final int ivChoosed=0x7f07007b;
public static final int ivLeft=0x7f070027;
public static final int ivRight=0x7f070028;
public static final int ivTop=0x7f070025;
public static final int iv_return=0x7f07002a;
public static final int launch_product_query=0x7f070006;
public static final int layoutparms=0x7f07002e;
public static final int linearLayout1=0x7f07000e;
public static final int linearLayout2=0x7f070053;
public static final int linearLayout3=0x7f070055;
public static final int list_view=0x7f07002c;
public static final int llAbout=0x7f070059;
public static final int llCenter=0x7f070022;
public static final int llChooseMode=0x7f070014;
public static final int llHaveNotDevice=0x7f07008f;
public static final int llLeft=0x7f07007c;
public static final int llNo=0x7f070071;
public static final int llNoDevice=0x7f070047;
public static final int llQQ=0x7f07005e;
public static final int llSure=0x7f070072;
public static final int llWechat=0x7f07005f;
public static final int ll_color=0x7f070032;
public static final int lls=0x7f070066;
public static final int lvColor=0x7f07002d;
public static final int lvMode=0x7f070057;
public static final int ly=0x7f070063;
public static final int nodevice=0x7f07002b;
public static final int ok=0x7f070075;
public static final int params=0x7f07001d;
public static final int popLayoutId=0x7f070084;
public static final int quit=0x7f070007;
public static final int redadd=0x7f070037;
public static final int redsub=0x7f070035;
public static final int restart_preview=0x7f070008;
public static final int return_scan_result=0x7f070009;
public static final int rlRichpushTitleBar=0x7f070087;
public static final int rpbConfig=0x7f07001e;
public static final int sb_blue=0x7f07003e;
public static final int sb_green=0x7f07003a;
public static final int sb_red=0x7f070036;
public static final int sb_speed=0x7f070042;
public static final int scrollView1=0x7f070030;
public static final int search_book_contents_failed=0x7f07000a;
public static final int search_book_contents_succeeded=0x7f07000b;
public static final int slideListView1=0x7f070090;
public static final int softreset=0x7f07006f;
public static final int speedadd=0x7f070043;
public static final int speedsub=0x7f070041;
public static final int svListGroup=0x7f07004a;
public static final int sw=0x7f070062;
public static final int sw_infrared=0x7f070044;
public static final int sw_red=0x7f070031;
public static final int textView0=0x7f070069;
public static final int textView1=0x7f070012;
public static final int textView2=0x7f070010;
public static final int textView3=0x7f07006a;
public static final int tvAlert=0x7f070076;
public static final int tvColorText=0x7f070033;
public static final int tvColorsText=0x7f07007a;
public static final int tvContentText=0x7f07008d;
public static final int tvContentTitle=0x7f07008c;
public static final int tvDeviceMac=0x7f07007f;
public static final int tvDeviceName=0x7f07007e;
public static final int tvDeviceStatus=0x7f070080;
public static final int tvForget=0x7f07005b;
public static final int tvListViewTitle=0x7f07008e;
public static final int tvMode=0x7f070015;
public static final int tvModeText=0x7f070083;
public static final int tvNoRedLight=0x7f07004e;
public static final int tvPass=0x7f070061;
public static final int tvRegister=0x7f07005c;
public static final int tvRichpushTitle=0x7f07008a;
public static final int tvSelect=0x7f070050;
public static final int tvTimer=0x7f07001f;
public static final int tv_blue=0x7f07003c;
public static final int tv_green=0x7f070038;
public static final int tv_humidity=0x7f070046;
public static final int tv_prompt=0x7f070070;
public static final int tv_red=0x7f070034;
public static final int tv_speed=0x7f070040;
public static final int tv_template=0x7f070045;
public static final int versionCode=0x7f070013;
public static final int wifi_list=0x7f070079;
public static final int wvPopwin=0x7f070085;
}
public static final class layout {
public static final int activity_gos_about=0x7f030000;
public static final int activity_gos_airlink_choose_device_workwifi=0x7f030001;
public static final int activity_gos_airlink_config_countdown=0x7f030002;
public static final int activity_gos_capture=0x7f030003;
public static final int activity_gos_check_device_workwifi=0x7f030004;
public static final int activity_gos_choose_device=0x7f030005;
public static final int activity_gos_colorlist=0x7f030006;
public static final int activity_gos_config_countdown=0x7f030007;
public static final int activity_gos_config_failed=0x7f030008;
public static final int activity_gos_device_control=0x7f030009;
public static final int activity_gos_device_list=0x7f03000a;
public static final int activity_gos_device_ready=0x7f03000b;
public static final int activity_gos_forget_password=0x7f03000c;
public static final int activity_gos_modelist=0x7f03000d;
public static final int activity_gos_register_user=0x7f03000e;
public static final int activity_gos_settings=0x7f03000f;
public static final int activity_gos_user_login=0x7f030010;
public static final int activity_xing=0x7f030011;
public static final int activity_zhinengdeng=0x7f030012;
public static final int actvity_gos_airlink_ready=0x7f030013;
public static final int actvity_gos_device_reset=0x7f030014;
public static final int alert_gos_empty=0x7f030015;
public static final int alert_gos_logout=0x7f030016;
public static final int alert_gos_new_device=0x7f030017;
public static final int alert_gos_no_id=0x7f030018;
public static final int alert_gos_quit=0x7f030019;
public static final int alert_gos_set_device_info=0x7f03001a;
public static final int alert_gos_wifi_list=0x7f03001b;
public static final int item_gos_colors_list=0x7f03001c;
public static final int item_gos_device_list=0x7f03001d;
public static final int item_gos_mode_list=0x7f03001e;
public static final int item_gos_wifi_list=0x7f03001f;
public static final int jpush_popwin_layout=0x7f030020;
public static final int jpush_webview_layout=0x7f030021;
public static final int view_gos_notification=0x7f030022;
public static final int view_gos_title_listview=0x7f030023;
}
public static final class menu {
public static final int devicecontrol=0x7f0a0000;
public static final int devicecontrol_lan=0x7f0a0001;
public static final int devicelist_login=0x7f0a0002;
public static final int devicelist_logout=0x7f0a0003;
}
public static final class string {
/** App Toast
App Toast
*/
public static final int AppID_Toast=0x7f09008f;
public static final int BDPushAppID_Toast=0x7f090092;
public static final int GIZ_OPENAPI_APPID_INVALID=0x7f0900e2;
public static final int GIZ_OPENAPI_APPLICATION_AUTH_INVALID=0x7f090105;
public static final int GIZ_OPENAPI_ATTR_INVALID=0x7f0900f8;
public static final int GIZ_OPENAPI_BAD_QRCODE_CONTENT=0x7f090107;
public static final int GIZ_OPENAPI_BT_FIRMWARE_NOTHING_TO_UPGRADE=0x7f090101;
public static final int GIZ_OPENAPI_BT_FIRMWARE_UNVERIFIED=0x7f090100;
public static final int GIZ_OPENAPI_CODE_EXPIRED=0x7f0900e8;
public static final int GIZ_OPENAPI_CODE_INVALID=0x7f0900e9;
public static final int GIZ_OPENAPI_DATAPOINT_DATA_NOT_FOUND=0x7f0900fc;
public static final int GIZ_OPENAPI_DEPRECATED_API=0x7f09010c;
public static final int GIZ_OPENAPI_DEVICE_DISABLED=0x7f0900f6;
public static final int GIZ_OPENAPI_DEVICE_NOT_BOUND=0x7f0900f0;
public static final int GIZ_OPENAPI_DEVICE_NOT_FOUND=0x7f0900ed;
public static final int GIZ_OPENAPI_DEVICE_OFFLINE=0x7f090109;
public static final int GIZ_OPENAPI_DID_PASSCODE_INVALID=0x7f0900ef;
public static final int GIZ_OPENAPI_EMAIL_UNAVALIABLE=0x7f0900f5;
public static final int GIZ_OPENAPI_EVENT_NOT_DEFINED=0x7f090103;
public static final int GIZ_OPENAPI_FAILED_NOTIFY_M2M=0x7f0900f7;
public static final int GIZ_OPENAPI_FIRMWARE_NOT_FOUND=0x7f0900fa;
public static final int GIZ_OPENAPI_FORM_INVALID=0x7f0900ee;
public static final int GIZ_OPENAPI_JD_PRODUCT_NOT_FOUND=0x7f0900fb;
public static final int GIZ_OPENAPI_M2M_ID_INVALID=0x7f0900e6;
public static final int GIZ_OPENAPI_MAC_ALREADY_REGISTERED=0x7f0900e0;
public static final int GIZ_OPENAPI_NOT_ALLOWED_CALL_API=0x7f090106;
public static final int GIZ_OPENAPI_OTA_SERVICE_OK_BUT_IN_IDLE=0x7f0900ff;
public static final int GIZ_OPENAPI_PHONE_UNAVALIABLE=0x7f0900f1;
public static final int GIZ_OPENAPI_PRODUCTION_SCALE_QUOTA_EXHAUSTED=0x7f0900eb;
public static final int GIZ_OPENAPI_PRODUCT_HAS_NO_REQUEST_SCALE=0x7f0900ec;
public static final int GIZ_OPENAPI_PRODUCT_KEY_INVALID=0x7f0900e1;
public static final int GIZ_OPENAPI_QQ_OAUTH_KEY_INVALID=0x7f0900fe;
public static final int GIZ_OPENAPI_REQUEST_THROTTLED=0x7f090108;
public static final int GIZ_OPENAPI_RESERVED=0x7f09010d;
public static final int GIZ_OPENAPI_SANDBOX_SCALE_QUOTA_EXHAUSTED=0x7f0900ea;
public static final int GIZ_OPENAPI_SAVE_KAIROSDB_ERROR=0x7f090102;
public static final int GIZ_OPENAPI_SCHEDULER_NOT_FOUND=0x7f0900fd;
public static final int GIZ_OPENAPI_SEND_COMMAND_FAILED=0x7f0900f4;
public static final int GIZ_OPENAPI_SEND_SMS_FAILED=0x7f090104;
public static final int GIZ_OPENAPI_SERVER_ERROR=0x7f0900e7;
public static final int GIZ_OPENAPI_SIGNATURE_INVALID=0x7f09010b;
public static final int GIZ_OPENAPI_TIMESTAMP_INVALID=0x7f09010a;
public static final int GIZ_OPENAPI_TOKEN_EXPIRED=0x7f0900e5;
public static final int GIZ_OPENAPI_TOKEN_INVALID=0x7f0900e3;
public static final int GIZ_OPENAPI_USERNAME_PASSWORD_ERROR=0x7f0900f3;
public static final int GIZ_OPENAPI_USERNAME_UNAVALIABLE=0x7f0900f2;
public static final int GIZ_OPENAPI_USER_INVALID=0x7f0900f9;
public static final int GIZ_OPENAPI_USER_NOT_EXIST=0x7f0900e4;
public static final int GIZ_PUSHAPI_APPID_OR_TOKEN_ERROR=0x7f090115;
public static final int GIZ_PUSHAPI_APPKEY_SECRETKEY_INVALID=0x7f090118;
public static final int GIZ_PUSHAPI_AUTH_KEY_INVALID=0x7f090114;
public static final int GIZ_PUSHAPI_BODY_JSON_INVALID=0x7f09010e;
public static final int GIZ_PUSHAPI_CHANNELID_ERROR_INVALID=0x7f090119;
public static final int GIZ_PUSHAPI_DATA_NOT_EXIST=0x7f09010f;
public static final int GIZ_PUSHAPI_GIZWITS_APPID_EXIST=0x7f090112;
public static final int GIZ_PUSHAPI_ID_PARAM_ERROR=0x7f090117;
public static final int GIZ_PUSHAPI_NO_CLIENT_CONFIG=0x7f090110;
public static final int GIZ_PUSHAPI_NO_SERVER_DATA=0x7f090111;
public static final int GIZ_PUSHAPI_PARAM_ERROR=0x7f090113;
public static final int GIZ_PUSHAPI_PUSH_ERROR=0x7f09011a;
public static final int GIZ_PUSHAPI_TYPE_PARAM_ERROR=0x7f090116;
public static final int GIZ_SDK_APK_CONTEXT_IS_NULL=0x7f0900cd;
public static final int GIZ_SDK_APK_PERMISSION_NOT_SET=0x7f0900ce;
public static final int GIZ_SDK_APPID_IS_EMPTY=0x7f0900d2;
public static final int GIZ_SDK_APPID_LENGTH_ERROR=0x7f09009a;
public static final int GIZ_SDK_BIND_DEVICE_FAILED=0x7f0900ae;
public static final int GIZ_SDK_CHMOD_DAEMON_REFUSED=0x7f0900cf;
public static final int GIZ_SDK_CLIENT_NOT_AUTHEN=0x7f090095;
public static final int GIZ_SDK_CLIENT_VERSION_INVALID=0x7f090096;
public static final int GIZ_SDK_CONNECTION_CLOSED=0x7f0900b6;
public static final int GIZ_SDK_CONNECTION_ERROR=0x7f0900b5;
public static final int GIZ_SDK_CONNECTION_REFUSED=0x7f0900b4;
public static final int GIZ_SDK_CONNECTION_TIMEOUT=0x7f0900b3;
public static final int GIZ_SDK_DAEMON_EXCEPTION=0x7f090098;
public static final int GIZ_SDK_DAEMON_VERSION_INVALID=0x7f0900d5;
public static final int GIZ_SDK_DATAPOINT_NOT_DOWNLOAD=0x7f0900c9;
public static final int GIZ_SDK_DATAPOINT_PARSE_FAILED=0x7f0900cb;
public static final int GIZ_SDK_DATAPOINT_SERVICE_UNAVAILABLE=0x7f0900ca;
public static final int GIZ_SDK_DEVICE_CONFIG_IS_RUNNING=0x7f09009e;
public static final int GIZ_SDK_DEVICE_CONFIG_SEND_FAILED=0x7f09009d;
public static final int GIZ_SDK_DEVICE_CONFIG_SSID_NOT_MATCHED=0x7f0900d7;
public static final int GIZ_SDK_DEVICE_CONFIG_TIMEOUT=0x7f09009f;
public static final int GIZ_SDK_DEVICE_CONTROL_FAILED=0x7f0900a9;
public static final int GIZ_SDK_DEVICE_CONTROL_NOT_WRITABLE_COMMAND=0x7f0900ad;
public static final int GIZ_SDK_DEVICE_CONTROL_VALUE_OUT_OF_RANGE=0x7f0900ac;
public static final int GIZ_SDK_DEVICE_CONTROL_VALUE_TYPE_ERROR=0x7f0900ab;
public static final int GIZ_SDK_DEVICE_CONTROL_WITH_INVALID_COMMAND=0x7f0900a8;
public static final int GIZ_SDK_DEVICE_DID_INVALID=0x7f0900a0;
public static final int GIZ_SDK_DEVICE_GET_STATUS_FAILED=0x7f0900aa;
public static final int GIZ_SDK_DEVICE_LOGIN_VERIFY_FAILED=0x7f0900b8;
public static final int GIZ_SDK_DEVICE_MAC_INVALID=0x7f0900a1;
public static final int GIZ_SDK_DEVICE_NOT_BINDED=0x7f0900a7;
public static final int GIZ_SDK_DEVICE_NOT_READY=0x7f0900a6;
public static final int GIZ_SDK_DEVICE_NOT_SUBSCRIBED=0x7f0900a4;
public static final int GIZ_SDK_DEVICE_NO_RESPONSE=0x7f0900a5;
public static final int GIZ_SDK_DEVICE_PASSCODE_INVALID=0x7f0900a3;
public static final int GIZ_SDK_DNS_FAILED=0x7f0900b0;
public static final int GIZ_SDK_EXEC_CATCH_EXCEPTION=0x7f0900d1;
public static final int GIZ_SDK_EXEC_DAEMON_FAILED=0x7f0900d0;
public static final int GIZ_SDK_GROUPNAME_INVALID=0x7f0900c4;
public static final int GIZ_SDK_GROUP_FAILED_ADD_DEVICE=0x7f0900c7;
public static final int GIZ_SDK_GROUP_FAILED_DELETE_DEVICE=0x7f0900c6;
public static final int GIZ_SDK_GROUP_GET_DEVICE_FAILED=0x7f0900c8;
public static final int GIZ_SDK_GROUP_ID_INVALID=0x7f0900c3;
public static final int GIZ_SDK_GROUP_PRODUCTKEY_INVALID=0x7f0900c5;
public static final int GIZ_SDK_HTTP_ANSWER_FORMAT_ERROR=0x7f0900ba;
public static final int GIZ_SDK_HTTP_ANSWER_PARAM_ERROR=0x7f0900bb;
public static final int GIZ_SDK_HTTP_REQUEST_FAILED=0x7f0900bd;
public static final int GIZ_SDK_HTTP_SERVER_NO_ANSWER=0x7f0900bc;
public static final int GIZ_SDK_INTERNET_NOT_REACHABLE=0x7f0900b9;
public static final int GIZ_SDK_LOG_LEVEL_INVALID=0x7f09009c;
public static final int GIZ_SDK_LOG_PATH_INVALID=0x7f09009b;
public static final int GIZ_SDK_M2M_CONNECTION_SUCCESS=0x7f0900b1;
public static final int GIZ_SDK_MEMORY_MALLOC_FAILED=0x7f0900bf;
public static final int GIZ_SDK_NOT_IN_SOFTAPMODE=0x7f0900d8;
public static final int GIZ_SDK_OTHERWISE=0x7f0900be;
/** Error Toast
Error Toast
*/
public static final int GIZ_SDK_PARAM_FORM_INVALID=0x7f090094;
public static final int GIZ_SDK_PARAM_INVALID=0x7f090099;
public static final int GIZ_SDK_PHONE_NOT_CONNECT_TO_SOFTAP_SSID=0x7f0900d6;
public static final int GIZ_SDK_PHONE_WIFI_IS_UNAVAILABLE=0x7f0900d9;
public static final int GIZ_SDK_PRODUCT_IS_DOWNLOADING=0x7f0900db;
public static final int GIZ_SDK_RAW_DATA_TRANSMIT=0x7f0900da;
public static final int GIZ_SDK_REQUEST_TIMEOUT=0x7f0900d4;
public static final int GIZ_SDK_SDK_NOT_INITIALIZED=0x7f0900cc;
public static final int GIZ_SDK_SET_SOCKET_NON_BLOCK_FAILED=0x7f0900b2;
public static final int GIZ_SDK_SSL_HANDSHAKE_FAILED=0x7f0900b7;
public static final int GIZ_SDK_START_SUCCESS=0x7f0900dc;
public static final int GIZ_SDK_SUBDEVICE_DID_INVALID=0x7f0900a2;
public static final int GIZ_SDK_THREAD_CREATE_FAILED=0x7f0900c0;
public static final int GIZ_SDK_TOKEN_INVALID=0x7f0900c2;
public static final int GIZ_SDK_UDP_PORT_BIND_FAILED=0x7f090097;
public static final int GIZ_SDK_UNBIND_DEVICE_FAILED=0x7f0900af;
public static final int GIZ_SDK_UNSUPPORTED_API=0x7f0900d3;
public static final int GIZ_SDK_USER_ID_INVALID=0x7f0900c1;
public static final int GIZ_SITE_DATAPOINTS_NOT_DEFINED=0x7f0900de;
public static final int GIZ_SITE_DATAPOINTS_NOT_MALFORME=0x7f0900df;
public static final int GIZ_SITE_PRODUCTKEY_INVALID=0x7f0900dd;
public static final int Humidity=0x7f090078;
public static final int Infrared=0x7f090076;
public static final int No_WXApp=0x7f090093;
public static final int QQ=0x7f090011;
/** 菜单
菜单
*/
public static final int QR_code=0x7f090065;
public static final int SDKversion=0x7f090060;
public static final int Temperature=0x7f090077;
public static final int TencentAPPID_Toast=0x7f090090;
public static final int UNKNOWN_ERROR=0x7f09011b;
public static final int Wechat=0x7f090012;
public static final int WechatAppID_Toast=0x7f090091;
public static final int about=0x7f090061;
/** 配置模块
ReadyDeviceActivity
配置模块
ReadyDeviceActivity
*/
public static final int add_device=0x7f090025;
public static final int add_device_menu=0x7f090026;
public static final int add_failed=0x7f090069;
/** 扫描二维码
扫描二维码
*/
public static final int add_successful=0x7f090068;
public static final int airlink_ready_message=0x7f09008a;
/** AirlinkReadyActivity
AirlinkReadyActivity
*/
public static final int airlink_ready_title=0x7f090089;
public static final int alias_hint=0x7f09007e;
/** 用户模块
UserLoginActivity
用户模块
UserLoginActivity
*/
public static final int app_company=0x7f090001;
public static final int app_name=0x7f090000;
/** AboutActivity
AboutActivity
*/
public static final int appversion=0x7f09005f;
public static final int besure=0x7f090041;
public static final int bound_divices=0x7f090055;
public static final int bound_failed=0x7f090059;
public static final int bound_successful=0x7f090058;
public static final int btn_register=0x7f09001e;
public static final int camera_error=0x7f090063;
public static final int cancel=0x7f090040;
public static final int cancel_besure=0x7f09003f;
public static final int cancel_logout=0x7f09005b;
public static final int change_user=0x7f090067;
public static final int check_first=0x7f090047;
public static final int check_fourth=0x7f09004a;
public static final int check_psw=0x7f090035;
/** ChooseDeviceWorkWifi
CheckDeviceWorkWifi
*/
public static final int check_psw_title=0x7f090034;
public static final int check_second=0x7f090048;
public static final int check_third=0x7f090049;
public static final int choose_mode_start=0x7f090086;
/** AitlinkChooseDeviceWorkWifiActivity
AitlinkChooseDeviceWorkWifiActivity
*/
public static final int choose_mode_title=0x7f090085;
public static final int choose_wifi_list_title=0x7f090039;
/** ChooseDeviceActivity
ChooseDeviceActivity
*/
public static final int choosedevice=0x7f09002e;
public static final int code_hint=0x7f090017;
public static final int config_again=0x7f09004b;
/** ConfigCountDownActivity
ConfigCountDownActivity
*/
public static final int configcountDown_title=0x7f09003b;
public static final int configuration_failed=0x7f09003d;
public static final int configuration_message=0x7f090087;
public static final int configuration_successful=0x7f09003c;
public static final int configuration_title=0x7f090036;
public static final int device_connect=0x7f090042;
public static final int device_no_ready=0x7f090084;
/** 设备列表
DeviceListActivity
设备列表
DeviceListActivity
*/
public static final int devicelist_title=0x7f09004c;
public static final int disconnect=0x7f090079;
public static final int double_click=0x7f090013;
public static final int doubleclick_back=0x7f09005e;
public static final int doubleclick_logout=0x7f09005d;
public static final int finished=0x7f090029;
public static final int five_wifi=0x7f090088;
public static final int forget_password=0x7f090006;
public static final int found_devices=0x7f09004e;
public static final int found_many_devices=0x7f090053;
public static final int getHardwareInfo=0x7f09007b;
public static final int getStatu=0x7f09007a;
/** RegisterActivity
RegisterActivity
*/
public static final int getcode=0x7f090014;
public static final int getcode_again=0x7f090015;
public static final int hardwareInfo=0x7f09007d;
public static final int havenot_device=0x7f09004f;
public static final int itemtext_end=0x7f090032;
public static final int itemtext_start=0x7f090031;
public static final int join_by_hands=0x7f09002a;
public static final int join_failed_title=0x7f090046;
public static final int lan=0x7f090051;
public static final int like_img=0x7f090027;
public static final int loadingtext=0x7f09000f;
public static final int login=0x7f090007;
public static final int name_digits=0x7f090004;
public static final int name_hint=0x7f090002;
public static final int network_error=0x7f090030;
public static final int next=0x7f09002b;
public static final int no=0x7f09005c;
public static final int no_devices=0x7f090054;
public static final int no_getcode=0x7f09001d;
public static final int no_lan=0x7f090050;
public static final int nodevice=0x7f09002f;
public static final int noredlight=0x7f090028;
public static final int not_text=0x7f09006e;
/** MessageHandler
MessageHandler
*/
public static final int not_ticker=0x7f09006c;
public static final int not_title=0x7f09006d;
public static final int notify=0x7f09006f;
public static final int offline_devices=0x7f09004d;
/** 设备控制
DeviceControlActivity
设备控制
DeviceControlActivity
*/
public static final int onoff_LED=0x7f090070;
public static final int pass=0x7f090010;
public static final int password_hint=0x7f090003;
/** FailedConfigActivity
FailedConfigActivity
*/
public static final int please_check=0x7f090045;
public static final int prompt=0x7f09003e;
public static final int psw_digits=0x7f090005;
public static final int qr_code_tips=0x7f09006a;
public static final int register=0x7f090008;
public static final int register_failed=0x7f090020;
public static final int register_successful=0x7f09001f;
public static final int remark_hint=0x7f09007f;
public static final int remove_bound=0x7f090056;
/** ForgetPasswordActivity
ForgetPasswordActivity
*/
public static final int reset=0x7f090021;
/** ResetDeviceActivity
ResetDeviceActivity
*/
public static final int reset_device=0x7f09002c;
public static final int reset_failed=0x7f090023;
public static final int reset_successful=0x7f090022;
public static final int reset_title=0x7f090024;
public static final int resetmessage=0x7f09002d;
public static final int scan=0x7f090064;
public static final int scanning_successful=0x7f09006b;
/** AirlinkConfigCountdown
AirlinkConfigCountdown
*/
public static final int search_join=0x7f09008b;
public static final int searched_device=0x7f09008d;
public static final int searching_device=0x7f09008c;
public static final int send_failed=0x7f090019;
public static final int send_successful=0x7f090018;
public static final int setDeviceInfo=0x7f09007c;
public static final int set_Alias_Remark=0x7f090083;
public static final int set_blue_LED=0x7f090074;
public static final int set_green_LED=0x7f090073;
public static final int set_group_LED=0x7f090071;
public static final int set_info_failed=0x7f090081;
public static final int set_info_successful=0x7f090080;
public static final int set_motor_speed=0x7f090075;
public static final int set_red_LED=0x7f090072;
public static final int setsubscribe_failed=0x7f09005a;
public static final int site=0x7f090066;
public static final int softPsw_hint=0x7f090037;
public static final int softap_loading=0x7f090044;
public static final int softssid_error=0x7f09003a;
public static final int ssid_start=0x7f090033;
public static final int timer_message=0x7f090016;
public static final int timer_text=0x7f090043;
public static final int toast_code_empet=0x7f09001a;
public static final int toast_login_failed=0x7f09000d;
public static final int toast_login_successful=0x7f09000c;
public static final int toast_name_empet=0x7f090009;
public static final int toast_name_wrong=0x7f09000a;
public static final int toast_psw_empet=0x7f09000b;
public static final int toast_psw_short=0x7f09001c;
public static final int toast_psw_wrong=0x7f09001b;
public static final int toast_third_login_failed=0x7f09000e;
public static final int trying_join_device=0x7f09008e;
public static final int unbind=0x7f090052;
public static final int unbound_failed=0x7f090057;
/** CaptureActivity
CaptureActivity
*/
public static final int unknown_device=0x7f090062;
public static final int waiting_device_ready=0x7f090082;
public static final int workwifi_isnull=0x7f090038;
}
public static final class style {
public static final int AcBar_titleStyle=0x7f080005;
/**
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
Base application theme for API 11+. This theme completely replaces
AppBaseTheme from res/values/styles.xml on API 11+ devices.
API 11 theme customizations can go here.
Base application theme for API 14+. This theme completely replaces
AppBaseTheme from BOTH res/values/styles.xml and
res/values-v11/styles.xml on API 14+ devices.
API 14 theme customizations can go here.
*/
public static final int AppBaseTheme=0x7f080001;
/** Application thianeme.
All customizations that are NOT specific to a particular API-level can go here.
*/
public static final int AppTheme=0x7f080002;
public static final int ButtonBlue=0x7f08000a;
public static final int ButtonStyle=0x7f080008;
public static final int Controlitem=0x7f08000b;
public static final int EditTextStyle=0x7f080007;
public static final int MyDialogStyle=0x7f080000;
public static final int My_Start=0x7f080004;
/** 重写actionbar中 OverFlow的属性
*/
public static final int OverFlow=0x7f080006;
/**
<style name="LinearlayoutStyle">
<item name="android:background">@drawable/button_shape</item>
<item name="android:layout_marginLeft">40dp</item>
<item name="android:layout_marginRight">40dp</item>
<item name="android:textColor">@color/black</item>
<item name="android:layout_marginBottom">20dp</item>
</style>
*/
public static final int Widget_GifView=0x7f080009;
public static final int my_actionbar_style=0x7f080003;
}
public static final class styleable {
/** Attributes that can be used with a CustomTheme.
<p>Includes the following attributes:</p>
<table>
<colgroup align="left" />
<colgroup align="left" />
<tr><th>Attribute</th><th>Description</th></tr>
<tr><td><code>{@link #CustomTheme_gifViewStyle com.gizwits.opensource.gokit:gifViewStyle}</code></td><td></td></tr>
</table>
@see #CustomTheme_gifViewStyle
*/
public static final int[] CustomTheme = {
0x7f010002
};
/**
<p>This symbol is the offset where the {@link com.gizwits.opensource.gokit.R.attr#gifViewStyle}
attribute's value can be found in the {@link #CustomTheme} array.
<p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
@attr name com.gizwits.opensource.gokit:gifViewStyle
*/
public static final int CustomTheme_gifViewStyle = 0;
/** Attributes that can be used with a GifView.
<p>Includes the following attributes:</p>
<table>
<colgroup align="left" />
<colgroup align="left" />
<tr><th>Attribute</th><th>Description</th></tr>
<tr><td><code>{@link #GifView_gif com.gizwits.opensource.gokit:gif}</code></td><td></td></tr>
<tr><td><code>{@link #GifView_paused com.gizwits.opensource.gokit:paused}</code></td><td></td></tr>
</table>
@see #GifView_gif
@see #GifView_paused
*/
public static final int[] GifView = {
0x7f010000, 0x7f010001
};
/**
<p>This symbol is the offset where the {@link com.gizwits.opensource.gokit.R.attr#gif}
attribute's value can be found in the {@link #GifView} array.
<p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
@attr name com.gizwits.opensource.gokit:gif
*/
public static final int GifView_gif = 0;
/**
<p>This symbol is the offset where the {@link com.gizwits.opensource.gokit.R.attr#paused}
attribute's value can be found in the {@link #GifView} array.
<p>Must be a boolean value, either "<code>true</code>" or "<code>false</code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name com.gizwits.opensource.gokit:paused
*/
public static final int GifView_paused = 1;
/** Attributes that can be used with a RoundProgressBar.
<p>Includes the following attributes:</p>
<table>
<colgroup align="left" />
<colgroup align="left" />
<tr><th>Attribute</th><th>Description</th></tr>
<tr><td><code>{@link #RoundProgressBar_max com.gizwits.opensource.gokit:max}</code></td><td></td></tr>
<tr><td><code>{@link #RoundProgressBar_roundColor com.gizwits.opensource.gokit:roundColor}</code></td><td></td></tr>
<tr><td><code>{@link #RoundProgressBar_roundProgressColor com.gizwits.opensource.gokit:roundProgressColor}</code></td><td></td></tr>
<tr><td><code>{@link #RoundProgressBar_roundWidth com.gizwits.opensource.gokit:roundWidth}</code></td><td></td></tr>
<tr><td><code>{@link #RoundProgressBar_style com.gizwits.opensource.gokit:style}</code></td><td></td></tr>
<tr><td><code>{@link #RoundProgressBar_textColor com.gizwits.opensource.gokit:textColor}</code></td><td></td></tr>
<tr><td><code>{@link #RoundProgressBar_textIsDisplayable com.gizwits.opensource.gokit:textIsDisplayable}</code></td><td></td></tr>
<tr><td><code>{@link #RoundProgressBar_textSize com.gizwits.opensource.gokit:textSize}</code></td><td></td></tr>
</table>
@see #RoundProgressBar_max
@see #RoundProgressBar_roundColor
@see #RoundProgressBar_roundProgressColor
@see #RoundProgressBar_roundWidth
@see #RoundProgressBar_style
@see #RoundProgressBar_textColor
@see #RoundProgressBar_textIsDisplayable
@see #RoundProgressBar_textSize
*/
public static final int[] RoundProgressBar = {
0x7f010003, 0x7f010004, 0x7f010005, 0x7f010006,
0x7f010007, 0x7f010008, 0x7f010009, 0x7f01000a
};
/**
<p>This symbol is the offset where the {@link com.gizwits.opensource.gokit.R.attr#max}
attribute's value can be found in the {@link #RoundProgressBar} array.
<p>Must be an integer value, such as "<code>100</code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name com.gizwits.opensource.gokit:max
*/
public static final int RoundProgressBar_max = 5;
/**
<p>This symbol is the offset where the {@link com.gizwits.opensource.gokit.R.attr#roundColor}
attribute's value can be found in the {@link #RoundProgressBar} array.
<p>Must be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>",
"<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name com.gizwits.opensource.gokit:roundColor
*/
public static final int RoundProgressBar_roundColor = 0;
/**
<p>This symbol is the offset where the {@link com.gizwits.opensource.gokit.R.attr#roundProgressColor}
attribute's value can be found in the {@link #RoundProgressBar} array.
<p>Must be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>",
"<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name com.gizwits.opensource.gokit:roundProgressColor
*/
public static final int RoundProgressBar_roundProgressColor = 1;
/**
<p>This symbol is the offset where the {@link com.gizwits.opensource.gokit.R.attr#roundWidth}
attribute's value can be found in the {@link #RoundProgressBar} array.
<p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name com.gizwits.opensource.gokit:roundWidth
*/
public static final int RoundProgressBar_roundWidth = 2;
/**
<p>This symbol is the offset where the {@link com.gizwits.opensource.gokit.R.attr#style}
attribute's value can be found in the {@link #RoundProgressBar} array.
<p>Must be one of the following constant values.</p>
<table>
<colgroup align="left" />
<colgroup align="left" />
<colgroup align="left" />
<tr><th>Constant</th><th>Value</th><th>Description</th></tr>
<tr><td><code>STROKE</code></td><td>0</td><td></td></tr>
<tr><td><code>FILL</code></td><td>1</td><td></td></tr>
</table>
@attr name com.gizwits.opensource.gokit:style
*/
public static final int RoundProgressBar_style = 7;
/**
<p>This symbol is the offset where the {@link com.gizwits.opensource.gokit.R.attr#textColor}
attribute's value can be found in the {@link #RoundProgressBar} array.
<p>Must be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>",
"<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name com.gizwits.opensource.gokit:textColor
*/
public static final int RoundProgressBar_textColor = 3;
/**
<p>This symbol is the offset where the {@link com.gizwits.opensource.gokit.R.attr#textIsDisplayable}
attribute's value can be found in the {@link #RoundProgressBar} array.
<p>Must be a boolean value, either "<code>true</code>" or "<code>false</code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name com.gizwits.opensource.gokit:textIsDisplayable
*/
public static final int RoundProgressBar_textIsDisplayable = 6;
/**
<p>This symbol is the offset where the {@link com.gizwits.opensource.gokit.R.attr#textSize}
attribute's value can be found in the {@link #RoundProgressBar} array.
<p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name com.gizwits.opensource.gokit:textSize
*/
public static final int RoundProgressBar_textSize = 4;
};
}
| [
"[email protected]"
] | |
222a8f5a3a8e109e992c8c52163014a4ac621b9b | 14b866ed3002fc26ef02db5b75a2bc23192c0fed | /test-java/proj-java-attack-dbs/src/main/java/com/sc/project/attackdbs/model/MySqlConnection.java | 303db14196c04deaf565ecc99623835c5222646d | [] | no_license | sergiocy/scripts-tests | 76333d26721f1bd6e61b473f6ce108f3a5bb2ccb | a55814799deae47954a7ca8320d07258d4b1a8ca | refs/heads/master | 2022-09-16T10:49:41.689459 | 2020-07-19T12:56:46 | 2020-07-19T12:56:46 | 178,724,341 | 0 | 0 | null | 2022-09-01T23:26:30 | 2019-03-31T18:09:41 | R | UTF-8 | Java | false | false | 3,495 | java | package com.sc.project.attackdbs.model;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class MySqlConnection implements IConnection {
String mysqlDataBase = null;
String mysqlIp = null;
String mysqlUser = null;
String mysqlPassword = null;
Connection mysqlConnection = null;
//List<Map<String,List<String>>> mysqlData = null;
//List<String> mysqlSchema = null;
//...atributos para las queries...
List<String> fieldsInResultSet = null;
public MySqlConnection(String ipHost, String dbName, String us, String pw){
this.mysqlDataBase = dbName;
this.mysqlIp = ipHost;
this.mysqlUser = us;
this.mysqlPassword = pw;
this.fieldsInResultSet = new ArrayList<String>();
}
public void setMysqlConnection(){
String ip = this.mysqlIp;
String db = this.mysqlDataBase;
String us = this.mysqlUser;
String pw = this.mysqlPassword;
Connection con = null;
String sURL = "jdbc:mysql://"+ip+"/"+db;
try {
Class.forName("com.mysql.jdbc.Driver");
con = DriverManager.getConnection(sURL,us,pw); //("jdbc:mysql://localhost/prueba","root", "la_clave")
}
catch (SQLException e) {
e.printStackTrace();
}
catch (ClassNotFoundException e) {
e.printStackTrace();
}
this.mysqlConnection = con;
}
public List<String> getFieldsInResultSet(){
return this.fieldsInResultSet;
}
/*
* FUNCION QUE GENERA EL RESULTSET EN UNA ESTRUCTURA List<Map<String, List<String>>>
* OJO PORQUE ESTA HECHO PARA QUE LOS CAMPOS SEAN STRING
*/
public List<Map<String, List<String>>> queryData(String queryStr){
Connection con = this.mysqlConnection;
List<String> colNamesInQuery = new ArrayList<String>();
//...generaremos un Map por cada columna que almacenamos en una lista de Maps. Esta estructura simula una tabla donde cada map es una columna...
List<Map<String, List<String>>> queryResult = new ArrayList<Map<String, List<String>>>();
try {
//...ejecutamos la consulta...
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery(queryStr);
//...obtenemos los nombres de las columnas, los seteamos en "colNamesInQuery"
//...y en la lista de mapas...
ResultSetMetaData colNames = rs.getMetaData();
for(int nCol = 1; nCol <= colNames.getColumnCount(); nCol++){
String oneColumnLabel = colNames.getColumnLabel(nCol).trim();
colNamesInQuery.add(oneColumnLabel);
Map<String, List<String>> oneColumn = new HashMap<String, List<String>>();
oneColumn.put(oneColumnLabel, new ArrayList<String>());
queryResult.add(oneColumn);
}
while (rs.next()){
for(int nCol = 1; nCol <= colNames.getColumnCount(); nCol++){
String field = rs.getString(colNamesInQuery.get(nCol-1));
queryResult.get(nCol-1).get(colNamesInQuery.get(nCol-1)).add(field);
}
}
}
catch (SQLException sqle) {
System.out.println("Error en la ejecución:"
+ sqle.getErrorCode() + " " + sqle.getMessage());
}
finally{
try {
con.close();
}
catch (SQLException e) {
e.printStackTrace();
}
}
this.fieldsInResultSet = colNamesInQuery;
return queryResult;
}
public void insertData() {
// TODO Auto-generated method stub
}
}
| [
"[email protected]"
] | |
0348637aa142358c3a890c29e6c22fbeb53094fe | 731e613a3fb9aa36225b4e4c588f8f244c22894b | /app/src/test/java/com/zeneo/photoeditorpro/ExampleUnitTest.java | 2f59f823d0f787b79481d59d4cd4842578619905 | [] | no_license | Anass001/PhotoEditor | d7b5dfc750e527b67d14cc92cc218d2b0213b49d | 76eff184fb8838b02c17caa54b79845fe9df7492 | refs/heads/master | 2020-06-14T05:44:29.609696 | 2019-07-13T07:56:46 | 2019-07-13T07:56:46 | 194,921,687 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 385 | java | package com.zeneo.photoeditorpro;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | [
"[email protected]"
] | |
ac5a0bade1cf282e0a6a4818031d83eae82c3259 | 5e3235edf3de262f4d10b9e9e1fcc3bd13d6b8b1 | /Code Snippet Repository/Spring/Spring4426.java | c1c2ea89df3f82a14a084858ac1cbae3bc64dd1a | [] | no_license | saber13812002/DeepCRM | 3336a244d4852a364800af3181e03e868cf6f9f5 | be3e5e50e34a042d5ba7259ff5ff75c08ab32bb9 | refs/heads/master | 2023-03-16T00:08:06.473699 | 2018-04-18T05:29:50 | 2018-04-18T05:29:50 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,695 | java | @SuppressWarnings("")
private AliasDescriptor(Method sourceAttribute, AliasFor aliasFor) {
Class<?> declaringClass = sourceAttribute.getDeclaringClass();
Assert.isTrue(declaringClass.isAnnotation(), "sourceAttribute must be from an annotation");
this.sourceAttribute = sourceAttribute;
this.sourceAnnotationType = (Class<? extends Annotation>) declaringClass;
this.sourceAttributeName = sourceAttribute.getName();
this.aliasedAnnotationType = (Annotation.class == aliasFor.annotation() ?
this.sourceAnnotationType : aliasFor.annotation());
this.aliasedAttributeName = getAliasedAttributeName(aliasFor, sourceAttribute);
if (this.aliasedAnnotationType == this.sourceAnnotationType &&
this.aliasedAttributeName.equals(this.sourceAttributeName)) {
String msg = String.format("@AliasFor declaration on attribute '%s' in annotation [%s] points to " +
"itself. Specify 'annotation' to point to a same-named attribute on a meta-annotation.",
sourceAttribute.getName(), declaringClass.getName());
throw new AnnotationConfigurationException(msg);
}
try {
this.aliasedAttribute = this.aliasedAnnotationType.getDeclaredMethod(this.aliasedAttributeName);
}
catch (NoSuchMethodException ex) {
String msg = String.format(
"Attribute '%s' in annotation [%s] is declared as an @AliasFor nonexistent attribute '%s' in annotation [%s].",
this.sourceAttributeName, this.sourceAnnotationType.getName(), this.aliasedAttributeName,
this.aliasedAnnotationType.getName());
throw new AnnotationConfigurationException(msg, ex);
}
this.isAliasPair = (this.sourceAnnotationType == this.aliasedAnnotationType);
}
| [
"[email protected]"
] | |
78d7e4238cae91776db154329c1ecc16bcce8306 | 41151b1e71c085347bd2d5d0be6e8ab7d4c989f5 | /prj/tests/unit/src/java/com/i10n/fleet/util/EnvironmentInfoTest.java | 7e82e8869fe0ee5d77e4b4e902a3e2dc5a5b3a78 | [] | no_license | venkat-developer/FeetVTS | b267f7db9d259c817dbfe1d8ef5c538c3626e379 | 7d735f4056dd0d9816db50fcaeeec10b38aa1659 | refs/heads/master | 2021-01-10T02:11:02.911658 | 2017-04-26T17:59:02 | 2017-04-26T17:59:02 | 55,285,574 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,546 | java | package com.i10n.fleet.util;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.InetAddress;
import java.net.UnknownHostException;
import org.apache.commons.io.IOUtils;
import org.apache.log4j.Logger;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import com.i10n.fleet.test.AbstractFleetTestCase;
import com.i10n.fleet.test.util.PropertyLoader;
/**
* Tests various functionalities if EnvironmentInfo
*
* @author sabarish
*
*/
public class EnvironmentInfoTest extends AbstractFleetTestCase {
private String m_environment = null;
private static final String KEY_TEST_OUT_DIR = "env.out.dir";
private static final String DEFAULT_SYSPROP_PROP = "systemtestproperty";
private static final String DEFAULT_SYSNAME_PROP = "systemname";
private static final String RELOAD_SYSNAME_PROP = "systemnamereload";
private static final String DEFAULT_STREAM_TEST_FILE = "/environment/stream.test.txt";
private static final String DEFAULT_STREAM_RESULT_FILE = "/environment/stream.expected.txt";
private static final String TEST_PROP_NAME = "TEST_PROP_NAME";
private static Logger LOG = Logger.getLogger(EnvironmentInfoTest.class);
/**
* @throws java.lang.Exception
*/
@Before
public void setUp() throws Exception {
PropertyLoader.load();
m_environment = System.getProperty(EnvironmentInfo.ENVIROMENT_PROP_NAME);
EnvironmentInfo.clear();
System.clearProperty(EnvironmentInfo.ENVIROMENT_PROP_NAME);
}
/**
* Tests fail back mechanism of getting back to default properties
*/
@Test
public void testFailBack() {
EnvironmentInfo.load(this);
assertEquals("Failed on failback", EnvironmentInfo.DEFAULT_ENV, EnvironmentInfo
.getEnvironment());
}
/**
* Tests EnvironmentInfo if it correctly loads properties based on system
* property.
*/
@Test
public void testSystemProperty() {
System.setProperty(EnvironmentInfo.ENVIROMENT_PROP_NAME, DEFAULT_SYSPROP_PROP);
EnvironmentInfo.load(this);
assertEquals(DEFAULT_SYSPROP_PROP, EnvironmentInfo.getEnvironment());
assertEquals("systemprop", EnvironmentInfo.getProperty(TEST_PROP_NAME));
}
/**
* Tests EnvironmentInfo if it correctly loads properties based on system
* name.
*/
@Test
public void testSystemNameProperty() {
String systemName = getSystemName();
File tempPropertyFile = createSystemPropertyFile(systemName, DEFAULT_SYSNAME_PROP);
if (null != tempPropertyFile) {
EnvironmentInfo.load(this);
assertEquals(systemName, EnvironmentInfo.getEnvironment());
assertEquals("systemname", EnvironmentInfo.getProperty(TEST_PROP_NAME));
tempPropertyFile.delete();
}
else {
fail("Error creating system property file with name = " + systemName);
}
}
/**
* Tests EnvironmentInfo if it correctly detemplatizes evironment based
* streams
*/
@Test
public void testEnvironmentStream() {
System.setProperty(EnvironmentInfo.ENVIROMENT_PROP_NAME, DEFAULT_SYSPROP_PROP);
EnvironmentInfo.load(this);
InputStream testStream = null;
InputStream resultStream = null;
InputStream outStream = null;
try {
testStream = EnvironmentInfoTest.class
.getResourceAsStream(DEFAULT_STREAM_TEST_FILE);
resultStream = EnvironmentInfoTest.class
.getResourceAsStream(DEFAULT_STREAM_RESULT_FILE);
outStream = EnvironmentInfo.getEnvironmentalizedStream(testStream);
assertTrue(IOUtils.contentEquals(resultStream, outStream));
}
catch (IOException e) {
LOG.error("Caught IOException while testing environmentalized stream", e);
fail("Caught IOException while testing environmentalized stream :: \n"
+ e.getMessage());
}
}
/**
* Tests EnvironmentInfo if it correctly reloads environment properties.
*/
@Test
public void testReload() {
testSystemNameProperty();
String systemName = getSystemName();
File tempPropertyFile = createSystemPropertyFile(systemName, RELOAD_SYSNAME_PROP);
EnvironmentInfo.load(this);
assertEquals(systemName, EnvironmentInfo.getEnvironment());
assertEquals("systemnamereload", EnvironmentInfo.getProperty(TEST_PROP_NAME));
tempPropertyFile.delete();
}
private File createSystemPropertyFile(String systemfile, String templatefile) {
File result = null;
String testDir = PropertyLoader.getProperty(KEY_TEST_OUT_DIR);
if (null != testDir && null != systemfile) {
result = new File(testDir + "/" + systemfile + ".properties");
InputStream in = null;
OutputStream out = null;
try {
in = new FileInputStream(testDir + "/" + templatefile + ".properties");
out = new FileOutputStream(result);
IOUtils.copy(in, out);
}
catch (IOException e) {
LOG.error("Caught IOException while copying systemname property file", e);
result = null;
}
finally {
IOUtils.closeQuietly(in);
IOUtils.closeQuietly(out);
}
}
return result;
}
private String getSystemName() {
String systemName = null;
try {
systemName = InetAddress.getLocalHost().getHostName();
}
catch (UnknownHostException e) {
LOG.error("Caught UnknownHostException while retrieving local computername",
e);
}
return systemName;
}
/**
* @throws java.lang.Exception
*/
@After
public void tearDown() throws Exception {
EnvironmentInfo.clear();
if (null != m_environment) {
System.setProperty(EnvironmentInfo.ENVIROMENT_PROP_NAME, m_environment);
}
else {
System.clearProperty(EnvironmentInfo.ENVIROMENT_PROP_NAME);
}
}
}
| [
"[email protected]"
] | |
e494a76a4140faecf105b4e00fc25182132ac92f | bb1bd2ee8d3b3ad8bcb0ea8513517d6effe8f74c | /TP4/src/edu/iut/gui/frames/SchedulerFrame.java | 1b71876e73c325e186eda53a56d30fe1efc245ee | [] | no_license | Nomeji/CPO-B | fc3850b9fbd7ac216e7bd557c1d80d3c99a9aa38 | ecda2387bd56ab2a048292568677c7a48d9daa61 | refs/heads/master | 2021-01-10T15:05:57.495028 | 2017-05-12T10:57:43 | 2017-05-12T10:57:43 | 45,669,686 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,738 | java | package edu.iut.gui.frames;
import java.awt.CardLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.File;
import java.io.IOException;
import java.io.ObjectInputStream;
import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JSplitPane;
import edu.iut.app.ExamEvent;
import edu.iut.gui.listeners.*;
import edu.iut.gui.widget.agenda.AgendaPanelFactory;
import edu.iut.gui.widget.agenda.ControlAgendaViewPanel;
import edu.iut.gui.widget.agenda.AgendaPanelFactory.ActiveView;
import edu.iut.io.AppStateReader;
import edu.iut.io.AppStateWriter;
import edu.iut.io.XMLProjectReader;
import edu.iut.io.XMLProjectWriter;
public class SchedulerFrame extends JFrame {
JPanel contentPane;
CardLayout layerLayout;
AgendaPanelFactory agendaPanelFactory;
JPanel dayView;
JPanel weekView;
JPanel monthView;
final static String ADDSAUVE="/tmp/t.tmp";
protected void setupUI() {
contentPane = new JPanel();
layerLayout = new CardLayout();
contentPane.setLayout(layerLayout);
ControlAgendaViewPanel agendaViewPanel = new ControlAgendaViewPanel(layerLayout,contentPane);
agendaPanelFactory = new AgendaPanelFactory();
dayView = agendaPanelFactory.getAgendaView(ActiveView.DAY_VIEW);
weekView = agendaPanelFactory.getAgendaView(ActiveView.WEEK_VIEW);
monthView = agendaPanelFactory.getAgendaView(ActiveView.MONTH_VIEW);
contentPane.add(dayView,ActiveView.DAY_VIEW.name());
contentPane.add(weekView,ActiveView.WEEK_VIEW.name());
contentPane.add(monthView,ActiveView.MONTH_VIEW.name());
JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,agendaViewPanel, contentPane);
this.setContentPane(splitPane);
JMenuBar menuBar = new JMenuBar();
JMenu menu;
JMenuItem menuItem;
/* File Menu */
menu = new JMenu("File");
menuItem = new JMenuItem("Load");
menuItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
XMLProjectReader reader = new XMLProjectReader();
try {
AppStateWriter output = new AppStateWriter(,"/tmp/save.xml",ADDSAUVE)
reader.load(new File("/tmp/save.xml"));
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
JOptionPane.showMessageDialog(null, "Not yet implemented", "info", JOptionPane.INFORMATION_MESSAGE, null);
}
});
menu.add(menuItem);
menuItem = new JMenuItem("Save");
menuItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
XMLProjectWriter writer = new XMLProjectWriter();
try {
AppStateReader input = new AppStateReader(ADDSAUVE);
ExamEvent exams = (ExamEvent) input.readObject();
writer.save(new File("/tmp/save.xml"));
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
JOptionPane.showMessageDialog(null, "Not yet implemented", "info", JOptionPane.INFORMATION_MESSAGE, null);
}
});
menu.add(menuItem);
menuItem = new JMenuItem("Quit");
menuItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
JOptionPane.showMessageDialog(null, "Not yet implemented", "info", JOptionPane.INFORMATION_MESSAGE, null);
}
});
menu.add(menuItem);
menuBar.add(menu);
/* Edit Menu */
menu = new JMenu("Edit");
JMenu submenu = new JMenu("View");
menuItem = new JMenuItem("Day");
menuItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
layerLayout.show(contentPane,ActiveView.DAY_VIEW.name());
}
});
submenu.add(menuItem);
menuItem = new JMenuItem("Week");
menuItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
layerLayout.show(contentPane,ActiveView.WEEK_VIEW.name());
}
});
submenu.add(menuItem);
menuItem = new JMenuItem("Month");
menuItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
layerLayout.show(contentPane,ActiveView.MONTH_VIEW.name());
}
});
submenu.add(menuItem);
menu.add(submenu);
menuBar.add(menu);
/* Help Menu */
menu = new JMenu("Help");
menuItem = new JMenuItem("Display");
menuItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
// EX 4 : ajouter l'aide
JOptionPane.showMessageDialog(null, "Not yet implemented", "info", JOptionPane.INFORMATION_MESSAGE, null);
}
});
menu.add(menuItem);
menuItem = new JMenuItem("About");
menuItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
JOptionPane.showMessageDialog(null, "Not yet implemented", "info", JOptionPane.INFORMATION_MESSAGE, null);
}
});
menu.add(menuItem);
menuBar.add(menu);
this.setJMenuBar(menuBar);
this.pack();
layerLayout.next(contentPane);
}
public SchedulerFrame() {
super();
addWindowListener (new WindowAdapter(){
public void windowClosing (WindowEvent e){
System.exit(0);
}
});
contentPane = null;
dayView = null;
weekView = null;
monthView = null;
agendaPanelFactory = null;
setupUI();
}
public SchedulerFrame(String title) {
super(title);
addWindowListener (new WindowAdapter(){
public void windowClosing (WindowEvent e){
System.exit(0);
}
});
setupUI();
}
}
| [
"[email protected]"
] | |
484795a4179da1e90f528823e90f662517df4bd7 | 2d238a07eb59c8c3b85421991f2c24e1a5cb73ca | /2020/ReteteCulinare/app/src/main/java/com/app/reteteculinare/MainActivity.java | 5c8d2acae3503fd9718fcb5a2e4b526d13f56fc8 | [] | no_license | roberteftene/AndroidExamSubjects | ce5b051c01bdd574082f851400a5b2d9881b5d0f | 8e31a4365f2a93b446cfc4bf1c078f034b4cd4b3 | refs/heads/main | 2023-02-24T13:20:07.419205 | 2021-01-31T18:25:25 | 2021-01-31T18:25:25 | 332,425,343 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,332 | java | package com.app.reteteculinare;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import android.app.Activity;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.Spinner;
import android.widget.Toast;
import com.app.reteteculinare.database.AppDatabase;
import com.app.reteteculinare.models.Reteta;
import com.app.reteteculinare.utils.AsyncTask;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
public class MainActivity extends AppCompatActivity {
private Intent i;
ArrayList<Reteta> retetas = new ArrayList<>();
private ListView reteteLV;
ArrayAdapter<Reteta> arrayAdapter;
private Spinner categFilter;
ArrayAdapter<CharSequence> adapter;
private AppDatabase appDatabase;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
SharedPreferences sharedPreferences = getSharedPreferences("sharedPrefs",MODE_PRIVATE);
SharedPreferences.Editor editor = sharedPreferences.edit();
String currentDateAndTime = new SimpleDateFormat("dd-MM-yyyy HH:mm").format(System.currentTimeMillis());
editor.putString("current",currentDateAndTime);
editor.apply();
editor.commit();
appDatabase = AppDatabase.getInstance(this);
retetas = (ArrayList<Reteta>) appDatabase.retetaDao().getAll();
reteteLV = findViewById(R.id.reteteLV);
arrayAdapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1,retetas);
reteteLV.setAdapter(arrayAdapter);
categFilter = findViewById(R.id.categFilter);
adapter = ArrayAdapter.createFromResource(this,R.array.categorie,R.layout.support_simple_spinner_dropdown_item);
categFilter.setAdapter(adapter);
categFilter.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
switch (categFilter.getSelectedItem().toString()) {
case "ciorbe":
getRetetaByCateg(0);
break;
case "gustari":
getRetetaByCateg(1);
break;
case "dulciuri":
getRetetaByCateg(2);
break;
case "felPrincipal":
getRetetaByCateg(3);
break;
}
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
}
});
reteteLV.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
i = new Intent(MainActivity.this,AddReteta.class);
i.putExtra("reteta",retetas.get(position));
i.putExtra("pos",position);
startActivityForResult(i,3);
}
});
reteteLV.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
@Override
public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
appDatabase = AppDatabase.getInstance(MainActivity.this);
appDatabase.retetaDao().insertReteta(retetas.get(position));
return true;
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.menu,menu);
return super.onCreateOptionsMenu(menu);
}
@Override
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
if (item.getItemId() == R.id.addReteta) {
i = new Intent(MainActivity.this,AddReteta.class);
i.putParcelableArrayListExtra("retete",retetas);
startActivityForResult(i,2);
}
if(item.getItemId() == R.id.sync) {
AsyncTask asyncTask = new AsyncTask() {
@Override
protected void onPostExecute(String s) {
super.onPostExecute(s);
if(s!=null) {
try {
JSONArray jsonArray = new JSONArray(s);
for(int i = 0; i < jsonArray.length(); i++) {
JSONObject jsonObject = jsonArray.getJSONObject(i);
String den = jsonObject.getString("denumire");
String des = jsonObject.getString("descriere");
String categ = jsonObject.getString("categorie");
int nrCalorii = jsonObject.getInt("calorii");
String data = jsonObject.getString("dataAdaugare");
Date date = new SimpleDateFormat("dd-MM-yyyy").parse(data);
Reteta reteta = new Reteta(den,des,date,nrCalorii,categ);
retetas.add(reteta);
}
arrayAdapter.notifyDataSetChanged();
} catch (JSONException | ParseException e) {
e.printStackTrace();
}
}
}
};
asyncTask.execute("https://api.mocki.io/v1/3ab8369c");
}
if(item.getItemId() == R.id.info) {
String currentDate;
SharedPreferences sharedPreferences = getSharedPreferences("sharedPrefs",MODE_PRIVATE);
currentDate = sharedPreferences.getString("current","Muie");
AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
builder.setTitle("Informatie");
builder.setMessage("Data ultimei utilizari este: " + currentDate);
builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.cancel();
}
});
AlertDialog alertDialog = builder.create();
alertDialog.show();
}
return super.onOptionsItemSelected(item);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == Activity.RESULT_OK) {
if (requestCode == 2) {
ArrayList<Reteta> temp = new ArrayList<>();
temp = data.getParcelableArrayListExtra("retete");
retetas.clear();
retetas.addAll(temp);
arrayAdapter.notifyDataSetChanged();
Toast.makeText(this, retetas.toString(), Toast.LENGTH_LONG).show();
}
if (requestCode == 3) {
if (data.getParcelableExtra("reteta") != null) {
Reteta reteta = data.getParcelableExtra("reteta");
int pos = data.getIntExtra("pos", 1);
retetas.get(pos).setDenumire(reteta.getDenumire());
retetas.get(pos).setDescriere(reteta.getDescriere());
retetas.get(pos).setCalorii(reteta.getCalorii());
retetas.get(pos).setCategorie(reteta.getCategorie());
retetas.get(pos).setDataAdaugare(reteta.getDataAdaugare());
appDatabase.retetaDao().updateReteta(retetas.get(pos));
arrayAdapter.notifyDataSetChanged();
} else {
int pos = data.getIntExtra("pos", 1);
appDatabase.retetaDao().deleteReteta(retetas.get(pos));
retetas.remove(pos);
ArrayList<Reteta> arrayList = new ArrayList<>();
arrayList.addAll(retetas);
retetas.clear();
retetas.addAll(arrayList);
arrayAdapter.notifyDataSetChanged();
}
}
}
}
protected void getRetetaByCateg(int categ) {
ArrayList<Reteta> retete = new ArrayList<>();
for (Reteta reteta : retetas) {
if(reteta.getCategorie().equals(adapter.getItem(categ))) {
retete.add(reteta);
}
}
arrayAdapter = new ArrayAdapter<>(this,android.R.layout.simple_list_item_1, retete);
reteteLV.setAdapter(arrayAdapter);
}
} | [
"[email protected]"
] | |
9d0ff8985786f0d694206661f8a00b7b317567ba | 5629b45dd69a7d9a108bedfba3defecacc4f5b1b | /concurrent-graph/src/main/java/mthesis/concurrent_graph/BaseQuery.java | d497e27c941d154fbb4420650b59a51a4529c8a2 | [] | no_license | jgrunert/ConcurrentGraph | 1fc063db0351477028821645041ed048d8483798 | 1f5ccb2b87b5c6f23b8ed217f6a78c3b5b96eeec | refs/heads/master | 2021-01-20T03:00:30.463469 | 2017-05-26T10:47:23 | 2017-05-26T10:47:23 | 75,532,175 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,047 | java | package mthesis.concurrent_graph;
import java.nio.ByteBuffer;
import java.util.Set;
import mthesis.concurrent_graph.writable.BaseWritable;
/**
* Base class for query global values and control, such as initial configuration or aggregators.
* Configuration values remain unchanged while aggregated values are aggregated by the master.
*
* @author Jonas Grunert
*
*/
public class BaseQuery extends BaseWritable {
public int QueryId;
protected int ActiveVertices;
protected int VertexCount;
public QueryStats Stats;
public BaseQuery() {
super();
}
public BaseQuery(int queryId) {
super();
QueryId = queryId;
ActiveVertices = 0;
VertexCount = 0;
Stats = new QueryStats();
}
public BaseQuery(int queryId, int activeVertices, int vertexCount, QueryStats stats) {
super();
QueryId = queryId;
ActiveVertices = activeVertices;
VertexCount = vertexCount;
Stats = stats;
}
public void combine(BaseQuery v) {
if (QueryId != v.QueryId) throw new RuntimeException("Cannot add qureries with differend IDs: " + QueryId + " " + v.QueryId);
ActiveVertices += v.ActiveVertices;
VertexCount += v.VertexCount;
Stats.combine(v.Stats);
}
/**
* Called by master when no more vertices are active
* @return TRUE if the query is finished now
*/
public boolean onMasterAllVerticesFinished() {
return true;
}
/**
* Called by master if all workers must be forced active in the next superstep.
* @return TRUE if force all workers to be active.
*/
public boolean masterForceAllWorkersActive(int superstepNo) {
return superstepNo <= 0;
}
/**
* Called by worker before the computation of a new superstep is started
* @return Instructions how to start superstep.
*/
public SuperstepInstructions onWorkerSuperstepStart(int superstepNo) {
if (superstepNo == 0) return new SuperstepInstructions(SuperstepInstructionsType.StartAll, null);
return new SuperstepInstructions(SuperstepInstructionsType.StartActive, null);
}
@Override
public void readFromBuffer(ByteBuffer buffer) {
QueryId = buffer.getInt();
ActiveVertices = buffer.getInt();
VertexCount = buffer.getInt();
Stats = new QueryStats(buffer);
}
@Override
public void writeToBuffer(ByteBuffer buffer) {
buffer.putInt(QueryId);
buffer.putInt(ActiveVertices);
buffer.putInt(VertexCount);
Stats.writeToBuffer(buffer);
}
@Override
public String getString() {
return QueryId + ":" + ActiveVertices + ":" + VertexCount
+ ":" + Stats.getString();
}
@Override
public int getBytesLength() {
return 3 * 4 + QueryStats.getBytesLength();
}
public int getActiveVertices() {
return ActiveVertices;
}
public void setActiveVertices(int activeVertices) {
ActiveVertices = activeVertices;
}
public int getVertexCount() {
return VertexCount;
}
public void setVertexCount(int vertexCount) {
VertexCount = vertexCount;
}
public int GetQueryHash() {
return 0;
}
public static abstract class BaseQueryGlobalValuesFactory<T extends BaseQuery> extends BaseWritableFactory<T> {
public abstract T createDefault(int queryId);
}
public static class Factory extends BaseQueryGlobalValuesFactory<BaseQuery> {
@Override
public BaseQuery createDefault() {
return new BaseQuery();
}
@Override
public BaseQuery createDefault(int queryId) {
return new BaseQuery(queryId);
}
@Override
public BaseQuery createFromString(String str) {
throw new RuntimeException("createFromString not implemented for BaseQueryGlobalValues");
}
}
public enum SuperstepInstructionsType {
/** Start all already active vertices */
StartActive,
/** Start all vertices */
StartAll,
/** Start specific vertices */
StartSpecific
}
public static class SuperstepInstructions {
public final SuperstepInstructionsType type;
public final Set<Integer> specificVerticesIds;
public SuperstepInstructions(SuperstepInstructionsType type, Set<Integer> specificVerticesIds) {
super();
this.type = type;
this.specificVerticesIds = specificVerticesIds;
}
}
}
| [
"[email protected]"
] | |
d463c38ff11433970bf24f0e4671ce62e911c10f | aa2493d2a54c87083db2748d5a86c8cbb8cd57bb | /src/com/sgnbs/cms/util/StrUtil.java | accc40378161e611b5e20beb94f0046143471aaf | [
"MIT"
] | permissive | wtl-github/CmsManagerPlatform | 81f485b5e716dabeaaebf959345748be916132be | 3ca09592556a36bce14ff870786fb6fd02982bb5 | refs/heads/master | 2021-05-06T13:45:43.794664 | 2017-12-06T07:09:15 | 2017-12-06T07:09:15 | 111,867,206 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,604 | java | package com.sgnbs.cms.util;
import java.util.Random;
import java.util.UUID;
//import com.game.publish.maintain.MdCol;
/**
* Created by liuyang on 15/4/2.
*/
public class StrUtil{
static final char[] hexDigits = new char[]{'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
static final char[] digits = new char[]{'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'};
static final Random rand = new Random();
public static String getUUID() {
String uuid = UUID.randomUUID().toString();
return uuid.replaceAll("-", "");
}
public static String randomString(int length) {
StringBuffer sb = new StringBuffer();
for (int loop = 0; loop < length; ++loop) {
sb.append(hexDigits[rand.nextInt(hexDigits.length)]);
}
return sb.toString();
}
public static String randomNumber(int length) {
StringBuffer sb = new StringBuffer();
for (int loop = 0; loop < length; ++loop) {
sb.append(digits[rand.nextInt(digits.length)]);
}
return sb.toString();
}
/* public static String getEncryptionToken(String token) {
for (int i = 0; i < 6; i++) {
token = EncryptionUtil.encoderBase64(token.getBytes());
}
return token;
}
public static String getDecryptToken(String encryptionToken) {
for (int i = 0; i < 6; i++) {
encryptionToken = EncryptionUtil.decoderBase64(encryptionToken.getBytes());
}
return encryptionToken;
}*/
public static void main(String[] args) {
System.out.println(StrUtil.getUUID());
}
public static String splitStr(String source,String type){
// String type = "0=治安类,1=保洁类,2=设施类,3=建议类,4=政策咨询类,5=社区服务类,6=其他";
String[] types = source.split(",");
for(int i=0;i<types.length;i++){
if(types[i].split("=")[0].equals(type))
return types[i].split("=")[1];
}
return null;
}
/* public static List<MdCol> splitStr(String source){
// String type = "0=治安类,1=保洁类,2=设施类,3=建议类,4=政策咨询类,5=社区服务类,6=其他";
List<MdCol> str = new ArrayList<MdCol>();
String[] types = source.split(",");
for(int i=0;i<types.length;i++){
MdCol mdCol = new MdCol();
mdCol.setType(types[i].split("=")[0]);
mdCol.setTypeName(types[i].split("=")[1]);
str.add(mdCol);
}
return str;
}*/
public static Boolean notNull(String str)
{
if(str!=null&&!"".equals(str))
{
return true;
}
else
{
return false;
}
}
}
| [
"[email protected]"
] | |
76f906b33c1a2c3bd18a190213f8aee60849fc48 | 62033c30523e72124e641053fb7c3c1a29cae060 | /java-dev-1/src/main/java/com/java/demo/chapter10/sample5/Sample10_5.java | 27d619e556b547a78157d9199010dcadea624c08 | [] | no_license | mi211314/maven-java-demo | 51c3a64a2c1997ae3edacf0a34883e0354afcaa9 | bbc38995d227819a1d5ee618dfc2704af0e67670 | refs/heads/master | 2022-06-27T23:24:41.489101 | 2019-09-01T17:16:35 | 2019-09-01T17:16:35 | 192,045,823 | 0 | 0 | null | 2022-06-21T01:29:31 | 2019-06-15T06:37:25 | Java | UTF-8 | Java | false | false | 659 | java | package com.java.demo.chapter10.sample5;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* @Description: Sample10_5
*
* @Date: 2019/1/7 22:00
*/
public class Sample10_5 {
private static final Logger logger = LoggerFactory.getLogger(Sample10_5.class);
private static final String DESC = "我的名字叫{},我的身体长{}厘米";
public static void main(String[] args) {
Animal a = new Animal("tom", 40);
Animal b = new Animal("tom");
Animal c = new Animal();
logger.info(DESC, a.name, a.size);
logger.info(DESC, b.name, b.size);
logger.info(DESC, c.name, c.size);
}
}
| [
"[email protected]"
] | |
ca4e9c329c97fccc44b5085dbf9de09853f19adf | 1f59e495282cdea7b09830d0fcf5eb8c914ff0ba | /cloudfoundry-client-lib/src/main/java/org/cloudfoundry/client/lib/CloudApplication.java | dfe37db2da06dd7f1c5f305f4775e726d0cb9b0f | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | georgiko/vcap-java-client | bc2c97a6e0cec89500106db05311e05a3c081288 | eef6c791cfcd1956f13d1d1461022cdabec24a21 | refs/heads/master | 2021-01-17T15:53:18.824383 | 2011-09-22T17:26:23 | 2011-09-22T17:26:23 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,075 | java | /*
* Copyright 2009-2011 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 org.cloudfoundry.client.lib;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class CloudApplication {
private String name;
private Map<String,String> staging = new HashMap<String, String>();
private int instances;
private List<String> uris;
private List<String> services;
private AppState state;
private Map<String, Object> meta = new HashMap<String, Object>();
private Map<String, Integer> resources = new HashMap<String, Integer>();
private int runningInstances;
private List<String> env = new ArrayList<String>();
private static final String MODEL_KEY = "model";
private static final String STACK_KEY = "stack";
private static final String MEMORY_KEY = "memory";
public static final String JAVA_WEB = "java_web/1.0";
public static final String SPRING = "spring_web/1.0";
public static final String GRAILS = "grails/1.0";
public CloudApplication(String name, String stagingStack, String stagingModel,
int memory, int instances,
List<String> uris, List<String> serviceNames,
AppState state) {
this.name = name;
this.staging.put(STACK_KEY, stagingStack);
this.staging.put(MODEL_KEY, stagingModel);
this.resources.put(MEMORY_KEY, memory);
this.instances = instances;
this.uris = uris;
this.services = serviceNames;
this.state = state;
}
@SuppressWarnings("unchecked")
public CloudApplication(Map<String, Object> attributes) {
name = (String) attributes.get("name");
setStaging((Map<String,String>) attributes.get("staging"));
instances = (Integer)attributes.get("instances");
Integer runningInstancesAttribute = (Integer) attributes.get("runningInstances");
if (runningInstancesAttribute != null) {
runningInstances = runningInstancesAttribute;
}
uris = (List<String>)attributes.get("uris");
services = (List<String>)attributes.get("services");
state = AppState.valueOf((String) attributes.get("state"));
meta = (Map<String, Object>) attributes.get("meta");
resources = (Map<String, Integer>) attributes.get("resources");
env = (List<String>) attributes.get("env");
}
public enum AppState {
UPDATING, STARTED, STOPPED
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Map<String,String> getStaging() {
return staging;
}
public void setStaging(Map<String,String> staging) {
this.staging = new HashMap<String,String>(staging);
}
public void setResources(Map<String,Integer> resources) {
this.resources = resources;
}
public Map<String,Integer> getResources() {
return new HashMap<String, Integer>(resources);
}
public int getInstances() {
return instances;
}
public void setInstances(int instances) {
this.instances = instances;
}
public int getMemory() {
return resources.get(MEMORY_KEY);
}
public void setMemory(int memory) {
resources.put(MEMORY_KEY, memory);
}
public List<String> getUris() {
return uris;
}
public void setUris(List<String> uris) {
this.uris = uris;
}
public AppState getState() {
return state;
}
public void setState(AppState state) {
this.state = state;
}
public Map<String, Object> getMeta() {
return meta;
}
public void setMeta(Map<String, Object> meta) {
this.meta = meta;
}
public List<String> getServices() {
return services;
}
public void setServices(List<String> services) {
this.services = services;
}
public int getRunningInstances() {
return runningInstances;
}
public Map<String, String> getEnvAsMap() {
Map<String,String> envMap = new HashMap<String, String>();
for (String nameAndValue : env) {
String[] parts = nameAndValue.split("=");
envMap.put(parts[0], parts[1]);
}
return envMap;
}
public List<String> getEnv() {
return env;
}
public void setEnv(Map<String, String> env) {
List<String> joined = new ArrayList<String>();
for (Map.Entry<String, String> entry : env.entrySet()) {
joined.add(entry.getKey() + '=' + entry.getValue());
}
this.env = joined;
}
public void setEnv(List<String> env) {
this.env = env;
}
@Override
public String toString() {
return "CloudApplication [stagingModel=" + staging.get(MODEL_KEY) + ", instances="
+ instances + ", name=" + name + ", stagingStack=" + staging.get(STACK_KEY)
+ ", memory=" + resources.get(MEMORY_KEY)
+ ", state=" + state + ", uris=" + uris + ",services=" + services
+ ", env=" + env + "]";
}
}
| [
"[email protected]"
] | |
575d04f7b98073fb17408c0bf01044fe5c2ba7cc | 629d3789c38b629eb93618382cdbe9245b9c38ab | /java-21/StructuredConcurrencyWithSubtaskExample.java | 9efef3b44b6ae833aa243dfea45a99baab7a2488 | [
"Apache-2.0"
] | permissive | wesleyegberto/java-new-features | 6f8476f6a99962b52de4d07ea031225e52a4bc2b | dcf8eb0327ed164e6037e2afd132808038ea4cd8 | refs/heads/master | 2023-09-01T12:21:53.365050 | 2023-08-31T01:48:52 | 2023-08-31T01:48:52 | 71,030,230 | 232 | 58 | Apache-2.0 | 2023-06-07T19:27:58 | 2016-10-16T04:34:47 | Java | UTF-8 | Java | false | false | 1,438 | java | import java.util.concurrent.ExecutionException;
import java.util.concurrent.Executors;
import java.util.concurrent.*;
import static java.util.concurrent.StructuredTaskScope.Subtask;
/**
* To run: `java --source 21 --enable-preview StructuredConcurrencyWithSubtaskExample.java`
*/
public class StructuredConcurrencyWithSubtaskExample {
public static void main(String[] args) throws Exception {
var message = new StructuredConcurrencyWithSubtaskExample().parallelSearch("42");
System.out.println(message);
}
private String parallelSearch(String userId) throws InterruptedException, ExecutionException {
try (var scope = new StructuredTaskScope.ShutdownOnFailure()) {
// JDK 21: changed `fork` to return `Subtask` instead of `Future`
Subtask<String> userName = scope.fork(() -> this.findName(userId));
Subtask<String> answer = scope.fork(() -> this.findPower(userId));
scope.join();
scope.throwIfFailed();
// `Subtask::get` behaves like `Future::resultNow`
return "The real name of '%s' is '%s' and its power is %s".formatted(userId, userName.get(), answer.get());
}
}
private String findName(String userId) {
System.out.println("Searching name for user ID: " + userId);
return "Thomas Anderson";
}
private String findPower(String userId) {
System.out.println("Calculating power for user ID: " + userId);
try {
Thread.sleep(3000);
} catch (Exception ex) {}
return "Over 9000";
}
}
| [
"[email protected]"
] | |
ce2d286d26a9d01a5a625238af4f6f4efb0549a1 | f321ba3a3383f6cecce4d10715427ce59b6016ec | /src/main/java/com/blecua84/bddcucumberexample/BddCucumberExampleApplication.java | d74c35007c918bf8ea1c0f5529eb649b7864bc25 | [
"MIT"
] | permissive | blecua84/bdd-cucumber-example | 69c7f9d5bd3cc92587608cb7f944cce687ba3760 | afd1ad79741cf0b77d85d177c4c69f5cb71645ac | refs/heads/master | 2021-07-24T19:42:57.624406 | 2017-11-03T01:03:04 | 2017-11-03T01:03:04 | 109,333,378 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 347 | java | package com.blecua84.bddcucumberexample;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class BddCucumberExampleApplication {
public static void main(String[] args) {
SpringApplication.run(BddCucumberExampleApplication.class, args);
}
}
| [
"[email protected]"
] | |
19a251242556b5b40a73a7401bd0d3c38e565d03 | ce437a3701c744fcfbd19c33d5d5cef898371713 | /src/negocio/basica/AnimalHome.java | e1e099d5a0348dd07088b43fe6657970fed9d3d0 | [] | no_license | LuisEduardoER/petshop-poo | da9b0980e80e556567641b35e699008cdf085ffe | 28f3d242974670cc1fec0990025148c2d0a1b1cc | refs/heads/master | 2021-01-10T16:57:09.650623 | 2011-11-14T16:35:29 | 2011-11-14T16:35:29 | 55,207,552 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,089 | java | package negocio.basica;
// Generated 22/09/2011 20:56:28 by Hibernate Tools 3.2.0.CR1
import java.util.List;
import javax.naming.InitialContext;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.LockMode;
import org.hibernate.SessionFactory;
import org.hibernate.criterion.Example;
/**
* Home object for domain model class Animal.
* @see negocio.basica.Animal
* @author Hibernate Tools
*/
public class AnimalHome {
private static final Log log = LogFactory.getLog(AnimalHome.class);
private final SessionFactory sessionFactory = getSessionFactory();
protected SessionFactory getSessionFactory() {
try {
return (SessionFactory) new InitialContext().lookup("SessionFactory");
}
catch (Exception e) {
log.error("Could not locate SessionFactory in JNDI", e);
throw new IllegalStateException("Could not locate SessionFactory in JNDI");
}
}
public void persist(Animal transientInstance) {
log.debug("persisting Animal instance");
try {
sessionFactory.getCurrentSession().persist(transientInstance);
log.debug("persist successful");
}
catch (RuntimeException re) {
log.error("persist failed", re);
throw re;
}
}
public void attachDirty(Animal instance) {
log.debug("attaching dirty Animal instance");
try {
sessionFactory.getCurrentSession().saveOrUpdate(instance);
log.debug("attach successful");
}
catch (RuntimeException re) {
log.error("attach failed", re);
throw re;
}
}
public void attachClean(Animal instance) {
log.debug("attaching clean Animal instance");
try {
sessionFactory.getCurrentSession().lock(instance, LockMode.NONE);
log.debug("attach successful");
}
catch (RuntimeException re) {
log.error("attach failed", re);
throw re;
}
}
public void delete(Animal persistentInstance) {
log.debug("deleting Animal instance");
try {
sessionFactory.getCurrentSession().delete(persistentInstance);
log.debug("delete successful");
}
catch (RuntimeException re) {
log.error("delete failed", re);
throw re;
}
}
public Animal merge(Animal detachedInstance) {
log.debug("merging Animal instance");
try {
Animal result = (Animal) sessionFactory.getCurrentSession()
.merge(detachedInstance);
log.debug("merge successful");
return result;
}
catch (RuntimeException re) {
log.error("merge failed", re);
throw re;
}
}
public Animal findById( int id) {
log.debug("getting Animal instance with id: " + id);
try {
Animal instance = (Animal) sessionFactory.getCurrentSession()
.get("negocio.basica.Animal", id);
if (instance==null) {
log.debug("get successful, no instance found");
}
else {
log.debug("get successful, instance found");
}
return instance;
}
catch (RuntimeException re) {
log.error("get failed", re);
throw re;
}
}
public List findByExample(Animal instance) {
log.debug("finding Animal instance by example");
try {
List results = sessionFactory.getCurrentSession()
.createCriteria("negocio.basica.Animal")
.add(Example.create(instance))
.list();
log.debug("find by example successful, result size: " + results.size());
return results;
}
catch (RuntimeException re) {
log.error("find by example failed", re);
throw re;
}
}
}
| [
"[email protected]"
] | |
56ef67790b26355f080c87a501fd9126ea9664ea | fe5e5856bb5256f0a169554833fd189b13708c3d | /app/src/main/java/app/helloworld/btsmedia/net/helloworld/MainActivity.java | 4439c6b400798467a4cd4abd17cb7701401e33f1 | [] | no_license | forestildig/HelloWorld | 792e83970f2117728292f4d205ea15fe6666f764 | 9eabfda8f7dc7756f1549a99b5e0323d54914ada | refs/heads/master | 2021-01-19T11:15:17.434164 | 2015-02-16T21:12:12 | 2015-02-16T21:12:12 | 30,888,585 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,138 | java | package app.helloworld.btsmedia.net.helloworld;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
public class MainActivity extends ActionBarActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
| [
"[email protected]"
] | |
3c4dbc8641ca3cbb0aa30d7871a1916b570a9f04 | 4ba26999b89608f03e9aca99f61c4c155e4dc87d | /Stoper/app/src/main/java/stoper/stoper/chat/ui/activity/UserListingActivity.java | fb6bbfcc7a1209c8bd2edfc1bae96cf84a4a0298 | [] | no_license | dachaKG/Stoper | 7851cf3e1620de21177b7a48610596a549a301f4 | 9b4a3ca496c615c7c6c0778f2b4aa1394d90f5d8 | refs/heads/master | 2020-03-09T23:08:44.842227 | 2018-06-12T23:13:33 | 2018-06-12T23:13:33 | 129,049,833 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,827 | java | package stoper.stoper.chat.ui.activity;
import android.content.Context;
import android.content.Intent;
import android.support.design.widget.TabLayout;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
import stoper.stoper.R;
import stoper.stoper.chat.ui.adapter.UserListingPagerAdapter;
public class UserListingActivity extends AppCompatActivity {
private Toolbar mToolbar;
private TabLayout mTabLayoutUserListing;
private ViewPager mViewPagerUserListing;
//private LogoutPresenter mLogoutPresenter;
public static void startActivity(Context context) {
Intent intent = new Intent(context, UserListingActivity.class);
context.startActivity(intent);
}
public static void startActivity(Context context, int flags) {
Intent intent = new Intent(context, UserListingActivity.class);
intent.setFlags(flags);
context.startActivity(intent);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_user_listing);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setTitle(R.string.menu_title_chat);
mViewPagerUserListing = (ViewPager) findViewById(R.id.view_pager_user_listing);
init();
}
/*private void bindViews() {
mToolbar = (Toolbar) findViewById(R.id.toolbar);
//mTabLayoutUserListing = (TabLayout) findViewById(R.id.tab_layout_user_listing);
mViewPagerUserListing = (ViewPager) findViewById(R.id.view_pager_user_listing);
}
*/
private void init() {
// set the toolbar
//setSupportActionBar(mToolbar);
// set the view pager adapter
UserListingPagerAdapter userListingPagerAdapter = new UserListingPagerAdapter(getSupportFragmentManager());
mViewPagerUserListing.setAdapter(userListingPagerAdapter);
// attach tab layout with view pager
//mTabLayoutUserListing.setupWithViewPager(mViewPagerUserListing);
//mLogoutPresenter = new LogoutPresenter(this);
}
/*@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_user_listing, menu);
return super.onCreateOptionsMenu(menu);
}*/
/*@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.action_logout:
logout();
break;
}
return super.onOptionsItemSelected(item);
}*/
}
| [
"[email protected]"
] | |
6636dc4719d6ea3cf4bc51c04c7838d1c3b42ce3 | a9fde0e9deee80d1b031182a1bc18cdd8bfb4ec7 | /MPT5Client/src/patient/PatientMyChartListController.java | 44187cf07f3d338ba5d8c2c755bae7d6748576fe | [] | no_license | mingginew88/semi_project | 15b37c26169b6b064fa5801e120099839550e4e3 | 8e299e3abd1887dc3948e87b8b4cbba0222b2e90 | refs/heads/master | 2020-09-05T20:44:38.993443 | 2019-11-07T10:24:08 | 2019-11-07T10:24:08 | 220,209,272 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,648 | java | package patient;
import java.net.URL;
import java.util.ResourceBundle;
import javafx.fxml.FXML;
import javafx.scene.control.Label;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.BorderPane;
public class PatientMyChartListController {
@FXML
private ResourceBundle resources;
@FXML
private URL location;
@FXML
private BorderPane borderPane;
@FXML
private Label lblMyInfo;
@FXML
private Label lblResult;
@FXML
private Label lblDisease;
@FXML
private Label lblMyPrescription;
@FXML
private Label lblMySche;
@FXML
void clickDisease(MouseEvent event) {
}
@FXML
void clickMyPrescription(MouseEvent event) {
}
@FXML
void clickMySche(MouseEvent event) {
}
@FXML
void clickResult(MouseEvent event) {
}
@FXML
void initialize() {
assert borderPane != null : "fx:id=\"borderPane\" was not injected: check your FXML file 'PatientMyChartList.fxml'.";
assert lblMyInfo != null : "fx:id=\"lblMyInfo\" was not injected: check your FXML file 'PatientMyChartList.fxml'.";
assert lblResult != null : "fx:id=\"lblResult\" was not injected: check your FXML file 'PatientMyChartList.fxml'.";
assert lblDisease != null : "fx:id=\"lblDisease\" was not injected: check your FXML file 'PatientMyChartList.fxml'.";
assert lblMyPrescription != null : "fx:id=\"lblMyPrescription\" was not injected: check your FXML file 'PatientMyChartList.fxml'.";
assert lblMySche != null : "fx:id=\"lblMySche\" was not injected: check your FXML file 'PatientMyChartList.fxml'.";
}
}
| [
"[email protected]"
] | |
82b41d7e7b267b7132d434ca8085be802bea7af8 | 99c5282afab6e7a8b4885a207191a312e359ec4c | /app/src/main/java/diegoperego/provafinale/Model/Corriere.java | 27ecdf965a0161c267816f6b16185d7adce22b76 | [] | no_license | DiegoPerego/ProvaFinale | 47cc97bb27854400eb99dd10e10219132554f0ba | 9169a63a471c1975da7598096d4c4a71fffeb96e | refs/heads/master | 2021-08-30T07:06:59.502237 | 2017-12-16T16:16:48 | 2017-12-16T16:16:48 | 114,251,195 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,067 | java | package diegoperego.provafinale.Model;
import java.io.Serializable;
import java.util.List;
/**
* Created by utente3.academy on 14-Dec-17.
*/
public class Corriere extends Users implements Serializable{
public Corriere(String username, String password, List<Pacco> pacchi) {
super(username, password, pacchi);
}
public Corriere(String username, String password) {
super(username, password);
}
public Corriere() {
super();
}
@Override
public String getUsername() {
return super.getUsername();
}
@Override
public void setUsername(String username) {
super.setUsername(username);
}
@Override
public String getPassword() {
return super.getPassword();
}
@Override
public void setPassword(String password) {
super.setPassword(password);
}
@Override
public List<Pacco> getPacchi() {
return super.getPacchi();
}
@Override
public void setPacchi(List<Pacco> pacchi) {
super.setPacchi(pacchi);
}
}
| [
"[email protected]"
] | |
91041f4e740db74a0f6f0d9b64f94a6ece94051d | 889a67a45ef535e8d2912bf896c2bb3929ef9221 | /ADA-main/dijsktra/Dijkstra.java | afa437261e71881e114c8eae09252ed6c2212839 | [] | no_license | gauravkhatri0611/ADA | b22cad2f4773568e198e52a8fb9b48e5f9281d25 | c6c5b8cbb04156db79dcf994c6227a1060125fd4 | refs/heads/main | 2023-04-20T10:27:54.115323 | 2021-05-11T17:02:42 | 2021-05-11T17:02:42 | 366,456,190 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,649 | java | package dijsktra;
public class Dijkstra {
public static void dijkstra(int a[][]) {
int v = a.length;
boolean visited[] = new boolean[v];
int dist[] = new int[v];
dist[0] = 0;
for (int i = 1; i < v; i++) {
dist[i] = 99999999;
}
for (int i = 0; i < v - 1; i++) {
// min dist vertex
int minVertex = findMinVertex(dist, visited);
visited[minVertex] = true;
// find neighbors
for (int j = 0; j < v; j++) {
if (a[minVertex][j] != 0 && !visited[j] && dist[minVertex] != 99999999) {
int newDist = dist[minVertex] + a[minVertex][j];
if (newDist < dist[j]) {
dist[j] = newDist;
}
}
}
}
// print
System.out.println("Vertex \t\t Distance from source");
for (int i = 0; i < v; i++) {
System.out.println(i + " \t\t " + dist[i]);
}
}
public static int findMinVertex(int[] distance, boolean visited[]) {
int min = -1;
for (int i = 0; i < distance.length; i++) {
if (!visited[i] && (min == -1 || distance[i] < distance[min])) {
min = i;
}
}
return min;
}
public static void main(String[] args) {
// TODO Auto-generated method stub
int a[][] = { { 0, 5, 0, 0, 0 }, { 0, 0, 0, 4, 6 }, { 0, 7, 0, 0, 0 }, { 0, 0, 2, 0, 0 }, { 3, 0, 0, 9, 0 } };
// int b[][] = { { 0, 1, 5 }, { 1, 3, -4 }, { 1, 4, 6 }, { 2, 1, 7 }, { 3, 2, 2 }, { 4, 0, 3 }, { 4, 3, 9 } };
// int a[][] = { { 0, 6, 5, 5, 0, 0, 0 }, { 0, 0, 0, 0, -1, 0, 0 }, { 0, 0, 0, 0, 5, 0, 0 },
// { 0, 0, -2, 0, 0, -1, 0 }, { 0, 0, 0, 0, 0, 0, 3 }, { 0, 0, 0, 0, 0, 0, 3 }, { 0, 0, 0, 0, 0, 0, 0 } };
dijkstra(a);
}
}
| [
"[email protected]"
] | |
fdf231997b74e8deea806717fb40b0d2817025f6 | 49f8459bff06ac8469bf42cb2b6fa0c72c1d0e90 | /app/src/main/java/io/cordova/zhihuiyouzhuan/fragment/home/SecondPreFragment.java | 7a7825ec119de80df7f2d780f83bdea95908cf8a | [] | no_license | pdsxsy007/zzyouzhuan | 8f4daf06a03c99baaf5224e570245dd9b8d2bad6 | ea261be8e3ba9838391fb0d612cc961a80b043e9 | refs/heads/master | 2022-12-25T01:03:37.236649 | 2020-09-30T00:33:35 | 2020-09-30T00:33:35 | 294,555,530 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 30,427 | java | package io.cordova.zhihuiyouzhuan.fragment.home;
import android.content.Intent;
import android.graphics.Color;
import android.support.v4.app.Fragment;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.RelativeLayout;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.lzy.okgo.OkGo;
import com.lzy.okgo.callback.StringCallback;
import com.lzy.okgo.model.Response;
import com.scwang.smartrefresh.layout.SmartRefreshLayout;
import com.scwang.smartrefresh.layout.api.RefreshLayout;
import com.scwang.smartrefresh.layout.listener.OnLoadmoreListener;
import com.scwang.smartrefresh.layout.listener.OnRefreshListener;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import butterknife.BindView;
import io.cordova.zhihuiyouzhuan.R;
import io.cordova.zhihuiyouzhuan.UrlRes;
import io.cordova.zhihuiyouzhuan.activity.LoginActivity2;
import io.cordova.zhihuiyouzhuan.activity.MyToDoMsg2Activity;
import io.cordova.zhihuiyouzhuan.adapter.NewsAdapter3;
import io.cordova.zhihuiyouzhuan.bean.CountBean;
import io.cordova.zhihuiyouzhuan.bean.ItemNewsBean;
import io.cordova.zhihuiyouzhuan.bean.NesItemBean;
import io.cordova.zhihuiyouzhuan.bean.NewsBean;
import io.cordova.zhihuiyouzhuan.bean.NewsBean2;
import io.cordova.zhihuiyouzhuan.bean.OAMessageBean;
import io.cordova.zhihuiyouzhuan.fragment.BaseFragment;
import io.cordova.zhihuiyouzhuan.utils.BadgeView;
import io.cordova.zhihuiyouzhuan.utils.LighterHelper;
import io.cordova.zhihuiyouzhuan.utils.MobileInfoUtils;
import io.cordova.zhihuiyouzhuan.utils.MyApp;
import io.cordova.zhihuiyouzhuan.utils.SPUtils;
import io.cordova.zhihuiyouzhuan.utils.StringUtils;
import io.cordova.zhihuiyouzhuan.utils.ViewUtils;
import me.samlss.lighter.Lighter;
import me.samlss.lighter.interfaces.OnLighterListener;
import me.samlss.lighter.parameter.Direction;
import me.samlss.lighter.parameter.LighterParameter;
import me.samlss.lighter.parameter.MarginOffset;
import me.samlss.lighter.shape.CircleShape;
/**
* Created by Administrator on 2019/8/21 0021.
*/
public class SecondPreFragment extends BaseFragment implements View.OnClickListener,RadioGroup.OnCheckedChangeListener{
RelativeLayout rl_msg_app;
private BadgeView badge1;
boolean isLogin = false;
private ArrayList<Fragment> mFragments = new ArrayList<>();
NewsAdapter3 adapter;
OAMessageBean oaMessageBean = new OAMessageBean();
OAMessageBean oaEmail = new OAMessageBean();
@BindView(R.id.xy_tz)
RadioButton xyTz;
@BindView(R.id.notice_news)
RadioButton noticeNews;
@BindView(R.id.rm_zt)
RadioButton rmzt;
@BindView(R.id.jw_sta)
RadioButton jwSta;
@BindView(R.id.xs_sta)
RadioButton xsSta;
@BindView(R.id.zs_sta)
RadioButton zsSta;
RadioGroup radioGroup;
RecyclerView recyclerView;
int num1,num2,num3,num4,num5;
String count;
int page = 1;
List<NesItemBean.Obj> objList1 = new ArrayList<>();
List<NesItemBean.Obj> objList2 = new ArrayList<>();
List<NesItemBean.Obj> objList3 = new ArrayList<>();
List<NesItemBean.Obj> objList4 = new ArrayList<>();
List<NesItemBean.Obj> objList5 = new ArrayList<>();
SmartRefreshLayout mSwipeRefreshLayout;
int pos = 0;
private int flag = 0;
@Override
protected int getLayoutResource() {
return R.layout.fragment_second_pre;
}
@Override
protected void initView(final View view) {
isLogin = !StringUtils.isEmpty((String) SPUtils.get(MyApp.getInstance(),"username",""));
mSwipeRefreshLayout = view.findViewById(R.id.swipeLayout);
recyclerView = view.findViewById(R.id.recyclerview);
LinearLayoutManager mLinearLayoutManager = new LinearLayoutManager(getActivity(), LinearLayout.VERTICAL, false);
recyclerView.setLayoutManager(mLinearLayoutManager);
xyTz = view.findViewById(R.id.xy_tz);
rmzt = view.findViewById(R.id.rm_zt);
jwSta = view.findViewById(R.id.jw_sta);
xsSta = view.findViewById(R.id.xs_sta);
zsSta = view.findViewById(R.id.zs_sta);
noticeNews = view.findViewById(R.id.notice_news);
noticeNews.setOnClickListener(this);
xyTz.setOnClickListener(this);
rmzt.setOnClickListener(this);
xyTz.setOnClickListener(this);
zsSta.setOnClickListener(this);
jwSta.setOnClickListener(this);
xsSta.setOnClickListener(this);
radioGroup = view.findViewById(R.id.radio_group);
radioGroup.setOnCheckedChangeListener(this);
rl_msg_app = view.findViewById(R.id.rl_msg_app1);
getNews2("5");
radioGroup.check(R.id.jw_sta);
isLogin = !StringUtils.isEmpty((String) SPUtils.get(MyApp.getInstance(),"userId",""));
rl_msg_app.setVisibility(View.VISIBLE);
count = (String) SPUtils.get(getActivity(), "count", "");
badge1 = new BadgeView(getActivity(), rl_msg_app);
remind();
if (!isLogin){
badge1.hide();
}else {
if(count != null){
if(count.equals("0")){
badge1.hide();
}else {
badge1.show();
}
}else {
badge1.hide();
}
}
rl_msg_app.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
isLogin = !StringUtils.isEmpty((String) SPUtils.get(MyApp.getInstance(),"username",""));
if (isLogin){
Intent intent = new Intent(MyApp.getInstance(), MyToDoMsg2Activity.class);
startActivity(intent);
}else {
Intent intent = new Intent(MyApp.getInstance(), LoginActivity2.class);
startActivity(intent);
}
}
});
String home02 = (String) SPUtils.get(MyApp.getInstance(), "home02", "");
if(home02.equals("")){
setGuideView();
}
mSwipeRefreshLayout.setOnRefreshListener(new OnRefreshListener() {
@Override
public void onRefresh(RefreshLayout refreshlayout) {
getNews2("5");
/* mTabLayout_1.setSelected(true);
mTabLayout_1.setCurrentTab(pos);*/
refreshlayout.finishRefresh();
}
});
mSwipeRefreshLayout.setOnLoadmoreListener(new OnLoadmoreListener() {
@Override
public void onLoadmore(RefreshLayout refreshlayout) {
getNewsDataMore();
refreshlayout.finishLoadmore();
}
});
recyclerView.setHasFixedSize(true);
recyclerView.setNestedScrollingEnabled(false);
}
private void getNewsDataMore() {
page = page + 1;
objList.clear();
switch (page){
// case 1:
// objList.addAll(objList1);
// adapter = new NewsAdapter3(getActivity(),R.layout.list_item_news,objList);
// recyclerView.setAdapter(adapter);
// break;
case 2:
objList.addAll(objList1);
objList.addAll(objList2);
adapter = new NewsAdapter3(getActivity(),R.layout.list_item_news,objList);
recyclerView.setAdapter(adapter);
break;
case 3:
objList.addAll(objList1);
objList.addAll(objList2);
objList.addAll(objList3);
adapter = new NewsAdapter3(getActivity(),R.layout.list_item_news,objList);
recyclerView.setAdapter(adapter);
break;
case 4:
objList.addAll(objList1);
objList.addAll(objList2);
objList.addAll(objList3);
objList.addAll(objList4);
adapter = new NewsAdapter3(getActivity(),R.layout.list_item_news,objList);
recyclerView.setAdapter(adapter);
break;
case 5:
objList.addAll(objList1);
objList.addAll(objList2);
objList.addAll(objList3);
objList.addAll(objList4);
objList.addAll(objList5);
adapter = new NewsAdapter3(getActivity(),R.layout.list_item_news,objList);
recyclerView.setAdapter(adapter);
break;
}
}
private void setGuideView() {
CircleShape circleShape = new CircleShape(10);
circleShape.setPaint(LighterHelper.getDashPaint()); //set custom paint
View tipView1 = getLayoutInflater().inflate(R.layout.fragment_home_gl, null);
// 使用图片
Lighter.with(getActivity()
)
.setBackgroundColor(0xB9000000)
.setOnLighterListener(new OnLighterListener() {
@Override
public void onShow(int index) {
}
@Override
public void onDismiss() {
SPUtils.put(MyApp.getInstance(),"home02","1");
}
})
.addHighlight(new LighterParameter.Builder()
//.setHighlightedViewId(R.id.rl_msg_app)
.setHighlightedView(rl_msg_app)
.setTipLayoutId(R.layout.fragment_home_gl3)
//.setLighterShape(new RectShape(80, 80, 50))
//.setLighterShape(circleShape)
.setTipViewRelativeDirection(Direction.BOTTOM)
.setTipViewRelativeOffset(new MarginOffset(150, 0, 30, 0))
.build()).show();
}
private void remind() { //BadgeView的具体使用
String count = (String) SPUtils.get(getActivity(), "count", "");
if(count.equals("")){
count = "0";
}
//badge1.setText(count); // 需要显示的提醒类容
if (Integer.parseInt(count) > 99) {
badge1.setText("99+");
}else{
badge1.setText(count); // 需要显示的提醒类容
}
badge1.setBadgePosition(BadgeView.POSITION_TOP_RIGHT);// 显示的位置.右上角,BadgeView.POSITION_BOTTOM_LEFT,下左,还有其他几个属性
badge1.setTextColor(Color.WHITE); // 文本颜色
badge1.setBadgeBackgroundColor(Color.RED); // 提醒信息的背景颜色,自己设置
//badge1.setBackgroundResource(R.mipmap.icon_message_png); //设置背景图片
badge1.setTextSize(10); // 文本大小
badge1.setBadgeMargin(3, 3); // 水平和竖直方向的间距
if(count.equals("0")){
badge1.hide();
}else {
badge1.show();// 只有显示
}
}
private void netWorkOAEmail() {
OkGo.<String>post(UrlRes.HOME_URL + UrlRes.getOaworkflow)
.params("userId",(String) SPUtils.get(MyApp.getInstance(),"userId",""))
.params("type","3")
.execute(new StringCallback() {
@Override
public void onSuccess(Response<String> response) {
Log.e("s待办",response.body());
oaEmail = JSON.parseObject(response.body(),OAMessageBean.class);
count = Integer.parseInt(oaEmail.getObj().getCount()) + Integer.parseInt(countBean1.getObj()) + Integer.parseInt(oaMessageBean.getObj().getCount()) + Integer.parseInt(oaMessageBean2.getObj().getCount()) + "";
if(SPUtils.get(getActivity(),"rolecodes","").equals("student")){
count = Integer.parseInt(countBean1.getObj()) + "";
}
if(null == count){
count = "0";
}
SPUtils.put(MyApp.getInstance(),"count",count+"");
if(!count.equals("") && !"0".equals(count)){
remind();
SPUtils.get(getContext(),"count","");
}else {
badge1.hide();
}
}
@Override
public void onError(Response<String> response) {
super.onError(response);
Log.e("newsid",response.body());
ViewUtils.cancelLoadingDialog();
}
});
}
OAMessageBean oaMessageBean2;
private void netWorkOANotice() {
OkGo.<String>post(UrlRes.HOME_URL + UrlRes.getOaworkflow)
.params("userId",(String) SPUtils.get(MyApp.getInstance(),"userId",""))
.params("type","2")
.execute(new StringCallback() {
@Override
public void onSuccess(Response<String> response) {
Log.e("s待办",response.body());
oaMessageBean2 = JSON.parseObject(response.body(),OAMessageBean.class);
if(oaMessageBean2.getObj().getCount().equals("0")){
}else {
}
netWorkOAEmail();
}
@Override
public void onError(Response<String> response) {
super.onError(response);
Log.e("newsid",response.body());
ViewUtils.cancelLoadingDialog();
}
});
}
CountBean countBean1;
private void netWorkSystemMsg() {
OkGo.<String>post(UrlRes.HOME_URL + UrlRes.Query_countUnreadMessagesForCurrentUser)
.params("userId",(String) SPUtils.get(MyApp.getInstance(),"userId",""))
.execute(new StringCallback() {
@Override
public void onSuccess(Response<String> response) {
Log.e("s",response.toString());
countBean1 = JSON.parseObject(response.body(), CountBean.class);
//yy_msg_num.setText(countBean.getCount()+"");
netWorkOAToDoMsg();//OA待办
}
@Override
public void onError(Response<String> response) {
super.onError(response);
}
});
}
/**OA消息列表*/
private void netWorkOAToDoMsg() {
// OkGo.<String>post(UrlRes.HOME_URL + UrlRes.Query_count)
// .params("userId",(String) SPUtils.get(MyApp.getInstance(),"userId",""))
// .params("type", "db")
// .params("workType", "workdb")
// .execute(new StringCallback() {
// @Override
// public void onSuccess(Response<String> response) {
// Log.e("s",response.toString());
//
// countBean2 = JSON.parseObject(response.body(), CountBean.class);
// netWorkDyMsg();
// }
//
// @Override
// public void onError(Response<String> response) {
// super.onError(response);
// Log.e("sssssss",response.toString());
// }
// });
OkGo.<String>post(UrlRes.HOME_URL + UrlRes.getOaworkflow)
.params("userId",(String) SPUtils.get(MyApp.getInstance(),"userId",""))
.params("type","1")
.execute(new StringCallback() {
@Override
public void onSuccess(Response<String> response) {
Log.e("oa待办",response.body());
oaMessageBean = JSON.parseObject(response.body(),OAMessageBean.class);
netWorkOANotice();
}
@Override
public void onError(Response<String> response) {
super.onError(response);
Log.e("newsid",response.body());
ViewUtils.cancelLoadingDialog();
}
});
}
@Override
public void onHiddenChanged(boolean hidden) {
super.onHiddenChanged(hidden);
if (hidden) { // 不在最前端显示 相当于调用了onPause();
}else{ // 在最前端显示 相当于调用了onResume();
isLogin = !StringUtils.isEmpty((String) SPUtils.get(MyApp.getInstance(),"username",""));
netInsertPortal("2");
String count = (String) SPUtils.get(getActivity(),"count","");
Log.e("count-------",count);
//badge1.setText(count);
if (!isLogin){
badge1.hide();
}else {
netWorkSystemMsg();
//remind(rl_msg_app);
}
}
}
private void netInsertPortal(final String insertPortalAccessLog) {
String imei = MobileInfoUtils.getIMEI(getActivity());
OkGo.<String>post(UrlRes.HOME_URL + UrlRes.Four_Modules)
.params("portalAccessLogMemberId",(String) SPUtils.get(MyApp.getInstance(),"userId",""))
.params("portalAccessLogEquipmentId",(String) SPUtils.get(MyApp.getInstance(),"imei",""))//设备ID
.params("portalAccessLogTarget", insertPortalAccessLog)//访问目标
.params("portalAccessLogVersionNumber", (String) SPUtils.get(getActivity(),"versionName", ""))//版本号
.params("portalAccessLogOperatingSystem", "ANDROID")//版本号
.execute(new StringCallback() {
@Override
public void onSuccess(Response<String> response) {
Log.e("sdsaas",response.body());
}
@Override
public void onError(Response<String> response) {
super.onError(response);
}
});
}
List<String> newstitle;
List<String> newstitleUrl;
List<List<ItemNewsBean>> lists;
List<String> mlists = new ArrayList<>();
private void getNewsData(final View view) {
OkGo.<String>post(UrlRes.HOME_URL + UrlRes.findNewsUrl)
.params("isReturnWithUrl","1")
.execute(new StringCallback() {
@Override
public void onSuccess(Response<String> response) {
Log.e("news",response.body());
Gson gson = new Gson();
// NewsBean newsBean = JsonUtil.parseJson(response.body(),NewsBean.class);
// JsonObject jsonObject = new JsonObject();
NewsBean newsBean = gson.fromJson(response.body(), new TypeToken<NewsBean>(){}.getType());
Map<String, List<ItemNewsBean>> obj = (Map<String, List<ItemNewsBean>>) newsBean.getObj();
newstitle = new ArrayList<>();
newstitleUrl = new ArrayList<>();
int i = 0;
List<Map<String,List<ItemNewsBean>>> list = new ArrayList<>();
lists = new ArrayList<>();
mFragments.clear();
newstitle.clear();
mlists.clear();
lists.clear();
for (Map.Entry<String, List<ItemNewsBean>> entry : obj.entrySet()) {
String key = entry.getKey();
if(key.contains("[@gilight]")){//最版的
flag = 1;
String[] split = key.split("\\[@gilight\\]");
List<ItemNewsBean> value = entry.getValue();
String s = gson.toJson(value);
mlists.add(s);
newstitle.add(split[0]);
newstitleUrl.add(split[1]);
lists.add(value);
}else {//老版的
flag = 0;
List<ItemNewsBean> value = entry.getValue();
String s = gson.toJson(value);
mlists.add(s);
newstitle.add(key);
lists.add(value);
}
}
}
@Override
public void onError(Response<String> response) {
super.onError(response);
}
});
}
@Override
public void onClick(View view) {
}
NewsBean2 newsBean2 ;
NesItemBean nesItemBean;
List<NesItemBean.Obj> objList = new ArrayList<>();
private void getNews2(String flag){//学院通知
OkGo.<String>post(UrlRes.news_url)
.params("flag",flag)
.execute(new StringCallback() {
@Override
public void onSuccess(Response<String> response) {
Log.e("news11111111111",response.body());
Gson gson = new Gson();
newsBean2 = gson.fromJson(response.body(),NewsBean2.class);
String obj = newsBean2.getObj();
Map<String,Object> jsonToMap = JSONObject.parseObject(obj);
System.out.println("jsonToMap:"+jsonToMap);
nesItemBean = JSONObject.parseObject(jsonToMap.get("str").toString(),NesItemBean.class);
System.out.println("jsonToData:"+ jsonToMap.get("str").toString());
objList.clear();
objList2.clear();
objList3.clear();
objList4.clear();
objList5.clear();
objList1.clear();
objList.addAll(nesItemBean.getData());
for(int i=0; i<15; i++){
if(objList.size() == 14){
objList1.clear();
objList1.add(objList.get(0));
objList1.add(objList.get(1));
objList1.add(objList.get(2));
objList1.add(objList.get(3));
objList1.add(objList.get(4));
objList1.add(objList.get(5));
objList1.add(objList.get(6));
objList1.add(objList.get(7));
objList1.add(objList.get(8));
objList1.add(objList.get(9));
objList1.add(objList.get(10));
objList1.add(objList.get(11));
objList1.add(objList.get(12));
objList1.add(objList.get(13));
}else{
objList1.add(objList.get(i));
}
}
if(objList.size() >15){
for (int i=15;i<25; i++){
objList2.add(objList.get(i));
}
}
if(objList.size() >25){
for (int i=25;i<35; i++){
objList3.add(objList.get(i));
}
}
if(objList.size()>35) {
for (int i = 35; i < 45; i++) {
if(objList.size() == 40){
objList4.clear();
objList4.add(objList.get(35));
objList4.add(objList.get(36));
objList4.add(objList.get(37));
objList4.add(objList.get(38));
objList4.add(objList.get(39));
}else{
objList4.add(objList.get(i));
}
}
}
if(objList.size() > 45){
for (int i=45;i<50; i++){
objList5.add(objList.get(i));
}
}
adapter = new NewsAdapter3(getActivity(),R.layout.list_item_news,objList1);
recyclerView.setAdapter(adapter);
// initTablayout(view,flag);
}
@Override
public void onError(Response<String> response) {
super.onError(response);
}
});
}
@Override
public void onCheckedChanged(RadioGroup radioGroup, int i) {
page = 1;
switch (i){
case R.id.xy_tz:
getNews2("2");
mSwipeRefreshLayout.setOnRefreshListener(new OnRefreshListener() {
@Override
public void onRefresh(RefreshLayout refreshlayout) {
getNews2("2");
refreshlayout.finishRefresh();
}
});
mSwipeRefreshLayout.setOnLoadmoreListener(new OnLoadmoreListener() {
@Override
public void onLoadmore(RefreshLayout refreshlayout) {
getNewsDataMore();
refreshlayout.finishLoadmore();
}
});
// setTabSelection(0);
break;
case R.id.notice_news:
getNews2("3");
// setTabSelection(1);
mSwipeRefreshLayout.setOnRefreshListener(new OnRefreshListener() {
@Override
public void onRefresh(RefreshLayout refreshlayout) {
getNews2("3");
refreshlayout.finishRefresh();
}
});
mSwipeRefreshLayout.setOnLoadmoreListener(new OnLoadmoreListener() {
@Override
public void onLoadmore(RefreshLayout refreshlayout) {
getNewsDataMore();
refreshlayout.finishLoadmore();
}
});
break;
case R.id.rm_zt:
getNews2("4");
mSwipeRefreshLayout.setOnRefreshListener(new OnRefreshListener() {
@Override
public void onRefresh(RefreshLayout refreshlayout) {
getNews2("4");
refreshlayout.finishRefresh();
}
});
mSwipeRefreshLayout.setOnLoadmoreListener(new OnLoadmoreListener() {
@Override
public void onLoadmore(RefreshLayout refreshlayout) {
getNewsDataMore();
refreshlayout.finishLoadmore();
}
});
break;
case R.id.jw_sta:
getNews2("5");
mSwipeRefreshLayout.setOnRefreshListener(new OnRefreshListener() {
@Override
public void onRefresh(RefreshLayout refreshlayout) {
getNews2("5");
refreshlayout.finishRefresh();
}
});
mSwipeRefreshLayout.setOnLoadmoreListener(new OnLoadmoreListener() {
@Override
public void onLoadmore(RefreshLayout refreshlayout) {
getNewsDataMore();
refreshlayout.finishLoadmore();
}
});
break;
case R.id.xs_sta:
getNews2("6");
mSwipeRefreshLayout.setOnRefreshListener(new OnRefreshListener() {
@Override
public void onRefresh(RefreshLayout refreshlayout) {
getNews2("6");
refreshlayout.finishRefresh();
}
});
mSwipeRefreshLayout.setOnLoadmoreListener(new OnLoadmoreListener() {
@Override
public void onLoadmore(RefreshLayout refreshlayout) {
getNewsDataMore();
refreshlayout.finishLoadmore();
}
});
break;
case R.id.zs_sta:
getNews2("7");
mSwipeRefreshLayout.setOnRefreshListener(new OnRefreshListener() {
@Override
public void onRefresh(RefreshLayout refreshlayout) {
getNews2("7");
refreshlayout.finishRefresh();
}
});
mSwipeRefreshLayout.setOnLoadmoreListener(new OnLoadmoreListener() {
@Override
public void onLoadmore(RefreshLayout refreshlayout) {
getNewsDataMore();
refreshlayout.finishLoadmore();
}
});
break;
}
}
}
| [
"[email protected]"
] | |
b4a08f7c65c0d06ab17919f5d884f40344f0ae64 | 008a846dd45c218665aacd6312a365c279c4e757 | /monitor_tuning/src/main/java/org/alanhou/monitor_tuning/chapter5/Ch5Controller.java | 090ff27de6be66b97aaced170ffbfcb64e020db0 | [] | no_license | zgdkik/java-codes | e630fc3d9c8402789dae597d629732b4a00047d7 | fbdecd979af97c7b04dc08be9ad6869b41bcd8c4 | refs/heads/master | 2020-06-17T18:34:39.930882 | 2018-08-18T00:03:54 | 2018-08-18T00:03:54 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 376 | java | package org.alanhou.monitor_tuning.chapter5;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/ch5")
public class Ch5Controller {
@RequestMapping("hello")
public String hello() {
String str = "";
for(int i=0; i<10; i++) {
str += i;
}
return str;
}
}
| [
""
] | |
2df2eca36d90826fd7a16e4eb52db2240f1dd922 | 56cdd7d194eb49a6a54246098b07883c9dafde74 | /app/src/test/java/in/sunsoft/com/verizontag/ExampleUnitTest.java | 244e2b5c377ba42989033f63c3fe82c551ab67bf | [] | no_license | sundeeprs/VerizonTag | adfb72bd70252a5e76a21bb2eb5b1708d49e2bc8 | d2eb4b4de09434d8f78c8a36a546a593a8a6f6bf | refs/heads/master | 2020-04-27T10:11:48.905573 | 2019-03-07T00:47:11 | 2019-03-07T00:47:11 | 174,244,019 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 386 | java | package in.sunsoft.com.verizontag;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | [
"[email protected]"
] | |
f749b2ea5dd5295a303d0aef567b7719d3d61949 | eb8054bb74477b20238cdb7c3a777e8a36120756 | /src/com/directi/training/codesmells_refactored/duplicatecode/Statistics.java | dbd8370efcd0ef828f417f3c4cd72a1158f65b0e | [] | no_license | pratvick/CodeSmells | 316f2266ea780e8c8254769cbe50b840461f67d7 | 7df3c4af1950d0ff313dcee202cdb7b26329e207 | refs/heads/master | 2020-12-02T06:40:58.636444 | 2016-07-26T08:10:17 | 2017-07-18T07:06:23 | 96,878,389 | 0 | 1 | null | 2017-07-11T09:54:14 | 2017-07-11T09:54:14 | null | UTF-8 | Java | false | false | 877 | java | package com.directi.training.codesmells_refactored.duplicatecode;
public class Statistics
{
public double calculateDifferenceOfAverage(double[] array1, double[] array2)
{
double average1 = getAverage(array1);
double average2 = getAverage(array2);
return Math.abs(average1 - average2);
}
private double getAverage(double[] array)
{
double sum1 = 0;
double average1;
for (double element : array) {
sum1 += element;
}
average1 = sum1 / array.length;
return average1;
}
public double calculateSampleVariance(double[] elements)
{
double average1 = getAverage(elements);
double temp = 0.0;
for (double element : elements) {
temp += Math.pow(element - average1, 2);
}
return temp / (elements.length - 1);
}
} | [
"[email protected]"
] | |
9400f4ec10ffd0e938ec1056d8c61c32a2022023 | d26f37c6dfe17d83c02d4ab9ef0b5cbf75a93864 | /assistuntu/src/main/java/assistuntu/view/UserComplect.java | fb2345cf5ba372de9f3608ed29b53bcd3124ec20 | [] | no_license | ol-loginov/assistuntu | b6c11ab14f3ecca847d9c3c0c54969f1b29ad8ba | 55a048216ee1782a078e9f8da461272e457aeb3e | refs/heads/master | 2020-05-30T19:41:26.972804 | 2012-05-17T21:58:44 | 2012-05-17T21:58:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 702 | java | package assistuntu.view;
import java.util.ArrayList;
import java.util.List;
public class UserComplect {
private final List<Complect> complects = new ArrayList<Complect>();
private final List<Theme> themes = new ArrayList<Theme>();
public List<Complect> getComplects() {
return complects;
}
public List<Theme> getThemes() {
return themes;
}
public UserComplect deepCopy() {
UserComplect other = new UserComplect();
for (Complect c : complects) {
other.getComplects().add(c.deepCopy());
}
for (Theme theme : themes) {
other.getThemes().add(theme.deepCopy());
}
return other;
}
}
| [
"[email protected]"
] | |
bcc2afaa8a97c490136972623e7998802cd01dbd | 493d0b189b3a72d722fbbc4b0857c2608610abf4 | /lesson/src/main/java/com/example/lesson/mvp/presenter/VideoPresenter.java | d293cd844121bb96be867caa0135ae7d34361086 | [] | no_license | getan525/MicroLesson | e48573d21e685c48a296ea9de963ecee40f287fc | d0becf1b1837a3f54a5b752a0c24c77e9ba1c63b | refs/heads/master | 2023-03-14T01:25:28.634578 | 2021-03-07T14:01:11 | 2021-03-07T14:01:11 | 345,360,982 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,986 | java | package com.example.lesson.mvp.presenter;
import android.app.Application;
import android.content.Intent;
import android.view.View;
import android.widget.Toast;
import android.widget.Toolbar;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.example.lesson.R;
import com.example.lesson.app.data.entity.RecommendBean;
import com.example.lesson.app.data.entity.VideoBean;
import com.example.lesson.mvp.ui.activity.DetailActivity;
import com.example.lesson.mvp.ui.activity.PlayerActivity;
import com.example.lesson.mvp.ui.adapter.Videodapter;
import com.jess.arms.integration.AppManager;
import com.jess.arms.di.scope.FragmentScope;
import com.jess.arms.mvp.BasePresenter;
import com.jess.arms.http.imageloader.ImageLoader;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;
import me.jessyan.rxerrorhandler.core.RxErrorHandler;
import me.jessyan.rxerrorhandler.handler.ErrorHandleSubscriber;
import timber.log.Timber;
import javax.inject.Inject;
import com.example.lesson.mvp.contract.VideoContract;
import com.jess.arms.utils.RxLifecycleUtils;
import java.util.List;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 12/24/2019 12:00
* <a href="mailto:[email protected]">Contact me</a>
* <a href="https://github.com/JessYanCoding">Follow me</a>
* <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
* <a href="https://github.com/JessYanCoding/MVPArms/wiki">See me</a>
* <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
* ================================================
*/
@FragmentScope
public class VideoPresenter extends BasePresenter<VideoContract.Model, VideoContract.View> {
@Inject
RxErrorHandler mErrorHandler;
@Inject
Application mApplication;
@Inject
ImageLoader mImageLoader;
@Inject
AppManager mAppManager;
Videodapter videodapter;
@Inject
public VideoPresenter(VideoContract.Model model, VideoContract.View rootView) {
super(model, rootView);
}
@Override
public void onDestroy() {
super.onDestroy();
this.mErrorHandler = null;
this.mAppManager = null;
this.mImageLoader = null;
this.mApplication = null;
}
public void getVideo() {
mModel.getVideo()
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.doOnSubscribe(disposable -> {
mRootView.showLoading();
})
.doFinally(() -> {
mRootView.hideLoading();
})
.compose(RxLifecycleUtils.bindToLifecycle(mRootView))
.subscribe(new ErrorHandleSubscriber<VideoBean>(mErrorHandler) {
@Override
public void onNext(VideoBean videoBean) {
setAdapter(videoBean.getData().getVideo());
}
});
}
private void setAdapter(List<VideoBean.DataBean.PlayerBean> list) {
if (videodapter == null) {
videodapter = new Videodapter(R.layout.item_video, list);
}
mRootView.setAdapter(videodapter);
videodapter.setNewData(list);
videodapter.setOnItemClickListener((adapter, view, position) -> {
Intent intent = new Intent(mApplication, DetailActivity.class);
intent.putExtra(DetailActivity.PARAM_TITLE, list.get(position).getTitle());
intent.putExtra(DetailActivity.PARAM_URL, list.get(position).getUrl());
mRootView.launchActivity(intent);
});
videodapter.setOnItemChildClickListener((adapter, view, position) -> {
Intent intent = new Intent(mApplication, PlayerActivity.class);
intent.putExtra("PlayBean", list.get(position));
mRootView.launchActivity(intent);
});
}
}
| [
"[email protected]"
] | |
954646012431259bbe7b627b1cc1a17e70962ce2 | fb56da69fa108f5538f8ccb59e73b378cebd85bc | /Java/src/Session7/Vidu7.java | c76a0b542798f302b5d5d83442822ba914ce0bee | [] | no_license | MaiPhan20/Baitap | a8fd0497c02ed40ffb2944ad12deb719f5f1f219 | c0c2443fceaf62eb5030341569e53f6c937cb5a4 | refs/heads/master | 2023-01-01T00:42:23.066391 | 2020-10-22T15:17:21 | 2020-10-22T15:17:21 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 149 | java | package Session7;
public class Vidu7 {
private double PI=3.14;
public double calcArea(double rad){
return (3.14 *rad *rad);
}
}
| [
"[email protected]"
] | |
c0aaae93857eeef57ab5a47aa5c643ca092597ab | 56d7cb4633ca04c130bccd44a5ffee325ea88b17 | /src/com/bookstore/controller/frontend/order/PlaceOrderServlet.java | e606f0b99c6f8a30fc0261b98e46fa8cc9f01771 | [] | no_license | davilla1993/evergreen-bookstore | 41affbac80b285509c4ea83b15c516a9cb639606 | 61648b92d9e8bfe5fa5ae99fb2c3f7694c3664b5 | refs/heads/master | 2022-12-05T02:00:42.920460 | 2020-08-29T20:05:09 | 2020-08-29T20:05:09 | 287,771,489 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 779 | java | package com.bookstore.controller.frontend.order;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.bookstore.services.OrderServices;
@WebServlet("/place_order")
public class PlaceOrderServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
public PlaceOrderServlet() {
super();
}
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
OrderServices orderServices = new OrderServices(request, response);
orderServices.placeOrder();
}
}
| [
"[email protected]"
] | |
5de6563207f38bb08de2e8973e1592a4c1c82bc0 | 423c7cbd375e4fa90462b2ad3bde417eeae7e0a7 | /day18-ProductServletListenerFilter/src/shop/util/LoginChecker.java | 435e0fd4dde6ea35205241167c287c425d8d3328 | [] | no_license | yjs3764/academy_java_servlet | 6baad1526028e14859c141d1cd10024f480c8f7a | 405237f28c1ba6b09c17096672b79badb9ea5773 | refs/heads/master | 2020-03-23T18:58:05.123999 | 2019-01-29T10:14:21 | 2019-01-29T10:14:21 | 141,945,106 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 867 | java | package shop.util;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
/**
* 로그인 상태를 체크해서 로그인 여부를
* boolean 값으로 리턴하는 static 를 가진 클래스
* @author PC38206
*
*/
public class LoginChecker {
public static boolean isLogin(HttpServletRequest req) {
boolean isLogin = false;
// 매개변수로 넘어온 req 로부터 세션을 얻어냄
HttpSession session = req.getSession(false);
if (session != null) {
// 로그인 했을 때, session 객체에
// userid 라는 이름으로 추가된 속성이 있는지 검사
String userid = (String) session.getAttribute("userid");
if (userid != null) {
isLogin = true;
}
}
System.out.println("isLogin = " + isLogin);
return isLogin;
}
}
| [
"[email protected]"
] |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.