blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 410 | content_id stringlengths 40 40 | detected_licenses listlengths 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 684M ⌀ | 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 132
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 28
values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 352 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0eab3286bcadae5ad13a59d6fa2f679b4e674668 | 7c00ba5b719e3a37d54ed212a021fae8f19a1a45 | /src/main/java/tutorial/workqueue/rece/Receiver2.java | ff67d351049bfa6d731549b586adadfeca01df14 | [] | no_license | maplecops/RabbitMQ-Study | 3a5897824aea10c046c37ca0e29f62f1e4e8888d | fcb110f489384ec84e4b7b1d30c8e0c6d19b1ecc | refs/heads/master | 2022-12-20T09:00:01.616981 | 2020-04-19T10:49:23 | 2020-04-19T10:49:23 | 256,771,827 | 0 | 0 | null | 2020-10-13T21:18:18 | 2020-04-18T14:19:42 | Java | UTF-8 | Java | false | false | 1,130 | java | package tutorial.workqueue.rece;
import com.rabbitmq.client.Channel;
import com.rabbitmq.client.DeliverCallback;
import tutorial.workqueue.BaseReceiver;
public class Receiver2 extends BaseReceiver {
public static void main(String[] args) throws Exception {
Receiver2 _2 = new Receiver2();
_2.consumer();
}
@Override
public void consumer() throws Exception {
Channel channel = getChannel();
channel.basicQos(1);
channel.queueDeclare(QUEUE_NAME, durable, false, false, null);
DeliverCallback deliverCallback = (consumerTag, message) -> {
try {
String str = new String(message.getBody(), "UTF-8");
System.out.println("2@" + str);
Thread.sleep(Integer.parseInt(str) * 100);
System.out.println("2#" + str);
} catch (Exception e) {
e.printStackTrace();
}
channel.basicAck(message.getEnvelope().getDeliveryTag(), false);
};
channel.basicConsume(QUEUE_NAME, false, deliverCallback, cancelCallback -> {
});
}
}
| [
"maple_chen@yeah.net"
] | maple_chen@yeah.net |
43128f8e21f77bb860cab29cb79ca77e841beaa8 | f78d4f1dfc4fbf4df28da8e3c2635981ce2c5248 | /codeGenerationServlet/src/sfcAST/XsiNoNamespaceSchemaLocation.java | cd2acf512198bc4e3f10aa0073586356346940d9 | [] | no_license | majstenmark/codegen | 9a6ac263c235a7aced29c876ab4d60e68046fbdb | a573cb79671bf121cc1689ff72776d9b081dc374 | refs/heads/master | 2016-09-14T19:36:18.821101 | 2016-05-03T20:43:39 | 2016-05-03T20:43:39 | 57,197,225 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,680 | java | package sfcAST;
import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
import java.util.HashSet;
import java.util.LinkedList;
import org.openrdf.OpenRDFException;
import org.openrdf.model.*;
import org.openrdf.model.vocabulary.OWL;
import org.openrdf.query.BindingSet;
import org.openrdf.query.QueryLanguage;
import org.openrdf.query.TupleQuery;
import org.openrdf.query.TupleQueryResult;
import org.openrdf.repository.*;
/**
* @ast node
* @declaredat sfc.ast:24
*/
public class XsiNoNamespaceSchemaLocation extends Attribute implements Cloneable {
/**
* @apilevel low-level
*/
public void flushCache() {
super.flushCache();
}
/**
* @apilevel internal
*/
public void flushCollectionCache() {
super.flushCollectionCache();
}
/**
* @apilevel internal
*/
@SuppressWarnings({"unchecked", "cast"})
public XsiNoNamespaceSchemaLocation clone() throws CloneNotSupportedException {
XsiNoNamespaceSchemaLocation node = (XsiNoNamespaceSchemaLocation)super.clone();
node.in$Circle(false);
node.is$Final(false);
return node;
}
/**
* @apilevel internal
*/
@SuppressWarnings({"unchecked", "cast"})
public XsiNoNamespaceSchemaLocation copy() {
try {
XsiNoNamespaceSchemaLocation node = (XsiNoNamespaceSchemaLocation)clone();
if(children != null) node.children = (ASTNode[])children.clone();
return node;
} catch (CloneNotSupportedException e) {
}
System.err.println("Error: Could not clone node of type " + getClass().getName() + "!");
return null;
}
/**
* @apilevel low-level
*/
@SuppressWarnings({"unchecked", "cast"})
public XsiNoNamespaceSchemaLocation fullCopy() {
XsiNoNamespaceSchemaLocation res = (XsiNoNamespaceSchemaLocation)copy();
for(int i = 0; i < getNumChildNoTransform(); i++) {
ASTNode node = getChildNoTransform(i);
if(node != null) node = node.fullCopy();
res.setChild(node, i);
}
return res;
}
/**
* @ast method
* @aspect PrettyPrinter
* @declaredat /Users/maj/Documents/workspace/sfctest/GeneratedAspects.jrag:1369
*/
public void prettyPrint(String indent, PrintStream pStream) {
pStream.print(" xsi:NoNamespaceSchemaLocation=");
getAttrValue().prettyPrint(indent,pStream);
}
/**
* @ast method
* @declaredat sfc.ast:1
*/
public XsiNoNamespaceSchemaLocation(int i) {
super(i);
}
/**
* @ast method
* @declaredat sfc.ast:4
*/
public XsiNoNamespaceSchemaLocation(XmlParser p, int i) {
this(i);
parser = p;
}
/**
* @ast method
* @declaredat sfc.ast:8
*/
public XsiNoNamespaceSchemaLocation() {
this(0);
}
/**
* @ast method
* @declaredat sfc.ast:14
*/
public XsiNoNamespaceSchemaLocation(AttrValue p0) {
setChild(p0, 0);
}
/**
* @ast method
* @declaredat sfc.ast:17
*/
public void dumpTree(String indent, java.io.PrintStream pStream) {
pStream.println(indent + "XsiNoNamespaceSchemaLocation");
String childIndent = indent + " ";
for(int i = 0; i < getNumChild(); i++)
getChild(i).dumpTree(childIndent, pStream);
}
/**
* @ast method
* @declaredat sfc.ast:24
*/
public Object jjtAccept(XmlParserVisitor visitor, Object data) {
return visitor.visit(this, data);
}
/**
* @ast method
* @declaredat sfc.ast:28
*/
public void jjtAddChild(Node n, int i) {
checkChild(n, i);
super.jjtAddChild(n, i);
}
/**
* @ast method
* @declaredat sfc.ast:33
*/
public void checkChild(Node n, int i) {
if(i == 0 && !(n instanceof AttrValue)) throw new Error("Child number 0 of Attribute has the type " + n.getClass().getName() + " which is not an instance of AttrValue");
}
/**
* @apilevel low-level
* @ast method
* @declaredat sfc.ast:40
*/
public int getNumChild() {
return 1;
}
/**
* @apilevel internal
* @ast method
* @declaredat sfc.ast:46
*/
public boolean mayHaveRewrite() {
return false;
}
/**
* Setter for AttrValue
* @apilevel high-level
* @ast method
* @declaredat sfc.ast:5
*/
public void setAttrValue(AttrValue node) {
setChild(node, 0);
}
/**
* Getter for AttrValue
* @apilevel high-level
* @ast method
* @declaredat sfc.ast:12
*/
public AttrValue getAttrValue() {
return (AttrValue)getChild(0);
}
/**
* @apilevel low-level
* @ast method
* @declaredat sfc.ast:18
*/
public AttrValue getAttrValueNoTransform() {
return (AttrValue)getChildNoTransform(0);
}
/**
* @apilevel internal
*/
public ASTNode rewriteTo() {
return super.rewriteTo();
}
}
| [
"maj.stenmark@cs.lth.se"
] | maj.stenmark@cs.lth.se |
6fe226e7ccd6ea20b7478b68584ad3d8d179fa2c | a2f93c6d6d86def8885e6d184e2682006981bd4f | /src/casa/kieran/dpi/algorithm/smith/Smith.java | 4fad3f2b3a0921b3b3af149ba67585cdf02ab9ef | [] | no_license | KieranHunt/dpi-algorithms-java | 427ffd52e0856a7c8a432fd52fcbbc816f2bdf84 | 9efae0050e721e1ba8ca37dfdbcd9567e1339e20 | refs/heads/master | 2021-01-10T16:45:59.090568 | 2016-02-18T09:38:54 | 2016-02-18T09:38:54 | 45,677,073 | 4 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,598 | java | package casa.kieran.dpi.algorithm.smith;
import casa.kieran.dpi.algorithm.AbstractAlgorithm;
import casa.kieran.dpi.algorithm.boyermoore.BoyerMoore;
import casa.kieran.dpi.algorithm.quicksearch.QuickSearch;
import casa.kieran.dpi.input.Input;
import casa.kieran.dpi.result.Result;
import casa.kieran.dpi.result.Results;
import casa.kieran.dpi.rule.Rule;
import casa.kieran.dpi.rule.Rules;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
public class Smith extends AbstractAlgorithm {
private static Smith instance;
private Rules rules;
private Map<Rule, List<Integer>> preQSBC;
private Map<Rule, List<Integer>> preBMBC;
public static Smith getInstance(Rules rules) {
if (instance == null) {
instance = new Smith();
}
instance.changeRules(rules);
return instance;
}
private void changeRules(Rules rules) {
this.rules = rules;
preQSBC = QuickSearch.preQsBc(rules);
preBMBC = BoyerMoore.preBmBc(rules);
}
@Override
public void search(Input input, Results results, int runNumber, String runId) {
Result result = new Result(rules, input, this, runNumber, runId);
result.start();
int n = input.getLength();
List<Runnable> runnables = new ArrayList<>();
rules.forEach(rule -> {
Runnable runnable = new SmithRunnable(input, result, n, rule);
runnables.add(runnable);
});
executeSearch(runnables);
result.end();
results.addResult(result);
}
@Override
public String toString() {
return "Smith";
}
private class SmithRunnable implements Runnable {
private Input input;
private Result result;
private int n;
private Rule rule;
public SmithRunnable(Input input, Result result, int n, Rule rule) {
this.input = input;
this.result = result;
this.n = n;
this.rule = rule;
}
public void run() {
int m = rule.getLength();
List<Integer> qsBc = preQSBC.get(rule);
List<Integer> bmBc = preBMBC.get(rule);
int j = 0;
while (j <= n - m) {
if (memcmp(rule, input, 0, j, m)) {
result.addLocation(j);
}
if (j + m >= n) {
break;
}
j += Math.max(bmBc.get(input.getByte(j + m - 1) & 0xFF), qsBc.get(input.getByte(j + m) & 0xFF));
}
}
}
}
| [
"kieran.hunt92@gmail.com"
] | kieran.hunt92@gmail.com |
7cae280caff16ba86f601bd25e7fbc97098c7a35 | 1e456ef04aad28a57828808e2173f488990fe243 | /src/main/java/io/github/ukuz/mybatis/type/json/type/ListTypeHandler.java | 6d49718c7e1e47173c0c8bb2604b37872fd6e0c4 | [
"JSON",
"Apache-2.0"
] | permissive | zhuangjinjin/mybatis-typehandlers-json | 080a69bfa32cc0a5c685a2879e95a59374187f7d | 75fde5fc212aa9320a145ab47b8af27a1b9e3f34 | refs/heads/master | 2020-06-11T18:31:40.741904 | 2019-06-27T08:19:07 | 2019-06-27T08:19:07 | 194,048,777 | 3 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,416 | java | /*
* Copyright 2019 ukuz90
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.github.ukuz.mybatis.type.json.type;
import io.github.ukuz.mybatis.type.json.core.Spi;
import org.apache.ibatis.type.JdbcType;
import org.apache.ibatis.type.TypeHandler;
import java.sql.CallableStatement;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;
/**
* @author ukuz90
* @since 2019-06-27
*/
@Spi("default")
public interface ListTypeHandler<T extends List> extends TypeHandler<T> {
void setNonNullParameter(PreparedStatement ps, int i, T parameter, JdbcType jdbcType) throws SQLException;
T getNullableResult(ResultSet rs, String columnName) throws SQLException;
T getNullableResult(ResultSet rs, int columnIndex) throws SQLException;
T getNullableResult(CallableStatement cs, int columnIndex) throws SQLException;
}
| [
"zhuangjinjin90@gmail.com"
] | zhuangjinjin90@gmail.com |
62d4eabd78fbdbd69c3e31a359ce8153060968e1 | 46e8e8e3b2a75394c26149a9e20e15995177f72f | /app/src/main/java/com/example/supjain/popularmoviesapp/Fragments/MovieVideosFragment.java | 36f888e1d01541cc35c743edf1cf464174290377 | [] | no_license | 13supriyajain/PopularMoviesApp | 3ddf38ea6e31910e9ee22127e94a41fdda30a522 | 557e76bf2a8bca177f842fd919354c0c7036c6ac | refs/heads/master | 2020-03-28T18:22:31.156370 | 2018-09-25T07:36:17 | 2018-09-25T07:36:17 | 143,827,369 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,111 | java | package com.example.supjain.popularmoviesapp.Fragments;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ProgressBar;
import android.widget.TextView;
import com.example.supjain.popularmoviesapp.Adapters.MovieVideosAdapter;
import com.example.supjain.popularmoviesapp.Adapters.SimpleFragmentPagerAdapter;
import com.example.supjain.popularmoviesapp.Data.MovieVideosData;
import com.example.supjain.popularmoviesapp.R;
import com.example.supjain.popularmoviesapp.Util.MovieDataUtil;
import java.util.List;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
import retrofit2.Retrofit;
/**
* This custom Fragment class is for displaying the list of movie videos/trailers.
*/
public class MovieVideosFragment extends Fragment implements MovieVideosAdapter.MovieVideosAdapterOnClickHandler {
private static final String SHARE_INTENT_TYPE = "text/plain";
private RecyclerView mVideosRecyclerView;
private TextView mErrorMessageDisplay;
private ProgressBar mProgressbar;
public MovieVideosFragment() {
// Required empty public constructor
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.activity_main, container, false);
mVideosRecyclerView = rootView.findViewById(R.id.movie_data_recycle_view);
mErrorMessageDisplay = rootView.findViewById(R.id.error_text_view);
mProgressbar = rootView.findViewById(R.id.progressbar);
mProgressbar.setVisibility(View.VISIBLE);
mErrorMessageDisplay.setVisibility(View.INVISIBLE);
mVideosRecyclerView.setVisibility(View.INVISIBLE);
String movieId = getArguments().getString(SimpleFragmentPagerAdapter.MOVIE_ID);
fetchAndSetVideoList(movieId);
return rootView;
}
@Override
public void mClick(int viewId, String movieVideoUrl, String movieVideoTitle) {
switch (viewId) {
case R.id.video_share_btn:
shareVideoUrl(movieVideoUrl, movieVideoTitle);
break;
case R.id.video_container_layout:
default:
openVideo(movieVideoUrl);
break;
}
}
private void fetchAndSetVideoList(String movieId) {
if (MovieDataUtil.hasNetworkConnection(getContext())) {
String ApiKeyValue = MovieDataUtil.getApiKeyValue();
Retrofit retrofit = MovieDataUtil.getRetrofitInstance();
MovieDataUtil.MovieDataFetchService service = retrofit.create(MovieDataUtil.MovieDataFetchService.class);
Call<MovieVideosData.TrailersApiResponse> call = service.getMovieVideos(movieId, ApiKeyValue);
call.enqueue(new Callback<MovieVideosData.TrailersApiResponse>() {
@Override
public void onResponse(Call<MovieVideosData.TrailersApiResponse> call, Response<MovieVideosData.TrailersApiResponse> response) {
setVideosList(response.body().getMovieVideosDataList());
}
@Override
public void onFailure(Call<MovieVideosData.TrailersApiResponse> call, Throwable t) {
}
});
} else {
showErrorMessage(getResources().getString(R.string.no_connection_err_msg));
}
}
private void setVideosList(List<MovieVideosData> movieVideosDataList) {
if (movieVideosDataList != null && movieVideosDataList.size() > 0) {
showMovieData();
MovieVideosAdapter movieVideosAdapter = new MovieVideosAdapter(this);
movieVideosAdapter.setMovieVideosData(movieVideosDataList);
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL, false);
mVideosRecyclerView.setLayoutManager(linearLayoutManager);
mVideosRecyclerView.setAdapter(movieVideosAdapter);
mVideosRecyclerView.setHasFixedSize(true);
} else {
showErrorMessage(getResources().getString(R.string.no_data_err_msg));
}
}
private void shareVideoUrl(String videoUrl, String videoTitle) {
if (!TextUtils.isEmpty(videoUrl) && !TextUtils.isEmpty(videoTitle)) {
Intent share = new Intent(android.content.Intent.ACTION_SEND);
share.setType(SHARE_INTENT_TYPE);
/* This flag clears the called app from the activity stack,
so users arrive in the expected place next time this application is restarted.*/
share.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
share.putExtra(Intent.EXTRA_SUBJECT, videoTitle);
share.putExtra(Intent.EXTRA_TEXT, videoUrl);
startActivity(Intent.createChooser(share, getString(R.string.intent_chooser_title)));
}
}
private void openVideo(String movieVideoUrl) {
if (!TextUtils.isEmpty(movieVideoUrl)) {
Uri uri = Uri.parse(movieVideoUrl);
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(uri);
if (intent.resolveActivity(getActivity().getPackageManager()) != null) {
startActivity(intent);
}
}
}
private void showMovieData() {
mErrorMessageDisplay.setVisibility(View.INVISIBLE);
mVideosRecyclerView.setVisibility(View.VISIBLE);
mProgressbar.setVisibility(View.INVISIBLE);
}
private void showErrorMessage(String errorMsg) {
mErrorMessageDisplay.setVisibility(View.VISIBLE);
mErrorMessageDisplay.setText(errorMsg);
mVideosRecyclerView.setVisibility(View.INVISIBLE);
mProgressbar.setVisibility(View.INVISIBLE);
}
}
| [
"supjain@ebay.com"
] | supjain@ebay.com |
2e8ce9bf13f92d56495030ed11a10e1c4cdb676d | 233e903c7e75a4cea44b996382a826300177b76f | /QCloudCosXml/cosxml/src/normal/java/com/tencent/cos/xml/model/bucket/ListMultiUploadsRequest.java | e73dfe1427f5652d985055bcb7b618ff618ee842 | [
"MIT"
] | permissive | asen666/qcloud-sdk-android | 01f70b9749b93474669cc79e5631ba5b346244c0 | d366c1fc037927f40cf924cbe788ef21129a3542 | refs/heads/master | 2023-04-17T06:51:32.135663 | 2021-05-07T12:27:33 | 2021-05-07T12:27:33 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,506 | java | /*
* Copyright (c) 2010-2020 Tencent Cloud. All rights reserved.
*
* 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.tencent.cos.xml.model.bucket;
import com.tencent.cos.xml.common.RequestMethod;
import com.tencent.cos.xml.listener.CosXmlResultListener;
import com.tencent.qcloud.core.http.RequestBodySerializer;
import java.util.Map;
/**
* 查询存储桶(Bucket)中正在进行中的分块上传对象的请求.
* @see com.tencent.cos.xml.CosXml#listMultiUploads(ListMultiUploadsRequest)
* @see com.tencent.cos.xml.CosXml#listMultiUploadsAsync(ListMultiUploadsRequest, CosXmlResultListener)
*/
final public class ListMultiUploadsRequest extends BucketRequest {
/**
* Delimiter is a sign.
* If Prefix exists, the same paths between Prefix and delimiter will be grouped as the same
* type and defined Common Prefix, then all Common Prefixes will be listed.
* If Prefix doesn't exist, the listing process will start from the beginning of the path
*/
private String delimiter;
/** Indicate the encoding method of the returned value */
private String encodingType;
/** Prefix match, used to specify the prefix address of the returned file */
private String prefix;
/** Max number of entries returned each time, default is 1000 */
private String maxUploads;
/**
* Used together with upload-id-marker
* If upload-id-marker is not specified, entries whose ObjectNames are in front of key-marker
* (according to alphabetical order) will be listed.If upload-id-marker is specified, besides
* the above entries, those whose ObjectNames are equal to key-marker and UploadIDs are in front
* of upload-id-marker (according to alphabetical order) will also be listed.
*/
private String keyMarker;
/**
* Used together with key-marker
* If key-marker is not specified, upload-id-marker will be ignored
* If key-marker is specified, entries whose ObjectNames are in front of key-marker
* (according to alphabetical order) will be listed, and entries whose ObjectNames
* are equal to key-marker and UploadIDs are in front of upload-id-marker
* (according to alphabetical order) will also be listed.
*/
private String uploadIdMarker;
public ListMultiUploadsRequest(String bucket){
super(bucket);
}
@Override
public String getMethod() {
return RequestMethod.GET;
}
@Override
public Map<String, String> getQueryString() {
queryParameters.put("uploads", null);
if(delimiter != null){
queryParameters.put("delimiter",delimiter);
}
if(encodingType != null){
queryParameters.put("Encoding-type",encodingType);
}
if(prefix != null){
queryParameters.put("Prefix",prefix);
}
if(maxUploads != null){
queryParameters.put("max-uploads",maxUploads);
}
if(keyMarker != null){
queryParameters.put("key-marker",keyMarker);
}
if(uploadIdMarker != null){
queryParameters.put("upload-id-marker",uploadIdMarker);
}
return super.getQueryString();
}
@Override
public RequestBodySerializer getRequestBody() {
return null;
}
/**
* <p>
* 设置请求的delimiter
* </p>
* <p>
* 定界符为一个符号,对 Object 名字包含指定前缀且第一次出现 delimiter 字符之间的 Object 作为一组元素:common prefix。
* 如果没有 prefix,则从路径起点开始
* </p>
*
* @param delimiter 请求的delimiter
*/
public void setDelimiter(String delimiter) {
this.delimiter = delimiter;
}
/**
* 获取请求的delimiter
*/
public String getDelimiter() {
return delimiter;
}
/**
* <p>
* 设置返回值的编码格式。
* </p>
* <p>
* 合法值:url
* </p>
*
* @param encodingType 返回值的编码格式
*/
public void setEncodingType(String encodingType) {
this.encodingType = encodingType;
}
/**
* 获取返回值的编码格式
*/
public String getEncodingType() {
return encodingType;
}
/**
* <p>
* 设置请求的key-marker
* </p>
*
* <p>
* 与 upload-id-marker 一起使用
* 当 upload-id-marker 未被指定时,ObjectName 字母顺序大于 key-marker 的条目将被列出
* 当upload-id-marker被指定时,ObjectName 字母顺序大于key-marker的条目被列出,
* ObjectName 字母顺序等于 key-marker 同时 UploadID 大于 upload-id-marker 的条目将被列出。
* </p>
*
* @param keyMarker 请求的key-marker
*/
public void setKeyMarker(String keyMarker) {
this.keyMarker = keyMarker;
}
/**
* 获取请求的key-marker
*/
public String getKeyMarker() {
return keyMarker;
}
/**
* 设置最大返回的 multipart 数量,合法取值从1到1000,默认1000
* @param maxUploads 最大返回的 multipart 数量
*/
public void setMaxUploads(String maxUploads) {
this.maxUploads = maxUploads;
}
/**
* 获取由用户设置的maxUploads值
*/
public String getMaxUploads() {
return maxUploads;
}
/**
* <p>
* 设置限定返回的 Object 的前缀
* </p>
*
* @param prefix 限定返回的 Object 的前缀
*/
public void setPrefix(String prefix) {
this.prefix = prefix;
}
/**
* 获取用户设置的前缀prefix
*/
public String getPrefix() {
return prefix;
}
/**
* <p>
* 设置请求的Upload-id-marker
* </p>
* <p>
* 与 key-marker 一起使用
* 当 key-marker 未被指定时,upload-id-marker 将被忽略
* 当 key-marker 被指定时,ObjectName字母顺序大于 key-marker 的条目被列出,
* ObjectName 字母顺序等于 key-marker 同时 UploadID 大于 upload-id-marker 的条目将被列出。
* </p>
* @param uploadIdMarker 请求的Upload-id-marker
*/
public void setUploadIdMarker(String uploadIdMarker) {
this.uploadIdMarker = uploadIdMarker;
}
/**
* 获取设置的upload-id-marker
*/
public String getUploadIdMarker() {
return uploadIdMarker;
}
}
| [
"rickenwang@tencent.com"
] | rickenwang@tencent.com |
5224a4689770d0e0cb803e70c4990f4abdef7487 | 16f6fc0243382de3e4239d02fbf895a91acf13a5 | /app/src/main/java/com/example/tugaslogin/MainActivity.java | d1c530250759d8f5f30794c20f2aadbe302343ae | [] | no_license | habib1388i/TugasLogin | b1faa439780294d8ade0dbbfab682a70f83682ca | 5da610864ef358be6d6c0883814e9430f1e89f7c | refs/heads/master | 2020-04-19T01:59:36.962601 | 2019-01-28T02:51:44 | 2019-01-28T02:51:44 | 167,888,784 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 535 | java | package com.example.tugaslogin;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import com.example.tugaslogin.R;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
public void login(View view) {
startActivity(new Intent(MainActivity.this, Login.class));
}
}
| [
"muhammadhabibhidayatullah14@gmail.com"
] | muhammadhabibhidayatullah14@gmail.com |
d76166f8d09890d975642b8c38ca2f393d41aea7 | 02d59e8b19b9f7c3ac953be738ab58771a348cfe | /第二题/sss/target/tomcat/work/Tomcat/localhost/_/org/apache/jsp/index_jsp.java | 9f4d15a290ed1d87fe7b316a56543c698b16f4b4 | [] | no_license | sunyb123/springMVC-Spring-data-jpa | 21e72269ea1ae6852105ff548ca3d9b6442fe01b | f27cd8755691cef2040ef04e311cf6a248873839 | refs/heads/master | 2023-01-01T00:25:55.858731 | 2020-10-24T14:06:26 | 2020-10-24T14:06:26 | 306,896,410 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,490 | java | /*
* Generated by the Jasper component of Apache Tomcat
* Version: Apache Tomcat/7.0.47
* Generated at: 2020-10-24 12:28:00 UTC
* Note: The last modified time of this file was set to
* the last modified time of the source file after
* generation to assist with modification tracking.
*/
package org.apache.jsp;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
public final class index_jsp extends org.apache.jasper.runtime.HttpJspBase
implements org.apache.jasper.runtime.JspSourceDependent {
private static final javax.servlet.jsp.JspFactory _jspxFactory =
javax.servlet.jsp.JspFactory.getDefaultFactory();
private static java.util.Map<java.lang.String,java.lang.Long> _jspx_dependants;
private javax.el.ExpressionFactory _el_expressionfactory;
private org.apache.tomcat.InstanceManager _jsp_instancemanager;
public java.util.Map<java.lang.String,java.lang.Long> getDependants() {
return _jspx_dependants;
}
public void _jspInit() {
_el_expressionfactory = _jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory();
_jsp_instancemanager = org.apache.jasper.runtime.InstanceManagerFactory.getInstanceManager(getServletConfig());
}
public void _jspDestroy() {
}
public void _jspService(final javax.servlet.http.HttpServletRequest request, final javax.servlet.http.HttpServletResponse response)
throws java.io.IOException, javax.servlet.ServletException {
final javax.servlet.jsp.PageContext pageContext;
javax.servlet.http.HttpSession session = null;
final javax.servlet.ServletContext application;
final javax.servlet.ServletConfig config;
javax.servlet.jsp.JspWriter out = null;
final java.lang.Object page = this;
javax.servlet.jsp.JspWriter _jspx_out = null;
javax.servlet.jsp.PageContext _jspx_page_context = null;
try {
response.setContentType("text/html;charset=UTF-8");
pageContext = _jspxFactory.getPageContext(this, request, response,
null, true, 8192, true);
_jspx_page_context = pageContext;
application = pageContext.getServletContext();
config = pageContext.getServletConfig();
session = pageContext.getSession();
out = pageContext.getOut();
_jspx_out = out;
out.write("\n");
out.write("\n");
out.write("<html>\n");
out.write("<head>\n");
out.write(" <title>登录页</title>\n");
out.write("</head>\n");
out.write("<body>\n");
out.write("<form action=\"/login\" method=\"post\">\n");
out.write(" 用户名:<input type=\"text\" name=\"username\" value=\"admin\"><br>\n");
out.write(" 密 码:\n");
out.write(" <input type=\"password\" name=\"pwd\" value=\"admin\"><br>\n");
out.write(" <input type=\"submit\" value=\"登录\">\n");
out.write("</form>\n");
out.write("\n");
out.write("</body>\n");
out.write("</html>");
} catch (java.lang.Throwable t) {
if (!(t instanceof javax.servlet.jsp.SkipPageException)){
out = _jspx_out;
if (out != null && out.getBufferSize() != 0)
try { out.clearBuffer(); } catch (java.io.IOException e) {}
if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
else throw new ServletException(t);
}
} finally {
_jspxFactory.releasePageContext(_jspx_page_context);
}
}
}
| [
"sunyb1029@163.com"
] | sunyb1029@163.com |
c1b27645fe2a393cadd76cd0bedb19861074bcab | bf8387adaa4061a073d0efb7e2277bbcfb5caaee | /app/src/main/java/com/vela/app/mobile/ui/adapter/AccountHistoryAdapter.java | d67e9c4a4c7fcd36b1703fd24e893273f56f5755 | [] | no_license | satyam07iitk/Vela | 9b8cc8cdaeb67ac2a9c0088a7791a0fb35cfeb17 | f560c8e480888bf3b5c760b65b7b95b8fdf7b93c | refs/heads/master | 2020-12-04T19:44:00.919274 | 2016-08-22T08:33:32 | 2016-08-22T08:33:32 | 66,254,224 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,220 | java | package com.vela.app.mobile.ui.adapter;
import android.content.Context;
import android.net.Uri;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.vela.app.mobile.R;
import com.vela.app.mobile.ui.model.AccountHistoryModel;
import java.util.ArrayList;
//import com.vyoice.app.R;
//import com.vyoice.app.models.landing_page.AccountHistoryModel;
public class AccountHistoryAdapter extends RecyclerView.Adapter<AccountHistoryAdapter.ViewHolder> {
private final ArrayList<AccountHistoryModel> accountHistoryList;
Context context,context1;
Uri uri,uri1;
int count;
public AccountHistoryAdapter(ArrayList<AccountHistoryModel> accountHistoryList) {
this.accountHistoryList = accountHistoryList;
}
// Create new views (invoked by the layout manager):
@Override
public AccountHistoryAdapter.ViewHolder onCreateViewHolder(ViewGroup parent,
int viewType) {
// create a new view
View itemLayoutView = LayoutInflater.from(parent.getContext()).inflate(R.layout.rvdriverdetails, null);
ViewHolder viewHolder = new ViewHolder(itemLayoutView);
return viewHolder;
}
// Replace the contents of a view (invoked by the layout manager)
@Override
public void onBindViewHolder(ViewHolder viewHolder, int position) {
AccountHistoryModel historyItem = accountHistoryList.get(position);
// uri= Uri.parse(historyItem.getProfileimage());
// context= viewHolder.Profileimage.getContext();
// Picasso.with(context)
// .load(uri).into(viewHolder.Profileimage);
viewHolder.Name.setText(historyItem.getName());
viewHolder.Carname.setText(historyItem.getCarname());
viewHolder.Rating.setText(historyItem.getRating());
viewHolder.Location.setText(historyItem.getLocation());
}
// inner class to hold a reference to each item of RecyclerView
public static class ViewHolder extends RecyclerView.ViewHolder {
ImageView Profileimage,Call,Chat,map;
TextView Name;
TextView Carname;
TextView Rating,Location;
public ViewHolder(View itemLayoutView) {
super(itemLayoutView);
Profileimage=(ImageView)itemLayoutView.findViewById(R.id.profileimage);
Name = (TextView) itemLayoutView.findViewById(R.id.Name);
Carname = (TextView) itemLayoutView.findViewById(R.id.Carname);
Call=(ImageView)itemLayoutView.findViewById(R.id.call);
Chat=(ImageView)itemLayoutView.findViewById(R.id.chat);
map=(ImageView)itemLayoutView.findViewById(R.id.map);
Rating = (TextView) itemLayoutView.findViewById(R.id.Rating);
Location = (TextView) itemLayoutView.findViewById(R.id.Location);
}
}
// Return the size of your itemsData (invoked by the layout manager)
@Override
public int getItemCount() {
return (accountHistoryList != null) ? accountHistoryList.size() : 0;
}
}
| [
"satyam07iitk@gmail.com"
] | satyam07iitk@gmail.com |
b2cdfb29a96697afe71af7083ff685abbfd7734f | ee3566b9e9ccac9e6d66e53ea727c55bd86ce0dd | /src/main/java/com/arodrigo/sysmodelcon/domain/ItemPedido.java | 160d7b03cf456ff3232b4c739b3dc78c7519facf | [] | no_license | arodrigo900045/sysmodelcon | 4ef8993c71daa2833c3f9d69be3221378fddabf7 | 8af5d2156081671f52684f5be0dd21b26148f568 | refs/heads/master | 2023-03-23T06:17:02.087288 | 2021-03-24T23:03:03 | 2021-03-24T23:03:03 | 350,121,930 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,933 | java | package com.arodrigo.sysmodelcon.domain;
import java.io.Serializable;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import com.fasterxml.jackson.annotation.JsonIgnore;
@Entity
public class ItemPedido implements Serializable
{
private static final long serialVersionUID = 1L;
@JsonIgnore
@EmbeddedId
private ItemPedidoPK id = new ItemPedidoPK();
private Double desconto;
private Integer quantidade;
private Double preco;
public ItemPedido()
{
}
public ItemPedido(Pedido pedido, Produto produto, Double desconto, Integer quantidade, Double preco)
{
super();
id.setPedido(pedido);
id.setProduto(produto);
this.desconto = desconto;
this.quantidade = quantidade;
this.preco = preco;
}
@JsonIgnore
public Pedido getPedido()
{
return id.getPedido();
}
public Produto getProduto()
{
return id.getProduto();
}
public ItemPedidoPK getId()
{
return id;
}
public void setId(ItemPedidoPK id)
{
this.id = id;
}
public Double getDesconto()
{
return desconto;
}
public void setDesconto(Double desconto)
{
this.desconto = desconto;
}
public Integer getQuantidade()
{
return quantidade;
}
public void setQuantidade(Integer quantidade)
{
this.quantidade = quantidade;
}
public Double getPreco()
{
return preco;
}
public void setPreco(Double preco)
{
this.preco = preco;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((id == null) ? 0 : id.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
ItemPedido other = (ItemPedido) obj;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
return true;
}
}
| [
"adilsonmissionario@gmail.com"
] | adilsonmissionario@gmail.com |
e04c1f32cb582e58f1f9c766f2d9d2c41ee30df1 | ad7d4dced193fde87f1b9a394d3a142fdad4344c | /Application/src/main/java/com/example/android/FaceDetector/Camera2BasicFragment.java | 52fcb88036fdf940675480836388121b56321fbc | [
"Apache-2.0"
] | permissive | samkecy/FaceDetector | c7588db48f97e992fdafbd3928a805dc89fbe829 | e08a769617ab7de093cb7a3cdf46b51dd71233e2 | refs/heads/master | 2020-07-04T06:31:30.492647 | 2019-08-13T17:16:38 | 2019-08-13T17:16:38 | 202,187,584 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 40,187 | java | /*
* Copyright 2017 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.example.android.FaceDetector;
import android.Manifest;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.graphics.ImageFormat;
import android.graphics.Matrix;
import android.graphics.Point;
import android.graphics.RectF;
import android.graphics.SurfaceTexture;
import android.hardware.camera2.CameraAccessException;
import android.hardware.camera2.CameraCaptureSession;
import android.hardware.camera2.CameraCharacteristics;
import android.hardware.camera2.CameraDevice;
import android.hardware.camera2.CameraManager;
import android.hardware.camera2.CameraMetadata;
import android.hardware.camera2.CaptureRequest;
import android.hardware.camera2.CaptureResult;
import android.hardware.camera2.TotalCaptureResult;
import android.hardware.camera2.params.StreamConfigurationMap;
import android.media.Image;
import android.media.ImageReader;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.os.HandlerThread;
import android.support.annotation.NonNull;
import android.support.v4.app.ActivityCompat;
import android.support.v4.app.DialogFragment;
import android.support.v4.app.Fragment;
import android.support.v4.content.ContextCompat;
import android.util.Log;
import android.util.Size;
import android.util.SparseIntArray;
import android.view.LayoutInflater;
import android.view.Surface;
import android.view.TextureView;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.Toast;
import com.example.android.camera2basic.R;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.concurrent.Semaphore;
import java.util.concurrent.TimeUnit;
public class Camera2BasicFragment extends Fragment
implements View.OnClickListener, ActivityCompat.OnRequestPermissionsResultCallback {
/**
* Conversion from screen rotation to JPEG orientation.
*/
private static final SparseIntArray ORIENTATIONS = new SparseIntArray();
private static final int REQUEST_CAMERA_PERMISSION = 1;
private static final String FRAGMENT_DIALOG = "dialog";
static {
ORIENTATIONS.append(Surface.ROTATION_0, 90);
ORIENTATIONS.append(Surface.ROTATION_90, 0);
ORIENTATIONS.append(Surface.ROTATION_180, 270);
ORIENTATIONS.append(Surface.ROTATION_270, 180);
}
/**
* Tag for the {@link Log}.
*/
private static final String TAG = "Camera2BasicFragment";
/**
* Camera state: Showing camera preview.
*/
private static final int STATE_PREVIEW = 0;
/**
* Camera state: Waiting for the focus to be locked.
*/
private static final int STATE_WAITING_LOCK = 1;
/**
* Camera state: Waiting for the exposure to be precapture state.
*/
private static final int STATE_WAITING_PRECAPTURE = 2;
/**
* Camera state: Waiting for the exposure state to be something other than precapture.
*/
private static final int STATE_WAITING_NON_PRECAPTURE = 3;
/**
* Camera state: Picture was taken.
*/
private static final int STATE_PICTURE_TAKEN = 4;
/**
* Max preview width that is guaranteed by Camera2 API
*/
private static final int MAX_PREVIEW_WIDTH = 1920;
/**
* Max preview height that is guaranteed by Camera2 API
*/
private static final int MAX_PREVIEW_HEIGHT = 1080;
/**
* {@link TextureView.SurfaceTextureListener} handles several lifecycle events on a
* {@link TextureView}.
*/
private final TextureView.SurfaceTextureListener mSurfaceTextureListener
= new TextureView.SurfaceTextureListener() {
@Override
public void onSurfaceTextureAvailable(SurfaceTexture texture, int width, int height) {
openCamera(width, height);
}
@Override
public void onSurfaceTextureSizeChanged(SurfaceTexture texture, int width, int height) {
configureTransform(width, height);
}
@Override
public boolean onSurfaceTextureDestroyed(SurfaceTexture texture) {
return true;
}
@Override
public void onSurfaceTextureUpdated(SurfaceTexture texture) {
}
};
/**
* ID of the current {@link CameraDevice}.
*/
private String mCameraId;
/**
* An {@link AutoFitTextureView} for camera preview.
*/
private AutoFitTextureView mTextureView;
/**
* A {@link CameraCaptureSession } for camera preview.
*/
private CameraCaptureSession mCaptureSession;
/**
* A reference to the opened {@link CameraDevice}.
*/
private CameraDevice mCameraDevice;
/**
* The {@link android.util.Size} of camera preview.
*/
private Size mPreviewSize;
/**
* {@link CameraDevice.StateCallback} is called when {@link CameraDevice} changes its state.
*/
private final CameraDevice.StateCallback mStateCallback = new CameraDevice.StateCallback() {
@Override
public void onOpened(@NonNull CameraDevice cameraDevice) {
// This method is called when the camera is opened. We start camera preview here.
mCameraOpenCloseLock.release();
mCameraDevice = cameraDevice;
createCameraPreviewSession();
}
@Override
public void onDisconnected(@NonNull CameraDevice cameraDevice) {
mCameraOpenCloseLock.release();
cameraDevice.close();
mCameraDevice = null;
}
@Override
public void onError(@NonNull CameraDevice cameraDevice, int error) {
mCameraOpenCloseLock.release();
cameraDevice.close();
mCameraDevice = null;
Activity activity = getActivity();
if (null != activity) {
activity.finish();
}
}
};
/**
* An additional thread for running tasks that shouldn't block the UI.
*/
private HandlerThread mBackgroundThread;
/**
* A {@link Handler} for running tasks in the background.
*/
private Handler mBackgroundHandler;
/**
* An {@link ImageReader} that handles still image capture.
*/
private ImageReader mImageReader;
/**
* This is the output file for our picture.
*/
private File mFile;
/**
* This a callback object for the {@link ImageReader}. "onImageAvailable" will be called when a
* still image is ready to be saved.
*/
private final ImageReader.OnImageAvailableListener mOnImageAvailableListener
= new ImageReader.OnImageAvailableListener() {
@Override
public void onImageAvailable(ImageReader reader) {
mBackgroundHandler.post(new ImageSaver(reader.acquireNextImage(), mFile));
}
};
/**
* {@link CaptureRequest.Builder} for the camera preview
*/
private CaptureRequest.Builder mPreviewRequestBuilder;
/**
* {@link CaptureRequest} generated by {@link #mPreviewRequestBuilder}
*/
private CaptureRequest mPreviewRequest;
/**
* The current state of camera state for taking pictures.
*
* @see #mCaptureCallback
*/
private int mState = STATE_PREVIEW;
/**
* A {@link Semaphore} to prevent the app from exiting before closing the camera.
*/
private Semaphore mCameraOpenCloseLock = new Semaphore(1);
/**
* Whether the current camera device supports Flash or not.
*/
private boolean mFlashSupported;
/**
* Orientation of the camera sensor
*/
private int mSensorOrientation;
/**
* A {@link CameraCaptureSession.CaptureCallback} that handles events related to JPEG capture.
*/
private CameraCaptureSession.CaptureCallback mCaptureCallback
= new CameraCaptureSession.CaptureCallback() {
private void process(CaptureResult result) {
switch (mState) {
case STATE_PREVIEW: {
// We have nothing to do when the camera preview is working normally.
break;
}
case STATE_WAITING_LOCK: {
Integer afState = result.get(CaptureResult.CONTROL_AF_STATE);
if (afState == null) {
captureStillPicture();
} else if (CaptureResult.CONTROL_AF_STATE_FOCUSED_LOCKED == afState ||
CaptureResult.CONTROL_AF_STATE_NOT_FOCUSED_LOCKED == afState) {
// CONTROL_AE_STATE can be null on some devices
Integer aeState = result.get(CaptureResult.CONTROL_AE_STATE);
if (aeState == null ||
aeState == CaptureResult.CONTROL_AE_STATE_CONVERGED) {
mState = STATE_PICTURE_TAKEN;
captureStillPicture();
} else {
runPrecaptureSequence();
}
}
break;
}
case STATE_WAITING_PRECAPTURE: {
// CONTROL_AE_STATE can be null on some devices
Integer aeState = result.get(CaptureResult.CONTROL_AE_STATE);
if (aeState == null ||
aeState == CaptureResult.CONTROL_AE_STATE_PRECAPTURE ||
aeState == CaptureRequest.CONTROL_AE_STATE_FLASH_REQUIRED) {
mState = STATE_WAITING_NON_PRECAPTURE;
}
break;
}
case STATE_WAITING_NON_PRECAPTURE: {
// CONTROL_AE_STATE can be null on some devices
Integer aeState = result.get(CaptureResult.CONTROL_AE_STATE);
if (aeState == null || aeState != CaptureResult.CONTROL_AE_STATE_PRECAPTURE) {
mState = STATE_PICTURE_TAKEN;
captureStillPicture();
}
break;
}
}
}
@Override
public void onCaptureProgressed(@NonNull CameraCaptureSession session,
@NonNull CaptureRequest request,
@NonNull CaptureResult partialResult) {
process(partialResult);
}
@Override
public void onCaptureCompleted(@NonNull CameraCaptureSession session,
@NonNull CaptureRequest request,
@NonNull TotalCaptureResult result) {
process(result);
}
};
/**
* Shows a {@link Toast} on the UI thread.
*
* @param text The message to show
*/
private void showToast(final String text) {
final Activity activity = getActivity();
if (activity != null) {
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
Toast.makeText(activity, text, Toast.LENGTH_SHORT).show();
}
});
}
}
/**
* Given {@code choices} of {@code Size}s supported by a camera, choose the smallest one that
* is at least as large as the respective texture view size, and that is at most as large as the
* respective max size, and whose aspect ratio matches with the specified value. If such size
* doesn't exist, choose the largest one that is at most as large as the respective max size,
* and whose aspect ratio matches with the specified value.
*
* @param choices The list of sizes that the camera supports for the intended output
* class
* @param textureViewWidth The width of the texture view relative to sensor coordinate
* @param textureViewHeight The height of the texture view relative to sensor coordinate
* @param maxWidth The maximum width that can be chosen
* @param maxHeight The maximum height that can be chosen
* @param aspectRatio The aspect ratio
* @return The optimal {@code Size}, or an arbitrary one if none were big enough
*/
private static Size chooseOptimalSize(Size[] choices, int textureViewWidth,
int textureViewHeight, int maxWidth, int maxHeight, Size aspectRatio) {
// Collect the supported resolutions that are at least as big as the preview Surface
List<Size> bigEnough = new ArrayList<>();
// Collect the supported resolutions that are smaller than the preview Surface
List<Size> notBigEnough = new ArrayList<>();
int w = aspectRatio.getWidth();
int h = aspectRatio.getHeight();
for (Size option : choices) {
if (option.getWidth() <= maxWidth && option.getHeight() <= maxHeight &&
option.getHeight() == option.getWidth() * h / w) {
if (option.getWidth() >= textureViewWidth &&
option.getHeight() >= textureViewHeight) {
bigEnough.add(option);
} else {
notBigEnough.add(option);
}
}
}
// Pick the smallest of those big enough. If there is no one big enough, pick the
// largest of those not big enough.
if (bigEnough.size() > 0) {
return Collections.min(bigEnough, new CompareSizesByArea());
} else if (notBigEnough.size() > 0) {
return Collections.max(notBigEnough, new CompareSizesByArea());
} else {
Log.e(TAG, "Couldn't find any suitable preview size");
return choices[0];
}
}
public static Camera2BasicFragment newInstance() {
return new Camera2BasicFragment();
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_camera2_basic, container, false);
}
@Override
public void onViewCreated(final View view, Bundle savedInstanceState) {
view.findViewById(R.id.picture).setOnClickListener(this);
view.findViewById(R.id.info).setOnClickListener(this);
mTextureView = (AutoFitTextureView) view.findViewById(R.id.texture);
}
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
mFile = new File(getActivity().getExternalFilesDir(null), "pic.jpg");
}
@Override
public void onResume() {
super.onResume();
startBackgroundThread();
// When the screen is turned off and turned back on, the SurfaceTexture is already
// available, and "onSurfaceTextureAvailable" will not be called. In that case, we can open
// a camera and start preview from here (otherwise, we wait until the surface is ready in
// the SurfaceTextureListener).
if (mTextureView.isAvailable()) {
openCamera(mTextureView.getWidth(), mTextureView.getHeight());
} else {
mTextureView.setSurfaceTextureListener(mSurfaceTextureListener);
}
}
@Override
public void onPause() {
closeCamera();
stopBackgroundThread();
super.onPause();
}
private void requestCameraPermission() {
if (shouldShowRequestPermissionRationale(Manifest.permission.CAMERA)) {
new ConfirmationDialog().show(getChildFragmentManager(), FRAGMENT_DIALOG);
} else {
requestPermissions(new String[]{Manifest.permission.CAMERA}, REQUEST_CAMERA_PERMISSION);
}
}
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions,
@NonNull int[] grantResults) {
if (requestCode == REQUEST_CAMERA_PERMISSION) {
if (grantResults.length != 1 || grantResults[0] != PackageManager.PERMISSION_GRANTED) {
ErrorDialog.newInstance(getString(R.string.request_permission))
.show(getChildFragmentManager(), FRAGMENT_DIALOG);
}
} else {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
}
}
/**
* Sets up member variables related to camera.
*
* @param width The width of available size for camera preview
* @param height The height of available size for camera preview
*/
@SuppressWarnings("SuspiciousNameCombination")
private void setUpCameraOutputs(int width, int height) {
Activity activity = getActivity();
CameraManager manager = (CameraManager) activity.getSystemService(Context.CAMERA_SERVICE);
try {
for (String cameraId : manager.getCameraIdList()) {
CameraCharacteristics characteristics
= manager.getCameraCharacteristics(cameraId);
// We don't use a front facing camera in this sample.
Integer facing = characteristics.get(CameraCharacteristics.LENS_FACING);
if ( facing == CameraCharacteristics.LENS_FACING_BACK) {
continue;
}
StreamConfigurationMap map = characteristics.get(
CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP);
// For still image captures, we use the largest available size.
Size largest = Collections.max(
Arrays.asList(map.getOutputSizes(ImageFormat.JPEG)),
new CompareSizesByArea());
mImageReader = ImageReader.newInstance(largest.getWidth(), largest.getHeight(),
ImageFormat.JPEG, /*maxImages*/2);
mImageReader.setOnImageAvailableListener(
mOnImageAvailableListener, mBackgroundHandler);
// Find out if we need to swap dimension to get the preview size relative to sensor
// coordinate.
int displayRotation = activity.getWindowManager().getDefaultDisplay().getRotation();
//noinspection ConstantConditions
mSensorOrientation = characteristics.get(CameraCharacteristics.SENSOR_ORIENTATION);
boolean swappedDimensions = false;
switch (displayRotation) {
case Surface.ROTATION_0:
case Surface.ROTATION_180:
if (mSensorOrientation == 90 || mSensorOrientation == 270) {
swappedDimensions = true;
}
break;
case Surface.ROTATION_90:
case Surface.ROTATION_270:
if (mSensorOrientation == 0 || mSensorOrientation == 180) {
swappedDimensions = true;
}
break;
default:
Log.e(TAG, "Display rotation is invalid: " + displayRotation);
}
Point displaySize = new Point();
activity.getWindowManager().getDefaultDisplay().getSize(displaySize);
int rotatedPreviewWidth = width;
int rotatedPreviewHeight = height;
int maxPreviewWidth = displaySize.x;
int maxPreviewHeight = displaySize.y;
if (swappedDimensions) {
rotatedPreviewWidth = height;
rotatedPreviewHeight = width;
maxPreviewWidth = displaySize.y;
maxPreviewHeight = displaySize.x;
}
if (maxPreviewWidth > MAX_PREVIEW_WIDTH) {
maxPreviewWidth = MAX_PREVIEW_WIDTH;
}
if (maxPreviewHeight > MAX_PREVIEW_HEIGHT) {
maxPreviewHeight = MAX_PREVIEW_HEIGHT;
}
// Danger, W.R.! Attempting to use too large a preview size could exceed the camera
// bus' bandwidth limitation, resulting in gorgeous previews but the storage of
// garbage capture data.
mPreviewSize = chooseOptimalSize(map.getOutputSizes(SurfaceTexture.class),
rotatedPreviewWidth, rotatedPreviewHeight, maxPreviewWidth,
maxPreviewHeight, largest);
// We fit the aspect ratio of TextureView to the size of preview we picked.
int orientation = getResources().getConfiguration().orientation;
if (orientation == Configuration.ORIENTATION_LANDSCAPE) {
mTextureView.setAspectRatio(
mPreviewSize.getWidth(), mPreviewSize.getHeight());
} else {
mTextureView.setAspectRatio(
mPreviewSize.getHeight(), mPreviewSize.getWidth());
}
// Check if the flash is supported.
Boolean available = characteristics.get(CameraCharacteristics.FLASH_INFO_AVAILABLE);
mFlashSupported = available == null ? false : available;
mCameraId = cameraId;
return;
}
} catch (CameraAccessException e) {
e.printStackTrace();
} catch (NullPointerException e) {
// Currently an NPE is thrown when the Camera2API is used but not supported on the
// device this code runs.
ErrorDialog.newInstance(getString(R.string.camera_error))
.show(getChildFragmentManager(), FRAGMENT_DIALOG);
}
}
/**
* Opens the camera specified by {@link Camera2BasicFragment#mCameraId}.
*/
private void openCamera(int width, int height) {
if (ContextCompat.checkSelfPermission(getActivity(), Manifest.permission.CAMERA)
!= PackageManager.PERMISSION_GRANTED) {
requestCameraPermission();
return;
}
setUpCameraOutputs(width, height);
configureTransform(width, height);
Activity activity = getActivity();
CameraManager manager = (CameraManager) activity.getSystemService(Context.CAMERA_SERVICE);
try {
if (!mCameraOpenCloseLock.tryAcquire(2500, TimeUnit.MILLISECONDS)) {
throw new RuntimeException("Time out waiting to lock camera opening.");
}
manager.openCamera(mCameraId, mStateCallback, mBackgroundHandler);
} catch (CameraAccessException e) {
e.printStackTrace();
} catch (InterruptedException e) {
throw new RuntimeException("Interrupted while trying to lock camera opening.", e);
}
}
/**
* Closes the current {@link CameraDevice}.
*/
private void closeCamera() {
try {
mCameraOpenCloseLock.acquire();
if (null != mCaptureSession) {
mCaptureSession.close();
mCaptureSession = null;
}
if (null != mCameraDevice) {
mCameraDevice.close();
mCameraDevice = null;
}
if (null != mImageReader) {
mImageReader.close();
mImageReader = null;
}
} catch (InterruptedException e) {
throw new RuntimeException("Interrupted while trying to lock camera closing.", e);
} finally {
mCameraOpenCloseLock.release();
}
}
/**
* Starts a background thread and its {@link Handler}.
*/
private void startBackgroundThread() {
mBackgroundThread = new HandlerThread("CameraBackground");
mBackgroundThread.start();
mBackgroundHandler = new Handler(mBackgroundThread.getLooper());
}
/**
* Stops the background thread and its {@link Handler}.
*/
private void stopBackgroundThread() {
mBackgroundThread.quitSafely();
try {
mBackgroundThread.join();
mBackgroundThread = null;
mBackgroundHandler = null;
} catch (InterruptedException e) {
e.printStackTrace();
}
}
/**
* Creates a new {@link CameraCaptureSession} for camera preview.
*/
private void createCameraPreviewSession() {
try {
SurfaceTexture texture = mTextureView.getSurfaceTexture();
assert texture != null;
// We configure the size of default buffer to be the size of camera preview we want.
texture.setDefaultBufferSize(mPreviewSize.getWidth(), mPreviewSize.getHeight());
// This is the output Surface we need to start preview.
Surface surface = new Surface(texture);
// We set up a CaptureRequest.Builder with the output Surface.
mPreviewRequestBuilder
= mCameraDevice.createCaptureRequest(CameraDevice.TEMPLATE_PREVIEW);
mPreviewRequestBuilder.addTarget(surface);
// Here, we create a CameraCaptureSession for camera preview.
mCameraDevice.createCaptureSession(Arrays.asList(surface, mImageReader.getSurface()),
new CameraCaptureSession.StateCallback() {
@Override
public void onConfigured(@NonNull CameraCaptureSession cameraCaptureSession) {
// The camera is already closed
if (null == mCameraDevice) {
return;
}
// When the session is ready, we start displaying the preview.
mCaptureSession = cameraCaptureSession;
try {
// Auto focus should be continuous for camera preview.
mPreviewRequestBuilder.set(CaptureRequest.CONTROL_AF_MODE,
CaptureRequest.CONTROL_AF_MODE_CONTINUOUS_PICTURE);
// Flash is automatically enabled when necessary.
setAutoFlash(mPreviewRequestBuilder);
// Finally, we start displaying the camera preview.
mPreviewRequest = mPreviewRequestBuilder.build();
mCaptureSession.setRepeatingRequest(mPreviewRequest,
mCaptureCallback, mBackgroundHandler);
} catch (CameraAccessException e) {
e.printStackTrace();
}
}
@Override
public void onConfigureFailed(
@NonNull CameraCaptureSession cameraCaptureSession) {
showToast("Failed");
}
}, null
);
} catch (CameraAccessException e) {
e.printStackTrace();
}
}
/**
* Configures the necessary {@link android.graphics.Matrix} transformation to `mTextureView`.
* This method should be called after the camera preview size is determined in
* setUpCameraOutputs and also the size of `mTextureView` is fixed.
*
* @param viewWidth The width of `mTextureView`
* @param viewHeight The height of `mTextureView`
*/
private void configureTransform(int viewWidth, int viewHeight) {
Activity activity = getActivity();
if (null == mTextureView || null == mPreviewSize || null == activity) {
return;
}
int rotation = activity.getWindowManager().getDefaultDisplay().getRotation();
Matrix matrix = new Matrix();
RectF viewRect = new RectF(0, 0, viewWidth, viewHeight);
RectF bufferRect = new RectF(0, 0, mPreviewSize.getHeight(), mPreviewSize.getWidth());
float centerX = viewRect.centerX();
float centerY = viewRect.centerY();
if (Surface.ROTATION_90 == rotation || Surface.ROTATION_270 == rotation) {
bufferRect.offset(centerX - bufferRect.centerX(), centerY - bufferRect.centerY());
matrix.setRectToRect(viewRect, bufferRect, Matrix.ScaleToFit.FILL);
float scale = Math.max(
(float) viewHeight / mPreviewSize.getHeight(),
(float) viewWidth / mPreviewSize.getWidth());
matrix.postScale(scale, scale, centerX, centerY);
matrix.postRotate(90 * (rotation - 2), centerX, centerY);
} else if (Surface.ROTATION_180 == rotation) {
matrix.postRotate(180, centerX, centerY);
}
mTextureView.setTransform(matrix);
}
/**
* Initiate a still image capture.
*/
private void takePicture() {
lockFocus();
}
/**
* Lock the focus as the first step for a still image capture.
*/
private void lockFocus() {
try {
// This is how to tell the camera to lock focus.
mPreviewRequestBuilder.set(CaptureRequest.CONTROL_AF_TRIGGER,
CameraMetadata.CONTROL_AF_TRIGGER_START);
// Tell #mCaptureCallback to wait for the lock.
mState = STATE_WAITING_LOCK;
mCaptureSession.capture(mPreviewRequestBuilder.build(), mCaptureCallback,
mBackgroundHandler);
} catch (CameraAccessException e) {
e.printStackTrace();
}
}
/**
* Run the precapture sequence for capturing a still image. This method should be called when
* we get a response in {@link #mCaptureCallback} from {@link #lockFocus()}.
*/
private void runPrecaptureSequence() {
try {
// This is how to tell the camera to trigger.
mPreviewRequestBuilder.set(CaptureRequest.CONTROL_AE_PRECAPTURE_TRIGGER,
CaptureRequest.CONTROL_AE_PRECAPTURE_TRIGGER_START);
// Tell #mCaptureCallback to wait for the precapture sequence to be set.
mState = STATE_WAITING_PRECAPTURE;
mCaptureSession.capture(mPreviewRequestBuilder.build(), mCaptureCallback,
mBackgroundHandler);
} catch (CameraAccessException e) {
e.printStackTrace();
}
}
/**
* Capture a still picture. This method should be called when we get a response in
* {@link #mCaptureCallback} from both {@link #lockFocus()}.
*/
private void captureStillPicture() {
try {
final Activity activity = getActivity();
if (null == activity || null == mCameraDevice) {
return;
}
// This is the CaptureRequest.Builder that we use to take a picture.
final CaptureRequest.Builder captureBuilder =
mCameraDevice.createCaptureRequest(CameraDevice.TEMPLATE_STILL_CAPTURE);
captureBuilder.addTarget(mImageReader.getSurface());
// Use the same AE and AF modes as the preview.
captureBuilder.set(CaptureRequest.CONTROL_AF_MODE,
CaptureRequest.CONTROL_AF_MODE_CONTINUOUS_PICTURE);
setAutoFlash(captureBuilder);
// Orientation
int rotation = activity.getWindowManager().getDefaultDisplay().getRotation();
captureBuilder.set(CaptureRequest.JPEG_ORIENTATION, getOrientation(rotation));
CameraCaptureSession.CaptureCallback CaptureCallback
= new CameraCaptureSession.CaptureCallback() {
@Override
public void onCaptureCompleted(@NonNull CameraCaptureSession session,
@NonNull CaptureRequest request,
@NonNull TotalCaptureResult result) {
showToast("Saved: " + mFile);
Log.d(TAG, mFile.toString());
unlockFocus();
}
};
mCaptureSession.stopRepeating();
mCaptureSession.abortCaptures();
mCaptureSession.capture(captureBuilder.build(), CaptureCallback, null);
} catch (CameraAccessException e) {
e.printStackTrace();
}
}
/**
* Retrieves the JPEG orientation from the specified screen rotation.
*
* @param rotation The screen rotation.
* @return The JPEG orientation (one of 0, 90, 270, and 360)
*/
private int getOrientation(int rotation) {
// Sensor orientation is 90 for most devices, or 270 for some devices (eg. Nexus 5X)
// We have to take that into account and rotate JPEG properly.
// For devices with orientation of 90, we simply return our mapping from ORIENTATIONS.
// For devices with orientation of 270, we need to rotate the JPEG 180 degrees.
return (ORIENTATIONS.get(rotation) + mSensorOrientation + 270) % 360;
}
/**
* Unlock the focus. This method should be called when still image capture sequence is
* finished.
*/
private void unlockFocus() {
try {
// Reset the auto-focus trigger
mPreviewRequestBuilder.set(CaptureRequest.CONTROL_AF_TRIGGER,
CameraMetadata.CONTROL_AF_TRIGGER_CANCEL);
setAutoFlash(mPreviewRequestBuilder);
mCaptureSession.capture(mPreviewRequestBuilder.build(), mCaptureCallback,
mBackgroundHandler);
// After this, the camera will go back to the normal state of preview.
mState = STATE_PREVIEW;
mCaptureSession.setRepeatingRequest(mPreviewRequest, mCaptureCallback,
mBackgroundHandler);
} catch (CameraAccessException e) {
e.printStackTrace();
}
}
@Override
public void onClick(View view) {
switch (view.getId()) {
case R.id.picture: {
takePicture();
break;
}
case R.id.info: {
Activity activity = getActivity();
if (null != activity) {
new AlertDialog.Builder(activity)
.setMessage(R.string.intro_message)
.setPositiveButton(android.R.string.ok, null)
.show();
}
break;
}
}
}
private void setAutoFlash(CaptureRequest.Builder requestBuilder) {
if (mFlashSupported) {
requestBuilder.set(CaptureRequest.CONTROL_AE_MODE,
CaptureRequest.CONTROL_AE_MODE_ON_AUTO_FLASH);
}
}
/**
* Saves a JPEG {@link Image} into the specified {@link File}.
*/
private static class ImageSaver implements Runnable {
/**
* The JPEG image
*/
private final Image mImage;
/**
* The file we save the image into.
*/
private final File mFile;
ImageSaver(Image image, File file) {
mImage = image;
mFile = file;
}
@Override
public void run() {
ByteBuffer buffer = mImage.getPlanes()[0].getBuffer();
byte[] bytes = new byte[buffer.remaining()];
buffer.get(bytes);
FileOutputStream output = null;
try {
output = new FileOutputStream(mFile);
output.write(bytes);
} catch (IOException e) {
e.printStackTrace();
} finally {
mImage.close();
if (null != output) {
try {
output.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
}
/**
* Compares two {@code Size}s based on their areas.
*/
static class CompareSizesByArea implements Comparator<Size> {
@Override
public int compare(Size lhs, Size rhs) {
// We cast here to ensure the multiplications won't overflow
return Long.signum((long) lhs.getWidth() * lhs.getHeight() -
(long) rhs.getWidth() * rhs.getHeight());
}
}
/**
* Shows an error message dialog.
*/
public static class ErrorDialog extends DialogFragment {
private static final String ARG_MESSAGE = "message";
public static ErrorDialog newInstance(String message) {
ErrorDialog dialog = new ErrorDialog();
Bundle args = new Bundle();
args.putString(ARG_MESSAGE, message);
dialog.setArguments(args);
return dialog;
}
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
final Activity activity = getActivity();
return new AlertDialog.Builder(activity)
.setMessage(getArguments().getString(ARG_MESSAGE))
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
activity.finish();
}
})
.create();
}
}
/**
* Shows OK/Cancel confirmation dialog about camera permission.
*/
public static class ConfirmationDialog extends DialogFragment {
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
final Fragment parent = getParentFragment();
return new AlertDialog.Builder(getActivity())
.setMessage(R.string.request_permission)
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
parent.requestPermissions(new String[]{Manifest.permission.CAMERA},
REQUEST_CAMERA_PERMISSION);
}
})
.setNegativeButton(android.R.string.cancel,
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Activity activity = parent.getActivity();
if (activity != null) {
activity.finish();
}
}
})
.create();
}
}
}
| [
"samkecy1@gmail.com"
] | samkecy1@gmail.com |
ec54e355eb88648f36ad5f2464f7e5a1e667c3f2 | ff10d27e8a5c530250d5e4639124b19301ea2f31 | /WebShoping_jsp/ShopOnline/src/connect/DBConnect.java | a140c1e5caf0f16b3233bd40d85c19ed1d7fafba | [] | no_license | eminel9311/git | 02ff7a21c92225a6a40960694eca43b3dae0a6b5 | d69579e0bf0b3d9e531b3996f3f7b52387597ab8 | refs/heads/master | 2023-05-25T03:30:31.405747 | 2017-10-06T07:08:36 | 2017-10-06T07:08:36 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 504 | java | package connect;
import java.sql.Connection;
import java.sql.DriverManager;
public class DBConnect {
public static Connection getConnection(){
Connection conn = null;
try {
Class.forName("com.mysql.jdbc.Driver");
conn = DriverManager.getConnection("jdbc:mysql://127.0.0.1:3306/shop","root","1234");
} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
}
return conn;
}
/* public static void main(String[] args) {
System.out.println(getConnection());
}*/
}
| [
"quanbh1911@gmail.com"
] | quanbh1911@gmail.com |
0218fc01762829e7d92ac7b40d340f021e0f6060 | 39e32f672b6ef972ebf36adcb6a0ca899f49a094 | /dcm4chee-dashboard/tags/DCM4CHEE_WEB_3_0_1/dcm4chee-dashboard-ui/src/main/java/org/dcm4chee/dashboard/ui/DashboardPanel.java | b369cb69e6ba5241240d373a6ec66c38923cc271 | [
"Apache-2.0"
] | permissive | medicayun/medicayundicom | 6a5812254e1baf88ad3786d1b4cf544821d4ca0b | 47827007f2b3e424a1c47863bcf7d4781e15e814 | refs/heads/master | 2021-01-23T11:20:41.530293 | 2017-06-05T03:11:47 | 2017-06-05T03:11:47 | 93,123,541 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 2,700 | java | /* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (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.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is part of dcm4che, an implementation of DICOM(TM) in
* Java(TM), hosted at http://sourceforge.net/projects/dcm4che.
*
* The Initial Developer of the Original Code is
* Agfa-Gevaert AG.
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* See listed authors below.
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
package org.dcm4chee.dashboard.ui;
import org.dcm4chee.dashboard.ui.filesystem.FileSystemPanel;
import org.dcm4chee.dashboard.ui.messaging.QueuePanel;
import org.dcm4chee.dashboard.ui.report.ReportPanel;
import org.dcm4chee.dashboard.ui.systeminfo.SystemInfoPanel;
import org.dcm4chee.web.common.secure.SecureAjaxTabbedPanel;
/**
* @author Robert David <robert.david@agfa.com>
* @version $Revision$ $Date$
* @since 07.04.2010
*/
public class DashboardPanel extends SecureAjaxTabbedPanel {
private static final long serialVersionUID = 1L;
public DashboardPanel(String id) {
super(id);
addModule(FileSystemPanel.class, null);
addModule(ReportPanel.class, null);
addModule(SystemInfoPanel.class, null);
addModule(QueuePanel.class, null);
}
public static String getModuleName() {
return "dashboard";
}
}
| [
"liliang_lz@icloud.com"
] | liliang_lz@icloud.com |
4bb16b4151e79315fc8d4983b9381f137ec39214 | 558667608651dfd5778e3cc1131e9eaf5f1be8d7 | /smali/com/umeng/analytics/d.java | 5a87ac6d7184476e441190fb23c6445b2083152c | [] | no_license | gambol/chunqingaikan | 0cd6b0d3ca855f2d1a5ad22f7be3c46f8b1e6984 | 25fa70619ab484e61124465a0b4bdec1cdb5bf62 | refs/heads/master | 2021-01-10T11:13:41.624112 | 2015-03-04T14:08:40 | 2015-03-04T14:08:40 | 36,016,628 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 39,630 | java | package com.umeng.analytics; class d { void a() { int a;
a=0;// .class public Lcom/umeng/analytics/d;
a=0;// .super Ljava/lang/Object;
a=0;// .source "InternalAgent.java"
a=0;//
a=0;// # interfaces
a=0;// .implements Lu/aly/t;
a=0;//
a=0;//
a=0;// # instance fields
a=0;// .field private final a:Lcom/umeng/analytics/onlineconfig/a;
a=0;//
a=0;// .field private b:Landroid/content/Context;
a=0;//
a=0;// .field private c:Lcom/umeng/analytics/c;
a=0;//
a=0;// .field private d:Lu/aly/m;
a=0;//
a=0;// .field private e:Lu/aly/z;
a=0;//
a=0;// .field private f:Lu/aly/v;
a=0;//
a=0;// .field private g:Lu/aly/n;
a=0;//
a=0;// .field private h:Lu/aly/k;
a=0;//
a=0;// .field private i:Z
a=0;//
a=0;//
a=0;// # direct methods
a=0;// .method constructor <init>()V
a=0;// .locals 1
a=0;//
a=0;// .prologue
a=0;// .line 38
a=0;// invoke-direct {p0}, Ljava/lang/Object;-><init>()V
a=0;//
a=0;// .line 26
a=0;// #p0=(Reference,Lcom/umeng/analytics/d;);
a=0;// new-instance v0, Lcom/umeng/analytics/onlineconfig/a;
a=0;//
a=0;// #v0=(UninitRef,Lcom/umeng/analytics/onlineconfig/a;);
a=0;// invoke-direct {v0}, Lcom/umeng/analytics/onlineconfig/a;-><init>()V
a=0;//
a=0;// #v0=(Reference,Lcom/umeng/analytics/onlineconfig/a;);
a=0;// iput-object v0, p0, Lcom/umeng/analytics/d;->a:Lcom/umeng/analytics/onlineconfig/a;
a=0;//
a=0;// .line 27
a=0;// const/4 v0, 0x0
a=0;//
a=0;// #v0=(Null);
a=0;// iput-object v0, p0, Lcom/umeng/analytics/d;->b:Landroid/content/Context;
a=0;//
a=0;// .line 30
a=0;// new-instance v0, Lu/aly/m;
a=0;//
a=0;// #v0=(UninitRef,Lu/aly/m;);
a=0;// invoke-direct {v0}, Lu/aly/m;-><init>()V
a=0;//
a=0;// #v0=(Reference,Lu/aly/m;);
a=0;// iput-object v0, p0, Lcom/umeng/analytics/d;->d:Lu/aly/m;
a=0;//
a=0;// .line 31
a=0;// new-instance v0, Lu/aly/z;
a=0;//
a=0;// #v0=(UninitRef,Lu/aly/z;);
a=0;// invoke-direct {v0}, Lu/aly/z;-><init>()V
a=0;//
a=0;// #v0=(Reference,Lu/aly/z;);
a=0;// iput-object v0, p0, Lcom/umeng/analytics/d;->e:Lu/aly/z;
a=0;//
a=0;// .line 32
a=0;// new-instance v0, Lu/aly/v;
a=0;//
a=0;// #v0=(UninitRef,Lu/aly/v;);
a=0;// invoke-direct {v0}, Lu/aly/v;-><init>()V
a=0;//
a=0;// #v0=(Reference,Lu/aly/v;);
a=0;// iput-object v0, p0, Lcom/umeng/analytics/d;->f:Lu/aly/v;
a=0;//
a=0;// .line 36
a=0;// const/4 v0, 0x0
a=0;//
a=0;// #v0=(Null);
a=0;// iput-boolean v0, p0, Lcom/umeng/analytics/d;->i:Z
a=0;//
a=0;// .line 39
a=0;// iget-object v0, p0, Lcom/umeng/analytics/d;->d:Lu/aly/m;
a=0;//
a=0;// #v0=(Reference,Lu/aly/m;);
a=0;// invoke-virtual {v0, p0}, Lu/aly/m;->a(Lu/aly/t;)V
a=0;//
a=0;// .line 40
a=0;// return-void
a=0;// .end method
a=0;//
a=0;// .method static synthetic a(Lcom/umeng/analytics/d;)Lu/aly/n;
a=0;// .locals 1
a=0;//
a=0;// .prologue
a=0;// .line 33
a=0;// iget-object v0, p0, Lcom/umeng/analytics/d;->g:Lu/aly/n;
a=0;//
a=0;// #v0=(Reference,Lu/aly/n;);
a=0;// return-object v0
a=0;// .end method
a=0;//
a=0;// .method static synthetic a(Lcom/umeng/analytics/d;Landroid/content/Context;)V
a=0;// .locals 0
a=0;//
a=0;// .prologue
a=0;// .line 190
a=0;// invoke-direct {p0, p1}, Lcom/umeng/analytics/d;->g(Landroid/content/Context;)V
a=0;//
a=0;// return-void
a=0;// .end method
a=0;//
a=0;// .method static synthetic b(Lcom/umeng/analytics/d;Landroid/content/Context;)V
a=0;// .locals 0
a=0;//
a=0;// .prologue
a=0;// .line 196
a=0;// invoke-direct {p0, p1}, Lcom/umeng/analytics/d;->h(Landroid/content/Context;)V
a=0;//
a=0;// return-void
a=0;// .end method
a=0;//
a=0;// .method private f(Landroid/content/Context;)V
a=0;// .locals 2
a=0;//
a=0;// .prologue
a=0;// .line 43
a=0;// iget-boolean v0, p0, Lcom/umeng/analytics/d;->i:Z
a=0;//
a=0;// #v0=(Boolean);
a=0;// if-nez v0, :cond_0
a=0;//
a=0;// .line 44
a=0;// invoke-virtual {p1}, Landroid/content/Context;->getApplicationContext()Landroid/content/Context;
a=0;//
a=0;// move-result-object v0
a=0;//
a=0;// #v0=(Reference,Landroid/content/Context;);
a=0;// iput-object v0, p0, Lcom/umeng/analytics/d;->b:Landroid/content/Context;
a=0;//
a=0;// .line 45
a=0;// new-instance v0, Lu/aly/n;
a=0;//
a=0;// #v0=(UninitRef,Lu/aly/n;);
a=0;// iget-object v1, p0, Lcom/umeng/analytics/d;->b:Landroid/content/Context;
a=0;//
a=0;// #v1=(Reference,Landroid/content/Context;);
a=0;// invoke-direct {v0, v1}, Lu/aly/n;-><init>(Landroid/content/Context;)V
a=0;//
a=0;// #v0=(Reference,Lu/aly/n;);
a=0;// iput-object v0, p0, Lcom/umeng/analytics/d;->g:Lu/aly/n;
a=0;//
a=0;// .line 46
a=0;// iget-object v0, p0, Lcom/umeng/analytics/d;->b:Landroid/content/Context;
a=0;//
a=0;// invoke-static {v0}, Lu/aly/k;->a(Landroid/content/Context;)Lu/aly/k;
a=0;//
a=0;// move-result-object v0
a=0;//
a=0;// iput-object v0, p0, Lcom/umeng/analytics/d;->h:Lu/aly/k;
a=0;//
a=0;// .line 48
a=0;// const/4 v0, 0x1
a=0;//
a=0;// #v0=(One);
a=0;// iput-boolean v0, p0, Lcom/umeng/analytics/d;->i:Z
a=0;//
a=0;// .line 50
a=0;// :cond_0
a=0;// #v0=(Boolean);v1=(Conflicted);
a=0;// return-void
a=0;// .end method
a=0;//
a=0;// .method private g(Landroid/content/Context;)V
a=0;// .locals 1
a=0;//
a=0;// .prologue
a=0;// .line 191
a=0;// iget-object v0, p0, Lcom/umeng/analytics/d;->f:Lu/aly/v;
a=0;//
a=0;// #v0=(Reference,Lu/aly/v;);
a=0;// invoke-virtual {v0, p1}, Lu/aly/v;->c(Landroid/content/Context;)V
a=0;//
a=0;// .line 193
a=0;// iget-object v0, p0, Lcom/umeng/analytics/d;->c:Lcom/umeng/analytics/c;
a=0;//
a=0;// if-eqz v0, :cond_0
a=0;//
a=0;// iget-object v0, p0, Lcom/umeng/analytics/d;->c:Lcom/umeng/analytics/c;
a=0;//
a=0;// invoke-interface {v0}, Lcom/umeng/analytics/c;->a()V
a=0;//
a=0;// .line 194
a=0;// :cond_0
a=0;// return-void
a=0;// .end method
a=0;//
a=0;// .method private h(Landroid/content/Context;)V
a=0;// .locals 1
a=0;//
a=0;// .prologue
a=0;// .line 197
a=0;// iget-object v0, p0, Lcom/umeng/analytics/d;->f:Lu/aly/v;
a=0;//
a=0;// #v0=(Reference,Lu/aly/v;);
a=0;// invoke-virtual {v0, p1}, Lu/aly/v;->d(Landroid/content/Context;)V
a=0;//
a=0;// .line 198
a=0;// iget-object v0, p0, Lcom/umeng/analytics/d;->e:Lu/aly/z;
a=0;//
a=0;// invoke-virtual {v0, p1}, Lu/aly/z;->a(Landroid/content/Context;)V
a=0;//
a=0;// .line 200
a=0;// iget-object v0, p0, Lcom/umeng/analytics/d;->c:Lcom/umeng/analytics/c;
a=0;//
a=0;// if-eqz v0, :cond_0
a=0;//
a=0;// iget-object v0, p0, Lcom/umeng/analytics/d;->c:Lcom/umeng/analytics/c;
a=0;//
a=0;// invoke-interface {v0}, Lcom/umeng/analytics/c;->b()V
a=0;//
a=0;// .line 201
a=0;// :cond_0
a=0;// iget-object v0, p0, Lcom/umeng/analytics/d;->h:Lu/aly/k;
a=0;//
a=0;// invoke-virtual {v0}, Lu/aly/k;->b()V
a=0;//
a=0;// .line 202
a=0;// return-void
a=0;// .end method
a=0;//
a=0;//
a=0;// # virtual methods
a=0;// .method public a(I)V
a=0;// .locals 0
a=0;//
a=0;// .prologue
a=0;// .line 77
a=0;// sput p1, Lcom/umeng/analytics/AnalyticsConfig;->mVerticalType:I
a=0;//
a=0;// .line 78
a=0;// return-void
a=0;// .end method
a=0;//
a=0;// .method a(Landroid/content/Context;)V
a=0;// .locals 2
a=0;//
a=0;// .prologue
a=0;// .line 86
a=0;// if-nez p1, :cond_0
a=0;//
a=0;// .line 87
a=0;// const-string v0, "MobclickAgent"
a=0;//
a=0;// #v0=(Reference,Ljava/lang/String;);
a=0;// const-string v1, "unexpected null context in onResume"
a=0;//
a=0;// #v1=(Reference,Ljava/lang/String;);
a=0;// invoke-static {v0, v1}, Lu/aly/bj;->b(Ljava/lang/String;Ljava/lang/String;)V
a=0;//
a=0;// .line 95
a=0;// :goto_0
a=0;// #v1=(Conflicted);
a=0;// return-void
a=0;//
a=0;// .line 90
a=0;// :cond_0
a=0;// #v0=(Uninit);v1=(Uninit);
a=0;// iget-object v0, p0, Lcom/umeng/analytics/d;->a:Lcom/umeng/analytics/onlineconfig/a;
a=0;//
a=0;// #v0=(Reference,Lcom/umeng/analytics/onlineconfig/a;);
a=0;// invoke-virtual {v0, p1}, Lcom/umeng/analytics/onlineconfig/a;->a(Landroid/content/Context;)V
a=0;//
a=0;// .line 93
a=0;// :try_start_0
a=0;// invoke-static {p1}, Lu/aly/k;->a(Landroid/content/Context;)Lu/aly/k;
a=0;//
a=0;// move-result-object v0
a=0;//
a=0;// iget-object v1, p0, Lcom/umeng/analytics/d;->a:Lcom/umeng/analytics/onlineconfig/a;
a=0;//
a=0;// #v1=(Reference,Lcom/umeng/analytics/onlineconfig/a;);
a=0;// invoke-virtual {v0, v1}, Lu/aly/k;->a(Lcom/umeng/analytics/onlineconfig/a;)V
a=0;// :try_end_0
a=0;// .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0
a=0;//
a=0;// goto :goto_0
a=0;//
a=0;// .line 94
a=0;// :catch_0
a=0;// #v1=(Conflicted);
a=0;// move-exception v0
a=0;//
a=0;// goto :goto_0
a=0;// .end method
a=0;//
a=0;// .method a(Landroid/content/Context;Ljava/lang/String;)V
a=0;// .locals 3
a=0;//
a=0;// .prologue
a=0;// .line 159
a=0;// invoke-static {p2}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z
a=0;//
a=0;// move-result v0
a=0;//
a=0;// #v0=(Boolean);
a=0;// if-eqz v0, :cond_0
a=0;//
a=0;// .line 175
a=0;// :goto_0
a=0;// #v0=(Conflicted);v1=(Conflicted);v2=(Conflicted);
a=0;// return-void
a=0;//
a=0;// .line 163
a=0;// :cond_0
a=0;// #v0=(Boolean);v1=(Uninit);v2=(Uninit);
a=0;// if-nez p1, :cond_1
a=0;//
a=0;// .line 165
a=0;// const-string v0, "MobclickAgent"
a=0;//
a=0;// #v0=(Reference,Ljava/lang/String;);
a=0;// const-string v1, "unexpected null context in reportError"
a=0;//
a=0;// #v1=(Reference,Ljava/lang/String;);
a=0;// invoke-static {v0, v1}, Lu/aly/bj;->b(Ljava/lang/String;Ljava/lang/String;)V
a=0;//
a=0;// goto :goto_0
a=0;//
a=0;// .line 170
a=0;// :cond_1
a=0;// :try_start_0
a=0;// #v0=(Boolean);v1=(Uninit);
a=0;// iget-boolean v0, p0, Lcom/umeng/analytics/d;->i:Z
a=0;//
a=0;// if-nez v0, :cond_2
a=0;//
a=0;// invoke-direct {p0, p1}, Lcom/umeng/analytics/d;->f(Landroid/content/Context;)V
a=0;//
a=0;// .line 171
a=0;// :cond_2
a=0;// iget-object v0, p0, Lcom/umeng/analytics/d;->h:Lu/aly/k;
a=0;//
a=0;// #v0=(Reference,Lu/aly/k;);
a=0;// new-instance v1, Lu/aly/ac;
a=0;//
a=0;// #v1=(UninitRef,Lu/aly/ac;);
a=0;// invoke-direct {v1, p2}, Lu/aly/ac;-><init>(Ljava/lang/String;)V
a=0;//
a=0;// #v1=(Reference,Lu/aly/ac;);
a=0;// const/4 v2, 0x0
a=0;//
a=0;// #v2=(Null);
a=0;// invoke-virtual {v1, v2}, Lu/aly/ac;->a(Z)Lu/aly/ac;
a=0;//
a=0;// move-result-object v1
a=0;//
a=0;// invoke-virtual {v0, v1}, Lu/aly/k;->a(Lu/aly/p;)V
a=0;// :try_end_0
a=0;// .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0
a=0;//
a=0;// goto :goto_0
a=0;//
a=0;// .line 172
a=0;// :catch_0
a=0;// #v0=(Conflicted);v1=(Conflicted);v2=(Conflicted);
a=0;// move-exception v0
a=0;//
a=0;// .line 173
a=0;// #v0=(Reference,Ljava/lang/Exception;);
a=0;// const-string v1, "MobclickAgent"
a=0;//
a=0;// #v1=(Reference,Ljava/lang/String;);
a=0;// const-string v2, ""
a=0;//
a=0;// #v2=(Reference,Ljava/lang/String;);
a=0;// invoke-static {v1, v2, v0}, Lu/aly/bj;->b(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Exception;)V
a=0;//
a=0;// goto :goto_0
a=0;// .end method
a=0;//
a=0;// .method a(Landroid/content/Context;Ljava/lang/String;Ljava/lang/String;)V
a=0;// .locals 3
a=0;//
a=0;// .prologue
a=0;// .line 233
a=0;// :try_start_0
a=0;// iget-boolean v0, p0, Lcom/umeng/analytics/d;->i:Z
a=0;//
a=0;// #v0=(Boolean);
a=0;// if-nez v0, :cond_0
a=0;//
a=0;// invoke-direct {p0, p1}, Lcom/umeng/analytics/d;->f(Landroid/content/Context;)V
a=0;//
a=0;// .line 234
a=0;// :cond_0
a=0;// new-instance v0, Lcom/umeng/analytics/d$3;
a=0;//
a=0;// #v0=(UninitRef,Lcom/umeng/analytics/d$3;);
a=0;// invoke-direct {v0, p0, p2, p3}, Lcom/umeng/analytics/d$3;-><init>(Lcom/umeng/analytics/d;Ljava/lang/String;Ljava/lang/String;)V
a=0;//
a=0;// #v0=(Reference,Lcom/umeng/analytics/d$3;);
a=0;// invoke-static {v0}, Lcom/umeng/analytics/e;->a(Ljava/lang/Runnable;)V
a=0;// :try_end_0
a=0;// .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0
a=0;//
a=0;// .line 242
a=0;// :goto_0
a=0;// #v1=(Conflicted);v2=(Conflicted);
a=0;// return-void
a=0;//
a=0;// .line 239
a=0;// :catch_0
a=0;// move-exception v0
a=0;//
a=0;// .line 240
a=0;// #v0=(Reference,Ljava/lang/Exception;);
a=0;// const-string v1, "MobclickAgent"
a=0;//
a=0;// #v1=(Reference,Ljava/lang/String;);
a=0;// const-string v2, ""
a=0;//
a=0;// #v2=(Reference,Ljava/lang/String;);
a=0;// invoke-static {v1, v2, v0}, Lu/aly/bj;->b(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Exception;)V
a=0;//
a=0;// goto :goto_0
a=0;// .end method
a=0;//
a=0;// .method public a(Landroid/content/Context;Ljava/lang/String;Ljava/lang/String;JI)V
a=0;// .locals 6
a=0;//
a=0;// .prologue
a=0;// .line 215
a=0;// :try_start_0
a=0;// iget-boolean v0, p0, Lcom/umeng/analytics/d;->i:Z
a=0;//
a=0;// #v0=(Boolean);
a=0;// if-nez v0, :cond_0
a=0;//
a=0;// invoke-direct {p0, p1}, Lcom/umeng/analytics/d;->f(Landroid/content/Context;)V
a=0;//
a=0;// .line 216
a=0;// :cond_0
a=0;// iget-object v0, p0, Lcom/umeng/analytics/d;->g:Lu/aly/n;
a=0;//
a=0;// #v0=(Reference,Lu/aly/n;);
a=0;// move-object v1, p2
a=0;//
a=0;// #v1=(Reference,Ljava/lang/String;);
a=0;// move-object v2, p3
a=0;//
a=0;// #v2=(Reference,Ljava/lang/String;);
a=0;// move-wide v3, p4
a=0;//
a=0;// #v3=(LongLo);v4=(LongHi);
a=0;// move v5, p6
a=0;//
a=0;// #v5=(Integer);
a=0;// invoke-virtual/range {v0 .. v5}, Lu/aly/n;->a(Ljava/lang/String;Ljava/lang/String;JI)V
a=0;// :try_end_0
a=0;// .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0
a=0;//
a=0;// .line 220
a=0;// :goto_0
a=0;// #v3=(Conflicted);v4=(Conflicted);v5=(Conflicted);
a=0;// return-void
a=0;//
a=0;// .line 217
a=0;// :catch_0
a=0;// move-exception v0
a=0;//
a=0;// .line 218
a=0;// #v0=(Reference,Ljava/lang/Exception;);
a=0;// const-string v1, "MobclickAgent"
a=0;//
a=0;// #v1=(Reference,Ljava/lang/String;);
a=0;// const-string v2, ""
a=0;//
a=0;// #v2=(Reference,Ljava/lang/String;);
a=0;// invoke-static {v1, v2, v0}, Lu/aly/bj;->b(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Exception;)V
a=0;//
a=0;// goto :goto_0
a=0;// .end method
a=0;//
a=0;// .method public a(Landroid/content/Context;Ljava/lang/String;Ljava/util/HashMap;)V
a=0;// .locals 3
a=0;// .annotation system Ldalvik/annotation/Signature;
a=0;// value = {
a=0;// "(",
a=0;// "Landroid/content/Context;",
a=0;// "Ljava/lang/String;",
a=0;// "Ljava/util/HashMap",
a=0;// "<",
a=0;// "Ljava/lang/String;",
a=0;// "Ljava/lang/Object;",
a=0;// ">;)V"
a=0;// }
a=0;// .end annotation
a=0;//
a=0;// .prologue
a=0;// .line 151
a=0;// :try_start_0
a=0;// iget-boolean v0, p0, Lcom/umeng/analytics/d;->i:Z
a=0;//
a=0;// #v0=(Boolean);
a=0;// if-nez v0, :cond_0
a=0;//
a=0;// invoke-direct {p0, p1}, Lcom/umeng/analytics/d;->f(Landroid/content/Context;)V
a=0;//
a=0;// .line 152
a=0;// :cond_0
a=0;// iget-object v0, p0, Lcom/umeng/analytics/d;->g:Lu/aly/n;
a=0;//
a=0;// #v0=(Reference,Lu/aly/n;);
a=0;// invoke-virtual {v0, p2, p3}, Lu/aly/n;->a(Ljava/lang/String;Ljava/util/Map;)V
a=0;// :try_end_0
a=0;// .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0
a=0;//
a=0;// .line 156
a=0;// :goto_0
a=0;// #v1=(Conflicted);v2=(Conflicted);
a=0;// return-void
a=0;//
a=0;// .line 153
a=0;// :catch_0
a=0;// move-exception v0
a=0;//
a=0;// .line 154
a=0;// #v0=(Reference,Ljava/lang/Exception;);
a=0;// const-string v1, "MobclickAgent"
a=0;//
a=0;// #v1=(Reference,Ljava/lang/String;);
a=0;// const-string v2, ""
a=0;//
a=0;// #v2=(Reference,Ljava/lang/String;);
a=0;// invoke-static {v1, v2, v0}, Lu/aly/bj;->b(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Exception;)V
a=0;//
a=0;// goto :goto_0
a=0;// .end method
a=0;//
a=0;// .method a(Landroid/content/Context;Ljava/lang/String;Ljava/util/HashMap;Ljava/lang/String;)V
a=0;// .locals 3
a=0;// .annotation system Ldalvik/annotation/Signature;
a=0;// value = {
a=0;// "(",
a=0;// "Landroid/content/Context;",
a=0;// "Ljava/lang/String;",
a=0;// "Ljava/util/HashMap",
a=0;// "<",
a=0;// "Ljava/lang/String;",
a=0;// "Ljava/lang/Object;",
a=0;// ">;",
a=0;// "Ljava/lang/String;",
a=0;// ")V"
a=0;// }
a=0;// .end annotation
a=0;//
a=0;// .prologue
a=0;// .line 258
a=0;// :try_start_0
a=0;// iget-boolean v0, p0, Lcom/umeng/analytics/d;->i:Z
a=0;//
a=0;// #v0=(Boolean);
a=0;// if-nez v0, :cond_0
a=0;//
a=0;// invoke-direct {p0, p1}, Lcom/umeng/analytics/d;->f(Landroid/content/Context;)V
a=0;//
a=0;// .line 259
a=0;// :cond_0
a=0;// new-instance v0, Lcom/umeng/analytics/d$5;
a=0;//
a=0;// #v0=(UninitRef,Lcom/umeng/analytics/d$5;);
a=0;// invoke-direct {v0, p0, p2, p3, p4}, Lcom/umeng/analytics/d$5;-><init>(Lcom/umeng/analytics/d;Ljava/lang/String;Ljava/util/HashMap;Ljava/lang/String;)V
a=0;//
a=0;// #v0=(Reference,Lcom/umeng/analytics/d$5;);
a=0;// invoke-static {v0}, Lcom/umeng/analytics/e;->a(Ljava/lang/Runnable;)V
a=0;// :try_end_0
a=0;// .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0
a=0;//
a=0;// .line 267
a=0;// :goto_0
a=0;// #v1=(Conflicted);v2=(Conflicted);
a=0;// return-void
a=0;//
a=0;// .line 264
a=0;// :catch_0
a=0;// move-exception v0
a=0;//
a=0;// .line 265
a=0;// #v0=(Reference,Ljava/lang/Exception;);
a=0;// const-string v1, "MobclickAgent"
a=0;//
a=0;// #v1=(Reference,Ljava/lang/String;);
a=0;// const-string v2, ""
a=0;//
a=0;// #v2=(Reference,Ljava/lang/String;);
a=0;// invoke-static {v1, v2, v0}, Lu/aly/bj;->b(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Exception;)V
a=0;//
a=0;// goto :goto_0
a=0;// .end method
a=0;//
a=0;// .method a(Landroid/content/Context;Ljava/lang/String;Ljava/util/Map;J)V
a=0;// .locals 3
a=0;// .annotation system Ldalvik/annotation/Signature;
a=0;// value = {
a=0;// "(",
a=0;// "Landroid/content/Context;",
a=0;// "Ljava/lang/String;",
a=0;// "Ljava/util/Map",
a=0;// "<",
a=0;// "Ljava/lang/String;",
a=0;// "Ljava/lang/Object;",
a=0;// ">;J)V"
a=0;// }
a=0;// .end annotation
a=0;//
a=0;// .prologue
a=0;// .line 224
a=0;// :try_start_0
a=0;// iget-boolean v0, p0, Lcom/umeng/analytics/d;->i:Z
a=0;//
a=0;// #v0=(Boolean);
a=0;// if-nez v0, :cond_0
a=0;//
a=0;// invoke-direct {p0, p1}, Lcom/umeng/analytics/d;->f(Landroid/content/Context;)V
a=0;//
a=0;// .line 225
a=0;// :cond_0
a=0;// iget-object v0, p0, Lcom/umeng/analytics/d;->g:Lu/aly/n;
a=0;//
a=0;// #v0=(Reference,Lu/aly/n;);
a=0;// invoke-virtual {v0, p2, p3, p4, p5}, Lu/aly/n;->a(Ljava/lang/String;Ljava/util/Map;J)V
a=0;// :try_end_0
a=0;// .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0
a=0;//
a=0;// .line 229
a=0;// :goto_0
a=0;// #v1=(Conflicted);v2=(Conflicted);
a=0;// return-void
a=0;//
a=0;// .line 226
a=0;// :catch_0
a=0;// move-exception v0
a=0;//
a=0;// .line 227
a=0;// #v0=(Reference,Ljava/lang/Exception;);
a=0;// const-string v1, "MobclickAgent"
a=0;//
a=0;// #v1=(Reference,Ljava/lang/String;);
a=0;// const-string v2, ""
a=0;//
a=0;// #v2=(Reference,Ljava/lang/String;);
a=0;// invoke-static {v1, v2, v0}, Lu/aly/bj;->b(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Exception;)V
a=0;//
a=0;// goto :goto_0
a=0;// .end method
a=0;//
a=0;// .method a(Landroid/content/Context;Ljava/lang/Throwable;)V
a=0;// .locals 3
a=0;//
a=0;// .prologue
a=0;// .line 178
a=0;// if-eqz p1, :cond_0
a=0;//
a=0;// if-nez p2, :cond_1
a=0;//
a=0;// .line 188
a=0;// :cond_0
a=0;// :goto_0
a=0;// #v0=(Conflicted);v1=(Conflicted);v2=(Conflicted);
a=0;// return-void
a=0;//
a=0;// .line 183
a=0;// :cond_1
a=0;// :try_start_0
a=0;// #v0=(Uninit);v1=(Uninit);v2=(Uninit);
a=0;// iget-boolean v0, p0, Lcom/umeng/analytics/d;->i:Z
a=0;//
a=0;// #v0=(Boolean);
a=0;// if-nez v0, :cond_2
a=0;//
a=0;// invoke-direct {p0, p1}, Lcom/umeng/analytics/d;->f(Landroid/content/Context;)V
a=0;//
a=0;// .line 184
a=0;// :cond_2
a=0;// iget-object v0, p0, Lcom/umeng/analytics/d;->h:Lu/aly/k;
a=0;//
a=0;// #v0=(Reference,Lu/aly/k;);
a=0;// new-instance v1, Lu/aly/ac;
a=0;//
a=0;// #v1=(UninitRef,Lu/aly/ac;);
a=0;// invoke-direct {v1, p2}, Lu/aly/ac;-><init>(Ljava/lang/Throwable;)V
a=0;//
a=0;// #v1=(Reference,Lu/aly/ac;);
a=0;// const/4 v2, 0x0
a=0;//
a=0;// #v2=(Null);
a=0;// invoke-virtual {v1, v2}, Lu/aly/ac;->a(Z)Lu/aly/ac;
a=0;//
a=0;// move-result-object v1
a=0;//
a=0;// invoke-virtual {v0, v1}, Lu/aly/k;->a(Lu/aly/p;)V
a=0;// :try_end_0
a=0;// .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0
a=0;//
a=0;// goto :goto_0
a=0;//
a=0;// .line 185
a=0;// :catch_0
a=0;// #v0=(Conflicted);v1=(Conflicted);v2=(Conflicted);
a=0;// move-exception v0
a=0;//
a=0;// .line 186
a=0;// #v0=(Reference,Ljava/lang/Exception;);
a=0;// const-string v1, "MobclickAgent"
a=0;//
a=0;// #v1=(Reference,Ljava/lang/String;);
a=0;// const-string v2, ""
a=0;//
a=0;// #v2=(Reference,Ljava/lang/String;);
a=0;// invoke-static {v1, v2, v0}, Lu/aly/bj;->b(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Exception;)V
a=0;//
a=0;// goto :goto_0
a=0;// .end method
a=0;//
a=0;// .method public a(Lcom/umeng/analytics/c;)V
a=0;// .locals 0
a=0;//
a=0;// .prologue
a=0;// .line 73
a=0;// iput-object p1, p0, Lcom/umeng/analytics/d;->c:Lcom/umeng/analytics/c;
a=0;//
a=0;// .line 74
a=0;// return-void
a=0;// .end method
a=0;//
a=0;// .method a(Lcom/umeng/analytics/onlineconfig/UmengOnlineConfigureListener;)V
a=0;// .locals 1
a=0;//
a=0;// .prologue
a=0;// .line 98
a=0;// iget-object v0, p0, Lcom/umeng/analytics/d;->a:Lcom/umeng/analytics/onlineconfig/a;
a=0;//
a=0;// #v0=(Reference,Lcom/umeng/analytics/onlineconfig/a;);
a=0;// invoke-virtual {v0, p1}, Lcom/umeng/analytics/onlineconfig/a;->a(Lcom/umeng/analytics/onlineconfig/UmengOnlineConfigureListener;)V
a=0;//
a=0;// .line 99
a=0;// return-void
a=0;// .end method
a=0;//
a=0;// .method a(Ljava/lang/String;)V
a=0;// .locals 1
a=0;//
a=0;// .prologue
a=0;// .line 53
a=0;// sget-boolean v0, Lcom/umeng/analytics/AnalyticsConfig;->ACTIVITY_DURATION_OPEN:Z
a=0;//
a=0;// #v0=(Boolean);
a=0;// if-nez v0, :cond_0
a=0;//
a=0;// .line 55
a=0;// :try_start_0
a=0;// iget-object v0, p0, Lcom/umeng/analytics/d;->e:Lu/aly/z;
a=0;//
a=0;// #v0=(Reference,Lu/aly/z;);
a=0;// invoke-virtual {v0, p1}, Lu/aly/z;->a(Ljava/lang/String;)V
a=0;// :try_end_0
a=0;// .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0
a=0;//
a=0;// .line 60
a=0;// :cond_0
a=0;// :goto_0
a=0;// #v0=(Conflicted);
a=0;// return-void
a=0;//
a=0;// .line 56
a=0;// :catch_0
a=0;// move-exception v0
a=0;//
a=0;// .line 57
a=0;// #v0=(Reference,Ljava/lang/Exception;);
a=0;// invoke-virtual {v0}, Ljava/lang/Exception;->printStackTrace()V
a=0;//
a=0;// goto :goto_0
a=0;// .end method
a=0;//
a=0;// .method public a(Ljava/lang/String;Ljava/lang/String;)V
a=0;// .locals 0
a=0;//
a=0;// .prologue
a=0;// .line 81
a=0;// sput-object p1, Lcom/umeng/analytics/AnalyticsConfig;->mWrapperType:Ljava/lang/String;
a=0;//
a=0;// .line 82
a=0;// sput-object p2, Lcom/umeng/analytics/AnalyticsConfig;->mWrapperVersion:Ljava/lang/String;
a=0;//
a=0;// .line 83
a=0;// return-void
a=0;// .end method
a=0;//
a=0;// .method public a(Ljava/lang/Throwable;)V
a=0;// .locals 3
a=0;//
a=0;// .prologue
a=0;// .line 295
a=0;// :try_start_0
a=0;// iget-object v0, p0, Lcom/umeng/analytics/d;->e:Lu/aly/z;
a=0;//
a=0;// #v0=(Reference,Lu/aly/z;);
a=0;// invoke-virtual {v0}, Lu/aly/z;->a()V
a=0;//
a=0;// .line 297
a=0;// iget-object v0, p0, Lcom/umeng/analytics/d;->b:Landroid/content/Context;
a=0;//
a=0;// if-eqz v0, :cond_1
a=0;//
a=0;// .line 298
a=0;// if-eqz p1, :cond_0
a=0;//
a=0;// iget-object v0, p0, Lcom/umeng/analytics/d;->h:Lu/aly/k;
a=0;//
a=0;// if-eqz v0, :cond_0
a=0;//
a=0;// .line 299
a=0;// iget-object v0, p0, Lcom/umeng/analytics/d;->h:Lu/aly/k;
a=0;//
a=0;// new-instance v1, Lu/aly/ac;
a=0;//
a=0;// #v1=(UninitRef,Lu/aly/ac;);
a=0;// invoke-direct {v1, p1}, Lu/aly/ac;-><init>(Ljava/lang/Throwable;)V
a=0;//
a=0;// #v1=(Reference,Lu/aly/ac;);
a=0;// invoke-virtual {v0, v1}, Lu/aly/k;->b(Lu/aly/p;)V
a=0;//
a=0;// .line 301
a=0;// :cond_0
a=0;// #v1=(Conflicted);
a=0;// iget-object v0, p0, Lcom/umeng/analytics/d;->b:Landroid/content/Context;
a=0;//
a=0;// invoke-direct {p0, v0}, Lcom/umeng/analytics/d;->h(Landroid/content/Context;)V
a=0;//
a=0;// .line 302
a=0;// iget-object v0, p0, Lcom/umeng/analytics/d;->b:Landroid/content/Context;
a=0;//
a=0;// invoke-static {v0}, Lu/aly/u;->a(Landroid/content/Context;)Landroid/content/SharedPreferences;
a=0;//
a=0;// move-result-object v0
a=0;//
a=0;// invoke-interface {v0}, Landroid/content/SharedPreferences;->edit()Landroid/content/SharedPreferences$Editor;
a=0;//
a=0;// move-result-object v0
a=0;//
a=0;// invoke-interface {v0}, Landroid/content/SharedPreferences$Editor;->commit()Z
a=0;//
a=0;// .line 305
a=0;// :cond_1
a=0;// invoke-static {}, Lcom/umeng/analytics/e;->a()V
a=0;// :try_end_0
a=0;// .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0
a=0;//
a=0;// .line 309
a=0;// :goto_0
a=0;// #v2=(Conflicted);
a=0;// return-void
a=0;//
a=0;// .line 306
a=0;// :catch_0
a=0;// move-exception v0
a=0;//
a=0;// .line 307
a=0;// #v0=(Reference,Ljava/lang/Exception;);
a=0;// const-string v1, "MobclickAgent"
a=0;//
a=0;// #v1=(Reference,Ljava/lang/String;);
a=0;// const-string v2, "Exception in onAppCrash"
a=0;//
a=0;// #v2=(Reference,Ljava/lang/String;);
a=0;// invoke-static {v1, v2, v0}, Lu/aly/bj;->a(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Exception;)V
a=0;//
a=0;// goto :goto_0
a=0;// .end method
a=0;//
a=0;// .method b(Landroid/content/Context;)V
a=0;// .locals 3
a=0;//
a=0;// .prologue
a=0;// .line 102
a=0;// if-nez p1, :cond_0
a=0;//
a=0;// .line 103
a=0;// const-string v0, "MobclickAgent"
a=0;//
a=0;// #v0=(Reference,Ljava/lang/String;);
a=0;// const-string v1, "unexpected null context in onResume"
a=0;//
a=0;// #v1=(Reference,Ljava/lang/String;);
a=0;// invoke-static {v0, v1}, Lu/aly/bj;->b(Ljava/lang/String;Ljava/lang/String;)V
a=0;//
a=0;// .line 124
a=0;// :goto_0
a=0;// #v1=(Conflicted);v2=(Conflicted);
a=0;// return-void
a=0;//
a=0;// .line 107
a=0;// :cond_0
a=0;// #v0=(Uninit);v1=(Uninit);v2=(Uninit);
a=0;// sget-boolean v0, Lcom/umeng/analytics/AnalyticsConfig;->ACTIVITY_DURATION_OPEN:Z
a=0;//
a=0;// #v0=(Boolean);
a=0;// if-eqz v0, :cond_1
a=0;//
a=0;// .line 108
a=0;// iget-object v0, p0, Lcom/umeng/analytics/d;->e:Lu/aly/z;
a=0;//
a=0;// #v0=(Reference,Lu/aly/z;);
a=0;// invoke-virtual {p1}, Ljava/lang/Object;->getClass()Ljava/lang/Class;
a=0;//
a=0;// move-result-object v1
a=0;//
a=0;// #v1=(Reference,Ljava/lang/Class;);
a=0;// invoke-virtual {v1}, Ljava/lang/Class;->getName()Ljava/lang/String;
a=0;//
a=0;// move-result-object v1
a=0;//
a=0;// invoke-virtual {v0, v1}, Lu/aly/z;->a(Ljava/lang/String;)V
a=0;//
a=0;// .line 112
a=0;// :cond_1
a=0;// :try_start_0
a=0;// #v0=(Conflicted);v1=(Conflicted);
a=0;// iget-boolean v0, p0, Lcom/umeng/analytics/d;->i:Z
a=0;//
a=0;// #v0=(Boolean);
a=0;// if-nez v0, :cond_2
a=0;//
a=0;// invoke-direct {p0, p1}, Lcom/umeng/analytics/d;->f(Landroid/content/Context;)V
a=0;//
a=0;// .line 114
a=0;// :cond_2
a=0;// new-instance v0, Lcom/umeng/analytics/d$1;
a=0;//
a=0;// #v0=(UninitRef,Lcom/umeng/analytics/d$1;);
a=0;// invoke-direct {v0, p0, p1}, Lcom/umeng/analytics/d$1;-><init>(Lcom/umeng/analytics/d;Landroid/content/Context;)V
a=0;//
a=0;// #v0=(Reference,Lcom/umeng/analytics/d$1;);
a=0;// invoke-static {v0}, Lcom/umeng/analytics/e;->a(Ljava/lang/Runnable;)V
a=0;// :try_end_0
a=0;// .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0
a=0;//
a=0;// goto :goto_0
a=0;//
a=0;// .line 120
a=0;// :catch_0
a=0;// #v0=(Conflicted);
a=0;// move-exception v0
a=0;//
a=0;// .line 121
a=0;// #v0=(Reference,Ljava/lang/Exception;);
a=0;// const-string v1, "MobclickAgent"
a=0;//
a=0;// .line 122
a=0;// #v1=(Reference,Ljava/lang/String;);
a=0;// const-string v2, "Exception occurred in Mobclick.onResume(). "
a=0;//
a=0;// .line 121
a=0;// #v2=(Reference,Ljava/lang/String;);
a=0;// invoke-static {v1, v2, v0}, Lu/aly/bj;->b(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Exception;)V
a=0;//
a=0;// goto :goto_0
a=0;// .end method
a=0;//
a=0;// .method b(Landroid/content/Context;Ljava/lang/String;Ljava/lang/String;)V
a=0;// .locals 3
a=0;//
a=0;// .prologue
a=0;// .line 246
a=0;// :try_start_0
a=0;// new-instance v0, Lcom/umeng/analytics/d$4;
a=0;//
a=0;// #v0=(UninitRef,Lcom/umeng/analytics/d$4;);
a=0;// invoke-direct {v0, p0, p2, p3}, Lcom/umeng/analytics/d$4;-><init>(Lcom/umeng/analytics/d;Ljava/lang/String;Ljava/lang/String;)V
a=0;//
a=0;// #v0=(Reference,Lcom/umeng/analytics/d$4;);
a=0;// invoke-static {v0}, Lcom/umeng/analytics/e;->a(Ljava/lang/Runnable;)V
a=0;// :try_end_0
a=0;// .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0
a=0;//
a=0;// .line 254
a=0;// :goto_0
a=0;// #v1=(Conflicted);v2=(Conflicted);
a=0;// return-void
a=0;//
a=0;// .line 251
a=0;// :catch_0
a=0;// move-exception v0
a=0;//
a=0;// .line 252
a=0;// #v0=(Reference,Ljava/lang/Exception;);
a=0;// const-string v1, "MobclickAgent"
a=0;//
a=0;// #v1=(Reference,Ljava/lang/String;);
a=0;// const-string v2, ""
a=0;//
a=0;// #v2=(Reference,Ljava/lang/String;);
a=0;// invoke-static {v1, v2, v0}, Lu/aly/bj;->b(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Exception;)V
a=0;//
a=0;// goto :goto_0
a=0;// .end method
a=0;//
a=0;// .method b(Ljava/lang/String;)V
a=0;// .locals 1
a=0;//
a=0;// .prologue
a=0;// .line 63
a=0;// sget-boolean v0, Lcom/umeng/analytics/AnalyticsConfig;->ACTIVITY_DURATION_OPEN:Z
a=0;//
a=0;// #v0=(Boolean);
a=0;// if-nez v0, :cond_0
a=0;//
a=0;// .line 65
a=0;// :try_start_0
a=0;// iget-object v0, p0, Lcom/umeng/analytics/d;->e:Lu/aly/z;
a=0;//
a=0;// #v0=(Reference,Lu/aly/z;);
a=0;// invoke-virtual {v0, p1}, Lu/aly/z;->b(Ljava/lang/String;)V
a=0;// :try_end_0
a=0;// .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0
a=0;//
a=0;// .line 70
a=0;// :cond_0
a=0;// :goto_0
a=0;// #v0=(Conflicted);
a=0;// return-void
a=0;//
a=0;// .line 66
a=0;// :catch_0
a=0;// move-exception v0
a=0;//
a=0;// .line 67
a=0;// #v0=(Reference,Ljava/lang/Exception;);
a=0;// invoke-virtual {v0}, Ljava/lang/Exception;->printStackTrace()V
a=0;//
a=0;// goto :goto_0
a=0;// .end method
a=0;//
a=0;// .method c(Landroid/content/Context;)V
a=0;// .locals 3
a=0;//
a=0;// .prologue
a=0;// .line 127
a=0;// if-nez p1, :cond_0
a=0;//
a=0;// .line 128
a=0;// const-string v0, "MobclickAgent"
a=0;//
a=0;// #v0=(Reference,Ljava/lang/String;);
a=0;// const-string v1, "unexpected null context in onPause"
a=0;//
a=0;// #v1=(Reference,Ljava/lang/String;);
a=0;// invoke-static {v0, v1}, Lu/aly/bj;->b(Ljava/lang/String;Ljava/lang/String;)V
a=0;//
a=0;// .line 147
a=0;// :goto_0
a=0;// #v1=(Conflicted);v2=(Conflicted);
a=0;// return-void
a=0;//
a=0;// .line 132
a=0;// :cond_0
a=0;// #v0=(Uninit);v1=(Uninit);v2=(Uninit);
a=0;// sget-boolean v0, Lcom/umeng/analytics/AnalyticsConfig;->ACTIVITY_DURATION_OPEN:Z
a=0;//
a=0;// #v0=(Boolean);
a=0;// if-eqz v0, :cond_1
a=0;//
a=0;// .line 133
a=0;// iget-object v0, p0, Lcom/umeng/analytics/d;->e:Lu/aly/z;
a=0;//
a=0;// #v0=(Reference,Lu/aly/z;);
a=0;// invoke-virtual {p1}, Ljava/lang/Object;->getClass()Ljava/lang/Class;
a=0;//
a=0;// move-result-object v1
a=0;//
a=0;// #v1=(Reference,Ljava/lang/Class;);
a=0;// invoke-virtual {v1}, Ljava/lang/Class;->getName()Ljava/lang/String;
a=0;//
a=0;// move-result-object v1
a=0;//
a=0;// invoke-virtual {v0, v1}, Lu/aly/z;->b(Ljava/lang/String;)V
a=0;//
a=0;// .line 137
a=0;// :cond_1
a=0;// :try_start_0
a=0;// #v0=(Conflicted);v1=(Conflicted);
a=0;// iget-boolean v0, p0, Lcom/umeng/analytics/d;->i:Z
a=0;//
a=0;// #v0=(Boolean);
a=0;// if-nez v0, :cond_2
a=0;//
a=0;// invoke-direct {p0, p1}, Lcom/umeng/analytics/d;->f(Landroid/content/Context;)V
a=0;//
a=0;// .line 139
a=0;// :cond_2
a=0;// new-instance v0, Lcom/umeng/analytics/d$2;
a=0;//
a=0;// #v0=(UninitRef,Lcom/umeng/analytics/d$2;);
a=0;// invoke-direct {v0, p0, p1}, Lcom/umeng/analytics/d$2;-><init>(Lcom/umeng/analytics/d;Landroid/content/Context;)V
a=0;//
a=0;// #v0=(Reference,Lcom/umeng/analytics/d$2;);
a=0;// invoke-static {v0}, Lcom/umeng/analytics/e;->a(Ljava/lang/Runnable;)V
a=0;// :try_end_0
a=0;// .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0
a=0;//
a=0;// goto :goto_0
a=0;//
a=0;// .line 144
a=0;// :catch_0
a=0;// #v0=(Conflicted);
a=0;// move-exception v0
a=0;//
a=0;// .line 145
a=0;// #v0=(Reference,Ljava/lang/Exception;);
a=0;// const-string v1, "MobclickAgent"
a=0;//
a=0;// #v1=(Reference,Ljava/lang/String;);
a=0;// const-string v2, "Exception occurred in Mobclick.onRause(). "
a=0;//
a=0;// #v2=(Reference,Ljava/lang/String;);
a=0;// invoke-static {v1, v2, v0}, Lu/aly/bj;->b(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Exception;)V
a=0;//
a=0;// goto :goto_0
a=0;// .end method
a=0;//
a=0;// .method c(Landroid/content/Context;Ljava/lang/String;Ljava/lang/String;)V
a=0;// .locals 3
a=0;//
a=0;// .prologue
a=0;// .line 271
a=0;// :try_start_0
a=0;// new-instance v0, Lcom/umeng/analytics/d$6;
a=0;//
a=0;// #v0=(UninitRef,Lcom/umeng/analytics/d$6;);
a=0;// invoke-direct {v0, p0, p2, p3}, Lcom/umeng/analytics/d$6;-><init>(Lcom/umeng/analytics/d;Ljava/lang/String;Ljava/lang/String;)V
a=0;//
a=0;// #v0=(Reference,Lcom/umeng/analytics/d$6;);
a=0;// invoke-static {v0}, Lcom/umeng/analytics/e;->a(Ljava/lang/Runnable;)V
a=0;// :try_end_0
a=0;// .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0
a=0;//
a=0;// .line 279
a=0;// :goto_0
a=0;// #v1=(Conflicted);v2=(Conflicted);
a=0;// return-void
a=0;//
a=0;// .line 276
a=0;// :catch_0
a=0;// move-exception v0
a=0;//
a=0;// .line 277
a=0;// #v0=(Reference,Ljava/lang/Exception;);
a=0;// const-string v1, "MobclickAgent"
a=0;//
a=0;// #v1=(Reference,Ljava/lang/String;);
a=0;// const-string v2, ""
a=0;//
a=0;// #v2=(Reference,Ljava/lang/String;);
a=0;// invoke-static {v1, v2, v0}, Lu/aly/bj;->b(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Exception;)V
a=0;//
a=0;// goto :goto_0
a=0;// .end method
a=0;//
a=0;// .method d(Landroid/content/Context;)V
a=0;// .locals 3
a=0;//
a=0;// .prologue
a=0;// .line 206
a=0;// :try_start_0
a=0;// iget-boolean v0, p0, Lcom/umeng/analytics/d;->i:Z
a=0;//
a=0;// #v0=(Boolean);
a=0;// if-nez v0, :cond_0
a=0;//
a=0;// invoke-direct {p0, p1}, Lcom/umeng/analytics/d;->f(Landroid/content/Context;)V
a=0;//
a=0;// .line 207
a=0;// :cond_0
a=0;// iget-object v0, p0, Lcom/umeng/analytics/d;->h:Lu/aly/k;
a=0;//
a=0;// #v0=(Reference,Lu/aly/k;);
a=0;// invoke-virtual {v0}, Lu/aly/k;->a()V
a=0;// :try_end_0
a=0;// .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0
a=0;//
a=0;// .line 211
a=0;// :goto_0
a=0;// #v1=(Conflicted);v2=(Conflicted);
a=0;// return-void
a=0;//
a=0;// .line 208
a=0;// :catch_0
a=0;// move-exception v0
a=0;//
a=0;// .line 209
a=0;// #v0=(Reference,Ljava/lang/Exception;);
a=0;// const-string v1, "MobclickAgent"
a=0;//
a=0;// #v1=(Reference,Ljava/lang/String;);
a=0;// const-string v2, ""
a=0;//
a=0;// #v2=(Reference,Ljava/lang/String;);
a=0;// invoke-static {v1, v2, v0}, Lu/aly/bj;->b(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Exception;)V
a=0;//
a=0;// goto :goto_0
a=0;// .end method
a=0;//
a=0;// .method e(Landroid/content/Context;)V
a=0;// .locals 1
a=0;//
a=0;// .prologue
a=0;// .line 283
a=0;// :try_start_0
a=0;// iget-object v0, p0, Lcom/umeng/analytics/d;->e:Lu/aly/z;
a=0;//
a=0;// #v0=(Reference,Lu/aly/z;);
a=0;// invoke-virtual {v0}, Lu/aly/z;->a()V
a=0;//
a=0;// .line 284
a=0;// invoke-direct {p0, p1}, Lcom/umeng/analytics/d;->h(Landroid/content/Context;)V
a=0;//
a=0;// .line 285
a=0;// invoke-static {p1}, Lu/aly/u;->a(Landroid/content/Context;)Landroid/content/SharedPreferences;
a=0;//
a=0;// move-result-object v0
a=0;//
a=0;// invoke-interface {v0}, Landroid/content/SharedPreferences;->edit()Landroid/content/SharedPreferences$Editor;
a=0;//
a=0;// move-result-object v0
a=0;//
a=0;// invoke-interface {v0}, Landroid/content/SharedPreferences$Editor;->commit()Z
a=0;//
a=0;// .line 287
a=0;// invoke-static {}, Lcom/umeng/analytics/e;->a()V
a=0;// :try_end_0
a=0;// .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0
a=0;//
a=0;// .line 291
a=0;// :goto_0
a=0;// return-void
a=0;//
a=0;// .line 288
a=0;// :catch_0
a=0;// move-exception v0
a=0;//
a=0;// .line 289
a=0;// #v0=(Reference,Ljava/lang/Exception;);
a=0;// invoke-virtual {v0}, Ljava/lang/Exception;->printStackTrace()V
a=0;//
a=0;// goto :goto_0
a=0;// .end method
}}
| [
"zhenbao.zhou@qunar.com"
] | zhenbao.zhou@qunar.com |
7f319824cb9bc23e05d76192d6cf781d41e72ef4 | b2b2cdc6a545c8a87e6ae9f450ab16f6a7cc76db | /src/main/java/model/TipoDeServicio.java | 1e45869b7ffd638a05ab746945750e7a44478a2e | [] | no_license | AlmudenaSantiago/gruas | 9fb675fb4c44d16914949ce24a85cd5bbc849ff8 | b50d32e48daceda2429a5edb1f3103408b24bf37 | refs/heads/master | 2021-01-19T07:06:55.840579 | 2017-04-07T08:37:31 | 2017-04-07T08:37:31 | 87,523,899 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 577 | 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 model;
/**
*
* @author loquat
*/
public class TipoDeServicio {
private int id;
private int tipo;
public int getId() {
return id;
}
public int getTipo() {
return tipo;
}
public void setId(int id) {
this.id = id;
}
public void setTipo(int tipo) {
this.tipo = tipo;
}
}
| [
"gruasjoseantonio@gruaspc1"
] | gruasjoseantonio@gruaspc1 |
d4299b1e39a57e89cc3d3ef69908e1b2b106da30 | 0c1c5a39fb145459b1d5905b15b37dc4b4623bf2 | /src/main/java/com/ao/scanElectricityBis/entity/QBaseOperator.java | 8bcf4585d8875ff0e7bf47c0f852ca841cba316f | [] | no_license | aohanhe/ScanBisServer | bc4276bc823a7208304174f69cd79e20283b4b7d | a8718adc453d92667616687d1da61ddff18c566c | refs/heads/master | 2020-03-28T07:10:53.469464 | 2018-11-09T09:27:15 | 2018-11-09T09:27:15 | 147,885,528 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,617 | java | package com.ao.scanElectricityBis.entity;
import static com.querydsl.core.types.PathMetadataFactory.*;
import com.querydsl.core.types.dsl.*;
import com.querydsl.core.types.PathMetadata;
import javax.annotation.Generated;
import com.querydsl.core.types.Path;
/**
* QBaseOperator is a Querydsl query type for BaseOperator
*/
@Generated("com.querydsl.codegen.EntitySerializer")
public class QBaseOperator extends EntityPathBase<BaseOperator> {
private static final long serialVersionUID = -413509059L;
public static final QBaseOperator baseOperator = new QBaseOperator("baseOperator");
public final QBaseBisEntity _super = new QBaseBisEntity(this);
//inherited
public final DateTimePath<java.util.Date> created = _super.created;
//inherited
public final NumberPath<Integer> creator = _super.creator;
//inherited
public final NumberPath<Integer> id = _super.id;
//inherited
public final NumberPath<Integer> modifier = _super.modifier;
//inherited
public final DateTimePath<java.util.Date> moditime = _super.moditime;
public final StringPath name = createString("name");
public final BooleanPath status = createBoolean("status");
//inherited
public final NumberPath<Integer> version = _super.version;
public QBaseOperator(String variable) {
super(BaseOperator.class, forVariable(variable));
}
public QBaseOperator(Path<? extends BaseOperator> path) {
super(path.getType(), path.getMetadata());
}
public QBaseOperator(PathMetadata metadata) {
super(BaseOperator.class, metadata);
}
}
| [
"13823904000@139.com"
] | 13823904000@139.com |
b6067fe0c6b3889c0f8741ed8b072691f6be4543 | d585e7319121e317f2430e34faeeedc0ff921abf | /src/com/cbai/common/page/Paginable.java | 87eed9dedbb8e2288e43703fe34248501bde24ae | [] | no_license | facaimeng/fuwubao | 95aef2376663f80dc4c0adc795e1ca4b020352a5 | 56bdfd568d855bfb28b69ae583a5e43ac1777df1 | refs/heads/master | 2022-08-18T23:31:17.978487 | 2020-05-18T23:31:45 | 2020-05-18T23:31:45 | 265,088,397 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 663 | java | package com.cbai.common.page;
/**
* 分页接口
*/
public interface Paginable {
/**
* 总记录数
*
* @return
*/
public int getTotalCount();
/**
* 总页数
*
* @return
*/
public int getTotalPage();
/**
* 每页记录数
*
* @return
*/
public int getPageSize();
/**
* 当前页号
*
* @return
*/
public int getPageNo();
/**
* 是否第一页
*
* @return
*/
public boolean isFirstPage();
/**
* 是否最后一页
*
* @return
*/
public boolean isLastPage();
/**
* 返回下页的页号
*/
public int getNextPage();
/**
* 返回上页的页号
*/
public int getPrePage();
}
| [
"249590716@qq.com"
] | 249590716@qq.com |
66cf16c1c53d8a6b5c2ef05ba4fe45411e9492d5 | a147e6b97fe257f287aae8272f241dcfa7c1b7b8 | /interact.parent/interact.core/src/main/java/com/codecoop/interact/core/dao/StopAndWatchHistoryDaoImpl.java | bbc059e490038fe133f5b086aa0d7b8717c6ca3f | [] | no_license | Dejiva/Carecent | 4fc382b8fc7371e0969ae2140a5846c703b4328b | f6f774927390f6fa7c52153f95237ed006f5c7f0 | refs/heads/master | 2021-01-10T18:00:38.383030 | 2015-06-04T06:52:32 | 2015-06-04T06:52:32 | 36,651,087 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,954 | java | package com.codecoop.interact.core.dao;
import java.util.List;
import org.hibernate.SQLQuery;
import org.hibernate.Session;
import org.springframework.stereotype.Component;
import com.codecoop.interact.core.domain.FacilityStaff;
import com.codecoop.interact.core.domain.Patient;
import com.codecoop.interact.core.domain.StopAndWatch;
import com.codecoop.interact.core.domain.StopAndWatchHistory;
import com.codecoop.interact.core.util.Constants;
@Component
public class StopAndWatchHistoryDaoImpl extends BaseDao<StopAndWatchHistory>{
@SuppressWarnings("unchecked")
public List<StopAndWatchHistory> findALLStopAndWatchHistorys(StopAndWatch stopAndWatch){
String sql = "select SWH.* from STOP_AND_WATCH_HISTORY SWH where SWH.STOP_AND_WATCH_ID=:stopAndWatch and SWH.INVALIDATE_FLAG=0 and SWH.DELETE_FLAG=0";
SQLQuery query = getCurrentSession().createSQLQuery(sql);
query.setParameter("stopAndWatch", stopAndWatch.getId());
query.addEntity(StopAndWatchHistory.class);
return query.list();
}
@SuppressWarnings("unchecked")
public List<StopAndWatchHistory> findALLSortedStopAndWatchHistorys(StopAndWatch stopAndWatch){
String sql = "select SWH.* from STOP_AND_WATCH_HISTORY SWH where SWH.STOP_AND_WATCH_ID=:stopAndWatch and SWH.INVALIDATE_FLAG=0 and SWH.DELETE_FLAG=0 order by SWH.DATE_CREATED desc";
SQLQuery query = getCurrentSession().createSQLQuery(sql);
query.setParameter("stopAndWatch", stopAndWatch.getId());
query.addEntity(StopAndWatchHistory.class);
return query.list();
}
@SuppressWarnings("unchecked")
public List<Patient> findByReportedId(FacilityStaff facilityStaff,Long staffId){
Session session = getCurrentSession();
//String sql="select p.* FROM PATIENT p,STOP_AND_WATCH s,PATIENT_EPISODE pe1 where p.ID=pe1.PATIENT_ID and pe1.ID=s.PATIENT_EPISODE_ID and pe1.FACILITY_DISCHARGE_DATE is null and pe1.FACILITY_ID=:facilityId and s.ID in(select distinct sh.STOP_AND_WATCH_ID from STOP_AND_WATCH_HISTORY sh where sh.REPORTED_TO_FACILITY_STAFF_ID=:facilityStaff and sh.DELETE_FLAG=0) and s.END_DATE is null union all select p2.* from SBAR_NOTES sbn,SBAR sb,PATIENT p2,PATIENT_EPISODE pe2 where sbn.NURSING_FACILITY_STAFF_ID=:facilityStaff and sbn.NURSING_STAFF_TYPE=:nurseType and sbn.SBAR_ID=sb.ID and p2.ID=pe2.PATIENT_ID and pe2.ID=sb.PATIENT_EPISODE_ID and pe2.FACILITY_DISCHARGE_DATE is null and pe2.FACILITY_ID=:facilityId union all select p3.* from SBAR sb,PATIENT p3,PATIENT_EPISODE pe3 where sb.DOCTOR_ID=:staffId and p3.ID=pe3.PATIENT_ID and pe3.ID=sb.PATIENT_EPISODE_ID and pe3.FACILITY_DISCHARGE_DATE is null and pe3.FACILITY_ID=:facilityId union all select p4.* from PATIENT p4 ,PATIENT_EPISODE pe4 where pe4.PCP_ID=:facilityStaff and p4.ID=pe4.PATIENT_ID and pe4.FACILITY_DISCHARGE_DATE is null and pe4.FACILITY_ID=:facilityId union all select p5.* from PATIENT p5 ,PATIENT_EPISODE pe5 ,ASSIGNED_DOC_RELATION asd where p5.ID=pe5.PATIENT_ID and pe5.FACILITY_DISCHARGE_DATE is null and pe5.FACILITY_ID=:facilityId and pe5.PCP_ID=asd.DOCTOR_FACILITY_STAFF_ID union all select p6.* from PATIENT p6,PATIENT_EPISODE pe6 where pe6.PCP_ID=:facilityStaff AND pe6.FACILITY_ID=:facilityId and p6.ID=pe6.PATIENT_ID and pe6.FACILITY_DISCHARGE_DATE is null order by FIRST_NAME ASC";
//String sql="select p6.* from PATIENT p6,PATIENT_EPISODE pe6 where pe6.PCP_ID=:facilityStaff AND pe6.FACILITY_ID=:facilityId and p6.ID=pe6.PATIENT_ID and pe6.FACILITY_DISCHARGE_DATE is null order by FIRST_NAME ASC";
String sql="select p5.* from PATIENT p5 ,PATIENT_EPISODE pe5 ,ASSIGNED_DOC_RELATION asd where p5.ID=pe5.PATIENT_ID and pe5.FACILITY_DISCHARGE_DATE is null and pe5.FACILITY_ID=:facilityId and pe5.PCP_ID=asd.DOCTOR_FACILITY_STAFF_ID and asd.FACILITY_STAFF_ID=:facilityStaffId union all select p6.* from PATIENT p6,PATIENT_EPISODE pe6 where pe6.PCP_ID=:facilityStaffId and pe6.FACILITY_ID=:facilityId and p6.ID=pe6.PATIENT_ID and pe6.FACILITY_DISCHARGE_DATE is null order by FIRST_NAME ASC";
SQLQuery query = session.createSQLQuery(sql);
query.setParameter("facilityId",facilityStaff.getFacility().getId());
query.setParameter("facilityStaffId",facilityStaff.getId());
// query.setParameter("staffId",staffId);
// query.setParameter("nurseType",Constants.NURSE_TYPE);
query.addEntity(Patient.class);
return (List<Patient>)query.list();
}
@SuppressWarnings("unchecked")
public List<StopAndWatchHistory> findAllActiveStopAndWatchHistorys(Long patientEpisodeId){
Session session = getCurrentSession();
String sql="SELECT sh.* from STOP_AND_WATCH_HISTORY sh where sh.DELETE_FLAG=false AND sh.INVALIDATE_FLAG=false and sh.STOP_AND_WATCH_ID IN (SELECT sa.ID FROM STOP_AND_WATCH sa WHERE sa.END_DATE IS NULL AND sa.PATIENT_EPISODE_ID IN (SELECT ID FROM PATIENT_EPISODE pe where pe. FACILITY_DISCHARGE_DATE is NULL));";
SQLQuery query = session.createSQLQuery(sql);
query.addEntity(StopAndWatchHistory.class);
return (List<StopAndWatchHistory>)query.list();
}
}
| [
"rameshnaidu84@gmail.com"
] | rameshnaidu84@gmail.com |
9d7cdba569d7f7596a01ba446b41f09776092e01 | 46a269d9409b57b2c318bfed116de4a950841f36 | /src/main/java/br/com/b2w/desafio/service/PlanetaService.java | 3b01c2f9728c221fef6feec0366772564af924af | [] | no_license | JonatasRodrigues/API-SpringBoot-Docker-CircleCi-Codecov | a4151b0b18f22243c1bd7e80c869fdd81d7e639b | ad873c8c3f70eb450a8432deedc5db580c795dc7 | refs/heads/master | 2021-06-12T04:36:45.280189 | 2019-07-27T21:37:59 | 2019-07-27T21:37:59 | 183,983,274 | 0 | 0 | null | 2021-06-04T01:55:23 | 2019-04-29T02:03:14 | Java | UTF-8 | Java | false | false | 3,605 | java | package br.com.b2w.desafio.service;
import br.com.b2w.desafio.config.BundleConfig;
import br.com.b2w.desafio.constantes.AppConstantes;
import br.com.b2w.desafio.dto.PlanetaDTO;
import br.com.b2w.desafio.dto.ResponseDTO;
import br.com.b2w.desafio.entity.Planeta;
import br.com.b2w.desafio.exception.SWAPIException;
import br.com.b2w.desafio.repository.PlanetaRepository;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
import org.springframework.stereotype.Service;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestTemplate;
import java.math.BigInteger;
import java.util.List;
import java.util.Optional;
@Service
public class PlanetaService implements IPlanetaService {
private static final Logger logger = LogManager.getLogger(PlanetaService.class);
private static final String URL_API_STAR_WARS = "https://swapi.co/api/planets?search=";
@Autowired
private PlanetaRepository planetaRepository;
@Autowired
private CounterService counterService;
@Override
public Planeta salvar(Planeta planeta) {
ResponseDTO responseDTO = consumirSwapi(planeta.getNome());
PlanetaDTO planetaDTO = responseDTO.getResults().stream()
.filter(value -> planeta.getNome().equalsIgnoreCase(value.getName()))
.findFirst().orElse(new PlanetaDTO());
planeta.setId(BigInteger.valueOf(counterService.getNextUserIdSequence()));
planeta.setQtdAparicao(Integer.parseInt(Optional.ofNullable(planetaDTO.getFilms()).map(List::size).orElse(0).toString()));
return planetaRepository.salvar(planeta);
}
@Override
public void deletar(BigInteger id) {
planetaRepository.deletar(id);
}
@Override
public Optional<Planeta> findByNome(String nome) {
return planetaRepository.findByNome(nome);
}
@Override
public Optional<Planeta> findById(BigInteger id) {
return planetaRepository.findById(id);
}
@Override
public List<Planeta> findAll() {
return planetaRepository.findAll();
}
private ResponseDTO consumirSwapi(String nomePlaneta){
logger.info("Consumindo API pública do Star Wars");
try{
RestTemplate restTemplate = new RestTemplate(new HttpComponentsClientHttpRequestFactory());
HttpEntity<String> request = new HttpEntity<>("parameters", getHeaders());
ResponseEntity<ResponseDTO> response = restTemplate.exchange(URL_API_STAR_WARS + nomePlaneta,
HttpMethod.GET, request, ResponseDTO.class);
if(response.getStatusCode().is2xxSuccessful()){
return response.getBody();
}
}catch (Exception e){
logger.error(e.getMessage(), e);
throw new SWAPIException(BundleConfig.getMensagem(AppConstantes.MSG_ERRO_SWAPI));
}
return null;
}
private MultiValueMap<String, String> getHeaders() {
MultiValueMap<String, String> headers = new LinkedMultiValueMap<String, String>();
headers.add("Content-Type", "application/json");
return headers;
}
}
| [
"jsrodrigues87@hotmail.com"
] | jsrodrigues87@hotmail.com |
ffcd6d527beedfa1266a9ab0d9d0a50bf6bcb98f | c7d7440c48f3c860a16fdd19697327543b7d6217 | /src/main/java/com/intellecteu/vis/pgp/ConfigEncrypt.java | 613cbfadc899d6f70373713f331c084e3f9b4baa | [
"Apache-2.0"
] | permissive | vanillaguy/vis-pgp | 1f459971c3c694f634216ce03cbad96964a51708 | dc2d3bf16432778ba8dfc3199ab9ee3a535e1078 | refs/heads/master | 2021-05-03T05:05:00.458482 | 2018-02-12T15:26:13 | 2018-02-12T15:26:13 | 120,631,102 | 2 | 1 | Apache-2.0 | 2018-02-12T15:26:14 | 2018-02-07T15:13:42 | Java | UTF-8 | Java | false | false | 1,197 | java | package com.intellecteu.vis.pgp;
import org.jasypt.encryption.StringEncryptor;
import org.jasypt.encryption.pbe.PooledPBEStringEncryptor;
import org.jasypt.encryption.pbe.config.SimpleStringPBEConfig;
import java.util.Scanner;
public class ConfigEncrypt {
public static void main(String[] args) {
System.out.println("Enter password for encryption: ");
Scanner scanner = new Scanner(System.in);
String str = scanner.nextLine();
System.out.println("Encrypted value is: " + "ENC(" + stringEncryptor().encrypt(str) + ")");
}
public static StringEncryptor stringEncryptor() {
PooledPBEStringEncryptor encryptor = new PooledPBEStringEncryptor();
SimpleStringPBEConfig config = new SimpleStringPBEConfig();
config.setPassword("Abcd1234Abcd1234");
config.setAlgorithm("PBEWithMD5AndDES");
config.setKeyObtentionIterations("1000");
config.setPoolSize("1");
config.setProviderName("SunJCE");
config.setSaltGeneratorClassName("org.jasypt.salt.RandomSaltGenerator");
config.setStringOutputType("base64");
encryptor.setConfig(config);
return encryptor;
}
} | [
"sergii.pozharov@intellecteu.com"
] | sergii.pozharov@intellecteu.com |
7c1b89ae3209c48b501d34a27892a28b5a747ac9 | bff8847c9ac32666d46c5e7824a8b1fe25e18401 | /android/app/src/main/java/com/handaccount/MainApplication.java | 64e044f7a5c6e8ddd9feb3bd368401ba94aa0ddc | [] | no_license | AnbolKing/HandAccount | ceaa56d062afc65c8a95770a01135bfa34a60496 | 38f1c0cc8e0508bb8bff66f9f331e7c83e11606d | refs/heads/master | 2023-06-11T17:42:48.124580 | 2021-06-11T13:35:53 | 2021-06-11T13:35:53 | 362,840,265 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,097 | java | package com.handaccount;
import android.app.Application;
import android.content.Context;
import com.facebook.react.PackageList;
import com.facebook.react.ReactApplication;
import com.cmcewen.blurview.BlurViewPackage;
import com.rnfs.RNFSPackage;
import fr.greweb.reactnativeviewshot.RNViewShotPackage;
import org.devio.rn.splashscreen.SplashScreenReactPackage;
import com.learnium.RNDeviceInfo.RNDeviceInfo;
import com.learnium.RNDeviceInfo.RNDeviceInfo;
import com.hieuvp.fingerprint.ReactNativeFingerprintScannerPackage;
import com.imagepicker.ImagePickerPackage;
import org.reactnative.camera.RNCameraPackage;
import com.oblador.vectoricons.VectorIconsPackage;
import com.facebook.react.ReactInstanceManager;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.soloader.SoLoader;
import java.lang.reflect.InvocationTargetException;
import java.util.List;
public class MainApplication extends Application implements ReactApplication {
private final ReactNativeHost mReactNativeHost =
new ReactNativeHost(this) {
@Override
public boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
}
@Override
protected List<ReactPackage> getPackages() {
@SuppressWarnings("UnnecessaryLocalVariable")
List<ReactPackage> packages = new PackageList(this).getPackages();
// Packages that cannot be autolinked yet can be added manually here, for example:
// packages.add(new MyReactNativePackage());
return packages;
}
@Override
protected String getJSMainModuleName() {
return "index";
}
};
@Override
public ReactNativeHost getReactNativeHost() {
return mReactNativeHost;
}
@Override
public void onCreate() {
super.onCreate();
SoLoader.init(this, /* native exopackage */ false);
initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
}
/**
* Loads Flipper in React Native templates. Call this in the onCreate method with something like
* initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
*
* @param context
* @param reactInstanceManager
*/
private static void initializeFlipper(
Context context, ReactInstanceManager reactInstanceManager) {
if (BuildConfig.DEBUG) {
try {
/*
We use reflection here to pick up the class that initializes Flipper,
since Flipper library is not available in release mode
*/
Class<?> aClass = Class.forName("com.handaccount.ReactNativeFlipper");
aClass
.getMethod("initializeFlipper", Context.class, ReactInstanceManager.class)
.invoke(null, context, reactInstanceManager);
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (NoSuchMethodException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
}
}
}
| [
"272344341@qq.com"
] | 272344341@qq.com |
7df5289a18e5877d459cd646da79da73efc0a457 | 798d47ff0479c238cce73a8c09fec32cb62c53af | /src/main/java/kr/ac/hansung/cse/service/CartItemService.java | a2819e915c29676405780cfacf02620575cf79a1 | [] | no_license | sycho0311/eStore | b192c270fcc3961d1f21fdbe680522f1488278eb | 785183b02a1da540581ef9dd508f949d2def5187 | refs/heads/master | 2021-04-06T02:13:52.028901 | 2018-06-01T11:23:11 | 2018-06-01T11:23:11 | 124,499,023 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,084 | java | package kr.ac.hansung.cse.service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import kr.ac.hansung.cse.dao.CartItemDao;
import kr.ac.hansung.cse.model.Cart;
import kr.ac.hansung.cse.model.CartItem;
@Service
public class CartItemService {
@Autowired
private CartItemDao cartItemDao;
public void addCartItem(CartItem cartItem) {
cartItemDao.addCartItem(cartItem);
}
public void removeCartItem(CartItem cartItem) {
cartItemDao.removeCartItem(cartItem);
}
public void removeAllCartItems(Cart cart) {
cartItemDao.removeAllCartItems(cart);
}
public CartItem getCartItemByProductId(int cartId, int productId) {
return cartItemDao.getCartItemByProductId(cartId, productId);
}
public boolean plusItem(CartItem cartItem, double totalPrice, int unitInStock) {
return cartItemDao.plusItem(cartItem, totalPrice, unitInStock);
}
public boolean minusItem(CartItem cartItem, double totalPrice) {
return cartItemDao.minusItem(cartItem, totalPrice);
}
}
| [
"sycho0311@gmail.com"
] | sycho0311@gmail.com |
853c6fa756773f54ddeec68207e98b4d1c998ba0 | bbea1076ba63efefe9d09d7c61a2231fc372ad75 | /src/trunk/SoftFoodTestCase/src/it/softfood/test/userfacade/logout/TC2.java | 909f14a352c3d279019dd3ffa0cbdcc4e8824d84 | [] | no_license | asilipo/softfood | d7f4cb852690610702d1356ecadf884700e8ecdd | 41c6baeb070ec04fa3abe5ea406f576103f0c9db | refs/heads/master | 2021-01-10T13:58:23.720475 | 2009-06-26T10:34:20 | 2009-06-26T10:34:20 | 51,141,148 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,490 | java | package it.softfood.test.userfacade.logout;
import it.softfood.entity.User;
import it.softfood.enumeration.Ruolo;
import it.softfood.handler.IUserFacade;
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
import junit.framework.TestCase;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
/**
* @author Maria Rosaria Paone
* @author Marco Grasso
* @author Francesco Pacilio
*/
public class TC2 extends TestCase {
private IUserFacade userFacade;
@SuppressWarnings("unused")
private User user;
@Before
public void setUp() throws Exception {
System.setProperty("java.security.policy", "polis.policy");
if (System.getSecurityManager() == null) {
System.setSecurityManager(new SecurityManager());
}
try {
Registry registry = LocateRegistry.getRegistry("localhost");
userFacade = (IUserFacade) registry.lookup("UserFacade");
} catch (Exception e) {
System.err.println("Exception to obtain the reference to the remote object: " + e);
fail("Exception");
}
user = userFacade.login(Ruolo.AMMINISTRATORE, "123456");
}
@After
public void tearDown() throws Exception {
}
@Test
public void testLogout() {
boolean state = true;
try {
userFacade.logout(null);
} catch (RemoteException e) {
fail("RemoteException");
} catch (Exception e) {
state = false;
}
assertTrue(state);
}
}
| [
"fpacilio@gmail.com"
] | fpacilio@gmail.com |
82f6471e32553728bced68d596e957be506d85dd | 756237569f046fe0207f095ae0552fa1becb6b22 | /app/src/main/java/com/gmm/asasystembar/DemoActivity.java | 84998f6e34f3b77c3857989201adba20b146f8f8 | [] | no_license | zhangquanit/UI-StatusBar | 80a5da232b23c9fbc1f50f1cbbdbbcdd4f1ac727 | 6087821d85a8b5d665eb3217fae68d53fae82895 | refs/heads/master | 2021-10-10T18:28:12.964292 | 2019-01-15T08:58:54 | 2019-01-15T08:58:54 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,021 | java | package com.gmm.asasystembar;
import android.annotation.TargetApi;
import android.content.Context;
import android.graphics.Color;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.IntRange;
import android.support.annotation.RequiresApi;
import android.support.v7.app.AppCompatActivity;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.FrameLayout;
public class DemoActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_demo);
//clear all flag
findViewById(R.id.clear_all).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
getWindow().getDecorView().setSystemUiVisibility(0);
}
});
/**
* show lightStatusBar require api 23
* 小米魅族等需要单独设置
* MIUI 6+ FlyMe 4+
*/
findViewById(R.id.lightStatusBar).setOnClickListener(new View.OnClickListener() {
@TargetApi(Build.VERSION_CODES.M)
@Override
public void onClick(View view) {
int flag = getWindow().getDecorView().getSystemUiVisibility();
// flag |= View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
//
//// flag |=(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS
//// | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
// getWindow().getDecorView().setSystemUiVisibility(flag);
// getWindow().setStatusBarColor(Color.TRANSPARENT);
View decor = getWindow().getDecorView();
flag |= (WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS
| View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
getWindow().setStatusBarColor(Color.TRANSPARENT);
decor.setSystemUiVisibility(flag);
}
});
//show transparentStatusBar require api 21
/**
* Android 5.0 ~ Android 6.0
* Android 5.0 之后我们可以对状态栏进行着色,通过设置flag
*/
findViewById(R.id.transparentStatusBar).setOnClickListener(new View.OnClickListener() {
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
@Override
public void onClick(View view) {
int flag = getWindow().getDecorView().getSystemUiVisibility();
flag |= View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_STABLE;
getWindow().setStatusBarColor(Color.TRANSPARENT); //设置状态栏颜色
getWindow().getDecorView().setSystemUiVisibility(flag);
}
});
//add decorview
findViewById(R.id.add_decocview).setOnClickListener(new View.OnClickListener() {
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
@Override
public void onClick(View view) {
/* AsaSystemBar.from(DemoActivity.this)
.addStatusBarView(true)
.process();*/
int flag = getWindow().getDecorView().getSystemUiVisibility();
flag |= View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_STABLE;
getWindow().setStatusBarColor(Color.TRANSPARENT);
getWindow().getDecorView().setSystemUiVisibility(flag);
ViewGroup viewGroup = (ViewGroup) getWindow().getDecorView();
setupStatusBarView(DemoActivity.this, viewGroup);
}
});
}
/**
* see {@link <a href="https://github.com/jgilfelt/SystemBarTint"></a>}
*/
private View mStatusBarTintView;
private void setupStatusBarView(Context context, ViewGroup decorViewGroup) {
mStatusBarTintView = new View(context);
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, getStatusBarOffsetPx(context));
params.gravity = Gravity.TOP;
/* if (mNavBarAvailable && !mConfig.isNavigationAtBottom()) {
params.rightMargin = mConfig.getNavigationBarWidth();
}*/
mStatusBarTintView.setLayoutParams(params);
mStatusBarTintView.setBackgroundColor(Color.RED);
decorViewGroup.addView(mStatusBarTintView);
}
@IntRange(from = 0, to = 75) public static int getStatusBarOffsetPx(Context context) {
Context appContext = context.getApplicationContext();
int result = 0;
int resourceId =
appContext.getResources().getIdentifier("status_bar_height", "dimen", "android");
if (resourceId > 0) {
result = appContext.getResources().getDimensionPixelSize(resourceId);
}
return result;
}
}
| [
"zhangquanit@126.com"
] | zhangquanit@126.com |
9fd21a57cbd2501874ab9dc7961276724b76cdee | b6175afbb4b8623eabb4af95d9d01deb991d322c | /src/java/rentalCar/AdminLoginDao.java | 27277950698e4102ccaf20d82556ccfc296e2526 | [] | no_license | amolswnz/Rent-a-car | a14512872b9a62ec7cdd1f2344bfb48e9e43396b | 17139cd782a492daa373adfa36d380f6360e78d4 | refs/heads/master | 2020-12-04T17:07:05.562884 | 2016-08-24T08:17:35 | 2016-08-24T08:17:35 | 66,445,053 | 3 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,548 | java | /*
* STD611 Java 2 - Assignment
* Application 2 (using JSP technology)
* by Amol Wankhede
* Student ID - TIZ00002TI
*
* Java class used to verify email and password stored in the database
Database name: java
Entity name: user
*/
package rentalCar;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.Arrays;
/**
*
* @author Amol Wankhede
*/
public class AdminLoginDao {
static String returnString = null;
public static String checkLogin(User bean) {
try {
// Get connection object from ConnectionProvider.java
Connection conn = ConnectionProvider.getConnection();
// Prepare SQL query
PreparedStatement ps = conn.prepareStatement("SELECT * FROM User, Staff WHERE email=? AND pwd=? AND user.userId = Staff.userId");
ps.setString(1, bean.getEmail()); // set first parameter to email
ps.setString(2, bean.getPwd()); // set second parameter to password
System.out.println(bean.getEmail());
System.out.println(bean.getPwd());
ResultSet rs = ps.executeQuery(); // get the result of the SQL query
if (rs.next()) {
returnString = String.valueOf(rs.getInt("userId")) + "-" + rs.getString("staffType")+ "-" + rs.getString("name");
} else {
returnString = "error";
}
} catch (Exception ex) {
returnString = "exception";
}
return returnString;
}
}
| [
"amolsw.nz@gmail.com"
] | amolsw.nz@gmail.com |
2e3c973c8a439f21a8e5cc6cb507cdbf37389948 | 934ca1193f548f464209668d881af11ee36b7dc8 | /RuoYi_online/ruoyi-common/src/main/java/com/ruoyi/common/enums/BusinessType.java | 3558c83492701486223c5f54c508a7f1acb7de45 | [
"MIT"
] | permissive | tiandaqing1985/xphl_adPuting | 33ef7acddcc9eb3666c405dc80711ea65b72e397 | d60bdf419efc44a36d9f4ddb17b647f38c89d2b8 | refs/heads/master | 2022-12-06T14:27:58.140775 | 2020-06-17T02:12:07 | 2020-06-17T02:12:07 | 206,768,940 | 0 | 0 | null | 2022-12-05T23:44:40 | 2019-09-06T10:17:12 | HTML | UTF-8 | Java | false | false | 554 | java | package com.ruoyi.common.enums;
/**
* 业务操作类型
*
* @author ruoyi
*/
public enum BusinessType
{
/**
* 其它
*/
OTHER,
/**
* 新增
*/
INSERT,
/**
* 修改
*/
UPDATE,
/**
* 删除
*/
DELETE,
/**
* 授权
*/
GRANT,
/**
* 导出
*/
EXPORT,
/**
* 导入
*/
IMPORT,
/**
* 强退
*/
FORCE,
/**
* 生成代码
*/
GENCODE,
/**
* 清空
*/
CLEAN,
}
| [
"ilike001999@aliyun.com"
] | ilike001999@aliyun.com |
eb7ccd7dbbd612167270303bfc2ebfe2e07d6ba8 | 25c63b83a1f412e59108115814734075e98e0d15 | /src/cn/digitalpublishing/util/PoiClass.java | 7f835889587dfbad31e1c7a413ee5077a027b166 | [] | no_license | yxxcrtd/ContentResource | 224918bd876a942a8ac72d74897b50efcec041d5 | 74d52c53d7e7e47ae05b173b9eec5e54a66fd11e | refs/heads/master | 2020-05-31T21:29:12.374579 | 2019-06-06T02:20:05 | 2019-06-06T02:20:05 | 190,499,218 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,400 | java | package cn.digitalpublishing.util;
import java.io.FileInputStream;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import org.apache.poi.hssf.usermodel.HSSFDateUtil;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.usermodel.WorkbookFactory;
public class PoiClass {
private Workbook workbook = null; // 工作部对象
private List<HashMap<String,Object>> mapData=null;
private String[] header=null;
private Sheet sheet = null; // 工作表
public int totalRows = 0; // 总行数
public int totalColumns = 0; // 总列数
public String[] getHeader() {
return header;
}
public void setHeader(String[] header) {
this.header = header;
}
public List<HashMap<String,Object>> getDatas(){
return mapData;
}
public PoiClass(String filename) throws Exception{
this(new FileInputStream(filename));
}
public PoiClass(FileInputStream inputStream) throws Exception {
workbook = WorkbookFactory.create(inputStream);
if(workbook.getNumberOfSheets()>0){
this.sheet = this.workbook.getSheetAt(0);
this.totalRows=this.sheet.getPhysicalNumberOfRows();
//System.out.println("Sheet0\"" + sheet + "\" has " + totalRows + " row(s).");
if(totalRows>0){
this.totalColumns=this.sheet.getRow(0).getPhysicalNumberOfCells();
//System.out.println("Sheet0\"" + sheet + "\" has " + totalColumns + " colume(s).");
}
}
}
public boolean Parse(Boolean hasheader)throws Exception{
try {
if(sheet!=null){
Boolean headComplate=false;
mapData=new ArrayList<HashMap<String,Object>>();
Integer rows = sheet.getPhysicalNumberOfRows();
if(hasheader && !headComplate){
header=new String[totalColumns];
}
for (int r = 0; r < rows; r++) {
// 表格首行为列标题,提取列标题---------------------
Row row = sheet.getRow(r);
if (row == null) {
continue;
}
HashMap<String,Object> map=(hasheader && !headComplate)?null:new HashMap<String,Object>();
for (int c = 0; c < totalColumns; c++) {
String value=null;
Cell cell = row.getCell(c);
if(cell!=null){
if (cell.getCellType() == Cell.CELL_TYPE_STRING)
value= cell.getStringCellValue();
else if (cell.getCellType() == Cell.CELL_TYPE_NUMERIC){
if(HSSFDateUtil.isCellDateFormatted(cell)){
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
value =sdf.format(HSSFDateUtil.getJavaDate(cell.getNumericCellValue()));
}else{
DecimalFormat df = new DecimalFormat("0");
value = df.format(cell.getNumericCellValue());
}
}
}
if (hasheader && !headComplate){
if(value==null || "".equals(value.trim())){
throw new Exception("标题行不能包含空值!");
}
header[c]=value.trim().toLowerCase();
if(c+1==totalColumns){
headComplate=true;
}
continue;
}
if(map!=null){
map.put(header[c], value);
}
}
if(map!=null){
mapData.add(map);
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
return true;
}
public static void main(String[] args) throws Exception {
String excel="C:\\Users\\jack\\Desktop\\date.xlsx";
PoiClass pc=new PoiClass(excel);
pc.Parse(true);
// List<String> excels=FileUtil.getFiles("C:\\Users\\jack\\Desktop\\upload\\ashgate", "*.xls", false);
// if(excels!=null &&excels.size()>0){
// for(String str:excels){
// PoiClass pc=new PoiClass(str);
// pc.Parse(true);
// String[] header=pc.getHeader();
// if(!pc.getDatas().get(0).containsKey("bic") && !pc.getDatas().get(0).containsKey("subjecttype(bic/bisac/dewey)")){
// System.out.println(str);
// }
// if(header!=null &&header.length>0){
// for(String h:header){
// System.out.print(h + "\t");
// }
// }else{
// System.out.print("错误!" + str);
// }
// System.out.print("\n");
// }
//
// }
}
}
| [
"yxxcrtd@gmail.com"
] | yxxcrtd@gmail.com |
09840377e24b2a953386a026c1173bdb4da903e9 | bb1eae2ebae3b114a63d454c9716fe00a38db5cb | /android/src/main/java/com/robertsheao/RNZenDeskSupport/SupportActivityBullder.java | 567542aec9ef432cb62a0db2e5a4f0c8e10b018e | [
"MIT"
] | permissive | synapsestudios/react-native-zendesk-support | 3929e5bd598e5e72b40cf6143c9db59595fe67cc | f6c03a5b1b0918a0ed3db0831c9896426398319e | refs/heads/master | 2021-07-13T03:51:32.805085 | 2020-06-11T21:13:59 | 2020-06-11T21:13:59 | 143,052,038 | 24 | 27 | MIT | 2020-06-11T20:53:05 | 2018-07-31T18:26:16 | Objective-C | UTF-8 | Java | false | false | 6,151 | java | package com.robertsheao.RNZenDeskSupport;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.bridge.ReadableMap;
import com.zendesk.logger.Logger;
import com.zendesk.sdk.feedback.WrappedZendeskFeedbackConfiguration;
import com.zendesk.sdk.feedback.ZendeskFeedbackConfiguration;
import com.zendesk.sdk.support.ContactUsButtonVisibility;
import com.zendesk.sdk.support.SupportActivity;
import com.zendesk.util.CollectionUtils;
import java.io.Serializable;
import java.util.ArrayList;
/**
* Created by Patrick O'Connor on 11/8/17.
* This is a mostly a copy of Zendesk's SupportActivity.Builder.class, modified slightly to allow configuration from the React Native module.
* It also adds the Intent.FLAG_ACTIVITY_NEW_TASK flag to the created Intent, fixing a crashing bug in older versions of Android.
* https://github.com/RobertSheaO/react-native-zendesk-support
*/
class SupportActivityBuilder {
private final Bundle args = new Bundle();
private SupportActivityBuilder() {
}
private static long[] toLongArray(ArrayList<?> values) {
long[] arr = new long[values.size()];
for (int i = 0; i < values.size(); i++)
arr[i] = Long.parseLong((String) values.get(i));
return arr;
}
static SupportActivityBuilder create() {
SupportActivityBuilder builder = new SupportActivityBuilder();
builder.showConversationsMenuButton(true);
builder.withArticleVoting(true);
builder.withContactUsButtonVisibility(ContactUsButtonVisibility.ARTICLE_LIST_AND_ARTICLE);
return builder;
}
SupportActivityBuilder withOptions(ReadableMap options) {
if (!(options == null || options.toHashMap().isEmpty())) {
if (options.hasKey("showConversationsMenuButton")) {
this.showConversationsMenuButton(options.getBoolean("showConversationsMenuButton"));
}
if (options.hasKey("articleVotingEnabled")) {
this.withArticleVoting(options.getBoolean("articleVotingEnabled"));
}
if (options.hasKey("withContactUsButtonVisibility")) {
switch(options.getString("withContactUsButtonVisibility")) {
case "OFF":
withContactUsButtonVisibility(ContactUsButtonVisibility.OFF);
break;
case "ARTICLE_LIST_ONLY":
withContactUsButtonVisibility(ContactUsButtonVisibility.ARTICLE_LIST_ONLY);
break;
case "ARTICLE_LIST_AND_ARTICLE":
default:
withContactUsButtonVisibility(ContactUsButtonVisibility.ARTICLE_LIST_AND_ARTICLE);
}
}
}
return this;
}
SupportActivityBuilder withArticlesForCategoryIds(ReadableArray categoryIds) {
return withArticlesForCategoryIds(toLongArray(categoryIds.toArrayList()));
}
private SupportActivityBuilder withArticlesForCategoryIds(long... categoryIds) {
if(this.args.getLongArray("extra_section_ids") != null) {
Logger.w("SupportActivity", "Builder: sections have already been specified. Removing section IDs to set category IDs.", new Object[0]);
this.args.remove("extra_section_ids");
}
this.args.putLongArray("extra_category_ids", categoryIds);
return this;
}
SupportActivityBuilder withArticlesForSectionIds(ReadableArray sectionIds) {
return withArticlesForSectionIds(toLongArray(sectionIds.toArrayList()));
}
private SupportActivityBuilder withArticlesForSectionIds(long... sectionIds) {
if(this.args.getLongArray("extra_category_ids") != null) {
Logger.w("SupportActivity", "Builder: categories have already been specified. Removing category IDs to set section IDs.", new Object[0]);
this.args.remove("extra_category_ids");
}
this.args.putLongArray("extra_section_ids", sectionIds);
return this;
}
/** @deprecated */
SupportActivityBuilder showContactUsButton(boolean showContactUsButton) {
this.args.putSerializable("extra_contact_us_button_visibility", showContactUsButton? ContactUsButtonVisibility.ARTICLE_LIST_ONLY:ContactUsButtonVisibility.OFF);
return this;
}
private SupportActivityBuilder withContactUsButtonVisibility(ContactUsButtonVisibility contactUsButtonVisibility) {
this.args.putSerializable("extra_contact_us_button_visibility", contactUsButtonVisibility);
return this;
}
private SupportActivityBuilder withContactConfiguration(ZendeskFeedbackConfiguration configuration) {
if(configuration != null) {
configuration = new WrappedZendeskFeedbackConfiguration((ZendeskFeedbackConfiguration)configuration);
}
this.args.putSerializable("extra_contact_configuration", (Serializable)configuration);
return this;
}
//noinspection SuspiciousToArrayCall
SupportActivityBuilder withLabelNames(ReadableArray labelNames) {
return withLabelNames(labelNames.toArrayList().toArray(new String[]{}));
}
private SupportActivityBuilder withLabelNames(String... labelNames) {
if(CollectionUtils.isNotEmpty(labelNames)) {
this.args.putStringArray("extra_label_names", labelNames);
}
return this;
}
private SupportActivityBuilder withCategoriesCollapsed(boolean categoriesCollapsed) {
this.args.putBoolean("extra_categories_collapsed", categoriesCollapsed);
return this;
}
private SupportActivityBuilder showConversationsMenuButton(boolean showConversationsMenuButton) {
this.args.putBoolean("extra_show_conversations_menu_button", showConversationsMenuButton);
return this;
}
private SupportActivityBuilder withArticleVoting(boolean articleVotingEnabled) {
this.args.putBoolean("article_voting_enabled", articleVotingEnabled);
return this;
}
void show(Context context) {
Logger.d("SupportActivity", "show: showing SupportActivity", new Object[0]);
context.startActivity(this.intent(context));
}
private Intent intent(Context context) {
Logger.d("SupportActivity", "intent: creating Intent", new Object[0]);
Intent intent = new Intent(context, SupportActivity.class);
intent.putExtras(this.args);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
return intent;
}
}
| [
"austin.west@gmail.com"
] | austin.west@gmail.com |
6f8699bdef2f2b62d3009641b401ddcf83a553c9 | 2ab03c4f54dbbb057beb3a0349b9256343b648e2 | /JavaAdvanced/JAdvancedStringExercises/src/SumBigNumbers.java | 80ec9df3564fcb209150d194c9ca8a21626f08bd | [
"MIT"
] | permissive | tabria/Java | 8ef04c0ec5d5072d4e7bf15e372e7c2b600a1cea | 9bfc733510b660bc3f46579a1cc98ff17fb955dd | refs/heads/master | 2021-05-05T11:50:05.175943 | 2018-03-07T06:53:54 | 2018-03-07T06:53:54 | 104,714,168 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,837 | java | import java.util.Scanner;
public class SumBigNumbers {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
String numberOne = new StringBuilder(scanner.nextLine()).reverse().toString();
String numberTwo = new StringBuilder(scanner.nextLine()).reverse().toString();
numberOne = removeLeadingZeros(numberOne);
numberTwo = removeLeadingZeros(numberTwo);
StringBuilder sb = new StringBuilder();
int cycles = numberOne.length() > numberTwo.length() ? numberOne.length() : numberTwo.length();
int offset = 0;
for (int i = 0; i <cycles ; i++) {
int currentNumberOne = getDigitFromNumber(numberOne, i);
int currentNumberTwo = getDigitFromNumber(numberTwo, i);
int sum = currentNumberOne + currentNumberTwo + offset;
int lastDigit = sum % 10;
int deviation = sum -lastDigit;
offset = deviation > 9 ? deviation/10 : deviation ;
sb.append(lastDigit);
}
if (offset !=0) {
sb.append(offset);
}
sb.reverse();
System.out.println(sb.toString());
}
private static String removeLeadingZeros(String numberStr) {
while(true) {
int lastDigit = Character.getNumericValue(numberStr.charAt(numberStr.length()-1));
if(lastDigit == 0) {
numberStr = numberStr.substring(0, numberStr.length()-1);
} else {
break;
}
}
return numberStr;
}
private static int getDigitFromNumber(String numberStr, int index) {
int digit = 0;
try {
digit = Character.getNumericValue(numberStr.charAt(index));
} catch (Exception e ){
}
return digit;
}
}
| [
"forexftg@yahoo.com"
] | forexftg@yahoo.com |
0e95838f697cf61dd7d2188734df636fbebe5635 | 50be786b1bacbb52b8e8d14d48942b24b96550ab | /src/by/it/predkel/MatLab/FloatVar.java | 44250ea731636e966b8503e241ca1e02c59af03b | [] | no_license | sleightsou/JD2016 | 83bcaf9a7a27b89f6adebb64475a114a2a193158 | bc8d0b9871c20951e2bfe6490a38719c9c383b69 | refs/heads/master | 2021-01-18T12:59:50.691746 | 2016-03-14T07:50:59 | 2016-03-14T07:50:59 | 51,425,668 | 0 | 0 | null | 2016-02-10T06:54:37 | 2016-02-10T06:54:37 | null | UTF-8 | Java | false | false | 1,796 | java | package by.it.predkel.MatLab;
import java.io.IOException;
/**
* Created by Admin on 19.02.2016.
*/
public class FloatVar extends Var {
double val;
public FloatVar(double value){
this.val = value;
}
public FloatVar(String str) throws IOException {
setForm(str);
}
@Override
public int intValue() {
return (int)this.val;
}
@Override
public long longValue() {
return (long)this.val;
}
@Override
public float floatValue() {
return (float)this.val;
}
@Override
public double doubleValue() {
return this.val;
}
@Override
public Var add (Var value){
if (value instanceof FloatVar){
return new FloatVar(val+=((FloatVar) value).val);
}
return value.add(this);
}
@Override
public Var mul (Var value){
if (value instanceof FloatVar){
return new FloatVar(val*=((FloatVar)value).val);
}
return value.mul(this);
}
@Override
public Var sub (Var value){
if (value instanceof FloatVar){
return new FloatVar(val-=((FloatVar)value).val);
}
FloatVar minus=new FloatVar(-1);
return minus.mul(value.sub(this));
}
@Override
public Var div (Var value){
if (value instanceof FloatVar){
{
if (((FloatVar) value).val==0){
throw new ArithmeticException();}
}
return new FloatVar(val/=((FloatVar)value).val);
}
return value.div(this);
}
@Override
public void outPut(){
System.out.println(val);
}
@Override
public void setForm(String str) throws IOException {
val=Double.parseDouble(str);
}
} | [
"slouch@bk.ru"
] | slouch@bk.ru |
c855bdcc121e7cd627b7400bff0b7a0ee5fa101c | 8e6ce5b9415e60398109df0827661beed1d6ebce | /ProyectoFinal_JavaGeneration/src/main/java/com/ejemplos/spring/service/CargoService.java | acf4a23e24e6dcce77abb7819727f62250d4174b | [] | no_license | oscest320/ProyectoFinal | 61469d6e6bc6fe1fc273347691c1ea3c1cda050a | e8013f782b947192dafb9f9344d00bc42c180e3e | refs/heads/main | 2023-05-02T11:08:11.911195 | 2021-05-20T08:16:02 | 2021-05-20T08:16:02 | 366,988,407 | 0 | 0 | null | 2021-05-13T08:46:40 | 2021-05-13T08:46:39 | null | UTF-8 | Java | false | false | 245 | java | package com.ejemplos.spring.service;
import java.util.List;
import com.ejemplos.spring.model.Cargo;
public interface CargoService {
//Metodo que muestra un listado de los cargos guardados en la BBDD
public List<Cargo> listarCargos();
}
| [
"oscest320@gmail.com"
] | oscest320@gmail.com |
1029710ee5dd28454626d03a4b29c2bce665845d | 7b81c76a9a51879ba0b5d886fbd61016c28f97b8 | /app/src/main/java/com/lucaspellegrinelli/busao/googleapi/WebsiteRequest.java | 37e8b7af67fa836efc00f6239c5092eaba95e475 | [] | no_license | lucaspellegrinelli/busshade | 1db94656a263ec97af3ad4dde3fa3aa0262da0bb | 7843df3f6a28f0669da0eb29d016d71f6412d71c | refs/heads/master | 2020-12-10T01:41:49.650946 | 2020-01-12T23:42:56 | 2020-01-12T23:42:56 | 233,472,954 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,301 | java | package com.lucaspellegrinelli.busao.googleapi;
/**
* Created by lucas on 09-Feb-17.
*/
import android.os.AsyncTask;
import android.util.Log;
import org.json.JSONException;
import org.json.JSONObject;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
public class WebsiteRequest extends AsyncTask<Void, Void, JSONObject>{
private String requestUrl;
private PostExecute postExecute;
public WebsiteRequest(String requestUrl, PostExecute postExecute){
this.requestUrl = requestUrl;
this.postExecute = postExecute;
}
@Override
protected JSONObject doInBackground(Void... params) {
try {
URL url = new URL(requestUrl);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("GET");
conn.setRequestProperty("Accept", "application/json");
BufferedReader br = new BufferedReader(new InputStreamReader((conn.getInputStream())));
String allText = "";
String output;
while ((output = br.readLine()) != null) {
allText += output;
}
conn.disconnect();
return new JSONObject(allText);
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (JSONException e) {
e.printStackTrace();
}
return null;
}
@Override
protected void onPostExecute(JSONObject result) {
if(postExecute != null && result != null){
postExecute.postAction(result);
}
}
private Document getDocFromUrl(String url) {
final String USER_AGENT = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36";
Document doc = null;
try {
doc = Jsoup.connect(url).userAgent(USER_AGENT).get();
} catch (IOException e) {
}
return doc;
}
}
| [
"lucas.pellegrinelli@hotmail.com"
] | lucas.pellegrinelli@hotmail.com |
b1465167abe79188c0a38120000d52cfd9676acb | e9015a35667d45b5cb7d98329abc76e95679492b | /src/main/java/com/mtons/mblog/modules/service/impl/PostServiceImpl.java | 8a20d19c3c0fb29225f85f3058dc73b4f9864b04 | [] | no_license | haoyong4039/mblog | 3e8c983bfc55c613a5e1ad3d140c2be1e26b22ca | c19093525145a113635492884a2d6698b3c22a99 | refs/heads/master | 2022-12-13T22:06:14.803603 | 2020-09-04T08:08:38 | 2020-09-04T08:08:38 | 291,607,270 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 16,251 | java | /*
+--------------------------------------------------------------------------
| Mblog [#RELEASE_VERSION#]
| ========================================
| Copyright (c) 2014, 2015 mtons. All Rights Reserved
| http://www.mtons.com
|
+---------------------------------------------------------------------------
*/
package com.mtons.mblog.modules.service.impl;
import com.mtons.mblog.base.lang.Consts;
import com.mtons.mblog.base.utils.*;
import com.mtons.mblog.modules.aspect.PostStatusFilter;
import com.mtons.mblog.modules.data.PostVO;
import com.mtons.mblog.modules.data.UserVO;
import com.mtons.mblog.modules.entity.*;
import com.mtons.mblog.modules.event.PostUpdateEvent;
import com.mtons.mblog.modules.repository.ResourceRepository;
import com.mtons.mblog.modules.repository.PostAttributeRepository;
import com.mtons.mblog.modules.repository.PostResourceRepository;
import com.mtons.mblog.modules.repository.PostRepository;
import com.mtons.mblog.modules.service.*;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.ListUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.data.domain.*;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;
import javax.persistence.criteria.Predicate;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
/**
* @author langhsu
*
*/
@Service
@Transactional
public class PostServiceImpl implements PostService {
@Autowired
private PostRepository postRepository;
@Autowired
private PostAttributeRepository postAttributeRepository;
@Autowired
private UserService userService;
@Autowired
private FavoriteService favoriteService;
@Autowired
private ChannelService channelService;
@Autowired
private TagService tagService;
@Autowired
private ApplicationContext applicationContext;
@Autowired
private PostResourceRepository postResourceRepository;
@Autowired
private ResourceRepository resourceRepository;
private static Pattern pattern = Pattern.compile("(?<=/_signature/)(.+?)(?=\\.)");
@Override
@PostStatusFilter
public Page<PostVO> paging(Pageable pageable, int channelId, Set<Integer> excludeChannelIds, int agentState, String tag) {
Page<Post> page = postRepository.findAll((root, query, builder) -> {
Predicate predicate = builder.conjunction();
if (channelId > Consts.ZERO) {
predicate.getExpressions().add(
builder.equal(root.get("channelId").as(Integer.class), channelId));
}
if (null != excludeChannelIds && !excludeChannelIds.isEmpty()) {
predicate.getExpressions().add(
builder.not(root.get("channelId").in(excludeChannelIds)));
}
// predicate.getExpressions().add(
// builder.equal(root.get("featured").as(Integer.class), Consts.FEATURED_DEFAULT));
// 普通用户不能查询仅代理商可见的文章
if (agentState != 1) {
predicate.getExpressions().add(
builder.equal(root.get("state").as(Integer.class), agentState));
}
// 根据标签查询
if (!"all".equals(tag)) {
predicate.getExpressions().add(
builder.equal(root.get("tags").as(String.class), tag));
}
return predicate;
}, pageable);
// page = postRepository.findAllByState(pageable, agentState);
return new PageImpl<>(toPosts(page.getContent()), pageable, page.getTotalElements());
}
@Override
public Page<PostVO> paging4Admin(Pageable pageable, int channelId, String title) {
Page<Post> page = postRepository.findAll((root, query, builder) -> {
Predicate predicate = builder.conjunction();
if (channelId > Consts.ZERO) {
predicate.getExpressions().add(
builder.equal(root.get("channelId").as(Integer.class), channelId));
}
if (StringUtils.isNotBlank(title)) {
predicate.getExpressions().add(
builder.like(root.get("title").as(String.class), "%" + title + "%"));
}
return predicate;
}, pageable);
return new PageImpl<>(toPosts(page.getContent()), pageable, page.getTotalElements());
}
@Override
@PostStatusFilter
public Page<PostVO> pagingByAuthorId(Pageable pageable, long userId) {
Page<Post> page = postRepository.findAllByAuthorId(pageable, userId);
return new PageImpl<>(toPosts(page.getContent()), pageable, page.getTotalElements());
}
@Override
@PostStatusFilter
public List<PostVO> findLatestPosts(int maxResults, int agentState) {
return find("created", maxResults, agentState).stream().map(BeanMapUtils::copy).collect(Collectors.toList());
}
@Override
@PostStatusFilter
public List<PostVO> findHottestPosts(int maxResults, int agentState) {
return find("views", maxResults, agentState).stream().map(BeanMapUtils::copy).collect(Collectors.toList());
}
@Override
@PostStatusFilter
public Map<Long, PostVO> findMapByIds(Set<Long> ids) {
if (ids == null || ids.isEmpty()) {
return Collections.emptyMap();
}
List<Post> list = postRepository.findAllById(ids);
Map<Long, PostVO> rets = new HashMap<>();
HashSet<Long> uids = new HashSet<>();
list.forEach(po -> {
rets.put(po.getId(), BeanMapUtils.copy(po));
uids.add(po.getAuthorId());
});
// 加载用户信息
buildUsers(rets.values(), uids);
return rets;
}
@Override
@Transactional(rollbackFor = Throwable.class)
public long post(PostVO post) {
Post po = new Post();
BeanUtils.copyProperties(post, po);
po.setCreated(new Date());
po.setStatus(post.getStatus());
// 处理摘要
if (StringUtils.isBlank(post.getSummary())) {
po.setSummary(trimSummary(post.getEditor(), post.getContent()));
} else {
po.setSummary(post.getSummary());
}
postRepository.save(po);
tagService.batchUpdate(po.getTags(), po.getId());
String key = ResourceLock.getPostKey(po.getId());
AtomicInteger lock = ResourceLock.getAtomicInteger(key);
try {
synchronized (lock){
PostAttribute attr = new PostAttribute();
attr.setContent(post.getContent());
attr.setEditor(post.getEditor());
attr.setId(po.getId());
postAttributeRepository.save(attr);
countResource(po.getId(), null, attr.getContent());
onPushEvent(po, PostUpdateEvent.ACTION_PUBLISH);
return po.getId();
}
}finally {
ResourceLock.giveUpAtomicInteger(key);
}
}
@Override
public PostVO get(long id) {
Optional<Post> po = postRepository.findById(id);
if (po.isPresent()) {
PostVO d = BeanMapUtils.copy(po.get());
d.setAuthor(userService.get(d.getAuthorId()));
d.setChannel(channelService.getById(d.getChannelId()));
PostAttribute attr = postAttributeRepository.findById(d.getId()).get();
d.setContent(attr.getContent());
d.setEditor(attr.getEditor());
return d;
}
return null;
}
/**
* 更新文章方法
* @param p
*/
@Override
@Transactional(rollbackFor = Throwable.class)
public void update(PostVO p){
Optional<Post> optional = postRepository.findById(p.getId());
if (optional.isPresent()) {
String key = ResourceLock.getPostKey(p.getId());
AtomicInteger lock = ResourceLock.getAtomicInteger(key);
try {
synchronized (lock){
Post po = optional.get();
po.setTitle(p.getTitle());//标题
po.setChannelId(p.getChannelId());
po.setThumbnail(p.getThumbnail());
po.setStatus(p.getStatus());
po.setState(p.getState());
// 处理摘要
if (StringUtils.isBlank(p.getSummary())) {
po.setSummary(trimSummary(p.getEditor(), p.getContent()));
} else {
po.setSummary(p.getSummary());
}
po.setTags(p.getTags());//标签
// 保存扩展
Optional<PostAttribute> attributeOptional = postAttributeRepository.findById(po.getId());
String originContent = "";
if (attributeOptional.isPresent()){
originContent = attributeOptional.get().getContent();
}
PostAttribute attr = new PostAttribute();
attr.setContent(p.getContent());
attr.setEditor(p.getEditor());
attr.setId(po.getId());
postAttributeRepository.save(attr);
tagService.batchUpdate(po.getTags(), po.getId());
countResource(po.getId(), originContent, p.getContent());
}
}finally {
ResourceLock.giveUpAtomicInteger(key);
}
}
}
@Override
@Transactional(rollbackFor = Throwable.class)
public void updateFeatured(long id, int featured) {
Post po = postRepository.findById(id).get();
int status = Consts.FEATURED_ACTIVE == featured ? Consts.FEATURED_ACTIVE: Consts.FEATURED_DEFAULT;
po.setFeatured(status);
postRepository.save(po);
}
@Override
@Transactional(rollbackFor = Throwable.class)
public void updateWeight(long id, int weighted) {
Post po = postRepository.findById(id).get();
int max = Consts.ZERO;
if (Consts.FEATURED_ACTIVE == weighted) {
max = postRepository.maxWeight() + 1;
}
po.setWeight(max);
postRepository.save(po);
}
@Override
@Transactional(rollbackFor = Throwable.class)
public void delete(long id, long authorId) {
Post po = postRepository.findById(id).get();
// 判断文章是否属于当前登录用户
Assert.isTrue(po.getAuthorId() == authorId, "认证失败");
String key = ResourceLock.getPostKey(po.getId());
AtomicInteger lock = ResourceLock.getAtomicInteger(key);
try {
synchronized (lock){
postRepository.deleteById(id);
postAttributeRepository.deleteById(id);
cleanResource(po.getId());
onPushEvent(po, PostUpdateEvent.ACTION_DELETE);
}
}finally {
ResourceLock.giveUpAtomicInteger(key);
}
}
@Override
@Transactional(rollbackFor = Throwable.class)
public void delete(Collection<Long> ids) {
if (CollectionUtils.isNotEmpty(ids)) {
List<Post> list = postRepository.findAllById(ids);
list.forEach(po -> {
String key = ResourceLock.getPostKey(po.getId());
AtomicInteger lock = ResourceLock.getAtomicInteger(key);
try {
synchronized (lock){
postRepository.delete(po);
postAttributeRepository.deleteById(po.getId());
cleanResource(po.getId());
onPushEvent(po, PostUpdateEvent.ACTION_DELETE);
}
}finally {
ResourceLock.giveUpAtomicInteger(key);
}
});
}
}
@Override
@Transactional(rollbackFor = Throwable.class)
public void identityViews(long id) {
// 不清理缓存, 等待文章缓存自动过期
postRepository.updateViews(id, Consts.IDENTITY_STEP);
}
@Override
@Transactional
public void identityComments(long id) {
postRepository.updateComments(id, Consts.IDENTITY_STEP);
}
@Override
@Transactional(rollbackFor = Throwable.class)
public void favor(long userId, long postId) {
postRepository.updateFavors(postId, Consts.IDENTITY_STEP);
favoriteService.add(userId, postId);
}
@Override
@Transactional(rollbackFor = Throwable.class)
public void unfavor(long userId, long postId) {
postRepository.updateFavors(postId, Consts.DECREASE_STEP);
favoriteService.delete(userId, postId);
}
@Override
@PostStatusFilter
public long count() {
return postRepository.count();
}
@PostStatusFilter
private List<Post> find(String orderBy, int size, int agentState) {
Pageable pageable = PageRequest.of(0, size, Sort.by(Sort.Direction.DESC, orderBy));
Set<Integer> excludeChannelIds = new HashSet<>();
List<Channel> channels = channelService.findAll(Consts.STATUS_CLOSED);
if (channels != null) {
channels.forEach((c) -> excludeChannelIds.add(c.getId()));
}
Page<Post> page = postRepository.findAll((root, query, builder) -> {
Predicate predicate = builder.conjunction();
if (excludeChannelIds.size() > 0) {
predicate.getExpressions().add(
builder.not(root.get("channelId").in(excludeChannelIds)));
}
// 普通用户不能查询仅代理商可见的文章
if (agentState != 1) {
predicate.getExpressions().add(
builder.equal(root.get("state").as(Integer.class), agentState));
}
return predicate;
}, pageable);
return page.getContent();
}
/**
* 截取文章内容
* @param text
* @return
*/
private String trimSummary(String editor, final String text){
if (Consts.EDITOR_MARKDOWN.endsWith(editor)) {
return PreviewTextUtils.getText(MarkdownUtils.renderMarkdown(text), 126);
} else {
return PreviewTextUtils.getText(text, 126);
}
}
private List<PostVO> toPosts(List<Post> posts) {
HashSet<Long> uids = new HashSet<>();
HashSet<Integer> groupIds = new HashSet<>();
List<PostVO> rets = posts
.stream()
.map(po -> {
uids.add(po.getAuthorId());
groupIds.add(po.getChannelId());
return BeanMapUtils.copy(po);
})
.collect(Collectors.toList());
// 加载用户信息
buildUsers(rets, uids);
buildGroups(rets, groupIds);
return rets;
}
private void buildUsers(Collection<PostVO> posts, Set<Long> uids) {
Map<Long, UserVO> userMap = userService.findMapByIds(uids);
posts.forEach(p -> p.setAuthor(userMap.get(p.getAuthorId())));
}
private void buildGroups(Collection<PostVO> posts, Set<Integer> groupIds) {
Map<Integer, Channel> map = channelService.findMapByIds(groupIds);
posts.forEach(p -> p.setChannel(map.get(p.getChannelId())));
}
private void onPushEvent(Post post, int action) {
PostUpdateEvent event = new PostUpdateEvent(System.currentTimeMillis());
event.setPostId(post.getId());
event.setUserId(post.getAuthorId());
event.setAction(action);
applicationContext.publishEvent(event);
}
private void countResource(Long postId, String originContent, String newContent){
if (StringUtils.isEmpty(originContent)){
originContent = "";
}
if (StringUtils.isEmpty(newContent)){
newContent = "";
}
Set<String> exists = extractImageMd5(originContent);
Set<String> news = extractImageMd5(newContent);
List<String> adds = ListUtils.removeAll(news, exists);
List<String> deleteds = ListUtils.removeAll(exists, news);
if (adds.size() > 0) {
List<Resource> resources = resourceRepository.findByMd5In(adds);
List<PostResource> prs = resources.stream().map(n -> {
PostResource pr = new PostResource();
pr.setResourceId(n.getId());
pr.setPostId(postId);
pr.setPath(n.getPath());
return pr;
}).collect(Collectors.toList());
postResourceRepository.saveAll(prs);
resourceRepository.updateAmount(adds, 1);
}
if (deleteds.size() > 0) {
List<Resource> resources = resourceRepository.findByMd5In(deleteds);
List<Long> rids = resources.stream().map(Resource::getId).collect(Collectors.toList());
postResourceRepository.deleteByPostIdAndResourceIdIn(postId, rids);
resourceRepository.updateAmount(deleteds, -1);
}
}
private void cleanResource(long postId) {
List<PostResource> list = postResourceRepository.findByPostId(postId);
if (null == list || list.isEmpty()) {
return;
}
List<Long> rids = list.stream().map(PostResource::getResourceId).collect(Collectors.toList());
resourceRepository.updateAmountByIds(rids, -1);
postResourceRepository.deleteByPostId(postId);
}
private Set<String> extractImageMd5(String text) {
// Pattern pattern = Pattern.compile("(?<=/_signature/)[^/]+?jpg");
Set<String> md5s = new HashSet<>();
Matcher originMatcher = pattern.matcher(text);
while (originMatcher.find()) {
String key = originMatcher.group();
// md5s.add(key.substring(0, key.lastIndexOf(".")));
md5s.add(key);
}
return md5s;
}
}
| [
"yong.hao@wuliangroup.com"
] | yong.hao@wuliangroup.com |
1f8f7953291a6274110f15d0e56a4c905d2bd5c2 | 0dc06e5cc1b49a092245f5caf9ab6ee573b727ec | /TestXidio/src/com/comcast/xidio/testCases/subscription/XidioSubscriptionChannelHighlightedContentTest.java | aad1af1b663d5f3fbaa21a8a8bdf4f4a30abcbf8 | [] | no_license | sandeeptiku2012/ComcastRobotium | d64122d1aa89ba5d19cd2574e07053a933c9a1bb | f9f5d061ba4b09d54ff294aaad346044823c29b5 | refs/heads/master | 2016-09-06T05:43:03.717164 | 2014-01-06T12:56:49 | 2014-01-06T12:56:49 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,885 | java | package com.comcast.xidio.testCases.subscription;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import android.test.ActivityInstrumentationTestCase2;
import android.util.Log;
import android.view.KeyEvent;
import com.comcast.xidio.core.common.GetSolo;
import com.comcast.xidio.core.constant.TestConstants;
import com.comcast.xidio.loginUtil.LoginUtil;
import com.comcast.xidio.model.GetSubscriptionList;
import com.jayway.android.robotium.solo.Solo;
import com.xfinity.xidio.FirstRun;
import com.xfinity.xidio.core.XidioApplication;
public class XidioSubscriptionChannelHighlightedContentTest extends ActivityInstrumentationTestCase2<FirstRun>
{
private Solo solo;
private JSONObject response;
private JSONObject currChannel;
String userId;
public XidioSubscriptionChannelHighlightedContentTest() {
super(FirstRun.class);
}
@Override
protected void setUp() throws Exception {
GetSolo.getInstance().setUpSolo(getInstrumentation(),getActivity());
solo=GetSolo.getInstance().getSoloObject();
solo.sleep(TestConstants.SLEEP_TIME_SETUP);
super.setUp();
}
public void testXidioSubscriptionChannelHighlightedContent()
{
//passing through the first Run Activity
solo.waitForActivity(TestConstants.FIRST_RUN);
solo.sleep(TestConstants.SLEEP_TIME_1000);
LoginUtil.authenticateUser(solo, getInstrumentation());
// solo.sendKey(KeyEvent.KEYCODE_DPAD_UP);
// solo.sendKey(KeyEvent.KEYCODE_DPAD_UP);
// solo.sendKey(KeyEvent.KEYCODE_DPAD_DOWN);
// solo.sendKey(KeyEvent.KEYCODE_DPAD_DOWN);
solo.waitForActivity(TestConstants.MAIN_ACTIVITY);
solo.sleep(TestConstants.SLEEP_TIME_5000);
//starting the test main Activity
JSONArray subscribedChannels = GetSubscriptionList.getInstance().getSubscriptionList(XidioApplication.getLastLoggedInUser());
if(subscribedChannels==null || subscribedChannels.length()==0)
{
solo.sleep(TestConstants.SLEEP_TIME_5000);
solo.sendKey(KeyEvent.KEYCODE_DPAD_DOWN);
solo.sleep(TestConstants.SLEEP_TIME_2000);
solo.sendKey(KeyEvent.KEYCODE_DPAD_DOWN);
solo.sleep(TestConstants.SLEEP_TIME_2000);
solo.sendKey(KeyEvent.KEYCODE_DPAD_CENTER);
solo.sleep(TestConstants.SLEEP_TIME_2000);
assertTrue(solo.searchText(TestConstants.SUBSCRIBE));
solo.sleep(TestConstants.SLEEP_TIME_2000);
solo.sendKey(KeyEvent.KEYCODE_DPAD_RIGHT);
solo.sleep(TestConstants.SLEEP_TIME_2000);
solo.sendKey(KeyEvent.KEYCODE_DPAD_CENTER);
solo.sleep(TestConstants.SLEEP_TIME_5000);
solo.sendKey(KeyEvent.KEYCODE_BACK);
solo.sleep(TestConstants.SLEEP_TIME_2000);
solo.sendKey(KeyEvent.KEYCODE_DPAD_UP);
solo.sleep(TestConstants.SLEEP_TIME_2000);
solo.sendKey(KeyEvent.KEYCODE_DPAD_UP);
subscribedChannels = GetSubscriptionList.getInstance().getSubscriptionList(XidioApplication.getLastLoggedInUser());
}
solo.sleep(TestConstants.SLEEP_TIME_5000);
solo.sendKey(KeyEvent.KEYCODE_DPAD_UP);
solo.sleep(TestConstants.SLEEP_TIME_2000);
solo.sendKey(KeyEvent.KEYCODE_DPAD_RIGHT);
assertTrue(solo.searchText(TestConstants.SUBSCRIPTIONS));
solo.sleep(TestConstants.SLEEP_TIME_2000);
solo.sendKey(KeyEvent.KEYCODE_DPAD_DOWN);
solo.sleep(TestConstants.SLEEP_TIME_2000);
for(int i=0;i<subscribedChannels.length();i++)
{
try {
currChannel=subscribedChannels.getJSONObject(i);
assertTrue(solo.searchText(currChannel.getString("title").trim()));
break;
} catch (JSONException e) {
Log.e("Exception:", "Exception occured in XidioSubscriptionChannelHighlightedContent test", e);
}
}
solo.sendKey(KeyEvent.KEYCODE_BACK);
solo.sleep(TestConstants.SLEEP_TIME_2000);
assertTrue(solo.waitForActivity(TestConstants.MAIN_ACTIVITY));
}
@Override
protected void tearDown() throws Exception {
solo.finishOpenedActivities();
super.tearDown();
}
}
| [
"manju1375@gmail.com"
] | manju1375@gmail.com |
2852aeb949897dab4faa8a29ba4f7e89360ea698 | 1efe99fd4bdd95bef108c5b2d958b6f04c46daf0 | /app/src/main/java/com/o3sa/politician/partymember_fragments/Add_donation.java | 72abff366d562b635315a379cb18647783e71bfe | [] | no_license | Raviteja07-MAD/Politician | 908851b1cf1de0109d770e96e5b678a2e624439a | 4895b8ff26a5fd31d335b4814d53c2c7ff9c4a77 | refs/heads/master | 2022-12-13T15:07:50.032933 | 2020-09-03T13:57:19 | 2020-09-03T13:57:19 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 45,230 | java | package com.o3sa.politician.partymember_fragments;
import android.Manifest;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.DatePickerDialog;
import android.app.Dialog;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Matrix;
import android.graphics.drawable.ColorDrawable;
import android.media.ExifInterface;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.provider.MediaStore;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.DatePicker;
import android.widget.ImageView;
import android.widget.ListPopupWindow;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import com.o3sa.politician.R;
import com.o3sa.politician.circularimageview.CircularImageView;
import com.o3sa.politician.customfonts.CustomButton;
import com.o3sa.politician.customfonts.CustomEditText;
import com.o3sa.politician.customfonts.CustomRegularTextView;
import com.o3sa.politician.servicesparsing.InterNetChecker;
import com.o3sa.politician.sidemenu.SideMenu;
import com.o3sa.politician.storedobjects.CameraUtils;
import com.o3sa.politician.storedobjects.StoredObjects;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.HashMap;
import java.util.Random;
import static android.app.Activity.RESULT_CANCELED;
import static android.app.Activity.RESULT_OK;
public class Add_donation extends Fragment {
CustomEditText dontn_name_edtxt,dontn_cause_edtxt,dontn_amunt_edtxt,dontn_date_edtxt,parent_photo_edtxt;
CircularImageView parent_image;
CustomRegularTextView addkidpick_txt;
//datepicker
DatePickerDialog datePickerDialog;
int year;
int month;
int dayOfMonth;
Calendar calendar;
//capture camera
// Activity request codes
private static final int CAMERA_CAPTURE_IMAGE_REQUEST_CODE = 100;
// key to store image path in savedInstance state
public static final String KEY_IMAGE_STORAGE_PATH = "image_path";
public static final int MEDIA_TYPE_IMAGE = 1;
// Bitmap sampling size
public static final int BITMAP_SAMPLE_SIZE = 8;
// Gallery directory name to store the images or videos
public static final String GALLERY_DIRECTORY_NAME = "ProfileImages";
// Image and Video file extensions
public static final String IMAGE_EXTENSION = "jpg";
private static String imageStoragePath;
protected static final int SELECT_FILE = 1;
private static final int PIC_CROP = 3;
String image_str="";
private Bitmap myImg;
private String fileName;
String file_name;
CustomEditText relation_edtxt;
CustomButton submit_btn;
private ListPopupWindow listPopupWindow;
Bundle bundle;
ArrayList<HashMap<String, String>> parentdetails;
int position;
String[] gnderlst = {"Mother","Father","Grand Father","Grand Mother","Sister","Brother","Uncle","Maid","Nephew"};
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View v = inflater.inflate ( R.layout.adddonation, null , false);
listPopupWindow = new ListPopupWindow(getActivity());
StoredObjects.page_type="Adddonation";
StoredObjects.back_type="Adddonation";
SideMenu.updatemenu(StoredObjects.page_type);
bundle = getArguments();
try {
Log.i("hos_id", "hos_id:--"+bundle);
if (bundle != null) {
parentdetails = (ArrayList<HashMap<String, String>>) bundle.getSerializable("YourHashMap");
position = bundle.getInt( "position" );
}
} catch (Exception e) {
// TODO: handle exception
}
init (v);
/*if (InterNetChecker.isNetworkAvailable(getActivity())) {
new Kidpickedby.GetRealtionTask().execute( StoredObjects.UserId);
}else{
StoredObjects.ToastMethod(getActivity().getResources().getString(R.string.checkinternet),getActivity());
}*/
return v;
}
private void init(View v) {
dontn_name_edtxt = v.findViewById(R.id.dontn_name_edtxt);
dontn_cause_edtxt = v.findViewById(R.id.dontn_cause_edtxt);
dontn_amunt_edtxt = v.findViewById(R.id.dontn_amunt_edtxt);
dontn_date_edtxt = v.findViewById(R.id.dontn_date_edtxt);
parent_photo_edtxt = v.findViewById (R.id.parent_photo_edtxt);
parent_image = v.findViewById (R.id.parent_image);
//relation_edtxt = v.findViewById( R.id.relation_edtxt );
submit_btn = v.findViewById( R.id.submit_btn );
addkidpick_txt = v.findViewById(R.id.addkidpick_txt);
TextView title_txt = (TextView) v.findViewById(R.id.title_txt);
title_txt.setText("Add donation");
ImageView backbtn_img = (ImageView) v.findViewById(R.id.backbtn_img);
backbtn_img.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
FragmentManager fm = getActivity().getSupportFragmentManager();
if (fm.getBackStackEntryCount() > 0) {
fm.popBackStack();
}
// fragmentcallinglay(new Events());
}
});
dontn_date_edtxt.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
StoredObjects.hide_keyboard( getActivity() );
calendar = Calendar.getInstance();
year = calendar.get(Calendar.YEAR);
month = calendar.get(Calendar.MONTH);
dayOfMonth = calendar.get(Calendar.DAY_OF_MONTH);
datePickerDialog = new DatePickerDialog(getActivity(),
new DatePickerDialog.OnDateSetListener() {
@Override
public void onDateSet(DatePicker datePicker, int year, int month, int day) {
dontn_date_edtxt.setText(day + "-" + (month + 1) + "-" + year);
}
}, year, month, dayOfMonth);
datePickerDialog.getDatePicker().setMinDate(System.currentTimeMillis());
datePickerDialog.show();
}
});
/*
relation_edtxt.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
selectrelation(relation_edtxt);
}
});
*/
parent_image.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
try {
if (ContextCompat.checkSelfPermission(getActivity(), Manifest.permission.CAMERA)
!= PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(getActivity(), Manifest.permission.CAMERA)
!= PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(getActivity(), new String[]{Manifest.permission.CAMERA}, 1);
} else {
profile_pic();
}
} catch (Exception e) {
}
}
});
if (bundle != null) {
parent_photo_edtxt.setText( parentdetails.get( position ).get("relation_image"));
addkidpick_txt.setText("Edit Event");
/*
try {
Glide.with( getActivity() )
.load( Uri.parse( StoredUrls.ImageUrl + parentdetails.get( position ).get( "relation_image" ) ) ) // add your image url
.centerCrop() // scale to fill the ImageView and crop any extra
.fitCenter() // scale to fit entire image within ImageView
.placeholder( R.drawable.black_logo )
.into( parent_image );
} catch (Exception e) {
}
*/
//relation_edtxt.setText( parentdetails.get( position ).get("relation_ship"));
try{
// Adminsidemenu.cstm_srch_img.setVisibility(View.VISIBLE);
}catch (Exception e){
}
/*
submit_btn.setOnClickListener (new View.OnClickListener () {
@Override
public void onClick(View v) {
*/
/* startActivity(new Intent(Login.this, Adminsidemenu.class));
Login.this.finish();*//*
final String photo,relation;
photo = parent_photo_edtxt.getText().toString();
relation = relation_edtxt.getText().toString();
if(StoredObjects.inputValidation(parent_photo_edtxt,getActivity().getApplicationContext().getResources().getString(R.string.upload_photo), getActivity()))
{
if(StoredObjects.inputValidation(relation_edtxt,getActivity().getApplicationContext().getResources().getString(R.string.enter_relation),getActivity()))
{
StoredObjects.hide_keyboard(getActivity());
if (InterNetChecker.isNetworkAvailable(getActivity())) {
// new EditparentTask().execute(photo,relation,parentdetails.get( position ).get("idno"));
}else{
StoredObjects.ToastMethod(getActivity().getApplicationContext().getResources().getString(R.string.checkinternet),getActivity());
}
}
}
}
});
*/
}
else {
/*
submit_btn.setOnClickListener (new View.OnClickListener () {
@Override
public void onClick(View v) {
*/
/* startActivity(new Intent(Login.this, Adminsidemenu.class));
Login.this.finish();*//*
final String photo,relation;
photo = parent_photo_edtxt.getText().toString();
relation = relation_edtxt.getText().toString();
if(StoredObjects.inputValidation(parent_photo_edtxt,getActivity().getApplicationContext().getResources().getString(R.string.upload_photo), getActivity()))
{
if(StoredObjects.inputValidation(relation_edtxt,getActivity().getApplicationContext().getResources().getString(R.string.enter_relation),getActivity()))
{
StoredObjects.hide_keyboard(getActivity());
if (InterNetChecker.isNetworkAvailable(getActivity())) {
//new AddparentTask().execute(photo,relation,StoredObjects.UserId);
}else{
StoredObjects.ToastMethod(getActivity().getApplicationContext().getResources().getString(R.string.checkinternet),getActivity());
}
}
}
}
});
*/
}
}
/*
public class AddparentTask extends AsyncTask<String, String, String> {
String strResult = "";
@Override
protected void onPreExecute() {
CustomProgressbar.Progressbarshow(getActivity () );
}
@Override
protected String doInBackground(String... params) {
try {
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2);
nameValuePairs.add(new BasicNameValuePair("token",StoredUrls.token));
nameValuePairs.add(new BasicNameValuePair("type",StoredUrls.create_relation));
nameValuePairs.add(new BasicNameValuePair("relation_ship",params[1]));
nameValuePairs.add(new BasicNameValuePair("relation_image",params[0]));
nameValuePairs.add(new BasicNameValuePair("user_id",params[2]));
strResult = HttpPostClass.PostMethod(StoredUrls.ParentBaseUrl,nameValuePairs);
} catch (URISyntaxException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SocketTimeoutException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ConnectTimeoutException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
StoredObjects.LogMethod("Details", "e:----"+strResult);
return strResult;
}
protected void onPostExecute(String result) {
if (result != null) {
CustomProgressbar.Progressbarcancel(getActivity () );
}
StoredObjects.LogMethod("Details", "e:----"+result);
try {
JSONObject jsonObject = new JSONObject(result);
String status = jsonObject.getString("status");
if(status.equalsIgnoreCase("200")){
StoredObjects.ToastMethod("Parent added successfully.",getActivity());
fragmentcallinglay( new Kidpickedby() );
}else{
String error= jsonObject.getString("error");
StoredObjects.ToastMethod(error,getActivity());
}
} catch (JSONException e) {
e.printStackTrace();
}
catch (NullPointerException e) {
// TODO: handle exception
}catch (IllegalStateException e) {
// TODO: handle exception
}catch (IllegalArgumentException e) {
// TODO: handle exception
}catch (NetworkOnMainThreadException e) {
// TODO: handle exception
}catch (RuntimeException e) {
// TODO: handle exception
}
catch (Exception e) {
StoredObjects.LogMethod("response", "response:---"+e);
}
}
}
*/
/*
public class EditparentTask extends AsyncTask<String, String, String> {
String strResult = "";
@Override
protected void onPreExecute() {
CustomProgressbar.Progressbarshow(getActivity () );
}
@Override
protected String doInBackground(String... params) {
try {
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2);
nameValuePairs.add(new BasicNameValuePair("token",StoredUrls.token));
nameValuePairs.add(new BasicNameValuePair("type",StoredUrls.status_change));
nameValuePairs.add(new BasicNameValuePair("relation_ship",params[1]));
nameValuePairs.add(new BasicNameValuePair("relation_image",params[0]));
nameValuePairs.add(new BasicNameValuePair("idno",params[2]));
nameValuePairs.add(new BasicNameValuePair("change_name",StoredUrls.status_edit_relation));
nameValuePairs.add(new BasicNameValuePair("status","3"));
strResult = HttpPostClass.PostMethod(StoredUrls.ParentBaseUrl,nameValuePairs);
} catch (URISyntaxException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SocketTimeoutException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ConnectTimeoutException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
StoredObjects.LogMethod("Details", "e:----"+strResult);
return strResult;
}
protected void onPostExecute(String result) {
if (result != null) {
CustomProgressbar.Progressbarcancel(getActivity () );
}
StoredObjects.LogMethod("Details", "e:----"+result);
try {
JSONObject jsonObject = new JSONObject(result);
String status = jsonObject.getString("status");
if(status.equalsIgnoreCase("200")){
//StoredObjects.ToastMethod("Parent edited successfully.",getActivity());
StoredObjects.customtoast(getActivity());
fragmentcallinglay( new Kidpickedby() );
}else{
String error= jsonObject.getString("error");
StoredObjects.ToastMethod(error,getActivity());
}
} catch (JSONException e) {
e.printStackTrace();
}
catch (NullPointerException e) {
// TODO: handle exception
}catch (IllegalStateException e) {
// TODO: handle exception
}catch (IllegalArgumentException e) {
// TODO: handle exception
}catch (NetworkOnMainThreadException e) {
// TODO: handle exception
}catch (RuntimeException e) {
// TODO: handle exception
}
catch (Exception e) {
StoredObjects.LogMethod("response", "response:---"+e);
}
}
}
*/
public void profile_pic() {
final CharSequence[] items = {"Take Photo", "Choose from Library", "Cancel"};
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setTitle("Add Photo!");
builder.setItems(items, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int item) {
if (items[item].equals("Take Photo")) {
if (CameraUtils.checkPermissions(getActivity())) {
captureImage();
} else {
requestCameraPermission(MEDIA_TYPE_IMAGE);
}
} else if (items[item].equals("Choose from Library")) {
Intent getIntent = new Intent(Intent.ACTION_GET_CONTENT);
getIntent.setType("image/*");
Intent pickIntent = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
pickIntent.setType("image/*");
Intent chooserIntent = Intent.createChooser(getIntent, "Select Image");
chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, new Intent[] {pickIntent});
startActivityForResult(chooserIntent, SELECT_FILE);
} else if (items[item].equals("Cancel")) {
dialog.dismiss();
}
}
});
builder.show();
}
private void captureImage() {
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
File file = CameraUtils.getOutputMediaFile(MEDIA_TYPE_IMAGE);
if (file != null) {
imageStoragePath = file.getAbsolutePath();
}
Uri fileUri = CameraUtils.getOutputMediaFileUri(getActivity(), file);
intent.putExtra(MediaStore.EXTRA_OUTPUT, fileUri);
// start the image capture Intent
startActivityForResult(intent, CAMERA_CAPTURE_IMAGE_REQUEST_CODE);
}
private void requestCameraPermission(final int type) {
if (type == MEDIA_TYPE_IMAGE) {
// capture picture
captureImage();
}
/*
Dexter.withActivity(getActivity())
.withPermissions(Manifest.permission.CAMERA,
Manifest.permission.WRITE_EXTERNAL_STORAGE)
.withListener(new MultiplePermissionsListener() {
@Override
public void onPermissionsChecked(MultiplePermissionsReport report) {
if (report.areAllPermissionsGranted()) {
if (type == MEDIA_TYPE_IMAGE) {
// capture picture
captureImage();
}
} else if (report.isAnyPermissionPermanentlyDenied()) {
showPermissionsAlert();
}
}
@Override
public void onPermissionRationaleShouldBeShown(List<com.karumi.dexter.listener.PermissionRequest> permissions, PermissionToken token) {
token.continuePermissionRequest();
}
}).check();
*/
}
private Uri picUri;
public void onActivityResult(int requestCode, int resultCode, Intent data) {
//user is returning from capturing an image using the camera
StoredObjects.LogMethod("response", "response:---"+CAMERA_CAPTURE_IMAGE_REQUEST_CODE+"<><>"+resultCode+"<>"+RESULT_OK);
if (requestCode == CAMERA_CAPTURE_IMAGE_REQUEST_CODE) {
if (resultCode == RESULT_OK) {
// Refreshing the gallery
CameraUtils.refreshGallery(getActivity(), imageStoragePath);
String deviceMan = Build.MANUFACTURER;
if (Build.VERSION.SDK_INT >Build.VERSION_CODES.N||deviceMan.contains("HUAWEI")||deviceMan.contains("motorola")|| deviceMan.equalsIgnoreCase("motorola")||deviceMan.contains("Meizu")||deviceMan.contains("meizu")||deviceMan.equalsIgnoreCase("mi") || deviceMan.equalsIgnoreCase("Mi") || deviceMan.equalsIgnoreCase("MI")||deviceMan.equalsIgnoreCase("LG nexus 5x")||deviceMan.equalsIgnoreCase("ZTE")||deviceMan.contains("LG")||deviceMan.contains("nexus")||deviceMan.equalsIgnoreCase("LG nexus 5")||deviceMan.equalsIgnoreCase("LG Nexus 5X")|| deviceMan.equalsIgnoreCase("VIVO")||deviceMan.equalsIgnoreCase("LG Nexus 5")||deviceMan.equalsIgnoreCase("oppo")||deviceMan.equalsIgnoreCase("OPPO")||deviceMan.equalsIgnoreCase("Oppo")||deviceMan.equalsIgnoreCase("ZTE Blade V6")||deviceMan.equalsIgnoreCase("zte blade v6")||deviceMan.equalsIgnoreCase("Zte blade v6")||deviceMan.equalsIgnoreCase("ZTE V6")||deviceMan.equalsIgnoreCase("zte v6")||deviceMan.equalsIgnoreCase("Zte v6")) {//||deviceMan.equalsIgnoreCase("YU")
// if (deviceMan.contains("Meizu")||deviceMan.contains("meizu")|| deviceMan.contains("oppo") || deviceMan.contains("OPPO") || deviceMan.contains("Oppo")||deviceMan.contains("mi") ||deviceMan.contains("Mi") || deviceMan.contains("MI") ||deviceMan.contains("vivo")||deviceMan.contains("VIVO")||deviceMan.equalsIgnoreCase("Meizu")|| deviceMan.equalsIgnoreCase("oppo") || deviceMan.equalsIgnoreCase("MI")|| deviceMan.equalsIgnoreCase("VIVO")) {//||deviceMan.equalsIgnoreCase("YU")
try {
Bitmap myBitmap = BitmapFactory.decodeFile(imageStoragePath);
f_new = createNewFile("CROP_");
try {
f_new.createNewFile();
} catch (IOException ex) {
Log.e("io", ex.getMessage());
}
Photo_SHowDialog(getActivity(),f_new,imageStoragePath,myBitmap);
} catch (Exception e) {
e.printStackTrace();
StoredObjects.LogMethod("", "imagepathexpection:--" + e);
}
} else {
Uri uri = picUri;
//carry out the crop operation
try {
performCrop(picUri);
Log.d("picUri", uri.toString());
} catch (Exception e) {
e.printStackTrace();
}
}
// successfully captured the image
// display it in image view
// Bitmap bitmap = CameraUtils.optimizeBitmap(BITMAP_SAMPLE_SIZE, imageStoragePath);
} else if (resultCode == RESULT_CANCELED) {
// user cancelled Image capture
Toast.makeText(getActivity(),
"User cancelled image capture", Toast.LENGTH_SHORT)
.show();
} else {
// failed to capture image
Toast.makeText(getActivity(),
"Sorry! Failed to capture image", Toast.LENGTH_SHORT)
.show();
}
}
else if (requestCode == SELECT_FILE) {
String deviceMan = Build.MANUFACTURER;
StoredObjects.LogMethod("onresume", "deviceMan:-" + deviceMan);
picUri = data.getData();
String url = data.getData().toString();
if (url.startsWith("content://com.google.android.apps.photos.content")){
String tempPath = getPath(picUri, getActivity());
try {
InputStream is = getActivity().getContentResolver().openInputStream(picUri);
if (is != null) {
Bitmap pictureBitmap = BitmapFactory.decodeStream(is);
f_new = createNewFile("CROP_");
try {
f_new.createNewFile();
} catch (IOException ex) {
Log.e("io", ex.getMessage());
}
Photo_SHowDialog(getActivity(),f_new,tempPath,pictureBitmap);
}
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}else{
if (Build.VERSION.SDK_INT >Build.VERSION_CODES.N||deviceMan.contains("HUAWEI")||deviceMan.contains("motorola")|| deviceMan.equalsIgnoreCase("motorola")||deviceMan.contains("Meizu")|| deviceMan.equalsIgnoreCase("VIVO")||deviceMan.contains("meizu")||deviceMan.equalsIgnoreCase("mi") || deviceMan.equalsIgnoreCase("Mi") || deviceMan.equalsIgnoreCase("MI")||deviceMan.equalsIgnoreCase("LG nexus 5x")||deviceMan.equalsIgnoreCase("ZTE")||deviceMan.contains("LG")||deviceMan.contains("nexus")||deviceMan.equalsIgnoreCase("LG nexus 5")||deviceMan.equalsIgnoreCase("LG Nexus 5X")||deviceMan.equalsIgnoreCase("LG Nexus 5")||deviceMan.equalsIgnoreCase("oppo")||deviceMan.equalsIgnoreCase("OPPO")||deviceMan.equalsIgnoreCase("Oppo")||deviceMan.equalsIgnoreCase("ZTE Blade V6")||deviceMan.equalsIgnoreCase("zte blade v6")||deviceMan.equalsIgnoreCase("Zte blade v6")||deviceMan.equalsIgnoreCase("ZTE V6")||deviceMan.equalsIgnoreCase("zte v6")||deviceMan.equalsIgnoreCase("Zte v6")) {//||deviceMan.equalsIgnoreCase("YU")
// if (deviceMan.contains("Meizu")||deviceMan.contains("meizu")|| deviceMan.contains("oppo") || deviceMan.contains("OPPO") || deviceMan.contains("Oppo")||deviceMan.contains("mi") ||deviceMan.contains("Mi") || deviceMan.contains("MI") ||deviceMan.contains("vivo")||deviceMan.contains("VIVO")||deviceMan.equalsIgnoreCase("Meizu")|| deviceMan.equalsIgnoreCase("oppo") || deviceMan.equalsIgnoreCase("MI")|| deviceMan.equalsIgnoreCase("VIVO")) {//||deviceMan.equalsIgnoreCase("YU")
StoredObjects.LogMethod("onresume", "deviceMan:-" + deviceMan);
try {
Bitmap myBitmap=null;
picUri = data.getData();
final String docFilePath = getFileNameByUri(getActivity(), picUri);
StoredObjects.LogMethod("", "imagepath:--" + docFilePath);
myBitmap = BitmapFactory.decodeFile(docFilePath);
try {
f_new = createNewFile("CROP_");
try {
f_new.createNewFile();
} catch (IOException ex) {
Log.e("io", ex.getMessage());
}
Photo_SHowDialog(getActivity(),f_new,docFilePath,myBitmap);
//new ImageUploadTaskNew().execute(docFilePath.toString());
} catch (Exception e1) {
e1.printStackTrace();
StoredObjects.LogMethod("", "Exception:--" + e1);
}
} catch (Exception e) {
e.printStackTrace();
StoredObjects.LogMethod("", "Exception:--" + e);
}
} else {
picUri = data.getData();
try {
Log.d("uriGallery", picUri.toString());
performCrop(picUri);
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
//user is returning from cropping the image
else if (requestCode == PIC_CROP) {
//get the returned data
try {
try {
Bitmap myBitmap = BitmapFactory.decodeFile(mCropImagedUri.getPath());
//ed_pro_image.setImageBitmap(myBitmap);
Photo_SHowDialog(getActivity(),f_new,mCropImagedUri.getPath(),myBitmap);
} catch (Exception e) {
StoredObjects.LogMethod("Exception", "Exception:::" +e);
e.printStackTrace();
}
StoredObjects.LogMethod("Exception", "Exception::" + mCropImagedUri.getPath());
} catch (Exception e1) {
StoredObjects.LogMethod("Exception", "Exception::" +e1);
e1.printStackTrace();
}
}
}
private void performCrop(Uri picUri) {
try {
Intent cropIntent = new Intent("com.android.camera.action.CROP");
// indicate image type and Uri
cropIntent.setDataAndType(picUri, "image/*");
// set crop properties
cropIntent.putExtra("crop", "true");
// indicate aspect of desired crop
cropIntent.putExtra("aspectX", 1);
cropIntent.putExtra("aspectY", 1);
cropIntent.putExtra("scale", true);
// indicate output X and Y
cropIntent.putExtra("outputX", 500);
cropIntent.putExtra("outputY", 500);
// retrieve data on return
cropIntent.putExtra("return-data", true);
// start the activity - we handle returning in onActivityResult
// startActivityForResult(cropIntent, PIC_CROP);
f_new = createNewFile("CROP_");
try {
f_new.createNewFile();
} catch (IOException ex) {
Log.e("io", ex.getMessage());
}
mCropImagedUri = Uri.fromFile(f_new);
cropIntent.putExtra(MediaStore.EXTRA_OUTPUT, mCropImagedUri);
//start the activity - we handle returning in onActivityResult
startActivityForResult(cropIntent, PIC_CROP);
}
//respond to users whose devices do not support the crop action
catch (ActivityNotFoundException anfe) {
//display an error message
String errorMessage = "Whoops - your device doesn't support the crop action!";
Toast toast = Toast.makeText(getActivity(), errorMessage, Toast.LENGTH_SHORT);
toast.show();
}
}
public String getPath(Uri uri, Activity activity) {
Cursor cursor = null;
try {
String[] projection = {MediaStore.MediaColumns.DATA};
cursor = activity.getContentResolver().query(uri, projection, null, null, null);
if (cursor.moveToFirst()) {
int column_index = cursor.getColumnIndexOrThrow(MediaStore.MediaColumns.DATA);
return cursor.getString(column_index);
}
} catch (Exception e) {
} finally {
cursor.close();
}
return "";
}
private String getFileNameByUri(Context context, Uri uri) {
String filepath = "";//default fileName
//Uri filePathUri = uri;
File file;
StoredObjects.LogMethod("", "imagepath:--" + uri);
if (uri.getScheme().toString().compareTo("content") == 0) {
Cursor cursor = context
.getContentResolver()
.query(uri,
new String[] {
MediaStore.Images.ImageColumns.DATA,
MediaStore.Images.Media.ORIENTATION },
null, null, null);
int column_index = cursor
.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
cursor.moveToFirst();
String mImagePath = cursor.getString(column_index);
cursor.close();
filepath = mImagePath;
}else if (uri.getScheme().compareTo("file") == 0) {
try {
file = new File(new URI(uri.toString()));
if (file.exists())
filepath = file.getAbsolutePath();
} catch (URISyntaxException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} else {
filepath = uri.getPath();
}
return filepath;
}
private Uri mCropImagedUri;
File f_new;
/**
* Crop the image
*
* @return returns <tt>true</tt> if crop supports by the device,otherwise false
*/
private File createNewFile(String prefix) {
if (prefix == null || "".equalsIgnoreCase(prefix)) {
prefix = "IMG_";
}
File newDirectory = new File( Environment.getExternalStorageDirectory() + "/mypics/");
if (!newDirectory.exists()) {
if (newDirectory.mkdir()) {
Log.d(getActivity().getClass().getName(), newDirectory.getAbsolutePath() + " directory created");
}
}
File file = new File(newDirectory, (prefix + System.currentTimeMillis() + ".jpg"));
if (file.exists()) {
//this wont be executed
file.delete();
try {
file.createNewFile();
} catch (IOException e) {
e.printStackTrace();
}
}
return file;
}
private Bitmap getResizedBitmap(Bitmap image, int maxSize) {
int width = image.getWidth();
int height = image.getHeight();
float bitmapRatio = (float) width / (float) height;
if (bitmapRatio > 0) {
width = maxSize;
height = (int) (width / bitmapRatio);
} else {
height = maxSize;
width = (int) (height * bitmapRatio);
}
return Bitmap.createScaledBitmap(image, width, height, true);
}
public static Bitmap getUnRotatedImage(String imagePath, Bitmap rotatedBitmap)
{
int rotate = 0;
try
{
File imageFile = new File(imagePath);
ExifInterface exif = new ExifInterface(imageFile.getAbsolutePath());
int orientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL);
switch (orientation)
{
case ExifInterface.ORIENTATION_ROTATE_270:
rotate = 270;
break;
case ExifInterface.ORIENTATION_ROTATE_180:
rotate = 180;
break;
case ExifInterface.ORIENTATION_ROTATE_90:
rotate = 90;
break;
}
}
catch (Exception e)
{
e.printStackTrace();
return null;
}
Matrix matrix = new Matrix();
matrix.postRotate(rotate);
return Bitmap.createBitmap(rotatedBitmap, 0, 0, rotatedBitmap.getWidth(), rotatedBitmap.getHeight(), matrix,
true);
}
public void bitmapToUriConverter(Bitmap mBitmap) {
Uri uri = null;
try {
final BitmapFactory.Options options = new BitmapFactory.Options();
File file = new File(getActivity().getFilesDir(), "ProfileImages"
+ new Random().nextInt() + ".png");
FileOutputStream out;
int currentAPIVersion = Build.VERSION.SDK_INT;
if (currentAPIVersion > Build.VERSION_CODES.M) {
out = getActivity().openFileOutput(file.getName(),
Context.MODE_PRIVATE);
}else{
out = getActivity().openFileOutput(file.getName(),
Context.MODE_WORLD_READABLE);
}
mBitmap.compress(Bitmap.CompressFormat.PNG, 100, out);
out.flush();
out.close();
//get absolute path
String realPath = file.getAbsolutePath();
File f = new File(realPath);
uri = Uri.fromFile(f);
StoredObjects.LogMethod("onresume", "realPath:-" + realPath);
if (InterNetChecker.isNetworkAvailable(getActivity())) {
// new ImageUploadTaskNew().execute(realPath);
}else{
Toast.makeText(getActivity(), "Please Check Internet Connection.", Toast.LENGTH_SHORT).show();
}
} catch (Exception e) {
Log.e("Your Error Message", e.getMessage());
}
}
Dialog dialog_show;
public void Photo_SHowDialog(final Context context, final File captured_file, final String path, final Bitmap bitmap){
dialog_show = new Dialog(context);
dialog_show.getWindow();
dialog_show.requestWindowFeature( Window.FEATURE_NO_TITLE);
dialog_show.setContentView(R.layout.photoshow_popup );
dialog_show.getWindow().setLayout( WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.WRAP_CONTENT);
dialog_show.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
ImageView captured_image = (ImageView) dialog_show.findViewById(R.id.captured_image);
Button cancel_btn = (Button) dialog_show.findViewById(R.id.cancel_btn);
Button saveandcontinue__btn = (Button) dialog_show.findViewById(R.id.saveandcontinue__btn);
String fileNameSegments[] = path.split("/");
fileName = fileNameSegments[fileNameSegments.length - 1];
myImg = Bitmap.createBitmap(getResizedBitmap(getUnRotatedImage(path, BitmapFactory.decodeFile(path)), 300));
ByteArrayOutputStream stream = new ByteArrayOutputStream();
myImg.compress(Bitmap.CompressFormat.JPEG, 80, stream);
captured_image.setImageBitmap(myImg);
saveandcontinue__btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (InterNetChecker.isNetworkAvailable(getActivity())) {
StoredObjects.LogMethod("", "pictureFile_uploading:--"+"::path::"+path);
// new ImageUploadTaskNew().execute(path);
/* capturd_image.setImageBitmap(myImg);
//uploadImage();
bitmapToUriConverter(myImg);*/
dialog_show.dismiss();
}else{
Toast toast = Toast.makeText(context, "Please Check Internet Connection.", Toast.LENGTH_LONG);
toast.show();
}
bitmapToUriConverter(myImg);
}
});
cancel_btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dialog_show.dismiss();
}
});
dialog_show.show();
}
/*
public class ImageUploadTaskNew extends AsyncTask<String, String, String> {
String strResult = "";
@Override
protected void onPreExecute() {
//CustomProgressbar.Progressbarshow(getActivity());
}
@Override
protected String doInBackground(String... params) {
strResult = HttpPostClass.uploadFile(params[0], StoredUrls.imageupload);
StoredObjects.LogMethod("strResult:", "strResult:--_final"+strResult);
return strResult;
}
protected void onPostExecute(String results) {
StoredObjects.LogMethod("strResult:", "strResult:--_final"+strResult);
if (results != null) {
// CustomProgressbar.Progressbarcancel(getActivity());
}
try {
JSONObject jsonrootObject = new JSONObject(results);
String status = jsonrootObject.getString("status");
if(status.equalsIgnoreCase("200")){
file_name = jsonrootObject.getString("file_name");
StoredObjects.LogMethod("filename","uploaded_filename"+file_name);
parent_photo_edtxt.setText( file_name );
try {
Glide.with( getActivity() )
.load( Uri.parse( StoredUrls.ImageUrl + file_name ) ) // add your image url
.centerCrop() // scale to fill the ImageView and crop any extra
.fitCenter() // scale to fit entire image within ImageView
.placeholder( R.drawable.black_logo )
.into( parent_image );
} catch (Exception e) {
}
}else{
StoredObjects.ToastMethod("Try Again.",getActivity());
}
}catch(Exception exception){
}
}
}
*/
public void fragmentcallinglay(Fragment fragment) {
FragmentManager fragmentManager = getActivity ().getSupportFragmentManager ();
fragmentManager.beginTransaction ().replace (R.id.frame_container , fragment).addToBackStack( "" ).commit ();
}
/*
private void selectrelation(final NimbusRegularEditText prfilenme){
listPopupWindow.setAdapter(new ArrayAdapter<>(getActivity(),R.layout.drpdwn_lay,gnderlst));
listPopupWindow.setAnchorView(prfilenme);
listPopupWindow.setHeight(LinearLayout.MarginLayoutParams.WRAP_CONTENT);
listPopupWindow.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
prfilenme.setText(gnderlst[position]);
listPopupWindow.dismiss();
}
});
listPopupWindow.show();
}
*/
}
| [
"o3sa@o3sas-Mac-mini.local"
] | o3sa@o3sas-Mac-mini.local |
6940a8b32fd6dd31f24b9dc0f6cea96b8b7c7e24 | 068910b2995738014b07f8d810d3aa0bcfccd8f9 | /footballfan/src/main/java/com/longngo/footballfan/data/datamanager/FootballService.java | 648ce12aa3b653dca116aff5c94ce08db6c7e79d | [] | no_license | beyonderVN/FootballFan | bff1621fc088ff470111338a859061dd6fe956e2 | 10ec2762b53dcadbd1551759f624d340a3fe18fb | refs/heads/master | 2021-01-24T09:02:10.031690 | 2016-10-05T18:00:22 | 2016-10-05T18:00:22 | 70,084,784 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 406 | java | package com.longngo.footballfan.data.datamanager;
import com.longngo.footballfan.data.model.Competition;
import java.util.List;
import retrofit2.http.GET;
import retrofit2.http.Query;
import rx.Single;
public interface FootballService {
/**
* Retrieve a list of competitions
*/
@GET("competitions")
Single<List<Competition>> getCompetitions(@Query("season") String season);
}
| [
"no.noo..nooo.yes@gmail.com"
] | no.noo..nooo.yes@gmail.com |
1dc06ce60ac0a056c8f007dbc96bb37f69538faa | 8124dde4cb616b44c5be01ed760eadd3dd1453b6 | /prg20-21/src/main/java/tema1/Ejer9.java | d3593e1ca9465409d0065fec075b1215fe164ac0 | [] | no_license | JoelFdz/PRG-20-21 | 17fa0c43cdce13dc8f2934410d5a497d405c914b | 1610dc673b30723d1789c5515416346eb722b023 | refs/heads/main | 2023-03-28T07:42:57.940038 | 2021-03-29T19:36:00 | 2021-03-29T19:36:00 | 348,817,979 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 200 | java | /*
* Ejercicio 9
*/
package tema1;
/**
*
* @author JFSam
*/
public class Ejer9 {
public static void main(String args[]) {
System.out.println("Mi primer programa en Java y funciona!!!");
}
}
| [
"joelfernan101@gmail.com"
] | joelfernan101@gmail.com |
ca39c642f2e0aafd4a0474d8a48fbf5576f8c6a9 | 355644b22dd0ead6b702e09068d2f4972198494b | /app/src/androidTest/java/com/example/akiya/helloworld/ExampleInstrumentedTest.java | 77237af4551928b8bfb34ae7ee36449a2608b6ee | [] | no_license | uehara1414/HelloAndroid | 5b7fdad8749475d3f76a852e24437dac74a5cc1b | b932377238ae209bbaf38e957bd8705ed0e752e0 | refs/heads/master | 2021-01-15T10:29:48.124362 | 2017-08-07T14:29:11 | 2017-08-07T14:29:11 | 99,583,047 | 0 | 1 | null | 2017-08-08T10:15:29 | 2017-08-07T13:50:58 | Java | UTF-8 | Java | false | false | 760 | java | package com.example.akiya.helloworld;
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.*;
/**
* Instrumentation 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.akiya.helloworld", appContext.getPackageName());
}
}
| [
"b1015062@fun.ac.jp"
] | b1015062@fun.ac.jp |
0df3c100d6a870874d765eea075ab4da2266ffec | f4e885c21b09749518ee97e7be612e32ee2253b3 | /src/main/java/com/fpx/common/util/excel/export/styler/IExcelExportStyler.java | 1eadda94cdc1da9bb2adacb4a5a5f1374e3db26a | [] | no_license | chingching123/common-util | a570dede83d35fa5311435ef1d8e6fe77bd63b3c | e9028401ba3f3d9dee2c68ce036e76bc3823e676 | refs/heads/master | 2023-02-22T23:29:56.548412 | 2019-05-30T07:43:56 | 2019-05-30T07:43:56 | 189,197,473 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,324 | java | /**
* Copyright 2013-2015 JueYue (qrb.jueyue@gmail.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.fpx.common.util.excel.export.styler;
import com.fpx.common.util.excel.entity.params.ExcelExportEntity;
import org.apache.poi.ss.usermodel.CellStyle;
/**
* Excel导出样式接口
*
* @author JueYue
* @date 2015年1月9日 下午5:32:30
*/
public interface IExcelExportStyler {
/**
* 列表头样式
*
* @param headerColor
* @return
*/
public CellStyle getHeaderStyle(short headerColor);
/**
* 标题样式
*
* @param color
* @return
*/
public CellStyle getTitleStyle(short color);
/**
* 获取样式方法
*
* @param noneStyler
* @param entity
* @return
*/
public CellStyle getStyles(boolean noneStyler, ExcelExportEntity entity);
}
| [
"974634914@qq.com"
] | 974634914@qq.com |
89c9165dbfd943bfabc722ca9537f0ea97e41d5a | 5e013e0b62ffec58e732a4a7e3c3387ef5dc634b | /app/src/main/java/com/example/dellc/coolweather/db/City.java | b7f935380ec867ebc3cdff1152a1491688de5d41 | [] | no_license | Jhonson2/CoolWeather | 85899cb603679f4aa1717d2ea9e971aad9d97082 | 44e27f38399b4a2dccce00f682d2a75893ffe9d6 | refs/heads/master | 2021-01-25T06:45:06.116035 | 2017-06-24T13:24:49 | 2017-06-24T13:24:49 | 93,603,253 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 909 | java | package com.example.dellc.coolweather.db;
import org.litepal.crud.DataSupport;
/**
* 城市
* Created by dellc on 2017/6/7.
*/
public class City extends DataSupport {
private int id;
private String cityName;//市的名字
private int cityCode;//市的代号
private int provinceId;//当前市所属省的id值
public int getCityCode() {
return cityCode;
}
public void setCityCode(int cityCode) {
this.cityCode = cityCode;
}
public String getCityName() {
return cityName;
}
public void setCityName(String cityName) {
this.cityName = cityName;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getProvinceId() {
return provinceId;
}
public void setProvinceId(int provinceId) {
this.provinceId = provinceId;
}
}
| [
"1750896420@qq.com"
] | 1750896420@qq.com |
02b234b99bfb396569877d95ce6b026297b89b34 | e1054bc0a6177f2944adb4f2c6670ab2ba80b8fb | /UPSTAC-Week3-assignment_updated/src/main/java/org/upgrad/upstac/testrequests/lab/LabRequestController.java | ba63f460a46e9a232c9ce2dec284d5ae4551ee66 | [] | no_license | anandr902FI/upgradassingments | 0f2317228f134f2ba8c1e88b0f33067935f64bdf | 6881273216f523999da043da6809c2ef3e432afe | refs/heads/main | 2023-03-27T18:44:15.395530 | 2021-03-31T09:16:05 | 2021-03-31T09:16:05 | 352,976,655 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,175 | java | package org.upgrad.upstac.testrequests.lab;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.server.ResponseStatusException;
import org.upgrad.upstac.config.security.UserLoggedInService;
import org.upgrad.upstac.exception.AppException;
import org.upgrad.upstac.testrequests.RequestStatus;
import org.upgrad.upstac.testrequests.TestRequest;
import org.upgrad.upstac.testrequests.TestRequestQueryService;
import org.upgrad.upstac.testrequests.TestRequestUpdateService;
import org.upgrad.upstac.testrequests.flow.TestRequestFlowService;
import org.upgrad.upstac.users.User;
import javax.validation.ConstraintViolationException;
import java.util.List;
import static org.upgrad.upstac.exception.UpgradResponseStatusException.asBadRequest;
import static org.upgrad.upstac.exception.UpgradResponseStatusException.asConstraintViolation;
@RestController
@RequestMapping("/api/labrequests")
public class LabRequestController {
Logger log = LoggerFactory.getLogger(LabRequestController.class);
@Autowired
private TestRequestUpdateService testRequestUpdateService;
@Autowired
private TestRequestQueryService testRequestQueryService;
@Autowired
private TestRequestFlowService testRequestFlowService;
@Autowired
private UserLoggedInService userLoggedInService;
@GetMapping("/to-be-tested")
@PreAuthorize("hasAnyRole('TESTER')")
public List<TestRequest> getForTests() {
return testRequestQueryService.findBy(RequestStatus.INITIATED);
}
@GetMapping
@PreAuthorize("hasAnyRole('TESTER')")
public List<TestRequest> getForTester() {
// Implement This Method
// Create an object of User class and store the current logged in user first
// Implement this method to return the list of test requests assigned to current
// tester(make use of the above created User object)
// Make use of the findByTester() method from testRequestQueryService class
// For reference check the method getForTests() method from LabRequestController
// class
return testRequestQueryService.findByTester(userLoggedInService.getLoggedInUser());
// throw new ResponseStatusException(HttpStatus.NOT_IMPLEMENTED,"Not implemented"); // replace this line with your code
}
@PreAuthorize("hasAnyRole('TESTER')")
@PutMapping("/assign/{id}")
public TestRequest assignForLabTest(@PathVariable Long id) {
User tester = userLoggedInService.getLoggedInUser();
return testRequestUpdateService.assignForLabTest(id, tester);
}
@PreAuthorize("hasAnyRole('TESTER')")
@PutMapping("/update/{id}")
public TestRequest updateLabTest(@PathVariable Long id, @RequestBody CreateLabResult createLabResult) {
try {
User tester = userLoggedInService.getLoggedInUser();
return testRequestUpdateService.updateLabTest(id, createLabResult, tester);
} catch (ConstraintViolationException e) {
throw asConstraintViolation(e);
} catch (AppException e) {
throw asBadRequest(e.getMessage());
}
}
}
| [
"anandr2@deloitte.com"
] | anandr2@deloitte.com |
3d65b4823051d6436d7ac59a58c4faf987b19ebd | 10ffbf4b2167065f3a0fae71c4ea72c1775cee86 | /CarEvent.java | 8c4f6cab1f77a986d71a090ebbe40045fd3db3b4 | [] | no_license | Distribute-System/Relay | 7f7ad46800857c42859f2507c495e0b830da8662 | 322ff49808b454ad898538bacec2ad8756ac69be | refs/heads/master | 2023-05-10T03:26:41.076148 | 2021-06-07T17:41:53 | 2021-06-07T17:41:53 | 374,748,398 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,408 | java |
import org.json.JSONException;
import org.json.JSONObject;
import java.util.List;
import org.json.JSONArray;
public class CarEvent
{
protected static final String HEADER = "HEADER";
protected static final String BODY = "BODY";
protected JSONObject jsonObj = new JSONObject();
public static void main(String args[])
{
JSONObject temp = new JSONObject();
try
{
temp.put(HEADER, new JSONObject());
JSONObject repli = new JSONObject(temp.toString());
System.out.println(repli.toString());
}
catch(JSONException e)
{
System.err.println(e);
}
System.out.println(temp.toString());
}
public CarEvent()
{
try
{
jsonObj.put(HEADER, new JSONObject());
jsonObj.put(BODY, new JSONObject());
}
catch (JSONException e) {
System.err.println("error occurred while construcutor for carEvent");
e.printStackTrace();
}
}
public CarEvent(JSONObject msg)
{
this();
try
{
if((msg.getJSONObject(HEADER) != null) && (msg.getJSONObject(BODY) != null))
jsonObj = msg;
}
catch(JSONException ex)
{
System.err.println(ex);
}
}
public boolean isEmpty()
{
return jsonObj == null;
}
protected void put(String key, String value, String specifier)
{
JSONObject tempJson;
try {
tempJson = jsonObj.getJSONObject(specifier);
tempJson.put(key, value);
} catch (JSONException e) {
System.err.println("error occurred while put" +specifier +"() \n");
e.printStackTrace();
}
}
public void putBody(String key, String value)
{
put(key, value, BODY);
}
public void putHeader(String key, String value)
{
put(key, value, HEADER);
}
protected String get(String key, String specifier)
{
try
{
JSONObject temp = (JSONObject) jsonObj.get(specifier);
if(temp.has(key))
{
return temp.getString(key);
}
}
catch (JSONException e)
{
System.err.println("error occurred while get" + specifier + "() \n");
e.printStackTrace();
}
return null;
}
public String getHeader(String key)
{
return get(key, HEADER);
}
public String getBody(String key)
{
return get(key, BODY);
}
public String toString()
{
return jsonObj.toString();
}
protected JSONObject getJsonObject()
{
return jsonObj;
}
}
| [
"ec2-user@ip-172-31-10-90.ec2.internal"
] | ec2-user@ip-172-31-10-90.ec2.internal |
a395f265e811e03f78ce04e9fce001491fc24efe | 077d8c529a3cb31815e66f3465b08b2396cf1d6e | /app/src/main/java/manjeet_hooda/news/Network/FetchNews.java | edabf68af0c3f740c4650b4d10c9470d1e9da221 | [] | no_license | manjeethooda/News | 72b89d64ac286f9a8bcd736e97593584e1259291 | 7bd9b9e9b9aa3367d9e41205e54c1f1a8e3e4f55 | refs/heads/master | 2021-01-01T05:29:24.992524 | 2016-04-15T10:36:34 | 2016-04-15T10:36:34 | 56,312,536 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,046 | java | package manjeet_hooda.news.Network;
import android.app.Fragment;
import android.content.Context;
import android.os.AsyncTask;
import android.util.Log;
import org.json.JSONArray;
import org.json.JSONObject;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.ArrayList;
import java.util.Locale;
import java.util.Objects;
import manjeet_hooda.news.R;
import manjeet_hooda.news.activity.MainActivity;
import manjeet_hooda.news.fragment.top_news;
import manjeet_hooda.news.model.news_item;
/**
* Created by manjeet on 15/4/16.
*/
public class FetchNews extends AsyncTask<String, Void, Void> {
private static final String NEWS_API =
"http://timesofindia.indiatimes.com/feeds/";
private String feedType = ".cms?feedtype=sjson";
private top_news fragment;
private JSONObject data;
private ArrayList<news_item> list;
public FetchNews(top_news fragment, ArrayList<news_item> list) {
this.fragment = fragment;
this.list = list;
}
@Override
public Void doInBackground(String... params) {
try {
String newsType = params[0];
URL url = new URL(String.format(NEWS_API + newsType + feedType));
HttpURLConnection connection =
(HttpURLConnection) url.openConnection();
BufferedReader reader = new BufferedReader(
new InputStreamReader(connection.getInputStream()));
StringBuffer json = new StringBuffer(1024);
String tmp = "";
while ((tmp = reader.readLine()) != null)
json.append(tmp).append("\n");
reader.close();
data = new JSONObject(json.toString());
// This value will be 404 if the request was not
// successful
if (data.getInt("cod") != 200) {
return null;
}
formList(data);
} catch (Exception e) {
return null;
}
return null;
}
private void formList(JSONObject json){
try {
JSONArray newsItem = json.getJSONArray("NewsItem");
int length = newsItem.length();
for(int i =0; i<length; i++){
JSONObject news_json = newsItem.getJSONObject(i);
news_item news = new news_item();
news.setHeadline(news_json.getString("Headline"));
news.setCaption(news_json.getString("Caption"));
news.setDate(news_json.getString("Dateline"));
news.setmUrl(news_json.getString("WebURL"));
news.setNewsId(news_json.getLong("NewsItemId"));
list.add(news);
}
}catch(Exception e){
Log.e("News", "One or more fields not found in the JSON data");
}
}
@Override
protected void onPostExecute(Void avoid){
super.onPostExecute(avoid);
fragment.display(list.get(0).getHeadline());
}
}
| [
"manjeethooda.msh@gmail.com"
] | manjeethooda.msh@gmail.com |
b7d48a63043ef58fdf614261a8f4def95d123606 | 3ac7c417f58e989e193bdcaa3cd1d16f25b67aae | /java/src/main/167TwoSumII/solution.java | 9b556bfa1c5cd087ff4ae3f0282a88272a0f8835 | [] | no_license | fandan-nyc/leetcode | 0bf455a8ad105b575dc563b055fb413a55b8039b | e794be3671b157a7cf37763ec4865ebe99f4b613 | refs/heads/master | 2023-03-16T18:20:46.566527 | 2022-11-22T06:12:15 | 2022-11-22T06:12:15 | 44,832,718 | 9 | 2 | null | 2023-03-05T05:38:34 | 2015-10-23T19:02:27 | Java | UTF-8 | Java | false | false | 471 | java | public class Solution {
public int[] twoSum(int[] numbers, int target) {
int start = 0;
int end = numbers.length-1;
while(start < end){
int curr = numbers[start] + numbers[end];
if(curr > target){
end--;
}else if(curr == target){
return new int[]{start+1, end+1};
}else{
start ++;
}
}
return new int[]{-1,-1};
}
}
| [
"dfan@appnexus.com"
] | dfan@appnexus.com |
2283b6ec28eff8b616bd2caeef27b9f9bdd629fb | bf2966abae57885c29e70852243a22abc8ba8eb0 | /aws-java-sdk-route53/src/main/java/com/amazonaws/services/route53/model/DisableHostedZoneDNSSECResult.java | aa56101fcb1a14881c723a767c59cae86f7665d9 | [
"Apache-2.0"
] | permissive | kmbotts/aws-sdk-java | ae20b3244131d52b9687eb026b9c620da8b49935 | 388f6427e00fb1c2f211abda5bad3a75d29eef62 | refs/heads/master | 2021-12-23T14:39:26.369661 | 2021-07-26T20:09:07 | 2021-07-26T20:09:07 | 246,296,939 | 0 | 0 | Apache-2.0 | 2020-03-10T12:37:34 | 2020-03-10T12:37:33 | null | UTF-8 | Java | false | false | 3,395 | java | /*
* Copyright 2016-2021 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.route53.model;
import java.io.Serializable;
import javax.annotation.Generated;
/**
*
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/DisableHostedZoneDNSSEC" target="_top">AWS
* API Documentation</a>
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class DisableHostedZoneDNSSECResult extends com.amazonaws.AmazonWebServiceResult<com.amazonaws.ResponseMetadata> implements Serializable, Cloneable {
private ChangeInfo changeInfo;
/**
* @param changeInfo
*/
public void setChangeInfo(ChangeInfo changeInfo) {
this.changeInfo = changeInfo;
}
/**
* @return
*/
public ChangeInfo getChangeInfo() {
return this.changeInfo;
}
/**
* @param changeInfo
* @return Returns a reference to this object so that method calls can be chained together.
*/
public DisableHostedZoneDNSSECResult withChangeInfo(ChangeInfo changeInfo) {
setChangeInfo(changeInfo);
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 (getChangeInfo() != null)
sb.append("ChangeInfo: ").append(getChangeInfo());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof DisableHostedZoneDNSSECResult == false)
return false;
DisableHostedZoneDNSSECResult other = (DisableHostedZoneDNSSECResult) obj;
if (other.getChangeInfo() == null ^ this.getChangeInfo() == null)
return false;
if (other.getChangeInfo() != null && other.getChangeInfo().equals(this.getChangeInfo()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getChangeInfo() == null) ? 0 : getChangeInfo().hashCode());
return hashCode;
}
@Override
public DisableHostedZoneDNSSECResult clone() {
try {
return (DisableHostedZoneDNSSECResult) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
}
}
}
| [
""
] | |
b4028cf0af5927a4d672d840697273774cda4826 | d4c1d131573607a243414102cc1228b77c6bdf23 | /src/dx/com/two/Example223.java | 9b45cf5d93ac3e638e945a932f9ff6a5750d9e66 | [] | no_license | NobiGo/Algorithm | defee3c7e4efba9261fcaa55966ac517fcb2c171 | a45b4d51586f5f265ee5d45488584e1f81c3c082 | refs/heads/master | 2021-12-24T11:07:40.923611 | 2021-11-28T01:47:17 | 2021-11-28T01:47:17 | 83,970,582 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 684 | java | package dx.com.two;
/**
* Created by dx on 2017/3/25.
*/
public class Example223 {
/**
* 自顶向上
*/
private static void sort(int[] arrays) {
int length = arrays.length;
int[] aux = new int[length];
for (int sz = 1; sz < length; sz += sz) {
for (int lo = 0; lo < length - sz; lo += sz + sz) {
Example211.merge(arrays, lo, lo + sz - 1, Math.min(lo + sz + sz - 1, length - 1));
}
}
}
public static void main(String[] args) {
int[] arrays = {1, 2, 5, 6, 89, 34, 56};
sort(arrays);
for (int i : arrays) {
System.out.println(i);
}
}
}
| [
"nobigogle@gmail.com"
] | nobigogle@gmail.com |
1c54011fca395c850765ce5a26506b7b4dd2cdd7 | a0c6a2feacb72ab3cac884faa625dbe70c84770c | /src/com/aypi/events/PlayerJoin.java | 82e7e756f712b073658cbd40cad462e7bf2ab590 | [] | no_license | Huminecraft/AYPI | 8cc3b7fe270923008140651caadb70b3b4b043a1 | ad054633a56e84a715158bbaae3e5365fa6893f6 | refs/heads/master | 2021-08-07T15:34:57.747056 | 2020-04-19T16:57:20 | 2020-04-19T16:57:20 | 157,255,309 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 627 | java | package com.aypi.events;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import com.aypi.Aypi;
import com.aypi.utils.Zone;
import com.aypi.utils.ZonePriorityBuffer;
public class PlayerJoin implements Listener {
@EventHandler
public void onPlayerMove(PlayerJoinEvent e)
{
Player player = e.getPlayer();
Location loc = player.getLocation();
for (Zone zone : Aypi.getZoneManager().getZones())
{
if (zone.containLocation(loc))
{
zone.addEntity(player);
}
}
}
}
| [
"unconfigured@null.spigotmc.org"
] | unconfigured@null.spigotmc.org |
b92775973a5371e797ce807d9a1dc2f90e3bbf92 | 8495ab95eed9c73ae4eb5d9c17948024de14faf8 | /src/main/java/org/plug/babylon/service/ImporterService.java | 2caa0855b3b42f8a3c5cfedbde90e801bdccf7fd | [
"LicenseRef-scancode-warranty-disclaimer",
"LicenseRef-scancode-public-domain"
] | permissive | clacote/babylon | 3a3555da848e942d8070f18bf0fe0b9733901299 | a36dbcc71e2f0dafd1614bb2372f4adbfd74dc94 | refs/heads/master | 2016-08-06T01:35:12.892668 | 2011-08-23T23:36:03 | 2011-08-23T23:36:03 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,191 | java | package org.plug.babylon.service;
import org.plug.babylon.service.importer.UnmanagedFileTypeException;
import java.io.InputStream;
import javax.ejb.EJB;
import javax.ejb.Stateless;
import org.plug.babylon.model.Owner;
import org.plug.babylon.service.importer.Importer;
import org.plug.babylon.service.importer.ImporterFactory;
/**
* File import service
* @author Sryl <cyril.lacote@gmail.com>
*/
@Stateless
public class ImporterService {
@EJB
private ImporterFactory importerFactory;
@EJB
private OwnerService ownerService;
public void importFile( String filename, InputStream data) throws ImportException {
// Find owner
// FIXME Retrieve owner with current authenticated Principal
Owner owner = ownerService.getByEmail("cyril.lacote@gmail.com");
if (owner == null) {
throw new ImportException("Unable to find owner for import");
}
Importer importer = importerFactory.getImporter(filename);
if (importer != null) {
importer.importData(owner, data);
} else {
throw new UnmanagedFileTypeException(filename);
}
}
}
| [
"cyril.lacote@gmail.com"
] | cyril.lacote@gmail.com |
36e298776cad9f46a5f8d958a4e73fd804aa63aa | d917aa5eea8babff3b47ea0826550e2d42b955ba | /src/test/java/chap08/testable/UserPointCalculator.java | ed0403c650e7e785d369c1f8285e8d84d3b13e28 | [] | no_license | rheehot/tdd-junit5 | 2adac2f3c9bad2e91594eb619672bffb4e93816a | b9d75aeb34fb55f44b2426816763901d1a71f86f | refs/heads/master | 2022-11-27T01:23:00.822452 | 2020-07-26T09:18:19 | 2020-07-26T09:18:19 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 988 | java | package chap08.testable;
import chap08.subs.*;
import java.time.LocalDate;
public class UserPointCalculator {
private PointRule pointRule = new PointRule();
private Times times = new Times();
private SubscriptionDao subscriptionDao;
private ProductDao productDao;
public UserPointCalculator(SubscriptionDao subscriptionDao,
ProductDao productDao) {
this.subscriptionDao = subscriptionDao;
this.productDao = productDao;
}
public void setPointRule(PointRule pointRule) {
this.pointRule = pointRule;
}
public void setTimes(Times times) {
this.times = times;
}
public int calculatePoint(User u) {
Subscription s = subscriptionDao.selectByUser(u.getId());
if (s == null) throw new NoSubscriptionException();
Product p = productDao.selectById(s.getProductId());
LocalDate now = times.today();
return pointRule.calculate(s, p, now);
}
}
| [
"llsb156@gmail.com"
] | llsb156@gmail.com |
3d7874d3741feaef8b6c25a2fa940d8a1900b3af | 7fb128c497e0ea4392e1fb364bb3d2ff8387c269 | /app/sample/src/main/java/br/com/igorbagliotti/school/dagger/module/ActivityModule.java | a0a39799a2be0aea70444a1b9c2d6ed46b9c0b7b | [
"Apache-2.0",
"MIT"
] | permissive | igorbag/tcc_puc_software-engineer | dff51b2944b7f6bf9a20d0deedbc81229253144c | 76ab9b2cdc2d09486a509e5a79319fa58d2c2b11 | refs/heads/master | 2020-03-25T08:31:31.277753 | 2018-08-30T14:37:09 | 2018-08-30T14:37:09 | 143,617,382 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 400 | java | package br.com.igorbagliotti.school.dagger.module;
import android.app.Activity;
import android.content.Context;
import dagger.Module;
import dagger.Provides;
@Module
public class ActivityModule {
final Activity mActivity;
public ActivityModule(Activity activity) {
mActivity = activity;
}
@Provides
public Context activityContext() {
return mActivity;
}
} | [
"igor.bagliotti@gmail.com"
] | igor.bagliotti@gmail.com |
f9a7ad75c8e651fcdad1c5eac852be75d61abd5d | a85d2dccd5eab048b22b2d66a0c9b8a3fba4d6c2 | /rebellion_h5_realm/java/l2r/gameserver/tables/AugmentationData.java | 273b714308c173a4bf72adaff137a6edf86bd84c | [] | no_license | netvirus/reb_h5_storm | 96d29bf16c9068f4d65311f3d93c8794737d4f4e | 861f7845e1851eb3c22d2a48135ee88f3dd36f5c | refs/heads/master | 2023-04-11T18:23:59.957180 | 2021-04-18T02:53:10 | 2021-04-18T02:53:10 | 252,070,605 | 0 | 0 | null | 2021-04-18T02:53:11 | 2020-04-01T04:19:39 | HTML | UTF-8 | Java | false | false | 23,206 | java | package l2r.gameserver.tables;
import l2r.commons.crypt.CryptUtil;
import l2r.commons.util.Rnd;
import l2r.gameserver.Config;
import l2r.gameserver.stats.Stats;
import l2r.gameserver.stats.triggers.TriggerInfo;
import l2r.gameserver.stats.triggers.TriggerType;
import l2r.gameserver.templates.item.ItemTemplate;
import gnu.trove.list.array.TDoubleArrayList;
import gnu.trove.map.hash.TIntObjectHashMap;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;
import javax.xml.parsers.DocumentBuilderFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
public class AugmentationData
{
private static final Logger _log = LoggerFactory.getLogger(AugmentationData.class);
private static AugmentationData _Instance;
public static AugmentationData getInstance()
{
if(_Instance == null)
_Instance = new AugmentationData();
return _Instance;
}
// stats
@SuppressWarnings("unused")
private static final int STAT_START = 1;
@SuppressWarnings("unused")
private static final int STAT_END = 14560;
private static final int STAT_BLOCKSIZE = 3640;
//private static final int STAT_NUMBEROF_BLOCKS = 4;
private static final int STAT_SUBBLOCKSIZE = 91;
//private static final int STAT_NUMBEROF_SUBBLOCKS = 40;
private static final int STAT_NUM = 13;
private static final byte[] STATS1_MAP = new byte[STAT_SUBBLOCKSIZE];
private static final byte[] STATS2_MAP = new byte[STAT_SUBBLOCKSIZE];
// skills
private static final int BLUE_START = 14561;
// private static final int PURPLE_START = 14578;
// private static final int RED_START = 14685;
private static final int SKILLS_BLOCKSIZE = 178;
// basestats
private static final int BASESTAT_STR = 16341;
@SuppressWarnings("unused")
private static final int BASESTAT_CON = 16342;
@SuppressWarnings("unused")
private static final int BASESTAT_INT = 16343;
private static final int BASESTAT_MEN = 16344;
// accessory
private static final int ACC_START = 16669;
private static final int ACC_BLOCKS_NUM = 10;
private static final int ACC_STAT_SUBBLOCKSIZE = 21;
private static final int ACC_STAT_NUM = 6;
private static final int ACC_RING_START = ACC_START;
private static final int ACC_RING_SKILLS = 18;
private static final int ACC_RING_BLOCKSIZE = ACC_RING_SKILLS + 4 * ACC_STAT_SUBBLOCKSIZE;
private static final int ACC_RING_END = ACC_RING_START + ACC_BLOCKS_NUM * ACC_RING_BLOCKSIZE - 1;
private static final int ACC_EAR_START = ACC_RING_END + 1;
private static final int ACC_EAR_SKILLS = 18;
private static final int ACC_EAR_BLOCKSIZE = ACC_EAR_SKILLS + 4 * ACC_STAT_SUBBLOCKSIZE;
private static final int ACC_EAR_END = ACC_EAR_START + ACC_BLOCKS_NUM * ACC_EAR_BLOCKSIZE - 1;
private static final int ACC_NECK_START = ACC_EAR_END + 1;
private static final int ACC_NECK_SKILLS = 24;
private static final int ACC_NECK_BLOCKSIZE = ACC_NECK_SKILLS + 4 * ACC_STAT_SUBBLOCKSIZE;
@SuppressWarnings("unused")
private static final int ACC_END = ACC_NECK_START + ACC_BLOCKS_NUM * ACC_NECK_BLOCKSIZE;
private static final byte[] ACC_STATS1_MAP = new byte[ACC_STAT_SUBBLOCKSIZE];
private static final byte[] ACC_STATS2_MAP = new byte[ACC_STAT_SUBBLOCKSIZE];
private List<?>[] _augStats = new ArrayList[4];
private List<?>[] _augAccStats = new ArrayList[4];
private List<?>[] _blueSkills = new ArrayList[10];
private List<?>[] _purpleSkills = new ArrayList[10];
private List<?>[] _redSkills = new ArrayList[10];
private List<?>[] _yellowSkills = new ArrayList[10];
private TIntObjectHashMap<TriggerInfo> _allSkills = new TIntObjectHashMap<TriggerInfo>();
public AugmentationData()
{
_log.info("Initializing AugmentationData.");
_augStats[0] = new ArrayList<augmentationStat>();
_augStats[1] = new ArrayList<augmentationStat>();
_augStats[2] = new ArrayList<augmentationStat>();
_augStats[3] = new ArrayList<augmentationStat>();
_augAccStats[0] = new ArrayList<augmentationStat>();
_augAccStats[1] = new ArrayList<augmentationStat>();
_augAccStats[2] = new ArrayList<augmentationStat>();
_augAccStats[3] = new ArrayList<augmentationStat>();
// Lookup tables structure: STAT1 represent first stat, STAT2 - second.
// If both values are the same - use solo stat, if different - combined.
int idx;
// weapon augmentation block: solo values first
// 00-00, 01-01 ... 11-11,12-12
for(idx = 0; idx < STAT_NUM; idx++)
{
// solo stats
STATS1_MAP[idx] = (byte) idx;
STATS2_MAP[idx] = (byte) idx;
}
// combined values next.
// 00-01,00-02,00-03 ... 00-11,00-12;
// 01-02,01-03 ... 01-11,01-12;
// ...
// 09-10,09-11,09-12;
// 10-11,10-12;
// 11-12
for(int i = 0; i < STAT_NUM; i++)
for(int j = i + 1; j < STAT_NUM; idx++, j++)
{
// combined stats
STATS1_MAP[idx] = (byte) i;
STATS2_MAP[idx] = (byte) j;
}
idx = 0;
// accessory augmentation block, structure is different:
// 00-00,00-01,00-02,00-03,00-04,00-05
// 01-01,01-02,01-03,01-04,01-05
// 02-02,02-03,02-04,02-05
// 03-03,03-04,03-05
// 04-04 \
// 05-05 - order is changed here
// 04-05 /
// First values always solo, next are combined, except last 3 values
for(int i = 0; i < ACC_STAT_NUM - 2; i++)
for(int j = i; j < ACC_STAT_NUM; idx++, j++)
{
ACC_STATS1_MAP[idx] = (byte) i;
ACC_STATS2_MAP[idx] = (byte) j;
}
ACC_STATS1_MAP[idx] = 4;
ACC_STATS2_MAP[idx++] = 4;
ACC_STATS1_MAP[idx] = 5;
ACC_STATS2_MAP[idx++] = 5;
ACC_STATS1_MAP[idx] = 4;
ACC_STATS2_MAP[idx] = 5;
for(int i = 0; i < 10; i++)
{
_blueSkills[i] = new ArrayList<Integer>();
_purpleSkills[i] = new ArrayList<Integer>();
_redSkills[i] = new ArrayList<Integer>();
_yellowSkills[i] = new ArrayList<Integer>();
}
load();
// Use size*4: since theres 4 blocks of stat-data with equivalent size
_log.info("AugmentationData: Loaded: " + _augStats[0].size() * 4 + " augmentation stats.");
_log.info("AugmentationData: Loaded: " + _augAccStats[0].size() * 4 + " accessory augmentation stats.");
for(int i = 0; i < 10; i++)
_log.info("AugmentationData: Loaded: " + _blueSkills[i].size() + " blue, " + _purpleSkills[i].size() + " purple and " + _redSkills[i].size() + " red skills for lifeStoneLevel " + i);
}
public class augmentationStat
{
private final Stats _stat;
private final int _singleSize;
private final int _combinedSize;
private final double _singleValues[];
private final double _combinedValues[];
public augmentationStat(Stats stat, double sValues[], double cValues[])
{
_stat = stat;
_singleSize = sValues.length;
_singleValues = sValues;
_combinedSize = cValues.length;
_combinedValues = cValues;
}
public int getSingleStatSize()
{
return _singleSize;
}
public int getCombinedStatSize()
{
return _combinedSize;
}
public double getSingleStatValue(int i)
{
if(i >= _singleSize || i < 0)
return _singleValues[_singleSize - 1];
return _singleValues[i];
}
public double getCombinedStatValue(int i)
{
if(i >= _combinedSize || i < 0)
return _combinedValues[_combinedSize - 1];
return _combinedValues[i];
}
public Stats getStat()
{
return _stat;
}
}
@SuppressWarnings({ "unchecked", "resource" })
private final void load()
{
// Load the skillmap
// Note: the skillmap data is only used when generating new augmentations
// the client expects a different id in order to display the skill in the
// items description...
try
{
int badAugmantData = 0;
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setValidating(false);
factory.setIgnoringComments(true);
File file = new File(Config.DATAPACK_ROOT, "data/stats/augmentation/augmentation_skillmap.xml");
FileInputStream stream = new FileInputStream(file);
InputStream output;
if((byte)stream.read() == 0x00)
{
byte[] bytes = new byte[0];
output = new ByteArrayInputStream(bytes);
output = CryptUtil.decrypt(stream, output);
}
else
output = new FileInputStream(file);
Document doc = factory.newDocumentBuilder().parse(output);
for(Node n = doc.getFirstChild(); n != null; n = n.getNextSibling())
if("list".equalsIgnoreCase(n.getNodeName()))
for(Node d = n.getFirstChild(); d != null; d = d.getNextSibling())
if("augmentation".equalsIgnoreCase(d.getNodeName()))
{
NamedNodeMap attrs = d.getAttributes();
int skillId = 0, augmentationId = Integer.parseInt(attrs.getNamedItem("id").getNodeValue());
int skillLvL = 0;
String type = "blue";
TriggerType t = null;
double chance = 0;
for(Node cd = d.getFirstChild(); cd != null; cd = cd.getNextSibling())
{
attrs = cd.getAttributes();
if("skillId".equalsIgnoreCase(cd.getNodeName()))
{
skillId = Integer.parseInt(attrs.getNamedItem("val").getNodeValue());
}
else if("skillLevel".equalsIgnoreCase(cd.getNodeName()))
{
skillLvL = Integer.parseInt(attrs.getNamedItem("val").getNodeValue());
}
else if("type".equalsIgnoreCase(cd.getNodeName()))
{
type = attrs.getNamedItem("val").getNodeValue();
}
else if("trigger_type".equalsIgnoreCase(cd.getNodeName()))
{
t = TriggerType.valueOf(attrs.getNamedItem("val").getNodeValue());
}
else if("trigger_chance".equalsIgnoreCase(cd.getNodeName()))
{
chance = Double.parseDouble(attrs.getNamedItem("val").getNodeValue());
}
}
if(skillId == 0)
{
badAugmantData++;
continue;
}
else if(skillLvL == 0)
{
badAugmantData++;
continue;
}
int k = (augmentationId - BLUE_START) / SKILLS_BLOCKSIZE;
if(type.equalsIgnoreCase("blue"))
((List<Integer>) _blueSkills[k]).add(augmentationId);
else if(type.equalsIgnoreCase("purple"))
((List<Integer>) _purpleSkills[k]).add(augmentationId);
else if(type.equalsIgnoreCase("red"))
((List<Integer>) _redSkills[k]).add(augmentationId);
_allSkills.put(augmentationId, new TriggerInfo(skillId, skillLvL, t, chance));
}
if(badAugmantData != 0)
_log.info("AugmentationData: " + badAugmantData + " bad skill(s) were skipped.");
}
catch(Exception e)
{
_log.error("Error parsing augmentation_skillmap.xml.", e);
return;
}
// Load the stats from xml
for(int i = 1; i < 5; i++)
{
try
{
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setValidating(false);
factory.setIgnoringComments(true);
File file = new File(Config.DATAPACK_ROOT, "data/stats/augmentation/augmentation_stats" + i + ".xml");
FileInputStream stream = new FileInputStream(file);
InputStream output;
if((byte)stream.read() == 0x00)
{
byte[] bytes = new byte[0];
output = new ByteArrayInputStream(bytes);
output = CryptUtil.decrypt(stream, output);
}
else
output = new FileInputStream(file);
Document doc = factory.newDocumentBuilder().parse(output);
for(Node n = doc.getFirstChild(); n != null; n = n.getNextSibling())
if("list".equalsIgnoreCase(n.getNodeName()))
for(Node d = n.getFirstChild(); d != null; d = d.getNextSibling())
if("stat".equalsIgnoreCase(d.getNodeName()))
{
NamedNodeMap attrs = d.getAttributes();
String statName = attrs.getNamedItem("name").getNodeValue();
double soloValues[] = null, combinedValues[] = null;
for(Node cd = d.getFirstChild(); cd != null; cd = cd.getNextSibling())
if("table".equalsIgnoreCase(cd.getNodeName()))
{
attrs = cd.getAttributes();
String tableName = attrs.getNamedItem("name").getNodeValue();
StringTokenizer data = new StringTokenizer(cd.getFirstChild().getNodeValue());
TDoubleArrayList array = new TDoubleArrayList();
while(data.hasMoreTokens())
array.add(Double.parseDouble(data.nextToken()));
if(tableName.equalsIgnoreCase("#soloValues"))
{
soloValues = new double[array.size()];
int x = 0;
for(double value : array.toArray())
soloValues[x++] = value;
}
else
{
combinedValues = new double[array.size()];
int x = 0;
for(double value : array.toArray())
combinedValues[x++] = value;
}
}
// store this stat
((List<augmentationStat>) _augStats[(i - 1)]).add(new augmentationStat(Stats.valueOfXml(statName), soloValues, combinedValues));
}
}
catch(Exception e)
{
_log.error("Error parsing augmentation_stats" + i + ".xml.", e);
return;
}
try
{
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setValidating(false);
factory.setIgnoringComments(true);
File file = new File(Config.DATAPACK_ROOT, "data/stats/augmentation/augmentation_jewel_stats" + i + ".xml");
FileInputStream stream = new FileInputStream(file);
InputStream output;
if((byte)stream.read() == 0x00)
{
byte[] bytes = new byte[0];
output = new ByteArrayInputStream(bytes);
output = CryptUtil.decrypt(stream, output);
}
else
output = new FileInputStream(file);
Document doc = factory.newDocumentBuilder().parse(output);
for(Node n = doc.getFirstChild(); n != null; n = n.getNextSibling())
if("list".equalsIgnoreCase(n.getNodeName()))
for(Node d = n.getFirstChild(); d != null; d = d.getNextSibling())
if("stat".equalsIgnoreCase(d.getNodeName()))
{
NamedNodeMap attrs = d.getAttributes();
String statName = attrs.getNamedItem("name").getNodeValue();
double soloValues[] = null, combinedValues[] = null;
for(Node cd = d.getFirstChild(); cd != null; cd = cd.getNextSibling())
if("table".equalsIgnoreCase(cd.getNodeName()))
{
attrs = cd.getAttributes();
String tableName = attrs.getNamedItem("name").getNodeValue();
StringTokenizer data = new StringTokenizer(cd.getFirstChild().getNodeValue());
TDoubleArrayList array = new TDoubleArrayList();
while(data.hasMoreTokens())
array.add(Double.parseDouble(data.nextToken()));
if(tableName.equalsIgnoreCase("#soloValues"))
{
soloValues = new double[array.size()];
int x = 0;
for(double value : array.toArray())
soloValues[x++] = value;
}
else
{
combinedValues = new double[array.size()];
int x = 0;
for(double value : array.toArray())
combinedValues[x++] = value;
}
}
// store this stat
((List<augmentationStat>) _augAccStats[(i - 1)]).add(new augmentationStat(Stats.valueOfXml(statName), soloValues, combinedValues));
}
}
catch(Exception e)
{
_log.error("Error parsing jewel augmentation_stats" + i + ".xml.", e);
return;
}
}
}
public int generateRandomAugmentation(int lifeStoneLevel, int lifeStoneGrade, int bodyPart)
{
switch(bodyPart)
{
case ItemTemplate.SLOT_L_FINGER:
case ItemTemplate.SLOT_R_FINGER:
case ItemTemplate.SLOT_L_FINGER | ItemTemplate.SLOT_R_FINGER:
case ItemTemplate.SLOT_L_EAR:
case ItemTemplate.SLOT_R_EAR:
case ItemTemplate.SLOT_L_EAR | ItemTemplate.SLOT_R_EAR:
case ItemTemplate.SLOT_NECK:
return generateRandomAccessoryAugmentation(lifeStoneLevel, bodyPart);
default:
return generateRandomWeaponAugmentation(lifeStoneLevel, lifeStoneGrade);
}
}
private int generateRandomWeaponAugmentation(int lifeStoneLevel, int lifeStoneGrade)
{
// Note that stat12 stands for stat 1 AND 2 (same for stat34 ;p )
// this is because a value can contain up to 2 stat modifications
// (there are two int values packed in one integer value, meaning 4 stat modifications at max)
// for more info take a look at getAugStatsById(...)
// Note: lifeStoneGrade: (0 means low grade, 3 top grade)
// First: determine whether we will add a skill/baseStatModifier or not
// because this determine which color could be the result
int stat12 = 0;
int stat34 = 0;
boolean generateSkill = false;
boolean generateGlow = false;
//lifestonelevel is used for stat Id and skill level, but here the max level is 9
lifeStoneLevel = Math.min(lifeStoneLevel, 9);
switch(lifeStoneGrade)
{
case 0:
generateSkill = Rnd.chance(Config.AUGMENTATION_NG_SKILL_CHANCE);
generateGlow = Rnd.chance(Config.AUGMENTATION_NG_GLOW_CHANCE);
break;
case 1:
generateSkill = Rnd.chance(Config.AUGMENTATION_MID_SKILL_CHANCE);
generateGlow = Rnd.chance(Config.AUGMENTATION_MID_GLOW_CHANCE);
break;
case 2:
generateSkill = Rnd.chance(Config.AUGMENTATION_HIGH_SKILL_CHANCE);
generateGlow = Rnd.chance(Config.AUGMENTATION_HIGH_GLOW_CHANCE);
break;
case 3:
generateSkill = Rnd.chance(Config.AUGMENTATION_TOP_SKILL_CHANCE);
generateGlow = Rnd.chance(Config.AUGMENTATION_TOP_GLOW_CHANCE);
break;
}
if(!generateSkill && Rnd.get(1, 100) <= Config.AUGMENTATION_BASESTAT_CHANCE)
stat34 = Rnd.get(BASESTAT_STR, BASESTAT_MEN);
// Second: decide which grade the augmentation result is going to have:
// 0:yellow, 1:blue, 2:purple, 3:red
// The chances used here are most likely custom,
// whats known is: you cant have yellow with skill(or baseStatModifier)
// noGrade stone can not have glow, mid only with skill, high has a chance(custom), top allways glow
int resultColor = Rnd.get(0, 100);
if(stat34 == 0 && !generateSkill)
if(resultColor <= 15 * lifeStoneGrade + 40)
resultColor = 1;
else
resultColor = 0;
else if(resultColor <= 10 * lifeStoneGrade + 5 || stat34 != 0)
resultColor = 3;
else if(resultColor <= 10 * lifeStoneGrade + 10)
resultColor = 1;
else
resultColor = 2;
// generate a skill if neccessary
if(generateSkill)
{
switch(resultColor)
{
case 1: // blue skill
stat34 = (Integer) _blueSkills[lifeStoneLevel].get(Rnd.get(0, _blueSkills[lifeStoneLevel].size() - 1));
break;
case 2: // purple skill
stat34 = (Integer) _purpleSkills[lifeStoneLevel].get(Rnd.get(0, _purpleSkills[lifeStoneLevel].size() - 1));
break;
case 3: // red skill
stat34 = (Integer) _redSkills[lifeStoneLevel].get(Rnd.get(0, _redSkills[lifeStoneLevel].size() - 1));
break;
}
}
// Third: Calculate the subblock offset for the choosen color,
// and the level of the lifeStone
// from large number of retail augmentations:
// no skill part
// Id for stat12:
// A:1-910 B:911-1820 C:1821-2730 D:2731-3640 E:3641-4550 F:4551-5460 G:5461-6370 H:6371-7280
// Id for stat34(this defines the color):
// I:7281-8190(yellow) K:8191-9100(blue) L:10921-11830(yellow) M:11831-12740(blue)
// you can combine I-K with A-D and L-M with E-H
// using C-D or G-H Id you will get a glow effect
// there seems no correlation in which grade use which Id except for the glowing restriction
// skill part
// Id for stat12:
// same for no skill part
// A same as E, B same as F, C same as G, D same as H
// A - no glow, no grade LS
// B - weak glow, mid grade LS?
// C - glow, high grade LS?
// D - strong glow, top grade LS?
// is neither a skill nor basestat used for stat34? then generate a normal stat
int offset;
if(stat34 == 0)
{
int temp = Rnd.get(2, 3);
int colorOffset = resultColor * 10 * STAT_SUBBLOCKSIZE + temp * STAT_BLOCKSIZE + 1;
offset = lifeStoneLevel * STAT_SUBBLOCKSIZE + colorOffset;
stat34 = Rnd.get(offset, offset + STAT_SUBBLOCKSIZE - 1);
if(generateGlow && lifeStoneGrade >= 2)
offset = lifeStoneLevel * STAT_SUBBLOCKSIZE + (temp - 2) * STAT_BLOCKSIZE + lifeStoneGrade * 10 * STAT_SUBBLOCKSIZE + 1;
else
offset = lifeStoneLevel * STAT_SUBBLOCKSIZE + (temp - 2) * STAT_BLOCKSIZE + Rnd.get(0, 1) * 10 * STAT_SUBBLOCKSIZE + 1;
}
else if(!generateGlow)
offset = lifeStoneLevel * STAT_SUBBLOCKSIZE + Rnd.get(0, 1) * STAT_BLOCKSIZE + 1;
else
offset = lifeStoneLevel * STAT_SUBBLOCKSIZE + Rnd.get(0, 1) * STAT_BLOCKSIZE + (lifeStoneGrade + resultColor) / 2 * 10 * STAT_SUBBLOCKSIZE + 1;
stat12 = Rnd.get(offset, offset + STAT_SUBBLOCKSIZE - 1);
return ((stat34 << 16) + stat12);
}
private int generateRandomAccessoryAugmentation(int lifeStoneLevel, int bodyPart)
{
int stat12 = 0;
int stat34 = 0;
int base = 0;
int skillsLength = 0;
lifeStoneLevel = Math.min(lifeStoneLevel, 9);
switch(bodyPart)
{
case ItemTemplate.SLOT_L_FINGER:
case ItemTemplate.SLOT_R_FINGER:
case ItemTemplate.SLOT_L_FINGER | ItemTemplate.SLOT_R_FINGER:
base = ACC_RING_START + ACC_RING_BLOCKSIZE * lifeStoneLevel;
skillsLength = ACC_RING_SKILLS;
break;
case ItemTemplate.SLOT_L_EAR:
case ItemTemplate.SLOT_R_EAR:
case ItemTemplate.SLOT_L_EAR | ItemTemplate.SLOT_R_EAR:
base = ACC_EAR_START + ACC_EAR_BLOCKSIZE * lifeStoneLevel;
skillsLength = ACC_EAR_SKILLS;
break;
case ItemTemplate.SLOT_NECK:
base = ACC_NECK_START + ACC_NECK_BLOCKSIZE * lifeStoneLevel;
skillsLength = ACC_NECK_SKILLS;
break;
default:
return 0;
}
int resultColor = Rnd.get(0, 3);
TriggerInfo triggerInfo = null;
// first augmentation (stats only)
stat12 = Rnd.get(ACC_STAT_SUBBLOCKSIZE);
if(Rnd.get(1, 100) <= Config.AUGMENTATION_ACC_SKILL_CHANCE)
{
// second augmentation (skill)
stat34 = base + Rnd.get(skillsLength);
triggerInfo = _allSkills.get(stat34);
}
if(triggerInfo == null)
{
// second augmentation (stats)
// calculating any different from stat12 value inside sub-block
// starting from next and wrapping over using remainder
stat34 = (stat12 + 1 + Rnd.get(ACC_STAT_SUBBLOCKSIZE - 1)) % ACC_STAT_SUBBLOCKSIZE;
// this is a stats - skipping skills
stat34 = base + skillsLength + ACC_STAT_SUBBLOCKSIZE * resultColor + stat34;
}
// stat12 has stats only
stat12 = base + skillsLength + ACC_STAT_SUBBLOCKSIZE * resultColor + stat12;
return ((stat34 << 16) + stat12);
}
public TriggerInfo getAugmentTrigger(int skillId)
{
return _allSkills.get(skillId);
}
} | [
"l2agedev@gmail.com"
] | l2agedev@gmail.com |
2fc8029d56d6e89a46579d6b97130ece84d75613 | 6967c77c6ccf286919576f4bce9bd861592f68e0 | /mvp4g2-processor/src/test/resources/com/github/mvp4g/mvp4g2/processor/eventbus/filterAnnotationOnAMethod/IMockShellView.java | d3ad5fdd67f9ca4dbfbe38bfb92a43412304ae0e | [
"Apache-2.0"
] | permissive | mvp4g/mvp4g2 | 3caaf07f504487675ab4e8539dcccd5276fc2694 | 24f65ac7ad70b70dd12dc84af6a654c46b13a51a | refs/heads/master | 2021-01-10T06:55:38.716424 | 2019-06-17T09:04:46 | 2019-06-17T09:04:46 | 46,654,747 | 24 | 5 | Apache-2.0 | 2018-05-01T10:11:13 | 2015-11-22T09:55:03 | Java | UTF-8 | Java | false | false | 258 | java | package com.github.mvp4g.mvp4g2.processor.eventbus.filterAnnotationOnAMethod;
import com.github.mvp4g.mvp4g2.core.ui.IsLazyReverseView;
public interface IMockShellView
extends IsLazyReverseView<IMockShellView.Presenter> {
interface Presenter {
}
}
| [
"frank.hossfeld@googlemail.com"
] | frank.hossfeld@googlemail.com |
fa84965765490e5da347cc0e16c6cd8c41f80134 | 31f3164dbf1e6101c8f5895ea332167bb47f1a71 | /PhoneController/app/src/test/java/alchemist/myapplication/ExampleUnitTest.java | e590e8115844fb294371f164a7f0f17fbda231d9 | [] | no_license | Sam-567/RpiCar | 566f3f537032b9ef008d46f3e840ca4aba948e9b | 774d1820150860d8246e6b0b050e5f6079a15b6e | refs/heads/master | 2020-03-17T00:26:34.337127 | 2018-11-07T10:55:14 | 2018-11-07T10:55:14 | 133,116,709 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 401 | java | package alchemist.myapplication;
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() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"sam.chapman567@gmail.com"
] | sam.chapman567@gmail.com |
2ed4571b4a6647b5c1c417bca32885768a1d268c | 8af1164bac943cef64e41bae312223c3c0e38114 | /results-java/serge-rider--dbeaver/6a41d13aa7d9a91c5d9ce42e9e94b9da2fe51f34/before/NavigatorUtils.java | d542affea515449cc0c7a22def0a3111d132584a | [] | no_license | fracz/refactor-extractor | 3ae45c97cc63f26d5cb8b92003b12f74cc9973a9 | dd5e82bfcc376e74a99e18c2bf54c95676914272 | refs/heads/master | 2021-01-19T06:50:08.211003 | 2018-11-30T13:00:57 | 2018-11-30T13:00:57 | 87,353,478 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 18,029 | java | /*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2016 Serge Rieder (serge@jkiss.org)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License (version 2)
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
package org.jkiss.dbeaver.ui.navigator;
import org.eclipse.jface.action.*;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.dnd.*;
import org.eclipse.swt.events.MenuEvent;
import org.eclipse.swt.events.MenuListener;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.swt.widgets.TreeItem;
import org.eclipse.ui.IWorkbenchActionConstants;
import org.eclipse.ui.IWorkbenchCommandConstants;
import org.eclipse.ui.IWorkbenchPartSite;
import org.eclipse.ui.IWorkbenchSite;
import org.eclipse.ui.dialogs.PreferencesUtil;
import org.eclipse.ui.menus.UIElement;
import org.eclipse.ui.part.IPageSite;
import org.eclipse.ui.services.IServiceLocator;
import org.jkiss.dbeaver.DBException;
import org.jkiss.dbeaver.core.DBeaverCore;
import org.jkiss.dbeaver.core.DBeaverUI;
import org.jkiss.dbeaver.model.DBPNamedObject;
import org.jkiss.dbeaver.model.DBUtils;
import org.jkiss.dbeaver.model.navigator.DBNDatabaseFolder;
import org.jkiss.dbeaver.model.navigator.DBNDatabaseNode;
import org.jkiss.dbeaver.model.navigator.DBNNode;
import org.jkiss.dbeaver.model.navigator.DBNProject;
import org.jkiss.dbeaver.model.struct.DBSObject;
import org.jkiss.dbeaver.model.struct.DBSObjectSelector;
import org.jkiss.dbeaver.model.struct.DBSWrapper;
import org.jkiss.dbeaver.ui.*;
import org.jkiss.dbeaver.ui.actions.navigator.NavigatorActionSetActiveObject;
import org.jkiss.dbeaver.ui.dnd.DatabaseObjectTransfer;
import org.jkiss.dbeaver.ui.dnd.TreeNodeTransfer;
import org.jkiss.utils.CommonUtils;
import java.util.*;
/**
* Navigator utils
*/
public class NavigatorUtils {
public static final String MB_NAVIGATOR_ADDITIONS = "navigator_additions";
public static DBNNode getSelectedNode(ISelectionProvider selectionProvider)
{
if (selectionProvider == null) {
return null;
}
return getSelectedNode(selectionProvider.getSelection());
}
public static DBNNode getSelectedNode(ISelection selection)
{
if (selection.isEmpty()) {
return null;
}
if (selection instanceof IStructuredSelection) {
Object selectedObject = ((IStructuredSelection)selection).getFirstElement();
if (selectedObject instanceof DBNNode) {
return (DBNNode) selectedObject;
}
}
return null;
}
/**
* Find selected node for specified UI element
* @param element ui element
* @return ndoe or null
*/
public static DBNNode getSelectedNode(UIElement element)
{
ISelectionProvider selectionProvider = UIUtils.getSelectionProvider(element.getServiceLocator());
if (selectionProvider != null) {
return NavigatorUtils.getSelectedNode(selectionProvider);
} else {
return null;
}
}
public static DBSObject getSelectedObject(IStructuredSelection selection)
{
if (selection.isEmpty()) {
return null;
}
return DBUtils.getFromObject(selection.getFirstElement());
}
public static List<DBSObject> getSelectedObjects(IStructuredSelection selection)
{
if (selection.isEmpty()) {
return Collections.emptyList();
}
List<DBSObject> result = new ArrayList<>();
for (Iterator iter = selection.iterator(); iter.hasNext(); ) {
DBSObject selectedObject = DBUtils.getFromObject(iter.next());
if (selectedObject != null) {
result.add(selectedObject);
}
}
return result;
}
public static void addContextMenu(final IWorkbenchSite workbenchSite, final ISelectionProvider selectionProvider, final Control control)
{
addContextMenu(workbenchSite, selectionProvider, control, null);
}
public static void addContextMenu(final IWorkbenchSite workbenchSite, final ISelectionProvider selectionProvider, final Control control, final IMenuListener menuListener)
{
MenuManager menuMgr = createContextMenu(workbenchSite, selectionProvider, control, menuListener);
if (workbenchSite instanceof IWorkbenchPartSite) {
((IWorkbenchPartSite)workbenchSite).registerContextMenu(menuMgr, selectionProvider);
} else if (workbenchSite instanceof IPageSite) {
((IPageSite)workbenchSite).registerContextMenu("navigatorMenu", menuMgr, selectionProvider);
}
}
public static MenuManager createContextMenu(final IWorkbenchSite workbenchSite, final ISelectionProvider selectionProvider, final Control control, IMenuListener menuListener)
{
MenuManager menuMgr = new MenuManager();
Menu menu = menuMgr.createContextMenu(control);
menu.addMenuListener(new MenuListener()
{
@Override
public void menuHidden(MenuEvent e)
{
}
@Override
public void menuShown(MenuEvent e)
{
Menu m = (Menu)e.widget;
DBNNode node = getSelectedNode(selectionProvider.getSelection());
if (node != null && !node.isLocked() && node.allowsOpen()) {
// Dirty hack
// Get contribution item from menu item and check it's ID
for (MenuItem item : m.getItems()) {
Object itemData = item.getData();
if (itemData instanceof IContributionItem) {
String contribId = ((IContributionItem)itemData).getId();
if (contribId != null && contribId.equals(ICommandIds.CMD_OBJECT_OPEN)) {
m.setDefaultItem(item);
}
}
}
}
}
});
menuMgr.addMenuListener(new IMenuListener() {
@Override
public void menuAboutToShow(final IMenuManager manager)
{
ViewerColumnController columnController = ViewerColumnController.getFromControl(control);
if (columnController != null && columnController.isClickOnHeader()) {
columnController.fillConfigMenu(manager);
manager.add(new Separator());
return;
}
// Fill context menu
final IStructuredSelection selection = (IStructuredSelection)selectionProvider.getSelection();
final DBNNode selectedNode = getSelectedNode(selectionProvider);
if (selectedNode == null || selectedNode.isLocked()) {
//manager.
return;
}
manager.add(new GroupMarker(MB_NAVIGATOR_ADDITIONS));
if (workbenchSite != null) {
// Add "Set active object" menu
if (selectedNode.isPersisted() && selectedNode instanceof DBNDatabaseNode && !(selectedNode instanceof DBNDatabaseFolder) && ((DBNDatabaseNode)selectedNode).getObject() != null) {
final DBSObjectSelector activeContainer = DBUtils.getParentAdapter(
DBSObjectSelector.class, ((DBNDatabaseNode) selectedNode).getObject());
if (activeContainer != null && activeContainer.supportsDefaultChange()) {
DBSObject activeChild;
activeChild = activeContainer.getDefaultObject();
if (activeChild != ((DBNDatabaseNode)selectedNode).getObject()) {
DBNDatabaseNode databaseNode = (DBNDatabaseNode)selectedNode;
if (databaseNode.getObject() != null && (activeChild == null || activeChild.getClass() == databaseNode.getObject().getClass())) {
String text = "Set Active ";// + databaseNode.getNodeType();
IAction action = ActionUtils.makeAction(new NavigatorActionSetActiveObject(), workbenchSite, selection, text, null, null);
manager.add(action);
}
}
}
}
}
manager.add(new Separator());
manager.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
manager.add(new GroupMarker(IActionConstants.MB_ADDITIONS_END));
IServiceLocator serviceLocator;
if (workbenchSite != null) {
serviceLocator = workbenchSite;
} else {
serviceLocator = DBeaverUI.getActiveWorkbenchWindow();
}
// Add properties button
if (PreferencesUtil.hasPropertiesContributors(selection.getFirstElement())) {
//propertyDialogAction.selectionChanged(selection);
//manager.add(propertyDialogAction);
manager.add(ActionUtils.makeCommandContribution(serviceLocator, IWorkbenchCommandConstants.FILE_PROPERTIES));
}
if (selectedNode.isPersisted()) {
// Add refresh button
manager.add(ActionUtils.makeCommandContribution(serviceLocator, IWorkbenchCommandConstants.FILE_REFRESH));
}
manager.add(new GroupMarker(ICommandIds.GROUP_TOOLS));
}
});
if (menuListener != null) {
menuMgr.addMenuListener(menuListener);
}
menuMgr.setRemoveAllWhenShown(true);
control.setMenu(menu);
return menuMgr;
}
public static void addDragAndDropSupport(final Viewer viewer)
{
Transfer[] types = new Transfer[] {TextTransfer.getInstance(), TreeNodeTransfer.getInstance(), DatabaseObjectTransfer.getInstance()};
int operations = DND.DROP_MOVE | DND.DROP_COPY | DND.DROP_LINK;
final DragSource source = new DragSource(viewer.getControl(), operations);
source.setTransfer(types);
source.addDragListener (new DragSourceListener() {
private IStructuredSelection selection;
@Override
public void dragStart(DragSourceEvent event) {
selection = (IStructuredSelection) viewer.getSelection();
}
@Override
public void dragSetData (DragSourceEvent event) {
if (!selection.isEmpty()) {
List<DBNNode> nodes = new ArrayList<>();
List<DBPNamedObject> objects = new ArrayList<>();
String lineSeparator = CommonUtils.getLineSeparator();
StringBuilder buf = new StringBuilder();
for (Iterator<?> i = selection.iterator(); i.hasNext(); ) {
Object nextSelected = i.next();
if (!(nextSelected instanceof DBNNode)) {
continue;
}
nodes.add((DBNNode)nextSelected);
String nodeName;
if (nextSelected instanceof DBNDatabaseNode) {
DBSObject object = ((DBNDatabaseNode)nextSelected).getObject();
if (object == null) {
continue;
}
nodeName = DBUtils.getObjectFullName(object);
objects.add(object);
} else {
nodeName = ((DBNNode)nextSelected).getNodeName();
}
if (buf.length() > 0) {
buf.append(lineSeparator);
}
buf.append(nodeName);
}
if (TreeNodeTransfer.getInstance().isSupportedType(event.dataType)) {
event.data = nodes;
} else if (DatabaseObjectTransfer.getInstance().isSupportedType(event.dataType)) {
event.data = objects;
} else if (TextTransfer.getInstance().isSupportedType(event.dataType)) {
event.data = buf.toString();
}
} else {
if (TreeNodeTransfer.getInstance().isSupportedType(event.dataType)) {
event.data = Collections.emptyList();
} else if (DatabaseObjectTransfer.getInstance().isSupportedType(event.dataType)) {
event.data = Collections.emptyList();
} else if (TextTransfer.getInstance().isSupportedType(event.dataType)) {
event.data = "";
}
}
}
@Override
public void dragFinished(DragSourceEvent event) {
}
});
DropTarget dropTarget = new DropTarget(viewer.getControl(), DND.DROP_MOVE);
dropTarget.setTransfer(new Transfer[] {TreeNodeTransfer.getInstance()});
dropTarget.addDropListener(new DropTargetListener() {
@Override
public void dragEnter(DropTargetEvent event)
{
handleDragEvent(event);
}
@Override
public void dragLeave(DropTargetEvent event)
{
handleDragEvent(event);
}
@Override
public void dragOperationChanged(DropTargetEvent event)
{
handleDragEvent(event);
}
@Override
public void dragOver(DropTargetEvent event)
{
handleDragEvent(event);
}
@Override
public void drop(DropTargetEvent event)
{
handleDragEvent(event);
if (event.detail == DND.DROP_MOVE) {
moveNodes(event);
}
}
@Override
public void dropAccept(DropTargetEvent event)
{
handleDragEvent(event);
}
private void handleDragEvent(DropTargetEvent event)
{
event.detail = isDropSupported(event) ? DND.DROP_MOVE : DND.DROP_NONE;
event.feedback = DND.FEEDBACK_SELECT;
}
private boolean isDropSupported(DropTargetEvent event)
{
if (TreeNodeTransfer.getInstance().isSupportedType(event.currentDataType) && event.item instanceof TreeItem) {
TreeItem treeItem = (TreeItem)event.item;
Object curObject = treeItem.getData();
if (curObject instanceof DBNNode) {
Collection<DBNNode> nodesToDrop = (Collection<DBNNode>) event.data;
if (!CommonUtils.isEmpty(nodesToDrop)) {
for (DBNNode node : nodesToDrop) {
if (!((DBNNode)curObject).supportsDrop(node)) {
return false;
}
}
return true;
} else {
return ((DBNNode)curObject).supportsDrop(null);
}
}
}
return false;
}
private void moveNodes(DropTargetEvent event)
{
if (TreeNodeTransfer.getInstance().isSupportedType(event.currentDataType) && event.item instanceof TreeItem) {
TreeItem treeItem = (TreeItem)event.item;
Object curObject = treeItem.getData();
if (curObject instanceof DBNNode) {
Collection<DBNNode> nodesToDrop = TreeNodeTransfer.getInstance().getObject();
try {
((DBNNode)curObject).dropNodes(nodesToDrop);
} catch (DBException e) {
UIUtils.showErrorDialog(viewer.getControl().getShell(), "Drop error", "Can't drop node", e);
}
}
}
}
});
}
public static boolean isDefaultElement(Object element)
{
if (element instanceof DBSWrapper) {
DBSObject object = ((DBSWrapper) element).getObject();
DBSObjectSelector activeContainer = DBUtils.getParentAdapter(
DBSObjectSelector.class, object);
if (activeContainer != null) {
return activeContainer.getDefaultObject() == object;
}
} else if (element instanceof DBNProject) {
if (((DBNProject)element).getProject() == DBeaverCore.getInstance().getProjectRegistry().getActiveProject()) {
return true;
}
}
return false;
}
} | [
"fraczwojciech@gmail.com"
] | fraczwojciech@gmail.com |
64115244e3680c44844508423326777e3bca1c88 | 022a88182d7f6921257f97608cb328ed648b0810 | /Algorithms/The_Full_Counting_Sort/Solution.java | d269551378924ed7362d413db37ccdded7ced577 | [] | no_license | Schifty87/Hacker-Rank | f18eb8534bcf2fa511c879eaf7e94e009b81f37d | 3f0261e26388b53379d538c5a99e02b588d96817 | refs/heads/master | 2021-01-25T04:48:09.511224 | 2017-09-06T18:33:21 | 2017-09-06T18:33:21 | 93,466,764 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,427 | java | package The_Full_Counting_Sort;
/*Problem
*
*You are given a list of number-string pairs.
* Put them in order based on the number. No sorting
* is needed beyond that. First come first served based
* on the number.
* The first half of the number-string pairs are represented
* by '-' instead of the string.
*
*
* Solution
*
* Java cannot chain HashMaps on its own. In order to do it, I
* used a HashMap<Integer, ArrayList<String>>.
*
*/
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Scanner;
public class Solution {
public static void main(String[] args){
Scanner s = new Scanner(System.in);
int n = s.nextInt();
//java cannot chain hashmaps, so use an arraylist as a value
HashMap<Integer, ArrayList<String>> hmap = new HashMap<Integer, ArrayList<String>>();
for(int i=0; i<n; i++){
int x = s.nextInt();
String y = s.next();
/*replace string value if it is in the first
half of the user-input*/
if(i<n/2){
y = "-";
}
if(hmap.containsKey(x)){
ArrayList a = hmap.get(x);
a.add(y);
hmap.put(x, a);
}
else{
ArrayList<String> b = new ArrayList<String>();
b.add(y);
hmap.put(x,b);
}
}
for(int i=0; i<hmap.size(); i++){
ArrayList x = hmap.get(i);
for(int j=0; j<x.size(); j++){
System.out.print(x.get(j) + " ");
}
}
}
}
| [
"ryan.j.schiferl@gmail.com"
] | ryan.j.schiferl@gmail.com |
b3d412d0745ff2fc65ceb479205cf6ea98379b10 | f83d2ad905cde0a2f3d03bca1d32efbf978d8646 | /src/edu/uta/cse/group9/controller/CancelAppointmentController.java | 129bd1994d58a487ffee580d26a2a4ccf10b5dd0 | [] | no_license | gurleenkaur793/MavAdvisingSystem | e7b50cfa88cd15ecf6329a66783722f7c06cadbe | 49b342ffff056889f7210ce3c2c90fbce88265f8 | refs/heads/master | 2021-01-19T19:59:12.574818 | 2017-04-17T05:37:16 | 2017-04-17T05:37:16 | 88,472,593 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,500 | java | package edu.uta.cse.group9.controller;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import edu.uta.cse.group9.database.DatabaseManager;
import edu.uta.cse.group9.model.AdvisingTask;
import edu.uta.cse.group9.model.Advisor;
import edu.uta.cse.group9.model.Appointment;
import edu.uta.cse.group9.model.AppointmentStatus;
import edu.uta.cse.group9.model.Student;
import edu.uta.cse.group9.util.JSPMap;
import edu.uta.cse.group9.util.ServletMap;
@WebServlet(ServletMap.APPOINTMENT_CANCEL)
public class CancelAppointmentController extends Controller {
private static final long serialVersionUID = 1L;
private static final String[] PERMISSIONS = new String[] {
Student.class.getName(),
Advisor.class.getName(),
};
public CancelAppointmentController() {
super();
}
@Override
protected void performGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
getServletContext().getRequestDispatcher(JSPMap.CANCEL_APPOINTMENT_URL).forward(request, response);
}
@Override
protected void performPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String reason = request.getParameter("reason");
try {
DatabaseManager dbmgr = new DatabaseManager();
Appointment appointment = (Appointment) request.getSession().getAttribute("id");
appointment.setStatus(AppointmentStatus.SCHEDULED);
appointment.setAdvisorNotes(reason);
if(dbmgr.updateAppointment(appointment)){
request.setAttribute("success", "Appointment successfully cancelled!");
// TODO: Send email to advisor and student with Appointment info
getServletContext().getRequestDispatcher(ServletMap.HOME).forward(request, response);
return;
} else {
request.setAttribute("error", "An unknown error occurred.");
getServletContext().getRequestDispatcher(JSPMap.CANCEL_APPOINTMENT_URL).forward(request, response);
return;
}
} catch(Exception e) {
request.setAttribute("error", e.getMessage());
getServletContext().getRequestDispatcher(JSPMap.CANCEL_APPOINTMENT_URL).forward(request, response);
return;
}
}
@Override
protected String[] authorizedGetUsers() {
return PERMISSIONS;
}
@Override
protected String[] authorizedPostUsers() {
return PERMISSIONS;
}
}
| [
"gurleen.kaur@mavs.uta.edu"
] | gurleen.kaur@mavs.uta.edu |
de016cfa3859f290c40a1106765ed7cb830555f2 | 007e59c0e522bbec5d3dd37c81e01da4a4601a88 | /7_sakila/src/main/java/hu/uni/eszterhazy/framework/dao/entity/CityEntity.java | 8b2a7e853cd335db2e93759e0090705214dc1ca5 | [] | no_license | ZsoltToth/FrameworkBasedDevelopment2020 | 1e9bf38960f8d2a1454c4f02a597c1808184a45d | d9609b2e781838781eff287f6886db074e112f5d | refs/heads/master | 2023-01-14T14:47:03.683446 | 2020-11-23T10:17:14 | 2020-11-23T10:17:14 | 297,224,717 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 654 | java | package hu.uni.eszterhazy.framework.dao.entity;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.*;
import java.sql.Timestamp;
@Entity
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table(name = "city", schema = "sakila")
public class CityEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name="city_id")
private int id;
@Column
private String city;
@ManyToOne
@JoinColumn(name = "country_id")
private CountryEntity country;
@Column(name="last_update")
private Timestamp lastUpdate;
}
| [
"tothzs87@gmail.com"
] | tothzs87@gmail.com |
b78dc50afebcd8f3b5ea4466d9fed286d0e24fef | bfe4f1d5f0b1472ad0e195e8fb72c545b8ab1ff6 | /src/com/fg/Collection/TreeMapTest.java | 9ea7b3a25f902aa03b3d039345b30caea228f443 | [] | no_license | kentGuo/Java_practice1 | 93bd99255af3af77d4eadda43a4a568da9c5661f | 459bc7626c64dd91146438ae506ac075c87eb856 | refs/heads/master | 2020-03-27T01:31:41.653782 | 2019-03-25T14:37:05 | 2019-03-25T14:37:05 | 145,719,378 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,541 | java | package com.fg.Collection;
import java.util.Set;
import java.util.TreeMap;
class R1 implements Comparable<Object>{
int count;
public R1(int count) {
this.count=count;
}
@Override
public String toString() {
return "R[count:"+count+"]";
}
//根据count来判断两个对象是否相等
@Override
public boolean equals(Object obj) {
if(this==obj) return true;
if(obj!=null&&obj.getClass()==R1.class) {
R1 r=(R1)obj;
return r.count==this.count;
}
return false;
}
//根据count属性值来判断两个对象的大小
@Override
public int compareTo(Object o) {
// TODO Auto-generated method stub
R1 r=(R1)o;
return count>r.count?1:count<r.count-1?-1:0;
}}
public class TreeMapTest {
public static void main(String[] args) {
TreeMap<Object, Object> tm=new TreeMap<>();
tm.put(new R1(3), "java");
tm.put(new R1(-5), "c++");
tm.put(new R1(9), "c");
Set<Object> set=tm.keySet();
Object[] o2=set.toArray();
for(Object o:o2) {
System.out.println(o);
}
System.out.println(tm);
//返回TreeMap的对个Entry对象
System.out.println(tm.firstEntry());
//返回该TreeMap的最后一个key值
System.out.println(tm.lastKey());
//返回该TreeMap的比newR1(2)大的最小key值
System.out.println(tm.higherKey(new R1(2)));
//返回该TreeMap的比newR1(2)小的最大的key-value对
System.out.println(tm.lowerKey(new R1(2)));
//返回该TreeMap的子TreeMap
System.out.println(tm.subMap(new R1(-1), new R1(4)));
}
}
| [
"417931378@qq.com"
] | 417931378@qq.com |
14c780147451cb7282860c3f081e9349ef89bccb | d4c5ee06ba8215873b4ed54a491f42e98a95ece6 | /src/org/forsook/parser/java/ast/lexical/LiteralExpression.java | 07e2d3eb37e350108d8c9a389acc9bee7a0b3752 | [] | no_license | cretz/forsook | 7a3f05e4849475fa6f5129c767b0f72b969409b4 | 0dd711ea23241eaa83070de4cfee263b7d46de73 | refs/heads/master | 2016-08-04T15:10:12.205066 | 2012-08-05T21:48:11 | 2012-08-05T21:48:11 | 3,037,243 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,096 | java | package org.forsook.parser.java.ast.lexical;
import org.forsook.parser.java.JlsReference;
import org.forsook.parser.java.ast.expression.Expression;
import org.forsook.parser.java.ast.expression.PrimaryNoNewArrayExpression;
@JlsReference("3.10")
@SuppressWarnings("serial")
public class LiteralExpression extends Expression implements PrimaryNoNewArrayExpression {
private String value;
private LiteralExpressionType type;
public LiteralExpression() {
}
public LiteralExpression(String value, LiteralExpressionType type) {
this.value = value;
this.type = type;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public LiteralExpressionType getType() {
return type;
}
public void setType(LiteralExpressionType type) {
this.type = type;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((type == null) ? 0 : type.hashCode());
result = prime * result + ((value == null) ? 0 : value.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
LiteralExpression other = (LiteralExpression) obj;
if (type != other.type) {
return false;
}
if (value == null) {
if (other.value != null) {
return false;
}
} else if (!value.equals(other.value)) {
return false;
}
return true;
}
public static enum LiteralExpressionType {
DECIMAL_INTEGER,
HEX_INTEGER,
OCTAL_INTEGER,
BINARY_INTEGER,
DECIMAL_FLOATING_POINT,
HEXADECIMAL_FLOATING_POINT,
BOOLEAN,
CHARACTER,
STRING,
NULL
}
}
| [
"chad.retz@gmail.com"
] | chad.retz@gmail.com |
e7267cb2181c08d0247ffeeb707e49b44b947bbd | c0e3d0eab5d7007d2ecd81a638570a23407c9eee | /src/main/java/com/hnust/mr/index/TwoIndexDriver.java | 7e730093bc0252368c2033e2b3a27c60e4059046 | [] | no_license | 1476183937/HadoopLearn | 51a14ddc5caaa2c3e0a7e3fcf6a947266b6b283e | 326ad4d06f4adb526c4990e146b80f73f9dc5010 | refs/heads/master | 2023-03-27T21:58:51.495809 | 2021-03-25T12:04:16 | 2021-03-25T12:04:16 | 351,421,411 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,466 | java | package com.hnust.mr.index;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;
import java.io.IOException;
public class TwoIndexDriver {
/*最终输出
* atguigu c.txt-->2 b.txt-->2 a.txt-->3
pingping c.txt-->1 b.txt-->3 a.txt-->1
ss c.txt-->1 b.txt-->1 a.txt-->2
* */
public static void main(String[] args) throws IOException, ClassNotFoundException, InterruptedException {
// 输入输出路径需要根据自己电脑上实际的输入输出路径设置
args = new String[] { "E://input/part-r-00000", "E://input/output7" };
Configuration config = new Configuration();
Job job = Job.getInstance(config);
job.setJarByClass(TwoIndexDriver.class);
job.setMapperClass(TwoIndexMapper.class);
job.setReducerClass(TwoIndexReducer.class);
job.setMapOutputKeyClass(Text.class);
job.setMapOutputValueClass(Text.class);
job.setOutputKeyClass(Text.class);
job.setOutputValueClass(Text.class);
FileInputFormat.setInputPaths(job, new Path(args[0]));
FileOutputFormat.setOutputPath(job, new Path(args[1]));
boolean result = job.waitForCompletion(true);
System.exit(result?0:1);
}
}
| [
"1476183937@qq.com"
] | 1476183937@qq.com |
d7d39150287f63d29dba68f9ca1f6eb08960f8cd | cdc3639bebcc359f35de09068b29f1da9bb17fa3 | /odps-sqoop/src/java/com/cloudera/sqoop/mapreduce/MySQLExportMapper.java | 30046dd7f8b0b8c3992278de2a779d7e7764fcd2 | [
"Apache-2.0",
"BSD-3-Clause",
"BSD-2-Clause"
] | permissive | aliyun/aliyun-maxcompute-data-collectors | ea874a8aee606764270a0e198f6d4cc3546d84d7 | ced3eab524aef870f38828fc7891633dbe6e72f2 | refs/heads/master | 2023-08-30T21:04:00.344985 | 2022-06-24T05:39:51 | 2022-06-24T05:39:51 | 79,514,986 | 107 | 61 | Apache-2.0 | 2023-06-15T16:19:17 | 2017-01-20T01:56:46 | Java | UTF-8 | Java | false | false | 1,303 | 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 com.cloudera.sqoop.mapreduce;
/**
* @deprecated Moving to use org.apache.sqoop namespace.
*/
public class MySQLExportMapper<KEYIN, VALIN>
extends org.apache.sqoop.mapreduce.MySQLExportMapper<KEYIN, VALIN> {
public static final String MYSQL_CHECKPOINT_BYTES_KEY =
org.apache.sqoop.mapreduce.MySQLExportMapper.MYSQL_CHECKPOINT_BYTES_KEY;
public static final long DEFAULT_CHECKPOINT_BYTES =
org.apache.sqoop.mapreduce.MySQLExportMapper.DEFAULT_CHECKPOINT_BYTES;
}
| [
"zhe.oyz@alibaba-inc.com"
] | zhe.oyz@alibaba-inc.com |
26f6449738077a69fc93466772c1ff141ec69bb9 | fc68842122cee3c6b4962b3afce67e5cf5de0ce7 | /app/src/main/java/com/example/foodorder/Chefsendotp.java | 4748d13d84dca3cf5ac42b727b185e856183f038 | [] | no_license | Saumil4122000/FoodOrder | 690bc12de5f0c46bd77e57cb97e4be4de6c2ade2 | 7c3717adc5fbb77a7fc937a58366f95c0e384a92 | refs/heads/master | 2023-07-28T22:57:37.329216 | 2021-09-23T16:55:51 | 2021-09-23T16:55:51 | 360,046,662 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 5,894 | java | package com.example.foodorder;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.os.CountDownTimer;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import com.example.foodorder.ReusableCode.ReusableCodeForAll;
import com.food_on.app.R;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.android.gms.tasks.TaskExecutors;
import com.google.firebase.FirebaseException;
import com.google.firebase.auth.AuthResult;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.PhoneAuthCredential;
import com.google.firebase.auth.PhoneAuthOptions;
import com.google.firebase.auth.PhoneAuthProvider;
import java.util.concurrent.TimeUnit;
public class Chefsendotp extends AppCompatActivity {
String verificationId;
FirebaseAuth FAuth;
Button verify;
TextView txt;
String phonenumber;
Button Resend;
EditText entercode;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_chefsendotp);
FAuth = FirebaseAuth.getInstance();
phonenumber = getIntent().getStringExtra("phonenumber").trim();
sendverificationcode(phonenumber);
entercode = (EditText) findViewById(R.id.phoneno);
txt = (TextView) findViewById(R.id.text);
Resend = (Button) findViewById(R.id.Resendotp);
Resend.setVisibility(View.INVISIBLE);
txt.setVisibility(View.INVISIBLE);
verify = (Button) findViewById(R.id.Verify);
verify.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Resend.setVisibility(View.INVISIBLE);
String code = entercode.getText().toString().trim();
if (code.isEmpty() && code.length() < 6) {
entercode.setError("Enter code");
entercode.requestFocus();
return;
}
verifyCode(code);
}
});
new CountDownTimer(60000, 1000) {
@Override
public void onTick(long millisUntilFinished) {
txt.setVisibility(View.VISIBLE);
txt.setText("Resend Code within " + millisUntilFinished / 1000 + " Seconds");
}
@Override
public void onFinish() {
Resend.setVisibility(View.VISIBLE);
txt.setVisibility(View.INVISIBLE);
}
}.start();
Resend.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Resend.setVisibility(View.INVISIBLE);
Resendotp(phonenumber);
new CountDownTimer(60000, 1000) {
@Override
public void onTick(long millisUntilFinished) {
txt.setVisibility(View.VISIBLE);
txt.setText("Resend Code within " + millisUntilFinished / 1000 + " Seconds");
}
@Override
public void onFinish() {
Resend.setVisibility(View.VISIBLE);
txt.setVisibility(View.INVISIBLE);
}
}.start();
}
});
}
private void Resendotp(String phonenumber) {
sendverificationcode(phonenumber);
}
private void verifyCode(String code)
{
PhoneAuthCredential credential= PhoneAuthProvider.getCredential(verificationId,code);
signInwithCredential(credential);
}
private void signInwithCredential(PhoneAuthCredential credential) {
FAuth.signInWithCredential(credential)
.addOnCompleteListener(new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if (task.isSuccessful())
{
Intent intent=new Intent(getApplicationContext(),ChefFoodPanel_BottomNavigation.class);
startActivity(intent);
finish();
}
else
{
ReusableCodeForAll.ShowAlert(Chefsendotp.this,"Error",task.getException().getMessage());
}
}
});
}
private void sendverificationcode(String number) {
PhoneAuthProvider.getInstance().verifyPhoneNumber(
number,
60,
TimeUnit.SECONDS,
Chefsendotp.this,
mCallBack
);
}
private final PhoneAuthProvider.OnVerificationStateChangedCallbacks
mCallBack=new PhoneAuthProvider.OnVerificationStateChangedCallbacks() {
@Override
public void onCodeSent(String s, PhoneAuthProvider.ForceResendingToken forceResendingToken) {
super.onCodeSent(s, forceResendingToken);
verificationId=s;
}
@Override
public void onVerificationCompleted(PhoneAuthCredential phoneAuthCredential) {
String code=phoneAuthCredential.getSmsCode();
if (code !=null)
{
entercode.setText(code);
verifyCode(code);
}
}
@Override
public void onVerificationFailed(FirebaseException e) {
Toast.makeText(Chefsendotp.this, e.getMessage(), Toast.LENGTH_LONG).show();
}
};
}
| [
"saumil1220@gmail.com"
] | saumil1220@gmail.com |
9a754e15577c29208fbda3c100b8a004a2662861 | 18bbf11b029716b480cb1c4470f438eb44976351 | /src/main/java/com/grupa2/chocolate/ChocolateController.java | ca0cae2652db0c123980a60cd9cfc96db50f0ec1 | [] | no_license | AmaliaIoanaBob/ciocolata | c3ec1bd44310f93006547662770d173f1eba8d39 | 1c92af689adb8a70e9b76c2ed99ba565e52fd8c8 | refs/heads/master | 2022-06-24T02:58:51.756521 | 2019-12-04T17:19:09 | 2019-12-04T17:19:09 | 225,428,171 | 0 | 0 | null | 2022-06-21T02:21:53 | 2019-12-02T17:11:10 | Java | UTF-8 | Java | false | false | 562 | java | package com.grupa2.chocolate;
import com.grupa2.AbstractController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/api/chocolate")
public class ChocolateController extends AbstractController<Long,ChocolateModel,ChocolateRepository,ChocolateService> {
@Autowired
public ChocolateController(ChocolateService chocolateService) {
super(chocolateService);
}
}
| [
"bobamaliaioana15@gmail.com"
] | bobamaliaioana15@gmail.com |
4c5ce3cb76fa69126ca4a4dfdcf20ecc90915f32 | 3b26a0d39305e54c859c80f040170f928f23a644 | /UniversalMediaPlayer/java/com/android/pump/provider/KnowledgeGraph.java | 588246cf303f766aca1015251932a795fbf1a7c2 | [] | no_license | MyMagma/apps | cfd74d98c7b81d4bc2f4b4946484a7be1b3bb4ef | 128d43ae1aa967328b32225f5eb162fb3b6569d3 | refs/heads/master | 2020-12-27T06:49:24.811808 | 2020-02-02T17:32:35 | 2020-02-02T17:32:35 | 237,800,995 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 7,830 | java | /*
* Copyright 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.pump.provider;
import android.net.Uri;
import androidx.annotation.AnyThread;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.WorkerThread;
import com.android.pump.db.Album;
import com.android.pump.db.Artist;
import com.android.pump.db.DataProvider;
import com.android.pump.db.Episode;
import com.android.pump.db.Movie;
import com.android.pump.db.Series;
import com.android.pump.util.Clog;
import com.android.pump.util.Http;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.json.JSONTokener;
@WorkerThread
public final class KnowledgeGraph implements DataProvider {
private static final String TAG = Clog.tag(KnowledgeGraph.class);
private static final DataProvider INSTANCE = new KnowledgeGraph();
private KnowledgeGraph() { }
@AnyThread
public static @NonNull DataProvider getInstance() {
return INSTANCE;
}
@Override
public boolean populateArtist(@NonNull Artist artist) throws IOException {
boolean updated = false;
// Artist may be of type "Person" or "MusicGroup"
JSONObject result = getResultFromKG(artist.getName(), "Person", "MusicGroup");
String imageUrl = getImageUrl(result);
if (imageUrl != null) {
updated |= artist.setHeadshotUri(Uri.parse(imageUrl));
}
String detailedDescription = getDetailedDescription(result);
if (detailedDescription != null) {
updated |= artist.setDescription(detailedDescription);
}
return updated;
}
@Override
public boolean populateAlbum(@NonNull Album album) throws IOException {
// Return if album art is already retrieved from the media file
if (album.getAlbumArtUri() != null) {
return false;
}
boolean updated = false;
JSONObject result = getResultFromKG(album.getTitle(), "MusicAlbum");
// TODO: (b/128383917) Investigate how to filter search results
String imageUrl = getImageUrl(result);
if (imageUrl != null) {
updated |= album.setAlbumArtUri(Uri.parse(imageUrl));
}
String detailedDescription = getDetailedDescription(result);
if (detailedDescription != null) {
updated |= album.setDescription(detailedDescription);
}
return updated;
}
@Override
public boolean populateMovie(@NonNull Movie movie) throws IOException {
boolean updated = false;
JSONObject result = getResultFromKG(movie.getTitle(), "Movie");
String imageUrl = getImageUrl(result);
if (imageUrl != null) {
updated |= movie.setPosterUri(Uri.parse(imageUrl));
}
String detailedDescription = getDetailedDescription(result);
if (detailedDescription != null) {
updated |= movie.setDescription(detailedDescription);
}
return updated;
}
@Override
public boolean populateSeries(@NonNull Series series) throws IOException {
boolean updated = false;
JSONObject result = getResultFromKG(series.getTitle(), "TVSeries");
String imageUrl = getImageUrl(result);
if (imageUrl != null) {
updated |= series.setPosterUri(Uri.parse(imageUrl));
}
String detailedDescription = getDetailedDescription(result);
if (detailedDescription != null) {
updated |= series.setDescription(detailedDescription);
}
return updated;
}
@Override
public boolean populateEpisode(@NonNull Episode episode) throws IOException {
boolean updated = false;
JSONObject result = getResultFromKG(episode.getSeries().getTitle(), "TVEpisode");
String imageUrl = getImageUrl(result);
if (imageUrl != null) {
updated |= episode.setPosterUri(Uri.parse(imageUrl));
}
String detailedDescription = getDetailedDescription(result);
if (detailedDescription != null) {
updated |= episode.setDescription(detailedDescription);
}
return updated;
}
private @NonNull JSONObject getResultFromKG(String title, String... types) throws IOException {
try {
JSONObject root = (JSONObject) getContent(getContentUri(title, types));
JSONArray items = root.getJSONArray("itemListElement");
JSONObject item = (JSONObject) items.get(0);
JSONObject result = item.getJSONObject("result");
if (!title.equals(result.getString("name"))) {
throw new IOException("Failed to find result for " + title);
}
return result;
} catch (JSONException e) {
throw new IOException("Failed to find result for " + title);
}
}
private @Nullable String getImageUrl(@NonNull JSONObject result) {
String imageUrl = null;
try {
JSONObject imageObj = result.optJSONObject("image");
if (imageObj != null) {
String url = imageObj.getString("contentUrl");
if (url != null) {
// TODO (b/125143807): Remove once HTTPS scheme urls are retrieved.
imageUrl = url.replaceFirst("^http://", "https://");
}
}
} catch (JSONException e) {
Clog.w(TAG, "Failed to parse image url", e);
}
return imageUrl;
}
private @Nullable String getDescription(@NonNull JSONObject result) {
String description = null;
try {
description = result.getString("description");
} catch (JSONException e) {
Clog.w(TAG, "Failed to parse description", e);
}
return description;
}
private @Nullable String getDetailedDescription(@NonNull JSONObject result) {
String detailedDescription = null;
try {
JSONObject descriptionObj = result.optJSONObject("detailedDescription");
if (descriptionObj != null) {
detailedDescription = descriptionObj.getString("articleBody");
}
} catch (JSONException e) {
Clog.w(TAG, "Failed to parse detailed description", e);
}
return detailedDescription;
}
private static @NonNull Uri getContentUri(@NonNull String title, @NonNull String... types) {
Uri.Builder ub = new Uri.Builder();
ub.scheme("https");
ub.authority("kgsearch.googleapis.com");
ub.appendPath("v1");
ub.appendEncodedPath("entities:search");
ub.appendQueryParameter("key", ApiKeys.KG_API);
ub.appendQueryParameter("limit", "1");
ub.appendQueryParameter("query", title);
for (String type : types) {
ub.appendQueryParameter("types", type);
}
return ub.build();
}
private static @NonNull Object getContent(@NonNull Uri uri) throws IOException, JSONException {
return new JSONTokener(new String(Http.get(uri.toString()), StandardCharsets.UTF_8))
.nextValue();
}
}
| [
"user@email.edu"
] | user@email.edu |
2ed382065c03eb5522fdc2337e58eb3cd7685c85 | 0c7d14a88f817989b3e9382b1826367b1cbb8131 | /core/src/test/java/com/zaubersoftware/gnip4j/api/model/GeoDeserializerTest.java | 7f17c08f9e490596cddf86cccec63fb65d0e40b5 | [
"Apache-2.0"
] | permissive | BrandwatchLtd/gnip4j | c39b6b67a12e98f5cb4be642d4107ee67cb8f6d2 | 4f943df82e95686c9d4ccbe8753383a5770a7b2c | refs/heads/master | 2021-01-15T20:43:07.480713 | 2015-07-25T04:33:10 | 2015-07-25T04:36:42 | 40,717,546 | 0 | 2 | null | 2017-02-15T16:02:52 | 2015-08-14T13:56:37 | Java | UTF-8 | Java | false | false | 3,500 | java | /**
* Copyright (c) 2011-2012 Zauber S.A. <http://www.zaubersoftware.com/>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.zaubersoftware.gnip4j.api.model;
import static org.junit.Assert.*;
import java.io.IOException;
import java.util.List;
import org.codehaus.jackson.JsonParseException;
import org.codehaus.jackson.map.JsonMappingException;
import org.codehaus.jackson.map.ObjectMapper;
import org.junit.Test;
import com.zaubersoftware.gnip4j.api.impl.formats.JsonActivityFeedProcessor;
/**
* TODO: Description of the class, Comments in english by default
*
*
* @author Juan F. Codagnone
* @since Jul 24, 2015
*/
public class GeoDeserializerTest {
private static final ObjectMapper mapper = JsonActivityFeedProcessor.getObjectMapper();
@Test
public void testLocation() throws JsonParseException, JsonMappingException, IOException {
String x = "{\"twitter_place_type\":\"city\",\"geo\":{\"coordinates\":[[[-58.5317922,-34.674453],[-58.5317922,-34.534177],[-58.353494,-34.534177],[-58.353494,-34.674453]]],\"type\":\"Polygon\"},\"link\":\"https://api.twitter.com/1.1/geo/id/018f1cde6bad9747.json\",\"twitter_country_code\":\"AR\",\"country_code\":\"Argentina\",\"name\":\"Ciudad Autónoma de Buenos Aires\",\"displayName\":\"Ciudad Autónoma de Buenos Aires, Argentina\",\"objectType\":\"place\"}";
final Activity.Location l = JsonActivityFeedProcessor.getObjectMapper().readValue(x, Activity.Location.class);
assertEquals("place", l.getObjectType());
assertEquals("Ciudad Autónoma de Buenos Aires, Argentina", l.getDisplayName());
assertEquals("Ciudad Autónoma de Buenos Aires", l.getName());
assertEquals("Argentina", l.getCountryCode());
assertEquals("AR", l.getTwitterCountryCode());
assertEquals("https://api.twitter.com/1.1/geo/id/018f1cde6bad9747.json", l.getLink());
assertEquals("city", l.getTwitterPlaceType());
final Geo geo = l.getGeo();
assertEquals("Polygon", geo.getType());
final Polygon expected = new Polygon(new LinearRing(
new Point(-58.5317922, -34.674453),
new Point(-58.5317922, -34.534177),
new Point(-58.353494, -34.534177),
new Point(-58.353494, -34.674453)
));
assertEquals(expected, geo.getCoordinates());
x = mapper.writeValueAsString(geo);
assertEquals(geo, mapper.readValue(x, Geo.class));
}
@Test
public void testPoint() throws JsonParseException, JsonMappingException, IOException {
String x = "{\"coordinates\":[-34.635439,-58.427005],\"type\":\"Point\"}";
final Geo geo = mapper.readValue(x, Geo.class);
final Geo expected = new Geo("Point", new Point(-34.635439,-58.427005));
assertEquals(expected, geo);
x = mapper.writeValueAsString(geo);
assertEquals(expected, mapper.readValue(x, Geo.class));
}
}
| [
"juan@flowics.com"
] | juan@flowics.com |
fb23dc1a29873052d8098241456b630189157420 | 6cf5afa88f9e42f705c3b21138a692d4a736efa4 | /app/src/main/java/com/zepan/caifuyun/activity/SalesJournalActivity.java | f814dc2b1ca6dcab4b7ac5e4035ae645f61449a7 | [] | no_license | xuetenglong/caifuyun | c84c344fab57c4bed9be2777301a40bd75127ae4 | 3430e2e3ffb64a371424f989716135253c943395 | refs/heads/master | 2021-05-31T00:31:34.599157 | 2016-03-31T09:41:32 | 2016-03-31T09:41:32 | 55,123,956 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 5,295 | java | package com.zepan.caifuyun.activity;
import java.util.ArrayList;
import java.util.List;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.ViewPager;
import android.support.v4.view.ViewPager.OnPageChangeListener;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.RadioGroup.OnCheckedChangeListener;
import com.zepan.caifuyun.R;
import com.zepan.caifuyun.base.BaseActivity;
import com.zepan.caifuyun.base.BaseFragment;
import com.zepan.caifuyun.widget.DialogBottom;
import com.zepan.caifuyun.widget.DialogBottom.OnItemClick;
/*
* 销售日报
*/
public class SalesJournalActivity extends BaseActivity {
private BaseFragment commitjournalFragment;
private BaseFragment readjournalFragment;
ImageView image_back;
private ListView listview;
List<String> list=new ArrayList<String>();
private ArrayList<BaseFragment> fragmentList=new ArrayList<BaseFragment>();
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_sales_journal);
initView();
}
private void initView(){
final ViewPager viewPager=(ViewPager) findViewById(R.id.viewpager);
final RadioGroup radioGroup=(RadioGroup) findViewById(R.id.rg);
image_back=(ImageView) findViewById(R.id.iv_back);
ImageView iv_add=(ImageView) findViewById(R.id.iv_add);
iv_add.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Intent intent=new Intent(SalesJournalActivity.this,WriteDetailsActivity.class);
startActivity(intent);
}
});
radioGroup.setOnCheckedChangeListener(new OnCheckedChangeListener() {
ImageView iv_more=(ImageView) findViewById(R.id.iv_more);
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
switch (checkedId) {
case R.id.rb_commit://我提交的日报
viewPager.setCurrentItem(0);
iv_more.setVisibility(View.GONE);
break;
case R.id.rb_read://我批阅的日报
viewPager.setCurrentItem(1);
iv_more.setVisibility(View.VISIBLE);
//销售日报 选择
iv_more.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
final DialogBottom infoDailog=new DialogBottom(SalesJournalActivity.this);
String[] nameArray={"全部标记已阅","未阅","已阅"};
infoDailog.setArray(nameArray);
infoDailog.setOnItemClick(new OnItemClick() {
@Override
public void itemClick(AdapterView<?> parent, View view, int position, long id) {
switch (position) {
case 0:
infoDailog.dismiss();
break;
case 1:
infoDailog.dismiss();
Intent intent=new Intent(SalesJournalActivity.this,UnReadDetailsActivity.class);
startActivity(intent);
break;
case 2:
infoDailog.dismiss();
Intent intent2=new Intent(SalesJournalActivity.this,ReadDetailsActivity.class);
startActivity(intent2);
break;
default:
break;
}
}
});
infoDailog.show();
}
});
break;
default:
break;
}
}
});
commitjournalFragment=new CommitJournalFragment();
readjournalFragment=new ReadJournalFragment();
fragmentList.add(commitjournalFragment);
fragmentList.add(readjournalFragment);
viewPager.setAdapter(new FragViewPagerAdapter(getSupportFragmentManager()));
viewPager.setOnPageChangeListener(new OnPageChangeListener() {
@Override
public void onPageSelected(int position) {
if(position==1){
((RadioButton)radioGroup.getChildAt(position+1)).setChecked(true);
}else if(position==0){
((RadioButton)radioGroup.getChildAt(position)).setChecked(true);
}
}
@Override
public void onPageScrolled(int arg0, float arg1, int arg2) {
// TODO Auto-generated method stub
}
@Override
public void onPageScrollStateChanged(int arg0) {
// TODO Auto-generated method stub
}
});
}
public class FragViewPagerAdapter extends FragmentPagerAdapter{
public FragViewPagerAdapter(FragmentManager fm) {
super(fm);
// TODO Auto-generated constructor stub
}
@Override
public BaseFragment getItem(int position) {
return fragmentList.get(position);
}
@Override
public int getCount() {
return fragmentList.size();
}
@Override
public CharSequence getPageTitle(int position) {
// TODO Auto-generated method stub
return null;
}
}
public void click(View v){
switch(v.getId()){
case R.id.iv_back:
finish();
}
}
}
| [
"xue.tenglong@piaojiaowang.com"
] | xue.tenglong@piaojiaowang.com |
f3efc18158a4c250fa8de868cb7759c81dcfaa0f | e9affefd4e89b3c7e2064fee8833d7838c0e0abc | /aws-java-sdk-glue/src/main/java/com/amazonaws/services/glue/model/ColumnRowFilter.java | ba525893cae377bd6757e17dba376c09ab03f72a | [
"Apache-2.0"
] | permissive | aws/aws-sdk-java | 2c6199b12b47345b5d3c50e425dabba56e279190 | bab987ab604575f41a76864f755f49386e3264b4 | refs/heads/master | 2023-08-29T10:49:07.379135 | 2023-08-28T21:05:55 | 2023-08-28T21:05:55 | 574,877 | 3,695 | 3,092 | Apache-2.0 | 2023-09-13T23:35:28 | 2010-03-22T23:34:58 | null | UTF-8 | Java | false | false | 5,887 | java | /*
* Copyright 2018-2023 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.glue.model;
import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;
/**
* <p>
* A filter that uses both column-level and row-level filtering.
* </p>
*
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/glue-2017-03-31/ColumnRowFilter" target="_top">AWS API
* Documentation</a>
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class ColumnRowFilter implements Serializable, Cloneable, StructuredPojo {
/**
* <p>
* A string containing the name of the column.
* </p>
*/
private String columnName;
/**
* <p>
* A string containing the row-level filter expression.
* </p>
*/
private String rowFilterExpression;
/**
* <p>
* A string containing the name of the column.
* </p>
*
* @param columnName
* A string containing the name of the column.
*/
public void setColumnName(String columnName) {
this.columnName = columnName;
}
/**
* <p>
* A string containing the name of the column.
* </p>
*
* @return A string containing the name of the column.
*/
public String getColumnName() {
return this.columnName;
}
/**
* <p>
* A string containing the name of the column.
* </p>
*
* @param columnName
* A string containing the name of the column.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ColumnRowFilter withColumnName(String columnName) {
setColumnName(columnName);
return this;
}
/**
* <p>
* A string containing the row-level filter expression.
* </p>
*
* @param rowFilterExpression
* A string containing the row-level filter expression.
*/
public void setRowFilterExpression(String rowFilterExpression) {
this.rowFilterExpression = rowFilterExpression;
}
/**
* <p>
* A string containing the row-level filter expression.
* </p>
*
* @return A string containing the row-level filter expression.
*/
public String getRowFilterExpression() {
return this.rowFilterExpression;
}
/**
* <p>
* A string containing the row-level filter expression.
* </p>
*
* @param rowFilterExpression
* A string containing the row-level filter expression.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ColumnRowFilter withRowFilterExpression(String rowFilterExpression) {
setRowFilterExpression(rowFilterExpression);
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 (getColumnName() != null)
sb.append("ColumnName: ").append(getColumnName()).append(",");
if (getRowFilterExpression() != null)
sb.append("RowFilterExpression: ").append(getRowFilterExpression());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof ColumnRowFilter == false)
return false;
ColumnRowFilter other = (ColumnRowFilter) obj;
if (other.getColumnName() == null ^ this.getColumnName() == null)
return false;
if (other.getColumnName() != null && other.getColumnName().equals(this.getColumnName()) == false)
return false;
if (other.getRowFilterExpression() == null ^ this.getRowFilterExpression() == null)
return false;
if (other.getRowFilterExpression() != null && other.getRowFilterExpression().equals(this.getRowFilterExpression()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getColumnName() == null) ? 0 : getColumnName().hashCode());
hashCode = prime * hashCode + ((getRowFilterExpression() == null) ? 0 : getRowFilterExpression().hashCode());
return hashCode;
}
@Override
public ColumnRowFilter clone() {
try {
return (ColumnRowFilter) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
}
}
@com.amazonaws.annotation.SdkInternalApi
@Override
public void marshall(ProtocolMarshaller protocolMarshaller) {
com.amazonaws.services.glue.model.transform.ColumnRowFilterMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}
| [
""
] | |
00b796553b0da74c4cd6b170aa858bb4f52e6465 | 1ca86d5d065372093c5f2eae3b1a146dc0ba4725 | /testing-modules/junit5-annotations/src/test/java/com/surya/junit5/registerextension/RegisterExtensionUnitTest.java | 6f5eb84e32fcd5ab7d62ba02d870b2a32fa0abbf | [] | no_license | Suryakanta97/DemoExample | 1e05d7f13a9bc30f581a69ce811fc4c6c97f2a6e | 5c6b831948e612bdc2d9d578a581df964ef89bfb | refs/heads/main | 2023-08-10T17:30:32.397265 | 2021-09-22T16:18:42 | 2021-09-22T16:18:42 | 391,087,435 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 937 | java | package com.surya.junit5.registerextension;
import com.surya.junit5.registerextension.RegisterExtensionSampleExtension;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
/**
* This test demonstrates the use of the same extension in two ways.
* 1. Once as instance level field: Only method level callbacks are called.
* 2. Once as class level static field: All methods are called.
*/
public class RegisterExtensionUnitTest {
@RegisterExtension
static RegisterExtensionSampleExtension staticExtension = new RegisterExtensionSampleExtension("static version");
@RegisterExtension
RegisterExtensionSampleExtension instanceLevelExtension = new RegisterExtensionSampleExtension("instance version");
@Test
public void demoTest() {
Assertions.assertEquals("instance version", instanceLevelExtension.getType());
}
}
| [
"suryakanta97@github.com"
] | suryakanta97@github.com |
c820d1c88cd981b5365c26b8fa35f11ab7fd67ec | df18264fec69afd2561ded6204343973c6c0e83a | /src/test/java/com/brain/inam/config/WebConfigurerTest.java | 8a745719c0632733facfb72f1883886264b246cd | [] | no_license | sandalothier/inam | adfed4020621140e25844e0ed934fcb9f7e06f03 | d0e6b8d4104114c975e15d90df5ee376e7d13627 | refs/heads/master | 2022-12-25T02:01:02.102325 | 2019-09-23T15:05:03 | 2019-09-23T15:05:03 | 210,384,602 | 0 | 0 | null | 2022-12-16T05:05:44 | 2019-09-23T15:04:48 | Java | UTF-8 | Java | false | false | 7,172 | java | package com.brain.inam.config;
import io.github.jhipster.config.JHipsterConstants;
import io.github.jhipster.config.JHipsterProperties;
import io.github.jhipster.web.filter.CachingHttpHeadersFilter;
import org.h2.server.web.WebServlet;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.boot.web.embedded.undertow.UndertowServletWebServerFactory;
import org.springframework.http.HttpHeaders;
import org.springframework.mock.env.MockEnvironment;
import org.springframework.mock.web.MockServletContext;
import org.springframework.test.util.ReflectionTestUtils;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import javax.servlet.*;
import java.io.File;
import java.util.*;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Mockito.*;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.options;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.header;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
/**
* Unit tests for the {@link WebConfigurer} class.
*/
public class WebConfigurerTest {
private WebConfigurer webConfigurer;
private MockServletContext servletContext;
private MockEnvironment env;
private JHipsterProperties props;
@BeforeEach
public void setup() {
servletContext = spy(new MockServletContext());
doReturn(mock(FilterRegistration.Dynamic.class))
.when(servletContext).addFilter(anyString(), any(Filter.class));
doReturn(mock(ServletRegistration.Dynamic.class))
.when(servletContext).addServlet(anyString(), any(Servlet.class));
env = new MockEnvironment();
props = new JHipsterProperties();
webConfigurer = new WebConfigurer(env, props);
}
@Test
public void testStartUpProdServletContext() throws ServletException {
env.setActiveProfiles(JHipsterConstants.SPRING_PROFILE_PRODUCTION);
webConfigurer.onStartup(servletContext);
verify(servletContext).addFilter(eq("cachingHttpHeadersFilter"), any(CachingHttpHeadersFilter.class));
verify(servletContext, never()).addServlet(eq("H2Console"), any(WebServlet.class));
}
@Test
public void testStartUpDevServletContext() throws ServletException {
env.setActiveProfiles(JHipsterConstants.SPRING_PROFILE_DEVELOPMENT);
webConfigurer.onStartup(servletContext);
verify(servletContext, never()).addFilter(eq("cachingHttpHeadersFilter"), any(CachingHttpHeadersFilter.class));
verify(servletContext).addServlet(eq("H2Console"), any(WebServlet.class));
}
@Test
public void testCustomizeServletContainer() {
env.setActiveProfiles(JHipsterConstants.SPRING_PROFILE_PRODUCTION);
UndertowServletWebServerFactory container = new UndertowServletWebServerFactory();
webConfigurer.customize(container);
assertThat(container.getMimeMappings().get("abs")).isEqualTo("audio/x-mpeg");
assertThat(container.getMimeMappings().get("html")).isEqualTo("text/html;charset=utf-8");
assertThat(container.getMimeMappings().get("json")).isEqualTo("text/html;charset=utf-8");
if (container.getDocumentRoot() != null) {
assertThat(container.getDocumentRoot()).isEqualTo(new File("target/classes/static/"));
}
}
@Test
public void testCorsFilterOnApiPath() throws Exception {
props.getCors().setAllowedOrigins(Collections.singletonList("*"));
props.getCors().setAllowedMethods(Arrays.asList("GET", "POST", "PUT", "DELETE"));
props.getCors().setAllowedHeaders(Collections.singletonList("*"));
props.getCors().setMaxAge(1800L);
props.getCors().setAllowCredentials(true);
MockMvc mockMvc = MockMvcBuilders.standaloneSetup(new WebConfigurerTestController())
.addFilters(webConfigurer.corsFilter())
.build();
mockMvc.perform(
options("/api/test-cors")
.header(HttpHeaders.ORIGIN, "other.domain.com")
.header(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, "POST"))
.andExpect(status().isOk())
.andExpect(header().string(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN, "other.domain.com"))
.andExpect(header().string(HttpHeaders.VARY, "Origin"))
.andExpect(header().string(HttpHeaders.ACCESS_CONTROL_ALLOW_METHODS, "GET,POST,PUT,DELETE"))
.andExpect(header().string(HttpHeaders.ACCESS_CONTROL_ALLOW_CREDENTIALS, "true"))
.andExpect(header().string(HttpHeaders.ACCESS_CONTROL_MAX_AGE, "1800"));
mockMvc.perform(
get("/api/test-cors")
.header(HttpHeaders.ORIGIN, "other.domain.com"))
.andExpect(status().isOk())
.andExpect(header().string(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN, "other.domain.com"));
}
@Test
public void testCorsFilterOnOtherPath() throws Exception {
props.getCors().setAllowedOrigins(Collections.singletonList("*"));
props.getCors().setAllowedMethods(Arrays.asList("GET", "POST", "PUT", "DELETE"));
props.getCors().setAllowedHeaders(Collections.singletonList("*"));
props.getCors().setMaxAge(1800L);
props.getCors().setAllowCredentials(true);
MockMvc mockMvc = MockMvcBuilders.standaloneSetup(new WebConfigurerTestController())
.addFilters(webConfigurer.corsFilter())
.build();
mockMvc.perform(
get("/test/test-cors")
.header(HttpHeaders.ORIGIN, "other.domain.com"))
.andExpect(status().isOk())
.andExpect(header().doesNotExist(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN));
}
@Test
public void testCorsFilterDeactivated() throws Exception {
props.getCors().setAllowedOrigins(null);
MockMvc mockMvc = MockMvcBuilders.standaloneSetup(new WebConfigurerTestController())
.addFilters(webConfigurer.corsFilter())
.build();
mockMvc.perform(
get("/api/test-cors")
.header(HttpHeaders.ORIGIN, "other.domain.com"))
.andExpect(status().isOk())
.andExpect(header().doesNotExist(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN));
}
@Test
public void testCorsFilterDeactivated2() throws Exception {
props.getCors().setAllowedOrigins(new ArrayList<>());
MockMvc mockMvc = MockMvcBuilders.standaloneSetup(new WebConfigurerTestController())
.addFilters(webConfigurer.corsFilter())
.build();
mockMvc.perform(
get("/api/test-cors")
.header(HttpHeaders.ORIGIN, "other.domain.com"))
.andExpect(status().isOk())
.andExpect(header().doesNotExist(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN));
}
}
| [
"jhipster-bot@jhipster.tech"
] | jhipster-bot@jhipster.tech |
5cfa2e929f65837ab99eec72d5772eb19897a708 | ae9757cf79fe991e03fb71c4f35cdc42aefeb78d | /ecif/src/main/java/com/gt/ecif/entity/RoleResourceOperator.java | 290ba17a37572e04d953d1bc74527f53e6809330 | [] | no_license | xiaoguanmm/ecif | cf751c974fdc8ea278a7d7e789ac16b039b7d215 | 4c9a94f477d1632001a7f7bd53f3633d2886cce5 | refs/heads/master | 2022-07-11T01:07:24.094867 | 2020-03-14T04:38:41 | 2020-03-14T04:38:41 | 247,207,166 | 0 | 0 | null | 2022-06-21T02:58:56 | 2020-03-14T03:51:10 | CSS | UTF-8 | Java | false | false | 1,274 | java | package com.gt.ecif.entity;
import java.io.Serializable;
import java.util.Date;
public class RoleResourceOperator implements Serializable{
private static final long serialVersionUID = 1L;
private String pid;
private String roleId;
private String resourceOperatorId;
private String createId;
private Date createDate;
public String getPid() {
return pid;
}
public void setPid(String pid) {
this.pid = pid == null ? null : pid.trim();
}
public String getRoleId() {
return roleId;
}
public void setRoleId(String roleId) {
this.roleId = roleId == null ? null : roleId.trim();
}
public String getResourceOperatorId() {
return resourceOperatorId;
}
public void setResourceOperatorId(String resourceOperatorId) {
this.resourceOperatorId = resourceOperatorId == null ? null : resourceOperatorId.trim();
}
public String getCreateId() {
return createId;
}
public void setCreateId(String createId) {
this.createId = createId == null ? null : createId.trim();
}
public Date getCreateDate() {
return createDate;
}
public void setCreateDate(Date createDate) {
this.createDate = createDate;
}
} | [
"724534476@qq.com"
] | 724534476@qq.com |
516df02f4593bff0ea8a974c89c48efbc9d48f24 | ae5eb1a38b4d22c82dfd67c86db73592094edc4b | /project117/src/test/java/org/gradle/test/performance/largejavamultiproject/project117/p585/Test11713.java | f72221a4da90a9a1dd80d4c601387649e0c29537 | [] | no_license | big-guy/largeJavaMultiProject | 405cc7f55301e1fd87cee5878a165ec5d4a071aa | 1cd6a3f9c59e9b13dffa35ad27d911114f253c33 | refs/heads/main | 2023-03-17T10:59:53.226128 | 2021-03-04T01:01:39 | 2021-03-04T01:01:39 | 344,307,977 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,112 | java | package org.gradle.test.performance.largejavamultiproject.project117.p585;
import org.junit.Test;
import static org.junit.Assert.*;
public class Test11713 {
Production11713 objectUnderTest = new Production11713();
@Test
public void testProperty0() {
String value = "value";
objectUnderTest.setProperty0(value);
assertEquals(value, objectUnderTest.getProperty0());
}
@Test
public void testProperty1() {
String value = "value";
objectUnderTest.setProperty1(value);
assertEquals(value, objectUnderTest.getProperty1());
}
@Test
public void testProperty2() {
String value = "value";
objectUnderTest.setProperty2(value);
assertEquals(value, objectUnderTest.getProperty2());
}
@Test
public void testProperty3() {
String value = "value";
objectUnderTest.setProperty3(value);
assertEquals(value, objectUnderTest.getProperty3());
}
@Test
public void testProperty4() {
String value = "value";
objectUnderTest.setProperty4(value);
assertEquals(value, objectUnderTest.getProperty4());
}
@Test
public void testProperty5() {
String value = "value";
objectUnderTest.setProperty5(value);
assertEquals(value, objectUnderTest.getProperty5());
}
@Test
public void testProperty6() {
String value = "value";
objectUnderTest.setProperty6(value);
assertEquals(value, objectUnderTest.getProperty6());
}
@Test
public void testProperty7() {
String value = "value";
objectUnderTest.setProperty7(value);
assertEquals(value, objectUnderTest.getProperty7());
}
@Test
public void testProperty8() {
String value = "value";
objectUnderTest.setProperty8(value);
assertEquals(value, objectUnderTest.getProperty8());
}
@Test
public void testProperty9() {
String value = "value";
objectUnderTest.setProperty9(value);
assertEquals(value, objectUnderTest.getProperty9());
}
} | [
"sterling.greene@gmail.com"
] | sterling.greene@gmail.com |
f61d2eb99f107181271a3f6b23cf8c63ff49566e | 35aea6d59e313063cc53fb48cfb32bf1ca7c7919 | /src/OpenSignServer/releases/0.3/src/main/java/org/owasp/oss/Configuration.java | a336152e9dd35c56ec7d74c065d9aadbd99bd2f3 | [
"MIT"
] | permissive | abb-wcheung/opensign-project | c0d810cea2eb9c497dfaeab84f80909bf4d93acd | 0856a3e7cb8cd736384362ae8bad6f8362058a2e | refs/heads/master | 2016-09-01T21:26:14.317040 | 2008-11-02T17:46:44 | 2008-11-02T17:46:44 | 39,601,116 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,719 | java | package org.owasp.oss;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Properties;
import org.apache.log4j.Logger;
import org.apache.log4j.PropertyConfigurator;
import org.owasp.oss.ca.CertificationAuthority;
/**
* This class reads the configuration file and provides the read values to the system.
*/
public class Configuration {
private static Logger log = Logger.getLogger(Configuration.class);
public enum ConfMode {
LIVE,
TEST
}
private static String CONFIGURATION_FILE_NAME = "config.properties";
private static String CONFIGURATION_FILES_PATH = "conf/";
private static String RESOURCES_FILE_PATH = "resources/";
private static String RESOURCES_FILE_PATH_TEST = "src/test/resources/";
private static Configuration _instance = null;
private ConfMode _confMode = ConfMode.LIVE;
static {
try {
_instance = new Configuration();
} catch (FileNotFoundException e) {
e.printStackTrace();
System.exit(-1);
} catch (IOException e) {
e.printStackTrace();
System.exit(-1);
}
}
private Properties _properties = null;
private Configuration() throws FileNotFoundException, IOException {
_properties = new Properties();
//System.setProperty("log4j.configuration" , "file:" + CONFIGURATION_FILES_PATH + "log4j.properties");
PropertyConfigurator.configure(CONFIGURATION_FILES_PATH + "log4j.properties");
log.info("Logger configured");
log.info("Loading configuration: " + CONFIGURATION_FILES_PATH + CONFIGURATION_FILE_NAME);
_properties.load(new FileInputStream(CONFIGURATION_FILES_PATH + CONFIGURATION_FILE_NAME));
}
public static Configuration getInstance() {
return _instance;
}
public void setMode(ConfMode mode) {
_confMode = mode;
}
public String getValue(String key) {
return _properties.getProperty(key);
}
public String getResourcePath() {
if (_confMode == ConfMode.LIVE)
return RESOURCES_FILE_PATH;
else
return RESOURCES_FILE_PATH_TEST;
}
public String getConfigurationFileAndPath(String key) {
return CONFIGURATION_FILES_PATH + _properties.getProperty(key);
}
public String getResourceFileAndPath(String key) {
if (_confMode == ConfMode.LIVE)
return RESOURCES_FILE_PATH + _properties.getProperty(key);
else
return RESOURCES_FILE_PATH_TEST + _properties.getProperty(key);
}
private void reload(String fileName) throws FileNotFoundException, IOException {
log.info("Reloading configuration: " + CONFIGURATION_FILES_PATH + fileName);
_properties.load(new FileInputStream(CONFIGURATION_FILES_PATH + fileName));
}
}
| [
"philipp.potisk@725ea65b-bb50-0410-bc28-9f83e2431ff3"
] | philipp.potisk@725ea65b-bb50-0410-bc28-9f83e2431ff3 |
62f611fea8f818739ad46207f1005821e7402fbf | 8ada64b660b7c8c1f909fc75c5d0424b2eb5a086 | /JAVA/T.9 POO/E3/MainE3.java | 1346c308f1f9d7e1ab9c1cd7c8dc4b166c7a82a7 | [] | no_license | esthermelendez/ejercicios-programacion-daw | 1d94047d786e772dadcb5c906d25b8adb18f2079 | d82d8ff0f59c0c88dec511d9982be6109c8af568 | refs/heads/master | 2021-09-07T03:54:20.585394 | 2018-02-16T23:17:13 | 2018-02-16T23:17:13 | 105,865,666 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,169 | 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 E3;
/**
*
* @author meloc
*/
public class MainE3 {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
Animal rocinante = new Animal("rocinante");
Ave blanca = new Ave("blanca");
Canario monu = new Canario("monu");
Canario lulu = new Canario("lulu");
Canario to = new Canario("to");
Canario cria1 = new Canario();
Canario cria2 = new Canario();
rocinante.setPeso(45);
rocinante.anda();
blanca.setPeso(25);
blanca.anda();
blanca.setSexo("hembra");
blanca.getSexo();
blanca.pia();
System.out.println(blanca.getSexo());
monu.setSexo("hembra");
monu.getSexo();
to.setSexo("macho");
to.getSexo();
lulu.setSexo("macho");
lulu.getSexo();
lulu.seApareaCon(to, "Piolino", "Piolina", "Periquito", "Cuervo");
cria1 = monu.seApareaCon(to, "Piolino", "Piolina", "Periquito", "Cuervo");
System.out.println(cria1);
}
}
| [
"sthyb99@gmail.com"
] | sthyb99@gmail.com |
0c3775fd940545da6683d8c34ec32354ad348fa1 | 8cdf7cbb4865c93dc4fe16d9ef0e95861fcd45f4 | /eshop-coupon/src/main/java/com/hxm/eshop/coupon/dao/CouponSpuCategoryRelationDao.java | 8cbaec047f4ae3407cbe5267ff978c1ab7fbfd80 | [] | no_license | z596593851/eshop | 698d7798e4c41fe6852abb23dfd189c884840f69 | 35e35b290859280621672209c06cc78534d8d0f9 | refs/heads/master | 2023-06-24T19:13:41.207294 | 2021-07-07T06:16:04 | 2021-07-07T06:16:04 | 361,741,550 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 434 | java | package com.hxm.eshop.coupon.dao;
import com.hxm.eshop.coupon.entity.CouponSpuCategoryRelationEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* 优惠券分类关联
*
* @author xiaoming
* @email z596593851@gmail.com
* @date 2021-05-08 14:48:37
*/
@Mapper
public interface CouponSpuCategoryRelationDao extends BaseMapper<CouponSpuCategoryRelationEntity> {
}
| [
"huxiaoming02@58.com"
] | huxiaoming02@58.com |
d64139285fcb693e5989916418924bbaca5c2ed1 | c3fa5ba0f65167ce3c64d4d7850058ab0606246a | /src/main/java/com/techery/droid/billings/utils/Base64.java | a09474dd9ee95a561f3bda78fbe3b008b30e87b9 | [
"MIT"
] | permissive | evrimulgen/DroidBilling | 09b5f1d2f9de3faecb1fe8a445ecf8433306cc3d | 468c4886ea611ca383765baeecd15a2ba2aac59a | refs/heads/master | 2021-01-12T22:22:03.741186 | 2013-11-27T20:48:59 | 2013-11-27T20:48:59 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 22,878 | java | package com.techery.droid.billings.utils;
public class Base64 {
/** Specify encoding (value is {@code true}). */
public final static boolean ENCODE = true;
/** Specify decoding (value is {@code false}). */
public final static boolean DECODE = false;
/** The equals sign (=) as a byte. */
private final static byte EQUALS_SIGN = (byte) '=';
/** The new line character (\n) as a byte. */
private final static byte NEW_LINE = (byte) '\n';
/**
* The 64 valid Base64 values.
*/
private final static byte[] ALPHABET =
{(byte) 'A', (byte) 'B', (byte) 'C', (byte) 'D', (byte) 'E', (byte) 'F',
(byte) 'G', (byte) 'H', (byte) 'I', (byte) 'J', (byte) 'K',
(byte) 'L', (byte) 'M', (byte) 'N', (byte) 'O', (byte) 'P',
(byte) 'Q', (byte) 'R', (byte) 'S', (byte) 'T', (byte) 'U',
(byte) 'V', (byte) 'W', (byte) 'X', (byte) 'Y', (byte) 'Z',
(byte) 'a', (byte) 'b', (byte) 'c', (byte) 'd', (byte) 'e',
(byte) 'f', (byte) 'g', (byte) 'h', (byte) 'i', (byte) 'j',
(byte) 'k', (byte) 'l', (byte) 'm', (byte) 'n', (byte) 'o',
(byte) 'p', (byte) 'q', (byte) 'r', (byte) 's', (byte) 't',
(byte) 'u', (byte) 'v', (byte) 'w', (byte) 'x', (byte) 'y',
(byte) 'z', (byte) '0', (byte) '1', (byte) '2', (byte) '3',
(byte) '4', (byte) '5', (byte) '6', (byte) '7', (byte) '8',
(byte) '9', (byte) '+', (byte) '/'};
/**
* The 64 valid web safe Base64 values.
*/
private final static byte[] WEBSAFE_ALPHABET =
{(byte) 'A', (byte) 'B', (byte) 'C', (byte) 'D', (byte) 'E', (byte) 'F',
(byte) 'G', (byte) 'H', (byte) 'I', (byte) 'J', (byte) 'K',
(byte) 'L', (byte) 'M', (byte) 'N', (byte) 'O', (byte) 'P',
(byte) 'Q', (byte) 'R', (byte) 'S', (byte) 'T', (byte) 'U',
(byte) 'V', (byte) 'W', (byte) 'X', (byte) 'Y', (byte) 'Z',
(byte) 'a', (byte) 'b', (byte) 'c', (byte) 'd', (byte) 'e',
(byte) 'f', (byte) 'g', (byte) 'h', (byte) 'i', (byte) 'j',
(byte) 'k', (byte) 'l', (byte) 'm', (byte) 'n', (byte) 'o',
(byte) 'p', (byte) 'q', (byte) 'r', (byte) 's', (byte) 't',
(byte) 'u', (byte) 'v', (byte) 'w', (byte) 'x', (byte) 'y',
(byte) 'z', (byte) '0', (byte) '1', (byte) '2', (byte) '3',
(byte) '4', (byte) '5', (byte) '6', (byte) '7', (byte) '8',
(byte) '9', (byte) '-', (byte) '_'};
/**
* Translates a Base64 value to either its 6-bit reconstruction value
* or a negative number indicating some other meaning.
**/
private final static byte[] DECODABET = {-9, -9, -9, -9, -9, -9, -9, -9, -9, // Decimal 0 - 8
-5, -5, // Whitespace: Tab and Linefeed
-9, -9, // Decimal 11 - 12
-5, // Whitespace: Carriage Return
-9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, // Decimal 14 - 26
-9, -9, -9, -9, -9, // Decimal 27 - 31
-5, // Whitespace: Space
-9, -9, -9, -9, -9, -9, -9, -9, -9, -9, // Decimal 33 - 42
62, // Plus sign at decimal 43
-9, -9, -9, // Decimal 44 - 46
63, // Slash at decimal 47
52, 53, 54, 55, 56, 57, 58, 59, 60, 61, // Numbers zero through nine
-9, -9, -9, // Decimal 58 - 60
-1, // Equals sign at decimal 61
-9, -9, -9, // Decimal 62 - 64
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, // Letters 'A' through 'N'
14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, // Letters 'O' through 'Z'
-9, -9, -9, -9, -9, -9, // Decimal 91 - 96
26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, // Letters 'a' through 'm'
39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, // Letters 'n' through 'z'
-9, -9, -9, -9, -9 // Decimal 123 - 127
/* ,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 128 - 139
-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 140 - 152
-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 153 - 165
-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 166 - 178
-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 179 - 191
-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 192 - 204
-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 205 - 217
-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 218 - 230
-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 231 - 243
-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9 // Decimal 244 - 255 */
};
/** The web safe decodabet */
private final static byte[] WEBSAFE_DECODABET =
{-9, -9, -9, -9, -9, -9, -9, -9, -9, // Decimal 0 - 8
-5, -5, // Whitespace: Tab and Linefeed
-9, -9, // Decimal 11 - 12
-5, // Whitespace: Carriage Return
-9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, // Decimal 14 - 26
-9, -9, -9, -9, -9, // Decimal 27 - 31
-5, // Whitespace: Space
-9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, // Decimal 33 - 44
62, // Dash '-' sign at decimal 45
-9, -9, // Decimal 46-47
52, 53, 54, 55, 56, 57, 58, 59, 60, 61, // Numbers zero through nine
-9, -9, -9, // Decimal 58 - 60
-1, // Equals sign at decimal 61
-9, -9, -9, // Decimal 62 - 64
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, // Letters 'A' through 'N'
14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, // Letters 'O' through 'Z'
-9, -9, -9, -9, // Decimal 91-94
63, // Underscore '_' at decimal 95
-9, // Decimal 96
26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, // Letters 'a' through 'm'
39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, // Letters 'n' through 'z'
-9, -9, -9, -9, -9 // Decimal 123 - 127
/* ,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 128 - 139
-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 140 - 152
-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 153 - 165
-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 166 - 178
-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 179 - 191
-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 192 - 204
-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 205 - 217
-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 218 - 230
-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 231 - 243
-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9 // Decimal 244 - 255 */
};
// Indicates white space in encoding
private final static byte WHITE_SPACE_ENC = -5;
// Indicates equals sign in encoding
private final static byte EQUALS_SIGN_ENC = -1;
/** Defeats instantiation. */
private Base64() {
}
/* ******** E N C O D I N G M E T H O D S ******** */
/**
* Encodes up to three bytes of the array <var>source</var>
* and writes the resulting four Base64 bytes to <var>destination</var>.
* The source and destination arrays can be manipulated
* anywhere along their length by specifying
* <var>srcOffset</var> and <var>destOffset</var>.
* This method does not check to make sure your arrays
* are large enough to accommodate <var>srcOffset</var> + 3 for
* the <var>source</var> array or <var>destOffset</var> + 4 for
* the <var>destination</var> array.
* The actual number of significant bytes in your array is
* given by <var>numSigBytes</var>.
*
* @param source the array to convert
* @param srcOffset the index where conversion begins
* @param numSigBytes the number of significant bytes in your array
* @param destination the array to hold the conversion
* @param destOffset the index where output will be put
* @param alphabet is the encoding alphabet
* @return the <var>destination</var> array
* @since 1.3
*/
private static byte[] encode3to4(byte[] source, int srcOffset,
int numSigBytes, byte[] destination, int destOffset, byte[] alphabet) {
// 1 2 3
// 01234567890123456789012345678901 Bit position
// --------000000001111111122222222 Array position from threeBytes
// --------| || || || | Six bit groups to index alphabet
// >>18 >>12 >> 6 >> 0 Right shift necessary
// 0x3f 0x3f 0x3f Additional AND
// Create buffer with zero-padding if there are only one or two
// significant bytes passed in the array.
// We have to shift left 24 in order to flush out the 1's that appear
// when Java treats a value as negative that is cast from a byte to an int.
int inBuff =
(numSigBytes > 0 ? ((source[srcOffset] << 24) >>> 8) : 0)
| (numSigBytes > 1 ? ((source[srcOffset + 1] << 24) >>> 16) : 0)
| (numSigBytes > 2 ? ((source[srcOffset + 2] << 24) >>> 24) : 0);
switch (numSigBytes) {
case 3:
destination[destOffset] = alphabet[(inBuff >>> 18)];
destination[destOffset + 1] = alphabet[(inBuff >>> 12) & 0x3f];
destination[destOffset + 2] = alphabet[(inBuff >>> 6) & 0x3f];
destination[destOffset + 3] = alphabet[(inBuff) & 0x3f];
return destination;
case 2:
destination[destOffset] = alphabet[(inBuff >>> 18)];
destination[destOffset + 1] = alphabet[(inBuff >>> 12) & 0x3f];
destination[destOffset + 2] = alphabet[(inBuff >>> 6) & 0x3f];
destination[destOffset + 3] = EQUALS_SIGN;
return destination;
case 1:
destination[destOffset] = alphabet[(inBuff >>> 18)];
destination[destOffset + 1] = alphabet[(inBuff >>> 12) & 0x3f];
destination[destOffset + 2] = EQUALS_SIGN;
destination[destOffset + 3] = EQUALS_SIGN;
return destination;
default:
return destination;
} // end switch
} // end encode3to4
/**
* Encodes a byte array into Base64 notation.
* Equivalent to calling
* {@code encodeBytes(source, 0, source.length)}
*
* @param source The data to convert
* @since 1.4
*/
public static String encode(byte[] source) {
return encode(source, 0, source.length, ALPHABET, true);
}
/**
* Encodes a byte array into web safe Base64 notation.
*
* @param source The data to convert
* @param doPadding is {@code true} to pad result with '=' chars
* if it does not fall on 3 byte boundaries
*/
public static String encodeWebSafe(byte[] source, boolean doPadding) {
return encode(source, 0, source.length, WEBSAFE_ALPHABET, doPadding);
}
/**
* Encodes a byte array into Base64 notation.
*
* @param source the data to convert
* @param off offset in array where conversion should begin
* @param len length of data to convert
* @param alphabet the encoding alphabet
* @param doPadding is {@code true} to pad result with '=' chars
* if it does not fall on 3 byte boundaries
* @since 1.4
*/
public static String encode(byte[] source, int off, int len, byte[] alphabet,
boolean doPadding) {
byte[] outBuff = encode(source, off, len, alphabet, Integer.MAX_VALUE);
int outLen = outBuff.length;
// If doPadding is false, set length to truncate '='
// padding characters
while (doPadding == false && outLen > 0) {
if (outBuff[outLen - 1] != '=') {
break;
}
outLen -= 1;
}
return new String(outBuff, 0, outLen);
}
/**
* Encodes a byte array into Base64 notation.
*
* @param source the data to convert
* @param off offset in array where conversion should begin
* @param len length of data to convert
* @param alphabet is the encoding alphabet
* @param maxLineLength maximum length of one line.
* @return the BASE64-encoded byte array
*/
public static byte[] encode(byte[] source, int off, int len, byte[] alphabet,
int maxLineLength) {
int lenDiv3 = (len + 2) / 3; // ceil(len / 3)
int len43 = lenDiv3 * 4;
byte[] outBuff = new byte[len43 // Main 4:3
+ (len43 / maxLineLength)]; // New lines
int d = 0;
int e = 0;
int len2 = len - 2;
int lineLength = 0;
for (; d < len2; d += 3, e += 4) {
// The following block of code is the same as
// encode3to4( source, d + off, 3, outBuff, e, alphabet );
// but inlined for faster encoding (~20% improvement)
int inBuff =
((source[d + off] << 24) >>> 8)
| ((source[d + 1 + off] << 24) >>> 16)
| ((source[d + 2 + off] << 24) >>> 24);
outBuff[e] = alphabet[(inBuff >>> 18)];
outBuff[e + 1] = alphabet[(inBuff >>> 12) & 0x3f];
outBuff[e + 2] = alphabet[(inBuff >>> 6) & 0x3f];
outBuff[e + 3] = alphabet[(inBuff) & 0x3f];
lineLength += 4;
if (lineLength == maxLineLength) {
outBuff[e + 4] = NEW_LINE;
e++;
lineLength = 0;
} // end if: end of line
} // end for: each piece of array
if (d < len) {
encode3to4(source, d + off, len - d, outBuff, e, alphabet);
lineLength += 4;
if (lineLength == maxLineLength) {
// Add a last newline
outBuff[e + 4] = NEW_LINE;
e++;
}
e += 4;
}
assert (e == outBuff.length);
return outBuff;
}
/* ******** D E C O D I N G M E T H O D S ******** */
/**
* Decodes four bytes from array <var>source</var>
* and writes the resulting bytes (up to three of them)
* to <var>destination</var>.
* The source and destination arrays can be manipulated
* anywhere along their length by specifying
* <var>srcOffset</var> and <var>destOffset</var>.
* This method does not check to make sure your arrays
* are large enough to accommodate <var>srcOffset</var> + 4 for
* the <var>source</var> array or <var>destOffset</var> + 3 for
* the <var>destination</var> array.
* This method returns the actual number of bytes that
* were converted from the Base64 encoding.
*
*
* @param source the array to convert
* @param srcOffset the index where conversion begins
* @param destination the array to hold the conversion
* @param destOffset the index where output will be put
* @param decodabet the decodabet for decoding Base64 content
* @return the number of decoded bytes converted
* @since 1.3
*/
private static int decode4to3(byte[] source, int srcOffset,
byte[] destination, int destOffset, byte[] decodabet) {
// Example: Dk==
if (source[srcOffset + 2] == EQUALS_SIGN) {
int outBuff =
((decodabet[source[srcOffset]] << 24) >>> 6)
| ((decodabet[source[srcOffset + 1]] << 24) >>> 12);
destination[destOffset] = (byte) (outBuff >>> 16);
return 1;
} else if (source[srcOffset + 3] == EQUALS_SIGN) {
// Example: DkL=
int outBuff =
((decodabet[source[srcOffset]] << 24) >>> 6)
| ((decodabet[source[srcOffset + 1]] << 24) >>> 12)
| ((decodabet[source[srcOffset + 2]] << 24) >>> 18);
destination[destOffset] = (byte) (outBuff >>> 16);
destination[destOffset + 1] = (byte) (outBuff >>> 8);
return 2;
} else {
// Example: DkLE
int outBuff =
((decodabet[source[srcOffset]] << 24) >>> 6)
| ((decodabet[source[srcOffset + 1]] << 24) >>> 12)
| ((decodabet[source[srcOffset + 2]] << 24) >>> 18)
| ((decodabet[source[srcOffset + 3]] << 24) >>> 24);
destination[destOffset] = (byte) (outBuff >> 16);
destination[destOffset + 1] = (byte) (outBuff >> 8);
destination[destOffset + 2] = (byte) (outBuff);
return 3;
}
} // end decodeToBytes
/**
* Decodes data from Base64 notation.
*
* @param s the string to decode (decoded in default encoding)
* @return the decoded data
* @since 1.4
*/
public static byte[] decode(String s) throws Base64DecoderException {
byte[] bytes = s.getBytes();
return decode(bytes, 0, bytes.length);
}
/**
* Decodes data from web safe Base64 notation.
* Web safe encoding uses '-' instead of '+', '_' instead of '/'
*
* @param s the string to decode (decoded in default encoding)
* @return the decoded data
*/
public static byte[] decodeWebSafe(String s) throws Base64DecoderException {
byte[] bytes = s.getBytes();
return decodeWebSafe(bytes, 0, bytes.length);
}
/**
* Decodes Base64 content in byte array format and returns
* the decoded byte array.
*
* @param source The Base64 encoded data
* @return decoded data
* @since 1.3
* @throws Base64DecoderException
*/
public static byte[] decode(byte[] source) throws Base64DecoderException {
return decode(source, 0, source.length);
}
/**
* Decodes web safe Base64 content in byte array format and returns
* the decoded data.
* Web safe encoding uses '-' instead of '+', '_' instead of '/'
*
* @param source the string to decode (decoded in default encoding)
* @return the decoded data
*/
public static byte[] decodeWebSafe(byte[] source)
throws Base64DecoderException {
return decodeWebSafe(source, 0, source.length);
}
/**
* Decodes Base64 content in byte array format and returns
* the decoded byte array.
*
* @param source the Base64 encoded data
* @param off the offset of where to begin decoding
* @param len the length of characters to decode
* @return decoded data
* @since 1.3
* @throws Base64DecoderException
*/
public static byte[] decode(byte[] source, int off, int len)
throws Base64DecoderException {
return decode(source, off, len, DECODABET);
}
/**
* Decodes web safe Base64 content in byte array format and returns
* the decoded byte array.
* Web safe encoding uses '-' instead of '+', '_' instead of '/'
*
* @param source the Base64 encoded data
* @param off the offset of where to begin decoding
* @param len the length of characters to decode
* @return decoded data
*/
public static byte[] decodeWebSafe(byte[] source, int off, int len)
throws Base64DecoderException {
return decode(source, off, len, WEBSAFE_DECODABET);
}
/**
* Decodes Base64 content using the supplied decodabet and returns
* the decoded byte array.
*
* @param source the Base64 encoded data
* @param off the offset of where to begin decoding
* @param len the length of characters to decode
* @param decodabet the decodabet for decoding Base64 content
* @return decoded data
*/
public static byte[] decode(byte[] source, int off, int len, byte[] decodabet)
throws Base64DecoderException {
int len34 = len * 3 / 4;
byte[] outBuff = new byte[2 + len34]; // Upper limit on size of output
int outBuffPosn = 0;
byte[] b4 = new byte[4];
int b4Posn = 0;
int i = 0;
byte sbiCrop = 0;
byte sbiDecode = 0;
for (i = 0; i < len; i++) {
sbiCrop = (byte) (source[i + off] & 0x7f); // Only the low seven bits
sbiDecode = decodabet[sbiCrop];
if (sbiDecode >= WHITE_SPACE_ENC) { // White space Equals sign or better
if (sbiDecode >= EQUALS_SIGN_ENC) {
// An equals sign (for padding) must not occur at position 0 or 1
// and must be the last byte[s] in the encoded value
if (sbiCrop == EQUALS_SIGN) {
int bytesLeft = len - i;
byte lastByte = (byte) (source[len - 1 + off] & 0x7f);
if (b4Posn == 0 || b4Posn == 1) {
throw new Base64DecoderException(
"invalid padding byte '=' at byte offset " + i);
} else if ((b4Posn == 3 && bytesLeft > 2)
|| (b4Posn == 4 && bytesLeft > 1)) {
throw new Base64DecoderException(
"padding byte '=' falsely signals end of encoded value "
+ "at offset " + i);
} else if (lastByte != EQUALS_SIGN && lastByte != NEW_LINE) {
throw new Base64DecoderException(
"encoded value has invalid trailing byte");
}
break;
}
b4[b4Posn++] = sbiCrop;
if (b4Posn == 4) {
outBuffPosn += decode4to3(b4, 0, outBuff, outBuffPosn, decodabet);
b4Posn = 0;
}
}
} else {
throw new Base64DecoderException("Bad Base64 input character at " + i
+ ": " + source[i + off] + "(decimal)");
}
}
// Because web safe encoding allows non padding base64 encodes, we
// need to pad the rest of the b4 buffer with equal signs when
// b4Posn != 0. There can be at most 2 equal signs at the end of
// four characters, so the b4 buffer must have two or three
// characters. This also catches the case where the input is
// padded with EQUALS_SIGN
if (b4Posn != 0) {
if (b4Posn == 1) {
throw new Base64DecoderException("single trailing character at offset "
+ (len - 1));
}
b4[b4Posn++] = EQUALS_SIGN;
outBuffPosn += decode4to3(b4, 0, outBuff, outBuffPosn, decodabet);
}
byte[] out = new byte[outBuffPosn];
System.arraycopy(outBuff, 0, out, 0, outBuffPosn);
return out;
}
}
| [
"sergeizenchenko@gmail.com"
] | sergeizenchenko@gmail.com |
0d9530e7a381733be6f9204294da9c33a1002d13 | 88ea1b0294a2c66eaa0bca3e4b0fdcb158e04765 | /app/src/main/java/in/tts/browser/browser/Javascript.java | a3609b6a1a7de0d440442b264bc7f40fd5c0d904 | [] | no_license | dttminers/TTS | 1b0973c21c362004ffb5eb5dbae30e8401d8ab05 | c4531c3a1ed2fd6cfc06d18b4b4c391fe40ae872 | refs/heads/master | 2020-03-21T15:04:15.225625 | 2018-09-18T13:15:07 | 2018-09-18T13:15:07 | 138,692,654 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,798 | java | package in.tts.browser.browser;
import android.content.Context;
import android.content.res.AssetManager;
import android.util.Log;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Set;
import in.tts.browser.database.RecordAction;
public class Javascript {
private static final String FILE = "javaHosts.txt";
private static final Set<String> hostsJS = new HashSet<>();
private static final List<String> whitelistJS = new ArrayList<>();
private static final Locale locale = Locale.getDefault();
private static void loadHosts(final Context context) {
Thread thread = new Thread(new Runnable() {
@Override
public void run() {
AssetManager manager = context.getAssets();
try {
BufferedReader reader = new BufferedReader(new InputStreamReader(manager.open(FILE)));
String line;
while ((line = reader.readLine()) != null) {
hostsJS.add(line.toLowerCase(locale));
}
} catch (IOException i) {
Log.w("Browser", "Error loading hosts");
}
}
});
thread.start();
}
private synchronized static void loadDomains(Context context) {
RecordAction action = new RecordAction(context);
action.open(false);
whitelistJS.clear();
whitelistJS.addAll(action.listDomainsJS());
action.close();
}
private final Context context;
public Javascript(Context context) {
this.context = context;
if (hostsJS.isEmpty()) {
loadHosts(context);
}
loadDomains(context);
}
public boolean isWhite(String url) {
for (String domain : whitelistJS) {
if (url.contains(domain)) {
return true;
}
}
return false;
}
public synchronized void addDomain(String domain) {
RecordAction action = new RecordAction(context);
action.open(true);
action.addDomainJS(domain);
action.close();
whitelistJS.add(domain);
}
public synchronized void removeDomain(String domain) {
RecordAction action = new RecordAction(context);
action.open(true);
action.deleteDomainJS(domain);
action.close();
whitelistJS.remove(domain);
}
public synchronized void clearDomains() {
RecordAction action = new RecordAction(context);
action.open(true);
action.clearDomainsJS();
action.close();
whitelistJS.clear();
}
}
| [
"37068505+Akshipta@users.noreply.github.com"
] | 37068505+Akshipta@users.noreply.github.com |
4ff78c7263373885fc00294234812ffd77076795 | 3ec3dd99ce0bf09380aa3e8beb40fa9c5c41c60e | /src/playerc/semanticactions/MakeRecordInitsExpression.java | 79aff4088c3a21c42f9f8476d20ced22d1b53449 | [
"Unlicense",
"LicenseRef-scancode-public-domain"
] | permissive | jdavcs/playerc | 3e46d58f0cfa5ab7f9a325daf37ef7fe191c5e19 | 5ca0a71503389fb5562153feee69f34e8de14b2c | refs/heads/master | 2022-04-30T09:57:51.876998 | 2018-05-23T04:26:12 | 2018-05-23T04:26:12 | 101,432,301 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 990 | java | /*
* This code is part of a compiler for the Player programming language
* Created: 2004-2005
* Revised: 09/2017
*/
package playerc.semanticactions;
import java.util.Stack;
import playerc.SemanticAction;
import playerc.Token;
import playerc.abstractsyntax.NewTypename;
import playerc.abstractsyntax.RecordInitList;
import playerc.abstractsyntax.RecordInitsExpression;
/**
* @author Sergey Golitsynskiy
* @version 3.1
*/
public class MakeRecordInitsExpression extends SemanticAction {
private String actionName;
public MakeRecordInitsExpression(String actionName, int lineNumber) {
super(lineNumber);
this.actionName = actionName;
}
public void execute(Stack semanticStack, Token lastToken) {
RecordInitList list = (RecordInitList) semanticStack.pop();
NewTypename typename = (NewTypename) semanticStack.pop();
semanticStack.push(new RecordInitsExpression(typename, list, lineNumber()));
}
public String toString() {
return actionName;
}
} | [
"sgolitsynskiy@gmail.com"
] | sgolitsynskiy@gmail.com |
cd03f7321e5d781e31da796f99df5c76c3ac3a4c | d5ea2e5a815f9799e4c8056d4585f145a15957a1 | /qshp-commons-lang/src/main/java/org/qshp/commons/lang/BaseDomain.java | 2f4be635bd1b5da794e33464d0e078d7c2916004 | [] | no_license | qshp/qshp-commons | 43824c93245f518d0d05204005691b21049afda1 | 137598ed3dbd6c0bddad6deb935416155c0375e5 | refs/heads/master | 2021-01-10T21:48:36.060583 | 2016-02-14T14:01:04 | 2016-02-14T14:01:04 | 42,348,100 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 558 | java | /*
* Copyright 1998-2012 qshp.org All right reserved. This software is the
* confidential and proprietary information of qshp.org ("Confidential
* Information"). You shall not disclose such Confidential Information and shall
* use it only in accordance with the terms of the license agreement you entered
* into with qshp.org.
*/
package org.qshp.commons.lang;
import org.apache.commons.lang.builder.ReflectionToStringBuilder;
public class BaseDomain {
@Override
public String toString() {
return ReflectionToStringBuilder.toString(this);
}
}
| [
"qinyong2020@sina.com"
] | qinyong2020@sina.com |
4967bb82c152c91e124993875222b2dadc2cb081 | adaaacc0da2eb6f4a1dc1794cf15b493bb8912bf | /src/test/java/TaskListTest.java | 81c32580d5c0f8792cd361eece617797cfaaa22c | [] | no_license | alam8064/duke | b04efdb93eab7be0e06cc40d4a398709fe140a55 | d54581b5d4bbdbd2e03f7212d2f8cdf9dca4503c | refs/heads/master | 2020-12-15T20:05:10.566322 | 2020-02-19T13:05:10 | 2020-02-19T13:05:10 | 235,238,881 | 0 | 0 | null | 2020-02-13T07:14:47 | 2020-01-21T02:21:10 | Java | UTF-8 | Java | false | false | 644 | java | import org.junit.jupiter.api.Test;
import java.util.ArrayList;
import static org.junit.jupiter.api.Assertions.assertEquals;
public class TaskListTest {
@Test
public void testMarkAsDone() {
TaskList taskList = new TaskList(new ArrayList<>());
taskList.arr.add(new Todo("read book"));
taskList.markAsDone(1);
assertEquals(true, taskList.arr.get(0).done);
}
@Test
public void testDeleteTask() {
TaskList taskList = new TaskList(new ArrayList<>());
taskList.arr.add(new Todo("read book"));
taskList.deleteTask(1);
assertEquals(0, taskList.arr.size());
}
}
| [
"59945273+alam8064@users.noreply.github.com"
] | 59945273+alam8064@users.noreply.github.com |
1d9a90f1a27a3e5f417ffbea12a280d977a35e2f | 194422c7909bb5aa7658532ebb93b0bb672e90c1 | /MolecularGUI/app/src/main/java/com/example/esteb/moleculargui/Main2Activity.java | 8f380818248b4b4ab5de27575f3f147040fb8bcb | [] | no_license | EstebanHRasch/MolecularGUI | fcc9c2d0ddd2a2ea2691949f279a7f26c21ab6a2 | 39b0c466001807534216ff4648ce87d801d84ac6 | refs/heads/master | 2022-05-27T00:00:59.024552 | 2020-03-20T04:48:57 | 2020-03-20T04:48:57 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 345 | java | package com.example.esteb.moleculargui;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class Main2Activity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main2);
}
}
| [
"33496976+EstebanHernandez1@users.noreply.github.com"
] | 33496976+EstebanHernandez1@users.noreply.github.com |
89a0f3c38dca37967db3554a5f906022c04c143b | 642a2adf2bc0bc43fa8199dd4db362e58b0c12cf | /src/test/java/dao/testRoleDao.java | f6434dd269895016842b07f263024fb96b06a9ba | [] | no_license | yinmh/rbac | 4e077fb07702bcdfaa7ca18f7b344149c276abef | 497476481772c59f0a764c1b3d50344b513e9d94 | refs/heads/master | 2020-04-29T15:09:40.793969 | 2019-03-18T06:37:46 | 2019-03-18T06:37:46 | 176,219,171 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 649 | java | package dao;
import com.westos.rbac.dao.RoleDao;
import com.westos.rbac.dao.impl.RoleDaoImpl;
import com.westos.rbac.domain.Role;
import org.junit.Ignore;
import org.junit.Test;
import java.util.List;
public class testRoleDao {
RoleDao roleDao = new RoleDaoImpl();
@Test
@Ignore
public void testFindByUserId(){
List<Role> roles = roleDao.findByUserId(14);
for (Role role : roles) {
System.out.println(role);
}
}
@Test
public void testFindAll(){
List<Role> roles = roleDao.findAll();
for (Role role : roles) {
System.out.println(role);
}
}
}
| [
"2573899087@qq.com"
] | 2573899087@qq.com |
6332e8f6cf3b9471ca3a9aa49cab3eebe9527907 | c12e22fbab7826b9c0ca65ad8472972a23f0223d | /bundles/designerx/ui/org.openhab.designerx.ui.javafx/src/main/java/org/openhab/designerx/ui/javafx/controller/BaseController.java | fb7d6f2789620d9239624b6de57b64bb875afdde | [] | no_license | leonzhouwei/openhab_designerx | a659da72a070a5072af628fc19e930ab75d807a6 | aa8de152fc1cd2f979c6b8c4409bba4ad1e450de | refs/heads/master | 2021-01-21T10:12:50.395976 | 2014-05-18T16:11:21 | 2014-05-18T16:11:21 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,235 | java | package org.openhab.designerx.ui.javafx.controller;
import java.awt.Dimension;
import java.awt.Toolkit;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
public abstract class BaseController {
protected Stage stage;
public abstract Parent getView();
public BaseController create(Stage stage, Stage parent) {
if (this.stage != null) {
return this;
}
this.stage = stage;
Scene scene = new Scene(getView());
stage.setScene(scene);
if (parent != null) {
stage.initOwner(parent);
}
return this;
}
public BaseController setTitle(String title) {
stage.setTitle(title);
return this;
}
public BaseController show() {
stage.show();
return this;
}
public BaseController hide() {
stage.hide();
return this;
}
public void close() {
stage.close();
}
public void resizeMax() {
Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
resizeTo(dim.getWidth(), dim.getHeight());
}
public void resizeTo(double w, double h) {
if (stage != null) {
stage.setWidth(w);
stage.setHeight(h);
}
}
}
| [
"leonzhouwei@gmail.com"
] | leonzhouwei@gmail.com |
f0dd2daaa86227cd128ee3612fc909341d400417 | 0d058a4d3fcf014a3bcb7e342154e839218f1877 | /src/java/helper/Clone.java | 3f52848f4de81644ac7a8fe723a37bdd865a4b6f | [] | no_license | maxredng/corefx | 644c68f820b693af5885c75e66f698be70808616 | 7119e228325954496015dc837a35019452aeebbd | refs/heads/master | 2020-04-05T22:09:48.089517 | 2018-11-12T20:29:39 | 2018-11-12T20:29:39 | 157,247,021 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,489 | 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 helper;
import data.connection;
import data.data;
import html.feed;
import html.tag;
import javax.servlet.http.HttpServletRequest;
/**
*
* @author Maxkarpov
*/
public class Clone {
public static void handle(HttpServletRequest request)
{
String mscope = request.getParameter("mscope");
String parent = request.getParameter("parent");
String select = request.getParameter("selected");
String scope = request.getParameter("area");
String tmp = request.getParameter("temp");
String prf = null;
prf = common.Com.getSec();
tag tg = new tag(select,scope,new feed(),true);
tg.parent = parent;
tg.populateTag();
tg.SaveTag(mscope, false,prf,parent);
String nm = common.Com.changeName(select, scope, mscope);
if(common.Com.isThing(tmp))
{
String qur = "update config.col set isel='nonsuch', num='template:"+tmp+"' where name='"+prf+nm+"' and scope='"+mscope+"'";
connection con = new connection(MyDB.Schema.schema.config);
data da = new data(con);
try
{
da.Execute(qur);
}
catch(Exception xex)
{}
}
}
}
| [
"Maxim.Karpov@valtech.com"
] | Maxim.Karpov@valtech.com |
3eaa5a13189a772c55e6988f1579914d4dfc7db5 | d31756eed3ae1869690b48b23b302b4231e73ba8 | /voizd-mediacommons/src/main/java/com/voizd/media/utils/file/AbstractMediaFile.java | 0b79e63f0028b7afaa1cf7112144b012d1acb750 | [] | no_license | mkggupta/VOIZD | 1cd6842ef5fb5f4cb760b3863e19964c372c413d | 07c65015b8cf765ae2f1bc60f0aa250c0bd6576e | refs/heads/master | 2021-01-10T06:45:50.947271 | 2015-12-26T07:09:56 | 2015-12-28T12:54:56 | 48,504,324 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,136 | java | package com.voizd.media.utils.file;
import com.voizd.media.dataobject.exception.UnsupportedTypeException;
import com.voizd.media.dataobject.file.MediaFile;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Formatter;
import java.util.Map;
import java.util.concurrent.atomic.AtomicLong;
import java.util.regex.Pattern;
/**
* @author Vikrant Singh
*/
public abstract class AbstractMediaFile {
protected static final String FILE_ID_SEPARATOR = "_";
protected static final Pattern FILE_ID_PATTERN = Pattern
.compile(FILE_ID_SEPARATOR);
protected static final AtomicLong UNIQUE_ID_COUNTER = new AtomicLong(
System.currentTimeMillis() * 1000);
protected static final String REPOSITORY_PATH_ORIGINAL = "original";
protected static final String REPOSITORY_PATH_CONVERTED = "converted";
protected static final String FILE_PATH_SEPARATOR = System
.getProperty("file.separator");
protected static final int FILE_DIR_LEVELS = 2;
protected static final int FILE_DIR_NAME_LENGTH = 2;
public abstract MediaFile getMediaFile(String[] fileFileds) throws UnsupportedTypeException;
public abstract String generateFileId(MediaFile mediaFile);
public abstract String getMediaPath(String fileId, MediaFile mediaFile, String basePath,
Map<Integer, String> pathParams, boolean isOriginal) throws NoSuchAlgorithmException;
public String generateUniqueId() {
String uniqueId = Long
.toString(UNIQUE_ID_COUNTER.incrementAndGet(), 36);
return uniqueId;
}
protected static String generateShaHashForFileId(String fileId)
throws NoSuchAlgorithmException {
MessageDigest md = MessageDigest.getInstance("SHA-1");
return byteArray2Hex(md.digest(fileId.getBytes()));
}
protected static String byteArray2Hex(final byte[] hash) {
Formatter formatter = new Formatter();
for (byte b : hash) {
formatter.format("%02x", b);
}
return formatter.toString();
}
}
| [
"manish.g.wnsgs@gmail.com"
] | manish.g.wnsgs@gmail.com |
c62875e9a4b06571224a221686358f09dc06d855 | 50b4bfc2fe47a5a497d5ecdf291c61d62d5502a7 | /src/main/java/pl/pabilo8/immersiveintelligence/common/CommonProxy.java | f0a8935e7e06a108ae2e4fc82ca19a658c99d608 | [] | no_license | Milkafund/ImmersiveIntelligence | 689cabf40d577893a7bdb7002a3fd70d9101a1fa | 0423e86de27a59f9549733087ce6824fac52eb39 | refs/heads/master | 2021-04-10T19:05:47.978896 | 2020-03-20T13:45:35 | 2020-03-20T13:45:35 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 54,582 | java | package pl.pabilo8.immersiveintelligence.common;
import blusunrize.immersiveengineering.ImmersiveEngineering;
import blusunrize.immersiveengineering.api.DimensionBlockPos;
import blusunrize.immersiveengineering.api.IEApi;
import blusunrize.immersiveengineering.api.MultiblockHandler;
import blusunrize.immersiveengineering.api.crafting.ArcFurnaceRecipe;
import blusunrize.immersiveengineering.api.crafting.BlueprintCraftingRecipe;
import blusunrize.immersiveengineering.api.crafting.IngredientStack;
import blusunrize.immersiveengineering.api.crafting.MixerRecipe;
import blusunrize.immersiveengineering.common.IEContent;
import blusunrize.immersiveengineering.common.blocks.IEBlockInterfaces.IGuiTile;
import blusunrize.immersiveengineering.common.blocks.ItemBlockIEBase;
import blusunrize.immersiveengineering.common.blocks.metal.BlockTypes_MetalDevice0;
import blusunrize.immersiveengineering.common.blocks.metal.BlockTypes_MetalDevice1;
import blusunrize.immersiveengineering.common.blocks.stone.BlockTypes_StoneDecoration;
import blusunrize.immersiveengineering.common.blocks.wooden.BlockTypes_WoodenDevice0;
import blusunrize.immersiveengineering.common.blocks.wooden.TileEntityWatermill;
import blusunrize.immersiveengineering.common.blocks.wooden.TileEntityWindmill;
import blusunrize.immersiveengineering.common.crafting.RecipeRGBColouration;
import blusunrize.immersiveengineering.common.items.IEItemInterfaces.IGuiItem;
import blusunrize.immersiveengineering.common.util.ItemNBTHelper;
import blusunrize.immersiveengineering.common.world.IEWorldGen;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.PropertyEnum;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.potion.Potion;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
import net.minecraftforge.event.world.BlockEvent.BreakEvent;
import net.minecraftforge.event.world.WorldEvent;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.eventhandler.Event.Result;
import net.minecraftforge.fml.common.eventhandler.EventPriority;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.network.IGuiHandler;
import net.minecraftforge.fml.common.registry.EntityRegistry;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.oredict.OreDictionary;
import pl.pabilo8.immersiveintelligence.Config.IIConfig.MechanicalDevices;
import pl.pabilo8.immersiveintelligence.Config.IIConfig.Ores;
import pl.pabilo8.immersiveintelligence.ImmersiveIntelligence;
import pl.pabilo8.immersiveintelligence.api.LighterFuelHandler;
import pl.pabilo8.immersiveintelligence.api.ShrapnelHandler;
import pl.pabilo8.immersiveintelligence.api.ShrapnelHandler.Shrapnel;
import pl.pabilo8.immersiveintelligence.api.Utils;
import pl.pabilo8.immersiveintelligence.api.bullets.BulletRegistry;
import pl.pabilo8.immersiveintelligence.api.bullets.PenetrationRegistry;
import pl.pabilo8.immersiveintelligence.api.crafting.BathingRecipe;
import pl.pabilo8.immersiveintelligence.api.crafting.ElectrolyzerRecipe;
import pl.pabilo8.immersiveintelligence.api.crafting.PrecissionAssemblerRecipe;
import pl.pabilo8.immersiveintelligence.api.rotary.CapabilityRotaryEnergy;
import pl.pabilo8.immersiveintelligence.api.rotary.RotaryUtils;
import pl.pabilo8.immersiveintelligence.api.utils.MinecartBlockHelper;
import pl.pabilo8.immersiveintelligence.common.blocks.BlockIIBase;
import pl.pabilo8.immersiveintelligence.common.blocks.BlockIIFluid;
import pl.pabilo8.immersiveintelligence.common.blocks.BlockIISlab;
import pl.pabilo8.immersiveintelligence.common.blocks.cloth.BlockIIClothDecoration;
import pl.pabilo8.immersiveintelligence.common.blocks.metal.*;
import pl.pabilo8.immersiveintelligence.common.blocks.multiblocks.metal.BlockIIMetalMultiblock0;
import pl.pabilo8.immersiveintelligence.common.blocks.multiblocks.metal.BlockIIMetalMultiblock1;
import pl.pabilo8.immersiveintelligence.common.blocks.multiblocks.metal.tileentities.first.*;
import pl.pabilo8.immersiveintelligence.common.blocks.multiblocks.metal.tileentities.second.MultiblockRedstoneInterface;
import pl.pabilo8.immersiveintelligence.common.blocks.multiblocks.metal.tileentities.second.TileEntityRedstoneInterface;
import pl.pabilo8.immersiveintelligence.common.blocks.multiblocks.wooden.*;
import pl.pabilo8.immersiveintelligence.common.blocks.rotary.*;
import pl.pabilo8.immersiveintelligence.common.blocks.stone.BlockIIStoneDecoration;
import pl.pabilo8.immersiveintelligence.common.blocks.stone.TileEntitySandbags;
import pl.pabilo8.immersiveintelligence.common.blocks.types.*;
import pl.pabilo8.immersiveintelligence.common.bullets.BulletComponentFirework;
import pl.pabilo8.immersiveintelligence.common.bullets.BulletComponentTracerPowder;
import pl.pabilo8.immersiveintelligence.common.bullets.BulletComponentWhitePhosphorus;
import pl.pabilo8.immersiveintelligence.common.bullets.cores.*;
import pl.pabilo8.immersiveintelligence.common.bullets.explosives.BulletComponentHMX;
import pl.pabilo8.immersiveintelligence.common.bullets.explosives.BulletComponentRDX;
import pl.pabilo8.immersiveintelligence.common.bullets.explosives.BulletComponentTNT;
import pl.pabilo8.immersiveintelligence.common.bullets.shrapnel.BulletComponentShrapnel;
import pl.pabilo8.immersiveintelligence.common.entity.EntityCamera;
import pl.pabilo8.immersiveintelligence.common.entity.EntityMachinegun;
import pl.pabilo8.immersiveintelligence.common.entity.EntitySkyCrate;
import pl.pabilo8.immersiveintelligence.common.entity.EntitySkycrateInternal;
import pl.pabilo8.immersiveintelligence.common.entity.bullets.EntityBullet;
import pl.pabilo8.immersiveintelligence.common.entity.bullets.EntityShrapnel;
import pl.pabilo8.immersiveintelligence.common.entity.minecarts.*;
import pl.pabilo8.immersiveintelligence.common.gui.*;
import pl.pabilo8.immersiveintelligence.common.gui.arithmetic_logic_machine.*;
import pl.pabilo8.immersiveintelligence.common.gui.data_input_machine.ContainerDataInputMachine;
import pl.pabilo8.immersiveintelligence.common.gui.data_input_machine.ContainerDataInputMachineVariables;
import pl.pabilo8.immersiveintelligence.common.items.*;
import pl.pabilo8.immersiveintelligence.common.items.bullet_casings.*;
import pl.pabilo8.immersiveintelligence.common.items.mechanical.ItemIIMotorBelt;
import pl.pabilo8.immersiveintelligence.common.items.mechanical.ItemIIMotorGear;
import pl.pabilo8.immersiveintelligence.common.items.tools.*;
import pl.pabilo8.immersiveintelligence.common.items.weapons.ItemIIMachinegun;
import pl.pabilo8.immersiveintelligence.common.items.weapons.ItemIIWeaponUpgrade;
import pl.pabilo8.immersiveintelligence.common.network.IIPacketHandler;
import pl.pabilo8.immersiveintelligence.common.network.MessageBlockDamageSync;
import pl.pabilo8.immersiveintelligence.common.wire.IIDataWireType;
import javax.annotation.Nonnull;
import java.util.ArrayList;
import java.util.List;
import java.util.Map.Entry;
import java.util.function.Predicate;
import static blusunrize.immersiveengineering.api.energy.wires.WireApi.registerFeedthroughForWiretype;
/**
* Created by Pabilo8 on 2019-05-07.
*/
@Mod.EventBusSubscriber(modid = ImmersiveIntelligence.MODID)
public abstract class CommonProxy implements IGuiHandler
{
public static final List<Block> blocks = new ArrayList<>();
public static final List<Item> items = new ArrayList<>();
public static final String description_key = "desc."+ImmersiveIntelligence.MODID+".";
public static final String info_key = "info."+ImmersiveIntelligence.MODID+".";
public static final String data_key = "datasystem."+ImmersiveIntelligence.MODID+".";
public static final String rotary_key = "rotary."+ImmersiveIntelligence.MODID+".";
public static final String block_key = "tile."+ImmersiveIntelligence.MODID+".";
public static final String TOOL_ADVANCED_HAMMER = "II_ADVANCED_HAMMER";
public static final String TOOL_WRENCH = "II_WRENCH";
public static final String TOOL_ADVANCED_WRENCH = "II_ADVANCED_WRENCH";
public static final String TOOL_CROWBAR = "II_CROWBAR";
public static final String TOOL_TACHOMETER = "TOOL_TACHOMETER";
public static ItemIIMaterial item_material = new ItemIIMaterial();
public static ItemIIFunctionalCircuit item_circuit = new ItemIIFunctionalCircuit();
public static ItemIIMotorBelt item_motor_belt = new ItemIIMotorBelt();
public static ItemIIMotorGear item_motor_gear = new ItemIIMotorGear();
public static ItemIISkycrateMount item_skycrate_mount = new ItemIISkycrateMount();
public static ItemIILighter item_lighter = new ItemIILighter();
public static ItemIIElectricHammer item_hammer = new ItemIIElectricHammer();
public static List<Predicate<IBlockState>> hammer_blacklist = new ArrayList<>();
public static ItemIIElectricWirecutter item_wirecutter = new ItemIIElectricWirecutter();
public static ItemIIWrench item_wrench = new ItemIIWrench();
public static ItemIIElectricWrench item_electric_wrench = new ItemIIElectricWrench();
//Don't know if i should make a seperate item for a torque meter
public static ItemIITachometer item_tachometer = new ItemIITachometer();
public static ItemIIDataWireCoil item_data_wire_coil = new ItemIIDataWireCoil();
public static ItemIIMinecart item_minecart = new ItemIIMinecart();
public static ItemIIRadioConfigurator item_radio_configurator = new ItemIIRadioConfigurator();
public static ItemIIMeasuringCup item_measuring_cup = new ItemIIMeasuringCup();
public static ItemIIPrecissionTool item_precission_tool = new ItemIIPrecissionTool();
public static ItemIIAssemblyScheme item_assembly_scheme = new ItemIIAssemblyScheme();
public static ItemIIBinoculars item_binoculars = new ItemIIBinoculars();
public static ItemIIMachinegun item_machinegun = new ItemIIMachinegun();
public static ItemIIWeaponUpgrade item_machinegun_upgrade = new ItemIIWeaponUpgrade();
public static ItemIIBullet item_bullet = new ItemIIBullet();
public static ItemIICasingArtillery item_casing_artillery = new ItemIICasingArtillery();
public static ItemIICasingGrenade item_casing_grenade = new ItemIICasingGrenade();
public static ItemIICasingMachinegun item_casing_machinegun = new ItemIICasingMachinegun();
public static ItemIICasingSubmachinegun item_casing_submachinegun = new ItemIICasingSubmachinegun();
public static ItemIICasingRevolver item_casing_revolver = new ItemIICasingRevolver();
public static ItemIIBulletMagazine item_bullet_magazine = new ItemIIBulletMagazine();
public static ItemIIPunchtape item_punchtape = new ItemIIPunchtape();
public static ItemIIPrintedPage item_printed_page = new ItemIIPrintedPage();
public static ItemIITracerPowder item_tracer_powder = new ItemIITracerPowder();
public static BlockIIBase<IIBlockTypes_Ore> block_ore = (BlockIIBase)new BlockIIBase("ore", Material.ROCK,
PropertyEnum.create("type", IIBlockTypes_Ore.class), ItemBlockIEBase.class, false).setOpaque(true)
.setHardness(3.0F).setResistance(10.0F);
public static BlockIIBase<IIBlockTypes_Metal> block_sheetmetal = (BlockIIBase)new BlockIIBase("sheetmetal", Material.IRON,
PropertyEnum.create("type", IIBlockTypes_Metal.class), ItemBlockIEBase.class, false).setOpaque(true)
.setHardness(3.0F).setResistance(10.0F), block_metal_storage = (BlockIIBase)new BlockIIBase("storage", Material.IRON,
PropertyEnum.create("type", IIBlockTypes_Metal.class), ItemBlockIEBase.class, false).setOpaque(true)
.setHardness(3.0F).setResistance(10.0F);
public static BlockIIBase<IIBlockTypes_Metal> block_metal_slabs = (BlockIIBase<IIBlockTypes_Metal>)new BlockIISlab("storage_slab", Material.IRON, PropertyEnum.create("type", IIBlockTypes_Metal.class)).setHardness(3.0F).setResistance(10.0F);
public static BlockIIBase<IIBlockTypes_Metal> block_sheetmetal_slabs = (BlockIIBase<IIBlockTypes_Metal>)new BlockIISlab("sheetmetal_slab", Material.IRON, PropertyEnum.create("type", IIBlockTypes_Metal.class)).setHardness(3.0F).setResistance(10.0F);
public static BlockIIBase<IIBlockTypes_StoneDecoration> block_stone_decoration = new BlockIIStoneDecoration();
public static BlockIIBase<IIBlockTypes_ClothDecoration> block_cloth_decoration = new BlockIIClothDecoration();
public static BlockIIBase<IIBlockTypes_MetalDecoration> block_metal_decoration = new BlockIIMetalDecoration();
public static BlockIIMetalDevice block_metal_device = new BlockIIMetalDevice();
public static BlockIIDataConnector block_data_connector = new BlockIIDataConnector();
public static BlockIISmallCrate block_small_crate = new BlockIISmallCrate();
public static BlockIIMechanicalDevice block_mechanical_device = new BlockIIMechanicalDevice();
public static BlockIIGearbox block_gearbox = new BlockIIGearbox();
public static BlockIIMechanicalConnector block_mechanical_connector = new BlockIIMechanicalConnector();
public static BlockIIWoodenMultiblock block_wooden_multiblock = new BlockIIWoodenMultiblock();
public static BlockIIMetalMultiblock0 block_metal_multiblock0 = new BlockIIMetalMultiblock0();
public static BlockIIMetalMultiblock1 block_metal_multiblock1 = new BlockIIMetalMultiblock1();
public static BlockIIFluid block_fluid_ink_black;
public static BlockIIFluid block_fluid_ink_cyan;
public static BlockIIFluid block_fluid_ink_magenta;
public static BlockIIFluid block_fluid_ink_yellow;
public static BlockIIFluid block_fluid_etching_acid;
public static BlockIIFluid block_fluid_brine;
public static BlockIIFluid block_gas_hydrogen;
public static BlockIIFluid block_gas_oxygen;
public static BlockIIFluid block_gas_chlorine;
public static Fluid fluid_ink_black;
public static Fluid fluid_ink_cyan;
public static Fluid fluid_ink_magenta;
public static Fluid fluid_ink_yellow;
public static Fluid fluid_etching_acid;
public static Fluid fluid_brine;
public static Fluid gas_hydrogen;
public static Fluid gas_oxygen;
public static Fluid gas_chlorine;
private static ResourceLocation createRegistryName(String unlocalized)
{
unlocalized = unlocalized.substring(unlocalized.indexOf(ImmersiveIntelligence.MODID));
unlocalized = unlocalized.replaceFirst("\\.", ":");
return new ResourceLocation(unlocalized);
}
@SubscribeEvent
public static void registerBlocks(RegistryEvent.Register<Block> event)
{
block_fluid_ink_black = new BlockIIFluid("ink", fluid_ink_black, Material.WATER);
block_fluid_ink_cyan = new BlockIIFluid("ink_cyan", fluid_ink_cyan, Material.WATER);
block_fluid_ink_magenta = new BlockIIFluid("ink_magenta", fluid_ink_magenta, Material.WATER);
block_fluid_ink_yellow = new BlockIIFluid("ink_yellow", fluid_ink_yellow, Material.WATER);
block_fluid_etching_acid = new BlockIIFluid("etching_acid", fluid_etching_acid, Material.WATER);
block_fluid_brine = new BlockIIFluid("brine", fluid_brine, Material.WATER);
block_gas_hydrogen = new BlockIIFluid("hydrogen", gas_hydrogen, Material.WATER);
block_gas_oxygen = new BlockIIFluid("oxygen", gas_oxygen, Material.WATER);
block_gas_chlorine = new BlockIIFluid("chlorine", gas_chlorine, Material.WATER);
for(Block block : blocks)
event.getRegistry().register(block.setRegistryName(createRegistryName(block.getTranslationKey())));
registerFeedthroughForWiretype(IIDataWireType.DATA, new ResourceLocation(ImmersiveIntelligence.MODID, "block/empty.obj"),
new ResourceLocation(ImmersiveIntelligence.MODID, "blocks/data_connector_feedtrough"), new float[]{0, 4, 8, 12},
0.09375, block_data_connector.getStateFromMeta(IIBlockTypes_Connector.DATA_RELAY.getMeta()),
0, 0, (f) -> f);
}
@SubscribeEvent
public static void registerItems(RegistryEvent.Register<Item> event)
{
ImmersiveIntelligence.logger.info("Registering Items");
for(Item item : items)
event.getRegistry().register(item.setRegistryName(createRegistryName(item.getTranslationKey())));
registerOreDict();
}
@SubscribeEvent
public static void registerPotions(RegistryEvent.Register<Potion> event)
{
/*POTIONS*/
IIPotions.init();
}
public static <T extends TileEntity & IGuiTile> void openGuiForTile(@Nonnull EntityPlayer player, @Nonnull T tile)
{
player.openGui(ImmersiveIntelligence.INSTANCE, tile.getGuiID(), tile.getWorld(), tile.getPos().getX(),
tile.getPos().getY(), tile.getPos().getZ());
}
public static <T extends TileEntity & IGuiTile> void openSpecificGuiForEvenMoreSpecificTile(@Nonnull EntityPlayer player, @Nonnull T tile, int gui)
{
player.openGui(ImmersiveIntelligence.INSTANCE, gui, tile.getWorld(), tile.getPos().getX(),
tile.getPos().getY(), tile.getPos().getZ());
}
public static void openGuiForItem(@Nonnull EntityPlayer player, @Nonnull EntityEquipmentSlot slot)
{
ItemStack stack = player.getItemStackFromSlot(slot);
if(stack.isEmpty()||!(stack.getItem() instanceof IGuiItem))
return;
IGuiItem gui = (IGuiItem)stack.getItem();
player.openGui(ImmersiveIntelligence.INSTANCE, gui.getGuiID(stack), player.world, (int)player.posX, (int)player.posY, (int)player.posZ);
}
public static void addConfiguredWorldgen(IBlockState state, String name, int[] config)
{
if(config!=null&&config.length >= 5&&config[0] > 0)
IEWorldGen.addOreGen(name, state, config[0], config[1], config[2], config[3], config[4]);
}
public static void registerTile(Class<? extends TileEntity> tile)
{
String s = tile.getSimpleName();
s = s.substring(s.indexOf("TileEntity")+"TileEntity".length());
GameRegistry.registerTileEntity(tile, new ResourceLocation(ImmersiveIntelligence.MODID+":"+s));
}
public static void registerOreDict()
{
OreDictionary.registerOre("dustAdvancedElectronicAlloy", new ItemStack(item_material, 1, item_material.getMetaBySubname("advanced_plate_blend")));
OreDictionary.registerOre("plateAdvancedElectronicAlloy", new ItemStack(item_material, 1, item_material.getMetaBySubname("advanced_plate")));
OreDictionary.registerOre("electronTubeAdvanced", new ItemStack(item_material, 1, item_material.getMetaBySubname("advanced_electron_tube")));
//Basic Circuit Board
OreDictionary.registerOre("circuitBasicRaw", new ItemStack(item_material, 1, item_material.getMetaBySubname("basic_circuit_board_raw")));
OreDictionary.registerOre("circuitBasicEtched", new ItemStack(item_material, 1, item_material.getMetaBySubname("basic_circuit_board_etched")));
OreDictionary.registerOre("chipBasic", new ItemStack(item_material, 1, item_material.getMetaBySubname("basic_electronic_element")));
//Advanced Circuit Board
OreDictionary.registerOre("circuitAdvancedRaw", new ItemStack(item_material, 1, item_material.getMetaBySubname("advanced_circuit_board_raw")));
OreDictionary.registerOre("circuitAdvancedEtched", new ItemStack(item_material, 1, item_material.getMetaBySubname("advanced_circuit_board_etched")));
OreDictionary.registerOre("chipAdvanced", new ItemStack(item_material, 1, item_material.getMetaBySubname("advanced_electronic_element")));
OreDictionary.registerOre("circuitAdvanced", new ItemStack(item_material, 1, item_material.getMetaBySubname("advanced_circuit_board")));
//Processor Circuit Board
OreDictionary.registerOre("circuitProcessorEtched", new ItemStack(item_material, 1, item_material.getMetaBySubname("processor_circuit_board_etched")));
OreDictionary.registerOre("circuitProcessorRaw", new ItemStack(item_material, 1, item_material.getMetaBySubname("processor_circuit_board_raw")));
OreDictionary.registerOre("chipProcessor", new ItemStack(item_material, 1, item_material.getMetaBySubname("processor_electronic_element")));
OreDictionary.registerOre("circuitProcessor", new ItemStack(item_material, 1, item_material.getMetaBySubname("processor_circuit_board")));
OreDictionary.registerOre("circuitEliteEtched", new ItemStack(item_material, 1, item_material.getMetaBySubname("processor_circuit_board_etched")));
OreDictionary.registerOre("circuitEliteRaw", new ItemStack(item_material, 1, item_material.getMetaBySubname("processor_circuit_board_raw")));
OreDictionary.registerOre("circuitElite", new ItemStack(item_material, 1, item_material.getMetaBySubname("processor_circuit_board")));
OreDictionary.registerOre("chipElite", new ItemStack(item_material, 1, item_material.getMetaBySubname("processor_electronic_element")));
OreDictionary.registerOre("electricEngineSmall", new ItemStack(item_material, 1, item_material.getMetaBySubname("compact_electric_engine")));
OreDictionary.registerOre("electricEngineCompact", new ItemStack(item_material, 1, item_material.getMetaBySubname("compact_electric_engine")));
//Platinum
OreDictionary.registerOre("ingotPlatinum", new ItemStack(item_material, 1, item_material.getMetaBySubname("metal_ingot_platinum")));
OreDictionary.registerOre("dustPlatinum", new ItemStack(item_material, 1, item_material.getMetaBySubname("metal_dust_platinum")));
OreDictionary.registerOre("platePlatinum", new ItemStack(item_material, 1, item_material.getMetaBySubname("metal_plate_platinum")));
OreDictionary.registerOre("nuggetPlatinum", new ItemStack(item_material, 1, item_material.getMetaBySubname("metal_nugget_platinum")));
OreDictionary.registerOre("orePlatinum", new ItemStack(block_ore, 1, IIBlockTypes_Ore.PLATINUM.getMeta()));
OreDictionary.registerOre("blockPlatinum", new ItemStack(block_metal_storage, 1, IIBlockTypes_Metal.PLATINUM.getMeta()));
OreDictionary.registerOre("sheetmetalPlatinum", new ItemStack(block_sheetmetal, 1, IIBlockTypes_Metal.PLATINUM.getMeta()));
//Zinc
OreDictionary.registerOre("ingotZinc", new ItemStack(item_material, 1, item_material.getMetaBySubname("metal_ingot_zinc")));
OreDictionary.registerOre("dustZinc", new ItemStack(item_material, 1, item_material.getMetaBySubname("metal_dust_zinc")));
OreDictionary.registerOre("plateZinc", new ItemStack(item_material, 1, item_material.getMetaBySubname("metal_plate_zinc")));
OreDictionary.registerOre("nuggetZinc", new ItemStack(item_material, 1, item_material.getMetaBySubname("metal_nugget_zinc")));
OreDictionary.registerOre("oreZinc", new ItemStack(block_ore, 1, IIBlockTypes_Ore.ZINC.getMeta()));
OreDictionary.registerOre("blockZinc", new ItemStack(block_metal_storage, 1, IIBlockTypes_Metal.ZINC.getMeta()));
OreDictionary.registerOre("sheetmetalZinc", new ItemStack(block_sheetmetal, 1, IIBlockTypes_Metal.ZINC.getMeta()));
//Tungsten
OreDictionary.registerOre("ingotTungsten", new ItemStack(item_material, 1, item_material.getMetaBySubname("metal_ingot_tungsten")));
OreDictionary.registerOre("dustTungsten", new ItemStack(item_material, 1, item_material.getMetaBySubname("metal_dust_tungsten")));
OreDictionary.registerOre("plateTungsten", new ItemStack(item_material, 1, item_material.getMetaBySubname("metal_plate_tungsten")));
OreDictionary.registerOre("nuggetTungsten", new ItemStack(item_material, 1, item_material.getMetaBySubname("metal_nugget_tungsten")));
OreDictionary.registerOre("oreTungsten", new ItemStack(block_ore, 1, IIBlockTypes_Ore.TUNGSTEN.getMeta()));
OreDictionary.registerOre("blockTungsten", new ItemStack(block_metal_storage, 1, IIBlockTypes_Metal.TUNGSTEN.getMeta()));
OreDictionary.registerOre("sheetmetalTungsten", new ItemStack(block_sheetmetal, 1, IIBlockTypes_Metal.TUNGSTEN.getMeta()));
OreDictionary.registerOre("ingotWolfram", new ItemStack(item_material, 1, item_material.getMetaBySubname("metal_ingot_tungsten")));
OreDictionary.registerOre("dustWolfram", new ItemStack(item_material, 1, item_material.getMetaBySubname("metal_dust_tungsten")));
OreDictionary.registerOre("plateWolfram", new ItemStack(item_material, 1, item_material.getMetaBySubname("metal_plate_tungsten")));
OreDictionary.registerOre("nuggetWolfram", new ItemStack(item_material, 1, item_material.getMetaBySubname("metal_nugget_tungsten")));
OreDictionary.registerOre("oreWolfram", new ItemStack(block_ore, 1, IIBlockTypes_Ore.TUNGSTEN.getMeta()));
OreDictionary.registerOre("blockWolfram", new ItemStack(block_metal_storage, 1, IIBlockTypes_Metal.TUNGSTEN.getMeta()));
OreDictionary.registerOre("sheetmetalWolfram", new ItemStack(block_sheetmetal, 1, IIBlockTypes_Metal.TUNGSTEN.getMeta()));
//Brass
OreDictionary.registerOre("ingotBrass", new ItemStack(item_material, 1, item_material.getMetaBySubname("metal_ingot_brass")));
OreDictionary.registerOre("dustBrass", new ItemStack(item_material, 1, item_material.getMetaBySubname("metal_dust_brass")));
OreDictionary.registerOre("plateBrass", new ItemStack(item_material, 1, item_material.getMetaBySubname("metal_plate_brass")));
OreDictionary.registerOre("nuggetBrass", new ItemStack(item_material, 1, item_material.getMetaBySubname("metal_nugget_brass")));
//Not this time ^^
//OreDictionary.registerOre("oreBrass", new ItemStack(block_ore, 1, IIBlockTypes_Ore.BRASS.getMeta()));
OreDictionary.registerOre("blockBrass", new ItemStack(block_metal_storage, 1, IIBlockTypes_Metal.BRASS.getMeta()));
OreDictionary.registerOre("sheetmetalBrass", new ItemStack(block_sheetmetal, 1, IIBlockTypes_Metal.BRASS.getMeta()));
//Punchtapes
OreDictionary.registerOre("punchtapeEmpty", new ItemStack(item_material, 1, item_material.getMetaBySubname("punchtape_empty")));
OreDictionary.registerOre("punchtape", new ItemStack(item_punchtape, 1, 0));
OreDictionary.registerOre("pageEmpty", new ItemStack(item_printed_page, 1, 0));
OreDictionary.registerOre("pageText", new ItemStack(item_printed_page, 1, 1));
OreDictionary.registerOre("pageWritten", new ItemStack(item_printed_page, 1, 1));
OreDictionary.registerOre("pageCode", new ItemStack(item_printed_page, 1, 2));
OreDictionary.registerOre("pageWritten", new ItemStack(item_printed_page, 1, 2));
OreDictionary.registerOre("pageBlueprint", new ItemStack(item_printed_page, 1, 3));
OreDictionary.registerOre("pageWritten", new ItemStack(item_printed_page, 1, 3));
OreDictionary.registerOre("materialTNT", new ItemStack(Blocks.TNT, 1, 0));
OreDictionary.registerOre("materialRDX", new ItemStack(item_material, 1, item_material.getMetaBySubname("dust_rdx")));
OreDictionary.registerOre("materialHexogen", new ItemStack(item_material, 1, item_material.getMetaBySubname("dust_rdx")));
OreDictionary.registerOre("materialHMX", new ItemStack(item_material, 1, item_material.getMetaBySubname("dust_hmx")));
OreDictionary.registerOre("dustWhitePhosphorus", new ItemStack(item_material, 1, item_material.getMetaBySubname("white_phosphorus")));
OreDictionary.registerOre("whitePhosphorus", new ItemStack(item_material, 1, item_material.getMetaBySubname("white_phosphorus")));
OreDictionary.registerOre("dustSalt", new ItemStack(item_material, 1, item_material.getMetaBySubname("dust_salt")));
OreDictionary.registerOre("oreSalt", new ItemStack(block_ore, 1, IIBlockTypes_Ore.SALT.getMeta()));
int i = 0;
for(String name : item_motor_gear.getSubNames())
{
OreDictionary.registerOre(Utils.toCamelCase("gear_"+name, true), new ItemStack(item_motor_gear, 1, i));
i += 1;
}
i = 0;
for(String name : item_motor_belt.getSubNames())
{
OreDictionary.registerOre(Utils.toCamelCase("belt_"+name, true), new ItemStack(item_motor_belt, 1, i));
i += 1;
}
}
@SubscribeEvent
public static void onSave(WorldEvent.Save event)
{
IISaveData.setDirty(0);
}
@SubscribeEvent
public static void onUnload(WorldEvent.Unload event)
{
IISaveData.setDirty(0);
}
@SubscribeEvent
public static void registerRecipes(RegistryEvent.Register<IRecipe> event)
{
LighterFuelHandler.addFuel(FluidRegistry.getFluid("creosote"), 100);
LighterFuelHandler.addFuel(FluidRegistry.getFluid("ethanol"), 20);
// LighterFuelHandler.addFuel(FluidRegistry.getFluid("creosote"),100);
final ItemStack powder = new ItemStack(item_tracer_powder, 1, 0);
event.getRegistry().register(new RecipeRGBColouration((s) -> (OreDictionary.itemMatches(powder, s, true)), (s) -> (ItemNBTHelper.hasKey(s, "colour")?ItemNBTHelper.getInt(s, "colour"): 0xffffff), (s, i) -> ItemNBTHelper.setInt(s, "colour", i)).setRegistryName(ImmersiveEngineering.MODID, "tracer_powder_colour"));
ArcFurnaceRecipe.addRecipe(new ItemStack(item_material, 1, item_material.getMetaBySubname("advanced_plate_blend")), "dustAdvancedPlate", ItemStack.EMPTY, 600, 640);
//Remove all circuit blueprint recipes
BlueprintCraftingRecipe.recipeList.removeAll("components");
BlueprintCraftingRecipe.addRecipe("components", new ItemStack(IEContent.itemMaterial, 1, 8), "plateIron", "plateIron", "ingotCopper");
BlueprintCraftingRecipe.addRecipe("components", new ItemStack(IEContent.itemMaterial, 1, 9), "plateSteel", "plateSteel", "ingotCopper");
BlueprintCraftingRecipe.addRecipe("basic_circuits", new ItemStack(item_material, 1, item_material.getMetaBySubname("basic_circuit_board_raw")), new ItemStack(IEContent.blockStoneDecoration, 2, BlockTypes_StoneDecoration.INSULATING_GLASS.getMeta()), "plateCopper");
BlueprintCraftingRecipe.addRecipe("basic_circuits", new ItemStack(IEContent.itemMaterial, 1, 27), "circuitBasicEtched", new IngredientStack("chipBasic", 2));
BlueprintCraftingRecipe.addRecipe("advanced_circuits", new ItemStack(item_material, 1, item_material.getMetaBySubname("advanced_circuit_board_raw")), new IngredientStack("circuitBasicRaw", 2), "plateAdvancedElectronicAlloy");
BlueprintCraftingRecipe.addRecipe("advanced_circuits", new ItemStack(item_material, 1, item_material.getMetaBySubname("advanced_circuit_board")), "circuitAdvancedEtched", new IngredientStack("chipAdvanced", 3));
BlueprintCraftingRecipe.addRecipe("processors", new ItemStack(item_material, 1, item_material.getMetaBySubname("processor_circuit_board_raw")), new IngredientStack("circuitAdvancedRaw", 4), new IngredientStack("plateAdvancedElectronicAlloy", 2));
BlueprintCraftingRecipe.addRecipe("processors", new ItemStack(item_material, 1, item_material.getMetaBySubname("processor_circuit_board")), "circuitProcessorEtched", new IngredientStack("chipProcessor", 4));
//((IForgeRegistryModifiable)CraftingManager.REGISTRY).remove(new ResourceLocation(""));
//It's cheap, believe me
BathingRecipe.addRecipe(new ItemStack(item_material, 1, item_material.getMetaBySubname("basic_circuit_board_etched")), new IngredientStack("circuitBasicRaw"), FluidRegistry.getFluidStack("etching_acid", 1000), 15000, 360);
BathingRecipe.addRecipe(new ItemStack(item_material, 1, item_material.getMetaBySubname("advanced_circuit_board_etched")), new IngredientStack("circuitAdvancedRaw"), FluidRegistry.getFluidStack("etching_acid", 2000), 150000, 560);
BathingRecipe.addRecipe(new ItemStack(item_material, 1, item_material.getMetaBySubname("processor_circuit_board_etched")), new IngredientStack("circuitProcessorRaw"), FluidRegistry.getFluidStack("etching_acid", 4000), 1500000, 720);
//Immersive Engineering can into space???
ElectrolyzerRecipe.addRecipe(FluidRegistry.getFluidStack("water", 3000), FluidRegistry.getFluidStack("oxygen", 1000), FluidRegistry.getFluidStack("hydrogen", 2000), 640, 320);
ElectrolyzerRecipe.addRecipe(FluidRegistry.getFluidStack("brine", 3000), FluidRegistry.getFluidStack("chlorine", 1500), FluidRegistry.getFluidStack("hydrogen", 1500), 640, 320);
MixerRecipe.addRecipe(new FluidStack(fluid_etching_acid, 1000), new FluidStack(gas_chlorine, 500), new Object[]{"dustIron"}, 4800);
MixerRecipe.addRecipe(new FluidStack(fluid_brine, 750), new FluidStack(FluidRegistry.WATER, 750), new Object[]{"dustSalt"}, 3200);
//2x Vacuum tube + 3 x copper nugget = 2 x copper wire, 1 x iron plate, 1 x glass block
PrecissionAssemblerRecipe.addRecipe(
new ItemStack(IEContent.itemMaterial, 2, 26),
new ItemStack(IEContent.itemMetal, 1, 20),
new IngredientStack[]{new IngredientStack("plateIron"), new IngredientStack("wireCopper", 2), new IngredientStack("blockGlass")},
new String[]{"inserter", "solderer", "drill"},
new String[]{"drill work main", "solderer work first", "inserter pick first", "inserter drop main", "solderer work main", "drill work second", "inserter pick second", "inserter drop main"},
12000,
1.0f
);
//Blu, pls add getting subitem stacks by name ^^ (not relevant to 1.13, i won't be porting my mod there anyway)
//1x Basic Electronic Component = 2x vacuum tube + nickel plate + 4 x redstone dust
PrecissionAssemblerRecipe.addRecipe(
new ItemStack(item_material, 1, item_material.getMetaBySubname("basic_electronic_element")),
ItemStack.EMPTY,
new IngredientStack[]{new IngredientStack("electronTube"), new IngredientStack("plateNickel"), new IngredientStack("dustRedstone", 4)},
new String[]{"inserter", "solderer", "drill"},
new String[]{"inserter pick second", "drill work main", "inserter drop main", "solderer work main", "inserter pick first", "inserter drop main"},
18000,
1.0f
);
//CrusherRecipe.addRecipe(ItemStack(item_material,1,item_material.getMetaBySubname("dust_salt")),new IngredientStack("oreSalt"),3200);
}
public void preInit()
{
IIDataWireType.init();
IIPacketHandler.preInit();
CapabilityRotaryEnergy.register();
fluid_ink_black = makeFluid("ink", 1500, 2250);
fluid_ink_cyan = makeFluid("ink_cyan", 1500, 2250);
fluid_ink_magenta = makeFluid("ink_magenta", 1500, 2250);
fluid_ink_yellow = makeFluid("ink_yellow", 1500, 2250);
fluid_etching_acid = makeFluid("etching_acid", 1500, 2250);
fluid_brine = makeFluid("brine", 1500, 2250);
gas_hydrogen = makeFluid("hydrogen", 0, 2250).setGaseous(true);
gas_oxygen = makeFluid("oxygen", 0, 2250).setGaseous(true);
gas_chlorine = makeFluid("chlorine", 0, 2250).setGaseous(true);
//ALWAYS REGISTER BULLETS IN PRE-INIT! (so they get their texture registered before TextureStitchEvent.Pre)
//Bullets
BulletRegistry.INSTANCE.registerCasing(item_casing_artillery, "artillery_8bCal");
BulletRegistry.INSTANCE.registerCasing(item_casing_grenade, "grenade_4bCal");
BulletRegistry.INSTANCE.registerCasing(item_casing_machinegun, "machinegun_2bCal");
BulletRegistry.INSTANCE.registerCasing(item_casing_submachinegun, "submachinegun_1bCal");
BulletRegistry.INSTANCE.registerCasing(item_casing_revolver, "revolver_1bCal");
BulletRegistry.INSTANCE.registerComponent(new BulletComponentTNT(), "TNT");
BulletRegistry.INSTANCE.registerComponent(new BulletComponentRDX(), "RDX");
BulletRegistry.INSTANCE.registerComponent(new BulletComponentHMX(), "HMX");
BulletRegistry.INSTANCE.registerComponent(new BulletComponentWhitePhosphorus(), "white_phosphorus");
BulletRegistry.INSTANCE.registerComponent(new BulletComponentFirework(), "firework");
BulletRegistry.INSTANCE.registerComponent(new BulletComponentTracerPowder(), "tracer_powder");
BulletRegistry.INSTANCE.registerBulletCore(new BulletCoreSteel(), "CoreSteel");
BulletRegistry.INSTANCE.registerBulletCore(new BulletCoreTungsten(), "CoreTungsten");
BulletRegistry.INSTANCE.registerBulletCore(new BulletCoreBrass(), "CoreBrass");
BulletRegistry.INSTANCE.registerBulletCore(new BulletCoreLead(), "CoreLead");
BulletRegistry.INSTANCE.registerBulletCore(new BulletCoreUranium(), "CoreUranium");
BulletRegistry.INSTANCE.registerBulletCore(new BulletCorePabilium(), "CorePabilium");
//ShrapnelHandler.addShrapnel("wood","",1,0.25f,0f,true);
ShrapnelHandler.addShrapnel("aluminum", 0xd9ecea, "immersiveengineering:textures/blocks/sheetmetal_aluminum", 1, 0.05f, 0f);
ShrapnelHandler.addShrapnel("zinc", 0xdee3dc, "immersiveintelligence:textures/blocks/metal/sheetmetal_zinc", 1, 0.15f, 0f);
ShrapnelHandler.addShrapnel("copper", 0xe37c26, "immersiveengineering:textures/blocks/sheetmetal_copper", 2, 0.25f, 0f);
ShrapnelHandler.addShrapnel("platinum", 0xd8e1e1, "immersiveintelligence:textures/blocks/metal/sheetmetal_platinum", 2, 0.05f, 0f);
ShrapnelHandler.addShrapnel("gold", 0xd1b039, "minecraft:textures/blocks/gold_block", 2, 0.25f, 0f);
ShrapnelHandler.addShrapnel("nickel", 0x838877, "immersiveengineering:textures/blocks/sheetmetal_nickel", 2, 0.25f, 0f);
ShrapnelHandler.addShrapnel("silver", 0xa7cac8, "immersiveengineering:textures/blocks/sheetmetal_silver", 2, 0.25f, 0f);
ShrapnelHandler.addShrapnel("electrum", 0xf6ad59, "immersiveengineering:textures/blocks/sheetmetal_electrum", 2, 0.25f, 0f);
ShrapnelHandler.addShrapnel("constantan", 0xf97456, "immersiveengineering:textures/blocks/sheetmetal_constantan", 3, 0.25f, 0f);
ShrapnelHandler.addShrapnel("iron", 0xc7c7c7, "minecraft:textures/blocks/iron_block", 4, 0.25f, 0f);
ShrapnelHandler.addShrapnel("lead", 0x3a3e44, "immersiveengineering:textures/blocks/sheetmetal_lead", 5, 0.75f, 0f);
ShrapnelHandler.addShrapnel("steel", 0x4d4d4d, "immersiveengineering:textures/blocks/sheetmetal_steel", 6, 0.35f, 0f);
ShrapnelHandler.addShrapnel("brass", 0x957743, "immersiveintelligence:textures/blocks/metal/sheetmetal_brass", 6, 0.35f, 0f);
ShrapnelHandler.addShrapnel("tungsten", 0x3b3e43, "immersiveintelligence:textures/blocks/metal/sheetmetal_tungsten", 8, 0.45f, 0f);
ShrapnelHandler.addShrapnel("HOPGraphite", 0x282828, "immersiveengineering:textures/blocks/stone_decoration_coke", 8, 0.45f, 0f);
ShrapnelHandler.addShrapnel("uranium", 0x659269, "immersiveengineering:textures/blocks/sheetmetal_uranium", 12, 0.45f, 8f);
for(Entry<String, Shrapnel> s : ShrapnelHandler.registry.entrySet())
{
BulletComponentShrapnel shrapnel = new BulletComponentShrapnel(s.getKey());
BulletRegistry.INSTANCE.registerComponent(shrapnel, shrapnel.getName());
}
}
public void init()
{
IEApi.forbiddenInCrates.add((stack) ->
{
if(OreDictionary.itemMatches(new ItemStack(block_metal_device, 1, 0), stack, true))
return true;
if(stack.getItem()==item_minecart&&stack.getMetadata() < ItemIIMinecart.META_MINECART_WOODEN_BARREL)
return true;
return OreDictionary.itemMatches(new ItemStack(block_metal_device, 1, 1), stack, true);
});
hammer_blacklist.add(
iBlockState -> (iBlockState.getBlock().equals(IEContent.blockMetalDevice1)&&iBlockState.getBlock().getMetaFromState(iBlockState)==BlockTypes_MetalDevice1.CHARGING_STATION.getMeta())
);
IEApi.forbiddenInCrates.add((stack) -> stack.getItem() instanceof ItemBlockIEBase&&((ItemBlockIEBase)stack.getItem()).getBlock() instanceof BlockIISmallCrate);
ImmersiveIntelligence.logger.info("Adding oregen");
addConfiguredWorldgen(block_ore.getStateFromMeta(IIBlockTypes_Ore.PLATINUM.getMeta()), "platinum", Ores.ore_platinum);
addConfiguredWorldgen(block_ore.getStateFromMeta(IIBlockTypes_Ore.ZINC.getMeta()), "zinc", Ores.ore_zinc);
addConfiguredWorldgen(block_ore.getStateFromMeta(IIBlockTypes_Ore.TUNGSTEN.getMeta()), "tungsten", Ores.ore_tungsten);
addConfiguredWorldgen(block_ore.getStateFromMeta(IIBlockTypes_Ore.SALT.getMeta()), "salt", Ores.ore_salt);
ImmersiveIntelligence.logger.info("Adding TileEntities");
registerTile(TileEntityMetalCrate.class);
registerTile(TileEntityAmmunitionCrate.class);
registerTile(TileEntitySmallCrate.class);
registerTile(TileEntityAlarmSiren.class);
registerTile(TileEntityInserter.class);
registerTile(TileEntityAdvancedInserter.class);
registerTile(TileEntityFluidInserter.class);
registerTile(TileEntityTimedBuffer.class);
registerTile(TileEntityRedstoneBuffer.class);
registerTile(TileEntitySmallDataBuffer.class);
registerTile(TileEntityDataMerger.class);
registerTile(TileEntityDataRouter.class);
registerTile(TileEntityDataDebugger.class);
registerTile(TileEntityChemicalDispenser.class);
registerTile(TileEntityDataConnector.class);
registerTile(TileEntityDataRelay.class);
registerTile(TileEntitySandbags.class);
registerTile(TileEntityMechanicalWheel.class);
registerTile(TileEntityGearbox.class);
registerTile(TileEntityTransmissionBoxCreative.class);
registerTile(TileEntityTransmissionBox.class);
registerTile(TileEntitySkyCratePost.class);
registerTile(TileEntitySkyCrateStation.class);
registerTile(TileEntityRadioStation.class);
registerTile(TileEntityDataInputMachine.class);
registerTile(TileEntityArithmeticLogicMachine.class);
registerTile(TileEntityPrintingPress.class);
registerTile(TileEntityChemicalBath.class);
registerTile(TileEntityElectrolyzer.class);
registerTile(TileEntityConveyorScanner.class);
registerTile(TileEntityPrecissionAssembler.class);
registerTile(TileEntityArtilleryHowitzer.class);
registerTile(TileEntityAmmunitionFactory.class);
registerTile(TileEntityBallisticComputer.class);
registerTile(TileEntityPacker.class);
registerTile(TileEntityRedstoneInterface.class);
MultiblockHandler.registerMultiblock(MultiblockSkyCratePost.instance);
MultiblockHandler.registerMultiblock(MultiblockSkyCrateStation.instance);
MultiblockHandler.registerMultiblock(MultiblockRadioStation.instance);
MultiblockHandler.registerMultiblock(MultiblockDataInputMachine.instance);
MultiblockHandler.registerMultiblock(MultiblockArithmeticLogicMachine.instance);
MultiblockHandler.registerMultiblock(MultiblockPrintingPress.instance);
MultiblockHandler.registerMultiblock(MultiblockChemicalBath.instance);
MultiblockHandler.registerMultiblock(MultiblockElectrolyzer.instance);
MultiblockHandler.registerMultiblock(MultiblockConveyorScanner.instance);
MultiblockHandler.registerMultiblock(MultiblockPrecissionAssembler.instance);
MultiblockHandler.registerMultiblock(MultiblockArtilleryHowitzer.instance);
MultiblockHandler.registerMultiblock(MultiblockAmmunitionFactory.instance);
MultiblockHandler.registerMultiblock(MultiblockBallisticComputer.instance);
MultiblockHandler.registerMultiblock(MultiblockPacker.instance);
MultiblockHandler.registerMultiblock(MultiblockRedstoneInterface.instance);
int i = -1;
EntityRegistry.registerModEntity(new ResourceLocation(ImmersiveIntelligence.MODID, "minecart_wooden_crate"),
EntityMinecartCrateWooden.class, "minecart_wooden_crate", i++, ImmersiveIntelligence.INSTANCE, 64, 1,
true);
EntityRegistry.registerModEntity(new ResourceLocation(ImmersiveIntelligence.MODID, "minecart_reinforced_crate"),
EntityMinecartCrateReinforced.class, "minecart_reinforced_crate", i++, ImmersiveIntelligence.INSTANCE,
64, 1, true);
EntityRegistry.registerModEntity(new ResourceLocation(ImmersiveIntelligence.MODID, "minecart_steel_crate"),
EntityMinecartCrateSteel.class, "minecart_steel_crate", i++, ImmersiveIntelligence.INSTANCE, 64, 1,
true);
EntityRegistry.registerModEntity(new ResourceLocation(ImmersiveIntelligence.MODID, "minecart_wooden_barrel"),
EntityMinecartBarrelWooden.class, "minecart_wooden_barrel", i++, ImmersiveIntelligence.INSTANCE, 64, 1,
true);
EntityRegistry.registerModEntity(new ResourceLocation(ImmersiveIntelligence.MODID, "minecart_metal_barrel"),
EntityMinecartBarrelSteel.class, "minecart_metal_barrel", i++, ImmersiveIntelligence.INSTANCE, 64, 1,
true);
//Entities
//Finally Skycrates are a thing! ^^
EntityRegistry.registerModEntity(new ResourceLocation(ImmersiveIntelligence.MODID, "skycrate"),
EntitySkyCrate.class, "skycrate", i++, ImmersiveIntelligence.INSTANCE, 64, 1, true);
EntityRegistry.registerModEntity(new ResourceLocation(ImmersiveIntelligence.MODID, "bullet"),
EntityBullet.class, "bullet", i++, ImmersiveIntelligence.INSTANCE, 32, 1, true);
EntityRegistry.registerModEntity(new ResourceLocation(ImmersiveIntelligence.MODID, "shrapnel"),
EntityShrapnel.class, "shrapnel", i++, ImmersiveIntelligence.INSTANCE, 16, 1, true);
EntityRegistry.registerModEntity(new ResourceLocation(ImmersiveIntelligence.MODID, "machinegun"),
EntityMachinegun.class, "machinegun", i++, ImmersiveIntelligence.INSTANCE, 64, 1, true);
EntityRegistry.registerModEntity(new ResourceLocation(ImmersiveIntelligence.MODID, "camera"),
EntityCamera.class, "camera", i++, ImmersiveIntelligence.INSTANCE, 1, 1, true);
EntityRegistry.registerModEntity(new ResourceLocation(ImmersiveIntelligence.MODID, "skycrate_internal"),
EntitySkycrateInternal.class, "skycrate_internal", i++, ImmersiveIntelligence.INSTANCE, 64, 1, true);
}
public void postInit()
{
MinecartBlockHelper.blocks.put((stack -> blusunrize.immersiveengineering.common.util.Utils.getBlockFromItem(stack.getItem())==IEContent.blockWoodenDevice0&&stack.getMetadata()==BlockTypes_WoodenDevice0.CRATE.getMeta()),
EntityMinecartCrateWooden::new);
MinecartBlockHelper.blocks.put((stack -> blusunrize.immersiveengineering.common.util.Utils.getBlockFromItem(stack.getItem())==IEContent.blockWoodenDevice0&&stack.getMetadata()==BlockTypes_WoodenDevice0.REINFORCED_CRATE.getMeta()),
EntityMinecartCrateReinforced::new);
MinecartBlockHelper.blocks.put((stack -> blusunrize.immersiveengineering.common.util.Utils.getBlockFromItem(stack.getItem())==block_metal_device&&stack.getMetadata()==IIBlockTypes_MetalDevice.METAL_CRATE.getMeta()),
EntityMinecartCrateSteel::new);
MinecartBlockHelper.blocks.put((stack -> blusunrize.immersiveengineering.common.util.Utils.getBlockFromItem(stack.getItem())==IEContent.blockWoodenDevice0&&stack.getMetadata()==BlockTypes_WoodenDevice0.BARREL.getMeta()),
EntityMinecartBarrelWooden::new);
MinecartBlockHelper.blocks.put((stack -> blusunrize.immersiveengineering.common.util.Utils.getBlockFromItem(stack.getItem())==IEContent.blockMetalDevice0&&stack.getMetadata()==BlockTypes_MetalDevice0.BARREL.getMeta()),
EntityMinecartBarrelSteel::new);
RotaryUtils.ie_rotational_blocks_torque.put(tileEntity -> tileEntity instanceof TileEntityWindmill,
aFloat -> aFloat*MechanicalDevices.dynamo_windmill_torque
);
RotaryUtils.ie_rotational_blocks_torque.put(tileEntity -> tileEntity instanceof TileEntityWatermill,
aFloat -> aFloat*MechanicalDevices.dynamo_watermill_torque
);
}
public void reInitGui()
{
}
@Override
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z)
{
TileEntity te = world.getTileEntity(new BlockPos(x, y, z));
ItemStack stack = player.getActiveItemStack();
if(te instanceof IGuiTile)
{
Object gui = null;
if(ID==IIGuiList.GUI_METAL_CRATE&&te instanceof TileEntityMetalCrate)
gui = new ContainerMetalCrate(player.inventory, (TileEntityMetalCrate)te);
else if(ID==IIGuiList.GUI_AMMUNITION_CRATE&&te instanceof TileEntityAmmunitionCrate)
gui = new ContainerAmmunitionCrate(player.inventory, (TileEntityAmmunitionCrate)te);
else if(ID==IIGuiList.GUI_SMALL_CRATE&&te instanceof TileEntitySmallCrate)
gui = new ContainerSmallCrate(player.inventory, (TileEntitySmallCrate)te);
else if(ID==IIGuiList.GUI_DATA_INPUT_MACHINE_STORAGE&&te instanceof TileEntityDataInputMachine)
gui = new ContainerDataInputMachine(player.inventory, (TileEntityDataInputMachine)te);
else if(ID==IIGuiList.GUI_DATA_INPUT_MACHINE_VARIABLES&&te instanceof TileEntityDataInputMachine)
gui = new ContainerDataInputMachineVariables(player.inventory, (TileEntityDataInputMachine)te);
else if(ID==IIGuiList.GUI_DATA_INPUT_MACHINE_EDIT&&te instanceof TileEntityDataInputMachine)
gui = new ContainerDataInputMachineVariables(player.inventory, (TileEntityDataInputMachine)te);
else if(ID==IIGuiList.GUI_ARITHMETIC_LOGIC_MACHINE_STORAGE&&te instanceof TileEntityArithmeticLogicMachine)
gui = new ContainerArithmeticLogicMachineStorage(player.inventory, (TileEntityArithmeticLogicMachine)te);
else if(ID==IIGuiList.GUI_ARITHMETIC_LOGIC_MACHINE_VARIABLES_1&&te instanceof TileEntityArithmeticLogicMachine)
gui = new ContainerArithmeticLogicMachineVariables0(player.inventory, (TileEntityArithmeticLogicMachine)te);
else if(ID==IIGuiList.GUI_ARITHMETIC_LOGIC_MACHINE_VARIABLES_2&&te instanceof TileEntityArithmeticLogicMachine)
gui = new ContainerArithmeticLogicMachineVariables1(player.inventory, (TileEntityArithmeticLogicMachine)te);
else if(ID==IIGuiList.GUI_ARITHMETIC_LOGIC_MACHINE_VARIABLES_3&&te instanceof TileEntityArithmeticLogicMachine)
gui = new ContainerArithmeticLogicMachineVariables2(player.inventory, (TileEntityArithmeticLogicMachine)te);
else if(ID==IIGuiList.GUI_ARITHMETIC_LOGIC_MACHINE_VARIABLES_4&&te instanceof TileEntityArithmeticLogicMachine)
gui = new ContainerArithmeticLogicMachineVariables3(player.inventory, (TileEntityArithmeticLogicMachine)te);
else if(ID==IIGuiList.GUI_ARITHMETIC_LOGIC_MACHINE_EDIT_1&&te instanceof TileEntityArithmeticLogicMachine)
gui = new ContainerArithmeticLogicMachineEdit(player.inventory, (TileEntityArithmeticLogicMachine)te);
else if(ID==IIGuiList.GUI_ARITHMETIC_LOGIC_MACHINE_EDIT_2&&te instanceof TileEntityArithmeticLogicMachine)
gui = new ContainerArithmeticLogicMachineEdit(player.inventory, (TileEntityArithmeticLogicMachine)te);
else if(ID==IIGuiList.GUI_ARITHMETIC_LOGIC_MACHINE_EDIT_3&&te instanceof TileEntityArithmeticLogicMachine)
gui = new ContainerArithmeticLogicMachineEdit(player.inventory, (TileEntityArithmeticLogicMachine)te);
else if(ID==IIGuiList.GUI_ARITHMETIC_LOGIC_MACHINE_EDIT_4&&te instanceof TileEntityArithmeticLogicMachine)
gui = new ContainerArithmeticLogicMachineEdit(player.inventory, (TileEntityArithmeticLogicMachine)te);
else if(ID==IIGuiList.GUI_PRINTING_PRESS&&te instanceof TileEntityPrintingPress)
gui = new ContainerPrintingPress(player.inventory, (TileEntityPrintingPress)te);
else if(ID==IIGuiList.GUI_CHEMICAL_BATH&&te instanceof TileEntityChemicalBath)
gui = new ContainerChemicalBath(player.inventory, (TileEntityChemicalBath)te);
else if(ID==IIGuiList.GUI_ELECTROLYZER&&te instanceof TileEntityElectrolyzer)
gui = new ContainerElectrolyzer(player.inventory, (TileEntityElectrolyzer)te);
else if(ID==IIGuiList.GUI_PRECISSION_ASSEMBLER&&te instanceof TileEntityPrecissionAssembler)
gui = new ContainerPrecissionAssembler(player.inventory, (TileEntityPrecissionAssembler)te);
else if(ID==IIGuiList.GUI_AMMUNITION_FACTORY&&te instanceof TileEntityAmmunitionFactory)
gui = new ContainerAmmunitionFactory(player.inventory, (TileEntityAmmunitionFactory)te);
else if(ID==IIGuiList.GUI_PACKER&&te instanceof TileEntityPacker)
gui = new ContainerPacker(player.inventory, (TileEntityPacker)te);
/*else if(ID==IIGuiList.GUI_UNPACKER&&te instanceof TileEntityUnpacker)
gui = new ContainerUnpacker(player.inventory, (TileEntityUnpacker)te);*/
else if(ID==IIGuiList.GUI_DATA_MERGER&&te instanceof TileEntityDataMerger)
gui = new ContainerDataMerger(player.inventory, (TileEntityDataMerger)te);
else if(ID==IIGuiList.GUI_DATA_REDSTONE_INTERFACE_DATA&&te instanceof TileEntityRedstoneInterface)
gui = new ContainerRedstoneDataInterface(player.inventory, (TileEntityRedstoneInterface)te);
else if(ID==IIGuiList.GUI_DATA_REDSTONE_INTERFACE_REDSTONE&&te instanceof TileEntityRedstoneInterface)
gui = new ContainerRedstoneDataInterface(player.inventory, (TileEntityRedstoneInterface)te);
else if(ID==IIGuiList.GUI_SKYCRATE_STATION&&te instanceof TileEntitySkyCrateStation)
gui = new ContainerSkycrateStation(player.inventory, (TileEntitySkyCrateStation)te);
else if(ID==IIGuiList.GUI_GEARBOX&&te instanceof TileEntityGearbox)
gui = new ContainerGearbox(player.inventory, (TileEntityGearbox)te);
((IGuiTile)te).onGuiOpened(player, false);
return gui;
}
return null;
}
@Override
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z)
{
return getServerGuiElement(ID, player, world, x, y, z);
}
public void renderTile(TileEntity te)
{
}
public void startSkyhookSound(EntitySkyCrate entitySkyCrate)
{
}
public void onServerGuiChangeRequest(TileEntity tile, int gui, EntityPlayer player)
{
if(!(tile instanceof IGuiTile)||((IGuiTile)tile).getGuiMaster()==null)
return;
//I like casting things
IGuiTile te = ((IGuiTile)((IGuiTile)tile).getGuiMaster());
if(!((TileEntity)te).getWorld().isRemote&&te.canOpenGui(player))
{
openSpecificGuiForEvenMoreSpecificTile(player, (TileEntity & IGuiTile)te, gui);
}
}
public Fluid makeFluid(String name, int density, int viscosity)
{
Fluid fl = new Fluid(
name,
new ResourceLocation(ImmersiveIntelligence.MODID+":blocks/fluid/"+name+"_still"),
new ResourceLocation(ImmersiveIntelligence.MODID+":blocks/fluid/"+name+"_flow")
).setDensity(density).setViscosity(viscosity);
if(!FluidRegistry.registerFluid(fl))
fl = FluidRegistry.getFluid(name);
FluidRegistry.addBucketForFluid(fl);
IICreativeTab.fluidBucketMap.add(fl);
return fl;
}
//Cancel when using a machinegun
@SubscribeEvent(priority = EventPriority.HIGH)
public void onItemUse(PlayerInteractEvent.RightClickBlock event)
{
if(event.getEntity().isRiding()&&event.getEntity().getRidingEntity() instanceof EntityMachinegun)
{
event.setResult(Result.DENY);
event.setCanceled(true);
}
}
//Cancel when using a machinegun
@SubscribeEvent(priority = EventPriority.HIGH)
public void onBlockUse(PlayerInteractEvent.RightClickItem event)
{
if(event.getEntity().isRiding()&&event.getEntity().getRidingEntity() instanceof EntityMachinegun)
{
event.setResult(Result.DENY);
event.setCanceled(true);
}
}
//Shooting
@SubscribeEvent(priority = EventPriority.HIGH)
public void onEmptyRightclick(PlayerInteractEvent.RightClickEmpty event)
{
if(event.getEntity().isRiding()&&event.getEntity().getRidingEntity() instanceof EntityMachinegun)
{
event.setResult(Result.DENY);
}
}
@SubscribeEvent
public void onBreakBlock(BreakEvent event)
{
DimensionBlockPos dpos = null;
for(Entry<DimensionBlockPos, Float> g : PenetrationRegistry.blockDamage.entrySet())
{
if(g.getKey().dimension==event.getWorld().provider.getDimension()&&event.getPos().equals(g.getKey())) ;
{
dpos = g.getKey();
break;
}
}
if(dpos!=null)
{
PenetrationRegistry.blockDamage.remove(dpos);
IIPacketHandler.INSTANCE.sendToAllAround(new MessageBlockDamageSync(-1f, dpos), Utils.targetPointFromPos(dpos, event.getWorld(), 32));
}
}
public void spawnGunfireFX(World world, double x, double y, double z, double mx, double my, double mz, float size)
{
}
}
| [
"pabilo1.PG@gmail.com"
] | pabilo1.PG@gmail.com |
d79a954994f9e6a9fdb35e0ae8fd4cdb1648365b | b621910d7a23e3df18402ab402378bc0aa3d8e1e | /src/pigLatin/PigLatin.java | dc997546e61f55e8d45652c3106b67a2ecca8afa | [] | no_license | clairegreiner/Pig-Latin | 3ddd63ae94adc9bf3b1db4f925cc93810c626c6d | 2744688d6c7c74d30d24b9d822c991f65b5351c4 | refs/heads/master | 2021-01-20T17:32:49.315595 | 2016-08-05T12:21:42 | 2016-08-05T12:21:42 | 65,016,158 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 999 | java | package pigLatin;
import java.util.Scanner;
public class PigLatin {
public static void main(String[] args) {
// TODO Auto-generated method stub
String realWord ;
char pigHead;
String pigHeadless = null;
String pigletLatin =null;
String translation =null;
greeting();
realWord = typeWord ();
translation = translate (realWord);
result (translation);
}
public static void greeting() {
System.out.println("Welcome to the Pig Latin Translator. Please enter a word:");
}
public static String typeWord (){
Scanner sc = new Scanner(System.in);
String word = sc.nextLine(); //method to run
System.out.println(word);
return word;
}
//public static boolean isLetter() {
// return ;
//}
//is letter?
public static String translate (String word){
return word; //translate later
}
public static void result (String myWord){
System.out.println("The translation is " + myWord);
}
//complete the translate; maybe validate isLetter
}
| [
"clairegreiner@gmail.com"
] | clairegreiner@gmail.com |
2a95eaa4ebc6e7e9849ee8d9f19625a1c5c9e1ef | 0cff2c7487e6f8ff6bad9e8b7cb330921419caf5 | /spring-boot-rest-example-student/src/main/java/prime_numbers/Main.java | d33b316d72ae9aad72f4ae366a26b47e272f0cb5 | [] | no_license | PavelZeger/irm-example | a2fd6ad279a663353d1303af7770225df661e499 | 10397093eb3d03c34d111552be2c1aae900d7102 | refs/heads/master | 2023-04-24T14:02:14.421465 | 2021-04-28T12:52:10 | 2021-04-28T12:52:10 | 356,183,793 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 443 | java | package prime_numbers;
import java.util.Arrays;
import java.util.stream.IntStream;
/**
* @author Pavel Zeger
* @implNote irm-example
* @since 09/04/2021
*/
public class Main {
public static void main(String[] args) {
int[] numbers = IntStream.rangeClosed(0, 100).toArray();
int[] primeNumbers = PrimeNumbersService.getPrimeNumbers(numbers);
Arrays.stream(primeNumbers).forEach(System.out::println);
}
}
| [
"gabberoid@gmail.com"
] | gabberoid@gmail.com |
64099b7a5a32c45005cafd27bb094d369a0b437b | d6e75d943a2a41473d06f0cc134ab3162f09d6b5 | /src/test/java/com/scp/selenium/seleniumBatchSeven/SeleniumDemo.java | 1a53e02b7a166083a55acafdc3ffe7a13c6d9690 | [] | no_license | yogymax/SeleniumX7 | 44d5fc25025aa7900e9494c98cbdfe725a846e4a | e03637396b5766b8c2edfb9b4ceff9868db6f1c9 | refs/heads/master | 2021-05-06T16:44:11.989779 | 2017-12-16T07:53:12 | 2017-12-16T07:53:12 | 113,723,188 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,535 | java | package com.scp.selenium.seleniumBatchSeven;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.Assert;
public class SeleniumDemo {
public static void main(String[] args) {
/**
* Selenium < 3version --
* There is firefox default browser -- not required to executable driver path
* Chrome/Safari/IE etc -- you need to path
* this can be executed on java 7/8
* <47
*
*
* selenium >=3 -- no default browser-- need to set firefox driver explicitly
* geckodriver
* java8
*
* Firefox/Chrome/Safari/IE etc -- you need to path
*
*/
System.setProperty("webdriver.gecko.driver","E:\\MySofts\\geckodriver-v0.19.0-win64\\geckodriver.exe");
WebDriver driver = new FirefoxDriver();
driver.get("http://opensource.demo.orangehrmlive.com/index.php/auth/login");
//txtUsername txtPassword btnLogin
WebElement usernameInput = driver.findElement(By.id("txtUsername"));
WebElement passwordInput = driver.findElement(By.id("txtPassword"));
WebElement loginBtn = driver.findElement(By.id("btnLogin"));
usernameInput.clear();
passwordInput.clear();
usernameInput.sendKeys("");
passwordInput.sendKeys("xxxxx");
loginBtn.click();
WebElement errorMessage = driver.findElement(By.id("spanMessage"));
System.out.println("Username cannot be empty# -- "+errorMessage.getText());
usernameInput.clear();
passwordInput.clear();
usernameInput.sendKeys("");
passwordInput.sendKeys("");
loginBtn.click();
errorMessage = driver.findElement(By.id("spanMessage"));
System.out.println("Username cannot be empty# -- "+errorMessage.getText());
usernameInput.clear();
passwordInput.clear();
usernameInput.sendKeys("qweqweqew");
passwordInput.sendKeys("");
loginBtn.click();
errorMessage = driver.findElement(By.id("spanMessage"));
System.out.println("Password cannot be empty# -- "+errorMessage.getText());
usernameInput.clear();
passwordInput.clear();
usernameInput.sendKeys("Admin");
passwordInput.sendKeys("admin");
loginBtn.click();
WebElement welcome = driver.findElement(By.id("welcome"));
System.out.println("Homepage Displayed -- "+welcome.getText());
Assert.assertEquals(welcome.getText(), "Welcome Admin");
//password null -- Password cannot be empty
//username & password null - Username cannot be empty
//incorrect Invalid credentials
//Correct - welcome
}
}
| [
"yogymax@gmail.com"
] | yogymax@gmail.com |
2d1d7a936e782df7db6c3d0615df7bc2bd4ca1e9 | 749c7cfc1ce7af5c852eae7e55b72fc4f198513d | /PlanJourney/src/main/java/com/tim9/PlanJourney/repository/BranchOfficeRepository.java | 6fc1f4e77f3a44d1819ee730eba5631682fd5f90 | [] | no_license | jelenacuk/ISA-MRS | 12e6de062bbaa49f55042957e908b2cc2b0a1cf3 | b8f8f82af6ef693e13987da79c09be83f2d96bbb | refs/heads/master | 2022-02-17T15:28:14.986504 | 2019-06-20T19:22:13 | 2019-06-20T19:22:13 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 260 | java | package com.tim9.PlanJourney.repository;
import org.springframework.data.jpa.repository.JpaRepository;
import com.tim9.PlanJourney.models.rentacar.BranchOffice;
public interface BranchOfficeRepository extends JpaRepository<BranchOffice, Long> {
}
| [
"mile.prastalo97@gmail.com"
] | mile.prastalo97@gmail.com |
eea11c8ab388e458c992c47856969edb8b527b39 | 83159c3fd3d440b976b0d744d1112ca325e9943d | /src/main/java/ua/kiev/prog/automation/framework/product/app/progkievua/forum/ModaratePage.java | b6273addc31d608082d9cf7e37ab0942ea557fa1 | [] | no_license | PotapIhor/automation-framework | bf186059a53c64a9e879fc47d64f946f503f17e7 | 8a320a80e05e3957189d03d6410a74db0bf62866 | refs/heads/master | 2020-03-21T13:39:22.975967 | 2018-07-02T17:14:49 | 2018-07-02T17:14:49 | 138,618,279 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 830 | java | package ua.kiev.prog.automation.framework.product.app.progkievua.forum;
import org.openqa.selenium.By;
import ua.kiev.prog.automation.framework.core.product.Component;
import ua.kiev.prog.automation.framework.product.app.progkievua.Forum;
import ua.kiev.prog.automation.framework.product.app.progkievua.forum.base.ForumPageObject;
public class ModaratePage extends ForumPageObject {
@Override
protected Class<? extends Component> componentClass() {
return Forum.class;
}
//нЕКИЙ ЭЛЕМЕНТ который загружается последний на странице и свидетельствует о том, что страница гоова
@Override
protected By readyLocator() {
return null;
}
@Override
public By TopLinks() {
return null;
}
}
| [
"johndoe@example.com"
] | johndoe@example.com |
813394345fbdc7e00669fdd5f7bff8391deeef31 | 082e26b011e30dc62a62fae95f375e4f87d9e99c | /docs/weixin_7.0.4_source/反编译源码/未反混淆/src/main/java/com/tencent/mm/plugin/sns/storage/AdLandingPagesStorage/AdLandingPageComponent/component/r.java | 7c7234e8d71591666d2cb8efd5640c60f18e3daa | [] | no_license | xsren/AndroidReverseNotes | 9631a5aabc031006e795a112b7ac756a8edd4385 | 9202c276fe9f04a978e4e08b08e42645d97ca94b | refs/heads/master | 2021-04-07T22:50:51.072197 | 2019-07-16T02:24:43 | 2019-07-16T02:24:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 23,508 | java | package com.tencent.mm.plugin.sns.storage.AdLandingPagesStorage.AdLandingPageComponent.component;
import android.content.Context;
import android.content.Intent;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Looper;
import android.support.v4.content.d;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.RelativeLayout.LayoutParams;
import android.widget.TextView;
import com.facebook.appevents.AppEventsConstants;
import com.tencent.matrix.trace.core.AppMethodBeat;
import com.tencent.mm.R;
import com.tencent.mm.g.a.ma;
import com.tencent.mm.graphics.MMBitmapFactory;
import com.tencent.mm.plugin.sight.decode.ui.b;
import com.tencent.mm.plugin.sns.storage.AdLandingPagesStorage.AdLandingPageComponent.component.widget.AdLandingVideoWrapper;
import com.tencent.mm.plugin.sns.storage.AdLandingPagesStorage.AdLandingPageComponent.z;
import com.tencent.mm.plugin.sns.storage.AdLandingPagesStorage.f.a;
import com.tencent.mm.pluginsdk.ui.h;
import com.tencent.mm.pluginsdk.ui.tools.VideoPlayerSeekBar;
import com.tencent.mm.sdk.platformtools.ab;
import com.tencent.mm.sdk.platformtools.ag;
import com.tencent.mm.sdk.platformtools.ah;
import com.tencent.mm.sdk.platformtools.ak;
import com.tencent.mm.sdk.platformtools.al;
import com.tencent.mm.vfs.e;
import com.tencent.smtt.sdk.WebView;
import org.json.JSONException;
import org.json.JSONObject;
public final class r extends y implements b, h.b {
private Context context;
private ak fbD;
private ProgressBar gtI;
private View iVh;
ImageView mOX;
private long oKj = 0;
private int playCount = 0;
AdLandingVideoWrapper raL;
private VideoPlayerSeekBar raM;
private ImageView raN;
boolean raO;
private ImageView raP;
private TextView raQ;
private Runnable raR;
boolean raS = false;
boolean raT = false;
boolean raU = false;
boolean raV = true;
boolean raW = true;
private boolean raX = false;
private boolean raY = true;
private boolean raZ = false;
private boolean rba = false;
private boolean rbb = false;
private boolean rbc = false;
int rbd = 0;
private int rbe = 0;
private int rbf = 0;
int rbg = 0;
int rbh = 0;
private ac rbi = null;
private OnClickListener rbj = new OnClickListener() {
public final void onClick(View view) {
AppMethodBeat.i(37210);
ab.i("MicroMsg.Sns.AdLandingPageNewStreamVideoComponent", "play btn onclick isPlaying[%b]", Boolean.valueOf(r.this.raL.isPlaying()));
if (r.this.raL.isPlaying()) {
r.this.cpN();
r.this.rbd = 4;
} else {
if (r.this.raV) {
r.this.coY();
} else {
r.this.cpe();
r.this.cpd();
}
r.b(r.this);
r.this.rbd = 3;
}
if (r.this.qVK) {
r rVar = r.this;
rVar.rbg++;
}
AppMethodBeat.o(37210);
}
};
private OnClickListener rbk = new OnClickListener() {
public final void onClick(View view) {
AppMethodBeat.i(37211);
r rVar = r.this;
rVar.rbh++;
if (r.this.raV) {
r.this.cpe();
r.this.cpd();
} else {
r.this.coY();
}
r.this.raS = true;
AppMethodBeat.o(37211);
}
};
private OnClickListener rbl = new OnClickListener() {
public final void onClick(View view) {
AppMethodBeat.i(37213);
r.b(r.this);
r.this.raW = false;
r.this.raT = true;
r.this.rbd = 3;
r.this.cpd();
r.this.la(true);
al.n(new Runnable() {
public final void run() {
AppMethodBeat.i(37212);
if (r.this.raU) {
AppMethodBeat.o(37212);
return;
}
r.this.la(false);
AppMethodBeat.o(37212);
}
}, 10000);
AppMethodBeat.o(37213);
}
};
private OnClickListener rbm = new OnClickListener() {
public final void onClick(View view) {
AppMethodBeat.i(37214);
if (!r.this.raU) {
r.this.raU = true;
r.this.la(true);
}
AppMethodBeat.o(37214);
}
};
static /* synthetic */ void b(r rVar) {
AppMethodBeat.i(37234);
rVar.bgC();
AppMethodBeat.o(37234);
}
public r(final Context context, z zVar, ViewGroup viewGroup) {
super(context, zVar, viewGroup);
AppMethodBeat.i(37216);
this.context = context;
this.fbD = new ak(Looper.getMainLooper());
this.raR = new Runnable() {
public final void run() {
AppMethodBeat.i(37204);
r.this.la(false);
AppMethodBeat.o(37204);
}
};
this.rbi = new ac() {
public final void lb(boolean z) {
AppMethodBeat.i(37207);
Intent intent = new Intent("com.tencent.mm.adlanding.video_progressbar_change");
intent.putExtra("show", z ? 1 : 0);
d.S(context).c(intent);
AppMethodBeat.o(37207);
}
};
AppMethodBeat.o(37216);
}
/* Access modifiers changed, original: protected|final */
public final int getLayout() {
return R.layout.au_;
}
/* JADX WARNING: Removed duplicated region for block: B:8:0x00bb */
/* JADX WARNING: Removed duplicated region for block: B:20:0x01aa */
/* JADX WARNING: Removed duplicated region for block: B:11:0x00c1 */
/* JADX WARNING: Removed duplicated region for block: B:14:0x0103 */
/* Code decompiled incorrectly, please refer to instructions dump. */
public final void cpk() {
String gj;
LayoutParams layoutParams;
AppMethodBeat.i(37217);
View findViewById = this.contentView.findViewById(R.id.um);
findViewById.setBackgroundColor(WebView.NIGHT_MODE_COLOR);
int i = this.ieu;
int i2 = this.iev;
if (((z) this.qZo).qXw == 1) {
if (((int) ((z) this.qZo).width) > 0) {
i2 = (i * ((int) ((z) this.qZo).height)) / ((int) ((z) this.qZo).width);
}
findViewById.setLayoutParams(new LayoutParams(i, i2));
findViewById.setMinimumHeight(i2);
this.raL = (AdLandingVideoWrapper) findViewById.findViewById(R.id.wh);
this.raL.setIMMVideoViewCallback(this);
this.raL.setOnClickListener(this.rbm);
this.raL.c(false, ((z) this.qZo).qWH, 0);
this.raL.setIsShowBasicControls(true);
this.gtI = (ProgressBar) findViewById.findViewById(R.id.rj);
this.mOX = (ImageView) findViewById.findViewById(R.id.z4);
gj = com.tencent.mm.plugin.sns.storage.AdLandingPagesStorage.h.gj("adId", ((z) this.qZo).qXv);
if (!e.ct(gj)) {
this.rbb = false;
}
if (this.rbb) {
com.tencent.mm.plugin.sns.storage.AdLandingPagesStorage.h.c("adId", ((z) this.qZo).qXv, false, 1000000001, new a() {
public final void cpu() {
}
public final void cmD() {
}
public final void YJ(String str) {
AppMethodBeat.i(37208);
if (r.this.mOX.getVisibility() == 0) {
r.this.mOX.setImageBitmap(MMBitmapFactory.decodeFile(str));
}
AppMethodBeat.o(37208);
}
});
} else {
this.mOX.setImageBitmap(MMBitmapFactory.decodeFile(gj));
}
this.raQ = (TextView) findViewById.findViewById(R.id.edz);
this.raQ.setText(this.context.getString(R.string.b6p));
this.iVh = findViewById.findViewById(R.id.efp);
this.iVh.setVisibility(4);
this.raM = new VideoPlayerSeekBar(this.context);
this.raM.setVisibility(4);
if (this.rbi != null) {
this.rbi.lb(this.raM.getVisibility() == 0);
}
this.raM.setIplaySeekCallback(this);
this.raM.setOnPlayButtonClickListener(this.rbj);
layoutParams = new LayoutParams(i - com.tencent.mm.bz.a.fromDPToPix(this.context, 30), -2);
layoutParams.addRule(12);
this.raM.setLayoutParams(layoutParams);
this.raL.setVideoFooterView(this.raM);
this.raN = (ImageView) findViewById.findViewById(R.id.efq);
this.raN.setVisibility(4);
this.raN.setOnClickListener(this.rbk);
this.raN.setPadding(0, 0, com.tencent.mm.bz.a.fromDPToPix(this.context, 8), 0);
this.raP = (ImageView) findViewById.findViewById(R.id.l4);
this.raP.setImageDrawable(com.tencent.mm.bz.a.g(this.context, R.raw.shortvideo_play_btn));
this.raP.setVisibility(8);
this.raP.setOnClickListener(this.rbl);
((ViewGroup) this.raM.getParent()).removeView(this.raM);
layoutParams.bottomMargin = 0;
((ViewGroup) findViewById).addView(this.raM, layoutParams);
this.raL.setVideoPlayCallback(new AdLandingVideoWrapper.a() {
public final void Dq(int i) {
AppMethodBeat.i(37209);
if (!(((z) r.this.qZo).qWM == null || i * 1000 < ((z) r.this.qZo).qWM.qXt || r.this.raO)) {
r.this.raO = true;
ma maVar = new ma();
maVar.cHQ.cHR = ((z) r.this.qZo).qWM.cHR;
com.tencent.mm.sdk.b.a.xxA.m(maVar);
}
AppMethodBeat.o(37209);
}
});
AppMethodBeat.o(37217);
}
findViewById.setPadding((int) ((z) this.qZo).qWS, (int) ((z) this.qZo).qWQ, (int) ((z) this.qZo).qWT, (int) ((z) this.qZo).qWR);
findViewById.setLayoutParams(new LayoutParams(i, i2));
findViewById.setMinimumHeight(i2);
this.raL = (AdLandingVideoWrapper) findViewById.findViewById(R.id.wh);
this.raL.setIMMVideoViewCallback(this);
this.raL.setOnClickListener(this.rbm);
this.raL.c(false, ((z) this.qZo).qWH, 0);
this.raL.setIsShowBasicControls(true);
this.gtI = (ProgressBar) findViewById.findViewById(R.id.rj);
this.mOX = (ImageView) findViewById.findViewById(R.id.z4);
gj = com.tencent.mm.plugin.sns.storage.AdLandingPagesStorage.h.gj("adId", ((z) this.qZo).qXv);
if (e.ct(gj)) {
}
if (this.rbb) {
}
this.raQ = (TextView) findViewById.findViewById(R.id.edz);
this.raQ.setText(this.context.getString(R.string.b6p));
this.iVh = findViewById.findViewById(R.id.efp);
this.iVh.setVisibility(4);
this.raM = new VideoPlayerSeekBar(this.context);
this.raM.setVisibility(4);
if (this.rbi != null) {
}
this.raM.setIplaySeekCallback(this);
this.raM.setOnPlayButtonClickListener(this.rbj);
layoutParams = new LayoutParams(i - com.tencent.mm.bz.a.fromDPToPix(this.context, 30), -2);
layoutParams.addRule(12);
this.raM.setLayoutParams(layoutParams);
this.raL.setVideoFooterView(this.raM);
this.raN = (ImageView) findViewById.findViewById(R.id.efq);
this.raN.setVisibility(4);
this.raN.setOnClickListener(this.rbk);
this.raN.setPadding(0, 0, com.tencent.mm.bz.a.fromDPToPix(this.context, 8), 0);
this.raP = (ImageView) findViewById.findViewById(R.id.l4);
this.raP.setImageDrawable(com.tencent.mm.bz.a.g(this.context, R.raw.shortvideo_play_btn));
this.raP.setVisibility(8);
this.raP.setOnClickListener(this.rbl);
((ViewGroup) this.raM.getParent()).removeView(this.raM);
layoutParams.bottomMargin = 0;
((ViewGroup) findViewById).addView(this.raM, layoutParams);
this.raL.setVideoPlayCallback(/* anonymous class already generated */);
AppMethodBeat.o(37217);
}
/* Access modifiers changed, original: protected|final */
public final void cpp() {
}
private void bgC() {
AppMethodBeat.i(37218);
ab.d("MicroMsg.Sns.AdLandingPageNewStreamVideoComponent", "starting play");
if (this.rba) {
ab.i("MicroMsg.Sns.AdLandingPageNewStreamVideoComponent", "last download fail ,try again");
this.raL.c(false, ((z) this.qZo).qWH, 0);
Dp(0);
this.raL.cpT();
AppMethodBeat.o(37218);
return;
}
this.fbD.post(new Runnable() {
public final void run() {
AppMethodBeat.i(37215);
if (!r.this.raL.isPlaying()) {
if (r.this.raL.getCurrPosSec() == r.this.raL.getVideoDurationSec()) {
r.this.Dp(0);
} else {
r.this.Dp(r.this.raL.getCurrPosSec());
}
r.this.raL.cpT();
}
AppMethodBeat.o(37215);
}
});
this.oKj = System.currentTimeMillis();
this.playCount++;
AppMethodBeat.o(37218);
}
/* Access modifiers changed, original: final */
public final void cpN() {
AppMethodBeat.i(37219);
ab.d("MicroMsg.Sns.AdLandingPageNewStreamVideoComponent", "pause play");
this.fbD.post(new Runnable() {
public final void run() {
AppMethodBeat.i(37205);
r.this.raL.pause();
AppMethodBeat.o(37205);
}
});
if (this.oKj != 0) {
this.rbe = (int) (((long) this.rbe) + (System.currentTimeMillis() - this.oKj));
this.oKj = 0;
}
AppMethodBeat.o(37219);
}
/* Access modifiers changed, original: final */
public final void la(boolean z) {
AppMethodBeat.i(37220);
if (z) {
this.raM.setVisibility(0);
this.raN.setVisibility(0);
this.iVh.setVisibility(0);
if (this.rbi != null) {
this.rbi.lb(true);
}
this.fbD.postDelayed(this.raR, 5000);
AppMethodBeat.o(37220);
return;
}
this.raU = false;
this.raM.setVisibility(4);
this.raN.setVisibility(8);
this.iVh.setVisibility(4);
if (this.rbi != null) {
this.rbi.lb(false);
}
this.fbD.removeCallbacks(this.raR);
AppMethodBeat.o(37220);
}
/* Access modifiers changed, original: final */
public final void Dp(int i) {
AppMethodBeat.i(37221);
if (this.raL != null) {
this.raP.setVisibility(8);
if (this.mOX.getVisibility() == 0) {
this.gtI.setVisibility(0);
}
this.raL.e((double) i, true);
}
AppMethodBeat.o(37221);
}
public final void coY() {
AppMethodBeat.i(37222);
super.coY();
this.raN.setImageDrawable(com.tencent.mm.bz.a.g(this.context, R.drawable.b7m));
this.raL.setMute(true);
this.raV = true;
AppMethodBeat.o(37222);
}
public final void cpd() {
AppMethodBeat.i(37223);
super.cpd();
this.raN.setImageDrawable(com.tencent.mm.bz.a.g(this.context, R.drawable.b7n));
this.raL.setMute(false);
this.raV = false;
AppMethodBeat.o(37223);
}
public final void cpa() {
AppMethodBeat.i(37224);
super.cpa();
AppMethodBeat.o(37224);
}
public final void cpb() {
AppMethodBeat.i(37225);
super.cpb();
cpN();
if (this.raX || this.raY) {
this.raY = false;
this.raX = false;
if (this.rbd == 1) {
this.rbd = 2;
}
AppMethodBeat.o(37225);
return;
}
AppMethodBeat.o(37225);
}
public final void coZ() {
AppMethodBeat.i(37226);
super.coZ();
this.raL.aEX();
AppMethodBeat.o(37226);
}
public final void cpc() {
AppMethodBeat.i(37227);
super.cpc();
int cpw = cpw();
int height = getView().getHeight();
ab.d("MicroMsg.Sns.AdLandingPageNewStreamVideoComponent", "inScreenHeight %d, height %d", Integer.valueOf(cpw), Integer.valueOf(height));
if (cpw == 0 || height == 0) {
AppMethodBeat.o(37227);
} else if (cpw < 0) {
AppMethodBeat.o(37227);
} else if (((float) cpw) < ((float) height) * 0.5f) {
this.raY = false;
this.raX = false;
cpN();
if (this.rbd == 1) {
this.rbd = 2;
}
AppMethodBeat.o(37227);
} else if (!this.raX || this.raY) {
this.raY = false;
this.raX = true;
this.mOX.setVisibility(0);
NetworkInfo activeNetworkInfo = ((ConnectivityManager) ah.getContext().getSystemService("connectivity")).getActiveNetworkInfo();
if (!this.raW || (this.raW && activeNetworkInfo != null && activeNetworkInfo.getType() == 1)) {
la(true);
al.n(new Runnable() {
public final void run() {
AppMethodBeat.i(37206);
if (r.this.raU) {
AppMethodBeat.o(37206);
return;
}
r.this.la(false);
AppMethodBeat.o(37206);
}
}, 3000);
}
if (this.raW) {
if (activeNetworkInfo == null || !(activeNetworkInfo == null || activeNetworkInfo.getType() == 1)) {
this.raP.setVisibility(0);
this.raZ = false;
this.raW = false;
AppMethodBeat.o(37227);
return;
}
this.raZ = true;
this.raW = false;
}
if (this.rbd == 0) {
if (activeNetworkInfo != null && activeNetworkInfo.getType() == 1) {
if (this.raV) {
coY();
} else {
cpd();
}
this.rbd = 1;
}
AppMethodBeat.o(37227);
} else if (this.rbd == 2) {
if (this.raV) {
coY();
} else {
cpd();
}
bgC();
this.rbd = 1;
AppMethodBeat.o(37227);
return;
} else {
if (this.rbd == 3) {
if (this.raV) {
coY();
} else {
cpd();
}
}
AppMethodBeat.o(37227);
}
bgC();
AppMethodBeat.o(37227);
} else {
AppMethodBeat.o(37227);
}
}
public final boolean al(JSONObject jSONObject) {
AppMethodBeat.i(37228);
if (super.al(jSONObject)) {
try {
String ck;
JSONObject jSONObject2;
jSONObject.put("streamVideoDuraion", this.raL.getVideoDurationSec() * 1000);
jSONObject.put("playTimeInterval", this.rbe);
jSONObject.put("playCount", this.playCount);
jSONObject.put("playCompletedCount", this.rbf);
jSONObject.put("clickPlayControlCount", this.rbg);
jSONObject.put("clickVoiceControlCount", this.rbh);
jSONObject.put("isAutoPlay", this.raZ ? "1" : AppEventsConstants.EVENT_PARAM_VALUE_NO);
if (!this.rbb) {
ck = ag.ck(((z) this.qZo).qXv);
jSONObject2 = new JSONObject();
jSONObject2.put("urlMd5", ck);
jSONObject2.put("needDownload", 1);
jSONObject.put("thumbUrlInfo", jSONObject2);
}
if (!this.rbc) {
ck = ag.ck(((z) this.qZo).qWH);
jSONObject2 = new JSONObject();
jSONObject2.put("urlMd5", ck);
jSONObject2.put("needDownload", 1);
jSONObject.put("streamVideoUrlInfo", jSONObject2);
}
AppMethodBeat.o(37228);
return true;
} catch (JSONException e) {
ab.printErrStackTrace("MicroMsg.Sns.AdLandingPageNewStreamVideoComponent", e, "", new Object[0]);
AppMethodBeat.o(37228);
return false;
}
}
AppMethodBeat.o(37228);
return false;
}
public final void aFw() {
this.raU = true;
}
public final void oA(int i) {
AppMethodBeat.i(37229);
ab.i("MicroMsg.Sns.AdLandingPageNewStreamVideoComponent", "onSeek time ".concat(String.valueOf(i)));
if (this.raV) {
coY();
} else {
cpe();
cpd();
}
Dp(i);
AppMethodBeat.o(37229);
}
public final void cp(String str, String str2) {
this.rba = false;
}
public final void cq(String str, String str2) {
AppMethodBeat.i(37230);
this.rbf++;
la(true);
this.raL.rcg.stopTimer();
if (this.oKj != 0) {
this.rbe = (int) (((long) this.rbe) + (System.currentTimeMillis() - this.oKj));
this.oKj = 0;
}
this.rbd = 5;
this.raL.akV();
AppMethodBeat.o(37230);
}
public final void cr(String str, String str2) {
}
public final void cs(String str, String str2) {
AppMethodBeat.i(37231);
this.mOX.setVisibility(8);
this.gtI.setVisibility(8);
AppMethodBeat.o(37231);
}
public final void d(String str, String str2, int i, int i2) {
}
public final void c(String str, String str2, String str3, int i, int i2) {
AppMethodBeat.i(37232);
ab.e("MicroMsg.Sns.AdLandingPageNewStreamVideoComponent", "online play error, %s", str3);
this.rba = true;
AppMethodBeat.o(37232);
}
public final void ct(String str, String str2) {
}
public final void cu(String str, String str2) {
}
public final void cpA() {
AppMethodBeat.i(37233);
super.cpA();
cpN();
String gj = com.tencent.mm.plugin.sns.storage.AdLandingPagesStorage.h.gj("adId", ((z) this.qZo).qXv);
if (e.ct(gj)) {
this.mOX.setImageBitmap(MMBitmapFactory.decodeFile(gj));
this.mOX.setVisibility(0);
}
AppMethodBeat.o(37233);
}
}
| [
"alwangsisi@163.com"
] | alwangsisi@163.com |
70682bf2eb22963416832ea00025d28541e699af | 07b9c8cfca6b72d2bd32f3ebaa1519bfdf94175f | /src/com/mainacad/ApplicationRunner.java | 822f47d85239afb89cee52fbdf72c179e39c7af9 | [] | no_license | AllroadDev/HomeAssignment1_MD | c6d277a8ff515a63d643e90abb711839f7289da9 | 92434eb82a0fcef65e099b4da3f06987a4349815 | refs/heads/master | 2020-08-08T04:14:38.132074 | 2019-10-16T11:09:32 | 2019-10-16T11:09:32 | 213,709,104 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,692 | java | package com.mainacad;
import com.mainacad.Circle.Circle;
import com.mainacad.Square.Square;
import com.mainacad.Triangle.Triangle;
import com.mainacad.abs.Shape;
public class ApplicationRunner {
public static void main(String[] args) {
Triangle triangle = new Triangle();
triangle.setBase(13.5);
triangle.setHeights(10.0);
Circle circle = new Circle();
circle.setRadius(7.5);
Square square = new Square();
square.setSide(45.0);
Shape maxShape;
Shape minShape;
if (circle.getArea() > square.getArea()) {
maxShape = circle;
} else {
maxShape = square;
}
if (maxShape.getArea() < triangle.getArea()) {
maxShape = triangle;
}
System.out.println(" Max shape is " + maxShape.getClass().getSimpleName() + " and has area " + maxShape.getArea());
if (circle.getArea() > square.getArea()) {
minShape = circle;
} else {
minShape = square;
}
if (minShape.getArea() > triangle.getArea()) {
minShape = triangle;
}
System.out.println(" Min shape is " + minShape.getClass().getSimpleName() + " and has area " + minShape.getArea() );
// Square square = new Square();
// square.setSide(10.0);
//// square.setName(" Square ");
//
//
// System.out.println(" Square with side " + square.getSide() + " has area " + square.getArea() );
//
// Circle circle = new Circle();
// circle.setRadius(14.0);
//
// System.out.println(" Circle with radius " + circle.getRadius() + " has area " + circle.getArea());
}
}
| [
"sasha110102@gmail.com"
] | sasha110102@gmail.com |
0865a128e0bcade0d9442ff4e358d558a3a0d526 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/5/5_f40663379173bdc5ab6aba1101025c62cb686ba2/AbstractInstrumentationMojo/5_f40663379173bdc5ab6aba1101025c62cb686ba2_AbstractInstrumentationMojo_t.java | a167a5a2b982dc8d21230d8342b0142ea0224eb7 | [] | 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 | 36,357 | java | /*
* Copyright (C) 2009-2011 Jayway AB
* Copyright (C) 2007-2008 JVending Masa
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.jayway.maven.plugins.android;
import com.android.ddmlib.AdbCommandRejectedException;
import com.android.ddmlib.IDevice;
import com.android.ddmlib.ShellCommandUnresponsiveException;
import com.android.ddmlib.TimeoutException;
import com.android.ddmlib.testrunner.IRemoteAndroidTestRunner;
import com.android.ddmlib.testrunner.ITestRunListener;
import com.android.ddmlib.testrunner.RemoteAndroidTestRunner;
import com.android.ddmlib.testrunner.TestIdentifier;
import com.jayway.maven.plugins.android.asm.AndroidTestFinder;
import com.jayway.maven.plugins.android.common.DeviceHelper;
import com.jayway.maven.plugins.android.configuration.Test;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.project.MavenProject;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.Result;
import javax.xml.transform.Source;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import static com.android.ddmlib.testrunner.ITestRunListener.TestFailure.ERROR;
/**
* AbstractInstrumentationMojo implements running the instrumentation
* tests.
*
* @author hugo.josefson@jayway.com
* @author Manfred Moser <manfred@simpligility.com>
*/
public abstract class AbstractInstrumentationMojo extends AbstractAndroidMojo {
/**
* -Dmaven.test.skip is commonly used with Maven to skip tests. We honor it too.
*
* @parameter expression="${maven.test.skip}" default-value=false
* @readonly
*/
private boolean mavenTestSkip;
/**
* -DskipTests is commonly used with Maven to skip tests. We honor it too.
*
* @parameter expression="${skipTests}" default-value=false
* @readonly
*/
private boolean mavenSkipTests;
/**
* The configuration to use for running instrumentation tests. Complete configuration
* is possible in the plugin configuration:
* <pre>
* <test>
* <skip>true|false|auto</skip>
* <instrumentationPackage>packageName</instrumentationPackage>
* <instrumentationRunner>className</instrumentationRunner>
* <debug>true|false</debug>
* <coverage>true|false</coverage>
* <logOnly>true|false</logOnly> avd
* <testSize>small|medium|large</testSize>
* <createReport>true|false</createReport>
* <classes>
* <class>your.package.name.YourTestClass</class>
* </classes>
* <packages>
* <package>your.package.name</package>
* </packages>
* </test>
* </pre>
*
* @parameter
*/
private Test test;
/**
* Enables or disables integration test related goals. If <code>true</code> they will be run; if <code>false</code>,
* they will be skipped. If <code>auto</code>, they will run if any of the classes inherit from any class in
* <code>junit.framework.**</code> or <code>android.test.**</code>.
*
* @parameter expression="${android.test.skip}" default-value="auto"
*/
private String testSkip;
/**
* Package name of the apk we wish to instrument. If not specified, it is inferred from
* <code>AndroidManifest.xml</code>.
*
* @optional
* @parameter expression="${android.test.instrumentationPackage}
*/
private String testInstrumentationPackage;
/**
* Class name of test runner. If not specified, it is inferred from <code>AndroidManifest.xml</code>.
*
* @optional
* @parameter expression="${android.test.instrumentationRunner}"
*/
private String testInstrumentationRunner;
/**
* Enable debug causing the test runner to wait until debugger is
* connected with the Android debug bridge (adb).
*
* @optional
* @parameter default-value=false expression="${android.test.debug}"
*/
private Boolean testDebug;
/**
* Enable or disable code coverage for this instrumentation test
* run.
*
* @optional
* @parameter default-value=false expression="${android.test.coverage}"
*/
private Boolean testCoverage;
/**
* Enable this flag to run a log only and not execute the tests.
*
* @optional
* @parameter default-value=false expression="${android.test.logonly}"
*/
private Boolean testLogOnly;
/**
* If specified only execute tests of certain size as defined by
* the Android instrumentation testing SmallTest, MediumTest and
* LargeTest annotations. Use "small", "medium" or "large" as values.
*
* @see com.android.ddmlib.testrunner.IRemoteAndroidTestRunner
*
* @optional
* @parameter expression="${android.test.testsize}"
*/
private String testTestSize;
/**
* Create a junit xml format compatible output file containing
* the test results for each device the instrumentation tests run
* on.
* <br /><br />
* The files are stored in target/surefire-reports and named TEST-deviceid.xml.
* The deviceid for an emulator is deviceSerialNumber_avdName_manufacturer_model.
* The serial number is commonly emulator-5554 for the first emulator started
* with numbers increasing. avdName is as defined in the SDK tool. The
* manufacturer is typically "unknown" and the model is typically "sdk".
* The deviceid for an actual devices is
* deviceSerialNumber_manufacturer_model.
* <br /><br />
* The file contains system properties from the system running
* the Android Maven Plugin (JVM) and device properties from the
* device/emulator the tests are running on.
* <br /><br />
* The file contains a single TestSuite for all tests and a
* TestCase for each test method. Errors and failures are logged
* in the file and the system log with full stack traces and other
* details available.
*
* @optional
* @parameter default-value=true expression="${android.test.createreport}"
*/
private Boolean testCreateReport;
/**
* <p>Whether to execute tests only in given packages as part of the instrumentation tests.</p>
* <pre>
* <packages>
* <package>your.package.name</package>
* </packages>
* </pre>
* or as e.g. -Dandroid.test.packages=package1,package2
*
* @optional
* @parameter expression="${android.test.packages}
*/
protected List<String> testPackages;
/**
* <p>Whether to execute test classes which are specified as part of the instrumentation tests.</p>
* <pre>
* <classes>
* <class>your.package.name.YourTestClass</class>
* </classes>
* </pre>
* or as e.g. -Dandroid.test.classes=class1,class2
*
* @optional
* @parameter expression="${android.test.classes}
*/
protected List<String> testClasses;
private boolean classesExists;
private boolean packagesExists;
// the parsed parameters from the plugin config or properties from command line or pom or settings
private String parsedSkip;
private String parsedInstrumentationPackage;
private String parsedInstrumentationRunner;
private List<String> parsedClasses;
private List<String> parsedPackages;
private String parsedTestSize;
private Boolean parsedCoverage;
private Boolean parsedDebug;
private Boolean parsedLogOnly;
private Boolean parsedCreateReport;
private String packagesList;
protected void instrument() throws MojoExecutionException, MojoFailureException {
parseConfiguration();
if (parsedInstrumentationPackage == null) {
parsedInstrumentationPackage = extractPackageNameFromAndroidManifest(androidManifestFile);
}
if (parsedInstrumentationRunner == null) {
parsedInstrumentationRunner = extractInstrumentationRunnerFromAndroidManifest(androidManifestFile);
}
// only run Tests in specific package
packagesList = buildCommaSeparatedString(parsedPackages);
packagesExists = StringUtils.isNotBlank(packagesList);
if (parsedClasses != null) {
classesExists = parsedClasses.size() > 0;
} else {
classesExists = false;
}
if(classesExists && packagesExists) {
// if both packages and classes are specified --> ERROR
throw new MojoFailureException("packages and classes are mutually exclusive. They cannot be specified at " +
"the same time. Please specify either packages or classes. For details, " +
"see http://developer.android.com/guide/developing/testing/testing_otheride.html");
}
doWithDevices(new DeviceCallback() {
public void doWithDevice(final IDevice device) throws MojoExecutionException, MojoFailureException {
RemoteAndroidTestRunner remoteAndroidTestRunner =
new RemoteAndroidTestRunner(parsedInstrumentationPackage, parsedInstrumentationRunner, device);
if(packagesExists) {
remoteAndroidTestRunner.setTestPackageName(packagesList);
getLog().info("Running tests for specified test packages: " + packagesList);
}
if(classesExists) {
remoteAndroidTestRunner.setClassNames(parsedClasses.toArray(new String[parsedClasses.size()]));
getLog().info("Running tests for specified test classes/methods: " + parsedClasses);
}
remoteAndroidTestRunner.setDebug(parsedDebug);
remoteAndroidTestRunner.setCoverage(parsedCoverage);
remoteAndroidTestRunner.setLogOnly(parsedLogOnly);
if (StringUtils.isNotBlank(parsedTestSize)) {
IRemoteAndroidTestRunner.TestSize validSize =
IRemoteAndroidTestRunner.TestSize.getTestSize(parsedTestSize);
remoteAndroidTestRunner.setTestSize(validSize);
}
getLog().info("Running instrumentation tests in " + parsedInstrumentationPackage + " on " +
device.getSerialNumber() + " (avdName=" + device.getAvdName() + ")");
try {
AndroidTestRunListener testRunListener = new AndroidTestRunListener(project, device);
remoteAndroidTestRunner.run(testRunListener);
if (testRunListener.hasFailuresOrErrors()) {
throw new MojoFailureException("Tests failed on device.");
}
if (testRunListener.testRunFailed()) {
throw new MojoFailureException("Test run failed to complete: "+testRunListener.getTestRunFailureCause());
}
if (testRunListener.threwException()) {
throw new MojoFailureException(testRunListener.getExceptionMessages());
}
} catch (TimeoutException e) {
throw new MojoExecutionException("timeout", e);
} catch (AdbCommandRejectedException e) {
throw new MojoExecutionException("adb command rejected", e);
} catch (ShellCommandUnresponsiveException e) {
throw new MojoExecutionException("shell command " +
"unresponsive", e);
} catch (IOException e) {
throw new MojoExecutionException("IO problem", e);
}
}
});
}
private void parseConfiguration() {
// we got config in pom ... lets use it,
if (test != null) {
if (StringUtils.isNotEmpty(test.getSkip())) {
parsedSkip = test.getSkip();
} else {
parsedSkip = testSkip;
}
if (StringUtils.isNotEmpty(test.getInstrumentationPackage())) {
parsedInstrumentationPackage = test.getInstrumentationPackage();
} else {
parsedInstrumentationPackage = testInstrumentationPackage;
}
if (StringUtils.isNotEmpty(test.getInstrumentationRunner())) {
parsedInstrumentationRunner = test.getInstrumentationRunner();
} else {
parsedInstrumentationRunner = testInstrumentationRunner;
}
if (test.getClasses() != null && !test.getClasses().isEmpty()) {
parsedClasses = test.getClasses();
} else {
parsedClasses = testClasses;
}
if (test.getPackages() != null && !test.getPackages().isEmpty()) {
parsedPackages = test.getPackages();
} else {
parsedPackages = testPackages;
}
if (StringUtils.isNotEmpty(test.getTestSize())) {
parsedTestSize = test.getTestSize();
} else {
parsedTestSize = testTestSize;
}
if (test.isCoverage() != null) {
parsedCoverage= test.isCoverage();
} else {
parsedCoverage = testCoverage;
}
if (test.isDebug() != null) {
parsedDebug = test.isDebug();
} else {
parsedDebug = testDebug;
}
if (test.isLogOnly() != null) {
parsedLogOnly = test.isLogOnly();
} else {
parsedLogOnly = testLogOnly;
}
if (test.isCreateReport() != null) {
parsedCreateReport = test.isCreateReport();
} else {
parsedCreateReport = testCreateReport;
}
}
// no pom, we take properties
else {
parsedSkip = testSkip;
parsedInstrumentationPackage = testInstrumentationPackage;
parsedInstrumentationRunner = testInstrumentationRunner;
parsedClasses = testClasses;
parsedPackages = testPackages;
parsedTestSize = testTestSize;
parsedCoverage= testCoverage;
parsedDebug= testDebug;
parsedLogOnly = testLogOnly;
parsedCreateReport = testCreateReport;
}
}
/**
* Whether or not to execute integration test related goals. Reads from configuration parameter
* <code>enableIntegrationTest</code>, but can be overridden with <code>-Dmaven.test.skip</code>.
*
* @return <code>true</code> if integration test goals should be executed, <code>false</code> otherwise.
*/
protected boolean isEnableIntegrationTest() throws MojoFailureException, MojoExecutionException {
parseConfiguration();
if (mavenTestSkip) {
getLog().info("maven.test.skip set - skipping tests");
return false;
}
if (mavenSkipTests) {
getLog().info("maven.skip.tests set - skipping tests");
return false;
}
if ("true".equalsIgnoreCase(parsedSkip)) {
getLog().info("android.test.skip set - skipping tests");
return false;
}
if ("false".equalsIgnoreCase(parsedSkip)) {
return true;
}
if (parsedSkip == null || "auto".equalsIgnoreCase(parsedSkip)) {
if (extractInstrumentationRunnerFromAndroidManifest(androidManifestFile) == null) {
getLog().info("No InstrumentationRunner found - skipping tests");
return false;
}
return AndroidTestFinder.containsAndroidTests(new File(project.getBuild()
.getOutputDirectory()));
}
throw new MojoFailureException("android.test.skip must be configured as 'true', 'false' or 'auto'.");
}
/**
* Helper method to build a comma separated string from a list.
* Blank strings are filtered out
*
* @param lines A list of strings
* @return Comma separated String from given list
*/
protected static String buildCommaSeparatedString(List<String> lines) {
if(lines == null || lines.size() == 0) {
return null;
}
List<String> strings = new ArrayList<String>(lines.size());
for(String str : lines) { // filter out blank strings
if(StringUtils.isNotBlank(str)) {
strings.add(StringUtils.trimToEmpty(str));
}
}
return StringUtils.join(strings, ",");
}
/**
* AndroidTestRunListener produces a nice output for the log for the test
* run as well as an xml file compatible with the junit xml report file
* format understood by many tools.
*
* It will do so for each device/emulator the tests run on.
*/
private class AndroidTestRunListener implements ITestRunListener {
/** the indent used in the log to group items that belong together visually **/
private static final String INDENT = " ";
/**
* Junit report schema documentation is sparse. Here are some hints
* @see "http://mail-archives.apache.org/mod_mbox/ant-dev/200902.mbox/%3Cdffc72020902241548l4316d645w2e98caf5f0aac770@mail.gmail.com%3E"
* @see "http://junitpdfreport.sourceforge.net/managedcontent/PdfTranslation"
*/
private static final String TAG_TESTSUITES = "testsuites";
private static final String TAG_TESTSUITE = "testsuite";
private static final String ATTR_TESTSUITE_ERRORS = "errors";
private static final String ATTR_TESTSUITE_FAILURES = "failures";
private static final String ATTR_TESTSUITE_HOSTNAME = "hostname";
private static final String ATTR_TESTSUITE_NAME = "name";
private static final String ATTR_TESTSUITE_TESTS = "tests";
private static final String ATTR_TESTSUITE_TIME = "time";
private static final String ATTR_TESTSUITE_TIMESTAMP = "timestamp";
private static final String TAG_PROPERTIES = "properties";
private static final String TAG_PROPERTY = "property";
private static final String ATTR_PROPERTY_NAME = "name";
private static final String ATTR_PROPERTY_VALUE = "value";
private static final String TAG_TESTCASE = "testcase";
private static final String ATTR_TESTCASE_NAME = "name";
private static final String ATTR_TESTCASE_CLASSNAME = "classname";
private static final String ATTR_TESTCASE_TIME = "time";
private static final String TAG_ERROR = "error";
private static final String TAG_FAILURE = "failure";
private static final String ATTR_MESSAGE = "message";
private static final String ATTR_TYPE = "type";
/** time format for the output of milliseconds in seconds in the xml file **/
private final NumberFormat timeFormatter = new DecimalFormat("#0.0000");
private int testCount = 0;
private int testFailureCount = 0;
private int testErrorCount = 0;
private String testRunFailureCause = null;
private final MavenProject project;
/** the emulator or device we are running the tests on **/
private final IDevice device;
// junit xml report related fields
private Document junitReport;
private Node testSuiteNode;
/** node for the current test case for junit report */
private Node currentTestCaseNode;
/** start time of current test case in millis, reset with each test start */
private long currentTestCaseStartTime;
// we track if we have problems and then report upstream
private boolean threwException = false;
private final StringBuilder exceptionMessages = new StringBuilder();
public AndroidTestRunListener(MavenProject project, IDevice device) {
this.project = project;
this.device = device;
}
public void testRunStarted(String runName, int testCount) {
this.testCount = testCount;
getLog().info(INDENT + "Run started: " + runName + ", " + testCount + " tests:");
if (parsedCreateReport) {
try {
DocumentBuilderFactory fact = DocumentBuilderFactory.newInstance();
DocumentBuilder parser = null;
parser = fact.newDocumentBuilder();
junitReport = parser.newDocument();
Node testSuitesNode = junitReport.createElement(TAG_TESTSUITES);
junitReport.appendChild(testSuitesNode);
testSuiteNode = junitReport.createElement(TAG_TESTSUITE);
NamedNodeMap testSuiteAttributes = testSuiteNode.getAttributes();
Attr nameAttr = junitReport.createAttribute(ATTR_TESTSUITE_NAME);
nameAttr.setValue(runName);
testSuiteAttributes.setNamedItem(nameAttr);
Attr hostnameAttr = junitReport.createAttribute(ATTR_TESTSUITE_HOSTNAME);
hostnameAttr.setValue(DeviceHelper.getDescriptiveName(device));
testSuiteAttributes.setNamedItem(hostnameAttr);
Node propertiesNode = junitReport.createElement(TAG_PROPERTIES);
Node propertyNode;
NamedNodeMap propertyAttributes;
Attr propNameAttr;
Attr propValueAttr;
for (Map.Entry<Object, Object> systemProperty : System.getProperties().entrySet()) {
propertyNode = junitReport.createElement(TAG_PROPERTY);
propertyAttributes = propertyNode.getAttributes();
propNameAttr = junitReport.createAttribute(ATTR_PROPERTY_NAME);
propNameAttr.setValue(systemProperty.getKey().toString());
propertyAttributes.setNamedItem(propNameAttr);
propValueAttr = junitReport.createAttribute(ATTR_PROPERTY_VALUE);
propValueAttr.setValue(systemProperty.getValue().toString());
propertyAttributes.setNamedItem(propValueAttr);
propertiesNode.appendChild(propertyNode);
}
Map<String, String> deviceProperties = device.getProperties();
for (Map.Entry<String, String> deviceProperty : deviceProperties.entrySet()) {
propertyNode = junitReport.createElement(TAG_PROPERTY);
propertyAttributes = propertyNode.getAttributes();
propNameAttr = junitReport.createAttribute(ATTR_PROPERTY_NAME);
propNameAttr.setValue(deviceProperty.getKey());
propertyAttributes.setNamedItem(propNameAttr);
propValueAttr = junitReport.createAttribute(ATTR_PROPERTY_VALUE);
propValueAttr.setValue(deviceProperty.getValue());
propertyAttributes.setNamedItem(propValueAttr);
propertiesNode.appendChild(propertyNode);
}
testSuiteNode.appendChild(propertiesNode);
testSuitesNode.appendChild(testSuiteNode);
} catch (ParserConfigurationException e) {
threwException = true;
exceptionMessages.append("Failed to create document");
exceptionMessages.append(e.getMessage());
}
}
}
public void testStarted(TestIdentifier test) {
getLog().info(INDENT + INDENT +"Start: " + test.toString());
if (parsedCreateReport) {
// reset start time for each test run
currentTestCaseStartTime = new Date().getTime();
currentTestCaseNode = junitReport.createElement(TAG_TESTCASE);
NamedNodeMap testCaseAttributes = currentTestCaseNode.getAttributes();
Attr classAttr = junitReport.createAttribute(ATTR_TESTCASE_CLASSNAME);
classAttr.setValue(test.getClassName());
testCaseAttributes.setNamedItem(classAttr);
Attr methodAttr = junitReport.createAttribute(ATTR_TESTCASE_NAME);
methodAttr.setValue(test.getTestName());
testCaseAttributes.setNamedItem(methodAttr);
}
}
public void testFailed(TestFailure status, TestIdentifier test, String trace) {
if (status==ERROR) {
++testErrorCount;
} else {
++testFailureCount;
}
getLog().info(INDENT + INDENT + status.name() + ":" + test.toString());
getLog().info(INDENT + INDENT + trace);
if (parsedCreateReport) {
Node errorFailureNode;
NamedNodeMap errorfailureAttributes;
if (status == ERROR) {
errorFailureNode = junitReport.createElement(TAG_ERROR);
errorfailureAttributes = errorFailureNode.getAttributes();
} else {
errorFailureNode = junitReport.createElement(TAG_FAILURE);
errorfailureAttributes= errorFailureNode.getAttributes();
}
errorFailureNode.setTextContent(trace);
Attr msgAttr = junitReport.createAttribute(ATTR_MESSAGE);
msgAttr.setValue(parseForMessage(trace));
errorfailureAttributes.setNamedItem(msgAttr);
Attr typeAttr = junitReport.createAttribute(ATTR_TYPE);
typeAttr.setValue(parseForException(trace));
errorfailureAttributes.setNamedItem(typeAttr);
currentTestCaseNode.appendChild(errorFailureNode);
}
}
public void testEnded(TestIdentifier test, Map<String, String> testMetrics) {
getLog().info( INDENT + INDENT +"End: " + test.toString());
logMetrics(testMetrics);
if (parsedCreateReport) {
testSuiteNode.appendChild(currentTestCaseNode);
NamedNodeMap testCaseAttributes = currentTestCaseNode.getAttributes();
Attr timeAttr = junitReport.createAttribute(ATTR_TESTCASE_TIME);
long now = new Date().getTime();
double seconds = (now - currentTestCaseStartTime)/1000.0;
timeAttr.setValue(timeFormatter.format(seconds));
testCaseAttributes.setNamedItem(timeAttr);
}
}
public void testRunEnded(long elapsedTime, Map<String, String> runMetrics) {
getLog().info(INDENT +"Run ended: " + elapsedTime + " ms");
if (hasFailuresOrErrors()) {
getLog().error(INDENT + "FAILURES!!!");
}
getLog().info(INDENT + "Tests run: " + testCount + ", Failures: "
+ testFailureCount + ", Errors: " + testErrorCount);
if (parsedCreateReport) {
NamedNodeMap testSuiteAttributes = testSuiteNode.getAttributes();
Attr testCountAttr = junitReport.createAttribute(ATTR_TESTSUITE_TESTS);
testCountAttr.setValue(Integer.toString(testCount));
testSuiteAttributes.setNamedItem(testCountAttr);
Attr testFailuresAttr = junitReport.createAttribute(ATTR_TESTSUITE_FAILURES);
testFailuresAttr.setValue(Integer.toString(testFailureCount));
testSuiteAttributes.setNamedItem(testFailuresAttr);
Attr testErrorsAttr = junitReport.createAttribute(ATTR_TESTSUITE_ERRORS);
testErrorsAttr.setValue(Integer.toString(testErrorCount));
testSuiteAttributes.setNamedItem(testErrorsAttr);
Attr timeAttr = junitReport.createAttribute(ATTR_TESTSUITE_TIME);
timeAttr.setValue(timeFormatter.format(elapsedTime / 1000.0));
testSuiteAttributes.setNamedItem(timeAttr);
Attr timeStampAttr = junitReport.createAttribute(ATTR_TESTSUITE_TIMESTAMP);
timeStampAttr.setValue(new Date().toString());
testSuiteAttributes.setNamedItem(timeStampAttr);
}
logMetrics(runMetrics);
if (parsedCreateReport) {
writeJunitReportToFile();
}
}
public void testRunFailed(String errorMessage) {
testRunFailureCause = errorMessage;
getLog().info(INDENT +"Run failed: " + errorMessage);
}
public void testRunStopped(long elapsedTime) {
getLog().info(INDENT +"Run stopped:" + elapsedTime);
}
/**
* Parse a trace string for the message in it. Assumes that the message is located after ":" and before
* "\r\n".
* @param trace
* @return message or empty string
*/
private String parseForMessage(String trace) {
if (StringUtils.isNotBlank(trace)) {
String newline = "\r\n";
// if there is message like
// junit.junit.framework.AssertionFailedError ... there is no message
int messageEnd = trace.indexOf(newline);
boolean hasMessage = !trace.startsWith("junit.") && messageEnd > 0;
if (hasMessage) {
int messageStart = trace.indexOf(":") + 2;
if (messageStart > messageEnd) {
messageEnd = trace.indexOf(newline+"at"); // match start of stack trace "\r\nat org.junit....."
}
return trace.substring(messageStart, messageEnd);
} else {
return StringUtils.EMPTY;
}
} else {
return StringUtils.EMPTY;
}
}
/**
* Parse a trace string for the exception class. Assumes that it is the start of the trace and ends at the first
* ":".
* @param trace
* @return Exception class as string or empty string
*/
private String parseForException(String trace) {
if (StringUtils.isNotBlank(trace)) {
return trace.substring(0, trace.indexOf(":"));
} else {
return StringUtils.EMPTY;
}
}
/**
* Write the junit report xml file.
*/
private void writeJunitReportToFile() {
TransformerFactory xfactory = TransformerFactory.newInstance();
Transformer xformer = null;
try {
xformer = xfactory.newTransformer();
} catch (TransformerConfigurationException e) {
e.printStackTrace();
}
Source source = new DOMSource(junitReport);
FileWriter writer = null;
try {
String directory = new StringBuilder()
.append(project.getBuild().getDirectory())
.append("/surefire-reports")
.toString();
FileUtils.forceMkdir(new File(directory));
String fileName = new StringBuilder()
.append(directory)
.append("/TEST-")
.append(DeviceHelper.getDescriptiveName(device))
.append(".xml")
.toString();
File reportFile = new File(fileName);
writer = new FileWriter(reportFile);
Result result = new StreamResult(writer);
xformer.transform(source, result);
getLog().info("Report file written to " + reportFile.getAbsolutePath());
} catch (IOException e) {
threwException = true;
exceptionMessages.append("Failed to write test report file");
exceptionMessages.append(e.getMessage());
} catch (TransformerException e) {
threwException = true;
exceptionMessages.append("Failed to transform document to write to test report file");
exceptionMessages.append(e.getMessage());
} finally {
IOUtils.closeQuietly(writer);
}
}
/**
* Log all the metrics out in to key: value lines.
* @param metrics
*/
private void logMetrics(Map<String, String> metrics) {
for (Map.Entry<String, String> entry : metrics.entrySet()) {
getLog().info(INDENT + INDENT + entry.getKey() + ": "
+ entry.getValue());
}
}
/**
* @return if any failures or errors occurred in the test run.
*/
public boolean hasFailuresOrErrors() {
return testErrorCount > 0 || testFailureCount > 0;
}
/**
* @return if the test run itself failed - a failure in the test infrastructure, not a test failure.
*/
public boolean testRunFailed() {
return testRunFailureCause != null;
}
public String getTestRunFailureCause() {
return testRunFailureCause;
}
/**
* @return if any exception was thrown during the test run
* on the build system (not the Android device or emulator)
*/
public boolean threwException() {
return threwException;
}
/**
* @return all exception messages thrown during test execution
* on the test run time (not the Android device or emulator)
*/
public String getExceptionMessages() {
return exceptionMessages.toString();
}
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
d5728094c8931d3188f20ab4af452440928da085 | 3f3489bd05d0e10d7e75b2896435f0cb84aa3e3b | /src/main/java/com/wmh/programmeTransaction/service/UserService.java | 46cc7ab03e13d279a7cf8d05f41a23135fd3ef0e | [] | no_license | jpower/spring_demo | 4e8a8cd6421eb32b338d24fdebbd054499f6013c | 83d4142b3b7c3bacfce2a3c535b1c7f9ad1d224a | refs/heads/master | 2020-04-14T16:43:42.233760 | 2019-01-03T10:37:40 | 2019-01-03T10:37:40 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 170 | java | package com.wmh.programmeTransaction.service;
/**
* Created by 周大侠
* 2018-11-24 11:07
*/
public interface UserService {
void add(String id, String name);
}
| [
"wmh@qq.com"
] | wmh@qq.com |
176c563bc10dde6f776a3ce3a5724624ee5b750f | 38bd0b45910128fca06b0c259a47d8a216a82f41 | /javamaven/src/test/java/com/wednesday/app/AppTest.java | 30d6543d8ffd06ba2af1bfd76fdee800703a8250 | [] | no_license | sabnew/wednesdayselenium | ea5501358a04eff053a502d7caa594c2068f77e3 | 77101d6ddfd7cf2ed67c14901bf3c84a1d6dfd8d | refs/heads/master | 2021-06-26T05:06:44.563475 | 2017-09-13T19:36:46 | 2017-09-13T19:36:46 | 103,440,848 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 645 | java | package com.wednesday.app;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
/**
* Unit test for simple App.
*/
public class AppTest
extends TestCase
{
/**
* Create the test case
*
* @param testName name of the test case
*/
public AppTest( String testName )
{
super( testName );
}
/**
* @return the suite of tests being tested
*/
public static Test suite()
{
return new TestSuite( AppTest.class );
}
/**
* Rigourous Test :-)
*/
public void testApp()
{
assertTrue( true );
}
}
| [
"sabnew83@gmail.com"
] | sabnew83@gmail.com |
550d2d327db2f7bb80ebca3ea87209505ae080dd | b3c86261b27c7d802e77ae0fdad44c298893bc46 | /consume/src/main/java/com/consume/graphql/consume/service/IPersonajeService.java | 68113c744a66cac0738975a84f36812b7af53fd2 | [] | no_license | cristhian1820/consumographql | 1a1f9842d36a0dac4bde57f13a4e945c3f86c00a | 5aa9317b673370b291667ae427acbe2c1b87537c | refs/heads/main | 2023-01-20T04:55:33.844337 | 2020-12-01T17:35:32 | 2020-12-01T17:35:32 | 317,618,675 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 389 | java | package com.consume.graphql.consume.service;
import com.consume.graphql.consume.model.dto.InputPersonaje;
import com.consume.graphql.consume.model.dto.PersonajeDto;
import org.springframework.http.ResponseEntity;
import java.util.List;
public interface IPersonajeService {
ResponseEntity<String> obtenerPersonaje();
ResponseEntity <String> registrar(InputPersonaje input);
}
| [
"50779675+cristhian1820@users.noreply.github.com"
] | 50779675+cristhian1820@users.noreply.github.com |
3d3e7581e41d5f712455e11361ab74395d189368 | df2739817ea32ca8198effcd5e5928082b12c268 | /src/Child.java | 5aa0abc394b91157d4697119fbc959cfecf87dbf | [] | no_license | olasip/LearningJava | 320468568285e982e9f27efe37d1e35b8e443981 | f7ede171c114afd1ad7ceed5024dfd65f7798abc | refs/heads/master | 2020-03-18T22:25:02.392915 | 2018-06-14T12:23:46 | 2018-06-14T12:23:46 | 134,432,744 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 156 | java |
public class Child extends Parent {
public static void main(String[] args) {
Child c = new Child();
System.out.println(c.eyeColor);
}
}
| [
"aleksandrysip@gmail.com"
] | aleksandrysip@gmail.com |
d963221f79887edb32c2a76027ef7253b8f6af9d | 7ad843a5b11df711f58fdb8d44ed50ae134deca3 | /JDK/JDK1.8/src/java/lang/NumberFormatException.java | 16869b6d52d51caa9aa8443e5e0e5612dbee6834 | [
"MIT"
] | permissive | JavaScalaDeveloper/java-source | f014526ad7750ad76b46ff475869db6a12baeb4e | 0e6be345eaf46cfb5c64870207b4afb1073c6cd0 | refs/heads/main | 2023-07-01T22:32:58.116092 | 2021-07-26T06:42:32 | 2021-07-26T06:42:32 | 362,427,367 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,315 | java | /*
* Copyright (c) 1994, 2012, Oracle and/or its affiliates. All rights reserved.
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*/
package java.lang;
/**
* Thrown to indicate that the application has attempted to convert
* a string to one of the numeric types, but that the string does not
* have the appropriate format.
*
* @author unascribed
* @see java.lang.Integer#parseInt(String)
* @since JDK1.0
*/
public
class NumberFormatException extends IllegalArgumentException {
static final long serialVersionUID = -2848938806368998894L;
/**
* Constructs a <code>NumberFormatException</code> with no detail message.
*/
public NumberFormatException () {
super();
}
/**
* Constructs a <code>NumberFormatException</code> with the
* specified detail message.
*
* @param s the detail message.
*/
public NumberFormatException (String s) {
super (s);
}
/**
* Factory method for making a <code>NumberFormatException</code>
* given the specified input which caused the error.
*
* @param s the input causing the error
*/
static NumberFormatException forInputString(String s) {
return new NumberFormatException("For input string: \"" + s + "\"");
}
}
| [
"panzha@dian.so"
] | panzha@dian.so |
efff9f361c853511e362b8b4db1f89b4f95d1ad0 | 764419bfba54f2701729abbc4423e856c8d22f09 | /sm-shop/src/test/java/com/salesmanager/test/shop/integration/tax/TaxRateIntegrationTest.java | 70ba50cdc7b708932e19920ac3781af4367dce22 | [
"Apache-2.0"
] | permissive | shopizer-ecommerce/shopizer | 972c86b7bebc607bfa7b6138ddb47fa3c1e90cc7 | 054a3bde1ea8894d13b0a8fb4e28f9db17262224 | refs/heads/main | 2023-08-30T16:24:57.981774 | 2023-04-26T02:47:50 | 2023-04-26T02:47:50 | 6,789,509 | 3,532 | 3,174 | Apache-2.0 | 2023-09-13T14:37:38 | 2012-11-21T03:42:39 | Java | UTF-8 | Java | false | false | 4,195 | java | package com.salesmanager.test.shop.integration.tax;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import java.math.BigDecimal;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.test.context.junit4.SpringRunner;
import com.salesmanager.shop.application.ShopApplication;
import com.salesmanager.shop.model.entity.Entity;
import com.salesmanager.shop.model.entity.EntityExists;
import com.salesmanager.shop.model.tax.PersistableTaxClass;
import com.salesmanager.shop.model.tax.PersistableTaxRate;
import com.salesmanager.shop.model.tax.TaxRateDescription;
import com.salesmanager.test.shop.common.ServicesTestSupport;
@SpringBootTest(classes = ShopApplication.class, webEnvironment = WebEnvironment.RANDOM_PORT)
@RunWith(SpringRunner.class)
public class TaxRateIntegrationTest extends ServicesTestSupport {
@Test
public void manageTaxClass() throws Exception {
//create tax class
PersistableTaxClass taxClass = new PersistableTaxClass();
taxClass.setCode("TESTTX");
taxClass.setName("Test tax class");
final HttpEntity<PersistableTaxClass> taxClassEntity = new HttpEntity<>(taxClass, getHeader());
final ResponseEntity<Entity> response = testRestTemplate.postForEntity(String.format("/api/v1/private/tax/class/"), taxClassEntity, Entity.class);
Entity e = response.getBody();
assertNotNull(e.getId());
assertTrue(e.getId() > 0);
final HttpEntity<String> httpEntity = new HttpEntity<>(getHeader());
//tax class exists
final ResponseEntity<EntityExists> exists = testRestTemplate.exchange(String.format("/api/v1/private/tax/class/unique?code=" + taxClass.getCode()), HttpMethod.GET,
httpEntity, EntityExists.class);
assertTrue(exists.getBody().isExists());
/**
//list 1 taxClass
@SuppressWarnings("rawtypes")
final ResponseEntity<ReadableEntityList> listOfTaxClasses = testRestTemplate.exchange(String.format("/private/tax/class"), HttpMethod.GET,
httpEntity, ReadableEntityList.class);
assertTrue(listOfTaxClasses.getBody().getRecordsTotal() == 1);
**/
}
@Test
public void manageTaxRates() throws Exception {
//create tax class
PersistableTaxRate taxRate = new PersistableTaxRate();
taxRate.setCode("taxcode1");
taxRate.setCountry("US");
taxRate.setPriority(0);
taxRate.setRate(new BigDecimal(5));
taxRate.setStore("DEFAULT");
taxRate.setTaxClass("DEFAULT");
taxRate.setZone("NY");
//descriptions
TaxRateDescription en = new TaxRateDescription();
en.setLanguage("en");
en.setName("TaxCode1EN");
en.setDescription("TaxCode1EN description");
TaxRateDescription fr = new TaxRateDescription();
fr.setLanguage("fr");
fr.setName("TaxCode1FR");
fr.setDescription("TaxCode1fr description");
taxRate.getDescriptions().add(en);
taxRate.getDescriptions().add(fr);
final HttpEntity<PersistableTaxRate> taxClassEntity = new HttpEntity<>(taxRate, getHeader());
final ResponseEntity<Entity> response = testRestTemplate.postForEntity(String.format("/api/v1/private/tax/rate/"), taxClassEntity, Entity.class);
Entity e = response.getBody();
assertNotNull(e.getId());
assertTrue(e.getId() > 0);
final HttpEntity<String> httpEntity = new HttpEntity<>(getHeader());
//tax class exists
final ResponseEntity<EntityExists> exists = testRestTemplate.exchange(String.format("/api/v1/private/tax/rate/unique?code=" + taxRate.getCode()), HttpMethod.GET,
httpEntity, EntityExists.class);
assertTrue(exists.getBody().isExists());
}
}
| [
"csamson777@yahoo.com"
] | csamson777@yahoo.com |
0bb1cceb332f788090786be9a8210edda4fd43eb | 016570dccd8748b0e046fe4d1b2b5bd374cdc83a | /src/main/java/com/example/demo/ch2/event/package-info.java | 3cff90bb00cc99ad12c97db4195ed490a059cd20 | [] | no_license | Aoldfarmer/bootdemo | 6055619eae1cf473001f8506474b0f07e95496fc | 69977008fa8af8cfa6d26744933f19bbdf10ba85 | refs/heads/master | 2021-08-16T23:57:05.640702 | 2017-11-20T14:48:27 | 2017-11-20T14:48:27 | 111,067,015 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 35 | java | package com.example.demo.ch2.event; | [
"738648406@qq.com"
] | 738648406@qq.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.